Compare commits

...

18 Commits

Author SHA1 Message Date
ae3fc21ffc Patch - Fix release and debug config - V11.2.1 2025-06-03 19:58:01 +02:00
315d259acd Minor - Stats Update - V11.2.0 2025-06-03 18:35:51 +02:00
2a1b474df0 Minor - architecture rework pt.2 - V11.1.0 2025-06-03 17:01:18 +02:00
d364517633 Major - Architecture Rework - 11.0.0 2025-06-03 16:29:44 +02:00
ce51c11b31 Minor - Add Unitest environment - V10.7.0 2025-06-02 14:15:18 +02:00
0e11ead55b Patch - Deth Shader integration for shadow map - V10.6.1 2025-05-28 15:02:43 +02:00
1af71960c3 Minor - Depth shader - V10.6.0 2025-05-28 13:24:53 +02:00
f20adee22f Patch - Sun camera Depth experiment - V10.5.3 2025-05-26 16:03:51 +02:00
eb2cd17ec3 Patch - Sun Camera - V10.5.2 2025-05-26 13:52:00 +02:00
dbd27d1fe7 Revert "Minor - Start Shadow Map - V10.5.0"
This reverts commit d6b7626446e965d3cf4567f5cd787511c9bbe4f3.
2025-05-25 16:12:39 +02:00
d6b7626446 Minor - Start Shadow Map - V10.5.0 2025-05-22 17:28:29 +02:00
f9d4523f09 Minor - Refactor name - V10.5.0 2025-05-21 16:40:27 +02:00
24203060be Actualiser README.md 2025-05-13 21:18:50 +00:00
8b77b189a8 Merge branch 'main' of http://gitea-ui.shiba-server.fr:19000/ShibaGit/khaotic-engine-Reborn 2025-05-13 21:50:17 +02:00
e5ee8fdad3 Patch Update - BigCube Is Back - V10.4.2 2025-05-13 21:50:05 +02:00
3a2d19dff4 Actualiser README.md 2025-05-13 13:01:35 +00:00
dbc7003569 Patch Update - Remove The """Instancing""" due to unwanted behavior - V10.4.1 2025-05-12 16:14:38 +02:00
c5bfa2e621 Minor Update - Loading Obj Model is now faster than f1 - V10.4.0 2025-05-12 14:18:43 +02:00
140 changed files with 9088 additions and 7769 deletions

View File

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

View File

@ -1,6 +1,7 @@
<component name="InspectionProjectProfileManager"> <component name="InspectionProjectProfileManager">
<profile version="1.0"> <profile version="1.0">
<option name="myName" value="Project Default" /> <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" /> <inspection_tool class="ReassignedToPlainText" enabled="false" level="WARNING" enabled_by_default="false" />
</profile> </profile>
</component> </component>

View File

@ -6,8 +6,8 @@
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="e81d6e08-efc7-40a0-909d-ec4943d948e9" name="Changes" comment=""> <list default="true" id="e81d6e08-efc7-40a0-909d-ec4943d948e9" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.KhaoticEngineReborn/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/enginecustom.vcxproj" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/imgui.ini" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/imgui.ini" afterDir="false" /> <change beforePath="$PROJECT_DIR$/enginecustom/imgui.ini" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/imgui.ini" afterDir="false" />
<change beforePath="$PROJECT_DIR$/enginecustom/src/src/system/imguiManager.cpp" beforeDir="false" afterPath="$PROJECT_DIR$/enginecustom/src/src/system/imguiManager.cpp" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
@ -21,12 +21,23 @@
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" /> <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component> </component>
<component name="HighlightingSettingsPerFile"> <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/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/Inc/VertexTypes.h" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/enginecustom/include/Vulkan/Include/vulkan/vulkan_core.h" root0="SKIP_HIGHLIGHTING" /> <setting file="file://$PROJECT_DIR$/enginecustom/include/Vulkan/Include/vulkan/vulkan_core.h" root0="SKIP_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/enginecustom/src/src/shader/CelShadingShader.cpp" root0="FORCE_HIGHLIGHTING" />
<setting file="file://$PROJECT_DIR$/../../IDE_VS/VC/Tools/MSVC/14.38.33130/include/type_traits" root0="SKIP_HIGHLIGHTING" /> <setting file="file://$PROJECT_DIR$/../../IDE_VS/VC/Tools/MSVC/14.38.33130/include/type_traits" root0="SKIP_HIGHLIGHTING" />
</component> </component>
<component name="KubernetesApiPersistence">{}</component>
<component name="KubernetesApiProvider">{
&quot;isMigrated&quot;: true
}</component>
<component name="MetaFilesCheckinStateConfiguration" checkMetaFiles="true" /> <component name="MetaFilesCheckinStateConfiguration" checkMetaFiles="true" />
<component name="ProblemsViewState"> <component name="ProblemsViewState">
<option name="selectedTabId" value="CurrentFile" /> <option name="selectedTabId" value="CurrentFile" />
@ -35,29 +46,33 @@
&quot;associatedIndex&quot;: 6 &quot;associatedIndex&quot;: 6
}</component> }</component>
<component name="ProjectId" id="2sGIWDeT5ixyzDQ0he4A3RFpG9W" /> <component name="ProjectId" id="2sGIWDeT5ixyzDQ0he4A3RFpG9W" />
<component name="ProjectLevelVcsManager">
<ConfirmationsSetting value="2" id="Add" />
</component>
<component name="ProjectViewState"> <component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" /> <option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" /> <option name="showLibraryContents" value="true" />
</component> </component>
<component name="PropertiesComponent">{ <component name="PropertiesComponent"><![CDATA[{
&quot;keyToString&quot;: { "keyToString": {
&quot;ASKED_SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;, "ASKED_SHARE_PROJECT_CONFIGURATION_FILES": "true",
&quot;C++ Project.enginecustom.executor&quot;: &quot;Run&quot;, "C++ Project.enginecustom.executor": "Run",
&quot;C/C++ Project.enginecustom.executor&quot;: &quot;Run&quot;, "C/C++ Project.KhaoticDemo.executor": "Run",
&quot;RunOnceActivity.ShowReadmeOnStart&quot;: &quot;true&quot;, "C/C++ Project.enginecustom.executor": "Run",
&quot;RunOnceActivity.git.unshallow&quot;: &quot;true&quot;, "RunOnceActivity.ShowReadmeOnStart": "true",
&quot;SHARE_PROJECT_CONFIGURATION_FILES&quot;: &quot;true&quot;, "RunOnceActivity.git.unshallow": "true",
&quot;git-widget-placeholder&quot;: &quot;main&quot;, "SHARE_PROJECT_CONFIGURATION_FILES": "true",
&quot;ignore.virus.scanning.warn.message&quot;: &quot;true&quot;, "git-widget-placeholder": "main",
&quot;node.js.detected.package.eslint&quot;: &quot;true&quot;, "ignore.virus.scanning.warn.message": "true",
&quot;node.js.detected.package.tslint&quot;: &quot;true&quot;, "node.js.detected.package.eslint": "true",
&quot;node.js.selected.package.eslint&quot;: &quot;(autodetect)&quot;, "node.js.detected.package.tslint": "true",
&quot;node.js.selected.package.tslint&quot;: &quot;(autodetect)&quot;, "node.js.selected.package.eslint": "(autodetect)",
&quot;nodejs_package_manager_path&quot;: &quot;npm&quot;, "node.js.selected.package.tslint": "(autodetect)",
&quot;settings.editor.selected.configurable&quot;: &quot;preferences.build.unityPlugin&quot;, "nodejs_package_manager_path": "npm",
&quot;vue.rearranger.settings.migration&quot;: &quot;true&quot; "settings.editor.selected.configurable": "preferences.pluginManager",
"vue.rearranger.settings.migration": "true"
} }
}</component> }]]></component>
<component name="RunManager" selected="C/C++ Project.enginecustom"> <component name="RunManager" selected="C/C++ Project.enginecustom">
<configuration name="KhaoticDemo" type="CppProject" factoryName="C++ Project"> <configuration name="KhaoticDemo" type="CppProject" factoryName="C++ Project">
<configuration_1 setup="1"> <configuration_1 setup="1">
@ -179,7 +194,25 @@
<workItem from="1746538260893" duration="5781000" /> <workItem from="1746538260893" duration="5781000" />
<workItem from="1746546014271" duration="1814000" /> <workItem from="1746546014271" duration="1814000" />
<workItem from="1746619988287" duration="12282000" /> <workItem from="1746619988287" duration="12282000" />
<workItem from="1746711806997" duration="6619000" /> <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>
<task id="LOCAL-00001" summary="Minor update - viewport window tweak"> <task id="LOCAL-00001" summary="Minor update - viewport window tweak">
<option name="closed" value="true" /> <option name="closed" value="true" />

View File

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

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

View File

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

View File

@ -1,72 +0,0 @@
/////////////
// 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,9 +3,7 @@ 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}") = "enginecustom", "enginecustom\enginecustom.vcxproj", "{92CF56C4-76BB-40D4-8FE5-36C15F5F127A}" Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "KhaoticCore", "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
@ -23,14 +21,6 @@ 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** utilise **ImGui** avec une couche d'abstraction pour permetre son usage avec d'autres API. Ce moteur est basé sur **DirectX11** et utilise **ImGui** pour son interface graphique.
--- ---
Khaotic Engine is a rendering engine made in **C++** by a small team with the aim of learning how to use rendering APIs (OpenGL, DirectX 11/12 and Vulkan). Khaotic Engine is a rendering engine made in **C++** by a small team with the aim of learning how to use rendering APIs (OpenGL, DirectX 11/12 and Vulkan).
This **DirectX11** based engine uses **ImGui** with an abstraction layer to enable its use with other APIs. This **DirectX11** based engine uses **ImGui** for the user interface.
## Installation ## Installation
@ -64,7 +64,7 @@ This **DirectX11** based engine uses **ImGui** with an abstraction layer to enab
## Demo : ## Demo :
[![Demo Video](https://img.youtube.com/vi/qCOCTyB_97c/0.jpg)](https://youtu.be/DYgT1Nu7B4c) [![Demo Video](https://img.youtube.com/vi/CbK1a0Ar94Q/0.jpg)](https://youtu.be/CbK1a0Ar94Q)
## Engine Build by : ## Engine Build by :

View File

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

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

@ -4,28 +4,28 @@ Size=400,400
Collapsed=0 Collapsed=0
[Window][Khaotic Engine] [Window][Khaotic Engine]
Pos=1697,27 Pos=1281,19
Size=343,1094 Size=303,842
Collapsed=0 Collapsed=0
DockId=0x00000005,0 DockId=0x0000000F,0
[Window][Objects] [Window][Objects]
Pos=8,27 Pos=0,19
Size=289,547 Size=281,842
Collapsed=0
DockId=0x00000011,0
[Window][Terrain]
Pos=0,19
Size=280,842
Collapsed=0 Collapsed=0
DockId=0x00000007,0 DockId=0x00000007,0
[Window][Terrain]
Pos=8,576
Size=289,545
Collapsed=0
DockId=0x00000008,0
[Window][Light] [Window][Light]
Pos=8,27 Pos=0,19
Size=290,866 Size=281,842
Collapsed=0 Collapsed=0
DockId=0x0000000B,1 DockId=0x00000012,0
[Window][Shader Manager] [Window][Shader Manager]
Pos=8,27 Pos=8,27
@ -34,10 +34,10 @@ Collapsed=0
DockId=0x00000001,2 DockId=0x00000001,2
[Window][Engine Settings] [Window][Engine Settings]
Pos=8,27 Pos=1281,527
Size=289,547 Size=303,334
Collapsed=0 Collapsed=0
DockId=0x00000007,1 DockId=0x00000010,0
[Window][DockSpace Demo] [Window][DockSpace Demo]
Size=1584,861 Size=1584,861
@ -47,11 +47,11 @@ Collapsed=0
Pos=8,27 Pos=8,27
Size=1559,974 Size=1559,974
Collapsed=0 Collapsed=0
DockId=0x00000007,0 DockId=0x00000011,0
[Window][DockSpace] [Window][DockSpace]
Pos=0,0 Pos=0,0
Size=2048,1129 Size=1584,861
Collapsed=0 Collapsed=0
[Window][Add Object] [Window][Add Object]
@ -66,24 +66,41 @@ Collapsed=0
DockId=0x0000000C,0 DockId=0x0000000C,0
[Window][Log Window] [Window][Log Window]
Pos=8,37 Pos=0,636
Size=16,19 Size=1279,225
Collapsed=0 Collapsed=0
DockId=0x00000006,0 DockId=0x00000006,0
[Window][Render Stats]
Pos=0,636
Size=1279,225
Collapsed=0
DockId=0x00000004,0
[Window][render Window]
Pos=16,718
Size=997,758
Collapsed=1
[Docking][Data] [Docking][Data]
DockSpace ID=0xC0DFADC4 Pos=8,27 Size=1568,826 Split=X DockSpace ID=0xC0DFADC4 Pos=8,27 Size=1568,826 Split=X
DockNode ID=0x00000001 Parent=0xC0DFADC4 SizeRef=330,1094 Selected=0x393905AB DockNode ID=0x00000001 Parent=0xC0DFADC4 SizeRef=330,1094 Selected=0x393905AB
DockNode ID=0x00000003 Parent=0xC0DFADC4 SizeRef=1700,1094 CentralNode=1 DockNode ID=0x00000003 Parent=0xC0DFADC4 SizeRef=1700,1094 CentralNode=1
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=8,27 Size=2032,1094 Split=Y DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=0,19 Size=1584,842 Split=X
DockNode ID=0x00000004 Parent=0xCCBD8CF7 SizeRef=1568,598 Split=X DockNode ID=0x00000002 Parent=0xCCBD8CF7 SizeRef=1743,826 Split=Y
DockNode ID=0x00000009 Parent=0x00000004 SizeRef=289,974 Split=Y Selected=0x031DC75C DockNode ID=0x0000000A Parent=0x00000002 SizeRef=1568,599 Split=X
DockNode ID=0x00000007 Parent=0x00000009 SizeRef=289,547 Selected=0x0B098C4B DockNode ID=0x00000009 Parent=0x0000000A SizeRef=281,974 Split=Y Selected=0x031DC75C
DockNode ID=0x00000008 Parent=0x00000009 SizeRef=289,545 Selected=0x393905AB DockNode ID=0x00000011 Parent=0x00000009 SizeRef=281,441 Selected=0x031DC75C
DockNode ID=0x0000000D Parent=0x00000004 SizeRef=1613,974 Split=X DockNode ID=0x00000012 Parent=0x00000009 SizeRef=281,440 Selected=0x321620B2
DockNode ID=0x00000002 Parent=0x0000000D SizeRef=1268,826 Split=Y DockNode ID=0x0000000D Parent=0x0000000A SizeRef=1460,974 Split=Y
DockNode ID=0x0000000B Parent=0x00000002 SizeRef=1568,637 CentralNode=1 DockNode ID=0x0000000B Parent=0x0000000D SizeRef=1568,637 Split=X Selected=0x321620B2
DockNode ID=0x0000000C Parent=0x00000002 SizeRef=1568,335 Selected=0x139FDA3F DockNode ID=0x00000007 Parent=0x0000000B SizeRef=280,883 Selected=0x393905AB
DockNode ID=0x00000005 Parent=0x0000000D SizeRef=343,826 Selected=0x9F035453 DockNode ID=0x00000008 Parent=0x0000000B SizeRef=1178,883 CentralNode=1 Selected=0x4FC83240
DockNode ID=0x00000006 Parent=0xCCBD8CF7 SizeRef=1568,226 Selected=0xAB74BEE9 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 +1 @@
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\stone01.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 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

@ -30,49 +30,54 @@
<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\alphamapshaderclass.cpp" /> <ClCompile Include="src\src\shader\alpha_map_shader_class.cpp" />
<ClCompile Include="src\src\shader\CelShadingShader.cpp" /> <ClCompile Include="src\src\shader\celshade_class.cpp" />
<ClCompile Include="src\src\shader\Colorshaderclass.cpp" /> <ClCompile Include="src\src\shader\color_shader_class.cpp" />
<ClCompile Include="src\src\shader\fontshaderclass.cpp" /> <ClCompile Include="src\src\shader\depth_shader_class.cpp" />
<ClCompile Include="src\src\shader\lightmapshaderclass.cpp" /> <ClCompile Include="src\src\shader\font_shader_class.cpp" />
<ClCompile Include="src\src\shader\lightshaderclass.cpp" /> <ClCompile Include="src\src\shader\light_map_shader_class.cpp" />
<ClCompile Include="src\src\shader\Multitextureshaderclass.cpp" /> <ClCompile Include="src\src\shader\light_shader_class.cpp" />
<ClCompile Include="src\src\shader\normalmapshaderclass.cpp" /> <ClCompile Include="src\src\shader\master_shader.cpp" />
<ClCompile Include="src\src\shader\reflectionshaderclass.cpp" /> <ClCompile Include="src\src\shader\multi_texture_shader_class.cpp" />
<ClCompile Include="src\src\shader\refractionshaderclass.cpp" /> <ClCompile Include="src\src\shader\normal_map_shader_class.cpp" />
<ClCompile Include="src\src\shader\shadermanagerclass.cpp" /> <ClCompile Include="src\src\shader\reflection_shader_class.cpp" />
<ClCompile Include="src\src\shader\SkyboxShaderClass.cpp" /> <ClCompile Include="src\src\shader\refraction_shader_class.cpp" />
<ClCompile Include="src\src\shader\specmapshaderclass.cpp" /> <ClCompile Include="src\src\shader\shader_manager_class.cpp" />
<ClCompile Include="src\src\shader\sunlightshaderclass.cpp" /> <ClCompile Include="src\src\shader\skybox_shader_class.cpp" />
<ClCompile Include="src\src\shader\textureshaderclass.cpp" /> <ClCompile Include="src\src\shader\spec_map_shader_class.cpp" />
<ClCompile Include="src\src\shader\translateshaderclass.cpp" /> <ClCompile Include="src\src\shader\sunlight_shader_class.cpp" />
<ClCompile Include="src\src\shader\transparentshaderclass.cpp" /> <ClCompile Include="src\src\shader\texture_shader_class.cpp" />
<ClCompile Include="src\src\shader\watershaderclass.cpp" /> <ClCompile Include="src\src\shader\translate_shader_class.cpp" />
<ClCompile Include="src\src\system\applicationclass.cpp" /> <ClCompile Include="src\src\shader\transparent_shader_class.cpp" />
<ClCompile Include="src\src\system\bitmapclass.cpp" /> <ClCompile Include="src\src\shader\water_shader_class.cpp" />
<ClCompile Include="src\src\system\Cameraclass.cpp" /> <ClCompile Include="src\src\system\application_class.cpp" />
<ClCompile Include="src\src\system\d3dclass.cpp" /> <ClCompile Include="src\src\system\bitmap_class.cpp" />
<ClCompile Include="src\src\system\displayplaneclass.cpp" /> <ClCompile Include="src\src\system\camera_class.cpp" />
<ClCompile Include="src\src\system\fontclass.cpp" /> <ClCompile Include="src\src\system\d_3d_class.cpp" />
<ClCompile Include="src\src\system\fpsclass.cpp" /> <ClCompile Include="src\src\system\display_plane_class.cpp" />
<ClCompile Include="src\src\system\font_class.cpp" />
<ClCompile Include="src\src\system\fps_class.cpp" />
<ClCompile Include="src\src\system\frustum.cpp" /> <ClCompile Include="src\src\system\frustum.cpp" />
<ClCompile Include="src\src\system\frustumclass.cpp" /> <ClCompile Include="src\src\system\frustumclass.cpp" />
<ClCompile Include="src\src\system\imguiManager.cpp" /> <ClCompile Include="src\src\system\imguiManager.cpp" />
<ClCompile Include="src\src\system\inputclass.cpp" /> <ClCompile Include="src\src\system\input_class.cpp" />
<ClCompile Include="src\src\system\lightclass.cpp" /> <ClCompile Include="src\src\system\light_class.cpp" />
<ClCompile Include="src\src\system\Main.cpp" /> <ClCompile Include="src\src\system\Main.cpp" />
<ClCompile Include="src\src\system\modelclass.cpp" /> <ClCompile Include="src\src\system\model_class.cpp" />
<ClCompile Include="src\src\system\Modellistclass.cpp" /> <ClCompile Include="src\src\system\Modellistclass.cpp" />
<ClCompile Include="src\src\system\object.cpp" /> <ClCompile Include="src\src\system\object.cpp" />
<ClCompile Include="src\src\system\physics.cpp" /> <ClCompile Include="src\src\system\physics.cpp" />
<ClCompile Include="src\src\system\Positionclass.cpp" /> <ClCompile Include="src\src\system\position_class.cpp" />
<ClCompile Include="src\src\system\rendertextureclass.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\Skybox.cpp" />
<ClCompile Include="src\src\system\Spriteclass.cpp" /> <ClCompile Include="src\src\system\sprite_class.cpp" />
<ClCompile Include="src\src\system\Systemclass.cpp" /> <ClCompile Include="src\src\system\stats.cpp" />
<ClCompile Include="src\src\system\textclass.cpp" /> <ClCompile Include="src\src\system\system_class.cpp" />
<ClCompile Include="src\src\system\textureclass.cpp" /> <ClCompile Include="src\src\system\text_class.cpp" />
<ClCompile Include="src\src\system\Timerclass.cpp" /> <ClCompile Include="src\src\system\texture_class.cpp" />
<ClCompile Include="src\src\system\timer_class.cpp" />
<ClCompile Include="src\src\system\vulkan.cpp" /> <ClCompile Include="src\src\system\vulkan.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -89,51 +94,56 @@
<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\alphamapshaderclass.h" /> <ClInclude Include="src\inc\shader\alpha_map_shader_class.h" />
<ClInclude Include="src\inc\shader\CelShadingShader.h" /> <ClInclude Include="src\inc\shader\celshade_class.h" />
<ClInclude Include="src\inc\shader\Colorshaderclass.h" /> <ClInclude Include="src\inc\shader\color_shader_class.h" />
<ClInclude Include="src\inc\shader\fontshaderclass.h" /> <ClInclude Include="src\inc\shader\depth_shader_class.h" />
<ClInclude Include="src\inc\shader\lightmapshaderclass.h" /> <ClInclude Include="src\inc\shader\font_shader_class.h" />
<ClInclude Include="src\inc\shader\lightshaderclass.h" /> <ClInclude Include="src\inc\shader\light_map_shader_class.h" />
<ClInclude Include="src\inc\shader\lightshaderwaterclass.h" /> <ClInclude Include="src\inc\shader\light_shader_class.h" />
<ClInclude Include="src\inc\shader\Multitextureshaderclass.h" /> <ClInclude Include="src\inc\shader\master_shader.h" />
<ClInclude Include="src\inc\shader\normalmapshaderclass.h" /> <ClInclude Include="src\inc\shader\multi_texture_shader_class.h" />
<ClInclude Include="src\inc\shader\reflectionshaderclass.h" /> <ClInclude Include="src\inc\shader\normal_map_shader_class.h" />
<ClInclude Include="src\inc\shader\refractionshaderclass.h" /> <ClInclude Include="src\inc\shader\reflection_shader_class.h" />
<ClInclude Include="src\inc\shader\shadermanagerclass.h" /> <ClInclude Include="src\inc\shader\refraction_shader_class.h" />
<ClInclude Include="src\inc\shader\SkyboxShaderClass.h" /> <ClInclude Include="src\inc\shader\shader_manager_class.h" />
<ClInclude Include="src\inc\shader\specmapshaderclass.h" /> <ClInclude Include="src\inc\shader\skybox_shader_class.h" />
<ClInclude Include="src\inc\shader\sunlightshaderclass.h" /> <ClInclude Include="src\inc\shader\spec_map_shader_class.h" />
<ClInclude Include="src\inc\shader\textureshaderclass.h" /> <ClInclude Include="src\inc\shader\sunlight_shader_class.h" />
<ClInclude Include="src\inc\shader\translateshaderclass.h" /> <ClInclude Include="src\inc\shader\texture_shader_class.h" />
<ClInclude Include="src\inc\shader\transparentshaderclass.h" /> <ClInclude Include="src\inc\shader\translate_shader_class.h" />
<ClInclude Include="src\inc\shader\watershaderclass.h" /> <ClInclude Include="src\inc\shader\transparent_shader_class.h" />
<ClInclude Include="src\inc\system\applicationclass.h" /> <ClInclude Include="src\inc\shader\water_shader_class.h" />
<ClInclude Include="src\inc\system\bitmapclass.h" /> <ClInclude Include="src\inc\system\application_class.h" />
<ClInclude Include="src\inc\system\Cameraclass.h" /> <ClInclude Include="src\inc\system\bitmap_class.h" />
<ClInclude Include="src\inc\system\d3dclass.h" /> <ClInclude Include="src\inc\system\camera_class.h" />
<ClInclude Include="src\inc\system\displayplaneclass.h" /> <ClInclude Include="src\inc\system\d_3d_class.h" />
<ClInclude Include="src\inc\system\fontclass.h" /> <ClInclude Include="src\inc\system\display_plane_class.h" />
<ClInclude Include="src\inc\system\fpsclass.h" /> <ClInclude Include="src\inc\system\font_class.h" />
<ClInclude Include="src\inc\system\fps_class.h" />
<ClInclude Include="src\inc\system\fps_limiter.h" />
<ClInclude Include="src\inc\system\frustum.h" /> <ClInclude Include="src\inc\system\frustum.h" />
<ClInclude Include="src\inc\system\frustumclass.h" /> <ClInclude Include="src\inc\system\frustumclass.h" />
<ClInclude Include="src\inc\system\imguiManager.h" /> <ClInclude Include="src\inc\system\imguiManager.h" />
<ClInclude Include="src\inc\system\inputclass.h" /> <ClInclude Include="src\inc\system\input_class.h" />
<ClInclude Include="src\inc\system\lightclass.h" /> <ClInclude Include="src\inc\system\light_class.h" />
<ClInclude Include="src\inc\system\Logger.h" /> <ClInclude Include="src\inc\system\Logger.h" />
<ClInclude Include="src\inc\system\modelclass.h" /> <ClInclude Include="src\inc\system\model_class.h" />
<ClInclude Include="src\inc\system\Modellistclass.h" /> <ClInclude Include="src\inc\system\Modellistclass.h" />
<ClInclude Include="src\inc\system\object.h" /> <ClInclude Include="src\inc\system\object.h" />
<ClInclude Include="src\inc\system\physics.h" /> <ClInclude Include="src\inc\system\physics.h" />
<ClInclude Include="src\inc\system\Positionclass.h" /> <ClInclude Include="src\inc\system\position_class.h" />
<ClInclude Include="src\inc\system\rendertextureclass.h" /> <ClInclude Include="src\inc\system\render_texture_class.h" />
<ClInclude Include="src\inc\system\sceneManager.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\Skybox.h" />
<ClInclude Include="src\inc\system\Spriteclass.h" /> <ClInclude Include="src\inc\system\sprite_class.h" />
<ClInclude Include="src\inc\system\systemclass.h" /> <ClInclude Include="src\inc\system\stats.h" />
<ClInclude Include="src\inc\system\textclass.h" /> <ClInclude Include="src\inc\system\system_class.h" />
<ClInclude Include="src\inc\system\textureclass.h" /> <ClInclude Include="src\inc\system\text_class.h" />
<ClInclude Include="src\inc\system\Timerclass.h" /> <ClInclude Include="src\inc\system\texture_class.h" />
<ClInclude Include="src\inc\system\timer_class.h" />
<ClInclude Include="src\inc\system\vulkan.h" /> <ClInclude Include="src\inc\system\vulkan.h" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -167,6 +177,20 @@
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\depth.ps">
<DestinationFolders>F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\\src\hlsl</DestinationFolders>
<DestinationFileName>%(Filename)%(Extension)</DestinationFileName>
<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\depth.vs">
<DestinationFolders>F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\\src\hlsl</DestinationFolders>
<DestinationFileName>%(Filename)%(Extension)</DestinationFileName>
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\font.ps"> <CopyFileToFolders Include="src\hlsl\font.ps">
<FileType>Document</FileType> <FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
@ -241,11 +265,15 @@
<DestinationFolders>F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\\src\hlsl</DestinationFolders> <DestinationFolders>F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\\src\hlsl</DestinationFolders>
<DestinationFileName>%(Filename)%(Extension)</DestinationFileName> <DestinationFileName>%(Filename)%(Extension)</DestinationFileName>
<FileType>Document</FileType> <FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\skybox.vs"> <CopyFileToFolders Include="src\hlsl\skybox.vs">
<DestinationFolders>F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\\src\hlsl</DestinationFolders> <DestinationFolders>F:\Github_Repo\khaotic-engine-Reborn\x64\Debug\\src\hlsl</DestinationFolders>
<DestinationFileName>%(Filename)%(Extension)</DestinationFileName> <DestinationFileName>%(Filename)%(Extension)</DestinationFileName>
<FileType>Document</FileType> <FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\src\hlsl</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\src\hlsl</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="src\hlsl\specmap.ps"> <CopyFileToFolders Include="src\hlsl\specmap.ps">
<FileType>Document</FileType> <FileType>Document</FileType>
@ -326,6 +354,82 @@
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Skybox</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Skybox</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Skybox</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Skybox</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\dirt01.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\EmptyTexture.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\font01.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\ground01.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\light01.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\marble01.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\moss01.png">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
</ExcludedFromBuild>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\normal01.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\spec02.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite01.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite02.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite03.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite04.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\stone01.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\stone01.tga">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\wall.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\wall01.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\water01.png">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Texture</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Texture</DestinationFolders>
</CopyFileToFolders>
<Image Include="KhaoticIcon.ico" /> <Image Include="KhaoticIcon.ico" />
<CopyFileToFolders Include="sprite01.tga" /> <CopyFileToFolders Include="sprite01.tga" />
<CopyFileToFolders Include="sprite02.tga" /> <CopyFileToFolders Include="sprite02.tga" />
@ -342,6 +446,42 @@
<CopyFileToFolders Include="sprite_data_01.txt" /> <CopyFileToFolders Include="sprite_data_01.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="assets\Model\OBJ\86.obj" />
<Content Include="assets\Model\OBJ\cone.obj" />
<Content Include="assets\Model\OBJ\invertcube.obj" />
<Content Include="assets\Model\OBJ\isosphere.obj" />
<Content Include="assets\Model\OBJ\monke.obj" />
<Content Include="assets\Model\OBJ\plane.obj" />
<Content Include="assets\Model\OBJ\vaisseautri.obj" />
<Content Include="assets\Model\TXT\bath.txt" />
<Content Include="assets\Model\TXT\chunk.txt" />
<Content Include="assets\Model\TXT\cube.txt" />
<Content Include="assets\Model\TXT\ground.txt" />
<Content Include="assets\Model\TXT\plane.txt" />
<Content Include="assets\Model\TXT\sphere.txt" />
<Content Include="assets\Model\TXT\square.txt" />
<Content Include="assets\Model\TXT\wall.txt" />
<Content Include="assets\Model\TXT\water.txt" />
<CopyFileToFolders Include="assets\Texture\alpha01.png" />
<Content Include="assets\Texture\dirt01.png" />
<Content Include="assets\Texture\EmptyTexture.png" />
<Content Include="assets\Texture\font01.png" />
<Content Include="assets\Texture\ground01.png" />
<Content Include="assets\Texture\imgui.ini" />
<Content Include="assets\Texture\light01.png" />
<Content Include="assets\Texture\marble01.png" />
<Content Include="assets\Texture\moss01.png" />
<Content Include="assets\Texture\normal01.png" />
<Content Include="assets\Texture\spec02.png" />
<Content Include="assets\Texture\sprite01.png" />
<Content Include="assets\Texture\sprite02.png" />
<Content Include="assets\Texture\sprite03.png" />
<Content Include="assets\Texture\sprite04.png" />
<Content Include="assets\Texture\stone01.png" />
<Content Include="assets\Texture\stone01.tga" />
<Content Include="assets\Texture\wall.png" />
<Content Include="assets\Texture\wall01.png" />
<Content Include="assets\Texture\water01.png" />
<Content Include="TODO.txt" /> <Content Include="TODO.txt" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
@ -351,6 +491,90 @@
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders> <DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
</CopyFileToFolders> </CopyFileToFolders>
</ItemGroup> </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">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\vaisseau.obj">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\vaisseautri.obj">
<FileType>Document</FileType>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\OBJ</DestinationFolders>
</CopyFileToFolders>
</ItemGroup>
<ItemGroup>
<CopyFileToFolders Include="assets\Model\TXT\bath.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\chunk.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\cube.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\ground.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\plane.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\sphere.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\square.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\wall.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\water.txt">
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
<DestinationFolders Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)\assets\Model\TXT</DestinationFolders>
</CopyFileToFolders>
</ItemGroup>
<PropertyGroup Label="Globals"> <PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion> <VCProjectVersion>17.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>

View File

@ -99,75 +99,6 @@
<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\shader\alphamapshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\CelShadingShader.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\Colorshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\lightmapshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\lightshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\Multitextureshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\normalmapshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\reflectionshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\refractionshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\shadermanagerclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\specmapshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\sunlightshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\textureshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\translateshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\transparentshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\watershaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="src\src\system\applicationclass.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\bitmapclass.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\Cameraclass.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\d3dclass.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\displayplaneclass.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\fontclass.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\fpsclass.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\frustum.cpp"> <ClCompile Include="src\src\system\frustum.cpp">
<Filter>Fichiers sources\System</Filter> <Filter>Fichiers sources\System</Filter>
</ClCompile> </ClCompile>
@ -177,18 +108,9 @@
<ClCompile Include="src\src\system\imguiManager.cpp"> <ClCompile Include="src\src\system\imguiManager.cpp">
<Filter>Fichiers sources\System</Filter> <Filter>Fichiers sources\System</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\src\system\inputclass.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\lightclass.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\Main.cpp"> <ClCompile Include="src\src\system\Main.cpp">
<Filter>Fichiers sources\System</Filter> <Filter>Fichiers sources\System</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\src\system\modelclass.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\Modellistclass.cpp"> <ClCompile Include="src\src\system\Modellistclass.cpp">
<Filter>Fichiers sources\System</Filter> <Filter>Fichiers sources\System</Filter>
</ClCompile> </ClCompile>
@ -198,37 +120,130 @@
<ClCompile Include="src\src\system\physics.cpp"> <ClCompile Include="src\src\system\physics.cpp">
<Filter>Fichiers sources\System</Filter> <Filter>Fichiers sources\System</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\src\system\Positionclass.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\rendertextureclass.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\Spriteclass.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\Systemclass.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\textclass.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\textureclass.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\system\Timerclass.cpp">
<Filter>Fichiers sources\System</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\fontshaderclass.cpp">
<Filter>Fichiers sources\Shader</Filter>
</ClCompile>
<ClCompile Include="src\src\system\vulkan.cpp"> <ClCompile Include="src\src\system\vulkan.cpp">
<Filter>Fichiers sources</Filter> <Filter>Fichiers sources</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\src\shader\SkyboxShaderClass.cpp"> <ClCompile Include="src\src\system\Skybox.cpp">
<Filter>Fichiers sources</Filter> <Filter>Fichiers sources</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="src\src\system\Skybox.cpp"> <ClCompile Include="src\src\shader\alpha_map_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\celshade_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\color_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\depth_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\font_shader_class.cpp">
<Filter>Fichiers sources</Filter>
</ClCompile>
<ClCompile Include="src\src\shader\light_map_shader_class.cpp">
<Filter>Fichiers sources</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> <Filter>Fichiers sources</Filter>
</ClCompile> </ClCompile>
</ItemGroup> </ItemGroup>
@ -272,81 +287,6 @@
<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\shader\alphamapshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\CelShadingShader.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\Colorshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\fontshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\lightmapshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\lightshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\lightshaderwaterclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\Multitextureshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\normalmapshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\reflectionshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\refractionshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\shadermanagerclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\specmapshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\sunlightshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\textureshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\translateshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\transparentshaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\watershaderclass.h">
<Filter>Fichiers d%27en-tête\Shader</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\applicationclass.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\bitmapclass.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\Cameraclass.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\d3dclass.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\displayplaneclass.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\fontclass.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\fpsclass.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\frustum.h"> <ClInclude Include="src\inc\system\frustum.h">
<Filter>Fichiers d%27en-tête\System</Filter> <Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude> </ClInclude>
@ -356,18 +296,9 @@
<ClInclude Include="src\inc\system\imguiManager.h"> <ClInclude Include="src\inc\system\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\inputclass.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\lightclass.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\Logger.h"> <ClInclude Include="src\inc\system\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\modelclass.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\Modellistclass.h"> <ClInclude Include="src\inc\system\Modellistclass.h">
<Filter>Fichiers d%27en-tête\System</Filter> <Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude> </ClInclude>
@ -377,37 +308,136 @@
<ClInclude Include="src\inc\system\physics.h"> <ClInclude Include="src\inc\system\physics.h">
<Filter>Fichiers d%27en-tête\System</Filter> <Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\inc\system\Positionclass.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\rendertextureclass.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\Spriteclass.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\systemclass.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\textclass.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\textureclass.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\Timerclass.h">
<Filter>Fichiers d%27en-tête\System</Filter>
</ClInclude>
<ClInclude Include="src\inc\system\sceneManager.h"> <ClInclude Include="src\inc\system\sceneManager.h">
<Filter>Fichiers d%27en-tête</Filter> <Filter>Fichiers d%27en-tête</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\inc\system\vulkan.h"> <ClInclude Include="src\inc\system\vulkan.h">
<Filter>Fichiers d%27en-tête</Filter> <Filter>Fichiers d%27en-tête</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\inc\shader\SkyboxShaderClass.h"> <ClInclude Include="src\inc\system\Skybox.h">
<Filter>Fichiers d%27en-tête</Filter> <Filter>Fichiers d%27en-tête</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="src\inc\system\Skybox.h"> <ClInclude Include="src\inc\shader\alpha_map_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\celshade_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\color_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\depth_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\font_shader_class.h">
<Filter>Fichiers d%27en-tête</Filter>
</ClInclude>
<ClInclude Include="src\inc\shader\light_map_shader_class.h">
<Filter>Fichiers d%27en-tête</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> <Filter>Fichiers d%27en-tête</Filter>
</ClInclude> </ClInclude>
</ItemGroup> </ItemGroup>
@ -492,5 +522,121 @@
<CopyFileToFolders Include="assets\Skybox\skybox.png"> <CopyFileToFolders Include="assets\Skybox\skybox.png">
<Filter>Assets\Skybox</Filter> <Filter>Assets\Skybox</Filter>
</CopyFileToFolders> </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>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\EmptyTexture.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\font01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\ground01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\light01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\marble01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\moss01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\normal01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\spec02.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite02.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite03.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\sprite04.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\stone01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\stone01.tga">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\wall.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\wall01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Texture\water01.png">
<Filter>Texture</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\vaisseautri.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\vaisseau.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\plane.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\monke.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\isosphere.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\invertcube.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\cone.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\OBJ\86.obj">
<Filter>Assets\Model\OBJ</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\bath.txt">
<Filter>Assets\Model\TXT</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\chunk.txt">
<Filter>Assets\Model\TXT</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\cube.txt">
<Filter>Assets\Model\TXT</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\ground.txt">
<Filter>Assets\Model\TXT</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\plane.txt">
<Filter>Assets\Model\TXT</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\sphere.txt">
<Filter>Assets\Model\TXT</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\square.txt">
<Filter>Assets\Model\TXT</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\wall.txt">
<Filter>Assets\Model\TXT</Filter>
</CopyFileToFolders>
<CopyFileToFolders Include="assets\Model\TXT\water.txt">
<Filter>Assets\Model\TXT</Filter>
</CopyFileToFolders>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="assets\Texture\imgui.ini">
<Filter>Texture</Filter>
</None>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,97 +1,37 @@
[Window][DockSpace]
Pos=0,0
Size=1584,861
Collapsed=0
[Window][Debug##Default] [Window][Debug##Default]
Pos=60,60 Pos=60,60
Size=400,400 Size=400,400
Collapsed=0 Collapsed=0
[Window][Khaotic Engine] [Window][Khaotic Engine]
Pos=1745,19 Pos=1267,19
Size=303,1110 Size=317,842
Collapsed=0 Collapsed=0
DockId=0x00000005,0 DockId=0x00000002,0
[Window][Objects] [Window][render Stats]
Pos=0,19 Pos=275,630
Size=281,307 Size=1309,231
Collapsed=0
DockId=0x00000007,0
[Window][Terrain]
Pos=0,19
Size=281,883
Collapsed=0
DockId=0x00000008,0
[Window][Light]
Pos=0,328
Size=281,306
Collapsed=0
DockId=0x00000008,1
[Window][Shader Manager]
Pos=8,27
Size=330,487
Collapsed=0
DockId=0x00000001,2
[Window][Engine Settings]
Pos=0,19
Size=281,307
Collapsed=0
DockId=0x00000007,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=2048,1129
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=652,636
Size=649,225
Collapsed=0
DockId=0x00000006,0
[Window][Render Stats]
Pos=0,904
Size=1743,225
Collapsed=0 Collapsed=0
DockId=0x00000004,0 DockId=0x00000004,0
[Docking][Data] [Window][Objects]
DockSpace ID=0xC0DFADC4 Pos=8,27 Size=1568,826 Split=X Pos=0,19
DockNode ID=0x00000001 Parent=0xC0DFADC4 SizeRef=330,1094 Selected=0x393905AB Size=273,842
DockNode ID=0x00000003 Parent=0xC0DFADC4 SizeRef=1700,1094 CentralNode=1 Collapsed=0
DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=0,19 Size=2048,1110 Split=X DockId=0x00000005,0
DockNode ID=0x00000002 Parent=0xCCBD8CF7 SizeRef=1743,826 Split=Y
DockNode ID=0x0000000A Parent=0x00000002 SizeRef=1568,599 Split=X [Docking][Data]
DockNode ID=0x00000009 Parent=0x0000000A SizeRef=281,974 Split=Y Selected=0x031DC75C DockSpace ID=0xCCBD8CF7 Window=0x3DA2F1DE Pos=0,19 Size=1584,842 Split=X
DockNode ID=0x00000007 Parent=0x00000009 SizeRef=289,547 Selected=0x0B098C4B DockNode ID=0x00000005 Parent=0xCCBD8CF7 SizeRef=273,842 Selected=0x031DC75C
DockNode ID=0x00000008 Parent=0x00000009 SizeRef=289,545 Selected=0x393905AB DockNode ID=0x00000006 Parent=0xCCBD8CF7 SizeRef=1309,842 Split=Y
DockNode ID=0x0000000D Parent=0x0000000A SizeRef=1460,974 Split=Y DockNode ID=0x00000003 Parent=0x00000006 SizeRef=1584,609 Split=X
DockNode ID=0x0000000B Parent=0x0000000D SizeRef=1568,637 CentralNode=1 Selected=0x321620B2 DockNode ID=0x00000001 Parent=0x00000003 SizeRef=990,842 CentralNode=1
DockNode ID=0x0000000C Parent=0x0000000D SizeRef=1568,335 Selected=0x139FDA3F DockNode ID=0x00000002 Parent=0x00000003 SizeRef=317,842 Selected=0x9F035453
DockNode ID=0x0000000E Parent=0x00000002 SizeRef=1568,225 Split=X Selected=0xD99DEA49 DockNode ID=0x00000004 Parent=0x00000006 SizeRef=1584,231 Selected=0xF5D1BB37
DockNode ID=0x00000004 Parent=0x0000000E SizeRef=882,225 Selected=0xD99DEA49
DockNode ID=0x00000006 Parent=0x0000000E SizeRef=881,225 Selected=0xAB74BEE9
DockNode ID=0x00000005 Parent=0xCCBD8CF7 SizeRef=303,826 Selected=0x9F035453

View File

@ -340,10 +340,10 @@ namespace ImGui
IMGUI_API ImGuiIO& GetIO(); // access the ImGuiIO structure (mouse/keyboard/gamepad inputs, time, various configuration options/flags) IMGUI_API ImGuiIO& GetIO(); // access the ImGuiIO structure (mouse/keyboard/gamepad inputs, time, various configuration options/flags)
IMGUI_API ImGuiPlatformIO& GetPlatformIO(); // access the ImGuiPlatformIO structure (mostly hooks/functions to connect to platform/renderer and OS Clipboard, IME etc.) IMGUI_API ImGuiPlatformIO& GetPlatformIO(); // access the ImGuiPlatformIO structure (mostly hooks/functions to connect to platform/renderer and OS Clipboard, IME etc.)
IMGUI_API ImGuiStyle& GetStyle(); // access the Style structure (colors, sizes). Always use PushStyleColor(), PushStyleVar() to modify style mid-frame! IMGUI_API ImGuiStyle& GetStyle(); // access the Style structure (colors, sizes). Always use PushStyleColor(), PushStyleVar() to modify style mid-frame!
IMGUI_API void NewFrame(); // start a new Dear ImGui frame, you can submit any command from this point until Render()/EndFrame(). IMGUI_API void NewFrame(); // start a new Dear ImGui frame, you can submit any command from this point until render()/EndFrame().
IMGUI_API void EndFrame(); // ends the Dear ImGui frame. automatically called by Render(). If you don't need to render data (skipping rendering) you may call EndFrame() without Render()... but you'll have wasted CPU already! If you don't need to render, better to not create any windows and not call NewFrame() at all! IMGUI_API void EndFrame(); // ends the Dear ImGui frame. automatically called by render(). If you don't need to render data (skipping rendering) you may call EndFrame() without render()... but you'll have wasted CPU already! If you don't need to render, better to not create any windows and not call NewFrame() at all!
IMGUI_API void Render(); // ends the Dear ImGui frame, finalize the draw data. You can then get call GetDrawData(). IMGUI_API void Render(); // ends the Dear ImGui frame, finalize the draw data. You can then get call GetDrawData().
IMGUI_API ImDrawData* GetDrawData(); // valid after Render() and until the next call to NewFrame(). this is what you have to render. IMGUI_API ImDrawData* GetDrawData(); // valid after render() and until the next call to NewFrame(). this is what you have to render.
// Demo, Debug, Information // Demo, Debug, Information
IMGUI_API void ShowDemoWindow(bool* p_open = NULL); // create Demo window. demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application! IMGUI_API void ShowDemoWindow(bool* p_open = NULL); // create Demo window. demonstrate most ImGui features. call this to learn about the library! try to make it always available in your application!
@ -409,8 +409,8 @@ namespace ImGui
IMGUI_API float GetWindowDpiScale(); // get DPI scale currently associated to the current window's viewport. IMGUI_API float GetWindowDpiScale(); // get DPI scale currently associated to the current window's viewport.
IMGUI_API ImVec2 GetWindowPos(); // get current window position in screen space (IT IS UNLIKELY YOU EVER NEED TO USE THIS. Consider always using GetCursorScreenPos() and GetContentRegionAvail() instead) IMGUI_API ImVec2 GetWindowPos(); // get current window position in screen space (IT IS UNLIKELY YOU EVER NEED TO USE THIS. Consider always using GetCursorScreenPos() and GetContentRegionAvail() instead)
IMGUI_API ImVec2 GetWindowSize(); // get current window size (IT IS UNLIKELY YOU EVER NEED TO USE THIS. Consider always using GetCursorScreenPos() and GetContentRegionAvail() instead) IMGUI_API ImVec2 GetWindowSize(); // get current window size (IT IS UNLIKELY YOU EVER NEED TO USE THIS. Consider always using GetCursorScreenPos() and GetContentRegionAvail() instead)
IMGUI_API float GetWindowWidth(); // get current window width (IT IS UNLIKELY YOU EVER NEED TO USE THIS). Shortcut for GetWindowSize().x. IMGUI_API float GetWindowWidth(); // get current window width (IT IS UNLIKELY YOU EVER NEED TO USE THIS). Shortcut for get_window_size().x.
IMGUI_API float GetWindowHeight(); // get current window height (IT IS UNLIKELY YOU EVER NEED TO USE THIS). Shortcut for GetWindowSize().y. IMGUI_API float GetWindowHeight(); // get current window height (IT IS UNLIKELY YOU EVER NEED TO USE THIS). Shortcut for get_window_size().y.
IMGUI_API ImGuiViewport*GetWindowViewport(); // get viewport currently associated to the current window. IMGUI_API ImGuiViewport*GetWindowViewport(); // get viewport currently associated to the current window.
// Window manipulation // Window manipulation
@ -1048,7 +1048,7 @@ namespace ImGui
IMGUI_API bool IsMouseDragging(ImGuiMouseButton button, float lock_threshold = -1.0f); // is mouse dragging? (uses io.MouseDraggingThreshold if lock_threshold < 0.0f) IMGUI_API bool IsMouseDragging(ImGuiMouseButton button, float lock_threshold = -1.0f); // is mouse dragging? (uses io.MouseDraggingThreshold if lock_threshold < 0.0f)
IMGUI_API ImVec2 GetMouseDragDelta(ImGuiMouseButton button = 0, float lock_threshold = -1.0f); // return the delta from the initial clicking position while the mouse button is pressed or was just released. This is locked and return 0.0f until the mouse moves past a distance threshold at least once (uses io.MouseDraggingThreshold if lock_threshold < 0.0f) IMGUI_API ImVec2 GetMouseDragDelta(ImGuiMouseButton button = 0, float lock_threshold = -1.0f); // return the delta from the initial clicking position while the mouse button is pressed or was just released. This is locked and return 0.0f until the mouse moves past a distance threshold at least once (uses io.MouseDraggingThreshold if lock_threshold < 0.0f)
IMGUI_API void ResetMouseDragDelta(ImGuiMouseButton button = 0); // IMGUI_API void ResetMouseDragDelta(ImGuiMouseButton button = 0); //
IMGUI_API ImGuiMouseCursor GetMouseCursor(); // get desired mouse cursor shape. Important: reset in ImGui::NewFrame(), this is updated during the frame. valid before Render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you IMGUI_API ImGuiMouseCursor GetMouseCursor(); // get desired mouse cursor shape. Important: reset in ImGui::NewFrame(), this is updated during the frame. valid before render(). If you use software rendering by setting io.MouseDrawCursor ImGui will render those for you
IMGUI_API void SetMouseCursor(ImGuiMouseCursor cursor_type); // set desired mouse cursor shape IMGUI_API void SetMouseCursor(ImGuiMouseCursor cursor_type); // set desired mouse cursor shape
IMGUI_API void SetNextFrameWantCaptureMouse(bool want_capture_mouse); // Override io.WantCaptureMouse flag next frame (said flag is left for your application to handle, typical when true it instucts your app to ignore inputs). This is equivalent to setting "io.WantCaptureMouse = want_capture_mouse;" after the next NewFrame() call. IMGUI_API void SetNextFrameWantCaptureMouse(bool want_capture_mouse); // Override io.WantCaptureMouse flag next frame (said flag is left for your application to handle, typical when true it instucts your app to ignore inputs). This is equivalent to setting "io.WantCaptureMouse = want_capture_mouse;" after the next NewFrame() call.
@ -1091,7 +1091,7 @@ namespace ImGui
// Note: You may use GetWindowViewport() to get the current viewport of the current window. // Note: You may use GetWindowViewport() to get the current viewport of the current window.
IMGUI_API void UpdatePlatformWindows(); // call in main loop. will call CreateWindow/ResizeWindow/etc. platform functions for each secondary viewport, and DestroyWindow for each inactive viewport. IMGUI_API void UpdatePlatformWindows(); // call in main loop. will call CreateWindow/ResizeWindow/etc. platform functions for each secondary viewport, and DestroyWindow for each inactive viewport.
IMGUI_API void RenderPlatformWindowsDefault(void* platform_render_arg = NULL, void* renderer_render_arg = NULL); // call in main loop. will call RenderWindow/SwapBuffers platform functions for each secondary viewport which doesn't have the ImGuiViewportFlags_Minimized flag set. May be reimplemented by user for custom rendering needs. IMGUI_API void RenderPlatformWindowsDefault(void* platform_render_arg = NULL, void* renderer_render_arg = NULL); // call in main loop. will call RenderWindow/SwapBuffers platform functions for each secondary viewport which doesn't have the ImGuiViewportFlags_Minimized flag set. May be reimplemented by user for custom rendering needs.
IMGUI_API void DestroyPlatformWindows(); // call DestroyWindow platform functions for all viewports. call from backend Shutdown() if you need to close platform windows before imgui shutdown. otherwise will be called by DestroyContext(). IMGUI_API void DestroyPlatformWindows(); // call DestroyWindow platform functions for all viewports. call from backend shutdown() if you need to close platform windows before imgui shutdown. otherwise will be called by DestroyContext().
IMGUI_API ImGuiViewport* FindViewportByID(ImGuiID id); // this is a helper for backends. IMGUI_API ImGuiViewport* FindViewportByID(ImGuiID id); // this is a helper for backends.
IMGUI_API ImGuiViewport* FindViewportByPlatformHandle(void* platform_handle); // this is a helper for backends. the type platform_handle is decided by the backend (e.g. HWND, MyWindow*, GLFWwindow* etc.) IMGUI_API ImGuiViewport* FindViewportByPlatformHandle(void* platform_handle); // this is a helper for backends. the type platform_handle is decided by the backend (e.g. HWND, MyWindow*, GLFWwindow* etc.)
@ -1247,7 +1247,7 @@ enum ImGuiTreeNodeFlags_
ImGuiTreeNodeFlags_SpanAvailWidth = 1 << 11, // Extend hit box to the right-most edge, even if not framed. This is not the default in order to allow adding other items on the same line without using AllowOverlap mode. ImGuiTreeNodeFlags_SpanAvailWidth = 1 << 11, // Extend hit box to the right-most edge, even if not framed. This is not the default in order to allow adding other items on the same line without using AllowOverlap mode.
ImGuiTreeNodeFlags_SpanFullWidth = 1 << 12, // Extend hit box to the left-most and right-most edges (cover the indent area). ImGuiTreeNodeFlags_SpanFullWidth = 1 << 12, // Extend hit box to the left-most and right-most edges (cover the indent area).
ImGuiTreeNodeFlags_SpanLabelWidth = 1 << 13, // Narrow hit box + narrow hovering highlight, will only cover the label text. ImGuiTreeNodeFlags_SpanLabelWidth = 1 << 13, // Narrow hit box + narrow hovering highlight, will only cover the label text.
ImGuiTreeNodeFlags_SpanAllColumns = 1 << 14, // Frame will span all columns of its container table (label will still fit in current column) ImGuiTreeNodeFlags_SpanAllColumns = 1 << 14, // frame will span all columns of its container table (label will still fit in current column)
ImGuiTreeNodeFlags_LabelSpanAllColumns = 1 << 15, // Label will span all columns of its container table ImGuiTreeNodeFlags_LabelSpanAllColumns = 1 << 15, // Label will span all columns of its container table
//ImGuiTreeNodeFlags_NoScrollOnOpen = 1 << 16, // FIXME: TODO: Disable automatic scroll on TreePop() if node got just open and contents is not visible //ImGuiTreeNodeFlags_NoScrollOnOpen = 1 << 16, // FIXME: TODO: Disable automatic scroll on TreePop() if node got just open and contents is not visible
ImGuiTreeNodeFlags_NavLeftJumpsBackHere = 1 << 17, // (WIP) Nav: left direction may move to this TreeNode() from any of its child (items submitted between TreeNode and TreePop) ImGuiTreeNodeFlags_NavLeftJumpsBackHere = 1 << 17, // (WIP) Nav: left direction may move to this TreeNode() from any of its child (items submitted between TreeNode and TreePop)
@ -1289,7 +1289,7 @@ enum ImGuiSelectableFlags_
{ {
ImGuiSelectableFlags_None = 0, ImGuiSelectableFlags_None = 0,
ImGuiSelectableFlags_NoAutoClosePopups = 1 << 0, // Clicking this doesn't close parent popup window (overrides ImGuiItemFlags_AutoClosePopups) ImGuiSelectableFlags_NoAutoClosePopups = 1 << 0, // Clicking this doesn't close parent popup window (overrides ImGuiItemFlags_AutoClosePopups)
ImGuiSelectableFlags_SpanAllColumns = 1 << 1, // Frame will span all columns of its container table (text will still fit in current column) ImGuiSelectableFlags_SpanAllColumns = 1 << 1, // frame will span all columns of its container table (text will still fit in current column)
ImGuiSelectableFlags_AllowDoubleClick = 1 << 2, // Generate press events on double clicks too ImGuiSelectableFlags_AllowDoubleClick = 1 << 2, // Generate press events on double clicks too
ImGuiSelectableFlags_Disabled = 1 << 3, // Cannot be selected, display grayed out text ImGuiSelectableFlags_Disabled = 1 << 3, // Cannot be selected, display grayed out text
ImGuiSelectableFlags_AllowOverlap = 1 << 4, // (WIP) Hit testing to allow subsequent widgets to overlap this one ImGuiSelectableFlags_AllowOverlap = 1 << 4, // (WIP) Hit testing to allow subsequent widgets to overlap this one
@ -2251,7 +2251,7 @@ struct ImGuiStyle
float DockingSeparatorSize; // Thickness of resizing border between docked windows float DockingSeparatorSize; // Thickness of resizing border between docked windows
float MouseCursorScale; // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). We apply per-monitor DPI scaling over this scale. May be removed later. float MouseCursorScale; // Scale software rendered mouse cursor (when io.MouseDrawCursor is enabled). We apply per-monitor DPI scaling over this scale. May be removed later.
bool AntiAliasedLines; // Enable anti-aliased lines/borders. Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList). bool AntiAliasedLines; // Enable anti-aliased lines/borders. Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList).
bool AntiAliasedLinesUseTex; // Enable anti-aliased lines/borders using textures where possible. Require backend to render with bilinear filtering (NOT point/nearest filtering). Latched at the beginning of the frame (copied to ImDrawList). bool AntiAliasedLinesUseTex; // Enable anti-aliased lines/borders using textures_ where possible. Require backend to render with bilinear filtering (NOT point/nearest filtering). Latched at the beginning of the frame (copied to ImDrawList).
bool AntiAliasedFill; // Enable anti-aliased edges around filled shapes (rounded rectangles, circles, etc.). Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList). bool AntiAliasedFill; // Enable anti-aliased edges around filled shapes (rounded rectangles, circles, etc.). Disable if you are really tight on CPU/GPU. Latched at the beginning of the frame (copied to ImDrawList).
float CurveTessellationTol; // Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality. float CurveTessellationTol; // Tessellation tolerance when using PathBezierCurveTo() without a specific number of segments. Decrease for highly tessellated curves (higher quality, more polygons), increase to reduce quality.
float CircleTessellationMaxError; // Maximum error (in pixels) allowed when using AddCircle()/AddCircleFilled() or drawing rounded corner rectangles with no explicit segment count specified. Decrease for higher quality but more geometry. float CircleTessellationMaxError; // Maximum error (in pixels) allowed when using AddCircle()/AddCircleFilled() or drawing rounded corner rectangles with no explicit segment count specified. Decrease for higher quality but more geometry.
@ -2446,7 +2446,7 @@ struct ImGuiIO
#endif #endif
//------------------------------------------------------------------ //------------------------------------------------------------------
// Output - Updated by NewFrame() or EndFrame()/Render() // Output - Updated by NewFrame() or EndFrame()/render()
// (when reading from the io.WantCaptureMouse, io.WantCaptureKeyboard flags to dispatch your inputs, it is // (when reading from the io.WantCaptureMouse, io.WantCaptureKeyboard flags to dispatch your inputs, it is
// generally easier and more correct to use their state BEFORE calling NewFrame(). See FAQ for details!) // generally easier and more correct to use their state BEFORE calling NewFrame(). See FAQ for details!)
//------------------------------------------------------------------ //------------------------------------------------------------------
@ -2459,8 +2459,8 @@ struct ImGuiIO
bool NavActive; // Keyboard/Gamepad navigation is currently allowed (will handle ImGuiKey_NavXXX events) = a window is focused and it doesn't use the ImGuiWindowFlags_NoNavInputs flag. bool NavActive; // Keyboard/Gamepad navigation is currently allowed (will handle ImGuiKey_NavXXX events) = a window is focused and it doesn't use the ImGuiWindowFlags_NoNavInputs flag.
bool NavVisible; // Keyboard/Gamepad navigation highlight is visible and allowed (will handle ImGuiKey_NavXXX events). bool NavVisible; // Keyboard/Gamepad navigation highlight is visible and allowed (will handle ImGuiKey_NavXXX events).
float Framerate; // Estimate of application framerate (rolling average over 60 frames, based on io.DeltaTime), in frame per second. Solely for convenience. Slow applications may not want to use a moving average or may want to reset underlying buffers occasionally. float Framerate; // Estimate of application framerate (rolling average over 60 frames, based on io.DeltaTime), in frame per second. Solely for convenience. Slow applications may not want to use a moving average or may want to reset underlying buffers occasionally.
int MetricsRenderVertices; // Vertices output during last call to Render() int MetricsRenderVertices; // Vertices output during last call to render()
int MetricsRenderIndices; // Indices output during last call to Render() = number of triangles * 3 int MetricsRenderIndices; // Indices output during last call to render() = number of triangles * 3
int MetricsRenderWindows; // Number of visible windows int MetricsRenderWindows; // Number of visible windows
int MetricsActiveWindows; // Number of active windows int MetricsActiveWindows; // Number of active windows
ImVec2 MouseDelta; // Mouse delta. Note that this is zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX), so a disappearing/reappearing mouse won't have a huge delta. ImVec2 MouseDelta; // Mouse delta. Note that this is zero if either current or previous position are invalid (-FLT_MAX,-FLT_MAX), so a disappearing/reappearing mouse won't have a huge delta.
@ -3038,7 +3038,7 @@ struct ImGuiSelectionExternalStorage
// Hold a series of drawing commands. The user provides a renderer for ImDrawData which essentially contains an array of ImDrawList. // Hold a series of drawing commands. The user provides a renderer for ImDrawData which essentially contains an array of ImDrawList.
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// The maximum line width to bake anti-aliased textures for. Build atlas with ImFontAtlasFlags_NoBakedLines to disable baking. // The maximum line width to bake anti-aliased textures_ for. Build atlas with ImFontAtlasFlags_NoBakedLines to disable baking.
#ifndef IM_DRAWLIST_TEX_LINES_WIDTH_MAX #ifndef IM_DRAWLIST_TEX_LINES_WIDTH_MAX
#define IM_DRAWLIST_TEX_LINES_WIDTH_MAX (32) #define IM_DRAWLIST_TEX_LINES_WIDTH_MAX (32)
#endif #endif
@ -3057,7 +3057,7 @@ typedef void (*ImDrawCallback)(const ImDrawList* parent_list, const ImDrawCmd* c
// Special Draw callback value to request renderer backend to reset the graphics/render state. // Special Draw callback value to request renderer backend to reset the graphics/render state.
// The renderer backend needs to handle this special value, otherwise it will crash trying to call a function at this address. // The renderer backend needs to handle this special value, otherwise it will crash trying to call a function at this address.
// This is useful, for example, if you submitted callbacks which you know have altered the render state and you want it to be restored. // This is useful, for example, if you submitted callbacks which you know have altered the render state and you want it to be restored.
// Render state is not reset by default because they are many perfectly useful way of altering render state (e.g. changing shader/blending settings before an Image call). // render state is not reset by default because they are many perfectly useful way of altering render state (e.g. changing shader/blending settings before an Image call).
#define ImDrawCallback_ResetRenderState (ImDrawCallback)(-8) #define ImDrawCallback_ResetRenderState (ImDrawCallback)(-8)
// Typically, 1 command = 1 GPU draw call (unless command is a callback) // Typically, 1 command = 1 GPU draw call (unless command is a callback)
@ -3156,8 +3156,8 @@ enum ImDrawFlags_
enum ImDrawListFlags_ enum ImDrawListFlags_
{ {
ImDrawListFlags_None = 0, ImDrawListFlags_None = 0,
ImDrawListFlags_AntiAliasedLines = 1 << 0, // Enable anti-aliased lines/borders (*2 the number of triangles for 1.0f wide line or lines thin enough to be drawn using textures, otherwise *3 the number of triangles) ImDrawListFlags_AntiAliasedLines = 1 << 0, // Enable anti-aliased lines/borders (*2 the number of triangles for 1.0f wide line or lines thin enough to be drawn using textures_, otherwise *3 the number of triangles)
ImDrawListFlags_AntiAliasedLinesUseTex = 1 << 1, // Enable anti-aliased lines/borders using textures when possible. Require backend to render with bilinear filtering (NOT point/nearest filtering). ImDrawListFlags_AntiAliasedLinesUseTex = 1 << 1, // Enable anti-aliased lines/borders using textures_ when possible. Require backend to render with bilinear filtering (NOT point/nearest filtering).
ImDrawListFlags_AntiAliasedFill = 1 << 2, // Enable anti-aliased edge around filled shapes (rounded rectangles, circles). ImDrawListFlags_AntiAliasedFill = 1 << 2, // Enable anti-aliased edge around filled shapes (rounded rectangles, circles).
ImDrawListFlags_AllowVtxOffset = 1 << 3, // Can emit 'VtxOffset > 0' to allow large meshes. Set when 'ImGuiBackendFlags_RendererHasVtxOffset' is enabled. ImDrawListFlags_AllowVtxOffset = 1 << 3, // Can emit 'VtxOffset > 0' to allow large meshes. Set when 'ImGuiBackendFlags_RendererHasVtxOffset' is enabled.
}; };
@ -3198,7 +3198,7 @@ struct ImDrawList
IMGUI_API ImDrawList(ImDrawListSharedData* shared_data); IMGUI_API ImDrawList(ImDrawListSharedData* shared_data);
IMGUI_API ~ImDrawList(); IMGUI_API ~ImDrawList();
IMGUI_API void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect = false); // Render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling) IMGUI_API void PushClipRect(const ImVec2& clip_rect_min, const ImVec2& clip_rect_max, bool intersect_with_current_clip_rect = false); // render-level scissoring. This is passed down to your render function but not used for CPU-side coarse clipping. Prefer using higher-level ImGui::PushClipRect() to affect logic (hit-testing and widget culling)
IMGUI_API void PushClipRectFullScreen(); IMGUI_API void PushClipRectFullScreen();
IMGUI_API void PopClipRect(); IMGUI_API void PopClipRect();
IMGUI_API void PushTextureID(ImTextureID texture_id); IMGUI_API void PushTextureID(ImTextureID texture_id);
@ -3211,7 +3211,7 @@ struct ImDrawList
// - For rectangular primitives, "p_min" and "p_max" represent the upper-left and lower-right corners. // - For rectangular primitives, "p_min" and "p_max" represent the upper-left and lower-right corners.
// - For circle primitives, use "num_segments == 0" to automatically calculate tessellation (preferred). // - For circle primitives, use "num_segments == 0" to automatically calculate tessellation (preferred).
// In older versions (until Dear ImGui 1.77) the AddCircle functions defaulted to num_segments == 12. // In older versions (until Dear ImGui 1.77) the AddCircle functions defaulted to num_segments == 12.
// In future versions we will use textures to provide cheaper and higher-quality circles. // In future versions we will use textures_ to provide cheaper and higher-quality circles.
// Use AddNgon() and AddNgonFilled() functions if you need to guarantee a specific number of sides. // Use AddNgon() and AddNgonFilled() functions if you need to guarantee a specific number of sides.
IMGUI_API void AddLine(const ImVec2& p1, const ImVec2& p2, ImU32 col, float thickness = 1.0f); IMGUI_API void AddLine(const ImVec2& p1, const ImVec2& p2, ImU32 col, float thickness = 1.0f);
IMGUI_API void AddRect(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding = 0.0f, ImDrawFlags flags = 0, float thickness = 1.0f); // a: upper-left, b: lower-right (== upper-left + size) IMGUI_API void AddRect(const ImVec2& p_min, const ImVec2& p_max, ImU32 col, float rounding = 0.0f, ImDrawFlags flags = 0, float thickness = 1.0f); // a: upper-left, b: lower-right (== upper-left + size)
@ -3326,7 +3326,7 @@ struct ImDrawList
// as this is one of the oldest structure exposed by the library! Basically, ImDrawList == CmdList) // as this is one of the oldest structure exposed by the library! Basically, ImDrawList == CmdList)
struct ImDrawData struct ImDrawData
{ {
bool Valid; // Only valid after Render() is called and before the next NewFrame() is called. bool Valid; // Only valid after render() is called and before the next NewFrame() is called.
int CmdListsCount; // Number of ImDrawList* to render int CmdListsCount; // Number of ImDrawList* to render
int TotalIdxCount; // For convenience, sum of all ImDrawList's IdxBuffer.Size int TotalIdxCount; // For convenience, sum of all ImDrawList's IdxBuffer.Size
int TotalVtxCount; // For convenience, sum of all ImDrawList's VtxBuffer.Size int TotalVtxCount; // For convenience, sum of all ImDrawList's VtxBuffer.Size
@ -3426,7 +3426,7 @@ enum ImFontAtlasFlags_
ImFontAtlasFlags_None = 0, ImFontAtlasFlags_None = 0,
ImFontAtlasFlags_NoPowerOfTwoHeight = 1 << 0, // Don't round the height to next power of two ImFontAtlasFlags_NoPowerOfTwoHeight = 1 << 0, // Don't round the height to next power of two
ImFontAtlasFlags_NoMouseCursors = 1 << 1, // Don't build software mouse cursors into the atlas (save a little texture memory) ImFontAtlasFlags_NoMouseCursors = 1 << 1, // Don't build software mouse cursors into the atlas (save a little texture memory)
ImFontAtlasFlags_NoBakedLines = 1 << 2, // Don't build thick line textures into the atlas (save a little texture memory, allow support for point/nearest filtering). The AntiAliasedLinesUseTex features uses them, otherwise they will be rendered using polygons (more expensive for CPU/GPU). ImFontAtlasFlags_NoBakedLines = 1 << 2, // Don't build thick line textures_ into the atlas (save a little texture memory, allow support for point/nearest filtering). The AntiAliasedLinesUseTex features uses them, otherwise they will be rendered using polygons (more expensive for CPU/GPU).
}; };
// Load and rasterize multiple TTF/OTF fonts into a same texture. The font atlas will build a single texture holding: // Load and rasterize multiple TTF/OTF fonts into a same texture. The font atlas will build a single texture holding:
@ -3647,7 +3647,7 @@ struct ImGuiViewport
ImVec2 WorkSize; // Work Area: Size of the viewport minus task bars, menu bars, status bars (<= Size) ImVec2 WorkSize; // Work Area: Size of the viewport minus task bars, menu bars, status bars (<= Size)
float DpiScale; // 1.0f = 96 DPI = No extra scale. float DpiScale; // 1.0f = 96 DPI = No extra scale.
ImGuiID ParentViewportId; // (Advanced) 0: no parent. Instruct the platform backend to setup a parent/child relationship between platform windows. ImGuiID ParentViewportId; // (Advanced) 0: no parent. Instruct the platform backend to setup a parent/child relationship between platform windows.
ImDrawData* DrawData; // The ImDrawData corresponding to this viewport. Valid after Render() and until the next call to NewFrame(). ImDrawData* DrawData; // The ImDrawData corresponding to this viewport. Valid after render() and until the next call to NewFrame().
// Platform/Backend Dependent Data // Platform/Backend Dependent Data
// Our design separate the Renderer and Platform backends to facilitate combining default backends with each others. // Our design separate the Renderer and Platform backends to facilitate combining default backends with each others.
@ -3693,7 +3693,7 @@ struct ImGuiViewport
// Steps to use multi-viewports in your application, when using a default backend from the examples/ folder: // Steps to use multi-viewports in your application, when using a default backend from the examples/ folder:
// - Application: Enable feature with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'. // - Application: Enable feature with 'io.ConfigFlags |= ImGuiConfigFlags_ViewportsEnable'.
// - Backend: The backend initialization will setup all necessary ImGuiPlatformIO's functions and update monitors info every frame. // - Backend: The backend initialization will setup all necessary ImGuiPlatformIO's functions and update monitors info every frame.
// - Application: In your main loop, call ImGui::UpdatePlatformWindows(), ImGui::RenderPlatformWindowsDefault() after EndFrame() or Render(). // - Application: In your main loop, call ImGui::UpdatePlatformWindows(), ImGui::RenderPlatformWindowsDefault() after EndFrame() or render().
// - Application: Fix absolute coordinates used in ImGui::SetWindowPos() or ImGui::SetNextWindowPos() calls. // - Application: Fix absolute coordinates used in ImGui::SetWindowPos() or ImGui::SetNextWindowPos() calls.
// //
// Steps to use multi-viewports in your application, when using a custom backend: // Steps to use multi-viewports in your application, when using a custom backend:
@ -3705,7 +3705,7 @@ struct ImGuiViewport
// Set 'io.BackendFlags |= ImGuiBackendFlags_PlatformHasViewports' and 'io.BackendFlags |= ImGuiBackendFlags_PlatformHasViewports'. // Set 'io.BackendFlags |= ImGuiBackendFlags_PlatformHasViewports' and 'io.BackendFlags |= ImGuiBackendFlags_PlatformHasViewports'.
// Update ImGuiPlatformIO's Monitors list every frame. // Update ImGuiPlatformIO's Monitors list every frame.
// Update MousePos every frame, in absolute coordinates. // Update MousePos every frame, in absolute coordinates.
// - Application: In your main loop, call ImGui::UpdatePlatformWindows(), ImGui::RenderPlatformWindowsDefault() after EndFrame() or Render(). // - Application: In your main loop, call ImGui::UpdatePlatformWindows(), ImGui::RenderPlatformWindowsDefault() after EndFrame() or render().
// You may skip calling RenderPlatformWindowsDefault() if its API is not convenient for your needs. Read comments below. // You may skip calling RenderPlatformWindowsDefault() if its API is not convenient for your needs. Read comments below.
// - Application: Fix absolute coordinates used in ImGui::SetWindowPos() or ImGui::SetNextWindowPos() calls. // - Application: Fix absolute coordinates used in ImGui::SetWindowPos() or ImGui::SetNextWindowPos() calls.
// //
@ -3811,7 +3811,7 @@ struct ImGuiPlatformIO
// Output - List of viewports to render into platform windows // Output - List of viewports to render into platform windows
//------------------------------------------------------------------ //------------------------------------------------------------------
// Viewports list (the list is updated by calling ImGui::EndFrame or ImGui::Render) // Viewports list (the list is updated by calling ImGui::EndFrame or ImGui::render)
// (in the future we will attempt to organize this feature to remove the need for a "main viewport") // (in the future we will attempt to organize this feature to remove the need for a "main viewport")
ImVector<ImGuiViewport*> Viewports; // Main viewports, followed by all secondary viewports. ImVector<ImGuiViewport*> Viewports; // Main viewports, followed by all secondary viewports.
}; };

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="GoogleTestAdapter" version="0.18.0" targetFramework="native" developmentDependency="true" />
</packages>

Binary file not shown.

View File

@ -0,0 +1,24 @@
/////////////
// GLOBALS //
/////////////
Texture2D shaderTexture : register(t0);
SamplerState SampleType : register(s0);
//////////////
// TYPEDEFS //
//////////////
struct PixelInputType
{
float4 position : SV_POSITION;
float2 tex : TEXCOORD0;
};
////////////////////////////////////////////////////////////////////////////////
// Pixel Shader
////////////////////////////////////////////////////////////////////////////////
float4 DepthPixelShader(PixelInputType input) : SV_TARGET
{
float depth = input.position.z / input.position.w;
depth = 1.0f - depth;
return float4(depth, depth, depth, 1.0f);
}

View File

@ -0,0 +1,47 @@
/////////////
// GLOBALS //
/////////////
cbuffer MatrixBuffer
{
matrix worldMatrix;
matrix viewMatrix;
matrix projectionMatrix;
};
//////////////
// TYPEDEFS //
//////////////
struct VertexInputType
{
float4 position : POSITION;
float2 tex : TEXCOORD0;
};
struct PixelInputType
{
float4 position : SV_POSITION;
float2 tex : TEXCOORD0;
};
////////////////////////////////////////////////////////////////////////////////
// Vertex Shader
////////////////////////////////////////////////////////////////////////////////
PixelInputType DepthVertexShader(VertexInputType input)
{
PixelInputType output;
// Change the position vector to be 4 units for proper matrix calculations.
input.position.w = 1.0f;
// Calculate the position of the vertex against the world, view, and projection matrices.
output.position = mul(input.position, worldMatrix);
output.position = mul(output.position, viewMatrix);
output.position = mul(output.position, projectionMatrix);
// Store the texture coordinates for the pixel shader.
output.tex = input.tex;
return output;
}

View File

@ -1,64 +0,0 @@
#pragma once
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
class CelshadeClass
{
private :
struct MatrixBufferType
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct CameraBufferType
{
XMFLOAT3 cameraPosition;
float padding;
};
struct SunLightBufferType
{
XMFLOAT4 diffuseColor;
XMFLOAT4 ambientColor;
XMFLOAT3 sunDirection;
float intensity;
};
public :
CelshadeClass();
CelshadeClass(const CelshadeClass&);
~CelshadeClass();
bool Initialize(ID3D11Device*, HWND);
void Shutdown();
bool Render(ID3D11DeviceContext* deviceContex, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture, XMFLOAT4 diffuseColor, XMFLOAT4 ambientColor, XMFLOAT3 sunDirection,float intensity);
private:
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void ShutdownShader();
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
bool SetShaderParameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture, XMFLOAT4 ambientColor, XMFLOAT4 diffuseColor, XMFLOAT3 lightDirection, float sunIntensity);
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_sunlightBuffer;
ID3D11Buffer* m_sunlightColorBuffer;
ID3D11Buffer* m_sunlightPositionBuffer;
};

View File

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

@ -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: alpha_map_shader_class
////////////////////////////////////////////////////////////////////////////////
class alpha_map_shader_class
{
private:
struct matrix_buffer_type
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
public:
alpha_map_shader_class();
alpha_map_shader_class(const alpha_map_shader_class&);
~alpha_map_shader_class();
bool initialize(ID3D11Device*, HWND);
void shutdown();
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
private:
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void shutdown_shader();
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
void render_shader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* vertex_shader_;
ID3D11PixelShader* pixel_shader_;
ID3D11InputLayout* layout_;
ID3D11Buffer* matrix_buffer_;
ID3D11SamplerState* sample_state_;
};
#endif

View File

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

View File

@ -0,0 +1,85 @@
#pragma once
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
class celshade_class
{
private :
struct matrix_buffer_type
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct camera_buffer_type
{
XMFLOAT3 cameraPosition;
float padding;
};
struct sun_light_buffer_type
{
XMFLOAT4 diffuse_color;
XMFLOAT4 ambient_color;
XMFLOAT3 sun_direction;
float intensity;
};
public :
celshade_class();
celshade_class(const celshade_class&);
~celshade_class();
bool initialize(ID3D11Device*, HWND);
void shutdown();
bool render(
ID3D11DeviceContext* device_context,
int index_count,
XMMATRIX world_matrix,
XMMATRIX view_matrix, XMMATRIX
projection_matrix,
ID3D11ShaderResourceView* texture,
XMFLOAT4 diffuse_color,
XMFLOAT4 ambient_color,
XMFLOAT3 sun_direction,
float intensity
);
private:
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void shutdown_shader();
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
bool set_shader_parameters(
ID3D11DeviceContext* device_context,
XMMATRIX world_matrix,
XMMATRIX view_matrix,
XMMATRIX projection_matrix,
ID3D11ShaderResourceView* texture,
XMFLOAT4 ambient_color,
XMFLOAT4 diffuse_color,
XMFLOAT3 light_direction,
float sun_intensity
);
void render_shader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* vertex_shader_;
ID3D11PixelShader* pixel_shader_;
ID3D11InputLayout* layout_;
ID3D11SamplerState* sample_state_;
ID3D11Buffer* matrix_buffer_;
ID3D11Buffer* camera_buffer_;
ID3D11Buffer* sunlight_buffer_;
ID3D11Buffer* sunlight_color_buffer_;
ID3D11Buffer* sunlight_position_buffer_;
};

View File

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

View File

@ -0,0 +1,56 @@
#ifndef _DEPTH_SHADER_CLASS_H_
#define _DEPTH_SHADER_CLASS_H_
//////////////
// INCLUDES //
//////////////
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: depth_shader_class
////////////////////////////////////////////////////////////////////////////////
class depth_shader_class
{
private:
struct matrix_buffer_type
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
public:
depth_shader_class();
depth_shader_class(const depth_shader_class&);
~depth_shader_class();
bool initialize(ID3D11Device*, HWND);
void shutdown();
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*);
private:
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void shutdown_shader();
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*);
void render_shader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* vertex_shader_;
ID3D11PixelShader* pixel_shader_;
ID3D11InputLayout* layout_;
ID3D11Buffer* matrix_buffer_;
ID3D11SamplerState* sample_state_;
};
#endif

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: font_shader_class
////////////////////////////////////////////////////////////////////////////////
class font_shader_class
{
private:
struct matrix_buffer_type
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct pixel_buffer_type
{
XMFLOAT4 pixelColor;
};
public:
font_shader_class();
font_shader_class(const font_shader_class&);
~font_shader_class();
bool initialize(ID3D11Device*, HWND);
void shutdown();
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4);
private:
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void shutdown_shader();
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4);
void render_shader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* vertex_shader_;
ID3D11PixelShader* pixel_shader_;
ID3D11InputLayout* layout_;
ID3D11Buffer* matrix_buffer_;
ID3D11SamplerState* sample_state_;
ID3D11Buffer* pixel_buffer_;
};
#endif

View File

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

View File

@ -0,0 +1,57 @@
////////////////////////////////////////////////////////////////////////////////
#ifndef _LIGHTMAPSHADERCLASS_H_
#define _LIGHTMAPSHADERCLASS_H_
//////////////
// INCLUDES //
//////////////
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: light_map_shader_class
////////////////////////////////////////////////////////////////////////////////
class light_map_shader_class
{
private:
struct matrix_buffer_type
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
public:
light_map_shader_class();
light_map_shader_class(const light_map_shader_class&);
~light_map_shader_class();
bool initialize(ID3D11Device*, HWND);
void shutdown();
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
private:
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void shutdown_shader();
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
void render_shader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* vertex_shader_;
ID3D11PixelShader* pixel_shader_;
ID3D11InputLayout* layout_;
ID3D11Buffer* matrix_buffer_;
ID3D11SamplerState* sample_state_;
};
#endif

View File

@ -0,0 +1,92 @@
////////////////////////////////////////////////////////////////////////////////
// Filename: lightshaderclass.h
////////////////////////////////////////////////////////////////////////////////
#ifndef _LIGHTSHADERCLASS_H_
#define _LIGHTSHADERCLASS_H_
#pragma once
/////////////
// GLOBALS //
/////////////
constexpr 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: light_shader_class
////////////////////////////////////////////////////////////////////////////////
class light_shader_class
{
private:
struct matrix_buffer_type
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct camera_buffer_type
{
XMFLOAT3 cameraPosition;
float padding;
};
struct light_buffer_type
{
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 light_color_buffer_type
{
XMFLOAT4 diffuseColor[num_lights];
};
struct light_position_buffer_type
{
XMFLOAT4 lightPosition[num_lights];
};
public:
light_shader_class();
light_shader_class(const light_shader_class&);
~light_shader_class();
bool initialize(ID3D11Device*, HWND);
void shutdown();
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[]);
private:
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void shutdown_shader();
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[]);
void render_shader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* vertex_shader_;
ID3D11PixelShader* pixel_shader_;
ID3D11InputLayout* layout_;
ID3D11SamplerState* sample_state_;
ID3D11Buffer* matrix_buffer_;
ID3D11Buffer* camera_buffer_;
ID3D11Buffer* light_buffer_;
ID3D11Buffer* light_color_buffer_;
ID3D11Buffer* light_position_buffer_;
};
#endif

View File

@ -1,57 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
#ifndef _LIGHTMAPSHADERCLASS_H_
#define _LIGHTMAPSHADERCLASS_H_
//////////////
// INCLUDES //
//////////////
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: LightMapShaderClass
////////////////////////////////////////////////////////////////////////////////
class LightMapShaderClass
{
private:
struct MatrixBufferType
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
public:
LightMapShaderClass();
LightMapShaderClass(const LightMapShaderClass&);
~LightMapShaderClass();
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,92 +0,0 @@
////////////////////////////////////////////////////////////////////////////////
// Filename: lightshaderclass.h
////////////////////////////////////////////////////////////////////////////////
#ifndef _LIGHTSHADERCLASS_H_
#define _LIGHTSHADERCLASS_H_
#pragma once
/////////////
// 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

@ -1 +0,0 @@
#pragma once

View File

@ -0,0 +1,25 @@
#pragma once
#include <d3d11.h>
#include <DirectXMath.h>
#include <string>
class master_shader
{
public :
master_shader();
master_shader(const master_shader& other) = delete;
virtual ~master_shader();
virtual bool initialize(ID3D11Device* device, HWND hwnd) = 0;
protected:
wchar_t vs_filename_[128], ps_filename_[128];
wchar_t const* vs_name_ = L"";
wchar_t const* ps_name_ = L"";
};

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: multi_texture_shader_class
////////////////////////////////////////////////////////////////////////////////
class multi_texture_shader_class
{
private:
struct matrix_buffer_type
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
public:
multi_texture_shader_class();
multi_texture_shader_class(const multi_texture_shader_class&);
~multi_texture_shader_class();
bool initialize(ID3D11Device*, HWND);
void shutdown();
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
private:
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void shutdown_shader();
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
void render_shader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* vertex_shader_;
ID3D11PixelShader* pixel_shader_;
ID3D11InputLayout* layout_;
ID3D11Buffer* matrix_buffer_;
ID3D11SamplerState* sample_state_;
};
#endif

View File

@ -0,0 +1,64 @@
#ifndef _NORMALMAPSHADERCLASS_H_
#define _NORMALMAPSHADERCLASS_H_
//////////////
// INCLUDES //
//////////////
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: normal_map_shader_class
////////////////////////////////////////////////////////////////////////////////
class normal_map_shader_class
{
private:
struct matrix_buffer_type
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct light_buffer_type
{
XMFLOAT4 diffuse_color;
XMFLOAT3 light_direction;
float padding;
};
public:
normal_map_shader_class();
normal_map_shader_class(const normal_map_shader_class&);
~normal_map_shader_class();
bool initialize(ID3D11Device*, HWND);
void shutdown();
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4);
private:
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void shutdown_shader();
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4);
void render_shader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* vertex_shader_;
ID3D11PixelShader* pixel_shader_;
ID3D11InputLayout* layout_;
ID3D11Buffer* matrix_buffer_;
ID3D11SamplerState* sample_state_;
ID3D11Buffer* light_buffer_;
};
#endif

View File

@ -1,64 +0,0 @@
#ifndef _NORMALMAPSHADERCLASS_H_
#define _NORMALMAPSHADERCLASS_H_
//////////////
// INCLUDES //
//////////////
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: NormalMapShaderClass
////////////////////////////////////////////////////////////////////////////////
class NormalMapShaderClass
{
private:
struct MatrixBufferType
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct LightBufferType
{
XMFLOAT4 diffuseColor;
XMFLOAT3 lightDirection;
float padding;
};
public:
NormalMapShaderClass();
NormalMapShaderClass(const NormalMapShaderClass&);
~NormalMapShaderClass();
bool Initialize(ID3D11Device*, HWND);
void Shutdown();
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4);
private:
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void ShutdownShader();
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4);
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

@ -0,0 +1,65 @@
////////////////////////////////////////////////////////////////////////////////
// Filename: reflectionshaderclass.h
////////////////////////////////////////////////////////////////////////////////
#ifndef _REFLECTIONSHADERCLASS_H_
#define _REFLECTIONSHADERCLASS_H_
//////////////
// INCLUDES //
//////////////
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: reflection_shader_class
////////////////////////////////////////////////////////////////////////////////
class reflection_shader_class
{
private:
struct matrix_buffer_type
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct reflection_buffer_type
{
XMMATRIX reflection_matrix;
};
public:
reflection_shader_class();
reflection_shader_class(const reflection_shader_class&);
~reflection_shader_class();
bool initialize(ID3D11Device*, HWND);
void shutdown();
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMMATRIX);
private:
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void shutdown_shader();
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMMATRIX);
void render_shader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* vertex_shader_;
ID3D11PixelShader* pixel_shader_;
ID3D11InputLayout* layout_;
ID3D11Buffer* matrix_buffer_;
ID3D11SamplerState* sample_state_;
ID3D11Buffer* reflection_buffer_;
};
#endif

View File

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

View File

@ -0,0 +1,72 @@
#ifndef _REFRACTIONSHADERCLASS_H_
#define _REFRACTIONSHADERCLASS_H_
//////////////
// INCLUDES //
//////////////
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: refraction_shader_class
////////////////////////////////////////////////////////////////////////////////
class refraction_shader_class
{
private:
struct matrix_buffer_type
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct light_buffer_type
{
XMFLOAT4 ambient_color;
XMFLOAT4 diffuse_color;
XMFLOAT4 light_position;
XMFLOAT3 light_direction;
float padding;
};
struct clip_plane_buffer_type
{
XMFLOAT4 clip_plane;
};
public:
refraction_shader_class();
refraction_shader_class(const refraction_shader_class&);
~refraction_shader_class();
bool initialize(ID3D11Device*, HWND);
void shutdown();
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*,
XMFLOAT3, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[], XMFLOAT4);
private:
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void shutdown_shader();
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*,
XMFLOAT3, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[], XMFLOAT4);
void render_shader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* vertex_shader_;
ID3D11PixelShader* pixel_shader_;
ID3D11InputLayout* layout_;
ID3D11SamplerState* sample_state_;
ID3D11Buffer* matrix_buffer_;
ID3D11Buffer* light_buffer_;
ID3D11Buffer* clip_plane_buffer_;
};
#endif

View File

@ -1,72 +0,0 @@
#ifndef _REFRACTIONSHADERCLASS_H_
#define _REFRACTIONSHADERCLASS_H_
//////////////
// INCLUDES //
//////////////
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: RefractionShaderClass
////////////////////////////////////////////////////////////////////////////////
class RefractionShaderClass
{
private:
struct MatrixBufferType
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct LightBufferType
{
XMFLOAT4 ambientColor;
XMFLOAT4 diffuseColor;
XMFLOAT4 lightPosition;
XMFLOAT3 lightDirection;
float padding;
};
struct ClipPlaneBufferType
{
XMFLOAT4 clipPlane;
};
public:
RefractionShaderClass();
RefractionShaderClass(const RefractionShaderClass&);
~RefractionShaderClass();
bool Initialize(ID3D11Device*, HWND);
void Shutdown();
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*,
XMFLOAT3, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[], XMFLOAT4);
private:
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void ShutdownShader();
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*,
XMFLOAT3, XMFLOAT4[], 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_lightBuffer;
ID3D11Buffer* m_clipPlaneBuffer;
};
#endif

View File

@ -0,0 +1,78 @@
#ifndef _SHADERMANAGERCLASS_H_
#define _SHADERMANAGERCLASS_H_
// Inclure les en-têtes nécessaires
#include <d3d11.h>
#include <DirectXMath.h>
#include <vector>
#include "texture_shader_class.h"
#include "normal_map_shader_class.h"
#include "multi_texture_shader_class.h"
#include "translate_shader_class.h"
#include "alpha_map_shader_class.h"
#include "spec_map_shader_class.h"
#include "transparent_shader_class.h"
#include "light_shader_class.h"
#include "light_map_shader_class.h"
#include "refraction_shader_class.h"
#include "water_shader_class.h"
#include "celshade_class.h"
#include "depth_shader_class.h"
#include "skybox_shader_class.h"
#include "sunlight_shader_class.h"
#include "depth_shader_class.h"
using namespace DirectX;
class shader_manager_class
{
public:
shader_manager_class();
shader_manager_class(const shader_manager_class&);
~shader_manager_class();
bool initialize(ID3D11Device*, HWND);
void shutdown();
bool render_texture_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*);
bool render_normal_map_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4);
bool render_multitexture_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
bool render_translate_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
bool render_alpha_map_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
bool render_spec_map_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4, XMFLOAT3, XMFLOAT4, float);
bool render_transparent_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
bool renderlight_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[]);
bool renderlight_map_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
bool render_refraction_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[], XMFLOAT4);
bool render_water_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, float, float);
bool render_cel_shading_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3, float);
bool render_sunlight_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3, float);
bool render_skybox_shader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3, float);
bool render_depth_shader(
ID3D11DeviceContext* context,
int indexCount,
XMMATRIX worldMatrix,
XMMATRIX viewMatrix,
XMMATRIX projectionMatrix,
ID3D11ShaderResourceView* texture
);
private:
texture_shader_class* texture_shader_;
normal_map_shader_class* normal_map_shader_;
multi_texture_shader_class* multitexture_shader_;
translate_shader_class* translate_shader_;
alpha_map_shader_class* alpha_map_shader_;
spec_map_shader_class* spec_map_shader_;
transparent_shader_class* transparent_shader_;
light_shader_class* light_shader_;
light_map_shader_class* light_map_shader_;
refraction_shader_class* refraction_shader_;
water_shader_class* water_shader_;
celshade_class* cel_shading_shader_;
sunlight_shader_class* sunlight_shader_;
skybox_shader_class* skybox_shader_;
depth_shader_class* depth_shader_;
};
#endif

View File

@ -1,67 +0,0 @@
#ifndef _SHADERMANAGERCLASS_H_
#define _SHADERMANAGERCLASS_H_
// Inclure les en-têtes nécessaires
#include <d3d11.h>
#include <DirectXMath.h>
#include <vector>
#include "textureshaderclass.h"
#include "normalmapshaderclass.h"
#include "multitextureshaderclass.h"
#include "translateshaderclass.h"
#include "alphamapshaderclass.h"
#include "specmapshaderclass.h"
#include "transparentshaderclass.h"
#include "lightshaderclass.h"
#include "lightmapshaderclass.h"
#include "refractionshaderclass.h"
#include "watershaderclass.h"
#include "celshadingshader.h"
#include "SkyboxShaderClass.h"
#include "sunlightshaderclass.h"
using namespace DirectX;
class ShaderManagerClass
{
public:
ShaderManagerClass();
ShaderManagerClass(const ShaderManagerClass&);
~ShaderManagerClass();
bool Initialize(ID3D11Device*, HWND);
void Shutdown();
bool RenderTextureShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*);
bool RenderNormalMapShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4);
bool RenderMultitextureShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
bool RenderTranslateShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
bool RenderAlphaMapShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
bool RenderSpecMapShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4, XMFLOAT3, XMFLOAT4, float);
bool RenderTransparentShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
bool RenderlightShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[]);
bool RenderlightMapShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*);
bool RenderRefractionShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT3, XMFLOAT4[], XMFLOAT4[], XMFLOAT4[], XMFLOAT4);
bool RenderWaterShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, float, float);
bool RenderCelShadingShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3, float);
bool RenderSunlightShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3, float);
bool RenderSkyboxShader(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3, float);
private:
TextureShaderClass* m_TextureShader;
NormalMapShaderClass* m_NormalMapShader;
MultiTextureShaderClass* m_MultitextureShader;
TranslateShaderClass* m_TranslateShader;
AlphaMapShaderClass* m_AlphaMapShader;
SpecMapShaderClass* m_SpecMapShader;
TransparentShaderClass* m_TransparentShader;
LightShaderClass* m_LightShader;
LightMapShaderClass* m_LightMapShader;
RefractionShaderClass* m_RefractionShader;
WaterShaderClass* m_WaterShader;
CelshadeClass* m_CelShadingShader;
SunlightShaderClass* m_SunlightShader;
SkyboxShaderClass* m_SkyboxShader;
};
#endif

View File

@ -8,7 +8,7 @@
using namespace DirectX; using namespace DirectX;
using namespace std; using namespace std;
class SkyboxShaderClass class skybox_shader_class
{ {
private : private :
@ -39,9 +39,9 @@ class SkyboxShaderClass
}; };
public : public :
SkyboxShaderClass(); skybox_shader_class();
SkyboxShaderClass(const SkyboxShaderClass&); skybox_shader_class(const skybox_shader_class&);
~SkyboxShaderClass(); ~skybox_shader_class();
bool Initialize(ID3D11Device*, HWND); bool Initialize(ID3D11Device*, HWND);
void Shutdown(); void Shutdown();

View File

@ -0,0 +1,72 @@
#ifndef _SPECMAPSHADERCLASS_H_
#define _SPECMAPSHADERCLASS_H_
//////////////
// INCLUDES //
//////////////
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: spec_map_shader_class
////////////////////////////////////////////////////////////////////////////////
class spec_map_shader_class
{
private:
struct matrix_buffer_type
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct light_buffer_type
{
XMFLOAT4 diffuse_color;
XMFLOAT4 specular_color;
float specular_power;
XMFLOAT3 light_direction;
};
struct camera_buffer_type
{
XMFLOAT3 camera_position;
float padding;
};
public:
spec_map_shader_class();
spec_map_shader_class(const spec_map_shader_class&);
~spec_map_shader_class();
bool initialize(ID3D11Device*, HWND);
void shutdown();
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*,
XMFLOAT3, XMFLOAT4, XMFLOAT3, XMFLOAT4, float);
private:
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void shutdown_shader();
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*,
XMFLOAT3, XMFLOAT4, XMFLOAT3, XMFLOAT4, float);
void render_shader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* vertex_shader_;
ID3D11PixelShader* pixel_shader_;
ID3D11InputLayout* layout_;
ID3D11Buffer* matrix_buffer_;
ID3D11SamplerState* sample_state_;
ID3D11Buffer* light_buffer_;
ID3D11Buffer* camera_buffer_;
};
#endif

View File

@ -1,72 +0,0 @@
#ifndef _SPECMAPSHADERCLASS_H_
#define _SPECMAPSHADERCLASS_H_
//////////////
// INCLUDES //
//////////////
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: SpecMapShaderClass
////////////////////////////////////////////////////////////////////////////////
class SpecMapShaderClass
{
private:
struct MatrixBufferType
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct LightBufferType
{
XMFLOAT4 diffuseColor;
XMFLOAT4 specularColor;
float specularPower;
XMFLOAT3 lightDirection;
};
struct CameraBufferType
{
XMFLOAT3 cameraPosition;
float padding;
};
public:
SpecMapShaderClass();
SpecMapShaderClass(const SpecMapShaderClass&);
~SpecMapShaderClass();
bool Initialize(ID3D11Device*, HWND);
void Shutdown();
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*,
XMFLOAT3, XMFLOAT4, XMFLOAT3, XMFLOAT4, float);
private:
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void ShutdownShader();
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, ID3D11ShaderResourceView*,
XMFLOAT3, XMFLOAT4, XMFLOAT3, XMFLOAT4, float);
void RenderShader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* m_vertexShader;
ID3D11PixelShader* m_pixelShader;
ID3D11InputLayout* m_layout;
ID3D11Buffer* m_matrixBuffer;
ID3D11SamplerState* m_sampleState;
ID3D11Buffer* m_lightBuffer;
ID3D11Buffer* m_cameraBuffer;
};
#endif

View File

@ -0,0 +1,68 @@
#pragma once
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
class sunlight_shader_class
{
private :
struct matrix_buffer_type
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct camera_buffer_type
{
XMFLOAT3 camera_position;
float padding;
};
struct sun_light_buffer_type
{
XMFLOAT4 diffuse_color;
XMFLOAT4 ambient_color;
XMFLOAT3 sun_direction;
float intensity;
};
struct sun_light_color_buffer_type
{
XMFLOAT4 sun_color;
};
public :
sunlight_shader_class();
sunlight_shader_class(const sunlight_shader_class&);
~sunlight_shader_class();
bool initialize(ID3D11Device*, HWND);
void shutdown();
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3,float);
private:
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void shutdown_shader();
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3, float);
void render_shader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* vertex_shader_;
ID3D11PixelShader* pixel_shader_;
ID3D11InputLayout* layout_;
ID3D11SamplerState* sample_state_;
ID3D11Buffer* matrix_buffer_;
ID3D11Buffer* camera_buffer_;
ID3D11Buffer* sunlight_buffer_;
ID3D11Buffer* sunlight_color_buffer_;
ID3D11Buffer* sunlight_position_buffer_;
};

View File

@ -1,68 +0,0 @@
#pragma once
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
class SunlightShaderClass
{
private :
struct MatrixBufferType
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct CameraBufferType
{
XMFLOAT3 cameraPosition;
float padding;
};
struct SunLightBufferType
{
XMFLOAT4 diffuseColor;
XMFLOAT4 ambientColor;
XMFLOAT3 sunDirection;
float intensity;
};
struct SunLightColorBufferType
{
XMFLOAT4 sunColor;
};
public :
SunlightShaderClass();
SunlightShaderClass(const SunlightShaderClass&);
~SunlightShaderClass();
bool Initialize(ID3D11Device*, HWND);
void Shutdown();
bool Render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3,float);
private:
bool InitializeShader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void ShutdownShader();
void OutputShaderErrorMessage(ID3D10Blob*, HWND, WCHAR*);
bool SetShaderParameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, XMFLOAT4, XMFLOAT4, XMFLOAT3, float);
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_sunlightBuffer;
ID3D11Buffer* m_sunlightColorBuffer;
ID3D11Buffer* m_sunlightPositionBuffer;
};

View File

@ -0,0 +1,56 @@
#ifndef _TEXTURESHADERCLASS_H_
#define _TEXTURESHADERCLASS_H_
//////////////
// INCLUDES //
//////////////
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: texture_shader_class
////////////////////////////////////////////////////////////////////////////////
class texture_shader_class
{
private:
struct matrix_buffer_type
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
public:
texture_shader_class();
texture_shader_class(const texture_shader_class&);
~texture_shader_class();
bool initialize(ID3D11Device*, HWND);
void shutdown();
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*);
private:
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void shutdown_shader();
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*);
void render_shader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* vertex_shader_;
ID3D11PixelShader* pixel_shader_;
ID3D11InputLayout* layout_;
ID3D11Buffer* matrix_buffer_;
ID3D11SamplerState* sample_state_;
};
#endif

View File

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

View File

@ -0,0 +1,63 @@
#ifndef _TRANSLATESHADERCLASS_H_
#define _TRANSLATESHADERCLASS_H_
//////////////
// INCLUDES //
//////////////
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: translate_shader_class
////////////////////////////////////////////////////////////////////////////////
class translate_shader_class
{
private:
struct matrix_buffer_type
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct translate_buffer_type
{
float translation;
XMFLOAT3 padding;
};
public:
translate_shader_class();
translate_shader_class(const translate_shader_class&);
~translate_shader_class();
bool initialize(ID3D11Device*, HWND);
void shutdown();
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
private:
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void shutdown_shader();
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
void render_shader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* vertex_shader_;
ID3D11PixelShader* pixel_shader_;
ID3D11InputLayout* layout_;
ID3D11Buffer* matrix_buffer_;
ID3D11SamplerState* sample_state_;
ID3D11Buffer* translate_buffer_;
};
#endif

View File

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

View File

@ -0,0 +1,63 @@
#ifndef _TRANSPARENTSHADERCLASS_H_
#define _TRANSPARENTSHADERCLASS_H_
//////////////
// INCLUDES //
//////////////
#include "Logger.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: transparent_shader_class
////////////////////////////////////////////////////////////////////////////////
class transparent_shader_class
{
private:
struct matrix_buffer_type
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct transparent_buffer_type
{
float blend_amount;
XMFLOAT3 padding;
};
public:
transparent_shader_class();
transparent_shader_class(const transparent_shader_class&);
~transparent_shader_class();
bool initialize(ID3D11Device*, HWND);
void shutdown();
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
private:
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void shutdown_shader();
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*, float);
void render_shader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* vertex_shader_;
ID3D11PixelShader* pixel_shader_;
ID3D11InputLayout* layout_;
ID3D11Buffer* matrix_buffer_;
ID3D11SamplerState* sample_state_;
ID3D11Buffer* transparent_buffer_;
};
#endif

View File

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

View File

@ -0,0 +1,70 @@
#ifndef _WATERSHADERCLASS_H_
#define _WATERSHADERCLASS_H_
//////////////
// INCLUDES //
//////////////
#include <d3d11.h>
#include <d3dcompiler.h>
#include <directxmath.h>
#include <fstream>
using namespace DirectX;
using namespace std;
////////////////////////////////////////////////////////////////////////////////
// Class name: water_shader_class
////////////////////////////////////////////////////////////////////////////////
class water_shader_class
{
private:
struct matrix_buffer_type
{
XMMATRIX world;
XMMATRIX view;
XMMATRIX projection;
};
struct reflection_buffer_type
{
XMMATRIX reflection;
};
struct water_buffer_type
{
float water_translation;
float reflect_refract_scale;
XMFLOAT2 padding;
};
public:
water_shader_class();
water_shader_class(const water_shader_class&);
~water_shader_class();
bool initialize(ID3D11Device*, HWND);
void shutdown();
bool render(ID3D11DeviceContext*, int, XMMATRIX, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*,
ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, float, float);
private:
bool initialize_shader(ID3D11Device*, HWND, WCHAR*, WCHAR*);
void shutdown_shader();
void output_shader_error_message(ID3D10Blob*, HWND, WCHAR*);
bool set_shader_parameters(ID3D11DeviceContext*, XMMATRIX, XMMATRIX, XMMATRIX, XMMATRIX, ID3D11ShaderResourceView*,
ID3D11ShaderResourceView*, ID3D11ShaderResourceView*, float, float);
void render_shader(ID3D11DeviceContext*, int);
private:
ID3D11VertexShader* vertex_shader_;
ID3D11PixelShader* pixel_shader_;
ID3D11InputLayout* layout_;
ID3D11Buffer* matrix_buffer_;
ID3D11SamplerState* sample_state_;
ID3D11Buffer* reflection_buffer_;
ID3D11Buffer* water_buffer_;
};
#endif

View File

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

View File

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

@ -67,12 +67,12 @@ public:
case LogLevel::Info: return LogLevelInfo{ "Info", 0, ImVec4(0.0f, 1.0f, 0.0f, 1.0f) }; 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::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::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::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::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::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::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::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::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::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::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::Scripting: return LogLevelInfo{ "Scripting", 11, ImVec4(0.5f, 0.5f, 0.5f, 1.0f) };

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <vector> #include <vector>
#include "d3dclass.h" #include "d_3d_class.h"
#include "object.h" #include "object.h"
class Skybox class Skybox
@ -11,9 +11,9 @@ public:
Skybox(); Skybox();
~Skybox(); ~Skybox();
void Initialize(D3DClass* d3dClassRef); // Get all the required references void Initialize(d_3d_class* d3dClassRef); // Get all the required references
Object* ConstructSkybox(); object* ConstructSkybox();
// Variables // Variables
@ -23,8 +23,8 @@ public:
private: private:
D3DClass* m_d3dClassRef; // Reference to the D3DClass instance d_3d_class* m_d3dClassRef; // Reference to the d_3d_class instance
Object* m_Skybox; object* m_Skybox;
}; };

View File

@ -0,0 +1,314 @@
#ifndef _APPLICATIONCLASS_H_
#define _APPLICATIONCLASS_H_
///////////////////////
// MY CLASS INCLUDES //
///////////////////////
#include "d_3d_class.h"
#include "camera_class.h"
#include "object.h"
#include "light_class.h"
#include <vector>
#include <filesystem>
#include "bitmap_class.h"
#include "sprite_class.h"
#include "timer_class.h"
#include "font_shader_class.h"
#include "font_class.h"
#include "text_class.h"
#include "fps_class.h"
#include "input_class.h"
#include "shader_manager_class.h"
#include "modellistclass.h"
#include "position_class.h"
#include "frustumclass.h"
#include "render_texture_class.h"
#include "display_plane_class.h"
#include "translate_shader_class.h"
#include "reflection_shader_class.h"
#include "physics.h"
#include "frustum.h"
#include "skybox.h"
#include <fstream>
#include <WICTextureLoader.h>
#include <comdef.h> // Pour _com_error
#include <chrono>
#include <thread>
#include <map>
#include <algorithm>
#include <DirectXMath.h>
#include <mutex>
#include "shadow_map.h"
#include "stats.h"
/////////////
// GLOBALS //
/////////////
constexpr bool full_screen = false;
constexpr float screen_depth = 1000.0f;
constexpr float screen_near = 0.3f;
struct input
{
bool key_left = false;
bool key_right = false;
bool key_up = false;
bool key_down = false;
};
////////////////////////////////////////////////////////////////////////////////
// Class name: application_class
////////////////////////////////////////////////////////////////////////////////
class application_class
{
public:
application_class();
~application_class();
virtual d_3d_class* get_direct_3d();
void set_direct_3d(d_3d_class* direct_3d) { direct_3d_ = direct_3d; };
render_texture_class* get_scene_texture() const { return scene_texture_; };
render_texture_class* get_render_texture() const { return render_texture_; };
render_texture_class* get_refraction_texture() const { return refraction_texture_; };
render_texture_class* get_reflection_texture() const { return reflection_texture_; };
void create_big_cube(int side_count);
void process_terrain_generation();
virtual bool initialize(int, int, HWND, bool is_vulkan);
void shutdown();
virtual bool frame(input_class*);
void physics_thread_function();
int get_physics_tick_rate() const { return physics_tick_rate_; };
void set_physics_tick_rate(int physics_tick_rate) { physics_tick_rate_ = physics_tick_rate; };
int get_screen_width() const;
void set_screen_width(int screen_width);
int get_screen_height() const;
void set_screen_height(int screen_height);
float get_speed() const { return speed_; };
void set_speed(const float speed) { this->speed_ = speed; };
void add_cube();
void delete_kobject(int index);
size_t get_cube_count() const { return cubes_.size(); };
size_t get_terrain_cube_count() const { return terrain_chunk_.size(); };
std::vector<object*> get_cubes() const { return cubes_; };
std::vector<object*> get_terrain_cubes() const { return terrain_chunk_; };
std::vector<object*> get_kobjects() const { return object_; };
void set_kobjects(std::vector<object*> kobjects) { object_ = kobjects; };
void add_kobject(std::wstring& filepath);
void set_path(WCHAR* path) { path_ = path; };
void set_w_folder(const std::filesystem::path& w_folder) { w_folder_ = w_folder; };
std::filesystem::path get_w_folder() const { return w_folder_; };
int get_object_id() const { return object_id_; };
void set_object_id(int object_id) { object_id_ = object_id; };
void generate_terrain();
void delete_terrain();
XMVECTOR get_light_position(int index);
XMVECTOR get_light_color(int index);
void set_light_position(int index, XMVECTOR position);
void set_light_color(int index, XMVECTOR color);
std::vector<light_class*> get_lights() const { return lights_; };
light_class* get_sun_light() const { return sun_light_; };
bool get_should_quit() const { return should_quit_; };
void set_should_quit(const bool should_quit) { should_quit_ = should_quit; };
void set_cel_shading(const bool enable) { enable_cel_shading_ = enable; };
void set_vsync(bool vsync);
bool get_vsync() const { return vsync_enabled_; };
HWND get_hwnd() const;
void set_hwnd(HWND hwnd);
bool is_windowed() const;
void set_windowed(bool windowed);
void set_window_size(const ImVec2 size) { window_size_ = size; };
ImVec2 get_window_size() const { return window_size_; };
float get_aspect_ratio() const { return static_cast<float>(screen_width_) / static_cast<float>(screen_height_); };
physics* get_physics() const { return physics_; };
// ----------------------------------- //
// ------------- Culling ------------- //
// ----------------------------------- //
frustum get_frustum() const { return frustum_culling_; };
void set_frustum(const frustum& frustum) { frustum_culling_ = frustum; };
void construct_frustum();
int get_render_count() const { return render_count_; };
void set_render_count(const int render_count) { render_count_ = render_count; };
float get_frustum_tolerance() const { return frustum_culling_tolerance_; };
void set_frustum_tolerance(const float frustum_tolerance) { frustum_culling_tolerance_ = frustum_tolerance; };
bool get_can_fixed_update() const { return can_fixed_update_; };
void set_can_fixed_update(bool can_fixed_update) { can_fixed_update_ = can_fixed_update; };
ID3D11ShaderResourceView* get_back_buffer_srv() const {return back_buffer_srv_;};
stats* get_stats() const { return stats_; };
fps_class* get_fps() const { return fps_; };
private:
bool render(float, float, float, float, float);
bool render_physics(bool key_left, bool key_right, bool key_up, bool key_down, float delta_time);
bool update_mouse_strings(int, int, bool);
bool update_fps();
bool update_render_count_string(int);
bool render_scene_to_texture(float);
bool render_refraction_to_texture();
bool render_reflection_to_texture();
bool render_pass(const std::vector<std::reference_wrapper<std::vector<object*>>>& RenderQueues, XMFLOAT4* diffuse, XMFLOAT4* position, XMFLOAT4* ambient, XMMATRIX view, XMMATRIX projection);
void update_skybox_position();
public :
std::vector<ID3D11ShaderResourceView*> textures;
private :
// Thread de culling
std::thread culling_thread_;
std::atomic<bool> culling_active_;
std::mutex objects_mutex_;
void culling_thread_function();
std::mutex terrain_mutex_;
std::vector<std::tuple<float, float, float, std::string, int>> terrain_generation_data_;
bool terrain_generation_ready_;
int next_terrain_object_id_;
// ------------------------------------- //
// ------------- DIRECT3D -------------- //
// ------------------------------------- //
d_3d_class* direct_3d_;
IDXGISwapChain* swap_chain_;
model_class* model_,* ground_model_, * wall_model_, * bath_model_, * water_model_;
ModelListClass* model_list_;
bool vsync_enabled_ = true;
HWND hwnd_;
bool windowed_;
// ------------------------------------- //
// ------------- RENDERING ------------- //
// ------------------------------------- //
XMMATRIX base_view_matrix_;
render_texture_class* render_texture_, * refraction_texture_, * reflection_texture_;
render_texture_class* scene_texture_;
display_plane_class* display_plane_;
int screen_width_, screen_height_;
camera_class* camera_;
camera_class* sun_camera_;
camera_class* active_camera_;
position_class* position_;
shadow_map* shadow_map_;
ID3D11ShaderResourceView* shadow_map_srv_;
// ------------------------------------ //
// ------------- OBJECTS -------------- //
// ------------------------------------ //
object* selected_object_;
std::vector<object*> cubes_;
std::vector<object*> terrain_chunk_;
float speed_ = 0.1f; // speed for the demo spinning object
std::vector<object*> object_;
std::vector<object*> imported_object_;
int object_id_ = 0;
std::vector<std::reference_wrapper<std::vector<object*>>> render_queues_;
std::vector<object*> skybox_;
// ----------------------------------- //
// ------------- LIGHTS -------------- //
// ----------------------------------- //
light_class* m_light_;
std::vector<light_class*> lights_;
int num_lights_;
light_class* sun_light_;
XMFLOAT3 true_light_position_;
model_class* light_model_;
// ----------------------------------- //
// ------------- SHADERS ------------- //
// ----------------------------------- //
shader_manager_class* shader_manager_;
font_shader_class* font_shader_;
bitmap_class* bitmap_;
sprite_class* sprite_;
bool enable_cel_shading_;
// ----------------------------------- //
// ------------ VARIABLES ------------ //
// ----------------------------------- //
float water_height_, water_translation_;
wchar_t* path_;
std::filesystem::path w_folder_;
// ------------------------------------------------- //
// ------------- FPS AND INFO ON SCREEN ------------ //
// ------------------------------------------------- //
timer_class* timer_;
text_class* mouse_strings_;
text_class* render_count_string_;
font_class* font_;
fps_class* fps_;
text_class* fps_string_;
int previous_fps_;
// ------------------------------------------------- //
// ------------------- OTHER ----------------------- //
// ------------------------------------------------- //
bool should_quit_;
physics* physics_;
float gravity_;
XMVECTOR previous_position_;
ImVec2 window_size_;
int physics_tick_rate_ = 50;
bool can_fixed_update_ = false;
std::thread physics_thread_;
ID3D11Texture2D* back_buffer_texture_;
ID3D11ShaderResourceView* back_buffer_srv_;
stats* stats_;
// ------------------------------------------------- //
// ------------------- Culling --------------------- //
// ------------------------------------------------- //
frustum frustum_culling_;
int render_count_;
float frustum_culling_tolerance_ = 5.f;
// ------------------------------------------------- //
// -------------------- Input ---------------------- //
// ------------------------------------------------- //
input inputs_;
bool tab_was_pressed_;
};
#endif

View File

@ -1,327 +0,0 @@
#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 "skybox.h"
#include <fstream>
#include <WICTextureLoader.h>
#include <comdef.h> // Pour _com_error
#include <chrono>
#include <thread>
#include <map>
#include <algorithm>
#include <DirectXMath.h>
#include <mutex>
/////////////
// GLOBALS //
/////////////
const bool FULL_SCREEN = false;
const float SCREEN_DEPTH = 1000.0f;
const float SCREEN_NEAR = 0.3f;
struct Input
{
bool m_KeyLeft = false;
bool m_KeyRight = false;
bool m_KeyUp = false;
bool m_KeyDown = false;
};
////////////////////////////////////////////////////////////////////////////////
// Class name: ApplicationClass
////////////////////////////////////////////////////////////////////////////////
class ApplicationClass
{
public:
ApplicationClass();
~ApplicationClass();
D3DClass* GetDirect3D();
RenderTextureClass* GetSceneTexture() const { return m_SceneTexture; };
RenderTextureClass* GetRenderTexture() const { return m_RenderTexture; };
RenderTextureClass* GetRefractionTexture() const { return m_RefractionTexture; };
RenderTextureClass* GetReflectionTexture() const { return m_ReflectionTexture; };
int GetTotalVertexCount() const;
int GetTotalTriangleCount() const;
int GetVisibleTriangleCount() const;
void CreateBigCube(int sideCount);
void ProcessTerrainGeneration();
bool Initialize(int, int, HWND, bool IsVulkan);
void Shutdown();
bool Frame(InputClass*);
void PhysicsThreadFunction();
int GetPhysicsTickRate() const { return m_PhysicsTickRate; };
void SetPhysicsTickRate(int physicsTickRate) { m_PhysicsTickRate = physicsTickRate; };
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(std::wstring& 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; };
LightClass* GetSunLight() const { return m_SunLight; };
bool GetShouldQuit() const { return m_ShouldQuit; };
void SetShouldQuit(bool shouldQuit) { m_ShouldQuit = shouldQuit; };
void SetCelShading(bool enable) { m_enableCelShading = enable; };
void SetVsync(bool vsync);
bool GetVsync() const { return VSYNC_ENABLED; };
HWND GetHwnd() const;
void SetHwnd(HWND hwnd);
bool IsWindowed() const;
void SetWindowed(bool windowed);
void SetWindowSize(ImVec2 size) { windowSize = size; };
ImVec2 GetWindowSize() const { return windowSize; };
float GetAspectRatio() const { return (float)m_screenWidth / (float)m_screenHeight; };
Physics* GetPhysics() const { return m_Physics; };
// ------------------------------------- //
// --------------- Stats --------------- //
// ------------------------------------- //
int GetCurrentFps() const;
int GetMinFps() const;
int GetMaxFps() const;
float GetFrameTime() const;
int GetDrawCalls() const;
void ResetFpsStats();
void IncrementDrawCallCount();
void ResetDrawCallCount();
// ----------------------------------- //
// ------------- Culling ------------- //
// ----------------------------------- //
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; };
bool GetCanFixedUpdate() const { return CanFixedUpdate; };
void SetCanFixedUpdate(bool canFixedUpdate) { CanFixedUpdate = canFixedUpdate; };
ID3D11ShaderResourceView* GetBackBufferSRV() const {return m_BackBufferSRV;};
// Save and load scene
void SaveScene();
bool LoadScene();
void SetScenePath(std::string path) { m_scenePath = path; };
std::wstring GetScenePath();
std::string ConvertWStringToString(const std::wstring& wstr);
private:
bool Render(float, float, float, float, float);
bool RenderPhysics(bool keyLeft, bool keyRight, bool keyUp, bool keyDown, float deltaTime);
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);
void UpdateSkyboxPosition();
public :
std::vector<ID3D11ShaderResourceView*> textures;
private :
// Thread de culling
std::thread m_CullingThread;
std::atomic<bool> m_CullingActive;
std::mutex m_ObjectsMutex;
void CullingThreadFunction();
std::mutex m_TerrainMutex;
std::vector<std::tuple<float, float, float, std::string, int>> m_TerrainGenerationData;
bool m_TerrainGenerationReady;
int m_NextTerrainObjectId;
// ------------------------------------- //
// ------------- 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;
std::string m_scenePath;
// ------------------------------------- //
// ------------- RENDERING ------------- //
// ------------------------------------- //
XMMATRIX m_baseViewMatrix;
RenderTextureClass* m_RenderTexture, * m_RefractionTexture, * m_ReflectionTexture;
RenderTextureClass* m_SceneTexture;
DisplayPlaneClass* m_DisplayPlane;
int m_screenWidth, m_screenHeight;
CameraClass* m_Camera;
PositionClass* m_Position;
int m_drawcalls;
// ------------------------------------ //
// ------------- 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;
std::vector<Object*> m_ImportedObject;
int m_ObjectId = 0;
std::vector<std::reference_wrapper<std::vector<Object*>>> m_RenderQueues;
std::vector<Object*> m_Skybox;
// ----------------------------------- //
// ------------- LIGHTS -------------- //
// ----------------------------------- //
LightClass* m_Light;
std::vector<LightClass*> m_Lights;
int m_numLights;
LightClass* m_SunLight;
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;
ImVec2 windowSize;
int m_PhysicsTickRate = 50;
bool CanFixedUpdate = false;
std::thread m_PhysicsThread;
ID3D11Texture2D* m_BackBufferTexture;
ID3D11ShaderResourceView* m_BackBufferSRV;
// ------------------------------------------------- //
// ------------------- Culling --------------------- //
// ------------------------------------------------- //
Frustum m_FrustumCulling;
int m_renderCount;
float m_FrustumCullingTolerance = 5.f;
// ------------------------------------------------- //
// -------------------- Input ---------------------- //
// ------------------------------------------------- //
Input m_Inputs;
};
#endif

View File

@ -0,0 +1,59 @@
#ifndef _BITMAPCLASS_H_
#define _BITMAPCLASS_H_
//////////////
// INCLUDES //
//////////////
#include <directxmath.h>
using namespace DirectX;
///////////////////////
// MY CLASS INCLUDES //
///////////////////////
#include "texture_class.h"
////////////////////////////////////////////////////////////////////////////////
// Class name: bitmap_class
////////////////////////////////////////////////////////////////////////////////
class bitmap_class
{
private:
struct vertex_type
{
XMFLOAT3 position;
XMFLOAT2 texture;
};
public:
bitmap_class();
bitmap_class(const bitmap_class&);
~bitmap_class();
bool initialize(ID3D11Device*, ID3D11DeviceContext*, int, int, char*, int, int);
void shutdown();
bool render(ID3D11DeviceContext*);
int get_index_count();
ID3D11ShaderResourceView* get_texture();
void set_render_location(int, int);
private:
bool initialize_buffers(ID3D11Device*);
void shutdown_buffers();
bool update_buffers(ID3D11DeviceContext*);
void render_buffers(ID3D11DeviceContext*);
bool load_texture(ID3D11Device*, ID3D11DeviceContext*, char*);
void release_texture();
private:
ID3D11Buffer* vertex_buffer_, * index_buffer_;
int vertex_count_, index_count_, screen_width_, screen_height_, bitmap_width_, bitmap_height_, render_x_, render_y_, prev_pos_x_, prev_pos_y_;
texture_class* texture_;
};
#endif

View File

@ -1,59 +0,0 @@
#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,46 @@
////////////////////////////////////////////////////////////////////////////////
// Filename: cameraclass.h
////////////////////////////////////////////////////////////////////////////////
#ifndef _CAMERACLASS_H_
#define _CAMERACLASS_H_
//////////////
// INCLUDES //
//////////////
#include <directxmath.h>
using namespace DirectX;
////////////////////////////////////////////////////////////////////////////////
// Class name: camera_class
////////////////////////////////////////////////////////////////////////////////
class camera_class
{
public:
camera_class();
camera_class(const camera_class&);
~camera_class();
void set_position(float, float, float);
void set_rotation(float, float, float);
XMFLOAT3 get_position();
XMFLOAT3 get_rotation();
void render();
XMMATRIX get_view_matrix(XMMATRIX& view_matrix) const;
void render_reflection(float);
void get_reflection_view_matrix(XMMATRIX&) const;
private:
float position_x_, position_y_, position_z_;
float rotation_x_, rotation_y_, rotation_z_;
XMMATRIX view_matrix_;
XMMATRIX reflection_view_matrix_;
};
#endif

View File

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

@ -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 "font_shader_class.h"
#include "font_class.h"
#include "text_class.h"
using namespace DirectX;
////////////////////////////////////////////////////////////////////////////////
// Class name: d_3d_class
////////////////////////////////////////////////////////////////////////////////
class d_3d_class
{
public:
d_3d_class();
d_3d_class(const d_3d_class&);
~d_3d_class();
virtual bool initialize(int, int, bool, HWND, bool, float, float);
void shutdown();
virtual void begin_scene(float, float, float, float);
virtual void end_scene();
ID3D11Device* get_device();
ID3D11DeviceContext* get_device_context();
//XMMATRIX get_projection_matrix(XMMATRIX& projectionMatrix);
IDXGISwapChain* swap_chain;
IDXGISwapChain* get_swap_chain();
void resize_swap_chain(int, int);
void set_vsync(bool vsync);
XMMATRIX get_projection_matrix() const { return projection_matrix_; };
XMMATRIX get_world_matrix() const { return world_matrix_;};
XMMATRIX get_ortho_matrix() const { return ortho_matrix_; };
void get_video_card_info(char*, int&);
void set_back_buffer_render_target();
void reset_viewport();
void release_resources();
void reset_resources(int newWidth, int newHeight);
void turn_z_buffer_on();
void turn_z_buffer_off();
void enable_alpha_blending();
void disable_alpha_blending();
private:
bool vsync_enabled_;
int video_card_memory_;
char video_card_description_[128];
ID3D11Device* device_;
ID3D11DeviceContext* device_context_;
ID3D11RenderTargetView* render_target_view_;
ID3D11Texture2D* depth_stencil_buffer_;
ID3D11DepthStencilState* depth_stencil_state_;
ID3D11DepthStencilView* depth_stencil_view_;
ID3D11RasterizerState* raster_state_;
XMMATRIX projection_matrix_;
XMMATRIX world_matrix_;
XMMATRIX ortho_matrix_;
D3D11_VIEWPORT viewport_;
ID3D11DepthStencilState* depth_disabled_stencil_state_;
ID3D11BlendState* alpha_enable_blending_state_;
ID3D11BlendState* alpha_disable_blending_state_;
};
#endif

View File

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

View File

@ -13,13 +13,13 @@ using namespace DirectX;
/////////////////////// ///////////////////////
// MY CLASS INCLUDES // // MY CLASS INCLUDES //
/////////////////////// ///////////////////////
#include "textureclass.h" #include "texture_class.h"
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Class name: FontClass // Class name: font_class
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class FontClass class font_class
{ {
private: private:
struct FontType struct FontType
@ -35,9 +35,9 @@ private:
}; };
public: public:
FontClass(); font_class();
FontClass(const FontClass&); font_class(const font_class&);
~FontClass(); ~font_class();
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;
TextureClass* m_Texture; texture_class* m_Texture;
float m_fontHeight; float m_fontHeight;
int m_spaceSize; int m_spaceSize;
}; };

View File

@ -15,14 +15,14 @@
#include <mmsystem.h> #include <mmsystem.h>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Class name: FpsClass // Class name: fps_class
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class FpsClass class fps_class
{ {
public: public:
FpsClass(); fps_class();
FpsClass(const FpsClass&); fps_class(const fps_class&);
~FpsClass(); ~fps_class();
void Initialize(); void Initialize();
void Frame(); void Frame();

View File

@ -0,0 +1,22 @@
#pragma once
#include <chrono>
class fps_limiter {
public:
explicit fps_limiter(const float target_fps = 60.0f)
: min_delta_(1.0f / target_fps), last_time_(std::chrono::high_resolution_clock::now()) {}
// Retourne true si la fonction peut etre executee
bool should_run() {
const auto now = std::chrono::high_resolution_clock::now();
if (const float elapsed = std::chrono::duration<float>(now - last_time_).count(); elapsed >= min_delta_) {
last_time_ = now;
return true;
}
return false;
}
private:
float min_delta_;
std::chrono::high_resolution_clock::time_point last_time_;
};

View File

@ -1,7 +1,7 @@
#include <DirectXMath.h> #include <DirectXMath.h>
using namespace DirectX; using namespace DirectX;
class Frustum class frustum
{ {
public: public:
void ConstructFrustum(float screenDepth, XMMATRIX projectionMatrix, XMMATRIX viewMatrix); void ConstructFrustum(float screenDepth, XMMATRIX projectionMatrix, XMMATRIX viewMatrix);

View File

@ -4,15 +4,26 @@
#include "Logger.h" #include "Logger.h"
#include "sceneManager.h" #include "sceneManager.h"
#include "fps_limiter.h"
#include <imgui.h> #include <imgui.h>
#include <imgui_impl_dx11.h> #include <imgui_impl_dx11.h>
#include <imgui_impl_win32.h> #include <imgui_impl_win32.h>
#include <windows.h> #include <windows.h>
#include <deque> #include <deque>
#include "rendertextureclass.h" #include <functional>
class ApplicationClass; #include "render_texture_class.h"
#include "scene_manager.h"
class application_class;
class stats;
struct widget_entry
{
bool* show;
std::function<void()> func;
};
class imguiManager class imguiManager
{ {
@ -22,29 +33,32 @@ public:
bool Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceContext* deviceContext); bool Initialize(HWND hwnd, ID3D11Device* device, ID3D11DeviceContext* deviceContext);
void Shutdown(); void Shutdown();
void Render(ApplicationClass* app); void Render();
void NewFrame(); void NewFrame();
void SetupDockspace(ApplicationClass* app); void SetupDockspace();
// Widgets // Widgets
void WidgetSpeedSlider(float* speed); void WidgetSpeedSlider(float* speed);
void WidgetButton(); void WidgetButton();
void WidgetFPS(); void WidgetFPS();
void WidgetAddObject(ApplicationClass* app); void WidgetAddObject();
void WidgetObjectWindow(ApplicationClass* app); void WidgetObjectWindow();
void WidgetTerrainWindow(ApplicationClass* app); void WidgetTerrainWindow();
void WidgetLightWindow(ApplicationClass* app); void WidgetLightWindow();
void WidgetEngineSettingsWindow(ApplicationClass* app); void WidgetEngineSettingsWindow();
void WidgetRenderWindow(ApplicationClass* app, ImVec2 availableSize); void WidgetRenderWindow(ImVec2 availableSize);
void WidgetLogWindow(ApplicationClass* app); void WidgetLogWindow();
void WidgetRenderStats(ApplicationClass* app); void WidgetRenderStats();
bool ImGuiWidgetRenderer(ApplicationClass* app); bool ImGuiWidgetRenderer();
void SetWindowSize(ImVec2 size) { windowSize = size; } void SetWindowSize(ImVec2 size) { windowSize = size; }
ImVec2 GetWindowSize() const { return windowSize; } ImVec2 GetWindowSize() const { return windowSize; }
// Getters
void SetApp(application_class* app) { app_ = app; }
// Shader toggles // Shader toggles
bool m_EnableCelShading; bool m_EnableCelShading;
@ -59,6 +73,11 @@ private:
// ----------------- Variables ----------------- // // ----------------- Variables ----------------- //
// --------------------------------------------- // // --------------------------------------------- //
std::vector<widget_entry> widgets_;
application_class* app_;
scene_manager* scene_manager_;
stats* stats_;
bool showObjectWindow; bool showObjectWindow;
bool showTerrainWindow; bool showTerrainWindow;
@ -68,6 +87,8 @@ private:
bool showLogWindow; bool showLogWindow;
bool showStatsWindow; bool showStatsWindow;
int m_SideCount = 0;
static const int FRAME_HISTORY_COUNT = 3600; // 1min secondes à 60 FPS static const int FRAME_HISTORY_COUNT = 3600; // 1min secondes à 60 FPS
float m_frameTimeHistory[FRAME_HISTORY_COUNT] = {}; float m_frameTimeHistory[FRAME_HISTORY_COUNT] = {};
int m_frameTimeHistoryIndex = 0; int m_frameTimeHistoryIndex = 0;
@ -81,9 +102,20 @@ private:
ID3D11DeviceContext* m_deviceContext; ID3D11DeviceContext* m_deviceContext;
ImVec2 windowSize; ImVec2 windowSize;
RenderTextureClass* m_renderTexture; render_texture_class* m_renderTexture;
const std::deque<Logger::LogEntry>& logBuffer = Logger::Get().GetLogBuffer(); const std::deque<Logger::LogEntry>& logBuffer = Logger::Get().GetLogBuffer();
int current_fps_, min_fps_, max_fps_, draw_calls_, total_vertex_count_, total_triangle_count_, visible_triangle_count_;
float current_frame_time_, min_frame_time_, max_frame_time_ ;
// gpu information
char card_name_[128];
int video_memory_ = 0;
// cpu information
std::string cpu_name_;
std::string version_driver_;
}; };
#endif #endif

View File

@ -19,18 +19,18 @@
#include <dinput.h> #include <dinput.h>
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Class name: InputClass // Class name: input_class
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class InputClass class input_class
{ {
public: public:
InputClass(); input_class();
InputClass(const InputClass&); input_class(const input_class&);
~InputClass(); ~input_class();
bool Initialize(HINSTANCE, HWND, int, int); virtual bool Initialize(HINSTANCE, HWND, int, int);
void Shutdown(); virtual void Shutdown();
bool Frame(); virtual bool Frame();
bool IsEscapePressed() const; bool IsEscapePressed() const;
void GetMouseLocation(int&, int&) const; void GetMouseLocation(int&, int&) const;
@ -50,10 +50,8 @@ public:
bool IsSPressed() const; bool IsSPressed() const;
bool IsQPressed() const; bool IsQPressed() const;
bool IsEPressed()const; bool IsEPressed()const;
bool IsTildePressed() const;
bool IsTildeReleased() const;
bool IsKeyDown(unsigned int) const; bool IsKeyDown(unsigned int) const;
bool is_key_pressed(const unsigned int);
private: private:
bool m_keys[256]; bool m_keys[256];

View File

@ -14,14 +14,14 @@ using namespace DirectX;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Class name: LightClass // Class name: light_class
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class LightClass class light_class
{ {
public: public:
LightClass(); light_class();
LightClass(const LightClass&); light_class(const light_class&);
~LightClass(); ~light_class();
void SetAmbientColor(float, float, float, float); void SetAmbientColor(float, float, float, float);
void SetDiffuseColor(float, float, float, float); void SetDiffuseColor(float, float, float, float);

View File

@ -20,7 +20,7 @@ using namespace std;
/////////////////////// ///////////////////////
// MY CLASS INCLUDES // // MY CLASS INCLUDES //
/////////////////////// ///////////////////////
#include "textureclass.h" #include "texture_class.h"
enum class TextureType enum class TextureType
{ {
@ -46,7 +46,7 @@ struct TextureContainer
std::vector<std::wstring> alphaPaths; std::vector<std::wstring> alphaPaths;
// Get the vector of textures based on the type // Get the vector of textures_ based on the type
std::vector<ID3D11ShaderResourceView*>& Get(TextureType type) const { std::vector<ID3D11ShaderResourceView*>& Get(TextureType type) const {
switch (type) { switch (type) {
case TextureType::Diffuse: return const_cast<std::vector<ID3D11ShaderResourceView*>&>(diffuse); case TextureType::Diffuse: return const_cast<std::vector<ID3D11ShaderResourceView*>&>(diffuse);
@ -57,7 +57,7 @@ struct TextureContainer
} }
} }
// Get the vector of textures paths based on the type // Get the vector of textures_ paths based on the type
std::vector<std::wstring> GetPaths(TextureType type) const { std::vector<std::wstring> GetPaths(TextureType type) const {
switch (type) switch (type)
{ {
@ -87,7 +87,7 @@ struct TextureContainer
return L""; return L"";
} }
// Release all textures and textures paths // Release all textures_ and textures_ paths
void ReleaseAll() { void ReleaseAll() {
ReleaseVector(diffuse); ReleaseVector(diffuse);
@ -145,9 +145,9 @@ private:
} }
}; };
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Class name: ModelClass // Class name: model_class
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class ModelClass class model_class
{ {
protected: protected:
@ -200,14 +200,15 @@ protected:
}; };
public: public:
ModelClass(); model_class();
ModelClass(const ModelClass&); model_class(const model_class&) = delete;
~ModelClass(); model_class& operator=(const model_class&) = delete;
~model_class();
//bool Initialize(ID3D11Device*, ID3D11DeviceContext*, char*, std::vector<ID3D11ShaderResourceView*>); //bool initialize(ID3D11Device*, ID3D11DeviceContext*, char*, std::vector<ID3D11ShaderResourceView*>);
// Nouvelle surcharge avec TextureContainer // Nouvelle surcharge avec TextureContainer
bool Initialize(ID3D11Device*, ID3D11DeviceContext*, char*, const TextureContainer&); bool Initialize(ID3D11Device*, ID3D11DeviceContext*, char*, const TextureContainer&);
// Nouvelle méthode - initialisation sans textures // Nouvelle méthode - initialisation sans textures_
bool Initialize(ID3D11Device*, ID3D11DeviceContext*, char*); bool Initialize(ID3D11Device*, ID3D11DeviceContext*, char*);
void Shutdown(); void Shutdown();
void Render(ID3D11DeviceContext*); void Render(ID3D11DeviceContext*);
@ -217,7 +218,7 @@ public:
// TEXTURE // // TEXTURE //
//ID3D11ShaderResourceView* GetTexture(int index) const; //ID3D11ShaderResourceView* get_texture(int index) const;
ID3D11ShaderResourceView* GetTexture(TextureType type, int index) const; ID3D11ShaderResourceView* GetTexture(TextureType type, int index) const;
//bool ChangeTexture(ID3D11Device* device, ID3D11DeviceContext* deviceContext, std::wstring filename, int index); //bool ChangeTexture(ID3D11Device* device, ID3D11DeviceContext* deviceContext, std::wstring filename, int index);
@ -240,7 +241,6 @@ private:
bool InitializeBuffers(ID3D11Device*); bool InitializeBuffers(ID3D11Device*);
void ShutdownBuffers(); void ShutdownBuffers();
void RenderBuffers(ID3D11DeviceContext*); void RenderBuffers(ID3D11DeviceContext*);
bool LoadTextures(ID3D11Device*, ID3D11DeviceContext*, vector<string> filename);
void ReleaseTextures(); void ReleaseTextures();
bool LoadModel(char*); bool LoadModel(char*);

View File

@ -1,9 +1,9 @@
#pragma once #pragma once
#include "modelclass.h" #include "model_class.h"
#include <WICTextureLoader.h> #include <WICTextureLoader.h>
#include <SimpleMath.h> #include <SimpleMath.h>
#include "d3dclass.h" #include "d_3d_class.h"
enum class ObjectType enum class ObjectType
{ {
@ -26,11 +26,14 @@ enum class ShaderType
ALPHA_MAPPING ALPHA_MAPPING
}; };
class Object : public ModelClass class object : public model_class
{ {
public: public:
Object(); object();
~Object(); ~object();
object(const object&) = delete;
object& operator=(const object&) = delete;
void SetScaleMatrix(XMMATRIX scaleMatrix); void SetScaleMatrix(XMMATRIX scaleMatrix);
void SetRotateMatrix(XMMATRIX rotateMatrix); void SetRotateMatrix(XMMATRIX rotateMatrix);
@ -50,7 +53,6 @@ public:
XMVECTOR GetPosition(); XMVECTOR GetPosition();
XMVECTOR GetRotation(); XMVECTOR GetRotation();
void Render(ID3D11DeviceContext* deviceContext);
XMVECTOR GetScale(); XMVECTOR GetScale();
void SetVelocity(XMVECTOR); void SetVelocity(XMVECTOR);
@ -100,8 +102,7 @@ public:
std::string ObjectTypeToString(ObjectType objectType); std::string ObjectTypeToString(ObjectType objectType);
void LaunchObject(); void LaunchObject();
bool LoadTexturesFromPath(std::vector<std::wstring>& texturePaths, TextureContainer& texturesContainer, bool LoadTexturesFromPath(std::vector<std::wstring>& texturePaths, TextureContainer& texturesContainer,d_3d_class* m_Direct3D);
D3DClass* m_Direct3D);
bool SetupInstancing(ID3D11Device* device, const std::vector<XMMATRIX>& instanceTransforms); bool SetupInstancing(ID3D11Device* device, const std::vector<XMMATRIX>& instanceTransforms);
void EnableInstancing(bool enabled); void EnableInstancing(bool enabled);
void SetInstanceCount(int count); void SetInstanceCount(int count);
@ -149,9 +150,4 @@ private:
float m_initialStretch = 0.0f; float m_initialStretch = 0.0f;
float m_springConstant = 10.0f; float m_springConstant = 10.0f;
bool m_instancingEnabled;
int m_instanceCount;
ID3D11Buffer* m_instanceBuffer;
std::vector<XMMATRIX> m_instanceTransforms;
}; };

View File

@ -4,21 +4,21 @@
#include "object.h" #include "object.h"
#include "math.h" #include "math.h"
class Physics : public Object class physics : public object
{ {
public: public:
Physics(); physics();
explicit Physics(const Physics&); // Use explicit to avoid implicit conversion explicit physics(const physics&); // Use explicit to avoid implicit conversion
~Physics(); ~physics();
XMVECTOR GetGravity() const; // Get the gravity value XMVECTOR GetGravity() const; // Get the gravity value
void SetGravity(XMVECTOR gravity); // Define the gravity value void SetGravity(XMVECTOR gravity); // Define the gravity value
void ApplyGravity(Object*, float); // Apply gravity to an object void ApplyGravity(object*, float); // Apply gravity to an object
void AddForce(Object*, XMVECTOR); void AddForce(object*, XMVECTOR);
bool IsColliding(Object*, Object*); bool IsColliding(object*, object*);
bool CubesOverlap(Object*, Object*); bool CubesOverlap(object*, object*);
bool SpheresOverlap(Object*, Object*); bool SpheresOverlap(object*, object*);
bool SphereCubeOverlap(Object*, Object*); bool SphereCubeOverlap(object*, object*);
private: private:
XMVECTOR m_gravity; XMVECTOR m_gravity;

View File

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

View File

@ -15,14 +15,14 @@ using namespace DirectX;
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Class name: RenderTextureClass // Class name: render_texture_class
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class RenderTextureClass class render_texture_class
{ {
public: public:
RenderTextureClass(); render_texture_class();
RenderTextureClass(const RenderTextureClass&); render_texture_class(const render_texture_class&);
~RenderTextureClass(); ~render_texture_class();
bool Initialize(ID3D11Device*, int, int, float, float, int); bool Initialize(ID3D11Device*, int, int, float, float, int);
void Shutdown(); void Shutdown();

View File

@ -0,0 +1,35 @@
#pragma once
#include <filesystem>
#include <string>
#include <vector>
class d_3d_class;
class object;
class application_class;
class scene_manager
{
public:
scene_manager();
~scene_manager();
bool initialize(application_class* app);
bool shutdown();
bool save_scene_as();
bool save_scene();
bool load_scene();
std::wstring get_scene_path();
std::string convert_w_string_to_string(const std::wstring& w_str);
private:
application_class* app_;
std::string scene_path_;
std::vector<object*> object_vec_;
int object_id_;
std::filesystem::path w_folder_;
d_3d_class* direct_3d_;
};

View File

@ -0,0 +1,25 @@
#pragma once
#include <d3d11.h>
#include <directxmath.h>
class shadow_map {
public:
shadow_map();
~shadow_map();
bool initialize(ID3D11Device* device, int width, int height);
void shutdown();
void set_render_target(ID3D11DeviceContext* context);
void clear_render_target(ID3D11DeviceContext* context, float depth = 1.0f);
ID3D11ShaderResourceView* get_shader_resource_view();
private:
ID3D11Texture2D* depth_texture_;
ID3D11DepthStencilView* depth_stencil_view_;
ID3D11ShaderResourceView* shader_resource_view_;
int width_, height_;
};

View File

@ -13,13 +13,13 @@ using namespace DirectX;
/////////////////////// ///////////////////////
// MY CLASS INCLUDES // // MY CLASS INCLUDES //
/////////////////////// ///////////////////////
#include "textureclass.h" #include "texture_class.h"
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Class name: SpriteClass // Class name: sprite_class
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class SpriteClass class sprite_class
{ {
private: private:
struct VertexType struct VertexType
@ -29,9 +29,9 @@ private:
}; };
public: public:
SpriteClass(); sprite_class();
SpriteClass(const SpriteClass&); sprite_class(const sprite_class&);
~SpriteClass(); ~sprite_class();
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;
TextureClass* m_Textures; texture_class* m_Textures;
float m_frameTime, m_cycleTime; float m_frameTime, m_cycleTime;
int m_currentTexture, m_textureCount; int m_currentTexture, m_textureCount;
}; };

View File

@ -0,0 +1,58 @@
#pragma once
#include <thread>
#include <vector>
#include "fps_class.h"
#include "object.h"
#include <intrin.h> // Pour __cpuid
#include <dxgi.h> // Pour DXGI
#pragma comment(lib, "dxgi.lib")
class stats
{
public:
stats();
~stats();
bool initialize(application_class* app);
void update_geometric_stats();
void update_display_stats();
int get_total_vertex_count() const;
int get_total_triangle_count() const;
int get_visible_triangle_count() const;
int get_current_fps() const { return current_fps_; };
int get_min_fps() const { return min_fps_; };
int get_max_fps() const { return max_fps_; };
float get_frame_time() const { return current_frame_time_;};
int get_draw_calls() const { return drawcalls_; };
void increment_draw_call_count() { drawcalls_++; };
void reset_draw_call_count() { drawcalls_ = 0; };
std::string get_cpu_name();
std::string get_gpu_driver_version(ID3D11Device* device);
private:
std::thread update_geometric_thread_;
std::thread update_display_thread_;
fps_class* fps_;
int drawcalls_;
application_class* app_;
std::vector<object*> object_vec_;
std::vector<object*> cubes_vec_;
std::vector<object*> terrain_chunk_vec_;
int total_vertex_count_;
int total_triangle_count_;
int visible_triangle_count_ = 0;
int current_fps_ = 0;
int min_fps_ = 0;
int max_fps_ = 0;
float current_frame_time_ = 0.0f;
};

View File

@ -0,0 +1,91 @@
#ifndef _SYSTEMCLASS_H_
#define _SYSTEMCLASS_H_
#define WIN32_LEAN_AND_MEAN
static bool DEBUG_MODE = true;
#include "Logger.h"
#include "input_class.h"
#include "application_class.h"
#include "imguiManager.h"
#include <mutex>
#include <filesystem>
#include <commdlg.h>
#include "../resources.h"
#include <chrono>
class system_class
{
public:
system_class();
system_class(const system_class&);
~system_class();
bool initialize();
void shutdown();
void run();
LRESULT CALLBACK message_handler(HWND, UINT, WPARAM, LPARAM);
void send_path(wchar_t* path, std::filesystem::path w_folder);
application_class* get_application_class() const { return application_; }
void set_application_class(application_class* application) {
if (application_) {
delete application_;
}
application_ = application;
}
input_class* get_input_class() const { return input_; }
void set_input(input_class* input) {
if (input_) {
delete input_;
}
input_ = input;
}
HWND get_hwnd() const { return hwnd_; }
void set_d_3D_mock(d_3d_class* mock) {application_->set_direct_3d(mock);}
protected:
bool frame();
void initialize_windows(int&, int&);
void shutdown_windows();
private:
LPCWSTR application_name_;
HINSTANCE hinstance_;
HWND hwnd_;
input_class* input_;
application_class* application_;
imguiManager* imgui_manager_;
int initial_window_width_;
int initial_window_height_;
bool is_direct_3d_initialized_;
bool is_resizing_ = false;
bool is_debug_key_pressed_ = false;
std::mutex render_mutex_;
};
/////////////////////////
// FUNCTION PROTOTYPES //
/////////////////////////
static LRESULT CALLBACK wnd_proc(HWND, UINT, WPARAM, LPARAM);
/////////////
// GLOBALS //
/////////////
static system_class* application_handle = 0;
#endif

View File

@ -1,73 +0,0 @@
#ifndef _SYSTEMCLASS_H_
#define _SYSTEMCLASS_H_
#define WIN32_LEAN_AND_MEAN
static bool DEBUG_MODE = true;
#include "Logger.h"
#include "inputclass.h"
#include "applicationclass.h"
#include "imguiManager.h"
#include <mutex>
#include <filesystem>
#include <commdlg.h>
#include "../resources.h"
#include <chrono>
class SystemClass
{
public:
SystemClass();
SystemClass(const SystemClass&);
~SystemClass();
bool Initialize();
void Shutdown();
void Run();
LRESULT CALLBACK MessageHandler(HWND, UINT, WPARAM, LPARAM);
void SendPath(wchar_t* path, std::filesystem::path WFolder);
void GetScenePath();
protected:
bool Frame();
void InitializeWindows(int&, int&);
void ShutdownWindows();
private:
LPCWSTR m_applicationName;
HINSTANCE m_hinstance;
HWND m_hwnd;
InputClass* m_Input;
ApplicationClass* m_Application;
imguiManager* m_imguiManager;
int m_initialWindowWidth;
int m_initialWindowHeight;
bool m_isDirect3DInitialized;
bool m_isResizing = false;
bool m_IsDebugKeyPressed = false;
std::mutex renderMutex;
};
/////////////////////////
// FUNCTION PROTOTYPES //
/////////////////////////
static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
/////////////
// GLOBALS //
/////////////
static SystemClass* ApplicationHandle = 0;
#endif

View File

@ -5,11 +5,11 @@
/////////////////////// ///////////////////////
// MY CLASS INCLUDES // // MY CLASS INCLUDES //
/////////////////////// ///////////////////////
#include "fontclass.h" #include "font_class.h"
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Class name: TextClass // Class name: text_class
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class TextClass class text_class
{ {
private: private:
struct VertexType struct VertexType
@ -19,21 +19,21 @@ private:
}; };
public: public:
TextClass(); text_class();
TextClass(const TextClass&); text_class(const text_class&);
~TextClass(); ~text_class();
bool Initialize(ID3D11Device*, ID3D11DeviceContext*, int, int, int, FontClass*, char*, int, int, float, float, float); bool Initialize(ID3D11Device*, ID3D11DeviceContext*, int, int, int, font_class*, char*, int, int, float, float, float);
void Shutdown(); void Shutdown();
void Render(ID3D11DeviceContext*); void Render(ID3D11DeviceContext*);
int GetIndexCount(); int GetIndexCount();
bool UpdateText(ID3D11DeviceContext*, FontClass*, char*, int, int, float, float, float); bool UpdateText(ID3D11DeviceContext*, font_class*, char*, int, int, float, float, float);
XMFLOAT4 GetPixelColor(); XMFLOAT4 GetPixelColor();
private: private:
bool InitializeBuffers(ID3D11Device*, ID3D11DeviceContext*, FontClass*, char*, int, int, float, float, float); bool InitializeBuffers(ID3D11Device*, ID3D11DeviceContext*, font_class*, char*, int, int, float, float, float);
void ShutdownBuffers(); void ShutdownBuffers();
void RenderBuffers(ID3D11DeviceContext*); void RenderBuffers(ID3D11DeviceContext*);

View File

@ -11,9 +11,9 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Class name: TextureClass // Class name: texture_class
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
class TextureClass class texture_class
{ {
private: private:
struct TargaHeader struct TargaHeader
@ -26,9 +26,9 @@ private:
}; };
public: public:
TextureClass(); texture_class();
TextureClass(const TextureClass&); texture_class(const texture_class&);
~TextureClass(); ~texture_class();
bool Initialize(ID3D11Device*, ID3D11DeviceContext*, std::string); bool Initialize(ID3D11Device*, ID3D11DeviceContext*, std::string);
void Shutdown(); void Shutdown();

View File

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

View File

@ -1,29 +1,29 @@
#include "alphamapshaderclass.h" #include "alpha_map_shader_class.h"
AlphaMapShaderClass::AlphaMapShaderClass() alpha_map_shader_class::alpha_map_shader_class()
{ {
m_vertexShader = 0; vertex_shader_ = 0;
m_pixelShader = 0; pixel_shader_ = 0;
m_layout = 0; layout_ = 0;
m_matrixBuffer = 0; matrix_buffer_ = 0;
m_sampleState = 0; sample_state_ = 0;
} }
AlphaMapShaderClass::AlphaMapShaderClass(const AlphaMapShaderClass& other) alpha_map_shader_class::alpha_map_shader_class(const alpha_map_shader_class& other)
{ {
} }
AlphaMapShaderClass::~AlphaMapShaderClass() alpha_map_shader_class::~alpha_map_shader_class()
{ {
} }
bool AlphaMapShaderClass::Initialize(ID3D11Device* device, HWND hwnd) bool alpha_map_shader_class::initialize(ID3D11Device* device, HWND hwnd)
{ {
Logger::Get().Log("Initializing AlphaMapShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing alpha_map_shader_class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
bool result; bool result;
wchar_t vsFilename[128]; wchar_t vsFilename[128];
@ -46,8 +46,8 @@ bool AlphaMapShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
return false; return false;
} }
// Initialize the vertex and pixel shaders. // initialize the vertex and pixel shaders.
result = InitializeShader(device, hwnd, vsFilename, psFilename); result = initialize_shader(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 AlphaMapShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
} }
void AlphaMapShaderClass::Shutdown() void alpha_map_shader_class::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.
ShutdownShader(); shutdown_shader();
return; return;
} }
bool AlphaMapShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, bool alpha_map_shader_class::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 = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2, texture3); result = set_shader_parameters(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 AlphaMapShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCo
} }
// Now render the prepared buffers with the shader. // Now render the prepared buffers with the shader.
RenderShader(deviceContext, indexCount); render_shader(deviceContext, indexCount);
return true; return true;
} }
bool AlphaMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) bool alpha_map_shader_class::initialize_shader(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 AlphaMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHA
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 AlphaMapShaderClass::InitializeShader(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)
{ {
OutputShaderErrorMessage(errorMessage, hwnd, vsFilename); output_shader_error_message(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 AlphaMapShaderClass::InitializeShader(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)
{ {
OutputShaderErrorMessage(errorMessage, hwnd, psFilename); output_shader_error_message(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 AlphaMapShaderClass::InitializeShader(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, &m_vertexShader); result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
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 AlphaMapShaderClass::InitializeShader(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, &m_pixelShader); result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
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 AlphaMapShaderClass::InitializeShader(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(), &m_layout); vertexShaderBuffer->GetBufferSize(), &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 AlphaMapShaderClass::InitializeShader(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(MatrixBufferType); matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
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, &m_matrixBuffer); result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
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 AlphaMapShaderClass::InitializeShader(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, &m_sampleState); result = device->CreateSamplerState(&samplerDesc, &sample_state_);
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 AlphaMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHA
} }
void AlphaMapShaderClass::ShutdownShader() void alpha_map_shader_class::shutdown_shader()
{ {
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 (m_sampleState) if (sample_state_)
{ {
Logger::Get().Log("Releasing sampler state", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Releasing sampler state", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
m_sampleState->Release(); sample_state_->Release();
m_sampleState = 0; sample_state_ = 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 (m_matrixBuffer) if (matrix_buffer_)
{ {
Logger::Get().Log("Releasing constant buffer", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Releasing constant buffer", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
m_matrixBuffer->Release(); matrix_buffer_->Release();
m_matrixBuffer = 0; matrix_buffer_ = 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 (m_layout) if (layout_)
{ {
Logger::Get().Log("Releasing layout", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Releasing layout", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
m_layout->Release(); layout_->Release();
m_layout = 0; 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 (m_pixelShader) if (pixel_shader_)
{ {
Logger::Get().Log("Releasing pixel shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Releasing pixel shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
m_pixelShader->Release(); pixel_shader_->Release();
m_pixelShader = 0; pixel_shader_ = 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 (m_vertexShader) if (vertex_shader_)
{ {
Logger::Get().Log("Releasing vertex shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Releasing vertex shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
m_vertexShader->Release(); vertex_shader_->Release();
m_vertexShader = 0; vertex_shader_ = 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 AlphaMapShaderClass::ShutdownShader()
} }
void AlphaMapShaderClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename) void alpha_map_shader_class::output_shader_error_message(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 AlphaMapShaderClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWN
} }
bool AlphaMapShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, bool alpha_map_shader_class::set_shader_parameters(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;
MatrixBufferType* dataPtr; matrix_buffer_type* dataPtr;
unsigned int bufferNumber; unsigned int bufferNumber;
@ -357,7 +357,7 @@ bool AlphaMapShaderClass::SetShaderParameters(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(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = deviceContext->Map(matrix_buffer_, 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 AlphaMapShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext
} }
// Get a pointer to the data in the constant buffer. // Get a pointer to the data in the constant buffer.
dataPtr = (MatrixBufferType*)mappedResource.pData; dataPtr = (matrix_buffer_type*)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 AlphaMapShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext
dataPtr->projection = projectionMatrix; dataPtr->projection = projectionMatrix;
// Unlock the constant buffer. // Unlock the constant buffer.
deviceContext->Unmap(m_matrixBuffer, 0); deviceContext->Unmap(matrix_buffer_, 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, &m_matrixBuffer); deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
// 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 AlphaMapShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext
} }
void AlphaMapShaderClass::RenderShader(ID3D11DeviceContext* deviceContext, int indexCount) void alpha_map_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
{ {
// Set the vertex input layout. // Set the vertex input layout.
deviceContext->IASetInputLayout(m_layout); deviceContext->IASetInputLayout(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(m_vertexShader, NULL, 0); deviceContext->VSSetShader(vertex_shader_, NULL, 0);
deviceContext->PSSetShader(m_pixelShader, NULL, 0); deviceContext->PSSetShader(pixel_shader_, NULL, 0);
// Set the sampler state in the pixel shader. // Set the sampler state in the pixel shader.
deviceContext->PSSetSamplers(0, 1, &m_sampleState); deviceContext->PSSetSamplers(0, 1, &sample_state_);
// Render the triangle. // render the triangle.
deviceContext->DrawIndexed(indexCount, 0, 0); deviceContext->DrawIndexed(indexCount, 0, 0);
return; return;

View File

@ -1,34 +1,34 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Filename: lightshaderclass.cpp // Filename: lightshaderclass.cpp
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "CelShadingShader.h" #include "celshade_class.h"
CelshadeClass::CelshadeClass() celshade_class::celshade_class()
{ {
m_vertexShader = 0; vertex_shader_ = 0;
m_pixelShader = 0; pixel_shader_ = 0;
m_layout = 0; layout_ = 0;
m_sampleState = 0; sample_state_ = 0;
m_matrixBuffer = 0; matrix_buffer_ = 0;
m_cameraBuffer = 0; camera_buffer_ = 0;
m_sunlightBuffer = 0; sunlight_buffer_ = 0;
m_sunlightColorBuffer = 0; sunlight_color_buffer_ = 0;
m_sunlightPositionBuffer = 0; sunlight_position_buffer_ = 0;
} }
CelshadeClass::CelshadeClass(const CelshadeClass& other) celshade_class::celshade_class(const celshade_class& other)
{ {
} }
CelshadeClass::~CelshadeClass() celshade_class::~celshade_class()
{ {
} }
bool CelshadeClass::Initialize(ID3D11Device* device, HWND hwnd) bool celshade_class::initialize(ID3D11Device* device, HWND hwnd)
{ {
Logger::Get().Log("Initializing LightShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing LightShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize);
@ -52,8 +52,8 @@ bool CelshadeClass::Initialize(ID3D11Device* device, HWND hwnd)
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 = InitializeShader(device, hwnd, vsFilename, psFilename); result = initialize_shader(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);
@ -66,22 +66,22 @@ bool CelshadeClass::Initialize(ID3D11Device* device, HWND hwnd)
} }
void CelshadeClass::Shutdown() void celshade_class::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.
ShutdownShader(); shutdown_shader();
return; return;
} }
bool CelshadeClass::Render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, bool celshade_class::render(ID3D11DeviceContext* deviceContext, int index_count, XMMATRIX world_matrix, XMMATRIX view_matrix, XMMATRIX projection_matrix,
ID3D11ShaderResourceView* texture, XMFLOAT4 diffuseColor, XMFLOAT4 ambientColor, XMFLOAT3 sunDirection, float sunIntensity) ID3D11ShaderResourceView* texture, XMFLOAT4 diffuse_color, XMFLOAT4 ambient_color, XMFLOAT3 sun_direction, float sunIntensity)
{ {
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 = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, diffuseColor, ambientColor, sunDirection, sunIntensity); result = set_shader_parameters(deviceContext, world_matrix, view_matrix, projection_matrix, texture, diffuse_color, ambient_color, sun_direction, sunIntensity);
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 CelshadeClass::Render(ID3D11DeviceContext* deviceContext, int indexCount, X
} }
// Now render the prepared buffers with the shader. // Now render the prepared buffers with the shader.
RenderShader(deviceContext, indexCount); render_shader(deviceContext, index_count);
return true; return true;
} }
bool CelshadeClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) bool celshade_class::initialize_shader(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);
@ -109,7 +109,7 @@ bool CelshadeClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsF
D3D11_BUFFER_DESC matrixBufferDesc; D3D11_BUFFER_DESC matrixBufferDesc;
D3D11_BUFFER_DESC sunlightBufferDesc; D3D11_BUFFER_DESC sunlightBufferDesc;
// 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;
@ -120,7 +120,7 @@ bool CelshadeClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsF
{ {
if (errorMessage) if (errorMessage)
{ {
OutputShaderErrorMessage(errorMessage, hwnd, vsFilename); output_shader_error_message(errorMessage, hwnd, vsFilename);
} }
else else
{ {
@ -135,7 +135,7 @@ bool CelshadeClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsF
{ {
if (errorMessage) if (errorMessage)
{ {
OutputShaderErrorMessage(errorMessage, hwnd, psFilename); output_shader_error_message(errorMessage, hwnd, psFilename);
} }
else else
{ {
@ -145,7 +145,7 @@ bool CelshadeClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsF
} }
// Create the vertex shader from the buffer. // Create the vertex shader from the buffer.
result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &m_vertexShader); result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
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);
@ -153,7 +153,7 @@ bool CelshadeClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsF
} }
// Create the pixel shader from the buffer. // Create the pixel shader from the buffer.
result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &m_pixelShader); result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
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);
@ -189,7 +189,7 @@ bool CelshadeClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsF
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(), vertexShaderBuffer->GetBufferSize(), &m_layout); result = device->CreateInputLayout(polygonLayout, numElements, vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), &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);
@ -219,7 +219,7 @@ bool CelshadeClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsF
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
// Create the texture sampler state. // Create the texture sampler state.
result = device->CreateSamplerState(&samplerDesc, &m_sampleState); result = device->CreateSamplerState(&samplerDesc, &sample_state_);
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);
@ -228,14 +228,14 @@ bool CelshadeClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsF
// 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(MatrixBufferType); matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
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, &m_matrixBuffer); result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
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);
@ -244,14 +244,14 @@ bool CelshadeClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsF
// Setup the description of the dynamic sunlight constant buffer that is in the pixel shader. // Setup the description of the dynamic sunlight constant buffer that is in the pixel shader.
sunlightBufferDesc.Usage = D3D11_USAGE_DYNAMIC; sunlightBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
sunlightBufferDesc.ByteWidth = sizeof(SunLightBufferType); sunlightBufferDesc.ByteWidth = sizeof(sun_light_buffer_type);
sunlightBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; sunlightBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
sunlightBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; sunlightBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
sunlightBufferDesc.MiscFlags = 0; sunlightBufferDesc.MiscFlags = 0;
sunlightBufferDesc.StructureByteStride = 0; sunlightBufferDesc.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(&sunlightBufferDesc, NULL, &m_sunlightBuffer); result = device->CreateBuffer(&sunlightBufferDesc, NULL, &sunlight_buffer_);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create sunlight buffer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create sunlight buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -266,70 +266,70 @@ bool CelshadeClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsF
void CelshadeClass::ShutdownShader() void celshade_class::shutdown_shader()
{ {
Logger::Get().Log("Shutting down SunLightShaderClass", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Shutting down SunLightShaderClass", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
// Release the light constant buffers. // Release the light constant buffers.
if (m_sunlightColorBuffer) if (sunlight_color_buffer_)
{ {
m_sunlightColorBuffer->Release(); sunlight_color_buffer_->Release();
m_sunlightColorBuffer = 0; sunlight_color_buffer_ = 0;
} }
if (m_sunlightPositionBuffer) if (sunlight_position_buffer_)
{ {
m_sunlightPositionBuffer->Release(); sunlight_position_buffer_->Release();
m_sunlightPositionBuffer = 0; sunlight_position_buffer_ = 0;
} }
// Release the light constant buffer. // Release the light constant buffer.
if (m_sunlightBuffer) if (sunlight_buffer_)
{ {
m_sunlightBuffer->Release(); sunlight_buffer_->Release();
m_sunlightBuffer = 0; sunlight_buffer_ = 0;
} }
// Release the camera constant buffer. // Release the camera constant buffer.
if (m_cameraBuffer) if (camera_buffer_)
{ {
m_cameraBuffer->Release(); camera_buffer_->Release();
m_cameraBuffer = 0; camera_buffer_ = 0;
} }
// Release the matrix constant buffer. // Release the matrix constant buffer.
if (m_matrixBuffer) if (matrix_buffer_)
{ {
m_matrixBuffer->Release(); matrix_buffer_->Release();
m_matrixBuffer = 0; matrix_buffer_ = 0;
} }
// Release the sampler state. // Release the sampler state.
if (m_sampleState) if (sample_state_)
{ {
m_sampleState->Release(); sample_state_->Release();
m_sampleState = 0; sample_state_ = 0;
} }
// Release the layout. // Release the layout.
if (m_layout) if (layout_)
{ {
m_layout->Release(); layout_->Release();
m_layout = 0; layout_ = 0;
} }
// Release the pixel shader. // Release the pixel shader.
if (m_pixelShader) if (pixel_shader_)
{ {
m_pixelShader->Release(); pixel_shader_->Release();
m_pixelShader = 0; pixel_shader_ = 0;
} }
// Release the vertex shader. // Release the vertex shader.
if (m_vertexShader) if (vertex_shader_)
{ {
m_vertexShader->Release(); vertex_shader_->Release();
m_vertexShader = 0; vertex_shader_ = 0;
} }
Logger::Get().Log("SunLightShaderClass shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("SunLightShaderClass shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
@ -338,7 +338,7 @@ void CelshadeClass::ShutdownShader()
} }
void CelshadeClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename) void celshade_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
{ {
char* compileErrors; char* compileErrors;
unsigned __int64 bufferSize, i; unsigned __int64 bufferSize, i;
@ -374,98 +374,98 @@ void CelshadeClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWND hwnd
} }
bool CelshadeClass::SetShaderParameters( bool celshade_class::set_shader_parameters(
ID3D11DeviceContext* deviceContext, ID3D11DeviceContext* device_context,
XMMATRIX worldMatrix, XMMATRIX world_matrix,
XMMATRIX viewMatrix, XMMATRIX view_matrix,
XMMATRIX projectionMatrix, XMMATRIX projection_matrix,
ID3D11ShaderResourceView* texture, ID3D11ShaderResourceView* texture,
XMFLOAT4 ambientColor, XMFLOAT4 ambient_color,
XMFLOAT4 diffuseColor, XMFLOAT4 diffuse_color,
XMFLOAT3 lightDirection, XMFLOAT3 light_direction,
float sunIntensity float sun_intensity
) )
{ {
HRESULT result; HRESULT result;
D3D11_MAPPED_SUBRESOURCE mappedResource; D3D11_MAPPED_SUBRESOURCE mappedResource;
MatrixBufferType* dataPtr; matrix_buffer_type* dataPtr;
CameraBufferType* dataPtr2; camera_buffer_type* dataPtr2;
SunLightBufferType* dataPtr3; sun_light_buffer_type* dataPtr3;
unsigned int bufferNumber; unsigned int bufferNumber;
// Transpose the matrices to prepare them for the shader. // Transpose the matrices to prepare them for the shader.
worldMatrix = XMMatrixTranspose(worldMatrix); world_matrix = XMMatrixTranspose(world_matrix);
viewMatrix = XMMatrixTranspose(viewMatrix); view_matrix = XMMatrixTranspose(view_matrix);
projectionMatrix = XMMatrixTranspose(projectionMatrix); projection_matrix = XMMatrixTranspose(projection_matrix);
// Lock the constant buffer so it can be written to. // Lock the constant buffer so it can be written to.
result = deviceContext->Map(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = device_context->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result)) if (FAILED(result))
{ {
return false; return false;
} }
// Get a pointer to the data in the constant buffer. // Get a pointer to the data in the constant buffer.
dataPtr = (MatrixBufferType*)mappedResource.pData; dataPtr = (matrix_buffer_type*)mappedResource.pData;
// Copy the matrices into the constant buffer. // Copy the matrices into the constant buffer.
dataPtr->world = worldMatrix; dataPtr->world = world_matrix;
dataPtr->view = viewMatrix; dataPtr->view = view_matrix;
dataPtr->projection = projectionMatrix; dataPtr->projection = projection_matrix;
// Unlock the constant buffer. // Unlock the constant buffer.
deviceContext->Unmap(m_matrixBuffer, 0); device_context->Unmap(matrix_buffer_, 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, &m_matrixBuffer); device_context->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
// Lock the sunlight constant buffer so it can be written to. // Lock the sunlight constant buffer so it can be written to.
result = deviceContext->Map(m_sunlightBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = device_context->Map(sunlight_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result)) if (FAILED(result))
{ {
return false; return false;
} }
// Get a pointer to the data in the constant buffer. // Get a pointer to the data in the constant buffer.
dataPtr3 = (SunLightBufferType*)mappedResource.pData; dataPtr3 = (sun_light_buffer_type*)mappedResource.pData;
// Copy the lighting variables into the constant buffer. // Copy the lighting variables into the constant buffer.
dataPtr3->ambientColor = ambientColor; dataPtr3->ambient_color = ambient_color;
dataPtr3->diffuseColor = diffuseColor; dataPtr3->diffuse_color = diffuse_color;
dataPtr3->sunDirection = lightDirection; dataPtr3->sun_direction = light_direction;
dataPtr3->intensity = sunIntensity; dataPtr3->intensity = sun_intensity;
// Unlock the constant buffer. // Unlock the constant buffer.
deviceContext->Unmap(m_sunlightBuffer, 0); device_context->Unmap(sunlight_buffer_, 0);
// Set the position of the sunlight constant buffer in the pixel shader. // Set the position of the sunlight constant buffer in the pixel shader.
bufferNumber = 0; bufferNumber = 0;
// Finally set the sunlight constant buffer in the pixel shader with the updated values. // Finally set the sunlight constant buffer in the pixel shader with the updated values.
deviceContext->PSSetConstantBuffers(bufferNumber, 1, &m_sunlightBuffer); device_context->PSSetConstantBuffers(bufferNumber, 1, &sunlight_buffer_);
// Set shader texture resource in the pixel shader. // Set shader texture resource in the pixel shader.
deviceContext->PSSetShaderResources(0, 1, &texture); device_context->PSSetShaderResources(0, 1, &texture);
return true; return true;
} }
void CelshadeClass::RenderShader(ID3D11DeviceContext* deviceContext, int indexCount) void celshade_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
{ {
// Set the vertex input layout. // Set the vertex input layout.
deviceContext->IASetInputLayout(m_layout); deviceContext->IASetInputLayout(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(m_vertexShader, NULL, 0); deviceContext->VSSetShader(vertex_shader_, NULL, 0);
deviceContext->PSSetShader(m_pixelShader, NULL, 0); deviceContext->PSSetShader(pixel_shader_, NULL, 0);
// Set the sampler state in the pixel shader. // Set the sampler state in the pixel shader.
deviceContext->PSSetSamplers(0, 1, &m_sampleState); deviceContext->PSSetSamplers(0, 1, &sample_state_);
// Render the triangle. // render the triangle.
deviceContext->DrawIndexed(indexCount, 0, 0); deviceContext->DrawIndexed(indexCount, 0, 0);
return; return;

View File

@ -1,29 +1,29 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Filename: colorshaderclass.cpp // Filename: colorshaderclass.cpp
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "colorshaderclass.h" #include "color_shader_class.h"
ColorShaderClass::ColorShaderClass() color_shader_class::color_shader_class()
{ {
m_vertexShader = 0; vertex_shader_ = 0;
m_pixelShader = 0; pixel_shader_ = 0;
m_layout = 0; layout_ = 0;
m_matrixBuffer = 0; matrix_buffer_ = 0;
} }
ColorShaderClass::ColorShaderClass(const ColorShaderClass& other) color_shader_class::color_shader_class(const color_shader_class& other)
{ {
} }
ColorShaderClass::~ColorShaderClass() color_shader_class::~color_shader_class()
{ {
} }
bool ColorShaderClass::Initialize(ID3D11Device* device, HWND hwnd) bool color_shader_class::initialize(ID3D11Device* device, HWND hwnd)
{ {
Logger::Get().Log("Initializing ColorShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing color_shader_class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
bool result; bool result;
wchar_t vsFilename[128]; wchar_t vsFilename[128];
@ -47,35 +47,35 @@ bool ColorShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
return false; return false;
} }
// Initialize the vertex and pixel shaders. // initialize the vertex and pixel shaders.
result = InitializeShader(device, hwnd, vsFilename, psFilename); result = initialize_shader(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("ColorShaderClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("color_shader_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
return true; return true;
} }
void ColorShaderClass::Shutdown() void color_shader_class::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.
ShutdownShader(); shutdown_shader();
return; return;
} }
bool ColorShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, bool color_shader_class::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 = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix); result = set_shader_parameters(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 ColorShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount
} }
// Now render the prepared buffers with the shader. // Now render the prepared buffers with the shader.
RenderShader(deviceContext, indexCount); render_shader(deviceContext, indexCount);
return true; return true;
} }
bool ColorShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) bool color_shader_class::initialize_shader(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 ColorShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR*
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 ColorShaderClass::InitializeShader(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)
{ {
OutputShaderErrorMessage(errorMessage, hwnd, vsFilename); output_shader_error_message(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 ColorShaderClass::InitializeShader(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)
{ {
OutputShaderErrorMessage(errorMessage, hwnd, psFilename); output_shader_error_message(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 ColorShaderClass::InitializeShader(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, &m_vertexShader); result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
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 ColorShaderClass::InitializeShader(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, &m_pixelShader); result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
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 ColorShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR*
// 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(), &m_layout); vertexShaderBuffer->GetBufferSize(), &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 ColorShaderClass::InitializeShader(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(MatrixBufferType); matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
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, &m_matrixBuffer); result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
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 ColorShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR*
return true; return true;
} }
void ColorShaderClass::ShutdownShader() void color_shader_class::shutdown_shader()
{ {
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 (m_matrixBuffer) if (matrix_buffer_)
{ {
Logger::Get().Log("Releasing matrix buffer", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Releasing matrix buffer", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
m_matrixBuffer->Release(); matrix_buffer_->Release();
m_matrixBuffer = 0; matrix_buffer_ = 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 (m_layout) if (layout_)
{ {
Logger::Get().Log("Releasing layout", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Releasing layout", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
m_layout->Release(); layout_->Release();
m_layout = 0; 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 (m_pixelShader) if (pixel_shader_)
{ {
Logger::Get().Log("Releasing pixel shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Releasing pixel shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
m_pixelShader->Release(); pixel_shader_->Release();
m_pixelShader = 0; pixel_shader_ = 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 (m_vertexShader) if (vertex_shader_)
{ {
Logger::Get().Log("Releasing vertex shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Releasing vertex shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
m_vertexShader->Release(); vertex_shader_->Release();
m_vertexShader = 0; vertex_shader_ = 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 ColorShaderClass::ShutdownShader()
return; return;
} }
void ColorShaderClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename) void color_shader_class::output_shader_error_message(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 ColorShaderClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWND h
return; return;
} }
bool ColorShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, bool color_shader_class::set_shader_parameters(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;
MatrixBufferType* dataPtr; matrix_buffer_type* 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 ColorShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, X
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(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = deviceContext->Map(matrix_buffer_, 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 ColorShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, X
} }
// Get a pointer to the data in the constant buffer. // Get a pointer to the data in the constant buffer.
dataPtr = (MatrixBufferType*)mappedResource.pData; dataPtr = (matrix_buffer_type*)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 ColorShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, X
dataPtr->projection = projectionMatrix; dataPtr->projection = projectionMatrix;
// Unlock the constant buffer. // Unlock the constant buffer.
deviceContext->Unmap(m_matrixBuffer, 0); deviceContext->Unmap(matrix_buffer_, 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, &m_matrixBuffer); deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
return true; return true;
} }
void ColorShaderClass::RenderShader(ID3D11DeviceContext* deviceContext, int indexCount) void color_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
{ {
// Set the vertex input layout. // Set the vertex input layout.
deviceContext->IASetInputLayout(m_layout); deviceContext->IASetInputLayout(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(m_vertexShader, NULL, 0); deviceContext->VSSetShader(vertex_shader_, NULL, 0);
deviceContext->PSSetShader(m_pixelShader, NULL, 0); deviceContext->PSSetShader(pixel_shader_, NULL, 0);
// Render the triangle. // render the triangle.
deviceContext->DrawIndexed(indexCount, 0, 0); deviceContext->DrawIndexed(indexCount, 0, 0);
return; return;

View File

@ -0,0 +1,378 @@
#include "depth_shader_class.h"
depth_shader_class::depth_shader_class()
{
vertex_shader_ = 0;
pixel_shader_ = 0;
layout_ = 0;
matrix_buffer_ = 0;
sample_state_ = 0;
}
depth_shader_class::depth_shader_class(const depth_shader_class& other)
{
}
depth_shader_class::~depth_shader_class()
{
}
bool depth_shader_class::initialize(ID3D11Device* device, HWND hwnd)
{
Logger::Get().Log("Initializing texture shader", __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"src/hlsl/depth.vs");
if (error != 0)
{
Logger::Get().Log("Error copying stirng", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Set the filename of the pixel shader.
error = wcscpy_s(psFilename, 128, L"src/hlsl/depth.ps");
if (error != 0)
{
Logger::Get().Log("Error copying stirng", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// initialize the vertex and pixel shaders.
result = initialize_shader(device, hwnd, vsFilename, psFilename);
if (!result)
{
Logger::Get().Log("Error initializing shader", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
Logger::Get().Log("Texture shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
return true;
}
void depth_shader_class::shutdown()
{
// shutdown the vertex and pixel shaders as well as the related objects.
shutdown_shader();
return;
}
bool depth_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture)
{
bool result;
// Set the shader parameters that it will use for rendering.
result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture);
if (!result)
{
Logger::Get().Log("Error setting shader parameters", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Now render the prepared buffers with the shader.
render_shader(deviceContext, indexCount);
return true;
}
bool depth_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
{
Logger::Get().Log("Initializing shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
HRESULT result;
ID3D10Blob* errorMessage;
ID3D10Blob* vertexShaderBuffer;
ID3D10Blob* pixelShaderBuffer;
D3D11_INPUT_ELEMENT_DESC polygonLayout[2];
unsigned int numElements;
D3D11_BUFFER_DESC matrixBufferDesc;
D3D11_SAMPLER_DESC samplerDesc;
// initialize the pointers this function will use to null.
errorMessage = 0;
vertexShaderBuffer = 0;
pixelShaderBuffer = 0;
// Compile the vertex shader code.
result = D3DCompileFromFile(vsFilename, NULL, NULL, "DepthVertexShader", "vs_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
&vertexShaderBuffer, &errorMessage);
if (FAILED(result))
{
// If the shader failed to compile it should have writen something to the error message.
if (errorMessage)
{
output_shader_error_message(errorMessage, hwnd, vsFilename);
}
// If there was nothing in the error message then it simply could not find the shader file itself.
else
{
Logger::Get().Log("Error compiling shader", __FILE__, __LINE__, Logger::LogLevel::Error);
}
return false;
}
// Compile the pixel shader code.
result = D3DCompileFromFile(psFilename, NULL, NULL, "DepthPixelShader", "ps_5_0", D3D10_SHADER_ENABLE_STRICTNESS, 0,
&pixelShaderBuffer, &errorMessage);
if (FAILED(result))
{
// If the shader failed to compile it should have writen something to the error message.
if (errorMessage)
{
output_shader_error_message(errorMessage, hwnd, psFilename);
}
// If there was nothing in the error message then it simply could not find the file itself.
else
{
Logger::Get().Log("Error compiling shader", __FILE__, __LINE__, Logger::LogLevel::Error);
}
return false;
}
// Create the vertex shader from the buffer.
result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
if (FAILED(result))
{
Logger::Get().Log("Error creating vertex shader", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Create the pixel shader from the buffer.
result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
if (FAILED(result))
{
Logger::Get().Log("Error creating pixel shader", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Create the vertex input layout description.
// This setup needs to match the VertexType stucture in the ModelClass and in the shader.
polygonLayout[0].SemanticName = "POSITION";
polygonLayout[0].SemanticIndex = 0;
polygonLayout[0].Format = DXGI_FORMAT_R32G32B32_FLOAT;
polygonLayout[0].InputSlot = 0;
polygonLayout[0].AlignedByteOffset = 0;
polygonLayout[0].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
polygonLayout[0].InstanceDataStepRate = 0;
polygonLayout[1].SemanticName = "TEXCOORD";
polygonLayout[1].SemanticIndex = 0;
polygonLayout[1].Format = DXGI_FORMAT_R32G32_FLOAT;
polygonLayout[1].InputSlot = 0;
polygonLayout[1].AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
polygonLayout[1].InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
polygonLayout[1].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(), &layout_);
if (FAILED(result))
{
Logger::Get().Log("Error creating input layout", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Release the vertex shader buffer and pixel shader buffer since they are no longer needed.
vertexShaderBuffer->Release();
vertexShaderBuffer = 0;
pixelShaderBuffer->Release();
pixelShaderBuffer = 0;
// Setup the description of the dynamic matrix constant buffer that is in the vertex shader.
matrixBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
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, NULL, &matrix_buffer_);
if (FAILED(result))
{
Logger::Get().Log("Error creating constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
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, &sample_state_);
if (FAILED(result))
{
Logger::Get().Log("Error creating sampler state", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
Logger::Get().Log("Shader initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
return true;
}
void depth_shader_class::shutdown_shader()
{
Logger::Get().Log("Shutting down shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
// Release the sampler state.
if (sample_state_)
{
sample_state_->Release();
sample_state_ = 0;
}
// Release the matrix constant buffer.
if (matrix_buffer_)
{
matrix_buffer_->Release();
matrix_buffer_ = 0;
}
// Release the layout.
if (layout_)
{
layout_->Release();
layout_ = 0;
}
// Release the pixel shader.
if (pixel_shader_)
{
pixel_shader_->Release();
pixel_shader_ = 0;
}
// Release the vertex shader.
if (vertex_shader_)
{
vertex_shader_->Release();
vertex_shader_ = 0;
}
Logger::Get().Log("Shader shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
return;
}
void depth_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
{
char* compileErrors;
unsigned long long bufferSize, i;
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 = 0;
// 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);
return;
}
bool depth_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix,
XMMATRIX projectionMatrix, ID3D11ShaderResourceView* texture)
{
HRESULT result;
D3D11_MAPPED_SUBRESOURCE mappedResource;
matrix_buffer_type* dataPtr;
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(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result))
{
Logger::Get().Log("Error mapping constant buffer", __FILE__, __LINE__, Logger::LogLevel::Error);
return false;
}
// Get a pointer to the data in the constant buffer.
dataPtr = (matrix_buffer_type*)mappedResource.pData;
// Copy the matrices into the constant buffer.
dataPtr->world = worldMatrix;
dataPtr->view = viewMatrix;
dataPtr->projection = projectionMatrix;
// Unlock the constant buffer.
deviceContext->Unmap(matrix_buffer_, 0);
// Set the position of the constant buffer in the vertex shader.
bufferNumber = 0;
// Finanly set the constant buffer in the vertex shader with the updated values.
deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
// Set shader texture resource in the pixel shader.
deviceContext->PSSetShaderResources(0, 1, &texture);
return true;
}
void depth_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
{
// Set the vertex input layout.
deviceContext->IASetInputLayout(layout_);
// Set the vertex and pixel shaders that will be used to render this triangle.
deviceContext->VSSetShader(vertex_shader_, NULL, 0);
deviceContext->PSSetShader(pixel_shader_, NULL, 0);
// Set the sampler state in the pixel shader.
deviceContext->PSSetSamplers(0, 1, &sample_state_);
// render the triangle.
deviceContext->DrawIndexed(indexCount, 0, 0);
return;
}

View File

@ -1,30 +1,30 @@
#include "fontshaderclass.h" #include "font_shader_class.h"
FontShaderClass::FontShaderClass() font_shader_class::font_shader_class()
{ {
m_vertexShader = 0; vertex_shader_ = 0;
m_pixelShader = 0; pixel_shader_ = 0;
m_layout = 0; layout_ = 0;
m_matrixBuffer = 0; matrix_buffer_ = 0;
m_sampleState = 0; sample_state_ = 0;
m_pixelBuffer = 0; pixel_buffer_ = 0;
} }
FontShaderClass::FontShaderClass(const FontShaderClass& other) font_shader_class::font_shader_class(const font_shader_class& other)
{ {
} }
FontShaderClass::~FontShaderClass() font_shader_class::~font_shader_class()
{ {
} }
bool FontShaderClass::Initialize(ID3D11Device* device, HWND hwnd) bool font_shader_class::initialize(ID3D11Device* device, HWND hwnd)
{ {
Logger::Get().Log("Initializing FontShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing font_shader_class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
bool result; bool result;
wchar_t vsFilename[128]; wchar_t vsFilename[128];
@ -47,35 +47,35 @@ bool FontShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
return false; return false;
} }
// Initialize the vertex and pixel shaders. // initialize the vertex and pixel shaders.
result = InitializeShader(device, hwnd, vsFilename, psFilename); result = initialize_shader(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("FontShaderClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("font_shader_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
return true; return true;
} }
void FontShaderClass::Shutdown() void font_shader_class::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.
ShutdownShader(); shutdown_shader();
return; return;
} }
bool FontShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, bool font_shader_class::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 = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, pixelColor); result = set_shader_parameters(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 FontShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount,
} }
// Now render the prepared buffers with the shader. // Now render the prepared buffers with the shader.
RenderShader(deviceContext, indexCount); render_shader(deviceContext, indexCount);
return true; return true;
} }
bool FontShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) bool font_shader_class::initialize_shader(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 FontShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* v
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 FontShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* v
// 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)
{ {
OutputShaderErrorMessage(errorMessage, hwnd, vsFilename); output_shader_error_message(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 FontShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* v
// 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)
{ {
OutputShaderErrorMessage(errorMessage, hwnd, psFilename); output_shader_error_message(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 FontShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* v
} }
// Create the vertex shader from the buffer. // Create the vertex shader from the buffer.
result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &m_vertexShader); result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
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 FontShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* v
} }
// Create the pixel shader from the buffer. // Create the pixel shader from the buffer.
result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &m_pixelShader); result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
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);
@ -185,7 +185,7 @@ bool FontShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* v
// 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(), &m_layout); vertexShaderBuffer->GetBufferSize(), &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 +201,14 @@ bool FontShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* v
// 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(MatrixBufferType); matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
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, &m_matrixBuffer); result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
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 +231,7 @@ bool FontShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* v
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
// Create the texture sampler state. // Create the texture sampler state.
result = device->CreateSamplerState(&samplerDesc, &m_sampleState); result = device->CreateSamplerState(&samplerDesc, &sample_state_);
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 +240,14 @@ bool FontShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* v
// 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(PixelBufferType); pixelBufferDesc.ByteWidth = sizeof(pixel_buffer_type);
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, &m_pixelBuffer); result = device->CreateBuffer(&pixelBufferDesc, NULL, &pixel_buffer_);
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 +259,50 @@ bool FontShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* v
return true; return true;
} }
void FontShaderClass::ShutdownShader() void font_shader_class::shutdown_shader()
{ {
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 (m_pixelBuffer) if (pixel_buffer_)
{ {
m_pixelBuffer->Release(); pixel_buffer_->Release();
m_pixelBuffer = 0; pixel_buffer_ = 0;
} }
// Release the sampler state. // Release the sampler state.
if (m_sampleState) if (sample_state_)
{ {
m_sampleState->Release(); sample_state_->Release();
m_sampleState = 0; sample_state_ = 0;
} }
// Release the matrix constant buffer. // Release the matrix constant buffer.
if (m_matrixBuffer) if (matrix_buffer_)
{ {
m_matrixBuffer->Release(); matrix_buffer_->Release();
m_matrixBuffer = 0; matrix_buffer_ = 0;
} }
// Release the layout. // Release the layout.
if (m_layout) if (layout_)
{ {
m_layout->Release(); layout_->Release();
m_layout = 0; layout_ = 0;
} }
// Release the pixel shader. // Release the pixel shader.
if (m_pixelShader) if (pixel_shader_)
{ {
m_pixelShader->Release(); pixel_shader_->Release();
m_pixelShader = 0; pixel_shader_ = 0;
} }
// Release the vertex shader. // Release the vertex shader.
if (m_vertexShader) if (vertex_shader_)
{ {
m_vertexShader->Release(); vertex_shader_->Release();
m_vertexShader = 0; vertex_shader_ = 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 +310,7 @@ void FontShaderClass::ShutdownShader()
return; return;
} }
void FontShaderClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename) void font_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
{ {
char* compileErrors; char* compileErrors;
unsigned long long bufferSize, i; unsigned long long bufferSize, i;
@ -345,15 +345,15 @@ void FontShaderClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWND hw
return; return;
} }
bool FontShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, bool font_shader_class::set_shader_parameters(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;
MatrixBufferType* dataPtr; matrix_buffer_type* dataPtr;
unsigned int bufferNumber; unsigned int bufferNumber;
PixelBufferType* dataPtr2; pixel_buffer_type* dataPtr2;
// Transpose the matrices to prepare them for the shader. // Transpose the matrices to prepare them for the shader.
@ -362,7 +362,7 @@ bool FontShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, XM
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(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = deviceContext->Map(matrix_buffer_, 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 +370,7 @@ bool FontShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, XM
} }
// Get a pointer to the data in the constant buffer. // Get a pointer to the data in the constant buffer.
dataPtr = (MatrixBufferType*)mappedResource.pData; dataPtr = (matrix_buffer_type*)mappedResource.pData;
// Copy the matrices into the constant buffer. // Copy the matrices into the constant buffer.
dataPtr->world = worldMatrix; dataPtr->world = worldMatrix;
@ -378,19 +378,19 @@ bool FontShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, XM
dataPtr->projection = projectionMatrix; dataPtr->projection = projectionMatrix;
// Unlock the constant buffer. // Unlock the constant buffer.
deviceContext->Unmap(m_matrixBuffer, 0); deviceContext->Unmap(matrix_buffer_, 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, &m_matrixBuffer); deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
// 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(m_pixelBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = deviceContext->Map(pixel_buffer_, 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 +398,36 @@ bool FontShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, XM
} }
// Get a pointer to the data in the pixel constant buffer. // Get a pointer to the data in the pixel constant buffer.
dataPtr2 = (PixelBufferType*)mappedResource.pData; dataPtr2 = (pixel_buffer_type*)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(m_pixelBuffer, 0); deviceContext->Unmap(pixel_buffer_, 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, &m_pixelBuffer); deviceContext->PSSetConstantBuffers(bufferNumber, 1, &pixel_buffer_);
return true; return true;
} }
void FontShaderClass::RenderShader(ID3D11DeviceContext* deviceContext, int indexCount) void font_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
{ {
// Set the vertex input layout. // Set the vertex input layout.
deviceContext->IASetInputLayout(m_layout); deviceContext->IASetInputLayout(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(m_vertexShader, NULL, 0); deviceContext->VSSetShader(vertex_shader_, NULL, 0);
deviceContext->PSSetShader(m_pixelShader, NULL, 0); deviceContext->PSSetShader(pixel_shader_, NULL, 0);
// Set the sampler state in the pixel shader. // Set the sampler state in the pixel shader.
deviceContext->PSSetSamplers(0, 1, &m_sampleState); deviceContext->PSSetSamplers(0, 1, &sample_state_);
// Render the triangle. // render the triangle.
deviceContext->DrawIndexed(indexCount, 0, 0); deviceContext->DrawIndexed(indexCount, 0, 0);
return; return;

View File

@ -1,29 +1,29 @@
#include "lightmapshaderclass.h" #include "light_map_shader_class.h"
LightMapShaderClass::LightMapShaderClass() light_map_shader_class::light_map_shader_class()
{ {
m_vertexShader = 0; vertex_shader_ = 0;
m_pixelShader = 0; pixel_shader_ = 0;
m_layout = 0; layout_ = 0;
m_matrixBuffer = 0; matrix_buffer_ = 0;
m_sampleState = 0; sample_state_ = 0;
} }
LightMapShaderClass::LightMapShaderClass(const LightMapShaderClass& other) light_map_shader_class::light_map_shader_class(const light_map_shader_class& other)
{ {
} }
LightMapShaderClass::~LightMapShaderClass() light_map_shader_class::~light_map_shader_class()
{ {
} }
bool LightMapShaderClass::Initialize(ID3D11Device* device, HWND hwnd) bool light_map_shader_class::initialize(ID3D11Device* device, HWND hwnd)
{ {
Logger::Get().Log("Initializing LightMapShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing light_map_shader_class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
bool result; bool result;
wchar_t vsFilename[128]; wchar_t vsFilename[128];
@ -46,37 +46,37 @@ bool LightMapShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
return false; return false;
} }
// Initialize the vertex and pixel shaders. // initialize the vertex and pixel shaders.
result = InitializeShader(device, hwnd, vsFilename, psFilename); result = initialize_shader(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("LightMapShaderClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("light_map_shader_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
return true; return true;
} }
void LightMapShaderClass::Shutdown() void light_map_shader_class::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.
ShutdownShader(); shutdown_shader();
return; return;
} }
bool LightMapShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, bool light_map_shader_class::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 = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2); result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2);
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);
@ -84,13 +84,13 @@ bool LightMapShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCo
} }
// Now render the prepared buffers with the shader. // Now render the prepared buffers with the shader.
RenderShader(deviceContext, indexCount); render_shader(deviceContext, indexCount);
return true; return true;
} }
bool LightMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) bool light_map_shader_class::initialize_shader(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);
HRESULT result; HRESULT result;
@ -103,7 +103,7 @@ bool LightMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHA
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;
@ -116,7 +116,7 @@ bool LightMapShaderClass::InitializeShader(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)
{ {
OutputShaderErrorMessage(errorMessage, hwnd, vsFilename); output_shader_error_message(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 LightMapShaderClass::InitializeShader(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)
{ {
OutputShaderErrorMessage(errorMessage, hwnd, psFilename); output_shader_error_message(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 LightMapShaderClass::InitializeShader(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, &m_vertexShader); result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
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 LightMapShaderClass::InitializeShader(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, &m_pixelShader); result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
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);
@ -192,7 +192,7 @@ bool LightMapShaderClass::InitializeShader(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(), &m_layout); vertexShaderBuffer->GetBufferSize(), &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);
@ -208,14 +208,14 @@ bool LightMapShaderClass::InitializeShader(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(MatrixBufferType); matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
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, &m_matrixBuffer); result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
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);
@ -238,7 +238,7 @@ bool LightMapShaderClass::InitializeShader(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, &m_sampleState); result = device->CreateSamplerState(&samplerDesc, &sample_state_);
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);
@ -251,52 +251,52 @@ bool LightMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHA
} }
void LightMapShaderClass::ShutdownShader() void light_map_shader_class::shutdown_shader()
{ {
Logger::Get().Log("Shutting down LightMapShaderClass", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Shutting down light_map_shader_class", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
// Release the sampler state. // Release the sampler state.
if (m_sampleState) if (sample_state_)
{ {
m_sampleState->Release(); sample_state_->Release();
m_sampleState = 0; sample_state_ = 0;
} }
// Release the matrix constant buffer. // Release the matrix constant buffer.
if (m_matrixBuffer) if (matrix_buffer_)
{ {
m_matrixBuffer->Release(); matrix_buffer_->Release();
m_matrixBuffer = 0; matrix_buffer_ = 0;
} }
// Release the layout. // Release the layout.
if (m_layout) if (layout_)
{ {
m_layout->Release(); layout_->Release();
m_layout = 0; layout_ = 0;
} }
// Release the pixel shader. // Release the pixel shader.
if (m_pixelShader) if (pixel_shader_)
{ {
m_pixelShader->Release(); pixel_shader_->Release();
m_pixelShader = 0; pixel_shader_ = 0;
} }
// Release the vertex shader. // Release the vertex shader.
if (m_vertexShader) if (vertex_shader_)
{ {
m_vertexShader->Release(); vertex_shader_->Release();
m_vertexShader = 0; vertex_shader_ = 0;
} }
Logger::Get().Log("LightMapShaderClass shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("light_map_shader_class shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
return; return;
} }
void LightMapShaderClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename) void light_map_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
{ {
char* compileErrors; char* compileErrors;
unsigned long long bufferSize, i; unsigned long long bufferSize, i;
@ -332,12 +332,12 @@ void LightMapShaderClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWN
} }
bool LightMapShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, bool light_map_shader_class::set_shader_parameters(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;
MatrixBufferType* dataPtr; matrix_buffer_type* dataPtr;
unsigned int bufferNumber; unsigned int bufferNumber;
@ -347,7 +347,7 @@ bool LightMapShaderClass::SetShaderParameters(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(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = deviceContext->Map(matrix_buffer_, 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);
@ -355,7 +355,7 @@ bool LightMapShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext
} }
// Get a pointer to the data in the constant buffer. // Get a pointer to the data in the constant buffer.
dataPtr = (MatrixBufferType*)mappedResource.pData; dataPtr = (matrix_buffer_type*)mappedResource.pData;
// Copy the matrices into the constant buffer. // Copy the matrices into the constant buffer.
dataPtr->world = worldMatrix; dataPtr->world = worldMatrix;
@ -363,13 +363,13 @@ bool LightMapShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext
dataPtr->projection = projectionMatrix; dataPtr->projection = projectionMatrix;
// Unlock the constant buffer. // Unlock the constant buffer.
deviceContext->Unmap(m_matrixBuffer, 0); deviceContext->Unmap(matrix_buffer_, 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, &m_matrixBuffer); deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
// 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);
@ -379,19 +379,19 @@ bool LightMapShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext
} }
void LightMapShaderClass::RenderShader(ID3D11DeviceContext* deviceContext, int indexCount) void light_map_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
{ {
// Set the vertex input layout. // Set the vertex input layout.
deviceContext->IASetInputLayout(m_layout); deviceContext->IASetInputLayout(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(m_vertexShader, NULL, 0); deviceContext->VSSetShader(vertex_shader_, NULL, 0);
deviceContext->PSSetShader(m_pixelShader, NULL, 0); deviceContext->PSSetShader(pixel_shader_, NULL, 0);
// Set the sampler state in the pixel shader. // Set the sampler state in the pixel shader.
deviceContext->PSSetSamplers(0, 1, &m_sampleState); deviceContext->PSSetSamplers(0, 1, &sample_state_);
// Render the triangle. // render the triangle.
deviceContext->DrawIndexed(indexCount, 0, 0); deviceContext->DrawIndexed(indexCount, 0, 0);
return; return;

View File

@ -1,36 +1,36 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Filename: lightshaderclass.cpp // Filename: lightshaderclass.cpp
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "lightshaderclass.h" #include "light_shader_class.h"
LightShaderClass::LightShaderClass() light_shader_class::light_shader_class()
{ {
m_vertexShader = 0; vertex_shader_ = 0;
m_pixelShader = 0; pixel_shader_ = 0;
m_layout = 0; layout_ = 0;
m_sampleState = 0; sample_state_ = 0;
m_matrixBuffer = 0; matrix_buffer_ = 0;
m_cameraBuffer = 0; camera_buffer_ = 0;
m_lightBuffer = 0; light_buffer_ = 0;
m_lightColorBuffer = 0; light_color_buffer_ = 0;
m_lightPositionBuffer = 0; light_position_buffer_ = 0;
} }
LightShaderClass::LightShaderClass(const LightShaderClass& other) light_shader_class::light_shader_class(const light_shader_class& other)
{ {
} }
LightShaderClass::~LightShaderClass() light_shader_class::~light_shader_class()
{ {
} }
bool LightShaderClass::Initialize(ID3D11Device* device, HWND hwnd) bool light_shader_class::initialize(ID3D11Device* device, HWND hwnd)
{ {
Logger::Get().Log("Initializing LightShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing light_shader_class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
wchar_t vsFilename[128]; wchar_t vsFilename[128];
wchar_t psFilename[128]; wchar_t psFilename[128];
@ -52,36 +52,36 @@ bool LightShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
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 = InitializeShader(device, hwnd, vsFilename, psFilename); result = initialize_shader(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("LightShaderClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("light_shader_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
return true; return true;
} }
void LightShaderClass::Shutdown() void light_shader_class::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.
ShutdownShader(); shutdown_shader();
return; return;
} }
bool LightShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, bool light_shader_class::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 = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture, diffuseColor, lightPosition, ambientClor); result = set_shader_parameters(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 LightShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount
} }
// Now render the prepared buffers with the shader. // Now render the prepared buffers with the shader.
RenderShader(deviceContext, indexCount); render_shader(deviceContext, indexCount);
return true; return true;
} }
bool LightShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) bool light_shader_class::initialize_shader(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 LightShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR*
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 LightShaderClass::InitializeShader(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)
{ {
OutputShaderErrorMessage(errorMessage, hwnd, vsFilename); output_shader_error_message(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 LightShaderClass::InitializeShader(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)
{ {
OutputShaderErrorMessage(errorMessage, hwnd, psFilename); output_shader_error_message(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 LightShaderClass::InitializeShader(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, &m_vertexShader); result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
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 LightShaderClass::InitializeShader(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, &m_pixelShader); result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
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 LightShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR*
// 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(),
&m_layout); &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 LightShaderClass::InitializeShader(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, &m_sampleState); result = device->CreateSamplerState(&samplerDesc, &sample_state_);
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 LightShaderClass::InitializeShader(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(MatrixBufferType); matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
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, &m_matrixBuffer); result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
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 LightShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR*
// 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(CameraBufferType); cameraBufferDesc.ByteWidth = sizeof(camera_buffer_type);
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, &m_cameraBuffer); result = device->CreateBuffer(&cameraBufferDesc, NULL, &camera_buffer_);
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 LightShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR*
// 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(LightColorBufferType); lightColorBufferDesc.ByteWidth = sizeof(light_color_buffer_type);
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, &m_lightColorBuffer); result = device->CreateBuffer(&lightColorBufferDesc, NULL, &light_color_buffer_);
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 LightShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR*
// 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(LightPositionBufferType); lightPositionBufferDesc.ByteWidth = sizeof(light_position_buffer_type);
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, &m_lightPositionBuffer); result = device->CreateBuffer(&lightPositionBufferDesc, NULL, &light_position_buffer_);
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 LightShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR*
} }
void LightShaderClass::ShutdownShader() void light_shader_class::shutdown_shader()
{ {
Logger::Get().Log("Shutting down LightShaderClass", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Shutting down light_shader_class", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
// Release the light constant buffers. // Release the light constant buffers.
if (m_lightColorBuffer) if (light_color_buffer_)
{ {
m_lightColorBuffer->Release(); light_color_buffer_->Release();
m_lightColorBuffer = 0; light_color_buffer_ = 0;
} }
if (m_lightPositionBuffer) if (light_position_buffer_)
{ {
m_lightPositionBuffer->Release(); light_position_buffer_->Release();
m_lightPositionBuffer = 0; light_position_buffer_ = 0;
} }
// Release the light constant buffer. // Release the light constant buffer.
if (m_lightBuffer) if (light_buffer_)
{ {
m_lightBuffer->Release(); light_buffer_->Release();
m_lightBuffer = 0; light_buffer_ = 0;
} }
// Release the camera constant buffer. // Release the camera constant buffer.
if (m_cameraBuffer) if (camera_buffer_)
{ {
m_cameraBuffer->Release(); camera_buffer_->Release();
m_cameraBuffer = 0; camera_buffer_ = 0;
} }
// Release the matrix constant buffer. // Release the matrix constant buffer.
if (m_matrixBuffer) if (matrix_buffer_)
{ {
m_matrixBuffer->Release(); matrix_buffer_->Release();
m_matrixBuffer = 0; matrix_buffer_ = 0;
} }
// Release the sampler state. // Release the sampler state.
if (m_sampleState) if (sample_state_)
{ {
m_sampleState->Release(); sample_state_->Release();
m_sampleState = 0; sample_state_ = 0;
} }
// Release the layout. // Release the layout.
if (m_layout) if (layout_)
{ {
m_layout->Release(); layout_->Release();
m_layout = 0; layout_ = 0;
} }
// Release the pixel shader. // Release the pixel shader.
if (m_pixelShader) if (pixel_shader_)
{ {
m_pixelShader->Release(); pixel_shader_->Release();
m_pixelShader = 0; pixel_shader_ = 0;
} }
// Release the vertex shader. // Release the vertex shader.
if (m_vertexShader) if (vertex_shader_)
{ {
m_vertexShader->Release(); vertex_shader_->Release();
m_vertexShader = 0; vertex_shader_ = 0;
} }
Logger::Get().Log("LightShaderClass shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("light_shader_class shut down", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
return; return;
} }
void LightShaderClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename) void light_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
{ {
char* compileErrors; char* compileErrors;
unsigned __int64 bufferSize, i; unsigned __int64 bufferSize, i;
@ -417,15 +417,15 @@ void LightShaderClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWND h
} }
bool LightShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, bool light_shader_class::set_shader_parameters(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;
MatrixBufferType* dataPtr; matrix_buffer_type* dataPtr;
LightPositionBufferType* dataPtr2; light_position_buffer_type* dataPtr2;
LightColorBufferType* dataPtr3; light_color_buffer_type* 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 LightShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, X
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(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = deviceContext->Map(matrix_buffer_, 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 LightShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, X
} }
// Get a pointer to the data in the constant buffer. // Get a pointer to the data in the constant buffer.
dataPtr = (MatrixBufferType*)mappedResource.pData; dataPtr = (matrix_buffer_type*)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 LightShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, X
dataPtr->projection = projectionMatrix; dataPtr->projection = projectionMatrix;
// Unlock the constant buffer. // Unlock the constant buffer.
deviceContext->Unmap(m_matrixBuffer, 0); deviceContext->Unmap(matrix_buffer_, 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, &m_matrixBuffer); deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
// 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(m_cameraBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = deviceContext->Map(camera_buffer_, 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 LightShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, X
} }
// 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(m_lightPositionBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = deviceContext->Map(light_position_buffer_, 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 LightShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, X
} }
// Get a pointer to the data in the constant buffer. // Get a pointer to the data in the constant buffer.
dataPtr2 = (LightPositionBufferType*)mappedResource.pData; dataPtr2 = (light_position_buffer_type*)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(m_lightPositionBuffer, 0); deviceContext->Unmap(light_position_buffer_, 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, &m_lightPositionBuffer); deviceContext->VSSetConstantBuffers(bufferNumber, 1, &light_position_buffer_);
// 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(m_lightColorBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = deviceContext->Map(light_color_buffer_, 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 LightShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, X
} }
// Get a pointer to the data in the constant buffer. // Get a pointer to the data in the constant buffer.
dataPtr3 = (LightColorBufferType*)mappedResource.pData; dataPtr3 = (light_color_buffer_type*)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(m_lightColorBuffer, 0); deviceContext->Unmap(light_color_buffer_, 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, &m_lightColorBuffer); deviceContext->PSSetConstantBuffers(bufferNumber, 1, &light_color_buffer_);
return true; return true;
} }
void LightShaderClass::RenderShader(ID3D11DeviceContext* deviceContext, int indexCount) void light_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
{ {
// Set the vertex input layout. // Set the vertex input layout.
deviceContext->IASetInputLayout(m_layout); deviceContext->IASetInputLayout(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(m_vertexShader, NULL, 0); deviceContext->VSSetShader(vertex_shader_, NULL, 0);
deviceContext->PSSetShader(m_pixelShader, NULL, 0); deviceContext->PSSetShader(pixel_shader_, NULL, 0);
// Set the sampler state in the pixel shader. // Set the sampler state in the pixel shader.
deviceContext->PSSetSamplers(0, 1, &m_sampleState); deviceContext->PSSetSamplers(0, 1, &sample_state_);
// Render the triangle. // render the triangle.
deviceContext->DrawIndexed(indexCount, 0, 0); deviceContext->DrawIndexed(indexCount, 0, 0);
return; return;

View File

@ -0,0 +1,24 @@
#include "master_shader.h"
#include "Logger.h"
master_shader::master_shader()
{
// Initialize shader filenames
wcscpy_s(vs_filename_, 128, vs_name_);
wcscpy_s(ps_filename_, 128, ps_name_);
}
master_shader::~master_shader()
{
// Destructor implementation
}
bool master_shader::initialize(ID3D11Device* device, HWND hwnd)
{
Logger::Get().Log("Initializing master_shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
bool success = false;
return true;
}

View File

@ -1,32 +1,32 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Filename: multitextureshaderclass.cpp // Filename: multitextureshaderclass.cpp
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
#include "multitextureshaderclass.h" #include "multi_texture_shader_class.h"
MultiTextureShaderClass::MultiTextureShaderClass() multi_texture_shader_class::multi_texture_shader_class()
{ {
m_vertexShader = 0; vertex_shader_ = 0;
m_pixelShader = 0; pixel_shader_ = 0;
m_layout = 0; layout_ = 0;
m_matrixBuffer = 0; matrix_buffer_ = 0;
m_sampleState = 0; sample_state_ = 0;
} }
MultiTextureShaderClass::MultiTextureShaderClass(const MultiTextureShaderClass& other) multi_texture_shader_class::multi_texture_shader_class(const multi_texture_shader_class& other)
{ {
} }
MultiTextureShaderClass::~MultiTextureShaderClass() multi_texture_shader_class::~multi_texture_shader_class()
{ {
} }
bool MultiTextureShaderClass::Initialize(ID3D11Device* device, HWND hwnd) bool multi_texture_shader_class::initialize(ID3D11Device* device, HWND hwnd)
{ {
Logger::Get().Log("Initializing MultiTextureShaderClass", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing multi_texture_shader_class", __FILE__, __LINE__, Logger::LogLevel::Initialize);
bool result; bool result;
wchar_t vsFilename[128]; wchar_t vsFilename[128];
@ -49,35 +49,35 @@ bool MultiTextureShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
return false; return false;
} }
// Initialize the vertex and pixel shaders. // initialize the vertex and pixel shaders.
result = InitializeShader(device, hwnd, vsFilename, psFilename); result = initialize_shader(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("MultiTextureShaderClass initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("multi_texture_shader_class initialized", __FILE__, __LINE__, Logger::LogLevel::Initialize);
return true; return true;
} }
void MultiTextureShaderClass::Shutdown() void multi_texture_shader_class::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.
ShutdownShader(); shutdown_shader();
return; return;
} }
bool MultiTextureShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, bool multi_texture_shader_class::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 = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2); result = set_shader_parameters(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 MultiTextureShaderClass::Render(ID3D11DeviceContext* deviceContext, int ind
} }
// Now render the prepared buffers with the shader. // Now render the prepared buffers with the shader.
RenderShader(deviceContext, indexCount); render_shader(deviceContext, indexCount);
return true; return true;
} }
bool MultiTextureShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) bool multi_texture_shader_class::initialize_shader(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 MultiTextureShaderClass::InitializeShader(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;
@ -117,7 +117,7 @@ bool MultiTextureShaderClass::InitializeShader(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)
{ {
OutputShaderErrorMessage(errorMessage, hwnd, vsFilename); output_shader_error_message(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 MultiTextureShaderClass::InitializeShader(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)
{ {
OutputShaderErrorMessage(errorMessage, hwnd, psFilename); output_shader_error_message(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 MultiTextureShaderClass::InitializeShader(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, &m_vertexShader); result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
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 MultiTextureShaderClass::InitializeShader(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, &m_pixelShader); result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
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 MultiTextureShaderClass::InitializeShader(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(), &m_layout); vertexShaderBuffer->GetBufferSize(), &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 MultiTextureShaderClass::InitializeShader(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(MatrixBufferType); matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
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, &m_matrixBuffer); result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
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 MultiTextureShaderClass::InitializeShader(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, &m_sampleState); result = device->CreateSamplerState(&samplerDesc, &sample_state_);
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 MultiTextureShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd,
return true; return true;
} }
void MultiTextureShaderClass::ShutdownShader() void multi_texture_shader_class::shutdown_shader()
{ {
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 (m_sampleState) if (sample_state_)
{ {
m_sampleState->Release(); sample_state_->Release();
m_sampleState = 0; sample_state_ = 0;
} }
// Release the matrix constant buffer. // Release the matrix constant buffer.
if (m_matrixBuffer) if (matrix_buffer_)
{ {
m_matrixBuffer->Release(); matrix_buffer_->Release();
m_matrixBuffer = 0; matrix_buffer_ = 0;
} }
// Release the layout. // Release the layout.
if (m_layout) if (layout_)
{ {
m_layout->Release(); layout_->Release();
m_layout = 0; layout_ = 0;
} }
// Release the pixel shader. // Release the pixel shader.
if (m_pixelShader) if (pixel_shader_)
{ {
m_pixelShader->Release(); pixel_shader_->Release();
m_pixelShader = 0; pixel_shader_ = 0;
} }
// Release the vertex shader. // Release the vertex shader.
if (m_vertexShader) if (vertex_shader_)
{ {
m_vertexShader->Release(); vertex_shader_->Release();
m_vertexShader = 0; vertex_shader_ = 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 MultiTextureShaderClass::ShutdownShader()
return; return;
} }
void MultiTextureShaderClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename) void multi_texture_shader_class::output_shader_error_message(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 MultiTextureShaderClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage,
return; return;
} }
bool MultiTextureShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, bool multi_texture_shader_class::set_shader_parameters(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;
MatrixBufferType* dataPtr; matrix_buffer_type* dataPtr;
unsigned int bufferNumber; unsigned int bufferNumber;
@ -345,7 +345,7 @@ bool MultiTextureShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceCon
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(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = deviceContext->Map(matrix_buffer_, 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 MultiTextureShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceCon
} }
// Get a pointer to the data in the constant buffer. // Get a pointer to the data in the constant buffer.
dataPtr = (MatrixBufferType*)mappedResource.pData; dataPtr = (matrix_buffer_type*)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 MultiTextureShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceCon
dataPtr->projection = projectionMatrix; dataPtr->projection = projectionMatrix;
// Unlock the constant buffer. // Unlock the constant buffer.
deviceContext->Unmap(m_matrixBuffer, 0); deviceContext->Unmap(matrix_buffer_, 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, &m_matrixBuffer); deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
// 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 MultiTextureShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceCon
return true; return true;
} }
void MultiTextureShaderClass::RenderShader(ID3D11DeviceContext* deviceContext, int indexCount) void multi_texture_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
{ {
// Set the vertex input layout. // Set the vertex input layout.
deviceContext->IASetInputLayout(m_layout); deviceContext->IASetInputLayout(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(m_vertexShader, NULL, 0); deviceContext->VSSetShader(vertex_shader_, NULL, 0);
deviceContext->PSSetShader(m_pixelShader, NULL, 0); deviceContext->PSSetShader(pixel_shader_, NULL, 0);
// Set the sampler state in the pixel shader. // Set the sampler state in the pixel shader.
deviceContext->PSSetSamplers(0, 1, &m_sampleState); deviceContext->PSSetSamplers(0, 1, &sample_state_);
// Render the triangle. // render the triangle.
deviceContext->DrawIndexed(indexCount, 0, 0); deviceContext->DrawIndexed(indexCount, 0, 0);
return; return;

View File

@ -1,28 +1,28 @@
#include "normalmapshaderclass.h" #include "normal_map_shader_class.h"
NormalMapShaderClass::NormalMapShaderClass() normal_map_shader_class::normal_map_shader_class()
{ {
m_vertexShader = 0; vertex_shader_ = 0;
m_pixelShader = 0; pixel_shader_ = 0;
m_layout = 0; layout_ = 0;
m_matrixBuffer = 0; matrix_buffer_ = 0;
m_sampleState = 0; sample_state_ = 0;
m_lightBuffer = 0; light_buffer_ = 0;
} }
NormalMapShaderClass::NormalMapShaderClass(const NormalMapShaderClass& other) normal_map_shader_class::normal_map_shader_class(const normal_map_shader_class& other)
{ {
} }
NormalMapShaderClass::~NormalMapShaderClass() normal_map_shader_class::~normal_map_shader_class()
{ {
} }
bool NormalMapShaderClass::Initialize(ID3D11Device* device, HWND hwnd) bool normal_map_shader_class::initialize(ID3D11Device* device, HWND hwnd)
{ {
Logger::Get().Log("Initializing normal map shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing normal map shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
@ -47,8 +47,8 @@ bool NormalMapShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
return false; return false;
} }
// Initialize the vertex and pixel shaders. // initialize the vertex and pixel shaders.
result = InitializeShader(device, hwnd, vsFilename, psFilename); result = initialize_shader(device, hwnd, vsFilename, psFilename);
if (!result) if (!result)
{ {
Logger::Get().Log("Failed to initialize the vertex and pixel shaders", __FILE__, __LINE__); Logger::Get().Log("Failed to initialize the vertex and pixel shaders", __FILE__, __LINE__);
@ -61,22 +61,22 @@ bool NormalMapShaderClass::Initialize(ID3D11Device* device, HWND hwnd)
} }
void NormalMapShaderClass::Shutdown() void normal_map_shader_class::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.
ShutdownShader(); shutdown_shader();
return; return;
} }
bool NormalMapShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, bool normal_map_shader_class::render(ID3D11DeviceContext* deviceContext, int indexCount, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2, XMFLOAT3 lightDirection, XMFLOAT4 diffuseColor) ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2, XMFLOAT3 lightDirection, XMFLOAT4 diffuseColor)
{ {
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 = SetShaderParameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2, lightDirection, diffuseColor); result = set_shader_parameters(deviceContext, worldMatrix, viewMatrix, projectionMatrix, texture1, texture2, lightDirection, diffuseColor);
if (!result) if (!result)
{ {
Logger::Get().Log("Failed to set the shader parameters that will be used for rendering", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to set the shader parameters that will be used for rendering", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -84,13 +84,13 @@ bool NormalMapShaderClass::Render(ID3D11DeviceContext* deviceContext, int indexC
} }
// Now render the prepared buffers with the shader. // Now render the prepared buffers with the shader.
RenderShader(deviceContext, indexCount); render_shader(deviceContext, indexCount);
return true; return true;
} }
bool NormalMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename) bool normal_map_shader_class::initialize_shader(ID3D11Device* device, HWND hwnd, WCHAR* vsFilename, WCHAR* psFilename)
{ {
Logger::Get().Log("Initializing normal map shader", __FILE__, __LINE__, Logger::LogLevel::Initialize); Logger::Get().Log("Initializing normal map shader", __FILE__, __LINE__, Logger::LogLevel::Initialize);
@ -105,7 +105,7 @@ bool NormalMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCH
D3D11_BUFFER_DESC lightBufferDesc; D3D11_BUFFER_DESC lightBufferDesc;
// 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;
@ -118,7 +118,7 @@ bool NormalMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCH
// 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)
{ {
OutputShaderErrorMessage(errorMessage, hwnd, vsFilename); output_shader_error_message(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
@ -137,7 +137,7 @@ bool NormalMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCH
// 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)
{ {
OutputShaderErrorMessage(errorMessage, hwnd, psFilename); output_shader_error_message(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
@ -149,7 +149,7 @@ bool NormalMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCH
} }
// Create the vertex shader from the buffer. // Create the vertex shader from the buffer.
result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &m_vertexShader); result = device->CreateVertexShader(vertexShaderBuffer->GetBufferPointer(), vertexShaderBuffer->GetBufferSize(), NULL, &vertex_shader_);
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);
@ -157,7 +157,7 @@ bool NormalMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCH
} }
// Create the pixel shader from the buffer. // Create the pixel shader from the buffer.
result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &m_pixelShader); result = device->CreatePixelShader(pixelShaderBuffer->GetBufferPointer(), pixelShaderBuffer->GetBufferSize(), NULL, &pixel_shader_);
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);
@ -210,7 +210,7 @@ bool NormalMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCH
// 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(), &m_layout); vertexShaderBuffer->GetBufferSize(), &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);
@ -226,14 +226,14 @@ bool NormalMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCH
// 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(MatrixBufferType); matrixBufferDesc.ByteWidth = sizeof(matrix_buffer_type);
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, &m_matrixBuffer); result = device->CreateBuffer(&matrixBufferDesc, NULL, &matrix_buffer_);
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);
@ -256,7 +256,7 @@ bool NormalMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCH
samplerDesc.MaxLOD = D3D11_FLOAT32_MAX; samplerDesc.MaxLOD = D3D11_FLOAT32_MAX;
// Create the texture sampler state. // Create the texture sampler state.
result = device->CreateSamplerState(&samplerDesc, &m_sampleState); result = device->CreateSamplerState(&samplerDesc, &sample_state_);
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);
@ -265,14 +265,14 @@ bool NormalMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCH
// Setup the description of the light dynamic constant buffer that is in the pixel shader. // Setup the description of the light dynamic constant buffer that is in the pixel shader.
lightBufferDesc.Usage = D3D11_USAGE_DYNAMIC; lightBufferDesc.Usage = D3D11_USAGE_DYNAMIC;
lightBufferDesc.ByteWidth = sizeof(LightBufferType); lightBufferDesc.ByteWidth = sizeof(light_buffer_type);
lightBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER; lightBufferDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
lightBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; lightBufferDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
lightBufferDesc.MiscFlags = 0; lightBufferDesc.MiscFlags = 0;
lightBufferDesc.StructureByteStride = 0; lightBufferDesc.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(&lightBufferDesc, NULL, &m_lightBuffer); result = device->CreateBuffer(&lightBufferDesc, NULL, &light_buffer_);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to create the light constant buffer pointer", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to create the light constant buffer pointer", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -285,50 +285,50 @@ bool NormalMapShaderClass::InitializeShader(ID3D11Device* device, HWND hwnd, WCH
} }
void NormalMapShaderClass::ShutdownShader() void normal_map_shader_class::shutdown_shader()
{ {
Logger::Get().Log("Shutting down normal map shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Shutting down normal map shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
// Release the light constant buffer. // Release the light constant buffer.
if (m_lightBuffer) if (light_buffer_)
{ {
m_lightBuffer->Release(); light_buffer_->Release();
m_lightBuffer = 0; light_buffer_ = 0;
} }
// Release the sampler state. // Release the sampler state.
if (m_sampleState) if (sample_state_)
{ {
m_sampleState->Release(); sample_state_->Release();
m_sampleState = 0; sample_state_ = 0;
} }
// Release the matrix constant buffer. // Release the matrix constant buffer.
if (m_matrixBuffer) if (matrix_buffer_)
{ {
m_matrixBuffer->Release(); matrix_buffer_->Release();
m_matrixBuffer = 0; matrix_buffer_ = 0;
} }
// Release the layout. // Release the layout.
if (m_layout) if (layout_)
{ {
m_layout->Release(); layout_->Release();
m_layout = 0; layout_ = 0;
} }
// Release the pixel shader. // Release the pixel shader.
if (m_pixelShader) if (pixel_shader_)
{ {
m_pixelShader->Release(); pixel_shader_->Release();
m_pixelShader = 0; pixel_shader_ = 0;
} }
// Release the vertex shader. // Release the vertex shader.
if (m_vertexShader) if (vertex_shader_)
{ {
m_vertexShader->Release(); vertex_shader_->Release();
m_vertexShader = 0; vertex_shader_ = 0;
} }
Logger::Get().Log("Successfully shut down normal map shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown); Logger::Get().Log("Successfully shut down normal map shader", __FILE__, __LINE__, Logger::LogLevel::Shutdown);
@ -337,7 +337,7 @@ void NormalMapShaderClass::ShutdownShader()
} }
void NormalMapShaderClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename) void normal_map_shader_class::output_shader_error_message(ID3D10Blob* errorMessage, HWND hwnd, WCHAR* shaderFilename)
{ {
char* compileErrors; char* compileErrors;
unsigned long long bufferSize, i; unsigned long long bufferSize, i;
@ -373,14 +373,14 @@ void NormalMapShaderClass::OutputShaderErrorMessage(ID3D10Blob* errorMessage, HW
} }
bool NormalMapShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix, bool normal_map_shader_class::set_shader_parameters(ID3D11DeviceContext* deviceContext, XMMATRIX worldMatrix, XMMATRIX viewMatrix, XMMATRIX projectionMatrix,
ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2, XMFLOAT3 lightDirection, XMFLOAT4 diffuseColor) ID3D11ShaderResourceView* texture1, ID3D11ShaderResourceView* texture2, XMFLOAT3 lightDirection, XMFLOAT4 diffuseColor)
{ {
HRESULT result; HRESULT result;
D3D11_MAPPED_SUBRESOURCE mappedResource; D3D11_MAPPED_SUBRESOURCE mappedResource;
MatrixBufferType* dataPtr; matrix_buffer_type* dataPtr;
unsigned int bufferNumber; unsigned int bufferNumber;
LightBufferType* dataPtr2; light_buffer_type* dataPtr2;
// Transpose the matrices to prepare them for the shader. // Transpose the matrices to prepare them for the shader.
@ -389,7 +389,7 @@ bool NormalMapShaderClass::SetShaderParameters(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(m_matrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = deviceContext->Map(matrix_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to lock the constant buffer so it can be written to", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to lock the constant buffer so it can be written to", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -397,7 +397,7 @@ bool NormalMapShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContex
} }
// Get a pointer to the data in the constant buffer. // Get a pointer to the data in the constant buffer.
dataPtr = (MatrixBufferType*)mappedResource.pData; dataPtr = (matrix_buffer_type*)mappedResource.pData;
// Copy the matrices into the constant buffer. // Copy the matrices into the constant buffer.
dataPtr->world = worldMatrix; dataPtr->world = worldMatrix;
@ -405,20 +405,20 @@ bool NormalMapShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContex
dataPtr->projection = projectionMatrix; dataPtr->projection = projectionMatrix;
// Unlock the constant buffer. // Unlock the constant buffer.
deviceContext->Unmap(m_matrixBuffer, 0); deviceContext->Unmap(matrix_buffer_, 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, &m_matrixBuffer); deviceContext->VSSetConstantBuffers(bufferNumber, 1, &matrix_buffer_);
// 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);
deviceContext->PSSetShaderResources(1, 1, &texture2); deviceContext->PSSetShaderResources(1, 1, &texture2);
// Lock the light constant buffer so it can be written to. // Lock the light constant buffer so it can be written to.
result = deviceContext->Map(m_lightBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource); result = deviceContext->Map(light_buffer_, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
if (FAILED(result)) if (FAILED(result))
{ {
Logger::Get().Log("Failed to lock the light constant buffer so it can be written to", __FILE__, __LINE__, Logger::LogLevel::Error); Logger::Get().Log("Failed to lock the light constant buffer so it can be written to", __FILE__, __LINE__, Logger::LogLevel::Error);
@ -426,21 +426,21 @@ bool NormalMapShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContex
} }
// Get a pointer to the data in the constant buffer. // Get a pointer to the data in the constant buffer.
dataPtr2 = (LightBufferType*)mappedResource.pData; dataPtr2 = (light_buffer_type*)mappedResource.pData;
// Copy the lighting variables into the constant buffer. // Copy the lighting variables into the constant buffer.
dataPtr2->diffuseColor = diffuseColor; dataPtr2->diffuse_color = diffuseColor;
dataPtr2->lightDirection = lightDirection; dataPtr2->light_direction = lightDirection;
dataPtr2->padding = 0.0f; dataPtr2->padding = 0.0f;
// Unlock the constant buffer. // Unlock the constant buffer.
deviceContext->Unmap(m_lightBuffer, 0); deviceContext->Unmap(light_buffer_, 0);
// Set the position of the light constant buffer in the pixel shader. // Set the position of the light constant buffer in the pixel shader.
bufferNumber = 0; bufferNumber = 0;
// Finally set the light constant buffer in the pixel shader with the updated values. // Finally set the light constant buffer in the pixel shader with the updated values.
deviceContext->PSSetConstantBuffers(bufferNumber, 1, &m_lightBuffer); deviceContext->PSSetConstantBuffers(bufferNumber, 1, &light_buffer_);
// 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);
@ -450,19 +450,19 @@ bool NormalMapShaderClass::SetShaderParameters(ID3D11DeviceContext* deviceContex
} }
void NormalMapShaderClass::RenderShader(ID3D11DeviceContext* deviceContext, int indexCount) void normal_map_shader_class::render_shader(ID3D11DeviceContext* deviceContext, int indexCount)
{ {
// Set the vertex input layout. // Set the vertex input layout.
deviceContext->IASetInputLayout(m_layout); deviceContext->IASetInputLayout(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(m_vertexShader, NULL, 0); deviceContext->VSSetShader(vertex_shader_, NULL, 0);
deviceContext->PSSetShader(m_pixelShader, NULL, 0); deviceContext->PSSetShader(pixel_shader_, NULL, 0);
// Set the sampler state in the pixel shader. // Set the sampler state in the pixel shader.
deviceContext->PSSetSamplers(0, 1, &m_sampleState); deviceContext->PSSetSamplers(0, 1, &sample_state_);
// Render the triangle. // render the triangle.
deviceContext->DrawIndexed(indexCount, 0, 0); deviceContext->DrawIndexed(indexCount, 0, 0);
return; return;

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