9 Commits

Author SHA1 Message Date
63482923bb Patch Update - V9.2.3
[FIX] :

~ Use The Already Implemented IsKeyDown avoid calling each tick the method bound to the input
2025-03-20 13:59:01 +01:00
987ad6784e Patch Update - V9.2.2
FIX RELEASE BUILD CONFIGURATION
2025-03-20 00:15:34 +01:00
f2a8bb6b5b Patch update - V9.2.1 2025-03-19 13:22:56 +01:00
606aaa76e9 Minor Update - V.9.2.0
[FEAT] :

- Add More Object Property to the save and load
2025-03-19 12:05:15 +01:00
3930c5eff7 Minor Update - V9.1.0
[FEAT] :

+ Import Assets in project copy file in project
2025-03-19 10:55:10 +01:00
eea7b4c067 Major Update - V9.0.0
[FEAT] :

+ Add Save and Load system for scene but only for kobject
2025-03-18 22:43:23 +01:00
6583f74a5f Patch Update - V8.1.1
+ Define the struct of the scene save file
2025-03-17 17:49:16 +01:00
7eb6ed72e6 Minor Update - V8.1.0
[FIX] :

- Alpha Shader

[FEAT] :

- Add Scene action in bar menu
- Start to implemented Save And Load Logique
2025-03-17 12:59:04 +01:00
8b9e860c00 Major Update - Scene Window Rework 2025-03-11 17:46:36 +01:00
24 changed files with 3779 additions and 218 deletions

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RiderProjectSettingsUpdater">
<option name="singleClickDiffPreview" value="1" />
<option name="vcsConfiguration" value="3" />
<option name="vcsConfiguration" value="2" />
</component>
</project>

View File

@@ -7,15 +7,8 @@
<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$/enginecustom/imgui.ini" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/imgui.ini" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/shader-error.txt" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/shader-error.txt" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/hlsl/font.ps" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/hlsl/font.ps" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/hlsl/font.vs" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/hlsl/font.vs" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/applicationclass.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/applicationclass.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/inc/system/imguiManager.h" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/inc/system/imguiManager.h" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/shader/fontshaderclass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/shader/fontshaderclass.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/Systemclass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/Systemclass.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/applicationclass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/applicationclass.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/imguiManager.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/imguiManager.cpp" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/inputclass.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/inputclass.cpp" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
@@ -33,36 +26,7 @@
<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://5" 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="cidr-memory-view://0" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/enginecustom/src/src/shader/CelShadingShader.cpp" root0="FORCE_HIGHLIGHTING" />
</component>
<component name="MetaFilesCheckinStateConfiguration" checkMetaFiles="true" />
@@ -77,30 +41,38 @@
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
"C++ Project.enginecustom.executor": "Run",
"C/C++ Project.enginecustom.executor": "Run",
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.git.unshallow": "true",
"SHARE_PROJECT_CONFIGURATION_FILES": "true",
"git-widget-placeholder": "main",
"ignore.virus.scanning.warn.message": "true",
"node.js.detected.package.eslint": "true",
"node.js.detected.package.tslint": "true",
"node.js.selected.package.eslint": "(autodetect)",
"node.js.selected.package.tslint": "(autodetect)",
"nodejs_package_manager_path": "npm",
"settings.editor.selected.configurable": "preferences.keymap",
"vue.rearranger.settings.migration": "true"
<component name="PropertiesComponent">{
&quot;keyToString&quot;: {
&quot;ASKED_SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;C++ Project.enginecustom.executor&quot;: &quot;Run&quot;,
&quot;C/C++ Project.enginecustom.executor&quot;: &quot;Run&quot;,
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;,
&quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;,
&quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;,
&quot;git-widget-placeholder&quot;: &quot;main&quot;,
&quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;,
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;,
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;,
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;,
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;,
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;,
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.pluginManager&quot;,
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot;
},
&quot;keyToStringList&quot;: {
&quot;rider.external.source.directories&quot;: [
&quot;C:\\Users\\arivas\\AppData\\Roaming\\JetBrains\\Rider2024.1\\resharper-host\\DecompilerCache&quot;,
&quot;C:\\Users\\arivas\\AppData\\Roaming\\JetBrains\\Rider2024.1\\resharper-host\\SourcesCache&quot;,
&quot;C:\\Users\\arivas\\AppData\\Local\\Symbols\\src&quot;
]
}
}]]></component>
<component name="RunManager" selected="C/C++ Project.enginecustom">
}</component>
<component name="RunManager" selected="C++ Project.enginecustom">
<configuration name="KhaoticDemo" type="CppProject" factoryName="C++ Project">
<configuration_1 setup="1">
<configuration_1>
<option name="CONFIGURATION" value="Debug" />
<option name="PLATFORM" value="x64" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/KhaoticDemo/KhaoticDemo.vcxproj" />
<option name="CURRENT_LAUNCH_PROFILE" value="Local" />
<option name="EXE_PATH" value="$(LocalDebuggerCommand)" />
<option name="PROGRAM_PARAMETERS" value="$(LocalDebuggerCommandArguments)" />
@@ -108,19 +80,18 @@
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="TERMINAL_INTERACTION_BEHAVIOR" value="AUTO_DETECT" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/KhaoticDemo/KhaoticDemo.vcxproj" />
</configuration_1>
<option name="DEFAULT_PROJECT_PATH" value="$PROJECT_DIR$/KhaoticDemo/KhaoticDemo.vcxproj" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/KhaoticDemo/KhaoticDemo.vcxproj" />
<option name="AUTO_SELECT_PRIORITY" value="0" />
<method v="2">
<option name="Build" />
</method>
</configuration>
<configuration name="enginecustom" type="CppProject" factoryName="C++ Project">
<configuration_1 setup="1">
<configuration_1>
<option name="CONFIGURATION" value="Debug" />
<option name="PLATFORM" value="x64" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
<option name="CURRENT_LAUNCH_PROFILE" value="Local" />
<option name="EXE_PATH" value="$(LocalDebuggerCommand)" />
<option name="PROGRAM_PARAMETERS" value="$(LocalDebuggerCommandArguments)" />
@@ -128,10 +99,20 @@
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="TERMINAL_INTERACTION_BEHAVIOR" value="AUTO_DETECT" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
</configuration_1>
<configuration_2>
<option name="CONFIGURATION" value="Release" />
<option name="PLATFORM" value="x64" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
<option name="CURRENT_LAUNCH_PROFILE" value="Local" />
<option name="EXE_PATH" value="$(TargetPath)" />
<option name="PROGRAM_PARAMETERS" value="" />
<option name="WORKING_DIRECTORY" value="$(ProjectDir)" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
<option name="TERMINAL_INTERACTION_BEHAVIOR" value="AUTO_DETECT" />
</configuration_2>
<option name="DEFAULT_PROJECT_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
<option name="AUTO_SELECT_PRIORITY" value="0" />
<method v="2">
<option name="Build" />
@@ -161,6 +142,22 @@
<workItem from="1738358091089" duration="6675000" />
<workItem from="1738364887298" duration="2275000" />
<workItem from="1738515031789" duration="14018000" />
<workItem from="1741705445392" duration="138000" />
<workItem from="1741706018301" duration="5499000" />
<workItem from="1742198713923" duration="31000" />
<workItem from="1742198792655" duration="4618000" />
<workItem from="1742203643675" duration="600000" />
<workItem from="1742206836574" duration="258000" />
<workItem from="1742207107802" duration="5340000" />
<workItem from="1742228751298" duration="38000" />
<workItem from="1742228870107" duration="1198000" />
<workItem from="1742314944369" duration="79000" />
<workItem from="1742318452773" duration="2258000" />
<workItem from="1742331065936" duration="3030000" />
<workItem from="1742371397157" duration="13355000" />
<workItem from="1742425863119" duration="231000" />
<workItem from="1742474596806" duration="67000" />
<workItem from="1742474683111" duration="689000" />
</task>
<task id="LOCAL-00001" summary="Minor update - viewport window tweak">
<option name="closed" value="true" />
@@ -203,4 +200,15 @@
<MESSAGE value="Patch update - add menu button" />
<option name="LAST_COMMIT_MESSAGE" value="Patch update - add menu button" />
</component>
<component name="XDebuggerManager">
<watches-manager>
<configuration name="CppProject">
<watch expression="((class ModelClass &amp;) (*(*(*this).m_Application).m_object[0]))" />
</configuration>
</watches-manager>
</component>
<component name="XSLT-Support.FileAssociations.UIState">
<expand />
<select />
</component>
</project>

2970
Doxyfile Normal file

File diff suppressed because it is too large Load Diff

8
enginecustom/TODO.txt Normal file
View File

@@ -0,0 +1,8 @@
- Scene Manager :
TODO : Save and Load Scene
- ImguiManager :
TODO : Add Save and Load Scene Button in the bar menu
TODO : Add a preview of the game in a new window

View File

@@ -4,28 +4,28 @@ Size=400,400
Collapsed=0
[Window][Khaotic Engine]
Pos=1180,27
Size=396,826
Pos=1233,27
Size=343,826
Collapsed=0
DockId=0x00000005,0
[Window][Objects]
Pos=8,27
Size=290,826
Collapsed=0
DockId=0x0000000A,0
[Window][Terrain]
Pos=8,27
Size=290,487
Size=522,826
Collapsed=0
DockId=0x00000009,0
[Window][Terrain]
Pos=8,27
Size=250,974
Collapsed=0
DockId=0x00000007,0
[Window][Light]
Pos=8,27
Size=290,487
Size=290,866
Collapsed=0
DockId=0x00000009,1
DockId=0x00000007,1
[Window][Shader Manager]
Pos=8,27
@@ -34,20 +34,20 @@ Collapsed=0
DockId=0x00000001,2
[Window][Engine Settings]
Pos=1516,27
Size=396,974
Pos=8,27
Size=289,974
Collapsed=0
DockId=0x00000005,1
DockId=0x00000009,0
[Window][DockSpace Demo]
Size=1584,861
Collapsed=0
[Window][Render Window]
Pos=300,27
Size=878,826
Pos=8,27
Size=1559,974
Collapsed=0
DockId=0x00000002,0
DockId=0x00000009,0
[Window][DockSpace]
Pos=0,0
@@ -66,24 +66,24 @@ Collapsed=0
DockId=0x0000000C,0
[Window][Log Window]
Pos=8,775
Size=1904,226
Pos=8,627
Size=1568,226
Collapsed=0
DockId=0x0000000E,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=Y
DockNode ID=0x0000000D Parent=0xCCBD8CF7 SizeRef=1568,598 Split=Y
DockNode ID=0x0000000B Parent=0x0000000D SizeRef=1568,637 Split=X
DockNode ID=0x00000007 Parent=0x0000000B SizeRef=290,826 Split=Y Selected=0x393905AB
DockNode ID=0x00000009 Parent=0x00000007 SizeRef=395,413 Selected=0x393905AB
DockNode ID=0x0000000A Parent=0x00000007 SizeRef=395,411 Selected=0x031DC75C
DockNode ID=0x00000008 Parent=0x0000000B SizeRef=1276,826 Split=X
DockNode ID=0x00000002 Parent=0x00000008 SizeRef=878,826 CentralNode=1 Selected=0x9204953B
DockNode ID=0x00000005 Parent=0x00000008 SizeRef=396,826 Selected=0x9F035453
DockNode ID=0x0000000C Parent=0x0000000D SizeRef=1568,335 Selected=0x139FDA3F
DockNode ID=0x0000000E Parent=0xCCBD8CF7 SizeRef=1568,226 Selected=0xAB74BEE9
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=522,974 Selected=0x031DC75C
DockNode ID=0x0000000D Parent=0xCCBD8CF7 SizeRef=1044,974 Split=X
DockNode ID=0x00000002 Parent=0x0000000D SizeRef=699,826 Split=Y
DockNode ID=0x00000004 Parent=0x00000002 SizeRef=2032,866 Split=Y
DockNode ID=0x0000000B Parent=0x00000004 SizeRef=1568,637 Split=X
DockNode ID=0x00000007 Parent=0x0000000B SizeRef=250,826 Selected=0x393905AB
DockNode ID=0x00000008 Parent=0x0000000B SizeRef=971,826 CentralNode=1 Selected=0x031DC75C
DockNode ID=0x0000000C Parent=0x00000004 SizeRef=1568,335 Selected=0x139FDA3F
DockNode ID=0x00000006 Parent=0x00000002 SizeRef=2032,226 Selected=0xAB74BEE9
DockNode ID=0x00000005 Parent=0x0000000D SizeRef=343,826 Selected=0x9F035453

View File

@@ -0,0 +1 @@
0 isosphere 0 10 0 1 1 1 F:\Github_Repo\khaotic-engine-Reborn\enginecustom\assets\Model\OBJ\isosphere.obj

View File

@@ -0,0 +1,35 @@
[Window][DockSpace]
Pos=0,0
Size=1584,861
Collapsed=0
[Window][Debug##Default]
Pos=60,60
Size=400,400
Collapsed=0
[Window][Khaotic Engine]
Pos=1223,27
Size=353,826
Collapsed=0
DockId=0x00000002,0
[Window][Objects]
Pos=8,27
Size=345,826
Collapsed=0
DockId=0x00000003,0
[Window][Engine Settings]
Pos=1223,27
Size=353,826
Collapsed=0
DockId=0x00000002,1
[Docking][Data]
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=8,27 Size=1568,826 Split=X
DockNode ID=0x00000003 Parent=0xCCBD8CF7 SizeRef=345,826 Selected=0x031DC75C
DockNode ID=0x00000004 Parent=0xCCBD8CF7 SizeRef=1221,826 Split=X
DockNode ID=0x00000001 Parent=0x00000004 SizeRef=866,826 CentralNode=1
DockNode ID=0x00000002 Parent=0x00000004 SizeRef=353,826 Selected=0x0B098C4B

View File

View File

@@ -123,6 +123,7 @@
<ClInclude Include="src\inc\system\physics.h" />
<ClInclude Include="src\inc\system\Positionclass.h" />
<ClInclude Include="src\inc\system\rendertextureclass.h" />
<ClInclude Include="src\inc\system\sceneManager.h" />
<ClInclude Include="src\inc\system\Spriteclass.h" />
<ClInclude Include="src\inc\system\systemclass.h" />
<ClInclude Include="src\inc\system\textclass.h" />
@@ -133,130 +134,162 @@
<CopyFileToFolders Include="src\hlsl\alphamap.ps">
<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 Include="src\hlsl\alphamap.vs">
<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 Include="src\hlsl\celshading.ps">
<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 Include="src\hlsl\celshading.vs">
<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 Include="src\hlsl\Color.ps">
<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 Include="src\hlsl\Color.vs">
<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 Include="src\hlsl\font.ps">
<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 Include="src\hlsl\font.vs">
<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 Include="src\hlsl\light.ps">
<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 Include="src\hlsl\light.vs">
<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 Include="src\hlsl\lightmap.ps">
<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 Include="src\hlsl\lightmap.vs">
<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 Include="src\hlsl\Multitexture.ps">
<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 Include="src\hlsl\Multitexture.vs">
<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 Include="src\hlsl\normalmap.ps">
<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 Include="src\hlsl\normalmap.vs">
<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 Include="src\hlsl\reflection.ps">
<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 Include="src\hlsl\reflection.vs">
<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 Include="src\hlsl\refraction.ps">
<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 Include="src\hlsl\refraction.vs">
<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 Include="src\hlsl\specmap.ps">
<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 Include="src\hlsl\specmap.vs">
<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 Include="src\hlsl\sunlight.ps">
<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 Include="src\hlsl\sunlight.vs">
<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 Include="src\hlsl\texture.ps">
<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 Include="src\hlsl\texture.vs">
<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 Include="src\hlsl\translate.ps">
<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 Include="src\hlsl\translate.vs">
<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 Include="src\hlsl\transparent.ps">
<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 Include="src\hlsl\transparent.vs">
<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 Include="src\hlsl\water.ps">
<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 Include="src\hlsl\water.vs">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
</ItemGroup>
<ItemGroup>
@@ -351,21 +384,27 @@
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Skybox\skybox_back.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Skybox\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Skybox\</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Skybox\skybox_bottom.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Skybox\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Skybox\</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Skybox\skybox_front.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Skybox\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Skybox\</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Skybox\skybox_left.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Skybox\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Skybox\</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Skybox\skybox_right.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Skybox\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Skybox\</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Skybox\skybox_top.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Skybox\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Skybox\</DestinationFolders>
</CopyFileToFolders>
<Image Include="KhaoticIcon.ico" />
<CopyFileToFolders Include="sprite01.tga" />
@@ -455,6 +494,9 @@
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
</CopyFileToFolders>
</ItemGroup>
<ItemGroup>
<Content Include="TODO.txt" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>

View File

@@ -389,6 +389,9 @@
<ClInclude Include="src\inc\system\Timerclass.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\sceneManager.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Image Include="KhaoticIcon.ico">

View File

@@ -11,21 +11,21 @@ DockId=0x00000005,0
[Window][Objects]
Pos=8,27
Size=290,826
Size=289,826
Collapsed=0
DockId=0x0000000A,0
DockId=0x00000009,0
[Window][Terrain]
Pos=8,27
Size=290,866
Size=250,974
Collapsed=0
DockId=0x00000009,0
DockId=0x00000007,0
[Window][Light]
Pos=8,27
Size=290,866
Collapsed=0
DockId=0x00000009,1
DockId=0x00000007,1
[Window][Shader Manager]
Pos=8,27
@@ -34,10 +34,10 @@ Collapsed=0
DockId=0x00000001,2
[Window][Engine Settings]
Pos=1187,27
Size=389,826
Pos=8,27
Size=289,974
Collapsed=0
DockId=0x00000008,1
DockId=0x00000009,0
[Window][DockSpace Demo]
Size=1584,861
@@ -45,9 +45,9 @@ Collapsed=0
[Window][Render Window]
Pos=8,27
Size=1223,826
Size=1559,974
Collapsed=0
DockId=0x00000008,0
DockId=0x00000009,0
[Window][DockSpace]
Pos=0,0
@@ -75,15 +75,15 @@ DockId=0x00000006,0
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=0x00000002 Parent=0xCCBD8CF7 SizeRef=1223,826 Split=Y
DockNode ID=0x00000004 Parent=0x00000002 SizeRef=2032,866 Split=Y
DockNode ID=0x0000000B Parent=0x00000004 SizeRef=1568,637 Split=X
DockNode ID=0x00000007 Parent=0x0000000B SizeRef=290,826 Split=Y Selected=0x393905AB
DockNode ID=0x00000009 Parent=0x00000007 SizeRef=395,413 Selected=0x321620B2
DockNode ID=0x0000000A Parent=0x00000007 SizeRef=395,411 Selected=0x031DC75C
DockNode ID=0x00000008 Parent=0x0000000B SizeRef=1276,826 CentralNode=1 Selected=0x9204953B
DockNode ID=0x0000000C Parent=0x00000004 SizeRef=1568,335 Selected=0x139FDA3F
DockNode ID=0x00000006 Parent=0x00000002 SizeRef=2032,226 Selected=0xAB74BEE9
DockNode ID=0x00000005 Parent=0xCCBD8CF7 SizeRef=343,826 Selected=0x9F035453
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=8,27 Size=1568,826 Split=Y
DockNode ID=0x00000004 Parent=0xCCBD8CF7 SizeRef=1568,598 Split=X
DockNode ID=0x00000009 Parent=0x00000004 SizeRef=289,974 Selected=0x031DC75C
DockNode ID=0x0000000D Parent=0x00000004 SizeRef=1613,974 Split=X
DockNode ID=0x00000002 Parent=0x0000000D SizeRef=1268,826 Split=Y
DockNode ID=0x0000000B Parent=0x00000002 SizeRef=1568,637 Split=X
DockNode ID=0x00000007 Parent=0x0000000B SizeRef=250,826 Selected=0x393905AB
DockNode ID=0x00000008 Parent=0x0000000B SizeRef=971,826 CentralNode=1 Selected=0x031DC75C
DockNode ID=0x0000000C Parent=0x00000002 SizeRef=1568,335 Selected=0x139FDA3F
DockNode ID=0x00000005 Parent=0x0000000D SizeRef=343,826 Selected=0x9F035453
DockNode ID=0x00000006 Parent=0xCCBD8CF7 SizeRef=1568,226 Selected=0xAB74BEE9

Binary file not shown.

View File

@@ -28,10 +28,10 @@ float4 FontPixelShader(PixelInputType input) : SV_TARGET
// Sample the texture pixel at this location.
color = shaderTexture.Sample(SampleType, input.tex);
// If the color is black on the texture then treat this pixel as transparent.
// If the color is black on the texture then discard this pixel.
if (color.r == 0.0f && color.g == 0.0f && color.b == 0.0f)
{
return color / color;
discard;
}
// If the color is other than black on the texture then this is a pixel in the font so draw it using the font pixel color.

View File

@@ -30,6 +30,7 @@
#include "reflectionshaderclass.h"
#include "physics.h"
#include "frustum.h"
#include <fstream>
#include <WICTextureLoader.h>
#include <comdef.h> // Pour _com_error
@@ -92,7 +93,7 @@ public:
std::vector<Object*> GetCubes() const { return m_cubes; };
std::vector<Object*> GetTerrainCubes() const { return m_terrainChunk; };
std::vector<Object*> GetKobjects() const { return m_object; };
void AddKobject(WCHAR* filepath);
void AddKobject(std::wstring& filepath);
void SetPath(WCHAR* path) { m_path = path; };
void SetWFolder(std::filesystem::path WFolder) { m_WFolder = WFolder; };
@@ -146,6 +147,15 @@ public:
ID3D11ShaderResourceView* GetBackBufferSRV() const {return m_BackBufferSRV;};
// Save and load scene
void SaveScene();
void LoadScene();
void SetScenePath(std::string path) { m_scenePath = path; };
std::wstring GetScenePath();
std::string ConvertWStringToString(const std::wstring& wstr);
private:
bool Render(float, float, float, float, float);
bool RenderPhysics(bool keyLeft, bool keyRight, bool keyUp, bool keyDown, float deltaTime);
@@ -180,6 +190,8 @@ private :
HWND m_hwnd;
bool m_windowed;
std::string m_scenePath;
// ------------------------------------- //
// ------------- RENDERING ------------- //
// ------------------------------------- //
@@ -202,6 +214,7 @@ private :
std::vector<Object*> m_terrainChunk;
float m_speed = 0.1f; // speed for the demo spinning object
std::vector<Object*> m_object;
std::vector<Object*> m_ImportedObject;
int m_ObjectId = 0;
std::vector<std::reference_wrapper<std::vector<Object*>>> m_RenderQueues;
std::vector<Object*> m_Skybox;

View File

@@ -3,6 +3,7 @@
#define _IMGUI_MANAGER_H_
#include "Logger.h"
#include "sceneManager.h"
#include <imgui.h>
#include <imgui_impl_dx11.h>
@@ -23,7 +24,7 @@ public:
void Shutdown();
void Render(ApplicationClass* app);
void NewFrame();
void SetupDockspace();
void SetupDockspace(ApplicationClass* app);
// Widgets
void WidgetSpeedSlider(float* speed);
@@ -61,7 +62,7 @@ private:
bool showObjectWindow;
bool showTerrainWindow;
bool showLightWindow;
bool showShaderWindow;
bool showOldSceneWindow;
bool showEngineSettingsWindow;
bool showLogWindow;

View File

@@ -50,6 +50,8 @@ public:
bool IsSPressed() const;
bool IsQPressed() const;
bool IsEPressed()const;
bool IsTildePressed() const;
bool IsTildeReleased() const;
bool IsKeyDown(unsigned int) const;
@@ -69,6 +71,7 @@ private:
DIMOUSESTATE m_mouseState;
int m_screenWidth, m_screenHeight, m_mouseX, m_mouseY;
bool m_previousTildeState;
};

View File

@@ -10,6 +10,20 @@ enum class ObjectType
Unknown
};
enum class ShaderType
{
CEL_SHADING,
LIGHTING,
NORMAL_MAPPING,
SPECULAR_MAPPING,
REFLECTION,
REFRACTION,
TEXTURE,
SKYBOX,
SUNLIGHT,
ALPHA_MAPPING
};
class Object : public ModelClass
{
public:
@@ -63,27 +77,23 @@ public:
void SetName(std::string name);
int SetId(int id);
int GetId() const;
void SetType(ObjectType type) { m_type = type; };
void SetType(ObjectType type);
ObjectType GetType() const { return m_type; };
enum ShaderType
{
CEL_SHADING,
LIGHTING,
NORMAL_MAPPING,
SPECULAR_MAPPING,
REFLECTION,
REFRACTION,
TEXTURE,
SKYBOX,
SUNLIGHT
};
ShaderType GetActiveShader() const { return m_activeShader; };
void SetActiveShader(ShaderType activeShader) { m_activeShader = activeShader; };
float GetBoundingRadius() const;
void SetBoundingRadius(float radius) { m_boundingRadius = radius; }
void SetModelPath(std::wstring& path) { m_modelPath = path; }
std::wstring& GetModelPath() { return m_modelPath; }
ShaderType StringToShaderType(const std::string& shaderType);
std::string ShaderTypeToString(ShaderType shaderType);
ObjectType StringToObjectType(const std::string& objectType);
std::string ObjectTypeToString(ObjectType objectType);
public :
bool m_demoSpinning = false;
@@ -106,7 +116,9 @@ private:
std::string m_name;
ObjectType m_type = ObjectType::Unknown;
ShaderType m_activeShader = LIGHTING;
ShaderType m_activeShader = ShaderType::LIGHTING;
float m_boundingRadius;
std::wstring m_modelPath;
};

View File

@@ -0,0 +1,40 @@
#pragma once
#include <string>
class sceneManager
{
public:
static sceneManager& Get()
{
static sceneManager instance;
return instance;
}
sceneManager(sceneManager const&) = delete;
void operator=(sceneManager const&) = delete;
void SetSceneFilePath(const std::string& path) { m_sceneFilePath = path; }
void SetSceneFileName(const std::string& name) { m_sceneFileName = name; }
bool SaveScene()
{
// Implement the save scene logic here
return true;
}
bool LoadScene()
{
// Implement the load scene logic here
return true;
}
private:
sceneManager() = default;
~sceneManager() = default;
// Scene file path
std::string m_sceneFilePath;
std::string m_sceneFileName;
};

View File

@@ -3,12 +3,17 @@
#define WIN32_LEAN_AND_MEAN
static bool DEBUG_MODE = true;
#include "Logger.h"
#include "inputclass.h"
#include "applicationclass.h"
#include "imguiManager.h"
#include <mutex>
#include <filesystem>
#include <commdlg.h>
#include "../resources.h"
#include <chrono>
@@ -27,7 +32,9 @@ public:
void SendPath(wchar_t* path, std::filesystem::path WFolder);
private:
void GetScenePath();
protected:
bool Frame();
void InitializeWindows(int&, int&);
void ShutdownWindows();
@@ -45,6 +52,7 @@ private:
int m_initialWindowHeight;
bool m_isDirect3DInitialized;
bool m_isResizing = false;
bool m_IsDebugKeyPressed = false;
std::mutex renderMutex;
};

View File

@@ -62,12 +62,16 @@ bool SystemClass::Initialize()
}
// Initialize imgui
m_imguiManager = new imguiManager;
result = m_imguiManager->Initialize(m_hwnd, m_Application->GetDirect3D()->GetDevice(), m_Application->GetDirect3D()->GetDeviceContext());
if (!result)
if(DEBUG_MODE)
{
return false;
m_imguiManager = new imguiManager;
result = m_imguiManager->Initialize(m_hwnd, m_Application->GetDirect3D()->GetDevice(), m_Application->GetDirect3D()->GetDeviceContext());
if (!result)
{
return false;
}
}
}
catch (const std::exception& e)
{
@@ -144,6 +148,64 @@ void SystemClass::Run()
// Loop until there is a quit message from the window or the user.
done = false;
// Ask if the user wants to load a scene or create a new one
int result_scene = MessageBox(NULL, L"Do you want to load a saved scene?", L"Load Scene", MB_YESNO | MB_ICONQUESTION);
if (result_scene == IDYES)
{
m_Application->LoadScene();
}
else
{
OPENFILENAME ofn;
wchar_t szFile[260] = L"";
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = m_hwnd;
ofn.lpstrFile = szFile;
ofn.nMaxFile = sizeof(szFile);
// Allow multiple extensions
ofn.lpstrFilter = L"Ker Scene (*.ker)\0*.ker\0All Files (*.*)\0*.*\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_OVERWRITEPROMPT;
if (GetSaveFileName(&ofn) == TRUE)
{
std::filesystem::path filepath = ofn.lpstrFile;
std::string path = filepath.string();
// Add the selected extension if not already present
switch (ofn.nFilterIndex)
{
case 1:
if (filepath.extension() != L".ker")
path += ".ker";
break;
case 2:
if (filepath.extension() != L".txt")
path += ".txt";
break;
}
m_Application->SetScenePath(path);
// Create a new scene file
std::ofstream outFile(path);
if (outFile.is_open())
{
// Initialize the new scene file with default content if needed
outFile.close();
Logger::Get().Log("New scene file created successfully", __FILE__, __LINE__, Logger::LogLevel::Info);
}
else
{
Logger::Get().Log("Failed to create new scene file", __FILE__, __LINE__, Logger::LogLevel::Error);
}
}
}
while (!done)
{
// Handle the windows messages.
@@ -206,13 +268,30 @@ bool SystemClass::Frame()
return false;
}
// Render ImGui
result = m_imguiManager->ImGuiWidgetRenderer(m_Application);
if (!result)
if(!m_Input->IsKeyDown(222))
{
Logger::Get().Log("Failed to render ImGui widgets", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
//log the key press
m_IsDebugKeyPressed = false;
}
else if (m_Input->IsKeyDown(222) && !m_IsDebugKeyPressed)
{
// Log the key release state
m_IsDebugKeyPressed = true;
DEBUG_MODE = !DEBUG_MODE;
}
if (DEBUG_MODE)
{
// Render ImGui
result = m_imguiManager->ImGuiWidgetRenderer(m_Application);
if (!result)
{
Logger::Get().Log("Failed to render ImGui widgets", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
}
m_Application->GetDirect3D()->EndScene();
@@ -291,7 +370,7 @@ LRESULT CALLBACK SystemClass::MessageHandler(HWND hwnd, UINT umsg, WPARAM wparam
if (extension == L"txt" || extension == L"kobj") {
// Handle dropped files with valid extensions
std::wcout << L"File dropped: " << filePath << std::endl;
m_Application->AddKobject(filePath);
m_Application->AddKobject(fileName);
}
else {
// Handle files with invalid extensions (optional)
@@ -467,4 +546,3 @@ void SystemClass::SendPath(wchar_t* path, std::filesystem::path WFolder)
m_Application->SetPath(path);
m_Application->SetWFolder(WFolder);
}

View File

@@ -1,5 +1,7 @@
#include "applicationclass.h"
#include "systemclass.h"
ApplicationClass::ApplicationClass() : m_ShouldQuit(false)
{
m_Direct3D = nullptr;
@@ -989,14 +991,23 @@ bool ApplicationClass::Render(float rotation, float x, float y, float z, float t
}
// Redimensionner la texture de rendu si n<>cessaire
if ((float)m_SceneTexture->GetTextureWidth() != windowSize.x || (float)m_SceneTexture->GetTextureHeight() != windowSize.y)
if (DEBUG_MODE)
{
m_SceneTexture->Shutdown();
m_SceneTexture->Initialize(m_Direct3D->GetDevice(), (int)windowSize.x, (int)windowSize.y, SCREEN_DEPTH, SCREEN_NEAR, 1);
if ((float)m_SceneTexture->GetTextureWidth() != windowSize.x || (float)m_SceneTexture->GetTextureHeight() != windowSize.y)
{
m_SceneTexture->Shutdown();
m_SceneTexture->Initialize(m_Direct3D->GetDevice(), (int)windowSize.x, (int)windowSize.y, SCREEN_DEPTH, SCREEN_NEAR, 1);
}
m_Direct3D->SetBackBufferRenderTarget();
m_Direct3D->ResetViewport();
}
m_SceneTexture->SetRenderTarget(m_Direct3D->GetDeviceContext());
m_SceneTexture->ClearRenderTarget(m_Direct3D->GetDeviceContext(), 0.0f, 0.0f, 0.0f, 1.0f);
/// CPT ALED C'EST ICI QUE CA SE PASSE ///
//m_SceneTexture->SetRenderTarget(m_Direct3D->GetDeviceContext());
//m_SceneTexture->ClearRenderTarget(m_Direct3D->GetDeviceContext(), 0.0f, 0.0f, 0.0f, 0.0f);
scaleMatrix = XMMatrixScaling(0.5f, 0.5f, 0.5f); // Build the scaling matrix.
rotateMatrix = XMMatrixRotationY(rotation); // Build the rotation matrix.
@@ -1410,7 +1421,7 @@ void ApplicationClass::GenerateTerrain()
newTerrain->SetTranslateMatrix(XMMatrixTranslation(i / 2 * scaleX , -12.0f, j * scaleZ));
newTerrain->SetName(filenameWithoutExtension);
newTerrain->SetType(ObjectType::Cube);
newTerrain->SetActiveShader(Object::SUNLIGHT);
newTerrain->SetActiveShader(ShaderType::SUNLIGHT);
m_terrainChunk.push_back(newTerrain);
}
@@ -1418,9 +1429,8 @@ void ApplicationClass::GenerateTerrain()
}
void ApplicationClass::AddKobject(WCHAR* filepath)
void ApplicationClass::AddKobject(std::wstring& filepath)
{
Logger::Get().Log("Adding object", __FILE__, __LINE__);
char modelFilename[128];
@@ -1431,7 +1441,7 @@ void ApplicationClass::AddKobject(WCHAR* filepath)
string filename = p.stem().string();
size_t convertedChars = 0;
wcstombs_s(&convertedChars, modelFilename, sizeof(modelFilename), filepath, _TRUNCATE);
wcstombs_s(&convertedChars, modelFilename, sizeof(modelFilename), filepath.c_str(), _TRUNCATE);
filesystem::current_path(m_WFolder);
@@ -1449,23 +1459,7 @@ void ApplicationClass::AddKobject(WCHAR* filepath)
result = DirectX::CreateWICTextureFromFile(m_Direct3D->GetDevice(), m_Direct3D->GetDeviceContext(), textureFilename.c_str(), nullptr, &texture);
if (FAILED(result))
{
// Utiliser _com_error pour obtenir des informations d<>taill<6C>es sur l'erreur
_com_error err(result);
LPCTSTR errMsg = err.ErrorMessage();
//convertie errMessage en std::wstring
std::wstring ws(errMsg);
std::string str(ws.begin(), ws.end());
// Log the current working directory
std::filesystem::path cwd = std::filesystem::current_path();
Logger::Get().Log("Current working directory: " + cwd.string(), __FILE__, __LINE__, Logger::LogLevel::Error);
Logger::Get().Log("Failed to load texture: " + std::string(textureFilename.begin(), textureFilename.end()) +
"\nError: " + std::to_string(result) +
"\nDescription: " + str,
__FILE__, __LINE__, Logger::LogLevel::Error);
return; // Assurez-vous de retourner false ou de g<>rer l'erreur de mani<6E>re appropri<72>e
// Handle error
}
textures.push_back(texture);
}
@@ -1476,12 +1470,12 @@ void ApplicationClass::AddKobject(WCHAR* filepath)
newObject->SetTranslateMatrix(XMMatrixTranslation(0.0f, 50.0f, 0.0f));
newObject->SetName(filename);
newObject->SetId(m_ObjectId);
newObject->SetModelPath(filepath); // Store the path as std::wstring
m_ObjectId++;
m_object.push_back(newObject);
// V<>rifiez que l'objet a bien re<72>u les textures
if (newObject->GetTexture(0) == nullptr)
{
@@ -1848,7 +1842,32 @@ bool ApplicationClass::RenderPass(const std::vector<std::reference_wrapper<std::
// Utiliser l'enum ShaderType pour d<>terminer quel shader utiliser
switch (object->GetActiveShader())
{
case Object::CEL_SHADING:
case ShaderType::ALPHA_MAPPING:
// Enable alpha blending for transparency.
m_Direct3D->EnableAlphaBlending();
result = m_ShaderManager->RenderAlphaMapShader(
m_Direct3D->GetDeviceContext(),
object->GetIndexCount(),
worldMatrix,
view,
projection,
object->GetTexture(0),
object->GetTexture(5),
object->GetTexture(3)
);
if (!result)
{
Logger::Get().Log("Could not render the model using the alpha map shader", __FILE__, __LINE__, Logger::LogLevel::Error);
m_Direct3D->DisableAlphaBlending();
return false;
}
m_Direct3D->DisableAlphaBlending();
break;
case ShaderType::CEL_SHADING:
result = m_ShaderManager->RenderCelShadingShader(
m_Direct3D->GetDeviceContext(),
object->GetIndexCount(),
@@ -1868,7 +1887,7 @@ bool ApplicationClass::RenderPass(const std::vector<std::reference_wrapper<std::
}
break;
case Object::NORMAL_MAPPING:
case ShaderType::NORMAL_MAPPING:
result = m_ShaderManager->RenderNormalMapShader(
m_Direct3D->GetDeviceContext(),
object->GetIndexCount(),
@@ -1887,16 +1906,37 @@ bool ApplicationClass::RenderPass(const std::vector<std::reference_wrapper<std::
}
break;
case Object::SPECULAR_MAPPING:
result = m_ShaderManager->RenderSpecMapShader(m_Direct3D->GetDeviceContext(), object->GetIndexCount(), worldMatrix, view, projection, object->GetTexture(0), object->GetTexture(1), object->GetTexture(2), m_Lights[0]->GetDirection(), m_Lights[0]->GetDiffuseColor(), m_Camera->GetPosition(), m_Lights[0]->GetSpecularColor(), m_Lights[0]->GetSpecularPower());
case ShaderType::SPECULAR_MAPPING:
result = m_ShaderManager->RenderSpecMapShader(
m_Direct3D->GetDeviceContext(),
object->GetIndexCount(),
worldMatrix,
view,
projection,
object->GetTexture(0),
object->GetTexture(1),
object->GetTexture(2),
m_Lights[0]->GetDirection(),
m_Lights[0]->GetDiffuseColor(),
m_Camera->GetPosition(),
m_Lights[0]->GetSpecularColor(),
m_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 Object::TEXTURE:
result = m_ShaderManager->RenderTextureShader(m_Direct3D->GetDeviceContext(), object->GetIndexCount(), worldMatrix, view, projection, object->GetTexture(0));
case ShaderType::TEXTURE:
result = m_ShaderManager->RenderTextureShader(
m_Direct3D->GetDeviceContext(),
object->GetIndexCount(),
worldMatrix,
view,
projection,
object->GetTexture(0)
);
if (!result)
{
Logger::Get().Log("Could not render the model using the texture shader", __FILE__, __LINE__, Logger::LogLevel::Error);
@@ -1904,9 +1944,18 @@ bool ApplicationClass::RenderPass(const std::vector<std::reference_wrapper<std::
}
break;
case Object::LIGHTING:
result = m_ShaderManager->RenderlightShader(m_Direct3D->GetDeviceContext(), object->GetIndexCount(), worldMatrix, view, projection,
object->GetTexture(0), diffuse, position, ambient);
case ShaderType::LIGHTING:
result = m_ShaderManager->RenderlightShader(
m_Direct3D->GetDeviceContext(),
object->GetIndexCount(),
worldMatrix,
view,
projection,
object->GetTexture(0),
diffuse,
position,
ambient
);
if (!result)
{
Logger::Get().Log("Could not render the object model using the light shader", __FILE__, __LINE__, Logger::LogLevel::Error);
@@ -1914,7 +1963,7 @@ bool ApplicationClass::RenderPass(const std::vector<std::reference_wrapper<std::
}
break;
case Object::SUNLIGHT:
case ShaderType::SUNLIGHT:
result = m_ShaderManager->RenderSunlightShader(
m_Direct3D->GetDeviceContext(),
object->GetIndexCount(),
@@ -1925,7 +1974,8 @@ bool ApplicationClass::RenderPass(const std::vector<std::reference_wrapper<std::
m_SunLight->GetDiffuseColor(),
m_SunLight->GetAmbientColor(),
m_SunLight->GetDirection(),
m_SunLight->GetIntensity());
m_SunLight->GetIntensity()
);
if (!result)
{
Logger::Get().Log("Could not render the object model using the sunlight shader", __FILE__, __LINE__, Logger::LogLevel::Error);
@@ -1933,8 +1983,17 @@ bool ApplicationClass::RenderPass(const std::vector<std::reference_wrapper<std::
}
break;
default:
result = m_ShaderManager->RenderlightShader(m_Direct3D->GetDeviceContext(), object->GetIndexCount(), worldMatrix, view, projection,
object->GetTexture(0), diffuse, position, ambient);
result = m_ShaderManager->RenderlightShader(
m_Direct3D->GetDeviceContext(),
object->GetIndexCount(),
worldMatrix,
view,
projection,
object->GetTexture(0),
diffuse,
position,
ambient
);
if (!result)
{
Logger::Get().Log("Could not render the object model using the light shader", __FILE__, __LINE__, Logger::LogLevel::Error);
@@ -2006,7 +2065,7 @@ void ApplicationClass::ConstructSkybox() {
face->SetScaleMatrix(XMMatrixScaling(2.01f, 2.01f, 2.01f));
face->SetRotateMatrix(rotations[i]);
face->SetTranslateMatrix(translations[i]);
face->SetActiveShader(Object::SKYBOX);
face->SetActiveShader(ShaderType::SKYBOX);
m_Skybox.push_back(face);
m_SkyboxInitialTranslations.push_back(translations[i]);
}
@@ -2168,3 +2227,131 @@ bool ApplicationClass::RenderSkybox(XMMATRIX view, XMMATRIX projection) {
return true;
}
std::string ApplicationClass::ConvertWStringToString(const std::wstring& wstr)
{
if (wstr.empty()) return std::string();
int size_needed = WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), NULL, 0, NULL, NULL);
std::string str(size_needed, 0);
WideCharToMultiByte(CP_UTF8, 0, &wstr[0], (int)wstr.size(), &str[0], size_needed, NULL, NULL);
return str;
}
void ApplicationClass::SaveScene() {
if (m_scenePath.empty()) {
Logger::Get().Log("Scene path is empty. Cannot save scene.", __FILE__, __LINE__, Logger::LogLevel::Error);
return;
}
std::ofstream outFile(m_scenePath);
if (!outFile.is_open()) {
Logger::Get().Log("Failed to open file for saving scene", __FILE__, __LINE__, Logger::LogLevel::Error);
return;
}
for (const auto& object : m_object) {
XMFLOAT3 position, scale, rotation;
XMStoreFloat3(&position, object->GetPosition());
XMStoreFloat3(&scale, object->GetScale());
XMStoreFloat3(&rotation, object->GetRotation());
outFile << object->GetId() << " "
<< object->GetName() << " "
<< position.x << " " << position.y << " " << position.z << " "
<< rotation.x << " " << rotation.y << " " << rotation.z << " "
<< scale.x << " " << scale.y << " " << scale.z << " "
<< ConvertWStringToString(object->GetModelPath()) << " "
<< object->ShaderTypeToString(object->GetActiveShader()) << " "
<< object->GetBoundingRadius() << " "
<< object->ObjectTypeToString(object->GetType()) << " "
<< object->GetMass() << " "
<< object->IsPhysicsEnabled() << std::endl;
}
outFile.close();
Logger::Get().Log("Scene saved successfully", __FILE__, __LINE__, Logger::LogLevel::Info);
}
void ApplicationClass::LoadScene() {
std::wstring scenePath = GetScenePath();
if (!scenePath.empty())
{
SetScenePath(ConvertWStringToString(scenePath));
}
if (m_scenePath.empty()) {
Logger::Get().Log("Scene path is empty. Cannot load scene.", __FILE__, __LINE__, Logger::LogLevel::Error);
return;
}
std::ifstream inFile(m_scenePath);
if (!inFile.is_open()) {
Logger::Get().Log("Failed to open file for loading scene", __FILE__, __LINE__, Logger::LogLevel::Error);
return;
}
m_object.clear();
int id;
std::string name;
float posX, posY, posZ;
float rotX, rotY, rotZ;
float scaleX, scaleY, scaleZ;
std::string modelPath;
std::string shaderTypeStr;
float boundingRadius;
std::string objectTypeStr;
float mass;
bool physicsEnabled;
while (inFile >> id >> name >> posX >> posY >> posZ >> rotX >> rotY >> rotZ >> scaleX >> scaleY >> scaleZ >> modelPath >> shaderTypeStr >> boundingRadius >> objectTypeStr >> mass >> physicsEnabled) {
int size_needed = MultiByteToWideChar(CP_UTF8, 0, modelPath.c_str(), (int)modelPath.size(), NULL, 0);
std::wstring wModelPath(size_needed, 0);
MultiByteToWideChar(CP_UTF8, 0, modelPath.c_str(), (int)modelPath.size(), &wModelPath[0], size_needed);
AddKobject(wModelPath);
Object* newObject = m_object.back();
newObject->SetId(id);
newObject->SetName(name);
newObject->SetPosition(XMVectorSet(posX, posY, posZ, 0.0f));
newObject->SetRotation(XMVectorSet(rotX, rotY, rotZ, 0.0f));
newObject->SetScale(XMVectorSet(scaleX, scaleY, scaleZ, 0.0f));
newObject->SetActiveShader(newObject->StringToShaderType(shaderTypeStr));
newObject->SetBoundingRadius(boundingRadius);
newObject->SetType(newObject->StringToObjectType(objectTypeStr));
newObject->SetMass(mass);
newObject->SetPhysicsEnabled(physicsEnabled);
}
inFile.close();
Logger::Get().Log("Scene loaded successfully", __FILE__, __LINE__, Logger::LogLevel::Info);
}
std::wstring ApplicationClass::GetScenePath()
{
OPENFILENAME ofn;
wchar_t szFile[260];
ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = m_hwnd;
ofn.lpstrFile = szFile;
ofn.lpstrFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = L"Ker Scene\0*.ker\0";
ofn.nFilterIndex = 1;
ofn.lpstrFileTitle = NULL;
ofn.nMaxFileTitle = 0;
ofn.lpstrInitialDir = NULL;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;
if (GetOpenFileName(&ofn) == TRUE)
{
std::filesystem::path filepath = ofn.lpstrFile;
return filepath.wstring();
}
return L"";
}

View File

@@ -29,6 +29,11 @@ bool imguiManager::Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceConte
// Setup style
ImGui::StyleColorsDark();
// Set the window background color to be a transparent black/gray
ImGui::GetStyle().Colors[ImGuiCol_WindowBg] = ImVec4(0, 0, 0, 0.5f);
// Set the menu bar background color to be a transparent black/gray
ImGui::GetStyle().Colors[ImGuiCol_MenuBarBg] = ImVec4(0, 0, 0, 0.5f);
Logger::Get().Log("imgui initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
@@ -48,13 +53,13 @@ void imguiManager::Render(ApplicationClass* app)
{
ImGui::Render();
app->GetDirect3D()->TurnZBufferOff();
app->GetDirect3D()->EnableAlphaBlending();
//app->GetDirect3D()->TurnZBufferOff();
//app->GetDirect3D()->EnableAlphaBlending();
ImGui_ImplDX11_RenderDrawData(ImGui::GetDrawData());
app->GetDirect3D()->DisableAlphaBlending();
app->GetDirect3D()->TurnZBufferOn();
//app->GetDirect3D()->DisableAlphaBlending();
//app->GetDirect3D()->TurnZBufferOn();
}
void imguiManager::NewFrame()
@@ -64,7 +69,7 @@ void imguiManager::NewFrame()
ImGui::NewFrame();
}
void imguiManager::SetupDockspace() {
void imguiManager::SetupDockspace(ApplicationClass* app) {
ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking;
ImGuiViewport* viewport = ImGui::GetMainViewport();
ImGui::SetNextWindowPos(viewport->Pos);
@@ -75,19 +80,37 @@ void imguiManager::SetupDockspace() {
window_flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove;
window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus;
ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0, 0, 0, 0));
ImGui::Begin("DockSpace", nullptr, window_flags);
ImGui::PopStyleVar(2);
ImGui::PopStyleColor();
if (ImGui::BeginMenuBar()) {
if (ImGui::BeginMenu("Windows")) {
ImGui::MenuItem("Object Window", NULL, &showObjectWindow);
ImGui::MenuItem("Terrain Window", NULL, &showTerrainWindow);
ImGui::MenuItem("Light Window", NULL, &showLightWindow);
ImGui::MenuItem("Shader Window", NULL, &showShaderWindow);
ImGui::MenuItem("Old Scene Window", NULL, &showOldSceneWindow);
ImGui::MenuItem("Engine Settings Window", NULL, &showEngineSettingsWindow);
ImGui::MenuItem("Log Window", NULL, &showLogWindow);
ImGui::EndMenu();
}
// Scene file menu
if (ImGui::BeginMenu("Scene")) {
if (ImGui::MenuItem("Save Scene")) {
// Save the scene
app->SaveScene();
}
if (ImGui::MenuItem("Load Scene")) {
// Load the scene
app->LoadScene();
}
ImGui::EndMenu();
}
ImGui::EndMenuBar();
}
@@ -146,7 +169,66 @@ void imguiManager::WidgetAddObject(ApplicationClass* app)
if (GetOpenFileName(&ofn))
{
app->AddKobject(ofn.lpstrFile);
std::wstring filepath = ofn.lpstrFile;
WCHAR exePath[MAX_PATH];
GetModuleFileName(NULL,exePath,MAX_PATH);
std::wstring exeDir = exePath;
size_t pos = exeDir.find_last_of(L"\\/");
if(pos != std::wstring::npos)
{
exeDir = exeDir.substr(0, pos);
}
std::wstring targetDir = exeDir + L"\\Content\\Assets\\Kobject";
DWORD ftyp = GetFileAttributesW(targetDir.c_str());
if( ftyp == INVALID_FILE_ATTRIBUTES)
{
std::wstring contentDir = exeDir + L"\\Content";
if (GetFileAttributes(contentDir.c_str()) == INVALID_FILE_ATTRIBUTES)
{
CreateDirectory(contentDir.c_str(), NULL);
}
std::wstring assetsDir = contentDir + L"\\Assets";
if (GetFileAttributes(assetsDir.c_str()) == INVALID_FILE_ATTRIBUTES)
{
CreateDirectory(assetsDir.c_str(), NULL);
}
std::wstring kobjectDir = assetsDir + L"\\Kobject";
if (GetFileAttributes(kobjectDir.c_str()) == INVALID_FILE_ATTRIBUTES)
{
CreateDirectory(kobjectDir.c_str(), NULL);
}
}
size_t posFile = filepath.find_last_of(L"\\/");
std::wstring filename = (posFile != std::wstring::npos) ? filepath.substr(posFile + 1) : filepath;
std::wstring targetPath = targetDir + L"\\" + filename;
if (!CopyFile(filepath.c_str(), targetPath.c_str(), FALSE))
{
// En cas d'erreur, vous pouvez g<>rer ici l'erreur (par exemple afficher un message)
MessageBox(NULL, L"Erreur lors de la copie du fichier.", L"Erreur", MB_OK);
}
else
{
// On r<>cup<75>re le chemin relatif par rapport <20> exeDir
std::wstring relativePath = targetPath.substr(exeDir.size());
// Suppression du premier caract<63>re s'il s'agit d'un antislash
if (!relativePath.empty() && (relativePath[0] == L'\\' || relativePath[0] == L'/'))
{
relativePath.erase(0, 1);
}
// Remplacer les antislashs par des slashs
std::replace(relativePath.begin(), relativePath.end(), L'\\', L'/');
app->AddKobject(relativePath);
}
}
}
@@ -203,6 +285,7 @@ void imguiManager::WidgetObjectWindow(ApplicationClass* app)
};
// Display all images
ImGui::BeginChild("TextureChild", ImVec2(0, 100), false, ImGuiWindowFlags_HorizontalScrollbar);
for (int count = 0; count < textureCategories.size(); count++)
{
std::string textureLabel = "Texture##" + std::to_string(index) + "##" + std::to_string(count);
@@ -222,7 +305,7 @@ void imguiManager::WidgetObjectWindow(ApplicationClass* app)
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = NULL;
ofn.lpstrFile = szFile;
ofn.lpstrFile[0] = '\0';
szFile[0] = '\0';
ofn.nMaxFile = sizeof(szFile);
ofn.lpstrFilter = L"Texture\0*.png\0";
ofn.nFilterIndex = 1;
@@ -251,7 +334,7 @@ void imguiManager::WidgetObjectWindow(ApplicationClass* app)
}
}
}
ImGui::EndChild();
ImGui::Separator();
@@ -265,8 +348,23 @@ void imguiManager::WidgetObjectWindow(ApplicationClass* app)
ImGui::Separator();
// Liste des options
const char* shaderOptions[] = { "Enable Global Lighting", "Enable Lighting", "Enable Cel Shading", "Enable Normal Mapping", "Enable Specular Mapping" };
Object::ShaderType shaderTypes[] = { Object::SUNLIGHT,Object::LIGHTING, Object::CEL_SHADING, Object::NORMAL_MAPPING, Object::SPECULAR_MAPPING };
const char* shaderOptions[] = {
"Enable Global Lighting",
"Enable Lighting",
"Enable Cel Shading",
"Enable Normal Mapping",
"Enable Specular Mapping",
"Enable Alpha Mapping"
};
ShaderType shaderTypes[] = {
ShaderType::SUNLIGHT,
ShaderType::LIGHTING,
ShaderType::CEL_SHADING,
ShaderType::NORMAL_MAPPING,
ShaderType::SPECULAR_MAPPING,
ShaderType::ALPHA_MAPPING
};
// Variable pour stocker l'option s<>lectionn<6E>e
static int currentShader = 0; // Index de l'option actuellement s<>lectionn<6E>e
@@ -365,7 +463,7 @@ bool imguiManager::ImGuiWidgetRenderer(ApplicationClass* app)
NewFrame();
// Setup the dockspace
SetupDockspace();
SetupDockspace(app);
//ImGui Widget
ImGui::Begin("Khaotic Engine", NULL);
@@ -405,7 +503,11 @@ bool imguiManager::ImGuiWidgetRenderer(ApplicationClass* app)
WidgetLogWindow(app);
}
WidgetRenderWindow(app, ImVec2(800, 600));
if (showOldSceneWindow)
{
WidgetRenderWindow(app, ImVec2(800, 600));
}
//render imgui
Render(app);
@@ -611,7 +713,6 @@ void imguiManager::WidgetLogWindow(ApplicationClass* app)
void imguiManager::WidgetRenderWindow(ApplicationClass* app, ImVec2 availableSize)
{
ImGui::Begin("Render Window");
ImVec2 oldWindowSize = windowSize;
@@ -640,7 +741,12 @@ void imguiManager::WidgetRenderWindow(ApplicationClass* app, ImVec2 availableSiz
if (texture)
{
// Affichez la texture dans une fen<65>tre ImGui
// Affichez la scenne projet<65> sur texture dans une fen<65>tre ImGui
// alpha blend is not enable to render the texture
app->GetDirect3D()->TurnZBufferOff();
app->GetDirect3D()->EnableAlphaBlending();
ImGui::Image((ImTextureID)texture, windowSize, ImVec2(0, 0), ImVec2(1, 1), ImVec4(1, 1, 1, 1));
}
else

View File

@@ -6,6 +6,7 @@ InputClass::InputClass()
m_directInput = 0;
m_keyboard = 0;
m_mouse = 0;
m_previousTildeState = false;
}
@@ -120,7 +121,7 @@ bool InputClass::Initialize(HINSTANCE hinstance, HWND hwnd, int screenWidth, int
void InputClass::KeyDown(unsigned int input)
{
// If a key is pressed then save that state in the key array.
Logger::Get().Log("Key down", __FILE__, __LINE__, Logger::LogLevel::Input);
Logger::Get().Log("Key down: " + std::to_string(input), __FILE__, __LINE__, Logger::LogLevel::Input);
m_keys[input] = true;
return;
}
@@ -129,7 +130,6 @@ void InputClass::KeyDown(unsigned int input)
void InputClass::KeyUp(unsigned int input)
{
// If a key is released then clear that state in the key array.
Logger::Get().Log("Key up", __FILE__, __LINE__, Logger::LogLevel::Input);
m_keys[input] = false;
return;
}

View File

@@ -1,6 +1,6 @@
#include "object.h"
Object::Object() : ModelClass()
Object::Object()// Initialize the reference here
{
m_scaleMatrix = XMMatrixIdentity();
m_rotateMatrix = XMMatrixIdentity();
@@ -260,3 +260,50 @@ void Object::UpdatePosition(float deltaTime)
position = position + GetVelocity() * deltaTime;
SetPosition(position);
}
void Object::SetType(ObjectType type)
{
m_type = type;
}
std::string Object::ObjectTypeToString(ObjectType type) {
switch (type) {
case ObjectType::Cube: return "Cube";
case ObjectType::Sphere: return "Sphere";
// Ajoutez d'autres cas si n<>cessaire
default: return "Unknown";
}
}
ObjectType Object::StringToObjectType(const std::string& str) {
if (str == "Cube") return ObjectType::Cube;
if (str == "Sphere") return ObjectType::Sphere;
// Add other cases as needed
return ObjectType::Unknown;
}
std::string Object::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";
// Ajoutez d'autres cas si n<>cessaire
default: return "Unknown";
}
}
ShaderType Object::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;
// Add other cases as needed
return ShaderType::TEXTURE;
}