Skip to content

Commit 4f2b7aa

Browse files
author
Adrien GIVRY
committed
Merge branch 'develop'
2 parents 40b5885 + 137b943 commit 4f2b7aa

File tree

79 files changed

+2819
-341
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+2819
-341
lines changed

Diff for: Resources/Editor/Models/Arrow.fbx

-34.4 KB
Binary file not shown.

Diff for: Resources/Editor/Models/Arrow_Rotate.fbx

36 KB
Binary file not shown.

Diff for: Resources/Editor/Models/Arrow_Scale.fbx

15.4 KB
Binary file not shown.

Diff for: Resources/Editor/Models/Arrow_Translate.fbx

15.8 KB
Binary file not shown.

Diff for: Sources/Overload/OvAnalytics/OvAnalytics.vcxproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@
1414
<VCProjectVersion>15.0</VCProjectVersion>
1515
<ProjectGuid>{45BFDD00-877F-42ED-A0E4-92E56F7D3C0E}</ProjectGuid>
1616
<RootNamespace>OvAnalytics</RootNamespace>
17-
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
17+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
1818
</PropertyGroup>
1919
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
2020
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
2121
<ConfigurationType>DynamicLibrary</ConfigurationType>
2222
<UseDebugLibraries>true</UseDebugLibraries>
23-
<PlatformToolset>v141</PlatformToolset>
23+
<PlatformToolset>v142</PlatformToolset>
2424
<CharacterSet>MultiByte</CharacterSet>
2525
</PropertyGroup>
2626
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
2727
<ConfigurationType>DynamicLibrary</ConfigurationType>
2828
<UseDebugLibraries>false</UseDebugLibraries>
29-
<PlatformToolset>v141</PlatformToolset>
29+
<PlatformToolset>v142</PlatformToolset>
3030
<WholeProgramOptimization>true</WholeProgramOptimization>
3131
<CharacterSet>MultiByte</CharacterSet>
3232
</PropertyGroup>

Diff for: Sources/Overload/OvAudio/OvAudio.vcxproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@
1414
<VCProjectVersion>15.0</VCProjectVersion>
1515
<ProjectGuid>{E76098C7-D1C1-430E-A7B2-527CF45BD853}</ProjectGuid>
1616
<RootNamespace>OvAudio</RootNamespace>
17-
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
17+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
1818
</PropertyGroup>
1919
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
2020
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
2121
<ConfigurationType>DynamicLibrary</ConfigurationType>
2222
<UseDebugLibraries>true</UseDebugLibraries>
23-
<PlatformToolset>v141</PlatformToolset>
23+
<PlatformToolset>v142</PlatformToolset>
2424
<CharacterSet>MultiByte</CharacterSet>
2525
</PropertyGroup>
2626
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
2727
<ConfigurationType>DynamicLibrary</ConfigurationType>
2828
<UseDebugLibraries>false</UseDebugLibraries>
29-
<PlatformToolset>v141</PlatformToolset>
29+
<PlatformToolset>v142</PlatformToolset>
3030
<WholeProgramOptimization>true</WholeProgramOptimization>
3131
<CharacterSet>MultiByte</CharacterSet>
3232
</PropertyGroup>

Diff for: Sources/Overload/OvCore/OvCore.vcxproj

+5-5
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@
1414
<VCProjectVersion>15.0</VCProjectVersion>
1515
<ProjectGuid>{C1D2EBB7-EE2A-4D42-858B-F14F5A47B867}</ProjectGuid>
1616
<RootNamespace>OvCore</RootNamespace>
17-
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
17+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
1818
</PropertyGroup>
1919
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
2020
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
2121
<ConfigurationType>DynamicLibrary</ConfigurationType>
2222
<UseDebugLibraries>true</UseDebugLibraries>
23-
<PlatformToolset>v141</PlatformToolset>
23+
<PlatformToolset>v142</PlatformToolset>
2424
<CharacterSet>MultiByte</CharacterSet>
2525
</PropertyGroup>
2626
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
2727
<ConfigurationType>DynamicLibrary</ConfigurationType>
2828
<UseDebugLibraries>false</UseDebugLibraries>
29-
<PlatformToolset>v141</PlatformToolset>
29+
<PlatformToolset>v142</PlatformToolset>
3030
<WholeProgramOptimization>true</WholeProgramOptimization>
3131
<CharacterSet>MultiByte</CharacterSet>
3232
</PropertyGroup>
@@ -123,7 +123,7 @@ xcopy "$(SolutionDir)..\..\Build\OvWindowing\bin\$(Configuration)\*.dll" "$(Solu
123123
xcopy "$(SolutionDir)..\..\Build\OvWindowing\lib\$(Configuration)\*.lib" "$(SolutionDir)..\..\Build\$(ProjectName)\lib\$(Configuration)" /e /y /i /r</Command>
124124
</PostBuildEvent>
125125
<Link>
126-
<AdditionalDependencies>liblua53.a;OvMaths.lib;OvPhysics.lib;OvRendering.lib;OvTools.lib;OvUI.lib;OvAudio.lib;OvDebug.lib;OvWindowing.lib;%(AdditionalDependencies)</AdditionalDependencies>
126+
<AdditionalDependencies>liblua53.a;OvMaths.lib;OvPhysics.lib;OvRendering.lib;OvTools.lib;OvUI.lib;OvAudio.lib;OvDebug.lib;OvWindowing.lib;OvAnalytics.lib;%(AdditionalDependencies)</AdditionalDependencies>
127127
</Link>
128128
</ItemDefinitionGroup>
129129
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@@ -140,7 +140,7 @@ xcopy "$(SolutionDir)..\..\Build\OvWindowing\lib\$(Configuration)\*.lib" "$(Solu
140140
<Link>
141141
<EnableCOMDATFolding>true</EnableCOMDATFolding>
142142
<OptimizeReferences>true</OptimizeReferences>
143-
<AdditionalDependencies>liblua53.a;OvMaths.lib;OvPhysics.lib;OvRendering.lib;OvTools.lib;OvUI.lib;OvAudio.lib;OvDebug.lib;OvWindowing.lib;%(AdditionalDependencies)</AdditionalDependencies>
143+
<AdditionalDependencies>liblua53.a;OvMaths.lib;OvPhysics.lib;OvRendering.lib;OvTools.lib;OvUI.lib;OvAudio.lib;OvDebug.lib;OvWindowing.lib;OvAnalytics.lib;%(AdditionalDependencies)</AdditionalDependencies>
144144
</Link>
145145
<PostBuildEvent>
146146
<Command>RD /S /Q "$(SolutionDir)..\..\Build\$(ProjectName)\include"

Diff for: Sources/Overload/OvCore/include/OvCore/ECS/Components/Behaviour.inl

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
#pragma once
88

9+
10+
#include <OvDebug/Utils/Logger.h>
11+
912
#include "OvCore/ECS/Components/Behaviour.h"
1013

1114
namespace OvCore::ECS::Components

Diff for: Sources/Overload/OvCore/include/OvCore/ECS/Components/CCamera.h

+22-12
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,6 @@ namespace OvCore::ECS::Components
3535
*/
3636
std::string GetName() override;
3737

38-
/**
39-
* Returns the projection matrix
40-
* @param p_windowWidth
41-
* @param p_windowHeight
42-
*/
43-
OvMaths::FMatrix4 GetProjectionMatrix(uint16_t p_windowWidth, uint16_t p_windowHeight);
44-
45-
/**
46-
* Returns the view matrix
47-
*/
48-
OvMaths::FMatrix4 GetViewMatrix();
49-
5038
/**
5139
* Sets the fov of the camera to the given value
5240
* @param p_value
@@ -71,6 +59,18 @@ namespace OvCore::ECS::Components
7159
*/
7260
void SetClearColor(const OvMaths::FVector3& p_clearColor);
7361

62+
/**
63+
* Defines if the camera should apply frustum geometry culling in rendering
64+
* @param p_enable
65+
*/
66+
void SetFrustumGeometryCulling(bool p_enable);
67+
68+
/**
69+
* Defines if the camera should apply frustum light culling in rendering
70+
* @param p_enable
71+
*/
72+
void SetFrustumLightCulling(bool p_enable);
73+
7474
/**
7575
* Returns the fov of the camera
7676
*/
@@ -91,6 +91,16 @@ namespace OvCore::ECS::Components
9191
*/
9292
const OvMaths::FVector3& GetClearColor() const;
9393

94+
/**
95+
* Returns true if the frustum geometry culling is enabled
96+
*/
97+
bool HasFrustumGeometryCulling() const;
98+
99+
/**
100+
* Returns true if the frustum light culling is enabled
101+
*/
102+
bool HasFrustumLightCulling() const;
103+
94104
/**
95105
* Returns the OvRendering camera instance attached to this component
96106
*/

Diff for: Sources/Overload/OvCore/include/OvCore/ECS/Components/CModelRenderer.h

+35
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,17 @@ namespace OvCore::ECS::Components
2121
class API_OVCORE CModelRenderer : public AComponent
2222
{
2323
public:
24+
/**
25+
* Defines how the model renderer bounding sphere should be interpreted
26+
*/
27+
enum class EFrustumBehaviour
28+
{
29+
DISABLED = 0,
30+
CULL_MODEL = 1,
31+
CULL_MESHES = 2,
32+
CULL_CUSTOM = 3
33+
};
34+
2435
/**
2536
* Constructor
2637
* @param p_owner
@@ -43,6 +54,28 @@ namespace OvCore::ECS::Components
4354
*/
4455
OvRendering::Resources::Model* GetModel() const;
4556

57+
/**
58+
* Sets a bounding mode
59+
* @param p_boundingMode
60+
*/
61+
void SetFrustumBehaviour(EFrustumBehaviour p_boundingMode);
62+
63+
/**
64+
* Returns the current bounding mode
65+
*/
66+
EFrustumBehaviour GetFrustumBehaviour() const;
67+
68+
/**
69+
* Returns the custom bounding sphere
70+
*/
71+
const OvRendering::Geometry::BoundingSphere& GetCustomBoundingSphere() const;
72+
73+
/**
74+
* Sets the custom bounding sphere
75+
* @param p_boundingSphere
76+
*/
77+
void SetCustomBoundingSphere(const OvRendering::Geometry::BoundingSphere& p_boundingSphere);
78+
4679
/**
4780
* Serialize the component
4881
* @param p_doc
@@ -66,5 +99,7 @@ namespace OvCore::ECS::Components
6699
private:
67100
OvRendering::Resources::Model* m_model = nullptr;
68101
OvTools::Eventing::Event<> m_modelChangedEvent;
102+
OvRendering::Geometry::BoundingSphere m_customBoundingSphere = { {}, 1.0f };
103+
EFrustumBehaviour m_frustumBehaviour = EFrustumBehaviour::CULL_MODEL;
69104
};
70105
}

Diff for: Sources/Overload/OvCore/include/OvCore/ECS/Renderer.h

+41-9
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include <OvRendering/Core/Renderer.h>
1212
#include <OvRendering/Resources/Mesh.h>
13+
#include <OvRendering/Data/Frustum.h>
1314

1415
#include "OvCore/API/Export.h"
1516
#include "OvCore/Resources/Material.h"
@@ -51,29 +52,60 @@ namespace OvCore::ECS
5152
/**
5253
* Fill the given FMatrix4 vector with lights information
5354
* @param p_scene
54-
* @param p_out
5555
*/
56-
void FindLightMatrices(const OvCore::SceneSystem::Scene& p_scene, std::vector<OvMaths::FMatrix4>& p_out);
56+
std::vector<OvMaths::FMatrix4> FindLightMatrices(const OvCore::SceneSystem::Scene& p_scene);
57+
58+
/**
59+
* Fill the given FMatrix4 vector with lights information that are inside the frustum
60+
* @param p_scene
61+
* @param p_frustum
62+
*/
63+
std::vector<OvMaths::FMatrix4> FindLightMatricesInFrustum(const OvCore::SceneSystem::Scene& p_scene, const OvRendering::Data::Frustum& p_frustum);
5764

5865
/**
5966
* Draw the given scene using the given default material (optional) if no material found on an actor
6067
* @param p_scene
6168
* @param p_cameraPosition
69+
* @param p_camera
70+
* @param p_customFrustum
71+
* @param p_defaultMaterial
72+
*/
73+
void RenderScene
74+
(
75+
OvCore::SceneSystem::Scene& p_scene,
76+
const OvMaths::FVector3& p_cameraPosition,
77+
const OvRendering::LowRenderer::Camera& p_camera,
78+
const OvRendering::Data::Frustum* p_customFrustum = nullptr,
79+
OvCore::Resources::Material* p_defaultMaterial = nullptr
80+
);
81+
82+
/**
83+
* Returns opaque and transparents drawables from the scene with frustum culling
84+
* @param p_scene
85+
* @param p_cameraPosition
86+
* @param p_frustum
6287
* @param p_defaultMaterial
6388
*/
64-
void RenderScene(OvCore::SceneSystem::Scene& p_scene, const OvMaths::FVector3& p_cameraPosition, Resources::Material* p_defaultMaterial = nullptr);
89+
std::pair<OpaqueDrawables, TransparentDrawables> FindAndSortFrustumCulledDrawables
90+
(
91+
const OvCore::SceneSystem::Scene& p_scene,
92+
const OvMaths::FVector3& p_cameraPosition,
93+
const OvRendering::Data::Frustum& p_frustum,
94+
OvCore::Resources::Material* p_defaultMaterial
95+
);
6596

6697
/**
67-
* Find every drawables objects in the scene. Sorting order:
68-
* - Opaques (Front to back)
69-
* - Transparents (Back to front)
70-
* @param p_opaques
71-
* @param p_transparents
98+
* Returns opaque and transparents drawables from the scene
7299
* @param p_scene
73100
* @param p_cameraPosition
74101
* @param p_defaultMaterial
75102
*/
76-
void FindAndSortDrawables(OpaqueDrawables& p_opaques, TransparentDrawables& p_transparents, const OvCore::SceneSystem::Scene& p_scene, const OvMaths::FVector3& p_cameraPosition, Resources::Material* p_defaultMaterial = nullptr);
103+
std::pair<OpaqueDrawables, TransparentDrawables> FindAndSortDrawables
104+
(
105+
const OvCore::SceneSystem::Scene& p_scene,
106+
const OvMaths::FVector3& p_cameraPosition,
107+
OvCore::Resources::Material* p_defaultMaterial
108+
);
77109

78110
/**
79111
* Draw a Drawable instance

Diff for: Sources/Overload/OvCore/src/OvCore/ECS/Components/CCamera.cpp

+27-12
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,6 @@ std::string OvCore::ECS::Components::CCamera::GetName()
3535
return "Camera";
3636
}
3737

38-
39-
OvMaths::FMatrix4 OvCore::ECS::Components::CCamera::GetProjectionMatrix(uint16_t p_windowWidth, uint16_t p_windowHeight)
40-
{
41-
return m_camera.GetProjectionMatrix(p_windowWidth, p_windowHeight);
42-
}
43-
44-
OvMaths::FMatrix4 OvCore::ECS::Components::CCamera::GetViewMatrix()
45-
{
46-
return m_camera.GetViewMatrix(owner.transform.GetWorldPosition());
47-
}
48-
4938
void OvCore::ECS::Components::CCamera::SetFov(float p_value)
5039
{
5140
m_camera.SetFov(p_value);
@@ -61,6 +50,16 @@ void OvCore::ECS::Components::CCamera::SetFar(float p_value)
6150
m_camera.SetFar(p_value);
6251
}
6352

53+
void OvCore::ECS::Components::CCamera::SetFrustumGeometryCulling(bool p_enable)
54+
{
55+
m_camera.SetFrustumGeometryCulling(p_enable);
56+
}
57+
58+
void OvCore::ECS::Components::CCamera::SetFrustumLightCulling(bool p_enable)
59+
{
60+
m_camera.SetFrustumLightCulling(p_enable);
61+
}
62+
6463
float OvCore::ECS::Components::CCamera::GetFov() const
6564
{
6665
return m_camera.GetFov();
@@ -81,11 +80,21 @@ const OvMaths::FVector3 & OvCore::ECS::Components::CCamera::GetClearColor() cons
8180
return m_camera.GetClearColor();
8281
}
8382

83+
bool OvCore::ECS::Components::CCamera::HasFrustumGeometryCulling() const
84+
{
85+
return m_camera.HasFrustumGeometryCulling();
86+
}
87+
8488
void OvCore::ECS::Components::CCamera::SetClearColor(const OvMaths::FVector3 & p_clearColor)
8589
{
8690
m_camera.SetClearColor(p_clearColor);
8791
}
8892

93+
bool OvCore::ECS::Components::CCamera::HasFrustumLightCulling() const
94+
{
95+
return m_camera.HasFrustumLightCulling();
96+
}
97+
8998
OvRendering::LowRenderer::Camera & OvCore::ECS::Components::CCamera::GetCamera()
9099
{
91100
return m_camera;
@@ -97,14 +106,18 @@ void OvCore::ECS::Components::CCamera::OnSerialize(tinyxml2::XMLDocument & p_doc
97106
OvCore::Helpers::Serializer::SerializeFloat(p_doc, p_node, "near", m_camera.GetNear());
98107
OvCore::Helpers::Serializer::SerializeFloat(p_doc, p_node, "far", m_camera.GetFar());
99108
OvCore::Helpers::Serializer::SerializeVec3(p_doc, p_node, "clear_color", m_camera.GetClearColor());
109+
OvCore::Helpers::Serializer::SerializeBoolean(p_doc, p_node, "frustum_geometry_culling", m_camera.HasFrustumGeometryCulling());
110+
OvCore::Helpers::Serializer::SerializeBoolean(p_doc, p_node, "frustum_light_culling", m_camera.HasFrustumLightCulling());
100111
}
101112

102113
void OvCore::ECS::Components::CCamera::OnDeserialize(tinyxml2::XMLDocument & p_doc, tinyxml2::XMLNode * p_node)
103114
{
104115
m_camera.SetFov(OvCore::Helpers::Serializer::DeserializeFloat(p_doc, p_node, "fov"));
105116
m_camera.SetNear(OvCore::Helpers::Serializer::DeserializeFloat(p_doc, p_node, "near"));
106117
m_camera.SetFar(OvCore::Helpers::Serializer::DeserializeFloat(p_doc, p_node, "far"));
107-
SetClearColor(OvCore::Helpers::Serializer::DeserializeVec3(p_doc, p_node, "clear_color"));
118+
m_camera.SetClearColor(OvCore::Helpers::Serializer::DeserializeVec3(p_doc, p_node, "clear_color"));
119+
m_camera.SetFrustumGeometryCulling(OvCore::Helpers::Serializer::DeserializeBoolean(p_doc, p_node, "frustum_geometry_culling"));
120+
m_camera.SetFrustumLightCulling(OvCore::Helpers::Serializer::DeserializeBoolean(p_doc, p_node, "frustum_light_culling"));
108121
}
109122

110123
void OvCore::ECS::Components::CCamera::OnInspector(OvUI::Internal::WidgetContainer& p_root)
@@ -113,4 +126,6 @@ void OvCore::ECS::Components::CCamera::OnInspector(OvUI::Internal::WidgetContain
113126
OvCore::Helpers::GUIDrawer::DrawScalar<float>(p_root, "Near", std::bind(&CCamera::GetNear, this), std::bind(&CCamera::SetNear, this, std::placeholders::_1));
114127
OvCore::Helpers::GUIDrawer::DrawScalar<float>(p_root, "Far", std::bind(&CCamera::GetFar, this), std::bind(&CCamera::SetFar, this, std::placeholders::_1));
115128
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);
129+
OvCore::Helpers::GUIDrawer::DrawBoolean(p_root, "Frustum Geometry Culling", std::bind(&CCamera::HasFrustumGeometryCulling, this), std::bind(&CCamera::SetFrustumGeometryCulling, this, std::placeholders::_1));
130+
OvCore::Helpers::GUIDrawer::DrawBoolean(p_root, "Frustum Light Culling", std::bind(&CCamera::HasFrustumLightCulling, this), std::bind(&CCamera::SetFrustumLightCulling, this, std::placeholders::_1));
116131
}

0 commit comments

Comments
 (0)