5 Commits

30 changed files with 1832 additions and 870 deletions

View File

@@ -6,6 +6,7 @@
<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/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/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/imguiManager.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/imguiManager.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/stats.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/stats.h" afterDir="false" /> <change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/stats.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/stats.h" afterDir="false" />
@@ -29,9 +30,46 @@
<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://2" 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="cidr-memory-view://10" 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://C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/um/d3d11.h" root0="SKIP_HIGHLIGHTING" />
<setting file="file://C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/um/dinput.h" root0="SKIP_HIGHLIGHTING" /> <setting file="file://C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0/um/dinput.h" root0="SKIP_HIGHLIGHTING" />
<setting file="file://C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.44.35207/include/memory" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/enginecustom/include/Inc/VertexTypes.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$/../../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" />
@@ -60,7 +98,7 @@
"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": "Debug", "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",
@@ -71,7 +109,7 @@
"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.environmentSetup",
"vue.rearranger.settings.migration": "true" "vue.rearranger.settings.migration": "true"
} }
}]]></component> }]]></component>
@@ -213,7 +251,18 @@
<workItem from="1748861785837" duration="357000" /> <workItem from="1748861785837" duration="357000" />
<workItem from="1748865625274" duration="797000" /> <workItem from="1748865625274" duration="797000" />
<workItem from="1748869642637" duration="3049000" /> <workItem from="1748869642637" duration="3049000" />
<workItem from="1748954607174" duration="13379000" /> <workItem from="1748954607174" duration="14202000" />
<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" />
<workItem from="1750351735497" duration="9648000" />
<workItem from="1750417484899" duration="2384000" />
<workItem from="1750420267631" duration="148000" />
<workItem from="1750592598277" duration="332000" />
<workItem from="1750699146323" duration="10385000" />
</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" />

View File

@@ -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

View File

@@ -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

View File

@@ -119,6 +119,15 @@
<ClInclude Include="src\inc\system\camera_class.h" /> <ClInclude Include="src\inc\system\camera_class.h" />
<ClInclude Include="src\inc\system\d_3d_class.h" /> <ClInclude Include="src\inc\system\d_3d_class.h" />
<ClInclude Include="src\inc\system\display_plane_class.h" /> <ClInclude Include="src\inc\system\display_plane_class.h" />
<ClInclude Include="src\inc\system\ecs\component.h" />
<ClInclude Include="src\inc\system\ecs\components\identity_component.h" />
<ClInclude Include="src\inc\system\ecs\components\physics_component.h" />
<ClInclude Include="src\inc\system\ecs\components\render_component.h" />
<ClInclude Include="src\inc\system\ecs\components\shader_component.h" />
<ClInclude Include="src\inc\system\ecs\components\transform_component.h" />
<ClInclude Include="src\inc\system\ecs\entity.h" />
<ClInclude Include="src\inc\system\ecs\entity_manager.h" />
<ClInclude Include="src\inc\system\ecs\systems\render_system.h" />
<ClInclude Include="src\inc\system\font_class.h" /> <ClInclude Include="src\inc\system\font_class.h" />
<ClInclude Include="src\inc\system\fps_class.h" /> <ClInclude Include="src\inc\system\fps_class.h" />
<ClInclude Include="src\inc\system\fps_limiter.h" /> <ClInclude Include="src\inc\system\fps_limiter.h" />
@@ -181,11 +190,15 @@
<DestinationFolders>F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\\src\hlsl</DestinationFolders> <DestinationFolders>F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\\src\hlsl</DestinationFolders>
<DestinationFileName>%(Filename)%(Extension)</DestinationFileName> <DestinationFileName>%(Filename)%(Extension)</DestinationFileName>
<FileType>Document</FileType> <FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\depth.vs"> <CopyFileToFolders Include="src\hlsl\depth.vs">
<DestinationFolders>F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\\src\hlsl</DestinationFolders> <DestinationFolders>F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\\src\hlsl</DestinationFolders>
<DestinationFileName>%(Filename)%(Extension)</DestinationFileName> <DestinationFileName>%(Filename)%(Extension)</DestinationFileName>
<FileType>Document</FileType> <FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\font.ps"> <CopyFileToFolders Include="src\hlsl\font.ps">
<FileType>Document</FileType> <FileType>Document</FileType>
@@ -261,11 +274,15 @@
<DestinationFolders>F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\\src\hlsl</DestinationFolders> <DestinationFolders>F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\\src\hlsl</DestinationFolders>
<DestinationFileName>%(Filename)%(Extension)</DestinationFileName> <DestinationFileName>%(Filename)%(Extension)</DestinationFileName>
<FileType>Document</FileType> <FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\skybox.vs"> <CopyFileToFolders Include="src\hlsl\skybox.vs">
<DestinationFolders>F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\\src\hlsl</DestinationFolders> <DestinationFolders>F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\\src\hlsl</DestinationFolders>
<DestinationFileName>%(Filename)%(Extension)</DestinationFileName> <DestinationFileName>%(Filename)%(Extension)</DestinationFileName>
<FileType>Document</FileType> <FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\specmap.ps"> <CopyFileToFolders Include="src\hlsl\specmap.ps">
<FileType>Document</FileType> <FileType>Document</FileType>
@@ -346,6 +363,82 @@
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Skybox</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Skybox</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Skybox</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Skybox</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\dirt01.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\EmptyTexture.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\font01.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\ground01.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\light01.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\marble01.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\moss01.png">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</ExcludedFromBuild>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\normal01.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\spec02.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite01.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite02.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite03.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite04.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\stone01.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\stone01.tga">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\wall.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\wall01.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\water01.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<Image Include="KhaoticIcon.ico" /> <Image Include="KhaoticIcon.ico" />
<CopyFileToFolders Include="sprite01.tga" /> <CopyFileToFolders Include="sprite01.tga" />
<CopyFileToFolders Include="sprite02.tga" /> <CopyFileToFolders Include="sprite02.tga" />
@@ -362,6 +455,42 @@
<CopyFileToFolders Include="sprite_data_01.txt" /> <CopyFileToFolders Include="sprite_data_01.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="assets\Model\OBJ\86.obj" />
<Content Include="assets\Model\OBJ\cone.obj" />
<Content Include="assets\Model\OBJ\invertcube.obj" />
<Content Include="assets\Model\OBJ\isosphere.obj" />
<Content Include="assets\Model\OBJ\monke.obj" />
<Content Include="assets\Model\OBJ\plane.obj" />
<Content Include="assets\Model\OBJ\vaisseautri.obj" />
<Content Include="assets\Model\TXT\bath.txt" />
<Content Include="assets\Model\TXT\chunk.txt" />
<Content Include="assets\Model\TXT\cube.txt" />
<Content Include="assets\Model\TXT\ground.txt" />
<Content Include="assets\Model\TXT\plane.txt" />
<Content Include="assets\Model\TXT\sphere.txt" />
<Content Include="assets\Model\TXT\square.txt" />
<Content Include="assets\Model\TXT\wall.txt" />
<Content Include="assets\Model\TXT\water.txt" />
<CopyFileToFolders Include="assets\Texture\alpha01.png" />
<Content Include="assets\Texture\dirt01.png" />
<Content Include="assets\Texture\EmptyTexture.png" />
<Content Include="assets\Texture\font01.png" />
<Content Include="assets\Texture\ground01.png" />
<Content Include="assets\Texture\imgui.ini" />
<Content Include="assets\Texture\light01.png" />
<Content Include="assets\Texture\marble01.png" />
<Content Include="assets\Texture\moss01.png" />
<Content Include="assets\Texture\normal01.png" />
<Content Include="assets\Texture\spec02.png" />
<Content Include="assets\Texture\sprite01.png" />
<Content Include="assets\Texture\sprite02.png" />
<Content Include="assets\Texture\sprite03.png" />
<Content Include="assets\Texture\sprite04.png" />
<Content Include="assets\Texture\stone01.png" />
<Content Include="assets\Texture\stone01.tga" />
<Content Include="assets\Texture\wall.png" />
<Content Include="assets\Texture\wall01.png" />
<Content Include="assets\Texture\water01.png" />
<Content Include="TODO.txt" /> <Content Include="TODO.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@@ -372,8 +501,89 @@
</CopyFileToFolders> </CopyFileToFolders>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="assets\Texture\imgui.ini" />
<None Include="packages.config" /> <None Include="packages.config" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="assets\Model\OBJ\86.obj">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\cone.obj">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\invertcube.obj">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\isosphere.obj">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\monke.obj">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\plane.obj">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\vaisseau.obj">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\vaisseautri.obj">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
</CopyFileToFolders>
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="assets\Model\TXT\bath.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\chunk.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\cube.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\ground.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\plane.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\sphere.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\square.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\wall.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\water.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
</ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion> <VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>

View File

@@ -240,6 +240,12 @@
<ClCompile Include="src\src\system\timer_class.cpp"> <ClCompile Include="src\src\system\timer_class.cpp">
<Filter>Fichiers sources</Filter> <Filter>Fichiers sources</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\src\system\scene_manager.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\stats.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="include\imconfig.h"> <ClInclude Include="include\imconfig.h">
@@ -428,6 +434,12 @@
<ClInclude Include="src\inc\system\timer_class.h"> <ClInclude Include="src\inc\system\timer_class.h">
<Filter>Fichiers d%27en-tête</Filter> <Filter>Fichiers d%27en-tête</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\inc\system\scene_manager.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\stats.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Image Include="KhaoticIcon.ico"> <Image Include="KhaoticIcon.ico">
@@ -512,8 +524,119 @@
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\depth.ps" /> <CopyFileToFolders Include="src\hlsl\depth.ps" />
<CopyFileToFolders Include="src\hlsl\depth.vs" /> <CopyFileToFolders Include="src\hlsl\depth.vs" />
<CopyFileToFolders Include="assets\Texture\alpha01.png">
<Filter>Fichiers de ressources</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\dirt01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\EmptyTexture.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\font01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\ground01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\light01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\marble01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\moss01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\normal01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\spec02.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite02.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite03.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite04.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\stone01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\stone01.tga">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\wall.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\wall01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\water01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\vaisseautri.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\vaisseau.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\plane.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\monke.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\isosphere.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\invertcube.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\cone.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\86.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\bath.txt">
<Filter>Assets\Model\TXT</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\chunk.txt">
<Filter>Assets\Model\TXT</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\cube.txt">
<Filter>Assets\Model\TXT</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\ground.txt">
<Filter>Assets\Model\TXT</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\plane.txt">
<Filter>Assets\Model\TXT</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\sphere.txt">
<Filter>Assets\Model\TXT</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\square.txt">
<Filter>Assets\Model\TXT</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\wall.txt">
<Filter>Assets\Model\TXT</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\water.txt">
<Filter>Assets\Model\TXT</Filter>
</CopyFileToFolders>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <None Include="packages.config" />
<None Include="assets\Texture\imgui.ini">
<Filter>Texture</Filter>
</None>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -1,114 +1,67 @@
[Window][DockSpace]
Pos=0,0
Size=1584,861
Collapsed=0
[Window][Debug##Default] [Window][Debug##Default]
Pos=60,60 Pos=60,60
Size=400,400 Size=400,400
Collapsed=0 Collapsed=0
[Window][Khaotic Engine] [Window][Khaotic Engine]
Pos=1281,19 Pos=1267,19
Size=303,631 Size=317,842
Collapsed=0 Collapsed=0
DockId=0x0000000F,0 DockId=0x00000005,0
[Window][render Stats]
Pos=0,630
Size=1584,231
Collapsed=0
DockId=0x00000009,0
[Window][Objects] [Window][Objects]
Pos=0,19 Pos=0,19
Size=281,842 Size=234,842
Collapsed=0 Collapsed=0
DockId=0x00000011,0 DockId=0x0000000B,0
[Window][Terrain] [Window][Terrain]
Pos=0,19 Pos=0,19
Size=280,842 Size=266,842
Collapsed=0 Collapsed=0
DockId=0x00000007,0 DockId=0x00000007,0
[Window][Log Window]
Pos=0,630
Size=1584,231
Collapsed=0
DockId=0x0000000A,0
[Window][Light] [Window][Light]
Pos=0,19 Pos=0,19
Size=281,842 Size=234,609
Collapsed=0 Collapsed=0
DockId=0x00000012,0 DockId=0x0000000B,0
[Window][Shader Manager]
Pos=8,27
Size=330,487
Collapsed=0
DockId=0x00000001,2
[Window][Engine Settings] [Window][Engine Settings]
Pos=1281,527 Pos=1267,462
Size=303,334 Size=317,166
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 Collapsed=0
DockId=0x00000006,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
[Window][render Stats]
Pos=0,652
Size=1584,209
Collapsed=0
DockId=0x00000014,0
[Docking][Data] [Docking][Data]
DockSpace ID=0xC0DFADC4 Pos=8,27 Size=1568,826 Split=X DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=0,19 Size=1584,842 Split=Y
DockNode ID=0x00000001 Parent=0xC0DFADC4 SizeRef=330,1094 Selected=0x393905AB DockNode ID=0x00000003 Parent=0xCCBD8CF7 SizeRef=1584,609 Split=X
DockNode ID=0x00000003 Parent=0xC0DFADC4 SizeRef=1700,1094 CentralNode=1 DockNode ID=0x0000000B Parent=0x00000003 SizeRef=234,842 Selected=0x321620B2
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=0,19 Size=1584,842 Split=Y DockNode ID=0x0000000C Parent=0x00000003 SizeRef=1348,842 Split=X
DockNode ID=0x00000013 Parent=0xCCBD8CF7 SizeRef=1584,631 Split=X DockNode ID=0x00000007 Parent=0x0000000C SizeRef=266,842 Selected=0x393905AB
DockNode ID=0x00000002 Parent=0x00000013 SizeRef=1743,826 Split=Y DockNode ID=0x00000008 Parent=0x0000000C SizeRef=1316,842 Split=X
DockNode ID=0x0000000A Parent=0x00000002 SizeRef=1568,599 Split=X DockNode ID=0x00000001 Parent=0x00000008 SizeRef=1265,842 CentralNode=1
DockNode ID=0x00000009 Parent=0x0000000A SizeRef=281,974 Split=Y Selected=0x031DC75C DockNode ID=0x00000002 Parent=0x00000008 SizeRef=317,842 Split=Y Selected=0x9F035453
DockNode ID=0x00000011 Parent=0x00000009 SizeRef=281,441 Selected=0x031DC75C DockNode ID=0x00000005 Parent=0x00000002 SizeRef=317,441 Selected=0x9F035453
DockNode ID=0x00000012 Parent=0x00000009 SizeRef=281,440 Selected=0x321620B2 DockNode ID=0x00000006 Parent=0x00000002 SizeRef=317,166 Selected=0x0B098C4B
DockNode ID=0x0000000D Parent=0x0000000A SizeRef=1460,974 Split=Y DockNode ID=0x00000004 Parent=0xCCBD8CF7 SizeRef=1584,231 Split=X Selected=0xF5D1BB37
DockNode ID=0x0000000B Parent=0x0000000D SizeRef=1568,637 Split=X Selected=0x321620B2 DockNode ID=0x00000009 Parent=0x00000004 SizeRef=792,231 Selected=0xF5D1BB37
DockNode ID=0x00000007 Parent=0x0000000B SizeRef=280,883 Selected=0x393905AB DockNode ID=0x0000000A Parent=0x00000004 SizeRef=790,231 Selected=0xAB74BEE9
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=0x00000013 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
DockNode ID=0x00000014 Parent=0xCCBD8CF7 SizeRef=1584,209 Selected=0xF5D1BB37

View File

@@ -13,7 +13,7 @@ public:
void Initialize(d_3d_class* d3dClassRef); // Get all the required references void Initialize(d_3d_class* d3dClassRef); // Get all the required references
object* ConstructSkybox(); object* ConstructSkybox(application_class* app);
// Variables // Variables

View File

@@ -9,8 +9,6 @@
#include "camera_class.h" #include "camera_class.h"
#include "object.h" #include "object.h"
#include "light_class.h" #include "light_class.h"
#include <vector>
#include <filesystem>
#include "bitmap_class.h" #include "bitmap_class.h"
#include "sprite_class.h" #include "sprite_class.h"
@@ -31,7 +29,15 @@
#include "physics.h" #include "physics.h"
#include "frustum.h" #include "frustum.h"
#include "skybox.h" #include "skybox.h"
#include "shadow_map.h"
#include "stats.h"
#include "ecs/components/identity_component.h"
#include "ecs/components/render_component.h"
#include "ecs/components/transform_component.h"
#include "ecs/components/physics_component.h"
#include "ecs/components/shader_component.h"
#include "ecs/systems/render_system.h"
#include <fstream> #include <fstream>
#include <WICTextureLoader.h> #include <WICTextureLoader.h>
@@ -42,9 +48,11 @@
#include <algorithm> #include <algorithm>
#include <DirectXMath.h> #include <DirectXMath.h>
#include <mutex> #include <mutex>
#include <memory>
#include <vector>
#include <filesystem>
#include "shadow_map.h" #include "ecs/entity_manager.h"
#include "stats.h"
///////////// /////////////
@@ -54,6 +62,8 @@ constexpr bool full_screen = false;
constexpr float screen_depth = 1000.0f; constexpr float screen_depth = 1000.0f;
constexpr float screen_near = 0.3f; constexpr float screen_near = 0.3f;
static std::map<std::string, std::shared_ptr<model_class>> g_model_cache;
struct input struct input
{ {
bool key_left = false; bool key_left = false;
@@ -78,8 +88,7 @@ public:
render_texture_class* get_refraction_texture() const { return refraction_texture_; }; render_texture_class* get_refraction_texture() const { return refraction_texture_; };
render_texture_class* get_reflection_texture() const { return reflection_texture_; }; render_texture_class* get_reflection_texture() const { return reflection_texture_; };
void create_big_cube(int side_count); bool create_big_cube(int side_count);
void process_terrain_generation();
virtual bool initialize(int, int, HWND, bool is_vulkan); virtual bool initialize(int, int, HWND, bool is_vulkan);
void shutdown(); void shutdown();
virtual bool frame(input_class*); virtual bool frame(input_class*);
@@ -126,14 +135,20 @@ public:
void set_cel_shading(const bool enable) { enable_cel_shading_ = enable; }; void set_cel_shading(const bool enable) { enable_cel_shading_ = enable; };
void set_vsync(bool vsync); void set_vsync(bool vsync) {
vsync_enabled_ = vsync;
if (direct_3d_) {
direct_3d_->set_vsync(vsync);
Logger::Get().Log("Setting Vsync to " + std::to_string(vsync), __FILE__, __LINE__);
}
};
bool get_vsync() const { return vsync_enabled_; }; bool get_vsync() const { return vsync_enabled_; };
HWND get_hwnd() const; HWND get_hwnd() const { return hwnd_; };
void set_hwnd(HWND hwnd); void set_hwnd(HWND hwnd) { hwnd_ = hwnd; };
bool is_windowed() const; bool is_windowed() const { return windowed_; };
void set_windowed(bool windowed); void set_windowed(bool windowed) { windowed_ = windowed; };
void set_window_size(const ImVec2 size) { window_size_ = size; }; void set_window_size(const ImVec2 size) { window_size_ = size; };
ImVec2 get_window_size() const { return window_size_; }; ImVec2 get_window_size() const { return window_size_; };
@@ -149,6 +164,7 @@ public:
void set_frustum(const frustum& frustum) { frustum_culling_ = frustum; }; void set_frustum(const frustum& frustum) { frustum_culling_ = frustum; };
void construct_frustum(); void construct_frustum();
int get_render_count() const { return render_count_; }; int get_render_count() const { return render_count_; };
void set_render_count(const int render_count) { render_count_ = render_count; }; void set_render_count(const int render_count) { render_count_ = render_count; };
float get_frustum_tolerance() const { return frustum_culling_tolerance_; }; float get_frustum_tolerance() const { return frustum_culling_tolerance_; };
@@ -174,6 +190,8 @@ private:
bool render_pass(const std::vector<std::reference_wrapper<std::vector<object*>>>& RenderQueues, XMFLOAT4* diffuse, XMFLOAT4* position, XMFLOAT4* ambient, XMMATRIX view, XMMATRIX projection); bool render_pass(const std::vector<std::reference_wrapper<std::vector<object*>>>& RenderQueues, XMFLOAT4* diffuse, XMFLOAT4* position, XMFLOAT4* ambient, XMMATRIX view, XMMATRIX projection);
void update_skybox_position(); void update_skybox_position();
void culling_thread_function();
void update_stats_after_modification();
public : public :
std::vector<ID3D11ShaderResourceView*> textures; std::vector<ID3D11ShaderResourceView*> textures;
@@ -184,8 +202,6 @@ private :
std::thread culling_thread_; std::thread culling_thread_;
std::atomic<bool> culling_active_; std::atomic<bool> culling_active_;
std::mutex objects_mutex_; std::mutex objects_mutex_;
void culling_thread_function();
std::mutex terrain_mutex_; std::mutex terrain_mutex_;
std::vector<std::tuple<float, float, float, std::string, int>> terrain_generation_data_; std::vector<std::tuple<float, float, float, std::string, int>> terrain_generation_data_;
@@ -226,11 +242,14 @@ private :
// ------------- OBJECTS -------------- // // ------------- OBJECTS -------------- //
// ------------------------------------ // // ------------------------------------ //
std::unique_ptr<ecs::EntityManager> entity_manager_;
object* selected_object_; object* selected_object_;
std::vector<object*> cubes_; std::vector<object*> cubes_;
std::vector<object*> terrain_chunk_; std::vector<object*> terrain_chunk_;
float speed_ = 0.1f; // speed for the demo spinning object
std::vector<object*> object_; std::vector<object*> object_;
float speed_ = 0.1f; // speed for the demo spinning object
std::vector<object*> imported_object_; std::vector<object*> imported_object_;
int object_id_ = 0; int object_id_ = 0;
std::vector<std::reference_wrapper<std::vector<object*>>> render_queues_; std::vector<std::reference_wrapper<std::vector<object*>>> render_queues_;

View File

@@ -0,0 +1,40 @@
#pragma once
#include <memory>
#include <typeindex>
#include <typeinfo>
namespace ecs {
// Classe de base pour tous les composants
class Component {
public:
Component() = default;
virtual ~Component() = default;
// Emp<6D>cher la copie
Component(const Component&) = delete;
Component& operator=(const Component&) = delete;
// Permettre le d<>placement
Component(Component&&) = default;
Component& operator=(Component&&) = default;
// Fonction virtuelle pour initialiser le composant
virtual void Initialize() {}
// Fonction virtuelle pour la mise <20> jour du composant
virtual void Update(float deltaTime) {}
};
// Alias utiles
using ComponentPtr = std::shared_ptr<Component>;
using ComponentTypeID = std::type_index;
// Fonction pour obtenir l'ID de type d'un composant
template<typename T>
ComponentTypeID GetComponentTypeID() {
static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
return std::type_index(typeid(T));
}
} // namespace ecs

View File

@@ -0,0 +1,58 @@
#pragma once
#include "../component.h"
#include <string>
namespace ecs {
enum class ObjectType
{
Sphere,
Cube,
Terrain,
Unknown
};
class IdentityComponent : public Component {
public:
IdentityComponent() : m_id(0), m_type(ObjectType::Unknown) {}
explicit IdentityComponent(int id) : m_id(id), m_type(ObjectType::Unknown) {}
IdentityComponent(int id, const std::string& name) : m_id(id), m_name(name), m_type(ObjectType::Unknown) {}
~IdentityComponent() = default;
void Initialize() override {}
void Update(float deltaTime) override {}
// Getters et setters
int GetId() const { return m_id; }
void SetId(int id) { m_id = id; }
const std::string& GetName() const { return m_name; }
void SetName(const std::string& name) { m_name = name; }
ObjectType GetType() const { return m_type; }
void SetType(ObjectType type) { m_type = type; }
// Conversions utiles
static std::string ObjectTypeToString(ObjectType type) {
switch (type) {
case ObjectType::Cube: return "Cube";
case ObjectType::Sphere: return "Sphere";
case ObjectType::Terrain: return "Terrain";
default: return "Unknown";
}
}
static ObjectType StringToObjectType(const std::string& str) {
if (str == "Cube") return ObjectType::Cube;
if (str == "Sphere") return ObjectType::Sphere;
if (str == "Terrain") return ObjectType::Terrain;
return ObjectType::Unknown;
}
private:
int m_id;
std::string m_name;
ObjectType m_type;
};
} // namespace ecs

View File

@@ -0,0 +1,110 @@
#pragma once
#include "../component.h"
#include <DirectXMath.h>
using namespace DirectX;
namespace ecs {
class PhysicsComponent : public Component {
public:
PhysicsComponent() {
m_Velocity = XMVectorZero();
m_Acceleration = XMVectorZero();
m_PreviousPosition = XMVectorZero();
m_Mass = 1.0f;
m_BoundingRadius = 1.0f;
m_IsGrounded = false;
m_IsPhysicsEnabled = false;
m_GravityEnabled = true;
}
~PhysicsComponent() = default;
void Initialize() override {
// Initialisation du composant physique
}
void Update(float deltaTime) override {
if (!m_IsPhysicsEnabled) return;
// Mise <20> jour de la v<>locit<69> bas<61>e sur l'acc<63>l<EFBFBD>ration
m_Velocity = m_Velocity + m_Acceleration * deltaTime;
// Si la physique est activ<69>e et qu'une fonction de mise <20> jour de position est d<>finie
if (m_UpdatePositionCallback) {
m_UpdatePositionCallback(m_Velocity * deltaTime);
}
}
// Lancement d'un objet
void LaunchObject(float alpha, float initialStretch, float springConstant) {
// Constants
const float gravity = -9.81f;
// Convert alpha from degrees to radians if needed
float alphaRadians = alpha * (XM_PI / 180.0f);
// Scale factors to make the physics simulation more visible
float scaleFactor = 200.0f; // Adjust this based on your world scale
// Calculate initial velocity magnitude
float velocityMagnitude = initialStretch * sqrtf(springConstant / m_Mass) *
sqrtf(1.0f - powf((m_Mass * gravity * sinf(alphaRadians) /
(springConstant * initialStretch)), 2.0f));
// Apply scale factor
velocityMagnitude *= scaleFactor;
// Calculate velocity components
XMVECTOR velocity = XMVectorSet(
velocityMagnitude * cosf(alphaRadians), // vx = v0 * cos(alpha)
velocityMagnitude * sinf(alphaRadians), // vy = v0 * sin(alpha)
0.0f, // z-component (0 for 2D trajectory)
0.0f
);
// Apply velocity
SetVelocity(velocity);
// Enable physics and reset grounded state
SetPhysicsEnabled(true);
SetGrounded(false);
}
// Setters
void SetVelocity(XMVECTOR velocity) { m_Velocity = velocity; }
void SetAcceleration(XMVECTOR acceleration) { m_Acceleration = acceleration; }
void SetMass(float mass) { m_Mass = mass; }
void SetGrounded(bool isGrounded) { m_IsGrounded = isGrounded; }
void SetPhysicsEnabled(bool enabled) { m_IsPhysicsEnabled = enabled; }
void SetBoundingRadius(float radius) { m_BoundingRadius = radius; }
void SetPreviousPosition(XMVECTOR position) { m_PreviousPosition = position; }
void SetGravityEnabled(bool enabled) { m_GravityEnabled = enabled; }
void SetUpdatePositionCallback(std::function<void(XMVECTOR)> callback) { m_UpdatePositionCallback = callback; }
// Getters
XMVECTOR GetVelocity() const { return m_Velocity; }
XMVECTOR GetAcceleration() const { return m_Acceleration; }
float GetMass() const { return m_Mass; }
bool IsGrounded() const { return m_IsGrounded; }
bool IsPhysicsEnabled() const { return m_IsPhysicsEnabled; }
float GetBoundingRadius() const { return m_BoundingRadius; }
XMVECTOR GetPreviousPosition() const { return m_PreviousPosition; }
bool IsGravityEnabled() const { return m_GravityEnabled; }
private:
XMVECTOR m_Velocity;
XMVECTOR m_Acceleration;
XMVECTOR m_PreviousPosition;
float m_Mass;
float m_BoundingRadius;
bool m_IsGrounded;
bool m_IsPhysicsEnabled;
bool m_GravityEnabled;
// Callback pour mettre <20> jour la position (sera connect<63> au TransformComponent)
std::function<void(XMVECTOR)> m_UpdatePositionCallback;
};
} // namespace ecs

View File

@@ -0,0 +1,124 @@
#pragma once
#include "../component.h"
#include "model_class.h"
#include <memory>
#include <string>
#include <map>
#include <WICTextureLoader.h>
// D<>claration externe de la variable globale d<>finie dans application_class.h
extern std::map<std::string, std::shared_ptr<model_class>> g_model_cache;
namespace ecs {
enum class TextureType
{
Diffuse,
Normal,
Specular,
Alpha,
Reflection
};
class RenderComponent : public Component {
public:
RenderComponent() : m_model(nullptr), m_isVisible(true) {}
~RenderComponent() = default;
void Initialize() override {}
void Update(float deltaTime) override {}
// Initialisation avec un mod<6F>le existant
bool InitializeWithModel(std::shared_ptr<model_class> model) {
if (!model) return false;
m_model = model;
return true;
}
// Initialisation avec un chemin de fichier
bool InitializeFromFile(ID3D11Device* device, ID3D11DeviceContext* deviceContext,
const char* modelFilename, TextureContainer& textureContainer) {
// V<>rifier si le mod<6F>le existe d<>j<EFBFBD> dans le cache
std::string filename(modelFilename);
auto it = g_model_cache.find(filename);
if (it != g_model_cache.end()) {
m_model = it->second;
} else {
// Cr<43>er un nouveau mod<6F>le
auto new_model = std::make_shared<model_class>();
if (!new_model->Initialize(device, deviceContext, const_cast<char*>(modelFilename), textureContainer)) {
return false;
}
g_model_cache[filename] = new_model;
m_model = new_model;
}
m_modelFilePath = modelFilename;
return true;
}
// Charger des textures depuis un chemin
bool LoadTexturesFromPath(std::vector<std::wstring>& texturePaths, TextureContainer& texturesContainer,
ID3D11Device* device, ID3D11DeviceContext* deviceContext) {
HRESULT result;
int i = 0;
for (const auto& texturePath : texturePaths) {
ID3D11ShaderResourceView* texture = nullptr;
result = DirectX::CreateWICTextureFromFile(device, deviceContext, texturePath.c_str(), nullptr, &texture);
if (FAILED(result)) {
return false;
}
texturesContainer.AssignTexture(texturesContainer, texture, texturePath, i);
i++;
}
return true;
}
// Getters et setters
std::shared_ptr<model_class> GetModel() const { return m_model; }
void SetModel(std::shared_ptr<model_class> model) { m_model = model; }
const std::string& GetModelFilePath() const { return m_modelFilePath; }
void SetModelFilePath(const std::string& path) { m_modelFilePath = path; }
bool IsVisible() const { return m_isVisible; }
void SetVisible(bool visible) { m_isVisible = visible; }
// Acc<63>s aux textures
ID3D11ShaderResourceView* GetTexture(TextureType type, int index = 0) {
if (!m_model) return nullptr;
switch (type) {
case TextureType::Diffuse:
return m_model->GetTexture(::TextureType::Diffuse, index);
case TextureType::Normal:
return m_model->GetTexture(::TextureType::Normal, index);
case TextureType::Specular:
return m_model->GetTexture(::TextureType::Specular, index);
case TextureType::Alpha:
return m_model->GetTexture(::TextureType::Alpha, index);
default:
return nullptr;
}
}
// Pour le rendu
int GetIndexCount() const {
return m_model ? m_model->GetIndexCount() : 0;
}
void Render(ID3D11DeviceContext* deviceContext) {
if (m_model && m_isVisible) {
m_model->Render(deviceContext);
}
}
private:
std::shared_ptr<model_class> m_model;
std::string m_modelFilePath;
bool m_isVisible;
};
} // namespace ecs

View File

@@ -0,0 +1,67 @@
#pragma once
#include "../component.h"
namespace ecs {
enum class ShaderType
{
CEL_SHADING,
LIGHTING,
NORMAL_MAPPING,
SPECULAR_MAPPING,
REFLECTION,
REFRACTION,
TEXTURE,
SKYBOX,
SUNLIGHT,
ALPHA_MAPPING
};
class ShaderComponent : public Component {
public:
ShaderComponent() : m_activeShader(ShaderType::LIGHTING) {}
~ShaderComponent() = default;
void Initialize() override {}
void Update(float deltaTime) override {}
// Getters et setters
ShaderType GetActiveShader() const { return m_activeShader; }
void SetActiveShader(ShaderType shader) { m_activeShader = shader; }
// Conversions utiles
static ShaderType StringToShaderType(const std::string& str) {
if (str == "ALPHA_MAPPING") return ShaderType::ALPHA_MAPPING;
if (str == "CEL_SHADING") return ShaderType::CEL_SHADING;
if (str == "NORMAL_MAPPING") return ShaderType::NORMAL_MAPPING;
if (str == "SPECULAR_MAPPING") return ShaderType::SPECULAR_MAPPING;
if (str == "TEXTURE") return ShaderType::TEXTURE;
if (str == "LIGHTING") return ShaderType::LIGHTING;
if (str == "SUNLIGHT") return ShaderType::SUNLIGHT;
if (str == "SKYBOX") return ShaderType::SKYBOX;
if (str == "REFLECTION") return ShaderType::REFLECTION;
if (str == "REFRACTION") return ShaderType::REFRACTION;
return ShaderType::TEXTURE;
}
static std::string ShaderTypeToString(ShaderType type) {
switch (type) {
case ShaderType::ALPHA_MAPPING: return "ALPHA_MAPPING";
case ShaderType::CEL_SHADING: return "CEL_SHADING";
case ShaderType::NORMAL_MAPPING: return "NORMAL_MAPPING";
case ShaderType::SPECULAR_MAPPING: return "SPECULAR_MAPPING";
case ShaderType::TEXTURE: return "TEXTURE";
case ShaderType::LIGHTING: return "LIGHTING";
case ShaderType::SUNLIGHT: return "SUNLIGHT";
case ShaderType::SKYBOX: return "SKYBOX";
case ShaderType::REFLECTION: return "REFLECTION";
case ShaderType::REFRACTION: return "REFRACTION";
default: return "TEXTURE";
}
}
private:
ShaderType m_activeShader;
};
} // namespace ecs

View File

@@ -0,0 +1,101 @@
#pragma once
#include "../component.h"
#include <DirectXMath.h>
using namespace DirectX;
namespace ecs {
class TransformComponent : public Component {
public:
TransformComponent() {
m_ScaleMatrix = XMMatrixIdentity();
m_RotateMatrix = XMMatrixIdentity();
m_TranslateMatrix = XMMatrixIdentity();
m_WorldMatrix = XMMatrixIdentity();
}
~TransformComponent() = default;
// M<>thodes pour les matrices
void SetPosition(XMVECTOR position) {
XMFLOAT4X4 matrix;
XMStoreFloat4x4(&matrix, m_TranslateMatrix);
matrix._41 = XMVectorGetX(position);
matrix._42 = XMVectorGetY(position);
matrix._43 = XMVectorGetZ(position);
m_TranslateMatrix = XMLoadFloat4x4(&matrix);
UpdateWorldMatrix();
}
void SetRotation(XMVECTOR rotation) {
m_RotateMatrix = XMMatrixRotationRollPitchYawFromVector(rotation);
UpdateWorldMatrix();
}
void SetScale(XMVECTOR scale) {
XMFLOAT4X4 matrix;
XMStoreFloat4x4(&matrix, m_ScaleMatrix);
matrix._11 = XMVectorGetX(scale);
matrix._22 = XMVectorGetY(scale);
matrix._33 = XMVectorGetZ(scale);
m_ScaleMatrix = XMLoadFloat4x4(&matrix);
UpdateWorldMatrix();
}
XMVECTOR GetPosition() const {
XMFLOAT4X4 matrix;
XMStoreFloat4x4(&matrix, m_TranslateMatrix);
return XMVectorSet(matrix._41, matrix._42, matrix._43, 0.0f);
}
XMVECTOR GetRotation() const {
XMFLOAT4X4 matrix;
XMStoreFloat4x4(&matrix, m_RotateMatrix);
float rotationX = atan2f(matrix._32, matrix._33);
float rotationY = atan2f(-matrix._31, sqrtf(matrix._32 * matrix._32 + matrix._33 * matrix._33));
float rotationZ = atan2f(matrix._21, matrix._11);
return XMVectorSet(rotationX, rotationY, rotationZ, 0.0f);
}
XMVECTOR GetScale() const {
XMFLOAT4X4 matrix;
XMStoreFloat4x4(&matrix, m_ScaleMatrix);
XMVECTOR row1 = XMLoadFloat3(reinterpret_cast<XMFLOAT3*>(&matrix._11));
XMVECTOR row2 = XMLoadFloat3(reinterpret_cast<XMFLOAT3*>(&matrix._21));
XMVECTOR row3 = XMLoadFloat3(reinterpret_cast<XMFLOAT3*>(&matrix._31));
XMVECTOR scale = XMVectorSet(
XMVectorGetX(XMVector3Length(row1)),
XMVectorGetX(XMVector3Length(row2)),
XMVectorGetX(XMVector3Length(row3)),
0.0f
);
return scale;
}
void UpdateWorldMatrix() {
m_WorldMatrix = m_ScaleMatrix * m_RotateMatrix * m_TranslateMatrix;
}
// Getters pour les matrices
XMMATRIX GetScaleMatrix() const { return m_ScaleMatrix; }
XMMATRIX GetRotateMatrix() const { return m_RotateMatrix; }
XMMATRIX GetTranslateMatrix() const { return m_TranslateMatrix; }
XMMATRIX GetWorldMatrix() const { return m_WorldMatrix; }
// Setters pour les matrices
void SetScaleMatrix(XMMATRIX matrix) { m_ScaleMatrix = matrix; UpdateWorldMatrix(); }
void SetRotateMatrix(XMMATRIX matrix) { m_RotateMatrix = matrix; UpdateWorldMatrix(); }
void SetTranslateMatrix(XMMATRIX matrix) { m_TranslateMatrix = matrix; UpdateWorldMatrix(); }
private:
XMMATRIX m_ScaleMatrix;
XMMATRIX m_RotateMatrix;
XMMATRIX m_TranslateMatrix;
XMMATRIX m_WorldMatrix;
};
} // namespace ecs

View File

@@ -0,0 +1,101 @@
#pragma once
#include "component.h"
#include <unordered_map>
#include <vector>
#include <memory>
#include <algorithm>
#include <cassert>
namespace ecs {
// Identifiant unique pour les entit<69>s
using EntityID = uint32_t;
class Entity {
public:
explicit Entity(EntityID id) : m_ID(id) {}
~Entity() = default;
// Emp<6D>cher la copie
Entity(const Entity&) = delete;
Entity& operator=(const Entity&) = delete;
// Permettre le d<>placement
Entity(Entity&&) = default;
Entity& operator=(Entity&&) = default;
// Getter pour l'ID
EntityID GetID() const { return m_ID; }
// Ajouter un composant
template<typename T, typename... Args>
std::shared_ptr<T> AddComponent(Args&&... args) {
static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
ComponentTypeID typeID = GetComponentTypeID<T>();
// V<>rifier si le composant existe d<>j<EFBFBD>
if (m_Components.find(typeID) != m_Components.end()) {
return std::static_pointer_cast<T>(m_Components[typeID]);
}
// Cr<43>er et ajouter le composant
auto component = std::make_shared<T>(std::forward<Args>(args)...);
m_Components[typeID] = component;
// Initialiser le composant
component->Initialize();
return component;
}
// R<>cup<75>rer un composant
template<typename T>
std::shared_ptr<T> GetComponent() {
static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
ComponentTypeID typeID = GetComponentTypeID<T>();
auto it = m_Components.find(typeID);
if (it != m_Components.end()) {
return std::static_pointer_cast<T>(it->second);
}
return nullptr;
}
// V<>rifier si l'entit<69> poss<73>de un composant
template<typename T>
bool HasComponent() const {
static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
ComponentTypeID typeID = GetComponentTypeID<T>();
return m_Components.find(typeID) != m_Components.end();
}
// Supprimer un composant
template<typename T>
void RemoveComponent() {
static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
ComponentTypeID typeID = GetComponentTypeID<T>();
auto it = m_Components.find(typeID);
if (it != m_Components.end()) {
m_Components.erase(it);
}
}
// Mettre <20> jour tous les composants
void UpdateComponents(float deltaTime) {
for (auto& [typeID, component] : m_Components) {
component->Update(deltaTime);
}
}
private:
EntityID m_ID;
std::unordered_map<ComponentTypeID, ComponentPtr> m_Components;
};
} // namespace ecs

View File

@@ -0,0 +1,95 @@
#pragma once
#include "entity.h"
#include <vector>
#include <unordered_map>
#include <queue>
namespace ecs {
class EntityManager {
public:
EntityManager() : m_NextEntityID(0) {}
~EntityManager() = default;
// Cr<43>er une nouvelle entit<69>
std::shared_ptr<Entity> CreateEntity() {
EntityID id;
// R<>utiliser les IDs des entit<69>s supprim<69>es si possible
if (!m_FreeIDs.empty()) {
id = m_FreeIDs.front();
m_FreeIDs.pop();
} else {
id = m_NextEntityID++;
}
auto entity = std::make_shared<Entity>(id);
m_Entities[id] = entity;
return entity;
}
// Supprimer une entit<69>
void DestroyEntity(EntityID id) {
auto it = m_Entities.find(id);
if (it != m_Entities.end()) {
m_Entities.erase(it);
m_FreeIDs.push(id); // Recycler l'ID
}
}
// Obtenir une entit<69> par son ID
std::shared_ptr<Entity> GetEntity(EntityID id) {
auto it = m_Entities.find(id);
if (it != m_Entities.end()) {
return it->second;
}
return nullptr;
}
// Mettre <20> jour toutes les entit<69>s
void UpdateEntities(float deltaTime) {
for (auto& [id, entity] : m_Entities) {
entity->UpdateComponents(deltaTime);
}
}
// Obtenir toutes les entit<69>s qui ont un composant sp<73>cifique
template<typename T>
std::vector<std::shared_ptr<Entity>> GetEntitiesWithComponent() {
static_assert(std::is_base_of<Component, T>::value, "T must derive from Component");
std::vector<std::shared_ptr<Entity>> result;
for (auto& [id, entity] : m_Entities) {
if (entity->HasComponent<T>()) {
result.push_back(entity);
}
}
return result;
}
// Obtenir le nombre d'entit<69>s
size_t GetEntityCount() const {
return m_Entities.size();
}
// Vider toutes les entit<69>s
void Clear() {
m_Entities.clear();
// Vider la file des IDs libres
std::queue<EntityID> empty;
std::swap(m_FreeIDs, empty);
m_NextEntityID = 0;
}
private:
EntityID m_NextEntityID;
std::unordered_map<EntityID, std::shared_ptr<Entity>> m_Entities;
std::queue<EntityID> m_FreeIDs; // IDs <20> r<>utiliser
};
} // namespace ecs

View File

@@ -0,0 +1,222 @@
#pragma once
#include "../entity_manager.h"
#include "../components/render_component.h"
#include "../components/transform_component.h"
#include "../components/shader_component.h"
#include "shader_manager_class.h"
#include <DirectXMath.h>
namespace ecs {
class RenderSystem {
public:
RenderSystem(ID3D11DeviceContext* deviceContext, shader_manager_class* shaderManager)
: m_deviceContext(deviceContext), m_shaderManager(shaderManager) {}
// Rendu d'une entit<69> sp<73>cifique
bool RenderEntity(std::shared_ptr<Entity> entity,
const DirectX::XMMATRIX& viewMatrix,
const DirectX::XMMATRIX& projectionMatrix,
const DirectX::XMFLOAT4* diffuseColors,
const DirectX::XMFLOAT4* lightPositions,
const DirectX::XMFLOAT4* ambientColors,
const DirectX::XMFLOAT3& cameraPosition,
const DirectX::XMFLOAT4& sunlightDiffuse,
const DirectX::XMFLOAT4& sunlightAmbient,
const DirectX::XMFLOAT3& sunlightDirection,
float sunlightIntensity) {
// V<>rifier si l'entit<69> a tous les composants n<>cessaires
auto transform = entity->GetComponent<TransformComponent>();
auto render = entity->GetComponent<RenderComponent>();
auto shader = entity->GetComponent<ShaderComponent>();
if (!transform || !render || !shader || !render->GetModel())
return false;
// Calculer la matrice monde
XMMATRIX scaleMatrix = transform->GetScaleMatrix();
XMMATRIX rotateMatrix = transform->GetRotateMatrix();
XMMATRIX translateMatrix = transform->GetTranslateMatrix();
XMMATRIX worldMatrix = XMMatrixMultiply(
XMMatrixMultiply(scaleMatrix, rotateMatrix),
translateMatrix
);
// Rendre le mod<6F>le
render->Render(m_deviceContext);
// S<>lectionner le shader appropri<72>
switch (shader->GetActiveShader()) {
case ShaderType::ALPHA_MAPPING:
return m_shaderManager->render_alpha_map_shader(
m_deviceContext,
render->GetIndexCount(),
worldMatrix,
viewMatrix,
projectionMatrix,
render->GetTexture(TextureType::Diffuse, 0),
render->GetTexture(TextureType::Diffuse, 1),
render->GetTexture(TextureType::Alpha, 0)
);
case ShaderType::CEL_SHADING:
return m_shaderManager->render_cel_shading_shader(
m_deviceContext,
render->GetIndexCount(),
worldMatrix,
viewMatrix,
projectionMatrix,
render->GetTexture(TextureType::Diffuse, 0),
sunlightDiffuse,
sunlightAmbient,
sunlightDirection,
sunlightIntensity
);
case ShaderType::NORMAL_MAPPING:
return m_shaderManager->render_normal_map_shader(
m_deviceContext,
render->GetIndexCount(),
worldMatrix,
viewMatrix,
projectionMatrix,
render->GetTexture(TextureType::Diffuse, 0),
render->GetTexture(TextureType::Normal, 0),
sunlightDirection,
sunlightDiffuse
);
case ShaderType::SPECULAR_MAPPING:
return m_shaderManager->render_spec_map_shader(
m_deviceContext,
render->GetIndexCount(),
worldMatrix,
viewMatrix,
projectionMatrix,
render->GetTexture(TextureType::Diffuse, 0),
render->GetTexture(TextureType::Normal, 0),
render->GetTexture(TextureType::Specular, 0),
sunlightDirection,
sunlightDiffuse,
cameraPosition,
sunlightDiffuse, // Couleur speculaire (<28> ajuster)
16.0f // Puissance speculaire (<28> ajuster)
);
case ShaderType::LIGHTING:
{
// Cr<43>er des copies locales non constantes des tableaux
DirectX::XMFLOAT4 localDiffuseColors[4];
DirectX::XMFLOAT4 localLightPositions[4];
DirectX::XMFLOAT4 localAmbientColors[4];
// Copier les donn<6E>es
for (int i = 0; i < 4; i++) {
localDiffuseColors[i] = diffuseColors[i];
localLightPositions[i] = lightPositions[i];
localAmbientColors[i] = ambientColors[i];
}
return m_shaderManager->renderlight_shader(
m_deviceContext,
render->GetIndexCount(),
worldMatrix,
viewMatrix,
projectionMatrix,
render->GetTexture(TextureType::Diffuse, 0),
localDiffuseColors,
localLightPositions,
localAmbientColors
);
}
case ShaderType::SUNLIGHT:
return m_shaderManager->render_sunlight_shader(
m_deviceContext,
render->GetIndexCount(),
worldMatrix,
viewMatrix,
projectionMatrix,
render->GetTexture(TextureType::Diffuse, 0),
sunlightDiffuse,
sunlightAmbient,
sunlightDirection,
sunlightIntensity
);
case ShaderType::SKYBOX:
return m_shaderManager->render_skybox_shader(
m_deviceContext,
render->GetIndexCount(),
worldMatrix,
viewMatrix,
projectionMatrix,
render->GetTexture(TextureType::Diffuse, 0),
sunlightDiffuse,
sunlightAmbient,
sunlightDirection,
sunlightIntensity
);
case ShaderType::TEXTURE:
default:
return m_shaderManager->render_texture_shader(
m_deviceContext,
render->GetIndexCount(),
worldMatrix,
viewMatrix,
projectionMatrix,
render->GetTexture(TextureType::Diffuse, 0)
);
}
}
// Rendu de toutes les entit<69>s avec les composants n<>cessaires
int RenderAllEntities(EntityManager* entityManager,
const DirectX::XMMATRIX& viewMatrix,
const DirectX::XMMATRIX& projectionMatrix,
const DirectX::XMFLOAT4* diffuseColors,
const DirectX::XMFLOAT4* lightPositions,
const DirectX::XMFLOAT4* ambientColors,
const DirectX::XMFLOAT3& cameraPos,
const DirectX::XMFLOAT4& sunlightDiffuse,
const DirectX::XMFLOAT4& sunlightAmbient,
const DirectX::XMFLOAT3& sunlightDirection,
float sunlightIntensity) {
int renderCount = 0;
// R<>cup<75>rer toutes les entit<69>s qui ont les composants RenderComponent et TransformComponent
auto entities = entityManager->GetEntitiesWithComponent<RenderComponent>();
for (auto& entity : entities) {
auto render = entity->GetComponent<RenderComponent>();
// V<>rifier si l'entit<69> a un TransformComponent
auto transform = entity->GetComponent<TransformComponent>();
if (!transform) continue;
// V<>rifier si le mod<6F>le est visible
if (!render->IsVisible()) continue;
// Effectuer le rendu
if (RenderEntity(entity, viewMatrix, projectionMatrix,
diffuseColors, lightPositions, ambientColors,cameraPos,
sunlightDiffuse, sunlightAmbient, sunlightDirection,
sunlightIntensity)) {
renderCount++;
}
}
return renderCount;
}
private:
ID3D11DeviceContext* m_deviceContext;
shader_manager_class* m_shaderManager;
};
} // namespace ecs

View File

@@ -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_;
@@ -106,9 +106,12 @@ private:
const std::deque<Logger::LogEntry>& logBuffer = Logger::Get().GetLogBuffer(); const std::deque<Logger::LogEntry>& logBuffer = Logger::Get().GetLogBuffer();
int current_fps_, min_fps_, max_fps_, draw_calls_, total_vertex_count_, total_triangle_count_, visible_triangle_count_; int current_fps_, min_fps_, max_fps_, draw_calls_, visible_triangle_count_;
float current_frame_time_, min_frame_time_, max_frame_time_ ; float current_frame_time_, min_frame_time_, max_frame_time_ ;
std::shared_ptr<int> total_vertex_count_;
std::shared_ptr<int> total_triangle_count_;
// gpu information // gpu information
char card_name_[128]; char card_name_[128];
int video_memory_ = 0; int video_memory_ = 0;

View File

@@ -26,15 +26,23 @@ enum class ShaderType
ALPHA_MAPPING ALPHA_MAPPING
}; };
class object : public model_class class object
{ {
public: public:
object(application_class& app);
object(); object();
~object(); ~object();
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 +127,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;
@@ -127,6 +138,9 @@ public :
bool m_gravityEnabled = true; bool m_gravityEnabled = true;
private: private:
application_class& m_Application;
XMMATRIX m_scaleMatrix; XMMATRIX m_scaleMatrix;
XMMATRIX m_rotateMatrix; XMMATRIX m_rotateMatrix;
XMMATRIX m_translateMatrix; XMMATRIX m_translateMatrix;
@@ -150,4 +164,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_;
}; };

View File

@@ -6,6 +6,7 @@
#include "object.h" #include "object.h"
#include <intrin.h> // Pour __cpuid #include <intrin.h> // Pour __cpuid
#include <dxgi.h> // Pour DXGI #include <dxgi.h> // Pour DXGI
#include <mutex>
#pragma comment(lib, "dxgi.lib") #pragma comment(lib, "dxgi.lib")
class stats class stats
@@ -17,6 +18,7 @@ public:
bool initialize(application_class* app); bool initialize(application_class* app);
void update_geometric_stats(); void update_geometric_stats();
void update_visible_count();
void update_display_stats(); void update_display_stats();
int get_total_vertex_count() const; int get_total_vertex_count() const;
@@ -35,8 +37,11 @@ public:
std::string get_cpu_name(); std::string get_cpu_name();
std::string get_gpu_driver_version(ID3D11Device* device); std::string get_gpu_driver_version(ID3D11Device* device);
std::shared_ptr<int>& get_vertex_count_ptr() { return total_vertex_count_; }
std::shared_ptr<int>& get_triangle_count_ptr() { return total_triangle_count_; }
private: private:
std::thread update_geometric_thread_;
std::thread update_display_thread_; std::thread update_display_thread_;
fps_class* fps_; fps_class* fps_;
@@ -47,8 +52,9 @@ private:
std::vector<object*> cubes_vec_; std::vector<object*> cubes_vec_;
std::vector<object*> terrain_chunk_vec_; std::vector<object*> terrain_chunk_vec_;
int total_vertex_count_; std::shared_ptr<int> total_vertex_count_;
int total_triangle_count_; std::shared_ptr<int> total_triangle_count_;
int visible_triangle_count_ = 0; int visible_triangle_count_ = 0;
int current_fps_ = 0; int current_fps_ = 0;
int min_fps_ = 0; int min_fps_ = 0;

View File

@@ -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_;

View File

@@ -23,7 +23,7 @@ void Skybox::Initialize(d_3d_class* d3dClassRef)
m_d3dClassRef = d3dClassRef; m_d3dClassRef = d3dClassRef;
} }
object* Skybox::ConstructSkybox() object* Skybox::ConstructSkybox(application_class* app)
{ {
Logger::Get().Log("Construct skybox", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Construct skybox", __FILE__, __LINE__, Logger::LogLevel::Initialize);
@@ -51,7 +51,7 @@ object* Skybox::ConstructSkybox()
} }
// Create the model object // Create the model object
m_Skybox = new object(); m_Skybox = new object(*app);
HRESULT result = m_Skybox->Initialize(m_d3dClassRef->get_device(), m_d3dClassRef->get_device_context(), modelFilename, SkyboxTextures); HRESULT result = m_Skybox->Initialize(m_d3dClassRef->get_device(), m_d3dClassRef->get_device_context(), modelFilename, SkyboxTextures);
if (!result) if (!result)
{ {

View File

@@ -91,6 +91,9 @@ bool application_class::initialize(int screenWidth, int screenHeight, HWND hwnd,
render_queues_.push_back(std::ref(cubes_)); render_queues_.push_back(std::ref(cubes_));
render_queues_.push_back(std::ref(terrain_chunk_)); render_queues_.push_back(std::ref(terrain_chunk_));
// create entity manager
entity_manager_ = std::make_unique<ecs::EntityManager>();
screen_width_ = screenWidth; screen_width_ = screenWidth;
screen_height_ = screenHeight; screen_height_ = screenHeight;
@@ -505,7 +508,7 @@ bool application_class::initialize(int screenWidth, int screenHeight, HWND hwnd,
//ConstructSkyboxWithPlanes(); //ConstructSkyboxWithPlanes();
Skybox* skybox = new Skybox; Skybox* skybox = new Skybox;
skybox->Initialize(direct_3d_); skybox->Initialize(direct_3d_);
skybox_.push_back(skybox->ConstructSkybox()); skybox_.push_back(skybox->ConstructSkybox(this));
culling_active_ = true; culling_active_ = true;
culling_thread_ = std::thread(&application_class::culling_thread_function, this); culling_thread_ = std::thread(&application_class::culling_thread_function, this);
@@ -765,8 +768,6 @@ void application_class::shutdown()
bool application_class::frame(input_class* Input) bool application_class::frame(input_class* Input)
{ {
process_terrain_generation();
stats_->reset_draw_call_count(); stats_->reset_draw_call_count();
int mouseX, mouseY, currentMouseX, currentMouseY; int mouseX, mouseY, currentMouseX, currentMouseY;
@@ -1157,6 +1158,7 @@ bool application_class::render(float rotation, float x, float y, float z, float
// return false; // return false;
// } // }
// stats_->update_geometric_stats();
// Update the render count text. // Update the render count text.
result = update_render_count_string(get_render_count()); result = update_render_count_string(get_render_count());
@@ -1301,15 +1303,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
@@ -1338,7 +1331,7 @@ void application_class::generate_terrain()
for (int j = 0; j < gridSizeZ; j++) for (int j = 0; j < gridSizeZ; j++)
{ {
// Cr<43>er un nouvel objet de terrain // Cr<43>er un nouvel objet de terrain
object* terrain = new object(); object* terrain = new object(*this);
// Initialiser avec le mod<6F>le et les textures_ pr<70>charg<72>es // Initialiser avec le mod<6F>le et les textures_ pr<70>charg<72>es
if (!terrain->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, textureContainer)) if (!terrain->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, textureContainer))
@@ -1363,6 +1356,8 @@ void application_class::generate_terrain()
// Ajouter <20> la liste des chunks de terrain // Ajouter <20> la liste des chunks de terrain
terrain_chunk_.push_back(terrain); terrain_chunk_.push_back(terrain);
update_stats_after_modification();
} }
} }
@@ -1371,6 +1366,7 @@ void application_class::generate_terrain()
void application_class::add_kobject(std::wstring& filepath) void application_class::add_kobject(std::wstring& filepath)
{ {
std::lock_guard<std::mutex> lock(objects_mutex_);
Logger::Get().Log("Adding object", __FILE__, __LINE__); Logger::Get().Log("Adding object", __FILE__, __LINE__);
char modelFilename[128]; char modelFilename[128];
@@ -1391,7 +1387,7 @@ void application_class::add_kobject(std::wstring& filepath)
L"assets/Texture/BricksGLOSS2K.png" L"assets/Texture/BricksGLOSS2K.png"
}; };
object* newObject = new object(); object* newObject = new object(*this);
newObject->LoadTexturesFromPath(kobjTexture,KobjectsTextures, direct_3d_); // Load textures_ from the path newObject->LoadTexturesFromPath(kobjTexture,KobjectsTextures, direct_3d_); // Load textures_ from the path
newObject->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, KobjectsTextures); newObject->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, KobjectsTextures);
newObject->SetMass(1.0f); newObject->SetMass(1.0f);
@@ -1404,8 +1400,10 @@ void application_class::add_kobject(std::wstring& filepath)
object_.push_back(newObject); object_.push_back(newObject);
update_stats_after_modification();
// 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);
} }
@@ -1413,6 +1411,7 @@ void application_class::add_kobject(std::wstring& filepath)
void application_class::add_cube() void application_class::add_cube()
{ {
std::lock_guard<std::mutex> lock(objects_mutex_);
Logger::Get().Log("Adding cube", __FILE__, __LINE__); Logger::Get().Log("Adding cube", __FILE__, __LINE__);
char modelFilename[128]; char modelFilename[128];
@@ -1427,37 +1426,36 @@ void application_class::add_cube()
static int cubeCount = 0; static int cubeCount = 0;
float position = cubeCount * 2.0f; float position = cubeCount * 2.0f;
object* newCube = new object(); object* newCube = new object(*this);
newCube->LoadTexturesFromPath(cubeTexture, CubeTexture, direct_3d_); // Load textures_ from the path newCube->LoadTexturesFromPath(cubeTexture, CubeTexture, direct_3d_); // Load textures_ from the path
newCube->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, CubeTexture); newCube->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, CubeTexture);
newCube->SetTranslateMatrix(XMMatrixTranslation(position, 0.0f, 0.0f)); newCube->SetTranslateMatrix(XMMatrixTranslation(position, 0.0f, 0.0f));
cubes_.push_back(newCube); cubes_.push_back(newCube);
update_stats_after_modification();
} }
void application_class::delete_kobject(int index) void application_class::delete_kobject(int index)
{ {
std::lock_guard<std::mutex> lock(objects_mutex_);
Logger::Get().Log("Deleting object", __FILE__, __LINE__); Logger::Get().Log("Deleting object", __FILE__, __LINE__);
if (index < object_.size()) if (index < object_.size())
{ {
object_[index]->Shutdown();
delete object_[index];
object_.erase(object_.begin() + index); object_.erase(object_.begin() + index);
} }
update_stats_after_modification();
} }
void application_class::delete_terrain() void application_class::delete_terrain()
{ {
std::lock_guard<std::mutex> lock(objects_mutex_);
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();
update_stats_after_modification();
} }
bool application_class::update_mouse_strings(int mouseX, int mouseY, bool mouseDown) bool application_class::update_mouse_strings(int mouseX, int mouseY, bool mouseDown)
@@ -1651,39 +1649,6 @@ void application_class::set_light_position(int index, XMVECTOR position)
lights_[index]->SetPosition(lightPosition.x, lightPosition.y, lightPosition.z); lights_[index]->SetPosition(lightPosition.x, lightPosition.y, lightPosition.z);
} }
void application_class::set_vsync(bool vsync)
{
vsync_enabled_ = vsync;
if (direct_3d_)
{
Logger::Get().Log("Setting Vsync to " + std::to_string(vsync) + " with a screen width : " + std::to_string(get_screen_width()) + "and a screen height : " + std::to_string(get_screen_height()), __FILE__, __LINE__);
direct_3d_->set_vsync(vsync);
}
}
HWND application_class::get_hwnd() const
{
return hwnd_;
}
void application_class::set_hwnd(HWND hwnd)
{
hwnd_ = hwnd;
}
bool application_class::is_windowed() const
{
return windowed_;
}
void application_class::set_windowed(bool windowed)
{
// log the new windowed mode
Logger::Get().Log("Setting windowed mode to " + std::to_string(windowed), __FILE__, __LINE__);
windowed_ = windowed;
}
void application_class::set_screen_height(int height) void application_class::set_screen_height(int height)
{ {
// log the new screen height // log the new screen height
@@ -1763,270 +1728,100 @@ void application_class::culling_thread_function()
bool application_class::render_pass(const std::vector<std::reference_wrapper<std::vector<object*>>>& RenderQueues, XMFLOAT4* diffuse, XMFLOAT4* position, XMFLOAT4* ambient, XMMATRIX view, XMMATRIX projection) bool application_class::render_pass(const std::vector<std::reference_wrapper<std::vector<object*>>>& RenderQueues, XMFLOAT4* diffuse, XMFLOAT4* position, XMFLOAT4* ambient, XMMATRIX view, XMMATRIX projection)
{ {
std::lock_guard<std::mutex> lock(objects_mutex_); std::lock_guard<std::mutex> lock(objects_mutex_);
XMMATRIX scaleMatrix, rotateMatrix, translateMatrix ; XMMATRIX scaleMatrix, rotateMatrix, translateMatrix;
bool result; bool result;
int renderCount = 0; int renderCount = 0;
int i;
if (RenderQueues.empty()) // render skybox
for (auto& skyboxObject : skybox_)
{ {
Logger::Get().Log("RenderQueues is empty", __FILE__, __LINE__, Logger::LogLevel::Error); if (skyboxObject == nullptr)
return false; {
Logger::Get().Log("skyboxObject is null", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
if (!skyboxObject->IsVisible())
{
continue;
}
direct_3d_->turn_z_buffer_off();
scaleMatrix = skyboxObject->GetScaleMatrix();
rotateMatrix = skyboxObject->GetRotateMatrix();
translateMatrix = skyboxObject->GetTranslateMatrix();
XMMATRIX worldMatrix = XMMatrixMultiply(
XMMatrixMultiply(scaleMatrix, rotateMatrix),
translateMatrix
);
renderCount++;
skyboxObject->get_model()->Render(direct_3d_->get_device_context());
result = shader_manager_->render_skybox_shader(
direct_3d_->get_device_context(),
skyboxObject->get_model()->GetIndexCount(),
worldMatrix,
view,
projection,
skyboxObject->get_model()->GetTexture(TextureType::Diffuse,0),
sun_light_->GetDiffuseColor(),
sun_light_->GetAmbientColor(),
sun_light_->GetDirection(),
sun_light_->GetIntensity()
);
if (!result)
{
Logger::Get().Log("Could not render the object model using the skybox shader", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
direct_3d_->turn_z_buffer_on(); // R<>activer le Z-buffer apr<70>s le rendu de la skybox
break;
} }
// Rendu des entit<69>s du syst<73>me ECS s'il est disponible
if (entity_manager_) {
// Cr<43>er le syst<73>me de rendu pour les entit<69>s
ecs::RenderSystem renderSystem(direct_3d_->get_device_context(), shader_manager_);
// Donn<6E>es pour le syst<73>me de rendu
XMFLOAT4 sunlightDiffuse = sun_light_->GetDiffuseColor();
XMFLOAT4 sunlightAmbient = sun_light_->GetAmbientColor();
XMFLOAT3 sunlightDirection = sun_light_->GetDirection();
float sunlightIntensity = sun_light_->GetIntensity();
// Effectuer le rendu de toutes les entit<69>s
int entitiesRendered = renderSystem.RenderAllEntities(
entity_manager_.get(),
view,
projection,
diffuse,
position,
ambient,
camera_->get_position(),
sunlightDiffuse,
sunlightAmbient,
sunlightDirection,
sunlightIntensity
);
renderCount += entitiesRendered;
}
// Rendu des objets traditionnels comme avant
// if (active_camera_ == sun_camera_) // if (active_camera_ == sun_camera_)
// { // {
// shadow_map_->set_render_target(direct_3d_->get_device_context()); // shadow_map_->set_render_target(direct_3d_->get_device_context());
// shadow_map_->clear_render_target(direct_3d_->get_device_context()); // shadow_map_->clear_render_target(direct_3d_->get_device_context());
// } // }
for (const auto& RenderQueue : RenderQueues)
{
// D<>sactiver le Z-buffer si la RenderQueue est skybox_
bool isSkybox = (&RenderQueue.get() == &skybox_);
if (isSkybox)
{
direct_3d_->turn_z_buffer_off();
}
for (auto& object : RenderQueue.get())
{
if (object == nullptr)
{
Logger::Get().Log("object is null", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Check if the object has physics enabled
if (object->IsPhysicsEnabled())
{
object->UpdatePosition(timer_->GetTime());
}
if (!object->IsVisible())
{
continue;
}
renderCount++;
scaleMatrix = object->GetScaleMatrix();
rotateMatrix = object->GetRotateMatrix();
translateMatrix = object->GetTranslateMatrix();
XMMATRIX worldMatrix = XMMatrixMultiply(
XMMatrixMultiply(scaleMatrix, rotateMatrix),
translateMatrix
);
object->Render(direct_3d_->get_device_context());
if (active_camera_ == sun_camera_)
{
result = shader_manager_->render_depth_shader(
direct_3d_->get_device_context(),
object->GetIndexCount(),
worldMatrix,
view,
projection,
object->GetTexture(TextureType::Diffuse,0)
);
}
// Utiliser l'enum ShaderType pour d<>terminer quel shader utiliser
switch (object->GetActiveShader())
{
case ShaderType::ALPHA_MAPPING:
// Enable alpha blending for transparency.
direct_3d_->enable_alpha_blending();
result = shader_manager_->render_alpha_map_shader(
direct_3d_->get_device_context(),
object->GetIndexCount(),
worldMatrix,
view,
projection,
object->GetTexture(TextureType::Diffuse,0),
object->GetTexture(TextureType::Diffuse,1),
object->GetTexture(TextureType::Alpha,0)
);
if (!result)
{
Logger::Get().Log("Could not render the model using the alpha map shader", __FILE__, __LINE__, Logger::LogLevel::Error);
direct_3d_->disable_alpha_blending();
return false;
}
direct_3d_->disable_alpha_blending();
break;
case ShaderType::CEL_SHADING:
result = shader_manager_->render_cel_shading_shader(
direct_3d_->get_device_context(),
object->GetIndexCount(),
worldMatrix,
view,
projection,
object->GetTexture(TextureType::Diffuse,0),
sun_light_->GetDiffuseColor(),
sun_light_->GetAmbientColor(),
sun_light_->GetDirection(),
sun_light_->GetIntensity()
);
if (!result)
{
Logger::Get().Log("Could not render the model using the cel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
break;
case ShaderType::NORMAL_MAPPING:
result = shader_manager_->render_normal_map_shader(
direct_3d_->get_device_context(),
object->GetIndexCount(),
worldMatrix,
view,
projection,
object->GetTexture(TextureType::Diffuse,0),
object->GetTexture(TextureType::Normal,0),
lights_[0]->GetDirection(),
lights_[0]->GetDiffuseColor()
);
if (!result)
{
Logger::Get().Log("Could not render the model using the normal map shader", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
break;
case ShaderType::SPECULAR_MAPPING:
result = shader_manager_->render_spec_map_shader(
direct_3d_->get_device_context(),
object->GetIndexCount(),
worldMatrix,
view,
projection,
object->GetTexture(TextureType::Diffuse,0),
object->GetTexture(TextureType::Normal,0),
object->GetTexture(TextureType::Specular,0),
lights_[0]->GetDirection(),
lights_[0]->GetDiffuseColor(),
camera_->get_position(),
lights_[0]->GetSpecularColor(),
lights_[0]->GetSpecularPower()
);
if (!result)
{
Logger::Get().Log("Could not render the model using the specular map shader", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
break;
case ShaderType::TEXTURE:
result = shader_manager_->render_texture_shader(
direct_3d_->get_device_context(),
object->GetIndexCount(),
worldMatrix,
view,
projection,
object->GetTexture(TextureType::Diffuse,0)
);
if (!result)
{
Logger::Get().Log("Could not render the model using the texture shader", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
break;
case ShaderType::LIGHTING:
result = shader_manager_->renderlight_shader(
direct_3d_->get_device_context(),
object->GetIndexCount(),
worldMatrix,
view,
projection,
object->GetTexture(TextureType::Diffuse,0),
diffuse,
position,
ambient
);
if (!result)
{
Logger::Get().Log("Could not render the object model using the light shader", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
break;
case ShaderType::SKYBOX:
result = shader_manager_->render_skybox_shader(
direct_3d_->get_device_context(),
object->GetIndexCount(),
worldMatrix,
view,
projection,
object->GetTexture(TextureType::Diffuse,0),
sun_light_->GetDiffuseColor(),
sun_light_->GetAmbientColor(),
sun_light_->GetDirection(),
sun_light_->GetIntensity()
);
if (!result)
{
Logger::Get().Log("Could not render the object model using the skybox shader", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
break;
case ShaderType::SUNLIGHT:
result = shader_manager_->render_sunlight_shader(
direct_3d_->get_device_context(),
object->GetIndexCount(),
worldMatrix,
view,
projection,
object->GetTexture(TextureType::Diffuse,0),
sun_light_->GetDiffuseColor(),
sun_light_->GetAmbientColor(),
sun_light_->GetDirection(),
sun_light_->GetIntensity()
//shadow_map_srv_
);
if (!result)
{
Logger::Get().Log("Could not render the object model using the sunlight shader", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
break;
default:
result = shader_manager_->renderlight_shader(
direct_3d_->get_device_context(),
object->GetIndexCount(),
worldMatrix,
view,
projection,
object->GetTexture(TextureType::Diffuse,0),
diffuse,
position,
ambient
);
if (!result)
{
Logger::Get().Log("Could not render the object model using the light shader", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
break;
}
stats_->increment_draw_call_count();
}
if (isSkybox)
{
direct_3d_->turn_z_buffer_on();
}
}
// if (active_camera_ == sun_camera_) // if (active_camera_ == sun_camera_)
// { // {
// direct_3d_->set_back_buffer_render_target(); // direct_3d_->set_back_buffer_render_target();
@@ -2168,134 +1963,94 @@ void application_class::physics_thread_function()
} }
} }
void application_class::create_big_cube(int side_count) bool application_class::create_big_cube(int side_count)
{ {
Logger::Get().Log("Lancement de la g<>n<EFBFBD>ration du terrain dans un thread s<>par<61>", __FILE__, __LINE__, Logger::LogLevel::Info); std::string modelName = "assets/Model/TXT/cube.txt";
std::shared_ptr<model_class> sharedModel;
// Cr<EFBFBD>er un thread qui ex<65>cutera la g<>n<EFBFBD>ration du terrain // V<EFBFBD>rifier si le mod<6F>le existe d<>j<EFBFBD>
std::thread generationThread([this, side_count]() { auto it = g_model_cache.find(modelName);
Logger::Get().Log("Thread de g<>n<EFBFBD>ration de terrain d<>marr<72>", __FILE__, __LINE__, Logger::LogLevel::Info); if (it != g_model_cache.end()) {
sharedModel = it->second;
} else {
// copy le string en char*
char model_file[128];
size_t convertedChars = 0;
(void)wcstombs_s(&convertedChars, model_file, sizeof(model_file), std::wstring(modelName.begin(), modelName.end()).c_str(), _TRUNCATE);
// Stockage temporaire pour les nouveaux objets // Cr<EFBFBD>er et initialiser le mod<6F>le si non trouv<75>
std::vector<object*> newTerrainChunks; auto newModel = std::make_shared<model_class>();
TextureContainer textures;
textures.diffusePaths.push_back(L"assets/Texture/Bricks2K.png");
textures.normalPaths.push_back(L"assets/Texture/BricksNRM2K.png");
textures.specularPaths.push_back(L"assets/Texture/BricksGLOSS2K.png");
newModel->PreloadTextures(direct_3d_->get_device(), direct_3d_->get_device_context(), textures);
if (!newModel->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(),model_file, textures)) {
Logger::Get().Log("Impossible d'initialiser le mod<6F>le du gros cube", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
g_model_cache[modelName] = newModel;
sharedModel = newModel;
}
// Dimensions du terrain // Version ECS - Cr<43>er les entit<69>s pour le cube
float scaleX = 1.0f; if (entity_manager_) {
float scaleY = 1.0f; for (int x = 0; x < side_count; x++) {
float scaleZ = 1.0f; for (int y = 0; y < side_count; y++) {
for (int z = 0; z < side_count; z++) {
// Cr<43>er une entit<69>
auto entity = entity_manager_->CreateEntity();
// Pr<50>parer les donn<6E>es pour la cr<63>ation des cubes // Ajouter un composant d'identit<69>
std::vector<std::tuple<float, float, float, std::string, int>> cubeData; auto identity = entity->AddComponent<ecs::IdentityComponent>(object_id_++);
int objectId = object_id_; identity->SetName("CubePart_" + std::to_string(x) + "_" + std::to_string(y) + "_" + std::to_string(z));
identity->SetType(ecs::ObjectType::Cube);
// G<>n<EFBFBD>rer les donn<6E>es des cubes // Ajouter un composant de transformation
for (int i = 0; i < side_count; i++) { auto transform = entity->AddComponent<ecs::TransformComponent>();
for (int j = 0; j < side_count; j++) { transform->SetPosition(XMVectorSet(static_cast<float>(x), static_cast<float>(y), static_cast<float>(z), 0.0f));
for (int k = 0; k < side_count; k++) { transform->SetScale(XMVectorSet(1.0f, 1.0f, 1.0f, 0.0f));
// V<>rifier si nous devons arr<72>ter le thread transform->UpdateWorldMatrix();
if (should_quit_) {
Logger::Get().Log("G<EFBFBD>n<EFBFBD>ration de terrain annul<75>e", __FILE__, __LINE__, Logger::LogLevel::Info);
return;
}
// Position et nom du cube // Ajouter un composant de rendu
float posX = i * scaleX; auto render = entity->AddComponent<ecs::RenderComponent>();
float posY = k * scaleY; render->InitializeWithModel(sharedModel);
float posZ = j * scaleZ;
std::string name = "TerrainTile_" + std::to_string(i) + "_" + std::to_string(j) + "_" + std::to_string(k);
// Stocker les donn<6E>es du cube // Ajouter un composant de shader
cubeData.push_back(std::make_tuple(posX, posY, posZ, name, objectId++)); auto shader = entity->AddComponent<ecs::ShaderComponent>();
shader->SetActiveShader(ecs::ShaderType::LIGHTING);
} }
} }
} }
} else {
// Ancien syst<73>me - Cr<43>er temporairement les cubes dans un vecteur local
std::vector<object*> tempCubes;
tempCubes.reserve(side_count * side_count * side_count);
// Synchroniser avec le thread principal pour cr<63>er les objets // G<EFBFBD>n<EFBFBD>rer side_count<6E> cubes
// Cette partie doit <20>tre ex<65>cut<75>e dans le thread principal (via une file d'attente ou autre m<>canisme) for (int x = 0; x < side_count; x++) {
std::lock_guard<std::mutex> lock(terrain_mutex_); for (int y = 0; y < side_count; y++) {
terrain_generation_data_ = std::move(cubeData); for (int z = 0; z < side_count; z++) {
terrain_generation_ready_ = true; object* cubePart = new object(*this);
next_terrain_object_id_ = objectId; cubePart->SetModel(sharedModel);
cubePart->SetTranslateMatrix(XMMatrixTranslation(static_cast<float>(x), static_cast<float>(y), static_cast<float>(z)));
tempCubes.push_back(cubePart);
}
}
}
// Transf<73>rer les cubes du vecteur temporaire au vecteur membre
cubes_ = std::move(tempCubes);
}
Logger::Get().Log("Donn<EFBFBD>es de g<>n<EFBFBD>ration de terrain pr<70>par<61>es (" + std::to_string(terrain_generation_data_.size()) + " cubes)", __FILE__, __LINE__, Logger::LogLevel::Info); update_stats_after_modification();
});
// D<>tacher le thread pour qu'il s'ex<65>cute en arri<72>re-plan return true;
generationThread.detach();
} }
void application_class::process_terrain_generation() void application_class::update_stats_after_modification()
{ {
// V<>rifier si des donn<6E>es de terrain sont pr<70>tes <20> <20>tre trait<69>es if (stats_)
if (!terrain_generation_ready_) { {
return; stats_ -> update_geometric_stats();
} }
// Acqu<71>rir les donn<6E>es g<>n<EFBFBD>r<EFBFBD>es
std::vector<std::tuple<float, float, float, std::string, int>> cubeData;
{
std::lock_guard<std::mutex> lock(terrain_mutex_);
cubeData = std::move(terrain_generation_data_);
terrain_generation_data_.clear();
terrain_generation_ready_ = false;
object_id_ = next_terrain_object_id_;
}
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();
// Cr<43>er un conteneur de textures_ partag<61>
TextureContainer textureContainer;
textureContainer.diffusePaths.push_back(L"assets/Texture/Bricks2K.png");
textureContainer.normalPaths.push_back(L"assets/Texture/BricksNRM2K.png");
textureContainer.specularPaths.push_back(L"assets/Texture/BricksGLOSS2K.png");
// Pr<50>charger les textures_ une seule fois
model_class* sharedModel = new model_class();
sharedModel->PreloadTextures(direct_3d_->get_device(), direct_3d_->get_device_context(), textureContainer);
char modelFilename[128];
strcpy_s(modelFilename, "assets/Model/TXT/cube.txt");
// Cr<43>er les objets <20> partir des donn<6E>es
for (const auto& [posX, posY, posZ, name, id] : cubeData)
{
// Cr<43>er un nouvel objet de terrain
object* terrain = new object();
// Initialiser avec le mod<6F>le et les textures_
if (!terrain->Initialize(direct_3d_->get_device(), direct_3d_->get_device_context(), modelFilename, textureContainer))
{
Logger::Get().Log("<EFBFBD>chec de l'initialisation d'une tuile de terrain", __FILE__, __LINE__, Logger::LogLevel::Error);
delete terrain;
continue;
}
// Configurer l'objet
XMFLOAT3 position(posX, posY, posZ);
XMFLOAT3 scale(1.0f, 1.0f, 1.0f);
terrain->SetPosition(XMLoadFloat3(&position));
terrain->SetScale(XMLoadFloat3(&scale));
terrain->SetName(name);
terrain->SetType(ObjectType::Cube);
terrain->SetActiveShader(ShaderType::TEXTURE);
terrain->SetId(id);
// Ajouter <20> la liste des chunks de terrain
terrain_chunk_.push_back(terrain);
}
delete sharedModel;
Logger::Get().Log("G<EFBFBD>n<EFBFBD>ration du terrain termin<69>e avec " + std::to_string(terrain_chunk_.size()) + " cubes", __FILE__, __LINE__, Logger::LogLevel::Info);
} }

View File

@@ -18,6 +18,14 @@ imguiManager::imguiManager()
visible_triangle_count_ = 0; visible_triangle_count_ = 0;
current_frame_time_ = 0; current_frame_time_ = 0;
showObjectWindow = false;
showTerrainWindow = false;
showLightWindow = false;
showOldSceneWindow = false;
showEngineSettingsWindow = false;
showLogWindow = false;
showStatsWindow = false;
// Initialiser l'historique des frametimes <20> z<>ro // Initialiser l'historique des frametimes <20> z<>ro
for (int i = 0; i < FRAME_HISTORY_COUNT; i++) for (int i = 0; i < FRAME_HISTORY_COUNT; i++)
{ {
@@ -165,13 +173,16 @@ 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;
} }
stats_ = app_->get_stats(); stats_ = app_->get_stats();
total_triangle_count_ = stats_->get_triangle_count_ptr();
total_vertex_count_ = stats_->get_vertex_count_ptr();
Logger::Get().Log("imgui initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("imgui initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
return true; return true;
@@ -441,7 +452,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 +461,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 +488,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 +526,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);
} }
} }
@@ -989,8 +1000,11 @@ void imguiManager::WidgetRenderStats()
min_fps_ = stats_->get_min_fps(); min_fps_ = stats_->get_min_fps();
max_fps_ = stats_->get_max_fps(); max_fps_ = stats_->get_max_fps();
draw_calls_ = stats_->get_draw_calls(); draw_calls_ = stats_->get_draw_calls();
total_vertex_count_ = stats_->get_total_vertex_count();
total_triangle_count_ = stats_->get_total_triangle_count();
// total_vertex_count_ = stats_->get_total_vertex_count();
// total_triangle_count_ = stats_->get_total_triangle_count();
visible_triangle_count_ = stats_->get_visible_triangle_count(); visible_triangle_count_ = stats_->get_visible_triangle_count();
current_frame_time_ = stats_->get_frame_time(); current_frame_time_ = stats_->get_frame_time();
@@ -1039,9 +1053,9 @@ void imguiManager::WidgetRenderStats()
ImGui::Separator(); ImGui::Separator();
ImGui::Text("Statistiques de rendu:"); ImGui::Text("Statistiques de rendu:");
ImGui::Text("Vertices total: %d", total_vertex_count_); ImGui::Text("Vertices total: %d", *total_vertex_count_);
ImGui::Text("Triangles total: %d", total_triangle_count_); ImGui::Text("Triangles total: %d", *total_triangle_count_);
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text("Triangles visibles: %d", visible_triangle_count_); ImGui::Text("Triangles visibles: %d", visible_triangle_count_);

View File

@@ -2,9 +2,27 @@
#include <comdef.h> #include <comdef.h>
#include "application_class.h"
#include "d_3d_class.h" #include "d_3d_class.h"
object::object()// initialize the reference here object::object(application_class& app) : m_Application(app)// initialize the reference here
{
m_scaleMatrix = XMMatrixIdentity();
m_rotateMatrix = XMMatrixIdentity();
m_translateMatrix = XMMatrixIdentity();
m_srMatrix = XMMatrixIdentity();
m_worldMatrix = XMMatrixIdentity();
m_previousPosition = XMVectorZero();
m_velocity = XMVectorZero();
m_acceleration = XMVectorZero();
m_mass = NULL;
m_isGrounded = false;
m_id = NULL;
m_boundingRadius = 1.0f;
}
object::object()
: m_Application(*static_cast<application_class*>(nullptr)) // Remplacer suivant votre logique
{ {
m_scaleMatrix = XMMatrixIdentity(); m_scaleMatrix = XMMatrixIdentity();
m_rotateMatrix = XMMatrixIdentity(); m_rotateMatrix = XMMatrixIdentity();
@@ -24,6 +42,34 @@ object::~object()
{ {
} }
bool object::Initialize(
ID3D11Device* device,
ID3D11DeviceContext* deviceContext,
char* modelFilename,
TextureContainer& texturesContainer
)
{
std::string filename(modelFilename);
auto it = g_model_cache.find(filename);
if (it != g_model_cache.end())
{
m_model_ = it->second;
}
else
{
auto new_model = std::make_shared<model_class>();
if (!new_model->Initialize(device, deviceContext, modelFilename, texturesContainer))
{
return false;
}
g_model_cache[filename] = new_model;
m_model_ = new_model;
}
return true;
}
void object::SetScaleMatrix(XMMATRIX scaleMatrix) void object::SetScaleMatrix(XMMATRIX scaleMatrix)
{ {
m_scaleMatrix = scaleMatrix; m_scaleMatrix = scaleMatrix;

View File

@@ -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);

View File

@@ -3,6 +3,8 @@
stats::stats() : fps_(nullptr), drawcalls_(0) stats::stats() : fps_(nullptr), drawcalls_(0)
{ {
total_triangle_count_ = std::make_shared<int>(0);
total_vertex_count_ = std::make_shared<int>(0);
} }
stats::~stats() stats::~stats()
@@ -27,11 +29,6 @@ bool stats::initialize(application_class* app)
return false; return false;
} }
// call update() in a separate thread
std::thread update_geometric_thread(&stats::update_geometric_stats, this);
update_geometric_thread_ = std::move(update_geometric_thread); // Move the thread to the member variable
update_geometric_thread_.detach(); // Detach the thread to run independently
Logger::Get().Log("Stats initialized successfully", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Stats initialized successfully", __FILE__, __LINE__, Logger::LogLevel::Initialize);
return true; return true;
@@ -39,19 +36,21 @@ bool stats::initialize(application_class* app)
void stats::update_geometric_stats() void stats::update_geometric_stats()
{ {
while (true)
{
object_vec_ = app_->get_kobjects();
cubes_vec_ = app_->get_cubes();
terrain_chunk_vec_ = app_->get_terrain_cubes();
total_vertex_count_ = get_total_vertex_count(); object_vec_ = app_->get_kobjects();
total_triangle_count_ = get_total_triangle_count(); cubes_vec_ = app_->get_cubes();
visible_triangle_count_ = get_visible_triangle_count(); terrain_chunk_vec_ = app_->get_terrain_cubes();
// call update_stats() every second
std::this_thread::sleep_for(std::chrono::seconds(1)); *total_vertex_count_ = get_total_vertex_count();
} *total_triangle_count_ = get_total_triangle_count();
update_visible_count();
}
void stats::update_visible_count()
{
visible_triangle_count_ = get_visible_triangle_count();
} }
void stats::update_display_stats() void stats::update_display_stats()
@@ -71,7 +70,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 +78,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 +86,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 +100,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 +108,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 +116,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 +129,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 +137,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 +145,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;

View File

@@ -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);

53
src/hlsl/skybox.ps Normal file
View File

@@ -0,0 +1,53 @@
/////////////
// GLOBALS //
/////////////
Texture2D shaderTexture : register(t0);
SamplerState SampleType : register(s0);
cbuffer SkyboxBuffer
{
float4 ambientColor;
float4 diffuseColor;
float3 lightDirection;
float intensity;
};
cbuffer SkyboxColorBuffer
{
float4 sunColor;
};
//////////////
// TYPEDEFS //
//////////////
struct PixelInputType
{
float4 position : SV_POSITION;
float2 tex : TEXCOORD0;
float3 normal : NORMAL;
};
////////////////////////////////////////////////////////////////////////////////
// Pixel Shader
////////////////////////////////////////////////////////////////////////////////
float4 SkyboxPixelShader(PixelInputType input) : SV_TARGET
{
// Inverser les coordonn<EFBFBD>es de texture pour compenser les normales invers<EFBFBD>es
float2 invertedTexCoord = float2(1.0 - input.tex.x, 1.0 - input.tex.y);
// <EFBFBD>chantillonner la texture avec les coordonn<EFBFBD>es invers<EFBFBD>es
float4 textureColor = shaderTexture.Sample(SampleType, invertedTexCoord);
// Pour une skybox, l'<27>clairage devrait <EFBFBD>tre plus simple - on ignore l'orientation des normales
// et on applique une luminosit<EFBFBD> uniforme ou un gradient bas<EFBFBD> sur la position (hauteur)
// Calculer un facteur de luminosit<EFBFBD> uniforme <EFBFBD> appliquer
float lightFactor = saturate(intensity);
// Combiner la couleur ambiante et diffuse pour l'<27>clairage de la skybox
float4 lightColor = ambientColor + (diffuseColor * lightFactor);
// Appliquer la couleur de l'<27>clairage <EFBFBD> la texture
float4 finalColor = saturate(lightColor) * textureColor;
return finalColor;
}

67
src/hlsl/skybox.vs Normal file
View File

@@ -0,0 +1,67 @@
/////////////
// GLOBALS //
/////////////
cbuffer MatrixBuffer
{
matrix worldMatrix;
matrix viewMatrix;
matrix projectionMatrix;
};
cbuffer CameraBuffer
{
float3 cameraPosition;
float padding;
};
cbuffer SkyboxBuffer
{
float4 ambientColor;
float4 diffuseColor;
float3 lightDirection;
float intensity;
};
//////////////
// TYPEDEFS //
//////////////
struct VertexInputType
{
float4 position : POSITION;
float2 tex : TEXCOORD0;
float3 normal : NORMAL;
};
struct PixelInputType
{
float4 position : SV_POSITION;
float2 tex : TEXCOORD0;
float3 normal : NORMAL;
};
////////////////////////////////////////////////////////////////////////////////
// Vertex Shader
////////////////////////////////////////////////////////////////////////////////
PixelInputType SkyboxVertexShader(VertexInputType input)
{
PixelInputType output;
// Change the position vector to be 4 units for proper matrix calculations.
input.position.w = 1.0f;
// Calculate the position of the vertex against the world, view, and projection matrices.
output.position = mul(input.position, worldMatrix);
output.position = mul(output.position, viewMatrix);
output.position = mul(output.position, projectionMatrix);
// Store the texture coordinates for the pixel shader.
output.tex = input.tex;
// Calculate the normal vector against the world matrix only.
output.normal = mul(input.normal, (float3x3) worldMatrix);
// Normalize the normal vector.
output.normal = normalize(output.normal);
return output;
}