Compare commits

..

No commits in common. "main" and "Cel-Shad-V1" have entirely different histories.

1370 changed files with 809360 additions and 758405 deletions

2
.gitattributes vendored
View File

@ -1,2 +0,0 @@
enginecustom/assets/Model/OBJ/*.obj filter=lfs diff=lfs merge=lfs -text
enginecustom/assets/Model/OBJ/*.mtl filter=lfs diff=lfs merge=lfs -text

4
.gitignore vendored
View File

@ -9,6 +9,10 @@
*.slo *.slo
*.lo *.lo
*.o *.o
*.obj
# Don't ignore 3d model in OBJ
!enginecustom/assets/Model/OBJ/*.obj
# Precompiled Headers # Precompiled Headers
*.gch *.gch

View File

@ -1 +0,0 @@
KhaoticEngineReborn

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidProjectSystem">
<option name="providerId" value="RiderAndroidProjectSystem" />
</component>
</project>

View File

@ -1,14 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="PROJECT_FILES" />
<option name="description" value="" />
<option name="applicationTheme" value="default" />
<option name="iconsTheme" value="default" />
<option name="button1Title" value="" />
<option name="button1Url" value="" />
<option name="button2Title" value="" />
<option name="button2Url" value="" />
<option name="customApplicationId" value="" />
</component>
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/enginecustom/src/src/system/application_class.cpp" charset="windows-1252" />
<file url="file://$PROJECT_DIR$/enginecustom/src/src/system/imguiManager.cpp" charset="windows-1252" />
<file url="PROJECT" charset="windows-1252" />
</component>
</project>

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitToolBoxBlameSettings">
<option name="version" value="2" />
</component>
</project>

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitToolBoxProjectSettings">
<option name="commitMessageIssueKeyValidationOverride">
<BoolValueOverride>
<option name="enabled" value="true" />
</BoolValueOverride>
</option>
<option name="commitMessageValidationEnabledOverride">
<BoolValueOverride>
<option name="enabled" value="true" />
</BoolValueOverride>
</option>
</component>
</project>

View File

@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

View File

@ -1,7 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="LanguageDetectionInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="ReassignedToPlainText" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

View File

@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MaterialThemeProjectNewConfig">
<option name="metadata">
<MTProjectMetadataState>
<option name="migrated" value="true" />
<option name="pristineConfig" value="false" />
<option name="userId" value="4025287c:194ad69ad19:-7ff7" />
</MTProjectMetadataState>
</option>
</component>
</project>

View File

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

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@ -1,285 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="SELECTIVE" />
</component>
<component name="ChangeListManager">
<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/enginecustom.vcxproj" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/imgui.ini" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/imgui.ini" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="DpaMonitoringSettings">
<option name="firstShow" value="false" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="HighlightingSettingsPerFile">
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="mock:///dummy.cpp" root0="SKIP_HIGHLIGHTING" />
<setting file="cidr-memory-view://4" root0="FORCE_HIGHLIGHTING" />
<setting file="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://$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$/../../IDE_VS/VC/Tools/MSVC/14.38.33130/include/type_traits" root0="SKIP_HIGHLIGHTING" />
</component>
<component name="KubernetesApiPersistence">{}</component>
<component name="KubernetesApiProvider">{
&quot;isMigrated&quot;: true
}</component>
<component name="MetaFilesCheckinStateConfiguration" checkMetaFiles="true" />
<component name="ProblemsViewState">
<option name="selectedTabId" value="CurrentFile" />
</component>
<component name="ProjectColorInfo">{
&quot;associatedIndex&quot;: 6
}</component>
<component name="ProjectId" id="2sGIWDeT5ixyzDQ0he4A3RFpG9W" />
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectViewState">
<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.KhaoticDemo.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.pluginManager",
"vue.rearranger.settings.migration": "true"
}
}]]></component>
<component name="RunManager" selected="C/C++ Project.enginecustom">
<configuration name="KhaoticDemo" type="CppProject" factoryName="C++ Project">
<configuration_1 setup="1">
<option name="CONFIGURATION" value="Debug" />
<option name="PLATFORM" value="x64" />
<option name="CURRENT_LAUNCH_PROFILE" value="Local" />
<option name="EXE_PATH" value="$(LocalDebuggerCommand)" />
<option name="PROGRAM_PARAMETERS" value="$(LocalDebuggerCommandArguments)" />
<option name="WORKING_DIRECTORY" value="$(LocalDebuggerWorkingDirectory)" />
<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">
<option name="CONFIGURATION" value="Debug" />
<option name="PLATFORM" value="x64" />
<option name="CURRENT_LAUNCH_PROFILE" value="Local" />
<option name="EXE_PATH" value="$(LocalDebuggerCommand)" />
<option name="PROGRAM_PARAMETERS" value="$(LocalDebuggerCommandArguments)" />
<option name="WORKING_DIRECTORY" value="$(LocalDebuggerWorkingDirectory)" />
<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 setup="1">
<option name="CONFIGURATION" value="Release" />
<option name="PLATFORM" value="x64" />
<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" />
<option name="PROJECT_FILE_PATH" value="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" />
</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" />
</method>
</configuration>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="e81d6e08-efc7-40a0-909d-ec4943d948e9" name="Changes" comment="" />
<created>1738075515913</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1738075515913</updated>
<workItem from="1738075517746" duration="553000" />
<workItem from="1738076088229" duration="80000" />
<workItem from="1738076192788" duration="19000" />
<workItem from="1738076222547" duration="6131000" />
<workItem from="1738171504772" duration="876000" />
<workItem from="1738172392786" duration="67000" />
<workItem from="1738173151768" duration="2361000" />
<workItem from="1738175535254" duration="279000" />
<workItem from="1738178991872" duration="2736000" />
<workItem from="1738244577624" duration="3000" />
<workItem from="1738321399968" duration="689000" />
<workItem from="1738358054789" duration="9000" />
<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" />
<workItem from="1742574318953" duration="552000" />
<workItem from="1742581210996" duration="681000" />
<workItem from="1742651501885" duration="47000" />
<workItem from="1742664377329" duration="746000" />
<workItem from="1742665243312" duration="310000" />
<workItem from="1742667326806" duration="95000" />
<workItem from="1743185728805" duration="15000" />
<workItem from="1743185754182" duration="815000" />
<workItem from="1743355100472" duration="708000" />
<workItem from="1743355837694" duration="1514000" />
<workItem from="1743370106270" duration="901000" />
<workItem from="1743505399891" duration="2361000" />
<workItem from="1746106963725" duration="5888000" />
<workItem from="1746112904421" duration="75000" />
<workItem from="1746113092234" duration="1477000" />
<workItem from="1746117455914" duration="5976000" />
<workItem from="1746126812110" duration="180000" />
<workItem from="1746188920194" duration="1870000" />
<workItem from="1746274246641" duration="89000" />
<workItem from="1746274352144" duration="8039000" />
<workItem from="1746444660572" duration="7742000" />
<workItem from="1746456965664" duration="13000" />
<workItem from="1746469494034" duration="799000" />
<workItem from="1746526901276" duration="2023000" />
<workItem from="1746536290167" duration="1908000" />
<workItem from="1746538260893" duration="5781000" />
<workItem from="1746546014271" duration="1814000" />
<workItem from="1746619988287" duration="12282000" />
<workItem from="1746711806997" duration="6736000" />
<workItem from="1746719840054" duration="991000" />
<workItem from="1746795732153" duration="33000" />
<workItem from="1746795828588" duration="592000" />
<workItem from="1747049871967" duration="9350000" />
<workItem from="1747136509645" duration="3939000" />
<workItem from="1747258663152" duration="835000" />
<workItem from="1747826758888" duration="3587000" />
<workItem from="1747830379222" duration="7954000" />
<workItem from="1748254142068" duration="10499000" />
<workItem from="1748267553700" duration="654000" />
<workItem from="1748429087202" duration="7421000" />
<workItem from="1748521606678" duration="5300000" />
<workItem from="1748859894056" duration="1431000" />
<workItem from="1748861785837" duration="357000" />
<workItem from="1748865625274" duration="797000" />
<workItem from="1748869642637" duration="3049000" />
<workItem from="1748954607174" duration="14202000" />
<workItem from="1748969487337" duration="402000" />
</task>
<task id="LOCAL-00001" summary="Minor update - viewport window tweak">
<option name="closed" value="true" />
<created>1738175474520</created>
<option name="number" value="00001" />
<option name="presentableId" value="LOCAL-00001" />
<option name="project" value="LOCAL" />
<updated>1738175474520</updated>
</task>
<task id="LOCAL-00002" summary="Patch update - add menu button">
<option name="closed" value="true" />
<created>1738181617050</created>
<option name="number" value="00002" />
<option name="presentableId" value="LOCAL-00002" />
<option name="project" value="LOCAL" />
<updated>1738181617050</updated>
</task>
<option name="localTasksCounter" value="3" />
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="UnityCheckinConfiguration" checkUnsavedScenes="true" />
<component name="UnityProjectConfiguration" hasMinimizedUI="false" />
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
</component>
<component name="VcsManagerConfiguration">
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
<MESSAGE value="Minor update - viewport window tweak" />
<MESSAGE value="Patch update - add menu button" />
<option name="LAST_COMMIT_MESSAGE" value="Patch update - add menu button" />
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<breakpoints>
<breakpoint enabled="true" type="DotNet_Exception_Breakpoints">
<properties exception="System.OperationCanceledException" breakIfHandledByOtherCode="false" displayValue="System.OperationCanceledException" />
<option name="timeStamp" value="1" />
</breakpoint>
<breakpoint enabled="true" type="DotNet_Exception_Breakpoints">
<properties exception="System.Threading.Tasks.TaskCanceledException" breakIfHandledByOtherCode="false" displayValue="System.Threading.Tasks.TaskCanceledException" />
<option name="timeStamp" value="2" />
</breakpoint>
<breakpoint enabled="true" type="DotNet_Exception_Breakpoints">
<properties exception="System.Threading.ThreadAbortException" breakIfHandledByOtherCode="false" displayValue="System.Threading.ThreadAbortException" />
<option name="timeStamp" value="3" />
</breakpoint>
</breakpoints>
</breakpoint-manager>
<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

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,140 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{9e5ef415-5337-4eed-ae23-edc4b1fff455}</ProjectGuid>
<RootNamespace>KhaoticDemo</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ProjectReference Include="..\enginecustom\enginecustom.vcxproj">
<Project>{92cf56c4-76bb-40d4-8fe5-36c15f5f127a}</Project>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Fichiers sources">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Fichiers d%27en-tête">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Fichiers de ressources">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
</ItemGroup>
</Project>

4
KhaoticDemo/main.cpp Normal file
View File

@ -0,0 +1,4 @@
int main()
{
return 0;
}

72
KhaoticDemo/water.ps Normal file
View File

@ -0,0 +1,72 @@
/////////////
// GLOBALS //
/////////////
SamplerState SampleType : register(s0);
Texture2D reflectionTexture : register(t0);
Texture2D refractionTexture : register(t1);
Texture2D normalTexture : register(t2);
cbuffer WaterBuffer
{
float waterTranslation;
float reflectRefractScale;
float2 padding;
};
//////////////
// TYPEDEFS //
//////////////
struct PixelInputType
{
float4 position : SV_POSITION;
float2 tex : TEXCOORD0;
float4 reflectionPosition : TEXCOORD1;
float4 refractionPosition : TEXCOORD2;
};
////////////////////////////////////////////////////////////////////////////////
// Pixel Shader
////////////////////////////////////////////////////////////////////////////////
float4 WaterPixelShader(PixelInputType input) : SV_TARGET
{
float2 reflectTexCoord;
float2 refractTexCoord;
float4 normalMap;
float3 normal;
float4 reflectionColor;
float4 refractionColor;
float4 color;
// Move the position the water normal is sampled from to simulate moving water.
input.tex.y += waterTranslation;
// Calculate the projected reflection texture coordinates.
reflectTexCoord.x = input.reflectionPosition.x / input.reflectionPosition.w / 2.0f + 0.5f;
reflectTexCoord.y = -input.reflectionPosition.y / input.reflectionPosition.w / 2.0f + 0.5f;
// Calculate the projected refraction texture coordinates.
refractTexCoord.x = input.refractionPosition.x / input.refractionPosition.w / 2.0f + 0.5f;
refractTexCoord.y = -input.refractionPosition.y / input.refractionPosition.w / 2.0f + 0.5f;
// Sample the normal from the normal map texture.
normalMap = normalTexture.Sample(SampleType, input.tex);
// Expand the range of the normal from (0,1) to (-1,+1).
normal = (normalMap.xyz * 2.0f) - 1.0f;
// Re-position the texture coordinate sampling position by the normal map value to simulate the rippling wave effect.
reflectTexCoord = reflectTexCoord + (normal.xy * reflectRefractScale);
refractTexCoord = refractTexCoord + (normal.xy * reflectRefractScale);
// Sample the texture pixels from the textures using the updated texture coordinates.
reflectionColor = reflectionTexture.Sample(SampleType, reflectTexCoord);
refractionColor = refractionTexture.Sample(SampleType, refractTexCoord);
// Combine the reflection and refraction results for the final color.
color = lerp(reflectionColor, refractionColor, 0.6f);
return color;
}

View File

@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.9.34607.119 VisualStudioVersion = 17.9.34607.119
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KhaoticCore", "enginecustom\enginecustom.vcxproj", "{92CF56C4-76BB-40D4-8FE5-36C15F5F127A}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "enginecustom", "enginecustom\enginecustom.vcxproj", "{92CF56C4-76BB-40D4-8FE5-36C15F5F127A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KhaoticDemo", "KhaoticDemo\KhaoticDemo.vcxproj", "{9E5EF415-5337-4EED-AE23-EDC4B1FFF455}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -21,6 +23,14 @@ Global
{92CF56C4-76BB-40D4-8FE5-36C15F5F127A}.Release|x64.Build.0 = Release|x64 {92CF56C4-76BB-40D4-8FE5-36C15F5F127A}.Release|x64.Build.0 = Release|x64
{92CF56C4-76BB-40D4-8FE5-36C15F5F127A}.Release|x86.ActiveCfg = Release|Win32 {92CF56C4-76BB-40D4-8FE5-36C15F5F127A}.Release|x86.ActiveCfg = Release|Win32
{92CF56C4-76BB-40D4-8FE5-36C15F5F127A}.Release|x86.Build.0 = Release|Win32 {92CF56C4-76BB-40D4-8FE5-36C15F5F127A}.Release|x86.Build.0 = Release|Win32
{9E5EF415-5337-4EED-AE23-EDC4B1FFF455}.Debug|x64.ActiveCfg = Debug|x64
{9E5EF415-5337-4EED-AE23-EDC4B1FFF455}.Debug|x64.Build.0 = Debug|x64
{9E5EF415-5337-4EED-AE23-EDC4B1FFF455}.Debug|x86.ActiveCfg = Debug|Win32
{9E5EF415-5337-4EED-AE23-EDC4B1FFF455}.Debug|x86.Build.0 = Debug|Win32
{9E5EF415-5337-4EED-AE23-EDC4B1FFF455}.Release|x64.ActiveCfg = Release|x64
{9E5EF415-5337-4EED-AE23-EDC4B1FFF455}.Release|x64.Build.0 = Release|x64
{9E5EF415-5337-4EED-AE23-EDC4B1FFF455}.Release|x86.ActiveCfg = Release|Win32
{9E5EF415-5337-4EED-AE23-EDC4B1FFF455}.Release|x86.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -2,13 +2,13 @@
Khaotic Engine Reborn reprend comme base le moteur Khaotic Engine pour lui ajouter plus de fonctionalité. Khaotic Engine Reborn reprend comme base le moteur Khaotic Engine pour lui ajouter plus de fonctionalité.
Ce moteur est basé sur **DirectX11** et utilise **ImGui** pour son interface graphique. Ce moteur est basé sur **DirectX11** utilise **ImGui** avec une couche d'abstraction pour permetre son usage avec d'autres API.
--- ---
Khaotic Engine is a rendering engine made in **C++** by a small team with the aim of learning how to use rendering APIs (OpenGL, DirectX 11/12 and Vulkan). Khaotic Engine is a rendering engine made in **C++** by a small team with the aim of learning how to use rendering APIs (OpenGL, DirectX 11/12 and Vulkan).
This **DirectX11** based engine uses **ImGui** for the user interface. This **DirectX11** based engine uses **ImGui** with an abstraction layer to enable its use with other APIs.
## Installation ## Installation
@ -35,36 +35,15 @@ This **DirectX11** based engine uses **ImGui** for the user interface.
**SHADER** : **SHADER** :
+ Sunlight shader - Cel Shading
+ Cel Shading
+ Skysphere
**Interface Graphique** : **Interface Graphique** :
+ Console link to the Logger object - Shader Manager
+ Shader Manager
+ Engine Settings
+ Sunlight Settings
**Save And Load of a Scene** :
+ Save All Custom object
+ Save All Custom Texture for Custom Object
**Texture File** :
+ All the format supported by Windows Imaging Component (WIC)
**Optimization** :
- Shader rendering
- Frustum culling
- Object rendering
- Terrain Instancing
## Demo : ## Demo :
[![Demo Video](https://img.youtube.com/vi/CbK1a0Ar94Q/0.jpg)](https://youtu.be/CbK1a0Ar94Q) [![Demo Video](https://img.youtube.com/vi/qCOCTyB_97c/0.jpg)](https://www.youtube.com/watch?v=qCOCTyB_97c)
## Engine Build by : ## Engine Build by :
@ -77,7 +56,7 @@ This **DirectX11** based engine uses **ImGui** for the user interface.
- [@Harpie94](https://github.com/Harpie94) - [@Harpie94](https://github.com/Harpie94)
- [@axelpicou](https://github.com/axelpicou) - [@axelpicou](https://github.com/axelpicou)
- [@GolfOcean334](https://github.com/GolfOcean334) - [@GolfOcean334](https://github.com/GolfOcean334)
- [@sutabasuto](https://github.com/sutabasuto) - [@sutabasuto](https://github.com/sutabasuto)
**Moteur Reborn** : **Moteur Reborn** :

View File

@ -1,58 +1,58 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Filename: cameraclass.cpp // Filename: cameraclass.cpp
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "camera_class.h" #include "cameraclass.h"
camera_class::camera_class() CameraClass::CameraClass()
{ {
position_x_ = 0.0f; m_positionX = 0.0f;
position_y_ = 0.0f; m_positionY = 0.0f;
position_z_ = 0.0f; m_positionZ = 0.0f;
rotation_x_ = 0.0f; m_rotationX = 0.0f;
rotation_y_ = 0.0f; m_rotationY = 0.0f;
rotation_z_ = 0.0f; m_rotationZ = 0.0f;
} }
camera_class::camera_class(const camera_class& other) CameraClass::CameraClass(const CameraClass& other)
{ {
} }
camera_class::~camera_class() CameraClass::~CameraClass()
{ {
} }
void camera_class::set_position(float x, float y, float z) void CameraClass::SetPosition(float x, float y, float z)
{ {
position_x_ = x; m_positionX = x;
position_y_ = y; m_positionY = y;
position_z_ = z; m_positionZ = z;
return; return;
} }
void camera_class::set_rotation(float x, float y, float z) void CameraClass::SetRotation(float x, float y, float z)
{ {
rotation_x_ = x; m_rotationX = x;
rotation_y_ = y; m_rotationY = y;
rotation_z_ = z; m_rotationZ = z;
return; return;
} }
XMFLOAT3 camera_class::get_position() XMFLOAT3 CameraClass::GetPosition()
{ {
return XMFLOAT3(position_x_, position_y_, position_z_); return XMFLOAT3(m_positionX, m_positionY, m_positionZ);
} }
XMFLOAT3 camera_class::get_rotation() XMFLOAT3 CameraClass::GetRotation()
{ {
return XMFLOAT3(rotation_x_, rotation_y_, rotation_z_); return XMFLOAT3(m_rotationX, m_rotationY, m_rotationZ);
} }
void camera_class::render() void CameraClass::Render()
{ {
XMFLOAT3 up, position, lookAt; XMFLOAT3 up, position, lookAt;
XMVECTOR upVector, positionVector, lookAtVector; XMVECTOR upVector, positionVector, lookAtVector;
@ -69,9 +69,9 @@ void camera_class::render()
upVector = XMLoadFloat3(&up); upVector = XMLoadFloat3(&up);
// Setup the position of the camera in the world. // Setup the position of the camera in the world.
position.x = position_x_; position.x = m_positionX;
position.y = position_y_; position.y = m_positionY;
position.z = position_z_; position.z = m_positionZ;
// Load it into a XMVECTOR structure. // Load it into a XMVECTOR structure.
positionVector = XMLoadFloat3(&position); positionVector = XMLoadFloat3(&position);
@ -85,9 +85,9 @@ void camera_class::render()
lookAtVector = XMLoadFloat3(&lookAt); lookAtVector = XMLoadFloat3(&lookAt);
// Set the yaw (Y axis), pitch (X axis), and roll (Z axis) rotations in radians. // Set the yaw (Y axis), pitch (X axis), and roll (Z axis) rotations in radians.
pitch = rotation_x_ * 0.0174532925f; pitch = m_rotationX * 0.0174532925f;
yaw = rotation_y_ * 0.0174532925f; yaw = m_rotationY * 0.0174532925f;
roll = rotation_z_ * 0.0174532925f; roll = m_rotationZ * 0.0174532925f;
// Create the rotation matrix from the yaw, pitch, and roll values. // Create the rotation matrix from the yaw, pitch, and roll values.
rotationMatrix = XMMatrixRotationRollPitchYaw(pitch, yaw, roll); rotationMatrix = XMMatrixRotationRollPitchYaw(pitch, yaw, roll);
@ -100,18 +100,18 @@ void camera_class::render()
lookAtVector = XMVectorAdd(positionVector, lookAtVector); lookAtVector = XMVectorAdd(positionVector, lookAtVector);
// Finally create the view matrix from the three updated vectors. // Finally create the view matrix from the three updated vectors.
view_matrix_ = XMMatrixLookAtLH(positionVector, lookAtVector, upVector); m_viewMatrix = XMMatrixLookAtLH(positionVector, lookAtVector, upVector);
return; return;
} }
XMMATRIX camera_class::get_view_matrix(XMMATRIX& view_matrix) const XMMATRIX CameraClass::GetViewMatrix(XMMATRIX& viewMatrix) const
{ {
view_matrix = view_matrix_; viewMatrix = m_viewMatrix;
return view_matrix; return viewMatrix;
} }
void camera_class::render_reflection(float height) void CameraClass::RenderReflection(float height)
{ {
XMFLOAT3 up, position, lookAt; XMFLOAT3 up, position, lookAt;
XMVECTOR upVector, positionVector, lookAtVector; XMVECTOR upVector, positionVector, lookAtVector;
@ -128,9 +128,9 @@ void camera_class::render_reflection(float height)
upVector = XMLoadFloat3(&up); upVector = XMLoadFloat3(&up);
// Setup the position of the camera in the world. // Setup the position of the camera in the world.
position.x = position_x_; position.x = m_positionX;
position.y = -position_y_ + (height * 2.0f); position.y = -m_positionY + (height * 2.0f);
position.z = position_z_; position.z = m_positionZ;
// Load it into a XMVECTOR structure. // Load it into a XMVECTOR structure.
positionVector = XMLoadFloat3(&position); positionVector = XMLoadFloat3(&position);
@ -144,9 +144,9 @@ void camera_class::render_reflection(float height)
lookAtVector = XMLoadFloat3(&lookAt); lookAtVector = XMLoadFloat3(&lookAt);
// Set the yaw (Y axis), pitch (X axis), and roll (Z axis) rotations in radians. // Set the yaw (Y axis), pitch (X axis), and roll (Z axis) rotations in radians.
pitch = (-1.0f * rotation_x_) * 0.0174532925f; // Invert for reflection pitch = (-1.0f * m_rotationX) * 0.0174532925f; // Invert for reflection
yaw = rotation_y_ * 0.0174532925f; yaw = m_rotationY * 0.0174532925f;
roll = rotation_z_ * 0.0174532925f; roll = m_rotationZ * 0.0174532925f;
// Create the rotation matrix from the yaw, pitch, and roll values. // Create the rotation matrix from the yaw, pitch, and roll values.
rotationMatrix = XMMatrixRotationRollPitchYaw(pitch, yaw, roll); rotationMatrix = XMMatrixRotationRollPitchYaw(pitch, yaw, roll);
@ -159,13 +159,13 @@ void camera_class::render_reflection(float height)
lookAtVector = XMVectorAdd(positionVector, lookAtVector); lookAtVector = XMVectorAdd(positionVector, lookAtVector);
// Finally create the view matrix from the three updated vectors. // Finally create the view matrix from the three updated vectors.
reflection_view_matrix_ = XMMatrixLookAtLH(positionVector, lookAtVector, upVector); m_reflectionViewMatrix = XMMatrixLookAtLH(positionVector, lookAtVector, upVector);
return; return;
} }
void camera_class::get_reflection_view_matrix(XMMATRIX& reflectionViewMatrix) const void CameraClass::GetReflectionViewMatrix(XMMATRIX& reflectionViewMatrix) const
{ {
reflectionViewMatrix = reflection_view_matrix_; reflectionViewMatrix = m_reflectionViewMatrix;
return; return;
} }

View File

@ -0,0 +1,46 @@
////////////////////////////////////////////////////////////////////////////////
// Filename: cameraclass.h
////////////////////////////////////////////////////////////////////////////////
#ifndef _CAMERACLASS_H_
#define _CAMERACLASS_H_
//////////////
// INCLUDES //
//////////////
#include <directxmath.h>
using namespace DirectX;
////////////////////////////////////////////////////////////////////////////////
// Class name: CameraClass
////////////////////////////////////////////////////////////////////////////////
class CameraClass
{
public:
CameraClass();
CameraClass(const CameraClass&);
~CameraClass();
void SetPosition(float, float, float);
void SetRotation(float, float, float);
XMFLOAT3 GetPosition();
XMFLOAT3 GetRotation();
void Render();
XMMATRIX GetViewMatrix(XMMATRIX& viewMatrix) const;
void RenderReflection(float);
void GetReflectionViewMatrix(XMMATRIX&) const;
private:
float m_positionX, m_positionY, m_positionZ;
float m_rotationX, m_rotationY, m_rotationZ;
XMMATRIX m_viewMatrix;
XMMATRIX m_reflectionViewMatrix;
};
#endif

View File

@ -0,0 +1,410 @@
#include "CelShadingShader.h"
#include <iostream>
CelShadingShader::CelShadingShader()
{
m_vertexShader = 0;
m_pixelShader = 0;
m_layout = 0;
m_matrixBuffer = 0;
m_sampleState = 0;
m_lightBuffer = 0;
}
CelShadingShader::CelShadingShader(const CelShadingShader& other)
{
}
CelShadingShader::~CelShadingShader()
{
}
bool CelShadingShader::Initialize(ID3D11Device* device, HWND hwnd)
{
Logger::Get().Log("Initializing CelShadingShader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
bool result;
wchar_t vsFilename[128];
wchar_t psFilename[128];
int error;
// Set the filename of the vertex shader.
error = wcscpy_s(vsFilename, 128, L"celshading.vs");
if (error != 0)
{
Logger::Get().Log("Failed to set the filename of the vertex shader", __FILE__, __LINE__);
return false;
}
// Set the filename of the pixel shader.
error = wcscpy_s(psFilename, 128, L"celshading.ps");
if (error != 0)
{
Logger::Get().Log("Failed to set the filename of the pixel shader", __FILE__, __LINE__);
return false;
}
// Initialize the vertex and pixel shaders.
result = InitializeShader(device, hwnd, vsFilename, psFilename);
if (!result)
{
Logger::Get().Log("Failed to initialize the vertex and pixel shaders", __FILE__, __LINE__);
return false;
}
Logger::Get().Log("Successfully initialized CelShadingShader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
return true;
}
void CelShadingShader::Shutdown()
{
// Shutdown the vertex and pixel shaders as well as the related objects.
ShutdownShader();
}
bool CelShadingShader::Render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
ID3D11ShaderResourceView* texture, XMFLOAT3 lightDirection, XMFLOAT4 diffuseColor, XMFLOAT3 lightPosition)
{
bool result;
// Set the shader parameters that it will use for rendering.
result = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, lightDirection, diffuseColor, lightPosition);
if (!result)
{
Logger::Get().Log("CelShading Error", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Now render the prepared buffers with the shader.
RenderShader(deviceContext, indexCount);
return true;
}
bool CelShadingShader::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
{
HRESULT result;
ID3D10Blob* errorMessage = nullptr;
ID3D10Blob* vertexShaderBuffer = nullptr;
ID3D10Blob* pixelShaderBuffer = nullptr;
D3D11_INPUT_ELEMENT_DESC polygonLayout[3];
unsigned int numElements;
D3D11_BUFFER_DESC matrixBufferDesc;
D3D11_SAMPLER_DESC samplerDesc;
D3D11_BUFFER_DESC lightBufferDesc;
// Compile the vertex shader code.
result = D3DCompileFromFile(vsFilename, nullptr, nullptr, "CelShadingVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, &vertexShaderBuffer, &errorMessage);
if (FAILED(result))
{
// If the shader failed to compile it should have written something to the error message.
if (errorMessage)
{
OutputShaderErrorMessage(errorMessage, hwnd, vsFilename);
}
// If there was nothing in the error message then it simply could not find the shader file itself.
else
{
MessageBox(hwnd, vsFilename, L"Missing Shader File", MB_OK);
}
return false;
}
// Compile the pixel shader code.
result = D3DCompileFromFile(psFilename, nullptr, nullptr, "CelShadingPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0, &pixelShaderBuffer, &errorMessage);
if (FAILED(result))
{
// If the shader failed to compile it should have written something to the error message.
if (errorMessage)
{
OutputShaderErrorMessage(errorMessage, hwnd, psFilename);
}
// If there was nothing in the error message then it simply could not find the file itself.
else
{
MessageBox(hwnd, psFilename, L"Missing Shader File", MB_OK);
}
return false;
}
// Create the vertex shader from the buffer.
result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), nullptr, &m_vertexShader);
if (FAILED(result))
{
return false;
}
// Create the pixel shader from the buffer.
result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), nullptr, &m_pixelShader);
if (FAILED(result))
{
return false;
}
// Create the vertex input layout description.
// This setup needs to match the VertexType structure in the ModelClass and in the shader.
polygonLayout[0].SemanticName = "POSITION";
polygonLayout[0].SemanticIndex = 0;
polygonLayout[0].Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
polygonLayout[0].InputSlot = 0;
polygonLayout[0].AlignedByteOffset = 0;
polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
polygonLayout[0].InstanceDataStepRate = 0;
polygonLayout[1].SemanticName = "NORMAL";
polygonLayout[1].SemanticIndex = 0;
polygonLayout[1].Format = DXGI_FORMAT_R32G32B32_FLOAT;
polygonLayout[1].InputSlot = 0;
polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
polygonLayout[1].InstanceDataStepRate = 0;
polygonLayout[2].SemanticName = "TEXCOORD";
polygonLayout[2].SemanticIndex = 0;
polygonLayout[2].Format = DXGI_FORMAT_R32G32_FLOAT;
polygonLayout[2].InputSlot = 0;
polygonLayout[2].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
polygonLayout[2].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
polygonLayout[2].InstanceDataStepRate = 0;
// Get a count of the elements in the layout.
numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
// Create the vertex input layout.
result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), &m_layout);
if (FAILED(result))
{
return false;
}
// Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
vertexShaderBuffer->Release();
vertexShaderBuffer = nullptr;
pixelShaderBuffer->Release();
pixelShaderBuffer = nullptr;
// Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
matrixBufferDesc.ByteWidth = sizeof(MatrixBufferType);
matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
matrixBufferDesc.MiscFlags = 0;
matrixBufferDesc.StructureByteStride = 0;
// Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
result = device->CreateBuffer(&matrixBufferDesc, nullptr, &m_matrixBuffer);
if (FAILED(result))
{
return false;
}
// Create a texture sampler state description.
samplerDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
samplerDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
samplerDesc.MipLODBias = 0.0f;
samplerDesc.MaxAnisotropy = 1;
samplerDesc.ComparisonFunc = D3D11_COMPARISON_ALWAYS;
samplerDesc.BorderColor[0] = 0;
samplerDesc.BorderColor[1] = 0;
samplerDesc.BorderColor[2] = 0;
samplerDesc.BorderColor[3] = 0;
samplerDesc.MinLOD = 0;
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
// Create the texture sampler state.
result = device->CreateSamplerState(&samplerDesc, &m_sampleState);
if (FAILED(result))
{
return false;
}
// Setup the description of the light dynamic constant buffer that is in the pixel shader.
lightBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
lightBufferDesc.ByteWidth = sizeof(LightBufferType);
lightBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
lightBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
lightBufferDesc.MiscFlags = 0;
lightBufferDesc.StructureByteStride = 0;
// Create the constant buffer pointer so we can access the pixel shader constant buffer from within this class.
result = device->CreateBuffer(&lightBufferDesc, nullptr, &m_lightBuffer);
if (FAILED(result))
{
return false;
}
return true;
}
void CelShadingShader::ShutdownShader()
{
// Release the light constant buffer.
if (m_lightBuffer)
{
m_lightBuffer->Release();
m_lightBuffer = nullptr;
}
// Release the sampler state.
if (m_sampleState)
{
m_sampleState->Release();
m_sampleState = nullptr;
}
// Release the matrix constant buffer.
if (m_matrixBuffer)
{
m_matrixBuffer->Release();
m_matrixBuffer = nullptr;
}
// Release the layout.
if (m_layout)
{
m_layout->Release();
m_layout = nullptr;
}
// Release the pixel shader.
if (m_pixelShader)
{
m_pixelShader->Release();
m_pixelShader = nullptr;
}
// Release the vertex shader.
if (m_vertexShader)
{
m_vertexShader->Release();
m_vertexShader = nullptr;
}
}
void CelShadingShader::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
{
char* compileErrors;
unsigned long bufferSize, i;
std::ofstream fout;
// Get a pointer to the error message text buffer.
compileErrors = (char*)(errorMessage->GetBufferPointer());
// Get the length of the message.
bufferSize = errorMessage->GetBufferSize();
// Open a file to write the error message to.
fout.open("shader-error.txt");
// Write out the error message.
for (i = 0; i < bufferSize; i++)
{
fout << compileErrors[i];
}
// Close the file.
fout.close();
// Release the error message.
errorMessage->Release();
errorMessage = nullptr;
// Pop a message up on the screen to notify the user to check the text file for compile errors.
MessageBox(hwnd, L"Error compiling shader. Check shader-error.txt for message.", shaderFilename, MB_OK);
}
bool CelShadingShader::SetShaderParameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
ID3D11ShaderResourceView* texture, XMFLOAT3 lightDirection, XMFLOAT4 diffuseColor, XMFLOAT3 lightPosition)
{
HRESULT result;
D3D11_MAPPED_SUBRESOURCE mappedResource;
MatrixBufferType* dataPtr;
LightBufferType* dataPtr2;
unsigned int bufferNumber;
// Transpose the matrices to prepare them for the shader.
worldMatrix = XMMatrixTranspose(worldMatrix);
viewMatrix = XMMatrixTranspose(viewMatrix);
projectionMatrix = XMMatrixTranspose(projectionMatrix);
// Lock the constant buffer so it can be written to.
result = deviceContext->Map(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result))
{
return false;
}
// Get a pointer to the data in the constant buffer.
dataPtr = (MatrixBufferType*)mappedResource.pData;
// Copy the matrices into the constant buffer.
dataPtr->world = worldMatrix;
dataPtr->view = viewMatrix;
dataPtr->projection = projectionMatrix;
// Unlock the constant buffer.
deviceContext->Unmap(m_matrixBuffer, 0);
// Set the position of the constant buffer in the vertex shader.
bufferNumber = 0;
// Finally set the constant buffer in the vertex shader with the updated values.
deviceContext->VSSetConstantBuffers(bufferNumber, 1, &m_matrixBuffer);
// Lock the light constant buffer so it can be written to.
result = deviceContext->Map(m_lightBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result))
{
return false;
}
// Get a pointer to the data in the constant buffer.
dataPtr2 = (LightBufferType*)mappedResource.pData;
// Copy the lighting variables into the constant buffer.
dataPtr2->diffuseColor = diffuseColor;
dataPtr2->lightDirection = lightDirection;
dataPtr2->lightPosition = lightPosition;
dataPtr2->constantAttenuation = 0.5f; // Set your attenuation values here
dataPtr2->linearAttenuation = 0.1f;
dataPtr2->quadraticAttenuation = 0.01f;
// Unlock the constant buffer.
deviceContext->Unmap(m_lightBuffer, 0);
// Set the position of the light constant buffer in the pixel shader.
bufferNumber = 0;
// Finally set the light constant buffer in the pixel shader with the updated values.
deviceContext->PSSetConstantBuffers(bufferNumber, 1, &m_lightBuffer);
// Set shader texture resource in the pixel shader.
deviceContext->PSSetShaderResources(0, 1, &texture);
return true;
}
void CelShadingShader::RenderShader(ID3D11DeviceContext* deviceContext, int indexCount)
{
// Set the vertex input layout.
deviceContext->IASetInputLayout(m_layout);
// Set the vertex and pixel shaders that will be used to render this triangle.
deviceContext->VSSetShader(m_vertexShader, nullptr, 0);
deviceContext->PSSetShader(m_pixelShader, nullptr, 0);
// Set the sampler state in the pixel shader.
deviceContext->PSSetSamplers(0, 1, &m_sampleState);
// Render the triangle.
deviceContext->DrawIndexed(indexCount, 0, 0);
}

View File

@ -0,0 +1,68 @@
#ifndef _CELSHADINGSHADER_H_
#define _CELSHADINGSHADER_H_
//////////////
// INCLUDES //
//////////////
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: CelShadingShader
////////////////////////////////////////////////////////////////////////////////
class CelShadingShader
{
private:
struct MatrixBufferType
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct LightBufferType
{
XMFLOAT4 diffuseColor;
XMFLOAT3 lightDirection;
float padding; // Padding to ensure the structure is a multiple of 16 bytes.
XMFLOAT3 lightPosition; // Add light position
float padding2; // Padding to ensure the structure is a multiple of 16 bytes.
float constantAttenuation;
float linearAttenuation;
float quadraticAttenuation;
float padding3; // Padding to ensure the structure is a multiple of 16 bytes.
};
public:
CelShadingShader();
CelShadingShader(const CelShadingShader&);
~CelShadingShader();
bool Initialize(ID3D11Device*, HWND);
void Shutdown();
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4, XMFLOAT3);
private:
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void ShutdownShader();
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4, XMFLOAT3);
void RenderShader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* m_vertexShader;
ID3D11PixelShader* m_pixelShader;
ID3D11InputLayout* m_layout;
ID3D11Buffer* m_matrixBuffer;
ID3D11SamplerState* m_sampleState;
ID3D11Buffer* m_lightBuffer;
};
#endif

View File

@ -1,29 +1,29 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Filename: colorshaderclass.cpp // Filename: colorshaderclass.cpp
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "color_shader_class.h" #include "colorshaderclass.h"
color_shader_class::color_shader_class() ColorShaderClass::ColorShaderClass()
{ {
vertex_shader_ = 0; m_vertexShader = 0;
pixel_shader_ = 0; m_pixelShader = 0;
layout_ = 0; m_layout = 0;
matrix_buffer_ = 0; m_matrixBuffer = 0;
} }
color_shader_class::color_shader_class(const color_shader_class& other) ColorShaderClass::ColorShaderClass(const ColorShaderClass& other)
{ {
} }
color_shader_class::~color_shader_class() ColorShaderClass::~ColorShaderClass()
{ {
} }
bool color_shader_class::initialize(ID3D11Device* device, HWND hwnd) bool ColorShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
{ {
Logger::Get().Log("Initializing color_shader_class", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing ColorShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize);
bool result; bool result;
wchar_t vsFilename[128]; wchar_t vsFilename[128];
@ -32,7 +32,7 @@ bool color_shader_class::initialize(ID3D11Device* device, HWND hwnd)
// Set the filename of the vertex shader. // Set the filename of the vertex shader.
error = wcscpy_s(vsFilename, 128, L"src/hlsl/Color.vs"); error = wcscpy_s(vsFilename, 128, L"../enginecustom/Color.vs");
if (error != 0) if (error != 0)
{ {
Logger::Get().Log("Error copying string", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error copying string", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -40,42 +40,42 @@ bool color_shader_class::initialize(ID3D11Device* device, HWND hwnd)
} }
// Set the filename of the pixel shader. // Set the filename of the pixel shader.
error = wcscpy_s(psFilename, 128, L"src/hlsl/Color.ps"); error = wcscpy_s(psFilename, 128, L"../enginecustom/Color.ps");
if (error != 0) if (error != 0)
{ {
Logger::Get().Log("Error copying string", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error copying string", __FILE__, __LINE__, Logger::LogLevel::Error);
return false; return false;
} }
// initialize the vertex and pixel shaders. // Initialize the vertex and pixel shaders.
result = initialize_shader(device, hwnd, vsFilename, psFilename); result = InitializeShader(device, hwnd, vsFilename, psFilename);
if (!result) if (!result)
{ {
Logger::Get().Log("Error initializing shader", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error initializing shader", __FILE__, __LINE__, Logger::LogLevel::Error);
return false; return false;
} }
Logger::Get().Log("color_shader_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("ColorShaderClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
return true; return true;
} }
void color_shader_class::shutdown() void ColorShaderClass::Shutdown()
{ {
// shutdown the vertex and pixel shaders as well as the related objects. // Shutdown the vertex and pixel shaders as well as the related objects.
shutdown_shader(); ShutdownShader();
return; return;
} }
bool color_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, bool ColorShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
XMMATRIX projectionMatrix) XMMATRIX projectionMatrix)
{ {
bool result; bool result;
// Set the shader parameters that it will use for rendering. // Set the shader parameters that it will use for rendering.
result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix); result = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix);
if (!result) if (!result)
{ {
Logger::Get().Log("Error setting shader parameters", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error setting shader parameters", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -83,12 +83,12 @@ bool color_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCou
} }
// Now render the prepared buffers with the shader. // Now render the prepared buffers with the shader.
render_shader(deviceContext, indexCount); RenderShader(deviceContext, indexCount);
return true; return true;
} }
bool color_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) bool ColorShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
{ {
Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
@ -101,7 +101,7 @@ bool color_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHA
D3D11_BUFFER_DESC matrixBufferDesc; D3D11_BUFFER_DESC matrixBufferDesc;
// initialize the pointers this function will use to null. // Initialize the pointers this function will use to null.
errorMessage = 0; errorMessage = 0;
vertexShaderBuffer = 0; vertexShaderBuffer = 0;
pixelShaderBuffer = 0; pixelShaderBuffer = 0;
@ -114,7 +114,7 @@ bool color_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHA
// If the shader failed to compile it should have writen something to the error message. // If the shader failed to compile it should have writen something to the error message.
if (errorMessage) if (errorMessage)
{ {
output_shader_error_message(errorMessage, hwnd, vsFilename); OutputShaderErrorMessage(errorMessage, hwnd, vsFilename);
} }
// If there was nothing in the error message then it simply could not find the shader file itself. // If there was nothing in the error message then it simply could not find the shader file itself.
else else
@ -133,7 +133,7 @@ bool color_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHA
// If the shader failed to compile it should have writen something to the error message. // If the shader failed to compile it should have writen something to the error message.
if (errorMessage) if (errorMessage)
{ {
output_shader_error_message(errorMessage, hwnd, psFilename); OutputShaderErrorMessage(errorMessage, hwnd, psFilename);
} }
// If there was nothing in the error message then it simply could not find the file itself. // If there was nothing in the error message then it simply could not find the file itself.
else else
@ -145,7 +145,7 @@ bool color_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHA
} }
// Create the vertex shader from the buffer. // Create the vertex shader from the buffer.
result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_); result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &m_vertexShader);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Error creating vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error creating vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -153,7 +153,7 @@ bool color_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHA
} }
// Create the pixel shader from the buffer. // Create the pixel shader from the buffer.
result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_); result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &m_pixelShader);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Error creating pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error creating pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -183,7 +183,7 @@ bool color_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHA
// Create the vertex input layout. // Create the vertex input layout.
result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(), result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(),
vertexShaderBuffer->GetBufferSize(), &layout_); vertexShaderBuffer->GetBufferSize(), &m_layout);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Error creating input layout", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error creating input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -199,14 +199,14 @@ bool color_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHA
// Setup the description of the dynamic matrix constant buffer that is in the vertex shader. // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC; matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type); matrixBufferDesc.ByteWidth = sizeof(MatrixBufferType);
matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
matrixBufferDesc.MiscFlags = 0; matrixBufferDesc.MiscFlags = 0;
matrixBufferDesc.StructureByteStride = 0; matrixBufferDesc.StructureByteStride = 0;
// Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class. // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_); result = device->CreateBuffer(&matrixBufferDesc, NULL, &m_matrixBuffer);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Error creating constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error creating constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -218,43 +218,43 @@ bool color_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHA
return true; return true;
} }
void color_shader_class::shutdown_shader() void ColorShaderClass::ShutdownShader()
{ {
Logger::Get().Log("Shutting down shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Shutting down shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
// Release the matrix constant buffer. // Release the matrix constant buffer.
if (matrix_buffer_) if (m_matrixBuffer)
{ {
Logger::Get().Log("Releasing matrix buffer", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Releasing matrix buffer", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
matrix_buffer_->Release(); m_matrixBuffer->Release();
matrix_buffer_ = 0; m_matrixBuffer = 0;
Logger::Get().Log("Matrix buffer released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Matrix buffer released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
} }
// Release the layout. // Release the layout.
if (layout_) if (m_layout)
{ {
Logger::Get().Log("Releasing layout", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Releasing layout", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
layout_->Release(); m_layout->Release();
layout_ = 0; m_layout = 0;
Logger::Get().Log("Layout released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Layout released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
} }
// Release the pixel shader. // Release the pixel shader.
if (pixel_shader_) if (m_pixelShader)
{ {
Logger::Get().Log("Releasing pixel shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Releasing pixel shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
pixel_shader_->Release(); m_pixelShader->Release();
pixel_shader_ = 0; m_pixelShader = 0;
Logger::Get().Log("Pixel shader released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Pixel shader released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
} }
// Release the vertex shader. // Release the vertex shader.
if (vertex_shader_) if (m_vertexShader)
{ {
Logger::Get().Log("Releasing vertex shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Releasing vertex shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
vertex_shader_->Release(); m_vertexShader->Release();
vertex_shader_ = 0; m_vertexShader = 0;
Logger::Get().Log("Vertex shader released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Vertex shader released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
} }
@ -263,7 +263,7 @@ void color_shader_class::shutdown_shader()
return; return;
} }
void color_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename) void ColorShaderClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
{ {
char* compileErrors; char* compileErrors;
unsigned long long bufferSize, i; unsigned long long bufferSize, i;
@ -298,14 +298,14 @@ void color_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, H
return; return;
} }
bool color_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, bool ColorShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
XMMATRIX projectionMatrix) XMMATRIX projectionMatrix)
{ {
Logger::Get().Log("Setting shader parameters", __FILE__, __LINE__); Logger::Get().Log("Setting shader parameters", __FILE__, __LINE__);
HRESULT result; HRESULT result;
D3D11_MAPPED_SUBRESOURCE mappedResource; D3D11_MAPPED_SUBRESOURCE mappedResource;
matrix_buffer_type* dataPtr; MatrixBufferType* dataPtr;
unsigned int bufferNumber; unsigned int bufferNumber;
// Transpose the matrices to prepare them for the shader. // Transpose the matrices to prepare them for the shader.
@ -314,7 +314,7 @@ bool color_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContex
projectionMatrix = XMMatrixTranspose(projectionMatrix); projectionMatrix = XMMatrixTranspose(projectionMatrix);
// Lock the constant buffer so it can be written to. // Lock the constant buffer so it can be written to.
result = deviceContext->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = deviceContext->Map(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Error mapping constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error mapping constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -322,7 +322,7 @@ bool color_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContex
} }
// Get a pointer to the data in the constant buffer. // Get a pointer to the data in the constant buffer.
dataPtr = (matrix_buffer_type*)mappedResource.pData; dataPtr = (MatrixBufferType*)mappedResource.pData;
// Copy the matrices into the constant buffer. // Copy the matrices into the constant buffer.
dataPtr->world = worldMatrix; dataPtr->world = worldMatrix;
@ -330,27 +330,27 @@ bool color_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContex
dataPtr->projection = projectionMatrix; dataPtr->projection = projectionMatrix;
// Unlock the constant buffer. // Unlock the constant buffer.
deviceContext->Unmap(matrix_buffer_, 0); deviceContext->Unmap(m_matrixBuffer, 0);
// Set the position of the constant buffer in the vertex shader. // Set the position of the constant buffer in the vertex shader.
bufferNumber = 0; bufferNumber = 0;
// Finanly set the constant buffer in the vertex shader with the updated values. // Finanly set the constant buffer in the vertex shader with the updated values.
deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_); deviceContext->VSSetConstantBuffers(bufferNumber, 1, &m_matrixBuffer);
return true; return true;
} }
void color_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount) void ColorShaderClass::RenderShader(ID3D11DeviceContext* deviceContext, int indexCount)
{ {
// Set the vertex input layout. // Set the vertex input layout.
deviceContext->IASetInputLayout(layout_); deviceContext->IASetInputLayout(m_layout);
// Set the vertex and pixel shaders that will be used to render this triangle. // Set the vertex and pixel shaders that will be used to render this triangle.
deviceContext->VSSetShader(vertex_shader_, NULL, 0); deviceContext->VSSetShader(m_vertexShader, NULL, 0);
deviceContext->PSSetShader(pixel_shader_, NULL, 0); deviceContext->PSSetShader(m_pixelShader, NULL, 0);
// render the triangle. // Render the triangle.
deviceContext->DrawIndexed(indexCount, 0, 0); deviceContext->DrawIndexed(indexCount, 0, 0);
return; return;

View File

@ -18,12 +18,12 @@ using namespace std;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Class name: color_shader_class // Class name: ColorShaderClass
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class color_shader_class class ColorShaderClass
{ {
private: private:
struct matrix_buffer_type struct MatrixBufferType
{ {
XMMATRIX world; XMMATRIX world;
XMMATRIX view; XMMATRIX view;
@ -31,27 +31,27 @@ private:
}; };
public: public:
color_shader_class(); ColorShaderClass();
color_shader_class(const color_shader_class&); ColorShaderClass(const ColorShaderClass&);
~color_shader_class(); ~ColorShaderClass();
bool initialize(ID3D11Device*, HWND); bool Initialize(ID3D11Device*, HWND);
void shutdown(); void Shutdown();
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX); bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX);
private: private:
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*); bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void shutdown_shader(); void ShutdownShader();
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*); void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX); bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX);
void render_shader(ID3D11DeviceContext*, int); void RenderShader(ID3D11DeviceContext*, int);
private: private:
ID3D11VertexShader* vertex_shader_; ID3D11VertexShader* m_vertexShader;
ID3D11PixelShader* pixel_shader_; ID3D11PixelShader* m_pixelShader;
ID3D11InputLayout* layout_; ID3D11InputLayout* m_layout;
ID3D11Buffer* matrix_buffer_; ID3D11Buffer* m_matrixBuffer;
}; };
#endif #endif

View File

@ -1 +0,0 @@
1 isosphere 0 10 0 0 -0 0 1 1 1 Content/Assets/Kobject/isosphere.obj ALPHA_MAPPING 1 Unknown 1 0 2 assets/Texture/Bricks2K.png F:\Github_Repo\khaotic-engine-Reborn\enginecustom\assets\Texture\moss01.png 1 assets/Texture/BricksNRM2K.png 1 assets/Texture/BricksGLOSS2K.png 1 F:\Github_Repo\khaotic-engine-Reborn\enginecustom\assets\Texture\alpha01.png

View File

@ -1 +0,0 @@
0 vaisseautri 0 50 0 0 -0 0 1 1 1 Content/Assets/Kobject/vaisseautri.obj CEL_SHADING 1 Unknown 1 0 1 F:\Github_Repo\khaotic-engine-Reborn\enginecustom\assets\Texture\marble01.png 1 assets/Texture/BricksNRM2K.png 1 assets/Texture/BricksGLOSS2K.png 0

View File

@ -1,24 +1,24 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Filename: lightclass.cpp // Filename: lightclass.cpp
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "light_class.h" #include "lightclass.h"
light_class::light_class() LightClass::LightClass()
{ {
} }
light_class::light_class(const light_class& other) LightClass::LightClass(const LightClass& other)
{ {
} }
light_class::~light_class() LightClass::~LightClass()
{ {
} }
void light_class::SetAmbientColor(float red, float green, float blue, float alpha) void LightClass::SetAmbientColor(float red, float green, float blue, float alpha)
{ {
m_ambientColor = XMFLOAT4(red, green, blue, alpha); m_ambientColor = XMFLOAT4(red, green, blue, alpha);
return; return;
@ -26,66 +26,66 @@ void light_class::SetAmbientColor(float red, float green, float blue, float alph
void light_class::SetDiffuseColor(float red, float green, float blue, float alpha) void LightClass::SetDiffuseColor(float red, float green, float blue, float alpha)
{ {
m_diffuseColor = XMFLOAT4(red, green, blue, alpha); m_diffuseColor = XMFLOAT4(red, green, blue, alpha);
return; return;
} }
void light_class::SetDirection(float x, float y, float z) void LightClass::SetDirection(float x, float y, float z)
{ {
m_direction = XMFLOAT3(x, y, z); m_direction = XMFLOAT3(x, y, z);
return; return;
} }
void light_class::SetSpecularColor(float red, float green, float blue, float alpha) void LightClass::SetSpecularColor(float red, float green, float blue, float alpha)
{ {
m_specularColor = XMFLOAT4(red, green, blue, alpha); m_specularColor = XMFLOAT4(red, green, blue, alpha);
return; return;
} }
void light_class::SetSpecularPower(float power) void LightClass::SetSpecularPower(float power)
{ {
m_specularPower = power; m_specularPower = power;
return; return;
} }
void light_class::SetPosition(float x, float y, float z) void LightClass::SetPosition(float x, float y, float z)
{ {
m_position = XMFLOAT4(x, y, z, 1.0f); m_position = XMFLOAT4(x, y, z, 1.0f);
return; return;
} }
XMFLOAT4 light_class::GetAmbientColor() XMFLOAT4 LightClass::GetAmbientColor()
{ {
return m_ambientColor; return m_ambientColor;
} }
XMFLOAT4 light_class::GetDiffuseColor() XMFLOAT4 LightClass::GetDiffuseColor()
{ {
return m_diffuseColor; return m_diffuseColor;
} }
XMFLOAT3 light_class::GetDirection() XMFLOAT3 LightClass::GetDirection()
{ {
return m_direction; return m_direction;
} }
XMFLOAT4 light_class::GetSpecularColor() XMFLOAT4 LightClass::GetSpecularColor()
{ {
return m_specularColor; return m_specularColor;
} }
float light_class::GetSpecularPower() float LightClass::GetSpecularPower()
{ {
return m_specularPower; return m_specularPower;
} }
XMFLOAT4 light_class::GetPosition() XMFLOAT4 LightClass::GetPosition()
{ {
return m_position; return m_position;
} }

View File

@ -14,14 +14,14 @@ using namespace DirectX;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Class name: light_class // Class name: LightClass
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class light_class class LightClass
{ {
public: public:
light_class(); LightClass();
light_class(const light_class&); LightClass(const LightClass&);
~light_class(); ~LightClass();
void SetAmbientColor(float, float, float, float); void SetAmbientColor(float, float, float, float);
void SetDiffuseColor(float, float, float, float); void SetDiffuseColor(float, float, float, float);
@ -36,16 +36,12 @@ public:
XMFLOAT4 GetSpecularColor(); XMFLOAT4 GetSpecularColor();
float GetSpecularPower(); float GetSpecularPower();
XMFLOAT4 GetPosition(); XMFLOAT4 GetPosition();
void SetIntensity(float intensity) { m_intensity = intensity; }
float GetIntensity() const { return m_intensity; }
private: private:
XMFLOAT4 m_ambientColor; XMFLOAT4 m_ambientColor;
XMFLOAT4 m_diffuseColor; XMFLOAT4 m_diffuseColor;
XMFLOAT3 m_direction; XMFLOAT3 m_direction;
XMFLOAT4 m_specularColor; XMFLOAT4 m_specularColor;
float m_intensity;
float m_specularPower; float m_specularPower;
XMFLOAT4 m_position; XMFLOAT4 m_position;
}; };

View File

@ -1,36 +1,36 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Filename: lightshaderclass.cpp // Filename: lightshaderclass.cpp
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "light_shader_class.h" #include "lightshaderclass.h"
light_shader_class::light_shader_class() LightShaderClass::LightShaderClass()
{ {
vertex_shader_ = 0; m_vertexShader = 0;
pixel_shader_ = 0; m_pixelShader = 0;
layout_ = 0; m_layout = 0;
sample_state_ = 0; m_sampleState = 0;
matrix_buffer_ = 0; m_matrixBuffer = 0;
camera_buffer_ = 0; m_cameraBuffer = 0;
light_buffer_ = 0; m_lightBuffer = 0;
light_color_buffer_ = 0; m_lightColorBuffer = 0;
light_position_buffer_ = 0; m_lightPositionBuffer = 0;
} }
light_shader_class::light_shader_class(const light_shader_class& other) LightShaderClass::LightShaderClass(const LightShaderClass& other)
{ {
} }
light_shader_class::~light_shader_class() LightShaderClass::~LightShaderClass()
{ {
} }
bool light_shader_class::initialize(ID3D11Device* device, HWND hwnd) bool LightShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
{ {
Logger::Get().Log("Initializing light_shader_class", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing LightShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize);
wchar_t vsFilename[128]; wchar_t vsFilename[128];
wchar_t psFilename[128]; wchar_t psFilename[128];
@ -38,7 +38,7 @@ bool light_shader_class::initialize(ID3D11Device* device, HWND hwnd)
bool result; bool result;
// Set the filename of the vertex shader. // Set the filename of the vertex shader.
error = wcscpy_s(vsFilename, 128, L"src/hlsl/light.vs"); error = wcscpy_s(vsFilename, 128, L"light.vs");
if (error != 0) if (error != 0)
{ {
Logger::Get().Log("Failed to copy string", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to copy string", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -46,42 +46,42 @@ bool light_shader_class::initialize(ID3D11Device* device, HWND hwnd)
} }
// Set the filename of the pixel shader. // Set the filename of the pixel shader.
error = wcscpy_s(psFilename, 128, L"src/hlsl/light.ps"); error = wcscpy_s(psFilename, 128, L"light.ps");
if (error != 0) if (error != 0)
{ {
Logger::Get().Log("Failed to copy string", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to copy string", __FILE__, __LINE__, Logger::LogLevel::Error);
return false; return false;
} }
// initialize the vertex and pixel shaders. // Initialize the vertex and pixel shaders.
result = initialize_shader(device, hwnd, vsFilename, psFilename); result = InitializeShader(device, hwnd, vsFilename, psFilename);
if (!result) if (!result)
{ {
Logger::Get().Log("Failed to initialize shader", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to initialize shader", __FILE__, __LINE__, Logger::LogLevel::Error);
return false; return false;
} }
Logger::Get().Log("light_shader_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("LightShaderClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
return true; return true;
} }
void light_shader_class::shutdown() void LightShaderClass::Shutdown()
{ {
// shutdown the vertex and pixel shaders as well as the related objects. // Shutdown the vertex and pixel shaders as well as the related objects.
shutdown_shader(); ShutdownShader();
return; return;
} }
bool light_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, bool LightShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
ID3D11ShaderResourceView* texture, XMFLOAT4 diffuseColor[], XMFLOAT4 lightPosition[], XMFLOAT4 ambientClor[]) ID3D11ShaderResourceView* texture, XMFLOAT4 diffuseColor[], XMFLOAT4 lightPosition[], XMFLOAT4 ambientClor[])
{ {
bool result; bool result;
// Set the shader parameters that it will use for rendering. // Set the shader parameters that it will use for rendering.
result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, diffuseColor, lightPosition, ambientClor); result = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, diffuseColor, lightPosition, ambientClor);
if(!result) if(!result)
{ {
Logger::Get().Log("Failed to set shader parameters", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to set shader parameters", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -89,13 +89,13 @@ bool light_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCou
} }
// Now render the prepared buffers with the shader. // Now render the prepared buffers with the shader.
render_shader(deviceContext, indexCount); RenderShader(deviceContext, indexCount);
return true; return true;
} }
bool light_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) bool LightShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
{ {
Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
@ -112,7 +112,7 @@ bool light_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHA
D3D11_BUFFER_DESC lightPositionBufferDesc; D3D11_BUFFER_DESC lightPositionBufferDesc;
// initialize the pointers this function will use to null. // Initialize the pointers this function will use to null.
errorMessage = 0; errorMessage = 0;
vertexShaderBuffer = 0; vertexShaderBuffer = 0;
pixelShaderBuffer = 0; pixelShaderBuffer = 0;
@ -124,7 +124,7 @@ bool light_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHA
// If the shader failed to compile it should have writen something to the error message. // If the shader failed to compile it should have writen something to the error message.
if (errorMessage) if (errorMessage)
{ {
output_shader_error_message(errorMessage, hwnd, vsFilename); OutputShaderErrorMessage(errorMessage, hwnd, vsFilename);
} }
// If there was nothing in the error message then it simply could not find the shader file itself. // If there was nothing in the error message then it simply could not find the shader file itself.
else else
@ -142,7 +142,7 @@ bool light_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHA
// If the shader failed to compile it should have writen something to the error message. // If the shader failed to compile it should have writen something to the error message.
if (errorMessage) if (errorMessage)
{ {
output_shader_error_message(errorMessage, hwnd, psFilename); OutputShaderErrorMessage(errorMessage, hwnd, psFilename);
} }
// If there was nothing in the error message then it simply could not find the file itself. // If there was nothing in the error message then it simply could not find the file itself.
else else
@ -154,7 +154,7 @@ bool light_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHA
} }
// Create the vertex shader from the buffer. // Create the vertex shader from the buffer.
result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_); result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &m_vertexShader);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -162,7 +162,7 @@ bool light_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHA
} }
// Create the pixel shader from the buffer. // Create the pixel shader from the buffer.
result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_); result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &m_pixelShader);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -200,7 +200,7 @@ bool light_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHA
// Create the vertex input layout. // Create the vertex input layout.
result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(),
&layout_); &m_layout);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create input layout", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -230,7 +230,7 @@ bool light_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHA
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
// Create the texture sampler state. // Create the texture sampler state.
result = device->CreateSamplerState(&samplerDesc, &sample_state_); result = device->CreateSamplerState(&samplerDesc, &m_sampleState);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create sampler state", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create sampler state", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -239,14 +239,14 @@ bool light_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHA
// Setup the description of the dynamic matrix constant buffer that is in the vertex shader. // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC; matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type); matrixBufferDesc.ByteWidth = sizeof(MatrixBufferType);
matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
matrixBufferDesc.MiscFlags = 0; matrixBufferDesc.MiscFlags = 0;
matrixBufferDesc.StructureByteStride = 0; matrixBufferDesc.StructureByteStride = 0;
// Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class. // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_); result = device->CreateBuffer(&matrixBufferDesc, NULL, &m_matrixBuffer);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create matrix buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create matrix buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -257,14 +257,14 @@ bool light_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHA
// Setup the description of the camera dynamic constant buffer that is in the vertex shader. // Setup the description of the camera dynamic constant buffer that is in the vertex shader.
cameraBufferDesc.Usage = D3D11_USAGE_DYNAMIC; cameraBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
cameraBufferDesc.ByteWidth = sizeof(camera_buffer_type); cameraBufferDesc.ByteWidth = sizeof(CameraBufferType);
cameraBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; cameraBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
cameraBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; cameraBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
cameraBufferDesc.MiscFlags = 0; cameraBufferDesc.MiscFlags = 0;
cameraBufferDesc.StructureByteStride = 0; cameraBufferDesc.StructureByteStride = 0;
// Create the camera constant buffer pointer so we can access the vertex shader constant buffer from within this class. // Create the camera constant buffer pointer so we can access the vertex shader constant buffer from within this class.
result = device->CreateBuffer(&cameraBufferDesc, NULL, &camera_buffer_); result = device->CreateBuffer(&cameraBufferDesc, NULL, &m_cameraBuffer);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create camera buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create camera buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -273,14 +273,14 @@ bool light_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHA
// Setup the description of the dynamic constant buffer that is in the pixel shader. // Setup the description of the dynamic constant buffer that is in the pixel shader.
lightColorBufferDesc.Usage = D3D11_USAGE_DYNAMIC; lightColorBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
lightColorBufferDesc.ByteWidth = sizeof(light_color_buffer_type); lightColorBufferDesc.ByteWidth = sizeof(LightColorBufferType);
lightColorBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; lightColorBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
lightColorBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; lightColorBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
lightColorBufferDesc.MiscFlags = 0; lightColorBufferDesc.MiscFlags = 0;
lightColorBufferDesc.StructureByteStride = 0; lightColorBufferDesc.StructureByteStride = 0;
// Create the constant buffer pointer so we can access the pixel shader constant buffer from within this class. // Create the constant buffer pointer so we can access the pixel shader constant buffer from within this class.
result = device->CreateBuffer(&lightColorBufferDesc, NULL, &light_color_buffer_); result = device->CreateBuffer(&lightColorBufferDesc, NULL, &m_lightColorBuffer);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create light color buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create light color buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -289,14 +289,14 @@ bool light_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHA
// Setup the description of the dynamic constant buffer that is in the vertex shader. // Setup the description of the dynamic constant buffer that is in the vertex shader.
lightPositionBufferDesc.Usage = D3D11_USAGE_DYNAMIC; lightPositionBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
lightPositionBufferDesc.ByteWidth = sizeof(light_position_buffer_type); lightPositionBufferDesc.ByteWidth = sizeof(LightPositionBufferType);
lightPositionBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; lightPositionBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
lightPositionBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; lightPositionBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
lightPositionBufferDesc.MiscFlags = 0; lightPositionBufferDesc.MiscFlags = 0;
lightPositionBufferDesc.StructureByteStride = 0; lightPositionBufferDesc.StructureByteStride = 0;
// Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class. // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
result = device->CreateBuffer(&lightPositionBufferDesc, NULL, &light_position_buffer_); result = device->CreateBuffer(&lightPositionBufferDesc, NULL, &m_lightPositionBuffer);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create light position buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create light position buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -309,79 +309,79 @@ bool light_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHA
} }
void light_shader_class::shutdown_shader() void LightShaderClass::ShutdownShader()
{ {
Logger::Get().Log("Shutting down light_shader_class", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Shutting down LightShaderClass", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
// Release the light constant buffers. // Release the light constant buffers.
if (light_color_buffer_) if (m_lightColorBuffer)
{ {
light_color_buffer_->Release(); m_lightColorBuffer->Release();
light_color_buffer_ = 0; m_lightColorBuffer = 0;
} }
if (light_position_buffer_) if (m_lightPositionBuffer)
{ {
light_position_buffer_->Release(); m_lightPositionBuffer->Release();
light_position_buffer_ = 0; m_lightPositionBuffer = 0;
} }
// Release the light constant buffer. // Release the light constant buffer.
if (light_buffer_) if (m_lightBuffer)
{ {
light_buffer_->Release(); m_lightBuffer->Release();
light_buffer_ = 0; m_lightBuffer = 0;
} }
// Release the camera constant buffer. // Release the camera constant buffer.
if (camera_buffer_) if (m_cameraBuffer)
{ {
camera_buffer_->Release(); m_cameraBuffer->Release();
camera_buffer_ = 0; m_cameraBuffer = 0;
} }
// Release the matrix constant buffer. // Release the matrix constant buffer.
if (matrix_buffer_) if (m_matrixBuffer)
{ {
matrix_buffer_->Release(); m_matrixBuffer->Release();
matrix_buffer_ = 0; m_matrixBuffer = 0;
} }
// Release the sampler state. // Release the sampler state.
if (sample_state_) if (m_sampleState)
{ {
sample_state_->Release(); m_sampleState->Release();
sample_state_ = 0; m_sampleState = 0;
} }
// Release the layout. // Release the layout.
if (layout_) if (m_layout)
{ {
layout_->Release(); m_layout->Release();
layout_ = 0; m_layout = 0;
} }
// Release the pixel shader. // Release the pixel shader.
if (pixel_shader_) if (m_pixelShader)
{ {
pixel_shader_->Release(); m_pixelShader->Release();
pixel_shader_ = 0; m_pixelShader = 0;
} }
// Release the vertex shader. // Release the vertex shader.
if (vertex_shader_) if (m_vertexShader)
{ {
vertex_shader_->Release(); m_vertexShader->Release();
vertex_shader_ = 0; m_vertexShader = 0;
} }
Logger::Get().Log("light_shader_class shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("LightShaderClass shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
return; return;
} }
void light_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename) void LightShaderClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
{ {
char* compileErrors; char* compileErrors;
unsigned __int64 bufferSize, i; unsigned __int64 bufferSize, i;
@ -417,15 +417,15 @@ void light_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, H
} }
bool light_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, bool LightShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
ID3D11ShaderResourceView* texture, XMFLOAT4 diffuseColor[], XMFLOAT4 lightPosition[], XMFLOAT4 ambientColor[]) ID3D11ShaderResourceView* texture, XMFLOAT4 diffuseColor[], XMFLOAT4 lightPosition[], XMFLOAT4 ambientColor[])
{ {
HRESULT result; HRESULT result;
D3D11_MAPPED_SUBRESOURCE mappedResource; D3D11_MAPPED_SUBRESOURCE mappedResource;
unsigned int bufferNumber; unsigned int bufferNumber;
matrix_buffer_type* dataPtr; MatrixBufferType* dataPtr;
light_position_buffer_type* dataPtr2; LightPositionBufferType* dataPtr2;
light_color_buffer_type* dataPtr3; LightColorBufferType* dataPtr3;
// Transpose the matrices to prepare them for the shader. // Transpose the matrices to prepare them for the shader.
worldMatrix = XMMatrixTranspose(worldMatrix); worldMatrix = XMMatrixTranspose(worldMatrix);
@ -433,7 +433,7 @@ bool light_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContex
projectionMatrix = XMMatrixTranspose(projectionMatrix); projectionMatrix = XMMatrixTranspose(projectionMatrix);
// Lock the constant buffer so it can be written to. // Lock the constant buffer so it can be written to.
result = deviceContext->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = deviceContext->Map(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to map matrix buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to map matrix buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -441,7 +441,7 @@ bool light_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContex
} }
// Get a pointer to the data in the constant buffer. // Get a pointer to the data in the constant buffer.
dataPtr = (matrix_buffer_type*)mappedResource.pData; dataPtr = (MatrixBufferType*)mappedResource.pData;
// Copy the matrices into the constant buffer. // Copy the matrices into the constant buffer.
dataPtr->world = worldMatrix; dataPtr->world = worldMatrix;
@ -449,16 +449,16 @@ bool light_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContex
dataPtr->projection = projectionMatrix; dataPtr->projection = projectionMatrix;
// Unlock the constant buffer. // Unlock the constant buffer.
deviceContext->Unmap(matrix_buffer_, 0); deviceContext->Unmap(m_matrixBuffer, 0);
// Set the position of the constant buffer in the vertex shader. // Set the position of the constant buffer in the vertex shader.
bufferNumber = 0; bufferNumber = 0;
// Now set the constant buffer in the vertex shader with the updated values. // Now set the constant buffer in the vertex shader with the updated values.
deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_); deviceContext->VSSetConstantBuffers(bufferNumber, 1, &m_matrixBuffer);
// Lock the camera constant buffer so it can be written to. // Lock the camera constant buffer so it can be written to.
result = deviceContext->Map(camera_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = deviceContext->Map(m_cameraBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to map camera buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to map camera buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -466,7 +466,7 @@ bool light_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContex
} }
// Lock the light position constant buffer so it can be written to. // Lock the light position constant buffer so it can be written to.
result = deviceContext->Map(light_position_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = deviceContext->Map(m_lightPositionBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to map light position buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to map light position buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -474,28 +474,28 @@ bool light_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContex
} }
// Get a pointer to the data in the constant buffer. // Get a pointer to the data in the constant buffer.
dataPtr2 = (light_position_buffer_type*)mappedResource.pData; dataPtr2 = (LightPositionBufferType*)mappedResource.pData;
// Copy the light position variables into the constant buffer. // Copy the light position variables into the constant buffer.
for (int i = 0; i < num_lights; i++) for (int i = 0; i < NUM_LIGHTS; i++)
{ {
dataPtr2->lightPosition[i] = lightPosition[i]; dataPtr2->lightPosition[i] = lightPosition[i];
} }
// Unlock the constant buffer. // Unlock the constant buffer.
deviceContext->Unmap(light_position_buffer_, 0); deviceContext->Unmap(m_lightPositionBuffer, 0);
// Set the position of the constant buffer in the vertex shader. // Set the position of the constant buffer in the vertex shader.
bufferNumber = 1; bufferNumber = 1;
// Finally set the constant buffer in the vertex shader with the updated values. // Finally set the constant buffer in the vertex shader with the updated values.
deviceContext->VSSetConstantBuffers(bufferNumber, 1, &light_position_buffer_); deviceContext->VSSetConstantBuffers(bufferNumber, 1, &m_lightPositionBuffer);
// Set shader texture resource in the pixel shader. // Set shader texture resource in the pixel shader.
deviceContext->PSSetShaderResources(0, 1, &texture); deviceContext->PSSetShaderResources(0, 1, &texture);
// Lock the light color constant buffer so it can be written to. // Lock the light color constant buffer so it can be written to.
result = deviceContext->Map(light_color_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = deviceContext->Map(m_lightColorBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to map light color buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to map light color buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -503,41 +503,41 @@ bool light_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContex
} }
// Get a pointer to the data in the constant buffer. // Get a pointer to the data in the constant buffer.
dataPtr3 = (light_color_buffer_type*)mappedResource.pData; dataPtr3 = (LightColorBufferType*)mappedResource.pData;
// Copy the light color variables into the constant buffer. // Copy the light color variables into the constant buffer.
for (int i = 0; i < num_lights; i++) for (int i = 0; i < NUM_LIGHTS; i++)
{ {
dataPtr3->diffuseColor[i] = diffuseColor[i]; dataPtr3->diffuseColor[i] = diffuseColor[i];
} }
// Unlock the constant buffer. // Unlock the constant buffer.
deviceContext->Unmap(light_color_buffer_, 0); deviceContext->Unmap(m_lightColorBuffer, 0);
// Set the position of the constant buffer in the pixel shader. // Set the position of the constant buffer in the pixel shader.
bufferNumber = 0; bufferNumber = 0;
// Finally set the constant buffer in the pixel shader with the updated values. // Finally set the constant buffer in the pixel shader with the updated values.
deviceContext->PSSetConstantBuffers(bufferNumber, 1, &light_color_buffer_); deviceContext->PSSetConstantBuffers(bufferNumber, 1, &m_lightColorBuffer);
return true; return true;
} }
void light_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount) void LightShaderClass::RenderShader(ID3D11DeviceContext* deviceContext, int indexCount)
{ {
// Set the vertex input layout. // Set the vertex input layout.
deviceContext->IASetInputLayout(layout_); deviceContext->IASetInputLayout(m_layout);
// Set the vertex and pixel shaders that will be used to render this triangle. // Set the vertex and pixel shaders that will be used to render this triangle.
deviceContext->VSSetShader(vertex_shader_, NULL, 0); deviceContext->VSSetShader(m_vertexShader, NULL, 0);
deviceContext->PSSetShader(pixel_shader_, NULL, 0); deviceContext->PSSetShader(m_pixelShader, NULL, 0);
// Set the sampler state in the pixel shader. // Set the sampler state in the pixel shader.
deviceContext->PSSetSamplers(0, 1, &sample_state_); deviceContext->PSSetSamplers(0, 1, &m_sampleState);
// render the triangle. // Render the triangle.
deviceContext->DrawIndexed(indexCount, 0, 0); deviceContext->DrawIndexed(indexCount, 0, 0);
return; return;

View File

@ -0,0 +1,92 @@
////////////////////////////////////////////////////////////////////////////////
// Filename: lightshaderclass.h
////////////////////////////////////////////////////////////////////////////////
#ifndef _LIGHTSHADERCLASS_H_
#define _LIGHTSHADERCLASS_H_
/////////////
// GLOBALS //
/////////////
const int NUM_LIGHTS = 4;
//////////////
// INCLUDES //
//////////////
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: LightShaderClass
////////////////////////////////////////////////////////////////////////////////
class LightShaderClass
{
private:
struct MatrixBufferType
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct CameraBufferType
{
XMFLOAT3 cameraPosition;
float padding;
};
struct LightBufferType
{
XMFLOAT4 ambientColor;
XMFLOAT4 diffuseColor;
XMFLOAT3 lightDirection;
float padding; // Added extra padding so structure is a multiple of 16 for CreateBuffer function requirements.
float specularPower;
XMFLOAT4 specularColor;
};
struct LightColorBufferType
{
XMFLOAT4 diffuseColor[NUM_LIGHTS];
};
struct LightPositionBufferType
{
XMFLOAT4 lightPosition[NUM_LIGHTS];
};
public:
LightShaderClass();
LightShaderClass(const LightShaderClass&);
~LightShaderClass();
bool Initialize(ID3D11Device*, HWND);
void Shutdown();
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[]);
private:
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void ShutdownShader();
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[]);
void RenderShader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* m_vertexShader;
ID3D11PixelShader* m_pixelShader;
ID3D11InputLayout* m_layout;
ID3D11SamplerState* m_sampleState;
ID3D11Buffer* m_matrixBuffer;
ID3D11Buffer* m_cameraBuffer;
ID3D11Buffer* m_lightBuffer;
ID3D11Buffer* m_lightColorBuffer;
ID3D11Buffer* m_lightPositionBuffer;
};
#endif

View File

@ -6,28 +6,25 @@
#include <iomanip> #include <iomanip>
#include <sstream> #include <sstream>
#include <filesystem> #include <filesystem>
#include <deque>
#include <unordered_set>
#include <imgui.h>
class Logger class Logger
{ {
public: public:
static Logger& Get() static Logger& Get()
{ {
static Logger instance; static Logger instance;
return instance; return instance;
} }
Logger(Logger const&) = delete; Logger(Logger const&) = delete;
void operator=(Logger const&) = delete; void operator=(Logger const&) = delete;
enum class LogLevel enum class LogLevel
{ {
Info, Info,
Warning, Warning,
Error, Error,
Shutdown, Shutdown,
Initialize, Initialize,
Update, Update,
@ -40,51 +37,10 @@ public:
AI, AI,
Resource, Resource,
Memory, Memory,
Debug, Debug
Count // Do not use this, it's just to get the number of log levels it must at the end };
};
// Return the size of the enum class LogLevel as a constant integer Logger()
static constexpr int LogLevelCount = static_cast<int>(LogLevel::Count);
struct LogEntry
{
std::string message;
LogLevel level;
};
struct LogLevelInfo
{
const char* name;
int value;
ImVec4 color;
};
static const LogLevelInfo GetLogLevelInfo(LogLevel level)
{
switch (level)
{
case LogLevel::Info: return LogLevelInfo{ "Info", 0, ImVec4(0.0f, 1.0f, 0.0f, 1.0f) };
case LogLevel::Warning: return LogLevelInfo{ "Warning", 1, ImVec4(1.0f, 1.0f, 0.0f, 1.0f) };
case LogLevel::Error: return LogLevelInfo{ "Error", 2, ImVec4(1.0f, 0.0f, 0.0f, 1.0f) };
case LogLevel::Shutdown: return LogLevelInfo{ "shutdown", 3, ImVec4(0.5f, 0.0f, 0.0f, 1.0f) };
case LogLevel::Initialize: return LogLevelInfo{ "initialize", 4, ImVec4(0.0f, 1.0f, 1.0f, 1.0f) };
case LogLevel::Update: return LogLevelInfo{ "Update", 5, ImVec4(1.0f, 0.0f, 1.0f, 1.0f) };
case LogLevel::Render: return LogLevelInfo{ "render", 6, ImVec4(1.0f, 1.0f, 1.0f, 1.0f) };
case LogLevel::Input: return LogLevelInfo{ "Input", 7, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
case LogLevel::Physics: return LogLevelInfo{ "physics", 8, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
case LogLevel::Audio: return LogLevelInfo{ "Audio", 9, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
case LogLevel::Network: return LogLevelInfo{ "Network", 10, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
case LogLevel::Scripting: return LogLevelInfo{ "Scripting", 11, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
case LogLevel::AI: return LogLevelInfo{ "AI", 12, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
case LogLevel::Resource: return LogLevelInfo{ "Resource", 13, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
case LogLevel::Memory: return LogLevelInfo{ "Memory", 14, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
case LogLevel::Debug: return LogLevelInfo{ "Debug", 15, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };
default: return LogLevelInfo{ "Unknown", 16, ImVec4(1.0f, 1.0f, 1.0f, 1.0f) };
}
}
Logger()
{ {
char* appdata = nullptr; char* appdata = nullptr;
size_t len; size_t len;
@ -92,8 +48,8 @@ public:
if (appdata == nullptr) if (appdata == nullptr)
{ {
m_appdataPath = "log.log"; m_appdataPath = "log.log";
} }
else else
{ {
m_appdataPath = appdata; m_appdataPath = appdata;
} }
@ -104,25 +60,10 @@ public:
ManageLogFiles(directoryPath); ManageLogFiles(directoryPath);
m_logFilePath = directoryPath + "\\" + m_logFileName; m_logFilePath = directoryPath + "\\" + m_logFileName;
// Enable only the Error warning and shutdown log levels
for (int i = 0; i < LogLevelCount; i++)
{
m_disabledLogLevels[i] = true;
if (i == static_cast<int>(LogLevel::Error) || i == static_cast<int>(LogLevel::Warning) || i == static_cast<int>(LogLevel::Shutdown))
{
m_disabledLogLevels[i] = false;
}
}
} }
// ecrit un message dans le fichier de log et le stocke dans le buffer
void Log(const std::string& message, const std::string& fileName, int lineNumber, LogLevel level = LogLevel::Info) void Log(const std::string& message, const std::string& fileName, int lineNumber, LogLevel level = LogLevel::Info)
{ {
auto now = std::chrono::system_clock::now(); auto now = std::chrono::system_clock::now();
auto in_time_t = std::chrono::system_clock::to_time_t(now); auto in_time_t = std::chrono::system_clock::to_time_t(now);
@ -132,8 +73,59 @@ public:
// Obtenez les millisecondes à partir de maintenant // Obtenez les millisecondes à partir de maintenant
auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()) % 1000; auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()) % 1000;
// Utilisez LogLevelToString pour obtenir la chaîne de caractères du niveau de log std::string levelStr;
std::string levelStr = GetLogLevelInfo(level).name; switch (level)
{
case LogLevel::Error:
levelStr = "ERROR";
break;
case LogLevel::Warning:
levelStr = "WARNING";
break;
case LogLevel::Info:
levelStr = "INFO";
break;
case LogLevel::Shutdown:
levelStr = "SHUTDOWN";
break;
case LogLevel::Initialize:
levelStr = "INITIALIZE";
break;
case LogLevel::Update:
levelStr = "UPDATE";
break;
case LogLevel::Render:
levelStr = "RENDER";
break;
case LogLevel::Input:
levelStr = "INPUT";
break;
case LogLevel::Physics:
levelStr = "PHYSICS";
break;
case LogLevel::Audio:
levelStr = "AUDIO";
break;
case LogLevel::Network:
levelStr = "NETWORK";
break;
case LogLevel::Scripting:
levelStr = "SCRIPTING";
break;
case LogLevel::AI:
levelStr = "AI";
break;
case LogLevel::Resource:
levelStr = "RESOURCE";
break;
case LogLevel::Memory:
levelStr = "MEMORY";
break;
case LogLevel::Debug:
levelStr = "DEBUG";
break;
}
std::stringstream ss; std::stringstream ss;
ss << "[" << std::put_time(&buf, "%Y-%m-%d") << "] " ss << "[" << std::put_time(&buf, "%Y-%m-%d") << "] "
@ -142,8 +134,6 @@ public:
<< "[" << fileName << ":" << lineNumber << "] " << "[" << fileName << ":" << lineNumber << "] "
<< message; << message;
Log(ss.str(), level);
std::ofstream file(m_logFilePath, std::ios::app); std::ofstream file(m_logFilePath, std::ios::app);
if (file.is_open()) if (file.is_open())
{ {
@ -152,25 +142,6 @@ public:
} }
} }
// ecrit un message dans la console
void Log(const std::string& message, LogLevel level)
{
// Si le niveau de log est désactivé, ne faites rien
if (m_disabledLogLevels[GetLogLevelInfo(level).value])
{
return;
}
if (logBuffer.size() >= logBufferSize)
{
logBuffer.pop_front();
}
logBuffer.push_back({ message, level });
}
const std::deque<LogEntry>& GetLogBuffer() const { return logBuffer; }
void ManageLogFiles(const std::string& directoryPath) void ManageLogFiles(const std::string& directoryPath)
{ {
std::vector<std::filesystem::path> logFiles; std::vector<std::filesystem::path> logFiles;
@ -205,22 +176,17 @@ public:
auto now = std::chrono::system_clock::now(); auto now = std::chrono::system_clock::now();
auto in_time_t = std::chrono::system_clock::to_time_t(now); auto in_time_t = std::chrono::system_clock::to_time_t(now);
std::tm buf; std::tm buf;
localtime_s(&buf, &in_time_t); localtime_s(&buf, &in_time_t);
std::stringstream ss; std::stringstream ss;
ss << "Khaotic_log_" << std::put_time(&buf, "%Y_%m_%d_%Hh%Mm%Ss") << ".log"; ss << "Khaotic_log_" << std::put_time(&buf, "%Y_%m_%d_%Hh%Mm%Ss") << ".log";
m_logFileName = ss.str(); m_logFileName = ss.str();
}
bool m_disabledLogLevels[LogLevelCount]; }
std::string m_logFilePath;
private: private:
std::string m_filename; std::string m_filename;
std::string m_appdataPath; std::string m_appdataPath;
std::string m_logFileName; std::string m_logFileName;
std::string m_logFilePath;
std::deque<LogEntry> logBuffer;
const size_t logBufferSize = 100;
}; };

View File

@ -1,9 +1,9 @@
#include "system_class.h" #include "systemclass.h"
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pScmdline, int iCmdshow) int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pScmdline, int iCmdshow)
{ {
system_class* System; SystemClass* System;
bool result; bool result;
wchar_t path[MAX_PATH]; wchar_t path[MAX_PATH];
@ -17,19 +17,19 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pScmdline,
std::filesystem::path WFolder = exePath.parent_path(); std::filesystem::path WFolder = exePath.parent_path();
// Create the system object. // Create the system object.
System = new system_class; System = new SystemClass;
// initialize and run the system object. // Initialize and run the system object.
result = System->initialize(); result = System->Initialize();
if (result) if (result)
{ {
Logger::Get().Log("System initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("System initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
System->send_path(path,WFolder); System->SendPath(path,WFolder);
System->run(); System->Run();
} }
// shutdown and release the system object. // Shutdown and release the system object.
System->shutdown(); System->Shutdown();
delete System; delete System;
System = 0; System = 0;

View File

@ -1,32 +1,32 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Filename: multitextureshaderclass.cpp // Filename: multitextureshaderclass.cpp
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "multi_texture_shader_class.h" #include "multitextureshaderclass.h"
multi_texture_shader_class::multi_texture_shader_class() MultiTextureShaderClass::MultiTextureShaderClass()
{ {
vertex_shader_ = 0; m_vertexShader = 0;
pixel_shader_ = 0; m_pixelShader = 0;
layout_ = 0; m_layout = 0;
matrix_buffer_ = 0; m_matrixBuffer = 0;
sample_state_ = 0; m_sampleState = 0;
} }
multi_texture_shader_class::multi_texture_shader_class(const multi_texture_shader_class& other) MultiTextureShaderClass::MultiTextureShaderClass(const MultiTextureShaderClass& other)
{ {
} }
multi_texture_shader_class::~multi_texture_shader_class() MultiTextureShaderClass::~MultiTextureShaderClass()
{ {
} }
bool multi_texture_shader_class::initialize(ID3D11Device* device, HWND hwnd) bool MultiTextureShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
{ {
Logger::Get().Log("Initializing multi_texture_shader_class", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing MultiTextureShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize);
bool result; bool result;
wchar_t vsFilename[128]; wchar_t vsFilename[128];
@ -34,7 +34,7 @@ bool multi_texture_shader_class::initialize(ID3D11Device* device, HWND hwnd)
int error; int error;
// Set the filename of the vertex shader. // Set the filename of the vertex shader.
error = wcscpy_s(vsFilename, 128, L"src/hlsl/multitexture.vs"); error = wcscpy_s(vsFilename, 128, L"multitexture.vs");
if (error != 0) if (error != 0)
{ {
Logger::Get().Log("Failed to set the filename of the vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to set the filename of the vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -42,42 +42,42 @@ bool multi_texture_shader_class::initialize(ID3D11Device* device, HWND hwnd)
} }
// Set the filename of the pixel shader. // Set the filename of the pixel shader.
error = wcscpy_s(psFilename, 128, L"src/hlsl/multitexture.ps"); error = wcscpy_s(psFilename, 128, L"multitexture.ps");
if (error != 0) if (error != 0)
{ {
Logger::Get().Log("Failed to set the filename of the pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to set the filename of the pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
return false; return false;
} }
// initialize the vertex and pixel shaders. // Initialize the vertex and pixel shaders.
result = initialize_shader(device, hwnd, vsFilename, psFilename); result = InitializeShader(device, hwnd, vsFilename, psFilename);
if (!result) if (!result)
{ {
Logger::Get().Log("Failed to initialize the vertex and pixel shaders", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to initialize the vertex and pixel shaders", __FILE__, __LINE__, Logger::LogLevel::Error);
return false; return false;
} }
Logger::Get().Log("multi_texture_shader_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("MultiTextureShaderClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
return true; return true;
} }
void multi_texture_shader_class::shutdown() void MultiTextureShaderClass::Shutdown()
{ {
// shutdown the vertex and pixel shaders as well as the related objects. // Shutdown the vertex and pixel shaders as well as the related objects.
shutdown_shader(); ShutdownShader();
return; return;
} }
bool multi_texture_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, bool MultiTextureShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2) XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2)
{ {
bool result; bool result;
// Set the shader parameters that it will use for rendering. // Set the shader parameters that it will use for rendering.
result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2); result = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2);
if (!result) if (!result)
{ {
Logger::Get().Log("Failed to set the shader parameters that it will use for rendering", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to set the shader parameters that it will use for rendering", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -85,12 +85,12 @@ bool multi_texture_shader_class::render(ID3D11DeviceContext* deviceContext, int
} }
// Now render the prepared buffers with the shader. // Now render the prepared buffers with the shader.
render_shader(deviceContext, indexCount); RenderShader(deviceContext, indexCount);
return true; return true;
} }
bool multi_texture_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) bool MultiTextureShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
{ {
Logger::Get().Log("Initializing the shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing the shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
@ -104,7 +104,7 @@ bool multi_texture_shader_class::initialize_shader(ID3D11Device* device, HWND hw
D3D11_SAMPLER_DESC samplerDesc; D3D11_SAMPLER_DESC samplerDesc;
// initialize the pointers this function will use to null. // Initialize the pointers this function will use to null.
errorMessage = 0; errorMessage = 0;
vertexShaderBuffer = 0; vertexShaderBuffer = 0;
pixelShaderBuffer = 0; pixelShaderBuffer = 0;
@ -117,7 +117,7 @@ bool multi_texture_shader_class::initialize_shader(ID3D11Device* device, HWND hw
// If the shader failed to compile it should have writen something to the error message. // If the shader failed to compile it should have writen something to the error message.
if (errorMessage) if (errorMessage)
{ {
output_shader_error_message(errorMessage, hwnd, vsFilename); OutputShaderErrorMessage(errorMessage, hwnd, vsFilename);
} }
// If there was nothing in the error message then it simply could not find the shader file itself. // If there was nothing in the error message then it simply could not find the shader file itself.
else else
@ -136,7 +136,7 @@ bool multi_texture_shader_class::initialize_shader(ID3D11Device* device, HWND hw
// If the shader failed to compile it should have writen something to the error message. // If the shader failed to compile it should have writen something to the error message.
if (errorMessage) if (errorMessage)
{ {
output_shader_error_message(errorMessage, hwnd, psFilename); OutputShaderErrorMessage(errorMessage, hwnd, psFilename);
} }
// If there was nothing in the error message then it simply could not find the file itself. // If there was nothing in the error message then it simply could not find the file itself.
else else
@ -148,7 +148,7 @@ bool multi_texture_shader_class::initialize_shader(ID3D11Device* device, HWND hw
} }
// Create the vertex shader from the buffer. // Create the vertex shader from the buffer.
result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_); result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &m_vertexShader);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create the vertex shader from the buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create the vertex shader from the buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -156,7 +156,7 @@ bool multi_texture_shader_class::initialize_shader(ID3D11Device* device, HWND hw
} }
// Create the pixel shader from the buffer. // Create the pixel shader from the buffer.
result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_); result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &m_pixelShader);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create the pixel shader from the buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create the pixel shader from the buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -193,7 +193,7 @@ bool multi_texture_shader_class::initialize_shader(ID3D11Device* device, HWND hw
// Create the vertex input layout. // Create the vertex input layout.
result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(), result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(),
vertexShaderBuffer->GetBufferSize(), &layout_); vertexShaderBuffer->GetBufferSize(), &m_layout);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create the vertex input layout", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create the vertex input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -209,14 +209,14 @@ bool multi_texture_shader_class::initialize_shader(ID3D11Device* device, HWND hw
// Setup the description of the dynamic matrix constant buffer that is in the vertex shader. // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC; matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type); matrixBufferDesc.ByteWidth = sizeof(MatrixBufferType);
matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
matrixBufferDesc.MiscFlags = 0; matrixBufferDesc.MiscFlags = 0;
matrixBufferDesc.StructureByteStride = 0; matrixBufferDesc.StructureByteStride = 0;
// Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class. // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_); result = device->CreateBuffer(&matrixBufferDesc, NULL, &m_matrixBuffer);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create the constant buffer pointer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create the constant buffer pointer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -239,7 +239,7 @@ bool multi_texture_shader_class::initialize_shader(ID3D11Device* device, HWND hw
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
// Create the texture sampler state. // Create the texture sampler state.
result = device->CreateSamplerState(&samplerDesc, &sample_state_); result = device->CreateSamplerState(&samplerDesc, &m_sampleState);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create the texture sampler state", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create the texture sampler state", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -251,43 +251,43 @@ bool multi_texture_shader_class::initialize_shader(ID3D11Device* device, HWND hw
return true; return true;
} }
void multi_texture_shader_class::shutdown_shader() void MultiTextureShaderClass::ShutdownShader()
{ {
Logger::Get().Log("Shutting down the shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Shutting down the shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
// Release the sampler state. // Release the sampler state.
if (sample_state_) if (m_sampleState)
{ {
sample_state_->Release(); m_sampleState->Release();
sample_state_ = 0; m_sampleState = 0;
} }
// Release the matrix constant buffer. // Release the matrix constant buffer.
if (matrix_buffer_) if (m_matrixBuffer)
{ {
matrix_buffer_->Release(); m_matrixBuffer->Release();
matrix_buffer_ = 0; m_matrixBuffer = 0;
} }
// Release the layout. // Release the layout.
if (layout_) if (m_layout)
{ {
layout_->Release(); m_layout->Release();
layout_ = 0; m_layout = 0;
} }
// Release the pixel shader. // Release the pixel shader.
if (pixel_shader_) if (m_pixelShader)
{ {
pixel_shader_->Release(); m_pixelShader->Release();
pixel_shader_ = 0; m_pixelShader = 0;
} }
// Release the vertex shader. // Release the vertex shader.
if (vertex_shader_) if (m_vertexShader)
{ {
vertex_shader_->Release(); m_vertexShader->Release();
vertex_shader_ = 0; m_vertexShader = 0;
} }
Logger::Get().Log("Shader shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Shader shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
@ -295,7 +295,7 @@ void multi_texture_shader_class::shutdown_shader()
return; return;
} }
void multi_texture_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename) void MultiTextureShaderClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
{ {
char* compileErrors; char* compileErrors;
unsigned long long bufferSize, i; unsigned long long bufferSize, i;
@ -330,12 +330,12 @@ void multi_texture_shader_class::output_shader_error_message(ID3D10Blob* errorMe
return; return;
} }
bool multi_texture_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, bool MultiTextureShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2) XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2)
{ {
HRESULT result; HRESULT result;
D3D11_MAPPED_SUBRESOURCE mappedResource; D3D11_MAPPED_SUBRESOURCE mappedResource;
matrix_buffer_type* dataPtr; MatrixBufferType* dataPtr;
unsigned int bufferNumber; unsigned int bufferNumber;
@ -345,7 +345,7 @@ bool multi_texture_shader_class::set_shader_parameters(ID3D11DeviceContext* devi
projectionMatrix = XMMatrixTranspose(projectionMatrix); projectionMatrix = XMMatrixTranspose(projectionMatrix);
// Lock the constant buffer so it can be written to. // Lock the constant buffer so it can be written to.
result = deviceContext->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = deviceContext->Map(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to lock the constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to lock the constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -353,7 +353,7 @@ bool multi_texture_shader_class::set_shader_parameters(ID3D11DeviceContext* devi
} }
// Get a pointer to the data in the constant buffer. // Get a pointer to the data in the constant buffer.
dataPtr = (matrix_buffer_type*)mappedResource.pData; dataPtr = (MatrixBufferType*)mappedResource.pData;
// Copy the matrices into the constant buffer. // Copy the matrices into the constant buffer.
dataPtr->world = worldMatrix; dataPtr->world = worldMatrix;
@ -361,13 +361,13 @@ bool multi_texture_shader_class::set_shader_parameters(ID3D11DeviceContext* devi
dataPtr->projection = projectionMatrix; dataPtr->projection = projectionMatrix;
// Unlock the constant buffer. // Unlock the constant buffer.
deviceContext->Unmap(matrix_buffer_, 0); deviceContext->Unmap(m_matrixBuffer, 0);
// Set the position of the constant buffer in the vertex shader. // Set the position of the constant buffer in the vertex shader.
bufferNumber = 0; bufferNumber = 0;
// Finally set the constant buffer in the vertex shader with the updated values. // Finally set the constant buffer in the vertex shader with the updated values.
deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_); deviceContext->VSSetConstantBuffers(bufferNumber, 1, &m_matrixBuffer);
// Set shader texture resources in the pixel shader. // Set shader texture resources in the pixel shader.
deviceContext->PSSetShaderResources(0, 1, &texture1); deviceContext->PSSetShaderResources(0, 1, &texture1);
@ -376,19 +376,19 @@ bool multi_texture_shader_class::set_shader_parameters(ID3D11DeviceContext* devi
return true; return true;
} }
void multi_texture_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount) void MultiTextureShaderClass::RenderShader(ID3D11DeviceContext* deviceContext, int indexCount)
{ {
// Set the vertex input layout. // Set the vertex input layout.
deviceContext->IASetInputLayout(layout_); deviceContext->IASetInputLayout(m_layout);
// Set the vertex and pixel shaders that will be used to render this triangle. // Set the vertex and pixel shaders that will be used to render this triangle.
deviceContext->VSSetShader(vertex_shader_, NULL, 0); deviceContext->VSSetShader(m_vertexShader, NULL, 0);
deviceContext->PSSetShader(pixel_shader_, NULL, 0); deviceContext->PSSetShader(m_pixelShader, NULL, 0);
// Set the sampler state in the pixel shader. // Set the sampler state in the pixel shader.
deviceContext->PSSetSamplers(0, 1, &sample_state_); deviceContext->PSSetSamplers(0, 1, &m_sampleState);
// render the triangle. // Render the triangle.
deviceContext->DrawIndexed(indexCount, 0, 0); deviceContext->DrawIndexed(indexCount, 0, 0);
return; return;

View File

@ -0,0 +1,59 @@
////////////////////////////////////////////////////////////////////////////////
// Filename: multitextureshaderclass.h
////////////////////////////////////////////////////////////////////////////////
#ifndef _MULTITEXTURESHADERCLASS_H_
#define _MULTITEXTURESHADERCLASS_H_
//////////////
// INCLUDES //
//////////////
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: MultiTextureShaderClass
////////////////////////////////////////////////////////////////////////////////
class MultiTextureShaderClass
{
private:
struct MatrixBufferType
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
public:
MultiTextureShaderClass();
MultiTextureShaderClass(const MultiTextureShaderClass&);
~MultiTextureShaderClass();
bool Initialize(ID3D11Device*, HWND);
void Shutdown();
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
private:
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void ShutdownShader();
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
void RenderShader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* m_vertexShader;
ID3D11PixelShader* m_pixelShader;
ID3D11InputLayout* m_layout;
ID3D11Buffer* m_matrixBuffer;
ID3D11SamplerState* m_sampleState;
};
#endif

View File

@ -1,6 +1,6 @@
#include "position_class.h" #include "positionclass.h"
position_class::position_class() PositionClass::PositionClass()
{ {
m_frameTime = 0.0f; m_frameTime = 0.0f;
m_rotationY = 0.0f; m_rotationY = 0.0f;
@ -12,34 +12,35 @@ position_class::position_class()
m_rightTurnSpeed = 0.0f; m_rightTurnSpeed = 0.0f;
m_horizontalTurnSpeed = 0.0f; m_horizontalTurnSpeed = 0.0f;
m_verticalTurnSpeed = 0.0f; m_verticalTurnSpeed = 0.0f;
m_verticalTurnSpeed = 0.0f;
m_cameraSpeed = 4.0f; m_cameraSpeed = 4.0f;
m_speed = m_cameraSpeed; m_speed = m_cameraSpeed;
} }
position_class::position_class(const position_class& other) PositionClass::PositionClass(const PositionClass& other)
{ {
} }
position_class::~position_class() PositionClass::~PositionClass()
{ {
} }
void position_class::SetFrameTime(float time) void PositionClass::SetFrameTime(float time)
{ {
m_frameTime = time; m_frameTime = time;
return; return;
} }
void position_class::GetRotation(float& y, float& x) const void PositionClass::GetRotation(float& y, float& x) const
{ {
y = m_rotationY; y = m_rotationY;
x = m_rotationX; x = m_rotationX;
return; return;
} }
void position_class::GetPosition(float& x, float& y, float& z) const void PositionClass::GetPosition(float& x, float& y, float& z) const
{ {
x = m_positionX; x = m_positionX;
y = m_positionY; y = m_positionY;
@ -47,7 +48,7 @@ void position_class::GetPosition(float& x, float& y, float& z) const
return; return;
} }
void position_class::TurnLeft(bool keydown) void PositionClass::TurnLeft(bool keydown)
{ {
// If the key is pressed increase the speed at which the camera turns left. If not slow down the turn speed. // If the key is pressed increase the speed at which the camera turns left. If not slow down the turn speed.
if (keydown) if (keydown)
@ -80,7 +81,7 @@ void position_class::TurnLeft(bool keydown)
} }
void position_class::TurnRight(bool keydown) void PositionClass::TurnRight(bool keydown)
{ {
// If the key is pressed increase the speed at which the camera turns right. If not slow down the turn speed. // If the key is pressed increase the speed at which the camera turns right. If not slow down the turn speed.
if (keydown) if (keydown)
@ -112,7 +113,7 @@ void position_class::TurnRight(bool keydown)
return; return;
} }
void position_class::TurnMouse(float deltaX, float deltaY, float sensitivity, bool rightMouseDown) void PositionClass::TurnMouse(float deltaX, float deltaY, float sensitivity, bool rightMouseDown)
{ {
// The turning speed is proportional to the horizontal mouse movement // The turning speed is proportional to the horizontal mouse movement
m_horizontalTurnSpeed = deltaX * sensitivity; m_horizontalTurnSpeed = deltaX * sensitivity;
@ -147,7 +148,7 @@ void position_class::TurnMouse(float deltaX, float deltaY, float sensitivity, bo
return; return;
} }
void position_class::MoveCamera(bool forward, bool backward, bool left, bool right, bool up, bool down, bool scrollUp, bool scrollDown, bool rightClick) void PositionClass::MoveCamera(bool forward, bool backward, bool left, bool right, bool up, bool down, bool scrollUp, bool scrollDown, bool rightClick)
{ {
float radiansY, radiansX, speed; float radiansY, radiansX, speed;

View File

@ -9,14 +9,14 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Class name: position_class // Class name: PositionClass
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class position_class class PositionClass
{ {
public: public:
position_class(); PositionClass();
position_class(const position_class&); PositionClass(const PositionClass&);
~position_class(); ~PositionClass();
void SetFrameTime(float); void SetFrameTime(float);
void GetRotation(float&, float&) const; void GetRotation(float&, float&) const;

View File

@ -1,7 +1,7 @@
#include "sprite_class.h" #include "spriteclass.h"
sprite_class::sprite_class() SpriteClass::SpriteClass()
{ {
m_vertexBuffer = 0; m_vertexBuffer = 0;
m_indexBuffer = 0; m_indexBuffer = 0;
@ -9,16 +9,16 @@ sprite_class::sprite_class()
} }
sprite_class::sprite_class(const sprite_class& other) SpriteClass::SpriteClass(const SpriteClass& other)
{ {
} }
sprite_class::~sprite_class() SpriteClass::~SpriteClass()
{ {
} }
bool sprite_class::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceContext, int screenWidth, int screenHeight, char* spriteFilename, int renderX, int renderY) bool SpriteClass::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceContext, int screenWidth, int screenHeight, char* spriteFilename, int renderX, int renderY)
{ {
bool result; bool result;
@ -52,7 +52,7 @@ bool sprite_class::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceC
} }
void sprite_class::Shutdown() void SpriteClass::Shutdown()
{ {
// Release the textures used for this sprite. // Release the textures used for this sprite.
ReleaseTextures(); ReleaseTextures();
@ -64,7 +64,7 @@ void sprite_class::Shutdown()
} }
bool sprite_class::Render(ID3D11DeviceContext* deviceContext) bool SpriteClass::Render(ID3D11DeviceContext* deviceContext)
{ {
bool result; bool result;
@ -82,7 +82,7 @@ bool sprite_class::Render(ID3D11DeviceContext* deviceContext)
return true; return true;
} }
void sprite_class::Update(float frameTime) void SpriteClass::Update(float frameTime)
{ {
// Increment the frame time each frame. // Increment the frame time each frame.
m_frameTime += frameTime; m_frameTime += frameTime;
@ -106,18 +106,18 @@ void sprite_class::Update(float frameTime)
} }
int sprite_class::GetIndexCount() int SpriteClass::GetIndexCount()
{ {
return m_indexCount; return m_indexCount;
} }
ID3D11ShaderResourceView* sprite_class::GetTexture() ID3D11ShaderResourceView* SpriteClass::GetTexture()
{ {
return m_Textures[m_currentTexture].GetTexture(); return m_Textures[m_currentTexture].GetTexture();
} }
bool sprite_class::InitializeBuffers(ID3D11Device* device) bool SpriteClass::InitializeBuffers(ID3D11Device* device)
{ {
VertexType* vertices; VertexType* vertices;
unsigned long* indices; unsigned long* indices;
@ -203,7 +203,7 @@ bool sprite_class::InitializeBuffers(ID3D11Device* device)
} }
void sprite_class::ShutdownBuffers() void SpriteClass::ShutdownBuffers()
{ {
// Release the index buffer. // Release the index buffer.
if (m_indexBuffer) if (m_indexBuffer)
@ -223,7 +223,7 @@ void sprite_class::ShutdownBuffers()
} }
bool sprite_class::UpdateBuffers(ID3D11DeviceContext* deviceContent) bool SpriteClass::UpdateBuffers(ID3D11DeviceContext* deviceContent)
{ {
float left, right, top, bottom; float left, right, top, bottom;
VertexType* vertices; VertexType* vertices;
@ -305,7 +305,7 @@ bool sprite_class::UpdateBuffers(ID3D11DeviceContext* deviceContent)
} }
void sprite_class::RenderBuffers(ID3D11DeviceContext* deviceContext) void SpriteClass::RenderBuffers(ID3D11DeviceContext* deviceContext)
{ {
unsigned int stride; unsigned int stride;
unsigned int offset; unsigned int offset;
@ -327,7 +327,7 @@ void sprite_class::RenderBuffers(ID3D11DeviceContext* deviceContext)
return; return;
} }
bool sprite_class::LoadTextures(ID3D11Device* device, ID3D11DeviceContext* deviceContext, char* filename) bool SpriteClass::LoadTextures(ID3D11Device* device, ID3D11DeviceContext* deviceContext, char* filename)
{ {
std::string textureFilename(256, '0'); std::string textureFilename(256, '0');
std::ifstream fin; std::ifstream fin;
@ -347,7 +347,7 @@ bool sprite_class::LoadTextures(ID3D11Device* device, ID3D11DeviceContext* devic
fin >> m_textureCount; fin >> m_textureCount;
// Create and initialize the texture array with the texture count from the file. // Create and initialize the texture array with the texture count from the file.
m_Textures = new texture_class[m_textureCount]; m_Textures = new TextureClass[m_textureCount];
// Read to start of next line. // Read to start of next line.
fin.get(input); fin.get(input);
@ -392,7 +392,7 @@ bool sprite_class::LoadTextures(ID3D11Device* device, ID3D11DeviceContext* devic
return true; return true;
} }
void sprite_class::ReleaseTextures() void SpriteClass::ReleaseTextures()
{ {
int i; int i;
@ -413,7 +413,7 @@ void sprite_class::ReleaseTextures()
} }
void sprite_class::SetRenderLocation(int x, int y) void SpriteClass::SetRenderLocation(int x, int y)
{ {
m_renderX = x; m_renderX = x;
m_renderY = y; m_renderY = y;

View File

@ -13,13 +13,13 @@ using namespace DirectX;
/////////////////////// ///////////////////////
// MY CLASS INCLUDES // // MY CLASS INCLUDES //
/////////////////////// ///////////////////////
#include "texture_class.h" #include "textureclass.h"
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Class name: sprite_class // Class name: SpriteClass
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class sprite_class class SpriteClass
{ {
private: private:
struct VertexType struct VertexType
@ -29,9 +29,9 @@ private:
}; };
public: public:
sprite_class(); SpriteClass();
sprite_class(const sprite_class&); SpriteClass(const SpriteClass&);
~sprite_class(); ~SpriteClass();
bool Initialize(ID3D11Device*, ID3D11DeviceContext*, int, int, char*, int, int); bool Initialize(ID3D11Device*, ID3D11DeviceContext*, int, int, char*, int, int);
void Shutdown(); void Shutdown();
@ -55,7 +55,7 @@ private:
private: private:
ID3D11Buffer* m_vertexBuffer, * m_indexBuffer; ID3D11Buffer* m_vertexBuffer, * m_indexBuffer;
int m_vertexCount, m_indexCount, m_screenWidth, m_screenHeight, m_bitmapWidth, m_bitmapHeight, m_renderX, m_renderY, m_prevPosX, m_prevPosY; int m_vertexCount, m_indexCount, m_screenWidth, m_screenHeight, m_bitmapWidth, m_bitmapHeight, m_renderX, m_renderY, m_prevPosX, m_prevPosY;
texture_class* m_Textures; TextureClass* m_Textures;
float m_frameTime, m_cycleTime; float m_frameTime, m_cycleTime;
int m_currentTexture, m_textureCount; int m_currentTexture, m_textureCount;
}; };

View File

@ -1,49 +1,28 @@
#include "system_class.h" #include "systemclass.h"
#include <iostream> #include <iostream>
#include <shellapi.h> // Include for DragAcceptFiles and DragQueryFile #include <shellapi.h> // Include for DragAcceptFiles and DragQueryFile
#include <windows.h> #include <windows.h>
extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
system_class::system_class() SystemClass::SystemClass()
{ {
input_ = 0; m_Input = 0;
application_ = 0; m_Application = 0;
imgui_manager_ = 0; m_imguiManager = 0;
application_name_ = 0; m_applicationName = 0;
hinstance_ = 0; m_hinstance = 0;
hwnd_ = 0; m_hwnd = 0;
initial_window_width_ = 0; m_initialWindowWidth = 0;
initial_window_height_ = 0; m_initialWindowHeight = 0;
is_direct_3d_initialized_ = false; m_isDirect3DInitialized = false;
} }
system_class::~system_class() SystemClass::~SystemClass()
{ {
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 SystemClass::Initialize()
{ {
int screenHeight, screenWidth = 0; int screenHeight, screenWidth = 0;
bool result; bool result;
@ -52,13 +31,13 @@ bool system_class::initialize()
try try
{ {
// initialize the windows api. // Initialize the windows api.
initialize_windows(screenWidth, screenHeight); InitializeWindows(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; m_Input = new InputClass;
result = input_->Initialize(hinstance_, hwnd_, screenWidth, screenHeight); result = m_Input->Initialize(m_hinstance, m_hwnd, screenWidth, screenHeight);
if (!result) if (!result)
{ {
Logger::Get().Log("Failed to initialize input class", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to initialize input class", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -66,34 +45,29 @@ 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; m_Application = new ApplicationClass;
result = application_->initialize(screenWidth, screenHeight, hwnd_, false); result = m_Application->Initialize(screenWidth, screenHeight, m_hwnd);
if (!result) if (!result)
{ {
return false; return false;
} }
is_direct_3d_initialized_ = true; m_isDirect3DInitialized = true;
// If we received a WM_SIZE message before Direct3D was initialized, resize the swap chain now // If we received a WM_SIZE message before Direct3D was initialized, resize the swap chain now
if (initial_window_width_ > 0 && initial_window_height_ > 0) if (m_initialWindowWidth > 0 && m_initialWindowHeight > 0)
{ {
application_->get_direct_3d()->resize_swap_chain(initial_window_width_, initial_window_height_); m_Application->GetDirect3D()->ResizeSwapChain(m_initialWindowWidth, m_initialWindowHeight);
} }
// initialize imgui // Initialize imgui
if(DEBUG_MODE) m_imguiManager = new imguiManager;
result = m_imguiManager->Initialize(m_hwnd, m_Application->GetDirect3D()->GetDevice(), m_Application->GetDirect3D()->GetDeviceContext());
if (!result)
{ {
imgui_manager_ = new imguiManager; return false;
imgui_manager_->SetApp(application_);
result = imgui_manager_->Initialize(hwnd_, application_->get_direct_3d()->get_device(), application_->get_direct_3d()->get_device_context());
if (!result)
{
return false;
}
} }
} }
catch (const std::exception& e) catch (const std::exception& e)
{ {
@ -106,70 +80,73 @@ bool system_class::initialize()
return true; return true;
} }
void system_class::shutdown() void SystemClass::Shutdown()
{ {
Logger::Get().Log("Shutting down system class", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Shutting down system class", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
std::lock_guard<std::mutex> guard(render_mutex_); std::lock_guard<std::mutex> guard(renderMutex);
// shutdown imgui // Shutdown imgui
if (imgui_manager_) if (m_imguiManager)
{ {
Logger::Get().Log("Shutting down imgui manager", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Shutting down imgui manager", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
imgui_manager_->Shutdown(); m_imguiManager->Shutdown();
delete imgui_manager_; delete m_imguiManager;
imgui_manager_ = 0; m_imguiManager = 0;
Logger::Get().Log("Imgui manager shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Imgui manager shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
} }
// Release the application class object. // Release the application class object.
if (application_) if (m_Application)
{ {
Logger::Get().Log("Shutting down application", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Shutting down application", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
application_->shutdown(); m_Application->Shutdown();
delete application_; delete m_Application;
application_ = 0; m_Application = 0;
Logger::Get().Log("Application shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Application shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
} }
// Release the input object. // Release the input object.
if (input_) if (m_Input)
{ {
Logger::Get().Log("Shutting down input", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Shutting down input", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
delete input_; delete m_Input;
input_ = 0; m_Input = 0;
Logger::Get().Log("Input shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Input shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
} }
// shutdown the window. // Shutdown the window.
shutdown_windows(); ShutdownWindows();
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; return;
} }
void system_class::run() void SystemClass::Run()
{ {
MSG msg; MSG msg;
bool done, result; bool done, result;
Logger::Get().Log("Running the system", __FILE__, __LINE__); Logger::Get().Log("Running the system", __FILE__, __LINE__);
// initialize the message structure. // Initialize the message structure.
ZeroMemory(&msg, sizeof(MSG)); ZeroMemory(&msg, sizeof(MSG));
// Loop until there is a quit message from the window or the user. // Loop until there is a quit message from the window or the user.
done = false; done = false;
auto fixedUpdateInterval = std::chrono::milliseconds(16);
auto m_lastFixedUpdateTime = std::chrono::steady_clock::now();
while (!done) while (!done)
{ {
// Handle the windows messages. // Handle the windows messages.
@ -187,7 +164,7 @@ void system_class::run()
} }
// If windows signals to end the application then exit out. // If windows signals to end the application then exit out.
if (application_ != nullptr && application_->get_should_quit()) if (m_Application != nullptr && m_Application->GetShouldQuit())
{ {
Logger::Get().Log("Received quit signal from application", __FILE__, __LINE__); Logger::Get().Log("Received quit signal from application", __FILE__, __LINE__);
done = true; done = true;
@ -195,12 +172,19 @@ void system_class::run()
else else
{ {
// Otherwise do the frame processing. // Otherwise do the frame processing.
result = frame(); result = Frame();
if (!result) if (!result)
{ {
Logger::Get().Log("Failed to process frame", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to process frame", __FILE__, __LINE__, Logger::LogLevel::Error);
done = true; done = true;
} }
auto now = std::chrono::steady_clock::now();
if (now - m_lastFixedUpdateTime >= fixedUpdateInterval)
{
FixedUpdate();
m_lastFixedUpdateTime = now;
}
} }
} }
@ -208,15 +192,16 @@ void system_class::run()
return; return;
} }
bool system_class::frame() bool SystemClass::Frame()
{ {
// Clear the buffers to begin the scene. // Clear the buffers to begin the scene.
application_->get_direct_3d()->begin_scene(0.0f, 0.0f, 0.0f, 1.0f); m_Application->GetDirect3D()->BeginScene(0.0f, 0.0f, 0.0f, 1.0f);
std::lock_guard<std::mutex> guard(render_mutex_); std::lock_guard<std::mutex> guard(renderMutex);
bool result; bool result;
result = input_->Frame(); // Do the input frame processing.
result = m_Input->Frame();
if (!result) if (!result)
{ {
Logger::Get().Log("Failed to process input frame", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to process input frame", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -224,42 +209,27 @@ 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 = m_Application->Frame(m_Input);
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);
return false; return false;
} }
if(!input_->IsKeyDown(222)) // Render ImGui
result = m_imguiManager->ImGuiWidgetRenderer(m_Application);
if (!result)
{ {
//log the key press Logger::Get().Log("Failed to render ImGui widgets", __FILE__, __LINE__, Logger::LogLevel::Error);
is_debug_key_pressed_ = false; return false;
} }
else if (input_->IsKeyDown(222) && !is_debug_key_pressed_)
{ m_Application->GetDirect3D()->EndScene();
// Log the key release state
is_debug_key_pressed_ = true;
DEBUG_MODE = !DEBUG_MODE;
}
if (DEBUG_MODE)
{
// render ImGui
result = imgui_manager_->ImGuiWidgetRenderer();
if (!result)
{
Logger::Get().Log("Failed to render ImGui widgets", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
}
application_->get_direct_3d()->end_scene();
return true; return true;
} }
LRESULT CALLBACK system_class::message_handler(HWND hwnd, UINT umsg, WPARAM wparam, LPARAM lparam) LRESULT CALLBACK SystemClass::MessageHandler(HWND hwnd, UINT umsg, WPARAM wparam, LPARAM lparam)
{ {
if (ImGui_ImplWin32_WndProcHandler(hwnd, umsg, wparam, lparam)) if (ImGui_ImplWin32_WndProcHandler(hwnd, umsg, wparam, lparam))
@ -273,7 +243,7 @@ LRESULT CALLBACK system_class::message_handler(HWND hwnd, UINT umsg, WPARAM wpar
case WM_KEYDOWN: case WM_KEYDOWN:
{ {
// If a key is pressed send it to the input object so it can record that state. // If a key is pressed send it to the input object so it can record that state.
input_->KeyDown((unsigned int)wparam); m_Input->KeyDown((unsigned int)wparam);
return 0; return 0;
} }
@ -281,7 +251,7 @@ LRESULT CALLBACK system_class::message_handler(HWND hwnd, UINT umsg, WPARAM wpar
case WM_KEYUP: case WM_KEYUP:
{ {
// If a key is released then send it to the input object so it can unset the state for that key. // If a key is released then send it to the input object so it can unset the state for that key.
input_->KeyUp((unsigned int)wparam); m_Input->KeyUp((unsigned int)wparam);
return 0; return 0;
} }
case WM_SIZE: case WM_SIZE:
@ -290,27 +260,27 @@ LRESULT CALLBACK system_class::message_handler(HWND hwnd, UINT umsg, WPARAM wpar
int newHeight = HIWORD(lparam); int newHeight = HIWORD(lparam);
// If Direct3D is initialized, update the swap chain. Otherwise, store the window dimensions // If Direct3D is initialized, update the swap chain. Otherwise, store the window dimensions
if (is_direct_3d_initialized_ && application_ && application_->get_direct_3d()) if (m_isDirect3DInitialized && m_Application && m_Application->GetDirect3D())
{ {
application_->set_screen_width(newWidth); m_Application->SetScreenWidth(newWidth);
application_->set_screen_height(newHeight); m_Application->SetScreenHeight(newHeight);
application_->get_direct_3d()->resize_swap_chain(newWidth, newHeight); m_Application->GetDirect3D()->ResizeSwapChain(newWidth, newHeight);
} }
else else
{ {
initial_window_width_ = newWidth; m_initialWindowWidth = newWidth;
initial_window_height_ = newHeight; m_initialWindowHeight = newHeight;
} }
return 0; return 0;
} }
case WM_ENTERSIZEMOVE: case WM_ENTERSIZEMOVE:
{ {
is_resizing_ = true; m_isResizing = true;
break; break;
} }
case WM_EXITSIZEMOVE: case WM_EXITSIZEMOVE:
{ {
is_resizing_ = false; m_isResizing = false;
break; break;
} }
case WM_DROPFILES: case WM_DROPFILES:
@ -331,7 +301,7 @@ LRESULT CALLBACK system_class::message_handler(HWND hwnd, UINT umsg, WPARAM wpar
if (extension == L"txt" || extension == L"kobj") { if (extension == L"txt" || extension == L"kobj") {
// Handle dropped files with valid extensions // Handle dropped files with valid extensions
std::wcout << L"File dropped: " << filePath << std::endl; std::wcout << L"File dropped: " << filePath << std::endl;
application_->add_kobject(fileName); m_Application->AddKobject(filePath);
} }
else { else {
// Handle files with invalid extensions (optional) // Handle files with invalid extensions (optional)
@ -346,7 +316,7 @@ LRESULT CALLBACK system_class::message_handler(HWND hwnd, UINT umsg, WPARAM wpar
case WM_CLOSE: case WM_CLOSE:
{ {
Logger::Get().Log("WM_CLOSE message received", __FILE__, __LINE__); Logger::Get().Log("WM_CLOSE message received", __FILE__, __LINE__);
application_->set_should_quit(true); m_Application->SetShouldQuit(true);
return 0; return 0;
} }
// Any other messages send to the default message handler as our application won't make use of them. // Any other messages send to the default message handler as our application won't make use of them.
@ -360,7 +330,7 @@ LRESULT CALLBACK system_class::message_handler(HWND hwnd, UINT umsg, WPARAM wpar
return 0; return 0;
} }
void system_class::initialize_windows(int& screenWidth, int& screenHeight) void SystemClass::InitializeWindows(int& screenWidth, int& screenHeight)
{ {
WNDCLASSEX wc; WNDCLASSEX wc;
DEVMODE dmScreenSettings; DEVMODE dmScreenSettings;
@ -368,26 +338,26 @@ void system_class::initialize_windows(int& screenWidth, int& screenHeight)
Logger::Get().Log("Initializing windows", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing windows", __FILE__, __LINE__, Logger::LogLevel::Initialize);
// Get an external pointer to this object. // Get an external pointer to this object.
application_handle = this; ApplicationHandle = this;
// Get the instance of this application. // Get the instance of this application.
hinstance_ = GetModuleHandle(NULL); m_hinstance = GetModuleHandle(NULL);
// Give the application a name. // Give the application a name.
application_name_ = L"Khaotic Engine"; m_applicationName = L"Khaotic Engine";
// Setup the windows class with default settings. // Setup the windows class with default settings.
wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC;
wc.lpfnWndProc = wnd_proc; wc.lpfnWndProc = WndProc;
wc.cbClsExtra = 0; wc.cbClsExtra = 0;
wc.cbWndExtra = 0; wc.cbWndExtra = 0;
wc.hInstance = hinstance_; wc.hInstance = m_hinstance;
wc.hIcon = LoadIcon(hinstance_,MAKEINTRESOURCE(IDI_ICON1)); wc.hIcon = LoadIcon(m_hinstance,MAKEINTRESOURCE(IDI_ICON1));
wc.hIconSm = LoadIcon(hinstance_, MAKEINTRESOURCE(IDI_ICON1)); wc.hIconSm = LoadIcon(m_hinstance, MAKEINTRESOURCE(IDI_ICON1));
wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH);
wc.lpszMenuName = NULL; wc.lpszMenuName = NULL;
wc.lpszClassName = application_name_; wc.lpszClassName = m_applicationName;
wc.cbSize = sizeof(WNDCLASSEX); wc.cbSize = sizeof(WNDCLASSEX);
// Register the window class. // Register the window class.
@ -398,7 +368,7 @@ void system_class::initialize_windows(int& screenWidth, int& screenHeight)
screenHeight = GetSystemMetrics(SM_CYSCREEN); screenHeight = GetSystemMetrics(SM_CYSCREEN);
// Setup the screen settings depending on whether it is running in full screen or in windowed mode. // Setup the screen settings depending on whether it is running in full screen or in windowed mode.
if (full_screen) if (FULL_SCREEN)
{ {
// If full screen set the screen to maximum size of the users desktop and 32bit. // If full screen set the screen to maximum size of the users desktop and 32bit.
memset(&dmScreenSettings, 0, sizeof(dmScreenSettings)); memset(&dmScreenSettings, 0, sizeof(dmScreenSettings));
@ -426,51 +396,51 @@ void system_class::initialize_windows(int& screenWidth, int& screenHeight)
} }
// Create the window with the screen settings and get the handle to it. // Create the window with the screen settings and get the handle to it.
hwnd_ = CreateWindowEx(WS_EX_APPWINDOW, application_name_, application_name_, m_hwnd = CreateWindowEx(WS_EX_APPWINDOW, m_applicationName, m_applicationName,
WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX, WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,
posX, posY, screenWidth, screenHeight, NULL, NULL, hinstance_, NULL); posX, posY, screenWidth, screenHeight, NULL, NULL, m_hinstance, NULL);
// Bring the window up on the screen and set it as main focus. // Bring the window up on the screen and set it as main focus.
ShowWindow(hwnd_, SW_SHOW); ShowWindow(m_hwnd, SW_SHOW);
SetForegroundWindow(hwnd_); SetForegroundWindow(m_hwnd);
SetFocus(hwnd_); SetFocus(m_hwnd);
// Hide the mouse cursor. // Hide the mouse cursor.
ShowCursor(true); ShowCursor(true);
//drag and drop //drag and drop
DragAcceptFiles(hwnd_, TRUE); DragAcceptFiles(m_hwnd, TRUE);
return; return;
} }
void system_class::shutdown_windows() void SystemClass::ShutdownWindows()
{ {
Logger::Get().Log("Shutting down the windows", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Shutting down the windows", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
// Show the mouse cursor. // Show the mouse cursor.
ShowCursor(true); ShowCursor(true);
// Fix the display settings if leaving full screen mode. // Fix the display settings if leaving full screen mode.
if (full_screen) if (FULL_SCREEN)
{ {
ChangeDisplaySettings(NULL, 0); ChangeDisplaySettings(NULL, 0);
} }
// Remove the window. // Remove the window.
DestroyWindow(hwnd_); DestroyWindow(m_hwnd);
hwnd_ = NULL; m_hwnd = NULL;
// Remove the application instance. // Remove the application instance.
UnregisterClass(application_name_, hinstance_); UnregisterClass(m_applicationName, m_hinstance);
hinstance_ = NULL; m_hinstance = NULL;
// Release the pointer to this class. // Release the pointer to this class.
application_handle = NULL; ApplicationHandle = NULL;
return; return;
} }
LRESULT CALLBACK wnd_proc(HWND hwnd, UINT umessage, WPARAM wparam, LPARAM lparam) LRESULT CALLBACK WndProc(HWND hwnd, UINT umessage, WPARAM wparam, LPARAM lparam)
{ {
switch (umessage) switch (umessage)
{ {
@ -490,20 +460,25 @@ LRESULT CALLBACK wnd_proc(HWND hwnd, UINT umessage, WPARAM wparam, LPARAM lparam
case WM_DROPFILES: case WM_DROPFILES:
{ {
application_handle->message_handler(hwnd, umessage, wparam, lparam); ApplicationHandle->MessageHandler(hwnd, umessage, wparam, lparam);
return(0); return(0);
} }
// All other messages pass to the message handler in the system class. // All other messages pass to the message handler in the system class.
default: default:
{ {
return application_handle->message_handler(hwnd, umessage, wparam, lparam); return ApplicationHandle->MessageHandler(hwnd, umessage, wparam, lparam);
} }
} }
} }
void system_class::send_path(wchar_t* path, std::filesystem::path w_folder) void SystemClass::SendPath(wchar_t* path, std::filesystem::path WFolder)
{ {
application_->set_path(path); m_Application->SetPath(path);
application_->set_w_folder(w_folder); m_Application->SetWFolder(WFolder);
}
void SystemClass::FixedUpdate()
{
m_Application->GetPhysics()->Update();
} }

View File

@ -1,8 +0,0 @@
- 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

@ -1,21 +1,21 @@
#include "timer_class.h" #include "timerclass.h"
timer_class::timer_class() TimerClass::TimerClass()
{ {
} }
timer_class::timer_class(const timer_class& other) TimerClass::TimerClass(const TimerClass& other)
{ {
} }
timer_class::~timer_class() TimerClass::~TimerClass()
{ {
} }
bool timer_class::Initialize() bool TimerClass::Initialize()
{ {
Logger::Get().Log("Initilazing timer class", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initilazing timer class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
@ -41,7 +41,7 @@ bool timer_class::Initialize()
return true; return true;
} }
void timer_class::Frame() void TimerClass::Frame()
{ {
INT64 currentTime; INT64 currentTime;
INT64 elapsedTicks; INT64 elapsedTicks;
@ -62,7 +62,7 @@ void timer_class::Frame()
return; return;
} }
float timer_class::GetTime() float TimerClass::GetTime()
{ {
return m_frameTime; return m_frameTime;
} }

View File

@ -10,14 +10,14 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Class name: timer_class // Class name: TimerClass
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class timer_class class TimerClass
{ {
public: public:
timer_class(); TimerClass();
timer_class(const timer_class&); TimerClass(const TimerClass&);
~timer_class(); ~TimerClass();
bool Initialize(); bool Initialize();
void Frame(); void Frame();

View File

@ -1,29 +1,29 @@
#include "alpha_map_shader_class.h" #include "alphamapshaderclass.h"
alpha_map_shader_class::alpha_map_shader_class() AlphaMapShaderClass::AlphaMapShaderClass()
{ {
vertex_shader_ = 0; m_vertexShader = 0;
pixel_shader_ = 0; m_pixelShader = 0;
layout_ = 0; m_layout = 0;
matrix_buffer_ = 0; m_matrixBuffer = 0;
sample_state_ = 0; m_sampleState = 0;
} }
alpha_map_shader_class::alpha_map_shader_class(const alpha_map_shader_class& other) AlphaMapShaderClass::AlphaMapShaderClass(const AlphaMapShaderClass& other)
{ {
} }
alpha_map_shader_class::~alpha_map_shader_class() AlphaMapShaderClass::~AlphaMapShaderClass()
{ {
} }
bool alpha_map_shader_class::initialize(ID3D11Device* device, HWND hwnd) bool AlphaMapShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
{ {
Logger::Get().Log("Initializing alpha_map_shader_class", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing AlphaMapShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize);
bool result; bool result;
wchar_t vsFilename[128]; wchar_t vsFilename[128];
@ -31,7 +31,7 @@ bool alpha_map_shader_class::initialize(ID3D11Device* device, HWND hwnd)
int error; int error;
// Set the filename of the vertex shader. // Set the filename of the vertex shader.
error = wcscpy_s(vsFilename, 128, L"src/hlsl/alphamap.vs"); error = wcscpy_s(vsFilename, 128, L"alphamap.vs");
if (error != 0) if (error != 0)
{ {
Logger::Get().Log("Error copying string ", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error copying string ", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -39,15 +39,15 @@ bool alpha_map_shader_class::initialize(ID3D11Device* device, HWND hwnd)
} }
// Set the filename of the pixel shader. // Set the filename of the pixel shader.
error = wcscpy_s(psFilename, 128, L"src/hlsl/alphamap.ps"); error = wcscpy_s(psFilename, 128, L"alphamap.ps");
if (error != 0) if (error != 0)
{ {
Logger::Get().Log("Error copying string", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error copying string", __FILE__, __LINE__, Logger::LogLevel::Error);
return false; return false;
} }
// initialize the vertex and pixel shaders. // Initialize the vertex and pixel shaders.
result = initialize_shader(device, hwnd, vsFilename, psFilename); result = InitializeShader(device, hwnd, vsFilename, psFilename);
if (!result) if (!result)
{ {
Logger::Get().Log("Error initializing shader", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error initializing shader", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -58,23 +58,23 @@ bool alpha_map_shader_class::initialize(ID3D11Device* device, HWND hwnd)
} }
void alpha_map_shader_class::shutdown() void AlphaMapShaderClass::Shutdown()
{ {
// shutdown the vertex and pixel shaders as well as the related objects. // Shutdown the vertex and pixel shaders as well as the related objects.
shutdown_shader(); ShutdownShader();
return; return;
} }
bool alpha_map_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, bool AlphaMapShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2, ID3D11ShaderResourceView* texture3) ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2, ID3D11ShaderResourceView* texture3)
{ {
bool result; bool result;
// Set the shader parameters that it will use for rendering. // Set the shader parameters that it will use for rendering.
result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2, texture3); result = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2, texture3);
if (!result) if (!result)
{ {
Logger::Get().Log("Error setting shader parameters", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error setting shader parameters", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -82,13 +82,13 @@ bool alpha_map_shader_class::render(ID3D11DeviceContext* deviceContext, int inde
} }
// Now render the prepared buffers with the shader. // Now render the prepared buffers with the shader.
render_shader(deviceContext, indexCount); RenderShader(deviceContext, indexCount);
return true; return true;
} }
bool alpha_map_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) bool AlphaMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
{ {
Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
@ -102,7 +102,7 @@ bool alpha_map_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd,
D3D11_SAMPLER_DESC samplerDesc; D3D11_SAMPLER_DESC samplerDesc;
// initialize the pointers this function will use to null. // Initialize the pointers this function will use to null.
errorMessage = 0; errorMessage = 0;
vertexShaderBuffer = 0; vertexShaderBuffer = 0;
pixelShaderBuffer = 0; pixelShaderBuffer = 0;
@ -115,7 +115,7 @@ bool alpha_map_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd,
// If the shader failed to compile it should have writen something to the error message. // If the shader failed to compile it should have writen something to the error message.
if (errorMessage) if (errorMessage)
{ {
output_shader_error_message(errorMessage, hwnd, vsFilename); OutputShaderErrorMessage(errorMessage, hwnd, vsFilename);
} }
// If there was nothing in the error message then it simply could not find the shader file itself. // If there was nothing in the error message then it simply could not find the shader file itself.
else else
@ -134,7 +134,7 @@ bool alpha_map_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd,
// If the shader failed to compile it should have writen something to the error message. // If the shader failed to compile it should have writen something to the error message.
if (errorMessage) if (errorMessage)
{ {
output_shader_error_message(errorMessage, hwnd, psFilename); OutputShaderErrorMessage(errorMessage, hwnd, psFilename);
} }
// If there was nothing in the error message then it simply could not find the file itself. // If there was nothing in the error message then it simply could not find the file itself.
else else
@ -146,7 +146,7 @@ bool alpha_map_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd,
} }
// Create the vertex shader from the buffer. // Create the vertex shader from the buffer.
result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_); result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &m_vertexShader);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Error creating vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error creating vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -154,7 +154,7 @@ bool alpha_map_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd,
} }
// Create the pixel shader from the buffer. // Create the pixel shader from the buffer.
result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_); result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &m_pixelShader);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Error creating pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error creating pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -191,7 +191,7 @@ bool alpha_map_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd,
// Create the vertex input layout. // Create the vertex input layout.
result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(), result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(),
vertexShaderBuffer->GetBufferSize(), &layout_); vertexShaderBuffer->GetBufferSize(), &m_layout);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Error creating input layout", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error creating input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -207,14 +207,14 @@ bool alpha_map_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd,
// Setup the description of the dynamic matrix constant buffer that is in the vertex shader. // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC; matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type); matrixBufferDesc.ByteWidth = sizeof(MatrixBufferType);
matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
matrixBufferDesc.MiscFlags = 0; matrixBufferDesc.MiscFlags = 0;
matrixBufferDesc.StructureByteStride = 0; matrixBufferDesc.StructureByteStride = 0;
// Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class. // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_); result = device->CreateBuffer(&matrixBufferDesc, NULL, &m_matrixBuffer);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Error creating constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error creating constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -237,7 +237,7 @@ bool alpha_map_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd,
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
// Create the texture sampler state. // Create the texture sampler state.
result = device->CreateSamplerState(&samplerDesc, &sample_state_); result = device->CreateSamplerState(&samplerDesc, &m_sampleState);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Error creating sampler state", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error creating sampler state", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -250,53 +250,53 @@ bool alpha_map_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd,
} }
void alpha_map_shader_class::shutdown_shader() void AlphaMapShaderClass::ShutdownShader()
{ {
Logger::Get().Log("Shutting down shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Shutting down shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
// Release the sampler state. // Release the sampler state.
if (sample_state_) if (m_sampleState)
{ {
Logger::Get().Log("Releasing sampler state", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Releasing sampler state", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
sample_state_->Release(); m_sampleState->Release();
sample_state_ = 0; m_sampleState = 0;
Logger::Get().Log("Sampler state released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Sampler state released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
} }
// Release the matrix constant buffer. // Release the matrix constant buffer.
if (matrix_buffer_) if (m_matrixBuffer)
{ {
Logger::Get().Log("Releasing constant buffer", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Releasing constant buffer", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
matrix_buffer_->Release(); m_matrixBuffer->Release();
matrix_buffer_ = 0; m_matrixBuffer = 0;
Logger::Get().Log("Constant buffer released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Constant buffer released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
} }
// Release the layout. // Release the layout.
if (layout_) if (m_layout)
{ {
Logger::Get().Log("Releasing layout", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Releasing layout", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
layout_->Release(); m_layout->Release();
layout_ = 0; m_layout = 0;
Logger::Get().Log("Layout released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Layout released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
} }
// Release the pixel shader. // Release the pixel shader.
if (pixel_shader_) if (m_pixelShader)
{ {
Logger::Get().Log("Releasing pixel shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Releasing pixel shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
pixel_shader_->Release(); m_pixelShader->Release();
pixel_shader_ = 0; m_pixelShader = 0;
Logger::Get().Log("Pixel shader released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Pixel shader released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
} }
// Release the vertex shader. // Release the vertex shader.
if (vertex_shader_) if (m_vertexShader)
{ {
Logger::Get().Log("Releasing vertex shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Releasing vertex shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
vertex_shader_->Release(); m_vertexShader->Release();
vertex_shader_ = 0; m_vertexShader = 0;
Logger::Get().Log("Vertex shader released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Vertex shader released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
} }
@ -306,7 +306,7 @@ void alpha_map_shader_class::shutdown_shader()
} }
void alpha_map_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename) void AlphaMapShaderClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
{ {
char* compileErrors; char* compileErrors;
unsigned long long bufferSize, i; unsigned long long bufferSize, i;
@ -342,12 +342,12 @@ void alpha_map_shader_class::output_shader_error_message(ID3D10Blob* errorMessag
} }
bool alpha_map_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, bool AlphaMapShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2, ID3D11ShaderResourceView* texture3) ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2, ID3D11ShaderResourceView* texture3)
{ {
HRESULT result; HRESULT result;
D3D11_MAPPED_SUBRESOURCE mappedResource; D3D11_MAPPED_SUBRESOURCE mappedResource;
matrix_buffer_type* dataPtr; MatrixBufferType* dataPtr;
unsigned int bufferNumber; unsigned int bufferNumber;
@ -357,7 +357,7 @@ bool alpha_map_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceCo
projectionMatrix = XMMatrixTranspose(projectionMatrix); projectionMatrix = XMMatrixTranspose(projectionMatrix);
// Lock the constant buffer so it can be written to. // Lock the constant buffer so it can be written to.
result = deviceContext->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = deviceContext->Map(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Error mapping constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error mapping constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -365,7 +365,7 @@ bool alpha_map_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceCo
} }
// Get a pointer to the data in the constant buffer. // Get a pointer to the data in the constant buffer.
dataPtr = (matrix_buffer_type*)mappedResource.pData; dataPtr = (MatrixBufferType*)mappedResource.pData;
// Copy the matrices into the constant buffer. // Copy the matrices into the constant buffer.
dataPtr->world = worldMatrix; dataPtr->world = worldMatrix;
@ -373,13 +373,13 @@ bool alpha_map_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceCo
dataPtr->projection = projectionMatrix; dataPtr->projection = projectionMatrix;
// Unlock the constant buffer. // Unlock the constant buffer.
deviceContext->Unmap(matrix_buffer_, 0); deviceContext->Unmap(m_matrixBuffer, 0);
// Set the position of the constant buffer in the vertex shader. // Set the position of the constant buffer in the vertex shader.
bufferNumber = 0; bufferNumber = 0;
// Finally set the constant buffer in the vertex shader with the updated values. // Finally set the constant buffer in the vertex shader with the updated values.
deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_); deviceContext->VSSetConstantBuffers(bufferNumber, 1, &m_matrixBuffer);
// Set shader texture resources in the pixel shader. // Set shader texture resources in the pixel shader.
deviceContext->PSSetShaderResources(0, 1, &texture1); deviceContext->PSSetShaderResources(0, 1, &texture1);
@ -390,20 +390,20 @@ bool alpha_map_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceCo
} }
void alpha_map_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount) void AlphaMapShaderClass::RenderShader(ID3D11DeviceContext* deviceContext, int indexCount)
{ {
// Set the vertex input layout. // Set the vertex input layout.
deviceContext->IASetInputLayout(layout_); deviceContext->IASetInputLayout(m_layout);
// Set the vertex and pixel shaders that will be used to render this triangle. // Set the vertex and pixel shaders that will be used to render this triangle.
deviceContext->VSSetShader(vertex_shader_, NULL, 0); deviceContext->VSSetShader(m_vertexShader, NULL, 0);
deviceContext->PSSetShader(pixel_shader_, NULL, 0); deviceContext->PSSetShader(m_pixelShader, NULL, 0);
// Set the sampler state in the pixel shader. // Set the sampler state in the pixel shader.
deviceContext->PSSetSamplers(0, 1, &sample_state_); deviceContext->PSSetSamplers(0, 1, &m_sampleState);
// render the triangle. // Render the triangle.
deviceContext->DrawIndexed(indexCount, 0, 0); deviceContext->DrawIndexed(indexCount, 0, 0);
return; return;

View File

@ -0,0 +1,55 @@
#ifndef _ALPHAMAPSHADERCLASS_H_
#define _ALPHAMAPSHADERCLASS_H_
//////////////
// INCLUDES //
//////////////
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: AlphaMapShaderClass
////////////////////////////////////////////////////////////////////////////////
class AlphaMapShaderClass
{
private:
struct MatrixBufferType
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
public:
AlphaMapShaderClass();
AlphaMapShaderClass(const AlphaMapShaderClass&);
~AlphaMapShaderClass();
bool Initialize(ID3D11Device*, HWND);
void Shutdown();
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
private:
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void ShutdownShader();
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
void RenderShader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* m_vertexShader;
ID3D11PixelShader* m_pixelShader;
ID3D11InputLayout* m_layout;
ID3D11Buffer* m_matrixBuffer;
ID3D11SamplerState* m_sampleState;
};
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,231 @@
#ifndef _APPLICATIONCLASS_H_
#define _APPLICATIONCLASS_H_
///////////////////////
// MY CLASS INCLUDES //
///////////////////////
#include "d3dclass.h"
#include "cameraclass.h"
#include "object.h"
#include "lightclass.h"
#include <vector>
#include <filesystem>
#include "bitmapclass.h"
#include "spriteclass.h"
#include "timerclass.h"
#include "fontshaderclass.h"
#include "fontclass.h"
#include "textclass.h"
#include "fpsclass.h"
#include "inputclass.h"
#include "shadermanagerclass.h"
#include "modellistclass.h"
#include "positionclass.h"
#include "frustumclass.h"
#include "rendertextureclass.h"
#include "displayplaneclass.h"
#include "translateshaderclass.h"
#include "reflectionshaderclass.h"
#include "physics.h"
#include "frustum.h"
#include <WICTextureLoader.h>
#include <comdef.h> // Pour _com_error
/////////////
// GLOBALS //
/////////////
const bool FULL_SCREEN = false;
const float SCREEN_DEPTH = 1000.0f;
const float SCREEN_NEAR = 0.3f;
////////////////////////////////////////////////////////////////////////////////
// Class name: ApplicationClass
////////////////////////////////////////////////////////////////////////////////
class ApplicationClass
{
public:
ApplicationClass();
ApplicationClass(const ApplicationClass&);
~ApplicationClass();
D3DClass* GetDirect3D();
bool Initialize(int, int, HWND);
void Shutdown();
bool Frame(InputClass*);
int GetScreenWidth() const;
void SetScreenWidth(int screenWidth);
int GetScreenHeight() const;
void SetScreenHeight(int screenHeight);
float GetSpeed() const { return m_speed; };
void SetSpeed(float speed) { this->m_speed = speed; };
void AddCube();
void DeleteKobject(int index);
size_t GetCubeCount() const { return m_cubes.size(); };
size_t GetTerrainCubeCount() const { return m_terrainChunk.size(); };
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 SetPath(WCHAR* path) { m_path = path; };
void SetWFolder(std::filesystem::path WFolder) { m_WFolder = WFolder; };
void GenerateTerrain();
void DeleteTerrain();
XMVECTOR GetLightPosition(int index);
XMVECTOR GetLightColor(int index);
void SetLightPosition(int index, XMVECTOR color);
void SetLightColor(int index, XMVECTOR color);
void DeleteLight(int index);
void AddLight();
std::vector<LightClass*> GetLights() const { return m_Lights; };
bool GetShouldQuit() const { return m_ShouldQuit; };
void SetShouldQuit(bool shouldQuit) { m_ShouldQuit = shouldQuit; };
void SetCelShading(bool enable) { m_enableCelShading = enable; };
std::vector<ID3D11ShaderResourceView*> textures;
void SetVsync(bool vsync);
bool GetVsync() const { return VSYNC_ENABLED; };
HWND GetHwnd() const;
void SetHwnd(HWND hwnd);
bool IsWindowed() const;
void SetWindowed(bool windowed);
Physics* GetPhysics() const { return m_Physics; };
// ----------------------------------- //
// ------------- Frustum ------------- //
// ----------------------------------- //
Frustum GetFrustum() const { return m_FrustumCulling; };
void SetFrustum(Frustum frustum) { m_FrustumCulling = frustum; };
void ConstructFrustum();
int GetRenderCount() const { return m_renderCount; };
void SetRenderCount(int renderCount) { m_renderCount = renderCount; };
float GetFrustumTolerance() const { return m_FrustumCullingTolerance; };
void SetFrustumTolerance(float frustumTolerance) { m_FrustumCullingTolerance = frustumTolerance; };
private:
bool Render(float, float, float, float, float);
bool RenderPhysics(float x, float y, float z);
bool UpdateMouseStrings(int, int, bool);
bool UpdateFps();
bool UpdateRenderCountString(int);
bool RenderSceneToTexture(float);
bool RenderRefractionToTexture();
bool RenderReflectionToTexture();
bool RenderPass(const std::vector<std::reference_wrapper<std::vector<Object*>>>& RenderQueues, XMFLOAT4* diffuse, XMFLOAT4* position, XMFLOAT4* ambient, XMMATRIX view, XMMATRIX projection);
private :
// ------------------------------------- //
// ------------- DIRECT3D -------------- //
// ------------------------------------- //
D3DClass* m_Direct3D;
IDXGISwapChain* m_swapChain;
ModelClass* m_Model,* m_GroundModel, * m_WallModel, * m_BathModel, * m_WaterModel;
ModelListClass* m_ModelList;
bool VSYNC_ENABLED = true;
HWND m_hwnd;
bool m_windowed;
// ------------------------------------- //
// ------------- RENDERING ------------- //
// ------------------------------------- //
XMMATRIX m_baseViewMatrix;
RenderTextureClass* m_RenderTexture, * m_RefractionTexture, * m_ReflectionTexture;
DisplayPlaneClass* m_DisplayPlane;
int m_screenWidth, m_screenHeight;
CameraClass* m_Camera;
PositionClass* m_Position;
// ------------------------------------ //
// ------------- OBJECTS -------------- //
// ------------------------------------ //
Object* m_SelectedObject;
std::vector<Object*> m_cubes;
std::vector<Object*> m_terrainChunk;
float m_speed = 0.1f; // speed for the demo spinning object
std::vector<Object*> m_object;
int m_ObjectId = 0;
std::vector<std::reference_wrapper<std::vector<Object*>>> m_RenderQueues;
// ----------------------------------- //
// ------------- LIGHTS -------------- //
// ----------------------------------- //
LightClass* m_Light;
std::vector<LightClass*> m_Lights;
int m_numLights;
XMFLOAT3 TrueLightPosition;
ModelClass* m_LightModel;
// ----------------------------------- //
// ------------- SHADERS ------------- //
// ----------------------------------- //
ShaderManagerClass* m_ShaderManager;
FontShaderClass* m_FontShader;
BitmapClass* m_Bitmap;
SpriteClass* m_Sprite;
bool m_enableCelShading;
// ----------------------------------- //
// ------------ VARIABLES ------------ //
// ----------------------------------- //
float m_waterHeight, m_waterTranslation;
wchar_t* m_path;
std::filesystem::path m_WFolder;
// ------------------------------------------------- //
// ------------- FPS AND INFO ON SCREEN ------------ //
// ------------------------------------------------- //
TimerClass* m_Timer;
TextClass* m_MouseStrings;
TextClass* m_RenderCountString;
FontClass* m_Font;
FpsClass* m_Fps;
TextClass* m_FpsString;
int m_previousFps;
// ------------------------------------------------- //
// ------------------- OTHER ----------------------- //
// ------------------------------------------------- //
bool m_ShouldQuit;
Physics* m_Physics;
float m_gravity;
XMVECTOR m_previousPosition;
// ------------------------------------------------- //
// ------------------- Frustum --------------------- //
// ------------------------------------------------- //
Frustum m_FrustumCulling;
int m_renderCount;
float m_FrustumCullingTolerance = 5.f;
};
#endif

BIN
enginecustom/assets/Model/OBJ/86.obj (Stored with Git LFS)

File diff suppressed because it is too large Load Diff

BIN
enginecustom/assets/Model/OBJ/cone.obj (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

BIN
enginecustom/assets/Model/OBJ/monke.obj (Stored with Git LFS)

File diff suppressed because it is too large Load Diff

BIN
enginecustom/assets/Model/OBJ/plane.obj (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

BIN
enginecustom/assets/Model/OBJ/vaisseau.obj (Stored with Git LFS)

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

View File

@ -1,91 +0,0 @@
[Window][Debug##Default]
Pos=60,60
Size=400,400
Collapsed=0
[Window][Khaotic Engine]
Pos=1180,27
Size=396,826
Collapsed=0
DockId=0x00000005,0
[Window][Objects]
Pos=8,442
Size=290,411
Collapsed=0
DockId=0x0000000A,0
[Window][Terrain]
Pos=8,27
Size=290,413
Collapsed=0
DockId=0x00000009,0
[Window][Light]
Pos=8,27
Size=330,487
Collapsed=0
DockId=0x00000004,1
[Window][Shader Manager]
Pos=8,27
Size=330,487
Collapsed=0
DockId=0x00000004,2
[Window][Engine Settings]
Pos=1180,27
Size=396,826
Collapsed=0
DockId=0x00000005,1
[Window][DockSpace Demo]
Size=1584,861
Collapsed=0
[Window][Render Window]
Pos=300,27
Size=878,826
Collapsed=0
DockId=0x00000002,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=8,627
Size=1568,226
Collapsed=0
DockId=0x0000000E,0
[Docking][Data]
DockSpace ID=0xC0DFADC4 Pos=8,27 Size=1568,826 Split=X
DockNode ID=0x00000001 Parent=0xC0DFADC4 SizeRef=330,1094 Split=Y Selected=0x393905AB
DockNode ID=0x00000004 Parent=0x00000001 SizeRef=330,487 Selected=0x393905AB
DockNode ID=0x00000006 Parent=0x00000001 SizeRef=330,485 Selected=0x031DC75C
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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 331 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 273 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 493 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 510 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 498 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 422 KiB

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 +0,0 @@
0 isosphere 0 10 0 1 1 1 F:\Github_Repo\khaotic-engine-Reborn\enginecustom\assets\Model\OBJ\isosphere.obj

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

@ -1,39 +1,39 @@
#include "bitmap_class.h" #include "bitmapclass.h"
bitmap_class::bitmap_class() BitmapClass::BitmapClass()
{ {
vertex_buffer_ = 0; m_vertexBuffer = 0;
index_buffer_ = 0; m_indexBuffer = 0;
texture_ = 0; m_Texture = 0;
} }
bitmap_class::bitmap_class(const bitmap_class& other) BitmapClass::BitmapClass(const BitmapClass& other)
{ {
} }
bitmap_class::~bitmap_class() BitmapClass::~BitmapClass()
{ {
} }
bool bitmap_class::initialize(ID3D11Device* device, ID3D11DeviceContext* deviceContext, int screenWidth, int screenHeight, char* textureFilename, int renderX, int renderY) bool BitmapClass::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceContext, int screenWidth, int screenHeight, char* textureFilename, int renderX, int renderY)
{ {
Logger::Get().Log("Initializing bitmap class", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing bitmap class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
bool result; bool result;
// Store the screen size. // Store the screen size.
screen_width_ = screenWidth; m_screenWidth = screenWidth;
screen_height_ = screenHeight; m_screenHeight = screenHeight;
// Store where the bitmap should be rendered to. // Store where the bitmap should be rendered to.
render_x_ = renderX; m_renderX = renderX;
render_y_ = renderY; m_renderY = renderY;
// initialize the vertex and index buffer that hold the geometry for the bitmap quad. // Initialize the vertex and index buffer that hold the geometry for the bitmap quad.
result = initialize_buffers(device); result = InitializeBuffers(device);
if (!result) if (!result)
{ {
Logger::Get().Log("Failed to initialize buffers", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to initialize buffers", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -41,7 +41,7 @@ bool bitmap_class::initialize(ID3D11Device* device, ID3D11DeviceContext* deviceC
} }
// Load the texture for this bitmap. // Load the texture for this bitmap.
result = load_texture(device, deviceContext, textureFilename); result = LoadTexture(device, deviceContext, textureFilename);
if (!result) if (!result)
{ {
Logger::Get().Log("Failed to load texture", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to load texture", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -53,24 +53,24 @@ bool bitmap_class::initialize(ID3D11Device* device, ID3D11DeviceContext* deviceC
return true; return true;
} }
void bitmap_class::shutdown() void BitmapClass::Shutdown()
{ {
// Release the bitmap texture. // Release the bitmap texture.
release_texture(); ReleaseTexture();
// Release the vertex and index buffers. // Release the vertex and index buffers.
shutdown_buffers(); ShutdownBuffers();
return; return;
} }
bool bitmap_class::render(ID3D11DeviceContext* deviceContext) bool BitmapClass::Render(ID3D11DeviceContext* deviceContext)
{ {
bool result; bool result;
// Update the buffers if the position of the bitmap has changed from its original position. // Update the buffers if the position of the bitmap has changed from its original position.
result = update_buffers(deviceContext); result = UpdateBuffers(deviceContext);
if (!result) if (!result)
{ {
Logger::Get().Log("Failed to update buffers", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to update buffers", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -78,60 +78,60 @@ bool bitmap_class::render(ID3D11DeviceContext* deviceContext)
} }
// Put the vertex and index buffers on the graphics pipeline to prepare them for drawing. // Put the vertex and index buffers on the graphics pipeline to prepare them for drawing.
render_buffers(deviceContext); RenderBuffers(deviceContext);
return true; return true;
} }
int bitmap_class::get_index_count() int BitmapClass::GetIndexCount()
{ {
return index_count_; return m_indexCount;
} }
ID3D11ShaderResourceView* bitmap_class::get_texture() ID3D11ShaderResourceView* BitmapClass::GetTexture()
{ {
return texture_->GetTexture(); return m_Texture->GetTexture();
} }
bool bitmap_class::initialize_buffers(ID3D11Device* device) bool BitmapClass::InitializeBuffers(ID3D11Device* device)
{ {
Logger::Get().Log("Initializing buffers", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing buffers", __FILE__, __LINE__, Logger::LogLevel::Initialize);
vertex_type* vertices; VertexType* vertices;
unsigned long* indices; unsigned long* indices;
D3D11_BUFFER_DESC vertexBufferDesc, indexBufferDesc; D3D11_BUFFER_DESC vertexBufferDesc, indexBufferDesc;
D3D11_SUBRESOURCE_DATA vertexData, indexData; D3D11_SUBRESOURCE_DATA vertexData, indexData;
HRESULT result; HRESULT result;
int i; int i;
// initialize the previous rendering position to negative one. // Initialize the previous rendering position to negative one.
prev_pos_x_ = -1; m_prevPosX = -1;
prev_pos_y_ = -1; m_prevPosY = -1;
// Set the number of vertices in the vertex array. // Set the number of vertices in the vertex array.
vertex_count_ = 6; m_vertexCount = 6;
// Set the number of indices in the index array. // Set the number of indices in the index array.
index_count_ = vertex_count_; m_indexCount = m_vertexCount;
// Create the vertex array. // Create the vertex array.
vertices = new vertex_type[vertex_count_]; vertices = new VertexType[m_vertexCount];
// Create the index array. // Create the index array.
indices = new unsigned long[index_count_]; indices = new unsigned long[m_indexCount];
// initialize vertex array to zeros at first. // Initialize vertex array to zeros at first.
memset(vertices, 0, (sizeof(vertex_type) * vertex_count_)); memset(vertices, 0, (sizeof(VertexType) * m_vertexCount));
// Load the index array with data. // Load the index array with data.
for (i = 0; i < index_count_; i++) for (i = 0; i < m_indexCount; i++)
{ {
indices[i] = i; indices[i] = i;
} }
// Set up the description of the dynamic vertex buffer. // Set up the description of the dynamic vertex buffer.
vertexBufferDesc.Usage = D3D11_USAGE_DYNAMIC; vertexBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
vertexBufferDesc.ByteWidth = sizeof(vertex_type) * vertex_count_; vertexBufferDesc.ByteWidth = sizeof(VertexType) * m_vertexCount;
vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
vertexBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; vertexBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
vertexBufferDesc.MiscFlags = 0; vertexBufferDesc.MiscFlags = 0;
@ -143,7 +143,7 @@ bool bitmap_class::initialize_buffers(ID3D11Device* device)
vertexData.SysMemSlicePitch = 0; vertexData.SysMemSlicePitch = 0;
// Now finally create the vertex buffer. // Now finally create the vertex buffer.
result = device->CreateBuffer(&vertexBufferDesc, &vertexData, &vertex_buffer_); result = device->CreateBuffer(&vertexBufferDesc, &vertexData, &m_vertexBuffer);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create vertex buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create vertex buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -152,7 +152,7 @@ bool bitmap_class::initialize_buffers(ID3D11Device* device)
// Set up the description of the index buffer. // Set up the description of the index buffer.
indexBufferDesc.Usage = D3D11_USAGE_DEFAULT; indexBufferDesc.Usage = D3D11_USAGE_DEFAULT;
indexBufferDesc.ByteWidth = sizeof(unsigned long) * index_count_; indexBufferDesc.ByteWidth = sizeof(unsigned long) * m_indexCount;
indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
indexBufferDesc.CPUAccessFlags = 0; indexBufferDesc.CPUAccessFlags = 0;
indexBufferDesc.MiscFlags = 0; indexBufferDesc.MiscFlags = 0;
@ -164,7 +164,7 @@ bool bitmap_class::initialize_buffers(ID3D11Device* device)
indexData.SysMemSlicePitch = 0; indexData.SysMemSlicePitch = 0;
// Create the index buffer. // Create the index buffer.
result = device->CreateBuffer(&indexBufferDesc, &indexData, &index_buffer_); result = device->CreateBuffer(&indexBufferDesc, &indexData, &m_indexBuffer);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create index buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create index buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -183,25 +183,25 @@ bool bitmap_class::initialize_buffers(ID3D11Device* device)
return true; return true;
} }
void bitmap_class::shutdown_buffers() void BitmapClass::ShutdownBuffers()
{ {
Logger::Get().Log("Shutting down buffers", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Shutting down buffers", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
// Release the index buffer. // Release the index buffer.
if (index_buffer_) if (m_indexBuffer)
{ {
Logger::Get().Log("Releasing index buffer", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Releasing index buffer", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
index_buffer_->Release(); m_indexBuffer->Release();
index_buffer_ = 0; m_indexBuffer = 0;
Logger::Get().Log("Index buffer released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Index buffer released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
} }
// Release the vertex buffer. // Release the vertex buffer.
if (vertex_buffer_) if (m_vertexBuffer)
{ {
Logger::Get().Log("Releasing vertex buffer", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Releasing vertex buffer", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
vertex_buffer_->Release(); m_vertexBuffer->Release();
vertex_buffer_ = 0; m_vertexBuffer = 0;
Logger::Get().Log("Vertex buffer released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Vertex buffer released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
} }
@ -210,38 +210,38 @@ void bitmap_class::shutdown_buffers()
return; return;
} }
bool bitmap_class::update_buffers(ID3D11DeviceContext* deviceContent) bool BitmapClass::UpdateBuffers(ID3D11DeviceContext* deviceContent)
{ {
float left, right, top, bottom; float left, right, top, bottom;
vertex_type* vertices; VertexType* vertices;
D3D11_MAPPED_SUBRESOURCE mappedResource; D3D11_MAPPED_SUBRESOURCE mappedResource;
vertex_type* dataPtr; VertexType* dataPtr;
HRESULT result; HRESULT result;
// If the position we are rendering this bitmap to hasn't changed then don't update the vertex buffer. // If the position we are rendering this bitmap to hasn't changed then don't update the vertex buffer.
if ((prev_pos_x_ == render_x_) && (prev_pos_y_ == render_y_)) if ((m_prevPosX == m_renderX) && (m_prevPosY == m_renderY))
{ {
return true; return true;
} }
// If the rendering location has changed then store the new position and update the vertex buffer. // If the rendering location has changed then store the new position and update the vertex buffer.
prev_pos_x_ = render_x_; m_prevPosX = m_renderX;
prev_pos_y_ = render_y_; m_prevPosY = m_renderY;
// Create the vertex array. // Create the vertex array.
vertices = new vertex_type[vertex_count_]; vertices = new VertexType[m_vertexCount];
// Calculate the screen coordinates of the left side of the bitmap. // Calculate the screen coordinates of the left side of the bitmap.
left = (float)((screen_width_ / 2) * -1) + (float)render_x_; left = (float)((m_screenWidth / 2) * -1) + (float)m_renderX;
// Calculate the screen coordinates of the right side of the bitmap. // Calculate the screen coordinates of the right side of the bitmap.
right = left + (float)bitmap_width_; right = left + (float)m_bitmapWidth;
// Calculate the screen coordinates of the top of the bitmap. // Calculate the screen coordinates of the top of the bitmap.
top = (float)(screen_height_ / 2) - (float)render_y_; top = (float)(m_screenHeight / 2) - (float)m_renderY;
// Calculate the screen coordinates of the bottom of the bitmap. // Calculate the screen coordinates of the bottom of the bitmap.
bottom = top - (float)bitmap_height_; bottom = top - (float)m_bitmapHeight;
// Load the vertex array with data. // Load the vertex array with data.
// First triangle. // First triangle.
@ -265,7 +265,7 @@ bool bitmap_class::update_buffers(ID3D11DeviceContext* deviceContent)
vertices[5].texture = XMFLOAT2(1.0f, 1.0f); vertices[5].texture = XMFLOAT2(1.0f, 1.0f);
// Lock the vertex buffer. // Lock the vertex buffer.
result = deviceContent->Map(vertex_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = deviceContent->Map(m_vertexBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to map vertex buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to map vertex buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -273,13 +273,13 @@ bool bitmap_class::update_buffers(ID3D11DeviceContext* deviceContent)
} }
// Get a pointer to the data in the constant buffer. // Get a pointer to the data in the constant buffer.
dataPtr = (vertex_type*)mappedResource.pData; dataPtr = (VertexType*)mappedResource.pData;
// Copy the data into the vertex buffer. // Copy the data into the vertex buffer.
memcpy(dataPtr, (void*)vertices, (sizeof(vertex_type) * vertex_count_)); memcpy(dataPtr, (void*)vertices, (sizeof(VertexType) * m_vertexCount));
// Unlock the vertex buffer. // Unlock the vertex buffer.
deviceContent->Unmap(vertex_buffer_, 0); deviceContent->Unmap(m_vertexBuffer, 0);
// Release the pointer reference. // Release the pointer reference.
dataPtr = 0; dataPtr = 0;
@ -291,21 +291,21 @@ bool bitmap_class::update_buffers(ID3D11DeviceContext* deviceContent)
return true; return true;
} }
void bitmap_class::render_buffers(ID3D11DeviceContext* deviceContext) void BitmapClass::RenderBuffers(ID3D11DeviceContext* deviceContext)
{ {
unsigned int stride; unsigned int stride;
unsigned int offset; unsigned int offset;
// Set vertex buffer stride and offset. // Set vertex buffer stride and offset.
stride = sizeof(vertex_type); stride = sizeof(VertexType);
offset = 0; offset = 0;
// Set the vertex buffer to active in the input assembler so it can be rendered. // Set the vertex buffer to active in the input assembler so it can be rendered.
deviceContext->IASetVertexBuffers(0, 1, &vertex_buffer_, &stride, &offset); deviceContext->IASetVertexBuffers(0, 1, &m_vertexBuffer, &stride, &offset);
// Set the index buffer to active in the input assembler so it can be rendered. // Set the index buffer to active in the input assembler so it can be rendered.
deviceContext->IASetIndexBuffer(index_buffer_, DXGI_FORMAT_R32_UINT, 0); deviceContext->IASetIndexBuffer(m_indexBuffer, DXGI_FORMAT_R32_UINT, 0);
// Set the type of primitive that should be rendered from this vertex buffer, in this case triangles. // Set the type of primitive that should be rendered from this vertex buffer, in this case triangles.
deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST); deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
@ -313,15 +313,15 @@ void bitmap_class::render_buffers(ID3D11DeviceContext* deviceContext)
return; return;
} }
bool bitmap_class::load_texture(ID3D11Device* device, ID3D11DeviceContext* deviceContext, char* filename) bool BitmapClass::LoadTexture(ID3D11Device* device, ID3D11DeviceContext* deviceContext, char* filename)
{ {
bool result; bool result;
// Create and initialize the texture object. // Create and initialize the texture object.
texture_ = new texture_class; m_Texture = new TextureClass;
result = texture_->Initialize(device, deviceContext, filename); result = m_Texture->Initialize(device, deviceContext, filename);
if (!result) if (!result)
{ {
Logger::Get().Log("Failed to initialize texture object", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to initialize texture object", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -329,22 +329,22 @@ bool bitmap_class::load_texture(ID3D11Device* device, ID3D11DeviceContext* devic
} }
// Store the size in pixels that this bitmap should be rendered at. // Store the size in pixels that this bitmap should be rendered at.
bitmap_width_ = texture_->GetWidth(); m_bitmapWidth = m_Texture->GetWidth();
bitmap_height_ = texture_->GetHeight(); m_bitmapHeight = m_Texture->GetHeight();
return true; return true;
} }
void bitmap_class::release_texture() void BitmapClass::ReleaseTexture()
{ {
Logger::Get().Log("Releasing texture", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Releasing texture", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
// Release the texture object. // Release the texture object.
if (texture_) if (m_Texture)
{ {
Logger::Get().Log("Releasing texture object", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Releasing texture object", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
texture_->Shutdown(); m_Texture->Shutdown();
delete texture_; delete m_Texture;
texture_ = 0; m_Texture = 0;
Logger::Get().Log("Texture object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Texture object released", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
} }
@ -353,9 +353,9 @@ void bitmap_class::release_texture()
return; return;
} }
void bitmap_class::set_render_location(int x, int y) void BitmapClass::SetRenderLocation(int x, int y)
{ {
render_x_ = x; m_renderX = x;
render_y_ = y; m_renderY = y;
return; return;
} }

View File

@ -0,0 +1,59 @@
#ifndef _BITMAPCLASS_H_
#define _BITMAPCLASS_H_
//////////////
// INCLUDES //
//////////////
#include <directxmath.h>
using namespace DirectX;
///////////////////////
// MY CLASS INCLUDES //
///////////////////////
#include "textureclass.h"
////////////////////////////////////////////////////////////////////////////////
// Class name: BitmapClass
////////////////////////////////////////////////////////////////////////////////
class BitmapClass
{
private:
struct VertexType
{
XMFLOAT3 position;
XMFLOAT2 texture;
};
public:
BitmapClass();
BitmapClass(const BitmapClass&);
~BitmapClass();
bool Initialize(ID3D11Device*, ID3D11DeviceContext*, int, int, char*, int, int);
void Shutdown();
bool Render(ID3D11DeviceContext*);
int GetIndexCount();
ID3D11ShaderResourceView* GetTexture();
void SetRenderLocation(int, int);
private:
bool InitializeBuffers(ID3D11Device*);
void ShutdownBuffers();
bool UpdateBuffers(ID3D11DeviceContext*);
void RenderBuffers(ID3D11DeviceContext*);
bool LoadTexture(ID3D11Device*, ID3D11DeviceContext*, char*);
void ReleaseTexture();
private:
ID3D11Buffer* m_vertexBuffer, * m_indexBuffer;
int m_vertexCount, m_indexCount, m_screenWidth, m_screenHeight, m_bitmapWidth, m_bitmapHeight, m_renderX, m_renderY, m_prevPosX, m_prevPosY;
TextureClass* m_Texture;
};
#endif

View File

@ -0,0 +1,87 @@
cbuffer LightBuffer
{
float4 diffuseColor;
float3 lightDirection;
float padding; // Padding to ensure the structure is a multiple of 16 bytes.
float3 lightPosition; // Add light position
float padding2; // Padding to ensure the structure is a multiple of 16 bytes.
float constantAttenuation;
float linearAttenuation;
float quadraticAttenuation;
float padding3; // Padding to ensure the structure is a multiple of 16 bytes.
};
Texture2D shaderTexture;
SamplerState SampleType;
struct PixelInputType
{
float4 position : SV_POSITION;
float3 normal : NORMAL;
float2 tex : TEXCOORD0;
float3 worldPos : TEXCOORD1; // Add world position
};
float4 CelShadingPixelShader(PixelInputType input) : SV_TARGET
{
float4 textureColor;
float lightIntensity;
float4 finalColor;
// Sample the pixel color from the texture.
textureColor = shaderTexture.Sample(SampleType, input.tex);
float3 normal = normalize(input.normal);
// Calculate the light vector from the light position to the world position
float3 lightVector = normalize(lightPosition - input.worldPos);
// Calculate the light intensity based on the light direction.
float directionalLightIntensity = saturate(dot(normal, normalize(lightDirection)));
// Calculate the light intensity based on the light position.
float positionalLightIntensity = saturate(dot(normal, lightVector));
// Combine the directional and positional light intensities.
lightIntensity = max(directionalLightIntensity, positionalLightIntensity);
// Calculate the distance from the light to the fragment.
float distance = length(lightPosition - input.worldPos);
// Apply an attenuation factor based on the distance.
float attenuation = 1.0f / (constantAttenuation + linearAttenuation * distance + quadraticAttenuation * distance * distance);
// Combine the light intensity with the attenuation factor.
lightIntensity *= attenuation;
// Apply a step function to create the cel shading effect.
if (lightIntensity > 0.75f)
{
lightIntensity = 1.0f; // Brightest level
}
else if (lightIntensity > 0.5f)
{
lightIntensity = 0.7f; // Mid-bright level
}
else if (lightIntensity > 0.25f)
{
lightIntensity = 0.4f; // Mid-dark level
}
else
{
lightIntensity = 0.1f; // Darkest level
}
// Simple shadow calculation: if the fragment is behind the light source, it is in shadow.
float3 toLight = normalize(lightPosition - input.worldPos);
float shadow = saturate(dot(normal, toLight));
if (shadow < 0.1f)
{
lightIntensity *= 0.5f; // Darken the fragment if it is in shadow
}
// Calculate the final color by combining the texture color with the light intensity and diffuse color.
finalColor = textureColor * diffuseColor * lightIntensity;
return finalColor;
}

View File

@ -1,6 +1,3 @@
/////////////
// GLOBALS //
/////////////
cbuffer MatrixBuffer cbuffer MatrixBuffer
{ {
matrix worldMatrix; matrix worldMatrix;
@ -8,38 +5,39 @@ cbuffer MatrixBuffer
matrix projectionMatrix; matrix projectionMatrix;
}; };
//////////////
// TYPEDEFS //
//////////////
struct VertexInputType struct VertexInputType
{ {
float4 position : POSITION; float4 position : POSITION;
float3 normal : NORMAL;
float2 tex : TEXCOORD0; float2 tex : TEXCOORD0;
}; };
struct PixelInputType struct PixelInputType
{ {
float4 position : SV_POSITION; float4 position : SV_POSITION;
float3 normal : NORMAL;
float2 tex : TEXCOORD0; float2 tex : TEXCOORD0;
float3 worldPos : TEXCOORD1; // Add world position
}; };
PixelInputType CelShadingVertexShader(VertexInputType input)
////////////////////////////////////////////////////////////////////////////////
// Vertex Shader
////////////////////////////////////////////////////////////////////////////////
PixelInputType DepthVertexShader(VertexInputType input)
{ {
PixelInputType output; PixelInputType output;
// Change the position vector to be 4 units for proper matrix calculations. // Change the position vector to be 4 units for proper matrix calculations.
input.position.w = 1.0f; input.position.w = 1.0f;
// Calculate the position of the vertex against the world, view, and projection matrices. // Calculate the position of the vertex against the world, view, and projection matrices.
output.position = mul(input.position, worldMatrix); float4 worldPosition = mul(input.position, worldMatrix);
output.position = mul(output.position, viewMatrix); output.position = mul(worldPosition, viewMatrix);
output.position = mul(output.position, projectionMatrix); output.position = mul(output.position, projectionMatrix);
// Pass the normal to the pixel shader
output.normal = mul((float3x3)worldMatrix, input.normal);
// Pass the world position to the pixel shader
output.worldPos = worldPosition.xyz;
// Store the texture coordinates for the pixel shader. // Store the texture coordinates for the pixel shader.
output.tex = input.tex; output.tex = input.tex;

View File

@ -1,36 +1,36 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Filename: d3dclass.cpp // Filename: d3dclass.cpp
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "d_3d_class.h" #include "d3dclass.h"
d_3d_class::d_3d_class() D3DClass::D3DClass()
{ {
swap_chain = 0; m_swapChain = 0;
device_ = 0; m_device = 0;
device_context_ = 0; m_deviceContext = 0;
render_target_view_ = 0; m_renderTargetView = 0;
depth_stencil_buffer_ = 0; m_depthStencilBuffer = 0;
depth_stencil_state_ = 0; m_depthStencilState = 0;
depth_stencil_view_ = 0; m_depthStencilView = 0;
raster_state_ = 0; m_rasterState = 0;
depth_disabled_stencil_state_ = 0; m_depthDisabledStencilState = 0;
alpha_enable_blending_state_ = 0; m_alphaEnableBlendingState = 0;
alpha_disable_blending_state_ = 0; m_alphaDisableBlendingState = 0;
} }
d_3d_class::d_3d_class(const d_3d_class& other) D3DClass::D3DClass(const D3DClass& other)
{ {
} }
d_3d_class::~d_3d_class() D3DClass::~D3DClass()
{ {
} }
bool d_3d_class::initialize(int screenWidth, int screenHeight, bool vsync, HWND hwnd, bool fullscreen, float screenDepth, float screenNear) bool D3DClass::Initialize(int screenWidth, int screenHeight, bool vsync, HWND hwnd, bool fullscreen, float screenDepth, float screenNear)
{ {
Logger::Get().Log("Initializing D3Dclass", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing D3Dclass", __FILE__, __LINE__, Logger::LogLevel::Initialize);
@ -55,7 +55,7 @@ bool d_3d_class::initialize(int screenWidth, int screenHeight, bool vsync, HWND
D3D11_BLEND_DESC blendStateDescription; D3D11_BLEND_DESC blendStateDescription;
// Store the vsync setting. // Store the vsync setting.
vsync_enabled_ = vsync; m_vsync_enabled = vsync;
// Create a DirectX graphics interface factory. // Create a DirectX graphics interface factory.
result = CreateDXGIFactory(__uuidof(IDXGIFactory), (void**)&factory); result = CreateDXGIFactory(__uuidof(IDXGIFactory), (void**)&factory);
@ -128,10 +128,10 @@ bool d_3d_class::initialize(int screenWidth, int screenHeight, bool vsync, HWND
} }
// Store the dedicated video card memory in megabytes. // Store the dedicated video card memory in megabytes.
video_card_memory_ = (int)(adapterDesc.DedicatedVideoMemory / 1024 / 1024); m_videoCardMemory = (int)(adapterDesc.DedicatedVideoMemory / 1024 / 1024);
// Convert the name of the video card to a character array and store it. // Convert the name of the video card to a character array and store it.
error = wcstombs_s(&stringLength, video_card_description_, 128, adapterDesc.Description, 128); error = wcstombs_s(&stringLength, m_videoCardDescription, 128, adapterDesc.Description, 128);
if (error != 0) if (error != 0)
{ {
Logger::Get().Log("Failed to convert video card name to character array", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to convert video card name to character array", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -154,7 +154,7 @@ bool d_3d_class::initialize(int screenWidth, int screenHeight, bool vsync, HWND
factory->Release(); factory->Release();
factory = 0; factory = 0;
// initialize the swap chain description. // Initialize the swap chain description.
ZeroMemory(&swapChainDesc, sizeof(swapChainDesc)); ZeroMemory(&swapChainDesc, sizeof(swapChainDesc));
// Set to a single back buffer. // Set to a single back buffer.
@ -168,7 +168,7 @@ bool d_3d_class::initialize(int screenWidth, int screenHeight, bool vsync, HWND
swapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; swapChainDesc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
// Set the refresh rate of the back buffer. // Set the refresh rate of the back buffer.
if (vsync_enabled_) if (m_vsync_enabled)
{ {
swapChainDesc.BufferDesc.RefreshRate.Numerator = numerator; swapChainDesc.BufferDesc.RefreshRate.Numerator = numerator;
swapChainDesc.BufferDesc.RefreshRate.Denominator = denominator; swapChainDesc.BufferDesc.RefreshRate.Denominator = denominator;
@ -214,7 +214,7 @@ bool d_3d_class::initialize(int screenWidth, int screenHeight, bool vsync, HWND
// Create the swap chain, Direct3D device, and Direct3D device context. // Create the swap chain, Direct3D device, and Direct3D device context.
result = D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, &featureLevel, 1, result = D3D11CreateDeviceAndSwapChain(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, &featureLevel, 1,
D3D11_SDK_VERSION, &swapChainDesc, &swap_chain, &device_, NULL, &device_context_); D3D11_SDK_VERSION, &swapChainDesc, &m_swapChain, &m_device, NULL, &m_deviceContext);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create swap chain, device and device context", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create swap chain, device and device context", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -222,7 +222,7 @@ bool d_3d_class::initialize(int screenWidth, int screenHeight, bool vsync, HWND
} }
// Get the pointer to the back buffer. // Get the pointer to the back buffer.
result = swap_chain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&backBufferPtr); result = m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&backBufferPtr);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to get pointer to back buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to get pointer to back buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -230,7 +230,7 @@ bool d_3d_class::initialize(int screenWidth, int screenHeight, bool vsync, HWND
} }
// Create the render target view with the back buffer pointer. // Create the render target view with the back buffer pointer.
result = device_->CreateRenderTargetView(backBufferPtr, NULL, &render_target_view_); result = m_device->CreateRenderTargetView(backBufferPtr, NULL, &m_renderTargetView);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create render target view", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create render target view", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -241,7 +241,7 @@ bool d_3d_class::initialize(int screenWidth, int screenHeight, bool vsync, HWND
backBufferPtr->Release(); backBufferPtr->Release();
backBufferPtr = 0; backBufferPtr = 0;
// initialize the description of the depth buffer. // Initialize the description of the depth buffer.
ZeroMemory(&depthBufferDesc, sizeof(depthBufferDesc)); ZeroMemory(&depthBufferDesc, sizeof(depthBufferDesc));
// Set up the description of the depth buffer. // Set up the description of the depth buffer.
@ -258,14 +258,14 @@ bool d_3d_class::initialize(int screenWidth, int screenHeight, bool vsync, HWND
depthBufferDesc.MiscFlags = 0; depthBufferDesc.MiscFlags = 0;
// Create the texture for the depth buffer using the filled out description. // Create the texture for the depth buffer using the filled out description.
result = device_->CreateTexture2D(&depthBufferDesc, NULL, &depth_stencil_buffer_); result = m_device->CreateTexture2D(&depthBufferDesc, NULL, &m_depthStencilBuffer);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create texture for depth buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create texture for depth buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
return false; return false;
} }
// initialize the description of the stencil state. // Initialize the description of the stencil state.
ZeroMemory(&depthStencilDesc, sizeof(depthStencilDesc)); ZeroMemory(&depthStencilDesc, sizeof(depthStencilDesc));
// Set up the description of the stencil state. // Set up the description of the stencil state.
@ -290,7 +290,7 @@ bool d_3d_class::initialize(int screenWidth, int screenHeight, bool vsync, HWND
depthStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS; depthStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
// Create the depth stencil state. // Create the depth stencil state.
result = device_->CreateDepthStencilState(&depthStencilDesc, &depth_stencil_state_); result = m_device->CreateDepthStencilState(&depthStencilDesc, &m_depthStencilState);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create depth stencil state", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create depth stencil state", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -298,9 +298,9 @@ bool d_3d_class::initialize(int screenWidth, int screenHeight, bool vsync, HWND
} }
// Set the depth stencil state. // Set the depth stencil state.
device_context_->OMSetDepthStencilState(depth_stencil_state_, 1); m_deviceContext->OMSetDepthStencilState(m_depthStencilState, 1);
// initialize the depth stencil view. // Initialize the depth stencil view.
ZeroMemory(&depthStencilViewDesc, sizeof(depthStencilViewDesc)); ZeroMemory(&depthStencilViewDesc, sizeof(depthStencilViewDesc));
// Set up the depth stencil view description. // Set up the depth stencil view description.
@ -309,7 +309,7 @@ bool d_3d_class::initialize(int screenWidth, int screenHeight, bool vsync, HWND
depthStencilViewDesc.Texture2D.MipSlice = 0; depthStencilViewDesc.Texture2D.MipSlice = 0;
// Create the depth stencil view. // Create the depth stencil view.
result = device_->CreateDepthStencilView(depth_stencil_buffer_, &depthStencilViewDesc, &depth_stencil_view_); result = m_device->CreateDepthStencilView(m_depthStencilBuffer, &depthStencilViewDesc, &m_depthStencilView);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create depth stencil view", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create depth stencil view", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -317,7 +317,7 @@ bool d_3d_class::initialize(int screenWidth, int screenHeight, bool vsync, HWND
} }
// Bind the render target view and depth stencil buffer to the output render pipeline. // Bind the render target view and depth stencil buffer to the output render pipeline.
device_context_->OMSetRenderTargets(1, &render_target_view_, depth_stencil_view_); m_deviceContext->OMSetRenderTargets(1, &m_renderTargetView, m_depthStencilView);
// Setup the raster description which will determine how and what polygons will be drawn. // Setup the raster description which will determine how and what polygons will be drawn.
rasterDesc.AntialiasedLineEnable = false; rasterDesc.AntialiasedLineEnable = false;
@ -332,7 +332,7 @@ bool d_3d_class::initialize(int screenWidth, int screenHeight, bool vsync, HWND
rasterDesc.SlopeScaledDepthBias = 0.0f; rasterDesc.SlopeScaledDepthBias = 0.0f;
// Create the rasterizer state from the description we just filled out. // Create the rasterizer state from the description we just filled out.
result = device_->CreateRasterizerState(&rasterDesc, &raster_state_); result = m_device->CreateRasterizerState(&rasterDesc, &m_rasterState);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create rasterizer state", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create rasterizer state", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -340,31 +340,31 @@ bool d_3d_class::initialize(int screenWidth, int screenHeight, bool vsync, HWND
} }
// Now set the rasterizer state. // Now set the rasterizer state.
device_context_->RSSetState(raster_state_); m_deviceContext->RSSetState(m_rasterState);
// Setup the viewport for rendering. // Setup the viewport for rendering.
viewport_.Width = (float)screenWidth; m_viewport.Width = (float)screenWidth;
viewport_.Height = (float)screenHeight; m_viewport.Height = (float)screenHeight;
viewport_.MinDepth = 0.0f; m_viewport.MinDepth = 0.0f;
viewport_.MaxDepth = 1.0f; m_viewport.MaxDepth = 1.0f;
viewport_.TopLeftX = 0.0f; m_viewport.TopLeftX = 0.0f;
viewport_.TopLeftY = 0.0f; m_viewport.TopLeftY = 0.0f;
// Create the viewport. // Create the viewport.
device_context_->RSSetViewports(1, &viewport_); m_deviceContext->RSSetViewports(1, &m_viewport);
// Setup the projection matrix. // Setup the projection matrix.
fieldOfView = 3.141592654f / 4.0f; fieldOfView = 3.141592654f / 4.0f;
screenAspect = (float)screenWidth / (float)screenHeight; screenAspect = (float)screenWidth / (float)screenHeight;
// Create the projection matrix for 3D rendering. // Create the projection matrix for 3D rendering.
projection_matrix_ = XMMatrixPerspectiveFovLH(fieldOfView, screenAspect, screenNear, screenDepth); m_projectionMatrix = XMMatrixPerspectiveFovLH(fieldOfView, screenAspect, screenNear, screenDepth);
// initialize the world matrix to the identity matrix. // Initialize the world matrix to the identity matrix.
world_matrix_ = XMMatrixIdentity(); m_worldMatrix = XMMatrixIdentity();
// Create an orthographic projection matrix for 2D rendering. // Create an orthographic projection matrix for 2D rendering.
ortho_matrix_ = XMMatrixOrthographicLH((float)screenWidth, (float)screenHeight, screenNear, screenDepth); m_orthoMatrix = XMMatrixOrthographicLH((float)screenWidth, (float)screenHeight, screenNear, screenDepth);
// Clear the second depth stencil state before setting the parameters. // Clear the second depth stencil state before setting the parameters.
ZeroMemory(&depthDisabledStencilDesc, sizeof(depthDisabledStencilDesc)); ZeroMemory(&depthDisabledStencilDesc, sizeof(depthDisabledStencilDesc));
@ -387,7 +387,7 @@ bool d_3d_class::initialize(int screenWidth, int screenHeight, bool vsync, HWND
depthDisabledStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS; depthDisabledStencilDesc.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
// Create the state using the device. // Create the state using the device.
result = device_->CreateDepthStencilState(&depthDisabledStencilDesc, &depth_disabled_stencil_state_); result = m_device->CreateDepthStencilState(&depthDisabledStencilDesc, &m_depthDisabledStencilState);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create depth disabled stencil state", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create depth disabled stencil state", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -405,10 +405,10 @@ bool d_3d_class::initialize(int screenWidth, int screenHeight, bool vsync, HWND
blendStateDescription.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE; blendStateDescription.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
blendStateDescription.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO; blendStateDescription.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ZERO;
blendStateDescription.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; blendStateDescription.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD;
blendStateDescription.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; blendStateDescription.RenderTarget[0].RenderTargetWriteMask = 0x0f;
// Create the blend state using the description. // Create the blend state using the description.
result = device_->CreateBlendState(&blendStateDescription, &alpha_enable_blending_state_); result = m_device->CreateBlendState(&blendStateDescription, &m_alphaEnableBlendingState);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create alpha enabled blend state", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create alpha enabled blend state", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -419,7 +419,7 @@ bool d_3d_class::initialize(int screenWidth, int screenHeight, bool vsync, HWND
blendStateDescription.RenderTarget[0].BlendEnable = FALSE; blendStateDescription.RenderTarget[0].BlendEnable = FALSE;
// Create the blend state using the description. // Create the blend state using the description.
result = device_->CreateBlendState(&blendStateDescription, &alpha_disable_blending_state_); result = m_device->CreateBlendState(&blendStateDescription, &m_alphaDisableBlendingState);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create alpha disabled blend state", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create alpha disabled blend state", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -430,81 +430,81 @@ bool d_3d_class::initialize(int screenWidth, int screenHeight, bool vsync, HWND
} }
void d_3d_class::shutdown() void D3DClass::Shutdown()
{ {
Logger::Get().Log("Shutting down D3Dclass", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Shutting down D3Dclass", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
// Before shutting down set to windowed mode or when you release the swap chain it will throw an exception. // Before shutting down set to windowed mode or when you release the swap chain it will throw an exception.
if (swap_chain) if (m_swapChain)
{ {
swap_chain->SetFullscreenState(false, NULL); m_swapChain->SetFullscreenState(false, NULL);
} }
if (alpha_enable_blending_state_) if (m_alphaEnableBlendingState)
{ {
alpha_enable_blending_state_->Release(); m_alphaEnableBlendingState->Release();
alpha_enable_blending_state_ = 0; m_alphaEnableBlendingState = 0;
} }
if (alpha_disable_blending_state_) if (m_alphaDisableBlendingState)
{ {
alpha_disable_blending_state_->Release(); m_alphaDisableBlendingState->Release();
alpha_disable_blending_state_ = 0; m_alphaDisableBlendingState = 0;
} }
if (depth_disabled_stencil_state_) if (m_depthDisabledStencilState)
{ {
depth_disabled_stencil_state_->Release(); m_depthDisabledStencilState->Release();
depth_disabled_stencil_state_ = 0; m_depthDisabledStencilState = 0;
} }
if (raster_state_) if (m_rasterState)
{ {
raster_state_->Release(); m_rasterState->Release();
raster_state_ = 0; m_rasterState = 0;
} }
if (depth_stencil_view_) if (m_depthStencilView)
{ {
depth_stencil_view_->Release(); m_depthStencilView->Release();
depth_stencil_view_ = 0; m_depthStencilView = 0;
} }
if (depth_stencil_state_) if (m_depthStencilState)
{ {
depth_stencil_state_->Release(); m_depthStencilState->Release();
depth_stencil_state_ = 0; m_depthStencilState = 0;
} }
if (depth_stencil_buffer_) if (m_depthStencilBuffer)
{ {
depth_stencil_buffer_->Release(); m_depthStencilBuffer->Release();
depth_stencil_buffer_ = 0; m_depthStencilBuffer = 0;
} }
if (render_target_view_) if (m_renderTargetView)
{ {
render_target_view_->Release(); m_renderTargetView->Release();
render_target_view_ = 0; m_renderTargetView = 0;
} }
if (device_context_) if (m_deviceContext)
{ {
device_context_->Release(); m_deviceContext->Release();
device_context_ = 0; m_deviceContext = 0;
} }
if (device_) if (m_device)
{ {
device_->Release(); m_device->Release();
device_ = 0; m_device = 0;
} }
if (swap_chain) if (m_swapChain)
{ {
swap_chain->Release(); m_swapChain->Release();
swap_chain = 0; m_swapChain = 0;
} }
Logger::Get().Log("D3Dclass shutdown", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("D3Dclass shutdown", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
@ -513,7 +513,7 @@ void d_3d_class::shutdown()
} }
void d_3d_class::begin_scene(float red, float green, float blue, float alpha) void D3DClass::BeginScene(float red, float green, float blue, float alpha)
{ {
float color[4]; float color[4];
@ -525,115 +525,115 @@ void d_3d_class::begin_scene(float red, float green, float blue, float alpha)
color[3] = alpha; color[3] = alpha;
// Clear the back buffer. // Clear the back buffer.
device_context_->ClearRenderTargetView(render_target_view_, color); m_deviceContext->ClearRenderTargetView(m_renderTargetView, color);
// Clear the depth buffer. // Clear the depth buffer.
device_context_->ClearDepthStencilView(depth_stencil_view_, D3D11_CLEAR_DEPTH, 1.0f, 0); m_deviceContext->ClearDepthStencilView(m_depthStencilView, D3D11_CLEAR_DEPTH, 1.0f, 0);
return; return;
} }
void d_3d_class::end_scene() void D3DClass::EndScene()
{ {
// Present the back buffer to the screen since rendering is complete. // Present the back buffer to the screen since rendering is complete.
if (vsync_enabled_) if (m_vsync_enabled)
{ {
// Lock to screen refresh rate. // Lock to screen refresh rate.
swap_chain->Present(1, 0); m_swapChain->Present(1, 0);
} }
else else
{ {
// Present as fast as possible. // Present as fast as possible.
swap_chain->Present(0, 0); m_swapChain->Present(0, 0);
} }
return; return;
} }
ID3D11Device* d_3d_class::get_device() ID3D11Device* D3DClass::GetDevice()
{ {
return device_; return m_device;
} }
ID3D11DeviceContext* d_3d_class::get_device_context() ID3D11DeviceContext* D3DClass::GetDeviceContext()
{ {
return device_context_; return m_deviceContext;
} }
void d_3d_class::get_video_card_info(char* cardName, int& memory) void D3DClass::GetVideoCardInfo(char* cardName, int& memory)
{ {
strcpy_s(cardName, 128, video_card_description_); strcpy_s(cardName, 128, m_videoCardDescription);
memory = video_card_memory_; memory = m_videoCardMemory;
return; return;
} }
void d_3d_class::set_back_buffer_render_target() void D3DClass::SetBackBufferRenderTarget()
{ {
// Bind the render target view and depth stencil buffer to the output render pipeline. // Bind the render target view and depth stencil buffer to the output render pipeline.
device_context_->OMSetRenderTargets(1, &render_target_view_, depth_stencil_view_); m_deviceContext->OMSetRenderTargets(1, &m_renderTargetView, m_depthStencilView);
return; return;
} }
void d_3d_class::reset_viewport() void D3DClass::ResetViewport()
{ {
// Set the viewport. // Set the viewport.
device_context_->RSSetViewports(1, &viewport_); m_deviceContext->RSSetViewports(1, &m_viewport);
return; return;
} }
void d_3d_class::release_resources() void D3DClass::ReleaseResources()
{ {
Logger::Get().Log("Releasing D3D resources", __FILE__, __LINE__); Logger::Get().Log("Releasing D3D resources", __FILE__, __LINE__);
// libere la vue // libere la vue
if (render_target_view_) if (m_renderTargetView)
{ {
render_target_view_->Release(); m_renderTargetView->Release();
render_target_view_ = 0; m_renderTargetView = 0;
} }
// libere le buffer de profondeur // libere le buffer de profondeur
if (depth_stencil_buffer_) if (m_depthStencilBuffer)
{ {
depth_stencil_buffer_->Release(); m_depthStencilBuffer->Release();
depth_stencil_buffer_ = 0; m_depthStencilBuffer = 0;
} }
// libere la vue de profondeur // libere la vue de profondeur
if (depth_stencil_view_) if (m_depthStencilView)
{ {
depth_stencil_view_->Release(); m_depthStencilView->Release();
depth_stencil_view_ = 0; m_depthStencilView = 0;
} }
Logger::Get().Log("D3D resources released", __FILE__, __LINE__); Logger::Get().Log("D3D resources released", __FILE__, __LINE__);
} }
// Reset the resources for the swap chain // Reset the resources for the swap chain
void d_3d_class::reset_resources(int newWidth, int newHeight) void D3DClass::ResetResources(int newWidth, int newHeight)
{ {
Logger::Get().Log("Resetting D3D resources", __FILE__, __LINE__); Logger::Get().Log("Resetting D3D resources", __FILE__, __LINE__);
HRESULT result; HRESULT result;
ID3D11Texture2D* backBuffer; ID3D11Texture2D* backBuffer;
result = swap_chain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&backBuffer); result = m_swapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (LPVOID*)&backBuffer);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to get back buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to get back buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
return; return;
} }
result = device_->CreateRenderTargetView(backBuffer, NULL, &render_target_view_); result = m_device->CreateRenderTargetView(backBuffer, NULL, &m_renderTargetView);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create render target view", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create render target view", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -669,14 +669,14 @@ void d_3d_class::reset_resources(int newWidth, int newHeight)
depthStencilViewDesc.Texture2D.MipSlice = 0; depthStencilViewDesc.Texture2D.MipSlice = 0;
// Other depthStencilDesc settings... // Other depthStencilDesc settings...
result = device_->CreateTexture2D(&depthBufferDesc, NULL, &depth_stencil_buffer_); result = m_device->CreateTexture2D(&depthBufferDesc, NULL, &m_depthStencilBuffer);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create depth stencil buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create depth stencil buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
return; return;
} }
result = device_->CreateDepthStencilView(depth_stencil_buffer_, &depthStencilViewDesc, &depth_stencil_view_); result = m_device->CreateDepthStencilView(m_depthStencilBuffer, &depthStencilViewDesc, &m_depthStencilView);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create depth stencil view", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create depth stencil view", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -684,15 +684,15 @@ void d_3d_class::reset_resources(int newWidth, int newHeight)
} }
// Set the new render target and depth/stencil views for rendering // Set the new render target and depth/stencil views for rendering
device_context_->OMSetRenderTargets(1, &render_target_view_, depth_stencil_view_); m_deviceContext->OMSetRenderTargets(1, &m_renderTargetView, m_depthStencilView);
} }
IDXGISwapChain* d_3d_class::get_swap_chain() IDXGISwapChain* D3DClass::GetSwapChain()
{ {
return swap_chain; return m_swapChain;
} }
void d_3d_class::resize_swap_chain(int newWidth, int newHeight) void D3DClass::ResizeSwapChain(int newWidth, int newHeight)
{ {
// log the new width and height // log the new width and height
@ -701,11 +701,11 @@ void d_3d_class::resize_swap_chain(int newWidth, int newHeight)
HRESULT result; HRESULT result;
// Release existing DirectX resources // Release existing DirectX resources
release_resources(); ReleaseResources();
device_context_->Flush(); m_deviceContext->Flush();
// Resize the swap chain // Resize the swap chain
result = swap_chain->ResizeBuffers(0, newWidth, newHeight, DXGI_FORMAT_UNKNOWN, 0); result = m_swapChain->ResizeBuffers(0, newWidth, newHeight, DXGI_FORMAT_UNKNOWN, 0);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to resize swap chain", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to resize swap chain", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -713,28 +713,28 @@ void d_3d_class::resize_swap_chain(int newWidth, int newHeight)
} }
// Reset the resources // Reset the resources
reset_resources(newWidth, newHeight); ResetResources(newWidth, newHeight);
// Update the viewport // Update the viewport
viewport_.Width = static_cast<float>(newWidth); m_viewport.Width = static_cast<float>(newWidth);
viewport_.Height = static_cast<float>(newHeight); m_viewport.Height = static_cast<float>(newHeight);
device_context_->RSSetViewports(1, &viewport_); m_deviceContext->RSSetViewports(1, &m_viewport);
} }
void d_3d_class::turn_z_buffer_on() void D3DClass::TurnZBufferOn()
{ {
device_context_->OMSetDepthStencilState(depth_stencil_state_, 1); m_deviceContext->OMSetDepthStencilState(m_depthStencilState, 1);
return; return;
} }
void d_3d_class::turn_z_buffer_off() void D3DClass::TurnZBufferOff()
{ {
device_context_->OMSetDepthStencilState(depth_disabled_stencil_state_, 1); m_deviceContext->OMSetDepthStencilState(m_depthDisabledStencilState, 1);
return; return;
} }
void d_3d_class::enable_alpha_blending() void D3DClass::EnableAlphaBlending()
{ {
float blendFactor[4]; float blendFactor[4];
@ -746,12 +746,12 @@ void d_3d_class::enable_alpha_blending()
blendFactor[3] = 0.0f; blendFactor[3] = 0.0f;
// Turn on the alpha blending. // Turn on the alpha blending.
device_context_->OMSetBlendState(alpha_enable_blending_state_, blendFactor, 0xffffffff); m_deviceContext->OMSetBlendState(m_alphaEnableBlendingState, blendFactor, 0xffffffff);
return; return;
} }
void d_3d_class::disable_alpha_blending() void D3DClass::DisableAlphaBlending()
{ {
float blendFactor[4]; float blendFactor[4];
@ -763,12 +763,12 @@ void d_3d_class::disable_alpha_blending()
blendFactor[3] = 0.0f; blendFactor[3] = 0.0f;
// Turn off the alpha blending. // Turn off the alpha blending.
device_context_->OMSetBlendState(alpha_disable_blending_state_, blendFactor, 0xffffffff); m_deviceContext->OMSetBlendState(m_alphaDisableBlendingState, blendFactor, 0xffffffff);
return; return;
} }
void d_3d_class::set_vsync(bool vsync) void D3DClass::SetVsync(bool vsync)
{ {
vsync_enabled_ = vsync; m_vsync_enabled = vsync;
} }

90
enginecustom/d3dclass.h Normal file
View File

@ -0,0 +1,90 @@
////////////////////////////////////////////////////////////////////////////////
// Filename: d3dclass.h
////////////////////////////////////////////////////////////////////////////////
#ifndef _D3DCLASS_H_
#define _D3DCLASS_H_
/////////////
// LINKING //
/////////////
#pragma comment(lib, "d3d11.lib")
#pragma comment(lib, "dxgi.lib")
#pragma comment(lib, "d3dcompiler.lib")
//////////////
// INCLUDES //
//////////////
#include "imguiManager.h"
#include "d3d11.h"
#include "fontshaderclass.h"
#include "fontclass.h"
#include "textclass.h"
using namespace DirectX;
////////////////////////////////////////////////////////////////////////////////
// Class name: D3DClass
////////////////////////////////////////////////////////////////////////////////
class D3DClass
{
public:
D3DClass();
D3DClass(const D3DClass&);
~D3DClass();
bool Initialize(int, int, bool, HWND, bool, float, float);
void Shutdown();
void BeginScene(float, float, float, float);
void EndScene();
ID3D11Device* GetDevice();
ID3D11DeviceContext* GetDeviceContext();
//XMMATRIX GetProjectionMatrix(XMMATRIX& projectionMatrix);
IDXGISwapChain* m_swapChain;
IDXGISwapChain* GetSwapChain();
void ResizeSwapChain(int, int);
void SetVsync(bool vsync);
XMMATRIX GetProjectionMatrix() const { return m_projectionMatrix; };
XMMATRIX GetWorldMatrix() const { return m_worldMatrix;};
XMMATRIX GetOrthoMatrix() const { return m_orthoMatrix; };
void GetVideoCardInfo(char*, int&);
void SetBackBufferRenderTarget();
void ResetViewport();
void ReleaseResources();
void ResetResources(int newWidth, int newHeight);
void TurnZBufferOn();
void TurnZBufferOff();
void EnableAlphaBlending();
void DisableAlphaBlending();
private:
bool m_vsync_enabled;
int m_videoCardMemory;
char m_videoCardDescription[128];
ID3D11Device* m_device;
ID3D11DeviceContext* m_deviceContext;
ID3D11RenderTargetView* m_renderTargetView;
ID3D11Texture2D* m_depthStencilBuffer;
ID3D11DepthStencilState* m_depthStencilState;
ID3D11DepthStencilView* m_depthStencilView;
ID3D11RasterizerState* m_rasterState;
XMMATRIX m_projectionMatrix;
XMMATRIX m_worldMatrix;
XMMATRIX m_orthoMatrix;
D3D11_VIEWPORT m_viewport;
ID3D11DepthStencilState* m_depthDisabledStencilState;
ID3D11BlendState* m_alphaEnableBlendingState;
ID3D11BlendState* m_alphaDisableBlendingState;
};
#endif

View File

@ -1 +0,0 @@
1 isosphere 0 10 0 0 0 -0 1 1 1 F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\Content/Assets/Kobject/isosphere.obj SUNLIGHT 1 Unknown 1 0 2 F:\Github_Repo\khaotic-engine-Reborn\enginecustom\assets\Texture\ground01.png F:\Github_Repo\khaotic-engine-Reborn\enginecustom\assets\Texture\dirt01.png 1 assets/Texture/BricksNRM2K.png 1 assets/Texture/BricksGLOSS2K.png 1 F:\Github_Repo\khaotic-engine-Reborn\enginecustom\assets\Texture\alpha01.png

View File

@ -1,29 +1,29 @@
#include "display_plane_class.h" #include "displayplaneclass.h"
display_plane_class::display_plane_class() DisplayPlaneClass::DisplayPlaneClass()
{ {
m_vertexBuffer = 0; m_vertexBuffer = 0;
m_indexBuffer = 0; m_indexBuffer = 0;
} }
display_plane_class::display_plane_class(const display_plane_class& other) DisplayPlaneClass::DisplayPlaneClass(const DisplayPlaneClass& other)
{ {
} }
display_plane_class::~display_plane_class() DisplayPlaneClass::~DisplayPlaneClass()
{ {
} }
bool display_plane_class::Initialize(ID3D11Device* device, float width, float height) bool DisplayPlaneClass::Initialize(ID3D11Device* device, float width, float height)
{ {
Logger::Get().Log("Initializing display_plane_class, width: " + std::to_string(width) + ", height: " + std::to_string(height), __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing DisplayPlaneClass, width: " + std::to_string(width) + ", height: " + std::to_string(height), __FILE__, __LINE__, Logger::LogLevel::Initialize);
bool result; bool result;
// initialize the vertex and index buffer that hold the geometry for the button. // Initialize the vertex and index buffer that hold the geometry for the button.
result = InitializeBuffers(device, width, height); result = InitializeBuffers(device, width, height);
if (!result) if (!result)
{ {
@ -35,7 +35,7 @@ bool display_plane_class::Initialize(ID3D11Device* device, float width, float he
} }
void display_plane_class::Shutdown() void DisplayPlaneClass::Shutdown()
{ {
// Release the vertex and index buffers. // Release the vertex and index buffers.
ShutdownBuffers(); ShutdownBuffers();
@ -44,7 +44,7 @@ void display_plane_class::Shutdown()
} }
void display_plane_class::Render(ID3D11DeviceContext* deviceContext) void DisplayPlaneClass::Render(ID3D11DeviceContext* deviceContext)
{ {
// Put the vertex and index buffers on the graphics pipeline to prepare them for drawing. // Put the vertex and index buffers on the graphics pipeline to prepare them for drawing.
RenderBuffers(deviceContext); RenderBuffers(deviceContext);
@ -53,12 +53,12 @@ void display_plane_class::Render(ID3D11DeviceContext* deviceContext)
} }
int display_plane_class::GetIndexCount() int DisplayPlaneClass::GetIndexCount()
{ {
return m_indexCount; return m_indexCount;
} }
bool display_plane_class::InitializeBuffers(ID3D11Device* device, float width, float height) bool DisplayPlaneClass::InitializeBuffers(ID3D11Device* device, float width, float height)
{ {
Logger::Get().Log("Initializing buffers", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing buffers", __FILE__, __LINE__, Logger::LogLevel::Initialize);
@ -164,7 +164,7 @@ bool display_plane_class::InitializeBuffers(ID3D11Device* device, float width, f
} }
void display_plane_class::ShutdownBuffers() void DisplayPlaneClass::ShutdownBuffers()
{ {
Logger::Get().Log("Shutting down Plane buffers", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Shutting down Plane buffers", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
@ -188,7 +188,7 @@ void display_plane_class::ShutdownBuffers()
} }
void display_plane_class::RenderBuffers(ID3D11DeviceContext* deviceContext) void DisplayPlaneClass::RenderBuffers(ID3D11DeviceContext* deviceContext)
{ {
unsigned int stride; unsigned int stride;
unsigned int offset; unsigned int offset;

View File

@ -5,13 +5,13 @@
/////////////////////// ///////////////////////
// MY CLASS INCLUDES // // MY CLASS INCLUDES //
/////////////////////// ///////////////////////
#include "d_3d_class.h" #include "d3dclass.h"
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Class name: display_plane_class // Class name: DisplayPlaneClass
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class display_plane_class class DisplayPlaneClass
{ {
private: private:
struct VertexType struct VertexType
@ -21,9 +21,9 @@ private:
}; };
public: public:
display_plane_class(); DisplayPlaneClass();
display_plane_class(const display_plane_class&); DisplayPlaneClass(const DisplayPlaneClass&);
~display_plane_class(); ~DisplayPlaneClass();
bool Initialize(ID3D11Device*, float, float); bool Initialize(ID3D11Device*, float, float);
void Shutdown(); void Shutdown();

View File

@ -19,68 +19,69 @@
</ProjectConfiguration> </ProjectConfiguration>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="alphamapshaderclass.cpp" />
<ClCompile Include="applicationclass.cpp" />
<ClCompile Include="bitmapclass.cpp" />
<ClCompile Include="Cameraclass.cpp" />
<ClCompile Include="CelShadingShader.cpp" />
<ClCompile Include="Colorshaderclass.cpp" />
<ClCompile Include="d3dclass.cpp" />
<ClCompile Include="frustum.cpp" />
<ClCompile Include="imguiManager.cpp" />
<ClCompile Include="include\backends\imgui_impl_dx11.cpp" /> <ClCompile Include="include\backends\imgui_impl_dx11.cpp" />
<ClCompile Include="include\backends\imgui_impl_win32.cpp" /> <ClCompile Include="include\backends\imgui_impl_win32.cpp" />
<ClCompile Include="include\imgui.cpp" /> <ClCompile Include="include\imgui.cpp" />
<ClCompile Include="include\imgui_demo.cpp" />
<ClCompile Include="include\imgui_draw.cpp" /> <ClCompile Include="include\imgui_draw.cpp" />
<ClCompile Include="include\imgui_tables.cpp" /> <ClCompile Include="include\imgui_tables.cpp" />
<ClCompile Include="include\imgui_widgets.cpp" /> <ClCompile Include="include\imgui_widgets.cpp" />
<ClCompile Include="displayplaneclass.cpp" />
<ClCompile Include="fontclass.cpp" />
<ClCompile Include="fontshaderclass.cpp" />
<ClCompile Include="fpsclass.cpp" />
<ClCompile Include="frustumclass.cpp" />
<ClCompile Include="include\Src\DDSTextureLoader.cpp" /> <ClCompile Include="include\Src\DDSTextureLoader.cpp" />
<ClCompile Include="include\Src\DirectXHelpers.cpp" /> <ClCompile Include="include\Src\DirectXHelpers.cpp" />
<ClCompile Include="include\Src\pch.cpp" /> <ClCompile Include="include\Src\pch.cpp" />
<ClCompile Include="include\Src\SimpleMath.cpp" /> <ClCompile Include="include\Src\SimpleMath.cpp" />
<ClCompile Include="include\Src\WICTextureLoader.cpp" /> <ClCompile Include="include\Src\WICTextureLoader.cpp" />
<ClCompile Include="src\src\shader\alpha_map_shader_class.cpp" /> <ClCompile Include="inputclass.cpp" />
<ClCompile Include="src\src\shader\celshade_class.cpp" /> <ClCompile Include="Lightclass.cpp" />
<ClCompile Include="src\src\shader\color_shader_class.cpp" /> <ClCompile Include="lightmapshaderclass.cpp" />
<ClCompile Include="src\src\shader\depth_shader_class.cpp" /> <ClCompile Include="Lightshaderclass.cpp" />
<ClCompile Include="src\src\shader\font_shader_class.cpp" /> <ClCompile Include="Main.cpp" />
<ClCompile Include="src\src\shader\light_map_shader_class.cpp" /> <ClCompile Include="modelclass.cpp" />
<ClCompile Include="src\src\shader\light_shader_class.cpp" /> <ClCompile Include="object.cpp" />
<ClCompile Include="src\src\shader\master_shader.cpp" /> <ClCompile Include="modellistclass.cpp" />
<ClCompile Include="src\src\shader\multi_texture_shader_class.cpp" /> <ClCompile Include="Multitextureshaderclass.cpp" />
<ClCompile Include="src\src\shader\normal_map_shader_class.cpp" /> <ClCompile Include="normalmapshaderclass.cpp" />
<ClCompile Include="src\src\shader\reflection_shader_class.cpp" /> <ClCompile Include="refractionshaderclass.cpp" />
<ClCompile Include="src\src\shader\refraction_shader_class.cpp" /> <ClCompile Include="shadermanagerclass.cpp" />
<ClCompile Include="src\src\shader\shader_manager_class.cpp" /> <ClCompile Include="physics.cpp" />
<ClCompile Include="src\src\shader\skybox_shader_class.cpp" /> <ClCompile Include="positionclass.cpp" />
<ClCompile Include="src\src\shader\spec_map_shader_class.cpp" /> <ClCompile Include="reflectionshaderclass.cpp" />
<ClCompile Include="src\src\shader\sunlight_shader_class.cpp" /> <ClCompile Include="rendertextureclass.cpp" />
<ClCompile Include="src\src\shader\texture_shader_class.cpp" /> <ClCompile Include="specmapshaderclass.cpp" />
<ClCompile Include="src\src\shader\translate_shader_class.cpp" /> <ClCompile Include="Spriteclass.cpp" />
<ClCompile Include="src\src\shader\transparent_shader_class.cpp" /> <ClCompile Include="Systemclass.cpp" />
<ClCompile Include="src\src\shader\water_shader_class.cpp" /> <ClCompile Include="textclass.cpp" />
<ClCompile Include="src\src\system\application_class.cpp" /> <ClCompile Include="textureclass.cpp" />
<ClCompile Include="src\src\system\bitmap_class.cpp" /> <ClCompile Include="textureshaderclass.cpp" />
<ClCompile Include="src\src\system\camera_class.cpp" /> <ClCompile Include="Timerclass.cpp" />
<ClCompile Include="src\src\system\d_3d_class.cpp" /> <ClCompile Include="translateshaderclass.cpp" />
<ClCompile Include="src\src\system\display_plane_class.cpp" /> <ClCompile Include="transparentshaderclass.cpp" />
<ClCompile Include="src\src\system\font_class.cpp" /> <ClCompile Include="watershaderclass.cpp" />
<ClCompile Include="src\src\system\fps_class.cpp" />
<ClCompile Include="src\src\system\frustum.cpp" />
<ClCompile Include="src\src\system\frustumclass.cpp" />
<ClCompile Include="src\src\system\imguiManager.cpp" />
<ClCompile Include="src\src\system\input_class.cpp" />
<ClCompile Include="src\src\system\light_class.cpp" />
<ClCompile Include="src\src\system\Main.cpp" />
<ClCompile Include="src\src\system\model_class.cpp" />
<ClCompile Include="src\src\system\Modellistclass.cpp" />
<ClCompile Include="src\src\system\object.cpp" />
<ClCompile Include="src\src\system\physics.cpp" />
<ClCompile Include="src\src\system\position_class.cpp" />
<ClCompile Include="src\src\system\render_texture_class.cpp" />
<ClCompile Include="src\src\system\scene_manager.cpp" />
<ClCompile Include="src\src\system\shadow_map.cpp" />
<ClCompile Include="src\src\system\Skybox.cpp" />
<ClCompile Include="src\src\system\sprite_class.cpp" />
<ClCompile Include="src\src\system\stats.cpp" />
<ClCompile Include="src\src\system\system_class.cpp" />
<ClCompile Include="src\src\system\text_class.cpp" />
<ClCompile Include="src\src\system\texture_class.cpp" />
<ClCompile Include="src\src\system\timer_class.cpp" />
<ClCompile Include="src\src\system\vulkan.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="alphamapshaderclass.h" />
<ClInclude Include="applicationclass.h" />
<ClInclude Include="bitmapclass.h" />
<ClInclude Include="Cameraclass.h" />
<ClInclude Include="CelShadingShader.h" />
<ClInclude Include="Colorshaderclass.h" />
<ClInclude Include="d3dclass.h" />
<ClInclude Include="frustum.h" />
<ClInclude Include="imguiManager.h" />
<ClInclude Include="include\backends\imgui_impl_dx11.h" /> <ClInclude Include="include\backends\imgui_impl_dx11.h" />
<ClInclude Include="include\backends\imgui_impl_win32.h" /> <ClInclude Include="include\backends\imgui_impl_win32.h" />
<ClInclude Include="include\imconfig.h" /> <ClInclude Include="include\imconfig.h" />
@ -89,346 +90,225 @@
<ClInclude Include="include\imstb_rectpack.h" /> <ClInclude Include="include\imstb_rectpack.h" />
<ClInclude Include="include\imstb_textedit.h" /> <ClInclude Include="include\imstb_textedit.h" />
<ClInclude Include="include\imstb_truetype.h" /> <ClInclude Include="include\imstb_truetype.h" />
<ClInclude Include="displayplaneclass.h" />
<ClInclude Include="fontclass.h" />
<ClInclude Include="fontshaderclass.h" />
<ClInclude Include="fpsclass.h" />
<ClInclude Include="frustumclass.h" />
<ClInclude Include="include\Src\CMO.h" /> <ClInclude Include="include\Src\CMO.h" />
<ClInclude Include="include\Src\DDS.h" /> <ClInclude Include="include\Src\DDS.h" />
<ClInclude Include="include\Src\LoaderHelpers.h" /> <ClInclude Include="include\Src\LoaderHelpers.h" />
<ClInclude Include="include\Src\pch.h" /> <ClInclude Include="include\Src\pch.h" />
<ClInclude Include="include\Src\PlatformHelpers.h" /> <ClInclude Include="include\Src\PlatformHelpers.h" />
<ClInclude Include="src\inc\shader\alpha_map_shader_class.h" /> <ClInclude Include="inputclass.h" />
<ClInclude Include="src\inc\shader\celshade_class.h" /> <ClInclude Include="lightclass.h" />
<ClInclude Include="src\inc\shader\color_shader_class.h" /> <ClInclude Include="lightmapshaderclass.h" />
<ClInclude Include="src\inc\shader\depth_shader_class.h" /> <ClInclude Include="lightshaderclass.h" />
<ClInclude Include="src\inc\shader\font_shader_class.h" /> <ClInclude Include="Logger.h" />
<ClInclude Include="src\inc\shader\light_map_shader_class.h" /> <ClInclude Include="modelclass.h" />
<ClInclude Include="src\inc\shader\light_shader_class.h" /> <ClInclude Include="object.h" />
<ClInclude Include="src\inc\shader\master_shader.h" /> <ClInclude Include="modellistclass.h" />
<ClInclude Include="src\inc\shader\multi_texture_shader_class.h" /> <ClInclude Include="Multitextureshaderclass.h" />
<ClInclude Include="src\inc\shader\normal_map_shader_class.h" /> <ClInclude Include="normalmapshaderclass.h" />
<ClInclude Include="src\inc\shader\reflection_shader_class.h" /> <ClInclude Include="refractionshaderclass.h" />
<ClInclude Include="src\inc\shader\refraction_shader_class.h" /> <ClInclude Include="shadermanagerclass.h" />
<ClInclude Include="src\inc\shader\shader_manager_class.h" /> <ClInclude Include="physics.h" />
<ClInclude Include="src\inc\shader\skybox_shader_class.h" /> <ClInclude Include="positionclass.h" />
<ClInclude Include="src\inc\shader\spec_map_shader_class.h" /> <ClInclude Include="reflectionshaderclass.h" />
<ClInclude Include="src\inc\shader\sunlight_shader_class.h" /> <ClInclude Include="rendertextureclass.h" />
<ClInclude Include="src\inc\shader\texture_shader_class.h" /> <ClInclude Include="resources.h" />
<ClInclude Include="src\inc\shader\translate_shader_class.h" /> <ClInclude Include="specmapshaderclass.h" />
<ClInclude Include="src\inc\shader\transparent_shader_class.h" /> <ClInclude Include="Spriteclass.h" />
<ClInclude Include="src\inc\shader\water_shader_class.h" /> <ClInclude Include="systemclass.h" />
<ClInclude Include="src\inc\system\application_class.h" /> <ClInclude Include="textclass.h" />
<ClInclude Include="src\inc\system\bitmap_class.h" /> <ClInclude Include="textureclass.h" />
<ClInclude Include="src\inc\system\camera_class.h" /> <ClInclude Include="textureshaderclass.h" />
<ClInclude Include="src\inc\system\d_3d_class.h" /> <ClInclude Include="Timerclass.h" />
<ClInclude Include="src\inc\system\display_plane_class.h" /> <ClInclude Include="translateshaderclass.h" />
<ClInclude Include="src\inc\system\font_class.h" /> <ClInclude Include="transparentshaderclass.h" />
<ClInclude Include="src\inc\system\fps_class.h" /> <ClInclude Include="watershaderclass.h" />
<ClInclude Include="src\inc\system\fps_limiter.h" />
<ClInclude Include="src\inc\system\frustum.h" />
<ClInclude Include="src\inc\system\frustumclass.h" />
<ClInclude Include="src\inc\system\imguiManager.h" />
<ClInclude Include="src\inc\system\input_class.h" />
<ClInclude Include="src\inc\system\light_class.h" />
<ClInclude Include="src\inc\system\Logger.h" />
<ClInclude Include="src\inc\system\model_class.h" />
<ClInclude Include="src\inc\system\Modellistclass.h" />
<ClInclude Include="src\inc\system\object.h" />
<ClInclude Include="src\inc\system\physics.h" />
<ClInclude Include="src\inc\system\position_class.h" />
<ClInclude Include="src\inc\system\render_texture_class.h" />
<ClInclude Include="src\inc\system\sceneManager.h" />
<ClInclude Include="src\inc\system\scene_manager.h" />
<ClInclude Include="src\inc\system\shadow_map.h" />
<ClInclude Include="src\inc\system\Skybox.h" />
<ClInclude Include="src\inc\system\sprite_class.h" />
<ClInclude Include="src\inc\system\stats.h" />
<ClInclude Include="src\inc\system\system_class.h" />
<ClInclude Include="src\inc\system\text_class.h" />
<ClInclude Include="src\inc\system\texture_class.h" />
<ClInclude Include="src\inc\system\timer_class.h" />
<ClInclude Include="src\inc\system\vulkan.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CopyFileToFolders Include="src\hlsl\alphamap.ps"> <CopyFileToFolders Include="alphamap.ps">
<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\alphamap.vs"> <CopyFileToFolders Include="alphamap.vs">
<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\celshading.ps"> <CopyFileToFolders Include="font.ps">
<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\celshading.vs"> <CopyFileToFolders Include="font.vs">
<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\Color.ps"> <CopyFileToFolders Include="light.ps">
<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\Color.vs"> <CopyFileToFolders Include="light.vs">
<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.ps"> <CopyFileToFolders Include="lightmap.ps">
<DestinationFolders>F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\\src\hlsl</DestinationFolders>
<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="lightmap.vs">
<DestinationFolders>F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\\src\hlsl</DestinationFolders>
<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="Multitexture.ps">
<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.vs"> <CopyFileToFolders Include="Multitexture.vs">
<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\light.ps"> <CopyFileToFolders Include="normalmap.ps">
<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\light.vs"> <CopyFileToFolders Include="normalmap.vs">
<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\lightmap.ps"> <CopyFileToFolders Include="..\KhaoticDemo\water.ps">
<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\lightmap.vs"> <CopyFileToFolders Include="celshading.ps">
<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\Multitexture.ps"> <CopyFileToFolders Include="celshading.vs">
<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\Multitexture.vs"> <None Include="packages.config" />
<CopyFileToFolders Include="reflection.ps">
<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\normalmap.ps"> <CopyFileToFolders Include="reflection.vs">
<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\normalmap.vs"> <CopyFileToFolders Include="specmap.ps">
<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\reflection.ps"> <CopyFileToFolders Include="specmap.vs">
<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\reflection.vs"> <CopyFileToFolders Include="texture.ps">
<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\refraction.ps"> <CopyFileToFolders Include="texture.vs">
<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\refraction.vs"> <CopyFileToFolders Include="transparent.ps">
<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.ps"> <CopyFileToFolders Include="transparent.vs">
<DestinationFolders>F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\\src\hlsl</DestinationFolders>
<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="refraction.ps">
<DestinationFolders>F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\\src\hlsl</DestinationFolders>
<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="refraction.vs">
<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.vs"> <CopyFileToFolders Include="water.vs">
<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\sunlight.ps"> </ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="Color.ps">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
<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\sunlight.vs"> <CopyFileToFolders Include="Color.vs">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
<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 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> </CopyFileToFolders>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CopyFileToFolders Include="font01.tga" /> <CopyFileToFolders Include="font01.tga" />
<CopyFileToFolders Include="assets\Texture\alpha01.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\Bricks2K.png"> <CopyFileToFolders Include="assets\Texture\Bricks2K.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\BricksGLOSS2K.png"> <CopyFileToFolders Include="assets\Texture\BricksGLOSS2K.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\BricksNRM2K.png"> <CopyFileToFolders Include="assets\Texture\BricksNRM2K.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Skybox\skybox.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Skybox</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Skybox</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\dirt01.png"> <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>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|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>
<CopyFileToFolders Include="assets\Texture\font01.png"> <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>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\ground01.png"> <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>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\light01.png"> <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>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\marble01.png"> <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>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\moss01.png"> <CopyFileToFolders Include="assets\Texture\moss01.png">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
</ExcludedFromBuild> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
<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>
<CopyFileToFolders Include="assets\Texture\normal01.png"> <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>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\spec02.png"> <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>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite01.png"> <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>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite02.png"> <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>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite03.png"> <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>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite04.png"> <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>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\stone01.png"> <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>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\stone01.tga"> <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>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\wall.png"> <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>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\wall01.png"> <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>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\water01.png"> <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>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\EmptyTexture.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture\</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<Image Include="KhaoticIcon.ico" /> <Image Include="KhaoticIcon.ico" />
<CopyFileToFolders Include="sprite01.tga" /> <CopyFileToFolders Include="sprite01.tga" />
@ -439,140 +319,93 @@
<ItemGroup> <ItemGroup>
<CopyFileToFolders Include="font01.txt" /> <CopyFileToFolders Include="font01.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="translate.ps">
<SubType>Designer</SubType>
<FileType>Document</FileType>
</CopyFileToFolders>
<CopyFileToFolders Include="translate.vs">
<SubType>Designer</SubType>
<FileType>Document</FileType>
</CopyFileToFolders>
</ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="resources.rc" /> <ResourceCompile Include="resources.rc" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="assets\Model\OBJ\86.obj">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\cone.obj">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\isosphere.obj">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\monke.obj">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\vaisseau.obj">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ\</DestinationFolders>
</CopyFileToFolders>
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="assets\Model\TXT\bath.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\chunk.txt">
<FileType>Text</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\cube.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\ground.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\plane.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\sphere.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\square.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\wall.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\water.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT\</DestinationFolders>
</CopyFileToFolders>
</ItemGroup>
<ItemGroup> <ItemGroup>
<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" />
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="assets\Model\OBJ\skysphere.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>
<None Include="assets\Texture\imgui.ini" />
<None Include="packages.config" />
</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"> <CopyFileToFolders Include="assets\Model\OBJ\plane.obj">
<FileType>Document</FileType> <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>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|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> </CopyFileToFolders>
</ItemGroup> </ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
@ -661,13 +494,12 @@
<SDLCheck>true</SDLCheck> <SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)enginecustom\include\backends;$(SolutionDir)enginecustom\include\Inc;$(SolutionDir)enginecustom\include;$(SolutionDir)enginecustom\src\inc\shader;$(SolutionDir)enginecustom\src\inc\system;$(SolutionDir)enginecustom\include\Vulkan\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)enginecustom\include\backends;$(SolutionDir)enginecustom\include\Inc;$(SolutionDir)enginecustom\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)enginecustom\include\Vulkan\Lib;$(SolutionDir)enginecustom\include\GLFW\lib-vc2022;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -679,14 +511,13 @@
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode> <ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard> <LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalIncludeDirectories>$(SolutionDir)enginecustom\include\backends;$(SolutionDir)enginecustom\include\Inc;$(SolutionDir)enginecustom\include;$(SolutionDir)enginecustom\src\inc\shader;$(SolutionDir)enginecustom\src\inc\system;$(SolutionDir)enginecustom\include\Vulkan\Include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(SolutionDir)enginecustom\include\backends;$(SolutionDir)enginecustom\include\Inc;$(SolutionDir)enginecustom\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>$(SolutionDir)enginecustom\include\Vulkan\Lib;$(SolutionDir)enginecustom\include\GLFW\lib-vc2022;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

View File

@ -52,20 +52,23 @@
<Filter Include="Fichiers d%27en-tête\Shader"> <Filter Include="Fichiers d%27en-tête\Shader">
<UniqueIdentifier>{e087647e-a306-4246-9320-bab0830bb634}</UniqueIdentifier> <UniqueIdentifier>{e087647e-a306-4246-9320-bab0830bb634}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Fichiers d%27en-tête\System">
<UniqueIdentifier>{14b07251-cf6d-4391-9fca-ec94e08d4427}</UniqueIdentifier>
</Filter>
<Filter Include="Fichiers sources\Shader"> <Filter Include="Fichiers sources\Shader">
<UniqueIdentifier>{3c669b93-a9fd-4b74-813f-f9780413f76b}</UniqueIdentifier> <UniqueIdentifier>{3c669b93-a9fd-4b74-813f-f9780413f76b}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Fichiers sources\System"> <Filter Include="Fichiers sources\System">
<UniqueIdentifier>{b2659b1e-695d-488e-9a1c-341691d312bc}</UniqueIdentifier> <UniqueIdentifier>{b2659b1e-695d-488e-9a1c-341691d312bc}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="Assets\Skybox">
<UniqueIdentifier>{4bfa47c6-e23c-4cae-a7af-3fc870a448e4}</UniqueIdentifier>
</Filter>
<Filter Include="Fichiers d%27en-tête\System">
<UniqueIdentifier>{567548ae-97a4-413e-8d44-86d6e8252487}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="Main.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="include\imgui_demo.cpp">
<Filter>Fichiers sources\ImGui</Filter>
</ClCompile>
<ClCompile Include="include\backends\imgui_impl_dx11.cpp"> <ClCompile Include="include\backends\imgui_impl_dx11.cpp">
<Filter>Fichiers sources\ImGui</Filter> <Filter>Fichiers sources\ImGui</Filter>
</ClCompile> </ClCompile>
@ -84,6 +87,33 @@
<ClCompile Include="include\imgui_widgets.cpp"> <ClCompile Include="include\imgui_widgets.cpp">
<Filter>Fichiers sources\ImGui</Filter> <Filter>Fichiers sources\ImGui</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="bitmapclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="fontclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="fpsclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="Spriteclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="textclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="fpsclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="frustumclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="modellistclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="displayplaneclass.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="include\Src\DDSTextureLoader.cpp"> <ClCompile Include="include\Src\DDSTextureLoader.cpp">
<Filter>Fichiers sources\DirectX Tool Kit</Filter> <Filter>Fichiers sources\DirectX Tool Kit</Filter>
</ClCompile> </ClCompile>
@ -99,155 +129,104 @@
<ClCompile Include="include\Src\WICTextureLoader.cpp"> <ClCompile Include="include\Src\WICTextureLoader.cpp">
<Filter>Fichiers sources\DirectX Tool Kit</Filter> <Filter>Fichiers sources\DirectX Tool Kit</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\src\system\frustum.cpp"> <ClCompile Include="alphamapshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="CelShadingShader.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="Colorshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="fontshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="lightmapshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="Lightshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="Multitextureshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="normalmapshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="reflectionshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="refractionshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="shadermanagerclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="specmapshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="watershaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="transparentshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="translateshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="textureshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="applicationclass.cpp">
<Filter>Fichiers sources\System</Filter> <Filter>Fichiers sources\System</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\src\system\frustumclass.cpp"> <ClCompile Include="Cameraclass.cpp">
<Filter>Fichiers sources\System</Filter> <Filter>Fichiers sources\System</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\src\system\imguiManager.cpp"> <ClCompile Include="d3dclass.cpp">
<Filter>Fichiers sources\System</Filter> <Filter>Fichiers sources\System</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\src\system\Main.cpp"> <ClCompile Include="imguiManager.cpp">
<Filter>Fichiers sources\System</Filter> <Filter>Fichiers sources\System</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\src\system\Modellistclass.cpp"> <ClCompile Include="inputclass.cpp">
<Filter>Fichiers sources\System</Filter> <Filter>Fichiers sources\System</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\src\system\object.cpp"> <ClCompile Include="Lightclass.cpp">
<Filter>Fichiers sources\System</Filter> <Filter>Fichiers sources\System</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\src\system\physics.cpp"> <ClCompile Include="object.cpp">
<Filter>Fichiers sources\System</Filter> <Filter>Fichiers sources\System</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\src\system\vulkan.cpp"> <ClCompile Include="physics.cpp">
<Filter>Fichiers sources</Filter> <Filter>Fichiers sources\System</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\src\system\Skybox.cpp"> <ClCompile Include="modelclass.cpp">
<Filter>Fichiers sources</Filter> <Filter>Fichiers sources\System</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\src\shader\alpha_map_shader_class.cpp"> <ClCompile Include="positionclass.cpp">
<Filter>Fichiers sources</Filter> <Filter>Fichiers sources\System</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\src\shader\celshade_class.cpp"> <ClCompile Include="rendertextureclass.cpp">
<Filter>Fichiers sources</Filter> <Filter>Fichiers sources\System</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\src\shader\color_shader_class.cpp"> <ClCompile Include="Systemclass.cpp">
<Filter>Fichiers sources</Filter> <Filter>Fichiers sources\System</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\src\shader\depth_shader_class.cpp"> <ClCompile Include="Timerclass.cpp">
<Filter>Fichiers sources</Filter> <Filter>Fichiers sources\System</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\src\shader\font_shader_class.cpp"> <ClCompile Include="textureclass.cpp">
<Filter>Fichiers sources</Filter> <Filter>Fichiers sources\System</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\src\shader\light_map_shader_class.cpp"> <ClCompile Include="frustum.cpp">
<Filter>Fichiers sources</Filter> <Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\light_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\master_shader.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\multi_texture_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\normal_map_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\reflection_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\refraction_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\shader_manager_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\skybox_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\spec_map_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\sunlight_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\texture_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\translate_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\transparent_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\water_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\application_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\bitmap_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\camera_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\d_3d_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\display_plane_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\font_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\fps_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\input_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\light_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\model_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\position_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\render_texture_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\shadow_map.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\sprite_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\system_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\text_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\texture_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\system\timer_class.cpp">
<Filter>Fichiers sources</Filter>
</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> </ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="systemclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="include\imconfig.h"> <ClInclude Include="include\imconfig.h">
<Filter>Fichiers d%27en-tête\ImGui</Filter> <Filter>Fichiers d%27en-tête\ImGui</Filter>
</ClInclude> </ClInclude>
@ -272,6 +251,33 @@
<ClInclude Include="include\backends\imgui_impl_win32.h"> <ClInclude Include="include\backends\imgui_impl_win32.h">
<Filter>Fichiers d%27en-tête\ImGui</Filter> <Filter>Fichiers d%27en-tête\ImGui</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="bitmapclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="fontclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="fpsclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="Spriteclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="textclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="fpsclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="frustumclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="modellistclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="displayplaneclass.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="include\Src\CMO.h"> <ClInclude Include="include\Src\CMO.h">
<Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter> <Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter>
</ClInclude> </ClInclude>
@ -287,158 +293,101 @@
<ClInclude Include="include\Src\PlatformHelpers.h"> <ClInclude Include="include\Src\PlatformHelpers.h">
<Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter> <Filter>Fichiers d%27en-tête\DirectX Tool Kit</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\inc\system\frustum.h"> <ClInclude Include="alphamapshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="CelShadingShader.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="Colorshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="fontshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="lightmapshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="lightshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="Multitextureshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="normalmapshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="reflectionshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="refractionshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="shadermanagerclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="specmapshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="textureshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="translateshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="transparentshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="watershaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="applicationclass.h">
<Filter>Fichiers d%27en-tête\System</Filter> <Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\inc\system\frustumclass.h"> <ClInclude Include="d3dclass.h">
<Filter>Fichiers d%27en-tête\System</Filter> <Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\inc\system\imguiManager.h"> <ClInclude Include="Cameraclass.h">
<Filter>Fichiers d%27en-tête\System</Filter> <Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\inc\system\Logger.h"> <ClInclude Include="imguiManager.h">
<Filter>Fichiers d%27en-tête\System</Filter> <Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\inc\system\Modellistclass.h"> <ClInclude Include="Logger.h">
<Filter>Fichiers d%27en-tête\System</Filter> <Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\inc\system\object.h"> <ClInclude Include="inputclass.h">
<Filter>Fichiers d%27en-tête\System</Filter> <Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\inc\system\physics.h"> <ClInclude Include="lightclass.h">
<Filter>Fichiers d%27en-tête\System</Filter> <Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\inc\system\sceneManager.h"> <ClInclude Include="modelclass.h">
<Filter>Fichiers d%27en-tête</Filter> <Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\inc\system\vulkan.h"> <ClInclude Include="physics.h">
<Filter>Fichiers d%27en-tête</Filter> <Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\inc\system\Skybox.h"> <ClInclude Include="Timerclass.h">
<Filter>Fichiers d%27en-tête</Filter> <Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\inc\shader\alpha_map_shader_class.h"> <ClInclude Include="textureclass.h">
<Filter>Fichiers d%27en-tête</Filter> <Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\inc\shader\celshade_class.h"> <ClInclude Include="resources.h">
<Filter>Fichiers d%27en-tête</Filter> <Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\inc\shader\color_shader_class.h"> <ClInclude Include="rendertextureclass.h">
<Filter>Fichiers d%27en-tête</Filter> <Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\inc\shader\depth_shader_class.h"> <ClInclude Include="positionclass.h">
<Filter>Fichiers d%27en-tête</Filter> <Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\inc\shader\font_shader_class.h"> <ClInclude Include="object.h">
<Filter>Fichiers d%27en-tête</Filter> <Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\inc\shader\light_map_shader_class.h"> <ClInclude Include="frustum.h">
<Filter>Fichiers d%27en-tête</Filter> <Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\light_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\master_shader.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\multi_texture_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\normal_map_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\reflection_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\refraction_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\shader_manager_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\skybox_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\spec_map_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\sunlight_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\texture_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\translate_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\transparent_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\water_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\application_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\bitmap_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\camera_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\d_3d_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\display_plane_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\font_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\fps_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\fps_limiter.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\input_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\light_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\model_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\position_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\render_texture_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\shadow_map.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\sprite_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\system_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\text_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\texture_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\timer_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</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> </ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -446,164 +395,122 @@
<Filter>Assets</Filter> <Filter>Assets</Filter>
</Image> </Image>
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="resources.rc"> <ResourceCompile Include="resources.rc">
<Filter>Fichiers de ressources</Filter> <Filter>Fichiers de ressources</Filter>
</ResourceCompile> </ResourceCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<CopyFileToFolders Include="font.vs">
<Filter>Fonts</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="font.ps">
<Filter>Fonts</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="Color.vs">
<Filter>shader</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="light.ps">
<Filter>shader</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="font01.txt"> <CopyFileToFolders Include="font01.txt">
<Filter>Fonts</Filter> <Filter>Fonts</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="font01.tga"> <CopyFileToFolders Include="font01.tga">
<Filter>fonts</Filter> <Filter>fonts</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="sprite_data_01.txt"> <CopyFileToFolders Include="sprite01.tga">
<Filter>Assets</Filter> <Filter>Assets</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="sprite01.tga">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="sprite02.tga"> <CopyFileToFolders Include="sprite02.tga">
<Filter>Assets\Texture</Filter> <Filter>Assets</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="sprite03.tga"> <CopyFileToFolders Include="sprite03.tga">
<Filter>Assets\Texture</Filter> <Filter>Assets</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="sprite04.tga"> <CopyFileToFolders Include="sprite04.tga">
<Filter>Assets\Texture</Filter> <Filter>Assets</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\alphamap.ps" /> <CopyFileToFolders Include="Color.ps">
<CopyFileToFolders Include="src\hlsl\alphamap.vs" /> <Filter>shader</Filter>
<CopyFileToFolders Include="src\hlsl\celshading.ps" />
<CopyFileToFolders Include="src\hlsl\celshading.vs" />
<CopyFileToFolders Include="src\hlsl\Color.ps" />
<CopyFileToFolders Include="src\hlsl\Color.vs" />
<CopyFileToFolders Include="src\hlsl\font.ps" />
<CopyFileToFolders Include="src\hlsl\font.vs" />
<CopyFileToFolders Include="src\hlsl\light.ps" />
<CopyFileToFolders Include="src\hlsl\light.vs" />
<CopyFileToFolders Include="src\hlsl\lightmap.ps" />
<CopyFileToFolders Include="src\hlsl\lightmap.vs" />
<CopyFileToFolders Include="src\hlsl\Multitexture.ps" />
<CopyFileToFolders Include="src\hlsl\Multitexture.vs" />
<CopyFileToFolders Include="src\hlsl\normalmap.ps" />
<CopyFileToFolders Include="src\hlsl\normalmap.vs" />
<CopyFileToFolders Include="src\hlsl\reflection.ps" />
<CopyFileToFolders Include="src\hlsl\reflection.vs" />
<CopyFileToFolders Include="src\hlsl\refraction.ps" />
<CopyFileToFolders Include="src\hlsl\refraction.vs" />
<CopyFileToFolders Include="src\hlsl\specmap.ps" />
<CopyFileToFolders Include="src\hlsl\specmap.vs" />
<CopyFileToFolders Include="src\hlsl\sunlight.ps" />
<CopyFileToFolders Include="src\hlsl\sunlight.vs" />
<CopyFileToFolders Include="src\hlsl\texture.ps" />
<CopyFileToFolders Include="src\hlsl\texture.vs" />
<CopyFileToFolders Include="src\hlsl\translate.ps" />
<CopyFileToFolders Include="src\hlsl\translate.vs" />
<CopyFileToFolders Include="src\hlsl\transparent.ps" />
<CopyFileToFolders Include="src\hlsl\transparent.vs" />
<CopyFileToFolders Include="src\hlsl\water.ps" />
<CopyFileToFolders Include="src\hlsl\water.vs" />
<CopyFileToFolders Include="src\hlsl\skybox.ps" />
<CopyFileToFolders Include="src\hlsl\skybox.vs" />
<CopyFileToFolders Include="assets\Model\OBJ\skysphere.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\BricksNRM2K.png"> <CopyFileToFolders Include="light.vs">
<Filter>shader</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="lightmap.ps">
<Filter>shader</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="lightmap.vs">
<Filter>shader</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="reflection.ps">
<Filter>shader</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="reflection.vs">
<Filter>shader</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="translate.ps">
<Filter>shader</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="translate.vs">
<Filter>shader</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="transparent.ps">
<Filter>shader</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="transparent.vs">
<Filter>shader</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="Multitexture.ps">
<Filter>Texture</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\BricksGLOSS2K.png"> <CopyFileToFolders Include="Multitexture.vs">
<Filter>Texture</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\Bricks2K.png"> <CopyFileToFolders Include="normalmap.ps">
<Filter>Texture</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Skybox\skybox.png"> <CopyFileToFolders Include="normalmap.vs">
<Filter>Assets\Skybox</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\depth.ps" />
<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> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\EmptyTexture.png"> <CopyFileToFolders Include="specmap.ps">
<Filter>Texture</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\font01.png"> <CopyFileToFolders Include="specmap.vs">
<Filter>Texture</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\ground01.png"> <CopyFileToFolders Include="texture.ps">
<Filter>Texture</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\light01.png"> <CopyFileToFolders Include="texture.vs">
<Filter>Texture</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\marble01.png"> <CopyFileToFolders Include="alphamap.vs">
<Filter>Texture</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\moss01.png"> <CopyFileToFolders Include="alphamap.ps">
<Filter>Texture</Filter> <Filter>Texture</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\normal01.png"> <CopyFileToFolders Include="refraction.ps">
<Filter>Texture</Filter> <Filter>shader</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\spec02.png"> <CopyFileToFolders Include="refraction.vs">
<Filter>Texture</Filter> <Filter>shader</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite01.png"> <CopyFileToFolders Include="..\KhaoticDemo\water.ps">
<Filter>Texture</Filter> <Filter>shader</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite02.png"> <CopyFileToFolders Include="water.vs">
<Filter>Texture</Filter> <Filter>shader</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite03.png"> <CopyFileToFolders Include="celshading.vs">
<Filter>Texture</Filter> <Filter>shader</Filter>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite04.png"> <CopyFileToFolders Include="celshading.ps">
<Filter>Texture</Filter> <Filter>shader</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>
<CopyFileToFolders Include="assets\Model\TXT\bath.txt"> <CopyFileToFolders Include="assets\Model\TXT\bath.txt">
<Filter>Assets\Model\TXT</Filter> <Filter>Assets\Model\TXT</Filter>
@ -632,11 +539,92 @@
<CopyFileToFolders Include="assets\Model\TXT\water.txt"> <CopyFileToFolders Include="assets\Model\TXT\water.txt">
<Filter>Assets\Model\TXT</Filter> <Filter>Assets\Model\TXT</Filter>
</CopyFileToFolders> </CopyFileToFolders>
</ItemGroup> <CopyFileToFolders Include="assets\Model\OBJ\vaisseau.obj">
<ItemGroup> <Filter>Assets\Model\OBJ</Filter>
<None Include="packages.config" /> </CopyFileToFolders>
<None Include="assets\Texture\imgui.ini"> <CopyFileToFolders Include="assets\Model\OBJ\monke.obj">
<Filter>Texture</Filter> <Filter>Assets\Model\OBJ</Filter>
</None> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\isosphere.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="sprite_data_01.txt">
<Filter>Assets</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\stone01.tga">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\alpha01.png">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\Bricks2K.png">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\BricksGLOSS2K.png">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\BricksNRM2K.png">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\dirt01.png">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\font01.png">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\ground01.png">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\light01.png">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\marble01.png">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\moss01.png">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\normal01.png">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\spec02.png">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite01.png">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite02.png">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite03.png">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite04.png">
<Filter>Fichiers de ressources</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\stone01.png">
<Filter>Fichiers de ressources</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\wall.png">
<Filter>Fichiers de ressources</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\wall01.png">
<Filter>Fichiers de ressources</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\water01.png">
<Filter>Fichiers de ressources</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\plane.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\EmptyTexture.png">
<Filter>Assets\Texture</Filter>
</CopyFileToFolders>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -9,6 +9,7 @@ cbuffer PixelBuffer
float4 pixelColor; float4 pixelColor;
}; };
////////////// //////////////
// TYPEDEFS // // TYPEDEFS //
////////////// //////////////
@ -24,18 +25,23 @@ struct PixelInputType
float4 FontPixelShader(PixelInputType input) : SV_TARGET float4 FontPixelShader(PixelInputType input) : SV_TARGET
{ {
float4 color; float4 color;
// Sample the texture pixel at this location. // Sample the texture pixel at this location.
color = shaderTexture.Sample(SampleType, input.tex); color = shaderTexture.Sample(SampleType, input.tex);
// If the color is black on the texture then discard this pixel. // If the color is black on the texture then treat this pixel as transparent.
if (color.r == 0.0f && color.g == 0.0f && color.b == 0.0f) if(color.r == 0.0f)
{ {
discard; color.a = 0.0f;
}
// 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.
else
{
color.a = 1.0f;
color = color * pixelColor;
} }
// 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.
color = color * pixelColor;
return color; return color;
} }

View File

@ -8,6 +8,7 @@ cbuffer MatrixBuffer
matrix projectionMatrix; matrix projectionMatrix;
}; };
////////////// //////////////
// TYPEDEFS // // TYPEDEFS //
////////////// //////////////
@ -23,12 +24,14 @@ struct PixelInputType
float2 tex : TEXCOORD0; float2 tex : TEXCOORD0;
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Vertex Shader // Vertex Shader
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
PixelInputType FontVertexShader(VertexInputType input) PixelInputType FontVertexShader(VertexInputType input)
{ {
PixelInputType output; PixelInputType output;
// Change the position vector to be 4 units for proper matrix calculations. // Change the position vector to be 4 units for proper matrix calculations.
input.position.w = 1.0f; input.position.w = 1.0f;
@ -37,9 +40,9 @@ PixelInputType FontVertexShader(VertexInputType input)
output.position = mul(input.position, worldMatrix); output.position = mul(input.position, worldMatrix);
output.position = mul(output.position, viewMatrix); output.position = mul(output.position, viewMatrix);
output.position = mul(output.position, projectionMatrix); output.position = mul(output.position, projectionMatrix);
// Store the texture coordinates for the pixel shader. // Store the texture coordinates for the pixel shader.
output.tex = input.tex; output.tex = input.tex;
return output; return output;
} }

View File

@ -1,22 +1,22 @@
#include "font_class.h" #include "fontclass.h"
font_class::font_class() FontClass::FontClass()
{ {
m_Font = 0; m_Font = 0;
m_Texture = 0; m_Texture = 0;
} }
font_class::font_class(const font_class& other) FontClass::FontClass(const FontClass& other)
{ {
} }
font_class::~font_class() FontClass::~FontClass()
{ {
} }
bool font_class::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceContext, int fontChoice) bool FontClass::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceContext, int fontChoice)
{ {
Logger::Get().Log("Initializing font class", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing font class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
@ -66,7 +66,7 @@ bool font_class::Initialize(ID3D11Device* device, ID3D11DeviceContext* deviceCon
return true; return true;
} }
void font_class::Shutdown() void FontClass::Shutdown()
{ {
// Release the font texture. // Release the font texture.
ReleaseTexture(); ReleaseTexture();
@ -77,7 +77,7 @@ void font_class::Shutdown()
return; return;
} }
bool font_class::LoadFontData(char* filename) bool FontClass::LoadFontData(char* filename)
{ {
Logger::Get().Log(("Loading font data from %s", filename), __FILE__, __LINE__); Logger::Get().Log(("Loading font data from %s", filename), __FILE__, __LINE__);
@ -123,7 +123,7 @@ bool font_class::LoadFontData(char* filename)
return true; return true;
} }
void font_class::ReleaseFontData() void FontClass::ReleaseFontData()
{ {
// Release the font data array. // Release the font data array.
if (m_Font) if (m_Font)
@ -135,7 +135,7 @@ void font_class::ReleaseFontData()
return; return;
} }
bool font_class::LoadTexture(ID3D11Device* device, ID3D11DeviceContext* deviceContext, char* filename) bool FontClass::LoadTexture(ID3D11Device* device, ID3D11DeviceContext* deviceContext, char* filename)
{ {
Logger::Get().Log(("Loading font texture from %s", filename), __FILE__, __LINE__); Logger::Get().Log(("Loading font texture from %s", filename), __FILE__, __LINE__);
@ -143,7 +143,7 @@ bool font_class::LoadTexture(ID3D11Device* device, ID3D11DeviceContext* deviceCo
// Create and initialize the font texture object. // Create and initialize the font texture object.
m_Texture = new texture_class; m_Texture = new TextureClass;
result = m_Texture->Initialize(device, deviceContext, filename); result = m_Texture->Initialize(device, deviceContext, filename);
if (!result) if (!result)
@ -157,7 +157,7 @@ bool font_class::LoadTexture(ID3D11Device* device, ID3D11DeviceContext* deviceCo
return true; return true;
} }
void font_class::ReleaseTexture() void FontClass::ReleaseTexture()
{ {
// Release the texture object. // Release the texture object.
if (m_Texture) if (m_Texture)
@ -170,12 +170,12 @@ void font_class::ReleaseTexture()
return; return;
} }
ID3D11ShaderResourceView* font_class::GetTexture() ID3D11ShaderResourceView* FontClass::GetTexture()
{ {
return m_Texture->GetTexture(); return m_Texture->GetTexture();
} }
void font_class::BuildVertexArray(void* vertices, char* sentence, float drawX, float drawY) void FontClass::BuildVertexArray(void* vertices, char* sentence, float drawX, float drawY)
{ {
VertexType* vertexPtr; VertexType* vertexPtr;
int numLetters, index, i, letter; int numLetters, index, i, letter;
@ -236,7 +236,7 @@ void font_class::BuildVertexArray(void* vertices, char* sentence, float drawX, f
return; return;
} }
int font_class::GetSentencePixelLength(char* sentence) int FontClass::GetSentencePixelLength(char* sentence)
{ {
int pixelLength, numLetters, i, letter; int pixelLength, numLetters, i, letter;
@ -262,7 +262,7 @@ int font_class::GetSentencePixelLength(char* sentence)
return pixelLength; return pixelLength;
} }
int font_class::GetFontHeight() int FontClass::GetFontHeight()
{ {
return (int)m_fontHeight; return (int)m_fontHeight;
} }

View File

@ -13,13 +13,13 @@ using namespace DirectX;
/////////////////////// ///////////////////////
// MY CLASS INCLUDES // // MY CLASS INCLUDES //
/////////////////////// ///////////////////////
#include "texture_class.h" #include "textureclass.h"
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Class name: font_class // Class name: FontClass
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class font_class class FontClass
{ {
private: private:
struct FontType struct FontType
@ -35,9 +35,9 @@ private:
}; };
public: public:
font_class(); FontClass();
font_class(const font_class&); FontClass(const FontClass&);
~font_class(); ~FontClass();
bool Initialize(ID3D11Device*, ID3D11DeviceContext*, int); bool Initialize(ID3D11Device*, ID3D11DeviceContext*, int);
void Shutdown(); void Shutdown();
@ -56,7 +56,7 @@ private:
private: private:
FontType* m_Font; FontType* m_Font;
texture_class* m_Texture; TextureClass* m_Texture;
float m_fontHeight; float m_fontHeight;
int m_spaceSize; int m_spaceSize;
}; };

View File

@ -1,30 +1,30 @@
#include "font_shader_class.h" #include "fontshaderclass.h"
font_shader_class::font_shader_class() FontShaderClass::FontShaderClass()
{ {
vertex_shader_ = 0; m_vertexShader = 0;
pixel_shader_ = 0; m_pixelShader = 0;
layout_ = 0; m_layout = 0;
matrix_buffer_ = 0; m_matrixBuffer = 0;
sample_state_ = 0; m_sampleState = 0;
pixel_buffer_ = 0; m_pixelBuffer = 0;
} }
font_shader_class::font_shader_class(const font_shader_class& other) FontShaderClass::FontShaderClass(const FontShaderClass& other)
{ {
} }
font_shader_class::~font_shader_class() FontShaderClass::~FontShaderClass()
{ {
} }
bool font_shader_class::initialize(ID3D11Device* device, HWND hwnd) bool FontShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
{ {
Logger::Get().Log("Initializing font_shader_class", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing FontShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize);
bool result; bool result;
wchar_t vsFilename[128]; wchar_t vsFilename[128];
@ -32,7 +32,7 @@ bool font_shader_class::initialize(ID3D11Device* device, HWND hwnd)
int error; int error;
// Set the filename of the vertex shader. // Set the filename of the vertex shader.
error = wcscpy_s(vsFilename, 128, L"src/hlsl/font.vs"); error = wcscpy_s(vsFilename, 128, L"font.vs");
if (error != 0) if (error != 0)
{ {
Logger::Get().Log("Error copying string", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error copying string", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -40,42 +40,42 @@ bool font_shader_class::initialize(ID3D11Device* device, HWND hwnd)
} }
// Set the filename of the pixel shader. // Set the filename of the pixel shader.
error = wcscpy_s(psFilename, 128, L"src/hlsl/font.ps"); error = wcscpy_s(psFilename, 128, L"font.ps");
if (error != 0) if (error != 0)
{ {
Logger::Get().Log("Error copying string", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error copying string", __FILE__, __LINE__, Logger::LogLevel::Error);
return false; return false;
} }
// initialize the vertex and pixel shaders. // Initialize the vertex and pixel shaders.
result = initialize_shader(device, hwnd, vsFilename, psFilename); result = InitializeShader(device, hwnd, vsFilename, psFilename);
if (!result) if (!result)
{ {
Logger::Get().Log("Error initializing shader", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error initializing shader", __FILE__, __LINE__, Logger::LogLevel::Error);
return false; return false;
} }
Logger::Get().Log("font_shader_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("FontShaderClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
return true; return true;
} }
void font_shader_class::shutdown() void FontShaderClass::Shutdown()
{ {
// shutdown the vertex and pixel shaders as well as the related objects. // Shutdown the vertex and pixel shaders as well as the related objects.
shutdown_shader(); ShutdownShader();
return; return;
} }
bool font_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, bool FontShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture, XMFLOAT4 pixelColor) XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture, XMFLOAT4 pixelColor)
{ {
bool result; bool result;
// Set the shader parameters that it will use for rendering. // Set the shader parameters that it will use for rendering.
result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, pixelColor); result = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, pixelColor);
if (!result) if (!result)
{ {
Logger::Get().Log("Error setting shader parameters", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error setting shader parameters", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -83,12 +83,12 @@ bool font_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCoun
} }
// Now render the prepared buffers with the shader. // Now render the prepared buffers with the shader.
render_shader(deviceContext, indexCount); RenderShader(deviceContext, indexCount);
return true; return true;
} }
bool font_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) bool FontShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
{ {
Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
@ -103,7 +103,7 @@ bool font_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR
D3D11_BUFFER_DESC pixelBufferDesc; D3D11_BUFFER_DESC pixelBufferDesc;
// initialize the pointers this function will use to null. // Initialize the pointers this function will use to null.
errorMessage = 0; errorMessage = 0;
vertexShaderBuffer = 0; vertexShaderBuffer = 0;
pixelShaderBuffer = 0; pixelShaderBuffer = 0;
@ -116,7 +116,7 @@ bool font_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR
// If the shader failed to compile it should have writen something to the error message. // If the shader failed to compile it should have writen something to the error message.
if (errorMessage) if (errorMessage)
{ {
output_shader_error_message(errorMessage, hwnd, vsFilename); OutputShaderErrorMessage(errorMessage, hwnd, vsFilename);
} }
// If there was nothing in the error message then it simply could not find the shader file itself. // If there was nothing in the error message then it simply could not find the shader file itself.
else else
@ -135,7 +135,7 @@ bool font_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR
// If the shader failed to compile it should have writen something to the error message. // If the shader failed to compile it should have writen something to the error message.
if (errorMessage) if (errorMessage)
{ {
output_shader_error_message(errorMessage, hwnd, psFilename); OutputShaderErrorMessage(errorMessage, hwnd, psFilename);
} }
// If there was nothing in the error message then it simply could not find the file itself. // If there was nothing in the error message then it simply could not find the file itself.
else else
@ -147,7 +147,7 @@ bool font_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR
} }
// Create the vertex shader from the buffer. // Create the vertex shader from the buffer.
result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_); result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &m_vertexShader);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Error creating vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error creating vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -155,7 +155,7 @@ bool font_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR
} }
// Create the pixel shader from the buffer. // Create the pixel shader from the buffer.
result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_); result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &m_pixelShader);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Error creating pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error creating pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -178,14 +178,13 @@ bool font_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR
polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT; polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA; polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
polygonLayout[1].InstanceDataStepRate = 0; polygonLayout[1].InstanceDataStepRate = 0;
// Get a count of the elements in the layout. // Get a count of the elements in the layout.
numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]); numElements = sizeof(polygonLayout) / sizeof(polygonLayout[0]);
// Create the vertex input layout. // Create the vertex input layout.
result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(), result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(),
vertexShaderBuffer->GetBufferSize(), &layout_); vertexShaderBuffer->GetBufferSize(), &m_layout);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Error creating input layout", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error creating input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -201,14 +200,14 @@ bool font_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR
// Setup the description of the dynamic matrix constant buffer that is in the vertex shader. // Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC; matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type); matrixBufferDesc.ByteWidth = sizeof(MatrixBufferType);
matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; matrixBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; matrixBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
matrixBufferDesc.MiscFlags = 0; matrixBufferDesc.MiscFlags = 0;
matrixBufferDesc.StructureByteStride = 0; matrixBufferDesc.StructureByteStride = 0;
// Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class. // Create the constant buffer pointer so we can access the vertex shader constant buffer from within this class.
result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_); result = device->CreateBuffer(&matrixBufferDesc, NULL, &m_matrixBuffer);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Error creating constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error creating constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -231,7 +230,7 @@ bool font_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
// Create the texture sampler state. // Create the texture sampler state.
result = device->CreateSamplerState(&samplerDesc, &sample_state_); result = device->CreateSamplerState(&samplerDesc, &m_sampleState);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Error creating sampler state", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error creating sampler state", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -240,14 +239,14 @@ bool font_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR
// Setup the description of the dynamic pixel constant buffer that is in the pixel shader. // Setup the description of the dynamic pixel constant buffer that is in the pixel shader.
pixelBufferDesc.Usage = D3D11_USAGE_DYNAMIC; pixelBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
pixelBufferDesc.ByteWidth = sizeof(pixel_buffer_type); pixelBufferDesc.ByteWidth = sizeof(PixelBufferType);
pixelBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; pixelBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
pixelBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; pixelBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
pixelBufferDesc.MiscFlags = 0; pixelBufferDesc.MiscFlags = 0;
pixelBufferDesc.StructureByteStride = 0; pixelBufferDesc.StructureByteStride = 0;
// Create the pixel constant buffer pointer so we can access the pixel shader constant buffer from within this class. // Create the pixel constant buffer pointer so we can access the pixel shader constant buffer from within this class.
result = device->CreateBuffer(&pixelBufferDesc, NULL, &pixel_buffer_); result = device->CreateBuffer(&pixelBufferDesc, NULL, &m_pixelBuffer);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Error creating constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error creating constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -259,50 +258,50 @@ bool font_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR
return true; return true;
} }
void font_shader_class::shutdown_shader() void FontShaderClass::ShutdownShader()
{ {
Logger::Get().Log("Shutting down shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Shutting down shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
// Release the pixel constant buffer. // Release the pixel constant buffer.
if (pixel_buffer_) if (m_pixelBuffer)
{ {
pixel_buffer_->Release(); m_pixelBuffer->Release();
pixel_buffer_ = 0; m_pixelBuffer = 0;
} }
// Release the sampler state. // Release the sampler state.
if (sample_state_) if (m_sampleState)
{ {
sample_state_->Release(); m_sampleState->Release();
sample_state_ = 0; m_sampleState = 0;
} }
// Release the matrix constant buffer. // Release the matrix constant buffer.
if (matrix_buffer_) if (m_matrixBuffer)
{ {
matrix_buffer_->Release(); m_matrixBuffer->Release();
matrix_buffer_ = 0; m_matrixBuffer = 0;
} }
// Release the layout. // Release the layout.
if (layout_) if (m_layout)
{ {
layout_->Release(); m_layout->Release();
layout_ = 0; m_layout = 0;
} }
// Release the pixel shader. // Release the pixel shader.
if (pixel_shader_) if (m_pixelShader)
{ {
pixel_shader_->Release(); m_pixelShader->Release();
pixel_shader_ = 0; m_pixelShader = 0;
} }
// Release the vertex shader. // Release the vertex shader.
if (vertex_shader_) if (m_vertexShader)
{ {
vertex_shader_->Release(); m_vertexShader->Release();
vertex_shader_ = 0; m_vertexShader = 0;
} }
Logger::Get().Log("Shader shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Shader shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
@ -310,7 +309,7 @@ void font_shader_class::shutdown_shader()
return; return;
} }
void font_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename) void FontShaderClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
{ {
char* compileErrors; char* compileErrors;
unsigned long long bufferSize, i; unsigned long long bufferSize, i;
@ -345,15 +344,15 @@ void font_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HW
return; return;
} }
bool font_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, bool FontShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture, XMFLOAT4 pixelColor) XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture, XMFLOAT4 pixelColor)
{ {
HRESULT result; HRESULT result;
D3D11_MAPPED_SUBRESOURCE mappedResource; D3D11_MAPPED_SUBRESOURCE mappedResource;
matrix_buffer_type* dataPtr; MatrixBufferType* dataPtr;
unsigned int bufferNumber; unsigned int bufferNumber;
pixel_buffer_type* dataPtr2; PixelBufferType* dataPtr2;
// Transpose the matrices to prepare them for the shader. // Transpose the matrices to prepare them for the shader.
@ -362,7 +361,7 @@ bool font_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext
projectionMatrix = XMMatrixTranspose(projectionMatrix); projectionMatrix = XMMatrixTranspose(projectionMatrix);
// Lock the constant buffer so it can be written to. // Lock the constant buffer so it can be written to.
result = deviceContext->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = deviceContext->Map(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Error mapping constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error mapping constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -370,7 +369,7 @@ bool font_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext
} }
// Get a pointer to the data in the constant buffer. // Get a pointer to the data in the constant buffer.
dataPtr = (matrix_buffer_type*)mappedResource.pData; dataPtr = (MatrixBufferType*)mappedResource.pData;
// Copy the matrices into the constant buffer. // Copy the matrices into the constant buffer.
dataPtr->world = worldMatrix; dataPtr->world = worldMatrix;
@ -378,19 +377,19 @@ bool font_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext
dataPtr->projection = projectionMatrix; dataPtr->projection = projectionMatrix;
// Unlock the constant buffer. // Unlock the constant buffer.
deviceContext->Unmap(matrix_buffer_, 0); deviceContext->Unmap(m_matrixBuffer, 0);
// Set the position of the constant buffer in the vertex shader. // Set the position of the constant buffer in the vertex shader.
bufferNumber = 0; bufferNumber = 0;
// Finally set the constant buffer in the vertex shader with the updated values. // Finally set the constant buffer in the vertex shader with the updated values.
deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_); deviceContext->VSSetConstantBuffers(bufferNumber, 1, &m_matrixBuffer);
// Set shader texture resource in the pixel shader. // Set shader texture resource in the pixel shader.
deviceContext->PSSetShaderResources(0, 1, &texture); deviceContext->PSSetShaderResources(0, 1, &texture);
// Lock the pixel constant buffer so it can be written to. // Lock the pixel constant buffer so it can be written to.
result = deviceContext->Map(pixel_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = deviceContext->Map(m_pixelBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Error mapping constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Error mapping constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -398,36 +397,36 @@ bool font_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext
} }
// Get a pointer to the data in the pixel constant buffer. // Get a pointer to the data in the pixel constant buffer.
dataPtr2 = (pixel_buffer_type*)mappedResource.pData; dataPtr2 = (PixelBufferType*)mappedResource.pData;
// Copy the pixel color into the pixel constant buffer. // Copy the pixel color into the pixel constant buffer.
dataPtr2->pixelColor = pixelColor; dataPtr2->pixelColor = pixelColor;
// Unlock the pixel constant buffer. // Unlock the pixel constant buffer.
deviceContext->Unmap(pixel_buffer_, 0); deviceContext->Unmap(m_pixelBuffer, 0);
// Set the position of the pixel constant buffer in the pixel shader. // Set the position of the pixel constant buffer in the pixel shader.
bufferNumber = 0; bufferNumber = 0;
// Now set the pixel constant buffer in the pixel shader with the updated value. // Now set the pixel constant buffer in the pixel shader with the updated value.
deviceContext->PSSetConstantBuffers(bufferNumber, 1, &pixel_buffer_); deviceContext->PSSetConstantBuffers(bufferNumber, 1, &m_pixelBuffer);
return true; return true;
} }
void font_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount) void FontShaderClass::RenderShader(ID3D11DeviceContext* deviceContext, int indexCount)
{ {
// Set the vertex input layout. // Set the vertex input layout.
deviceContext->IASetInputLayout(layout_); deviceContext->IASetInputLayout(m_layout);
// Set the vertex and pixel shaders that will be used to render this triangle. // Set the vertex and pixel shaders that will be used to render this triangle.
deviceContext->VSSetShader(vertex_shader_, NULL, 0); deviceContext->VSSetShader(m_vertexShader, NULL, 0);
deviceContext->PSSetShader(pixel_shader_, NULL, 0); deviceContext->PSSetShader(m_pixelShader, NULL, 0);
// Set the sampler state in the pixel shader. // Set the sampler state in the pixel shader.
deviceContext->PSSetSamplers(0, 1, &sample_state_); deviceContext->PSSetSamplers(0, 1, &m_sampleState);
// render the triangle. // Render the triangle.
deviceContext->DrawIndexed(indexCount, 0, 0); deviceContext->DrawIndexed(indexCount, 0, 0);
return; return;

View File

@ -0,0 +1,62 @@
#ifndef _FONTSHADERCLASS_H_
#define _FONTSHADERCLASS_H_
//////////////
// INCLUDES //
//////////////
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: FontShaderClass
////////////////////////////////////////////////////////////////////////////////
class FontShaderClass
{
private:
struct MatrixBufferType
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct PixelBufferType
{
XMFLOAT4 pixelColor;
};
public:
FontShaderClass();
FontShaderClass(const FontShaderClass&);
~FontShaderClass();
bool Initialize(ID3D11Device*, HWND);
void Shutdown();
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4);
private:
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void ShutdownShader();
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4);
void RenderShader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* m_vertexShader;
ID3D11PixelShader* m_pixelShader;
ID3D11InputLayout* m_layout;
ID3D11Buffer* m_matrixBuffer;
ID3D11SamplerState* m_sampleState;
ID3D11Buffer* m_pixelBuffer;
};
#endif

46
enginecustom/fpsclass.cpp Normal file
View File

@ -0,0 +1,46 @@
#include "fpsclass.h"
FpsClass::FpsClass()
{
}
FpsClass::FpsClass(const FpsClass& other)
{
}
FpsClass::~FpsClass()
{
}
void FpsClass::Initialize()
{
m_fps = 0;
m_count = 0;
m_startTime = timeGetTime();
return;
}
void FpsClass::Frame()
{
m_count++;
if (timeGetTime() >= (m_startTime + 1000))
{
m_fps = m_count;
m_count = 0;
m_startTime = timeGetTime();
}
return;
}
int FpsClass::GetFps()
{
return m_fps;
}

View File

@ -15,32 +15,22 @@
#include <mmsystem.h> #include <mmsystem.h>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Class name: fps_class // Class name: FpsClass
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class fps_class class FpsClass
{ {
public: public:
fps_class(); FpsClass();
fps_class(const fps_class&); FpsClass(const FpsClass&);
~fps_class(); ~FpsClass();
void Initialize(); void Initialize();
void Frame(); void Frame();
int GetFps(); int GetFps();
int GetMinFps() const;
int GetMaxFps() const;
float GetFrameTime() const;
void ResetStats();
private: private:
int m_fps, m_count; int m_fps, m_count;
unsigned long m_startTime; unsigned long m_startTime;
int m_minFps;
int m_maxFps;
float m_frameTime;
unsigned long m_previousTime;
}; };
#endif #endif

Some files were not shown because too many files have changed in this diff Show More