Minor - Smart pointer and switch from composition to aggregation for object relation with modelclass - V11.3.0
This commit is contained in:
56
.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
generated
56
.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
generated
@@ -6,8 +6,19 @@
|
|||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="e81d6e08-efc7-40a0-909d-ec4943d948e9" name="Changes" comment="">
|
<list default="true" id="e81d6e08-efc7-40a0-909d-ec4943d948e9" name="Changes" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/enginecustom/assets/Texture/imgui.ini" beforeDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/enginecustom/assets/imgui.ini" beforeDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/imgui.ini" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/imgui.ini" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/enginecustom/imgui.ini" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/imgui.ini" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/application_class.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/application_class.h" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/imguiManager.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/imguiManager.h" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/object.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/object.h" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/system_class.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/system_class.h" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/application_class.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/application_class.cpp" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/imguiManager.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/imguiManager.cpp" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/object.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/object.cpp" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/scene_manager.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/scene_manager.cpp" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/stats.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/stats.cpp" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/system_class.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/system_class.cpp" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -53,26 +64,26 @@
|
|||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
<option name="hideEmptyMiddlePackages" value="true" />
|
||||||
<option name="showLibraryContents" value="true" />
|
<option name="showLibraryContents" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="PropertiesComponent"><![CDATA[{
|
<component name="PropertiesComponent">{
|
||||||
"keyToString": {
|
"keyToString": {
|
||||||
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||||
"C++ Project.enginecustom.executor": "Run",
|
"C++ Project.enginecustom.executor": "Run",
|
||||||
"C/C++ Project.KhaoticDemo.executor": "Run",
|
"C/C++ Project.KhaoticDemo.executor": "Run",
|
||||||
"C/C++ Project.enginecustom.executor": "Run",
|
"C/C++ Project.enginecustom.executor": "Run",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"RunOnceActivity.git.unshallow": "true",
|
"RunOnceActivity.git.unshallow": "true",
|
||||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||||
"git-widget-placeholder": "main",
|
"git-widget-placeholder": "main",
|
||||||
"ignore.virus.scanning.warn.message": "true",
|
"ignore.virus.scanning.warn.message": "true",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
"node.js.detected.package.tslint": "true",
|
"node.js.detected.package.tslint": "true",
|
||||||
"node.js.selected.package.eslint": "(autodetect)",
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
"node.js.selected.package.tslint": "(autodetect)",
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
"nodejs_package_manager_path": "npm",
|
"nodejs_package_manager_path": "npm",
|
||||||
"settings.editor.selected.configurable": "preferences.pluginManager",
|
"settings.editor.selected.configurable": "preferences.pluginManager",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"vue.rearranger.settings.migration": "true"
|
||||||
}
|
}
|
||||||
}]]></component>
|
}</component>
|
||||||
<component name="RunManager" selected="C/C++ Project.enginecustom">
|
<component name="RunManager" selected="C/C++ Project.enginecustom">
|
||||||
<configuration name="KhaoticDemo" type="CppProject" factoryName="C++ Project">
|
<configuration name="KhaoticDemo" type="CppProject" factoryName="C++ Project">
|
||||||
<configuration_1 setup="1">
|
<configuration_1 setup="1">
|
||||||
@@ -213,6 +224,11 @@
|
|||||||
<workItem from="1748869642637" duration="3049000" />
|
<workItem from="1748869642637" duration="3049000" />
|
||||||
<workItem from="1748954607174" duration="14202000" />
|
<workItem from="1748954607174" duration="14202000" />
|
||||||
<workItem from="1748969487337" duration="402000" />
|
<workItem from="1748969487337" duration="402000" />
|
||||||
|
<workItem from="1750187491423" duration="4397000" />
|
||||||
|
<workItem from="1750191969842" duration="162000" />
|
||||||
|
<workItem from="1750248915365" duration="442000" />
|
||||||
|
<workItem from="1750335650897" duration="2051000" />
|
||||||
|
<workItem from="1750344288223" duration="1751000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="Minor update - viewport window tweak">
|
<task id="LOCAL-00001" summary="Minor update - viewport window tweak">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
|
@@ -1,106 +0,0 @@
|
|||||||
[Window][Debug##Default]
|
|
||||||
Pos=60,60
|
|
||||||
Size=400,400
|
|
||||||
Collapsed=0
|
|
||||||
|
|
||||||
[Window][Khaotic Engine]
|
|
||||||
Pos=1281,19
|
|
||||||
Size=303,842
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x0000000F,0
|
|
||||||
|
|
||||||
[Window][Objects]
|
|
||||||
Pos=0,19
|
|
||||||
Size=281,842
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x00000011,0
|
|
||||||
|
|
||||||
[Window][Terrain]
|
|
||||||
Pos=0,19
|
|
||||||
Size=280,842
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x00000007,0
|
|
||||||
|
|
||||||
[Window][Light]
|
|
||||||
Pos=0,19
|
|
||||||
Size=281,842
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x00000012,0
|
|
||||||
|
|
||||||
[Window][Shader Manager]
|
|
||||||
Pos=8,27
|
|
||||||
Size=330,487
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x00000001,2
|
|
||||||
|
|
||||||
[Window][Engine Settings]
|
|
||||||
Pos=1281,527
|
|
||||||
Size=303,334
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x00000010,0
|
|
||||||
|
|
||||||
[Window][DockSpace Demo]
|
|
||||||
Size=1584,861
|
|
||||||
Collapsed=0
|
|
||||||
|
|
||||||
[Window][Render Window]
|
|
||||||
Pos=8,27
|
|
||||||
Size=1559,974
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x00000011,0
|
|
||||||
|
|
||||||
[Window][DockSpace]
|
|
||||||
Pos=0,0
|
|
||||||
Size=1584,861
|
|
||||||
Collapsed=0
|
|
||||||
|
|
||||||
[Window][Add Object]
|
|
||||||
Pos=1188,0
|
|
||||||
Size=396,430
|
|
||||||
Collapsed=0
|
|
||||||
|
|
||||||
[Window][Log]
|
|
||||||
Pos=8,518
|
|
||||||
Size=1568,335
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x0000000C,0
|
|
||||||
|
|
||||||
[Window][Log Window]
|
|
||||||
Pos=0,636
|
|
||||||
Size=1279,225
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x00000006,0
|
|
||||||
|
|
||||||
[Window][Render Stats]
|
|
||||||
Pos=0,636
|
|
||||||
Size=1279,225
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x00000004,0
|
|
||||||
|
|
||||||
[Window][render Window]
|
|
||||||
Pos=16,718
|
|
||||||
Size=997,758
|
|
||||||
Collapsed=1
|
|
||||||
|
|
||||||
[Docking][Data]
|
|
||||||
DockSpace ID=0xC0DFADC4 Pos=8,27 Size=1568,826 Split=X
|
|
||||||
DockNode ID=0x00000001 Parent=0xC0DFADC4 SizeRef=330,1094 Selected=0x393905AB
|
|
||||||
DockNode ID=0x00000003 Parent=0xC0DFADC4 SizeRef=1700,1094 CentralNode=1
|
|
||||||
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=0,19 Size=1584,842 Split=X
|
|
||||||
DockNode ID=0x00000002 Parent=0xCCBD8CF7 SizeRef=1743,826 Split=Y
|
|
||||||
DockNode ID=0x0000000A Parent=0x00000002 SizeRef=1568,599 Split=X
|
|
||||||
DockNode ID=0x00000009 Parent=0x0000000A SizeRef=281,974 Split=Y Selected=0x031DC75C
|
|
||||||
DockNode ID=0x00000011 Parent=0x00000009 SizeRef=281,441 Selected=0x031DC75C
|
|
||||||
DockNode ID=0x00000012 Parent=0x00000009 SizeRef=281,440 Selected=0x321620B2
|
|
||||||
DockNode ID=0x0000000D Parent=0x0000000A SizeRef=1460,974 Split=Y
|
|
||||||
DockNode ID=0x0000000B Parent=0x0000000D SizeRef=1568,637 Split=X Selected=0x321620B2
|
|
||||||
DockNode ID=0x00000007 Parent=0x0000000B SizeRef=280,883 Selected=0x393905AB
|
|
||||||
DockNode ID=0x00000008 Parent=0x0000000B SizeRef=1178,883 CentralNode=1 Selected=0x4FC83240
|
|
||||||
DockNode ID=0x0000000C Parent=0x0000000D SizeRef=1568,335 Selected=0x139FDA3F
|
|
||||||
DockNode ID=0x0000000E Parent=0x00000002 SizeRef=1568,225 Split=X Selected=0xD99DEA49
|
|
||||||
DockNode ID=0x00000004 Parent=0x0000000E SizeRef=871,225 Selected=0xD99DEA49
|
|
||||||
DockNode ID=0x00000006 Parent=0x0000000E SizeRef=870,225 Selected=0xAB74BEE9
|
|
||||||
DockNode ID=0x00000005 Parent=0xCCBD8CF7 SizeRef=303,826 Split=Y Selected=0x9F035453
|
|
||||||
DockNode ID=0x0000000F Parent=0x00000005 SizeRef=303,667 Selected=0x9F035453
|
|
||||||
DockNode ID=0x00000010 Parent=0x00000005 SizeRef=303,441 Selected=0x0B098C4B
|
|
||||||
|
|
@@ -1,89 +0,0 @@
|
|||||||
[Window][Debug##Default]
|
|
||||||
Pos=60,60
|
|
||||||
Size=400,400
|
|
||||||
Collapsed=0
|
|
||||||
|
|
||||||
[Window][Khaotic Engine]
|
|
||||||
Pos=1233,27
|
|
||||||
Size=343,826
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x00000005,0
|
|
||||||
|
|
||||||
[Window][Objects]
|
|
||||||
Pos=8,27
|
|
||||||
Size=289,413
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x00000007,0
|
|
||||||
|
|
||||||
[Window][Terrain]
|
|
||||||
Pos=8,442
|
|
||||||
Size=289,411
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x00000008,0
|
|
||||||
|
|
||||||
[Window][Light]
|
|
||||||
Pos=8,27
|
|
||||||
Size=290,866
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x00000004,1
|
|
||||||
|
|
||||||
[Window][Shader Manager]
|
|
||||||
Pos=8,27
|
|
||||||
Size=330,487
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x00000001,2
|
|
||||||
|
|
||||||
[Window][Engine Settings]
|
|
||||||
Pos=1233,27
|
|
||||||
Size=343,826
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x00000005,1
|
|
||||||
|
|
||||||
[Window][DockSpace Demo]
|
|
||||||
Size=1584,861
|
|
||||||
Collapsed=0
|
|
||||||
|
|
||||||
[Window][Render Window]
|
|
||||||
Pos=8,27
|
|
||||||
Size=1559,974
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x00000007,0
|
|
||||||
|
|
||||||
[Window][DockSpace]
|
|
||||||
Pos=0,0
|
|
||||||
Size=1584,861
|
|
||||||
Collapsed=0
|
|
||||||
|
|
||||||
[Window][Add Object]
|
|
||||||
Pos=1188,0
|
|
||||||
Size=396,430
|
|
||||||
Collapsed=0
|
|
||||||
|
|
||||||
[Window][Log]
|
|
||||||
Pos=8,518
|
|
||||||
Size=1568,335
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x0000000C,0
|
|
||||||
|
|
||||||
[Window][Log Window]
|
|
||||||
Pos=299,627
|
|
||||||
Size=932,226
|
|
||||||
Collapsed=0
|
|
||||||
DockId=0x00000006,0
|
|
||||||
|
|
||||||
[Docking][Data]
|
|
||||||
DockSpace ID=0xC0DFADC4 Pos=8,27 Size=1568,826 Split=X
|
|
||||||
DockNode ID=0x00000001 Parent=0xC0DFADC4 SizeRef=330,1094 Selected=0x393905AB
|
|
||||||
DockNode ID=0x00000003 Parent=0xC0DFADC4 SizeRef=1700,1094 CentralNode=1
|
|
||||||
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=8,27 Size=1568,826 Split=X
|
|
||||||
DockNode ID=0x00000009 Parent=0xCCBD8CF7 SizeRef=289,974 Split=Y Selected=0x031DC75C
|
|
||||||
DockNode ID=0x00000007 Parent=0x00000009 SizeRef=289,299 Selected=0x031DC75C
|
|
||||||
DockNode ID=0x00000008 Parent=0x00000009 SizeRef=289,297 Selected=0x393905AB
|
|
||||||
DockNode ID=0x0000000D Parent=0xCCBD8CF7 SizeRef=1613,974 Split=X
|
|
||||||
DockNode ID=0x00000002 Parent=0x0000000D SizeRef=1268,826 Split=Y
|
|
||||||
DockNode ID=0x0000000B Parent=0x00000002 SizeRef=1568,637 Split=Y
|
|
||||||
DockNode ID=0x00000004 Parent=0x0000000B SizeRef=932,598 CentralNode=1
|
|
||||||
DockNode ID=0x00000006 Parent=0x0000000B SizeRef=932,226 Selected=0xAB74BEE9
|
|
||||||
DockNode ID=0x0000000C Parent=0x00000002 SizeRef=1568,335 Selected=0x139FDA3F
|
|
||||||
DockNode ID=0x00000005 Parent=0x0000000D SizeRef=343,826 Selected=0x0B098C4B
|
|
||||||
|
|
@@ -15,23 +15,45 @@ Collapsed=0
|
|||||||
DockId=0x00000002,0
|
DockId=0x00000002,0
|
||||||
|
|
||||||
[Window][render Stats]
|
[Window][render Stats]
|
||||||
Pos=275,630
|
Pos=0,630
|
||||||
Size=1309,231
|
Size=792,231
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000004,0
|
DockId=0x00000009,0
|
||||||
|
|
||||||
[Window][Objects]
|
[Window][Objects]
|
||||||
Pos=0,19
|
Pos=0,19
|
||||||
Size=273,842
|
Size=238,609
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000005,0
|
DockId=0x0000000B,0
|
||||||
|
|
||||||
|
[Window][Terrain]
|
||||||
|
Pos=0,19
|
||||||
|
Size=266,842
|
||||||
|
Collapsed=0
|
||||||
|
DockId=0x00000007,0
|
||||||
|
|
||||||
|
[Window][Log Window]
|
||||||
|
Pos=794,630
|
||||||
|
Size=790,231
|
||||||
|
Collapsed=0
|
||||||
|
DockId=0x0000000A,0
|
||||||
|
|
||||||
|
[Window][Light]
|
||||||
|
Pos=0,19
|
||||||
|
Size=238,609
|
||||||
|
Collapsed=0
|
||||||
|
DockId=0x0000000B,1
|
||||||
|
|
||||||
[Docking][Data]
|
[Docking][Data]
|
||||||
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=0,19 Size=1584,842 Split=X
|
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=0,19 Size=1584,842 Split=Y
|
||||||
DockNode ID=0x00000005 Parent=0xCCBD8CF7 SizeRef=273,842 Selected=0x031DC75C
|
DockNode ID=0x00000003 Parent=0xCCBD8CF7 SizeRef=1584,609 Split=X
|
||||||
DockNode ID=0x00000006 Parent=0xCCBD8CF7 SizeRef=1309,842 Split=Y
|
DockNode ID=0x0000000B Parent=0x00000003 SizeRef=238,842 Selected=0x031DC75C
|
||||||
DockNode ID=0x00000003 Parent=0x00000006 SizeRef=1584,609 Split=X
|
DockNode ID=0x0000000C Parent=0x00000003 SizeRef=1344,842 Split=X
|
||||||
DockNode ID=0x00000001 Parent=0x00000003 SizeRef=990,842 CentralNode=1
|
DockNode ID=0x00000007 Parent=0x0000000C SizeRef=266,842 Selected=0x393905AB
|
||||||
DockNode ID=0x00000002 Parent=0x00000003 SizeRef=317,842 Selected=0x9F035453
|
DockNode ID=0x00000008 Parent=0x0000000C SizeRef=1316,842 Split=X
|
||||||
DockNode ID=0x00000004 Parent=0x00000006 SizeRef=1584,231 Selected=0xF5D1BB37
|
DockNode ID=0x00000001 Parent=0x00000008 SizeRef=1025,842 CentralNode=1
|
||||||
|
DockNode ID=0x00000002 Parent=0x00000008 SizeRef=317,842 Selected=0x9F035453
|
||||||
|
DockNode ID=0x00000004 Parent=0xCCBD8CF7 SizeRef=1584,231 Split=X Selected=0xF5D1BB37
|
||||||
|
DockNode ID=0x00000009 Parent=0x00000004 SizeRef=792,231 Selected=0xF5D1BB37
|
||||||
|
DockNode ID=0x0000000A Parent=0x00000004 SizeRef=790,231 Selected=0xAB74BEE9
|
||||||
|
|
||||||
|
@@ -42,6 +42,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <DirectXMath.h>
|
#include <DirectXMath.h>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "shadow_map.h"
|
#include "shadow_map.h"
|
||||||
#include "stats.h"
|
#include "stats.h"
|
||||||
|
@@ -57,7 +57,7 @@ public:
|
|||||||
ImVec2 GetWindowSize() const { return windowSize; }
|
ImVec2 GetWindowSize() const { return windowSize; }
|
||||||
|
|
||||||
// Getters
|
// Getters
|
||||||
void SetApp(application_class* app) { app_ = app; }
|
void SetApp(std::shared_ptr<application_class> app) { app_ = app; }
|
||||||
|
|
||||||
// Shader toggles
|
// Shader toggles
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ private:
|
|||||||
|
|
||||||
std::vector<widget_entry> widgets_;
|
std::vector<widget_entry> widgets_;
|
||||||
|
|
||||||
application_class* app_;
|
std::shared_ptr<application_class> app_;
|
||||||
scene_manager* scene_manager_;
|
scene_manager* scene_manager_;
|
||||||
stats* stats_;
|
stats* stats_;
|
||||||
|
|
||||||
|
@@ -26,7 +26,7 @@ enum class ShaderType
|
|||||||
ALPHA_MAPPING
|
ALPHA_MAPPING
|
||||||
};
|
};
|
||||||
|
|
||||||
class object : public model_class
|
class object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
object();
|
object();
|
||||||
@@ -35,6 +35,13 @@ public:
|
|||||||
object(const object&) = delete;
|
object(const object&) = delete;
|
||||||
object& operator=(const object&) = delete;
|
object& operator=(const object&) = delete;
|
||||||
|
|
||||||
|
bool Initialize(
|
||||||
|
ID3D11Device* device,
|
||||||
|
ID3D11DeviceContext* deviceContext,
|
||||||
|
char* modelFilename,
|
||||||
|
TextureContainer& texturesContainer
|
||||||
|
);
|
||||||
|
|
||||||
void SetScaleMatrix(XMMATRIX scaleMatrix);
|
void SetScaleMatrix(XMMATRIX scaleMatrix);
|
||||||
void SetRotateMatrix(XMMATRIX rotateMatrix);
|
void SetRotateMatrix(XMMATRIX rotateMatrix);
|
||||||
void SetTranslateMatrix(XMMATRIX translateMatrix);
|
void SetTranslateMatrix(XMMATRIX translateMatrix);
|
||||||
@@ -119,6 +126,9 @@ public:
|
|||||||
bool IsGravityEnabled() const { return m_gravityEnabled; }
|
bool IsGravityEnabled() const { return m_gravityEnabled; }
|
||||||
void SetGravityEnabled(bool state) { m_gravityEnabled = state; }
|
void SetGravityEnabled(bool state) { m_gravityEnabled = state; }
|
||||||
|
|
||||||
|
std::shared_ptr<model_class> get_model() const { return m_model_; }
|
||||||
|
void SetModel(std::shared_ptr<model_class> model) { m_model_ = model; }
|
||||||
|
|
||||||
public :
|
public :
|
||||||
bool m_demoSpinning = false;
|
bool m_demoSpinning = false;
|
||||||
XMVECTOR m_previousPosition;
|
XMVECTOR m_previousPosition;
|
||||||
@@ -150,4 +160,6 @@ private:
|
|||||||
float m_initialStretch = 0.0f;
|
float m_initialStretch = 0.0f;
|
||||||
float m_springConstant = 10.0f;
|
float m_springConstant = 10.0f;
|
||||||
|
|
||||||
|
std::shared_ptr<model_class> m_model_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@@ -32,20 +32,12 @@ public:
|
|||||||
|
|
||||||
void send_path(wchar_t* path, std::filesystem::path w_folder);
|
void send_path(wchar_t* path, std::filesystem::path w_folder);
|
||||||
|
|
||||||
application_class* get_application_class() const { return application_; }
|
std::shared_ptr<application_class> get_application_class() const { return application_; }
|
||||||
void set_application_class(application_class* application) {
|
void set_application_class(std::shared_ptr<application_class> application) { application_ = std::move(application); }
|
||||||
if (application_) {
|
|
||||||
delete application_;
|
std::shared_ptr<input_class> get_input_class() const { return input_; }
|
||||||
}
|
void set_input(std::shared_ptr<input_class> input) { input_ = std::move(input); }
|
||||||
application_ = application;
|
|
||||||
}
|
|
||||||
input_class* get_input_class() const { return input_; }
|
|
||||||
void set_input(input_class* input) {
|
|
||||||
if (input_) {
|
|
||||||
delete input_;
|
|
||||||
}
|
|
||||||
input_ = input;
|
|
||||||
}
|
|
||||||
HWND get_hwnd() const { return hwnd_; }
|
HWND get_hwnd() const { return hwnd_; }
|
||||||
|
|
||||||
void set_d_3D_mock(d_3d_class* mock) {application_->set_direct_3d(mock);}
|
void set_d_3D_mock(d_3d_class* mock) {application_->set_direct_3d(mock);}
|
||||||
@@ -61,9 +53,9 @@ private:
|
|||||||
HINSTANCE hinstance_;
|
HINSTANCE hinstance_;
|
||||||
HWND hwnd_;
|
HWND hwnd_;
|
||||||
|
|
||||||
input_class* input_;
|
std::shared_ptr<input_class> input_;
|
||||||
application_class* application_;
|
std::shared_ptr<application_class> application_;
|
||||||
imguiManager* imgui_manager_;
|
std::shared_ptr<imguiManager> imgui_manager_;
|
||||||
|
|
||||||
int initial_window_width_;
|
int initial_window_width_;
|
||||||
int initial_window_height_;
|
int initial_window_height_;
|
||||||
|
@@ -1133,10 +1133,10 @@ bool application_class::render(float rotation, float x, float y, float z, float
|
|||||||
// -------------------------------------------------------- //
|
// -------------------------------------------------------- //
|
||||||
|
|
||||||
// set the active camera to the sun camera for rendering the shadow map.
|
// set the active camera to the sun camera for rendering the shadow map.
|
||||||
// active_camera_ = sun_camera_;
|
active_camera_ = sun_camera_;
|
||||||
// active_camera_->render();
|
active_camera_->render();
|
||||||
// // Render the objects in the render queues. with depth only pass.
|
// Render the objects in the render queues. with depth only pass.
|
||||||
// active_camera_->get_view_matrix(viewMatrix);
|
active_camera_->get_view_matrix(viewMatrix);
|
||||||
result = render_pass(render_queues_, diffuseColor, lightPosition, ambientColor, viewMatrix, projectionMatrix);
|
result = render_pass(render_queues_, diffuseColor, lightPosition, ambientColor, viewMatrix, projectionMatrix);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
@@ -1145,17 +1145,17 @@ bool application_class::render(float rotation, float x, float y, float z, float
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Reset the active camera to the main camera.
|
// Reset the active camera to the main camera.
|
||||||
// active_camera_ = camera_;
|
active_camera_ = camera_;
|
||||||
// active_camera_->render();
|
active_camera_->render();
|
||||||
// active_camera_->get_view_matrix(viewMatrix);
|
active_camera_->get_view_matrix(viewMatrix);
|
||||||
//
|
|
||||||
// // render the objects in the render queues. with standard pass.
|
// render the objects in the render queues. with standard pass.
|
||||||
// result = render_pass(render_queues_, diffuseColor, lightPosition, ambientColor, viewMatrix, projectionMatrix);
|
result = render_pass(render_queues_, diffuseColor, lightPosition, ambientColor, viewMatrix, projectionMatrix);
|
||||||
// if (!result)
|
if (!result)
|
||||||
// {
|
{
|
||||||
// Logger::Get().Log("Could not render the model using any shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
Logger::Get().Log("Could not render the model using any shader", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||||
// return false;
|
return false;
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
// Update the render count text.
|
// Update the render count text.
|
||||||
@@ -1301,15 +1301,6 @@ void application_class::generate_terrain()
|
|||||||
{
|
{
|
||||||
Logger::Get().Log("G<EFBFBD>n<EFBFBD>ration du terrain avec instanciation", __FILE__, __LINE__, Logger::LogLevel::Info);
|
Logger::Get().Log("G<EFBFBD>n<EFBFBD>ration du terrain avec instanciation", __FILE__, __LINE__, Logger::LogLevel::Info);
|
||||||
|
|
||||||
// Nettoyer les objets terrain existants pour <20>viter les fuites
|
|
||||||
for (auto* chunk : terrain_chunk_)
|
|
||||||
{
|
|
||||||
if (chunk)
|
|
||||||
{
|
|
||||||
chunk->Shutdown();
|
|
||||||
delete chunk;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
terrain_chunk_.clear();
|
terrain_chunk_.clear();
|
||||||
|
|
||||||
// Dimensions du terrain
|
// Dimensions du terrain
|
||||||
@@ -1405,7 +1396,7 @@ void application_class::add_kobject(std::wstring& filepath)
|
|||||||
object_.push_back(newObject);
|
object_.push_back(newObject);
|
||||||
|
|
||||||
// V<>rifiez que l'objet a bien re<72>u les textures_
|
// V<>rifiez que l'objet a bien re<72>u les textures_
|
||||||
if (newObject->GetTexture(TextureType::Diffuse,0) == nullptr)
|
if (newObject->get_model()->GetTexture(TextureType::Diffuse,0) == nullptr)
|
||||||
{
|
{
|
||||||
Logger::Get().Log("object texture is null after initialization", __FILE__, __LINE__, Logger::LogLevel::Error);
|
Logger::Get().Log("object texture is null after initialization", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||||
}
|
}
|
||||||
@@ -1442,8 +1433,6 @@ void application_class::delete_kobject(int index)
|
|||||||
|
|
||||||
if (index < object_.size())
|
if (index < object_.size())
|
||||||
{
|
{
|
||||||
object_[index]->Shutdown();
|
|
||||||
delete object_[index];
|
|
||||||
object_.erase(object_.begin() + index);
|
object_.erase(object_.begin() + index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1451,12 +1440,6 @@ void application_class::delete_kobject(int index)
|
|||||||
void application_class::delete_terrain()
|
void application_class::delete_terrain()
|
||||||
{
|
{
|
||||||
Logger::Get().Log("Deleting terrain", __FILE__, __LINE__);
|
Logger::Get().Log("Deleting terrain", __FILE__, __LINE__);
|
||||||
|
|
||||||
for (auto cube : terrain_chunk_)
|
|
||||||
{
|
|
||||||
cube->Shutdown();
|
|
||||||
delete cube;
|
|
||||||
}
|
|
||||||
terrain_chunk_.clear();
|
terrain_chunk_.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1819,17 +1802,17 @@ bool application_class::render_pass(const std::vector<std::reference_wrapper<std
|
|||||||
translateMatrix
|
translateMatrix
|
||||||
);
|
);
|
||||||
|
|
||||||
object->Render(direct_3d_->get_device_context());
|
object->get_model()->Render(direct_3d_->get_device_context());
|
||||||
|
|
||||||
if (active_camera_ == sun_camera_)
|
if (active_camera_ == sun_camera_)
|
||||||
{
|
{
|
||||||
result = shader_manager_->render_depth_shader(
|
result = shader_manager_->render_depth_shader(
|
||||||
direct_3d_->get_device_context(),
|
direct_3d_->get_device_context(),
|
||||||
object->GetIndexCount(),
|
object->get_model()->GetIndexCount(),
|
||||||
worldMatrix,
|
worldMatrix,
|
||||||
view,
|
view,
|
||||||
projection,
|
projection,
|
||||||
object->GetTexture(TextureType::Diffuse,0)
|
object->get_model()->GetTexture(TextureType::Diffuse,0)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1844,13 +1827,13 @@ bool application_class::render_pass(const std::vector<std::reference_wrapper<std
|
|||||||
|
|
||||||
result = shader_manager_->render_alpha_map_shader(
|
result = shader_manager_->render_alpha_map_shader(
|
||||||
direct_3d_->get_device_context(),
|
direct_3d_->get_device_context(),
|
||||||
object->GetIndexCount(),
|
object->get_model()->GetIndexCount(),
|
||||||
worldMatrix,
|
worldMatrix,
|
||||||
view,
|
view,
|
||||||
projection,
|
projection,
|
||||||
object->GetTexture(TextureType::Diffuse,0),
|
object->get_model()->GetTexture(TextureType::Diffuse,0),
|
||||||
object->GetTexture(TextureType::Diffuse,1),
|
object->get_model()->GetTexture(TextureType::Diffuse,1),
|
||||||
object->GetTexture(TextureType::Alpha,0)
|
object->get_model()->GetTexture(TextureType::Alpha,0)
|
||||||
);
|
);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
@@ -1864,11 +1847,11 @@ bool application_class::render_pass(const std::vector<std::reference_wrapper<std
|
|||||||
case ShaderType::CEL_SHADING:
|
case ShaderType::CEL_SHADING:
|
||||||
result = shader_manager_->render_cel_shading_shader(
|
result = shader_manager_->render_cel_shading_shader(
|
||||||
direct_3d_->get_device_context(),
|
direct_3d_->get_device_context(),
|
||||||
object->GetIndexCount(),
|
object->get_model()->GetIndexCount(),
|
||||||
worldMatrix,
|
worldMatrix,
|
||||||
view,
|
view,
|
||||||
projection,
|
projection,
|
||||||
object->GetTexture(TextureType::Diffuse,0),
|
object->get_model()->GetTexture(TextureType::Diffuse,0),
|
||||||
sun_light_->GetDiffuseColor(),
|
sun_light_->GetDiffuseColor(),
|
||||||
sun_light_->GetAmbientColor(),
|
sun_light_->GetAmbientColor(),
|
||||||
sun_light_->GetDirection(),
|
sun_light_->GetDirection(),
|
||||||
@@ -1884,12 +1867,12 @@ bool application_class::render_pass(const std::vector<std::reference_wrapper<std
|
|||||||
case ShaderType::NORMAL_MAPPING:
|
case ShaderType::NORMAL_MAPPING:
|
||||||
result = shader_manager_->render_normal_map_shader(
|
result = shader_manager_->render_normal_map_shader(
|
||||||
direct_3d_->get_device_context(),
|
direct_3d_->get_device_context(),
|
||||||
object->GetIndexCount(),
|
object->get_model()->GetIndexCount(),
|
||||||
worldMatrix,
|
worldMatrix,
|
||||||
view,
|
view,
|
||||||
projection,
|
projection,
|
||||||
object->GetTexture(TextureType::Diffuse,0),
|
object->get_model()->GetTexture(TextureType::Diffuse,0),
|
||||||
object->GetTexture(TextureType::Normal,0),
|
object->get_model()->GetTexture(TextureType::Normal,0),
|
||||||
lights_[0]->GetDirection(),
|
lights_[0]->GetDirection(),
|
||||||
lights_[0]->GetDiffuseColor()
|
lights_[0]->GetDiffuseColor()
|
||||||
);
|
);
|
||||||
@@ -1903,13 +1886,13 @@ bool application_class::render_pass(const std::vector<std::reference_wrapper<std
|
|||||||
case ShaderType::SPECULAR_MAPPING:
|
case ShaderType::SPECULAR_MAPPING:
|
||||||
result = shader_manager_->render_spec_map_shader(
|
result = shader_manager_->render_spec_map_shader(
|
||||||
direct_3d_->get_device_context(),
|
direct_3d_->get_device_context(),
|
||||||
object->GetIndexCount(),
|
object->get_model()->GetIndexCount(),
|
||||||
worldMatrix,
|
worldMatrix,
|
||||||
view,
|
view,
|
||||||
projection,
|
projection,
|
||||||
object->GetTexture(TextureType::Diffuse,0),
|
object->get_model()->GetTexture(TextureType::Diffuse,0),
|
||||||
object->GetTexture(TextureType::Normal,0),
|
object->get_model()->GetTexture(TextureType::Normal,0),
|
||||||
object->GetTexture(TextureType::Specular,0),
|
object->get_model()->GetTexture(TextureType::Specular,0),
|
||||||
lights_[0]->GetDirection(),
|
lights_[0]->GetDirection(),
|
||||||
lights_[0]->GetDiffuseColor(),
|
lights_[0]->GetDiffuseColor(),
|
||||||
camera_->get_position(),
|
camera_->get_position(),
|
||||||
@@ -1926,11 +1909,11 @@ bool application_class::render_pass(const std::vector<std::reference_wrapper<std
|
|||||||
case ShaderType::TEXTURE:
|
case ShaderType::TEXTURE:
|
||||||
result = shader_manager_->render_texture_shader(
|
result = shader_manager_->render_texture_shader(
|
||||||
direct_3d_->get_device_context(),
|
direct_3d_->get_device_context(),
|
||||||
object->GetIndexCount(),
|
object->get_model()->GetIndexCount(),
|
||||||
worldMatrix,
|
worldMatrix,
|
||||||
view,
|
view,
|
||||||
projection,
|
projection,
|
||||||
object->GetTexture(TextureType::Diffuse,0)
|
object->get_model()->GetTexture(TextureType::Diffuse,0)
|
||||||
);
|
);
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
@@ -1942,11 +1925,11 @@ bool application_class::render_pass(const std::vector<std::reference_wrapper<std
|
|||||||
case ShaderType::LIGHTING:
|
case ShaderType::LIGHTING:
|
||||||
result = shader_manager_->renderlight_shader(
|
result = shader_manager_->renderlight_shader(
|
||||||
direct_3d_->get_device_context(),
|
direct_3d_->get_device_context(),
|
||||||
object->GetIndexCount(),
|
object->get_model()->GetIndexCount(),
|
||||||
worldMatrix,
|
worldMatrix,
|
||||||
view,
|
view,
|
||||||
projection,
|
projection,
|
||||||
object->GetTexture(TextureType::Diffuse,0),
|
object->get_model()->GetTexture(TextureType::Diffuse,0),
|
||||||
diffuse,
|
diffuse,
|
||||||
position,
|
position,
|
||||||
ambient
|
ambient
|
||||||
@@ -1961,11 +1944,11 @@ bool application_class::render_pass(const std::vector<std::reference_wrapper<std
|
|||||||
case ShaderType::SKYBOX:
|
case ShaderType::SKYBOX:
|
||||||
result = shader_manager_->render_skybox_shader(
|
result = shader_manager_->render_skybox_shader(
|
||||||
direct_3d_->get_device_context(),
|
direct_3d_->get_device_context(),
|
||||||
object->GetIndexCount(),
|
object->get_model()->GetIndexCount(),
|
||||||
worldMatrix,
|
worldMatrix,
|
||||||
view,
|
view,
|
||||||
projection,
|
projection,
|
||||||
object->GetTexture(TextureType::Diffuse,0),
|
object->get_model()->GetTexture(TextureType::Diffuse,0),
|
||||||
sun_light_->GetDiffuseColor(),
|
sun_light_->GetDiffuseColor(),
|
||||||
sun_light_->GetAmbientColor(),
|
sun_light_->GetAmbientColor(),
|
||||||
sun_light_->GetDirection(),
|
sun_light_->GetDirection(),
|
||||||
@@ -1981,11 +1964,11 @@ bool application_class::render_pass(const std::vector<std::reference_wrapper<std
|
|||||||
case ShaderType::SUNLIGHT:
|
case ShaderType::SUNLIGHT:
|
||||||
result = shader_manager_->render_sunlight_shader(
|
result = shader_manager_->render_sunlight_shader(
|
||||||
direct_3d_->get_device_context(),
|
direct_3d_->get_device_context(),
|
||||||
object->GetIndexCount(),
|
object->get_model()->GetIndexCount(),
|
||||||
worldMatrix,
|
worldMatrix,
|
||||||
view,
|
view,
|
||||||
projection,
|
projection,
|
||||||
object->GetTexture(TextureType::Diffuse,0),
|
object->get_model()->GetTexture(TextureType::Diffuse,0),
|
||||||
sun_light_->GetDiffuseColor(),
|
sun_light_->GetDiffuseColor(),
|
||||||
sun_light_->GetAmbientColor(),
|
sun_light_->GetAmbientColor(),
|
||||||
sun_light_->GetDirection(),
|
sun_light_->GetDirection(),
|
||||||
@@ -2001,11 +1984,11 @@ bool application_class::render_pass(const std::vector<std::reference_wrapper<std
|
|||||||
default:
|
default:
|
||||||
result = shader_manager_->renderlight_shader(
|
result = shader_manager_->renderlight_shader(
|
||||||
direct_3d_->get_device_context(),
|
direct_3d_->get_device_context(),
|
||||||
object->GetIndexCount(),
|
object->get_model()->GetIndexCount(),
|
||||||
worldMatrix,
|
worldMatrix,
|
||||||
view,
|
view,
|
||||||
projection,
|
projection,
|
||||||
object->GetTexture(TextureType::Diffuse,0),
|
object->get_model()->GetTexture(TextureType::Diffuse,0),
|
||||||
diffuse,
|
diffuse,
|
||||||
position,
|
position,
|
||||||
ambient
|
ambient
|
||||||
@@ -2243,14 +2226,6 @@ void application_class::process_terrain_generation()
|
|||||||
|
|
||||||
Logger::Get().Log("Cr<EFBFBD>ation des objets terrain <20> partir des donn<6E>es pr<70>par<61>es", __FILE__, __LINE__, Logger::LogLevel::Info);
|
Logger::Get().Log("Cr<EFBFBD>ation des objets terrain <20> partir des donn<6E>es pr<70>par<61>es", __FILE__, __LINE__, Logger::LogLevel::Info);
|
||||||
|
|
||||||
// Nettoyer les objets terrain existants
|
|
||||||
for (auto* chunk : terrain_chunk_)
|
|
||||||
{
|
|
||||||
if (chunk) {
|
|
||||||
chunk->Shutdown();
|
|
||||||
delete chunk;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
terrain_chunk_.clear();
|
terrain_chunk_.clear();
|
||||||
|
|
||||||
// Cr<43>er un conteneur de textures_ partag<61>
|
// Cr<43>er un conteneur de textures_ partag<61>
|
||||||
|
@@ -165,7 +165,7 @@ bool imguiManager::Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceConte
|
|||||||
|
|
||||||
// initialize the scene manager
|
// initialize the scene manager
|
||||||
scene_manager_ = new scene_manager;
|
scene_manager_ = new scene_manager;
|
||||||
if (!scene_manager_->initialize(app_)) {
|
if (!scene_manager_->initialize(app_.get())) {
|
||||||
Logger::Get().Log("Failed to initialize scene manager", __FILE__, __LINE__, Logger::LogLevel::Error);
|
Logger::Get().Log("Failed to initialize scene manager", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -441,7 +441,7 @@ void imguiManager::WidgetObjectWindow()
|
|||||||
|
|
||||||
// Compter combien de textures_ de ce type existent
|
// Compter combien de textures_ de ce type existent
|
||||||
int textureCount = 0;
|
int textureCount = 0;
|
||||||
while (object->GetTexture(type, textureCount) != nullptr)
|
while (object->get_model()->GetTexture(type, textureCount) != nullptr)
|
||||||
{
|
{
|
||||||
textureCount++;
|
textureCount++;
|
||||||
}
|
}
|
||||||
@@ -450,7 +450,7 @@ void imguiManager::WidgetObjectWindow()
|
|||||||
ImGui::BeginGroup();
|
ImGui::BeginGroup();
|
||||||
for (int texIndex = 0; texIndex < textureCount; texIndex++)
|
for (int texIndex = 0; texIndex < textureCount; texIndex++)
|
||||||
{
|
{
|
||||||
ID3D11ShaderResourceView* texture = object->GetTexture(type, texIndex);
|
ID3D11ShaderResourceView* texture = object->get_model()->GetTexture(type, texIndex);
|
||||||
if (texture)
|
if (texture)
|
||||||
{
|
{
|
||||||
// ID unique pour chaque bouton de texture
|
// ID unique pour chaque bouton de texture
|
||||||
@@ -477,7 +477,7 @@ void imguiManager::WidgetObjectWindow()
|
|||||||
if (GetOpenFileName(&ofn))
|
if (GetOpenFileName(&ofn))
|
||||||
{
|
{
|
||||||
// Changer la texture existante
|
// Changer la texture existante
|
||||||
object->ChangeTexture(m_device, m_deviceContext, ofn.lpstrFile, type, texIndex);
|
object->get_model()->ChangeTexture(m_device, m_deviceContext, ofn.lpstrFile, type, texIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -515,7 +515,7 @@ void imguiManager::WidgetObjectWindow()
|
|||||||
if (GetOpenFileName(&ofn))
|
if (GetOpenFileName(&ofn))
|
||||||
{
|
{
|
||||||
// Ajouter une nouvelle texture
|
// Ajouter une nouvelle texture
|
||||||
object->AddTexture(m_device, m_deviceContext, ofn.lpstrFile, type);
|
object->get_model()->AddTexture(m_device, m_deviceContext, ofn.lpstrFile, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -24,6 +24,17 @@ object::~object()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool object::Initialize(
|
||||||
|
ID3D11Device* device,
|
||||||
|
ID3D11DeviceContext* deviceContext,
|
||||||
|
char* modelFilename,
|
||||||
|
TextureContainer& texturesContainer
|
||||||
|
)
|
||||||
|
{
|
||||||
|
m_model_ = std::make_shared<model_class>();
|
||||||
|
return m_model_->Initialize(device, deviceContext, modelFilename, texturesContainer);
|
||||||
|
}
|
||||||
|
|
||||||
void object::SetScaleMatrix(XMMATRIX scaleMatrix)
|
void object::SetScaleMatrix(XMMATRIX scaleMatrix)
|
||||||
{
|
{
|
||||||
m_scaleMatrix = scaleMatrix;
|
m_scaleMatrix = scaleMatrix;
|
||||||
|
@@ -85,13 +85,6 @@ bool scene_manager::load_scene() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Nettoyer les objets existants
|
|
||||||
for (auto& obj : object_vec_) {
|
|
||||||
if (obj) {
|
|
||||||
obj->Shutdown();
|
|
||||||
delete obj;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
object_vec_.clear();
|
object_vec_.clear();
|
||||||
object_id_ = 0;
|
object_id_ = 0;
|
||||||
|
|
||||||
@@ -192,7 +185,7 @@ bool scene_manager::load_scene() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// preload texture
|
// preload texture
|
||||||
if (!newObject->PreloadTextures(direct_3d_->get_device(), direct_3d_->get_device_context(), objectTextures))
|
if (!newObject->get_model()->PreloadTextures(direct_3d_->get_device(), direct_3d_->get_device_context(), objectTextures))
|
||||||
{
|
{
|
||||||
// G<>rer l'erreur
|
// G<>rer l'erreur
|
||||||
return false;
|
return false;
|
||||||
@@ -281,28 +274,28 @@ bool scene_manager::save_scene() {
|
|||||||
// M<>me chose pour les autres types de textures_
|
// M<>me chose pour les autres types de textures_
|
||||||
|
|
||||||
// Textures diffuses
|
// Textures diffuses
|
||||||
const auto& diffusePaths = object->GetTextureContainer().GetPaths(TextureType::Diffuse);
|
const auto& diffusePaths = object->get_model()->GetTextureContainer().GetPaths(TextureType::Diffuse);
|
||||||
outFile << " " << diffusePaths.size();
|
outFile << " " << diffusePaths.size();
|
||||||
for (const auto& path : diffusePaths) {
|
for (const auto& path : diffusePaths) {
|
||||||
outFile << " " << convert_w_string_to_string(path);
|
outFile << " " << convert_w_string_to_string(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Textures normales
|
// Textures normales
|
||||||
const auto& normalPaths = object->GetTextureContainer().GetPaths(TextureType::Normal);
|
const auto& normalPaths = object->get_model()->GetTextureContainer().GetPaths(TextureType::Normal);
|
||||||
outFile << " " << normalPaths.size();
|
outFile << " " << normalPaths.size();
|
||||||
for (const auto& path : normalPaths) {
|
for (const auto& path : normalPaths) {
|
||||||
outFile << " " << convert_w_string_to_string(path);
|
outFile << " " << convert_w_string_to_string(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Textures sp<73>culaires
|
// Textures sp<73>culaires
|
||||||
const auto& specularPaths = object->GetTextureContainer().GetPaths(TextureType::Specular);
|
const auto& specularPaths = object->get_model()->GetTextureContainer().GetPaths(TextureType::Specular);
|
||||||
outFile << " " << specularPaths.size();
|
outFile << " " << specularPaths.size();
|
||||||
for (const auto& path : specularPaths) {
|
for (const auto& path : specularPaths) {
|
||||||
outFile << " " << convert_w_string_to_string(path);
|
outFile << " " << convert_w_string_to_string(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Textures alpha
|
// Textures alpha
|
||||||
const auto& alphaPaths = object->GetTextureContainer().GetPaths(TextureType::Alpha);
|
const auto& alphaPaths = object->get_model()->GetTextureContainer().GetPaths(TextureType::Alpha);
|
||||||
outFile << " " << alphaPaths.size();
|
outFile << " " << alphaPaths.size();
|
||||||
for (const auto& path : alphaPaths) {
|
for (const auto& path : alphaPaths) {
|
||||||
outFile << " " << convert_w_string_to_string(path);
|
outFile << " " << convert_w_string_to_string(path);
|
||||||
|
@@ -71,7 +71,7 @@ int stats::get_total_vertex_count() const
|
|||||||
{
|
{
|
||||||
if (obj)
|
if (obj)
|
||||||
{
|
{
|
||||||
totalVertices += obj->GetVertexCount();
|
totalVertices += obj->get_model()->GetVertexCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Ajoutez le nombre de sommets pour les cubes
|
// Ajoutez le nombre de sommets pour les cubes
|
||||||
@@ -79,7 +79,7 @@ int stats::get_total_vertex_count() const
|
|||||||
{
|
{
|
||||||
if (cube)
|
if (cube)
|
||||||
{
|
{
|
||||||
totalVertices += cube->GetVertexCount();
|
totalVertices += cube->get_model()->GetVertexCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Ajoutez le nombre de sommets pour le terrain
|
// Ajoutez le nombre de sommets pour le terrain
|
||||||
@@ -87,7 +87,7 @@ int stats::get_total_vertex_count() const
|
|||||||
{
|
{
|
||||||
if (chunk)
|
if (chunk)
|
||||||
{
|
{
|
||||||
totalVertices += chunk->GetVertexCount();
|
totalVertices += chunk->get_model()->GetVertexCount();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return totalVertices;
|
return totalVertices;
|
||||||
@@ -101,7 +101,7 @@ int stats::get_total_triangle_count() const
|
|||||||
if (obj)
|
if (obj)
|
||||||
{
|
{
|
||||||
// Dans une topologie de liste de triangles, chaque triangle utilise 3 indices
|
// Dans une topologie de liste de triangles, chaque triangle utilise 3 indices
|
||||||
totalTriangles += obj->GetIndexCount() / 3;
|
totalTriangles += obj->get_model()->GetIndexCount() / 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Ajoutez le nombre de triangles pour les cubes
|
// Ajoutez le nombre de triangles pour les cubes
|
||||||
@@ -109,7 +109,7 @@ int stats::get_total_triangle_count() const
|
|||||||
{
|
{
|
||||||
if (cube)
|
if (cube)
|
||||||
{
|
{
|
||||||
totalTriangles += cube->GetIndexCount() / 3;
|
totalTriangles += cube->get_model()->GetIndexCount() / 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Ajoutez le nombre de triangles pour le terrain
|
// Ajoutez le nombre de triangles pour le terrain
|
||||||
@@ -117,7 +117,7 @@ int stats::get_total_triangle_count() const
|
|||||||
{
|
{
|
||||||
if (chunk)
|
if (chunk)
|
||||||
{
|
{
|
||||||
totalTriangles += chunk->GetIndexCount() / 3;
|
totalTriangles += chunk->get_model()->GetIndexCount() / 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return totalTriangles;
|
return totalTriangles;
|
||||||
@@ -130,7 +130,7 @@ int stats::get_visible_triangle_count() const
|
|||||||
{
|
{
|
||||||
if (obj && obj->IsVisible())
|
if (obj && obj->IsVisible())
|
||||||
{
|
{
|
||||||
visibleTriangles += obj->GetIndexCount() / 3;
|
visibleTriangles += obj->get_model()->GetIndexCount() / 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Ajoutez le nombre de triangles visibles pour les cubes
|
// Ajoutez le nombre de triangles visibles pour les cubes
|
||||||
@@ -138,7 +138,7 @@ int stats::get_visible_triangle_count() const
|
|||||||
{
|
{
|
||||||
if (cube && cube->IsVisible())
|
if (cube && cube->IsVisible())
|
||||||
{
|
{
|
||||||
visibleTriangles += cube->GetIndexCount() / 3;
|
visibleTriangles += cube->get_model()->GetIndexCount() / 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Ajoutez le nombre de triangles visibles pour le terrain
|
// Ajoutez le nombre de triangles visibles pour le terrain
|
||||||
@@ -146,7 +146,7 @@ int stats::get_visible_triangle_count() const
|
|||||||
{
|
{
|
||||||
if (chunk && chunk->IsVisible())
|
if (chunk && chunk->IsVisible())
|
||||||
{
|
{
|
||||||
visibleTriangles += chunk->GetIndexCount() / 3;
|
visibleTriangles += chunk->get_model()->GetIndexCount() / 3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return visibleTriangles;
|
return visibleTriangles;
|
||||||
|
@@ -20,27 +20,6 @@ system_class::system_class()
|
|||||||
|
|
||||||
system_class::~system_class()
|
system_class::~system_class()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (application_handle)
|
|
||||||
{
|
|
||||||
delete application_handle;
|
|
||||||
application_handle = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (input_)
|
|
||||||
{
|
|
||||||
delete input_;
|
|
||||||
input_ = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (imgui_manager_)
|
|
||||||
{
|
|
||||||
delete imgui_manager_;
|
|
||||||
imgui_manager_ = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool system_class::initialize()
|
bool system_class::initialize()
|
||||||
@@ -56,7 +35,7 @@ bool system_class::initialize()
|
|||||||
initialize_windows(screenWidth, screenHeight);
|
initialize_windows(screenWidth, screenHeight);
|
||||||
|
|
||||||
// Create and initialize the input object. This object will be used to handle reading the keyboard input from the user.
|
// Create and initialize the input object. This object will be used to handle reading the keyboard input from the user.
|
||||||
input_ = new input_class;
|
input_ = std::make_shared<input_class>();
|
||||||
|
|
||||||
result = input_->Initialize(hinstance_, hwnd_, screenWidth, screenHeight);
|
result = input_->Initialize(hinstance_, hwnd_, screenWidth, screenHeight);
|
||||||
if (!result)
|
if (!result)
|
||||||
@@ -66,7 +45,7 @@ bool system_class::initialize()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create and initialize the application class object. This object will handle rendering all the graphics for this application.
|
// Create and initialize the application class object. This object will handle rendering all the graphics for this application.
|
||||||
application_ = new application_class;
|
application_ = std::make_shared<application_class>();
|
||||||
|
|
||||||
result = application_->initialize(screenWidth, screenHeight, hwnd_, false);
|
result = application_->initialize(screenWidth, screenHeight, hwnd_, false);
|
||||||
if (!result)
|
if (!result)
|
||||||
@@ -85,7 +64,7 @@ bool system_class::initialize()
|
|||||||
// initialize imgui
|
// initialize imgui
|
||||||
if(DEBUG_MODE)
|
if(DEBUG_MODE)
|
||||||
{
|
{
|
||||||
imgui_manager_ = new imguiManager;
|
imgui_manager_ = std::make_shared<imguiManager>();
|
||||||
imgui_manager_->SetApp(application_);
|
imgui_manager_->SetApp(application_);
|
||||||
result = imgui_manager_->Initialize(hwnd_, application_->get_direct_3d()->get_device(), application_->get_direct_3d()->get_device_context());
|
result = imgui_manager_->Initialize(hwnd_, application_->get_direct_3d()->get_device(), application_->get_direct_3d()->get_device_context());
|
||||||
if (!result)
|
if (!result)
|
||||||
@@ -112,49 +91,11 @@ void system_class::shutdown()
|
|||||||
|
|
||||||
std::lock_guard<std::mutex> guard(render_mutex_);
|
std::lock_guard<std::mutex> guard(render_mutex_);
|
||||||
|
|
||||||
// shutdown imgui
|
|
||||||
if (imgui_manager_)
|
|
||||||
{
|
|
||||||
Logger::Get().Log("Shutting down imgui manager", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
|
|
||||||
|
|
||||||
imgui_manager_->Shutdown();
|
|
||||||
delete imgui_manager_;
|
|
||||||
imgui_manager_ = 0;
|
|
||||||
|
|
||||||
Logger::Get().Log("Imgui manager shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Release the application class object.
|
|
||||||
if (application_)
|
|
||||||
{
|
|
||||||
Logger::Get().Log("Shutting down application", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
|
|
||||||
|
|
||||||
application_->shutdown();
|
|
||||||
delete application_;
|
|
||||||
application_ = 0;
|
|
||||||
|
|
||||||
Logger::Get().Log("Application shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Release the input object.
|
|
||||||
if (input_)
|
|
||||||
{
|
|
||||||
Logger::Get().Log("Shutting down input", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
|
|
||||||
|
|
||||||
delete input_;
|
|
||||||
input_ = 0;
|
|
||||||
|
|
||||||
Logger::Get().Log("Input shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// shutdown the window.
|
// shutdown the window.
|
||||||
shutdown_windows();
|
shutdown_windows();
|
||||||
|
|
||||||
Logger::Get().Log("System class shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
|
Logger::Get().Log("System class shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void system_class::run()
|
void system_class::run()
|
||||||
@@ -224,7 +165,7 @@ bool system_class::frame()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Do the frame processing for the application class object.
|
// Do the frame processing for the application class object.
|
||||||
result = application_->frame(input_);
|
result = application_->frame(input_.get());
|
||||||
if (!result)
|
if (!result)
|
||||||
{
|
{
|
||||||
Logger::Get().Log("Failed to process application frame", __FILE__, __LINE__, Logger::LogLevel::Error);
|
Logger::Get().Log("Failed to process application frame", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||||
|
Reference in New Issue
Block a user