diff --git a/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Engine_Shader_Defines.hlsli b/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Engine_Shader_Defines.hlsli
index 077fa26d2..05b918dcc 100644
--- a/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Engine_Shader_Defines.hlsli
+++ b/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Engine_Shader_Defines.hlsli
@@ -1,7 +1,11 @@
+#ifndef ENGINE_SHADER_DEFINES_HLSLI
+#define ENGINE_SHADER_DEFINES_HLSLI
-vector g_vMtrlDiffuse = 1.f;
-vector g_vMtrlAmbient = 1.f;
-vector g_vMtrlSpecular = 1.f;
+#include "Engine_Shader_Constants.hlsli"
+#include "Engine_Shader_Structures.hlsli"
+#include "Engine_Shader_Samplers.hlsli"
+#include "Engine_Shader_States.hlsli"
+#include "Engine_Shader_Functions.hlsli"
float PI = 3.14592;
@@ -256,3 +260,5 @@ float2 UV_Cutting(float2 vUV, float2 vUVCutting, int iCurrentFrame)
return UV;
}
+#endif // ENGINE_SHADER_DEFINES_HLSLI
+
diff --git a/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl
index 38eea62d7..a02084c27 100644
--- a/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl
+++ b/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl
@@ -35,14 +35,13 @@ Texture2D g_BlurTexture;
Texture2D g_BlurXTexture;
Texture2D g_BlurWeightTexture;
+Texture2D g_SurfaceTexture;
vector g_vLightDiffuse;
vector g_vLightAmbient;
vector g_vLightSpecular;
-
-
struct VS_IN
{
float3 vPosition : POSITION;
@@ -56,9 +55,9 @@ struct VS_OUT
};
VS_OUT VS_MAIN(VS_IN In)
{
- VS_OUT Out;
+ VS_OUT Out;
- matrix matWV, matWVP;
+ matrix matWV, matWVP;
matWV = mul(g_WorldMatrix, g_ViewMatrix);
matWVP = mul(matWV, g_ProjMatrix);
@@ -66,7 +65,7 @@ VS_OUT VS_MAIN(VS_IN In)
Out.vPosition = mul(vector(In.vPosition, 1.f), matWVP);
Out.vTexcoord = In.vTexcoord;
- return Out;
+ return Out;
}
struct PS_IN
@@ -99,41 +98,77 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
{
PS_OUT_LIGHT Out;
- vector vNormalDesc = g_NormalTexture.Sample(DefaultSampler, In.vTexcoord);
+ float2 uv = In.vTexcoord;
- float4 vNormal = vector(vNormalDesc.xyz * 2.f - 1.f, 0.0f);
+ // float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1);
+ float3 vNormal = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, uv);
- Out.vShade = g_vLightDiffuse * saturate(max(dot(normalize(g_vLightDir) * -1.f, vNormal), 0.f) + (g_vLightAmbient * g_vMtrlAmbient));
+ float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
- vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
+ float fViewZ = vDepth.y * g_fFar;
- float fViewZ = vDepthDesc.y * g_fFar;
+ float4 vWorldPosition;
+ {
+ vWorldPosition.x = uv.x * 2 - 1;
+ vWorldPosition.y = uv.y * -2 + 1;
+ vWorldPosition.z = vDepth.x;
+ vWorldPosition.w = 1.f;
+ vWorldPosition *= fViewZ;
+ vWorldPosition = mul(vWorldPosition, g_invmatProj);
+ vWorldPosition = mul(vWorldPosition, g_invMatView);
+ }
- vector vPosition;
+ float3 vF0;
+ float fMetallic;
+ float fRoughness;
+ float fOcclusion;
+ float fAttenuation;
-{ // vDepthDesc과 vTexcoord.xy로부터 World Position의 추론
- /* 직육면체의 NDC */
- /* LocalPos * World * View * Proj * ( 1 / w ) */
- vPosition.x = In.vTexcoord.x * 2.f - 1.f;
- vPosition.y = In.vTexcoord.y * -2.f + 1.f;
- vPosition.z = vDepthDesc.x;
- vPosition.w = 1.f;
+ float3 vWPos = vWorldPosition.xyz;
+ float3 vFromView = normalize(vWPos - g_vCamPosition.xyz); // 카메라에서 픽셀로 가는 방향
+ float3 vFromLight = normalize(g_vLightDir.xyz); // 라이트에서 오는 라이트 벡터
- /* [* (1 / w)] 소거*/
- /* z나누기를 되돌림 */
- vPosition = vPosition * fViewZ;
-// vPosition.x = In.vTexcoord.x * 2.f - 1.f * Far;
-// vPosition.y = In.vTexcoord.y * -2.f + 1.f * Far;
-// vPosition.z = vDepthDesc.x * Far;
-// vPosition.w = Far;
+ float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
- vPosition = mul(vPosition, g_invmatProj);
- vPosition = mul(vPosition, g_invMatView);
-}
- vector vLook = vPosition - g_vCamPosition;
- vector vReflect = reflect(normalize(g_vLightDir), vNormal);
+ if (true == AlmostEqual3(vDepth.b, AI_TEXTURE_TYPE_METALNESS)) // Metallic
+ {
+ float3 vMRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb;
+ fMetallic = vMRO.r;
+ fRoughness = vMRO.g;
+ fOcclusion = vMRO.b;
+
+ vF0 = lerp(float3(0.04f, 0.04f, 0.04f), vAlbedo, fMetallic);
+ }
+ else if (true == AlmostEqual3(vDepth.b, AI_TEXTURE_TYPE_SPECULAR)) // Specular
+ {
+ float3 vSRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb;
+ float3 vSpec = vSRO.r;
+
+ fMetallic = 0.f;
+ fRoughness = vSRO.g;
+ fOcclusion = vSRO.b;
+
+
+ vF0 = vSpec.xxx;
+ }
+ else
+ {
+ fMetallic = 0.f;
+ fRoughness = 0.5f;
+ fOcclusion = 1.f;
+ vF0 = float3(0.04f, 0.04f, 0.04f);
+ }
- Out.vSpecular = (g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(normalize(vLook) * -1.f, normalize(vReflect)), 0.f), 50.f);
+ fAttenuation = 1.f;
+
+ float fDiffuseAOStrength = lerp(0.3f, 1.f, fOcclusion);
+
+ PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vFromView, vFromLight, vAlbedo, fMetallic, fRoughness, g_vLightDiffuse.rgb, fAttenuation, vF0);
+
+ PBR_Out.vShade *= fDiffuseAOStrength;
+
+ Out.vShade = float4(PBR_Out.vShade, 1.f);
+ Out.vSpecular = float4(PBR_Out.vSpecular, 1.f);
return Out;
}
@@ -142,38 +177,81 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
{
PS_OUT_LIGHT Out;
- vector vNormalDesc = g_NormalTexture.Sample(DefaultSampler, In.vTexcoord);
+ float2 uv = In.vTexcoord;
- float4 vNormal = vector(vNormalDesc.xyz * 2.f - 1.f, 0.f);
+ float3 vNormal = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, uv);
- vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
- float fViewZ = vDepthDesc.y * g_fFar;
+ float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
- vector vPosition;
- /* 0 ~ 1 에서 -1 ~ 1 */
- vPosition.x = In.vTexcoord.x * 2.f - 1.f;
- vPosition.y = In.vTexcoord.y * -2.f + 1.f;
- vPosition.z = vDepthDesc.x;
- vPosition.w = 1.f;
- vPosition = vPosition * fViewZ;
- vPosition = mul(vPosition, g_invmatProj);
- vPosition = mul(vPosition, g_invMatView);
+ float fViewZ = vDepth.y * g_fFar;
- vector vLightDir = vPosition - (g_vLightPos + g_vLightPosOffset);
- float fDistance = length(vLightDir);
- float fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange);
- if (fAttenuation <= 0.f)
+ float4 vWorldPosition;
{
- discard;
+ vWorldPosition.x = uv.x * 2 - 1;
+ vWorldPosition.y = uv.y * -2 + 1;
+ vWorldPosition.z = vDepth.x;
+ vWorldPosition.w = 1.f;
+ vWorldPosition *= fViewZ;
+ vWorldPosition = mul(vWorldPosition, g_invmatProj);
+ vWorldPosition = mul(vWorldPosition, g_invMatView);
}
- vLightDir = normalize(vLightDir);
- Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vLightDir * -1.f, vNormal), 0.f) + (g_vLightAmbient * g_vMtrlAmbient)));
+ float3 vWPos = vWorldPosition.xyz;
+ float3 vFromView = normalize(vWPos - g_vCamPosition.xyz); // 카메라에서 픽셀로 가는 방향
+ float3 vFromLight = normalize(g_vLightDir.xyz); // 라이트에서 오는 라이트 벡터
- vector vLook = vPosition - g_vCamPosition;
- vector vReflect = reflect(vLightDir, vNormal);
+ float3 vF0;
+ float fMetallic;
+ float fRoughness;
+ float fOcclusion;
+ float fAttenuation;
- Out.vSpecular = fAttenuation * ((g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(normalize(vLook) * -1.f, normalize(vReflect)), 0.f), 50.f));
+ {
+ float fDistance = length(vFromLight);
+ fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange);
+ if (fAttenuation <= 0.f)
+ {
+ discard;
+ }
+ }
+
+ float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
+
+ if (true == AlmostEqual3(vDepth.b, AI_TEXTURE_TYPE_METALNESS)) // Metallic
+ {
+ float3 vMRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb;
+ fMetallic = vMRO.r;
+ fRoughness = vMRO.g;
+ fOcclusion = vMRO.b;
+
+ vF0 = lerp(float3(0.04f, 0.04f, 0.04f), vAlbedo, fMetallic);
+ }
+ else if (true == AlmostEqual3(vDepth.b, AI_TEXTURE_TYPE_SPECULAR)) // Specular
+ {
+ float3 vSRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb;
+ float3 vSpec = vSRO.r;
+
+ fMetallic = 0.f;
+ fRoughness = vSRO.g;
+ fOcclusion = vSRO.b;
+
+
+ vF0 = vSpec.xxx;
+ }
+ else
+ {
+ fMetallic = 0.f;
+ fRoughness = 0.5f;
+ fOcclusion = 1.f;
+ vF0 = float3(0.04f, 0.04f, 0.04f);
+ }
+
+ PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vFromView, vFromLight,
+ vAlbedo, fMetallic, fRoughness,
+ g_vLightDiffuse.rgb, fAttenuation, vF0);
+
+ Out.vShade = float4(PBR_Out.vShade, 1.f);
+ Out.vSpecular = float4(PBR_Out.vSpecular, 1.f);
return Out;
}
@@ -182,46 +260,85 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
{
PS_OUT_LIGHT Out;
- vector vNormalDesc = g_NormalTexture.Sample(DefaultSampler, In.vTexcoord);
+ float2 uv = In.vTexcoord;
- float4 vNormal = vector(vNormalDesc.xyz * 2.f - 1.f, 0.f);
+ float3 vNormal = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, uv);
- vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
- float fViewZ = vDepthDesc.y * g_fFar;
+ float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
- vector vPosition;
- /* 0 ~ 1 에서 -1 ~ 1 */
- vPosition.x = In.vTexcoord.x * 2.f - 1.f;
- vPosition.y = In.vTexcoord.y * -2.f + 1.f;
- vPosition.z = vDepthDesc.x;
- vPosition.w = 1.f;
- vPosition = vPosition * fViewZ;
- vPosition = mul(vPosition, g_invmatProj);
- vPosition = mul(vPosition, g_invMatView);
+ float fViewZ = vDepth.y * g_fFar;
- vector vLightDir = vPosition - g_vLightPos;
- float fDistance = length(vLightDir);
- float fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange);
- if (fAttenuation <= 0.f)
+ float4 vWorldPosition;
{
- discard;
+ vWorldPosition.x = uv.x * 2 - 1;
+ vWorldPosition.y = uv.y * -2 + 1;
+ vWorldPosition.z = vDepth.x;
+ vWorldPosition.w = 1.f;
+ vWorldPosition *= fViewZ;
+ vWorldPosition = mul(vWorldPosition, g_invmatProj);
+ vWorldPosition = mul(vWorldPosition, g_invMatView);
}
- vLightDir = normalize(vLightDir);
- vector vSpotDir = normalize(g_vLightDir);
- float fCosAngle = dot(vLightDir, vSpotDir);
+
+ float3 vWPos = vWorldPosition.xyz;
+ float3 vFromView = normalize(vWPos - g_vCamPosition.xyz); // 카메라에서 픽셀로 가는 방향
+ float3 vFromLight = normalize(g_vLightDir.xyz); // 라이트에서 오는 라이트 벡터
+
+ float3 vF0;
+ float fMetallic;
+ float fRoughness;
+ float fOcclusion;
+ float fAttenuation;
+ {
+ float fDistance = length(vFromLight);
+ fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange);
+ if (fAttenuation <= 0.f)
+ {
+ discard;
+ }
+ }
+ float fCosAngle = dot(vFromLight, g_vLightDir.xyz);
if (fCosAngle < g_fSpotOuterAngle)
{
discard;
}
- float fSpotAttenenuation = saturate((fCosAngle - g_fSpotInnerAngle) / (g_fSpotInnerAngle - g_fSpotOuterAngle));
+ float fSpotAttenenuation = saturate((fCosAngle - g_fSpotInnerAngle) / (g_fSpotInnerAngle - g_fSpotOuterAngle));
fAttenuation *= fSpotAttenenuation;
- Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vLightDir * -1.f, vNormal), 0.f) + (g_vLightAmbient * g_vMtrlAmbient)));
+ float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
- vector vLook = vPosition - g_vCamPosition;
- vector vReflect = reflect(vLightDir, vNormal);
+ if (true == AlmostEqual3(vDepth.b, AI_TEXTURE_TYPE_METALNESS)) // Metallic
+ {
+ float3 vMRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb;
+ fMetallic = vMRO.r;
+ fRoughness = vMRO.g;
+ fOcclusion = vMRO.b;
+
+ vF0 = lerp(float3(0.04f, 0.04f, 0.04f), vAlbedo, fMetallic);
+ }
+ else if (true == AlmostEqual3(vDepth.b, AI_TEXTURE_TYPE_SPECULAR)) // Specular
+ {
+ float3 vSRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb;
+ float3 vSpec = vSRO.r;
+
+ fMetallic = 0.f;
+ fRoughness = vSRO.g;
+ fOcclusion = vSRO.b;
+
+
+ vF0 = vSpec.xxx;
+ }
+ else
+ {
+ fMetallic = 0.f;
+ fRoughness = 0.5f;
+ fOcclusion = 1.f;
+ vF0 = float3(0.04f, 0.04f, 0.04f);
+ }
- Out.vSpecular = fAttenuation * ((g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(normalize(vLook) * -1.f, normalize(vReflect)), 0.f), 50.f));
+ PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vFromView, vFromLight, vAlbedo, fMetallic, fRoughness, g_vLightDiffuse.rgb, fAttenuation, vF0);
+
+ Out.vShade = float4(PBR_Out.vShade, 1.f);
+ Out.vSpecular = float4(PBR_Out.vSpecular, 1.f);
return Out;
}
@@ -271,6 +388,7 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
vPosition = mul(vPosition, g_invmatProj);
vPosition = mul(vPosition, g_invMatView);
vPreShadowPosition = vPosition;
+
/* (로컬위치 * 월드) -> (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 ) */
vPosition = mul(vPosition, g_LightViewMatrix);
vPosition = mul(vPosition, g_LightProjMatrix);
@@ -377,7 +495,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X(PS_IN In)
vColor += g_fWeights[i + 15] * g_BlurTexture.Sample(ClampSampler, vTexcoord);
}
- Out.vBlurX = vColor;
+ Out.vBlurX = vColor;
return Out;
}
@@ -385,7 +503,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X(PS_IN In)
technique11 DefaultTechnique
{
- pass DebugPass
+ pass DebugPass // 0
{
SetRasterizerState(RS_Default);
SetDepthStencilState(DSS_Default, 0);
@@ -395,7 +513,7 @@ technique11 DefaultTechnique
PixelShader = compile ps_5_0 PS_MAIN_DEBUG();
}
- pass DirectionalPass
+ pass DirectionalPass // 1
{
SetRasterizerState(RS_Default);
SetDepthStencilState(DSS_None, 0);
@@ -405,7 +523,7 @@ technique11 DefaultTechnique
PixelShader = compile ps_5_0 PS_MAIN_DIRECTIONAL();
}
- pass PointPass
+ pass PointPass // 2
{
SetRasterizerState(RS_Default);
SetDepthStencilState(DSS_None, 0);
@@ -415,7 +533,7 @@ technique11 DefaultTechnique
PixelShader = compile ps_5_0 PS_MAIN_POINT();
}
- pass CombinedPass
+ pass CombinedPass // 3
{
SetRasterizerState(RS_Default);
SetDepthStencilState(DSS_None, 0);
@@ -425,7 +543,7 @@ technique11 DefaultTechnique
PixelShader = compile ps_5_0 PS_MAIN_COMBINED();
}
- pass BlurPass
+ pass BlurPass // 4
{
SetRasterizerState(RS_Default);
SetDepthStencilState(DSS_None, 0);
@@ -435,7 +553,7 @@ technique11 DefaultTechnique
PixelShader = compile ps_5_0 PS_MAIN_BLUR_X();
}
- pass SpotPass
+ pass SpotPass // 5
{
SetRasterizerState(RS_Default);
SetDepthStencilState(DSS_None, 0);
diff --git a/Jusin154_Team3D/Client/Public/Client_Macro.h b/Jusin154_Team3D/Client/Public/Client_Macro.h
index a9e42a633..b9f913fc8 100644
--- a/Jusin154_Team3D/Client/Public/Client_Macro.h
+++ b/Jusin154_Team3D/Client/Public/Client_Macro.h
@@ -15,7 +15,6 @@ namespace Client {
#define FX_POSTEX TEXT("FX_POSTEX")
#define FX_NORTEX TEXT("FX_NORTEX")
#define FX_CELL TEXT("FX_CELL")
-#define FX_DEFERRED TEXT("FX_DEFFERED")
#define FX_PARTICLE TEXT("FX_PARTICLE")
#define FX_UIEDITOR TEXT("FX_UIEDITOR")
@@ -58,4 +57,4 @@ namespace Client {
#pragma region MACRO_EXTRA
#pragma endregion
-}
\ No newline at end of file
+}
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/ConfingoTest.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/ConfingoTest.bin
new file mode 100644
index 000000000..bc239d5c1
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/ConfingoTest.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:016da9c4fc0e164f3914a6d45abfaf0a45f2a421e90b8c360c0581fa5be78023
+size 555
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Test.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Test.bin
new file mode 100644
index 000000000..ea52d381c
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Test.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b80f4d457c7d8ce25daf73aa960db5d1a46b491d700a40f35e91a253546b0407
+size 588
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Test2.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Test2.bin
new file mode 100644
index 000000000..74e029c11
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Test2.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:b7e9b058b855b5c589651bd350a4af99b30664bd1ff684d4d2a96d34e683d36f
+size 586
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Height.bmp b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Height.bmp
new file mode 100644
index 000000000..728dc6336
Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Data/Map/Height.bmp differ
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/KeyFrame.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/KeyFrame.bin
deleted file mode 100644
index a19061885..000000000
--- a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/KeyFrame.bin
+++ /dev/null
@@ -1,3 +0,0 @@
-version https://git-lfs.github.com/spec/v1
-oid sha256:d32b8b61a6e5ed2b2c1d6472c01c06b85e86dd6edabe007a56990287dd52af18
-size 52
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/KeyFrame.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/KeyFrame.bin
index e69de29bb..12f29295b 100644
--- a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/KeyFrame.bin
+++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/KeyFrame.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:3f0e6a868bc07861d4cb0e0cd80ab163ac81805701331463b5401bf74c71e86d
+size 29
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/NFC_Broom.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/NFC_Broom.bin
new file mode 100644
index 000000000..8e9877109
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/NFC_Broom.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:def7cba77513dd9a10ad40cd962fbb0678c343e91d251b748184520b5a94104f
+size 12940862
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Npc_Broom.fbx b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Npc_Broom.fbx
new file mode 100644
index 000000000..f9c6dbc12
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Human/Npc/Npc_Broom.fbx
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:e59bb5c07f3550596b5a4da0dd248027d19bb96bed84a1019849be6f77df174a
+size 35534748
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/DragonGlobe.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/DragonGlobe.bin
new file mode 100644
index 000000000..8bfee58f2
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/DragonGlobe.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:a474ee4079f2727f72b82ad260f074dd07eb4c1711f604b7ed9b4aff689f7933
+size 739778
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/DragonGlobe.fbx b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/DragonGlobe.fbx
new file mode 100644
index 000000000..3cb8313b1
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/DragonGlobe.fbx
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:04095b30fb71db8aa5a1f88b789368f538077f5310d3f087c68af30ebaaf418a
+size 302236
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Base_D.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Base_D.dds
new file mode 100644
index 000000000..30a480528
Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Base_D.dds differ
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Base_MRO.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Base_MRO.dds
new file mode 100644
index 000000000..fc183f014
Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Base_MRO.dds differ
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Base_N.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Base_N.dds
new file mode 100644
index 000000000..2a74db500
Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Base_N.dds differ
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_D.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_D.dds
new file mode 100644
index 000000000..020dc3728
Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_D.dds differ
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Globe_D.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Globe_D.dds
new file mode 100644
index 000000000..dbd482408
Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Globe_D.dds differ
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Globe_MRO.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Globe_MRO.dds
new file mode 100644
index 000000000..81928a67b
Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Globe_MRO.dds differ
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Globe_N.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Globe_N.dds
new file mode 100644
index 000000000..9e747644c
Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_Globe_N.dds differ
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_MRO.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_MRO.dds
new file mode 100644
index 000000000..87c321c86
Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_MRO.dds differ
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_N.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_N.dds
new file mode 100644
index 000000000..7489e9c83
Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe/T_DragonGlobe_N.dds differ
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/DragonGlobe.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/DragonGlobe.bin
new file mode 100644
index 000000000..2b31d4576
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/DragonGlobe.bin
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:30b8f2e0c9087c3be426ffbbbcebdb1aa409a06e1331e31670949692656ac716
+size 739787
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/DragonGlobe.fbx b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/DragonGlobe.fbx
new file mode 100644
index 000000000..3cb8313b1
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/DragonGlobe.fbx
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:04095b30fb71db8aa5a1f88b789368f538077f5310d3f087c68af30ebaaf418a
+size 302236
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_Base_D.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_Base_D.dds
new file mode 100644
index 000000000..30a480528
Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_Base_D.dds differ
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_Base_MRO.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_Base_MRO.dds
new file mode 100644
index 000000000..fc183f014
Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_Base_MRO.dds differ
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_Base_N.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_Base_N.dds
new file mode 100644
index 000000000..52859906c
Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_Base_N.dds differ
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_D.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_D.dds
new file mode 100644
index 000000000..020dc3728
Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_D.dds differ
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_Globe_D.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_Globe_D.dds
new file mode 100644
index 000000000..dbd482408
Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_Globe_D.dds differ
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_Globe_MRO.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_Globe_MRO.dds
new file mode 100644
index 000000000..81928a67b
Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_Globe_MRO.dds differ
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_Globe_N.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_Globe_N.dds
new file mode 100644
index 000000000..35172d308
Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_Globe_N.dds differ
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_MRO.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_MRO.dds
new file mode 100644
index 000000000..87c321c86
Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_MRO.dds differ
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_N.dds b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_N.dds
new file mode 100644
index 000000000..0ed625085
Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Object/DragonGlobe2/T_DragonGlobe_N.dds differ
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Constants.hlsli b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Constants.hlsli
new file mode 100644
index 000000000..372ecfae5
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Constants.hlsli
@@ -0,0 +1,47 @@
+#ifndef ENGINE_SHADER_CONSTANTS_HLSLI
+#define ENGINE_SHADER_CONSTANTS_HLSLI
+
+static const vector g_vMtrlDiffuse = 1.f;
+static const vector g_vMtrlAmbient = 1.f;
+static const vector g_vMtrlSpecular = 1.f;
+
+static const float PI = 3.14159265359;
+static const float PI2 = 6.28318530718;
+
+static const float FLT_EPSILON7 = 1.192092896e-07;
+static const float FLT_EPSILON5 = 1.192092896e-05;
+static const float FLT_EPSILON3 = 1.192092896e-03;
+
+
+static const float AI_TEXTURE_TYPE_NONE = 0.f / 27.f;
+static const float AI_TEXTURE_TYPE_DIFFUSE = 1.f / 27.f;
+static const float AI_TEXTURE_TYPE_SPECULAR = 2.f / 27.f;
+static const float AI_TEXTURE_TYPE_AMBIENT = 3.f / 27.f;
+static const float AI_TEXTURE_TYPE_EMISSIVE = 4.f / 27.f;
+static const float AI_TEXTURE_TYPE_HEIGHT = 5.f / 27.f;
+static const float AI_TEXTURE_TYPE_NORMALS = 6.f / 27.f;
+static const float AI_TEXTURE_TYPE_SHININESS = 7.f / 27.f;
+static const float AI_TEXTURE_TYPE_OPACITY = 8.f / 27.f;
+static const float AI_TEXTURE_TYPE_DISPLACEMENT = 9.f / 27.f;
+static const float AI_TEXTURE_TYPE_LIGHTMAP = 10.f / 27.f;
+static const float AI_TEXTURE_TYPE_REFLECTION = 11.f / 27.f;
+static const float AI_TEXTURE_TYPE_BASE_COLOR = 12.f / 27.f;
+static const float AI_TEXTURE_TYPE_NORMAL_CAMERA = 13.f / 27.f;
+static const float AI_TEXTURE_TYPE_EMISSION_COLOR = 14.f / 27.f;
+static const float AI_TEXTURE_TYPE_METALNESS = 15.f / 27.f;
+static const float AI_TEXTURE_TYPE_DIFFUSE_ROUGHNESS = 16.f / 27.f;
+static const float AI_TEXTURE_TYPE_AMBIENT_OCCLUSION = 17.f / 27.f;
+static const float AI_TEXTURE_TYPE_UNKNOWN = 18.f / 27.f;
+static const float AI_TEXTURE_TYPE_SHEEN = 19.f / 27.f;
+static const float AI_TEXTURE_TYPE_CLEARCOAT = 20.f / 27.f;
+static const float AI_TEXTURE_TYPE_TRANSMISSION = 21.f / 27.f;
+static const float AI_TEXTURE_TYPE_MAYA_BASE = 22.f / 27.f;
+static const float AI_TEXTURE_TYPE_MAYA_SPECULAR = 23.f / 27.f;
+static const float AI_TEXTURE_TYPE_MAYA_SPECULAR_COLOR = 24.f / 27.f;
+static const float AI_TEXTURE_TYPE_MAYA_SPECULAR_ROUGHNESS = 25.f / 27.f;
+static const float AI_TEXTURE_TYPE_ANISOTROPY = 26.f / 27.f;
+static const float AI_TEXTURE_TYPE_GLTF_METALLIC_ROUGHNESS = 27.f / 27.f;
+
+
+
+#endif // ENGINE_SHADER_CONSTANTS_HLSLI
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Defines.hlsli b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Defines.hlsli
index 077fa26d2..05b918dcc 100644
--- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Defines.hlsli
+++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Defines.hlsli
@@ -1,7 +1,11 @@
+#ifndef ENGINE_SHADER_DEFINES_HLSLI
+#define ENGINE_SHADER_DEFINES_HLSLI
-vector g_vMtrlDiffuse = 1.f;
-vector g_vMtrlAmbient = 1.f;
-vector g_vMtrlSpecular = 1.f;
+#include "Engine_Shader_Constants.hlsli"
+#include "Engine_Shader_Structures.hlsli"
+#include "Engine_Shader_Samplers.hlsli"
+#include "Engine_Shader_States.hlsli"
+#include "Engine_Shader_Functions.hlsli"
float PI = 3.14592;
@@ -256,3 +260,5 @@ float2 UV_Cutting(float2 vUV, float2 vUVCutting, int iCurrentFrame)
return UV;
}
+#endif // ENGINE_SHADER_DEFINES_HLSLI
+
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli
new file mode 100644
index 000000000..70a63a82d
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli
@@ -0,0 +1,184 @@
+#ifndef ENGINE_SHADER_FUNCTIONS_HLSLI
+#define ENGINE_SHADER_FUNCTIONS_HLSLI
+
+#include "Engine_Shader_Constants.hlsli"
+#include "Engine_Shader_Structures.hlsli"
+#include "Engine_Shader_Samplers.hlsli"
+
+bool AlmostEqual7(float fA, float fB)
+{
+ return abs(fA - fB) < FLT_EPSILON7;
+}
+bool AlmostEqual5(float fA, float fB)
+{
+ return abs(fA - fB) < FLT_EPSILON5;
+}
+bool AlmostEqual3(float fA, float fB)
+{
+ return abs(fA - fB) < FLT_EPSILON3;
+}
+
+float ShadowVisibility_hwPCF(Texture2D ShadowMap, float4 vLightClip, float2 vShadowMapSize, float bias)
+{
+ float2 uv = float2(vLightClip.x / vLightClip.w, -vLightClip.y / vLightClip.w) * 0.5f + 0.5f;
+ float fDepthCenter = saturate(vLightClip.z / vLightClip.w);
+ float2 vTexel = 1.f / vShadowMapSize;
+
+ float fVisibility = 0.f;
+ for (int v = -1; v <= 1; ++v)
+ {
+ for (int u = -1; u <= 1; ++u)
+ {
+ float2 vOffset = float2(u, v) * vTexel;
+ float fDepth = ShadowMap.Sample(DefaultSampler, uv + vOffset).x;
+ fVisibility += (fDepthCenter - bias > fDepth) ? 0.f : 1.f;
+ }
+ }
+ return fVisibility / 9.f;
+}
+
+float GetRimLight(float3 vCamPosition, float3 vPosition, float3 vNormal, float fRimPower, float fRimStrength)
+{
+ float fRimLight = (1 - dot(normalize(vCamPosition - vPosition), vNormal));
+ fRimLight = pow(fRimLight, fRimPower);
+ fRimLight = fRimLight * fRimStrength;
+ return fRimLight;
+}
+
+float2 Get_MovedUV(float2 vOriginalUV, float fDeltaU, float fDeltaV, uint iIndexU, uint iIndexV)
+{
+ float2 vDelta = float2(fDeltaU, fDeltaV);
+ float2 vOffset = float2(iIndexU * fDeltaU, iIndexV * fDeltaV);
+ return vOriginalUV * vDelta + vOffset;
+}
+
+float2 UV_Cutting(float2 vUV, float2 vUVCutting, int iCurrentFrame)
+{
+ float2 UV = vUV; // 이미지의 UV값
+
+ int iTotalFrame = vUVCutting.x * vUVCutting.y; // 이미지의 최대 프레임 (몇 곱하기 몇인지)
+
+ int iFrameX = iCurrentFrame % (int) vUVCutting.x; // 현재 x축의 위치(현재 이미지의 몇번째 칸을 보여줄 지)
+ int iFrameY = iCurrentFrame / (int) vUVCutting.x; // 현재 y축의 위치(현재 이미지의 몇번째 줄을 보여줄 지)
+
+ float fFreamWidth = 1.0 / vUVCutting.x; // 1.0 나누기 이미지 갯수를 해서 한칸에 얼마나 갈지 정해준다.
+ float fFreamHeight = 1.0 / vUVCutting.y; // 1.0 나누기 이미지 갯수를 해서 한줄에 얼마나 갈지 정해준다.
+
+ UV.x = UV.x * fFreamWidth + iFrameX * fFreamWidth; // 먼저 uv를 0~1이 아닌 0~fFrameWidth로 만든 다음에 한칸씩 옆으로 밀어준다.
+ UV.y = UV.y * fFreamHeight + iFrameY * fFreamHeight; // 먼저 uv를 0~1이 아닌 0~fFrameHeight로 만든 다음에 한줄씩 밑으로 내려준다.
+
+ return UV;
+}
+
+// (Kd F(Lambert)) + (Ks F(cook-torrance))
+
+//float LambertDiffuse(float c)
+//{
+// return c / PI;
+//}
+
+// F(cook-torrance)
+// DFG / (4 (Wo dot N) (Wi dot N))
+
+// D(distribution, NormalDistribution function), 표면의 거칠기에 영향을 받는 halfWay vector
+// G(Geometry, GeometryFunc), 에너지 보존법칙 적용
+// F(Fresnel-Fresnel equation), 표면 각도에 따른 반사율
+
+// F->D
+float NDF_ggxtr(float3 vNormal, float3 vHalfWayVector, float fAlpha) // NormalDistributionGGXTR, (H, halfWay vector), (A, Roughness), (N, Normal)
+{
+ float a2 = fAlpha * fAlpha;
+ float NdotH = saturate(dot(vNormal, vHalfWayVector));
+ float NdotH2 = NdotH * NdotH;
+
+ float nom = a2;
+ float denom = (NdotH2 * (a2 - 1.f) + 1.f);
+
+ denom = PI * denom * denom;
+ return (nom / denom);
+}
+
+// F->G
+// GschlickGGX(n, v, k)
+// k는 이하 두개 조명 조건에 따라 가변적임
+// Direct // Kdir -> ((a + 1) * (a + 1)) / 8 // direct lighting 추천
+// IBL Lighting // Kibl -> a * a / 2 // 이미지 기반 조명기법
+
+float Geometry_SchlickGGX(float NdotV, float fK)
+{
+ return NdotV / (NdotV * (1.0f - fK) + fK);
+}
+
+float Geometry_Smith(float3 vNormal, float3 vFromView, float3 vFromLight, float k)
+{
+ // Geometry Obstruction
+ // 철이 있는, 주로 튀어나온 장애물
+ float NdotV = saturate(dot(vNormal, vFromView));
+
+ // Geometry Shadowing
+ // 요가 있는, 주로 음푹 들어간 장애물 (그래서 셰도잉)
+ float NdotL = saturate(dot(vNormal, vFromLight));
+
+ // 요철이 골고루 있다고 가정하고 적당히 섞음
+ return Geometry_SchlickGGX(NdotV, k) * Geometry_SchlickGGX(NdotL, k);
+}
+
+// F -> F
+float3 Fresnel_Schlick(float cosTheta, float3 F0)
+{
+ // 모서리 부분의 반사
+ return F0 + (1.0f - F0) * pow(1.0f - cosTheta, 5.0f);
+}
+
+PBR_LIGHT_OUT PBR_Lighting(
+ float3 vNormal, float3 vFromView, float3 vFromLight,
+ float3 vAlbedo, float fMetallic, float fRoughness,
+ float3 vLightColor, float fAttenuation, float3 vFO
+) {
+ PBR_LIGHT_OUT Out;
+ Out.vShade = 0;
+ Out.vSpecular = 0;
+
+ float3 vHalfVector = normalize(vFromView + vFromLight);
+ float NdotL = saturate(dot(vNormal, vFromLight));
+ float NdotV = saturate(dot(vNormal, vFromView));
+ if (NdotL <= 0 || NdotV <= 0)
+ {
+ return Out;
+ }
+ float fAlpha = max(fRoughness * fRoughness, 0.04f);
+ float k = ((fRoughness + 1.f) * (fRoughness + 1.f)) / 8.f;
+
+ float D = NDF_ggxtr(vNormal, vHalfVector, fAlpha);
+ float G = Geometry_Smith(vNormal, vFromView, vFromLight, k);
+ float3 F = Fresnel_Schlick(saturate(dot(vHalfVector, vFromView)), vFO);
+
+ float3 vNumerator = D * G * F;
+ float fDenom = max(4.f * NdotL * NdotV, 1e-7);
+ float3 specularBRDF = vNumerator / fDenom;
+
+ float3 kS = F;
+ float3 kD = (1.f - kS) * (1.f -fMetallic);
+
+ //Out.vShade = float(1.f, 1.f, 1. 1.f);
+ Out.vShade = (kD / PI) * (NdotL * fAttenuation) * vLightColor;
+
+ Out.vSpecular = specularBRDF * vLightColor * fAttenuation * NdotL;
+
+ return Out;
+}
+
+float3 DecodeNormalFromRG(Texture2D NormalMap, SamplerState Samp, float2 uv)
+{
+ float2 vSampledRG = (NormalMap.Sample(Samp, uv).rg * 2.f - 1.f);
+
+ float z2 = 1.0f - saturate(dot(vSampledRG, vSampledRG));
+ float z = sqrt(max(z2, 0.0f));
+
+ float3 n = float3(vSampledRG, z);
+
+ return normalize(n);
+}
+
+
+#endif // ENGINE_SHADER_FUNCTIONS_HLSLI
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Samplers.hlsli b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Samplers.hlsli
new file mode 100644
index 000000000..7b7ec1a3b
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Samplers.hlsli
@@ -0,0 +1,40 @@
+#ifndef ENGINE_SHADER_SAMPLERS_HLSLI
+#define ENGINE_SHADER_SAMPLERS_HLSLI
+
+sampler DefaultSampler = sampler_state
+{
+ Filter = MIN_MAG_MIP_LINEAR;
+ AddressU = wrap;
+ AddressV = wrap;
+};
+
+sampler ClampSampler = sampler_state
+{
+ Filter = MIN_MAG_MIP_POINT;
+ AddressU = clamp;
+ AddressV = clamp;
+};
+
+sampler MirrorSampler = sampler_state
+{
+ Filter = MIN_MAG_MIP_LINEAR;
+ AddressU = mirror;
+ AddressV = mirror;
+};
+
+sampler BorderZeroSampler = sampler_state
+{
+ Filter = MIN_MAG_MIP_POINT;
+ AddressU = Border;
+ AddressV = Border;
+ BorderColor = float4(0, 0, 0, 0);
+};
+
+sampler PointSampler = sampler_state
+{
+ Filter = MIN_MAG_MIP_POINT;
+ AddressU = wrap;
+ AddressV = wrap;
+};
+
+#endif // ENGINE_SHADER_SAMPLERS_HLSLI
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_States.hlsli b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_States.hlsli
new file mode 100644
index 000000000..8c6fbe9e9
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_States.hlsli
@@ -0,0 +1,168 @@
+#ifndef ENGINE_SHADER_STATES_HLSLI
+#define ENGINE_SHADER_STATES_HLSLI
+
+RasterizerState RS_Default
+{
+ FillMode = Solid;
+ CullMode = Back;
+};
+
+RasterizerState RS_Nocull
+{
+ FillMode = Solid;
+ CullMode = None;
+ FrontCounterClockwise = false;
+ DepthClipEnable = false;
+};
+
+RasterizerState RS_Nocull_Wireframe
+{
+ FillMode = Wireframe;
+ CullMode = None;
+ FrontCounterClockwise = false;
+ DepthBias = 0;
+ SlopeScaledDepthBias = 0.f;
+ DepthBiasClamp = 0.f;
+ DepthClipEnable = false;
+ ScissorEnable = false;
+ MultisampleEnable = false;
+ AntialiasedLineEnable = false;
+};
+
+RasterizerState RS_Scissor
+{
+ FillMode = Solid;
+ CullMode = Back;
+ FrontCounterClockwise = false;
+ ScissorEnable = true;
+};
+
+DepthStencilState DSS_Default
+{
+ DepthEnable = true;
+ DepthWriteMask = all;
+ DepthFunc = less_equal;
+};
+
+DepthStencilState DSS_None
+{
+ DepthEnable = false;
+ DepthWriteMask = zero;
+};
+
+DepthStencilState DSS_Effect
+{
+ DepthEnable = true;
+ DepthWriteMask = zero;
+ DepthFunc = less_equal;
+ StencilEnable = false;
+};
+
+BlendState BS_None
+{
+ BlendEnable[0] = false;
+};
+
+BlendState BS_AlphaBlend // ALPHA_BLEND
+{
+ BlendEnable[0] = true;
+ BlendEnable[1] = true;
+ BlendEnable[2] = true;
+ BlendEnable[3] = true;
+ BlendEnable[4] = true;
+ BlendEnable[5] = true;
+ BlendEnable[6] = true;
+ BlendEnable[7] = true;
+
+ // Ac * Aa + Bc * (1 - Aa);
+ SrcBlend = Src_Alpha;
+ DestBlend = Inv_Src_Alpha;
+ BlendOp = Add;
+};
+
+BlendState BS_Blend // ADDITIVE_BLEND
+{
+ BlendEnable[0] = true;
+ BlendEnable[1] = true;
+ BlendEnable[2] = true;
+ BlendEnable[3] = true;
+ BlendEnable[4] = true;
+ BlendEnable[5] = true;
+ BlendEnable[6] = true;
+ BlendEnable[7] = true;
+
+ // Ac * (1) + Bc * (1);
+ SrcBlend = one;
+ DestBlend = one;
+ BlendOp = Add;
+};
+
+BlendState BS_UIBlend
+{
+ BlendEnable[0] = true;
+ BlendEnable[1] = true;
+ BlendEnable[2] = true;
+ BlendEnable[3] = true;
+ BlendEnable[4] = true;
+ BlendEnable[5] = true;
+ BlendEnable[6] = true;
+ BlendEnable[7] = true;
+
+ SrcBlend = Src_Alpha;
+ DestBlend = Inv_Src_Alpha;
+ BlendOp = Add;
+
+ SrcBlendAlpha = One;
+ DestBlendAlpha = Zero;
+ BlendOpAlpha = Add;
+
+ RenderTargetWriteMask[0] = 0x0F; // RGBA 모두 출력
+};
+
+BlendState BS_WB_Acc
+{
+ BlendEnable[0] = true;
+ BlendEnable[1] = true;
+ BlendEnable[2] = true;
+ BlendEnable[3] = true;
+ BlendEnable[4] = true;
+ BlendEnable[5] = true;
+ BlendEnable[6] = true;
+ BlendEnable[7] = true;
+
+ SrcBlend[0] = one;
+ DestBlend[0] = one;
+ BlendOp[0] = Add;
+
+ SrcBlend[1] = Zero;
+ DestBlend[1] = Inv_Src_Alpha;
+ BlendOp[1] = Add;
+
+
+ SrcBlend[2] = one;
+ DestBlend[2] = one;
+ BlendOp[2] = Add;
+};
+
+BlendState BS_WeightBlend
+{
+ BlendEnable[0] = true;
+ BlendEnable[1] = true;
+ BlendEnable[2] = true;
+ BlendEnable[3] = true;
+ BlendEnable[4] = true;
+ BlendEnable[5] = true;
+ BlendEnable[6] = true;
+ BlendEnable[7] = true;
+
+
+ SrcBlend[0] = Src_Alpha;
+ DestBlend[0] = Inv_Src_Alpha;
+
+ BlendOp[0] = Add;
+
+
+
+};
+
+#endif // ENGINE_SHADER_STATES_HLSLI
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Structures.hlsli b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Structures.hlsli
new file mode 100644
index 000000000..7dcb70724
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Structures.hlsli
@@ -0,0 +1,10 @@
+#ifndef ENGINE_SHADER_STRUCTURES_HLSLI
+#define ENGINE_SHADER_STRUCTURES_HLSLI
+
+struct PBR_LIGHT_OUT
+{
+ float3 vShade;
+ float3 vSpecular;
+};
+
+#endif // ENGINE_SHADER_STRUCTURES_HLSLI
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl
index 38eea62d7..a02084c27 100644
--- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl
+++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl
@@ -35,14 +35,13 @@ Texture2D g_BlurTexture;
Texture2D g_BlurXTexture;
Texture2D g_BlurWeightTexture;
+Texture2D g_SurfaceTexture;
vector g_vLightDiffuse;
vector g_vLightAmbient;
vector g_vLightSpecular;
-
-
struct VS_IN
{
float3 vPosition : POSITION;
@@ -56,9 +55,9 @@ struct VS_OUT
};
VS_OUT VS_MAIN(VS_IN In)
{
- VS_OUT Out;
+ VS_OUT Out;
- matrix matWV, matWVP;
+ matrix matWV, matWVP;
matWV = mul(g_WorldMatrix, g_ViewMatrix);
matWVP = mul(matWV, g_ProjMatrix);
@@ -66,7 +65,7 @@ VS_OUT VS_MAIN(VS_IN In)
Out.vPosition = mul(vector(In.vPosition, 1.f), matWVP);
Out.vTexcoord = In.vTexcoord;
- return Out;
+ return Out;
}
struct PS_IN
@@ -99,41 +98,77 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
{
PS_OUT_LIGHT Out;
- vector vNormalDesc = g_NormalTexture.Sample(DefaultSampler, In.vTexcoord);
+ float2 uv = In.vTexcoord;
- float4 vNormal = vector(vNormalDesc.xyz * 2.f - 1.f, 0.0f);
+ // float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1);
+ float3 vNormal = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, uv);
- Out.vShade = g_vLightDiffuse * saturate(max(dot(normalize(g_vLightDir) * -1.f, vNormal), 0.f) + (g_vLightAmbient * g_vMtrlAmbient));
+ float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
- vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
+ float fViewZ = vDepth.y * g_fFar;
- float fViewZ = vDepthDesc.y * g_fFar;
+ float4 vWorldPosition;
+ {
+ vWorldPosition.x = uv.x * 2 - 1;
+ vWorldPosition.y = uv.y * -2 + 1;
+ vWorldPosition.z = vDepth.x;
+ vWorldPosition.w = 1.f;
+ vWorldPosition *= fViewZ;
+ vWorldPosition = mul(vWorldPosition, g_invmatProj);
+ vWorldPosition = mul(vWorldPosition, g_invMatView);
+ }
- vector vPosition;
+ float3 vF0;
+ float fMetallic;
+ float fRoughness;
+ float fOcclusion;
+ float fAttenuation;
-{ // vDepthDesc과 vTexcoord.xy로부터 World Position의 추론
- /* 직육면체의 NDC */
- /* LocalPos * World * View * Proj * ( 1 / w ) */
- vPosition.x = In.vTexcoord.x * 2.f - 1.f;
- vPosition.y = In.vTexcoord.y * -2.f + 1.f;
- vPosition.z = vDepthDesc.x;
- vPosition.w = 1.f;
+ float3 vWPos = vWorldPosition.xyz;
+ float3 vFromView = normalize(vWPos - g_vCamPosition.xyz); // 카메라에서 픽셀로 가는 방향
+ float3 vFromLight = normalize(g_vLightDir.xyz); // 라이트에서 오는 라이트 벡터
- /* [* (1 / w)] 소거*/
- /* z나누기를 되돌림 */
- vPosition = vPosition * fViewZ;
-// vPosition.x = In.vTexcoord.x * 2.f - 1.f * Far;
-// vPosition.y = In.vTexcoord.y * -2.f + 1.f * Far;
-// vPosition.z = vDepthDesc.x * Far;
-// vPosition.w = Far;
+ float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
- vPosition = mul(vPosition, g_invmatProj);
- vPosition = mul(vPosition, g_invMatView);
-}
- vector vLook = vPosition - g_vCamPosition;
- vector vReflect = reflect(normalize(g_vLightDir), vNormal);
+ if (true == AlmostEqual3(vDepth.b, AI_TEXTURE_TYPE_METALNESS)) // Metallic
+ {
+ float3 vMRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb;
+ fMetallic = vMRO.r;
+ fRoughness = vMRO.g;
+ fOcclusion = vMRO.b;
+
+ vF0 = lerp(float3(0.04f, 0.04f, 0.04f), vAlbedo, fMetallic);
+ }
+ else if (true == AlmostEqual3(vDepth.b, AI_TEXTURE_TYPE_SPECULAR)) // Specular
+ {
+ float3 vSRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb;
+ float3 vSpec = vSRO.r;
+
+ fMetallic = 0.f;
+ fRoughness = vSRO.g;
+ fOcclusion = vSRO.b;
+
+
+ vF0 = vSpec.xxx;
+ }
+ else
+ {
+ fMetallic = 0.f;
+ fRoughness = 0.5f;
+ fOcclusion = 1.f;
+ vF0 = float3(0.04f, 0.04f, 0.04f);
+ }
- Out.vSpecular = (g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(normalize(vLook) * -1.f, normalize(vReflect)), 0.f), 50.f);
+ fAttenuation = 1.f;
+
+ float fDiffuseAOStrength = lerp(0.3f, 1.f, fOcclusion);
+
+ PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vFromView, vFromLight, vAlbedo, fMetallic, fRoughness, g_vLightDiffuse.rgb, fAttenuation, vF0);
+
+ PBR_Out.vShade *= fDiffuseAOStrength;
+
+ Out.vShade = float4(PBR_Out.vShade, 1.f);
+ Out.vSpecular = float4(PBR_Out.vSpecular, 1.f);
return Out;
}
@@ -142,38 +177,81 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
{
PS_OUT_LIGHT Out;
- vector vNormalDesc = g_NormalTexture.Sample(DefaultSampler, In.vTexcoord);
+ float2 uv = In.vTexcoord;
- float4 vNormal = vector(vNormalDesc.xyz * 2.f - 1.f, 0.f);
+ float3 vNormal = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, uv);
- vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
- float fViewZ = vDepthDesc.y * g_fFar;
+ float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
- vector vPosition;
- /* 0 ~ 1 에서 -1 ~ 1 */
- vPosition.x = In.vTexcoord.x * 2.f - 1.f;
- vPosition.y = In.vTexcoord.y * -2.f + 1.f;
- vPosition.z = vDepthDesc.x;
- vPosition.w = 1.f;
- vPosition = vPosition * fViewZ;
- vPosition = mul(vPosition, g_invmatProj);
- vPosition = mul(vPosition, g_invMatView);
+ float fViewZ = vDepth.y * g_fFar;
- vector vLightDir = vPosition - (g_vLightPos + g_vLightPosOffset);
- float fDistance = length(vLightDir);
- float fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange);
- if (fAttenuation <= 0.f)
+ float4 vWorldPosition;
{
- discard;
+ vWorldPosition.x = uv.x * 2 - 1;
+ vWorldPosition.y = uv.y * -2 + 1;
+ vWorldPosition.z = vDepth.x;
+ vWorldPosition.w = 1.f;
+ vWorldPosition *= fViewZ;
+ vWorldPosition = mul(vWorldPosition, g_invmatProj);
+ vWorldPosition = mul(vWorldPosition, g_invMatView);
}
- vLightDir = normalize(vLightDir);
- Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vLightDir * -1.f, vNormal), 0.f) + (g_vLightAmbient * g_vMtrlAmbient)));
+ float3 vWPos = vWorldPosition.xyz;
+ float3 vFromView = normalize(vWPos - g_vCamPosition.xyz); // 카메라에서 픽셀로 가는 방향
+ float3 vFromLight = normalize(g_vLightDir.xyz); // 라이트에서 오는 라이트 벡터
- vector vLook = vPosition - g_vCamPosition;
- vector vReflect = reflect(vLightDir, vNormal);
+ float3 vF0;
+ float fMetallic;
+ float fRoughness;
+ float fOcclusion;
+ float fAttenuation;
- Out.vSpecular = fAttenuation * ((g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(normalize(vLook) * -1.f, normalize(vReflect)), 0.f), 50.f));
+ {
+ float fDistance = length(vFromLight);
+ fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange);
+ if (fAttenuation <= 0.f)
+ {
+ discard;
+ }
+ }
+
+ float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
+
+ if (true == AlmostEqual3(vDepth.b, AI_TEXTURE_TYPE_METALNESS)) // Metallic
+ {
+ float3 vMRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb;
+ fMetallic = vMRO.r;
+ fRoughness = vMRO.g;
+ fOcclusion = vMRO.b;
+
+ vF0 = lerp(float3(0.04f, 0.04f, 0.04f), vAlbedo, fMetallic);
+ }
+ else if (true == AlmostEqual3(vDepth.b, AI_TEXTURE_TYPE_SPECULAR)) // Specular
+ {
+ float3 vSRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb;
+ float3 vSpec = vSRO.r;
+
+ fMetallic = 0.f;
+ fRoughness = vSRO.g;
+ fOcclusion = vSRO.b;
+
+
+ vF0 = vSpec.xxx;
+ }
+ else
+ {
+ fMetallic = 0.f;
+ fRoughness = 0.5f;
+ fOcclusion = 1.f;
+ vF0 = float3(0.04f, 0.04f, 0.04f);
+ }
+
+ PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vFromView, vFromLight,
+ vAlbedo, fMetallic, fRoughness,
+ g_vLightDiffuse.rgb, fAttenuation, vF0);
+
+ Out.vShade = float4(PBR_Out.vShade, 1.f);
+ Out.vSpecular = float4(PBR_Out.vSpecular, 1.f);
return Out;
}
@@ -182,46 +260,85 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
{
PS_OUT_LIGHT Out;
- vector vNormalDesc = g_NormalTexture.Sample(DefaultSampler, In.vTexcoord);
+ float2 uv = In.vTexcoord;
- float4 vNormal = vector(vNormalDesc.xyz * 2.f - 1.f, 0.f);
+ float3 vNormal = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, uv);
- vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
- float fViewZ = vDepthDesc.y * g_fFar;
+ float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
- vector vPosition;
- /* 0 ~ 1 에서 -1 ~ 1 */
- vPosition.x = In.vTexcoord.x * 2.f - 1.f;
- vPosition.y = In.vTexcoord.y * -2.f + 1.f;
- vPosition.z = vDepthDesc.x;
- vPosition.w = 1.f;
- vPosition = vPosition * fViewZ;
- vPosition = mul(vPosition, g_invmatProj);
- vPosition = mul(vPosition, g_invMatView);
+ float fViewZ = vDepth.y * g_fFar;
- vector vLightDir = vPosition - g_vLightPos;
- float fDistance = length(vLightDir);
- float fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange);
- if (fAttenuation <= 0.f)
+ float4 vWorldPosition;
{
- discard;
+ vWorldPosition.x = uv.x * 2 - 1;
+ vWorldPosition.y = uv.y * -2 + 1;
+ vWorldPosition.z = vDepth.x;
+ vWorldPosition.w = 1.f;
+ vWorldPosition *= fViewZ;
+ vWorldPosition = mul(vWorldPosition, g_invmatProj);
+ vWorldPosition = mul(vWorldPosition, g_invMatView);
}
- vLightDir = normalize(vLightDir);
- vector vSpotDir = normalize(g_vLightDir);
- float fCosAngle = dot(vLightDir, vSpotDir);
+
+ float3 vWPos = vWorldPosition.xyz;
+ float3 vFromView = normalize(vWPos - g_vCamPosition.xyz); // 카메라에서 픽셀로 가는 방향
+ float3 vFromLight = normalize(g_vLightDir.xyz); // 라이트에서 오는 라이트 벡터
+
+ float3 vF0;
+ float fMetallic;
+ float fRoughness;
+ float fOcclusion;
+ float fAttenuation;
+ {
+ float fDistance = length(vFromLight);
+ fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange);
+ if (fAttenuation <= 0.f)
+ {
+ discard;
+ }
+ }
+ float fCosAngle = dot(vFromLight, g_vLightDir.xyz);
if (fCosAngle < g_fSpotOuterAngle)
{
discard;
}
- float fSpotAttenenuation = saturate((fCosAngle - g_fSpotInnerAngle) / (g_fSpotInnerAngle - g_fSpotOuterAngle));
+ float fSpotAttenenuation = saturate((fCosAngle - g_fSpotInnerAngle) / (g_fSpotInnerAngle - g_fSpotOuterAngle));
fAttenuation *= fSpotAttenenuation;
- Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vLightDir * -1.f, vNormal), 0.f) + (g_vLightAmbient * g_vMtrlAmbient)));
+ float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
- vector vLook = vPosition - g_vCamPosition;
- vector vReflect = reflect(vLightDir, vNormal);
+ if (true == AlmostEqual3(vDepth.b, AI_TEXTURE_TYPE_METALNESS)) // Metallic
+ {
+ float3 vMRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb;
+ fMetallic = vMRO.r;
+ fRoughness = vMRO.g;
+ fOcclusion = vMRO.b;
+
+ vF0 = lerp(float3(0.04f, 0.04f, 0.04f), vAlbedo, fMetallic);
+ }
+ else if (true == AlmostEqual3(vDepth.b, AI_TEXTURE_TYPE_SPECULAR)) // Specular
+ {
+ float3 vSRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb;
+ float3 vSpec = vSRO.r;
+
+ fMetallic = 0.f;
+ fRoughness = vSRO.g;
+ fOcclusion = vSRO.b;
+
+
+ vF0 = vSpec.xxx;
+ }
+ else
+ {
+ fMetallic = 0.f;
+ fRoughness = 0.5f;
+ fOcclusion = 1.f;
+ vF0 = float3(0.04f, 0.04f, 0.04f);
+ }
- Out.vSpecular = fAttenuation * ((g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(normalize(vLook) * -1.f, normalize(vReflect)), 0.f), 50.f));
+ PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vFromView, vFromLight, vAlbedo, fMetallic, fRoughness, g_vLightDiffuse.rgb, fAttenuation, vF0);
+
+ Out.vShade = float4(PBR_Out.vShade, 1.f);
+ Out.vSpecular = float4(PBR_Out.vSpecular, 1.f);
return Out;
}
@@ -271,6 +388,7 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
vPosition = mul(vPosition, g_invmatProj);
vPosition = mul(vPosition, g_invMatView);
vPreShadowPosition = vPosition;
+
/* (로컬위치 * 월드) -> (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 ) */
vPosition = mul(vPosition, g_LightViewMatrix);
vPosition = mul(vPosition, g_LightProjMatrix);
@@ -377,7 +495,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X(PS_IN In)
vColor += g_fWeights[i + 15] * g_BlurTexture.Sample(ClampSampler, vTexcoord);
}
- Out.vBlurX = vColor;
+ Out.vBlurX = vColor;
return Out;
}
@@ -385,7 +503,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X(PS_IN In)
technique11 DefaultTechnique
{
- pass DebugPass
+ pass DebugPass // 0
{
SetRasterizerState(RS_Default);
SetDepthStencilState(DSS_Default, 0);
@@ -395,7 +513,7 @@ technique11 DefaultTechnique
PixelShader = compile ps_5_0 PS_MAIN_DEBUG();
}
- pass DirectionalPass
+ pass DirectionalPass // 1
{
SetRasterizerState(RS_Default);
SetDepthStencilState(DSS_None, 0);
@@ -405,7 +523,7 @@ technique11 DefaultTechnique
PixelShader = compile ps_5_0 PS_MAIN_DIRECTIONAL();
}
- pass PointPass
+ pass PointPass // 2
{
SetRasterizerState(RS_Default);
SetDepthStencilState(DSS_None, 0);
@@ -415,7 +533,7 @@ technique11 DefaultTechnique
PixelShader = compile ps_5_0 PS_MAIN_POINT();
}
- pass CombinedPass
+ pass CombinedPass // 3
{
SetRasterizerState(RS_Default);
SetDepthStencilState(DSS_None, 0);
@@ -425,7 +543,7 @@ technique11 DefaultTechnique
PixelShader = compile ps_5_0 PS_MAIN_COMBINED();
}
- pass BlurPass
+ pass BlurPass // 4
{
SetRasterizerState(RS_Default);
SetDepthStencilState(DSS_None, 0);
@@ -435,7 +553,7 @@ technique11 DefaultTechnique
PixelShader = compile ps_5_0 PS_MAIN_BLUR_X();
}
- pass SpotPass
+ pass SpotPass // 5
{
SetRasterizerState(RS_Default);
SetDepthStencilState(DSS_None, 0);
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_PBR.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_PBR.hlsl
new file mode 100644
index 000000000..919c44c67
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_PBR.hlsl
@@ -0,0 +1,544 @@
+#include "Engine_Shader_Defines.hlsli"
+
+matrix g_WorldMatrix, g_ViewMatrix, g_ProjMatrix;
+matrix g_invMatView, g_invmatProj;
+matrix g_LightViewMatrix, g_LightProjMatrix;
+matrix g_PreShadowLightViewMatrix, g_PreShadowLightProjMatrix;
+
+float g_fFar;
+float g_fPreShadowFar;
+uint g_iMaxShadowWidth;
+uint g_iMaxShadowHeight;
+float2 g_vResolution;
+
+Texture2D g_Texture;
+
+float g_fLightRange;
+float g_fSpotInnerAngle;
+float g_fSpotOuterAngle;
+
+vector g_vLightDir;
+vector g_vLightPos;
+vector g_vLightPosOffset;
+
+vector g_vCamPosition;
+
+
+Texture2D g_NormalTexture;
+Texture2D g_DiffuseTexture;
+Texture2D g_ShadeTexture;
+Texture2D g_DepthTexture;
+Texture2D g_SpecularTexture;
+Texture2D g_ShadowTexture;
+Texture2D g_PreShadowTexture;
+Texture2D g_BlurTexture;
+Texture2D g_BlurXTexture;
+Texture2D g_BlurWeightTexture;
+
+Texture2D g_MROTexture;
+Texture2D g_SROTexture;
+
+
+vector g_vLightDiffuse;
+vector g_vLightAmbient;
+vector g_vLightSpecular;
+
+struct VS_IN
+{
+ float3 vPosition : POSITION;
+ float2 vTexcoord : TEXCOORD0;
+};
+
+struct VS_OUT
+{
+ float4 vPosition : SV_POSITION;
+ float2 vTexcoord : TEXCOORD0;
+};
+VS_OUT VS_MAIN(VS_IN In)
+{
+ VS_OUT Out;
+
+ matrix matWV, matWVP;
+
+ matWV = mul(g_WorldMatrix, g_ViewMatrix);
+ matWVP = mul(matWV, g_ProjMatrix);
+
+ Out.vPosition = mul(vector(In.vPosition, 1.f), matWVP);
+ Out.vTexcoord = In.vTexcoord;
+
+ return Out;
+}
+
+struct PS_IN
+{
+ float4 vPosition : SV_POSITION;
+ float2 vTexcoord : TEXCOORD0;
+};
+
+struct PS_OUT_BACKBUFFER
+{
+ float4 vBackBuffer : SV_TARGET0;
+};
+
+PS_OUT_BACKBUFFER PS_MAIN_DEBUG(PS_IN In)
+{
+ PS_OUT_BACKBUFFER Out;
+
+ Out.vBackBuffer = g_Texture.Sample(DefaultSampler, In.vTexcoord);
+
+ return Out;
+}
+
+struct PS_OUT_LIGHT
+{
+ vector vShade : SV_TARGET0;
+ vector vSpecular : SV_TARGET1;
+};
+
+PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
+{
+ PS_OUT_LIGHT Out;
+
+ float2 uv = In.vTexcoord;
+
+ float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1);
+
+ float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
+
+ float fViewZ = vDepth.y * g_fFar;
+
+ float4 vWorldPosition;
+ {
+ vWorldPosition.x = uv.x * 2 - 1;
+ vWorldPosition.y = uv.y * -2 + 1;
+ vWorldPosition.z = vDepth.x;
+ vWorldPosition.w = 1.f;
+ vWorldPosition *= fViewZ;
+ vWorldPosition = mul(vWorldPosition, g_invmatProj);
+ vWorldPosition = mul(vWorldPosition, g_invMatView);
+ }
+
+ float3 vF0;
+ float fMetallic;
+ float fRoughness;
+ float fOcclusion;
+ float fAttenuation;
+
+ float3 vWPos = vWorldPosition.xyz;
+ float3 vFromView = normalize(vWPos - g_vCamPosition.xyz); // 카메라에서 픽셀로 가는 방향
+ float3 vFromLight = normalize(g_vLightDir.xyz); // 라이트에서 오는 라이트 벡터
+
+ float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
+
+ if (1 == vDepth.b) // Metallic
+ {
+ float3 vMRO = g_MROTexture.Sample(DefaultSampler, uv).rgb;
+ fMetallic = vMRO.r;
+ fRoughness = vMRO.g;
+ fOcclusion = vMRO.b;
+
+ vF0 = lerp(float3(0.04f, 0.04f, 0.04f), vAlbedo, fMetallic);
+ }
+ else // Specular
+ {
+ float3 vSRO = g_MROTexture.Sample(DefaultSampler, uv).rgb;
+ float3 vSpec = vSRO.r;
+
+ fMetallic = 0.f;
+ fRoughness = vSRO.g;
+ fOcclusion = vSRO.b;
+
+
+ vF0 = vSpec.xxx;
+ }
+
+ fAttenuation = 1.f;
+
+ float fDiffuseAOStrength = lerp(0.3f, 1.f, fOcclusion);
+
+ PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vFromView, vFromLight, vAlbedo, fMetallic, fRoughness, g_vLightDiffuse.rgb, fAttenuation, vF0);
+
+ PBR_Out.vShade *= fDiffuseAOStrength;
+
+ Out.vShade = float4(PBR_Out.vShade, 1.f);
+ Out.vSpecular = float4(PBR_Out.vSpecular, 1.f);
+
+ return Out;
+}
+
+PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
+{
+ PS_OUT_LIGHT Out;
+
+ float2 uv = In.vTexcoord;
+
+ float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1);
+
+ float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
+
+ float fViewZ = vDepth.y * g_fFar;
+
+ float4 vWorldPosition;
+ {
+ vWorldPosition.x = uv.x * 2 - 1;
+ vWorldPosition.y = uv.y * -2 + 1;
+ vWorldPosition.z = vDepth.x;
+ vWorldPosition.w = 1.f;
+ vWorldPosition *= fViewZ;
+ vWorldPosition = mul(vWorldPosition, g_invmatProj);
+ vWorldPosition = mul(vWorldPosition, g_invMatView);
+ }
+
+ float3 vWPos = vWorldPosition.xyz;
+ float3 vFromView = normalize(vWPos - g_vCamPosition.xyz); // 카메라에서 픽셀로 가는 방향
+ float3 vFromLight = normalize(g_vLightDir.xyz); // 라이트에서 오는 라이트 벡터
+
+ float3 vF0;
+ float fMetallic;
+ float fRoughness;
+ float fOcclusion;
+ float fAttenuation;
+
+ {
+ float fDistance = length(vFromLight);
+ fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange);
+ if (fAttenuation <= 0.f)
+ {
+ discard;
+ }
+ }
+
+ float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
+
+ if (1 == vDepth.b) // Metallic
+ {
+ float3 vMRO = g_MROTexture.Sample(DefaultSampler, uv).rgb;
+ fMetallic = vMRO.r;
+ fRoughness = vMRO.g;
+ fOcclusion = vMRO.b;
+
+ vF0 = lerp(float3(0.04f, 0.04f, 0.04f), vAlbedo, fMetallic);
+ }
+ else // Specular
+ {
+ float3 vSRO = g_MROTexture.Sample(DefaultSampler, uv).rgb;
+ float3 vSpec = vSRO.r;
+
+ fMetallic = 0.f;
+ fRoughness = vSRO.g;
+ fOcclusion = vSRO.b;
+
+
+ vF0 = vSpec.xxx;
+ }
+
+ PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vFromView, vFromLight,
+ vAlbedo, fMetallic, fRoughness,
+ g_vLightDiffuse.rgb, fAttenuation, vF0);
+
+ Out.vShade = float4(PBR_Out.vShade, 1.f);
+ Out.vSpecular = float4(PBR_Out.vSpecular, 1.f);
+
+ return Out;
+}
+
+PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
+{
+ PS_OUT_LIGHT Out;
+
+ float2 uv = In.vTexcoord;
+
+ float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1);
+
+ float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
+
+ float fViewZ = vDepth.y * g_fFar;
+
+ float4 vWorldPosition;
+ {
+ vWorldPosition.x = uv.x * 2 - 1;
+ vWorldPosition.y = uv.y * -2 + 1;
+ vWorldPosition.z = vDepth.x;
+ vWorldPosition.w = 1.f;
+ vWorldPosition *= fViewZ;
+ vWorldPosition = mul(vWorldPosition, g_invmatProj);
+ vWorldPosition = mul(vWorldPosition, g_invMatView);
+ }
+
+ float3 vWPos = vWorldPosition.xyz;
+ float3 vFromView = normalize(vWPos - g_vCamPosition.xyz); // 카메라에서 픽셀로 가는 방향
+ float3 vFromLight = normalize(g_vLightDir.xyz); // 라이트에서 오는 라이트 벡터
+
+ float3 vF0;
+ float fMetallic;
+ float fRoughness;
+ float fOcclusion;
+ float fAttenuation;
+ {
+ float fDistance = length(vFromLight);
+ fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange);
+ if (fAttenuation <= 0.f)
+ {
+ discard;
+ }
+ }
+ float fCosAngle = dot(vFromLight, g_vLightDir.xyz);
+ if (fCosAngle < g_fSpotOuterAngle)
+ {
+ discard;
+ }
+ float fSpotAttenenuation = saturate((fCosAngle - g_fSpotInnerAngle) / (g_fSpotInnerAngle - g_fSpotOuterAngle));
+ fAttenuation *= fSpotAttenenuation;
+
+ float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
+
+ if (1 == vDepth.b) // Metallic
+ {
+ float3 vMRO = g_MROTexture.Sample(DefaultSampler, uv).rgb;
+ fMetallic = vMRO.r;
+ fRoughness = vMRO.g;
+ fOcclusion = vMRO.b;
+
+ vF0 = lerp(float3(0.04f, 0.04f, 0.04f), vAlbedo, fMetallic);
+ }
+ else // Specular
+ {
+ float3 vSRO = g_MROTexture.Sample(DefaultSampler, uv).rgb;
+ float3 vSpec = vSRO.r;
+
+ fMetallic = 0.f;
+ fRoughness = vSRO.g;
+ fOcclusion = vSRO.b;
+
+
+ vF0 = vSpec.xxx;
+ }
+
+ PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vFromView, vFromLight, vAlbedo, fMetallic, fRoughness, g_vLightDiffuse.rgb, fAttenuation, vF0);
+
+ Out.vShade = float4(PBR_Out.vShade, 1.f);
+ Out.vSpecular = float4(PBR_Out.vSpecular, 1.f);
+
+ return Out;
+}
+
+float g_fWeights[32] =
+{
+ 0.000400, 0.000700, 0.001200, 0.002000, 0.003200, 0.005000, 0.007500, 0.011000,
+ 0.015700, 0.021700, 0.029000, 0.037300, 0.046200, 0.055200, 0.063600, 0.070800,
+ 0.075900, 0.078500, 0.078500, 0.075900, 0.070800, 0.063600, 0.055200, 0.046200,
+ 0.037300, 0.029000, 0.021700, 0.015700, 0.011000, 0.007500, 0.005000, 0.003200
+};
+
+
+PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
+{
+ PS_OUT_BACKBUFFER Out;
+
+ vector vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord);
+
+ if (0.f == vDiffuse.a)
+ {
+ discard;
+ }
+
+ vector vShade = g_ShadeTexture.Sample(DefaultSampler, In.vTexcoord);
+
+ vector vSpecular = g_SpecularTexture.Sample(DefaultSampler, In.vTexcoord);
+
+ Out.vBackBuffer = vDiffuse * vShade + vSpecular;
+
+ vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
+
+
+ float fViewZ = vDepthDesc.y * g_fFar;
+
+
+ vector vPosition, vPreShadowPosition;
+
+ /* (로컬위치 * 월드 * 뷰 * 투영 / w) -> (로컬위치 * 월드) */
+ vPosition.x = In.vTexcoord.x * 2.f - 1.f;
+ vPosition.y = In.vTexcoord.y * -2.f + 1.f;
+ vPosition.z = vDepthDesc.x;
+ vPosition.w = 1.f;
+
+ vPosition = vPosition * fViewZ;
+
+ vPosition = mul(vPosition, g_invmatProj);
+ vPosition = mul(vPosition, g_invMatView);
+ vPreShadowPosition = vPosition;
+
+ /* (로컬위치 * 월드) -> (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 ) */
+ vPosition = mul(vPosition, g_LightViewMatrix);
+ vPosition = mul(vPosition, g_LightProjMatrix);
+ vPreShadowPosition = mul(vPreShadowPosition, g_PreShadowLightViewMatrix);
+ vPreShadowPosition = mul(vPreShadowPosition, g_PreShadowLightProjMatrix);
+
+ /* (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 ) -> (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 * (/w) */
+ float2 vTexcoord, vPreShadowTexcoord;
+ vTexcoord.x = (vPosition.x / vPosition.w) * 0.5f + 0.5f;
+ vTexcoord.y = (vPosition.y / vPosition.w) * -0.5f + 0.5f;
+ vPreShadowTexcoord.x = (vPreShadowPosition.x / vPreShadowPosition.w) * 0.5f + 0.5f;
+ vPreShadowTexcoord.y = (vPreShadowPosition.y / vPreShadowPosition.w) * -0.5f + 0.5f;
+
+ /* 광원의 NDC에서 샘플링 */
+ float fVisibility_Dynamic = ShadowVisibility_hwPCF(g_ShadowTexture, vPosition, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), 0.0005f);
+ float fVisibility_Static = ShadowVisibility_hwPCF(g_PreShadowTexture, vPreShadowPosition, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), 0.0005f);
+
+ Out.vBackBuffer.rgb *= lerp(0.5f, 1.f, min(fVisibility_Dynamic, fVisibility_Static));
+ //float fShadowDepth = g_ShadowTexture.Sample(DefaultSampler, vTexcoord).x;
+ //float fPreShadowDepth = g_PreShadowTexture.Sample(DefaultSampler, vPreShadowTexcoord).x;
+ //bool IsShadow = { false };
+ //if (vPosition.z - 0.0005f > fShadowDepth)
+ //{
+ // IsShadow = true;
+ //}
+ //if (vPreShadowPosition.z - 0.0005f > fPreShadowDepth)
+ //{
+ // IsShadow = true;
+ //}
+ //if (true == IsShadow)
+ //{
+ // Out.vBackBuffer *= 0.5f;
+ //}
+ float4 vColor = 0.f;
+
+ //int iBlurWeight = g_BlurWeightTexture.Sample(ClampSampler, In.vTexcoord).r * 32.f;
+
+ //int iBlurMin;
+ //int iBlurMax;
+
+ //if (iBlurWeight % 2 == 0)
+ //{
+ // iBlurMin = -1 * iBlurWeight / 2;
+ // iBlurMax = iBlurWeight / 2;
+ //}
+ //else
+ //{
+ // iBlurMin = -iBlurWeight / 2;
+ // iBlurMax = iBlurWeight / 2 + 1;
+ //}
+
+ //[loop] // 변수로 루프돌리려면 반드시 필요함
+ for (int i = -15; i < 16; ++i)
+ {
+ vTexcoord.x = In.vTexcoord.x;
+ vTexcoord.y = In.vTexcoord.y + (float) i / g_vResolution.y;
+
+ vColor += g_fWeights[i + 15] * g_BlurXTexture.Sample(ClampSampler, vTexcoord);
+ }
+
+ Out.vBackBuffer += vColor;
+
+ return Out;
+}
+
+struct PS_OUT_BLUR_X
+{
+ float4 vBlurX : SV_TARGET0;
+};
+
+
+PS_OUT_BLUR_X PS_MAIN_BLUR_X(PS_IN In)
+{
+ PS_OUT_BLUR_X Out;
+
+ float2 vTexcoord;
+ float4 vColor = 0.f;
+
+ //TODO 블러 조절 해보려햇는데 실패함..
+
+ //int iBlurWeight = g_BlurWeightTexture.Sample(ClampSampler, In.vTexcoord).r * 32.f;
+
+ //int iBlurMin;
+ //int iBlurMax;
+
+ //if (iBlurWeight % 2 == 0)
+ //{
+ // iBlurMin = -1 * iBlurWeight / 2;
+ // iBlurMax = iBlurWeight / 2;
+ //}
+ //else
+ //{
+ // iBlurMin = -iBlurWeight / 2;
+ // iBlurMax = iBlurWeight / 2 + 1;
+ //}
+
+ //[loop] // 변수로 루프돌리려면 반드시 필요함
+
+ for (int i = -15; i < 16; ++i)
+ {
+ vTexcoord.x = In.vTexcoord.x + (float) i / g_vResolution.x;
+ vTexcoord.y = In.vTexcoord.y;
+
+ vColor += g_fWeights[i + 15] * g_BlurTexture.Sample(ClampSampler, vTexcoord);
+ }
+
+ Out.vBlurX = vColor;
+
+ return Out;
+}
+
+
+technique11 DefaultTechnique
+{
+ pass DebugPass // 0
+ {
+ SetRasterizerState(RS_Default);
+ SetDepthStencilState(DSS_Default, 0);
+ SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
+ VertexShader = compile vs_5_0 VS_MAIN();
+ GeometryShader = NULL;
+ PixelShader = compile ps_5_0 PS_MAIN_DEBUG();
+ }
+
+ pass DirectionalPass // 1
+ {
+ SetRasterizerState(RS_Default);
+ SetDepthStencilState(DSS_None, 0);
+ SetBlendState(BS_Blend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
+ VertexShader = compile vs_5_0 VS_MAIN();
+ GeometryShader = NULL;
+ PixelShader = compile ps_5_0 PS_MAIN_DIRECTIONAL();
+ }
+
+ pass PointPass // 2
+ {
+ SetRasterizerState(RS_Default);
+ SetDepthStencilState(DSS_None, 0);
+ SetBlendState(BS_Blend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
+ VertexShader = compile vs_5_0 VS_MAIN();
+ GeometryShader = NULL;
+ PixelShader = compile ps_5_0 PS_MAIN_POINT();
+ }
+
+ pass CombinedPass // 3
+ {
+ SetRasterizerState(RS_Default);
+ SetDepthStencilState(DSS_None, 0);
+ SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
+ VertexShader = compile vs_5_0 VS_MAIN();
+ GeometryShader = NULL;
+ PixelShader = compile ps_5_0 PS_MAIN_COMBINED();
+ }
+
+ pass BlurPass // 4
+ {
+ SetRasterizerState(RS_Default);
+ SetDepthStencilState(DSS_None, 0);
+ SetBlendState(BS_Blend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
+ VertexShader = compile vs_5_0 VS_MAIN();
+ GeometryShader = NULL;
+ PixelShader = compile ps_5_0 PS_MAIN_BLUR_X();
+ }
+
+ pass SpotPass // 5
+ {
+ SetRasterizerState(RS_Default);
+ SetDepthStencilState(DSS_None, 0);
+ SetBlendState(BS_Blend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
+ VertexShader = compile vs_5_0 VS_MAIN();
+ GeometryShader = NULL;
+ PixelShader = compile ps_5_0 PS_MAIN_SPOT();
+ }
+}
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl
index bbb47719c..3dcf673d5 100644
--- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl
+++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl
@@ -18,6 +18,7 @@ Texture2D g_DiffuseTexture;
Texture2D g_NormalTexture;
Texture2D g_DAOTexture;
Texture2D g_THVTexture;
+Texture2D g_SurfaceParamsTexture;
float3 g_RootColor;
float3 g_TipColor;
@@ -25,6 +26,7 @@ float3 g_DyeColor;
float g_DyeOpacity;
float g_HairRoughness;
+float g_fUsingSurfaceParams;
matrix g_BoneMatrices[512];
@@ -156,10 +158,10 @@ VS_OUT_SHADOW VS_MAIN_SHADOW(VS_IN In)
float fWeightW = 1.f - (In.vBlendWeight.x + In.vBlendWeight.y + In.vBlendWeight.z);
- matrix BoneMatrix = g_BoneMatrices[In.vBlendIndex.x] * In.vBlendWeight.x +
- g_BoneMatrices[In.vBlendIndex.y] * In.vBlendWeight.y +
- g_BoneMatrices[In.vBlendIndex.z] * In.vBlendWeight.z +
- g_BoneMatrices[In.vBlendIndex.w] * fWeightW;
+ matrix BoneMatrix = mul(g_BoneMatrices[In.vBlendIndex.x], In.vBlendWeight.x) +
+ mul(g_BoneMatrices[In.vBlendIndex.y], In.vBlendWeight.y) +
+ mul(g_BoneMatrices[In.vBlendIndex.z], In.vBlendWeight.z) +
+ mul(g_BoneMatrices[In.vBlendIndex.w], fWeightW);
/* ?ㅽ궎??*/
vector vPosition = mul(vector(In.vPosition, 1.f), BoneMatrix);
@@ -188,9 +190,11 @@ struct PS_IN
struct PS_OUT
{
- float4 vDiffuse : SV_TARGET0;
+ float4 vAlbedo : SV_TARGET0;
float4 vNormal : SV_TARGET1;
float4 vDepth : SV_TARGET2;
+ float4 vColor : SV_Target3;
+ float4 vSurface : SV_Target4;
};
PS_OUT PS_MAIN(PS_IN In)
@@ -213,11 +217,14 @@ PS_OUT PS_MAIN(PS_IN In)
float fRimLight = GetRimLight(g_vCamPosition.xyz, In.vWorldPos.xyz, vNormal, g_fRimPower, g_fRimStrength);
vMtrlDiffuse.xyz = (vMtrlDiffuse.xyz * (1 - fRimLight)) + g_vRimColor * fRimLight;
}
+ vector vSurface = g_SurfaceParamsTexture.Sample(DefaultSampler, In.vTexcoord);
- Out.vDiffuse = vMtrlDiffuse;
+ Out.vAlbedo = vMtrlDiffuse;
Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f);
- Out.vDepth = float4(In.vProjPos.z / In.vProjPos.w, In.vProjPos.w / g_fFar, 0.0f, 1.f);
+ Out.vDepth = float4(In.vProjPos.z / In.vProjPos.w, In.vProjPos.w / g_fFar, g_fUsingSurfaceParams, 1.f);
+ Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
+ Out.vSurface = vSurface;
return Out;
@@ -313,7 +320,7 @@ PS_OUT PS_HAIR(PS_IN In)
baseColor = lerp(baseColor, g_vRimColor.rgb, fRim);
}
- Out.vDiffuse = float4(baseColor, alpha);
+ Out.vAlbedo = float4(baseColor, alpha);
Out.vNormal = float4(normal * 0.5f + 0.5f, 0.f);
Out.vDepth = float4(In.vProjPos.z / In.vProjPos.w, In.vProjPos.w / g_fFar, 0.0f, 1.f);
@@ -342,7 +349,7 @@ PS_OUT PS_EYELASH(PS_IN In)
}
- Out.vDiffuse = float4(vMtrlDiffuse.rgb, vMtrlDiffuse.g);
+ Out.vAlbedo = float4(vMtrlDiffuse.rgb, vMtrlDiffuse.g);
Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f);
Out.vDepth = float4(In.vProjPos.z / In.vProjPos.w, In.vProjPos.w / g_fFar, 0.0f, 1.f);
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl
index 37ae44db6..213dd2a08 100644
--- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl
+++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxMesh.hlsl
@@ -5,6 +5,7 @@ matrix g_WorldMatrix, g_ViewMatrix, g_ProjMatrix;
bool g_bUVTargetDiffuse;
bool g_bAdditiveDisolve;
+
float g_LifeRatio;
float g_fFar;
float g_fTime;
@@ -14,6 +15,7 @@ uint g_iIndexU;
uint g_iIndexV;
float g_fDisolveRatio;
+float g_fUsingSurfaceParams;
float2 g_vClipBoxSize;
float2 g_vClipBoxLTPos;
@@ -24,6 +26,7 @@ Texture2D g_ClippingTexture;
Texture2D g_DisolveTexture;
Texture2D g_NormalTexture;
Texture2D g_GlowTexture;
+Texture2D g_SurfaceParamsTexture;
struct VS_IN
{
@@ -155,10 +158,11 @@ struct PS_IN
struct PS_OUT
{
- float4 vDiffuse : SV_TARGET0;
+ float4 vAlbedo : SV_TARGET0;
float4 vNormal : SV_TARGET1;
float4 vDepth : SV_TARGET2;
-
+ float4 vColor : SV_Target3;
+ float4 vSurface : SV_Target4;
};
PS_OUT PS_MAIN(PS_IN In)
{
@@ -174,13 +178,17 @@ PS_OUT PS_MAIN(PS_IN In)
float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal);
float3 vNormal = mul(vNormalDesc.xyz * 2.f - 1.f, WorldMatrix);
+ vector vSurface = g_SurfaceParamsTexture.Sample(DefaultSampler, In.vTexcoord);
- Out.vDiffuse = vMtrlDiffuse;
+ Out.vAlbedo = vMtrlDiffuse;
Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f);
- Out.vDepth = float4(In.vProjPos.z / In.vProjPos.w, In.vProjPos.w / g_fFar, 0.0f, 1.f);
+ Out.vDepth = float4(In.vProjPos.z / In.vProjPos.w, In.vProjPos.w / g_fFar, g_fUsingSurfaceParams, 1.f);
+ Out.vColor = float4(0.f, 0.f, 0.f, 1.f);
+ Out.vSurface = vSurface;
return Out;
}
+
PS_OUT PS_MAIN_SELECT(PS_IN In)
{
PS_OUT Out;
@@ -196,7 +204,7 @@ PS_OUT PS_MAIN_SELECT(PS_IN In)
float3 vNormal = mul(vNormalDesc.xyz * 2.f - 1.f, WorldMatrix);
- Out.vDiffuse = vMtrlDiffuse * float4(0.f, 1.f, 1.f, 0.3f);
+ Out.vAlbedo = vMtrlDiffuse * float4(0.f, 1.f, 1.f, 0.3f);
Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f);
Out.vDepth = float4(In.vProjPos.z / In.vProjPos.w, In.vProjPos.w / g_fFar, 0.0f, 1.f);
return Out;
@@ -213,7 +221,7 @@ PS_OUT PS_GLASS(PS_IN In)
float3 vNormal = mul(vNormalDesc.xyz * 2.f - 1.f, WorldMatrix);
- Out.vDiffuse = lerp(vMtrlDiffuse, float4(1.f, 1.f, 1.f, 1.f), 0.5f);
+ Out.vAlbedo = lerp(vMtrlDiffuse, float4(1.f, 1.f, 1.f, 1.f), 0.5f);
float4(vMtrlDiffuse.xyz, 1.f);
Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f);
Out.vDepth = float4(In.vProjPos.z / In.vProjPos.w, In.vProjPos.w / g_fFar, 0.0f, 1.f);
diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/T_C_Dun_Moss_D.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/T_C_Dun_Moss_D.png
new file mode 100644
index 000000000..1ebff01b1
Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/T_C_Dun_Moss_D.png differ
diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj
index ba301c6cc..fa6eb585b 100644
--- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj
+++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj
@@ -166,12 +166,14 @@
+
+
true
true
@@ -207,6 +209,7 @@
+
@@ -227,11 +230,14 @@
+
+
+
@@ -280,12 +286,14 @@
+
+
true
true
@@ -321,6 +329,7 @@
+
@@ -341,11 +350,14 @@
+
+
+
diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters
index 6708485f7..b195f888a 100644
--- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters
+++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters
@@ -271,6 +271,12 @@
{83781d7f-b84d-45a3-8361-b6bed2722b74}
+
+ {19c5f600-e566-4903-ab74-448904dcbc99}
+
+
+ {04d044a9-3cab-4425-9adf-8eea436e71d4}
+
{0b8cac41-419f-48ce-87bc-805b8962b4df}
@@ -309,6 +315,18 @@
{8882358e-c8eb-4222-a87e-01d902533b8f}
+
+
+ {3614836d-9988-4ec0-95a8-f8ebc25a9a13}
+
+
+ {98f012a4-2f13-456f-85ba-6929b1535de6}
+
+
+ {3ad2f4c4-95e6-47fa-9f4c-b9fcdbd77277}
+
+
+ {a9862861-6eaa-4e04-b7f6-217a32db7db4}
@@ -579,6 +597,12 @@
02.GameObjects\Dummys\DummyPhysX\00.Callback\Behavior\Playable
+
+ 01.Level\65.BloomViewer
+
+
+ 02.GameObjects\Dummys\DummyGlobe
+
80.State\State_Combat\State_Skill
@@ -608,6 +632,20 @@
02.GameObjects\Layer_Effect\Effect\05.NomalJap
+
+
+
+ 80.State\State_Combat\State_Skill2
+
+
+ 80.State\State_Idle\State_Idle_Turn
+
+
+ 80.State\State_Move\State_Jog
+
+
+ 02.GameObjects\Broom
+
@@ -874,6 +912,12 @@
02.GameObjects\Dummys\DummyPhysX\00.Callback\Behavior\Playable
+
+ 01.Level\65.BloomViewer
+
+
+ 02.GameObjects\Dummys\DummyGlobe
+
80.State\State_Combat\State_Skill
@@ -904,6 +948,19 @@
02.GameObjects\Layer_Effect\Effect\05.NomalJap
+
+ 80.State\State_Combat\State_Skill2
+
+
+ 80.State\State_Idle\State_Idle_Turn
+
+
+ 80.State\State_Move\State_Jog
+
+
+ 02.GameObjects\Broom
+
+
diff --git a/Jusin154_Team3D/Editor/Private/Broom.cpp b/Jusin154_Team3D/Editor/Private/Broom.cpp
new file mode 100644
index 000000000..0381be466
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Private/Broom.cpp
@@ -0,0 +1,162 @@
+#include "pch.h"
+#include "Broom.h"
+
+#include "GameInstance.h"
+
+CBroom::CBroom(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
+ : CGameObject(pDevice, pContext)
+{
+}
+
+CBroom::CBroom(const CBroom& Prototype)
+ : CGameObject(Prototype)
+{
+}
+
+HRESULT CBroom::Initialize_Prototype()
+{
+ return S_OK;
+}
+
+HRESULT CBroom::Initialize(void* pArg)
+{
+ if (FAILED(__super::Initialize(pArg)))
+ return E_FAIL;
+
+
+ if (FAILED(Ready_Components()))
+ return E_FAIL;
+
+ m_pModelCom->Set_AnimationIndex(5);
+
+ return S_OK;
+}
+
+void CBroom::Priority_Update(_float fTimeDelta)
+{
+}
+
+void CBroom::Update(_float fTimeDelta)
+{
+ m_pModelCom->Play_Animation(fTimeDelta, m_pTransformCom);
+}
+
+void CBroom::Late_Update(_float fTimeDelta)
+{
+ m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this);
+}
+
+HRESULT CBroom::Render()
+{
+ if (!m_pModelCom)
+ return S_OK;
+
+ if (FAILED(Bind_ShaderResources())) {
+ return E_FAIL;
+ }
+
+ _uint iNumMeshes = m_pModelCom->Get_NumMeshes();
+
+ for (_uint i = 0; i < iNumMeshes; i++)
+ {
+ if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
+ return E_FAIL;
+ }
+
+ if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_ANIM::DEFAULT)))) {
+ return E_FAIL;
+ }
+
+ if (FAILED(m_pModelCom->Render(i))) {
+ return E_FAIL;
+ }
+ }
+
+ return S_OK;
+}
+
+HRESULT CBroom::Ready_Components()
+{
+ CTransform::TRANSFORM_DESC Desc = {};
+
+ Desc.fSpeedPerSec = 10.f;
+ Desc.fRotationPerSec = XMConvertToRadians(180.0f);
+ Desc.fRadius = 10.f;
+
+ __super::Ready_Components(&Desc);
+
+ /* Com_Model */
+ if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_Broom_Model"),
+ reinterpret_cast(&m_pModelCom))))
+ return E_FAIL;
+
+ /* Com_Shader */
+ if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_ANIMMESH,
+ reinterpret_cast(&m_pShaderCom))))
+ return E_FAIL;
+
+ return S_OK;
+}
+
+HRESULT CBroom::Bind_ShaderResources()
+{
+ if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) {
+ return E_FAIL;
+ }
+
+ if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) {
+ return E_FAIL;
+ }
+
+ if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
+ return E_FAIL;
+ }
+
+ return S_OK;
+}
+
+CBroom* CBroom::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
+{
+ CBroom* pInstance = new CBroom(pDevice, pContext);
+
+ if (FAILED(pInstance->Initialize_Prototype()))
+ {
+ MSG_BOX("Failed to Created : CBroom");
+ SAFE_RELEASE(pInstance);
+ }
+
+ return pInstance;
+}
+
+CGameObject* CBroom::Clone(void* pArg, CGameObject* pOwner)
+{
+ CBroom* pInstance = new CBroom(*this);
+ pInstance->m_pOwner = pOwner;
+ if (FAILED(pInstance->Initialize(pArg)))
+ {
+ MSG_BOX("Failed to Cloned : CBroom");
+ SAFE_RELEASE(pInstance);
+ }
+
+ return pInstance;
+}
+
+void CBroom::Free()
+{
+ __super::Free();
+
+ SAFE_RELEASE(m_pShaderCom);
+ SAFE_RELEASE(m_pModelCom);
+
+
+}
+
+void CBroom::Describe_Entity()
+{
+}
diff --git a/Jusin154_Team3D/Editor/Private/BuildingContainer.cpp b/Jusin154_Team3D/Editor/Private/BuildingContainer.cpp
index 4387692d0..38c600af6 100644
--- a/Jusin154_Team3D/Editor/Private/BuildingContainer.cpp
+++ b/Jusin154_Team3D/Editor/Private/BuildingContainer.cpp
@@ -148,10 +148,10 @@ void CBuildingContainer::Describe_Entity()
if (m_pGameInstance->Mouse_Down(DIM_LBUTTON) && m_pGameInstance->Key_Pressing(DIK_LSHIFT))
{
CTerrain* pTerrain = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Terrain"))->Get_Object();
- if (nullptr != pTerrain)
+ /*if (nullptr != pTerrain)
{
pTerrain->Get_Component()->Picking(pTerrain->Get_Component(), m_vPosition);
- }
+ }*/
}
GUI::Text("----- Rotation ----");
diff --git a/Jusin154_Team3D/Editor/Private/DebugCamera.cpp b/Jusin154_Team3D/Editor/Private/DebugCamera.cpp
index 803bda53a..2952b68c6 100644
--- a/Jusin154_Team3D/Editor/Private/DebugCamera.cpp
+++ b/Jusin154_Team3D/Editor/Private/DebugCamera.cpp
@@ -18,6 +18,7 @@ void CDebugCamera::Priority_Update(_float fTimeDelta)
void CDebugCamera::Update(_float fTimeDelta)
{
+ Transition(fTimeDelta);
_float3 vCamPos = {};
XMStoreFloat3(&vCamPos, m_pTransformCom->Get_State(STATE::POSITION));
GUI::Text("Cam Coord %.2f, %.2f, %.2f", vCamPos.x, vCamPos.y, vCamPos.z);
diff --git a/Jusin154_Team3D/Editor/Private/DummyObject.cpp b/Jusin154_Team3D/Editor/Private/DummyObject.cpp
index d2d9cb4f2..47faacc3a 100644
--- a/Jusin154_Team3D/Editor/Private/DummyObject.cpp
+++ b/Jusin154_Team3D/Editor/Private/DummyObject.cpp
@@ -72,10 +72,7 @@ HRESULT CDummyObject::Render()
return E_FAIL;
}
- if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
- return E_FAIL;
- }
- if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) {
+ if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
return E_FAIL;
}
diff --git a/Jusin154_Team3D/Editor/Private/DummySkyBox.cpp b/Jusin154_Team3D/Editor/Private/DummySkyBox.cpp
index 413b82fbb..579456d49 100644
--- a/Jusin154_Team3D/Editor/Private/DummySkyBox.cpp
+++ b/Jusin154_Team3D/Editor/Private/DummySkyBox.cpp
@@ -59,10 +59,7 @@ HRESULT CDummySkyBox::Render()
for (_uint i = 0; i < iNumMeshes; i++)
{
- if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
- return E_FAIL;
- }
- if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) {
+ if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
return E_FAIL;
}
diff --git a/Jusin154_Team3D/Editor/Private/Dummy_Cube.cpp b/Jusin154_Team3D/Editor/Private/Dummy_Cube.cpp
index 2835b1b62..d30f3d89e 100644
--- a/Jusin154_Team3D/Editor/Private/Dummy_Cube.cpp
+++ b/Jusin154_Team3D/Editor/Private/Dummy_Cube.cpp
@@ -58,10 +58,7 @@ HRESULT CDummy_Cube::Render()
for (_uint i = 0; i < iNumMeshes; i++)
{
- if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
- return E_FAIL;
- }
- if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) {
+ if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
return E_FAIL;
}
diff --git a/Jusin154_Team3D/Editor/Private/Dummy_Globe.cpp b/Jusin154_Team3D/Editor/Private/Dummy_Globe.cpp
new file mode 100644
index 000000000..f4e35177b
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Private/Dummy_Globe.cpp
@@ -0,0 +1,154 @@
+#include "pch.h"
+#include "Dummy_Globe.h"
+
+#include "GameInstance.h"
+
+
+CDummy_Globe::CDummy_Globe(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
+ : CGameObject{ pDevice, pContext }
+{
+}
+
+CDummy_Globe::CDummy_Globe(const CDummy_Globe& rhs)
+ : CGameObject(rhs)
+{
+}
+
+HRESULT CDummy_Globe::Initialize_Prototype()
+{
+ return S_OK;
+}
+
+HRESULT CDummy_Globe::Initialize(void* pArg)
+{
+ if (FAILED(__super::Initialize(pArg)))
+ return E_FAIL;
+
+ if (FAILED(Ready_Components(pArg)))
+ return E_FAIL;
+
+
+ return S_OK;
+}
+
+void CDummy_Globe::Priority_Update(_float fTimeDelta)
+{
+
+}
+
+void CDummy_Globe::Update(_float fTimeDelta)
+{
+}
+
+void CDummy_Globe::Late_Update(_float fTimeDelta)
+{
+ if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
+ m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
+ }
+}
+
+HRESULT CDummy_Globe::Render()
+{
+ if (FAILED(Bind_ShaderResources())) {
+ return E_FAIL;
+ }
+
+
+ _uint iNumMeshes = m_pModelCom->Get_NumMeshes();
+
+ for (_uint i = 0; i < iNumMeshes; i++)
+ {
+ if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) {
+ return E_FAIL;
+ }
+ if (FAILED(m_pModelCom->Render(i))) {
+ return E_FAIL;
+ }
+ }
+
+
+ return S_OK;
+}
+
+HRESULT CDummy_Globe::Ready_Components(void* pArg)
+{
+ if (FAILED(__super::Ready_Components(nullptr))) {
+ return E_FAIL;
+ }
+ GLOBE_DESC* pDesc = static_cast(pArg);
+
+ /* Com_Model */
+ if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, pDesc->wstrKey,
+ reinterpret_cast(&m_pModelCom)))){
+ return E_FAIL;
+ }
+
+ /* Com_Shader */
+ if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_MESH,
+ reinterpret_cast(&m_pShaderCom)))){
+ return E_FAIL;
+ }
+
+ m_pTransformCom->Set_State(STATE::POSITION, XMVectorSetW(XMLoadFloat3(&pDesc->vPos), 1.f));
+ return S_OK;
+}
+
+HRESULT CDummy_Globe::Bind_ShaderResources()
+{
+ if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) {
+ return E_FAIL;
+ }
+ if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) {
+ return E_FAIL;
+ }
+
+ if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
+ return E_FAIL;
+ }
+
+ return S_OK;
+}
+
+CDummy_Globe* CDummy_Globe::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
+{
+ CDummy_Globe* pInstance = new CDummy_Globe(pDevice, pContext);
+
+ if (FAILED(pInstance->Initialize_Prototype()))
+ {
+ MSG_BOX("Failed to Created : CDummy_Globe");
+ SAFE_RELEASE(pInstance);
+ }
+
+ return pInstance;
+}
+
+CGameObject* CDummy_Globe::Clone(void* pArg, CGameObject* pOwner)
+{
+ CDummy_Globe* pInstance = new CDummy_Globe(*this);
+ pInstance->m_pOwner = pOwner;
+ if (FAILED(pInstance->Initialize(pArg)))
+ {
+ MSG_BOX("Failed to Cloned : CDummy_Globe");
+ SAFE_RELEASE(pInstance);
+ }
+
+ return pInstance;
+}
+
+void CDummy_Globe::Free()
+{
+ __super::Free();
+
+ SAFE_RELEASE(m_pModelCom);
+ SAFE_RELEASE(m_pShaderCom);
+}
+
+void CDummy_Globe::Describe_Entity()
+{
+}
diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXBox.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXBox.cpp
index fe5b6e0d8..d229ee700 100644
--- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXBox.cpp
+++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXBox.cpp
@@ -64,7 +64,7 @@ HRESULT CDummy_PhysXBox::Render()
return E_FAIL;
}
- if (FAILED(m_pModelCom->Bind_Material(0, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
+ if (FAILED(m_pModelCom->Bind_Material(0, m_pShaderCom))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) {
diff --git a/Jusin154_Team3D/Editor/Private/Dummy_PhysXMesh.cpp b/Jusin154_Team3D/Editor/Private/Dummy_PhysXMesh.cpp
index 5b54b1435..6a2a0d4af 100644
--- a/Jusin154_Team3D/Editor/Private/Dummy_PhysXMesh.cpp
+++ b/Jusin154_Team3D/Editor/Private/Dummy_PhysXMesh.cpp
@@ -58,13 +58,9 @@ HRESULT CDummy_PhysXMesh::Render()
for (_uint i = 0; i < iNumMeshes; i++)
{
- if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
+ if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
return E_FAIL;
}
- if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) {
- return E_FAIL;
- }
-
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) {
return E_FAIL;
}
diff --git a/Jusin154_Team3D/Editor/Private/Dummy_Plane.cpp b/Jusin154_Team3D/Editor/Private/Dummy_Plane.cpp
index d563835a8..9660686d7 100644
--- a/Jusin154_Team3D/Editor/Private/Dummy_Plane.cpp
+++ b/Jusin154_Team3D/Editor/Private/Dummy_Plane.cpp
@@ -60,10 +60,10 @@ HRESULT CDummy_Plane::Render()
for (_uint i = 0; i < iNumMeshes; i++)
{
- if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
+ if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
return E_FAIL;
}
- if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) {
+ if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
return E_FAIL;
}
diff --git a/Jusin154_Team3D/Editor/Private/Goblin.cpp b/Jusin154_Team3D/Editor/Private/Goblin.cpp
index e013c8b73..b7b8bb047 100644
--- a/Jusin154_Team3D/Editor/Private/Goblin.cpp
+++ b/Jusin154_Team3D/Editor/Private/Goblin.cpp
@@ -61,10 +61,7 @@ HRESULT CGoblin::Render()
return E_FAIL;
}
- if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
- return E_FAIL;
- }
- if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) {
+ if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
return E_FAIL;
}
@@ -145,6 +142,7 @@ CGameObject* CGoblin::Clone(void* pArg, CGameObject* pOwner)
void CGoblin::Free()
{
__super::Free();
+
}
void CGoblin::Describe_Entity()
diff --git a/Jusin154_Team3D/Editor/Private/Head.cpp b/Jusin154_Team3D/Editor/Private/Head.cpp
index 1366bbf88..3697e77e0 100644
--- a/Jusin154_Team3D/Editor/Private/Head.cpp
+++ b/Jusin154_Team3D/Editor/Private/Head.cpp
@@ -65,10 +65,7 @@ HRESULT CHead::Render()
return E_FAIL;
}
- if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
- return E_FAIL;
- }
- if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) {
+ if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
return E_FAIL;
}
diff --git a/Jusin154_Team3D/Editor/Private/Land.cpp b/Jusin154_Team3D/Editor/Private/Land.cpp
index 1d2120d75..67cd59a80 100644
--- a/Jusin154_Team3D/Editor/Private/Land.cpp
+++ b/Jusin154_Team3D/Editor/Private/Land.cpp
@@ -26,12 +26,25 @@ void CLand::Update(_float fTimeDelta)
//m_pTransformCom->Set_State(STATE::POSITION, XMLoadFloat4(&m_vPosition));
//GUI::End();
+
+ _float3 vPos = {};
+ if (m_pGameInstance->Mouse_Pressing(DIM_LBUTTON))
+ {
+ if (m_pGameInstance->isPicking(&vPos))
+ {
+
+ }
+ }
+
+ GUI::Begin("TEEEEE");
+ GUI::InputFloat3("Pos", (_float*)(&vPos));
+ GUI::End();
}
void CLand::Late_Update(_float fTimeDelta)
{
_float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
- m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
+ //m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
}
HRESULT CLand::Render()
@@ -44,13 +57,9 @@ HRESULT CLand::Render()
for (_uint i = 0; i < iNumMeshes; i++)
{
- if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
+ if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
return E_FAIL;
}
- if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) {
- return E_FAIL;
- }
-
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) {
return E_FAIL;
}
@@ -76,7 +85,9 @@ HRESULT CLand::Initialize(void* pArg)
if (FAILED(Ready_Components(pArg)))
return E_FAIL;
- m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(66.f, 18.f, 96.f, 1.f));
+ //m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(66.f, 18.f, 96.f, 1.f));
+ m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(0.f, 0.f,0.f, 1.f));
+
return S_OK;
}
@@ -105,9 +116,11 @@ HRESULT CLand::Bind_ShaderResources()
if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) {
return E_FAIL;
}
+
if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) {
return E_FAIL;
}
+
if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) {
return E_FAIL;
}
diff --git a/Jusin154_Team3D/Editor/Private/Level_BloomViewer.cpp b/Jusin154_Team3D/Editor/Private/Level_BloomViewer.cpp
new file mode 100644
index 000000000..4e5f9e1ec
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Private/Level_BloomViewer.cpp
@@ -0,0 +1,147 @@
+#include "pch.h"
+#include "Level_BloomViewer.h"
+#include "GameInstance.h"
+#include "DebugCamera.h"
+#include "Dummy_Cube.h"
+#include "Dummy_Globe.h"
+#include "MainLight.h"
+#include "Dummy_Plane.h"
+
+CLevel_BloomViewer::CLevel_BloomViewer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID)
+ : CLevel{ pDevice, pContext, ENUM_CLASS(eLevelID) }
+{
+
+}
+
+HRESULT CLevel_BloomViewer::Initialize()
+{
+ if (FAILED(Ready_Layer_Light())) {
+ return E_FAIL;
+ }
+
+ if (FAILED(Ready_Layer_Camera(TEXT("Layer_Camera"))))
+ {
+ return E_FAIL;
+ }
+
+ if (FAILED(Ready_Layer_Effect(TEXT("Layer_Effect"))))
+ {
+ return E_FAIL;
+ }
+
+ {
+ CDummy_Globe::GLOBE_DESC Desc{};
+ Desc.wstrKey = TEXT("Prototype_GameObject_SM_DragonGlobe");
+ Desc.vPos = { 0.f, 0.f, 0.f };
+ if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE, &Desc))) {
+ return E_FAIL;
+ }
+ }
+
+ {
+ CDummy_Globe::GLOBE_DESC Desc{};
+ Desc.wstrKey = TEXT("Desc_Globe");
+ Desc.vPos = { 3.f, 0.f, 0.f };
+ if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE, &Desc))) {
+ return E_FAIL;
+ }
+ }
+
+ {
+ CDummy_Globe::GLOBE_DESC Desc{};
+ Desc.wstrKey = TEXT("Desc_Globe2");
+ Desc.vPos = { 6.f, 0.f, 0.f };
+ if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE, &Desc))) {
+ return E_FAIL;
+ }
+ }
+ //if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE))){
+ // return E_FAIL;
+ //}
+
+ //if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_CUBE))){
+ // return E_FAIL;
+ //}
+
+ return S_OK;
+}
+
+void CLevel_BloomViewer::Update(_float fTimeDelta)
+{
+
+}
+
+HRESULT CLevel_BloomViewer::Render()
+{
+ SetWindowText(g_hWnd, TEXT("이펙트 레벨입니다"));
+ GUI::ShowDemoWindow();
+ return S_OK;
+}
+
+
+
+HRESULT CLevel_BloomViewer::Ready_Layer_Camera(const _wstring& strLayerTag)
+{
+ CDebugCamera::CAMERA_DEBUG_DESC CameraDesc{};
+ CameraDesc.fFovy = XMConvertToRadians(60.0f);
+ CameraDesc.fNear = 0.1f;
+ CameraDesc.fFar = 500.f;
+ CameraDesc.vEye = _float3(0.f, 10.f, -10.f);
+ CameraDesc.vAt = _float3(0.f, 0.f, 0.f);
+ CameraDesc.fSpeedPerSec = 5.f;
+ CameraDesc.pCameraKey = TEXT("Debug_Camera");
+ CameraDesc.fRotationPerSec = XMConvertToRadians(90.0f);
+ CameraDesc.fMouseSensor = 0.1f;
+
+ if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL,
+ strLayerTag, &CameraDesc)))
+ return E_FAIL;
+
+ return S_OK;
+}
+
+HRESULT CLevel_BloomViewer::Ready_Layer_Light()
+{
+
+ if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(ENUM_CLASS(LEVEL::STATIC), NEXT_LEVEL, LAYER_LIGHT))){
+ return E_FAIL;
+ }
+
+ return S_OK;
+}
+
+HRESULT CLevel_BloomViewer::Ready_Layer_UI(const _wstring& strLayerTag)
+{
+ return S_OK;
+}
+
+
+HRESULT CLevel_BloomViewer::Ready_Layer_Effect(const _wstring& strLayerTag)
+{
+
+ return S_OK;
+}
+
+
+
+CLevel_BloomViewer* CLevel_BloomViewer::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID)
+{
+ CLevel_BloomViewer* pInstance = new CLevel_BloomViewer(pDevice, pContext, eLevelID);
+
+ if (FAILED(pInstance->Initialize()))
+ {
+ MSG_BOX("Failed to Created : CLevel_BloomViewer");
+ SAFE_RELEASE(pInstance);
+ }
+
+ return pInstance;
+}
+
+
+
+void CLevel_BloomViewer::Free()
+{
+ __super::Free();
+
+
+}
diff --git a/Jusin154_Team3D/Editor/Private/Level_Loading.cpp b/Jusin154_Team3D/Editor/Private/Level_Loading.cpp
index f8f1dca2e..9ef8407d7 100644
--- a/Jusin154_Team3D/Editor/Private/Level_Loading.cpp
+++ b/Jusin154_Team3D/Editor/Private/Level_Loading.cpp
@@ -1,4 +1,4 @@
-#include "pch.h"
+#include "pch.h"
#include "Level_Loading.h"
#include "Loader.h"
#include "GameInstance.h"
@@ -8,6 +8,7 @@
#include "Level_ObjectViewer.h"
#include "Level_EffectViewer.h"
#include "Level_MapViewer.h"
+#include "Level_BloomViewer.h"
#include "Level_PhysXLab.h"
@@ -62,9 +63,9 @@ void CLevel_Loading::Update(_float fTimeDelta)
case LEVEL::PHYSX:
pNewLevel = CLevel_PhysXLab::Create(m_pDevice, m_pContext, m_eNextLevelID);
break;
- //case LEVEL::PARTICLE:
- // pNewLevel = CLevel_ParticleViewer::Create(m_pDevice, m_pContext, m_eNextLevelID);
- // break;
+ case LEVEL::BLOOM:
+ pNewLevel = CLevel_BloomViewer::Create(m_pDevice, m_pContext, m_eNextLevelID);
+ break;
}
if (FAILED(m_pGameInstance->Change_Level(pNewLevel)))
diff --git a/Jusin154_Team3D/Editor/Private/Level_Logo.cpp b/Jusin154_Team3D/Editor/Private/Level_Logo.cpp
index 7b3736fd5..2621663c9 100644
--- a/Jusin154_Team3D/Editor/Private/Level_Logo.cpp
+++ b/Jusin154_Team3D/Editor/Private/Level_Logo.cpp
@@ -1,4 +1,4 @@
-#include "pch.h"
+#include "pch.h"
#include "Level_Logo.h"
#include "GameInstance.h"
#include "Level_Loading.h"
@@ -42,10 +42,10 @@ void CLevel_Logo::Update(_float fTimeDelta)
if (FAILED(m_pGameInstance->Change_Level(CLevel_Loading::Create(m_pDevice, m_pContext, LEVEL::LOADING, LEVEL::PHYSX))))
return;
}
- //else if (GUI::Button("Particle Editor", { 100, 100 })) {
- // if (FAILED(m_pGameInstance->Change_Level(CLevel_Loading::Create(m_pDevice, m_pContext, LEVEL::LOADING, LEVEL::PARTICLE))))
- // return;
- //}
+ else if (GUI::SameLine(), GUI::Button("Bloom Editor", { 100, 100 })) {
+ if (FAILED(m_pGameInstance->Change_Level(CLevel_Loading::Create(m_pDevice, m_pContext, LEVEL::LOADING, LEVEL::BLOOM))))
+ return;
+ }
else if (GUI::Button("UI Editor", { 100, 100 })) {
if (FAILED(m_pGameInstance->Change_Level(CLevel_Loading::Create(m_pDevice, m_pContext, LEVEL::LOADING, LEVEL::UI))))
return;
@@ -55,7 +55,7 @@ void CLevel_Logo::Update(_float fTimeDelta)
HRESULT CLevel_Logo::Render()
{
- SetWindowText(g_hWnd, TEXT("·ΰí·¹º§ÀԴϴÙ"));
+ SetWindowText(g_hWnd, TEXT("로고레벨입니다"));
GUI::ShowDemoWindow();
return S_OK;
}
diff --git a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp
index af5364efb..e7ad90e29 100644
--- a/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp
+++ b/Jusin154_Team3D/Editor/Private/Level_MapViewer.cpp
@@ -74,7 +74,7 @@ HRESULT CLevel_MapViewer::Ready_Layer_Camera(const _wstring& strLayerTag)
CameraDesc.fFar = 500.f;
CameraDesc.vEye = _float3(0.f, 10.f, -10.f);
CameraDesc.vAt = _float3(0.f, 0.f, 0.f);
- CameraDesc.fSpeedPerSec = 2.f;
+ CameraDesc.fSpeedPerSec = 5.f;
CameraDesc.pCameraKey = TEXT("Debug_Camera");
CameraDesc.fRotationPerSec = XMConvertToRadians(90.0f);
CameraDesc.fMouseSensor = 0.1f;
diff --git a/Jusin154_Team3D/Editor/Private/Level_ObjectViewer.cpp b/Jusin154_Team3D/Editor/Private/Level_ObjectViewer.cpp
index 96c5b8014..2ae091489 100644
--- a/Jusin154_Team3D/Editor/Private/Level_ObjectViewer.cpp
+++ b/Jusin154_Team3D/Editor/Private/Level_ObjectViewer.cpp
@@ -17,7 +17,7 @@
#include "Terrain.h"
#include "Player.h"
#include "Goblin.h"
-
+#include "Broom.h"
CLevel_ObjectViewer::CLevel_ObjectViewer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID)
: CLevel{ pDevice, pContext, ENUM_CLASS(eLevelID) }
{
@@ -368,9 +368,12 @@ void CLevel_ObjectViewer::Dummy_Object_Setting()
GUI::Begin("Object_Info");
if (!m_Objects.empty())
{
- _float3 Pos;
- XMStoreFloat3(&Pos, m_Objects[m_iObjectIndex]->Get_Component()->Get_State(STATE::POSITION));
- GUI::DragFloat3("Pos", (_float*)&Pos);
+ _float4 Pos;
+ XMStoreFloat4(&Pos, m_Objects[m_iObjectIndex]->Get_Component()->Get_State(STATE::POSITION));
+ if (GUI::DragFloat3("Pos", (_float*)&Pos))
+ {
+ m_Objects[m_iObjectIndex]->Get_Component()->Set_State(STATE::POSITION, XMLoadFloat4(&Pos));
+ }
Show_ObjectList();
@@ -700,6 +703,9 @@ HRESULT CLevel_ObjectViewer::Ready_Layer_Dummy(const _wstring& strLayerTag)
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag)))
return E_FAIL;
+ if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, strLayerTag)))
+ return E_FAIL;
+
return S_OK;
}
diff --git a/Jusin154_Team3D/Editor/Private/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp
index d7616c473..13570c0cf 100644
--- a/Jusin154_Team3D/Editor/Private/Loader.cpp
+++ b/Jusin154_Team3D/Editor/Private/Loader.cpp
@@ -22,7 +22,8 @@
#include "DummyObject.h"
#include "Player.h"
#include "Goblin.h"
-#include
+#include "Broom.h"
+
#pragma endregion
@@ -95,6 +96,12 @@
#pragma endregion
+#pragma region BLOOM_HEADER
+
+#include "Dummy_Globe.h"
+
+#pragma endregion
+
CLoader::CLoader(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
: m_pDevice{ pDevice }
, m_pContext{ pContext }
@@ -124,8 +131,9 @@ HRESULT CLoader::Initialize(LEVEL eNextLevelID)
InitializeCriticalSection(&m_CriticalSection);
m_hThread = (HANDLE)_beginthreadex(nullptr, 0, LoadingMain, this, 0, nullptr);
- if (0 == m_hThread)
+ if (0 == m_hThread){
return E_FAIL;
+ }
return S_OK;
}
@@ -164,9 +172,9 @@ HRESULT CLoader::Loading()
case LEVEL::PHYSX:
hr = Loading_For_PhysXLevel();
break;
- //case LEVEL::PARTICLE:
- // hr = Loading_For_Particle();
- // break;
+ case LEVEL::BLOOM:
+ hr = Loading_For_Bloom();
+ break;
default:
assert(false);
break;
@@ -914,6 +922,57 @@ HRESULT CLoader::Loading_For_PhysXLevel()
return S_OK;
}
+HRESULT CLoader::Loading_For_Bloom()
+{
+
+ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Desc_Box"),
+ CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/Box/Box.bin", XMMatrixScaling(10.f, 10.f, 10.f) * XMMatrixIdentity())))){
+ return E_FAIL;
+ }
+
+ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Model_DummyPlane"),
+ CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/Effect/DummyPlane/DummyPlane.fbx", XMMatrixTranslation(0.f, -10.f, 0.f) * XMMatrixIdentity())))){
+ return E_FAIL;
+ }
+
+ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Desc_Globe"),
+ CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/Object/DragonGlobe/DragonGlobe.fbx", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixIdentity())))){
+ return E_FAIL;
+ }
+
+ if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Desc_Globe2"),
+ CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/Object/DragonGlobe2/DragonGlobe.fbx", XMMatrixScaling(0.01f, 0.01f, 0.01f) * XMMatrixIdentity())))){
+ return E_FAIL;
+ }
+
+ vector<_wstring> ModelPrototypeTags = {};
+ vector ModelPrototypePath = {};
+
+ /* Hog_Props */
+ if (FAILED(MapFolderLoad("C:\\Users\\kimnuri\\Desktop\\MeshTable\\Game\\Environment\\Hogwarts\\Meshes\\Props",
+ ".fbx", true, ModelPrototypeTags, ModelPrototypePath))){
+ return E_FAIL;
+ }
+
+ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummy_Globe::Create(m_pDevice, m_pContext)))){
+ return E_FAIL;
+ }
+
+ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummy_Cube::Create(m_pDevice, m_pContext)))){
+ return E_FAIL;
+ }
+
+ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CDummy_Plane::Create(m_pDevice, m_pContext)))){
+ return E_FAIL;
+ }
+
+ m_strMessage = TEXT("Loading Success!");
+
+ m_isFinished = true;
+
+ return S_OK;
+}
+
HRESULT CLoader::Asset_FileLoad(const _char* pDirectoryPath, const _tchar* pPreName, function AddPrototypeEvent)
{
for (const auto& file : filesystem::directory_iterator(pDirectoryPath))
@@ -1160,6 +1219,11 @@ HRESULT CLoader::Loading_For_ObjectViewer()
if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CGoblin::Create(m_pDevice, m_pContext))))
return E_FAIL;
+
+ /* For.Prototype_GameObject_Broom */
+ if (FAILED(m_pGameInstance->Add_Prototype(g_iStaticLevel, CBroom::Create(m_pDevice, m_pContext))))
+ return E_FAIL;
+
m_strMessage = TEXT("Loading Success!");
m_isFinished = true;
@@ -1173,7 +1237,7 @@ HRESULT CLoader::Loading_For_MapViewer()
m_strMessage = TEXT("텍스쳐를(을) 로딩 중 입니다.");
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("TerrainTest"),
- CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("../Bin/Resources/Textures/Cursor/UI_T_CursorRings.dds"), 0)))) {
+ CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("../Bin/Resources/Textures/T_C_Dun_Moss_D.png"), 0)))) {
return E_FAIL;
}
@@ -1198,193 +1262,193 @@ HRESULT CLoader::Loading_For_MapViewer()
vector ModelPrototypePath = {};
#pragma region HOGSMEADE
- /* Terrain*/
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Collision\\Terrain",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\Terrain",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
+ ///* Terrain*/
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Collision\\Terrain",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\Terrain",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
- /* TScrolls*/
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_TScrolls\\Meshes",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_TScrolls\\Collisions",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
+ ///* TScrolls*/
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_TScrolls\\Meshes",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_TScrolls\\Collisions",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
- /* 3BroomStick*/
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_ThreeBroomsticks\\Meshes",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_ThreeBroomsticks\\Collision",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_ThreeBroomsticks\\Meshes\\3Broom_Kit",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
+ ///* 3BroomStick*/
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_ThreeBroomsticks\\Meshes",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_ThreeBroomsticks\\Collision",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_ThreeBroomsticks\\Meshes\\3Broom_Kit",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
- /* Ollivanders*/
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Ollivanders\\Meshes",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Ollivanders\\Collision",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
+ ///* Ollivanders*/
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Ollivanders\\Meshes",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Ollivanders\\Collision",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
- /* Gatehouse*/
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Gatehouse\\Meshes",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
+ ///* Gatehouse*/
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Gatehouse\\Meshes",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+
+ ///* BLDG_QuidditchShop */
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_QuidditchShop\\Meshes",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_QuidditchShop\\Collision",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+
+ ///* BLDG_HogsheadInn */
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_HogsheadInn\\Meshes",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_HogsheadInn\\Collision",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+
+ ///* BLDG_Honeydukes */
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Honeydukes\\Meshes",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Honeydukes\\Collision",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+
+ ///* BLDG_OwlPost */
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_OwlPost\\Meshes",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_OwlPost\\Collision",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+
+ ///* BLDG_TeaShop */
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_TeaShop\\Meshes",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_TeaShop\\Collision",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+
+ ///* BLDG_Zonkos */
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Zonkos\\Meshes",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Zonkos\\Collision",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+
+ ///* BLDG_DB_GR */
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_DB_GR\\Meshes",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_DB_GR\\Collision",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+
+ ///* BLDG_Potions */
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Potions\\Meshes",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Potions\\Collisions",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+
+ ///* BLDG_Salon */
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Salon\\Meshes",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Salon\\Collision",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+
+ ///* Hengist_Tree */
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\Vegetation\\Hengist_Tree",
+ // ".bin", true, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Collision\\Vegetation",
+ // ".bin", true, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+
+ ///* GEN A*/
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_A\\Meshes",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_A\\Collision",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+
+ ///* GEN B*/
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_B\\Meshes",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_B\\Collision",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+
+ ///* GEN C*/
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_C\\Meshes",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_C\\Collision",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+
+ ///* GEN E*/
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_E\\Meshes",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_E\\Collision",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+
+ ///* GEN F*/
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_F\\Meshes",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_F\\Collision",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+
+ ///* GEN G*/
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_G\\Meshes",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_G\\Collision",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+
+ ///* GEN H*/
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_H\\Meshes",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_H\\Collision",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+
+ ///* GEN J*/
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_J\\Meshes",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
+ //if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_J\\Collision",
+ // ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
+ // return E_FAIL;
- /* BLDG_QuidditchShop */
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_QuidditchShop\\Meshes",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_QuidditchShop\\Collision",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
#pragma endregion
- /* BLDG_HogsheadInn */
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_HogsheadInn\\Meshes",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_HogsheadInn\\Collision",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
-
- /* BLDG_Honeydukes */
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Honeydukes\\Meshes",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Honeydukes\\Collision",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
-
- /* BLDG_OwlPost */
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_OwlPost\\Meshes",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_OwlPost\\Collision",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
-
- /* BLDG_TeaShop */
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_TeaShop\\Meshes",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_TeaShop\\Collision",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
-
- /* BLDG_Zonkos */
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Zonkos\\Meshes",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Zonkos\\Collision",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
-
- /* BLDG_DB_GR */
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_DB_GR\\Meshes",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_DB_GR\\Collision",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
-
- /* BLDG_Potions */
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Potions\\Meshes",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Potions\\Collisions",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
-
- /* BLDG_Salon */
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Salon\\Meshes",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_Salon\\Collision",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
-
- /* Hengist_Tree */
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Meshes\\Vegetation\\Hengist_Tree",
- ".bin", true, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\Common\\Collision\\Vegetation",
- ".bin", true, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
-
- /* GEN A*/
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_A\\Meshes",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_A\\Collision",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
-
- /* GEN B*/
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_B\\Meshes",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_B\\Collision",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
-
- /* GEN C*/
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_C\\Meshes",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_C\\Collision",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
-
- /* GEN E*/
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_E\\Meshes",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_E\\Collision",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
-
- /* GEN F*/
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_F\\Meshes",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_F\\Collision",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
-
- /* GEN G*/
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_G\\Meshes",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_G\\Collision",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
-
- /* GEN H*/
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_H\\Meshes",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_H\\Collision",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
-
- /* GEN J*/
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_J\\Meshes",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
- if (FAILED(MapFolderLoad("C:\\Users\\82103\\Desktop\\MeshTable\\Game\\Environment\\Hogsmeade\\BLDG_GEN_J\\Collision",
- ".bin", false, ModelPrototypeTags, ModelPrototypePath)))
- return E_FAIL;
-
-
-
+
m_strMessage = TEXT("쉐이더를(을) 로딩 중 입니다.");
m_strMessage = TEXT("객체원형를(을) 로딩 중 입니다.");
@@ -1397,7 +1461,7 @@ HRESULT CLoader::Loading_For_MapViewer()
/* For.Prototype_Component_VIBuffer_Terrain */
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_Terrain"),
- CVIBuffer_Terrain::Create(m_pDevice, m_pContext, nullptr, 100, 100))))
+ CVIBuffer_Terrain::Create(m_pDevice, m_pContext, "../Bin/Resources/Data/Map/Height.bmp", 257, 257))))
return E_FAIL;
/* For.Prototype_GameObject_SkyBox */
diff --git a/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp b/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp
index 29d570ba1..6ba73587b 100644
--- a/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp
+++ b/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp
@@ -89,10 +89,7 @@ HRESULT CMapElement_Interactable::Render()
for (_uint i = 0; i < iNumMeshes; i++)
{
- if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
- return E_FAIL;
- }
- if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) {
+ if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom))) {
return E_FAIL;
}
if (m_bSelected)
@@ -218,7 +215,7 @@ void CMapElement_Interactable::Describe_Entity()
CTerrain* pTerrain = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Terrain"))->Get_Object();
if (nullptr != pTerrain)
{
- pTerrain->Get_Component()->Picking(pTerrain->Get_Component(), m_vPosition);
+ pTerrain->Get_Component()->Picking(pTerrain->Get_Component()->Get_XMWorldMatrix(), &m_vPosition);
}
}
diff --git a/Jusin154_Team3D/Editor/Private/MapElement_Static.cpp b/Jusin154_Team3D/Editor/Private/MapElement_Static.cpp
index 48ede6440..a6f282b01 100644
--- a/Jusin154_Team3D/Editor/Private/MapElement_Static.cpp
+++ b/Jusin154_Team3D/Editor/Private/MapElement_Static.cpp
@@ -90,10 +90,7 @@ HRESULT CMapElement_Static::Render()
for (_uint i = 0; i < iNumMeshes; i++)
{
- if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
- return E_FAIL;
- }
- if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) {
+ if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom))) {
return E_FAIL;
}
if (m_bSelected)
@@ -218,7 +215,7 @@ void CMapElement_Static::Describe_Entity()
CTerrain* pTerrain = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Terrain"))->Get_Object();
if (nullptr != pTerrain)
{
- pTerrain->Get_Component()->Picking(pTerrain->Get_Component(), m_vPosition);
+ pTerrain->Get_Component()->Picking(pTerrain->Get_Component()->Get_XMWorldMatrix(), &m_vPosition);
}
}
diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Collision.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Collision.cpp
index c2b86906c..66e8e00e8 100644
--- a/Jusin154_Team3D/Editor/Private/MapObject_Collision.cpp
+++ b/Jusin154_Team3D/Editor/Private/MapObject_Collision.cpp
@@ -64,7 +64,7 @@ HRESULT CMapObject_Collision::Render()
return E_FAIL;
}
- if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) {
+ if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom))) {
return E_FAIL;
}
if (m_bSelected)
@@ -240,7 +240,7 @@ void CMapObject_Collision::Describe_Entity()
CTerrain* pTerrain = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Terrain"))->Get_Object();
if (nullptr != pTerrain)
{
- pTerrain->Get_Component()->Picking(pTerrain->Get_Component(), m_vPosition);
+ pTerrain->Get_Component()->Picking(pTerrain->Get_Component()->Get_XMWorldMatrix(), &m_vPosition);
}
}
diff --git a/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp b/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp
index 054b284eb..37140c4d1 100644
--- a/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp
+++ b/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp
@@ -125,14 +125,10 @@ HRESULT CMapObject_LOD::Render()
for (_uint i = 0; i < iNumMeshes; i++)
{
- if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
+ if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom))) {
return E_FAIL;
}
- if (FAILED(m_pModelComs[0]->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) {
- return E_FAIL;
- }
-
if (m_bSelected)
{
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::MAPTOOL)))) {
@@ -281,7 +277,7 @@ void CMapObject_LOD::Describe_Entity()
CTerrain* pTerrain = m_pGameInstance->Get_Layer(ENUM_CLASS(LEVEL::MAP), TEXT("Layer_Terrain"))->Get_Object();
if (nullptr != pTerrain)
{
- pTerrain->Get_Component()->Picking(pTerrain->Get_Component(), m_vPosition);
+ pTerrain->Get_Component()->Picking(pTerrain->Get_Component()->Get_XMWorldMatrix(), &m_vPosition);
}
}
diff --git a/Jusin154_Team3D/Editor/Private/ModelParts.cpp b/Jusin154_Team3D/Editor/Private/ModelParts.cpp
index 63d63dbe2..b1c75a254 100644
--- a/Jusin154_Team3D/Editor/Private/ModelParts.cpp
+++ b/Jusin154_Team3D/Editor/Private/ModelParts.cpp
@@ -70,13 +70,9 @@ HRESULT CModelParts::Render()
return E_FAIL;
}
- if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
+ if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
return E_FAIL;
}
- if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) {
- return E_FAIL;
- }
-
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_ANIM::DEFAULT)))) {
return E_FAIL;
}
diff --git a/Jusin154_Team3D/Editor/Private/Player.cpp b/Jusin154_Team3D/Editor/Private/Player.cpp
index 7a97db996..419e5e6f9 100644
--- a/Jusin154_Team3D/Editor/Private/Player.cpp
+++ b/Jusin154_Team3D/Editor/Private/Player.cpp
@@ -7,15 +7,18 @@
#pragma region STATE
#include "State_Idle.h"
#include "State_Walk.h"
-#include "State_Dodge.h"
+#include "State_Jog.h"
#include "State_Sprint.h"
+#include "State_Dodge.h"
#include "State_Jump.h"
#include "State_Skill.h"
+#include "State_Skill2.h"
#include "State_LightAttack.h"
#include "State_Land.h"
#include "State_Cast.h"
#include "State_Move.h"
#include "State_Combat.h"
+#include "State_Idle_Turn.h"
#pragma endregion
CPlayer::CPlayer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
@@ -89,13 +92,9 @@ HRESULT CPlayer::Render()
return E_FAIL;
}
- if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
+ if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
return E_FAIL;
}
- if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) {
- return E_FAIL;
- }
-
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_ANIM::DEFAULT)))) {
return E_FAIL;
}
@@ -155,17 +154,19 @@ void CPlayer::Setup_InputConditions()
{
m_InputConditions =
{
- { FSMSTATE::MOVE, [&]() {return Check(FSMSTATE::WALK) && Check(FSMSTATE::SPRINT) && Check(FSMSTATE::JOG); }},
+ { FSMSTATE::IDLE_TURN, [&]() { return m_pGameInstance->Key_Down(DIK_LEFT) || m_pGameInstance->Key_Down(DIK_RIGHT) || m_pGameInstance->Key_Down(DIK_DOWN); }},
+ { FSMSTATE::MOVE, [&]() { return Check(FSMSTATE::WALK) || Check(FSMSTATE::SPRINT) || Check(FSMSTATE::JOG) || Check(FSMSTATE::DODGE); }},
{ FSMSTATE::WALK, [&]() { return m_pGameInstance->Key_Pressing(DIK_UP)
- || m_pGameInstance->Key_Pressing(DIK_DOWN); }},
+ /*|| m_pGameInstance->Key_Pressing(DIK_DOWN)*/; }},
{ FSMSTATE::WALK_FWD, [&]() { return m_pGameInstance->Key_Pressing(DIK_UP); }},
{ FSMSTATE::WALK_BWD, [&]() { return m_pGameInstance->Key_Pressing(DIK_DOWN); }},
- { FSMSTATE::SPRINT, [&]() { return m_pGameInstance->Key_Pressing(DIK_LSHIFT)
+ { FSMSTATE::SPRINT, [&]() { return m_bSprintToggle
&& m_pGameInstance->Key_Pressing(DIK_UP); }},
-
- { FSMSTATE::COMBAT, [&]() {return Check(FSMSTATE::DODGE) && Check(FSMSTATE::SKILL) && Check(FSMSTATE::LIGHT_ATTACK) && Check(FSMSTATE::CAST); }},
{ FSMSTATE::DODGE, [&]() { return m_pGameInstance->Key_Down(DIK_LCONTROL); }},
+
+ { FSMSTATE::COMBAT, [&]() { return Check(FSMSTATE::SKILL) || Check(FSMSTATE::LIGHT_ATTACK) || Check(FSMSTATE::CAST) || Check(FSMSTATE::SKILL2); }},
{ FSMSTATE::SKILL, [&]() { return m_pGameInstance->Key_Down(DIK_R); }},
+ { FSMSTATE::SKILL2, [&]() { return m_pGameInstance->Key_Down(DIK_Q); }},
{ FSMSTATE::LIGHT_ATTACK,[&]() { return m_pGameInstance->Mouse_Up(ENUM_CLASS(MOUSEKEYSTATE::LBUTTON)); }},
{ FSMSTATE::CAST, [&]() { return m_pGameInstance->Key_Down(DIK_1); }},
@@ -185,6 +186,8 @@ void CPlayer::Key_Input(_float fTimeDelta)
if (m_pGameInstance->Key_Pressing(DIK_RIGHT))
m_pTransformCom->Turn(m_pTransformCom->Get_State(STATE::UP), fTimeDelta);
}
+
+ IsSprint();
}
void CPlayer::Add_FSM()
@@ -192,17 +195,20 @@ void CPlayer::Add_FSM()
#pragma region MOVE
m_pFSM->Add_State(FSMSTATE::MOVE, new CState_Move());
m_pFSM->Add_State(FSMSTATE::WALK, new CState_Walk());
+ m_pFSM->Add_State(FSMSTATE::JOG, new CState_Jog());
m_pFSM->Add_State(FSMSTATE::SPRINT, new CState_Sprint());
+ m_pFSM->Add_State(FSMSTATE::DODGE, new CState_Dodge());
#pragma endregion
#pragma region COMBAT
m_pFSM->Add_State(FSMSTATE::COMBAT, new CState_Combat());
m_pFSM->Add_State(FSMSTATE::SKILL, new CState_Skill());
+ m_pFSM->Add_State(FSMSTATE::SKILL2, new CState_Skill2());
m_pFSM->Add_State(FSMSTATE::LIGHT_ATTACK, new CState_LightAttack());
m_pFSM->Add_State(FSMSTATE::CAST, new CState_Cast());
- m_pFSM->Add_State(FSMSTATE::DODGE, new CState_Dodge());
#pragma endregion
m_pFSM->Add_State(FSMSTATE::IDLE, new CState_Idle());
+ m_pFSM->Add_State(FSMSTATE::IDLE_TURN, new CState_Idle_Turn());
m_pFSM->Add_State(FSMSTATE::JUMP, new CState_Jump());
m_pFSM->Add_State(FSMSTATE::LAND, new CState_Land());
@@ -216,28 +222,44 @@ void CPlayer::Set_FSM()
m_pFSM->Set_Parent(FSMSTATE::WALK_FWD, FSMSTATE::MOVE);
m_pFSM->Set_Parent(FSMSTATE::JOG, FSMSTATE::MOVE);
m_pFSM->Set_Parent(FSMSTATE::SPRINT, FSMSTATE::MOVE);
+ m_pFSM->Set_Parent(FSMSTATE::DODGE, FSMSTATE::MOVE);
#pragma endregion
#pragma region COMBAT
m_pFSM->Set_Parent(FSMSTATE::SKILL, FSMSTATE::COMBAT);
+ m_pFSM->Set_Parent(FSMSTATE::SKILL2, FSMSTATE::COMBAT);
m_pFSM->Set_Parent(FSMSTATE::LIGHT_ATTACK, FSMSTATE::COMBAT);
m_pFSM->Set_Parent(FSMSTATE::CAST, FSMSTATE::COMBAT);
- m_pFSM->Set_Parent(FSMSTATE::DODGE, FSMSTATE::COMBAT);
#pragma endregion
}
void CPlayer::Set_Anim()
{
- m_Animation[FSMSTATE::IDLE] = { 266,true };
- m_Animation[FSMSTATE::DODGE] = { 802,false };
- m_Animation[FSMSTATE::WALK_FWD] = { 167,true };
- m_Animation[FSMSTATE::WALK_BWD] = { 166,true };
- m_Animation[FSMSTATE::SPRINT] = { 599,true };
- m_Animation[FSMSTATE::JUMP] = { 205,false };
- m_Animation[FSMSTATE::SKILL] = { 593,false };
- m_Animation[FSMSTATE::LIGHT_ATTACK] = { 413,false };
- m_Animation[FSMSTATE::LAND] = { 259,false };
- m_Animation[FSMSTATE::CAST] = { 696,false };
+
+ m_Animation[STATEANIM::DODGE] = { 802,false };
+
+ m_Animation[STATEANIM::JOG] = { 166,true };
+
+ m_Animation[STATEANIM::SKILL] = { 593,false };
+ m_Animation[STATEANIM::SKILL2] = { 915,false };
+ m_Animation[STATEANIM::LIGHT_ATTACK] = { 413,false };
+ m_Animation[STATEANIM::LAND] = { 259,false };
+ m_Animation[STATEANIM::CAST] = { 696,false };
+
+ m_Animation[STATEANIM::IDLE] = { 266,true };
+ m_Animation[STATEANIM::IDLE_TURN_L] = { 270,false };
+ m_Animation[STATEANIM::IDLE_TURN_R] = { 430,false };
+ m_Animation[STATEANIM::IDLE_TURN_BWD] = { 268,false };
+
+ m_Animation[STATEANIM::WALK_FWD] = { 167,true };
+ m_Animation[STATEANIM::WALK_BWD] = { 166,true };
+ m_Animation[STATEANIM::WALK_STOP] = { 289,false };
+
+ m_Animation[STATEANIM::JUMP] = { 205,false };
+ m_Animation[STATEANIM::JUMP_WALK] = { 203,false };
+ m_Animation[STATEANIM::JUMP_SPRINT] = { 207,false };
+
+ m_Animation[STATEANIM::SPRINT] = { 599,true };
}
CPlayer* CPlayer::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
@@ -279,6 +301,21 @@ void CPlayer::Describe_Entity()
GUI::Text(label);
}
+ _float3 Pos;
+ XMStoreFloat3(&Pos, Get_WorldPostion());
+
+ float Pos3[3] = { Pos.x, Pos.y, Pos.z };
+ GUI::DragFloat3("Pos", Pos3);
+
+
+ _float RotR,RotU,RotL;
+ RotR = XMVectorGetX(m_pTransformCom->Get_State(STATE::RIGHT));
+ RotU = XMVectorGetY(m_pTransformCom->Get_State(STATE::UP));
+ RotL = XMVectorGetZ(m_pTransformCom->Get_State(STATE::LOOK));
+
+ float Rot3[3] = { RotR, RotU,RotL };
+ GUI::DragFloat3("Rot", Rot3);
+
}
_bool CPlayer::Check(FSMSTATE::ESTATE state)
@@ -290,3 +327,12 @@ _bool CPlayer::Check(FSMSTATE::ESTATE state)
}
return false;
}
+
+_bool CPlayer::IsSprint()
+{
+ if (m_pGameInstance->Key_Down(DIK_LSHIFT))
+ {
+ return m_bSprintToggle = !m_bSprintToggle;
+ }
+ return false;
+}
diff --git a/Jusin154_Team3D/Editor/Private/State_Cast.cpp b/Jusin154_Team3D/Editor/Private/State_Cast.cpp
index f736fab28..3915da0eb 100644
--- a/Jusin154_Team3D/Editor/Private/State_Cast.cpp
+++ b/Jusin154_Team3D/Editor/Private/State_Cast.cpp
@@ -13,7 +13,7 @@ void CState_Cast::Enter()
if (m_pFSM->Get_PrevState() == FSMSTATE::CAST)
return;
- auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::CAST);
+ auto anim = m_pOwner->Get_AnimInfo(STATEANIM::CAST);
m_pModel->Set_AnimationIndex(anim.first, anim.second);
}
@@ -29,13 +29,6 @@ void CState_Cast::Exit()
_bool CState_Cast::CheckExitState()
{
- if (m_pOwner->Check(FSMSTATE::WALK))
- {
- m_pOwner->Reset_LightCombo();
- m_pFSM->Change_State(FSMSTATE::WALK);
- return true;
- }
-
if (m_pModel->IsFinishedAnim())
{
m_pOwner->Reset_LightCombo();
@@ -54,7 +47,7 @@ _bool CState_Cast::CheckExitState()
return true;
}
- auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::CAST);
+ auto anim = m_pOwner->Get_AnimInfo(STATEANIM::CAST);
m_pModel->Set_AnimationIndex(anim.first + combo, anim.second);
m_pFSM->Change_State(FSMSTATE::CAST);
@@ -62,6 +55,13 @@ _bool CState_Cast::CheckExitState()
return true;
}
+ if (m_pOwner->Check(FSMSTATE::SKILL2))
+ {
+ m_pOwner->Reset_LightCombo();
+ m_pFSM->Change_State(FSMSTATE::SKILL2);
+ return true;
+ }
+
return false;
}
diff --git a/Jusin154_Team3D/Editor/Private/State_Combat.cpp b/Jusin154_Team3D/Editor/Private/State_Combat.cpp
index 616dec433..932fe1f57 100644
--- a/Jusin154_Team3D/Editor/Private/State_Combat.cpp
+++ b/Jusin154_Team3D/Editor/Private/State_Combat.cpp
@@ -25,11 +25,23 @@ void CState_Combat::Exit()
_bool CState_Combat::CheckExitState()
{
- if (m_pOwner->Check(FSMSTATE::MOVE))
+ if (m_pOwner->Check(FSMSTATE::MOVE) &&
+ !m_pOwner->Check(FSMSTATE::COMBAT))
{
m_pFSM->Change_State(FSMSTATE::MOVE);
+
+ if (m_pOwner->Check(FSMSTATE::WALK))
+ m_pFSM->Change_State(FSMSTATE::WALK);
+
+ if (m_pOwner->Check(FSMSTATE::SPRINT))
+ m_pFSM->Change_State(FSMSTATE::SPRINT);
+
+ if (m_pOwner->Check(FSMSTATE::DODGE))
+ m_pFSM->Change_State(FSMSTATE::DODGE);
+
return true;
}
+
return false;
}
diff --git a/Jusin154_Team3D/Editor/Private/State_Dodge.cpp b/Jusin154_Team3D/Editor/Private/State_Dodge.cpp
index 53925868c..e2052ad0b 100644
--- a/Jusin154_Team3D/Editor/Private/State_Dodge.cpp
+++ b/Jusin154_Team3D/Editor/Private/State_Dodge.cpp
@@ -10,7 +10,7 @@ CState_Dodge::CState_Dodge()
void CState_Dodge::Enter()
{
- auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::DODGE);
+ auto anim = m_pOwner->Get_AnimInfo(STATEANIM::DODGE);
m_pModel->Set_AnimationIndex(anim.first, anim.second);
}
diff --git a/Jusin154_Team3D/Editor/Private/State_Idle.cpp b/Jusin154_Team3D/Editor/Private/State_Idle.cpp
index c66342a9d..fc24940e1 100644
--- a/Jusin154_Team3D/Editor/Private/State_Idle.cpp
+++ b/Jusin154_Team3D/Editor/Private/State_Idle.cpp
@@ -9,8 +9,17 @@ CState_Idle::CState_Idle()
void CState_Idle::Enter()
{
- auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::IDLE);
- m_pModel->Set_AnimationIndex(anim.first, anim.second);
+ if (m_pFSM->Get_PrevState() == FSMSTATE::WALK)
+ {
+ auto anim = m_pOwner->Get_AnimInfo(STATEANIM::WALK_STOP);
+ m_pModel->Set_AnimationIndex(anim.first, anim.second);
+ return;
+ }
+ else
+ {
+ auto anim = m_pOwner->Get_AnimInfo(STATEANIM::IDLE);
+ m_pModel->Set_AnimationIndex(anim.first, anim.second);
+ }
}
void CState_Idle::Update(_float fTimeDelta)
@@ -25,27 +34,43 @@ void CState_Idle::Exit()
_bool CState_Idle::CheckExitState()
{
- if (m_pOwner->Check(FSMSTATE::WALK))
- m_pFSM->Change_State(FSMSTATE::WALK);
+ if (m_pOwner->Check(FSMSTATE::MOVE))
+ {
+ m_pFSM->Change_State(FSMSTATE::MOVE);
- if (m_pOwner->Check(FSMSTATE::DODGE))
- m_pFSM->Change_State(FSMSTATE::DODGE);
+ if (m_pOwner->Check(FSMSTATE::WALK))
+ m_pFSM->Change_State(FSMSTATE::WALK);
- if (m_pOwner->Check(FSMSTATE::SPRINT))
- m_pFSM->Change_State(FSMSTATE::SPRINT);
+ if (m_pOwner->Check(FSMSTATE::SPRINT))
+ m_pFSM->Change_State(FSMSTATE::SPRINT);
+
+ if (m_pOwner->Check(FSMSTATE::DODGE))
+ m_pFSM->Change_State(FSMSTATE::DODGE);
+ }
+
+ if (m_pOwner->Check(FSMSTATE::COMBAT))
+ {
+ m_pFSM->Change_State(FSMSTATE::COMBAT);
+
+ if (m_pOwner->Check(FSMSTATE::SKILL))
+ m_pFSM->Change_State(FSMSTATE::SKILL);
+
+ if (m_pOwner->Check(FSMSTATE::SKILL2))
+ m_pFSM->Change_State(FSMSTATE::SKILL2);
+
+ if (m_pOwner->Check(FSMSTATE::LIGHT_ATTACK))
+ m_pFSM->Change_State(FSMSTATE::LIGHT_ATTACK);
+
+ if (m_pOwner->Check(FSMSTATE::CAST))
+ m_pFSM->Change_State(FSMSTATE::CAST);
+ }
+
+ if (m_pOwner->Check(FSMSTATE::IDLE_TURN))
+ m_pFSM->Change_State(FSMSTATE::IDLE_TURN);
if (m_pOwner->Check(FSMSTATE::JUMP))
m_pFSM->Change_State(FSMSTATE::JUMP);
- if (m_pOwner->Check(FSMSTATE::SKILL))
- m_pFSM->Change_State(FSMSTATE::SKILL);
-
- if (m_pOwner->Check(FSMSTATE::LIGHT_ATTACK))
- m_pFSM->Change_State(FSMSTATE::LIGHT_ATTACK);
-
- if (m_pOwner->Check(FSMSTATE::CAST))
- m_pFSM->Change_State(FSMSTATE::CAST);
-
return false;
}
diff --git a/Jusin154_Team3D/Editor/Private/State_Idle_Turn.cpp b/Jusin154_Team3D/Editor/Private/State_Idle_Turn.cpp
new file mode 100644
index 000000000..d0b9f1712
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Private/State_Idle_Turn.cpp
@@ -0,0 +1,88 @@
+#include "pch.h"
+#include "State_Idle_Turn.h"
+#include "Unit.h"
+
+CState_Idle_Turn::CState_Idle_Turn()
+ :CState()
+{
+}
+
+void CState_Idle_Turn::Enter()
+{
+ if (m_pGameInstance->Key_Down(DIK_LEFT))
+ {
+ auto anim = m_pOwner->Get_AnimInfo(STATEANIM::IDLE_TURN_L);
+ m_pModel->Set_AnimationIndex(anim.first, anim.second);
+ }
+ if (m_pGameInstance->Key_Down(DIK_RIGHT))
+ {
+ auto anim = m_pOwner->Get_AnimInfo(STATEANIM::IDLE_TURN_R);
+ m_pModel->Set_AnimationIndex(anim.first, anim.second);
+ }
+ if (m_pGameInstance->Key_Down(DIK_DOWN))
+ {
+ auto anim = m_pOwner->Get_AnimInfo(STATEANIM::IDLE_TURN_BWD);
+ m_pModel->Set_AnimationIndex(anim.first, anim.second);
+ }
+}
+
+void CState_Idle_Turn::Update(_float fTimeDelta)
+{
+ if (CheckExitState())
+ return;
+}
+
+void CState_Idle_Turn::Exit()
+{
+}
+
+_bool CState_Idle_Turn::CheckExitState()
+{
+ if (m_pOwner->Check(FSMSTATE::MOVE))
+ {
+ m_pFSM->Change_State(FSMSTATE::MOVE);
+
+ if (m_pOwner->Check(FSMSTATE::WALK))
+ m_pFSM->Change_State(FSMSTATE::WALK);
+
+ if (m_pOwner->Check(FSMSTATE::SPRINT))
+ m_pFSM->Change_State(FSMSTATE::SPRINT);
+
+ if (m_pOwner->Check(FSMSTATE::DODGE))
+ m_pFSM->Change_State(FSMSTATE::DODGE);
+ }
+
+ if (m_pOwner->Check(FSMSTATE::COMBAT))
+ {
+ m_pFSM->Change_State(FSMSTATE::COMBAT);
+
+ if (m_pOwner->Check(FSMSTATE::SKILL))
+ m_pFSM->Change_State(FSMSTATE::SKILL);
+
+ if (m_pOwner->Check(FSMSTATE::SKILL2))
+ m_pFSM->Change_State(FSMSTATE::SKILL2);
+
+ if (m_pOwner->Check(FSMSTATE::LIGHT_ATTACK))
+ m_pFSM->Change_State(FSMSTATE::LIGHT_ATTACK);
+
+ if (m_pOwner->Check(FSMSTATE::CAST))
+ m_pFSM->Change_State(FSMSTATE::CAST);
+ }
+
+ if (m_pModel->IsFinishedAnim())
+ m_pFSM->Change_State(FSMSTATE::IDLE);
+
+ if (m_pOwner->Check(FSMSTATE::JUMP))
+ m_pFSM->Change_State(FSMSTATE::JUMP);
+
+ return false;
+}
+
+void CState_Idle_Turn::Free()
+{
+ __super::Free();
+}
+
+void CState_Idle_Turn::Describe_Entity()
+{
+}
diff --git a/Jusin154_Team3D/Editor/Private/State_Jog.cpp b/Jusin154_Team3D/Editor/Private/State_Jog.cpp
new file mode 100644
index 000000000..3831f9943
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Private/State_Jog.cpp
@@ -0,0 +1,56 @@
+#include "pch.h"
+#include "State_Jog.h"
+#include "Unit.h"
+
+CState_Jog::CState_Jog()
+ :CState()
+{
+}
+
+void CState_Jog::Enter()
+{
+ if (m_pOwner->Check(FSMSTATE::WALK_FWD))
+ {
+ auto anim = m_pOwner->Get_AnimInfo(STATEANIM::WALK_FWD);
+ m_pModel->Set_AnimationIndex(anim.first, anim.second);
+ }
+
+ if (m_pOwner->Check(FSMSTATE::WALK_BWD))
+ {
+ auto anim = m_pOwner->Get_AnimInfo(STATEANIM::WALK_BWD);
+ m_pModel->Set_AnimationIndex(anim.first, anim.second);
+ }
+}
+
+void CState_Jog::Update(_float fTimeDelta)
+{
+ if (CheckExitState())
+ return;
+}
+
+void CState_Jog::Exit()
+{
+}
+
+_bool CState_Jog::CheckExitState()
+{
+ if (m_pOwner->Check(FSMSTATE::SPRINT))
+ m_pFSM->Change_State(FSMSTATE::SPRINT);
+
+ else if (m_pOwner->Check(FSMSTATE::DODGE))
+ m_pFSM->Change_State(FSMSTATE::DODGE);
+
+ else if (!m_pOwner->Check(FSMSTATE::JOG))
+ m_pFSM->Change_State(FSMSTATE::IDLE);
+
+ return false;
+}
+
+void CState_Jog::Free()
+{
+ __super::Free();
+}
+
+void CState_Jog::Describe_Entity()
+{
+}
diff --git a/Jusin154_Team3D/Editor/Private/State_Jump.cpp b/Jusin154_Team3D/Editor/Private/State_Jump.cpp
index dd4b58487..c2c175863 100644
--- a/Jusin154_Team3D/Editor/Private/State_Jump.cpp
+++ b/Jusin154_Team3D/Editor/Private/State_Jump.cpp
@@ -10,7 +10,20 @@ CState_Jump::CState_Jump()
void CState_Jump::Enter()
{
- auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::JUMP);
+ if (m_pOwner->Check(FSMSTATE::SPRINT))
+ {
+ auto anim = m_pOwner->Get_AnimInfo(STATEANIM::JUMP_SPRINT);
+ m_pModel->Set_AnimationIndex(anim.first, anim.second);
+ return;
+ }
+ if (m_pOwner->Check(FSMSTATE::WALK))
+ {
+ auto anim = m_pOwner->Get_AnimInfo(STATEANIM::JUMP_WALK);
+ m_pModel->Set_AnimationIndex(anim.first, anim.second);
+ return;
+ }
+
+ auto anim = m_pOwner->Get_AnimInfo(STATEANIM::JUMP);
m_pModel->Set_AnimationIndex(anim.first, anim.second);
}
diff --git a/Jusin154_Team3D/Editor/Private/State_Land.cpp b/Jusin154_Team3D/Editor/Private/State_Land.cpp
index 86ff832d0..d6fb4ea3c 100644
--- a/Jusin154_Team3D/Editor/Private/State_Land.cpp
+++ b/Jusin154_Team3D/Editor/Private/State_Land.cpp
@@ -10,7 +10,7 @@ CState_Land::CState_Land()
void CState_Land::Enter()
{
- auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::LAND);
+ auto anim = m_pOwner->Get_AnimInfo(STATEANIM::LAND);
m_pModel->Set_AnimationIndex(anim.first, anim.second);
}
diff --git a/Jusin154_Team3D/Editor/Private/State_LightAttack.cpp b/Jusin154_Team3D/Editor/Private/State_LightAttack.cpp
index bed197938..ed27639b4 100644
--- a/Jusin154_Team3D/Editor/Private/State_LightAttack.cpp
+++ b/Jusin154_Team3D/Editor/Private/State_LightAttack.cpp
@@ -13,7 +13,7 @@ void CState_LightAttack::Enter()
if (m_pFSM->Get_PrevState() == FSMSTATE::LIGHT_ATTACK)
return;
- auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::LIGHT_ATTACK);
+ auto anim = m_pOwner->Get_AnimInfo(STATEANIM::LIGHT_ATTACK);
m_pModel->Set_AnimationIndex(anim.first, anim.second);
}
@@ -29,12 +29,6 @@ void CState_LightAttack::Exit()
_bool CState_LightAttack::CheckExitState()
{
- if (m_pOwner->Check(FSMSTATE::WALK))
- {
- m_pOwner->Reset_LightCombo();
- m_pFSM->Change_State(FSMSTATE::WALK);
- return true;
- }
if (m_pModel->IsFinishedAnim())
{
m_pOwner->Reset_LightCombo();
@@ -53,7 +47,7 @@ _bool CState_LightAttack::CheckExitState()
return true;
}
- auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::LIGHT_ATTACK);
+ auto anim = m_pOwner->Get_AnimInfo(STATEANIM::LIGHT_ATTACK);
m_pModel->Set_AnimationIndex(anim.first + combo, anim.second);
m_pFSM->Change_State(FSMSTATE::LIGHT_ATTACK);
@@ -62,6 +56,13 @@ _bool CState_LightAttack::CheckExitState()
}
+ if (m_pOwner->Check(FSMSTATE::SKILL2))
+ {
+ m_pOwner->Reset_LightCombo();
+ m_pFSM->Change_State(FSMSTATE::SKILL2);
+ return true;
+ }
+
return false;
}
diff --git a/Jusin154_Team3D/Editor/Private/State_Move.cpp b/Jusin154_Team3D/Editor/Private/State_Move.cpp
index 8b9956607..351df59db 100644
--- a/Jusin154_Team3D/Editor/Private/State_Move.cpp
+++ b/Jusin154_Team3D/Editor/Private/State_Move.cpp
@@ -25,11 +25,26 @@ void CState_Move::Exit()
_bool CState_Move::CheckExitState()
{
- if (m_pOwner->Check(FSMSTATE::COMBAT))
+ if (m_pOwner->Check(FSMSTATE::COMBAT) &&
+ !m_pOwner->Check(FSMSTATE::MOVE))
{
m_pFSM->Change_State(FSMSTATE::COMBAT);
+
+ if (m_pOwner->Check(FSMSTATE::SKILL))
+ m_pFSM->Change_State(FSMSTATE::SKILL);
+
+ if (m_pOwner->Check(FSMSTATE::SKILL2))
+ m_pFSM->Change_State(FSMSTATE::SKILL2);
+
+ if (m_pOwner->Check(FSMSTATE::LIGHT_ATTACK))
+ m_pFSM->Change_State(FSMSTATE::LIGHT_ATTACK);
+
+ if (m_pOwner->Check(FSMSTATE::CAST))
+ m_pFSM->Change_State(FSMSTATE::CAST);
+
return true;
}
+
return false;
}
diff --git a/Jusin154_Team3D/Editor/Private/State_Skill.cpp b/Jusin154_Team3D/Editor/Private/State_Skill.cpp
index 6b0e9e175..d842e203d 100644
--- a/Jusin154_Team3D/Editor/Private/State_Skill.cpp
+++ b/Jusin154_Team3D/Editor/Private/State_Skill.cpp
@@ -10,7 +10,7 @@ CState_Skill::CState_Skill()
void CState_Skill::Enter()
{
- auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::SKILL);
+ auto anim = m_pOwner->Get_AnimInfo(STATEANIM::SKILL);
m_pModel->Set_AnimationIndex(anim.first, anim.second);
}
diff --git a/Jusin154_Team3D/Editor/Private/State_Skill2.cpp b/Jusin154_Team3D/Editor/Private/State_Skill2.cpp
new file mode 100644
index 000000000..03704ac90
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Private/State_Skill2.cpp
@@ -0,0 +1,42 @@
+#include "pch.h"
+#include "State_Skill2.h"
+#include "Unit.h"
+
+
+CState_Skill2::CState_Skill2()
+ :CState()
+{
+}
+
+void CState_Skill2::Enter()
+{
+ auto anim = m_pOwner->Get_AnimInfo(STATEANIM::SKILL2);
+ m_pModel->Set_AnimationIndex(anim.first, anim.second);
+}
+
+void CState_Skill2::Update(_float fTimeDelta)
+{
+ if (CheckExitState())
+ return;
+}
+
+void CState_Skill2::Exit()
+{
+}
+
+_bool CState_Skill2::CheckExitState()
+{
+ if (m_pModel->IsFinishedAnim())
+ m_pFSM->Change_State(FSMSTATE::IDLE);
+
+ return false;
+}
+
+void CState_Skill2::Free()
+{
+ __super::Free();
+}
+
+void CState_Skill2::Describe_Entity()
+{
+}
diff --git a/Jusin154_Team3D/Editor/Private/State_Sprint.cpp b/Jusin154_Team3D/Editor/Private/State_Sprint.cpp
index e279f6fc8..eccc2dd30 100644
--- a/Jusin154_Team3D/Editor/Private/State_Sprint.cpp
+++ b/Jusin154_Team3D/Editor/Private/State_Sprint.cpp
@@ -9,7 +9,7 @@ CState_Sprint::CState_Sprint()
void CState_Sprint::Enter()
{
- auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::SPRINT);
+ auto anim = m_pOwner->Get_AnimInfo(STATEANIM::SPRINT);
m_pModel->Set_AnimationIndex(anim.first, anim.second);
}
@@ -27,10 +27,16 @@ void CState_Sprint::Exit()
_bool CState_Sprint::CheckExitState()
{
if (!m_pOwner->Check(FSMSTATE::SPRINT))
+ {
+ m_pOwner->Reset_Sprint();
m_pFSM->Change_State(FSMSTATE::WALK);
-
- else if (!m_pOwner->Check(FSMSTATE::WALK))
- m_pFSM->Change_State(FSMSTATE::IDLE);
+ }
+
+ else if (m_pOwner->Check(FSMSTATE::DODGE))
+ m_pFSM->Change_State(FSMSTATE::DODGE);
+
+ if (m_pOwner->Check(FSMSTATE::JUMP))
+ m_pFSM->Change_State(FSMSTATE::JUMP);
return false;
}
diff --git a/Jusin154_Team3D/Editor/Private/State_Walk.cpp b/Jusin154_Team3D/Editor/Private/State_Walk.cpp
index 104be8f59..967bbbeba 100644
--- a/Jusin154_Team3D/Editor/Private/State_Walk.cpp
+++ b/Jusin154_Team3D/Editor/Private/State_Walk.cpp
@@ -11,13 +11,13 @@ void CState_Walk::Enter()
{
if(m_pOwner->Check(FSMSTATE::WALK_FWD))
{
- auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::WALK_FWD);
+ auto anim = m_pOwner->Get_AnimInfo(STATEANIM::WALK_FWD);
m_pModel->Set_AnimationIndex(anim.first, anim.second);
}
if (m_pOwner->Check(FSMSTATE::WALK_BWD))
{
- auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::WALK_BWD);
+ auto anim = m_pOwner->Get_AnimInfo(STATEANIM::WALK_BWD);
m_pModel->Set_AnimationIndex(anim.first, anim.second);
}
}
@@ -43,6 +43,9 @@ _bool CState_Walk::CheckExitState()
else if (!m_pOwner->Check(FSMSTATE::WALK))
m_pFSM->Change_State(FSMSTATE::IDLE);
+ if (m_pOwner->Check(FSMSTATE::JUMP))
+ m_pFSM->Change_State(FSMSTATE::JUMP);
+
return false;
}
diff --git a/Jusin154_Team3D/Editor/Private/Terrain.cpp b/Jusin154_Team3D/Editor/Private/Terrain.cpp
index 617f3f48a..34c13f99d 100644
--- a/Jusin154_Team3D/Editor/Private/Terrain.cpp
+++ b/Jusin154_Team3D/Editor/Private/Terrain.cpp
@@ -33,24 +33,30 @@ HRESULT CTerrain::Initialize(void* pArg)
void CTerrain::Priority_Update(_float fTimeDelta)
{
+ GUI::Begin("Picking Position");
+ if (m_pGameInstance->Mouse_Pressing(0))
+ {
+ if (m_pGameInstance->isPicking(&m_vPickingPosition))
+ {
+ m_pVIBufferCom->FitY(m_pTransformCom->Get_XMWorldMatrix(), m_vPickingPosition.y);
+ }
+ }
+ GUI::DragFloat3("Pos", (_float*)(&m_vPickingPosition));
+
+ GUI::End();
}
void CTerrain::Update(_float fTimeDelta)
{
- GUI::Begin("Picking Position");
- if (m_pGameInstance->Mouse_Down(0))
- m_pVIBufferCom->Picking(m_pTransformCom, m_vPickingPosition);
-
- GUI::DragFloat3("Pos", (_float*)(&m_vPickingPosition));
- GUI::End();
+ m_pVIBufferCom->Culling(XMMatrixIdentity());
}
void CTerrain::Late_Update(_float fTimeDelta)
{
- if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
+ //if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
- }
+ //}
}
HRESULT CTerrain::Render()
diff --git a/Jusin154_Team3D/Editor/Public/Broom.h b/Jusin154_Team3D/Editor/Public/Broom.h
new file mode 100644
index 000000000..caebcc248
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Public/Broom.h
@@ -0,0 +1,48 @@
+#pragma once
+
+#include "Editor_Define.h"
+#include "PartObject.h"
+
+NS_BEGIN(Engine)
+class CShader;
+class CModel;
+NS_END
+
+NS_BEGIN(Editor)
+
+class CBroom final : public CGameObject
+{
+private:
+ CBroom(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
+ CBroom(const CBroom& Prototype);
+ virtual ~CBroom() = default;
+
+public:
+ virtual HRESULT Initialize_Prototype() override;
+ virtual HRESULT Initialize(void* pArg) override;
+ virtual void Priority_Update(_float fTimeDelta) override;
+ virtual void Update(_float fTimeDelta) override;
+ virtual void Late_Update(_float fTimeDelta) override;
+ virtual HRESULT Render() override;
+
+private:
+ CShader* m_pShaderCom = { nullptr };
+ CModel* m_pModelCom = { nullptr };
+
+ _bool m_bRimLight = { true };
+ _float m_fRimLightPower = { 3.2f };
+ _float m_fRimLightStrength = { 3.04f };
+ _float3 m_vRimLightColor = { 69.f / 255.f, 5.f / 255.f, 10.f / 255.f };
+
+private:
+ HRESULT Ready_Components();
+ HRESULT Bind_ShaderResources();
+
+public:
+ static CBroom* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
+ virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr) override;
+ virtual void Free() override;
+ virtual void Describe_Entity() override;
+};
+
+NS_END
diff --git a/Jusin154_Team3D/Editor/Public/Dummy_Globe.h b/Jusin154_Team3D/Editor/Public/Dummy_Globe.h
new file mode 100644
index 000000000..0c88bb16d
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Public/Dummy_Globe.h
@@ -0,0 +1,49 @@
+#pragma once
+
+#include "Editor_Define.h"
+#include "GameObject.h"
+
+NS_BEGIN(Engine)
+class CModel;
+class CShader;
+NS_END
+
+NS_BEGIN(Editor)
+
+class CDummy_Globe final : public CGameObject
+{
+public:
+ typedef struct tagGlobeDesc {
+ _wstring wstrKey = {};
+ _float3 vPos = {};
+ }GLOBE_DESC;
+private:
+ CDummy_Globe(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
+ CDummy_Globe(const CDummy_Globe& rhs);
+ virtual ~CDummy_Globe() = default;
+
+public:
+ virtual void Priority_Update(_float fTimeDelta) override;
+ virtual void Update(_float fTimeDelta) override;
+ virtual void Late_Update(_float fTimeDelta) override;
+ virtual HRESULT Render() override;
+
+private:
+ CModel* m_pModelCom = { nullptr };
+ CShader* m_pShaderCom = { nullptr };
+ _bool m_bMRO = { false };
+
+private:
+ virtual HRESULT Initialize_Prototype() override;
+ virtual HRESULT Initialize(void* pArg) override;
+ virtual HRESULT Ready_Components(void* pArg) override;
+ virtual HRESULT Bind_ShaderResources() override;
+
+public:
+ static CDummy_Globe* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
+ virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override;
+ virtual void Free() override;
+ void Describe_Entity() override;
+};
+
+NS_END
diff --git a/Jusin154_Team3D/Editor/Public/Editor_Define.h b/Jusin154_Team3D/Editor/Public/Editor_Define.h
index 3d9a736ee..f4b5f2335 100644
--- a/Jusin154_Team3D/Editor/Public/Editor_Define.h
+++ b/Jusin154_Team3D/Editor/Public/Editor_Define.h
@@ -13,13 +13,13 @@ namespace Editor
const unsigned int g_iWinSizeX = 1920;
const unsigned int g_iWinSizeY = 1080;
- enum class LEVEL { STATIC, LOADING, LOGO, LOBY, GAMEPLAY, RESTART, OBJECT, MAP, UI, EFFECT, PHYSX, END };
+ enum class LEVEL { STATIC, LOADING, LOGO, LOBY, GAMEPLAY, RESTART, OBJECT, MAP, UI, EFFECT, PHYSX, BLOOM, END };
enum class COLLIDABLEOBJECT { PLAYER, MONSTER, HOSTILE_HITBOX, ALLY_HITBOX, NEUTRAL_HITBOX, ENVIRIONMENT, NPC, ITEM, TRIGGERBOX, REGION, NOCOLLIDE, END };
enum class MAPOBJECT_TYPE { CONTAINER, ELEMENT_STATIC, ELEMENT_INTERACT };
enum class SHADER_PASS_ANIM { DEFAULT, SHADOW, CAPTURE, BLUR, END };
enum class SHADER_PASS_CUBE { DEFAULT, SHADOW, BLUR, END };
- enum class SHADER_PASS_MESH { DEFAULT, SHADOW, SKYBOX, ALPHABLEND, EFFECT_ALPHABLEND, EFFECT_BLEND, EFFECT_ALPHABLEND_CULL, EFFECT_BLEND_CULL, CAPTURE, BLUR, EFFECT_ALPHABLEND_UVMOVE, MAPTOOL, END };
+ enum class SHADER_PASS_MESH { DEFAULT, SHADOW, SKYBOX, ALPHABLEND, EFFECT_ALPHABLEND, EFFECT_BLEND, EFFECT_ALPHABLEND_CULL, EFFECT_BLEND_CULL, CAPTURE, BLUR, EFFECT_ALPHABLEND_UVMOVE, MAPTOOL, GLASS, END };
enum class SHADER_PASS_NORTEX { DEFAULT, TERRAIN, END };
enum class SHADER_PASS_PARTICLE { EXPLOSION, END };
enum class SHADER_PASS_POSTEX { DEFAULT, SCISSOR, UI, UVMOVE, TRAIL, END };
diff --git a/Jusin154_Team3D/Editor/Public/Editor_Macro.h b/Jusin154_Team3D/Editor/Public/Editor_Macro.h
index b6589b9d8..0413d1cf1 100644
--- a/Jusin154_Team3D/Editor/Public/Editor_Macro.h
+++ b/Jusin154_Team3D/Editor/Public/Editor_Macro.h
@@ -15,7 +15,6 @@ namespace Editor {
#define FX_POSTEX TEXT("FX_POSTEX")
#define FX_NORTEX TEXT("FX_NORTEX")
#define FX_CELL TEXT("FX_CELL")
-#define FX_DEFERRED TEXT("FX_DEFFERED")
#define FX_PARTICLE TEXT("FX_PARTICLE")
#define FX_INSTANCE_MODEL TEXT("FX_INSTANCE_MODEL")
#define FX_UIEDITOR TEXT("FX_UIEDITOR")
@@ -63,4 +62,4 @@ namespace Editor {
#pragma endregion
-}
\ No newline at end of file
+}
diff --git a/Jusin154_Team3D/Editor/Public/Land.h b/Jusin154_Team3D/Editor/Public/Land.h
index 3daee86ce..9edc3490f 100644
--- a/Jusin154_Team3D/Editor/Public/Land.h
+++ b/Jusin154_Team3D/Editor/Public/Land.h
@@ -34,6 +34,9 @@ class CLand final : public CGameObject
CShader* m_pShaderCom = { nullptr };
CModel* m_pModelCom = { nullptr };
_float4 m_vPosition = {};
+
+ _float4x4 m_ProjMatrix = {};
+ _float4x4 m_ViewMatrix = {};
private:
virtual HRESULT Initialize_Prototype() override;
virtual HRESULT Initialize(void* pArg) override;
diff --git a/Jusin154_Team3D/Editor/Public/Level_BloomViewer.h b/Jusin154_Team3D/Editor/Public/Level_BloomViewer.h
new file mode 100644
index 000000000..028c7e1a8
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Public/Level_BloomViewer.h
@@ -0,0 +1,31 @@
+#pragma once
+
+#include "Editor_Define.h"
+#include "Level.h"
+
+NS_BEGIN(Editor)
+
+class CLevel_BloomViewer final : public CLevel
+{
+private:
+ CLevel_BloomViewer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID);
+ virtual ~CLevel_BloomViewer() = default;
+
+public:
+ virtual void Update(_float fTimeDelta) override;
+ virtual HRESULT Render() override;
+
+private:
+ /* 이 레벨에서 쓰기위한 객체들을 생성한다. */
+ virtual HRESULT Initialize() override;
+ HRESULT Ready_Layer_Camera(const _wstring& strLayerTag);
+ HRESULT Ready_Layer_Light();
+ HRESULT Ready_Layer_UI(const _wstring& strLayerTag);
+ HRESULT Ready_Layer_Effect(const _wstring& strLayerTag);
+
+public:
+ static CLevel_BloomViewer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID);
+ virtual void Free() override;
+};
+
+NS_END
diff --git a/Jusin154_Team3D/Editor/Public/Loader.h b/Jusin154_Team3D/Editor/Public/Loader.h
index 62caaffda..de7392328 100644
--- a/Jusin154_Team3D/Editor/Public/Loader.h
+++ b/Jusin154_Team3D/Editor/Public/Loader.h
@@ -48,6 +48,7 @@ class CLoader final : public CBase
HRESULT Loading_For_UI();
HRESULT Loading_For_Effect();
HRESULT Loading_For_PhysXLevel();
+ HRESULT Loading_For_Bloom();
private:
HRESULT Asset_FileLoad(const _char* pDirectoryPath, const _tchar* pPreName, function AddPrototypeEvent);
diff --git a/Jusin154_Team3D/Editor/Public/Player.h b/Jusin154_Team3D/Editor/Public/Player.h
index 3f33274d5..66b3edc6c 100644
--- a/Jusin154_Team3D/Editor/Public/Player.h
+++ b/Jusin154_Team3D/Editor/Public/Player.h
@@ -26,9 +26,10 @@ class CPlayer final : public CUnit
virtual void Update(_float fTimeDelta) override;
virtual void Late_Update(_float fTimeDelta) override;
virtual HRESULT Render() override;
-
+ _bool Set_Sprint(_bool bSprint) { m_bSprintToggle = bSprint; }
private:
vector m_InputConditions;
+ _bool m_bSprintToggle = { false };
private:
HRESULT Ready_Components();
@@ -48,7 +49,9 @@ class CPlayer final : public CUnit
virtual void Set_FSM();
virtual void Set_Anim();
_bool Check(FSMSTATE::ESTATE state);
-
+ _bool IsSprint();
+public:
+ virtual void Reset_Sprint() { m_bSprintToggle = false; }
#pragma endregion
diff --git a/Jusin154_Team3D/Editor/Public/State_Idle_Turn.h b/Jusin154_Team3D/Editor/Public/State_Idle_Turn.h
new file mode 100644
index 000000000..c39f90ee8
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Public/State_Idle_Turn.h
@@ -0,0 +1,21 @@
+#pragma once
+#include "Editor_Define.h"
+#include "State.h"
+
+class CState_Idle_Turn final : public CState
+{
+public:
+ CState_Idle_Turn();
+ virtual ~CState_Idle_Turn() = default;
+
+public:
+ virtual void Enter();
+ virtual void Update(_float fTimeDelta);
+ virtual void Exit();
+ virtual _bool CheckExitState();
+
+public:
+ virtual void Free() override;
+ virtual void Describe_Entity();
+};
+
diff --git a/Jusin154_Team3D/Editor/Public/State_Jog.h b/Jusin154_Team3D/Editor/Public/State_Jog.h
new file mode 100644
index 000000000..5fa7c5008
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Public/State_Jog.h
@@ -0,0 +1,21 @@
+#pragma once
+#include "Editor_Define.h"
+#include "State.h"
+
+
+class CState_Jog final : public CState
+{
+public:
+ CState_Jog();
+ virtual ~CState_Jog() = default;
+
+public:
+ virtual void Enter();
+ virtual void Update(_float fTimeDelta);
+ virtual void Exit();
+ virtual _bool CheckExitState();
+
+public:
+ virtual void Free() override;
+ virtual void Describe_Entity();
+};
diff --git a/Jusin154_Team3D/Editor/Public/State_Skill2.h b/Jusin154_Team3D/Editor/Public/State_Skill2.h
new file mode 100644
index 000000000..652630d4b
--- /dev/null
+++ b/Jusin154_Team3D/Editor/Public/State_Skill2.h
@@ -0,0 +1,19 @@
+#pragma once
+#include "Editor_Define.h"
+#include "State.h"
+
+class CState_Skill2 final : public CState
+{
+public:
+ CState_Skill2();
+ virtual ~CState_Skill2() = default;
+
+public:
+ virtual void Enter();
+ virtual void Update(_float fTimeDelta);
+ virtual void Exit();
+ virtual _bool CheckExitState();
+public:
+ virtual void Free() override;
+ virtual void Describe_Entity();
+};
diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Constants.hlsli b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Constants.hlsli
new file mode 100644
index 000000000..372ecfae5
--- /dev/null
+++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Constants.hlsli
@@ -0,0 +1,47 @@
+#ifndef ENGINE_SHADER_CONSTANTS_HLSLI
+#define ENGINE_SHADER_CONSTANTS_HLSLI
+
+static const vector g_vMtrlDiffuse = 1.f;
+static const vector g_vMtrlAmbient = 1.f;
+static const vector g_vMtrlSpecular = 1.f;
+
+static const float PI = 3.14159265359;
+static const float PI2 = 6.28318530718;
+
+static const float FLT_EPSILON7 = 1.192092896e-07;
+static const float FLT_EPSILON5 = 1.192092896e-05;
+static const float FLT_EPSILON3 = 1.192092896e-03;
+
+
+static const float AI_TEXTURE_TYPE_NONE = 0.f / 27.f;
+static const float AI_TEXTURE_TYPE_DIFFUSE = 1.f / 27.f;
+static const float AI_TEXTURE_TYPE_SPECULAR = 2.f / 27.f;
+static const float AI_TEXTURE_TYPE_AMBIENT = 3.f / 27.f;
+static const float AI_TEXTURE_TYPE_EMISSIVE = 4.f / 27.f;
+static const float AI_TEXTURE_TYPE_HEIGHT = 5.f / 27.f;
+static const float AI_TEXTURE_TYPE_NORMALS = 6.f / 27.f;
+static const float AI_TEXTURE_TYPE_SHININESS = 7.f / 27.f;
+static const float AI_TEXTURE_TYPE_OPACITY = 8.f / 27.f;
+static const float AI_TEXTURE_TYPE_DISPLACEMENT = 9.f / 27.f;
+static const float AI_TEXTURE_TYPE_LIGHTMAP = 10.f / 27.f;
+static const float AI_TEXTURE_TYPE_REFLECTION = 11.f / 27.f;
+static const float AI_TEXTURE_TYPE_BASE_COLOR = 12.f / 27.f;
+static const float AI_TEXTURE_TYPE_NORMAL_CAMERA = 13.f / 27.f;
+static const float AI_TEXTURE_TYPE_EMISSION_COLOR = 14.f / 27.f;
+static const float AI_TEXTURE_TYPE_METALNESS = 15.f / 27.f;
+static const float AI_TEXTURE_TYPE_DIFFUSE_ROUGHNESS = 16.f / 27.f;
+static const float AI_TEXTURE_TYPE_AMBIENT_OCCLUSION = 17.f / 27.f;
+static const float AI_TEXTURE_TYPE_UNKNOWN = 18.f / 27.f;
+static const float AI_TEXTURE_TYPE_SHEEN = 19.f / 27.f;
+static const float AI_TEXTURE_TYPE_CLEARCOAT = 20.f / 27.f;
+static const float AI_TEXTURE_TYPE_TRANSMISSION = 21.f / 27.f;
+static const float AI_TEXTURE_TYPE_MAYA_BASE = 22.f / 27.f;
+static const float AI_TEXTURE_TYPE_MAYA_SPECULAR = 23.f / 27.f;
+static const float AI_TEXTURE_TYPE_MAYA_SPECULAR_COLOR = 24.f / 27.f;
+static const float AI_TEXTURE_TYPE_MAYA_SPECULAR_ROUGHNESS = 25.f / 27.f;
+static const float AI_TEXTURE_TYPE_ANISOTROPY = 26.f / 27.f;
+static const float AI_TEXTURE_TYPE_GLTF_METALLIC_ROUGHNESS = 27.f / 27.f;
+
+
+
+#endif // ENGINE_SHADER_CONSTANTS_HLSLI
diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Defines.hlsli b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Defines.hlsli
index 077fa26d2..05b918dcc 100644
--- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Defines.hlsli
+++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Defines.hlsli
@@ -1,7 +1,11 @@
+#ifndef ENGINE_SHADER_DEFINES_HLSLI
+#define ENGINE_SHADER_DEFINES_HLSLI
-vector g_vMtrlDiffuse = 1.f;
-vector g_vMtrlAmbient = 1.f;
-vector g_vMtrlSpecular = 1.f;
+#include "Engine_Shader_Constants.hlsli"
+#include "Engine_Shader_Structures.hlsli"
+#include "Engine_Shader_Samplers.hlsli"
+#include "Engine_Shader_States.hlsli"
+#include "Engine_Shader_Functions.hlsli"
float PI = 3.14592;
@@ -256,3 +260,5 @@ float2 UV_Cutting(float2 vUV, float2 vUVCutting, int iCurrentFrame)
return UV;
}
+#endif // ENGINE_SHADER_DEFINES_HLSLI
+
diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli
new file mode 100644
index 000000000..70a63a82d
--- /dev/null
+++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli
@@ -0,0 +1,184 @@
+#ifndef ENGINE_SHADER_FUNCTIONS_HLSLI
+#define ENGINE_SHADER_FUNCTIONS_HLSLI
+
+#include "Engine_Shader_Constants.hlsli"
+#include "Engine_Shader_Structures.hlsli"
+#include "Engine_Shader_Samplers.hlsli"
+
+bool AlmostEqual7(float fA, float fB)
+{
+ return abs(fA - fB) < FLT_EPSILON7;
+}
+bool AlmostEqual5(float fA, float fB)
+{
+ return abs(fA - fB) < FLT_EPSILON5;
+}
+bool AlmostEqual3(float fA, float fB)
+{
+ return abs(fA - fB) < FLT_EPSILON3;
+}
+
+float ShadowVisibility_hwPCF(Texture2D ShadowMap, float4 vLightClip, float2 vShadowMapSize, float bias)
+{
+ float2 uv = float2(vLightClip.x / vLightClip.w, -vLightClip.y / vLightClip.w) * 0.5f + 0.5f;
+ float fDepthCenter = saturate(vLightClip.z / vLightClip.w);
+ float2 vTexel = 1.f / vShadowMapSize;
+
+ float fVisibility = 0.f;
+ for (int v = -1; v <= 1; ++v)
+ {
+ for (int u = -1; u <= 1; ++u)
+ {
+ float2 vOffset = float2(u, v) * vTexel;
+ float fDepth = ShadowMap.Sample(DefaultSampler, uv + vOffset).x;
+ fVisibility += (fDepthCenter - bias > fDepth) ? 0.f : 1.f;
+ }
+ }
+ return fVisibility / 9.f;
+}
+
+float GetRimLight(float3 vCamPosition, float3 vPosition, float3 vNormal, float fRimPower, float fRimStrength)
+{
+ float fRimLight = (1 - dot(normalize(vCamPosition - vPosition), vNormal));
+ fRimLight = pow(fRimLight, fRimPower);
+ fRimLight = fRimLight * fRimStrength;
+ return fRimLight;
+}
+
+float2 Get_MovedUV(float2 vOriginalUV, float fDeltaU, float fDeltaV, uint iIndexU, uint iIndexV)
+{
+ float2 vDelta = float2(fDeltaU, fDeltaV);
+ float2 vOffset = float2(iIndexU * fDeltaU, iIndexV * fDeltaV);
+ return vOriginalUV * vDelta + vOffset;
+}
+
+float2 UV_Cutting(float2 vUV, float2 vUVCutting, int iCurrentFrame)
+{
+ float2 UV = vUV; // 이미지의 UV값
+
+ int iTotalFrame = vUVCutting.x * vUVCutting.y; // 이미지의 최대 프레임 (몇 곱하기 몇인지)
+
+ int iFrameX = iCurrentFrame % (int) vUVCutting.x; // 현재 x축의 위치(현재 이미지의 몇번째 칸을 보여줄 지)
+ int iFrameY = iCurrentFrame / (int) vUVCutting.x; // 현재 y축의 위치(현재 이미지의 몇번째 줄을 보여줄 지)
+
+ float fFreamWidth = 1.0 / vUVCutting.x; // 1.0 나누기 이미지 갯수를 해서 한칸에 얼마나 갈지 정해준다.
+ float fFreamHeight = 1.0 / vUVCutting.y; // 1.0 나누기 이미지 갯수를 해서 한줄에 얼마나 갈지 정해준다.
+
+ UV.x = UV.x * fFreamWidth + iFrameX * fFreamWidth; // 먼저 uv를 0~1이 아닌 0~fFrameWidth로 만든 다음에 한칸씩 옆으로 밀어준다.
+ UV.y = UV.y * fFreamHeight + iFrameY * fFreamHeight; // 먼저 uv를 0~1이 아닌 0~fFrameHeight로 만든 다음에 한줄씩 밑으로 내려준다.
+
+ return UV;
+}
+
+// (Kd F(Lambert)) + (Ks F(cook-torrance))
+
+//float LambertDiffuse(float c)
+//{
+// return c / PI;
+//}
+
+// F(cook-torrance)
+// DFG / (4 (Wo dot N) (Wi dot N))
+
+// D(distribution, NormalDistribution function), 표면의 거칠기에 영향을 받는 halfWay vector
+// G(Geometry, GeometryFunc), 에너지 보존법칙 적용
+// F(Fresnel-Fresnel equation), 표면 각도에 따른 반사율
+
+// F->D
+float NDF_ggxtr(float3 vNormal, float3 vHalfWayVector, float fAlpha) // NormalDistributionGGXTR, (H, halfWay vector), (A, Roughness), (N, Normal)
+{
+ float a2 = fAlpha * fAlpha;
+ float NdotH = saturate(dot(vNormal, vHalfWayVector));
+ float NdotH2 = NdotH * NdotH;
+
+ float nom = a2;
+ float denom = (NdotH2 * (a2 - 1.f) + 1.f);
+
+ denom = PI * denom * denom;
+ return (nom / denom);
+}
+
+// F->G
+// GschlickGGX(n, v, k)
+// k는 이하 두개 조명 조건에 따라 가변적임
+// Direct // Kdir -> ((a + 1) * (a + 1)) / 8 // direct lighting 추천
+// IBL Lighting // Kibl -> a * a / 2 // 이미지 기반 조명기법
+
+float Geometry_SchlickGGX(float NdotV, float fK)
+{
+ return NdotV / (NdotV * (1.0f - fK) + fK);
+}
+
+float Geometry_Smith(float3 vNormal, float3 vFromView, float3 vFromLight, float k)
+{
+ // Geometry Obstruction
+ // 철이 있는, 주로 튀어나온 장애물
+ float NdotV = saturate(dot(vNormal, vFromView));
+
+ // Geometry Shadowing
+ // 요가 있는, 주로 음푹 들어간 장애물 (그래서 셰도잉)
+ float NdotL = saturate(dot(vNormal, vFromLight));
+
+ // 요철이 골고루 있다고 가정하고 적당히 섞음
+ return Geometry_SchlickGGX(NdotV, k) * Geometry_SchlickGGX(NdotL, k);
+}
+
+// F -> F
+float3 Fresnel_Schlick(float cosTheta, float3 F0)
+{
+ // 모서리 부분의 반사
+ return F0 + (1.0f - F0) * pow(1.0f - cosTheta, 5.0f);
+}
+
+PBR_LIGHT_OUT PBR_Lighting(
+ float3 vNormal, float3 vFromView, float3 vFromLight,
+ float3 vAlbedo, float fMetallic, float fRoughness,
+ float3 vLightColor, float fAttenuation, float3 vFO
+) {
+ PBR_LIGHT_OUT Out;
+ Out.vShade = 0;
+ Out.vSpecular = 0;
+
+ float3 vHalfVector = normalize(vFromView + vFromLight);
+ float NdotL = saturate(dot(vNormal, vFromLight));
+ float NdotV = saturate(dot(vNormal, vFromView));
+ if (NdotL <= 0 || NdotV <= 0)
+ {
+ return Out;
+ }
+ float fAlpha = max(fRoughness * fRoughness, 0.04f);
+ float k = ((fRoughness + 1.f) * (fRoughness + 1.f)) / 8.f;
+
+ float D = NDF_ggxtr(vNormal, vHalfVector, fAlpha);
+ float G = Geometry_Smith(vNormal, vFromView, vFromLight, k);
+ float3 F = Fresnel_Schlick(saturate(dot(vHalfVector, vFromView)), vFO);
+
+ float3 vNumerator = D * G * F;
+ float fDenom = max(4.f * NdotL * NdotV, 1e-7);
+ float3 specularBRDF = vNumerator / fDenom;
+
+ float3 kS = F;
+ float3 kD = (1.f - kS) * (1.f -fMetallic);
+
+ //Out.vShade = float(1.f, 1.f, 1. 1.f);
+ Out.vShade = (kD / PI) * (NdotL * fAttenuation) * vLightColor;
+
+ Out.vSpecular = specularBRDF * vLightColor * fAttenuation * NdotL;
+
+ return Out;
+}
+
+float3 DecodeNormalFromRG(Texture2D NormalMap, SamplerState Samp, float2 uv)
+{
+ float2 vSampledRG = (NormalMap.Sample(Samp, uv).rg * 2.f - 1.f);
+
+ float z2 = 1.0f - saturate(dot(vSampledRG, vSampledRG));
+ float z = sqrt(max(z2, 0.0f));
+
+ float3 n = float3(vSampledRG, z);
+
+ return normalize(n);
+}
+
+
+#endif // ENGINE_SHADER_FUNCTIONS_HLSLI
diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Samplers.hlsli b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Samplers.hlsli
new file mode 100644
index 000000000..7b7ec1a3b
--- /dev/null
+++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Samplers.hlsli
@@ -0,0 +1,40 @@
+#ifndef ENGINE_SHADER_SAMPLERS_HLSLI
+#define ENGINE_SHADER_SAMPLERS_HLSLI
+
+sampler DefaultSampler = sampler_state
+{
+ Filter = MIN_MAG_MIP_LINEAR;
+ AddressU = wrap;
+ AddressV = wrap;
+};
+
+sampler ClampSampler = sampler_state
+{
+ Filter = MIN_MAG_MIP_POINT;
+ AddressU = clamp;
+ AddressV = clamp;
+};
+
+sampler MirrorSampler = sampler_state
+{
+ Filter = MIN_MAG_MIP_LINEAR;
+ AddressU = mirror;
+ AddressV = mirror;
+};
+
+sampler BorderZeroSampler = sampler_state
+{
+ Filter = MIN_MAG_MIP_POINT;
+ AddressU = Border;
+ AddressV = Border;
+ BorderColor = float4(0, 0, 0, 0);
+};
+
+sampler PointSampler = sampler_state
+{
+ Filter = MIN_MAG_MIP_POINT;
+ AddressU = wrap;
+ AddressV = wrap;
+};
+
+#endif // ENGINE_SHADER_SAMPLERS_HLSLI
diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_States.hlsli b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_States.hlsli
new file mode 100644
index 000000000..8c6fbe9e9
--- /dev/null
+++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_States.hlsli
@@ -0,0 +1,168 @@
+#ifndef ENGINE_SHADER_STATES_HLSLI
+#define ENGINE_SHADER_STATES_HLSLI
+
+RasterizerState RS_Default
+{
+ FillMode = Solid;
+ CullMode = Back;
+};
+
+RasterizerState RS_Nocull
+{
+ FillMode = Solid;
+ CullMode = None;
+ FrontCounterClockwise = false;
+ DepthClipEnable = false;
+};
+
+RasterizerState RS_Nocull_Wireframe
+{
+ FillMode = Wireframe;
+ CullMode = None;
+ FrontCounterClockwise = false;
+ DepthBias = 0;
+ SlopeScaledDepthBias = 0.f;
+ DepthBiasClamp = 0.f;
+ DepthClipEnable = false;
+ ScissorEnable = false;
+ MultisampleEnable = false;
+ AntialiasedLineEnable = false;
+};
+
+RasterizerState RS_Scissor
+{
+ FillMode = Solid;
+ CullMode = Back;
+ FrontCounterClockwise = false;
+ ScissorEnable = true;
+};
+
+DepthStencilState DSS_Default
+{
+ DepthEnable = true;
+ DepthWriteMask = all;
+ DepthFunc = less_equal;
+};
+
+DepthStencilState DSS_None
+{
+ DepthEnable = false;
+ DepthWriteMask = zero;
+};
+
+DepthStencilState DSS_Effect
+{
+ DepthEnable = true;
+ DepthWriteMask = zero;
+ DepthFunc = less_equal;
+ StencilEnable = false;
+};
+
+BlendState BS_None
+{
+ BlendEnable[0] = false;
+};
+
+BlendState BS_AlphaBlend // ALPHA_BLEND
+{
+ BlendEnable[0] = true;
+ BlendEnable[1] = true;
+ BlendEnable[2] = true;
+ BlendEnable[3] = true;
+ BlendEnable[4] = true;
+ BlendEnable[5] = true;
+ BlendEnable[6] = true;
+ BlendEnable[7] = true;
+
+ // Ac * Aa + Bc * (1 - Aa);
+ SrcBlend = Src_Alpha;
+ DestBlend = Inv_Src_Alpha;
+ BlendOp = Add;
+};
+
+BlendState BS_Blend // ADDITIVE_BLEND
+{
+ BlendEnable[0] = true;
+ BlendEnable[1] = true;
+ BlendEnable[2] = true;
+ BlendEnable[3] = true;
+ BlendEnable[4] = true;
+ BlendEnable[5] = true;
+ BlendEnable[6] = true;
+ BlendEnable[7] = true;
+
+ // Ac * (1) + Bc * (1);
+ SrcBlend = one;
+ DestBlend = one;
+ BlendOp = Add;
+};
+
+BlendState BS_UIBlend
+{
+ BlendEnable[0] = true;
+ BlendEnable[1] = true;
+ BlendEnable[2] = true;
+ BlendEnable[3] = true;
+ BlendEnable[4] = true;
+ BlendEnable[5] = true;
+ BlendEnable[6] = true;
+ BlendEnable[7] = true;
+
+ SrcBlend = Src_Alpha;
+ DestBlend = Inv_Src_Alpha;
+ BlendOp = Add;
+
+ SrcBlendAlpha = One;
+ DestBlendAlpha = Zero;
+ BlendOpAlpha = Add;
+
+ RenderTargetWriteMask[0] = 0x0F; // RGBA 모두 출력
+};
+
+BlendState BS_WB_Acc
+{
+ BlendEnable[0] = true;
+ BlendEnable[1] = true;
+ BlendEnable[2] = true;
+ BlendEnable[3] = true;
+ BlendEnable[4] = true;
+ BlendEnable[5] = true;
+ BlendEnable[6] = true;
+ BlendEnable[7] = true;
+
+ SrcBlend[0] = one;
+ DestBlend[0] = one;
+ BlendOp[0] = Add;
+
+ SrcBlend[1] = Zero;
+ DestBlend[1] = Inv_Src_Alpha;
+ BlendOp[1] = Add;
+
+
+ SrcBlend[2] = one;
+ DestBlend[2] = one;
+ BlendOp[2] = Add;
+};
+
+BlendState BS_WeightBlend
+{
+ BlendEnable[0] = true;
+ BlendEnable[1] = true;
+ BlendEnable[2] = true;
+ BlendEnable[3] = true;
+ BlendEnable[4] = true;
+ BlendEnable[5] = true;
+ BlendEnable[6] = true;
+ BlendEnable[7] = true;
+
+
+ SrcBlend[0] = Src_Alpha;
+ DestBlend[0] = Inv_Src_Alpha;
+
+ BlendOp[0] = Add;
+
+
+
+};
+
+#endif // ENGINE_SHADER_STATES_HLSLI
diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Structures.hlsli b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Structures.hlsli
new file mode 100644
index 000000000..7dcb70724
--- /dev/null
+++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Structures.hlsli
@@ -0,0 +1,10 @@
+#ifndef ENGINE_SHADER_STRUCTURES_HLSLI
+#define ENGINE_SHADER_STRUCTURES_HLSLI
+
+struct PBR_LIGHT_OUT
+{
+ float3 vShade;
+ float3 vSpecular;
+};
+
+#endif // ENGINE_SHADER_STRUCTURES_HLSLI
diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl
index 38eea62d7..a02084c27 100644
--- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl
+++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl
@@ -35,14 +35,13 @@ Texture2D g_BlurTexture;
Texture2D g_BlurXTexture;
Texture2D g_BlurWeightTexture;
+Texture2D g_SurfaceTexture;
vector g_vLightDiffuse;
vector g_vLightAmbient;
vector g_vLightSpecular;
-
-
struct VS_IN
{
float3 vPosition : POSITION;
@@ -56,9 +55,9 @@ struct VS_OUT
};
VS_OUT VS_MAIN(VS_IN In)
{
- VS_OUT Out;
+ VS_OUT Out;
- matrix matWV, matWVP;
+ matrix matWV, matWVP;
matWV = mul(g_WorldMatrix, g_ViewMatrix);
matWVP = mul(matWV, g_ProjMatrix);
@@ -66,7 +65,7 @@ VS_OUT VS_MAIN(VS_IN In)
Out.vPosition = mul(vector(In.vPosition, 1.f), matWVP);
Out.vTexcoord = In.vTexcoord;
- return Out;
+ return Out;
}
struct PS_IN
@@ -99,41 +98,77 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
{
PS_OUT_LIGHT Out;
- vector vNormalDesc = g_NormalTexture.Sample(DefaultSampler, In.vTexcoord);
+ float2 uv = In.vTexcoord;
- float4 vNormal = vector(vNormalDesc.xyz * 2.f - 1.f, 0.0f);
+ // float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1);
+ float3 vNormal = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, uv);
- Out.vShade = g_vLightDiffuse * saturate(max(dot(normalize(g_vLightDir) * -1.f, vNormal), 0.f) + (g_vLightAmbient * g_vMtrlAmbient));
+ float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
- vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
+ float fViewZ = vDepth.y * g_fFar;
- float fViewZ = vDepthDesc.y * g_fFar;
+ float4 vWorldPosition;
+ {
+ vWorldPosition.x = uv.x * 2 - 1;
+ vWorldPosition.y = uv.y * -2 + 1;
+ vWorldPosition.z = vDepth.x;
+ vWorldPosition.w = 1.f;
+ vWorldPosition *= fViewZ;
+ vWorldPosition = mul(vWorldPosition, g_invmatProj);
+ vWorldPosition = mul(vWorldPosition, g_invMatView);
+ }
- vector vPosition;
+ float3 vF0;
+ float fMetallic;
+ float fRoughness;
+ float fOcclusion;
+ float fAttenuation;
-{ // vDepthDesc과 vTexcoord.xy로부터 World Position의 추론
- /* 직육면체의 NDC */
- /* LocalPos * World * View * Proj * ( 1 / w ) */
- vPosition.x = In.vTexcoord.x * 2.f - 1.f;
- vPosition.y = In.vTexcoord.y * -2.f + 1.f;
- vPosition.z = vDepthDesc.x;
- vPosition.w = 1.f;
+ float3 vWPos = vWorldPosition.xyz;
+ float3 vFromView = normalize(vWPos - g_vCamPosition.xyz); // 카메라에서 픽셀로 가는 방향
+ float3 vFromLight = normalize(g_vLightDir.xyz); // 라이트에서 오는 라이트 벡터
- /* [* (1 / w)] 소거*/
- /* z나누기를 되돌림 */
- vPosition = vPosition * fViewZ;
-// vPosition.x = In.vTexcoord.x * 2.f - 1.f * Far;
-// vPosition.y = In.vTexcoord.y * -2.f + 1.f * Far;
-// vPosition.z = vDepthDesc.x * Far;
-// vPosition.w = Far;
+ float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
- vPosition = mul(vPosition, g_invmatProj);
- vPosition = mul(vPosition, g_invMatView);
-}
- vector vLook = vPosition - g_vCamPosition;
- vector vReflect = reflect(normalize(g_vLightDir), vNormal);
+ if (true == AlmostEqual3(vDepth.b, AI_TEXTURE_TYPE_METALNESS)) // Metallic
+ {
+ float3 vMRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb;
+ fMetallic = vMRO.r;
+ fRoughness = vMRO.g;
+ fOcclusion = vMRO.b;
+
+ vF0 = lerp(float3(0.04f, 0.04f, 0.04f), vAlbedo, fMetallic);
+ }
+ else if (true == AlmostEqual3(vDepth.b, AI_TEXTURE_TYPE_SPECULAR)) // Specular
+ {
+ float3 vSRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb;
+ float3 vSpec = vSRO.r;
+
+ fMetallic = 0.f;
+ fRoughness = vSRO.g;
+ fOcclusion = vSRO.b;
+
+
+ vF0 = vSpec.xxx;
+ }
+ else
+ {
+ fMetallic = 0.f;
+ fRoughness = 0.5f;
+ fOcclusion = 1.f;
+ vF0 = float3(0.04f, 0.04f, 0.04f);
+ }
- Out.vSpecular = (g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(normalize(vLook) * -1.f, normalize(vReflect)), 0.f), 50.f);
+ fAttenuation = 1.f;
+
+ float fDiffuseAOStrength = lerp(0.3f, 1.f, fOcclusion);
+
+ PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vFromView, vFromLight, vAlbedo, fMetallic, fRoughness, g_vLightDiffuse.rgb, fAttenuation, vF0);
+
+ PBR_Out.vShade *= fDiffuseAOStrength;
+
+ Out.vShade = float4(PBR_Out.vShade, 1.f);
+ Out.vSpecular = float4(PBR_Out.vSpecular, 1.f);
return Out;
}
@@ -142,38 +177,81 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
{
PS_OUT_LIGHT Out;
- vector vNormalDesc = g_NormalTexture.Sample(DefaultSampler, In.vTexcoord);
+ float2 uv = In.vTexcoord;
- float4 vNormal = vector(vNormalDesc.xyz * 2.f - 1.f, 0.f);
+ float3 vNormal = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, uv);
- vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
- float fViewZ = vDepthDesc.y * g_fFar;
+ float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
- vector vPosition;
- /* 0 ~ 1 에서 -1 ~ 1 */
- vPosition.x = In.vTexcoord.x * 2.f - 1.f;
- vPosition.y = In.vTexcoord.y * -2.f + 1.f;
- vPosition.z = vDepthDesc.x;
- vPosition.w = 1.f;
- vPosition = vPosition * fViewZ;
- vPosition = mul(vPosition, g_invmatProj);
- vPosition = mul(vPosition, g_invMatView);
+ float fViewZ = vDepth.y * g_fFar;
- vector vLightDir = vPosition - (g_vLightPos + g_vLightPosOffset);
- float fDistance = length(vLightDir);
- float fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange);
- if (fAttenuation <= 0.f)
+ float4 vWorldPosition;
{
- discard;
+ vWorldPosition.x = uv.x * 2 - 1;
+ vWorldPosition.y = uv.y * -2 + 1;
+ vWorldPosition.z = vDepth.x;
+ vWorldPosition.w = 1.f;
+ vWorldPosition *= fViewZ;
+ vWorldPosition = mul(vWorldPosition, g_invmatProj);
+ vWorldPosition = mul(vWorldPosition, g_invMatView);
}
- vLightDir = normalize(vLightDir);
- Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vLightDir * -1.f, vNormal), 0.f) + (g_vLightAmbient * g_vMtrlAmbient)));
+ float3 vWPos = vWorldPosition.xyz;
+ float3 vFromView = normalize(vWPos - g_vCamPosition.xyz); // 카메라에서 픽셀로 가는 방향
+ float3 vFromLight = normalize(g_vLightDir.xyz); // 라이트에서 오는 라이트 벡터
- vector vLook = vPosition - g_vCamPosition;
- vector vReflect = reflect(vLightDir, vNormal);
+ float3 vF0;
+ float fMetallic;
+ float fRoughness;
+ float fOcclusion;
+ float fAttenuation;
- Out.vSpecular = fAttenuation * ((g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(normalize(vLook) * -1.f, normalize(vReflect)), 0.f), 50.f));
+ {
+ float fDistance = length(vFromLight);
+ fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange);
+ if (fAttenuation <= 0.f)
+ {
+ discard;
+ }
+ }
+
+ float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
+
+ if (true == AlmostEqual3(vDepth.b, AI_TEXTURE_TYPE_METALNESS)) // Metallic
+ {
+ float3 vMRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb;
+ fMetallic = vMRO.r;
+ fRoughness = vMRO.g;
+ fOcclusion = vMRO.b;
+
+ vF0 = lerp(float3(0.04f, 0.04f, 0.04f), vAlbedo, fMetallic);
+ }
+ else if (true == AlmostEqual3(vDepth.b, AI_TEXTURE_TYPE_SPECULAR)) // Specular
+ {
+ float3 vSRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb;
+ float3 vSpec = vSRO.r;
+
+ fMetallic = 0.f;
+ fRoughness = vSRO.g;
+ fOcclusion = vSRO.b;
+
+
+ vF0 = vSpec.xxx;
+ }
+ else
+ {
+ fMetallic = 0.f;
+ fRoughness = 0.5f;
+ fOcclusion = 1.f;
+ vF0 = float3(0.04f, 0.04f, 0.04f);
+ }
+
+ PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vFromView, vFromLight,
+ vAlbedo, fMetallic, fRoughness,
+ g_vLightDiffuse.rgb, fAttenuation, vF0);
+
+ Out.vShade = float4(PBR_Out.vShade, 1.f);
+ Out.vSpecular = float4(PBR_Out.vSpecular, 1.f);
return Out;
}
@@ -182,46 +260,85 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
{
PS_OUT_LIGHT Out;
- vector vNormalDesc = g_NormalTexture.Sample(DefaultSampler, In.vTexcoord);
+ float2 uv = In.vTexcoord;
- float4 vNormal = vector(vNormalDesc.xyz * 2.f - 1.f, 0.f);
+ float3 vNormal = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, uv);
- vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
- float fViewZ = vDepthDesc.y * g_fFar;
+ float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
- vector vPosition;
- /* 0 ~ 1 에서 -1 ~ 1 */
- vPosition.x = In.vTexcoord.x * 2.f - 1.f;
- vPosition.y = In.vTexcoord.y * -2.f + 1.f;
- vPosition.z = vDepthDesc.x;
- vPosition.w = 1.f;
- vPosition = vPosition * fViewZ;
- vPosition = mul(vPosition, g_invmatProj);
- vPosition = mul(vPosition, g_invMatView);
+ float fViewZ = vDepth.y * g_fFar;
- vector vLightDir = vPosition - g_vLightPos;
- float fDistance = length(vLightDir);
- float fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange);
- if (fAttenuation <= 0.f)
+ float4 vWorldPosition;
{
- discard;
+ vWorldPosition.x = uv.x * 2 - 1;
+ vWorldPosition.y = uv.y * -2 + 1;
+ vWorldPosition.z = vDepth.x;
+ vWorldPosition.w = 1.f;
+ vWorldPosition *= fViewZ;
+ vWorldPosition = mul(vWorldPosition, g_invmatProj);
+ vWorldPosition = mul(vWorldPosition, g_invMatView);
}
- vLightDir = normalize(vLightDir);
- vector vSpotDir = normalize(g_vLightDir);
- float fCosAngle = dot(vLightDir, vSpotDir);
+
+ float3 vWPos = vWorldPosition.xyz;
+ float3 vFromView = normalize(vWPos - g_vCamPosition.xyz); // 카메라에서 픽셀로 가는 방향
+ float3 vFromLight = normalize(g_vLightDir.xyz); // 라이트에서 오는 라이트 벡터
+
+ float3 vF0;
+ float fMetallic;
+ float fRoughness;
+ float fOcclusion;
+ float fAttenuation;
+ {
+ float fDistance = length(vFromLight);
+ fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange);
+ if (fAttenuation <= 0.f)
+ {
+ discard;
+ }
+ }
+ float fCosAngle = dot(vFromLight, g_vLightDir.xyz);
if (fCosAngle < g_fSpotOuterAngle)
{
discard;
}
- float fSpotAttenenuation = saturate((fCosAngle - g_fSpotInnerAngle) / (g_fSpotInnerAngle - g_fSpotOuterAngle));
+ float fSpotAttenenuation = saturate((fCosAngle - g_fSpotInnerAngle) / (g_fSpotInnerAngle - g_fSpotOuterAngle));
fAttenuation *= fSpotAttenenuation;
- Out.vShade = fAttenuation * (g_vLightDiffuse * saturate(max(dot(vLightDir * -1.f, vNormal), 0.f) + (g_vLightAmbient * g_vMtrlAmbient)));
+ float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
- vector vLook = vPosition - g_vCamPosition;
- vector vReflect = reflect(vLightDir, vNormal);
+ if (true == AlmostEqual3(vDepth.b, AI_TEXTURE_TYPE_METALNESS)) // Metallic
+ {
+ float3 vMRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb;
+ fMetallic = vMRO.r;
+ fRoughness = vMRO.g;
+ fOcclusion = vMRO.b;
+
+ vF0 = lerp(float3(0.04f, 0.04f, 0.04f), vAlbedo, fMetallic);
+ }
+ else if (true == AlmostEqual3(vDepth.b, AI_TEXTURE_TYPE_SPECULAR)) // Specular
+ {
+ float3 vSRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb;
+ float3 vSpec = vSRO.r;
+
+ fMetallic = 0.f;
+ fRoughness = vSRO.g;
+ fOcclusion = vSRO.b;
+
+
+ vF0 = vSpec.xxx;
+ }
+ else
+ {
+ fMetallic = 0.f;
+ fRoughness = 0.5f;
+ fOcclusion = 1.f;
+ vF0 = float3(0.04f, 0.04f, 0.04f);
+ }
- Out.vSpecular = fAttenuation * ((g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(normalize(vLook) * -1.f, normalize(vReflect)), 0.f), 50.f));
+ PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vFromView, vFromLight, vAlbedo, fMetallic, fRoughness, g_vLightDiffuse.rgb, fAttenuation, vF0);
+
+ Out.vShade = float4(PBR_Out.vShade, 1.f);
+ Out.vSpecular = float4(PBR_Out.vSpecular, 1.f);
return Out;
}
@@ -271,6 +388,7 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
vPosition = mul(vPosition, g_invmatProj);
vPosition = mul(vPosition, g_invMatView);
vPreShadowPosition = vPosition;
+
/* (로컬위치 * 월드) -> (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 ) */
vPosition = mul(vPosition, g_LightViewMatrix);
vPosition = mul(vPosition, g_LightProjMatrix);
@@ -377,7 +495,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X(PS_IN In)
vColor += g_fWeights[i + 15] * g_BlurTexture.Sample(ClampSampler, vTexcoord);
}
- Out.vBlurX = vColor;
+ Out.vBlurX = vColor;
return Out;
}
@@ -385,7 +503,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X(PS_IN In)
technique11 DefaultTechnique
{
- pass DebugPass
+ pass DebugPass // 0
{
SetRasterizerState(RS_Default);
SetDepthStencilState(DSS_Default, 0);
@@ -395,7 +513,7 @@ technique11 DefaultTechnique
PixelShader = compile ps_5_0 PS_MAIN_DEBUG();
}
- pass DirectionalPass
+ pass DirectionalPass // 1
{
SetRasterizerState(RS_Default);
SetDepthStencilState(DSS_None, 0);
@@ -405,7 +523,7 @@ technique11 DefaultTechnique
PixelShader = compile ps_5_0 PS_MAIN_DIRECTIONAL();
}
- pass PointPass
+ pass PointPass // 2
{
SetRasterizerState(RS_Default);
SetDepthStencilState(DSS_None, 0);
@@ -415,7 +533,7 @@ technique11 DefaultTechnique
PixelShader = compile ps_5_0 PS_MAIN_POINT();
}
- pass CombinedPass
+ pass CombinedPass // 3
{
SetRasterizerState(RS_Default);
SetDepthStencilState(DSS_None, 0);
@@ -425,7 +543,7 @@ technique11 DefaultTechnique
PixelShader = compile ps_5_0 PS_MAIN_COMBINED();
}
- pass BlurPass
+ pass BlurPass // 4
{
SetRasterizerState(RS_Default);
SetDepthStencilState(DSS_None, 0);
@@ -435,7 +553,7 @@ technique11 DefaultTechnique
PixelShader = compile ps_5_0 PS_MAIN_BLUR_X();
}
- pass SpotPass
+ pass SpotPass // 5
{
SetRasterizerState(RS_Default);
SetDepthStencilState(DSS_None, 0);
diff --git a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_PBR.hlsl b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_PBR.hlsl
new file mode 100644
index 000000000..919c44c67
--- /dev/null
+++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Shader_PBR.hlsl
@@ -0,0 +1,544 @@
+#include "Engine_Shader_Defines.hlsli"
+
+matrix g_WorldMatrix, g_ViewMatrix, g_ProjMatrix;
+matrix g_invMatView, g_invmatProj;
+matrix g_LightViewMatrix, g_LightProjMatrix;
+matrix g_PreShadowLightViewMatrix, g_PreShadowLightProjMatrix;
+
+float g_fFar;
+float g_fPreShadowFar;
+uint g_iMaxShadowWidth;
+uint g_iMaxShadowHeight;
+float2 g_vResolution;
+
+Texture2D g_Texture;
+
+float g_fLightRange;
+float g_fSpotInnerAngle;
+float g_fSpotOuterAngle;
+
+vector g_vLightDir;
+vector g_vLightPos;
+vector g_vLightPosOffset;
+
+vector g_vCamPosition;
+
+
+Texture2D g_NormalTexture;
+Texture2D g_DiffuseTexture;
+Texture2D g_ShadeTexture;
+Texture2D g_DepthTexture;
+Texture2D g_SpecularTexture;
+Texture2D g_ShadowTexture;
+Texture2D g_PreShadowTexture;
+Texture2D g_BlurTexture;
+Texture2D g_BlurXTexture;
+Texture2D g_BlurWeightTexture;
+
+Texture2D g_MROTexture;
+Texture2D g_SROTexture;
+
+
+vector g_vLightDiffuse;
+vector g_vLightAmbient;
+vector g_vLightSpecular;
+
+struct VS_IN
+{
+ float3 vPosition : POSITION;
+ float2 vTexcoord : TEXCOORD0;
+};
+
+struct VS_OUT
+{
+ float4 vPosition : SV_POSITION;
+ float2 vTexcoord : TEXCOORD0;
+};
+VS_OUT VS_MAIN(VS_IN In)
+{
+ VS_OUT Out;
+
+ matrix matWV, matWVP;
+
+ matWV = mul(g_WorldMatrix, g_ViewMatrix);
+ matWVP = mul(matWV, g_ProjMatrix);
+
+ Out.vPosition = mul(vector(In.vPosition, 1.f), matWVP);
+ Out.vTexcoord = In.vTexcoord;
+
+ return Out;
+}
+
+struct PS_IN
+{
+ float4 vPosition : SV_POSITION;
+ float2 vTexcoord : TEXCOORD0;
+};
+
+struct PS_OUT_BACKBUFFER
+{
+ float4 vBackBuffer : SV_TARGET0;
+};
+
+PS_OUT_BACKBUFFER PS_MAIN_DEBUG(PS_IN In)
+{
+ PS_OUT_BACKBUFFER Out;
+
+ Out.vBackBuffer = g_Texture.Sample(DefaultSampler, In.vTexcoord);
+
+ return Out;
+}
+
+struct PS_OUT_LIGHT
+{
+ vector vShade : SV_TARGET0;
+ vector vSpecular : SV_TARGET1;
+};
+
+PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
+{
+ PS_OUT_LIGHT Out;
+
+ float2 uv = In.vTexcoord;
+
+ float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1);
+
+ float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
+
+ float fViewZ = vDepth.y * g_fFar;
+
+ float4 vWorldPosition;
+ {
+ vWorldPosition.x = uv.x * 2 - 1;
+ vWorldPosition.y = uv.y * -2 + 1;
+ vWorldPosition.z = vDepth.x;
+ vWorldPosition.w = 1.f;
+ vWorldPosition *= fViewZ;
+ vWorldPosition = mul(vWorldPosition, g_invmatProj);
+ vWorldPosition = mul(vWorldPosition, g_invMatView);
+ }
+
+ float3 vF0;
+ float fMetallic;
+ float fRoughness;
+ float fOcclusion;
+ float fAttenuation;
+
+ float3 vWPos = vWorldPosition.xyz;
+ float3 vFromView = normalize(vWPos - g_vCamPosition.xyz); // 카메라에서 픽셀로 가는 방향
+ float3 vFromLight = normalize(g_vLightDir.xyz); // 라이트에서 오는 라이트 벡터
+
+ float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
+
+ if (1 == vDepth.b) // Metallic
+ {
+ float3 vMRO = g_MROTexture.Sample(DefaultSampler, uv).rgb;
+ fMetallic = vMRO.r;
+ fRoughness = vMRO.g;
+ fOcclusion = vMRO.b;
+
+ vF0 = lerp(float3(0.04f, 0.04f, 0.04f), vAlbedo, fMetallic);
+ }
+ else // Specular
+ {
+ float3 vSRO = g_MROTexture.Sample(DefaultSampler, uv).rgb;
+ float3 vSpec = vSRO.r;
+
+ fMetallic = 0.f;
+ fRoughness = vSRO.g;
+ fOcclusion = vSRO.b;
+
+
+ vF0 = vSpec.xxx;
+ }
+
+ fAttenuation = 1.f;
+
+ float fDiffuseAOStrength = lerp(0.3f, 1.f, fOcclusion);
+
+ PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vFromView, vFromLight, vAlbedo, fMetallic, fRoughness, g_vLightDiffuse.rgb, fAttenuation, vF0);
+
+ PBR_Out.vShade *= fDiffuseAOStrength;
+
+ Out.vShade = float4(PBR_Out.vShade, 1.f);
+ Out.vSpecular = float4(PBR_Out.vSpecular, 1.f);
+
+ return Out;
+}
+
+PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
+{
+ PS_OUT_LIGHT Out;
+
+ float2 uv = In.vTexcoord;
+
+ float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1);
+
+ float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
+
+ float fViewZ = vDepth.y * g_fFar;
+
+ float4 vWorldPosition;
+ {
+ vWorldPosition.x = uv.x * 2 - 1;
+ vWorldPosition.y = uv.y * -2 + 1;
+ vWorldPosition.z = vDepth.x;
+ vWorldPosition.w = 1.f;
+ vWorldPosition *= fViewZ;
+ vWorldPosition = mul(vWorldPosition, g_invmatProj);
+ vWorldPosition = mul(vWorldPosition, g_invMatView);
+ }
+
+ float3 vWPos = vWorldPosition.xyz;
+ float3 vFromView = normalize(vWPos - g_vCamPosition.xyz); // 카메라에서 픽셀로 가는 방향
+ float3 vFromLight = normalize(g_vLightDir.xyz); // 라이트에서 오는 라이트 벡터
+
+ float3 vF0;
+ float fMetallic;
+ float fRoughness;
+ float fOcclusion;
+ float fAttenuation;
+
+ {
+ float fDistance = length(vFromLight);
+ fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange);
+ if (fAttenuation <= 0.f)
+ {
+ discard;
+ }
+ }
+
+ float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
+
+ if (1 == vDepth.b) // Metallic
+ {
+ float3 vMRO = g_MROTexture.Sample(DefaultSampler, uv).rgb;
+ fMetallic = vMRO.r;
+ fRoughness = vMRO.g;
+ fOcclusion = vMRO.b;
+
+ vF0 = lerp(float3(0.04f, 0.04f, 0.04f), vAlbedo, fMetallic);
+ }
+ else // Specular
+ {
+ float3 vSRO = g_MROTexture.Sample(DefaultSampler, uv).rgb;
+ float3 vSpec = vSRO.r;
+
+ fMetallic = 0.f;
+ fRoughness = vSRO.g;
+ fOcclusion = vSRO.b;
+
+
+ vF0 = vSpec.xxx;
+ }
+
+ PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vFromView, vFromLight,
+ vAlbedo, fMetallic, fRoughness,
+ g_vLightDiffuse.rgb, fAttenuation, vF0);
+
+ Out.vShade = float4(PBR_Out.vShade, 1.f);
+ Out.vSpecular = float4(PBR_Out.vSpecular, 1.f);
+
+ return Out;
+}
+
+PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
+{
+ PS_OUT_LIGHT Out;
+
+ float2 uv = In.vTexcoord;
+
+ float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1);
+
+ float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv);
+
+ float fViewZ = vDepth.y * g_fFar;
+
+ float4 vWorldPosition;
+ {
+ vWorldPosition.x = uv.x * 2 - 1;
+ vWorldPosition.y = uv.y * -2 + 1;
+ vWorldPosition.z = vDepth.x;
+ vWorldPosition.w = 1.f;
+ vWorldPosition *= fViewZ;
+ vWorldPosition = mul(vWorldPosition, g_invmatProj);
+ vWorldPosition = mul(vWorldPosition, g_invMatView);
+ }
+
+ float3 vWPos = vWorldPosition.xyz;
+ float3 vFromView = normalize(vWPos - g_vCamPosition.xyz); // 카메라에서 픽셀로 가는 방향
+ float3 vFromLight = normalize(g_vLightDir.xyz); // 라이트에서 오는 라이트 벡터
+
+ float3 vF0;
+ float fMetallic;
+ float fRoughness;
+ float fOcclusion;
+ float fAttenuation;
+ {
+ float fDistance = length(vFromLight);
+ fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange);
+ if (fAttenuation <= 0.f)
+ {
+ discard;
+ }
+ }
+ float fCosAngle = dot(vFromLight, g_vLightDir.xyz);
+ if (fCosAngle < g_fSpotOuterAngle)
+ {
+ discard;
+ }
+ float fSpotAttenenuation = saturate((fCosAngle - g_fSpotInnerAngle) / (g_fSpotInnerAngle - g_fSpotOuterAngle));
+ fAttenuation *= fSpotAttenenuation;
+
+ float3 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb;
+
+ if (1 == vDepth.b) // Metallic
+ {
+ float3 vMRO = g_MROTexture.Sample(DefaultSampler, uv).rgb;
+ fMetallic = vMRO.r;
+ fRoughness = vMRO.g;
+ fOcclusion = vMRO.b;
+
+ vF0 = lerp(float3(0.04f, 0.04f, 0.04f), vAlbedo, fMetallic);
+ }
+ else // Specular
+ {
+ float3 vSRO = g_MROTexture.Sample(DefaultSampler, uv).rgb;
+ float3 vSpec = vSRO.r;
+
+ fMetallic = 0.f;
+ fRoughness = vSRO.g;
+ fOcclusion = vSRO.b;
+
+
+ vF0 = vSpec.xxx;
+ }
+
+ PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vFromView, vFromLight, vAlbedo, fMetallic, fRoughness, g_vLightDiffuse.rgb, fAttenuation, vF0);
+
+ Out.vShade = float4(PBR_Out.vShade, 1.f);
+ Out.vSpecular = float4(PBR_Out.vSpecular, 1.f);
+
+ return Out;
+}
+
+float g_fWeights[32] =
+{
+ 0.000400, 0.000700, 0.001200, 0.002000, 0.003200, 0.005000, 0.007500, 0.011000,
+ 0.015700, 0.021700, 0.029000, 0.037300, 0.046200, 0.055200, 0.063600, 0.070800,
+ 0.075900, 0.078500, 0.078500, 0.075900, 0.070800, 0.063600, 0.055200, 0.046200,
+ 0.037300, 0.029000, 0.021700, 0.015700, 0.011000, 0.007500, 0.005000, 0.003200
+};
+
+
+PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
+{
+ PS_OUT_BACKBUFFER Out;
+
+ vector vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord);
+
+ if (0.f == vDiffuse.a)
+ {
+ discard;
+ }
+
+ vector vShade = g_ShadeTexture.Sample(DefaultSampler, In.vTexcoord);
+
+ vector vSpecular = g_SpecularTexture.Sample(DefaultSampler, In.vTexcoord);
+
+ Out.vBackBuffer = vDiffuse * vShade + vSpecular;
+
+ vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
+
+
+ float fViewZ = vDepthDesc.y * g_fFar;
+
+
+ vector vPosition, vPreShadowPosition;
+
+ /* (로컬위치 * 월드 * 뷰 * 투영 / w) -> (로컬위치 * 월드) */
+ vPosition.x = In.vTexcoord.x * 2.f - 1.f;
+ vPosition.y = In.vTexcoord.y * -2.f + 1.f;
+ vPosition.z = vDepthDesc.x;
+ vPosition.w = 1.f;
+
+ vPosition = vPosition * fViewZ;
+
+ vPosition = mul(vPosition, g_invmatProj);
+ vPosition = mul(vPosition, g_invMatView);
+ vPreShadowPosition = vPosition;
+
+ /* (로컬위치 * 월드) -> (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 ) */
+ vPosition = mul(vPosition, g_LightViewMatrix);
+ vPosition = mul(vPosition, g_LightProjMatrix);
+ vPreShadowPosition = mul(vPreShadowPosition, g_PreShadowLightViewMatrix);
+ vPreShadowPosition = mul(vPreShadowPosition, g_PreShadowLightProjMatrix);
+
+ /* (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 ) -> (로컬위치 * 월드 * 광원의 뷰 * 광원의 투영 * (/w) */
+ float2 vTexcoord, vPreShadowTexcoord;
+ vTexcoord.x = (vPosition.x / vPosition.w) * 0.5f + 0.5f;
+ vTexcoord.y = (vPosition.y / vPosition.w) * -0.5f + 0.5f;
+ vPreShadowTexcoord.x = (vPreShadowPosition.x / vPreShadowPosition.w) * 0.5f + 0.5f;
+ vPreShadowTexcoord.y = (vPreShadowPosition.y / vPreShadowPosition.w) * -0.5f + 0.5f;
+
+ /* 광원의 NDC에서 샘플링 */
+ float fVisibility_Dynamic = ShadowVisibility_hwPCF(g_ShadowTexture, vPosition, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), 0.0005f);
+ float fVisibility_Static = ShadowVisibility_hwPCF(g_PreShadowTexture, vPreShadowPosition, float2(g_iMaxShadowWidth, g_iMaxShadowHeight), 0.0005f);
+
+ Out.vBackBuffer.rgb *= lerp(0.5f, 1.f, min(fVisibility_Dynamic, fVisibility_Static));
+ //float fShadowDepth = g_ShadowTexture.Sample(DefaultSampler, vTexcoord).x;
+ //float fPreShadowDepth = g_PreShadowTexture.Sample(DefaultSampler, vPreShadowTexcoord).x;
+ //bool IsShadow = { false };
+ //if (vPosition.z - 0.0005f > fShadowDepth)
+ //{
+ // IsShadow = true;
+ //}
+ //if (vPreShadowPosition.z - 0.0005f > fPreShadowDepth)
+ //{
+ // IsShadow = true;
+ //}
+ //if (true == IsShadow)
+ //{
+ // Out.vBackBuffer *= 0.5f;
+ //}
+ float4 vColor = 0.f;
+
+ //int iBlurWeight = g_BlurWeightTexture.Sample(ClampSampler, In.vTexcoord).r * 32.f;
+
+ //int iBlurMin;
+ //int iBlurMax;
+
+ //if (iBlurWeight % 2 == 0)
+ //{
+ // iBlurMin = -1 * iBlurWeight / 2;
+ // iBlurMax = iBlurWeight / 2;
+ //}
+ //else
+ //{
+ // iBlurMin = -iBlurWeight / 2;
+ // iBlurMax = iBlurWeight / 2 + 1;
+ //}
+
+ //[loop] // 변수로 루프돌리려면 반드시 필요함
+ for (int i = -15; i < 16; ++i)
+ {
+ vTexcoord.x = In.vTexcoord.x;
+ vTexcoord.y = In.vTexcoord.y + (float) i / g_vResolution.y;
+
+ vColor += g_fWeights[i + 15] * g_BlurXTexture.Sample(ClampSampler, vTexcoord);
+ }
+
+ Out.vBackBuffer += vColor;
+
+ return Out;
+}
+
+struct PS_OUT_BLUR_X
+{
+ float4 vBlurX : SV_TARGET0;
+};
+
+
+PS_OUT_BLUR_X PS_MAIN_BLUR_X(PS_IN In)
+{
+ PS_OUT_BLUR_X Out;
+
+ float2 vTexcoord;
+ float4 vColor = 0.f;
+
+ //TODO 블러 조절 해보려햇는데 실패함..
+
+ //int iBlurWeight = g_BlurWeightTexture.Sample(ClampSampler, In.vTexcoord).r * 32.f;
+
+ //int iBlurMin;
+ //int iBlurMax;
+
+ //if (iBlurWeight % 2 == 0)
+ //{
+ // iBlurMin = -1 * iBlurWeight / 2;
+ // iBlurMax = iBlurWeight / 2;
+ //}
+ //else
+ //{
+ // iBlurMin = -iBlurWeight / 2;
+ // iBlurMax = iBlurWeight / 2 + 1;
+ //}
+
+ //[loop] // 변수로 루프돌리려면 반드시 필요함
+
+ for (int i = -15; i < 16; ++i)
+ {
+ vTexcoord.x = In.vTexcoord.x + (float) i / g_vResolution.x;
+ vTexcoord.y = In.vTexcoord.y;
+
+ vColor += g_fWeights[i + 15] * g_BlurTexture.Sample(ClampSampler, vTexcoord);
+ }
+
+ Out.vBlurX = vColor;
+
+ return Out;
+}
+
+
+technique11 DefaultTechnique
+{
+ pass DebugPass // 0
+ {
+ SetRasterizerState(RS_Default);
+ SetDepthStencilState(DSS_Default, 0);
+ SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
+ VertexShader = compile vs_5_0 VS_MAIN();
+ GeometryShader = NULL;
+ PixelShader = compile ps_5_0 PS_MAIN_DEBUG();
+ }
+
+ pass DirectionalPass // 1
+ {
+ SetRasterizerState(RS_Default);
+ SetDepthStencilState(DSS_None, 0);
+ SetBlendState(BS_Blend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
+ VertexShader = compile vs_5_0 VS_MAIN();
+ GeometryShader = NULL;
+ PixelShader = compile ps_5_0 PS_MAIN_DIRECTIONAL();
+ }
+
+ pass PointPass // 2
+ {
+ SetRasterizerState(RS_Default);
+ SetDepthStencilState(DSS_None, 0);
+ SetBlendState(BS_Blend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
+ VertexShader = compile vs_5_0 VS_MAIN();
+ GeometryShader = NULL;
+ PixelShader = compile ps_5_0 PS_MAIN_POINT();
+ }
+
+ pass CombinedPass // 3
+ {
+ SetRasterizerState(RS_Default);
+ SetDepthStencilState(DSS_None, 0);
+ SetBlendState(BS_None, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
+ VertexShader = compile vs_5_0 VS_MAIN();
+ GeometryShader = NULL;
+ PixelShader = compile ps_5_0 PS_MAIN_COMBINED();
+ }
+
+ pass BlurPass // 4
+ {
+ SetRasterizerState(RS_Default);
+ SetDepthStencilState(DSS_None, 0);
+ SetBlendState(BS_Blend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
+ VertexShader = compile vs_5_0 VS_MAIN();
+ GeometryShader = NULL;
+ PixelShader = compile ps_5_0 PS_MAIN_BLUR_X();
+ }
+
+ pass SpotPass // 5
+ {
+ SetRasterizerState(RS_Default);
+ SetDepthStencilState(DSS_None, 0);
+ SetBlendState(BS_Blend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
+ VertexShader = compile vs_5_0 VS_MAIN();
+ GeometryShader = NULL;
+ PixelShader = compile ps_5_0 PS_MAIN_SPOT();
+ }
+}
diff --git a/Jusin154_Team3D/Engine/Default/Engine.vcxproj b/Jusin154_Team3D/Engine/Default/Engine.vcxproj
index 2430cdce9..297e225b6 100644
--- a/Jusin154_Team3D/Engine/Default/Engine.vcxproj
+++ b/Jusin154_Team3D/Engine/Default/Engine.vcxproj
@@ -207,6 +207,7 @@ call Update_Lib.bat
+
true
true
@@ -298,6 +299,7 @@ call Update_Lib.bat
+
@@ -418,6 +420,7 @@ call Update_Lib.bat
+
true
true
@@ -541,6 +544,7 @@ call Update_Lib.bat
+
@@ -559,7 +563,36 @@ call Update_Lib.bat
-
+
+ Document
+
+
+
+
+ Document
+
+
+
+
+ Document
+
+
+
+
+ Document
+
+
+
+
+ Document
+
+
+
+
+ Document
+
+
+
diff --git a/Jusin154_Team3D/Engine/Default/Engine.vcxproj.filters b/Jusin154_Team3D/Engine/Default/Engine.vcxproj.filters
index 918b88407..99f6ac3c8 100644
--- a/Jusin154_Team3D/Engine/Default/Engine.vcxproj.filters
+++ b/Jusin154_Team3D/Engine/Default/Engine.vcxproj.filters
@@ -264,7 +264,7 @@
{a4560f1b-c4f4-4705-bbf8-6a60977d3211}
-
+
{b3742605-653a-4bdf-bad9-329d993e7f52}
@@ -277,6 +277,15 @@
{dae29f0c-1727-4423-a3ca-9ef27460520b}
+
+ {1e10fa90-da5b-4285-a7a3-c4211b4cccbb}
+
+
+ {701cf231-2892-4d72-9615-dbe9285c28f4}
+
+
+ {d9f03f43-e9d1-4a50-b465-e1000462bd3e}
+
@@ -512,7 +521,7 @@
02.Element\01.GameObject\Unit
-
+
02.Element\02.Component\02.VIBuffer\Instance\UI_nstance
@@ -525,6 +534,12 @@
02.Element\02.Component\02.VIBuffer\Trail
+
+ 02.Element\02.Component\02.VIBuffer\Terrain\QuadTree
+
+
+ 00.System\02.ThreadHolder
+
@@ -1126,7 +1141,7 @@
02.Element\01.GameObject\Unit
-
+
02.Element\02.Component\02.VIBuffer\Instance\UI_nstance
@@ -1139,6 +1154,12 @@
02.Element\02.Component\02.VIBuffer\Trail
+
+ 02.Element\02.Component\02.VIBuffer\Terrain\QuadTree
+
+
+ 00.System\02.ThreadHolder
+
@@ -1186,9 +1207,6 @@
99.Define\99.THIRDPARTY\FMOD
-
- 99.Define\01.SHADER
-
@@ -1206,5 +1224,23 @@
99.Define\01.SHADER
+
+ 99.Define\01.SHADER\Inc
+
+
+ 99.Define\01.SHADER\Inc
+
+
+ 99.Define\01.SHADER\Inc
+
+
+ 99.Define\01.SHADER\Inc
+
+
+ 99.Define\01.SHADER\Inc
+
+
+ 99.Define\01.SHADER\Inc
+
\ No newline at end of file
diff --git a/Jusin154_Team3D/Engine/Engine_Shader_Defines.hlsli b/Jusin154_Team3D/Engine/Engine_Shader_Defines.hlsli
new file mode 100644
index 000000000..ad5294f69
--- /dev/null
+++ b/Jusin154_Team3D/Engine/Engine_Shader_Defines.hlsli
@@ -0,0 +1,366 @@
+
+vector g_vMtrlDiffuse = 1.f;
+vector g_vMtrlAmbient = 1.f;
+vector g_vMtrlSpecular = 1.f;
+
+float PI = 3.14592;
+
+sampler DefaultSampler = sampler_state
+{
+ Filter = MIN_MAG_MIP_LINEAR;
+ AddressU = wrap;
+ AddressV = wrap;
+};
+
+sampler ClampSampler = sampler_state
+{
+ Filter = MIN_MAG_MIP_POINT;
+ AddressU = clamp;
+ AddressV = clamp;
+};
+
+sampler MirrorSampler = sampler_state
+{
+ Filter = MIN_MAG_MIP_LINEAR;
+ AddressU = mirror;
+ AddressV = mirror;
+};
+
+sampler BorderZeroSampler = sampler_state
+{
+ Filter = MIN_MAG_MIP_POINT;
+ AddressU = Border;
+ AddressV = Border;
+ BorderColor = float4(0, 0, 0, 0);
+};
+
+sampler PointSampler = sampler_state
+{
+ Filter = MIN_MAG_MIP_POINT;
+ AddressU = wrap;
+ AddressV = wrap;
+};
+
+RasterizerState RS_Default
+{
+ FillMode = Solid;
+ CullMode = Back;
+};
+
+RasterizerState RS_Nocull
+{
+ FillMode = Solid;
+ CullMode = None;
+ FrontCounterClockwise = false;
+ DepthClipEnable = false;
+};
+
+RasterizerState RS_Nocull_Wireframe
+{
+ FillMode = Wireframe;
+ CullMode = None;
+ FrontCounterClockwise = false;
+ DepthBias = 0;
+ SlopeScaledDepthBias = 0.f;
+ DepthBiasClamp = 0.f;
+ DepthClipEnable = false;
+ ScissorEnable = false;
+ MultisampleEnable = false;
+ AntialiasedLineEnable = false;
+};
+
+RasterizerState RS_Scissor
+{
+ FillMode = Solid;
+ CullMode = Back;
+ FrontCounterClockwise = false;
+ ScissorEnable = true;
+};
+
+DepthStencilState DSS_Default
+{
+ DepthEnable = true;
+ DepthWriteMask = all;
+ DepthFunc = less_equal;
+};
+
+DepthStencilState DSS_None
+{
+ DepthEnable = false;
+ DepthWriteMask = zero;
+};
+
+DepthStencilState DSS_Effect
+{
+ DepthEnable = true;
+ DepthWriteMask = zero;
+ DepthFunc = less_equal;
+ StencilEnable = false;
+};
+
+BlendState BS_None
+{
+ BlendEnable[0] = false;
+};
+
+BlendState BS_AlphaBlend // ALPHA_BLEND
+{
+ BlendEnable[0] = true;
+ BlendEnable[1] = true;
+ BlendEnable[2] = true;
+ BlendEnable[3] = true;
+ BlendEnable[4] = true;
+ BlendEnable[5] = true;
+ BlendEnable[6] = true;
+ BlendEnable[7] = true;
+
+ // Ac * Aa + Bc * (1 - Aa);
+ SrcBlend = Src_Alpha;
+ DestBlend = Inv_Src_Alpha;
+ BlendOp = Add;
+};
+
+BlendState BS_Blend // ADDITIVE_BLEND
+{
+ BlendEnable[0] = true;
+ BlendEnable[1] = true;
+ BlendEnable[2] = true;
+ BlendEnable[3] = true;
+ BlendEnable[4] = true;
+ BlendEnable[5] = true;
+ BlendEnable[6] = true;
+ BlendEnable[7] = true;
+
+ // Ac * (1) + Bc * (1);
+ SrcBlend = one;
+ DestBlend = one;
+ BlendOp = Add;
+};
+
+BlendState BS_UIBlend
+{
+ BlendEnable[0] = true;
+ BlendEnable[1] = true;
+ BlendEnable[2] = true;
+ BlendEnable[3] = true;
+ BlendEnable[4] = true;
+ BlendEnable[5] = true;
+ BlendEnable[6] = true;
+ BlendEnable[7] = true;
+
+ SrcBlend = Src_Alpha;
+ DestBlend = Inv_Src_Alpha;
+ BlendOp = Add;
+
+ SrcBlendAlpha = One;
+ DestBlendAlpha = Zero;
+ BlendOpAlpha = Add;
+
+ RenderTargetWriteMask[0] = 0x0F; // RGBA 모두 출력
+};
+
+BlendState BS_WB_Acc
+{
+ BlendEnable[0] = true;
+ BlendEnable[1] = true;
+ BlendEnable[2] = true;
+ BlendEnable[3] = true;
+ BlendEnable[4] = true;
+ BlendEnable[5] = true;
+ BlendEnable[6] = true;
+ BlendEnable[7] = true;
+
+ SrcBlend[0] = one;
+ DestBlend[0] = one;
+ BlendOp[0] = Add;
+
+ SrcBlend[1] = Zero;
+ DestBlend[1] = Inv_Src_Alpha;
+ BlendOp[1] = Add;
+
+
+ SrcBlend[2] = one;
+ DestBlend[2] = one;
+ BlendOp[2] = Add;
+};
+
+BlendState BS_WeightBlend
+{
+ BlendEnable[0] = true;
+ BlendEnable[1] = true;
+ BlendEnable[2] = true;
+ BlendEnable[3] = true;
+ BlendEnable[4] = true;
+ BlendEnable[5] = true;
+ BlendEnable[6] = true;
+ BlendEnable[7] = true;
+
+
+ SrcBlend[0] = Src_Alpha;
+ DestBlend[0] = Inv_Src_Alpha;
+
+ BlendOp[0] = Add;
+
+
+
+};
+
+float ShadowVisibility_hwPCF(Texture2D ShadowMap, float4 vLightClip, float2 vShadowMapSize, float bias)
+{
+ float2 uv = float2(vLightClip.x / vLightClip.w, -vLightClip.y / vLightClip.w) * 0.5f + 0.5f;
+ float fDepthCenter = saturate(vLightClip.z / vLightClip.w);
+ float2 vTexel = 1.f / vShadowMapSize;
+
+ float fVisibility = 0.f;
+ for (int v = -1; v <= 1; ++v)
+ {
+ for (int u = -1; u <= 1; ++u)
+ {
+ float2 vOffset = float2(u, v) * vTexel;
+ float fDepth = ShadowMap.Sample(DefaultSampler, uv + vOffset).x;
+ fVisibility += (fDepthCenter - bias > fDepth) ? 0.f : 1.f;
+ }
+ }
+ return fVisibility / 9.f;
+}
+
+float GetRimLight(float3 vCamPosition, float3 vPosition, float3 vNormal, float fRimPower, float fRimStrength)
+{
+ float fRimLight = (1 - dot(normalize(vCamPosition - vPosition), vNormal));
+ fRimLight = pow(fRimLight, fRimPower);
+ fRimLight = fRimLight * fRimStrength;
+ return fRimLight;
+}
+
+float2 Get_MovedUV(float2 vOriginalUV, float fDeltaU, float fDeltaV, uint iIndexU, uint iIndexV)
+{
+ float2 vDelta = float2(fDeltaU, fDeltaV);
+ float2 vOffset = float2(iIndexU * fDeltaU, iIndexV * fDeltaV);
+ return vOriginalUV * vDelta + vOffset;
+}
+
+float2 UV_Cutting(float2 vUV, float2 vUVCutting, int iCurrentFrame)
+{
+ float2 UV = vUV; // 이미지의 UV값
+
+ int iTotalFrame = vUVCutting.x * vUVCutting.y; // 이미지의 최대 프레임 (몇 곱하기 몇인지)
+
+ int iFrameX = iCurrentFrame % (int) vUVCutting.x; // 현재 x축의 위치(현재 이미지의 몇번째 칸을 보여줄 지)
+ int iFrameY = iCurrentFrame / (int) vUVCutting.x; // 현재 y축의 위치(현재 이미지의 몇번째 줄을 보여줄 지)
+
+ float fFreamWidth = 1.0 / vUVCutting.x; // 1.0 나누기 이미지 갯수를 해서 한칸에 얼마나 갈지 정해준다.
+ float fFreamHeight = 1.0 / vUVCutting.y; // 1.0 나누기 이미지 갯수를 해서 한줄에 얼마나 갈지 정해준다.
+
+ UV.x = UV.x * fFreamWidth + iFrameX * fFreamWidth; // 먼저 uv를 0~1이 아닌 0~fFrameWidth로 만든 다음에 한칸씩 옆으로 밀어준다.
+ UV.y = UV.y * fFreamHeight + iFrameY * fFreamHeight; // 먼저 uv를 0~1이 아닌 0~fFrameHeight로 만든 다음에 한줄씩 밑으로 내려준다.
+
+ return UV;
+}
+
+struct PBR_LIGHT_OUT
+{
+ float3 vShade;
+ float3 vSpecular;
+};
+
+// (Kd F(Lambert)) + (Ks F(cook-torrance))
+
+//float LambertDiffuse(float c)
+//{
+// return c / PI;
+//}
+
+// F(cook-torrance)
+// DFG / (4 (Wo dot N) (Wi dot N))
+
+// D(distribution, NormalDistribution function), 표면의 거칠기에 영향을 받는 halfWay vector
+// G(Geometry, GeometryFunc), 에너지 보존법칙 적용
+// F(Fresnel-Fresnel equation), 표면 각도에 따른 반사율
+
+// F->D
+float NDF_ggxtr(float3 n, float3 h, float a) // NormalDistributionGGXTR, (H, halfWay vector), (A, Roughness), (N, Normal?)
+{
+ float a2 = a * a;
+ float NdotH = saturate(dot(n, h));
+ float NdotH2 = NdotH * NdotH;
+
+ float nom = a2;
+ float denom = (NdotH2 * (a2 - 1.f) + 1.f);
+
+ denom = PI * denom * denom;
+ return (nom / denom);
+}
+
+// F->G
+// GschlickGGX(n, v, k)
+// k는 이하 두개 조명 조건에 따라 가변적임
+// Direct // Kdir -> ((a + 1) * (a + 1)) / 8 // direct lighting 추천
+// IBL Lighting // Kibl -> a * a / 2 // 이미지 기반 조명기법
+
+float Geometry_SchlickGGX(float NdotV, float fK)
+{
+ return NdotV / (NdotV * (1.0f - fK) + fK);
+}
+
+float Geometry_Smith(float3 n, float3 v, float3 l, float k)
+{
+ // Geometry Obstruction
+ // 철이 있는, 주로 튀어나온 장애물
+ float NdotV = saturate(dot(n, v));
+
+ // Geometry Shadowing
+ // 요가 있는, 주로 음푹 들어간 장애물 (그래서 셰도잉)
+ float NdotL = saturate(dot(n, l));
+
+ // 요철이 골고루 있다고 가정하고 적당히 섞음
+ return Geometry_SchlickGGX(NdotV, k) * Geometry_SchlickGGX(NdotL, k);
+}
+
+// F -> F
+float3 Fresnel_Schlick(float cosTheta, float3 F0)
+{
+ // 모서리 부분의 반사
+ return F0 + (1.0f - F0) * pow(1.0f - cosTheta, 5.0f);
+}
+
+PBR_LIGHT_OUT PBR_Lighting(
+ float3 vNormal, float3 vToView, float3 vToLight,
+ float3 vAlbedo, float fMetallic, float fRoughness,
+ float3 vLightColor, float fAttenuation
+
+) {
+ PBR_LIGHT_OUT Out;
+ Out.vShade = 0;
+ Out.vSpecular = 0;
+
+ float3 vHalfVector = normalize(vToView + vToLight);
+ float NdotL = saturate(dot(vNormal, vToLight));
+ float NdotV = saturate(dot(vNormal, vToView));
+ if (NdotL <= 0 || NdotV <= 0)
+ {
+ return Out;
+ }
+ float fAlpha = max(fRoughness * fRoughness, 0.04f);
+ float k = ((fRoughness + 1.f) * (fRoughness + 1.f)) / 8.f;
+
+
+ float3 F0 = lerp(float3(0.04f, 0.04f, 0.04f), vAlbedo, fMetallic);
+
+ float D = NDF_ggxtr(vNormal, vHalfVector, fAlpha);
+ float G = Geometry_Smith(vNormal, vToView, vToLight, k);
+ float3 F = Fresnel_Schlick(saturate(dot(vHalfVector, vToView)), F0);
+
+ float3 vNumerator = D * G * F;
+ float fDenom = max(4.f * NdotL * NdotV, 1e-7);
+ float3 specularBRDF = vNumerator / fDenom;
+
+
+ float3 kS = F;
+ float3 kD = (1.f - kS) * (1.f -fMetallic);
+
+ Out.vShade = (kD / PI) * (NdotL * fAttenuation) * vLightColor;
+
+ Out.vSpecular = specularBRDF * vLightColor * fAttenuation * NdotL;
+
+ return Out;
+}
diff --git a/Jusin154_Team3D/Engine/Private/Animation.cpp b/Jusin154_Team3D/Engine/Private/Animation.cpp
index 9d4d13f26..91a1376ef 100644
--- a/Jusin154_Team3D/Engine/Private/Animation.cpp
+++ b/Jusin154_Team3D/Engine/Private/Animation.cpp
@@ -169,7 +169,7 @@ void CAnimation::InterpAnim(CAnimation* pPreAnim, vector& Bones, float f
if (BoneName == "Reference")
{
- FinalPos = XMVectorZero();
+ //FinalPos = XMVectorZero();
}
_matrix FinalMat = XMMatrixAffineTransformation(FinalScale, XMVectorZero(), FinalRot, FinalPos);
diff --git a/Jusin154_Team3D/Engine/Private/Channel.cpp b/Jusin154_Team3D/Engine/Private/Channel.cpp
index 1f72faa3b..bc1043d15 100644
--- a/Jusin154_Team3D/Engine/Private/Channel.cpp
+++ b/Jusin154_Team3D/Engine/Private/Channel.cpp
@@ -164,7 +164,7 @@ void CChannel::Update_TransformationMatirx(const vector& Bones, _float f
_float dy = XMVectorGetY(vDeltaAdjusted);
_float dz = XMVectorGetZ(vDeltaAdjusted);
- _vector vDeltaWorld = vRight * dx + (-vUp * dz) + vLook * dy;
+ _vector vDeltaWorld = vRight * dx + (-vUp * dz) + vLook * dy;
vDeltaWorld *= 0.01f;
@@ -175,6 +175,45 @@ void CChannel::Update_TransformationMatirx(const vector& Bones, _float f
m_vPrevRootPos = vCurRootPos;
vTranslation = XMVectorZero();
+
+ /////////////////////////////////////
+
+ _float4 curRotF4;
+ XMStoreFloat4(&curRotF4, vRotation);
+ _vector qCur = XMLoadFloat4(&curRotF4);
+
+ if (!m_bInitialRootRotSaved)
+ {
+ m_vInitialRootRot = curRotF4;
+ m_vPrevRootRot = curRotF4;
+ m_bInitialRootRotSaved = true;
+ }
+ else
+ {
+ _vector qPrev = XMLoadFloat4(&m_vPrevRootRot);
+
+ _vector qInvPrev = XMQuaternionInverse(qPrev);
+ _vector qDelta = XMQuaternionMultiply(qInvPrev, qCur);
+
+ _vector axisLocal;
+ _float angle = 0.f;
+ XMQuaternionToAxisAngle(&axisLocal, &angle, qDelta);
+
+ _vector axisWorld = XMVector3TransformNormal(axisLocal, pre);
+ axisWorld = XMVector3Normalize(axisWorld);
+
+ _float4 axis;
+ XMStoreFloat4(&axis, axisWorld);
+ swap(axis.z, axis.y);
+
+
+ if (angle > 0 )
+ pTransform->TurnAngle(XMLoadFloat4(&axis), -angle);
+ }
+
+ XMStoreFloat4(&m_vPrevRootRot, qCur);
+
+ vRotation = XMLoadFloat4(&m_vInitialRootRot);
}
m_BoneTransformationMatrix = XMMatrixAffineTransformation(vScale, XMVectorSet(0.f, 0.f, 0.f, 1.f), vRotation, vTranslation);
@@ -182,7 +221,6 @@ void CChannel::Update_TransformationMatirx(const vector& Bones, _float f
Bones[m_iBoneIndex]->Set_TransformationMatrix(m_BoneTransformationMatrix);
}
-
KEYFRAME* CChannel::Get_Frame(_uint iIndex)
{
return &m_KeyFrames[iIndex];
diff --git a/Jusin154_Team3D/Engine/Private/FSM.cpp b/Jusin154_Team3D/Engine/Private/FSM.cpp
index f17e7dde1..f09d5d689 100644
--- a/Jusin154_Team3D/Engine/Private/FSM.cpp
+++ b/Jusin154_Team3D/Engine/Private/FSM.cpp
@@ -69,7 +69,9 @@ _uint CFSM::Get_CurrState()
_uint CFSM::Get_PrevState()
{
- return m_pPrevious->Get_State();
+ if (m_pPrevious)
+ return m_pPrevious->Get_State();
+ return 0;
}
void CFSM::Set_Parent(FSMSTATE::ESTATE Child, FSMSTATE::ESTATE Parent)
diff --git a/Jusin154_Team3D/Engine/Private/Light.cpp b/Jusin154_Team3D/Engine/Private/Light.cpp
index 64296c575..c71638e30 100644
--- a/Jusin154_Team3D/Engine/Private/Light.cpp
+++ b/Jusin154_Team3D/Engine/Private/Light.cpp
@@ -12,7 +12,7 @@ CLight::CLight(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
}
CLight::CLight(const CLight& rhs)
- : CComponent{ rhs }
+ : CComponent(rhs)
{
}
diff --git a/Jusin154_Team3D/Engine/Private/Material.cpp b/Jusin154_Team3D/Engine/Private/Material.cpp
index 67b8586bf..61355fdbe 100644
--- a/Jusin154_Team3D/Engine/Private/Material.cpp
+++ b/Jusin154_Team3D/Engine/Private/Material.cpp
@@ -220,8 +220,9 @@ HRESULT CMaterial::Read_MaterialFile(const _char* pMaterialFilePath, const _char
getline(file, strText);
// Add Texture
- if (FAILED(Add_Texture(szTextureFilePath, Type)))
+ if (FAILED(Add_Texture(szTextureFilePath, Type))){
return E_FAIL;
+ }
break;
@@ -250,49 +251,70 @@ HRESULT CMaterial::Add_Texture(const _char* pTextureFolderPath, string& FileType
aiTextureType eTexture = {};
/* Find type */
- if (!strcmp(FileType.c_str(), "D"))
+ if (!strcmp(FileType.c_str(), "D")){
eTexture = aiTextureType::aiTextureType_DIFFUSE;
- else if (!strcmp(FileType.c_str(), "Diff"))
+ }
+ else if (!strcmp(FileType.c_str(), "Diff")){
eTexture = aiTextureType::aiTextureType_DIFFUSE;
- else if (!strcmp(FileType.c_str(), "d"))
+ }
+ else if (!strcmp(FileType.c_str(), "d")){
eTexture = aiTextureType::aiTextureType_DIFFUSE;
- else if (!strcmp(FileType.c_str(), "N"))
+ }
+ else if (!strcmp(FileType.c_str(), "basecolor")) {
+ eTexture = aiTextureType::aiTextureType_DIFFUSE;
+ }
+ else if (!strcmp(FileType.c_str(), "N")){
eTexture = aiTextureType::aiTextureType_NORMALS;
- else if (!strcmp(FileType.c_str(), "normal"))
+ }
+ else if (!strcmp(FileType.c_str(), "normal")){
eTexture = aiTextureType::aiTextureType_NORMALS;
- else if (!strcmp(FileType.c_str(), "Norm"))
+ }
+ else if (!strcmp(FileType.c_str(), "Norm")){
eTexture = aiTextureType::aiTextureType_NORMALS;
- else if (!strcmp(FileType.c_str(), "n"))
+ }
+ else if (!strcmp(FileType.c_str(), "n")){
eTexture = aiTextureType::aiTextureType_NORMALS;
- else if (!strcmp(FileType.c_str(), "MRO"))
+ }
+ else if (!strcmp(FileType.c_str(), "MRO")){
eTexture = aiTextureType::aiTextureType_METALNESS;
- else if (!strcmp(FileType.c_str(), "3Broom"))
+ }
+ else if (!strcmp(FileType.c_str(), "MROH")){
eTexture = aiTextureType::aiTextureType_METALNESS;
- else if (!strcmp(FileType.c_str(), "MROH"))
+ }
+ else if (!strcmp(FileType.c_str(), "MRAB")){
eTexture = aiTextureType::aiTextureType_METALNESS;
- else if (!strcmp(FileType.c_str(), "MRAB"))
+ }
+ else if (!strcmp(FileType.c_str(), "MROA")){
eTexture = aiTextureType::aiTextureType_METALNESS;
- else if (!strcmp(FileType.c_str(), "MROA"))
+ }
+ else if (!strcmp(FileType.c_str(), "SRO")){
eTexture = aiTextureType::aiTextureType_SPECULAR;
- else if (!strcmp(FileType.c_str(), "SRO"))
+ }
+ else if (!strcmp(FileType.c_str(), "HRO")){
eTexture = aiTextureType::aiTextureType_SPECULAR;
- else if (!strcmp(FileType.c_str(), "HRO"))
+ }
+ else if (!strcmp(FileType.c_str(), "SROH")) {
eTexture = aiTextureType::aiTextureType_SPECULAR;
- else if (!strcmp(FileType.c_str(), "SROH"))
- eTexture = aiTextureType::aiTextureType_SPECULAR;
- else if (!strcmp(FileType.c_str(), "SROA"))
+ }
+ else if (!strcmp(FileType.c_str(), "SROA")){
eTexture = aiTextureType::aiTextureType_SPECULAR;
+ }
+ else if (!strcmp(FileType.c_str(), "3Broom")) {
+ eTexture = aiTextureType::aiTextureType_UNKNOWN;
+ }
else if (!strcmp(FileType.c_str(), "HDR"))
return S_OK;
- else if (!strcmp(FileType.c_str(), "MSK"))
+ else if (!strcmp(FileType.c_str(), "MSK")){
eTexture = aiTextureType::aiTextureType_AMBIENT_OCCLUSION;
- else if (!strcmp(FileType.c_str(), "basecolor"))
- eTexture = aiTextureType::aiTextureType_DIFFUSE;
- else if (!strcmp(FileType.c_str(), "E"))
+ }
+ else if (!strcmp(FileType.c_str(), "E")){
eTexture = aiTextureType::aiTextureType_EMISSIVE;
+ }
else
{
+#ifndef 기무리
MSG_BOX("Failed to Path Material Texture Type");
+#endif // !기무리
return S_OK;
}
_char TexturePath[MAX_PATH] = {};
@@ -319,8 +341,10 @@ HRESULT CMaterial::Add_Texture(const _char* pTextureFolderPath, string& FileType
if (FAILED(CreateWICTextureFromFile(m_pDevice, szTextureFilePath_Png, nullptr, &pSRV)))
{
+#ifndef 기무리
MSG_BOX("Failed to Load TextureFile");
- return E_FAIL;
+#endif // !기무리
+ return S_OK;
}
strTexturePath = CMyTools::ToString(szTextureFilePath_Png);
}
@@ -360,25 +384,6 @@ HRESULT CMaterial::Add_Texture(const _char* pTextureFolderPath, string& FileType
return S_OK;
}
-HRESULT CMaterial::SaveAsBinary(HANDLE hFile, DWORD& dwByte)
-{
- // 실제 값을 저장하지 않고 파일이름.확장자명의 문자열을 저장해서 수정하기 편하게 만들기
- // 대신 리소스를 공유해야함
- // 텍스쳐를 저장하지 않고
- // 텍스쳐 경로만 ( "이름.확장자" ) 만 저장함
- for (int i = 0; i < AI_TEXTURE_TYPE_MAX; ++i) {
- _uint iNumSrv = (_uint)m_strPath[i].size();
- WriteFile(hFile, &i, sizeof(_uint), &dwByte, nullptr); // 종류 저장
- WriteFile(hFile, &iNumSrv, sizeof(_uint), &dwByte, nullptr); // 종류의 갯수 저장
- for (_uint j = 0; j < iNumSrv; ++j) {
- m_strPath[i][j].shrink_to_fit();
- _uint strLength = (_uint)(sizeof(_char) * m_strPath[i][j].length());
- WriteFile(hFile, &strLength, sizeof(_uint), &dwByte, nullptr); // 사이즈 저장
- WriteFile(hFile, m_strPath[i][j].data(), strLength, &dwByte, nullptr); // 실제 값 저장
- }
- }
- return S_OK;
-}
CMaterial* CMaterial::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _char* pModelFilePath, const aiMaterial* pAIMaterial)
{
CMaterial* pInstance = new CMaterial(pDevice, pContext);
@@ -406,15 +411,111 @@ CMaterial* CMaterial::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContex
}
#endif
-HRESULT CMaterial::Bind_SRV(CShader* pShader, const _char* pConstantName, _uint iType, _uint iTextureIndex)
+HRESULT CMaterial::Bind_SRV(CShader* pShader)
{
- if (m_SRVs[iType].empty()) {
- //assert(false);
- return S_OK;
+ //if (m_SRVs[iType].empty()) {
+ // //assert(false);
+ // return S_OK;
+ //}
+
+ const _char* pConstantName = "";
+ _float fZero = 0.f;
+ if (FAILED(pShader->Bind_RawValue("g_fUsingSurfaceParams", &fZero, sizeof(_float)))) {
+ return E_FAIL;
+ }
+ if (FAILED(pShader->Bind_SRV("g_SurfaceParamsTexture", nullptr))) {
+ return E_FAIL;
}
+ for (_uint iTextureType = 0; iTextureType < AI_TEXTURE_TYPE_MAX; ++iTextureType) {
+ if (m_SRVs[iTextureType].empty()) {
+ continue;
+ }
+ switch (aiTextureType(iTextureType))
+ {
+ case aiTextureType_NONE:
+ break;
+ case aiTextureType_DIFFUSE:
+ pConstantName = "g_DiffuseTexture";
+ break;
+ case aiTextureType_SPECULAR:
+ {
+ _float fUsingSurfaceParams = ((_float)iTextureType / (_float)AI_TEXTURE_TYPE_MAX);
+ pConstantName = "g_SurfaceParamsTexture";
+ pShader->Bind_RawValue("g_fUsingSurfaceParams", &fUsingSurfaceParams, sizeof(_float));
+ }
+ break;
+ case aiTextureType_AMBIENT:
+ break;
+ case aiTextureType_EMISSIVE:
+ break;
+ case aiTextureType_HEIGHT:
+ break;
+ case aiTextureType_NORMALS:
+ pConstantName = "g_NormalTexture";
+ break;
+ case aiTextureType_SHININESS:
+ {
+ _float fUsingSurfaceParams = ((_float)aiTextureType_METALNESS / (_float)AI_TEXTURE_TYPE_MAX);
+ pConstantName = "g_SurfaceParamsTexture";
+ pShader->Bind_RawValue("g_fUsingSurfaceParams", &fUsingSurfaceParams, sizeof(_float));
+ }
+ break;
+ case aiTextureType_OPACITY:
+ break;
+ case aiTextureType_DISPLACEMENT:
+ break;
+ case aiTextureType_LIGHTMAP:
+ break;
+ case aiTextureType_REFLECTION:
+ break;
+ case aiTextureType_BASE_COLOR:
+ break;
+ case aiTextureType_NORMAL_CAMERA:
+ break;
+ case aiTextureType_EMISSION_COLOR:
+ break;
+ case aiTextureType_METALNESS:
+ {
+ _float fUsingSurfaceParams = ((_float)iTextureType / (_float)AI_TEXTURE_TYPE_MAX);
+ pConstantName = "g_SurfaceParamsTexture";
+ pShader->Bind_RawValue("g_fUsingSurfaceParams", &fUsingSurfaceParams, sizeof(_float));
+ }
+ break;
+ case aiTextureType_DIFFUSE_ROUGHNESS:
+ break;
+ case aiTextureType_AMBIENT_OCCLUSION:
+ break;
+ case aiTextureType_UNKNOWN:
+ break;
+ case aiTextureType_SHEEN:
+ break;
+ case aiTextureType_CLEARCOAT:
+ break;
+ case aiTextureType_TRANSMISSION:
+ break;
+ case aiTextureType_MAYA_BASE:
+ break;
+ case aiTextureType_MAYA_SPECULAR:
+ break;
+ case aiTextureType_MAYA_SPECULAR_COLOR:
+ break;
+ case aiTextureType_MAYA_SPECULAR_ROUGHNESS:
+ break;
+ case aiTextureType_ANISOTROPY:
+ break;
+ case aiTextureType_GLTF_METALLIC_ROUGHNESS:
+ break;
+ case _aiTextureType_Force32Bit:
+ break;
+ default:
+ break;
+ }
- return pShader->Bind_SRV(pConstantName, m_SRVs[iType][iTextureIndex]);
+ pShader->Bind_SRV(pConstantName, m_SRVs[iTextureType][0]);
+ }
+
+ return S_OK;
}
HRESULT CMaterial::Initialize(const _char* pModelFilePath, const SaveMaterial& _SaveMaterial)
@@ -448,8 +549,9 @@ HRESULT CMaterial::Initialize(const _char* pModelFilePath, const SaveMaterial& _
hr = CreateWICTextureFromFile(m_pDevice, szPerfectPath, nullptr, &pSRV);
}
- if (FAILED(hr))
+ if (FAILED(hr)){
return E_FAIL;
+ }
m_SRVs[type].push_back(pSRV);
}
diff --git a/Jusin154_Team3D/Engine/Private/Model.cpp b/Jusin154_Team3D/Engine/Private/Model.cpp
index 6f8bf8bfd..098703f27 100644
--- a/Jusin154_Team3D/Engine/Private/Model.cpp
+++ b/Jusin154_Team3D/Engine/Private/Model.cpp
@@ -119,7 +119,7 @@ void CModel::Change_AnimationIndex(_int iAnimationIndex, _bool bIsLoop, _float f
m_pLerpAnim->Begin(m_Bones, LerpStartFrames, LerpEndFrames, fLerpDuration, m_iRootBoneIndex);
}
-HRESULT CModel::Bind_Material(_uint iMeshIndex, CShader* pShader, const _char* pConstantName, _uint iType, _uint iTextureIndex)
+HRESULT CModel::Bind_Material(_uint iMeshIndex, CShader* pShader)
{
if (iMeshIndex >= m_iNumMeshes) {
return E_FAIL;
@@ -130,7 +130,7 @@ HRESULT CModel::Bind_Material(_uint iMeshIndex, CShader* pShader, const _char* p
if (iMaterialIndex >= m_iNumMaterials) {
return E_FAIL;
}
- return m_Materials[iMaterialIndex]->Bind_SRV(pShader, pConstantName, iType, iTextureIndex);
+ return m_Materials[iMaterialIndex]->Bind_SRV(pShader);
}
HRESULT CModel::Bind_BoneMatrices(_uint iMeshIndex, CShader* pShader, const _char* pConstantName)
diff --git a/Jusin154_Team3D/Engine/Private/Mouse_Manager.cpp b/Jusin154_Team3D/Engine/Private/Mouse_Manager.cpp
index 0510c48ff..1cff6dc5f 100644
--- a/Jusin154_Team3D/Engine/Private/Mouse_Manager.cpp
+++ b/Jusin154_Team3D/Engine/Private/Mouse_Manager.cpp
@@ -1,4 +1,4 @@
-#include "pch.h"
+#include "pch.h"
#include "Mouse_Manager.h"
#include "GameObject.h"
#include "GameInstance.h"
@@ -50,7 +50,7 @@ HRESULT CMouse_Manager::Initialize()
void CMouse_Manager::Update()
{
if (GetForegroundWindow() == m_ghWnd) {
- /* ºäÆ÷Ʈ ¸¶¿콺 ÁÂǥ*/
+ /* 뷰포트 마우스 좌표*/
GetCursorPos(&m_ptCurrentMouseCur);
m_vMove = { _float(m_ptCurrentMouseCur.x - m_ptOldMouseCur.x), _float(m_ptCurrentMouseCur.y - m_ptOldMouseCur.y) , 0.f };
@@ -106,22 +106,22 @@ void CMouse_Manager::Picking()
_float4 vMousePos = {};
POINT vViewPortMousePos = Get_MouseViewPortPos();
- /* ºäÆ÷Ʈ ÁÂǥ¸¦ Åõ¿µ ½ºÆäÀ̽º ÁÂǥ·Î ¹ٲٴ À۾÷ */
+ /* 뷰포트 좌표를 투영 스페이스 좌표로 바꾸는 작업 */
vMousePos.x = vViewPortMousePos.x / (m_iWinCX * 0.5f) - 1.f;
vMousePos.y = vViewPortMousePos.y / -(m_iWinCY * 0.5f) + 1.f;
- vMousePos.z = 0.f; // ±ÙÆò¸é»óÀÇ ÁÂǥÀ̱â ¶§¹®¿¡ 0
- vMousePos.w = 1.f; // W ³ª´©±⸦ ¼öÇàÇÑ »óÅÂÀ̱â ¶§¹®¿¡ 1
+ vMousePos.z = 0.f; // 근평면상의 좌표이기 때문에 0
+ vMousePos.w = 1.f; // W 나누기를 수행한 상태이기 때문에 1
- /* Åõ¿µ½ºÆäÀ̽º ÁÂǥ -> º佺ÆäÀ̽º ÁÂǥ*/
+ /* 투영스페이스 좌표 -> 뷰스페이스 좌표*/
_matrix InverseProjectionMatrix = XMMatrixInverse(nullptr, m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ));
XMStoreFloat4(&vMousePos, XMVector4Transform(XMLoadFloat4(&vMousePos), InverseProjectionMatrix));
- /* º佺ÆäÀ̽º ÁÂǥ -> ¿ùµå ½ºÆäÀ̽º ÁÂǥ*/
+ /* 뷰스페이스 좌표 -> 월드 스페이스 좌표*/
_float3 vRayPos, vRayDir = {};
- vRayPos = _float3{ 0.f,0.f,0.f }; // º佺ÆäÀ̽º » ī¸óÀÇ À§ġ´Â 0,0,0
- vRayDir = _float3{ (_float)vMousePos.x, (_float)vMousePos.y, (_float)vMousePos.z }; // ·¹ÀÌÀÇ ¹æÇ⺤Åʹ ¸¶¿콺À§ġ¿¡¼ ī¸ó À§ġ »« °ª
+ vRayPos = _float3{ 0.f,0.f,0.f }; // 뷰스페이스 상에서 카메라의 위치는 0,0,0
+ vRayDir = _float3{ (_float)vMousePos.x, (_float)vMousePos.y, (_float)vMousePos.z }; // 레이의 방향벡터는 마우스위치에서 카메라 위치 뺀 값
_matrix InverseViewSpaceMatrix = XMMatrixInverse(nullptr, m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW));
@@ -165,7 +165,7 @@ _bool CMouse_Manager::MousePicking_InWorldSpace(const _float3& vPointA, const _f
_bool isCollision;
_float fU, fV, fDist = {};
-
+
isCollision = CMyTools::IntersectTri(XMLoadFloat3(&m_vRayPos[ENUM_CLASS(RAY::WORLD)]), XMLoadFloat3(&m_vRayDir[ENUM_CLASS(RAY::WORLD)]),
XMLoadFloat3(&vPointA), XMLoadFloat3(&vPointB), XMLoadFloat3(&vPointC), fDist, fU, fV);
@@ -186,24 +186,24 @@ _bool CMouse_Manager::MousePicking_InWorldSpace(const _float3& vPointA, const _f
// const float cw = float(rc.right - rc.left);
// const float ch = float(rc.bottom - rc.top);
//
-// // 2) ºä/ÇÁ·ÎÁ§¼Ç: ȭ¸é Á»ó´Ü(0,0) ~ (cw,ch), Y-´ٿî
+// // 2) 뷰/프로젝션: 화면 좌상단(0,0) ~ (cw,ch), Y-다운
// XMFLOAT4X4 view{}, proj{};
// XMStoreFloat4x4(&view, XMMatrixIdentity());
// XMStoreFloat4x4(&proj, XMMatrixOrthographicOffCenterLH(0.f, cw, ch, 0.f, 0.f, 1.f));
//
-// // 3) ¸¶¿콺 ÁÂǥ (Ŭ¶óÀ̾ðƮ ÁÂǥ·Î º¯ȯ)
+// // 3) 마우스 좌표 (클라이언트 좌표로 변환)
// POINT pt{}; GetCursorPos(&pt); ScreenToClient(m_ghWnd, &pt);
//
-// // 4) ¿ùµå Çà·Ä: 30x30 ½ºÄÉÀÏ + À§ġ(Çȼ¿ ¼¾ÅÍ Á¤·Ä: +0.5f)
+// // 4) 월드 행렬: 30x30 스케일 + 위치(픽셀 센터 정렬: +0.5f)
// XMFLOAT4X4 world{};
// world._11 = 30.f; // width
// world._22 = 30.f; // height
// world._33 = 1.f; // keep
// world._44 = 1.f; // keep
-// world._41 = floorf((float)pt.x) + 0.5f; // translation X (row-vector ±Ծà)
+// world._41 = floorf((float)pt.x) + 0.5f; // translation X (row-vector 규약)
// world._42 = floorf((float)pt.y) + 0.5f; // translation Y
//
-// // 5) ¹ÙÀεù
+// // 5) 바인딩
// m_pShader->Bind_Matrix("g_WorldMatrix", &world);
// m_pShader->Bind_Matrix("g_ViewMatrix", &view);
// m_pShader->Bind_Matrix("g_ProjMatrix", &proj);
@@ -211,9 +211,9 @@ _bool CMouse_Manager::MousePicking_InWorldSpace(const _float3& vPointA, const _f
// m_pShader->Bind_SRV("g_Texture", m_pMouseSRV);
// m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(float));
//
-// // 6) »óÅ ¼¾÷(±ÇÀå)
+// // 6) 상태 셋업(권장)
// // - DepthTest OFF / DepthWrite OFF (UI)
-// // - AlphaBlend ON (Çʿä½Ã)
+// // - AlphaBlend ON (필요시)
// m_pShader->Begin(2);
// m_pRect->Bind_Resources();
// m_pRect->Render();
diff --git a/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp b/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp
index 595e32a22..6bb1707e3 100644
--- a/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp
+++ b/Jusin154_Team3D/Engine/Private/PhysX_Manager.cpp
@@ -405,7 +405,7 @@ HRESULT CPhysX_Manager::Initialize()
}
if (FAILED(Connect_DebugServer())) {
- ASSERT_NURI(false);
+ //ASSERT_NURI(false);
}
{ // 씬 세팅
diff --git a/Jusin154_Team3D/Engine/Private/Picking.cpp b/Jusin154_Team3D/Engine/Private/Picking.cpp
index 316c3fafb..efa57a8fd 100644
--- a/Jusin154_Team3D/Engine/Private/Picking.cpp
+++ b/Jusin154_Team3D/Engine/Private/Picking.cpp
@@ -66,9 +66,12 @@ _bool CPicking::isPicking(_float3* pOut)
_uint iMouseIndex = ptMouse.y * m_iNumPixelW + ptMouse.x;
- if (0.f == m_pPixels[iMouseIndex].w)
+ if (iMouseIndex > m_iNumPixelW * m_iNumPixelH)
return false;
+ if (0.f == m_pPixels[iMouseIndex].w)
+ return false;
+
_float3 vMousePos = _float3(0.f, 0.f, 0.f);
vMousePos.x = ptMouse.x / (m_iNumPixelW * 0.5f) - 1.f;
diff --git a/Jusin154_Team3D/Engine/Private/Prototype_Manager.cpp b/Jusin154_Team3D/Engine/Private/Prototype_Manager.cpp
index 55a473d60..9e5192594 100644
--- a/Jusin154_Team3D/Engine/Private/Prototype_Manager.cpp
+++ b/Jusin154_Team3D/Engine/Private/Prototype_Manager.cpp
@@ -104,19 +104,18 @@ HRESULT CPrototype_Manager::Ready_StaticComponents()
HRESULT CPrototype_Manager::Ready_EngineAssets()
{
- if (FAILED(Add_Asset_Prototype(g_iStaticLevel, TEXT("FX_DEFERRED"),
+ if (FAILED(Add_Asset_Prototype(g_iStaticLevel, FX_DEFERRED,
CShader::Create(m_pDevice, m_pContext, TEXT("../Bin/Resources/ShaderFiles/Shader_Deferred.hlsl"),
VTXPOSTEX::Elements, VTXPOSTEX::iNumElements)))) {
return E_FAIL;
}
-
- if (FAILED(Add_Asset_Prototype(g_iStaticLevel, TEXT("FX_LASTCOLOR"),
+ if (FAILED(Add_Asset_Prototype(g_iStaticLevel, FX_LASTCOLOR,
CShader::Create(m_pDevice, m_pContext, TEXT("../Bin/Resources/ShaderFiles/Shader_LastColor.hlsl"),
VTXPOSTEX::Elements, VTXPOSTEX::iNumElements)))) {
return E_FAIL;
}
- if (FAILED(Add_Asset_Prototype(g_iStaticLevel, TEXT("FX_WEIGHTBELND"),
+ if (FAILED(Add_Asset_Prototype(g_iStaticLevel, FX_WEIGHTBELND,
CShader::Create(m_pDevice, m_pContext, TEXT("../Bin/Resources/ShaderFiles/Shader_WeightBlend.hlsl"),
VTXPOSTEX::Elements, VTXPOSTEX::iNumElements)))) {
return E_FAIL;
diff --git a/Jusin154_Team3D/Engine/Private/QuadTree.cpp b/Jusin154_Team3D/Engine/Private/QuadTree.cpp
new file mode 100644
index 000000000..b09f9d4ec
--- /dev/null
+++ b/Jusin154_Team3D/Engine/Private/QuadTree.cpp
@@ -0,0 +1,362 @@
+#include "pch.h"
+#include "QuadTree.h"
+#include "GameInstance.h"
+
+CQuadTree::CQuadTree()
+{
+}
+
+void CQuadTree::Culling(CGameInstance* pGameInstance, const _float3* pVertexPositions, _uint* pIndices, _uint* pNumIndices)
+{
+ /* 해당 노드에서 그릴건지 확인 */
+ if (nullptr == m_pChildren[CORNER_LT] ||
+ true == isDraw(pGameInstance, pVertexPositions))
+ {
+ _bool isDraw[NEIGHBOR_END] = { true, true, true, true };
+
+ /* 이웃노드가 그려지는지 확인 */
+ for (size_t i = 0; i < NEIGHBOR_END; i++)
+ {
+ if (nullptr != m_pNeighbors[i])
+ isDraw[i] = m_pNeighbors[i]->isDraw(pGameInstance, pVertexPositions);
+
+ }
+
+ /* 점들이 절두체 안에 있는지 확인 */
+ _bool isIn[4] = {
+ pGameInstance->isIn_LocalFrustum(XMLoadFloat3(&pVertexPositions[m_iCorners[0]]), 0.f),
+ pGameInstance->isIn_LocalFrustum(XMLoadFloat3(&pVertexPositions[m_iCorners[1]]), 0.f),
+ pGameInstance->isIn_LocalFrustum(XMLoadFloat3(&pVertexPositions[m_iCorners[2]]), 0.f),
+ pGameInstance->isIn_LocalFrustum(XMLoadFloat3(&pVertexPositions[m_iCorners[3]]), 0.f),
+ };
+
+ /* 이웃하는 노드가 모두 그려진다면 */
+ if (true == isDraw[NEIGHBOR_LEFT] &&
+ true == isDraw[NEIGHBOR_TOP] &&
+ true == isDraw[NEIGHBOR_RIGHT] &&
+ true == isDraw[NEIGHBOR_BOTTOM])
+ {
+ /* 삼각형의 한점이라도 절두체 안에 있다면 그린다(인덱스를 넣어주고 NumIndices++)*/
+
+ if (true == isIn[0] ||
+ true == isIn[1] ||
+ true == isIn[2])
+ {
+ pIndices[(*pNumIndices)++] = m_iCorners[0];
+ pIndices[(*pNumIndices)++] = m_iCorners[1];
+ pIndices[(*pNumIndices)++] = m_iCorners[2];
+ }
+
+ if (true == isIn[0] ||
+ true == isIn[2] ||
+ true == isIn[3])
+ {
+ pIndices[(*pNumIndices)++] = m_iCorners[0];
+ pIndices[(*pNumIndices)++] = m_iCorners[2];
+ pIndices[(*pNumIndices)++] = m_iCorners[3];
+ }
+
+ return;
+ }
+
+ /* 이웃 노드와 크기 차이가 있을 때 */
+ _uint iLC, iTC, iRC, iBC;
+
+ iLC = (m_iCorners[CORNER_LT] + m_iCorners[CORNER_LB]) >> 1;
+ iTC = (m_iCorners[CORNER_LT] + m_iCorners[CORNER_RT]) >> 1;
+ iRC = (m_iCorners[CORNER_RT] + m_iCorners[CORNER_RB]) >> 1;
+ iBC = (m_iCorners[CORNER_LB] + m_iCorners[CORNER_RB]) >> 1;
+
+
+ /* 왼쪽 아래 확인 */
+ if (true == isIn[0] ||
+ true == isIn[2] ||
+ true == isIn[3])
+ {
+ /* 왼쪽 이웃 확인 (같은 크기로 그려지는지)*/
+ if (false == isDraw[NEIGHBOR_LEFT])
+ {
+ /* 아닐때 삼각형 분할 */
+ pIndices[(*pNumIndices)++] = m_iCorners[CORNER_LT];
+ pIndices[(*pNumIndices)++] = m_iCenter;
+ pIndices[(*pNumIndices)++] = iLC;
+
+ pIndices[(*pNumIndices)++] = iLC;
+ pIndices[(*pNumIndices)++] = m_iCenter;
+ pIndices[(*pNumIndices)++] = m_iCorners[CORNER_LB];
+ }
+ else
+ {
+ /* 같은 크기면 인접한 큰 삼각형으로(사각형의 1/4 )*/
+ pIndices[(*pNumIndices)++] = m_iCorners[CORNER_LT];
+ pIndices[(*pNumIndices)++] = m_iCenter;
+ pIndices[(*pNumIndices)++] = m_iCorners[CORNER_LB];
+ }
+
+ if (false == isDraw[NEIGHBOR_BOTTOM])
+ {
+ pIndices[(*pNumIndices)++] = m_iCorners[CORNER_LB];
+ pIndices[(*pNumIndices)++] = m_iCenter;
+ pIndices[(*pNumIndices)++] = iBC;
+
+ pIndices[(*pNumIndices)++] = iBC;
+ pIndices[(*pNumIndices)++] = m_iCenter;
+ pIndices[(*pNumIndices)++] = m_iCorners[CORNER_RB];
+ }
+ else
+ {
+ pIndices[(*pNumIndices)++] = m_iCorners[CORNER_LB];
+ pIndices[(*pNumIndices)++] = m_iCenter;
+ pIndices[(*pNumIndices)++] = m_iCorners[CORNER_RB];
+ }
+ }
+
+ /* 오른쪽 위 확인*/
+ if (true == isIn[0] ||
+ true == isIn[1] ||
+ true == isIn[2])
+ {
+ if (false == isDraw[NEIGHBOR_TOP])
+ {
+ pIndices[(*pNumIndices)++] = m_iCorners[CORNER_LT];
+ pIndices[(*pNumIndices)++] = iTC;
+ pIndices[(*pNumIndices)++] = m_iCenter;
+
+ pIndices[(*pNumIndices)++] = m_iCenter;
+ pIndices[(*pNumIndices)++] = iTC;
+ pIndices[(*pNumIndices)++] = m_iCorners[CORNER_RT];
+ }
+ else
+ {
+ pIndices[(*pNumIndices)++] = m_iCorners[CORNER_LT];
+ pIndices[(*pNumIndices)++] = m_iCorners[CORNER_RT];
+ pIndices[(*pNumIndices)++] = m_iCenter;
+ }
+
+ if (false == isDraw[NEIGHBOR_RIGHT])
+ {
+ pIndices[(*pNumIndices)++] = m_iCorners[CORNER_RT];
+ pIndices[(*pNumIndices)++] = iRC;
+ pIndices[(*pNumIndices)++] = m_iCenter;
+
+ pIndices[(*pNumIndices)++] = m_iCenter;
+ pIndices[(*pNumIndices)++] = iRC;
+ pIndices[(*pNumIndices)++] = m_iCorners[CORNER_RB];
+ }
+ else
+ {
+ pIndices[(*pNumIndices)++] = m_iCorners[CORNER_RT];
+ pIndices[(*pNumIndices)++] = m_iCorners[CORNER_RB];
+ pIndices[(*pNumIndices)++] = m_iCenter;
+ }
+ }
+
+ return;
+ }
+
+ /* 현재 사각형이 절두체 안에 있다면 자식 호출 */
+ /* Range 는 사각형의 중심에서 꼭짓점까지의 거리 */
+ _float fRange = XMVector3Length(XMLoadFloat3(&pVertexPositions[m_iCorners[CORNER_LT]]) - XMLoadFloat3(&pVertexPositions[m_iCenter])).m128_f32[0];
+
+ if (true == pGameInstance->isIn_LocalFrustum(XMLoadFloat3(&pVertexPositions[m_iCenter]), fRange))
+ {
+ for (size_t i = 0; i < CORNER_END; i++)
+ {
+ if (nullptr != m_pChildren[i])
+ m_pChildren[i]->Culling(pGameInstance, pVertexPositions, pIndices, pNumIndices);
+ }
+ }
+
+}
+
+void CQuadTree::SetUp_Neighbors()
+{
+ if (nullptr == m_pChildren[CORNER_LT]->m_pChildren[CORNER_LT])
+ return;
+
+ /* 해당 위치의 child의 neighbor에 포인터를 저장*/
+ m_pChildren[CORNER_LT]->m_pNeighbors[NEIGHBOR_RIGHT] = m_pChildren[CORNER_RT];
+ m_pChildren[CORNER_LT]->m_pNeighbors[NEIGHBOR_BOTTOM] = m_pChildren[CORNER_LB];
+
+ m_pChildren[CORNER_RT]->m_pNeighbors[NEIGHBOR_LEFT] = m_pChildren[CORNER_LT];
+ m_pChildren[CORNER_RT]->m_pNeighbors[NEIGHBOR_BOTTOM] = m_pChildren[CORNER_RB];
+
+ m_pChildren[CORNER_RB]->m_pNeighbors[NEIGHBOR_LEFT] = m_pChildren[CORNER_LB];
+ m_pChildren[CORNER_RB]->m_pNeighbors[NEIGHBOR_TOP] = m_pChildren[CORNER_RT];
+
+ m_pChildren[CORNER_LB]->m_pNeighbors[NEIGHBOR_RIGHT] = m_pChildren[CORNER_RB];
+ m_pChildren[CORNER_LB]->m_pNeighbors[NEIGHBOR_TOP] = m_pChildren[CORNER_LT];
+
+ /* 다른 부모의 자식인 인접한 이웃을 설정 */
+ if (nullptr != m_pNeighbors[NEIGHBOR_LEFT])
+ {
+ m_pChildren[CORNER_LT]->m_pNeighbors[NEIGHBOR_LEFT] = m_pNeighbors[NEIGHBOR_LEFT]->m_pChildren[CORNER_RT];
+ m_pChildren[CORNER_LB]->m_pNeighbors[NEIGHBOR_LEFT] = m_pNeighbors[NEIGHBOR_LEFT]->m_pChildren[CORNER_RB];
+ }
+
+ if (nullptr != m_pNeighbors[NEIGHBOR_TOP])
+ {
+ m_pChildren[CORNER_LT]->m_pNeighbors[NEIGHBOR_TOP] = m_pNeighbors[NEIGHBOR_TOP]->m_pChildren[CORNER_LB];
+ m_pChildren[CORNER_RT]->m_pNeighbors[NEIGHBOR_TOP] = m_pNeighbors[NEIGHBOR_TOP]->m_pChildren[CORNER_RB];
+ }
+
+ if (nullptr != m_pNeighbors[NEIGHBOR_RIGHT])
+ {
+ m_pChildren[CORNER_RT]->m_pNeighbors[NEIGHBOR_RIGHT] = m_pNeighbors[NEIGHBOR_RIGHT]->m_pChildren[CORNER_LT];
+ m_pChildren[CORNER_RB]->m_pNeighbors[NEIGHBOR_RIGHT] = m_pNeighbors[NEIGHBOR_RIGHT]->m_pChildren[CORNER_LB];
+ }
+
+ if (nullptr != m_pNeighbors[NEIGHBOR_BOTTOM])
+ {
+ m_pChildren[CORNER_LB]->m_pNeighbors[NEIGHBOR_BOTTOM] = m_pNeighbors[NEIGHBOR_BOTTOM]->m_pChildren[CORNER_LT];
+ m_pChildren[CORNER_RB]->m_pNeighbors[NEIGHBOR_BOTTOM] = m_pNeighbors[NEIGHBOR_BOTTOM]->m_pChildren[CORNER_RT];
+ }
+
+ for (size_t i = 0; i < CORNER_END; i++)
+ {
+ m_pChildren[i]->SetUp_Neighbors();
+ }
+}
+
+_bool CQuadTree::Picking(CGameInstance* pGameInstance, const _float3* pVertexPositions, _float3& Out, _fmatrix WorldMatrix)
+{
+ _bool isIn = { false };
+
+ if (true == pGameInstance->MousePicking_InLocalSpace(pVertexPositions[m_iCorners[CORNER_LT]],pVertexPositions[m_iCorners[CORNER_RT]],pVertexPositions[m_iCorners[CORNER_RB]], Out))
+ {
+ if (nullptr == m_pChildren[CORNER_LT])
+ {
+ XMStoreFloat3(&Out, XMVector3TransformCoord(XMLoadFloat3(&Out), WorldMatrix));
+ return true;
+ }
+ isIn = true;
+ }
+
+ if (true == pGameInstance->MousePicking_InLocalSpace(pVertexPositions[m_iCorners[CORNER_LT]], pVertexPositions[m_iCorners[CORNER_RB]], pVertexPositions[m_iCorners[CORNER_LB]], Out))
+ {
+ if (nullptr == m_pChildren[CORNER_LT])
+ {
+ XMStoreFloat3(&Out, XMVector3TransformCoord(XMLoadFloat3(&Out), WorldMatrix));
+ return true;
+ }
+ isIn = true;
+ }
+
+ if (isIn)
+ {
+ for (_uint i = 0; i < CORNER_END; ++i)
+ {
+ if (m_pChildren[i]->Picking(pGameInstance, pVertexPositions, Out, WorldMatrix))
+ return true;
+ }
+ }
+
+ return false;
+}
+
+_bool CQuadTree::Set_Y(CGameInstance* pGameInstance, const _float3* pVertexPositions, VTXNORTEX* pVertices, _fmatrix WorldMatrix, _float fY)
+{
+ _bool isIn = { false };
+ _float3 Out = {};
+ if (true == pGameInstance->MousePicking_InLocalSpace(pVertexPositions[m_iCorners[CORNER_LT]], pVertexPositions[m_iCorners[CORNER_RT]], pVertexPositions[m_iCorners[CORNER_RB]], Out))
+ {
+ if (nullptr == m_pChildren[CORNER_LT])
+ {
+ pVertices[m_iCorners[CORNER_LT]].vPosition.y = fY;
+ pVertices[m_iCorners[CORNER_RT]].vPosition.y = fY;
+ pVertices[m_iCorners[CORNER_RB]].vPosition.y = fY;
+
+ XMStoreFloat3(&Out, XMVector3TransformCoord(XMLoadFloat3(&Out), WorldMatrix));
+ return true;
+ }
+ isIn = true;
+ }
+
+ if (true == pGameInstance->MousePicking_InLocalSpace(pVertexPositions[m_iCorners[CORNER_LT]], pVertexPositions[m_iCorners[CORNER_RB]], pVertexPositions[m_iCorners[CORNER_LB]], Out))
+ {
+ if (nullptr == m_pChildren[CORNER_LT])
+ {
+ pVertices[m_iCorners[CORNER_LT]].vPosition.y = fY;
+ pVertices[m_iCorners[CORNER_RB]].vPosition.y = fY;
+ pVertices[m_iCorners[CORNER_LB]].vPosition.y = fY;
+
+ XMStoreFloat3(&Out, XMVector3TransformCoord(XMLoadFloat3(&Out), WorldMatrix));
+ return true;
+ }
+ isIn = true;
+ }
+
+ if (isIn)
+ {
+ for (_uint i = 0; i < CORNER_END; ++i)
+ {
+ if (m_pChildren[i]->Set_Y(pGameInstance, pVertexPositions, pVertices, WorldMatrix, fY))
+ return true;
+ }
+ }
+
+ return false;
+}
+
+_bool CQuadTree::isDraw(CGameInstance* pGameInstance, const _float3* pVertexPositions)
+{
+ _vector vCamPos = XMLoadFloat4(pGameInstance->Get_CamPosition());
+ _vector vCenter = XMLoadFloat3(&pVertexPositions[m_iCenter]);
+
+ if (m_iCorners[CORNER_RT] - m_iCorners[CORNER_LT] < XMVectorGetX(XMVector3Length(vCamPos - vCenter)) * 0.2f)
+ return true;
+
+ return false;
+}
+
+HRESULT CQuadTree::Initialize(_uint iLT, _uint iRT, _uint iRB, _uint iLB)
+{
+ m_iCorners[CORNER_LT] = iLT;
+ m_iCorners[CORNER_RT] = iRT;
+ m_iCorners[CORNER_RB] = iRB;
+ m_iCorners[CORNER_LB] = iLB;
+
+ /* 길이가 1일때 트리 최하위 */
+ if (1 == m_iCorners[CORNER_RT] - m_iCorners[CORNER_LT])
+ return S_OK;
+
+ /* 중간 점들 인덱스 구하기 */
+ m_iCenter = (m_iCorners[CORNER_LT] + m_iCorners[CORNER_RB]) >> 1;
+
+ _uint iLC, iTC, iRC, iBC;
+
+ iLC = (m_iCorners[CORNER_LT] + m_iCorners[CORNER_LB]) >> 1;
+ iTC = (m_iCorners[CORNER_LT] + m_iCorners[CORNER_RT]) >> 1;
+ iRC = (m_iCorners[CORNER_RT] + m_iCorners[CORNER_RB]) >> 1;
+ iBC = (m_iCorners[CORNER_LB] + m_iCorners[CORNER_RB]) >> 1;
+
+ /* 점들을 이용해서 하위 트리를 만든다 */
+ m_pChildren[CORNER_LT] = CQuadTree::Create(m_iCorners[CORNER_LT], iTC, m_iCenter, iLC);
+ m_pChildren[CORNER_RT] = CQuadTree::Create(iTC, m_iCorners[CORNER_RT], iRC, m_iCenter);
+ m_pChildren[CORNER_RB] = CQuadTree::Create(m_iCenter, iRC, m_iCorners[CORNER_RB], iBC);
+ m_pChildren[CORNER_LB] = CQuadTree::Create(iLC, m_iCenter, iBC, m_iCorners[CORNER_LB]);
+
+ return S_OK;
+}
+
+CQuadTree* CQuadTree::Create(_uint iLT, _uint iRT, _uint iRB, _uint iLB)
+{
+ CQuadTree* pInstance = new CQuadTree();
+
+ if (FAILED(pInstance->Initialize(iLT, iRT, iRB, iLB)))
+ {
+ MSG_BOX("Failed to Created : CQuadTree");
+ Safe_Release(pInstance);
+ }
+
+ return pInstance;
+}
+
+void CQuadTree::Free()
+{
+ __super::Free();
+
+ for (auto& pChild : m_pChildren)
+ Safe_Release(pChild);
+
+}
diff --git a/Jusin154_Team3D/Engine/Private/Renderer.cpp b/Jusin154_Team3D/Engine/Private/Renderer.cpp
index c521efb9e..7de2341bf 100644
--- a/Jusin154_Team3D/Engine/Private/Renderer.cpp
+++ b/Jusin154_Team3D/Engine/Private/Renderer.cpp
@@ -176,12 +176,18 @@ void CRenderer::Render_LightAcc()
m_pShader->Bind_RawValue("g_vCamPosition", m_pGameInstance->Get_CamPosition(), sizeof(_float4));
m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float));
+ if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Diffuse"), m_pShader, "g_DiffuseTexture"))) {
+ return;
+ }
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Normal"), m_pShader, "g_NormalTexture"))) {
return;
}
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Depth"), m_pShader, "g_DepthTexture"))) {
return;
}
+ if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Surface"), m_pShader, "g_SurfaceTexture"))) {
+ return;
+ }
m_pVIBuffer->Bind_Resources();
@@ -538,6 +544,12 @@ HRESULT CRenderer::Initialize()
return E_FAIL;
}
+ /* Target_Surface */
+ if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_Surface"), (_uint)Viewport.Width, (_uint)Viewport.Height,
+ DXGI_FORMAT_R32G32B32A32_FLOAT, _float4(0.0f, 0.f, 0.f, 0.f)))) {
+ return E_FAIL;
+ }
+
/* Target_Shade */
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_Shade"), (_uint)Viewport.Width, (_uint)Viewport.Height,
DXGI_FORMAT_R16G16B16A16_UNORM, _float4(0.0f, 0.f, 0.f, 1.f)))) {
@@ -620,6 +632,9 @@ HRESULT CRenderer::Initialize()
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_GameObjects"), TEXT("Target_Color")))) {
return E_FAIL;
}
+ if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_GameObjects"), TEXT("Target_Surface")))) {
+ return E_FAIL;
+ }
/* MRT_LightAcc */
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_LightAcc"), TEXT("Target_Shade")))) {
@@ -672,19 +687,19 @@ HRESULT CRenderer::Initialize()
}
- m_pShader = (CShader*)m_pGameInstance->Clone_Asset_Prototype(g_iStaticLevel, TEXT("FX_DEFERRED"), nullptr, nullptr);
+ m_pShader = (CShader*)m_pGameInstance->Clone_Asset_Prototype(g_iStaticLevel, FX_DEFERRED, nullptr, nullptr);
if (nullptr == m_pShader) {
return E_FAIL;
}
- m_pLastColorShader = (CShader*)m_pGameInstance->Clone_Asset_Prototype(g_iStaticLevel, TEXT("FX_LASTCOLOR"), nullptr, nullptr);
+ m_pLastColorShader = (CShader*)m_pGameInstance->Clone_Asset_Prototype(g_iStaticLevel, FX_LASTCOLOR, nullptr, nullptr);
if (nullptr == m_pLastColorShader) {
return E_FAIL;
}
- m_pWeightBlendShader = (CShader*)m_pGameInstance->Clone_Asset_Prototype(g_iStaticLevel, TEXT("FX_WEIGHTBELND"), nullptr, nullptr);
+ m_pWeightBlendShader = (CShader*)m_pGameInstance->Clone_Asset_Prototype(g_iStaticLevel, FX_WEIGHTBELND, nullptr, nullptr);
if (nullptr == m_pWeightBlendShader) {
return E_FAIL;
diff --git a/Jusin154_Team3D/Engine/Private/Shader.cpp b/Jusin154_Team3D/Engine/Private/Shader.cpp
index b10c8276f..6b90564bc 100644
--- a/Jusin154_Team3D/Engine/Private/Shader.cpp
+++ b/Jusin154_Team3D/Engine/Private/Shader.cpp
@@ -122,10 +122,15 @@ HRESULT CShader::CreateShader(const _tchar* pShaderFilePath, const D3D11_INPUT_E
iHlslFlag = D3DCOMPILE_OPTIMIZATION_LEVEL1;
#endif
- /*ID3DBlob* pBlob;*/
+ ID3DBlob* pBlob;
- if (FAILED(D3DX11CompileEffectFromFile(pShaderFilePath, nullptr, D3D_COMPILE_STANDARD_FILE_INCLUDE, iHlslFlag, 0, m_pDevice, &m_pEffect, nullptr)))
+ if (FAILED(D3DX11CompileEffectFromFile(pShaderFilePath, nullptr, D3D_COMPILE_STANDARD_FILE_INCLUDE, iHlslFlag, 0, m_pDevice, &m_pEffect, &pBlob))) {
+ if (pBlob) {
+ OutputDebugStringA((char*)pBlob->GetBufferPointer());
+ pBlob->Release();
+ }
return E_FAIL;
+ }
ID3DX11EffectTechnique* pTechnique = m_pEffect->GetTechniqueByIndex(0);
if (nullptr == pTechnique)
diff --git a/Jusin154_Team3D/Engine/Private/ThreadHolder.cpp b/Jusin154_Team3D/Engine/Private/ThreadHolder.cpp
new file mode 100644
index 000000000..a34a06976
--- /dev/null
+++ b/Jusin154_Team3D/Engine/Private/ThreadHolder.cpp
@@ -0,0 +1,77 @@
+#include "pch.h"
+
+#include "ThreadHolder.h"
+
+CThreadHolder::CThreadHolder()
+{
+}
+
+CThreadHolder::~CThreadHolder()
+{
+}
+
+void CThreadHolder::WorkerThread()
+{
+ while (true)
+ {
+ function job = {};
+ unique_lock lock(m_mtxJobQueue);
+ {
+ m_cvJobQueue.wait(lock, [this]() {
+ return !this->m_JobQueue.empty() || m_bStop_All;
+ });
+ if (m_bStop_All && this->m_JobQueue.empty()) {
+ return;
+ }
+
+ function job = move(m_JobQueue.front());
+ m_JobQueue.pop();
+ }
+ lock.unlock();
+
+ job();
+ }
+}
+
+void CThreadHolder::EnqueueJob(function job)
+{
+ if (m_bStop_All) {
+ throw runtime_error("ThreadPool 사용 중지됨");
+ }
+
+ lock_guard lock(m_mtxJobQueue);
+ m_JobQueue.push(move(job));
+
+ m_cvJobQueue.notify_one();
+}
+
+HRESULT CThreadHolder::Initialize(_uint iSize)
+{
+ m_bStop_All = false;
+ m_iNumThreads = iSize;
+ m_Workers.reserve(iSize);
+ for (_uint i = 0; i < m_iNumThreads; ++i) {
+ m_Workers.emplace_back([this]() {this->WorkerThread(); });
+
+ }
+
+ return S_OK;
+}
+
+CThreadHolder* CThreadHolder::Create(_uint iSize)
+{
+ CThreadHolder* pInstance = new CThreadHolder();
+ if (FAILED(pInstance->Initialize(iSize))) {
+ SAFE_RELEASE(pInstance);
+ }
+ return pInstance;
+}
+
+void CThreadHolder::Free()
+{
+ __super::Free();
+}
+
+void CThreadHolder::Describe_Entity()
+{
+}
diff --git a/Jusin154_Team3D/Engine/Private/Transform.cpp b/Jusin154_Team3D/Engine/Private/Transform.cpp
index b6fe733ca..0585b946c 100644
--- a/Jusin154_Team3D/Engine/Private/Transform.cpp
+++ b/Jusin154_Team3D/Engine/Private/Transform.cpp
@@ -225,6 +225,32 @@ void CTransform::Turn(_fvector vAxis, _float fTimeDelta)
Set_State(STATE::LOOK, vLook);
}
+void CTransform::TurnAngle(_vector vAxis, _float fAngle)
+{
+ _vector vRight = Get_State(STATE::RIGHT);
+ _vector vUp = Get_State(STATE::UP);
+ _vector vLook = Get_State(STATE::LOOK);
+ if (vAxis.m128_f32[0] == 0)
+ return;
+ if (vAxis.m128_f32[1] == 0)
+ return;
+ if (vAxis.m128_f32[2] == 0)
+ return;
+
+ vAxis = XMVector3Normalize(vAxis);
+
+ _matrix TurnMatrix = XMMatrixRotationAxis(vAxis, fAngle);
+
+ vRight = XMVector3TransformNormal(vRight, TurnMatrix);
+ vUp = XMVector3TransformNormal(vUp, TurnMatrix);
+ vLook = XMVector3TransformNormal(vLook, TurnMatrix);
+
+ Set_State(STATE::RIGHT, vRight);
+ Set_State(STATE::UP, vUp);
+ Set_State(STATE::LOOK, vLook);
+}
+
+
void CTransform::Rotation(_fvector vAxis, _float fRadian)
{
_float3 vScale = Get_Scale();
diff --git a/Jusin154_Team3D/Engine/Private/Unit.cpp b/Jusin154_Team3D/Engine/Private/Unit.cpp
index c916579ef..1d4672861 100644
--- a/Jusin154_Team3D/Engine/Private/Unit.cpp
+++ b/Jusin154_Team3D/Engine/Private/Unit.cpp
@@ -23,7 +23,7 @@ HRESULT CUnit::Initialize(void* pArg)
if (FAILED(__super::Initialize(pArg)))
return E_FAIL;
- m_Animation.resize(FSMSTATE::END);
+ m_Animation.resize(STATEANIM::END);
return S_OK;
}
diff --git a/Jusin154_Team3D/Engine/Private/VIBuffer_Terrain.cpp b/Jusin154_Team3D/Engine/Private/VIBuffer_Terrain.cpp
index ac794b025..0964984a4 100644
--- a/Jusin154_Team3D/Engine/Private/VIBuffer_Terrain.cpp
+++ b/Jusin154_Team3D/Engine/Private/VIBuffer_Terrain.cpp
@@ -1,143 +1,154 @@
-#include "pch.h"
+#include "pch.h"
#include "VIBuffer_Terrain.h"
-
#include "GameInstance.h"
+#include "QuadTree.h"
-CVIBuffer_Terrain::CVIBuffer_Terrain(ID3D11Device * pDevice, ID3D11DeviceContext * pContext)
+CVIBuffer_Terrain::CVIBuffer_Terrain(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
: CVIBuffer{ pDevice, pContext }
{
}
-CVIBuffer_Terrain::CVIBuffer_Terrain(CVIBuffer_Terrain& rhs)
- :CVIBuffer(rhs),
- m_iNumVerticesX{ rhs.m_iNumVerticesX },
- m_iNumVerticesZ{ rhs.m_iNumVerticesZ }
+CVIBuffer_Terrain::CVIBuffer_Terrain(const CVIBuffer_Terrain& rhs)
+ : CVIBuffer(rhs)
+ , m_iNumVerticesX{ rhs.m_iNumVerticesX }
+ , m_iNumVerticesZ{ rhs.m_iNumVerticesZ }
+ , m_pQuadTree{ rhs.m_pQuadTree }
{
+ Safe_AddRef(m_pQuadTree);
}
HRESULT CVIBuffer_Terrain::Initialize_Prototype(const _char* pFilePath, _uint iSizeX, _uint iSizeZ)
{
- m_bChange = { false };
- m_iNumVerticesX = iSizeX;
- m_iNumVerticesZ = iSizeZ;
+ _ulong dwByte = {};
+ HANDLE hFile = CreateFile(CMyTools::ToWstring(pFilePath).c_str(), GENERIC_READ, 0, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
+
+ BITMAPFILEHEADER fh{};
+ BITMAPINFOHEADER ih{};
+
+ ReadFile(hFile, &fh, sizeof fh, &dwByte, nullptr);
+ ReadFile(hFile, &ih, sizeof ih, &dwByte, nullptr);
+
+ m_iNumVerticesX = ih.biWidth + 1;//iSizeX;
+ m_iNumVerticesZ = ih.biHeight + 1;//iSizeZ;
m_iNumVertices = m_iNumVerticesX * m_iNumVerticesZ;
- m_pVertexPositions = new _float3[m_iNumVertices];
- ZeroMemory(m_pVertexPositions, sizeof(_float3) * m_iNumVertices);
-
- //if (FAILED(Load_HeightFile(pFilePath)))
- // return E_FAIL;
-
- m_iNumVertexBuffers = 1;
- m_iVertexStride = sizeof(VTXNORTEX);
-
_uint* pPixels = new _uint[m_iNumVertices];
ZeroMemory(pPixels, sizeof(_uint) * m_iNumVertices);
+ ReadFile(hFile, pPixels, sizeof(_uint) * ih.biHeight * ih.biWidth, &dwByte, nullptr);
+
+ m_iNumVertexBuffers = 1;
+
+ m_iVertexStride = sizeof(VTXNORTEX);
+
m_iNumIndices = (m_iNumVerticesX - 1) * (m_iNumVerticesZ - 1) * 2 * 3;
m_iIndexStride = 4;
m_eIndexFormat = DXGI_FORMAT_R32_UINT;
m_ePrimitive = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
-#pragma region VETEX_BUFFER
- D3D11_BUFFER_DESC VBDesc = {};
+#pragma region VERTEX_BUFFER
+ D3D11_BUFFER_DESC VBDesc{};
VBDesc.ByteWidth = m_iVertexStride * m_iNumVertices;
- VBDesc.Usage = D3D11_USAGE_DEFAULT;
- VBDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
+ VBDesc.Usage = D3D11_USAGE_STAGING;
+ VBDesc.BindFlags = 0;//D3D11_BIND_VERTEX_BUFFER;
VBDesc.StructureByteStride = m_iVertexStride;
- VBDesc.CPUAccessFlags = 0;
+ VBDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE | D3D11_CPU_ACCESS_READ;
VBDesc.MiscFlags = 0;
VTXNORTEX* pVertices = new VTXNORTEX[m_iNumVertices];
ZeroMemory(pVertices, sizeof(VTXNORTEX) * m_iNumVertices);
- for (_uint i = 0; i < m_iNumVerticesZ; ++i)
- {
- for (_uint j = 0; j < m_iNumVerticesX; ++j)
- {
- _uint iIndex = j + i * m_iNumVerticesX;
+ m_pVertexPositions = new _float3[m_iNumVertices];
+ ZeroMemory(m_pVertexPositions, sizeof(_float3) * m_iNumVertices);
- m_pVertexPositions[iIndex] = pVertices[iIndex].vPosition = _float3((_float)j, 0.f, (_float)i);
+ for (_uint i = 0; i < m_iNumVerticesZ; i++)
+ {
+ for (_uint j = 0; j < m_iNumVerticesX; j++)
+ {
+ _uint iIndex = i * m_iNumVerticesX + j;
+
+ m_pVertexPositions[iIndex] = pVertices[iIndex].vPosition = _float3((_float)j, (_float)(pPixels[iIndex] & 0x000000ff) / 5.f, (_float)i);
pVertices[iIndex].vNormal = _float3(0.f, 0.f, 0.f);
pVertices[iIndex].vTexcoord = _float2(j / (m_iNumVerticesX - 1.f), i / (m_iNumVerticesZ - 1.f));
}
}
- D3D11_SUBRESOURCE_DATA InitVBData = {};
- InitVBData.pSysMem = pVertices;
+
+ D3D11_SUBRESOURCE_DATA InitialVBData{};
+ InitialVBData.pSysMem = pVertices;
#pragma endregion
#pragma region INDEX_BUFFER
- D3D11_BUFFER_DESC IBDesc = {};
- IBDesc.ByteWidth = m_iNumIndices * m_iIndexStride;
- IBDesc.Usage = D3D11_USAGE_DEFAULT;
+ D3D11_BUFFER_DESC IBDesc{};
+ IBDesc.ByteWidth = m_iIndexStride * m_iNumIndices;
+ IBDesc.Usage = D3D11_USAGE_DYNAMIC;
IBDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
IBDesc.StructureByteStride = m_iIndexStride;
- IBDesc.CPUAccessFlags = 0;
+ IBDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
IBDesc.MiscFlags = 0;
+
_uint* pIndices = new _uint[m_iNumIndices];
ZeroMemory(pIndices, sizeof(_uint) * m_iNumIndices);
- _uint iNumIndex = {};
- _uint iCountZ = m_iNumVerticesZ - 1;
- _uint iCountX = m_iNumVerticesX - 1;
- for (_uint i = 0; i < iCountZ; ++i)
- {
- for (_uint j = 0; j < iCountX; ++j)
- {
- _uint iIndex = j + i * m_iNumVerticesX;
+ _uint iNumIndices = {};
- _uint Indices[4] = {
+ for (_uint i = 0; i < m_iNumVerticesZ - 1; i++)
+ {
+ for (_uint j = 0; j < m_iNumVerticesX - 1; j++)
+ {
+ _uint iIndex = i * m_iNumVerticesX + j;
+
+ _uint iIndices[4] = {
iIndex + m_iNumVerticesX,
iIndex + m_iNumVerticesX + 1,
iIndex + 1,
- iIndex,
+ iIndex
};
- pIndices[iNumIndex++] = Indices[0];
- pIndices[iNumIndex++] = Indices[1];
- pIndices[iNumIndex++] = Indices[2];
+ _vector vSourDir, vDestDir, vNormal;
- _vector vSrc, vDst, vNormal;
+ pIndices[iNumIndices++] = iIndices[0];
+ pIndices[iNumIndices++] = iIndices[1];
+ pIndices[iNumIndices++] = iIndices[2];
- vSrc = XMLoadFloat3(&pVertices[Indices[1]].vPosition) - XMLoadFloat3(&pVertices[Indices[0]].vPosition);
- vDst = XMLoadFloat3(&pVertices[Indices[2]].vPosition) - XMLoadFloat3(&pVertices[Indices[0]].vPosition);
+ vSourDir = XMLoadFloat3(&pVertices[iIndices[1]].vPosition) - XMLoadFloat3(&pVertices[iIndices[0]].vPosition);
+ vDestDir = XMLoadFloat3(&pVertices[iIndices[2]].vPosition) - XMLoadFloat3(&pVertices[iIndices[1]].vPosition);
+ vNormal = XMVector3Normalize(XMVector3Cross(vSourDir, vDestDir));
- vNormal = XMVector3Normalize(XMVector3Cross(vSrc, vDst));
+ XMStoreFloat3(&pVertices[iIndices[0]].vNormal, XMLoadFloat3(&pVertices[iIndices[0]].vNormal) + vNormal);
+ XMStoreFloat3(&pVertices[iIndices[1]].vNormal, XMLoadFloat3(&pVertices[iIndices[1]].vNormal) + vNormal);
+ XMStoreFloat3(&pVertices[iIndices[2]].vNormal, XMLoadFloat3(&pVertices[iIndices[2]].vNormal) + vNormal);
- XMStoreFloat3(&pVertices[Indices[0]].vNormal, XMLoadFloat3(&pVertices[Indices[0]].vNormal) + vNormal);
- XMStoreFloat3(&pVertices[Indices[1]].vNormal, XMLoadFloat3(&pVertices[Indices[1]].vNormal) + vNormal);
- XMStoreFloat3(&pVertices[Indices[2]].vNormal, XMLoadFloat3(&pVertices[Indices[2]].vNormal) + vNormal);
+ pIndices[iNumIndices++] = iIndices[0];
+ pIndices[iNumIndices++] = iIndices[2];
+ pIndices[iNumIndices++] = iIndices[3];
- pIndices[iNumIndex++] = Indices[0];
- pIndices[iNumIndex++] = Indices[2];
- pIndices[iNumIndex++] = Indices[3];
+ vSourDir = XMLoadFloat3(&pVertices[iIndices[2]].vPosition) - XMLoadFloat3(&pVertices[iIndices[0]].vPosition);
+ vDestDir = XMLoadFloat3(&pVertices[iIndices[3]].vPosition) - XMLoadFloat3(&pVertices[iIndices[2]].vPosition);
+ vNormal = XMVector3Normalize(XMVector3Cross(vSourDir, vDestDir));
- vSrc = XMLoadFloat3(&pVertices[Indices[2]].vPosition) - XMLoadFloat3(&pVertices[Indices[0]].vPosition);
- vDst = XMLoadFloat3(&pVertices[Indices[3]].vPosition) - XMLoadFloat3(&pVertices[Indices[2]].vPosition);
-
- vNormal = XMVector3Normalize(XMVector3Cross(vSrc, vDst));
-
- XMStoreFloat3(&pVertices[Indices[0]].vNormal, XMLoadFloat3(&pVertices[Indices[0]].vNormal) + vNormal);
- XMStoreFloat3(&pVertices[Indices[2]].vNormal, XMLoadFloat3(&pVertices[Indices[2]].vNormal) + vNormal);
- XMStoreFloat3(&pVertices[Indices[3]].vNormal, XMLoadFloat3(&pVertices[Indices[3]].vNormal) + vNormal);
+ XMStoreFloat3(&pVertices[iIndices[0]].vNormal, XMLoadFloat3(&pVertices[iIndices[0]].vNormal) + vNormal);
+ XMStoreFloat3(&pVertices[iIndices[2]].vNormal, XMLoadFloat3(&pVertices[iIndices[2]].vNormal) + vNormal);
+ XMStoreFloat3(&pVertices[iIndices[3]].vNormal, XMLoadFloat3(&pVertices[iIndices[3]].vNormal) + vNormal);
}
}
- for (_uint i = 0; i < m_iNumVertices; ++i)
+ for (size_t i = 0; i < m_iNumVertices; i++)
{
- XMStoreFloat3(&pVertices[i].vNormal, XMVector3Normalize(XMLoadFloat3(&pVertices[i].vNormal)));
+ XMStoreFloat3(&pVertices[i].vNormal,
+ XMVector3Normalize(XMLoadFloat3(&pVertices[i].vNormal)));
}
- D3D11_SUBRESOURCE_DATA InitIBData = {};
- InitIBData.pSysMem = pIndices;
+ D3D11_SUBRESOURCE_DATA InitialIBData{};
+ InitialIBData.pSysMem = pIndices;
+#pragma endregion
- if (FAILED(m_pDevice->CreateBuffer(&VBDesc, &InitVBData, &m_pVB)))
+ if (FAILED(m_pDevice->CreateBuffer(&VBDesc, &InitialVBData, &m_pVB)))
return E_FAIL;
- if (FAILED(m_pDevice->CreateBuffer(&IBDesc, &InitIBData, &m_pIB)))
+ if (FAILED(m_pDevice->CreateBuffer(&IBDesc, &InitialIBData, &m_pIB)))
return E_FAIL;
Safe_Delete_Array(pVertices);
@@ -145,7 +156,11 @@ HRESULT CVIBuffer_Terrain::Initialize_Prototype(const _char* pFilePath, _uint iS
Safe_Delete_Array(pPixels);
-#pragma endregion
+ m_pQuadTree = CQuadTree::Create(m_iNumVerticesX * m_iNumVerticesZ - m_iNumVerticesX, m_iNumVerticesX * m_iNumVerticesZ - 1, m_iNumVerticesX - 1, 0);
+ if (nullptr == m_pQuadTree)
+ return E_FAIL;
+
+ m_pQuadTree->SetUp_Neighbors();
return S_OK;
}
@@ -155,76 +170,84 @@ HRESULT CVIBuffer_Terrain::Initialize(void* pArg)
return S_OK;
}
-_bool CVIBuffer_Terrain::Picking(CTransform* pTransform, _float3& pOut)
+_bool CVIBuffer_Terrain::Picking(_fmatrix WorldMatrix, _float3* pOut)
{
- _matrix WorldMatrixInv = pTransform->Get_WorldMatrixInv();
+ _matrix WorldInv = XMMatrixInverse(nullptr, WorldMatrix);
- m_pGameInstance->Ray_WorldToLocal(&WorldMatrixInv);
-
- _uint iNumIndices = {};
-
- for (_uint i = 0; i < m_iNumVerticesZ - 1; i++)
- {
- for (_uint j = 0; j < m_iNumVerticesX - 1; j++)
- {
- _uint iIndex = i * m_iNumVerticesX + j;
-
- _uint iIndices[4] = {
- iIndex + m_iNumVerticesX,
- iIndex + m_iNumVerticesX + 1,
- iIndex + 1,
- iIndex
- };
-
- if (true == m_pGameInstance->MousePicking_InLocalSpace(m_pVertexPositions[iIndices[0]], m_pVertexPositions[iIndices[1]], m_pVertexPositions[iIndices[2]], pOut))
- {
- XMStoreFloat3(&pOut, XMVector3TransformCoord(XMLoadFloat3(&pOut), XMLoadFloat4x4(pTransform->Get_WorldMatrixPtr())));
- return true;
- }
-
- if (true == m_pGameInstance->MousePicking_InWorldSpace(m_pVertexPositions[iIndices[0]], m_pVertexPositions[iIndices[2]], m_pVertexPositions[iIndices[3]], pOut))
- {
- XMStoreFloat3(&pOut, XMVector3TransformCoord(XMLoadFloat3(&pOut), XMLoadFloat4x4(pTransform->Get_WorldMatrixPtr())));
- return true;
- }
- }
- }
-
- return false;
+ m_pGameInstance->Ray_WorldToLocal(&WorldInv);
+ return m_pQuadTree->Picking(m_pGameInstance,m_pVertexPositions, *pOut, WorldMatrix);
}
+void CVIBuffer_Terrain::Culling(_fmatrix WorldMatrix)
+{
+ m_pGameInstance->Transform_Frustum_ToLocalSpace(XMMatrixInverse(nullptr, WorldMatrix));
-CVIBuffer_Terrain * CVIBuffer_Terrain::Create(ID3D11Device * pDevice, ID3D11DeviceContext * pContext, const _char * pFilePath, _uint iSizeX, _uint iSizeZ)
+ D3D11_MAPPED_SUBRESOURCE SubResource{};
+
+ m_pContext->Map(m_pIB, 0, D3D11_MAP_WRITE_DISCARD, 0, &SubResource);
+
+ _uint* pIndices = static_cast<_uint*>(SubResource.pData);
+
+ _uint iNumIndices = {};
+
+ m_pQuadTree->Culling(m_pGameInstance, m_pVertexPositions, pIndices, &iNumIndices);
+
+ m_pContext->Unmap(m_pIB, 0);
+
+ m_iNumIndices = iNumIndices;
+}
+
+void CVIBuffer_Terrain::FitY(_fmatrix WorldMatrix, _float fY)
+{
+ m_pGameInstance->Transform_Frustum_ToLocalSpace(XMMatrixInverse(nullptr, WorldMatrix));
+
+ D3D11_MAPPED_SUBRESOURCE SubResource{};
+
+ m_pContext->Map(m_pVB, 0, D3D11_MAP_WRITE, 0, &SubResource);
+
+ VTXNORTEX* pVertices = static_cast(SubResource.pData);
+
+ _matrix WorldInv = XMMatrixInverse(nullptr, WorldMatrix);
+
+ m_pGameInstance->Ray_WorldToLocal(&WorldInv);
+
+ m_pQuadTree->Set_Y(m_pGameInstance, m_pVertexPositions, pVertices, WorldMatrix, fY);
+
+ m_pContext->Unmap(m_pVB, 0);
+}
+
+CVIBuffer_Terrain* CVIBuffer_Terrain::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _char* pFilePath, _uint iSizeX, _uint iSizeZ)
{
CVIBuffer_Terrain* pInstance = new CVIBuffer_Terrain(pDevice, pContext);
if (FAILED(pInstance->Initialize_Prototype(pFilePath, iSizeX, iSizeZ)))
{
- MSG_BOX("Failed to Create : CVIBuffer_Terrain");
- SAFE_RELEASE(pInstance);
+ MSG_BOX("Failed to Created : CVIBuffer_Terrain");
+ Safe_Release(pInstance);
}
return pInstance;
}
-CVIBuffer_Terrain* CVIBuffer_Terrain::Clone(void* pArg, CGameObject* pOwner)
+CComponent* CVIBuffer_Terrain::Clone(void* pArg, class CGameObject* pOwner)
{
CVIBuffer_Terrain* pInstance = new CVIBuffer_Terrain(*this);
- pInstance->m_pOwner = pOwner;
+
if (FAILED(pInstance->Initialize(pArg)))
{
MSG_BOX("Failed to Cloned : CVIBuffer_Terrain");
- SAFE_RELEASE(pInstance);
+ Safe_Release(pInstance);
}
return pInstance;
}
-
void CVIBuffer_Terrain::Free()
{
__super::Free();
+
+ Safe_Release(m_pQuadTree);
}
void CVIBuffer_Terrain::Describe_Entity()
{
-}
\ No newline at end of file
+}
diff --git a/Jusin154_Team3D/Engine/Public/Assimp/material.h b/Jusin154_Team3D/Engine/Public/Assimp/material.h
index 9d10347cc..1da122b05 100644
--- a/Jusin154_Team3D/Engine/Public/Assimp/material.h
+++ b/Jusin154_Team3D/Engine/Public/Assimp/material.h
@@ -1,4 +1,4 @@
-/*
+/*
---------------------------------------------------------------------------
Open Asset Import Library (assimp)
---------------------------------------------------------------------------
diff --git a/Jusin154_Team3D/Engine/Public/Channel.h b/Jusin154_Team3D/Engine/Public/Channel.h
index 9a5590477..745a95f1c 100644
--- a/Jusin154_Team3D/Engine/Public/Channel.h
+++ b/Jusin154_Team3D/Engine/Public/Channel.h
@@ -22,7 +22,11 @@ class ENGINE_DLL CChannel : public CBase
void Update_TransformationMatirx(const vector& Bones, _float fCurrentTrackPosition, _uint* pCurrentKeyFrameIndex,class CTransform* pTransform=nullptr);
_int Get_BoneIndex() { return { m_iBoneIndex }; }
void Set_BoneIndex(_int iBoneIndex) { m_iBoneIndex = iBoneIndex; }
- void ResetRootMotion() { m_vPrevRootPos = { 0.f, 0.f, 0.f }; }
+ void ResetRootMotion() {
+ m_vPrevRootPos = { 0.f, 0.f, 0.f };
+ m_vPrevRootRot = { 0.f,0.f,0.f,0.f };
+ m_bInitialRootRotSaved = false;
+ }
_matrix Get_BoneTransformationMatrix() { return m_BoneTransformationMatrix; }
KEYFRAME* Get_Frame(_uint iIndex);
@@ -38,7 +42,6 @@ class ENGINE_DLL CChannel : public CBase
//
HRESULT Initialize(const vector& Bones, _uint iIndex);
-
private:
_char m_szName[MAX_PATH] = {}; // 영향을 받을 본의 이름
_int m_iBoneIndex = { -1 }; // 본 벡터에서 본의 인덱스
@@ -46,7 +49,11 @@ class ENGINE_DLL CChannel : public CBase
_float4x4 m_PreTransformMatrix = {};
vector m_KeyFrames; // 키프레임 벡터
_float3 m_vPrevRootPos = { 0.f, 0.f, 0.f };
+ _float4 m_vPrevRootRot = { 0.f, 0.f, 0.f,0.f };
_matrix m_BoneTransformationMatrix = {};
+ _float m_fPrevYaw = 0.f;
+ _bool m_bInitialRootRotSaved = {false};
+_float4 m_vInitialRootRot = {};
public:
static CChannel* Create(const vector& Bones, _uint iIndex); // 럴프전용
static CChannel* Create(HANDLE hFile, DWORD& dwByte);
diff --git a/Jusin154_Team3D/Engine/Public/Engine_Enum.h b/Jusin154_Team3D/Engine/Public/Engine_Enum.h
index ea9ef2e51..6ab74b1a2 100644
--- a/Jusin154_Team3D/Engine/Public/Engine_Enum.h
+++ b/Jusin154_Team3D/Engine/Public/Engine_Enum.h
@@ -37,6 +37,11 @@ enum class SHADER_PASS_CELL { DEBUG, END };
enum class SHADER_PASS_DEFERRED { DEBUG, DIRECTIONAL, POINT, COMBINED, BLUR, SPOT, END };
enum class QUESTYPE {MAIN, SUB, END};
+enum class TEXTURE_MOUNT_SLOT0 { NOT_DEFINED, METALLIC, SPECULAR, HEIGHT, END };
+enum class TEXTURE_MOUNT_SLOT1 { NOT_DEFINED, ROUGHNESS, END };
+enum class TEXTURE_MOUNT_SLOT2 { NOT_DEFINED, OCCLUSION, ALPHA, Amount_Scatter, END };
+enum class TEXTURE_MOUNT_SLOT3 { NOT_DEFINED, HEIGHT, ALPHA, Brightness_Scatter, END };
+
#ifndef EDITOR_PROJECT
enum aiTextureType {
diff --git a/Jusin154_Team3D/Engine/Public/Engine_Macro.h b/Jusin154_Team3D/Engine/Public/Engine_Macro.h
index 00bf5e20e..f75a7a74c 100644
--- a/Jusin154_Team3D/Engine/Public/Engine_Macro.h
+++ b/Jusin154_Team3D/Engine/Public/Engine_Macro.h
@@ -71,6 +71,11 @@
#define PURE = 0
#endif
+#define FX_DEFERRED TEXT("FX_DEFERRED")
+#define FX_LASTCOLOR TEXT("FX_LASTCOLOR")
+#define FX_WEIGHTBELND TEXT("FX_WEIGHTBELND")
+
+
#define SAFE_ADDREF(pInstance) Safe_AddRef(pInstance)
#define SAFE_RELEASE(pInstance) Safe_Release(pInstance)
diff --git a/Jusin154_Team3D/Engine/Public/Engine_Struct.h b/Jusin154_Team3D/Engine/Public/Engine_Struct.h
index 89146f58e..0e4a8f3e7 100644
--- a/Jusin154_Team3D/Engine/Public/Engine_Struct.h
+++ b/Jusin154_Team3D/Engine/Public/Engine_Struct.h
@@ -122,7 +122,7 @@ struct SaveMesh
struct SaveMaterial
{
- vector Path[27];
+ vector Path[AI_TEXTURE_TYPE_MAX];
};
diff --git a/Jusin154_Team3D/Engine/Public/Engine_Typedef.h b/Jusin154_Team3D/Engine/Public/Engine_Typedef.h
index 40ba0d8ef..dd7629714 100644
--- a/Jusin154_Team3D/Engine/Public/Engine_Typedef.h
+++ b/Jusin154_Team3D/Engine/Public/Engine_Typedef.h
@@ -43,4 +43,4 @@ typedef CXMMATRIX _cmatrix;
typedef POINT _point;
-NS_END
\ No newline at end of file
+NS_END
diff --git a/Jusin154_Team3D/Engine/Public/FSM.h b/Jusin154_Team3D/Engine/Public/FSM.h
index af92dd6e7..736f2c6ca 100644
--- a/Jusin154_Team3D/Engine/Public/FSM.h
+++ b/Jusin154_Team3D/Engine/Public/FSM.h
@@ -3,17 +3,16 @@
NS_BEGIN(FSMSTATE)
enum ESTATE
{
- IDLE,
+ IDLE,IDLE_TURN,
MOVE, WALK, WALK_FWD, WALK_BWD, JOG, SPRINT,
JUMP,
LAND,
DODGE,
- COMBAT, LIGHT_ATTACK, CAST, SKILL,
+ COMBAT, LIGHT_ATTACK, CAST, SKILL,SKILL2,
END
};
NS_END
-
NS_BEGIN(Engine)
class CState;
diff --git a/Jusin154_Team3D/Engine/Public/Material.h b/Jusin154_Team3D/Engine/Public/Material.h
index 7f56edd79..ab0c0678b 100644
--- a/Jusin154_Team3D/Engine/Public/Material.h
+++ b/Jusin154_Team3D/Engine/Public/Material.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "Base.h"
@@ -11,7 +11,7 @@ class ENGINE_DLL CMaterial final : public CBase
virtual ~CMaterial() = default;
public:
- HRESULT Bind_SRV(class CShader* pShader, const _char* pConstantName, _uint iType, _uint iTextureIndex);
+ HRESULT Bind_SRV(class CShader* pShader);
SaveMaterial Get_SaveMaterial() { return m_SaveMaterial; }
private:
class CGameInstance* m_pGameInstance = { nullptr };
@@ -25,7 +25,6 @@ class ENGINE_DLL CMaterial final : public CBase
public:
static CMaterial* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _char* pModelFilePath, const aiMaterial* pAIMaterial);
static CMaterial* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _char* pMaterialFilePath, const _char* pTextureFilePath);
- HRESULT SaveAsBinary(HANDLE hFile, DWORD& dwByte);
private:
vector m_strPath[AI_TEXTURE_TYPE_MAX];
HRESULT Initialize(const _char* pModelFilePath, const aiMaterial* pAIMaterial);
@@ -34,15 +33,15 @@ class ENGINE_DLL CMaterial final : public CBase
HRESULT Add_Texture(const _char* pTextureFolderPath, string& FileType);
#endif // EDITOR_PROJECT
- // ¹ÙÀ̳ʸ®
+ // 바이너리
HRESULT Initialize(const _char* pModelFilePath, const SaveMaterial& _SaveMaterial);
//
public:
- // ¹ÙÀ̳ʸ®
+ // 바이너리
static CMaterial* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _char* pModelFilePathconst, const SaveMaterial& _SaveMaterial);
//
virtual void Free() override;
};
-NS_END
\ No newline at end of file
+NS_END
diff --git a/Jusin154_Team3D/Engine/Public/Mesh.h b/Jusin154_Team3D/Engine/Public/Mesh.h
index 63a669d03..8bcd5149a 100644
--- a/Jusin154_Team3D/Engine/Public/Mesh.h
+++ b/Jusin154_Team3D/Engine/Public/Mesh.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "VIBuffer.h"
@@ -32,7 +32,7 @@ class ENGINE_DLL CMesh final : public CVIBuffer
#endif // EDITOR_PROJECT
public:
- //ÀνºÅϽÌ ¸ðµ¨ Àü¿ë µå·οì, ¹ÙÀεù ÇԼö
+ //인스턴싱 모델 전용 드로우, 바인딩 함수
virtual HRESULT Bind_Resources_Instance(ID3D11Buffer* pVBInstance, _uint iInstanceStride, _uint iBufferCount);
virtual HRESULT Render_Instance(_uint iNumInstance);
@@ -41,7 +41,7 @@ class ENGINE_DLL CMesh final : public CVIBuffer
virtual HRESULT Initialize(void* pArg) override;
HRESULT Ready_VertexBuffer_For_NonAnim(HANDLE hFile, DWORD& dwByte);
HRESULT Ready_VertexBuffer_For_Anim(HANDLE hFile, DWORD& dwByte);
- // ¹ÙÀ̳ʸ®
+ // 바이너리
virtual HRESULT Initialize_Prototype(MODEL eType, const class CModel* pModel, SaveMesh* _SaveMesh, _fmatrix PreTransformMatrix);
HRESULT Ready_VertexBuffer_For_NonAnim(SaveMesh* _SaveMesh, _fmatrix PreTransformMatrix);
HRESULT Ready_VertexBuffer_For_Anim(const class CModel* pModel, SaveMesh* _SaveMesh);
@@ -54,14 +54,14 @@ class ENGINE_DLL CMesh final : public CVIBuffer
vector<_int> m_BoneIndices;
_float4x4* m_pBoneMatrices = { nullptr };
vector<_float4x4> m_offsetMatrices;
- // ¹ÙÀ̳ʸ®
+ // 바이너리
std::vector<_uint> m_Indices;
std::vector<_float3> m_Vertices;
//
public:
static CMesh* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, HANDLE hFile, DWORD& dwByte);
- // ¹ÙÀ̳ʸ®
+ // 바이너리
static CMesh* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, MODEL eType, const class CModel* pModel, SaveMesh* _SaveMesh, _fmatrix PreTransformMatrix);
//
virtual CMesh* Clone(void* pArg, class CGameObject* pOwner = nullptr) override;
@@ -69,4 +69,4 @@ class ENGINE_DLL CMesh final : public CVIBuffer
void Describe_Entity() override;
};
-NS_END
\ No newline at end of file
+NS_END
diff --git a/Jusin154_Team3D/Engine/Public/Model.h b/Jusin154_Team3D/Engine/Public/Model.h
index 0762b3962..b214af79f 100644
--- a/Jusin154_Team3D/Engine/Public/Model.h
+++ b/Jusin154_Team3D/Engine/Public/Model.h
@@ -62,7 +62,7 @@ static _int Get_BoneIndex(const _char* pBoneName, vector Bones); /
_matrix Get_BoneMatrix(_uint iBoneIndex);
#pragma endregion
#pragma region Material
- HRESULT Bind_Material(_uint iMeshIndex, class CShader* pShader, const _char* pConstantName, _uint iType, _uint iTextureIndex);
+ HRESULT Bind_Material(_uint iMeshIndex, class CShader* pShader);
#pragma endregion
diff --git a/Jusin154_Team3D/Engine/Public/Picking.h b/Jusin154_Team3D/Engine/Public/Picking.h
index ef5e709cc..a41197db0 100644
--- a/Jusin154_Team3D/Engine/Public/Picking.h
+++ b/Jusin154_Team3D/Engine/Public/Picking.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "Base.h"
@@ -14,6 +14,7 @@ class CPicking final : public CBase
HRESULT Initialize(HWND hWnd, _uint iSizeX, _uint iSizeY);
void Update();
_bool isPicking(_float3* pOut);
+
private:
HWND m_hWnd = { };
ID3D11Device* m_pDevice = { nullptr };
@@ -32,4 +33,4 @@ class CPicking final : public CBase
virtual void Free();
};
-NS_END
\ No newline at end of file
+NS_END
diff --git a/Jusin154_Team3D/Engine/Public/QuadTree.h b/Jusin154_Team3D/Engine/Public/QuadTree.h
new file mode 100644
index 000000000..bb68da23a
--- /dev/null
+++ b/Jusin154_Team3D/Engine/Public/QuadTree.h
@@ -0,0 +1,38 @@
+#pragma once
+
+#include "Base.h"
+
+NS_BEGIN(Engine)
+
+class CQuadTree final : public CBase
+{
+public:
+ enum CORNER { CORNER_LT, CORNER_RT, CORNER_RB, CORNER_LB, CORNER_END };
+ enum NEIGHBOR { NEIGHBOR_LEFT, NEIGHBOR_TOP, NEIGHBOR_RIGHT, NEIGHBOR_BOTTOM, NEIGHBOR_END };
+private:
+ CQuadTree();
+ virtual ~CQuadTree() = default;
+
+public:
+ void Culling(class CGameInstance* pGameInstance, const _float3* pVertexPositions, _uint* pIndices, _uint* pNumIndices);
+ void SetUp_Neighbors();
+ _bool Picking(class CGameInstance* pGameInstance, const _float3* pVertexPositions, _float3& Out, _fmatrix WorldMatrix);
+ _bool Set_Y(class CGameInstance* pGameInstance, const _float3* pVertexPositions, VTXNORTEX* pVertices, _fmatrix WorldMatrix, _float fY);
+
+private:
+ _uint m_iCorners[CORNER_END] = { };
+ _uint m_iCenter = {};
+
+ CQuadTree* m_pChildren[CORNER_END] = { nullptr };
+ CQuadTree* m_pNeighbors[NEIGHBOR_END] = { nullptr, nullptr, nullptr, nullptr };
+
+private:
+ _bool isDraw(class CGameInstance* pGameInstance, const _float3* pVertexPositions);
+ HRESULT Initialize(_uint iLT, _uint iRT, _uint iRB, _uint iLB);
+
+public:
+ static CQuadTree* Create(_uint iLT, _uint iRT, _uint iRB, _uint iLB);
+ virtual void Free() override;
+};
+
+NS_END
diff --git a/Jusin154_Team3D/Engine/Public/RenderTarget_Manager.h b/Jusin154_Team3D/Engine/Public/RenderTarget_Manager.h
index 24baa3dd0..fa065952c 100644
--- a/Jusin154_Team3D/Engine/Public/RenderTarget_Manager.h
+++ b/Jusin154_Team3D/Engine/Public/RenderTarget_Manager.h
@@ -27,8 +27,8 @@ class CRenderTarget_Manager final : public CBase
#ifdef _DEBUG
private:
- _int m_iSizeX = { 100 };
- _int m_iSizeY = { 100 };
+ _int m_iSizeX = { 200 };
+ _int m_iSizeY = { 200 };
#endif // _DEBUG
private:
diff --git a/Jusin154_Team3D/Engine/Public/State.h b/Jusin154_Team3D/Engine/Public/State.h
index df29cf0e7..13abe1d97 100644
--- a/Jusin154_Team3D/Engine/Public/State.h
+++ b/Jusin154_Team3D/Engine/Public/State.h
@@ -1,6 +1,22 @@
#pragma once
#include "Base.h"
+NS_BEGIN(STATEANIM)
+enum ESTATE
+{
+ IDLE, IDLE_TURN_L, IDLE_TURN_R, IDLE_TURN_BWD,
+ MOVE,
+ WALK, WALK_FWD, WALK_BWD, WALK_STOP,
+ JOG,
+ SPRINT,
+ JUMP,JUMP_WALK,JUMP_SPRINT,
+ LAND,
+ DODGE,
+ COMBAT, LIGHT_ATTACK, CAST, SKILL, SKILL2,
+ END
+};
+NS_END
+
NS_BEGIN(Engine)
class CUnit;
class CModel;
diff --git a/Jusin154_Team3D/Engine/Public/ThreadHolder.h b/Jusin154_Team3D/Engine/Public/ThreadHolder.h
new file mode 100644
index 000000000..8a4507528
--- /dev/null
+++ b/Jusin154_Team3D/Engine/Public/ThreadHolder.h
@@ -0,0 +1,36 @@
+#pragma once
+
+#include "Base.h"
+
+NS_BEGIN(Engine)
+
+class ENGINE_DLL CThreadHolder final : public CBase
+{
+private:
+ CThreadHolder();
+ ~CThreadHolder();
+public:
+ void WorkerThread();
+ void EnqueueJob(function job);
+
+private:
+ _uint m_iNumThreads = {};
+ vector m_Workers = {};
+
+ queue> m_JobQueue = {};
+ condition_variable m_cvJobQueue = {};
+ mutex m_mtxJobQueue = {};
+
+ _bool m_bStop_All = { true };
+
+private:
+ HRESULT Initialize(_uint iSize);
+
+
+public:
+ static CThreadHolder* Create(_uint iSize);
+ virtual void Free() override;
+ void Describe_Entity();
+};
+
+NS_END
diff --git a/Jusin154_Team3D/Engine/Public/Transform.h b/Jusin154_Team3D/Engine/Public/Transform.h
index 2f352efbe..690439bbe 100644
--- a/Jusin154_Team3D/Engine/Public/Transform.h
+++ b/Jusin154_Team3D/Engine/Public/Transform.h
@@ -57,6 +57,7 @@ class ENGINE_DLL CTransform final :
void BookMomentum(_fvector vMomentum);
void Turn(_fvector vAxis, _float fTimeDelta);
+ void TurnAngle(_vector vAxis, _float fAngle);
void Rotation(_fvector vAxis, _float fRadian);
void Rotation(_float fRadianX, _float fRadianY, _float fRadianZ);
void Rotation(_float3& vRadian);
diff --git a/Jusin154_Team3D/Engine/Public/Unit.h b/Jusin154_Team3D/Engine/Public/Unit.h
index 7bd6ca6e8..45bc73380 100644
--- a/Jusin154_Team3D/Engine/Public/Unit.h
+++ b/Jusin154_Team3D/Engine/Public/Unit.h
@@ -39,6 +39,7 @@ class ENGINE_DLL CUnit abstract : public CGameObject
void Set_LightCombo(_uint LightCombo) { m_iLightCombo = LightCombo; }
_float Get_KeyFrame(_string FrameName);
_bool IsCurrentKeyFrame(_string FrameName);
+ virtual void Reset_Sprint() {};
#pragma endregion
protected:
diff --git a/Jusin154_Team3D/Engine/Public/VIBuffer_Terrain.h b/Jusin154_Team3D/Engine/Public/VIBuffer_Terrain.h
index 33a4ed7bf..e936ff428 100644
--- a/Jusin154_Team3D/Engine/Public/VIBuffer_Terrain.h
+++ b/Jusin154_Team3D/Engine/Public/VIBuffer_Terrain.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "VIBuffer.h"
NS_BEGIN(Engine)
@@ -13,7 +13,7 @@ class ENGINE_DLL CVIBuffer_Terrain final : public CVIBuffer
}VIBUFFER_TERRAIN_DESC;
private:
CVIBuffer_Terrain(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
- CVIBuffer_Terrain(CVIBuffer_Terrain& rhs);
+ CVIBuffer_Terrain(const CVIBuffer_Terrain& rhs);
virtual ~CVIBuffer_Terrain() = default;
_float2 Get_Size() { return _float2((_float)m_iNumVerticesX, (_float)m_iNumVerticesZ); }
@@ -22,8 +22,9 @@ class ENGINE_DLL CVIBuffer_Terrain final : public CVIBuffer
virtual HRESULT Initialize_Prototype(const _char* pFilePath, _uint iSizeX, _uint iSizeZ);
virtual HRESULT Initialize(void* pArg);
- _bool Picking(class CTransform* pTransform, _float3& pOut);
-
+ _bool Picking(_fmatrix WorldMatrix, _float3* pOut);
+ void Culling(_fmatrix WorldMatrix);
+ void FitY(_fmatrix WorldMatrix, _float fY);
private:
_bool m_bChange = {};
_uint m_iNumVerticesX = {};
@@ -31,11 +32,13 @@ class ENGINE_DLL CVIBuffer_Terrain final : public CVIBuffer
vector<_float> m_HeigthValues = {};
+ class CQuadTree* m_pQuadTree = { nullptr };
+
public:
static CVIBuffer_Terrain* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const _char* pFilePath, _uint iSizeX, _uint iSizeZ);
- virtual CVIBuffer_Terrain* Clone(void* pArg, class CGameObject* pOwner = nullptr) override;
+ virtual CComponent* Clone(void* pArg, class CGameObject* pOwner = nullptr) override;
virtual void Free() override;
virtual void Describe_Entity() override;
};
-NS_END
\ No newline at end of file
+NS_END
diff --git a/Jusin154_Team3D/Engine/Public/pch.h b/Jusin154_Team3D/Engine/Public/pch.h
index 8a61f4686..8ae41fec5 100644
--- a/Jusin154_Team3D/Engine/Public/pch.h
+++ b/Jusin154_Team3D/Engine/Public/pch.h
@@ -54,6 +54,9 @@ using namespace DirectX;
#include
#include
#include
+#include
+#include
+
using namespace std;