Compare commits
7 Commits
V10.2.1
...
3a2d19dff4
Author | SHA1 | Date | |
---|---|---|---|
3a2d19dff4 | |||
dbc7003569 | |||
c5bfa2e621 | |||
32b71ac97f | |||
5c3c6d944c | |||
8d32f51e8c | |||
644fc57762 |
134
.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
generated
134
.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml
generated
@@ -6,8 +6,9 @@
|
|||||||
<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/imgui.ini" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/imgui.ini" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/applicationclass.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/applicationclass.h" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/applicationclass.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/applicationclass.h" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/modelclass.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/modelclass.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/src/system/applicationclass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/applicationclass.cpp" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/applicationclass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/applicationclass.cpp" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/modelclass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/modelclass.cpp" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/modelclass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/modelclass.cpp" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
@@ -29,7 +30,129 @@
|
|||||||
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
<setting file="cidr-memory-view://4" root0="FORCE_HIGHLIGHTING" />
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="cidr-memory-view://23" root0="FORCE_HIGHLIGHTING" />
|
||||||
|
<setting file="file://C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/um/d3d11.h" root0="SKIP_HIGHLIGHTING" />
|
||||||
|
<setting file="file://$PROJECT_DIR$/enginecustom/include/Inc/VertexTypes.h" root0="SKIP_HIGHLIGHTING" />
|
||||||
<setting file="file://$PROJECT_DIR$/enginecustom/include/Vulkan/Include/vulkan/vulkan_core.h" root0="SKIP_HIGHLIGHTING" />
|
<setting file="file://$PROJECT_DIR$/enginecustom/include/Vulkan/Include/vulkan/vulkan_core.h" root0="SKIP_HIGHLIGHTING" />
|
||||||
<setting file="file://$PROJECT_DIR$/enginecustom/src/src/shader/CelShadingShader.cpp" root0="FORCE_HIGHLIGHTING" />
|
<setting file="file://$PROJECT_DIR$/enginecustom/src/src/shader/CelShadingShader.cpp" root0="FORCE_HIGHLIGHTING" />
|
||||||
<setting file="file://$PROJECT_DIR$/../../IDE_VS/VC/Tools/MSVC/14.38.33130/include/type_traits" root0="SKIP_HIGHLIGHTING" />
|
<setting file="file://$PROJECT_DIR$/../../IDE_VS/VC/Tools/MSVC/14.38.33130/include/type_traits" root0="SKIP_HIGHLIGHTING" />
|
||||||
@@ -50,7 +173,7 @@
|
|||||||
"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.enginecustom.executor": "dotTrace Profiler",
|
"C/C++ Project.enginecustom.executor": "Debug",
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||||
"RunOnceActivity.git.unshallow": "true",
|
"RunOnceActivity.git.unshallow": "true",
|
||||||
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
|
||||||
@@ -186,6 +309,11 @@
|
|||||||
<workItem from="1746538260893" duration="5781000" />
|
<workItem from="1746538260893" duration="5781000" />
|
||||||
<workItem from="1746546014271" duration="1814000" />
|
<workItem from="1746546014271" duration="1814000" />
|
||||||
<workItem from="1746619988287" duration="12282000" />
|
<workItem from="1746619988287" duration="12282000" />
|
||||||
|
<workItem from="1746711806997" duration="6736000" />
|
||||||
|
<workItem from="1746719840054" duration="991000" />
|
||||||
|
<workItem from="1746795732153" duration="33000" />
|
||||||
|
<workItem from="1746795828588" duration="592000" />
|
||||||
|
<workItem from="1747049871967" duration="8976000" />
|
||||||
</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" />
|
||||||
|
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
Khaotic Engine Reborn reprend comme base le moteur Khaotic Engine pour lui ajouter plus de fonctionalité.
|
Khaotic Engine Reborn reprend comme base le moteur Khaotic Engine pour lui ajouter plus de fonctionalité.
|
||||||
|
|
||||||
Ce moteur est basé sur **DirectX11** utilise **ImGui** avec une couche d'abstraction pour permetre son usage avec d'autres API.
|
Ce moteur est basé sur **DirectX11** et utilise **ImGui** pour son interface graphique.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
Khaotic Engine is a rendering engine made in **C++** by a small team with the aim of learning how to use rendering APIs (OpenGL, DirectX 11/12 and Vulkan).
|
Khaotic Engine is a rendering engine made in **C++** by a small team with the aim of learning how to use rendering APIs (OpenGL, DirectX 11/12 and Vulkan).
|
||||||
|
|
||||||
This **DirectX11** based engine uses **ImGui** with an abstraction layer to enable its use with other APIs.
|
This **DirectX11** based engine uses **ImGui** for the user interface.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ This **DirectX11** based engine uses **ImGui** with an abstraction layer to enab
|
|||||||
- [@Harpie94](https://github.com/Harpie94)
|
- [@Harpie94](https://github.com/Harpie94)
|
||||||
- [@axelpicou](https://github.com/axelpicou)
|
- [@axelpicou](https://github.com/axelpicou)
|
||||||
- [@GolfOcean334](https://github.com/GolfOcean334)
|
- [@GolfOcean334](https://github.com/GolfOcean334)
|
||||||
- [@sutabasuto](https://github.com/sutabasuto)
|
- [@sutabasuto](https://github.com/sutabasuto)
|
||||||
|
|
||||||
|
|
||||||
**Moteur Reborn** :
|
**Moteur Reborn** :
|
||||||
|
@@ -4,28 +4,28 @@ Size=400,400
|
|||||||
Collapsed=0
|
Collapsed=0
|
||||||
|
|
||||||
[Window][Khaotic Engine]
|
[Window][Khaotic Engine]
|
||||||
Pos=1233,27
|
Pos=1281,19
|
||||||
Size=343,599
|
Size=303,842
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000005,0
|
DockId=0x00000005,0
|
||||||
|
|
||||||
[Window][Objects]
|
[Window][Objects]
|
||||||
Pos=8,27
|
Pos=0,19
|
||||||
Size=289,547
|
Size=281,615
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000007,0
|
DockId=0x00000007,0
|
||||||
|
|
||||||
[Window][Terrain]
|
[Window][Terrain]
|
||||||
Pos=8,27
|
Pos=0,328
|
||||||
Size=281,599
|
Size=281,306
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000008,0
|
DockId=0x00000008,0
|
||||||
|
|
||||||
[Window][Light]
|
[Window][Light]
|
||||||
Pos=8,27
|
Pos=0,328
|
||||||
Size=290,866
|
Size=281,306
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x0000000B,1
|
DockId=0x00000008,1
|
||||||
|
|
||||||
[Window][Shader Manager]
|
[Window][Shader Manager]
|
||||||
Pos=8,27
|
Pos=8,27
|
||||||
@@ -34,8 +34,8 @@ Collapsed=0
|
|||||||
DockId=0x00000001,2
|
DockId=0x00000001,2
|
||||||
|
|
||||||
[Window][Engine Settings]
|
[Window][Engine Settings]
|
||||||
Pos=8,27
|
Pos=0,19
|
||||||
Size=289,547
|
Size=281,615
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000007,1
|
DockId=0x00000007,1
|
||||||
|
|
||||||
@@ -66,32 +66,32 @@ Collapsed=0
|
|||||||
DockId=0x0000000C,0
|
DockId=0x0000000C,0
|
||||||
|
|
||||||
[Window][Log Window]
|
[Window][Log Window]
|
||||||
Pos=8,37
|
Pos=641,636
|
||||||
Size=16,19
|
Size=638,225
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x00000006,0
|
DockId=0x00000006,0
|
||||||
|
|
||||||
[Window][Render Stats]
|
[Window][Render Stats]
|
||||||
Pos=8,628
|
Pos=0,636
|
||||||
Size=1568,225
|
Size=639,225
|
||||||
Collapsed=0
|
Collapsed=0
|
||||||
DockId=0x0000000E,0
|
DockId=0x00000004,0
|
||||||
|
|
||||||
[Docking][Data]
|
[Docking][Data]
|
||||||
DockSpace ID=0xC0DFADC4 Pos=8,27 Size=1568,826 Split=X
|
DockSpace ID=0xC0DFADC4 Pos=8,27 Size=1568,826 Split=X
|
||||||
DockNode ID=0x00000001 Parent=0xC0DFADC4 SizeRef=330,1094 Selected=0x393905AB
|
DockNode ID=0x00000001 Parent=0xC0DFADC4 SizeRef=330,1094 Selected=0x393905AB
|
||||||
DockNode ID=0x00000003 Parent=0xC0DFADC4 SizeRef=1700,1094 CentralNode=1
|
DockNode ID=0x00000003 Parent=0xC0DFADC4 SizeRef=1700,1094 CentralNode=1
|
||||||
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=8,27 Size=1568,826 Split=Y
|
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=0,19 Size=1584,842 Split=X
|
||||||
DockNode ID=0x0000000A Parent=0xCCBD8CF7 SizeRef=1568,599 Split=Y
|
DockNode ID=0x00000002 Parent=0xCCBD8CF7 SizeRef=1743,826 Split=Y
|
||||||
DockNode ID=0x00000004 Parent=0x0000000A SizeRef=1568,598 Split=X
|
DockNode ID=0x0000000A Parent=0x00000002 SizeRef=1568,599 Split=X
|
||||||
DockNode ID=0x00000009 Parent=0x00000004 SizeRef=281,974 Split=Y Selected=0x031DC75C
|
DockNode ID=0x00000009 Parent=0x0000000A SizeRef=281,974 Split=Y Selected=0x031DC75C
|
||||||
DockNode ID=0x00000007 Parent=0x00000009 SizeRef=289,547 Selected=0x031DC75C
|
DockNode ID=0x00000007 Parent=0x00000009 SizeRef=289,547 Selected=0x0B098C4B
|
||||||
DockNode ID=0x00000008 Parent=0x00000009 SizeRef=289,545 Selected=0x393905AB
|
DockNode ID=0x00000008 Parent=0x00000009 SizeRef=289,545 Selected=0x393905AB
|
||||||
DockNode ID=0x0000000D Parent=0x00000004 SizeRef=1285,974 Split=X
|
DockNode ID=0x0000000D Parent=0x0000000A SizeRef=1460,974 Split=Y
|
||||||
DockNode ID=0x00000002 Parent=0x0000000D SizeRef=940,826 Split=Y
|
DockNode ID=0x0000000B Parent=0x0000000D SizeRef=1568,637 CentralNode=1 Selected=0x321620B2
|
||||||
DockNode ID=0x0000000B Parent=0x00000002 SizeRef=1568,637 CentralNode=1
|
DockNode ID=0x0000000C Parent=0x0000000D SizeRef=1568,335 Selected=0x139FDA3F
|
||||||
DockNode ID=0x0000000C Parent=0x00000002 SizeRef=1568,335 Selected=0x139FDA3F
|
DockNode ID=0x0000000E Parent=0x00000002 SizeRef=1568,225 Split=X Selected=0xD99DEA49
|
||||||
DockNode ID=0x00000005 Parent=0x0000000D SizeRef=343,826 Selected=0x9F035453
|
DockNode ID=0x00000004 Parent=0x0000000E SizeRef=882,225 Selected=0xD99DEA49
|
||||||
DockNode ID=0x00000006 Parent=0x0000000A SizeRef=1568,226 Selected=0xAB74BEE9
|
DockNode ID=0x00000006 Parent=0x0000000E SizeRef=881,225 Selected=0xAB74BEE9
|
||||||
DockNode ID=0x0000000E Parent=0xCCBD8CF7 SizeRef=1568,225 Selected=0xD99DEA49
|
DockNode ID=0x00000005 Parent=0xCCBD8CF7 SizeRef=303,826 Selected=0x9F035453
|
||||||
|
|
||||||
|
@@ -196,6 +196,12 @@ public :
|
|||||||
|
|
||||||
private :
|
private :
|
||||||
|
|
||||||
|
// Thread de culling
|
||||||
|
std::thread m_CullingThread;
|
||||||
|
std::atomic<bool> m_CullingActive;
|
||||||
|
std::mutex m_ObjectsMutex;
|
||||||
|
void CullingThreadFunction();
|
||||||
|
|
||||||
|
|
||||||
std::mutex m_TerrainMutex;
|
std::mutex m_TerrainMutex;
|
||||||
std::vector<std::tuple<float, float, float, std::string, int>> m_TerrainGenerationData;
|
std::vector<std::tuple<float, float, float, std::string, int>> m_TerrainGenerationData;
|
||||||
|
@@ -201,7 +201,8 @@ protected:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ModelClass();
|
ModelClass();
|
||||||
ModelClass(const ModelClass&);
|
ModelClass(const ModelClass&) = delete;
|
||||||
|
ModelClass& operator=(const ModelClass&) = delete;
|
||||||
~ModelClass();
|
~ModelClass();
|
||||||
|
|
||||||
//bool Initialize(ID3D11Device*, ID3D11DeviceContext*, char*, std::vector<ID3D11ShaderResourceView*>);
|
//bool Initialize(ID3D11Device*, ID3D11DeviceContext*, char*, std::vector<ID3D11ShaderResourceView*>);
|
||||||
|
@@ -32,6 +32,9 @@ public:
|
|||||||
Object();
|
Object();
|
||||||
~Object();
|
~Object();
|
||||||
|
|
||||||
|
Object(const Object&) = delete;
|
||||||
|
Object& operator=(const Object&) = delete;
|
||||||
|
|
||||||
void SetScaleMatrix(XMMATRIX scaleMatrix);
|
void SetScaleMatrix(XMMATRIX scaleMatrix);
|
||||||
void SetRotateMatrix(XMMATRIX rotateMatrix);
|
void SetRotateMatrix(XMMATRIX rotateMatrix);
|
||||||
void SetTranslateMatrix(XMMATRIX translateMatrix);
|
void SetTranslateMatrix(XMMATRIX translateMatrix);
|
||||||
@@ -50,7 +53,6 @@ public:
|
|||||||
|
|
||||||
XMVECTOR GetPosition();
|
XMVECTOR GetPosition();
|
||||||
XMVECTOR GetRotation();
|
XMVECTOR GetRotation();
|
||||||
void Render(ID3D11DeviceContext* deviceContext);
|
|
||||||
XMVECTOR GetScale();
|
XMVECTOR GetScale();
|
||||||
|
|
||||||
void SetVelocity(XMVECTOR);
|
void SetVelocity(XMVECTOR);
|
||||||
@@ -148,10 +150,5 @@ private:
|
|||||||
float m_alpha = 0.0f;
|
float m_alpha = 0.0f;
|
||||||
float m_initialStretch = 0.0f;
|
float m_initialStretch = 0.0f;
|
||||||
float m_springConstant = 10.0f;
|
float m_springConstant = 10.0f;
|
||||||
|
|
||||||
bool m_instancingEnabled;
|
|
||||||
int m_instanceCount;
|
|
||||||
ID3D11Buffer* m_instanceBuffer;
|
|
||||||
std::vector<XMMATRIX> m_instanceTransforms;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@@ -54,12 +54,18 @@ ApplicationClass::ApplicationClass() : m_ShouldQuit(false)
|
|||||||
ApplicationClass::~ApplicationClass()
|
ApplicationClass::~ApplicationClass()
|
||||||
{
|
{
|
||||||
m_ShouldQuit = true;
|
m_ShouldQuit = true;
|
||||||
|
m_CullingActive = false;
|
||||||
|
|
||||||
// Joindre le thread pour s'assurer qu'il se termine correctement
|
// Joindre les threads pour s'assurer qu'ils se terminent correctement
|
||||||
if (m_PhysicsThread.joinable())
|
if (m_PhysicsThread.joinable())
|
||||||
{
|
{
|
||||||
m_PhysicsThread.join();
|
m_PhysicsThread.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_CullingThread.joinable())
|
||||||
|
{
|
||||||
|
m_CullingThread.join();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -468,6 +474,9 @@ bool ApplicationClass::Initialize(int screenWidth, int screenHeight, HWND hwnd,
|
|||||||
skybox->Initialize(m_Direct3D);
|
skybox->Initialize(m_Direct3D);
|
||||||
m_Skybox.push_back(skybox->ConstructSkybox());
|
m_Skybox.push_back(skybox->ConstructSkybox());
|
||||||
|
|
||||||
|
m_CullingActive = true;
|
||||||
|
m_CullingThread = std::thread(&ApplicationClass::CullingThreadFunction, this);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (const std::exception& e)
|
catch (const std::exception& e)
|
||||||
{
|
{
|
||||||
@@ -1277,7 +1286,7 @@ void ApplicationClass::AddKobject(std::wstring& filepath)
|
|||||||
string filename = p.stem().string();
|
string filename = p.stem().string();
|
||||||
|
|
||||||
size_t convertedChars = 0;
|
size_t convertedChars = 0;
|
||||||
wcstombs_s(&convertedChars, modelFilename, sizeof(modelFilename), filepath.c_str(), _TRUNCATE);
|
(void)wcstombs_s(&convertedChars, modelFilename, sizeof(modelFilename), filepath.c_str(), _TRUNCATE);
|
||||||
|
|
||||||
filesystem::current_path(m_WFolder);
|
filesystem::current_path(m_WFolder);
|
||||||
|
|
||||||
@@ -1593,14 +1602,77 @@ void ApplicationClass::SetScreenWidth(int width)
|
|||||||
m_screenWidth = width;
|
m_screenWidth = width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ApplicationClass::CullingThreadFunction()
|
||||||
|
{
|
||||||
|
Logger::Get().Log("Thread de culling d<>marr<72>", __FILE__, __LINE__, Logger::LogLevel::Info);
|
||||||
|
|
||||||
|
while (m_CullingActive)
|
||||||
|
{
|
||||||
|
// Construction du frustum une fois par cycle de culling
|
||||||
|
ConstructFrustum();
|
||||||
|
|
||||||
|
// S'assurer que la skybox est toujours visible
|
||||||
|
{
|
||||||
|
std::lock_guard<std::mutex> lock(m_ObjectsMutex);
|
||||||
|
for (auto* skyboxObject : m_Skybox)
|
||||||
|
{
|
||||||
|
if (skyboxObject)
|
||||||
|
{
|
||||||
|
skyboxObject->SetVisible(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Traitement des files d'objets normaux (sans la skybox)
|
||||||
|
std::vector<std::reference_wrapper<std::vector<Object*>>> queues = {
|
||||||
|
std::ref(m_object), std::ref(m_cubes), std::ref(m_terrainChunk)
|
||||||
|
};
|
||||||
|
|
||||||
|
for (auto& queueRef : queues)
|
||||||
|
{
|
||||||
|
std::vector<Object*>& queue = queueRef.get();
|
||||||
|
|
||||||
|
std::lock_guard<std::mutex> lock(m_ObjectsMutex);
|
||||||
|
|
||||||
|
for (auto* object : queue)
|
||||||
|
{
|
||||||
|
if (!object) continue;
|
||||||
|
|
||||||
|
// Extraction des donn<6E>es de position
|
||||||
|
XMVECTOR position = object->GetPosition();
|
||||||
|
float x = XMVectorGetX(position);
|
||||||
|
float y = XMVectorGetY(position);
|
||||||
|
float z = XMVectorGetZ(position);
|
||||||
|
|
||||||
|
// Calcul du rayon approximatif
|
||||||
|
XMVECTOR scale = object->GetScale();
|
||||||
|
float radius = max(max(XMVectorGetX(scale), XMVectorGetY(scale)), XMVectorGetZ(scale));
|
||||||
|
|
||||||
|
// V<>rification du frustum
|
||||||
|
bool visible = m_FrustumCulling.CheckCube(x, y, z, radius, GetFrustumTolerance());
|
||||||
|
object->SetVisible(visible);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pause pour <20>viter de surcharger le CPU
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(16)); // ~60 Hz
|
||||||
|
}
|
||||||
|
|
||||||
|
Logger::Get().Log("Thread de culling termin<69>", __FILE__, __LINE__, Logger::LogLevel::Info);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool ApplicationClass::RenderPass(const std::vector<std::reference_wrapper<std::vector<Object*>>>& RenderQueues, XMFLOAT4* diffuse, XMFLOAT4* position, XMFLOAT4* ambient, XMMATRIX view, XMMATRIX projection)
|
bool ApplicationClass::RenderPass(const std::vector<std::reference_wrapper<std::vector<Object*>>>& RenderQueues, XMFLOAT4* diffuse, XMFLOAT4* position, XMFLOAT4* ambient, XMMATRIX view, XMMATRIX projection)
|
||||||
{
|
{
|
||||||
XMMATRIX worldMatrix, scaleMatrix, rotateMatrix, translateMatrix, srMatrix;
|
std::lock_guard<std::mutex> lock(m_ObjectsMutex);
|
||||||
|
XMMATRIX scaleMatrix, rotateMatrix, translateMatrix ;
|
||||||
bool result;
|
bool result;
|
||||||
|
|
||||||
int renderCount = 0;
|
int renderCount = 0;
|
||||||
|
|
||||||
ConstructFrustum();
|
//ConstructFrustum();
|
||||||
|
|
||||||
for (const auto& RenderQueue : RenderQueues)
|
for (const auto& RenderQueue : RenderQueues)
|
||||||
{
|
{
|
||||||
@@ -1619,33 +1691,27 @@ bool ApplicationClass::RenderPass(const std::vector<std::reference_wrapper<std::
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
XMVECTOR objposition = object->GetPosition();
|
|
||||||
float x = XMVectorGetX(objposition);
|
|
||||||
float y = XMVectorGetY(objposition);
|
|
||||||
float z = XMVectorGetZ(objposition);
|
|
||||||
float radius = object->GetBoundingRadius();
|
|
||||||
|
|
||||||
// Check if the object has physics enabled
|
// Check if the object has physics enabled
|
||||||
if (object->IsPhysicsEnabled())
|
if (object->IsPhysicsEnabled())
|
||||||
{
|
{
|
||||||
object->UpdatePosition(m_Timer->GetTime());
|
object->UpdatePosition(m_Timer->GetTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
// V<>rifie si l'objet est dans le frustum
|
if (!object->IsVisible())
|
||||||
if (!m_FrustumCulling.CheckCube(x, y, z, radius, GetFrustumTolerance()))
|
|
||||||
{
|
{
|
||||||
object->SetVisible(false);
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
object->SetVisible(true); // L'objet est visible
|
|
||||||
renderCount++;
|
renderCount++;
|
||||||
|
|
||||||
scaleMatrix = object->GetScaleMatrix();
|
scaleMatrix = object->GetScaleMatrix();
|
||||||
rotateMatrix = object->GetRotateMatrix();
|
rotateMatrix = object->GetRotateMatrix();
|
||||||
translateMatrix = object->GetTranslateMatrix();
|
translateMatrix = object->GetTranslateMatrix();
|
||||||
|
|
||||||
srMatrix = XMMatrixMultiply(scaleMatrix, rotateMatrix);
|
XMMATRIX worldMatrix = XMMatrixMultiply(
|
||||||
worldMatrix = XMMatrixMultiply(srMatrix, translateMatrix);
|
XMMatrixMultiply(scaleMatrix, rotateMatrix),
|
||||||
|
translateMatrix
|
||||||
|
);
|
||||||
|
|
||||||
object->Render(m_Direct3D->GetDeviceContext());
|
object->Render(m_Direct3D->GetDeviceContext());
|
||||||
|
|
||||||
|
@@ -19,32 +19,130 @@ imguiManager::~imguiManager()
|
|||||||
|
|
||||||
bool imguiManager::Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceContext* deviceContext)
|
bool imguiManager::Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceContext* deviceContext)
|
||||||
{
|
{
|
||||||
Logger::Get().Log("Initializing imgui", __FILE__, __LINE__, Logger::LogLevel::Initialize);
|
Logger::Get().Log("Initializing imgui", __FILE__, __LINE__, Logger::LogLevel::Initialize);
|
||||||
|
|
||||||
m_device = device;
|
m_device = device;
|
||||||
m_deviceContext = deviceContext;
|
m_deviceContext = deviceContext;
|
||||||
|
|
||||||
IMGUI_CHECKVERSION();
|
|
||||||
ImGui::CreateContext();
|
|
||||||
io = &ImGui::GetIO();
|
|
||||||
io->ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard; // Enable Keyboard Controls
|
|
||||||
io->ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable Docking
|
|
||||||
|
|
||||||
|
IMGUI_CHECKVERSION();
|
||||||
|
ImGui::CreateContext();
|
||||||
|
io = &ImGui::GetIO();
|
||||||
|
io->ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
|
||||||
|
io->ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
||||||
|
io->FontGlobalScale = 1.0f;
|
||||||
|
|
||||||
ImGui_ImplWin32_Init(hwnd);
|
ImGui_ImplWin32_Init(hwnd);
|
||||||
ImGui_ImplDX11_Init(m_device, m_deviceContext);
|
ImGui_ImplDX11_Init(m_device, m_deviceContext);
|
||||||
|
|
||||||
// Setup style
|
// Appliquer un th<74>me sombre de base
|
||||||
ImGui::StyleColorsDark();
|
ImGui::StyleColorsDark();
|
||||||
// Set the window background color to be a transparent black/gray
|
|
||||||
ImGui::GetStyle().Colors[ImGuiCol_WindowBg] = ImVec4(0, 0, 0, 0.5f);
|
// D<>finir les couleurs pour une interface de type <20>diteur sobre
|
||||||
// Set the menu bar background color to be a transparent black/gray
|
ImGuiStyle& style = ImGui::GetStyle();
|
||||||
ImGui::GetStyle().Colors[ImGuiCol_MenuBarBg] = ImVec4(0, 0, 0, 0.5f);
|
|
||||||
|
// Palette de couleurs sobres inspir<69>e des <20>diteurs modernes
|
||||||
|
ImVec4 background_dark = ImVec4(0.10f, 0.10f, 0.10f, 1.00f); // Fond fonc<6E>
|
||||||
|
ImVec4 background = ImVec4(0.15f, 0.15f, 0.15f, 1.00f); // Fond principal
|
||||||
|
ImVec4 background_light = ImVec4(0.20f, 0.20f, 0.20f, 1.00f); // Fond clair
|
||||||
|
ImVec4 accent = ImVec4(0.14f, 0.44f, 0.80f, 0.50f); // Accent bleu
|
||||||
|
ImVec4 accent_light = ImVec4(0.14f, 0.44f, 0.80f, 1.00f); // Accent bleu vif
|
||||||
|
ImVec4 text = ImVec4(1.0f, 1.0f, 1.0f, 1.00f); // Texte plus blanc
|
||||||
|
ImVec4 text_dim = ImVec4(0.70f, 0.70f, 0.70f, 1.00f);
|
||||||
|
|
||||||
|
// Ajustements de style g<>n<EFBFBD>raux
|
||||||
|
style.WindowPadding = ImVec2(4.0f, 4.0f); // Moins de padding dans les fen<65>tres
|
||||||
|
style.FramePadding = ImVec2(4.0f, 3.0f); // Moins de padding dans les cadres
|
||||||
|
style.ItemSpacing = ImVec2(4.0f, 3.0f); // Moins d'espace entre les widgets
|
||||||
|
style.ItemInnerSpacing = ImVec2(3.0f, 3.0f); // Moins d'espace interne
|
||||||
|
style.DisplayWindowPadding = ImVec2(0.0f, 0.0f); // Pas de padding pour l'affichage
|
||||||
|
style.DisplaySafeAreaPadding = ImVec2(0.0f, 0.0f);
|
||||||
|
style.TouchExtraPadding = ImVec2(0.0f, 0.0f);
|
||||||
|
style.IndentSpacing = 20.0f;
|
||||||
|
style.ScrollbarSize = 14.0f;
|
||||||
|
style.GrabMinSize = 10.0f;
|
||||||
|
|
||||||
|
// Arrondis
|
||||||
|
style.WindowRounding = 4.0f;
|
||||||
|
style.ChildRounding = 4.0f;
|
||||||
|
style.FrameRounding = 3.0f;
|
||||||
|
style.PopupRounding = 4.0f;
|
||||||
|
style.ScrollbarRounding = 9.0f;
|
||||||
|
style.GrabRounding = 3.0f;
|
||||||
|
style.TabRounding = 4.0f;
|
||||||
|
|
||||||
|
// Couleurs principales
|
||||||
|
style.Colors[ImGuiCol_Text] = text;
|
||||||
|
style.Colors[ImGuiCol_TextDisabled] = text_dim;
|
||||||
|
style.Colors[ImGuiCol_WindowBg] = background;
|
||||||
|
style.Colors[ImGuiCol_ChildBg] = background_dark;
|
||||||
|
style.Colors[ImGuiCol_PopupBg] = background_dark;
|
||||||
|
style.Colors[ImGuiCol_Border] = ImVec4(0.25f, 0.25f, 0.27f, 1.00f);
|
||||||
|
style.Colors[ImGuiCol_BorderShadow] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
|
||||||
|
|
||||||
|
// Encadrements
|
||||||
|
style.Colors[ImGuiCol_FrameBg] = background_light;
|
||||||
|
style.Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.25f, 0.25f, 0.25f, 1.00f);
|
||||||
|
style.Colors[ImGuiCol_FrameBgActive] = ImVec4(0.30f, 0.30f, 0.30f, 1.00f);
|
||||||
|
|
||||||
|
// Titres
|
||||||
|
style.Colors[ImGuiCol_TitleBg] = background_dark;
|
||||||
|
style.Colors[ImGuiCol_TitleBgActive] = accent;
|
||||||
|
style.Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.12f, 0.12f, 0.12f, 0.90f);
|
||||||
|
|
||||||
|
// <20>l<EFBFBD>ments de menu
|
||||||
|
style.Colors[ImGuiCol_MenuBarBg] = background_dark;
|
||||||
|
style.Colors[ImGuiCol_ScrollbarBg] = background_dark;
|
||||||
|
style.Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.40f, 0.40f, 0.40f, 1.00f);
|
||||||
|
style.Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);
|
||||||
|
style.Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.60f, 0.60f, 0.60f, 1.00f);
|
||||||
|
|
||||||
|
// Boutons et interactions
|
||||||
|
style.Colors[ImGuiCol_CheckMark] = accent_light;
|
||||||
|
style.Colors[ImGuiCol_SliderGrab] = accent;
|
||||||
|
style.Colors[ImGuiCol_SliderGrabActive] = accent_light;
|
||||||
|
style.Colors[ImGuiCol_Button] = background_light;
|
||||||
|
style.Colors[ImGuiCol_ButtonHovered] = ImVec4(0.30f, 0.30f, 0.30f, 1.00f);
|
||||||
|
style.Colors[ImGuiCol_ButtonActive] = accent;
|
||||||
|
|
||||||
|
// En-t<>tes et onglets
|
||||||
|
style.Colors[ImGuiCol_Header] = ImVec4(0.20f, 0.20f, 0.20f, 1.00f);
|
||||||
|
style.Colors[ImGuiCol_HeaderHovered] = ImVec4(0.25f, 0.25f, 0.25f, 1.00f);
|
||||||
|
style.Colors[ImGuiCol_HeaderActive] = accent;
|
||||||
|
|
||||||
|
style.Colors[ImGuiCol_Separator] = ImVec4(0.28f, 0.28f, 0.28f, 1.00f);
|
||||||
|
style.Colors[ImGuiCol_SeparatorHovered] = ImVec4(0.45f, 0.45f, 0.45f, 1.00f);
|
||||||
|
style.Colors[ImGuiCol_SeparatorActive] = accent;
|
||||||
|
|
||||||
|
style.Colors[ImGuiCol_Tab] = background_dark;
|
||||||
|
style.Colors[ImGuiCol_TabHovered] = accent;
|
||||||
|
style.Colors[ImGuiCol_TabActive] = accent;
|
||||||
|
style.Colors[ImGuiCol_TabUnfocused] = background_dark;
|
||||||
|
style.Colors[ImGuiCol_TabUnfocusedActive] = background;
|
||||||
|
|
||||||
|
// Autres <20>l<EFBFBD>ments
|
||||||
|
style.Colors[ImGuiCol_DockingPreview] = accent;
|
||||||
|
style.Colors[ImGuiCol_DockingEmptyBg] = background_light;
|
||||||
|
|
||||||
|
// Charger une police avec une meilleure nettet<65>
|
||||||
|
ImFontConfig fontConfig;
|
||||||
|
fontConfig.OversampleH = 2; // Sur<75>chantillonnage horizontal
|
||||||
|
fontConfig.OversampleV = 2; // Sur<75>chantillonnage vertical
|
||||||
|
fontConfig.PixelSnapH = true; // Alignement sur la grille de pixels
|
||||||
|
fontConfig.RasterizerMultiply = 1.2f; // L<>g<EFBFBD>re augmentation de l'<27>paisseur
|
||||||
|
|
||||||
Logger::Get().Log("imgui initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
|
io->Fonts->AddFontDefault(&fontConfig);
|
||||||
|
|
||||||
return true;
|
// OU charger une police personnalis<69>e (d<>commenter si vous avez la police)
|
||||||
|
// io->Fonts->AddFontFromFileTTF("assets/fonts/roboto.ttf", 16.0f, &fontConfig);
|
||||||
|
|
||||||
|
|
||||||
|
unsigned char* pixels;
|
||||||
|
int width, height;
|
||||||
|
io->Fonts->GetTexDataAsRGBA32(&pixels, &width, &height);
|
||||||
|
|
||||||
|
Logger::Get().Log("imgui initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void imguiManager::Shutdown()
|
void imguiManager::Shutdown()
|
||||||
@@ -77,54 +175,61 @@ void imguiManager::NewFrame()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void imguiManager::SetupDockspace(ApplicationClass* app) {
|
void imguiManager::SetupDockspace(ApplicationClass* app) {
|
||||||
ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking;
|
// Configuration du style pour supprimer l'espace autour des fen<65>tres dock<63>es
|
||||||
ImGuiViewport* viewport = ImGui::GetMainViewport();
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
|
||||||
ImGui::SetNextWindowPos(viewport->Pos);
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
||||||
ImGui::SetNextWindowSize(viewport->Size);
|
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
||||||
ImGui::SetNextWindowViewport(viewport->ID);
|
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
|
// Configuration du style pour les n<>uds de dock
|
||||||
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
|
ImGui::PushStyleVar(ImGuiStyleVar_DockingSeparatorSize, 1.0f); // R<>duit l'<27>paisseur des s<>parateurs
|
||||||
window_flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove;
|
|
||||||
window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus;
|
// Configuration de la fen<65>tre principale
|
||||||
|
ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking;
|
||||||
|
ImGuiViewport* viewport = ImGui::GetMainViewport();
|
||||||
|
ImGui::SetNextWindowPos(viewport->Pos);
|
||||||
|
ImGui::SetNextWindowSize(viewport->Size);
|
||||||
|
ImGui::SetNextWindowViewport(viewport->ID);
|
||||||
|
window_flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove;
|
||||||
|
window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus;
|
||||||
|
|
||||||
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0, 0, 0, 0));
|
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0, 0, 0, 0));
|
||||||
|
|
||||||
|
ImGui::Begin("DockSpace", nullptr, window_flags);
|
||||||
|
|
||||||
|
// Pop des styles apr<70>s avoir cr<63><72> la fen<65>tre principale
|
||||||
|
ImGui::PopStyleVar(4); // 4 car nous avons pouss<73> 4 variables de style
|
||||||
|
ImGui::PopStyleColor();
|
||||||
|
|
||||||
ImGui::Begin("DockSpace", nullptr, window_flags);
|
// Configuration du DockSpace
|
||||||
ImGui::PopStyleVar(2);
|
ImGuiID dockspace_id = ImGui::GetID("MainDockSpace");
|
||||||
ImGui::PopStyleColor();
|
ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags_PassthruCentralNode;
|
||||||
|
ImGui::DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), dockspace_flags);
|
||||||
|
|
||||||
|
if (ImGui::BeginMenuBar()) {
|
||||||
|
if (ImGui::BeginMenu("Windows")) {
|
||||||
|
ImGui::MenuItem("Object Window", NULL, &showObjectWindow);
|
||||||
|
ImGui::MenuItem("Terrain Window", NULL, &showTerrainWindow);
|
||||||
|
ImGui::MenuItem("Light Window", NULL, &showLightWindow);
|
||||||
|
ImGui::MenuItem("Engine Settings Window", NULL, &showEngineSettingsWindow);
|
||||||
|
ImGui::MenuItem("Log Window", NULL, &showLogWindow);
|
||||||
|
ImGui::MenuItem("Render Stats", NULL, &showStatsWindow);
|
||||||
|
ImGui::EndMenu();
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui::BeginMenuBar()) {
|
if (ImGui::BeginMenu("Scene")) {
|
||||||
if (ImGui::BeginMenu("Windows")) {
|
if (ImGui::MenuItem("Save Scene")) {
|
||||||
ImGui::MenuItem("Object Window", NULL, &showObjectWindow);
|
app->SaveScene();
|
||||||
ImGui::MenuItem("Terrain Window", NULL, &showTerrainWindow);
|
}
|
||||||
ImGui::MenuItem("Light Window", NULL, &showLightWindow);
|
if (ImGui::MenuItem("Load Scene")) {
|
||||||
ImGui::MenuItem("Engine Settings Window", NULL, &showEngineSettingsWindow);
|
app->LoadScene();
|
||||||
ImGui::MenuItem("Log Window", NULL, &showLogWindow);
|
}
|
||||||
ImGui::MenuItem("Render Stats", NULL, &showStatsWindow);
|
ImGui::EndMenu();
|
||||||
ImGui::EndMenu();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Scene file menu
|
ImGui::EndMenuBar();
|
||||||
if (ImGui::BeginMenu("Scene")) {
|
}
|
||||||
if (ImGui::MenuItem("Save Scene")) {
|
|
||||||
// Save the scene
|
|
||||||
app->SaveScene();
|
|
||||||
}
|
|
||||||
if (ImGui::MenuItem("Load Scene")) {
|
|
||||||
// Load the scene
|
|
||||||
app->LoadScene();
|
|
||||||
}
|
|
||||||
ImGui::EndMenu();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndMenuBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGuiID dockspace_id = ImGui::GetID("MainDockSpace");
|
ImGui::End();
|
||||||
ImGui::DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), ImGuiDockNodeFlags_PassthruCentralNode);
|
|
||||||
|
|
||||||
ImGui::End();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void imguiManager::WidgetSpeedSlider(float* speed)
|
void imguiManager::WidgetSpeedSlider(float* speed)
|
||||||
@@ -539,23 +644,6 @@ void imguiManager::WidgetTerrainWindow(ApplicationClass* app)
|
|||||||
|
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
|
|
||||||
// int input area for the number of cubes
|
|
||||||
static int numCubes = 10;
|
|
||||||
ImGui::InputInt("Number of Cubes", &numCubes);
|
|
||||||
if (numCubes < 1)
|
|
||||||
{
|
|
||||||
numCubes = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::Separator();
|
|
||||||
|
|
||||||
if (ImGui::Button("Generate Big Cube Terrain"))
|
|
||||||
{
|
|
||||||
app->CreateBigCube(numCubes);
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::Separator();
|
|
||||||
|
|
||||||
if (ImGui::Button("Delete All Terrain Cubes"))
|
if (ImGui::Button("Delete All Terrain Cubes"))
|
||||||
{
|
{
|
||||||
app->DeleteTerrain();
|
app->DeleteTerrain();
|
||||||
|
@@ -6,16 +6,23 @@ ModelClass::ModelClass()
|
|||||||
m_vertexBuffer = 0;
|
m_vertexBuffer = 0;
|
||||||
m_indexBuffer = 0;
|
m_indexBuffer = 0;
|
||||||
m_model = 0;
|
m_model = 0;
|
||||||
|
m_vertexCount = 0;
|
||||||
|
m_indexCount = 0;
|
||||||
|
m_Textures.diffuse.clear();
|
||||||
|
m_Textures.normal.clear();
|
||||||
|
m_Textures.specular.clear();
|
||||||
|
m_Textures.alpha.clear();
|
||||||
|
m_Textures.diffusePaths.clear();
|
||||||
|
m_Textures.normalPaths.clear();
|
||||||
|
m_Textures.specularPaths.clear();
|
||||||
|
m_Textures.alphaPaths.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ModelClass::ModelClass(const ModelClass& other)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
ModelClass::~ModelClass()
|
ModelClass::~ModelClass()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ModelClass::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceContext, char* modelFilename, const TextureContainer& textures) {
|
bool ModelClass::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceContext, char* modelFilename, const TextureContainer& textures) {
|
||||||
@@ -240,94 +247,110 @@ bool ModelClass::LoadModel(char* filename)
|
|||||||
|
|
||||||
bool ModelClass::LoadObjModel(char* filename)
|
bool ModelClass::LoadObjModel(char* filename)
|
||||||
{
|
{
|
||||||
|
// Lecture optimis<69>e du fichier en mode binaire
|
||||||
std::string line;
|
std::ifstream fin(filename, std::ios::in | std::ios::binary);
|
||||||
std::ifstream fin(filename);
|
if (!fin)
|
||||||
|
{
|
||||||
|
Logger::Get().Log("<EFBFBD>chec d'ouverture du fichier mod<6F>le", __FILE__, __LINE__, Logger::LogLevel::Error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// If it could not open the file then exit.
|
// Lecture du fichier entier d'un coup (<28>vite la lecture ligne par ligne)
|
||||||
if (!fin)
|
fin.seekg(0, std::ios::end);
|
||||||
{
|
const size_t fileSize = fin.tellg();
|
||||||
Logger::Get().Log("Failed to open model file", __FILE__, __LINE__, Logger::LogLevel::Error);
|
fin.seekg(0, std::ios::beg);
|
||||||
return false;
|
|
||||||
}
|
std::string fileContent;
|
||||||
|
fileContent.resize(fileSize);
|
||||||
|
fin.read(&fileContent[0], fileSize);
|
||||||
|
fin.close();
|
||||||
|
|
||||||
std::vector<XMFLOAT3> temp_positions;
|
// Pr<50>-allocation des vecteurs (<28>vite les r<>allocations)
|
||||||
std::vector<XMFLOAT2> temp_texcoords;
|
const size_t estimatedVertices = fileSize / 150;
|
||||||
std::vector<XMFLOAT3> temp_normals;
|
std::vector<XMFLOAT3> temp_positions;
|
||||||
std::vector<ModelType> temp_model;
|
std::vector<XMFLOAT2> temp_texcoords;
|
||||||
|
std::vector<XMFLOAT3> temp_normals;
|
||||||
|
std::vector<ModelType> temp_model;
|
||||||
|
|
||||||
// Read the file line by line.
|
temp_positions.reserve(estimatedVertices);
|
||||||
while (std::getline(fin, line))
|
temp_texcoords.reserve(estimatedVertices);
|
||||||
{
|
temp_normals.reserve(estimatedVertices);
|
||||||
std::istringstream iss(line);
|
temp_model.reserve(estimatedVertices * 3);
|
||||||
std::string type;
|
|
||||||
iss >> type;
|
|
||||||
|
|
||||||
if (type == "v") // Vertex position
|
// Analyse du contenu
|
||||||
{
|
std::istringstream iss(fileContent);
|
||||||
XMFLOAT3 pos;
|
std::string line;
|
||||||
iss >> pos.x >> pos.y >> pos.z;
|
|
||||||
temp_positions.push_back(pos);
|
|
||||||
}
|
|
||||||
else if (type == "vt") // Texture coordinate
|
|
||||||
{
|
|
||||||
XMFLOAT2 tex;
|
|
||||||
iss >> tex.x >> tex.y;
|
|
||||||
temp_texcoords.push_back(tex);
|
|
||||||
}
|
|
||||||
else if (type == "vn") // Vertex normal
|
|
||||||
{
|
|
||||||
XMFLOAT3 norm;
|
|
||||||
iss >> norm.x >> norm.y >> norm.z;
|
|
||||||
temp_normals.push_back(norm);
|
|
||||||
}
|
|
||||||
else if (type == "f") // Face
|
|
||||||
{
|
|
||||||
int posIndex[3], texIndex[3], normIndex[3];
|
|
||||||
char slash; // To skip the slashes '/' in the .obj file format
|
|
||||||
for (int i = 0; i < 3; i++) // Each face in .obj format has 3 vertices
|
|
||||||
{
|
|
||||||
iss >> posIndex[i] >> slash >> texIndex[i] >> slash >> normIndex[i];
|
|
||||||
|
|
||||||
// Handle negative indices
|
while (std::getline(iss, line))
|
||||||
if (posIndex[i] < 0) posIndex[i] += temp_positions.size() + 1;
|
{
|
||||||
if (texIndex[i] < 0) texIndex[i] += temp_texcoords.size() + 1;
|
if (line.empty() || line[0] == '#') continue;
|
||||||
if (normIndex[i] < 0) normIndex[i] += temp_normals.size() + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// .obj indices start from 1, not 0
|
// Analyse plus rapide bas<61>e sur le premier caract<63>re
|
||||||
for (int i = 0; i < 3; i++)
|
if (line[0] == 'v')
|
||||||
{
|
{
|
||||||
ModelType vertex;
|
if (line[1] == ' ') // Position de sommet
|
||||||
vertex.x = temp_positions[posIndex[i] - 1].x;
|
{
|
||||||
vertex.y = temp_positions[posIndex[i] - 1].y;
|
XMFLOAT3 pos;
|
||||||
vertex.z = temp_positions[posIndex[i] - 1].z;
|
sscanf_s(line.c_str() + 2, "%f %f %f", &pos.x, &pos.y, &pos.z);
|
||||||
vertex.tu = temp_texcoords[texIndex[i] - 1].x;
|
temp_positions.push_back(pos);
|
||||||
vertex.tv = temp_texcoords[texIndex[i] - 1].y;
|
}
|
||||||
vertex.nx = temp_normals[normIndex[i] - 1].x;
|
else if (line[1] == 't') // Coordonn<6E>es de texture
|
||||||
vertex.ny = temp_normals[normIndex[i] - 1].y;
|
{
|
||||||
vertex.nz = temp_normals[normIndex[i] - 1].z;
|
XMFLOAT2 tex;
|
||||||
temp_model.push_back(vertex);
|
sscanf_s(line.c_str() + 3, "%f %f", &tex.x, &tex.y);
|
||||||
}
|
temp_texcoords.push_back(tex);
|
||||||
}
|
}
|
||||||
}
|
else if (line[1] == 'n') // Normales
|
||||||
|
{
|
||||||
|
XMFLOAT3 norm;
|
||||||
|
sscanf_s(line.c_str() + 3, "%f %f %f", &norm.x, &norm.y, &norm.z);
|
||||||
|
temp_normals.push_back(norm);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (line[0] == 'f')
|
||||||
|
{
|
||||||
|
int posIndex[3], texIndex[3], normIndex[3];
|
||||||
|
const char* linePtr = line.c_str() + 2; // Sauter "f "
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
// Analyse rapide du format v/vt/vn
|
||||||
|
sscanf_s(linePtr, "%d/%d/%d", &posIndex[i], &texIndex[i], &normIndex[i]);
|
||||||
|
|
||||||
|
// Avancer au prochain ensemble d'indices
|
||||||
|
while (*linePtr && *linePtr != ' ') linePtr++;
|
||||||
|
while (*linePtr == ' ') linePtr++;
|
||||||
|
|
||||||
m_vertexCount = temp_model.size();
|
if (posIndex[i] < 0) posIndex[i] += temp_positions.size() + 1;
|
||||||
m_indexCount = temp_model.size();
|
if (texIndex[i] < 0) texIndex[i] += temp_texcoords.size() + 1;
|
||||||
|
if (normIndex[i] < 0) normIndex[i] += temp_normals.size() + 1;
|
||||||
|
}
|
||||||
|
|
||||||
// Create the model using the vertex count that was read in.
|
for (int i = 0; i < 3; i++)
|
||||||
m_model = new ModelType[m_vertexCount];
|
{
|
||||||
for (int i = 0; i < m_vertexCount; i++)
|
ModelType vertex{};
|
||||||
{
|
vertex.x = temp_positions[posIndex[i] - 1].x;
|
||||||
m_model[i] = temp_model[i];
|
vertex.y = temp_positions[posIndex[i] - 1].y;
|
||||||
}
|
vertex.z = temp_positions[posIndex[i] - 1].z;
|
||||||
|
vertex.tu = temp_texcoords[texIndex[i] - 1].x;
|
||||||
|
vertex.tv = temp_texcoords[texIndex[i] - 1].y;
|
||||||
|
vertex.nx = temp_normals[normIndex[i] - 1].x;
|
||||||
|
vertex.ny = temp_normals[normIndex[i] - 1].y;
|
||||||
|
vertex.nz = temp_normals[normIndex[i] - 1].z;
|
||||||
|
temp_model.push_back(vertex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fin.close();
|
// Allocation et copie efficace du mod<6F>le final
|
||||||
|
m_vertexCount = temp_model.size();
|
||||||
|
m_indexCount = temp_model.size();
|
||||||
|
m_model = new ModelType[m_vertexCount];
|
||||||
|
std::memcpy(m_model, temp_model.data(), m_vertexCount * sizeof(ModelType));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool ModelClass::LoadTxtModel(char* filename)
|
bool ModelClass::LoadTxtModel(char* filename)
|
||||||
{
|
{
|
||||||
ifstream fin;
|
ifstream fin;
|
||||||
|
@@ -18,19 +18,10 @@ Object::Object()// Initialize the reference here
|
|||||||
m_isGrounded = false;
|
m_isGrounded = false;
|
||||||
m_id = NULL;
|
m_id = NULL;
|
||||||
m_boundingRadius = 1.0f;
|
m_boundingRadius = 1.0f;
|
||||||
m_instancingEnabled = false;
|
|
||||||
m_instanceCount = 0;
|
|
||||||
m_instanceBuffer = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Object::~Object()
|
Object::~Object()
|
||||||
{
|
{
|
||||||
// Lib<69>rer le buffer d'instances
|
|
||||||
if (m_instanceBuffer)
|
|
||||||
{
|
|
||||||
m_instanceBuffer->Release();
|
|
||||||
m_instanceBuffer = nullptr;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Object::SetScaleMatrix(XMMATRIX scaleMatrix)
|
void Object::SetScaleMatrix(XMMATRIX scaleMatrix)
|
||||||
@@ -100,45 +91,6 @@ XMVECTOR Object::GetRotation()
|
|||||||
return XMVectorSet(rotationX, rotationY, rotationZ, 0.0f);
|
return XMVectorSet(rotationX, rotationY, rotationZ, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Object::Render(ID3D11DeviceContext* deviceContext)
|
|
||||||
{
|
|
||||||
unsigned int strides[2];
|
|
||||||
unsigned int offsets[2];
|
|
||||||
ID3D11Buffer* bufferPointers[2];
|
|
||||||
|
|
||||||
// Configurer les vertex et index buffers
|
|
||||||
strides[0] = sizeof(VertexType);
|
|
||||||
offsets[0] = 0;
|
|
||||||
bufferPointers[0] = m_vertexBuffer;
|
|
||||||
|
|
||||||
// Si l'instanciation est activ<69>e
|
|
||||||
if (m_instancingEnabled && m_instanceBuffer)
|
|
||||||
{
|
|
||||||
// Configurer le buffer d'instances
|
|
||||||
strides[1] = sizeof(XMMATRIX);
|
|
||||||
offsets[1] = 0;
|
|
||||||
bufferPointers[1] = m_instanceBuffer;
|
|
||||||
|
|
||||||
// D<>finir les deux buffers (vertex et instance) sur le pipeline
|
|
||||||
deviceContext->IASetVertexBuffers(0, 2, bufferPointers, strides, offsets);
|
|
||||||
deviceContext->IASetIndexBuffer(m_indexBuffer, DXGI_FORMAT_R32_UINT, 0);
|
|
||||||
deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
|
||||||
|
|
||||||
// Dessiner les instances
|
|
||||||
deviceContext->DrawIndexedInstanced(m_indexCount, m_instanceCount, 0, 0, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Rendu normal sans instanciation
|
|
||||||
deviceContext->IASetVertexBuffers(0, 1, bufferPointers, strides, offsets);
|
|
||||||
deviceContext->IASetIndexBuffer(m_indexBuffer, DXGI_FORMAT_R32_UINT, 0);
|
|
||||||
deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
|
|
||||||
|
|
||||||
// Dessiner l'objet normalement
|
|
||||||
deviceContext->DrawIndexed(m_indexCount, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
XMVECTOR Object::GetScale()
|
XMVECTOR Object::GetScale()
|
||||||
{
|
{
|
||||||
XMFLOAT4X4 matrix;
|
XMFLOAT4X4 matrix;
|
||||||
@@ -435,66 +387,4 @@ bool Object::LoadTexturesFromPath(std::vector<std::wstring>& texturePaths, Textu
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
bool Object::SetupInstancing(ID3D11Device* device, const std::vector<XMMATRIX>& instanceTransforms)
|
|
||||||
{
|
|
||||||
// Stocker les matrices de transformation
|
|
||||||
m_instanceTransforms = instanceTransforms;
|
|
||||||
m_instanceCount = static_cast<int>(instanceTransforms.size());
|
|
||||||
|
|
||||||
// Lib<69>rer le buffer d'instances existant si n<>cessaire
|
|
||||||
if (m_instanceBuffer)
|
|
||||||
{
|
|
||||||
m_instanceBuffer->Release();
|
|
||||||
m_instanceBuffer = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cr<43>er le buffer d'instances
|
|
||||||
D3D11_BUFFER_DESC instanceBufferDesc;
|
|
||||||
ZeroMemory(&instanceBufferDesc, sizeof(instanceBufferDesc));
|
|
||||||
instanceBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
|
|
||||||
instanceBufferDesc.ByteWidth = sizeof(XMMATRIX) * m_instanceCount;
|
|
||||||
instanceBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
|
||||||
instanceBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
|
||||||
instanceBufferDesc.MiscFlags = 0;
|
|
||||||
instanceBufferDesc.StructureByteStride = 0;
|
|
||||||
|
|
||||||
D3D11_SUBRESOURCE_DATA instanceData;
|
|
||||||
ZeroMemory(&instanceData, sizeof(instanceData));
|
|
||||||
instanceData.pSysMem = instanceTransforms.data();
|
|
||||||
|
|
||||||
HRESULT result = device->CreateBuffer(&instanceBufferDesc, &instanceData, &m_instanceBuffer);
|
|
||||||
if (FAILED(result))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Object::EnableInstancing(bool enabled)
|
|
||||||
{
|
|
||||||
m_instancingEnabled = enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Object::SetInstanceCount(int count)
|
|
||||||
{
|
|
||||||
m_instanceCount = count;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Ajoutez <20>galement ces m<>thodes pour acc<63>der aux donn<6E>es d'instanciation
|
|
||||||
bool Object::IsInstancingEnabled() const
|
|
||||||
{
|
|
||||||
return m_instancingEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
int Object::GetInstanceCount() const
|
|
||||||
{
|
|
||||||
return m_instanceCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
ID3D11Buffer* Object::GetInstanceBuffer() const
|
|
||||||
{
|
|
||||||
return m_instanceBuffer;
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user