Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrien GIVRY committed Sep 19, 2019
2 parents 40b5885 + 137b943 commit 4f2b7aa
Show file tree
Hide file tree
Showing 79 changed files with 2,819 additions and 341 deletions.
Binary file removed Resources/Editor/Models/Arrow.fbx
Binary file not shown.
Binary file added Resources/Editor/Models/Arrow_Rotate.fbx
Binary file not shown.
Binary file added Resources/Editor/Models/Arrow_Scale.fbx
Binary file not shown.
Binary file added Resources/Editor/Models/Arrow_Translate.fbx
Binary file not shown.
6 changes: 3 additions & 3 deletions Sources/Overload/OvAnalytics/OvAnalytics.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{45BFDD00-877F-42ED-A0E4-92E56F7D3C0E}</ProjectGuid>
<RootNamespace>OvAnalytics</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
Expand Down
6 changes: 3 additions & 3 deletions Sources/Overload/OvAudio/OvAudio.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{E76098C7-D1C1-430E-A7B2-527CF45BD853}</ProjectGuid>
<RootNamespace>OvAudio</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
Expand Down
10 changes: 5 additions & 5 deletions Sources/Overload/OvCore/OvCore.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{C1D2EBB7-EE2A-4D42-858B-F14F5A47B867}</ProjectGuid>
<RootNamespace>OvCore</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
Expand Down Expand Up @@ -123,7 +123,7 @@ xcopy "$(SolutionDir)..\..\Build\OvWindowing\bin\$(Configuration)\*.dll" "$(Solu
xcopy "$(SolutionDir)..\..\Build\OvWindowing\lib\$(Configuration)\*.lib" "$(SolutionDir)..\..\Build\$(ProjectName)\lib\$(Configuration)" /e /y /i /r</Command>
</PostBuildEvent>
<Link>
<AdditionalDependencies>liblua53.a;OvMaths.lib;OvPhysics.lib;OvRendering.lib;OvTools.lib;OvUI.lib;OvAudio.lib;OvDebug.lib;OvWindowing.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>liblua53.a;OvMaths.lib;OvPhysics.lib;OvRendering.lib;OvTools.lib;OvUI.lib;OvAudio.lib;OvDebug.lib;OvWindowing.lib;OvAnalytics.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand All @@ -140,7 +140,7 @@ xcopy "$(SolutionDir)..\..\Build\OvWindowing\lib\$(Configuration)\*.lib" "$(Solu
<Link>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>liblua53.a;OvMaths.lib;OvPhysics.lib;OvRendering.lib;OvTools.lib;OvUI.lib;OvAudio.lib;OvDebug.lib;OvWindowing.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>liblua53.a;OvMaths.lib;OvPhysics.lib;OvRendering.lib;OvTools.lib;OvUI.lib;OvAudio.lib;OvDebug.lib;OvWindowing.lib;OvAnalytics.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PostBuildEvent>
<Command>RD /S /Q "$(SolutionDir)..\..\Build\$(ProjectName)\include"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

#pragma once


#include <OvDebug/Utils/Logger.h>

#include "OvCore/ECS/Components/Behaviour.h"

namespace OvCore::ECS::Components
Expand Down
34 changes: 22 additions & 12 deletions Sources/Overload/OvCore/include/OvCore/ECS/Components/CCamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,6 @@ namespace OvCore::ECS::Components
*/
std::string GetName() override;

/**
* Returns the projection matrix
* @param p_windowWidth
* @param p_windowHeight
*/
OvMaths::FMatrix4 GetProjectionMatrix(uint16_t p_windowWidth, uint16_t p_windowHeight);

/**
* Returns the view matrix
*/
OvMaths::FMatrix4 GetViewMatrix();

/**
* Sets the fov of the camera to the given value
* @param p_value
Expand All @@ -71,6 +59,18 @@ namespace OvCore::ECS::Components
*/
void SetClearColor(const OvMaths::FVector3& p_clearColor);

/**
* Defines if the camera should apply frustum geometry culling in rendering
* @param p_enable
*/
void SetFrustumGeometryCulling(bool p_enable);

/**
* Defines if the camera should apply frustum light culling in rendering
* @param p_enable
*/
void SetFrustumLightCulling(bool p_enable);

/**
* Returns the fov of the camera
*/
Expand All @@ -91,6 +91,16 @@ namespace OvCore::ECS::Components
*/
const OvMaths::FVector3& GetClearColor() const;

/**
* Returns true if the frustum geometry culling is enabled
*/
bool HasFrustumGeometryCulling() const;

/**
* Returns true if the frustum light culling is enabled
*/
bool HasFrustumLightCulling() const;

/**
* Returns the OvRendering camera instance attached to this component
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,17 @@ namespace OvCore::ECS::Components
class API_OVCORE CModelRenderer : public AComponent
{
public:
/**
* Defines how the model renderer bounding sphere should be interpreted
*/
enum class EFrustumBehaviour
{
DISABLED = 0,
CULL_MODEL = 1,
CULL_MESHES = 2,
CULL_CUSTOM = 3
};

/**
* Constructor
* @param p_owner
Expand All @@ -43,6 +54,28 @@ namespace OvCore::ECS::Components
*/
OvRendering::Resources::Model* GetModel() const;

/**
* Sets a bounding mode
* @param p_boundingMode
*/
void SetFrustumBehaviour(EFrustumBehaviour p_boundingMode);

/**
* Returns the current bounding mode
*/
EFrustumBehaviour GetFrustumBehaviour() const;

/**
* Returns the custom bounding sphere
*/
const OvRendering::Geometry::BoundingSphere& GetCustomBoundingSphere() const;

/**
* Sets the custom bounding sphere
* @param p_boundingSphere
*/
void SetCustomBoundingSphere(const OvRendering::Geometry::BoundingSphere& p_boundingSphere);

/**
* Serialize the component
* @param p_doc
Expand All @@ -66,5 +99,7 @@ namespace OvCore::ECS::Components
private:
OvRendering::Resources::Model* m_model = nullptr;
OvTools::Eventing::Event<> m_modelChangedEvent;
OvRendering::Geometry::BoundingSphere m_customBoundingSphere = { {}, 1.0f };
EFrustumBehaviour m_frustumBehaviour = EFrustumBehaviour::CULL_MODEL;
};
}
50 changes: 41 additions & 9 deletions Sources/Overload/OvCore/include/OvCore/ECS/Renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <OvRendering/Core/Renderer.h>
#include <OvRendering/Resources/Mesh.h>
#include <OvRendering/Data/Frustum.h>

#include "OvCore/API/Export.h"
#include "OvCore/Resources/Material.h"
Expand Down Expand Up @@ -51,29 +52,60 @@ namespace OvCore::ECS
/**
* Fill the given FMatrix4 vector with lights information
* @param p_scene
* @param p_out
*/
void FindLightMatrices(const OvCore::SceneSystem::Scene& p_scene, std::vector<OvMaths::FMatrix4>& p_out);
std::vector<OvMaths::FMatrix4> FindLightMatrices(const OvCore::SceneSystem::Scene& p_scene);

/**
* Fill the given FMatrix4 vector with lights information that are inside the frustum
* @param p_scene
* @param p_frustum
*/
std::vector<OvMaths::FMatrix4> FindLightMatricesInFrustum(const OvCore::SceneSystem::Scene& p_scene, const OvRendering::Data::Frustum& p_frustum);

/**
* Draw the given scene using the given default material (optional) if no material found on an actor
* @param p_scene
* @param p_cameraPosition
* @param p_camera
* @param p_customFrustum
* @param p_defaultMaterial
*/
void RenderScene
(
OvCore::SceneSystem::Scene& p_scene,
const OvMaths::FVector3& p_cameraPosition,
const OvRendering::LowRenderer::Camera& p_camera,
const OvRendering::Data::Frustum* p_customFrustum = nullptr,
OvCore::Resources::Material* p_defaultMaterial = nullptr
);

/**
* Returns opaque and transparents drawables from the scene with frustum culling
* @param p_scene
* @param p_cameraPosition
* @param p_frustum
* @param p_defaultMaterial
*/
void RenderScene(OvCore::SceneSystem::Scene& p_scene, const OvMaths::FVector3& p_cameraPosition, Resources::Material* p_defaultMaterial = nullptr);
std::pair<OpaqueDrawables, TransparentDrawables> FindAndSortFrustumCulledDrawables
(
const OvCore::SceneSystem::Scene& p_scene,
const OvMaths::FVector3& p_cameraPosition,
const OvRendering::Data::Frustum& p_frustum,
OvCore::Resources::Material* p_defaultMaterial
);

/**
* Find every drawables objects in the scene. Sorting order:
* - Opaques (Front to back)
* - Transparents (Back to front)
* @param p_opaques
* @param p_transparents
* Returns opaque and transparents drawables from the scene
* @param p_scene
* @param p_cameraPosition
* @param p_defaultMaterial
*/
void FindAndSortDrawables(OpaqueDrawables& p_opaques, TransparentDrawables& p_transparents, const OvCore::SceneSystem::Scene& p_scene, const OvMaths::FVector3& p_cameraPosition, Resources::Material* p_defaultMaterial = nullptr);
std::pair<OpaqueDrawables, TransparentDrawables> FindAndSortDrawables
(
const OvCore::SceneSystem::Scene& p_scene,
const OvMaths::FVector3& p_cameraPosition,
OvCore::Resources::Material* p_defaultMaterial
);

/**
* Draw a Drawable instance
Expand Down
39 changes: 27 additions & 12 deletions Sources/Overload/OvCore/src/OvCore/ECS/Components/CCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,6 @@ std::string OvCore::ECS::Components::CCamera::GetName()
return "Camera";
}


OvMaths::FMatrix4 OvCore::ECS::Components::CCamera::GetProjectionMatrix(uint16_t p_windowWidth, uint16_t p_windowHeight)
{
return m_camera.GetProjectionMatrix(p_windowWidth, p_windowHeight);
}

OvMaths::FMatrix4 OvCore::ECS::Components::CCamera::GetViewMatrix()
{
return m_camera.GetViewMatrix(owner.transform.GetWorldPosition());
}

void OvCore::ECS::Components::CCamera::SetFov(float p_value)
{
m_camera.SetFov(p_value);
Expand All @@ -61,6 +50,16 @@ void OvCore::ECS::Components::CCamera::SetFar(float p_value)
m_camera.SetFar(p_value);
}

void OvCore::ECS::Components::CCamera::SetFrustumGeometryCulling(bool p_enable)
{
m_camera.SetFrustumGeometryCulling(p_enable);
}

void OvCore::ECS::Components::CCamera::SetFrustumLightCulling(bool p_enable)
{
m_camera.SetFrustumLightCulling(p_enable);
}

float OvCore::ECS::Components::CCamera::GetFov() const
{
return m_camera.GetFov();
Expand All @@ -81,11 +80,21 @@ const OvMaths::FVector3 & OvCore::ECS::Components::CCamera::GetClearColor() cons
return m_camera.GetClearColor();
}

bool OvCore::ECS::Components::CCamera::HasFrustumGeometryCulling() const
{
return m_camera.HasFrustumGeometryCulling();
}

void OvCore::ECS::Components::CCamera::SetClearColor(const OvMaths::FVector3 & p_clearColor)
{
m_camera.SetClearColor(p_clearColor);
}

bool OvCore::ECS::Components::CCamera::HasFrustumLightCulling() const
{
return m_camera.HasFrustumLightCulling();
}

OvRendering::LowRenderer::Camera & OvCore::ECS::Components::CCamera::GetCamera()
{
return m_camera;
Expand All @@ -97,14 +106,18 @@ void OvCore::ECS::Components::CCamera::OnSerialize(tinyxml2::XMLDocument & p_doc
OvCore::Helpers::Serializer::SerializeFloat(p_doc, p_node, "near", m_camera.GetNear());
OvCore::Helpers::Serializer::SerializeFloat(p_doc, p_node, "far", m_camera.GetFar());
OvCore::Helpers::Serializer::SerializeVec3(p_doc, p_node, "clear_color", m_camera.GetClearColor());
OvCore::Helpers::Serializer::SerializeBoolean(p_doc, p_node, "frustum_geometry_culling", m_camera.HasFrustumGeometryCulling());
OvCore::Helpers::Serializer::SerializeBoolean(p_doc, p_node, "frustum_light_culling", m_camera.HasFrustumLightCulling());
}

void OvCore::ECS::Components::CCamera::OnDeserialize(tinyxml2::XMLDocument & p_doc, tinyxml2::XMLNode * p_node)
{
m_camera.SetFov(OvCore::Helpers::Serializer::DeserializeFloat(p_doc, p_node, "fov"));
m_camera.SetNear(OvCore::Helpers::Serializer::DeserializeFloat(p_doc, p_node, "near"));
m_camera.SetFar(OvCore::Helpers::Serializer::DeserializeFloat(p_doc, p_node, "far"));
SetClearColor(OvCore::Helpers::Serializer::DeserializeVec3(p_doc, p_node, "clear_color"));
m_camera.SetClearColor(OvCore::Helpers::Serializer::DeserializeVec3(p_doc, p_node, "clear_color"));
m_camera.SetFrustumGeometryCulling(OvCore::Helpers::Serializer::DeserializeBoolean(p_doc, p_node, "frustum_geometry_culling"));
m_camera.SetFrustumLightCulling(OvCore::Helpers::Serializer::DeserializeBoolean(p_doc, p_node, "frustum_light_culling"));
}

void OvCore::ECS::Components::CCamera::OnInspector(OvUI::Internal::WidgetContainer& p_root)
Expand All @@ -113,4 +126,6 @@ void OvCore::ECS::Components::CCamera::OnInspector(OvUI::Internal::WidgetContain
OvCore::Helpers::GUIDrawer::DrawScalar<float>(p_root, "Near", std::bind(&CCamera::GetNear, this), std::bind(&CCamera::SetNear, this, std::placeholders::_1));
OvCore::Helpers::GUIDrawer::DrawScalar<float>(p_root, "Far", std::bind(&CCamera::GetFar, this), std::bind(&CCamera::SetFar, this, std::placeholders::_1));
OvCore::Helpers::GUIDrawer::DrawColor(p_root, "Clear color", [this]() {return reinterpret_cast<const OvUI::Types::Color&>(GetClearColor()); }, [this](OvUI::Types::Color p_color) { SetClearColor({ p_color.r, p_color.g, p_color.b }); }, false);
OvCore::Helpers::GUIDrawer::DrawBoolean(p_root, "Frustum Geometry Culling", std::bind(&CCamera::HasFrustumGeometryCulling, this), std::bind(&CCamera::SetFrustumGeometryCulling, this, std::placeholders::_1));
OvCore::Helpers::GUIDrawer::DrawBoolean(p_root, "Frustum Light Culling", std::bind(&CCamera::HasFrustumLightCulling, this), std::bind(&CCamera::SetFrustumLightCulling, this, std::placeholders::_1));
}
Loading

0 comments on commit 4f2b7aa

Please sign in to comment.