Skip to content

Commit

Permalink
ãì소프트웨어 설계 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
ahnjiwoo committed Sep 22, 2024
1 parent 90dc54b commit f063ebd
Show file tree
Hide file tree
Showing 54 changed files with 162 additions and 101 deletions.
2 changes: 1 addition & 1 deletion MyD3DFramework/LightPixelShader.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ void ComputeSpotLight(
out float4 outSpecular
)
{
//초기화
//초기화l
outAmbient = float4(0.f, 0.f, 0.f, 0.f);
outDiffuse = float4(0.f, 0.f, 0.f, 0.f);
outSpecular = float4(0.f, 0.f, 0.f, 0.f);
Expand Down
14 changes: 12 additions & 2 deletions MyD3DFramework/MyD3DFramework.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<GenerateManifest>true</GenerateManifest>
<OutDir>$(SolutionDir)Binaries\Debug</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(SolutionDir)Binaries\Release</OutDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
Expand Down Expand Up @@ -111,7 +115,7 @@
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp20</LanguageStandard>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<AdditionalIncludeDirectories>$(SolutionDir)\DirectXTK\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)\DirectXTK\inc;$(SolutionDir)\MyD3DFramework;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<FloatingPointModel>Fast</FloatingPointModel>
</ClCompile>
<Link>
Expand All @@ -128,7 +132,7 @@
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>$(SolutionDir)\DirectXTK\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)\DirectXTK\inc;$(SolutionDir)\MyD3DFramework;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp20</LanguageStandard>
<LanguageStandard_C>stdc17</LanguageStandard_C>
<PrecompiledHeader>Use</PrecompiledHeader>
Expand All @@ -155,15 +159,18 @@
<ClInclude Include="InputManager.h" />
<ClInclude Include="Main.h" />
<ClInclude Include="Material.h" />
<ClInclude Include="Mesh.h" />
<ClInclude Include="pch.h" />
<ClInclude Include="PointLight.h" />
<ClInclude Include="RenderableObject.h" />
<ClInclude Include="Renderer.h" />
<ClInclude Include="Resource.h" />
<ClInclude Include="ResourceManager.h" />
<ClInclude Include="ShaderIncludeHelper.h" />
<ClInclude Include="SimpleMathAdv.h" />
<ClInclude Include="SpotLight.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="Transform.h" />
<ClInclude Include="Types.h" />
<ClInclude Include="Macro.h" />
<ClInclude Include="Vertex.h" />
Expand All @@ -185,19 +192,22 @@
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Use</PrecompiledHeader>
</ClCompile>
<ClCompile Include="Material.cpp" />
<ClCompile Include="Mesh.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">pch.h</PrecompiledHeaderFile>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">pch.h</PrecompiledHeaderFile>
</ClCompile>
<ClCompile Include="PointLight.cpp" />
<ClCompile Include="RenderableObject.cpp" />
<ClCompile Include="Renderer.cpp" />
<ClCompile Include="ResourceManager.cpp" />
<ClCompile Include="ShaderIncludeHelper.cpp" />
<ClCompile Include="SimpleMathAdv.cpp" />
<ClCompile Include="SpotLight.cpp" />
<ClCompile Include="Structs.cpp" />
<ClCompile Include="Transform.cpp" />
<ClCompile Include="Vertex.cpp" />
<ClCompile Include="WindowsApp.cpp" />
<ClCompile Include="WindowsProc.cpp" />
Expand Down
95 changes: 58 additions & 37 deletions MyD3DFramework/MyD3DFramework.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@
<ClInclude Include="InputManager.h">
<Filter>03.Module</Filter>
</ClInclude>
<ClInclude Include="Vertex.h">
<Filter>99.Headers\Rendering</Filter>
</ClInclude>
<ClInclude Include="Enums.h">
<Filter>99.Headers</Filter>
</ClInclude>
Expand All @@ -67,23 +64,35 @@
<ClInclude Include="ShaderIncludeHelper.h">
<Filter>99.Headers\Utility\DirectX</Filter>
</ClInclude>
<ClInclude Include="SimpleMathAdv.h">
<Filter>99.Headers\Utility\Math</Filter>
</ClInclude>
<ClInclude Include="DirectionalLight.h">
<Filter>99.Headers\Rendering\Light</Filter>
<Filter>06.RenderModules\Light</Filter>
</ClInclude>
<ClInclude Include="PointLight.h">
<Filter>99.Headers\Rendering\Light</Filter>
<Filter>06.RenderModules\Light</Filter>
</ClInclude>
<ClInclude Include="SpotLight.h">
<Filter>99.Headers\Rendering\Light</Filter>
<Filter>06.RenderModules\Light</Filter>
</ClInclude>
<ClInclude Include="RenderableObject.h">
<Filter>05.Object</Filter>
</ClInclude>
<ClInclude Include="Transform.h">
<Filter>06.RenderModules</Filter>
</ClInclude>
<ClInclude Include="Vertex.h">
<Filter>06.RenderModules</Filter>
</ClInclude>
<ClInclude Include="ContantBuffers.h">
<Filter>99.Headers\Rendering</Filter>
<Filter>06.RenderModules</Filter>
</ClInclude>
<ClInclude Include="Material.h">
<Filter>99.Headers\Rendering</Filter>
<Filter>06.RenderModules</Filter>
</ClInclude>
<ClInclude Include="SimpleMathAdv.h">
<Filter>99.Headers\Utility\Math</Filter>
<ClInclude Include="Mesh.h">
<Filter>06.RenderModules</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -113,9 +122,6 @@
<Filter Include="02.Windows\WindowProc">
<UniqueIdentifier>{88749dda-40c1-432b-b215-a32832f2a45d}</UniqueIdentifier>
</Filter>
<Filter Include="99.Headers\Rendering">
<UniqueIdentifier>{7c51b9fe-926f-4ccc-97a8-d7e453f95e3b}</UniqueIdentifier>
</Filter>
<Filter Include="04.Resource">
<UniqueIdentifier>{c40b9c7d-1f7d-4644-92fb-5c8828997fd5}</UniqueIdentifier>
</Filter>
Expand All @@ -125,23 +131,29 @@
<Filter Include="99.Headers\Utility">
<UniqueIdentifier>{ead7b941-b6e4-4b56-b500-97f7286bbee9}</UniqueIdentifier>
</Filter>
<Filter Include="05.Shader">
<UniqueIdentifier>{8221b782-8374-4d33-a989-eefa5ba9118e}</UniqueIdentifier>
</Filter>
<Filter Include="99.Headers\Utility\DirectX">
<UniqueIdentifier>{64994a64-867c-43a8-90f9-af23a013e5ed}</UniqueIdentifier>
</Filter>
<Filter Include="99.Headers\Rendering\Light">
<UniqueIdentifier>{c5affbb2-1d59-44dc-9d0c-eab16615963c}</UniqueIdentifier>
<Filter Include="99.Headers\Utility\Math">
<UniqueIdentifier>{30d3bf42-960a-4cce-8dad-e28db940d889}</UniqueIdentifier>
</Filter>
<Filter Include="05.Object">
<UniqueIdentifier>{feb580ef-5ac5-4dee-a760-4cdf7ba495ac}</UniqueIdentifier>
</Filter>
<Filter Include="05.Shader\Transform">
<Filter Include="06.RenderModules">
<UniqueIdentifier>{8221b782-8374-4d33-a989-eefa5ba9118e}</UniqueIdentifier>
</Filter>
<Filter Include="06.RenderModules\Shader">
<UniqueIdentifier>{7c882b67-ef5c-4f3a-8ff7-8297a4597a0f}</UniqueIdentifier>
</Filter>
<Filter Include="06.RenderModules\Shader\Transform">
<UniqueIdentifier>{6590a010-c3a0-4c41-917f-59de16ae2aa9}</UniqueIdentifier>
</Filter>
<Filter Include="05.Shader\Light+Trans">
<Filter Include="06.RenderModules\Shader\Light+Trans">
<UniqueIdentifier>{b0a1ee0e-148b-4071-bc56-413b7f1bf831}</UniqueIdentifier>
</Filter>
<Filter Include="99.Headers\Utility\Math">
<UniqueIdentifier>{30d3bf42-960a-4cce-8dad-e28db940d889}</UniqueIdentifier>
<Filter Include="06.RenderModules\Light">
<UniqueIdentifier>{443e8641-a7f4-4c5d-bc8a-c4cd4eea9449}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
Expand Down Expand Up @@ -175,9 +187,6 @@
<ClCompile Include="InputManager.cpp">
<Filter>03.Module</Filter>
</ClCompile>
<ClCompile Include="Vertex.cpp">
<Filter>99.Headers\Rendering</Filter>
</ClCompile>
<ClCompile Include="ResourceManager.cpp">
<Filter>03.Module</Filter>
</ClCompile>
Expand All @@ -193,23 +202,35 @@
<ClCompile Include="ShaderIncludeHelper.cpp">
<Filter>99.Headers\Utility\DirectX</Filter>
</ClCompile>
<ClCompile Include="SimpleMathAdv.cpp">
<Filter>99.Headers\Utility\Math</Filter>
</ClCompile>
<ClCompile Include="DirectionalLight.cpp">
<Filter>99.Headers\Rendering\Light</Filter>
<Filter>06.RenderModules\Light</Filter>
</ClCompile>
<ClCompile Include="PointLight.cpp">
<Filter>99.Headers\Rendering\Light</Filter>
<Filter>06.RenderModules\Light</Filter>
</ClCompile>
<ClCompile Include="SpotLight.cpp">
<Filter>99.Headers\Rendering\Light</Filter>
<Filter>06.RenderModules\Light</Filter>
</ClCompile>
<ClCompile Include="RenderableObject.cpp">
<Filter>05.Object</Filter>
</ClCompile>
<ClCompile Include="Transform.cpp">
<Filter>06.RenderModules</Filter>
</ClCompile>
<ClCompile Include="Vertex.cpp">
<Filter>06.RenderModules</Filter>
</ClCompile>
<ClCompile Include="ContantBuffers.cpp">
<Filter>99.Headers\Rendering</Filter>
<Filter>06.RenderModules</Filter>
</ClCompile>
<ClCompile Include="Material.cpp">
<Filter>99.Headers\Rendering</Filter>
<Filter>06.RenderModules</Filter>
</ClCompile>
<ClCompile Include="SimpleMathAdv.cpp">
<Filter>99.Headers\Utility\Math</Filter>
<ClCompile Include="Mesh.cpp">
<Filter>06.RenderModules</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
Expand All @@ -228,21 +249,21 @@
<Filter>99.Headers\Default</Filter>
</None>
<None Include="ShaderHeader.hlsli">
<Filter>05.Shader</Filter>
<Filter>06.RenderModules\Shader</Filter>
</None>
</ItemGroup>
<ItemGroup>
<FxCompile Include="SimpleVertexShader.hlsl">
<Filter>05.Shader\Transform</Filter>
<Filter>06.RenderModules\Shader\Transform</Filter>
</FxCompile>
<FxCompile Include="SimplePixelShader.hlsl">
<Filter>05.Shader\Transform</Filter>
<Filter>06.RenderModules\Shader\Transform</Filter>
</FxCompile>
<FxCompile Include="LightVertexShader.hlsl">
<Filter>05.Shader\Light+Trans</Filter>
<Filter>06.RenderModules\Shader\Light+Trans</Filter>
</FxCompile>
<FxCompile Include="LightPixelShader.hlsl">
<Filter>05.Shader\Light+Trans</Filter>
<Filter>06.RenderModules\Shader\Light+Trans</Filter>
</FxCompile>
</ItemGroup>
</Project>
30 changes: 16 additions & 14 deletions MyD3DFramework/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "Engine.h"
#include <fstream>



bool Renderer::InitD3D11Device()
{
if (!::XMVerifyCPUSupport())
Expand Down Expand Up @@ -163,7 +165,6 @@ void Renderer::CreateDeviceDependentResource()
m_spriteBatch = std::make_unique<SpriteBatch>(m_deviceContext.Get());
}


void Renderer::InputAssembler()
{
//Vertex Shader 컴파일
Expand Down Expand Up @@ -235,7 +236,7 @@ void Renderer::InputAssembler()

D3D11_BUFFER_DESC vbd = {};
vbd.Usage = D3D11_USAGE_DEFAULT;
vbd.ByteWidth = sizeof(VertexNormal) * 8;
vbd.ByteWidth = sizeof(VertexNormal) * ARRAYSIZE(vertices);
vbd.BindFlags = D3D11_BIND_VERTEX_BUFFER;

D3D11_SUBRESOURCE_DATA vinitData = {};
Expand All @@ -261,7 +262,7 @@ void Renderer::InputAssembler()

D3D11_BUFFER_DESC ibd = {};
ibd.Usage = D3D11_USAGE_DEFAULT;
ibd.ByteWidth = sizeof(UINT) * 36;
ibd.ByteWidth = sizeof(UINT) * ARRAYSIZE(indices);
ibd.BindFlags = D3D11_BIND_INDEX_BUFFER;
ibd.CPUAccessFlags = 0;
ibd.MiscFlags = 0;
Expand Down Expand Up @@ -315,17 +316,17 @@ void Renderer::InputAssembler()
m_farPlane);

//광원 초기화
m_spotLight.Ambient = Color(0.2f, 0.2f, 0.2f, 1.f);
m_spotLight.Diffuse = Color(1.0f, 0.95f, 0.8f, 1.f);
m_spotLight.Specular = Color(1.0f, 1.0f, 1.0f, 1.f);
m_spotLight.SpotDirection = Vector3(0.f, 0.f, 1.f);
m_spotLight.Attenuation = Vector3(1.f,0.1f,0.f);
m_spotLight.Range = 50.f;
m_dirLight.Ambient = Color(0.2f, 0.2f, 0.2f, 1.f);
m_dirLight.Diffuse = Color(1.0f, 0.95f, 0.8f, 1.f);
m_dirLight.Specular = Color(1.0f, 1.0f, 1.0f, 1.f);
m_dirLight.Direction = Vector3(2.f, -1.f, 2.f);
m_dirLight.Direction.Normalize();

//머테리얼 설정
m_material.Ambient = Color(0.4f, 0.4f, 0.4f, 1.f);
m_material.Diffuse = Color(0.5f, 0.5f, 0.5f, 1.f);
m_material.Ambient = Color(0.4f, 0.4f, 0.4f, 1.f);
m_material.Diffuse = Color(0.5f, 0.5f, 0.5f, 1.f);
m_material.Specular = Color(0.8f, 0.8f, 0.8f, 16.f);

}

void Renderer::Update(float inDeltaTime)
Expand Down Expand Up @@ -369,7 +370,7 @@ void Renderer::Update(float inDeltaTime)

if (KEY_HOLD(eKeyCode::Left))
{
m_cmrLook = ::XMVector3Rotate(m_cmrLook, Quaternion::CreateFromYawPitchRoll(-s_cmrRotateSpeed * inDeltaTime,0.f,0.f));
m_cmrLook = ::XMVector3Rotate(m_cmrLook, Quaternion::CreateFromYawPitchRoll(-s_cmrRotateSpeed * inDeltaTime, 0.f, 0.f));
}

if (KEY_HOLD(eKeyCode::Right))
Expand All @@ -388,7 +389,7 @@ void Renderer::Update(float inDeltaTime)
}
}

static const float s_rotateSpeed = ::XMConvertToRadians(30.f);
static const float s_rotateSpeed = ::XMConvertToRadians(90.f);
float s_rotateDelta = inDeltaTime * s_rotateSpeed;

//Update cbPerObject
Expand All @@ -411,7 +412,7 @@ void Renderer::Update(float inDeltaTime)
//Update cbPerFrame
{
cbPerFrame cb = {};
m_spotLight.Position = m_cmrPosition;
m_dirLight.Direction = ::XMVector3Rotate(m_dirLight.Direction, Quaternion::CreateFromYawPitchRoll(s_rotateDelta, 0.f, 0.f));

cb.gEyePosW = ToVector4(m_cmrPosition, true);
cb.gDirLight = m_dirLight;
Expand All @@ -420,6 +421,7 @@ void Renderer::Update(float inDeltaTime)

m_deviceContext->UpdateSubresource(m_cBufferPerFrame.Get(), 0, nullptr, &cb, 0, 0);
}

}

void Renderer::Render()
Expand Down
5 changes: 5 additions & 0 deletions MyD3DFramework/Renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ class Renderer
inline D3D_FEATURE_LEVEL GetFeatureLevel() const { return m_featureLevel; }
inline std::wstring GetFeatureLevelToString() const;

void ReloadRenderState()
{
}

private:
Renderer() = default;
~Renderer() = default;
Expand All @@ -65,6 +69,7 @@ class Renderer
ComPtr<ID3D11Buffer> m_vertexBuffer = nullptr;
ComPtr<ID3D11Buffer> m_indexBuffer = nullptr;


CD3D11_VIEWPORT m_viewport = {};
D3D_FEATURE_LEVEL m_featureLevel = {};

Expand Down
2 changes: 2 additions & 0 deletions MyD3DFramework/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,10 @@ using namespace DirectX::SimpleMath;
#include "BufferPool.h"
#include "Algorithm.h"
#include "SimpleMathAdv.h"
#include "Transform.h"

//About Rendering
#include "Mesh.h"
#include "Vertex.h"
#include "Material.h"
#include "DirectionalLight.h"
Expand Down
Binary file modified MyD3DFramework/x64/Debug/Algorithm.obj
Binary file not shown.
Binary file modified MyD3DFramework/x64/Debug/BufferPool.obj
Binary file not shown.
Binary file modified MyD3DFramework/x64/Debug/ContantBuffers.obj
Binary file not shown.
Binary file modified MyD3DFramework/x64/Debug/DirectionalLight.obj
Binary file not shown.
Binary file modified MyD3DFramework/x64/Debug/Engine.obj
Binary file not shown.
Binary file modified MyD3DFramework/x64/Debug/Font.obj
Binary file not shown.
Binary file modified MyD3DFramework/x64/Debug/GameTimer.obj
Binary file not shown.
Binary file modified MyD3DFramework/x64/Debug/InputManager.obj
Binary file not shown.
Binary file modified MyD3DFramework/x64/Debug/Main.obj
Binary file not shown.
Binary file modified MyD3DFramework/x64/Debug/Material.obj
Binary file not shown.
Loading

0 comments on commit f063ebd

Please sign in to comment.