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 3ddc2f1e7..3ce9b7364 100644 --- a/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Engine_Shader_Defines.hlsli +++ b/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Engine_Shader_Defines.hlsli @@ -1,258 +1,12 @@ +#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; - -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; +#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" - SrcBlend[2] = one; - DestBlend[2] = one; - BlendOp[2] = Add; -}; +#endif // ENGINE_SHADER_DEFINES_HLSLI -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; -} diff --git a/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl b/Jusin154_Team3D/Client/Bin/Resources/ShaderFiles/Shader_Deferred.hlsl index 38eea62d7..1a8c94894 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,62 @@ 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 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb; + float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1.f); + float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv); - Out.vShade = g_vLightDiffuse * saturate(max(dot(normalize(g_vLightDir) * -1.f, vNormal), 0.f) + (g_vLightAmbient * g_vMtrlAmbient)); + float fViewZ = vDepth.y * g_fFar; - vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord); + 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); + } - float fViewZ = vDepthDesc.y * g_fFar; - - vector vPosition; + float3 vF0 = float3(0.04f, 0.04f, 0.04f); + float fMetallic = 0.f; + float fRoughness = 0.5f; + float fOcclusion = 1.f; + float fAttenuation = 1.f; -{ // 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 vToView = normalize(g_vCamPosition.xyz - vWorldPosition.xyz); // 픽셀에서 카메라로 + float3 vToLight = 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; - 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 + { + fMetallic = 0.f; + + float3 vSRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb; + vF0 = vSRO.rrr; + fRoughness = vSRO.g; + fOcclusion = vSRO.b; + } - Out.vSpecular = (g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(normalize(vLook) * -1.f, normalize(vReflect)), 0.f), 50.f); + float fDiffuseAOStrength = lerp(0.3f, 1.f, fOcclusion); + + PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vToView, vToLight, 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 +162,62 @@ 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 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb; + float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1.f); + float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv); - vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord); - float fViewZ = vDepthDesc.y * g_fFar; + float fViewZ = vDepth.y * g_fFar; - 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); - - 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 vF0 = float3(0.04f, 0.04f, 0.04f); + float fMetallic = 0.f; + float fRoughness = 0.5f; + float fOcclusion = 1.f; + float fAttenuation = 1.f; - vector vLook = vPosition - g_vCamPosition; - vector vReflect = reflect(vLightDir, vNormal); + float3 vToView = normalize(g_vCamPosition.xyz - vWorldPosition.xyz); // 픽셀에서 카메라로 + float3 vToLight = normalize(g_vLightPos.xyz - vWorldPosition.xyz); // 픽셀에서 라이트로 - Out.vSpecular = fAttenuation * ((g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(normalize(vLook) * -1.f, normalize(vReflect)), 0.f), 50.f)); + { + float fDistance = length(vToLight); + fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange); + if (fAttenuation <= 0.f) { discard; } + } + + 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 + { + fMetallic = 0.f; + float3 vSRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb; + vF0 = vSRO.rrr; + fRoughness = vSRO.g; + fOcclusion = vSRO.b; + } + + PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vToView, vToLight, 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 +226,67 @@ 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 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb; + float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1.f); + float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv); - vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord); - float fViewZ = vDepthDesc.y * g_fFar; + float fViewZ = vDepth.y * g_fFar; - 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); - - 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); - if (fCosAngle < g_fSpotOuterAngle) + + float3 vF0 = float3(0.04f, 0.04f, 0.04f); + float fMetallic = 0.f; + float fRoughness = 0.5f; + float fOcclusion = 1.f; + float fAttenuation = 1.f; + + float3 vToView = normalize(g_vCamPosition.xyz - vWorldPosition.xyz); // 픽셀에서 카메라로 + float3 vToLight = normalize(g_vLightPos.xyz - vWorldPosition.xyz); // 픽셀에서 라이트로 + { - discard; + float fDistance = length(vToLight); + fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange); + if (fAttenuation <= 0.f) { discard; } } - float fSpotAttenenuation = saturate((fCosAngle - g_fSpotInnerAngle) / (g_fSpotInnerAngle - g_fSpotOuterAngle)); + float fCosAngle = dot(vToView, g_vLightDir.xyz); + if (fCosAngle < g_fSpotOuterAngle) { discard; } + + 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))); + 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 + { + fMetallic = 0.f; + float3 vSRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb; + vF0 = vSRO.rrr; + fRoughness = vSRO.g; + fOcclusion = vSRO.b; + } - vector vLook = vPosition - g_vCamPosition; - vector vReflect = reflect(vLightDir, vNormal); + PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vToView, vToLight, vAlbedo, fMetallic, fRoughness, g_vLightDiffuse.rgb, fAttenuation, vF0); - Out.vSpecular = fAttenuation * ((g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(normalize(vLook) * -1.f, normalize(vReflect)), 0.f), 50.f)); + Out.vShade = float4(PBR_Out.vShade, 1.f); + Out.vSpecular = float4(PBR_Out.vSpecular, 1.f); return Out; } @@ -271,6 +336,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 +443,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 +451,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 +461,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 +471,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 +481,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 +491,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 +501,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/Default/Client.vcxproj b/Jusin154_Team3D/Client/Default/Client.vcxproj index 2a688741c..dbbcc6a86 100644 --- a/Jusin154_Team3D/Client/Default/Client.vcxproj +++ b/Jusin154_Team3D/Client/Default/Client.vcxproj @@ -29,7 +29,7 @@ Application true - v145 + v143 Unicode diff --git a/Jusin154_Team3D/Client/Private/Loader.cpp b/Jusin154_Team3D/Client/Private/Loader.cpp index 6ad1c0b6f..4abe2e521 100644 --- a/Jusin154_Team3D/Client/Private/Loader.cpp +++ b/Jusin154_Team3D/Client/Private/Loader.cpp @@ -1,4 +1,4 @@ -#include "pch.h" +#include "pch.h" #include "Loader.h" #include "GameInstance.h" #include "MainApp.h" @@ -29,11 +29,7 @@ HRESULT CLoader::Initialize(LEVEL eNextLevelID) { m_eNextLevelID = eNextLevelID; - InitializeCriticalSection(&m_CriticalSection); - - m_hThread = (HANDLE)_beginthreadex(nullptr, 0, LoadingMain, this, 0, nullptr); - if (0 == m_hThread) - return E_FAIL; + m_pGameInstance->EnqueueJob(&LoadingMain, this); return S_OK; } @@ -45,8 +41,6 @@ HRESULT CLoader::Loading() return E_FAIL; } - EnterCriticalSection(&m_CriticalSection); - HRESULT hr = {}; switch (m_eNextLevelID) @@ -61,10 +55,9 @@ HRESULT CLoader::Loading() break; } - LeaveCriticalSection(&m_CriticalSection); - - if (FAILED(hr)) + if (FAILED(hr)){ return E_FAIL; + } return S_OK; } @@ -76,17 +69,17 @@ void CLoader::Output() HRESULT CLoader::Loading_For_Logo() { - m_strMessage = TEXT("ÅؽºÃĸ¦(À») ·εù Áß ÀԴϴÙ."); + m_strMessage = TEXT("텍스쳐를(을) 로딩 중 입니다."); - m_strMessage = TEXT("»ç¿îµ带(À») ·εù Áß ÀԴϴÙ."); + m_strMessage = TEXT("사운드를(을) 로딩 중 입니다."); - m_strMessage = TEXT("¸𵨸¦(À») ·εù Áß ÀԴϴÙ."); + m_strMessage = TEXT("모델를(을) 로딩 중 입니다."); - m_strMessage = TEXT("¼ÎÀ̴õ¸¦(À») ·εù Áß ÀԴϴÙ."); + m_strMessage = TEXT("셰이더를(을) 로딩 중 입니다."); - m_strMessage = TEXT("°´ü¿øÇü¸¦(À») ·εù Áß ÀԴϴÙ."); + m_strMessage = TEXT("객체원형를(을) 로딩 중 입니다."); - m_strMessage = TEXT("·εùÀÌ ¿ϷáµǾú½À´ϴÙ.."); + m_strMessage = TEXT("로딩이 완료되었습니다.."); m_isFinished = true; @@ -95,19 +88,19 @@ HRESULT CLoader::Loading_For_Logo() HRESULT CLoader::Loading_For_GamePlay() { - m_strMessage = TEXT("ÅؽºÃĸ¦(À») ·εù Áß ÀԴϴÙ."); + m_strMessage = TEXT("텍스쳐를(을) 로딩 중 입니다."); - m_strMessage = TEXT("¸𵨸¦(À») ·εù Áß ÀԴϴÙ."); + m_strMessage = TEXT("모델를(을) 로딩 중 입니다."); - m_strMessage = TEXT("¼ÎÀ̴õ¸¦(À») ·εù Áß ÀԴϴÙ."); + m_strMessage = TEXT("셰이더를(을) 로딩 중 입니다."); - m_strMessage = TEXT("ÀÌÆåƮ¸¦(À») ·εù Áß ÀԴϴÙ."); + m_strMessage = TEXT("이펙트를(을) 로딩 중 입니다."); - m_strMessage = TEXT("°´ü¿øÇü¸¦(À») ·εù Áß ÀԴϴÙ."); + m_strMessage = TEXT("객체원형를(을) 로딩 중 입니다."); - m_strMessage = TEXT("Á¤º¸¸¦ ºҷ¯¿À´Â ÁßÀԴϴÙ."); + m_strMessage = TEXT("정보를 불러오는 중입니다."); - m_strMessage = TEXT("·εùÀÌ ¿ϷáµǾú½À´ϴÙ.."); + m_strMessage = TEXT("로딩이 완료되었습니다.."); m_isFinished = true; @@ -132,11 +125,6 @@ void CLoader::Free() { __super::Free(); - WaitForSingleObject(m_hThread, INFINITE); - - CloseHandle(m_hThread); - - DeleteCriticalSection(&m_CriticalSection); SAFE_RELEASE(m_pGameInstance); SAFE_RELEASE(m_pDevice); 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/Client/Public/Loader.h b/Jusin154_Team3D/Client/Public/Loader.h index bbc28dddb..ab651f55d 100644 --- a/Jusin154_Team3D/Client/Public/Loader.h +++ b/Jusin154_Team3D/Client/Public/Loader.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "Client_Define.h" #include "Base.h" @@ -27,8 +27,6 @@ class CLoader final : public CBase ID3D11DeviceContext* m_pContext = { nullptr }; LEVEL m_eNextLevelID = { LEVEL::END }; - HANDLE m_hThread = {}; - CRITICAL_SECTION m_CriticalSection = {}; _wstring m_strMessage = {}; _bool m_isFinished = { false }; @@ -43,4 +41,4 @@ class CLoader final : public CBase }; -NS_END \ No newline at end of file +NS_END diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/BaiscParticle.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/BaiscParticle.bin index 73974c53a..918c30892 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/BaiscParticle.bin +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/BaiscParticle.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:697362b584679afac0be6f7707b10367030e6ccaec5f93fbc4d301ad80bd7c35 -size 598 +oid sha256:5f97e1272ef22cebdc2bbc672b1267c98c6433aa7ffdf77ce3c34f71bd7c4cbd +size 606 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/BasicParticle.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/BasicParticle.bin index ccc57faa2..4ea0d36a9 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/BasicParticle.bin +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/BasicParticle.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:60c069d147060437e1c362b41fade1ef56556b6d0e5038606601acdb0572a5f3 -size 598 +oid sha256:97fe8d6e4c7c1b2461a92639a4683f746ff55dc7a821ce119ebe0d8a09373bfd +size 606 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/BasicParticle2.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/BasicParticle2.bin index 20916c601..c9b54ca60 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/BasicParticle2.bin +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/BasicParticle2.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bd8016c2c3a1a081c1d2774e6fc678a326ce813d853fda18e08a48100692f33c -size 598 +oid sha256:11bdf139c24c2065b691be072e6483f68870ab3a0a980f7c10aaf012a5ac75a0 +size 606 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/BlustParticle.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/BlustParticle.bin index e5d34d8e0..11d068b9d 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/BlustParticle.bin +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/BlustParticle.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b6f198111876e32cb27a8f6341053be4c761fa923545c5c821cd89f64e2f7ad4 -size 598 +oid sha256:632fe36b935690a2838c92bb8be312d5d763a171423cae41e99dcfd8ba0bd445 +size 606 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/ConfingoTest.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/ConfingoTest.bin similarity index 100% rename from Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/ConfingoTest.bin rename to Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/ConfingoTest.bin diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/FireProjectile.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/FireProjectile.bin index 32435023b..382829e76 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/FireProjectile.bin +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/FireProjectile.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:25abe6ca6cd125734f2a7eadc17c2e4e8b022c8e4c3b48cd95275f414a6387f1 -size 628 +oid sha256:7ded4807087aa32efaf780f2466e9bcd25dbf771c61e58eeb30b4ec1fbc9f451 +size 636 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ice.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ice.bin index 55beced3f..7523b1838 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ice.bin +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Ice.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:82c1cd8f66bbeaa2828aec08a7fcf85eb8138f57fe7ef34d7ab05465ce3346c8 -size 521 +oid sha256:ba8f4656956e753b0378a2d8f6ce2f8dfa73014e885a59e8890cdedfd28daad2 +size 529 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/LP.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/LP.bin deleted file mode 100644 index 590f2b74a..000000000 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/LP.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:385b4684f3ed82cd63e843f2f75a8f07c797708d4423556dfbd1c993ced7ac5d -size 264 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/LightProjectile1.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/LightProjectile1.bin new file mode 100644 index 000000000..c15925e85 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/LightProjectile1.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:937ae454ea27b326ccc519afd84314adab8c658009e609f8217c525d26cdfb72 +size 595 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/LightProjectile2.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/LightProjectile2.bin new file mode 100644 index 000000000..5225655a0 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/LightProjectile2.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:51af73356e47c2cfed59bd5d09728335e3cee1311e0790610c68cf86d8f32f83 +size 605 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/LightProjectileCircle1.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/LightProjectileCircle1.bin new file mode 100644 index 000000000..759a4f369 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/LightProjectileCircle1.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:d81d1f57e021bd726103dbc896bca49c1cfcadac7366ca055b1067b9361132c1 +size 550 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/LightProjectileMiddle.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/LightProjectileMiddle.bin new file mode 100644 index 000000000..68b463e39 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/LightProjectileMiddle.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:26f5717dbfd5055a0b606134b5dd343e3f77bc02c3acfb3bbf50d3ecc1015bfd +size 607 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/MagicProjectile.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/MagicProjectile.bin index 530ff611f..ce9742895 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/MagicProjectile.bin +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/MagicProjectile.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:04321afa62b3e9aaca6036e249e8fa7ef9f8cb765e25088a4430b5883df3f70d -size 626 +oid sha256:7806c0cc6f06d1b5dde93aeb8da7b7e36ead2684b56d9697d445c4e1781bd975 +size 634 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Package/1.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Package/1.bin new file mode 100644 index 000000000..be9aa71f0 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Package/1.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:dafba43009b3809b1cf3b2886f9453f1fba5ad7c1c6551afd1dfc5634a4a245a +size 262 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Package/Light.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Package/Light.bin new file mode 100644 index 000000000..df0e49ab1 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Package/Light.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e3610476d496d331ec27dd61739b2928f352629b4d904dcb1b79242dc8924f3a +size 201 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Projectile0.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Projectile0.bin index c171516eb..9119bfe76 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Projectile0.bin +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Projectile0.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:46eb4b43cb9d9f79c087008082e8874983231357fe05aa3354d0c8bf8dc08117 +oid sha256:1b72b06e1ce45740d09f46a051b0f99a4aaa53f057af0bc8ffbd74b78cd18b6f size 633 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/SpreadRing.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/SpreadRing.bin index 0a3554ab6..b74cb9d5d 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/SpreadRing.bin +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/SpreadRing.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:c5bfe527d29c9e72248e1ba60487d7ff030e97008206097177c2ff33e3b663f2 +oid sha256:23ceeb532383f6a0506647edb2497de4827ac9d931e14be41ded9e5a77064dc6 size 644 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/Test.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Test.bin similarity index 100% rename from Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/Test.bin rename to Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Test.bin diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/Test2.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Test2.bin similarity index 100% rename from Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/Test2.bin rename to Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Test2.bin diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Trail/TestTrail.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Trail/TestTrail.bin new file mode 100644 index 000000000..6414c221c --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/Trail/TestTrail.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:18d4d2843900a6643f7d2a1170271828e7153c309687b64054ef363a7aaa5107 +size 138 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/TrailTest.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/TrailTest.bin new file mode 100644 index 000000000..a727116fa --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/TrailTest.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a855f032a53ad0b5a1efd023bb02e4ffa10df3deeced2e5fd049a15615adfefc +size 550 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/BaiscParticle.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/BaiscParticle.bin new file mode 100644 index 000000000..64103f049 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/BaiscParticle.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e51157f496aa53487d5ff04f60d1b871a4be3773ddc43cf36895d79f4ba2f27e +size 598 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/BasicParticle.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/BasicParticle.bin new file mode 100644 index 000000000..1b1e9059f --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/BasicParticle.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:99cde9fe783c6e2c4cad26263ae72294e0c87784961cdc69953467ae08ace0de +size 598 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/BasicParticle2.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/BasicParticle2.bin new file mode 100644 index 000000000..0e4cd0d00 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/BasicParticle2.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c047e6c3570b1d26e85ebdd12617172b050be798fb4ed1ec40b9335fff94e769 +size 598 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/BlustParticle.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/BlustParticle.bin new file mode 100644 index 000000000..396ed3956 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/BlustParticle.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f640193ab520cf9c49e9c987cbe0f506d353d27e8a01a67a7e2c049af32cb421 +size 598 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/FireProjectile.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/FireProjectile.bin new file mode 100644 index 000000000..96653610c --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/FireProjectile.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:59daade7d260f4a7cf9af81a3f09b2a00f6155b786ac7d30552a6d8376fdf5de +size 628 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/Ice.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/Ice.bin new file mode 100644 index 000000000..5708bf8d4 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/Ice.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:448d9913e85573500e2b86c046b8711a342f28597b9fa63048adf92cf7e458b1 +size 521 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/LightProjectile1.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/LightProjectile1.bin new file mode 100644 index 000000000..3e9ac4786 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/LightProjectile1.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:82890f11a1561ca32e8504d5dec11a18ef3dae00f490f70a9581a529b0ca2304 +size 587 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/LightProjectile2.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/LightProjectile2.bin new file mode 100644 index 000000000..55291ea6b --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/LightProjectile2.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:69c6354c06138ef2b34377e13964d14412600eb5b0f88b21d55e6571b34890c1 +size 597 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/LightProjectileCircle1.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/LightProjectileCircle1.bin new file mode 100644 index 000000000..cd81664d3 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/LightProjectileCircle1.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:022d6dcae155a8a1c369aa275ed56e533d5a3afb417b5fed9d6b9345ec05b008 +size 542 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/LightProjectileMiddle.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/LightProjectileMiddle.bin new file mode 100644 index 000000000..41a49338d --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/LightProjectileMiddle.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:cab580f863401e8351fda8c05e5accb6c02b0424d678d65de802b7827ebdad5d +size 599 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/MagicProjectile.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/MagicProjectile.bin new file mode 100644 index 000000000..2bdbb53ff --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/MagicProjectile.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:44e2ce0bc50ae9ef56e8b48444ee2d3795925e1776086701f9be47b9cb09ad0f +size 626 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/Projectile0.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/Projectile0.bin new file mode 100644 index 000000000..9119bfe76 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/Projectile0.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:1b72b06e1ce45740d09f46a051b0f99a4aaa53f057af0bc8ffbd74b78cd18b6f +size 633 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/SpreadRing.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/SpreadRing.bin new file mode 100644 index 000000000..b74cb9d5d --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/SpreadRing.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:23ceeb532383f6a0506647edb2497de4827ac9d931e14be41ded9e5a77064dc6 +size 644 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/TrailTest.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/TrailTest.bin new file mode 100644 index 000000000..a727116fa --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/임시공간/TrailTest.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a855f032a53ad0b5a1efd023bb02e4ffa10df3deeced2e5fd049a15615adfefc +size 550 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/BasicParticle.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/BasicParticle.bin deleted file mode 100644 index d3c6667ba..000000000 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/BasicParticle.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2781b48e3f8d8510a338e650e00660ed853345901eb0e8eb693e64765bd284a3 -size 566 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/FireProjectile.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/FireProjectile.bin deleted file mode 100644 index 33a13070d..000000000 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/FireProjectile.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c6446751f95f98d233e9ee3054f8bb8cfb7e6163e9bc1fc7c506d89b119f599f -size 596 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/Flared.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/Flared.bin deleted file mode 100644 index 30cd5d21d..000000000 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/Flared.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2d3673f63af9789fdac33dc723b742e3040ad9cd27b420b2b00b6971f3f2120c -size 620 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/Ice.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/Ice.bin deleted file mode 100644 index 17365dced..000000000 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/Ice.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:d282d160be4081ea02cba70fdfa0587d4ae2818cfb2c0ad3ca76274f43d715e9 -size 489 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/LP.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/LP.bin deleted file mode 100644 index 590f2b74a..000000000 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/LP.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:385b4684f3ed82cd63e843f2f75a8f07c797708d4423556dfbd1c993ced7ac5d -size 264 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/LightProjectile1.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/LightProjectile1.bin deleted file mode 100644 index e9f1f1b9f..000000000 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/LightProjectile1.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:22cb188973c1268a590daf37b1b990de8b83436f40800ffe0b075a8a5b8a3047 -size 547 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/LightProjectile2.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/LightProjectile2.bin deleted file mode 100644 index 5f43a8cab..000000000 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/LightProjectile2.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5daa02fb61ea067ca7f8c892856ddf83e82aa8da51251e425a88ae014923a3d1 -size 557 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/LightProjectileCircle1.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/LightProjectileCircle1.bin deleted file mode 100644 index 53a553cfb..000000000 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/LightProjectileCircle1.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:81e7ac152b6a78bea83531c1ceabbfd3880465fd833c9fd14484603f5ee73965 -size 502 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/LightProjectileMiddle.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/LightProjectileMiddle.bin deleted file mode 100644 index 2d75b0aac..000000000 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/LightProjectileMiddle.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:628ec29f1188b972973cd6338e5840fbcefe663b19204275b85a78268f1301c6 -size 559 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/MagicProjectile.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/MagicProjectile.bin deleted file mode 100644 index 02ebb834b..000000000 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/MagicProjectile.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:2fe361015c7d0d0dc213bc6d5f149759298f18f3e1183d19e8e43f38d7ee7baa -size 594 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/ParticleTest.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/ParticleTest.bin deleted file mode 100644 index b0057f6bd..000000000 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/ParticleTest.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:c1b2254a9f76ef1c627149e881269b2570ff4c80e664cf4ab4e2a8878f7bd349 -size 558 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/Projectile0.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/Projectile0.bin deleted file mode 100644 index 81dd8cb25..000000000 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/Projectile0.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b9fdb6d34c1ff4fffb0f91e7ecac07dea75919239991ab53468adfdc909f6c90 -size 601 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/SpreadRing.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/SpreadRing.bin deleted file mode 100644 index 879f4706d..000000000 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/SpreadRing.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b238b2b412d5cdb251e90f7806b473f56373499b67f48472d6dca68784015e9b -size 612 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/Wand.bin b/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/Wand.bin deleted file mode 100644 index 22cbd08e4..000000000 --- a/Jusin154_Team3D/Editor/Bin/Resources/Data/Effect/해오라기/Wand.bin +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:a53acc13222138968a56dffabad667d007e31f0d46bb2a52dd5e972c5867bd41 -size 585 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/DummyPlane/Bina.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/DummyPlane/Bina.bin new file mode 100644 index 000000000..55772083a --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/DummyPlane/Bina.bin @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:839d2e81de953ae07343e40f426b94b7702b53aacfaafcacf9ce219a9b86b992 +size 2097152 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/DummyPlane/DummyPlane.bin b/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/DummyPlane/DummyPlane.bin index ae6f282af..1c12c6445 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/DummyPlane/DummyPlane.bin +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/DummyPlane/DummyPlane.bin @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7fe74b089c3b90a426d1988d3d49632890c904456da1e2a2ed9f7c04e4a8c5dd -size 9479 +oid sha256:b520a5d24cf3269872221ece0c9018044de596ae837a142eeebb973744fc91bd +size 9480 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/DummyPlane/DummyPlane.fbx b/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/DummyPlane/DummyPlane.fbx index 8b7d31df5..1c9916af5 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/DummyPlane/DummyPlane.fbx +++ b/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/DummyPlane/DummyPlane.fbx @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7c8a8ff5d822a7a6cff559c7a70a8d69aaadea6a661096d3c313ad9c232bd3a5 -size 22060 +oid sha256:fdc19861e06e37f3876f0203fa70bad848076948da32444c621b6c77889f3c28 +size 24268 diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/DummyPlane/New Piskel_MRO.png b/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/DummyPlane/New Piskel_MRO.png new file mode 100644 index 000000000..59ba0c00b Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/DummyPlane/New Piskel_MRO.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/DummyPlane/New Piskel_N.png b/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/DummyPlane/New Piskel_N.png new file mode 100644 index 000000000..9d000651a Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Models/Effect/DummyPlane/New Piskel_N.png differ 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 3ddc2f1e7..3ce9b7364 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Defines.hlsli +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Defines.hlsli @@ -1,258 +1,12 @@ +#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; - -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; +#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" - SrcBlend[2] = one; - DestBlend[2] = one; - BlendOp[2] = Add; -}; +#endif // ENGINE_SHADER_DEFINES_HLSLI -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; -} 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..f16a08d3c --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli @@ -0,0 +1,185 @@ +#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 vToView, float3 vToLight, + 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(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; + + float D = NDF_ggxtr(vNormal, vHalfVector, fAlpha); + float G = Geometry_Smith(vNormal, vToView, vToLight, k); + float3 F = Fresnel_Schlick(saturate(dot(vHalfVector, vToView)), vFO); + + float3 vNumerator = D * G * F; + float fDenominator = max(4.f * NdotL * NdotV, 1e-7); + float3 specularBRDF = vNumerator / fDenominator; + + 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..1a8c94894 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,62 @@ 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 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb; + float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1.f); + float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv); - Out.vShade = g_vLightDiffuse * saturate(max(dot(normalize(g_vLightDir) * -1.f, vNormal), 0.f) + (g_vLightAmbient * g_vMtrlAmbient)); + float fViewZ = vDepth.y * g_fFar; - vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord); + 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); + } - float fViewZ = vDepthDesc.y * g_fFar; - - vector vPosition; + float3 vF0 = float3(0.04f, 0.04f, 0.04f); + float fMetallic = 0.f; + float fRoughness = 0.5f; + float fOcclusion = 1.f; + float fAttenuation = 1.f; -{ // 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 vToView = normalize(g_vCamPosition.xyz - vWorldPosition.xyz); // 픽셀에서 카메라로 + float3 vToLight = 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; - 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 + { + fMetallic = 0.f; + + float3 vSRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb; + vF0 = vSRO.rrr; + fRoughness = vSRO.g; + fOcclusion = vSRO.b; + } - Out.vSpecular = (g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(normalize(vLook) * -1.f, normalize(vReflect)), 0.f), 50.f); + float fDiffuseAOStrength = lerp(0.3f, 1.f, fOcclusion); + + PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vToView, vToLight, 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 +162,62 @@ 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 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb; + float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1.f); + float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv); - vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord); - float fViewZ = vDepthDesc.y * g_fFar; + float fViewZ = vDepth.y * g_fFar; - 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); - - 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 vF0 = float3(0.04f, 0.04f, 0.04f); + float fMetallic = 0.f; + float fRoughness = 0.5f; + float fOcclusion = 1.f; + float fAttenuation = 1.f; - vector vLook = vPosition - g_vCamPosition; - vector vReflect = reflect(vLightDir, vNormal); + float3 vToView = normalize(g_vCamPosition.xyz - vWorldPosition.xyz); // 픽셀에서 카메라로 + float3 vToLight = normalize(g_vLightPos.xyz - vWorldPosition.xyz); // 픽셀에서 라이트로 - Out.vSpecular = fAttenuation * ((g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(normalize(vLook) * -1.f, normalize(vReflect)), 0.f), 50.f)); + { + float fDistance = length(vToLight); + fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange); + if (fAttenuation <= 0.f) { discard; } + } + + 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 + { + fMetallic = 0.f; + float3 vSRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb; + vF0 = vSRO.rrr; + fRoughness = vSRO.g; + fOcclusion = vSRO.b; + } + + PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vToView, vToLight, 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 +226,67 @@ 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 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb; + float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1.f); + float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv); - vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord); - float fViewZ = vDepthDesc.y * g_fFar; + float fViewZ = vDepth.y * g_fFar; - 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); - - 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); - if (fCosAngle < g_fSpotOuterAngle) + + float3 vF0 = float3(0.04f, 0.04f, 0.04f); + float fMetallic = 0.f; + float fRoughness = 0.5f; + float fOcclusion = 1.f; + float fAttenuation = 1.f; + + float3 vToView = normalize(g_vCamPosition.xyz - vWorldPosition.xyz); // 픽셀에서 카메라로 + float3 vToLight = normalize(g_vLightPos.xyz - vWorldPosition.xyz); // 픽셀에서 라이트로 + { - discard; + float fDistance = length(vToLight); + fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange); + if (fAttenuation <= 0.f) { discard; } } - float fSpotAttenenuation = saturate((fCosAngle - g_fSpotInnerAngle) / (g_fSpotInnerAngle - g_fSpotOuterAngle)); + float fCosAngle = dot(vToView, g_vLightDir.xyz); + if (fCosAngle < g_fSpotOuterAngle) { discard; } + + 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))); + 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 + { + fMetallic = 0.f; + float3 vSRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb; + vF0 = vSRO.rrr; + fRoughness = vSRO.g; + fOcclusion = vSRO.b; + } - vector vLook = vPosition - g_vCamPosition; - vector vReflect = reflect(vLightDir, vNormal); + PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vToView, vToLight, vAlbedo, fMetallic, fRoughness, g_vLightDiffuse.rgb, fAttenuation, vF0); - Out.vSpecular = fAttenuation * ((g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(normalize(vLook) * -1.f, normalize(vReflect)), 0.f), 50.f)); + Out.vShade = float4(PBR_Out.vShade, 1.f); + Out.vSpecular = float4(PBR_Out.vSpecular, 1.f); return Out; } @@ -271,6 +336,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 +443,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 +451,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 +461,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 +471,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 +481,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 +491,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 +501,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_UIEditor.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl index 760622fc7..7f503e59b 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UIEditor.hlsl @@ -222,7 +222,7 @@ PS_OUT PS_Sptire_Sheet(PS_IN In) int iTotalFrame = g_iImageCountX * g_iImageCountY; - int iCurrentFrame = int(floor(g_fTime / g_fFrame)) % iTotalFrame; + uint iCurrentFrame = uint(floor(g_fTime / g_fFrame)) % iTotalFrame; int iFrameX = iCurrentFrame % g_iImageCountX; int iFrameY = iCurrentFrame / g_iImageCountX; @@ -285,46 +285,63 @@ PS_OUT PS_NineSlice(PS_IN In) { PS_OUT Out; float Alpha = g_fAlpha * g_fOwnerAlpha * g_fCanvasAlpha; - float Left = g_fNine_Slice.x / g_fOrigin_Size.x; - float Right = (g_fOrigin_Size.x - g_fNine_Slice.y) / g_fOrigin_Size.x; - float Top = g_fNine_Slice.z / g_fOrigin_Size.y; - float Bottom = (g_fOrigin_Size.y - g_fNine_Slice.w) / g_fOrigin_Size.y; + float4 Color = float4(1.f, 1.f, 1.f, 1.f); + float2 uv = In.vTexcoord; + float2 CurrentPixelPosition = uv * g_fCurrent_Size; + float OriginLeft = g_fNine_Slice.x; + float OriginRight = g_fNine_Slice.y; + float OriginTop = g_fNine_Slice.z; + float OriginBottom = g_fNine_Slice.w; - float2 ratio = g_fCurrent_Size / g_fOrigin_Size; + float CurrentLeft = OriginLeft; + float CurrentRight = g_fCurrent_Size.x - (g_fOrigin_Size.x - OriginRight); + float CurrentTop = OriginTop; + float CurrentBottom = g_fCurrent_Size.y - (g_fOrigin_Size.y - OriginBottom); - float2 UV = In.vTexcoord * 0.5f + 0.5f; - float2 ScaledUV = UV; - - if (UV.x < Left) + float2 Finaluv = In.vTexcoord; + + if(CurrentPixelPosition.x < CurrentLeft) { - ScaledUV.x = UV.x; + Finaluv.x = CurrentPixelPosition.x / g_fOrigin_Size.x; } - else if (UV.x > Right) + else if(CurrentPixelPosition.x >CurrentRight) { - ScaledUV.x = 1.0f - ((1.0f - UV.x) / ratio.x); + float dist = CurrentPixelPosition.x - CurrentRight; + Finaluv.x = (OriginRight + dist) / g_fOrigin_Size.x; } else { - ScaledUV.x = Left + (UV.x - Left) / ratio.x; + float scale = (CurrentPixelPosition.x - CurrentLeft) / (CurrentRight - CurrentLeft); + Finaluv.x = (OriginLeft / g_fOrigin_Size.x) + scale * ((OriginRight - OriginLeft) / g_fOrigin_Size.x); } - if (UV.y < Top) + if(CurrentPixelPosition.y < CurrentTop) { - ScaledUV.y = UV.y; + Finaluv.y = CurrentPixelPosition.y / g_fOrigin_Size.y; } - else if (UV.y > Bottom) + else if(CurrentPixelPosition.y > CurrentBottom) { - ScaledUV.y = 1.0f - ((1.0f - UV.y) / ratio.y); + float dist = CurrentPixelPosition.y - CurrentBottom; + Finaluv.y = (OriginBottom + dist) / g_fOrigin_Size.y; } else { - ScaledUV.y = Top + (UV.y - Top) / ratio.y; + float scale = (CurrentPixelPosition.y - CurrentTop) / (CurrentBottom - CurrentTop); + Finaluv.y = (OriginTop / g_fOrigin_Size.y) + scale * ((OriginBottom - OriginTop) / g_fOrigin_Size.y); } - float4 color = g_Texture.Sample(ClampSampler, ScaledUV); + float4 tex1 = g_Texture.Sample(ClampSampler, Finaluv); + float4 tex2 = g_Texture1.Sample(ClampSampler, Finaluv); - color.a *= Alpha; - Out.vColor = color; + tex1.a *= 0.5f; + + if (tex1.a >= 0.f) + Color = tex1; + + Color = lerp(Color, tex2, tex2.a); + + Color.a *= Alpha; + Out.vColor = Color; return Out; } @@ -446,6 +463,7 @@ PS_OUT PS_Slot(PS_IN In) PS_OUT PS_SpellAnim(PS_IN In) { PS_OUT Out; + float4 color = float4(1.f, 1.f, 1.f, 1.f); //float Alpha = g_fAlpha * g_fOwnerAlpha * g_fCanvasAlpha; //float2 center = float2(0.5f, 0.5f); @@ -460,7 +478,7 @@ PS_OUT PS_SpellAnim(PS_IN In) //color.a *= Alpha; - //Out.vColor = color; + Out.vColor = color; return Out; } diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UI_Instance.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UI_Instance.hlsl new file mode 100644 index 000000000..db2d298b1 --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_UI_Instance.hlsl @@ -0,0 +1,90 @@ +#include "Engine_Shader_Defines.hlsli" + +matrix g_WorldMatrix, g_ViewMatrix, g_ProjMatrix; + +Texture2D g_Texture; + +float g_fAlpha; +float g_fOwnerAlpha; +float g_fCanvasAlpha; +float g_fAngle; +float g_fFar; + +struct VS_IN +{ + float3 vPosition : POSITION; + float2 vTexcoord : TEXCOORD0; + + float2 vSize : TEXCOORD1; + float2 Pos : TEXCOORD2; +}; + +struct VS_OUT +{ + float4 vPosition : SV_POSITION; + float2 vTexcoord : TEXCOORD0; +}; + +VS_OUT VS_MAIN(VS_IN In) +{ + VS_OUT Out; + + matrix matWV = mul(g_WorldMatrix, g_ViewMatrix); + matrix matWVP = mul(matWV, g_ProjMatrix); + + float3 scaledPos = In.vPosition; + scaledPos.xy *= In.vSize; // 인스턴스 스케일 적용 + scaledPos.xy += In.Pos; // 인스턴스 위치 적용 + + Out.vPosition = mul(float4(scaledPos, 1.f), matWVP); + Out.vTexcoord = In.vTexcoord; + + return Out; +} + +struct PS_IN +{ + float4 vPosition : SV_POSITION; + float2 vTexcoord : TEXCOORD0; +}; + +struct PS_OUT +{ + float4 vColor : SV_TARGET0; +}; + +PS_OUT PS_MAIN(PS_IN In) +{ + PS_OUT Out; + float Alpha = g_fAlpha * g_fOwnerAlpha * g_fCanvasAlpha; + + float2 center = float2(0.5f, 0.5f); + float2 uv = In.vTexcoord - center; + uv *= sqrt(2.0f); + float2 Rotation = In.vTexcoord; + Rotation.x = uv.x * cos(g_fAngle) - uv.y * sin(g_fAngle); + Rotation.y = uv.x * sin(g_fAngle) + uv.y * cos(g_fAngle); + Rotation += center; + + float4 color = g_Texture.Sample(ClampSampler, Rotation); + + color.a *= Alpha; + + Out.vColor = color; + + return Out; +} + +technique11 PosTexTechnique11 +{ + pass Default + { + SetRasterizerState(RS_Default); + SetDepthStencilState(DSS_Default, 0); + SetBlendState(BS_AlphaBlend, 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(); + } +} diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxAnimMesh.hlsl index bbb47719c..b09ad0258 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) @@ -198,15 +202,13 @@ PS_OUT PS_MAIN(PS_IN In) PS_OUT Out; vector vMtrlDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); - if (vMtrlDiffuse.a < 0.4f) - { - discard; - } + vector vSurface = g_SurfaceParamsTexture.Sample(DefaultSampler, In.vTexcoord); + if (vMtrlDiffuse.a < 0.2f) { discard; } - vector vNormalDesc = g_NormalTexture.Sample(MirrorSampler, In.vTexcoord); + float3 vNormalDecoded = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, In.vTexcoord); float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal); - float3 vNormal = mul(vNormalDesc.xyz * 2.f - 1.f, WorldMatrix); + float3 vNormal = normalize(mul(vNormalDecoded, WorldMatrix)); if (true == g_bRimLight) { @@ -214,11 +216,14 @@ PS_OUT PS_MAIN(PS_IN In) vMtrlDiffuse.xyz = (vMtrlDiffuse.xyz * (1 - fRimLight)) + g_vRimColor * fRimLight; } - - 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), // NDC 깊이 ( 0~ 1) + (In.vProjPos.w / g_fFar), // 뷰 스페이스 Z + g_fUsingSurfaceParams, // 서페이스 파라미터 + 1.f); + Out.vColor = float4(0.f, 0.f, 0.f, 1.f); + Out.vSurface = vSurface; return Out; } @@ -313,7 +318,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 +347,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..1c0cd858a 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,32 +158,37 @@ 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) { PS_OUT Out; vector vMtrlDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); - if (vMtrlDiffuse.a < 0.2f) - { - discard; - } + vector vSurface = g_SurfaceParamsTexture.Sample(DefaultSampler, In.vTexcoord); + if (vMtrlDiffuse.a < 0.2f) { discard; } - vector vNormalDesc = g_NormalTexture.Sample(MirrorSampler, In.vTexcoord); + float3 vNormalDecoded = DecodeNormalFromRG(g_NormalTexture, DefaultSampler, In.vTexcoord); float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal); - float3 vNormal = mul(vNormalDesc.xyz * 2.f - 1.f, WorldMatrix); + float3 vNormal = normalize(mul(vNormalDecoded, WorldMatrix)); - 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), // NDC 깊이 ( 0~ 1) + (In.vProjPos.w / g_fFar), // 뷰 스페이스 Z + 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); @@ -356,7 +364,7 @@ technique11 MeshTechnique11 { pass MeshPass // 0 { - SetRasterizerState(RS_Nocull); + 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(); diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxModelInstance.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxModelInstance.hlsl index 61c092ba3..59f96a378 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxModelInstance.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxModelInstance.hlsl @@ -333,16 +333,16 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In) if(g_isNoise) { + float2 vNoiseUV = In.vTexcoord + SelectLerpUV(g_vNoiseUVGainAmount, (vNoiseUVMoveTime.x / vNoiseUVMoveTime.y), g_iNoiseMoveLerpOption); - vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, In.vTexcoord); + vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, vNoiseUV); - vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlNoise.r); vMtrlDiffuse *= vMtrlNoise; - } + /* 마스크 */ if (g_isMasking == true) { float2 vMaskTexcoord = In.vTexcoord; @@ -361,8 +361,6 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In) //디스토션(노이즈) 텍스쳐로 uv를 왜곡함 vMaskTexcoord = vMaskTexcoord + (vMtrlDistortion - 0.5f).r * g_fNoiseDistortionIntensity; - - } if (g_isMaskUVMove) @@ -529,19 +527,19 @@ PS_BLUR_OUT PS_BLUR(PS_BLUR_IN In) //0.5f를 빼는 이유는 중심을 0으로 옮겨서 양음수 방향으로 offset을 줄수 있다. vMtrlDistortion.rg -= 0.5f; - ////아마 분할되었다면 noise도 분할해야할듯 - //vMtrlDistortion.rg /= g_vUVCutting; + //아마 분할되었다면 noise도 분할해야할듯 + vMtrlDistortion.rg /= g_vUVCutting; //디스토션(노이즈) 텍스쳐로 uv를 왜곡함 UV = UV + (vMtrlDistortion).rg * g_fNoiseDistortionIntensity; + } /* 최종 색깔 */ vMtrlDiffuse = g_DiffuseTexture.Sample(DefaultSampler, UV); - if (g_vColor.a > 0) vMtrlDiffuse += g_vColor; @@ -556,12 +554,16 @@ PS_BLUR_OUT PS_BLUR(PS_BLUR_IN In) if (g_isNoise) { - vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, In.vTexcoord); + float2 vNoiseUV = In.vTexcoord + SelectLerpUV(g_vNoiseUVGainAmount, (vNoiseUVMoveTime.x / vNoiseUVMoveTime.y), g_iNoiseMoveLerpOption); + + vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, vNoiseUV); + + vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlNoise.r); vMtrlDiffuse *= vMtrlNoise; - } + /* 마스크 */ if (g_isMasking == true) { float2 vMaskTexcoord = In.vTexcoord; @@ -578,8 +580,9 @@ PS_BLUR_OUT PS_BLUR(PS_BLUR_IN In) vMtrlDistortion = g_DistortionTexture.Sample(DefaultSampler, vDistortionUV); //디스토션(노이즈) 텍스쳐로 uv를 왜곡함 - vMaskTexcoord = vMaskTexcoord + (vMtrlDistortion - 0.5f).r * g_fNoiseDistortionIntensity; - + vMaskTexcoord = vMaskTexcoord + (vMtrlDistortion - 0.5f).r * g_fNoiseDistortionIntensity; + + } @@ -596,13 +599,9 @@ PS_BLUR_OUT PS_BLUR(PS_BLUR_IN In) { vMtrlMask.r = 1.f; } - - vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlMask.r); - - if (vMtrlDiffuse.a <= 0.f) discard; @@ -610,7 +609,7 @@ PS_BLUR_OUT PS_BLUR(PS_BLUR_IN In) { vMtrlDissolve = g_DissolveTexture.Sample(DefaultSampler, In.vTexcoord); - if(g_isReverseDissolve == true) + if (g_isReverseDissolve == true) { if (vMtrlDissolve.r >= (In.vLifeTime.x / In.vLifeTime.y)) discard; @@ -620,7 +619,6 @@ PS_BLUR_OUT PS_BLUR(PS_BLUR_IN In) if (vMtrlDissolve.r < (In.vLifeTime.x / In.vLifeTime.y)) discard; } - } vMtrlDiffuse.a *= g_fDiffuseAlpha; @@ -634,6 +632,7 @@ PS_BLUR_OUT PS_BLUR(PS_BLUR_IN In) vEmissiveMtrl = g_EmissiveTexture.Sample(DefaultSampler, In.vTexcoord); } + Out.vDiffuse = vMtrlDiffuse * g_fBlurIntensity; Out.vBlurWeight.r = g_iBlurWeight / 32.f; diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPosTex.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPosTex.hlsl index 6b9fcb9b8..926473fa9 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPosTex.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_VtxPosTex.hlsl @@ -11,9 +11,14 @@ uint g_iIndexU; uint g_iIndexV; Texture2D g_Texture; + Texture2D g_DiffuseTexture; Texture2D g_MaskingTexture; +Texture2D g_NoiseTexture; +bool g_isDiffuse; +bool g_isNoise; +bool g_isMask; struct VS_IN { @@ -25,27 +30,55 @@ struct VS_OUT { float4 vPosition : SV_Position; float2 vTexcoord : TEXCOORD0; + float4 vProjPos : TEXCOORD1; }; VS_OUT VS_MAIN(VS_IN In) { VS_OUT Out; - + + matrix matWV, matWVP; matWV = mul(g_WorldMatrix, g_ViewMatrix); matWVP = mul(matWV, g_ProjMatrix); + + vector vPosition = mul(vector(In.vPosition, 1.f), matWVP); + Out.vPosition = mul(vector(In.vPosition, 1.f), matWVP); Out.vTexcoord = In.vTexcoord; + Out.vProjPos = vPosition; return Out; } +VS_OUT VS_TRAIL(VS_IN In) +{ + VS_OUT Out; + + + matrix matWVP; + + matWVP = mul(g_ViewMatrix , g_ProjMatrix); //월드행렬 곱해져서 오기때문에 월드 곱하지 않음 + + + vector vPosition = mul(vector(In.vPosition, 1.f), matWVP); + + Out.vPosition = mul(vector(In.vPosition, 1.f), matWVP); + Out.vTexcoord = In.vTexcoord; + Out.vProjPos = vPosition; + + + return Out; + +} + struct PS_IN { float4 vPosition : SV_Position; float2 vTexcoord : TEXCOORD0; + float4 vProjPos : TEXCOORD1; }; struct PS_OUT @@ -72,17 +105,54 @@ PS_OUT PS_UVMove(PS_IN In) return Out; } -PS_OUT PS_Trail(PS_IN In) + + +struct PS_TRAILOUT { - PS_OUT Out; + float4 vDiffuse : SV_TARGET0; + float4 vRevealage : SV_TARGET1; + float4 vColorTarget : SV_TARGET2; +}; + +PS_TRAILOUT PS_Trail(PS_IN In) +{ + PS_TRAILOUT Out; - vector vDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); - vector vMasking = g_MaskingTexture.Sample(DefaultSampler, In.vTexcoord); + vector vMtrlDiffuse; + vector vMtrlMask; + vector vMtrlNoise; + + if (g_isDiffuse == true) + vMtrlDiffuse = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord); + else + vMtrlDiffuse = vector(0.f, 0.f, 0.f, 1.f); + + if (g_isMask == true) + vMtrlMask = g_MaskingTexture.Sample(PointSampler, In.vTexcoord); + else + vMtrlMask = vector(1.f, 1.f, 1.f, 1.f); + + if (g_isNoise == true) + { + vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, In.vTexcoord); + + //vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlNoise.r); + + vMtrlDiffuse *= vMtrlNoise; + } + + + vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlMask.r); + + + float fWeight = clamp(pow(In.vProjPos.w, -2.5f), 1.0f, 1000.0f); + + + Out.vDiffuse = vector(vMtrlDiffuse.rgb * vMtrlDiffuse.a, vMtrlDiffuse.a) * fWeight; + + Out.vRevealage.r = vMtrlDiffuse.a; + Out.vColorTarget = vector(0.f, 0.f, 0.f, 0.f); - vDiffuse.a = vDiffuse.a * vMasking.r; - Out.vColor = vDiffuse; - Out.vColor.a *= In.vTexcoord.x; - clip(Out.vColor.a - 0.01f); return Out; } diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Dungeon1.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Dungeon1.png new file mode 100644 index 000000000..600f0f7dc Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Dungeon1.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Dungeon2.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Dungeon2.png new file mode 100644 index 000000000..43fb0e20e Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Dungeon2.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Dungeon3.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Dungeon3.png new file mode 100644 index 000000000..338839f98 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Dungeon3.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Dungeon4.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Dungeon4.png new file mode 100644 index 000000000..cddd2e7ce Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Dungeon4.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Dungeon5.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Dungeon5.png new file mode 100644 index 000000000..5fa9f592b Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Dungeon5.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Generic1.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Generic1.png new file mode 100644 index 000000000..b02760373 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Generic1.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogsmeade1.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogsmeade1.png new file mode 100644 index 000000000..5a35bb55e Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogsmeade1.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogsmeade2.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogsmeade2.png new file mode 100644 index 000000000..e2577da72 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogsmeade2.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogsmeade3.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogsmeade3.png new file mode 100644 index 000000000..7d488c1f2 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogsmeade3.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogsmeade4.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogsmeade4.png new file mode 100644 index 000000000..6b517cb51 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogsmeade4.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogsmeade5.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogsmeade5.png new file mode 100644 index 000000000..db4ffab63 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogsmeade5.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogwarts1.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogwarts1.png new file mode 100644 index 000000000..9ff845e51 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogwarts1.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogwarts2.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogwarts2.png new file mode 100644 index 000000000..6904d09eb Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogwarts2.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogwarts3.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogwarts3.png new file mode 100644 index 000000000..a836c1325 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogwarts3.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogwarts4.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogwarts4.png new file mode 100644 index 000000000..a40e52a7a Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogwarts4.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogwarts5.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogwarts5.png new file mode 100644 index 000000000..98ef35dc1 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Hogwarts5.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Overland1.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Overland1.png new file mode 100644 index 000000000..f4a2aa4a5 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Overland1.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Overland2.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Overland2.png new file mode 100644 index 000000000..a52b20c2a Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Overland2.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Overland3.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Overland3.png new file mode 100644 index 000000000..d3bb27e91 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Overland3.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Overland4.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Overland4.png new file mode 100644 index 000000000..1735958a6 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Overland4.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Overland5.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Overland5.png new file mode 100644 index 000000000..f94edf1b1 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Overland5.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Sanctuary1.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Sanctuary1.png new file mode 100644 index 000000000..37fad41d3 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Sanctuary1.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Sanctuary2.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Sanctuary2.png new file mode 100644 index 000000000..18942ce0f Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Sanctuary2.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Sanctuary3.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Sanctuary3.png new file mode 100644 index 000000000..f7af17cc5 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Sanctuary3.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Sanctuary4.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Sanctuary4.png new file mode 100644 index 000000000..387a9ba87 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Sanctuary4.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Sanctuary5.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Sanctuary5.png new file mode 100644 index 000000000..33fd6f430 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/LoadingScreen/UI_T_LoadingScreen_Sanctuary5.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Mission/Group 1.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Mission/Group 1.png new file mode 100644 index 000000000..0275521be Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Mission/Group 1.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Mission/MissionBanner_Border.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Mission/MissionBanner_Border.png index ac93bf6ff..91853f4f7 100644 Binary files a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Mission/MissionBanner_Border.png and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Mission/MissionBanner_Border.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Mission/UI_T_DuelDivider.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Mission/UI_T_DuelDivider.png new file mode 100644 index 000000000..c5d079031 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Mission/UI_T_DuelDivider.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Mission/UI_T_Icon_InteractType_Straight.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Mission/UI_T_Icon_InteractType_Straight.png new file mode 100644 index 000000000..e1576dc61 Binary files /dev/null and b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Mission/UI_T_Icon_InteractType_Straight.png differ diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Mission/UI_T_NotificationGoldLeaf_Divider.png b/Jusin154_Team3D/Editor/Bin/Resources/Textures/Mission/UI_T_NotificationGoldLeaf_Divider.png deleted file mode 100644 index 3cc37dc13..000000000 Binary files a/Jusin154_Team3D/Editor/Bin/Resources/Textures/Mission/UI_T_NotificationGoldLeaf_Divider.png and /dev/null differ diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj b/Jusin154_Team3D/Editor/Default/Editor.vcxproj index 5ed316e18..04b874e45 100644 --- a/Jusin154_Team3D/Editor/Default/Editor.vcxproj +++ b/Jusin154_Team3D/Editor/Default/Editor.vcxproj @@ -29,7 +29,7 @@ Application true - v145 + v143 Unicode @@ -173,6 +173,7 @@ + true true @@ -193,6 +194,8 @@ + + @@ -206,6 +209,7 @@ + @@ -241,6 +245,7 @@ + @@ -288,6 +293,7 @@ + true true @@ -308,6 +314,8 @@ + + @@ -321,6 +329,7 @@ + @@ -356,6 +365,7 @@ + @@ -402,6 +412,7 @@ Effect 5.0 + Effect 5.0 diff --git a/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters b/Jusin154_Team3D/Editor/Default/Editor.vcxproj.filters index c149e7351..4237eaa35 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} @@ -301,6 +307,15 @@ {b017e167-f48d-4417-a924-765ab802cff5} + + {f5cd19e8-186b-418f-b7fa-af73046a80d1} + + + {a193f87a-e222-4dd8-9766-cb32bb368ccb} + + + {8882358e-c8eb-4222-a87e-01d902533b8f} + {3614836d-9988-4ec0-95a8-f8ebc25a9a13} @@ -582,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 @@ -603,6 +624,16 @@ 80.State\State_Combat + + 02.GameObjects\Layer_Effect\Effect\03.TrailObject + + + 02.GameObjects\Layer_Effect\Effect\04.Effect_Container + + + 02.GameObjects\Layer_Effect\Effect\05.NomalJap + + 80.State\State_Combat\State_Skill2 @@ -614,6 +645,7 @@ 02.GameObjects\Broom + @@ -880,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 @@ -901,6 +939,15 @@ 80.State\State_Combat + + 02.GameObjects\Layer_Effect\Effect\03.TrailObject + + + 02.GameObjects\Layer_Effect\Effect\04.Effect_Container + + + 02.GameObjects\Layer_Effect\Effect\05.NomalJap + 80.State\State_Combat\State_Skill2 @@ -912,6 +959,7 @@ 02.GameObjects\Broom + @@ -941,5 +989,8 @@ 99.Define\SHADER + + 99.Define\SHADER + \ No newline at end of file diff --git a/Jusin154_Team3D/Editor/Private/Broom.cpp b/Jusin154_Team3D/Editor/Private/Broom.cpp index 24541bd2b..0381be466 100644 --- a/Jusin154_Team3D/Editor/Private/Broom.cpp +++ b/Jusin154_Team3D/Editor/Private/Broom.cpp @@ -63,13 +63,9 @@ HRESULT CBroom::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/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..42f0f3b85 100644 --- a/Jusin154_Team3D/Editor/Private/Dummy_Cube.cpp +++ b/Jusin154_Team3D/Editor/Private/Dummy_Cube.cpp @@ -42,9 +42,9 @@ void CDummy_Cube::Update(_float fTimeDelta) void CDummy_Cube::Late_Update(_float fTimeDelta) { - if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) { - m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); - } + //if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) { + // m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this); + //} } HRESULT CDummy_Cube::Render() @@ -58,14 +58,11 @@ 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; } - if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::SKYBOX)))) { + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { 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..85c84511a 100644 --- a/Jusin154_Team3D/Editor/Private/Dummy_Plane.cpp +++ b/Jusin154_Team3D/Editor/Private/Dummy_Plane.cpp @@ -29,7 +29,6 @@ HRESULT CDummy_Plane::Initialize(void* pArg) m_pTransformCom->Set_State(STATE::POSITION, XMVectorSet(0.f, -10.f, 0.f, 1.f)); - return S_OK; } @@ -60,13 +59,9 @@ 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))) { - return E_FAIL; - } - if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_MESH::DEFAULT)))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Editor/Private/EditEffect.cpp b/Jusin154_Team3D/Editor/Private/EditEffect.cpp index 050f192f7..84e573507 100644 --- a/Jusin154_Team3D/Editor/Private/EditEffect.cpp +++ b/Jusin154_Team3D/Editor/Private/EditEffect.cpp @@ -39,10 +39,6 @@ void CEditEffect::Priority_Update(_float fTimeDelta) void CEditEffect::Update(_float fTimeDelta) { - - - - if (m_pInstance_ModelCom == nullptr) return; @@ -51,6 +47,7 @@ void CEditEffect::Update(_float fTimeDelta) if (m_EffectInfo.isBillboard) m_pGameInstance->BillBoard(m_pTransformCom); + } void CEditEffect::Late_Update(_float fTimeDelta) @@ -60,6 +57,9 @@ void CEditEffect::Late_Update(_float fTimeDelta) return; + XMStoreFloat4x4(&m_CombinedWorldMatrix , m_pTransformCom->Get_XMWorldMatrix() * m_pParentTransformCom->Get_XMWorldMatrix()); + + if (m_EffectInfo.isBlur == true) { m_pGameInstance->Add_RenderGroup(RENDER::BLUR, this); @@ -141,7 +141,6 @@ void CEditEffect::Reference_Mat_For_EditEffect() HRESULT CEditEffect::Save_Effect(const _char* pPath) { - _string strPerfectFilePath = pPath; strPerfectFilePath += ".bin"; @@ -154,12 +153,12 @@ HRESULT CEditEffect::Save_Effect(const _char* pPath) if (hFile == INVALID_HANDLE_VALUE) { - MessageBox(NULL, L"오브젝트 저장 실패", L"System Message", MB_OK); + MessageBox(NULL, L"이펙트 오브젝트 저장 실패", L"System Message", MB_OK); return E_FAIL; } + m_strPath = strPerfectFilePath; - DWORD dwByte(0); if (m_pLightCom != nullptr) @@ -291,11 +290,39 @@ HRESULT CEditEffect::Save_Effect(const _char* pPath) m_pInstance_ModelCom->Save_InstanceModel(hFile); + + MessageBox(NULL, L"이펙트 저장 성공", L"System Message", MB_OK); + CloseHandle(hFile); return S_OK; } +HRESULT CEditEffect::Save_Path(HANDLE hFile) +{ + DWORD dwByte; + + size_t iObjectLength = m_strPath.length(); + const _char* pFilePath = m_strPath.c_str(); + + if (!WriteFile(hFile, &m_EffectInfo.eEffectType, sizeof(EFFECT_TYPE), &dwByte, nullptr)) { + return E_FAIL; + } + + if (!WriteFile(hFile, &iObjectLength, sizeof(size_t), &dwByte, nullptr)) { + return E_FAIL; + } + + if (pFilePath != 0) + { + if (!WriteFile(hFile, pFilePath, sizeof(_char) * ((DWORD)iObjectLength + 1), &dwByte, nullptr)) { + return E_FAIL; + } + } + + return S_OK; +} + HRESULT CEditEffect::Ready_Components(void* pArg) { if (FAILED(__super::Ready_Components(pArg))) @@ -308,6 +335,7 @@ HRESULT CEditEffect::Ready_Components(void* pArg) return E_FAIL; } + return S_OK; } @@ -341,6 +369,7 @@ CGameObject* CEditEffect::Clone(void* pArg, CGameObject* pOwner) void CEditEffect::Free() { __super::Free(); + } void CEditEffect::Describe_Entity() @@ -365,7 +394,6 @@ void CEditEffect::Describe_Entity() GUI::Checkbox("Distortion", &m_EffectInfo.isDistortion); GUI::Checkbox("Noise", &m_EffectInfo.isNoise); - if (GUI::Checkbox("Billboard", &m_EffectInfo.isBillboard)) { m_pTransformCom->Rotation(0.f, 0.f, 0.f); diff --git a/Jusin154_Team3D/Editor/Private/EffectObject.cpp b/Jusin154_Team3D/Editor/Private/EffectObject.cpp index 47ad19e1a..230246b42 100644 --- a/Jusin154_Team3D/Editor/Private/EffectObject.cpp +++ b/Jusin154_Team3D/Editor/Private/EffectObject.cpp @@ -53,6 +53,7 @@ HRESULT CEffectObject::Render() } } + return S_OK; } @@ -93,12 +94,14 @@ HRESULT CEffectObject::Render_Blur() + return S_OK; } + + HRESULT CEffectObject::Load(const _char* pFilePath , LEVEL eLevel) { - SAFE_RELEASE(m_pDiffuse_TextureCom); SAFE_RELEASE(m_pNoise_TextureCom); SAFE_RELEASE(m_pMasking_TextureCom); @@ -130,6 +133,8 @@ HRESULT CEffectObject::Load(const _char* pFilePath , LEVEL eLevel) return E_FAIL; } + // 나중에 패키징할때 패스를 저장할거임 + m_strPath = strPerfectFilePath; DWORD dwByte(0); @@ -323,13 +328,14 @@ HRESULT CEffectObject::Load(const _char* pFilePath , LEVEL eLevel) CloseHandle(hFile); + + MessageBox(NULL, L"이펙트 로드 성공", L"System Message", MB_OK); + return S_OK; } #ifdef _DEBUG - - HRESULT CEffectObject::LoadPre(const _char* pFilePath, LEVEL eLevel) { @@ -555,7 +561,7 @@ HRESULT CEffectObject::LoadPre(const _char* pFilePath, LEVEL eLevel) HRESULT CEffectObject::Bind_ShaderResources() { - if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) { + if (FAILED(m_pShaderCom->Bind_Matrix("g_WorldMatrix", &m_CombinedWorldMatrix))) { return E_FAIL; } @@ -637,7 +643,6 @@ HRESULT CEffectObject::Bind_ShaderResources() return E_FAIL; } - if (FAILED(m_pShaderCom->Bind_RawValue("g_vDiffuseDistortionUVGainAmount", &m_EffectInfo.vDiffuseDistortionUVGainAmount, sizeof(_float2)))) { return E_FAIL; } @@ -735,7 +740,14 @@ HRESULT CEffectObject::Bind_ShaderResources() HRESULT CEffectObject::Ready_Components(void* pArg) { - if (FAILED(__super::Ready_Components(pArg))) { + CTransform::TRANSFORM_DESC TransformDesc = {}; + + TransformDesc.fRadius = 20.f; + TransformDesc.fRotationPerSec = 10.f; + TransformDesc.fSpeedPerSec = 10.f; + + + if (FAILED(__super::Ready_Components(&TransformDesc))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Editor/Private/Effect_Container.cpp b/Jusin154_Team3D/Editor/Private/Effect_Container.cpp new file mode 100644 index 000000000..bfe1d9cb2 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/Effect_Container.cpp @@ -0,0 +1,298 @@ +#include "pch.h" +#include "Effect_Container.h" + +#include "GameInstance.h" +#include "EditEffect.h" +#include "TrailObject.h" + + +#include + +CEffect_Container::CEffect_Container(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CContainerObject{ pDevice, pContext } +{ +} + +CEffect_Container::CEffect_Container(const CEffect_Container& rhs) + : CContainerObject(rhs) +{ + +} + +HRESULT CEffect_Container::Initialize_Prototype() +{ + + return S_OK; + +} + +HRESULT CEffect_Container::Initialize(void* pArg) +{ + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Child())) + return E_FAIL; + + + + return S_OK; +} + +void CEffect_Container::Priority_Update(_float fTimeDelta) +{ + __super::Priority_Update(fTimeDelta); +} + +void CEffect_Container::Update(_float fTimeDelta) +{ + __super::Update(fTimeDelta); + +} + +void CEffect_Container::Late_Update(_float fTimeDelta) +{ + __super::Late_Update(fTimeDelta); +} + +#ifdef _DEBUG + +HRESULT CEffect_Container::Save_Package(const _char* pPath) +{ + _string strPerfectFilePath = pPath; + strPerfectFilePath += ".bin"; + + HANDLE hFile = CreateFile(CMyTools::ToWstring(strPerfectFilePath).c_str(), + GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, NULL + ); + + + if (hFile == INVALID_HANDLE_VALUE) { + MessageBox(NULL, L"패키징 저장 실패", L"System Message", MB_OK); + return E_FAIL; + } + + ; + + DWORD dwByte(0); + + _int iObjectCount = (_int)m_PartObjects.size(); + + if (!WriteFile(hFile, &iObjectCount, sizeof(_int), &dwByte, nullptr)) { + return E_FAIL; + } + + // 자식 개수 저장 + + for (auto& pPartObejct : m_PartObjects) + { + CEditEffect* pEffectObject = dynamic_cast(pPartObejct.second); + CTrailObject* pTrailObject = {}; + + if (pEffectObject == nullptr) // 이펙트 오브젝트가 아닐 경우 + { + pTrailObject = dynamic_cast(pPartObejct.second); + + pTrailObject->Save_Path(hFile); + } + else + { + pEffectObject->Save_Path(hFile); + } + } + + + CloseHandle(hFile); + + + MessageBox(NULL, L"패키징 성공", L"System Message", MB_OK); + + return S_OK; +} + +#endif + +HRESULT CEffect_Container::Load_Package(const _char* pPath) +{ + _string strPerfectFilePath = pPath; + + strPerfectFilePath += ".bin"; + + DWORD dwByte(0); + + HANDLE hFile = CreateFileW( + CMyTools::ToWstring(strPerfectFilePath).c_str(), // 파일 이름 + GENERIC_READ, // 읽기 모드 + FILE_SHARE_READ, // 다른 프로세스도 읽기 가능 + NULL, + OPEN_EXISTING, // 기존 파일 열기 + FILE_ATTRIBUTE_NORMAL, + NULL + ); + + if (hFile == INVALID_HANDLE_VALUE) { + MessageBox(NULL, L"패키징 읽기 실패", L"System Message", MB_OK); + return E_FAIL; + } + + _int iObjectCount = {}; + + if (!ReadFile(hFile, &iObjectCount, sizeof(_int), &dwByte, nullptr)) { + return E_FAIL; + } + + for (size_t i = 0; i < iObjectCount; i++) + { + EFFECT_TYPE eEffectType = {}; + + if (!ReadFile(hFile, &eEffectType, sizeof(EFFECT_TYPE), &dwByte, nullptr)) { + return E_FAIL; + } + + size_t iFilePathLength = {}; + + if (!ReadFile(hFile, &iFilePathLength, sizeof(size_t), &dwByte, nullptr)) { + return E_FAIL; + } + + _char szFilePath[MAX_PATH] = {}; + + if (iFilePathLength != 0) + { + if (!ReadFile(hFile, szFilePath, sizeof(_char) * ((DWORD)iFilePathLength + 1), &dwByte, nullptr)) { + return E_FAIL; + } + } + + _string strPath = szFilePath; + size_t iPos; + + while ((iPos = strPath.find(".bin")) != std::string::npos) { + strPath.erase(iPos, 4); + }; + + + CPartObject::PARTOBJECT_DESC PartsDesc{}; + CEditEffect* pEditEffect = {}; + CTrailObject* pTrailEffect = {}; + switch (eEffectType) + { + case EFFECT_TYPE::EFFECT: + + + PartsDesc.pParentTransform = m_pTransformCom; + + + if (FAILED(Add_PartObject("EffectObject" + i, ENUM_CLASS(LEVEL::EFFECT), &pEditEffect, &PartsDesc))) + { + return E_FAIL; + } + + pEditEffect->Load(strPath.c_str(), LEVEL::EFFECT); + + SAFE_RELEASE(pEditEffect); + + break; + + case EFFECT_TYPE::TRAIL: + + PartsDesc.pParentTransform = m_pTransformCom; + + + if (FAILED(Add_PartObject("TrailObject" + i, ENUM_CLASS(LEVEL::EFFECT), &pTrailEffect, &PartsDesc))) + { + return E_FAIL; + } + + pTrailEffect->Load_Trail(strPath.c_str(), LEVEL::EFFECT); + + SAFE_RELEASE(pTrailEffect); + + break; + case EFFECT_TYPE::END: + break; + default: + break; + } + + } + + CloseHandle(hFile); + + MessageBox(NULL, L"패키징 로드 성공", L"System Message", MB_OK); + + return S_OK; +} + +HRESULT CEffect_Container::Ready_Components(void* pArg) +{ + CTransform::TRANSFORM_DESC TransformDesc = {}; + + TransformDesc.fRadius = 20.f; + TransformDesc.fRotationPerSec = 10.f; + TransformDesc.fSpeedPerSec = 10.f; + + if (FAILED(__super::Ready_Components(&TransformDesc))) { + return E_FAIL; + } + + return S_OK; +} + +HRESULT CEffect_Container::Ready_Child() +{ + + return S_OK; +} + +void CEffect_Container::Free() +{ + __super::Free(); + +} + +HRESULT CEffect_Container::Bind_ShaderResources() +{ + return S_OK; +} + +void CEffect_Container::Update_Event(_float fTimeDelta) +{ + + m_fPreAccTime = m_fAccTime; + m_fAccTime += fTimeDelta; + + if (m_fAccTime >= m_fDelay && m_isDelayed == false) // 아직 딜레이되지 않았고 딜레이를 넘어섰다면 + { + m_isDelayed = true; + } + else + { + return; + } + + + if (m_fAccTime >= m_fDuration) // 듀레이션을 넘어섰다면 + { + if (m_isLoop) + { + m_fAccTime = 0.f; + m_fPreAccTime = 0.f; + m_isDelayed = false; + } + } + + + for (auto& pPair : m_Events) // 이벤트들을 비교하면서 실행함 + { + if (pPair.first >= m_fPreAccTime && pPair.first <= m_fAccTime) + { + pPair.second(); + } + } + + +} diff --git a/Jusin154_Team3D/Editor/Private/Effect_Editor.cpp b/Jusin154_Team3D/Editor/Private/Effect_Editor.cpp index 59dd9abdb..90fc4eb93 100644 --- a/Jusin154_Team3D/Editor/Private/Effect_Editor.cpp +++ b/Jusin154_Team3D/Editor/Private/Effect_Editor.cpp @@ -3,17 +3,18 @@ #include "GameInstance.h" #include "EditEffect.h" +#include "TrailObject.h" #include CEffect_Editor::CEffect_Editor(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) - : CContainerObject{ pDevice, pContext } + : CEffect_Container{ pDevice, pContext } { } CEffect_Editor::CEffect_Editor(const CEffect_Editor& rhs) - : CContainerObject(rhs) + : CEffect_Container(rhs) , m_MatFiles(rhs.m_MatFiles) { @@ -22,8 +23,6 @@ CEffect_Editor::CEffect_Editor(const CEffect_Editor& rhs) HRESULT CEffect_Editor::Initialize_Prototype() { - - ReadMaterials("../Bin/Resources/VFX/Particles/Magic/Glacius"); @@ -70,6 +69,18 @@ void CEffect_Editor::Update(_float fTimeDelta) Describe_Entity(); __super::Update(fTimeDelta); + if (m_pGameInstance->Key_Pressing(DIK_UP)) + m_pTransformCom->Go_Straight(fTimeDelta); + if (m_pGameInstance->Key_Pressing(DIK_DOWN)) + m_pTransformCom->Go_Backward(fTimeDelta); + if (m_pGameInstance->Key_Pressing(DIK_RIGHT)) + m_pTransformCom->Go_Right(fTimeDelta); + if (m_pGameInstance->Key_Pressing(DIK_LEFT)) + m_pTransformCom->Go_Left(fTimeDelta); + + if (m_pGameInstance->Key_Pressing(DIK_Z)) + m_pTransformCom->Turn(XMVectorSet(0.f, 1.f, 0.f, 0.f), fTimeDelta); + } void CEffect_Editor::Late_Update(_float fTimeDelta) @@ -79,7 +90,13 @@ void CEffect_Editor::Late_Update(_float fTimeDelta) HRESULT CEffect_Editor::Ready_Components(void* pArg) { - if (FAILED(__super::Ready_Components(pArg))) { + CTransform::TRANSFORM_DESC TransformDesc = {}; + + TransformDesc.fRadius = 20.f; + TransformDesc.fRotationPerSec = 10.f; + TransformDesc.fSpeedPerSec = 10.f; + + if (FAILED(__super::Ready_Components(&TransformDesc))) { return E_FAIL; } @@ -90,15 +107,15 @@ HRESULT CEffect_Editor::Ready_Child() { - CPartObject::PARTOBJECT_DESC PartsDesc{}; + //CPartObject::PARTOBJECT_DESC PartsDesc{}; - PartsDesc.pParentTransform = m_pTransformCom; + //PartsDesc.pParentTransform = m_pTransformCom; - if (FAILED(Add_PartObject("EffectObject" + to_string(m_iNumPart++), ENUM_CLASS(LEVEL::EFFECT), &m_pEditEffect, &PartsDesc))) - return E_FAIL; + //if (FAILED(Add_PartObject("EffectObject" + to_string(m_iNumPart++), ENUM_CLASS(LEVEL::EFFECT), nullptr, &PartsDesc))) + // return E_FAIL; + + //m_strCurrentEffectName = "EffectObject0" ; - m_strCurrentEffectName = "EffectObject0"; - SAFE_RELEASE(m_pEditEffect); @@ -388,12 +405,14 @@ CEffect_Editor* CEffect_Editor::Create(ID3D11Device* pDevice, ID3D11DeviceContex } return pInstance; + } CGameObject* CEffect_Editor::Clone(void* pArg, CGameObject* pOwner) { CEffect_Editor* pInstance = new CEffect_Editor(*this); pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) { MSG_BOX("Failed to Cloned : CEffect_Editor"); @@ -408,6 +427,7 @@ void CEffect_Editor::Free() __super::Free(); SAFE_RELEASE(m_pEditEffect); + SAFE_RELEASE(m_pTrailObject); } void CEffect_Editor::Describe_Entity() @@ -417,29 +437,15 @@ void CEffect_Editor::Describe_Entity() GUI::TextColored(ImVec4(1.f, 0.f, 1.f, 1.f), m_strCurrentEffectName.c_str()); if (m_pEditEffect != nullptr) + { m_pEditEffect->Describe_Entity(); - - GUI::InputTextMultiline("FILE PATH", m_szBuffer, sizeof(m_szBuffer), ImVec2(250, 25)); - - m_strSavePath = m_szBuffer; - - if (GUI::Button("SAVE")) - { - m_pEditEffect->Save_Effect(m_strSavePath.c_str()); - } - - GUI::SameLine(); - - if (GUI::Button("LOAD")) - { - Load_Edit(m_strSavePath.c_str()); } - if (GUI::Button("RESAVE")) + if (m_pTrailObject != nullptr) { - ReSaveFile(m_strSavePath.c_str()); + m_pTrailObject->Describe_Entity(); } - + ImGui::End(); ImGui::Begin("Reference Material"); @@ -467,10 +473,32 @@ void CEffect_Editor::Describe_Entity() PartsDesc.pParentTransform = m_pTransformCom; if (FAILED(Add_PartObject("EffectObject" + to_string(m_iNumPart++), ENUM_CLASS(LEVEL::EFFECT), nullptr, &PartsDesc))) + { + ImGui::EndPopup(); return; + } + } + if (ImGui::MenuItem("Create Trail")) + { + if (m_pTrailObject == nullptr) + { + CPartObject::PARTOBJECT_DESC PartsDesc{}; + + PartsDesc.pParentTransform = m_pTransformCom; + + if (FAILED(Add_PartObject("TrailObject", ENUM_CLASS(LEVEL::EFFECT), &m_pTrailObject, &PartsDesc))) + { + ImGui::EndPopup(); + } + + CTrailObject* pTrailObject = m_pTrailObject; + + SAFE_RELEASE(pTrailObject); + + } } ImGui::EndPopup(); @@ -482,7 +510,12 @@ void CEffect_Editor::Describe_Entity() for (auto& pPartObject : m_PartObjects) { - _string strName = "EffectObject" + to_string(iIndex); + _string strName = {}; + + if( nullptr != dynamic_cast(pPartObject.second)) + strName = "TrailObject" + to_string(iIndex); + else + strName = "EffectObject" + to_string(iIndex); if (GUI::TreeNode(strName.c_str())) { @@ -555,6 +588,74 @@ void CEffect_Editor::Describe_Entity() ImGui::End(); + + ImGui::Begin("Effect Save"); + + GUI::InputTextMultiline("FILE PATH", m_szBuffer, sizeof(m_szBuffer), ImVec2(250, 25)); + + m_strSavePath = m_szBuffer; + + if (GUI::Button("SAVE")) + { + m_pEditEffect->Save_Effect(m_strSavePath.c_str()); + } + + GUI::SameLine(); + + if (GUI::Button("LOAD")) + { + Load_Edit(m_strSavePath.c_str()); + } + + GUI::SameLine(); + + if (GUI::Button("RESAVE")) + { + ReSaveFile(m_strSavePath.c_str()); + } + + + + GUI::InputTextMultiline("PACKAGE FILE PATH", m_szPackageBuffer, sizeof(m_szPackageBuffer), ImVec2(250, 25)); + + m_strPackageSavePath = m_szPackageBuffer; + + if (GUI::Button("PACKAING")) + { + Save_Package(m_strPackageSavePath.c_str()); + } + + GUI::SameLine(); + + if (GUI::Button("LOAD PACKAGE")) + { + Load_Package(m_strPackageSavePath.c_str()); + } + + GUI::InputTextMultiline("TRAIL FILE PATH", m_szTrailBuffer, sizeof(m_szTrailBuffer), ImVec2(250, 25)); + + m_strTrailSavePath = m_szTrailBuffer; + + if (GUI::Button("TRAIL SAVE")) + { + if (m_pTrailObject != nullptr) + { + m_pTrailObject->Save_Trail(m_strTrailSavePath.c_str()); + } + } + + GUI::SameLine(); + + if (GUI::Button("TRAIL LOAD")) + { + if (m_pTrailObject != nullptr) + { + m_pTrailObject->Load_Trail(m_strTrailSavePath.c_str(), LEVEL::EFFECT); + } + } + + ImGui::End(); + } HRESULT CEffect_Editor::Bind_ShaderResources() diff --git a/Jusin154_Team3D/Editor/Private/Goblin.cpp b/Jusin154_Team3D/Editor/Private/Goblin.cpp index a444dbf36..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; } 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/IMGUIUI.cpp b/Jusin154_Team3D/Editor/Private/IMGUIUI.cpp index 1031a292b..66176d5cd 100644 --- a/Jusin154_Team3D/Editor/Private/IMGUIUI.cpp +++ b/Jusin154_Team3D/Editor/Private/IMGUIUI.cpp @@ -316,6 +316,15 @@ void CIMGUIUI::Update(_float fTimeDelta) { static_cast(m_pElementObject)->SizeUpdate(m_fSize.x, m_fSize.y); } + if (GUI::SliderFloat("X##Sizex", &m_fSize.x, 1.f, 1920.f)) + { + static_cast(m_pElementObject)->SizeUpX(m_fSize.x); + } + + if (GUI::SliderFloat("Y##Sizey", &m_fSize.y, 1.f, 1080.f)) + { + static_cast(m_pElementObject)->SizeUpY(m_fSize.y); + } if (GUI::SliderFloat("Size", &m_fSizeXY.x, 1.f, 1980.f)) { diff --git a/Jusin154_Team3D/Editor/Private/Land.cpp b/Jusin154_Team3D/Editor/Private/Land.cpp index 229700a01..67cd59a80 100644 --- a/Jusin154_Team3D/Editor/Private/Land.cpp +++ b/Jusin154_Team3D/Editor/Private/Land.cpp @@ -57,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; } 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/Loader.cpp b/Jusin154_Team3D/Editor/Private/Loader.cpp index 3d2dfa955..5d500fc2e 100644 --- a/Jusin154_Team3D/Editor/Private/Loader.cpp +++ b/Jusin154_Team3D/Editor/Private/Loader.cpp @@ -23,7 +23,7 @@ #include "Player.h" #include "Goblin.h" #include "Broom.h" -#include + #pragma endregion @@ -76,6 +76,8 @@ #include "EditEffect.h" #include "Effect_Editor.h" #include "Dummy_Plane.h" +#include "TrailObject.h" +#include "NomalJap.h" #pragma endregion @@ -94,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 } @@ -120,11 +128,7 @@ HRESULT CLoader::Initialize(LEVEL eNextLevelID) { m_eNextLevelID = eNextLevelID; - InitializeCriticalSection(&m_CriticalSection); - - m_hThread = (HANDLE)_beginthreadex(nullptr, 0, LoadingMain, this, 0, nullptr); - if (0 == m_hThread) - return E_FAIL; + m_pGameInstance->EnqueueJob(&LoadingMain, this); return S_OK; } @@ -136,7 +140,6 @@ HRESULT CLoader::Loading() return E_FAIL; } - EnterCriticalSection(&m_CriticalSection); HRESULT hr = {}; @@ -163,15 +166,14 @@ 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; } - LeaveCriticalSection(&m_CriticalSection); if (FAILED(hr)) return E_FAIL; @@ -396,7 +398,18 @@ HRESULT CLoader::Loading_For_UI() m_strMessage = TEXT("Model Loading.."); + CVIBuffer_UI_Instance::UI_INSTANCE_DESC UIDesc{}; + UIDesc.iNum = 4; + UIDesc.vSize = _float2(1.f,1.f); + UIDesc.fPositionOffSetX = 75.f; + UIDesc.fPositionOffSetY = 0.f; + UIDesc.vPsition = _float2(100.f, 100.f); + + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_UI_Instance"), + CVIBuffer_UI_Instance::Create(m_pDevice, m_pContext, &UIDesc)))) { + return E_FAIL; + } m_strMessage = TEXT("Shader Loading.."); @@ -406,6 +419,12 @@ HRESULT CLoader::Loading_For_UI() return E_FAIL; } + if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, FX_UIINSTANCE, + CShader::Create(m_pDevice, m_pContext, TEXT("../Bin/Resources/ShaderFiles/Shader_UI_Instance.hlsl"), + VTX_POSTEX_INSTANCE_UI::Elements, VTX_POSTEX_INSTANCE_UI::iNumElements)))) { + return E_FAIL; + } + m_strMessage = TEXT("Prototype Loading.."); @@ -645,6 +664,15 @@ HRESULT CLoader::Loading_For_Effect() if (FAILED(m_pGameInstance->Add_Prototype(ENUM_CLASS(LEVEL::EFFECT), CDummy_Plane::Create(m_pDevice, m_pContext)))) return E_FAIL; + if (FAILED(m_pGameInstance->Add_Prototype(ENUM_CLASS(LEVEL::EFFECT), CTrail::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + if (FAILED(m_pGameInstance->Add_Prototype(ENUM_CLASS(LEVEL::EFFECT), CTrailObject::Create(m_pDevice, m_pContext)))) + return E_FAIL; + + if (FAILED(m_pGameInstance->Add_Prototype(ENUM_CLASS(LEVEL::EFFECT), CNomalJap::Create(m_pDevice, m_pContext)))) + return E_FAIL; + m_strMessage = TEXT("Loading Success!"); @@ -904,6 +932,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)) @@ -1461,12 +1540,6 @@ void CLoader::Free() { __super::Free(); - WaitForSingleObject(m_hThread, INFINITE); - - CloseHandle(m_hThread); - - DeleteCriticalSection(&m_CriticalSection); - SAFE_RELEASE(m_pGameInstance); SAFE_RELEASE(m_pDevice); SAFE_RELEASE(m_pContext); diff --git a/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp b/Jusin154_Team3D/Editor/Private/MapElement_Interactable.cpp index f10d05506..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) diff --git a/Jusin154_Team3D/Editor/Private/MapElement_Static.cpp b/Jusin154_Team3D/Editor/Private/MapElement_Static.cpp index 47d551246..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) diff --git a/Jusin154_Team3D/Editor/Private/MapObject_Collision.cpp b/Jusin154_Team3D/Editor/Private/MapObject_Collision.cpp index ac2c1beb0..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) diff --git a/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp b/Jusin154_Team3D/Editor/Private/MapObject_LOD.cpp index 77328c1e1..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)))) { diff --git a/Jusin154_Team3D/Editor/Private/MissionBanner_Border.cpp b/Jusin154_Team3D/Editor/Private/MissionBanner_Border.cpp index e09d48b4e..d11839c1b 100644 --- a/Jusin154_Team3D/Editor/Private/MissionBanner_Border.cpp +++ b/Jusin154_Team3D/Editor/Private/MissionBanner_Border.cpp @@ -1,6 +1,8 @@ #include "pch.h" #include "MissionBanner_Border.h" #include "GameInstance.h" +#include "Mission_Icon.h" + CMissionBanner_Border::CMissionBanner_Border(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) :CElementObject(pDevice, pContext) @@ -22,9 +24,9 @@ HRESULT CMissionBanner_Border::Initialize(void* pArg) CUIObject::UIOBJECT_DESC Desc{}; Desc.fX = -207.f; - Desc.fY = 150.f; + Desc.fY = 115.f; Desc.fSizeX = 256.f; - Desc.fSizeY = 128.f; + Desc.fSizeY = 175.f; m_pRect = { long(Desc.fX - Desc.fSizeX * 0.5f), long(Desc.fY - Desc.fSizeY * 0.5f), long(Desc.fX + Desc.fSizeX * 0.5f), long(Desc.fY + Desc.fSizeY * 0.5f) }; @@ -37,20 +39,22 @@ HRESULT CMissionBanner_Border::Initialize(void* pArg) return E_FAIL; } - m_fTimeMult = 3.f; + m_fTimeMult = 15.f; m_fAlpha = 0.f; m_fAlphaTime = 5.f; - m_fMoveSpeed = 5.f; + m_fMoveSpeed = 100.f; m_fLerpX = m_fX; + m_fLerpY = 100.f; m_fSortZ = 0.11f; m_vUVScale = _float2(1.f, 1.f); - static_cast(m_pOwner)->Add_Function(TEXT("Missiom_On"), [this]() {this->Set_FadeIn(); }); - static_cast(m_pOwner)->Add_Function(TEXT("Missiom_On"), [this]() {this->LerpOn(); }); - static_cast(m_pOwner)->Add_Function(TEXT("Missiom_Off"), [this]() {this->Set_FadeOut(); }); - static_cast(m_pOwner)->Add_Function(TEXT("Missiom_Off"), [this]() {this->LerpOff(); }); + m_vNine_Slice = _float4(80, 200, 60, 90); + static_cast(m_pOwner)->Add_Function(TEXT("Mission_On"), [this](void* p) {this->Set_FadeIn(); }); + static_cast(m_pOwner)->Add_Function(TEXT("Mission_Off"), [this](void* p) {this->Set_FadeOut(); }); + static_cast(m_pOwner)->Add_Function(TEXT("Mission_Off"), [this](void* p) {this->LerpOff(); }); return S_OK; } + void CMissionBanner_Border::Priority_Update(_float fTimeDelta) { if (!__super::Chack_Visible()) @@ -66,6 +70,7 @@ void CMissionBanner_Border::Update(_float fTimeDelta) { return; } + m_fLerpTime = fTimeDelta * m_fTimeMult; if (m_bFadeIn == true) { @@ -75,6 +80,10 @@ void CMissionBanner_Border::Update(_float fTimeDelta) m_fAlpha += fTimeDelta * m_fAlphaTime; } + if (m_fAlpha >= 0.5f) + { + LerpOn(); + } if (m_fAlpha >= 1.f) { m_bFadeIn = false; @@ -94,16 +103,18 @@ void CMissionBanner_Border::Update(_float fTimeDelta) m_fAlpha = 0.f; } } - + if (m_pGameInstance->Key_Down(DIK_1)) + { + Lerp_PosY(100); + } if (m_bLerpOn == true) { - - Start_Lerp(m_fMoveSpeed); + Size_LerpOn(m_fOrigin_Size.y + m_fLerpY, m_fLerpTime); } if (m_bLerpOff == true) { - Reset_Pos(m_fMoveSpeed); + Size_LerpOff(m_fLerpTime); } m_fTime += fTimeDelta * m_fTimeMult; @@ -129,7 +140,7 @@ HRESULT CMissionBanner_Border::Render() if (FAILED(Bind_ShaderResources())) { return E_FAIL; } - if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::MISSION)))) { + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::NINECLICE)))) { return E_FAIL; } if (FAILED(m_pVIBufferCom->Bind_Resources())) { @@ -138,7 +149,7 @@ HRESULT CMissionBanner_Border::Render() if (FAILED(m_pVIBufferCom->Render())) { return E_FAIL; } - + m_pMission_Icon->Render(); return S_OK; } @@ -147,6 +158,49 @@ _vector CMissionBanner_Border::Get_WorldPostion() return m_pTransformCom->Get_State(STATE::POSITION); } +void CMissionBanner_Border::Size_LerpOn(_float LerpX, _float fTimeDelta) +{ + _float fDir = LerpX - m_fSizeY; + _float move = m_fMoveSpeed * fTimeDelta; + + + if (fDir <= move) + { + m_fSizeY = LerpX; + m_bLerpOn = false; + } + + else + { + m_fY -= move * 0.5f; + m_fSizeY += move; + static_cast(m_pMission_Icon)->MoveY(move * 0.5f); + + } +} + +void CMissionBanner_Border::Size_LerpOff(_float fTimeDelta) +{ + _float fDir = m_fSizeY - m_fOrigin_Size.y; + + _float move = m_fMoveSpeed * fTimeDelta; + + if (fDir <= move) + { + m_fSizeY = m_fOrigin_Size.y; + m_fLerpY; + m_bLerpOn = false; + } + + else + { + m_fSizeY -= move; + m_fY += move * 0.5f; + static_cast(m_pMission_Icon)->MoveY(-move * 0.5f); + + } +} + HRESULT CMissionBanner_Border::Bind_ShaderResources() { if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) @@ -197,6 +251,10 @@ HRESULT CMissionBanner_Border::Bind_ShaderResources() { return E_FAIL; } + if (FAILED(m_pShaderCom->Bind_RawValue("g_fCurrent_Size", &m_vScale, sizeof(_float2)))) + { + return E_FAIL; + } return S_OK; } @@ -219,10 +277,26 @@ HRESULT CMissionBanner_Border::Ready_Components(void* pArg) { return E_FAIL; } - + if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pMission_Icon)))) + { + return E_FAIL; + } return S_OK; } +void CMissionBanner_Border::SizeUpX(_float fSizeX) +{ + m_fSizeX = fSizeX; + m_fX += (fSizeX - m_vScale.x) * 0.5f; + m_fLerpX += (fSizeX - m_vScale.x) * 0.5f; + static_cast(m_pMission_Icon)->MoveX((fSizeX - m_vScale.x) * 0.5f); +} + +void CMissionBanner_Border::Lerp_PosY(_float fSizeY) +{ + m_fLerpY = fSizeY; +} + CMissionBanner_Border* CMissionBanner_Border::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) { CMissionBanner_Border* pInstance = new CMissionBanner_Border(pDevice, pContext); diff --git a/Jusin154_Team3D/Editor/Private/Mission_Icon.cpp b/Jusin154_Team3D/Editor/Private/Mission_Icon.cpp index cd52289cb..7be1c58ca 100644 --- a/Jusin154_Team3D/Editor/Private/Mission_Icon.cpp +++ b/Jusin154_Team3D/Editor/Private/Mission_Icon.cpp @@ -21,8 +21,8 @@ HRESULT CMission_Icon::Initialize(void* pArg) { CUIObject::UIOBJECT_DESC Desc{}; - Desc.fX = -275.f; - Desc.fY = 145.f; + Desc.fX = -70.f; + Desc.fY = -20.f; Desc.fSizeX = 60.f; Desc.fSizeY = 60.f; @@ -38,16 +38,22 @@ HRESULT CMission_Icon::Initialize(void* pArg) } m_fTimeMult = 3.f; - m_fAlpha = 0.f; + m_fAlpha = 1.f; m_fAlphaTime = 3.f; m_fMoveSpeed = 5.f; m_fLerpX = m_fX; + m_fLerpY = 45; m_fSortZ = 0.1f; m_eQuestType = QUESTYPE::MAIN; - static_cast(m_pOwner)->Add_Function(TEXT("Missiom_On"), [this]() {this->Set_FadeIn(); }); - static_cast(m_pOwner)->Add_Function(TEXT("Missiom_On"), [this]() {this->LerpOn(); }); - static_cast(m_pOwner)->Add_Function(TEXT("Missiom_Off"), [this]() {this->Set_FadeOut(); }); - static_cast(m_pOwner)->Add_Function(TEXT("Missiom_Off"), [this]() {this->LerpOff(); }); + //static_cast(m_pOwner)->Add_Function(TEXT("Mission_SizeUp"), [this](void* p) { + // if (p == nullptr) + // return; + // _float fY = *reinterpret_cast<_float*>(p); + // this->Lerp_PosY(fY); }); + //static_cast(m_pOwner)->Add_Function(TEXT("Mission_On"), [this] (void* p) {this->Set_FadeIn(); }); + ////static_cast(m_pOwner)->Add_Function(TEXT("Mission_On"), [this] (void* p) {this->LerpOn(); }); + //static_cast(m_pOwner)->Add_Function(TEXT("Mission_Off"), [this](void* p) {this->Set_FadeOut(); }); + //static_cast(m_pOwner)->Add_Function(TEXT("Mission_Off"), [this](void* p) {this->LerpOff(); }); m_iType = ENUM_CLASS(m_eQuestType); return S_OK; } @@ -59,25 +65,22 @@ void CMission_Icon::QuestType(QUESTYPE eType) void CMission_Icon::Priority_Update(_float fTimeDelta) { - if (!__super::Chack_Visible()) - { - return; - } __super::Priority_Update(fTimeDelta); } void CMission_Icon::Update(_float fTimeDelta) { - if (!__super::Chack_Visible()) - { - return; - } - if (m_bFadeIn == true) { if (m_fAlpha <= 1.f) + { m_fAlpha += fTimeDelta * m_fAlphaTime; + } + if (m_fAlpha >= 0.2f) + { + LerpOn(); + } if (m_fAlpha >= 1.f) { m_bFadeIn = false; @@ -98,7 +101,6 @@ void CMission_Icon::Update(_float fTimeDelta) } if (m_bLerpOn == true) { - Start_Lerp(m_fMoveSpeed); } @@ -113,14 +115,7 @@ void CMission_Icon::Update(_float fTimeDelta) void CMission_Icon::Late_Update(_float fTimeDelta) { - if (!__super::Chack_Visible()) - { - return; - } if (m_bVisible) { - if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) { - m_pGameInstance->Add_RenderGroup(RENDER::UI, this); - } __super::Late_Update(fTimeDelta); } } @@ -148,6 +143,21 @@ _vector CMission_Icon::Get_WorldPostion() return m_pTransformCom->Get_State(STATE::POSITION); } +void CMission_Icon::MoveX(_float fX) +{ + m_fX -= fX; +} + +void CMission_Icon::MoveY(_float fY) +{ + m_fY -= fY; +} + +void CMission_Icon::Lerp_PosY(_float fLerpY) +{ + m_fLerpY -= fLerpY; +} + HRESULT CMission_Icon::Bind_ShaderResources() { if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) diff --git a/Jusin154_Team3D/Editor/Private/Mission_Key.cpp b/Jusin154_Team3D/Editor/Private/Mission_Key.cpp index e9c63c42f..93a4f0ec0 100644 --- a/Jusin154_Team3D/Editor/Private/Mission_Key.cpp +++ b/Jusin154_Team3D/Editor/Private/Mission_Key.cpp @@ -21,10 +21,10 @@ HRESULT CMission_Key::Initialize(void* pArg) { CUIObject::UIOBJECT_DESC Desc{}; - Desc.fX = -296.f; - Desc.fY = 158.f; - Desc.fSizeX = 37.f; - Desc.fSizeY = 37.f; + Desc.fX = -297.f; + Desc.fY = 159.f; + Desc.fSizeX = 40.f; + Desc.fSizeY = 40.f; m_pRect = { long(Desc.fX - Desc.fSizeX * 0.5f), long(Desc.fY - Desc.fSizeY * 0.5f), long(Desc.fX + Desc.fSizeX * 0.5f), long(Desc.fY + Desc.fSizeY * 0.5f) }; diff --git a/Jusin154_Team3D/Editor/Private/Mission_KeyHold.cpp b/Jusin154_Team3D/Editor/Private/Mission_KeyHold.cpp index 8df1c44c9..28e643dba 100644 --- a/Jusin154_Team3D/Editor/Private/Mission_KeyHold.cpp +++ b/Jusin154_Team3D/Editor/Private/Mission_KeyHold.cpp @@ -21,10 +21,10 @@ HRESULT CMission_KeyHold::Initialize(void* pArg) { CUIObject::UIOBJECT_DESC Desc{}; - Desc.fX = -296.f; + Desc.fX = -297.f; Desc.fY = 158.f; - Desc.fSizeX = 86.f; - Desc.fSizeY = 86.f; + Desc.fSizeX = 94.f; + Desc.fSizeY = 94.f; m_pRect = { long(Desc.fX - Desc.fSizeX * 0.5f), long(Desc.fY - Desc.fSizeY * 0.5f), long(Desc.fX + Desc.fSizeX * 0.5f), long(Desc.fY + Desc.fSizeY * 0.5f) }; @@ -112,11 +112,11 @@ void CMission_KeyHold::Update(_float fTimeDelta) if (m_bisHoldOn) { - static_cast(m_pOwner)->Function_Callback(TEXT("Missiom_On")); + static_cast(m_pOwner)->Function_Callback(TEXT("Mission_On")); } else { - static_cast(m_pOwner)->Function_Callback(TEXT("Missiom_Off")); + static_cast(m_pOwner)->Function_Callback(TEXT("Mission_Off")); } __super::Update(fTimeDelta); diff --git a/Jusin154_Team3D/Editor/Private/Mission_Panel.cpp b/Jusin154_Team3D/Editor/Private/Mission_Panel.cpp index 0ee7abd31..62b7d60f7 100644 --- a/Jusin154_Team3D/Editor/Private/Mission_Panel.cpp +++ b/Jusin154_Team3D/Editor/Private/Mission_Panel.cpp @@ -1,10 +1,9 @@ -#include "pch.h" +#include "pch.h" #include "Mission_Panel.h" #include "GameInstance.h" #include "Mission_KeyHold.h" #include "Mission_Key.h" #include "Active_Icon.h" -#include "Mission_Icon.h" #include "MissionBanner_Border.h" #include "MissionBanner_Key.h" @@ -148,13 +147,6 @@ HRESULT CMission_Panel::Ready_Element(void* pArg) return E_FAIL; } Add_Element(TEXT("Mission_Key"), m_pMission_Key); - - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pMission_Icon)))) - { - return E_FAIL; - } - Add_Element(TEXT("Mission_Icon"), m_pMission_Icon); - if (FAILED(m_pGameInstance->Add_GameObject_ToLayer(g_iStaticLevel, NEXT_LEVEL, LAYER_UI, nullptr, this, reinterpret_cast(&m_pActive_Icon)))) { return E_FAIL; 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/NomalJap.cpp b/Jusin154_Team3D/Editor/Private/NomalJap.cpp new file mode 100644 index 000000000..959be1168 --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/NomalJap.cpp @@ -0,0 +1,122 @@ +#include "pch.h" +#include "NomalJap.h" + +#include "GameInstance.h" +#include "EditEffect.h" + + +CNomalJap::CNomalJap(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CEffect_Container{ pDevice, pContext } +{ +} + +CNomalJap::CNomalJap(const CNomalJap& rhs) + : CEffect_Container(rhs) +{ + +} + +HRESULT CNomalJap::Initialize_Prototype() +{ + + return S_OK; + +} + +HRESULT CNomalJap::Initialize(void* pArg) +{ + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components(pArg))) + return E_FAIL; + + if (FAILED(Ready_Child())) + return E_FAIL; + + + m_wstrEffectName = L"Nomal_Jap"; + + + return S_OK; +} + +void CNomalJap::Priority_Update(_float fTimeDelta) +{ + __super::Priority_Update(fTimeDelta); +} + +void CNomalJap::Update(_float fTimeDelta) +{ + __super::Update(fTimeDelta); + +} + +void CNomalJap::Late_Update(_float fTimeDelta) +{ + __super::Late_Update(fTimeDelta); +} + +HRESULT CNomalJap::Ready_Components(void* pArg) +{ + if (FAILED(__super::Ready_Components(pArg))) { + return E_FAIL; + } + + return S_OK; +} + +HRESULT CNomalJap::Ready_Child() +{ + + //CPartObject::PARTOBJECT_DESC PartsDesc{}; + + //PartsDesc.pParentTransform = m_pTransformCom; + + //if (FAILED(Add_PartObject("EffectObject" + to_string(m_iNumPart++), ENUM_CLASS(LEVEL::EFFECT), &m_pEditEffect, &PartsDesc))) + // return E_FAIL; + + return S_OK; +} + +CNomalJap* CNomalJap::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CNomalJap* pInstance = new CNomalJap(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CNomalJap"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CNomalJap::Free() +{ + __super::Free(); + +} + +CGameObject* CNomalJap::Clone(void* pArg, CGameObject* pOwner) +{ + CNomalJap* pInstance = new CNomalJap(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CNomalJap"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CNomalJap::Describe_Entity() +{ + +} + +HRESULT CNomalJap::Bind_ShaderResources() +{ + return S_OK; +} diff --git a/Jusin154_Team3D/Editor/Private/Player.cpp b/Jusin154_Team3D/Editor/Private/Player.cpp index 7e4df71e1..419e5e6f9 100644 --- a/Jusin154_Team3D/Editor/Private/Player.cpp +++ b/Jusin154_Team3D/Editor/Private/Player.cpp @@ -92,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; } diff --git a/Jusin154_Team3D/Editor/Private/Spell_Slot.cpp b/Jusin154_Team3D/Editor/Private/Spell_Slot.cpp index 13a2b9e6b..2ceededea 100644 --- a/Jusin154_Team3D/Editor/Private/Spell_Slot.cpp +++ b/Jusin154_Team3D/Editor/Private/Spell_Slot.cpp @@ -21,8 +21,8 @@ HRESULT CSpell_Slot::Initialize(void* pArg) { CUIObject::UIOBJECT_DESC Desc{}; - Desc.fX = -160.f; - Desc.fY = 50.f; + Desc.fX = 0.f; + Desc.fY = 98.f; Desc.fSizeX = 140.f; Desc.fSizeY = 140.f; @@ -41,6 +41,9 @@ HRESULT CSpell_Slot::Initialize(void* pArg) m_fTimeMult = 3.f; m_fAngle = XMConvertToRadians(-135); m_fAlphaTime = 1.f; + m_pVIBufferCom->Set_Cloned(true); + m_pVIBufferCom->Set_Size(m_fSizeX, m_fSizeY); + m_pVIBufferCom->Set_Pos(m_fX, m_fY, 150.f,0.f,4); return S_OK; } @@ -85,7 +88,6 @@ void CSpell_Slot::Update(_float fTimeDelta) } m_fTime += fTimeDelta * m_fTimeMult; __super::Update(fTimeDelta); - } void CSpell_Slot::Late_Update(_float fTimeDelta) @@ -110,7 +112,7 @@ HRESULT CSpell_Slot::Render() { return E_FAIL; } - if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::SLOT)))) + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_UIEDITOR::DEFAULT)))) { return E_FAIL; } @@ -174,7 +176,7 @@ HRESULT CSpell_Slot::Bind_ShaderResources() HRESULT CSpell_Slot::Ready_Components(void* pArg) { - if (FAILED(Add_Component(g_iStaticLevel, &m_pVIBufferCom))) + if (FAILED(Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_VIBuffer_UI_Instance"), (CComponent**)&m_pVIBufferCom, nullptr))) { return E_FAIL; } @@ -182,7 +184,7 @@ HRESULT CSpell_Slot::Ready_Components(void* pArg) { return E_FAIL; } - if (FAILED(Add_Asset_Component(g_iStaticLevel, FX_UIEDITOR, (CComponent**)&m_pShaderCom, nullptr))) + if (FAILED(Add_Asset_Component(g_iStaticLevel, FX_UIINSTANCE, (CComponent**)&m_pShaderCom, nullptr))) { return E_FAIL; } diff --git a/Jusin154_Team3D/Editor/Private/TrailObject.cpp b/Jusin154_Team3D/Editor/Private/TrailObject.cpp new file mode 100644 index 000000000..720c3702b --- /dev/null +++ b/Jusin154_Team3D/Editor/Private/TrailObject.cpp @@ -0,0 +1,463 @@ +#include "pch.h" +#include "TrailObject.h" + +#include "GameInstance.h" +#include "Trail.h" + + +CTrailObject::CTrailObject(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) + : CPartObject{ pDevice, pContext } +{ +} + +CTrailObject::CTrailObject(const CTrailObject& rhs) + : CPartObject(rhs) +{ +} + +HRESULT CTrailObject::Initialize_Prototype() +{ + return S_OK; +} + +HRESULT CTrailObject::Initialize(void* pArg) +{ + if (FAILED(__super::Initialize(pArg))) + return E_FAIL; + + if (FAILED(Ready_Components(pArg))) + return E_FAIL; + + + return S_OK; +} + +void CTrailObject::Priority_Update(_float fTimeDelta) +{ + +} + +void CTrailObject::Update(_float fTimeDelta) +{ + m_pTrailCom->Trail_Update(fTimeDelta, m_pParentTransformCom->Get_XMWorldMatrix()); +} + +void CTrailObject::Late_Update(_float fTimeDelta) +{ + if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) { + m_pGameInstance->Add_RenderGroup(RENDER::EFFECT, this); + } + +} + +#ifdef _DEBUG + +HRESULT CTrailObject::Save_Path(HANDLE hFile) +{ + DWORD dwByte; + + size_t iObjectLength = m_strPath.length(); + const _char* pFilePath = m_strPath.c_str(); + + if (!WriteFile(hFile, &m_eEffectType, sizeof(EFFECT_TYPE), &dwByte, nullptr)) { + return E_FAIL; + } + + if (!WriteFile(hFile, &iObjectLength, sizeof(size_t), &dwByte, nullptr)) { + return E_FAIL; + } + + if (pFilePath != 0) + { + if (!WriteFile(hFile, pFilePath, sizeof(_char) * ((DWORD)iObjectLength + 1), &dwByte, nullptr)) { + return E_FAIL; + } + } + + return S_OK; +} + +HRESULT CTrailObject::Save_Trail(const _char* pPath) +{ + _string strPerfectFilePath = pPath; + strPerfectFilePath += ".bin"; + + HANDLE hFile = CreateFile(CMyTools::ToWstring(strPerfectFilePath).c_str(), + GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, CREATE_ALWAYS, + FILE_ATTRIBUTE_NORMAL, NULL + ); + + + if (hFile == INVALID_HANDLE_VALUE) { + MessageBox(NULL, L"트레일 오브젝트 저장 실패", L"System Message", MB_OK); + return E_FAIL; + } + + m_strPath = strPerfectFilePath; + + DWORD dwByte(0); + + if (!WriteFile(hFile, &m_eEffectType, sizeof(EFFECT_TYPE), &dwByte, nullptr)) { + return E_FAIL; + } + + + + size_t iComponentLength = m_strTrailDiffuseName.length(); + const _char* pFileComponentPath = m_strTrailDiffuseName.c_str(); + + if (!WriteFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) { + return E_FAIL; + } + + if (iComponentLength != 0) + { + if (!WriteFile(hFile, pFileComponentPath, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) { + return E_FAIL; + } + } + + iComponentLength = m_strTrailNoiseName.length(); + pFileComponentPath = m_strTrailNoiseName.c_str(); + + if (!WriteFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) { + return E_FAIL; + } + + if (iComponentLength != 0) + { + if (!WriteFile(hFile, pFileComponentPath, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) { + return E_FAIL; + } + } + + + iComponentLength = m_strTrailMaskingName.length(); + pFileComponentPath = m_strTrailMaskingName.c_str(); + + if (!WriteFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) { + return E_FAIL; + } + + if (iComponentLength != 0) + { + if (!WriteFile(hFile, pFileComponentPath, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) { + return E_FAIL; + } + } + + m_pTrailCom->Save_Trail(hFile); + + CloseHandle(hFile); + + MessageBox(NULL, L"트레일 저장 성공", L"System Message", MB_OK); + return S_OK; +} + +#endif + +HRESULT CTrailObject::Load_Trail(const _char* pPath, LEVEL eLevel) +{ + SAFE_RELEASE(m_pDiffuse_TextureCom); + SAFE_RELEASE(m_pMasking_TextureCom); + SAFE_RELEASE(m_pNoise_TextureCom); + + _string strPerfectFilePath = pPath; + + strPerfectFilePath += ".bin"; + + DWORD dwByte(0); + + HANDLE hFile = CreateFileW( + CMyTools::ToWstring(strPerfectFilePath).c_str(), // 파일 이름 + GENERIC_READ, // 읽기 모드 + FILE_SHARE_READ, // 다른 프로세스도 읽기 가능 + NULL, + OPEN_EXISTING, // 기존 파일 열기 + FILE_ATTRIBUTE_NORMAL, + NULL + ); + + m_strPath = strPerfectFilePath; + + if (hFile == INVALID_HANDLE_VALUE) { + MessageBox(NULL, L"오브젝트 읽기 실패", L"System Message", MB_OK); + return E_FAIL; + } + + + if (!ReadFile(hFile, &m_eEffectType, sizeof(EFFECT_TYPE), &dwByte, nullptr)) { + return E_FAIL; + } + + size_t iComponentLength = {}; + + if (!ReadFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) { + return E_FAIL; + } + + if (iComponentLength != 0) + { + _char szName[MAX_PATH] = {}; + + if (!ReadFile(hFile, &szName, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) { + return E_FAIL; + } + + m_strTrailDiffuseName = szName; + + m_isDiffuse = true; + + if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(eLevel), CMyTools::ToWstring(m_strTrailDiffuseName), + reinterpret_cast(&m_pDiffuse_TextureCom)))) + return E_FAIL; + + + } + + if (!ReadFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) { + return E_FAIL; + } + + if (iComponentLength != 0) + { + _char szName[MAX_PATH] = {}; + + if (!ReadFile(hFile, &szName, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) { + return E_FAIL; + } + + m_strTrailNoiseName = szName; + + m_isNoise = true; + + if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(eLevel), CMyTools::ToWstring(m_strTrailNoiseName), + reinterpret_cast(&m_pNoise_TextureCom)))) + return E_FAIL; + + } + + if (!ReadFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) { + return E_FAIL; + } + + if (iComponentLength != 0) + { + _char szName[MAX_PATH] = {}; + + if (!ReadFile(hFile, &szName, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) { + return E_FAIL; + } + + m_strTrailMaskingName = szName; + + m_isMask = true; + + if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(eLevel), CMyTools::ToWstring(m_strTrailMaskingName), + reinterpret_cast(&m_pMasking_TextureCom)))) + return E_FAIL; + } + + m_pTrailCom->Load_Trail(hFile); + + CloseHandle(hFile); + + + MessageBox(NULL, L"트레일 로드 성공", L"System Message", MB_OK); + + return S_OK; +} + +HRESULT CTrailObject::Ready_Components(void* pArg) +{ + + if (FAILED(__super::Ready_Components(nullptr))) { + return E_FAIL; + } + + if (FAILED(Add_Asset_Component(g_iStaticLevel, FX_POSTEX, (CComponent**)&m_pShaderCom, nullptr))) + { + return E_FAIL; + } + + CTrail::TRAIL_DESC pTrailDesc; + + pTrailDesc.vHigh = _float3(0.f, 1.f, 0.f); + pTrailDesc.vLow = _float3(0.f, -1.f, 0.f); + + if (FAILED(Add_Component(ENUM_CLASS(LEVEL::EFFECT), &m_pTrailCom, &pTrailDesc))) { + return E_FAIL; + } + + return S_OK; +} + +HRESULT CTrailObject::Render() +{ + if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_POSTEX::TRAIL)))) + return E_FAIL; + + if (FAILED(Bind_ShaderResources())) + return E_FAIL; + + if (FAILED(m_pTrailCom->Render())) + return E_FAIL; + + return S_OK; +} + + + + +CTrailObject* CTrailObject::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) +{ + CTrailObject* pInstance = new CTrailObject(pDevice, pContext); + + if (FAILED(pInstance->Initialize_Prototype())) + { + MSG_BOX("Failed to Created : CTrailObject"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +CGameObject* CTrailObject::Clone(void* pArg, CGameObject* pOwner) +{ + CTrailObject* pInstance = new CTrailObject(*this); + pInstance->m_pOwner = pOwner; + if (FAILED(pInstance->Initialize(pArg))) + { + MSG_BOX("Failed to Cloned : CTrailObject"); + SAFE_RELEASE(pInstance); + } + + return pInstance; +} + +void CTrailObject::Free() +{ + __super::Free(); + + SAFE_RELEASE(m_pDiffuse_TextureCom); + SAFE_RELEASE(m_pMasking_TextureCom); + SAFE_RELEASE(m_pNoise_TextureCom); + SAFE_RELEASE(m_pShaderCom); + SAFE_RELEASE(m_pTrailCom); +} + +void CTrailObject::Describe_Entity() +{ + + if (GUI::TreeNode("TRAIL")) + { + m_pTrailCom->Describe_Entity(); + + GUI::Checkbox("Diffuse", &m_isDiffuse); + GUI::Checkbox("Masking", &m_isMask); + GUI::Checkbox("Noise", &m_isNoise); + + if (m_isDiffuse == true) + { + if (GUI::TreeNode("TRAIL DIFFUSE")) + { + _string strName = m_pGameInstance->Asset_Description(ENUM_CLASS(LEVEL::EFFECT), "DIFFUSE_TEXTURE", (CComponent**)&m_pDiffuse_TextureCom, nullptr, this); + + if (strName != "") { + m_strTrailDiffuseName = strName; + } + + GUI::TreePop(); + } + } + + if (m_isMask == true) + { + if (GUI::TreeNode("TRAIL MASK")) + { + _string strName = m_pGameInstance->Asset_Description(ENUM_CLASS(LEVEL::EFFECT), "MASK_TEXTURE", (CComponent**)&m_pMasking_TextureCom, nullptr, this); + + if (strName != "") { + m_strTrailMaskingName = strName; + } + + GUI::TreePop(); + } + } + + if (m_isNoise == true) + { + if (GUI::TreeNode("TRAIL NOISE")) + { + _string strName = m_pGameInstance->Asset_Description(ENUM_CLASS(LEVEL::EFFECT), "NOISE_TEXTURE", (CComponent**)&m_pNoise_TextureCom, nullptr, this); + + if (strName != "") { + m_strTrailNoiseName = strName; + } + + GUI::TreePop(); + } + } + + GUI::TreePop(); + } + + GUI::Separator(); + GUI::Spacing(); + +} + +HRESULT CTrailObject::Bind_ShaderResources() +{ + + if (FAILED(m_pTrailCom->Bind_Resources())) + return E_FAIL; + + 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_isDiffuse", &m_isDiffuse, sizeof(_bool)))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Bind_RawValue("g_isMask", &m_isMask, sizeof(_bool)))) { + return E_FAIL; + } + + if (FAILED(m_pShaderCom->Bind_RawValue("g_isNoise", &m_isNoise, sizeof(_bool)))) { + return E_FAIL; + } + + if (m_pDiffuse_TextureCom != nullptr) + { + if (FAILED(m_pDiffuse_TextureCom->Bind_ShaderResource(m_pShaderCom, "g_DiffuseTexture", 0))) { + return E_FAIL; + } + } + + if (m_pNoise_TextureCom != nullptr) + { + if (FAILED(m_pNoise_TextureCom->Bind_ShaderResource(m_pShaderCom, "g_NoiseTexture", 0))) { + return E_FAIL; + } + } + + if (m_pMasking_TextureCom != nullptr) + { + if (FAILED(m_pMasking_TextureCom->Bind_ShaderResource(m_pShaderCom, "g_MaskingTexture", 0))) { + return E_FAIL; + } + } + + return S_OK; +} 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/EditEffect.h b/Jusin154_Team3D/Editor/Public/EditEffect.h index be9ec7891..af347487a 100644 --- a/Jusin154_Team3D/Editor/Public/EditEffect.h +++ b/Jusin154_Team3D/Editor/Public/EditEffect.h @@ -6,6 +6,7 @@ NS_BEGIN(Engine) class CModel; class CShader; + NS_END NS_BEGIN(Editor) @@ -25,6 +26,7 @@ class CEditEffect final : public CEffectObject public: void Reference_Mat_For_EditEffect(); HRESULT Save_Effect(const _char* pPath); + HRESULT Save_Path(HANDLE hFile); private: virtual HRESULT Initialize_Prototype() override; virtual HRESULT Initialize(void* pArg) override; @@ -32,6 +34,7 @@ class CEditEffect final : public CEffectObject private: _int m_iSelectTextureNum = {}; + public: static CEditEffect* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; diff --git a/Jusin154_Team3D/Editor/Public/Editor_Define.h b/Jusin154_Team3D/Editor/Public/Editor_Define.h index 337f65f8b..f4b5f2335 100644 --- a/Jusin154_Team3D/Editor/Public/Editor_Define.h +++ b/Jusin154_Team3D/Editor/Public/Editor_Define.h @@ -13,18 +13,20 @@ 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 }; enum class SHADER_PASS_INSTANCE_MODEL { DEFAULT, NON_NOMALMAP, BLUR, END }; enum class SHADER_PASS_UIEDITOR { DEFAULT, ALPHABLEND, CLAMP, CURSOR, LODING, HOLD_ROTATION, MISSION, QUESTYPE, UVMULT, NINECLICE, ROTATION, SLOT, END }; + + enum class EFFECT_TYPE { EFFECT , TRAIL , END}; } using namespace Editor; diff --git a/Jusin154_Team3D/Editor/Public/Editor_Macro.h b/Jusin154_Team3D/Editor/Public/Editor_Macro.h index b6589b9d8..fc6d3bf5e 100644 --- a/Jusin154_Team3D/Editor/Public/Editor_Macro.h +++ b/Jusin154_Team3D/Editor/Public/Editor_Macro.h @@ -15,10 +15,10 @@ 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") +#define FX_UIINSTANCE TEXT("FX_UIINSTANCE") #pragma endregion @@ -63,4 +63,4 @@ namespace Editor { #pragma endregion -} \ No newline at end of file +} diff --git a/Jusin154_Team3D/Editor/Public/EffectObject.h b/Jusin154_Team3D/Editor/Public/EffectObject.h index 8ec16cb71..e25614983 100644 --- a/Jusin154_Team3D/Editor/Public/EffectObject.h +++ b/Jusin154_Team3D/Editor/Public/EffectObject.h @@ -8,6 +8,7 @@ class CInstance_Model; class CShader; class CTexture; class CLight; +class CTrail; NS_END NS_BEGIN(Editor) @@ -62,6 +63,8 @@ class CEffectObject abstract : public CPartObject _bool isReverseDissolve = {}; + EFFECT_TYPE eEffectType = { EFFECT_TYPE::EFFECT }; + }EFFECT_INFO; typedef struct tagPreEffectInfo @@ -109,6 +112,10 @@ class CEffectObject abstract : public CPartObject LIGHT_DESC LightDesc = {}; RENDER eRenderOrder = { RENDER::EFFECT }; + _bool isReverseDissolve = {}; + + + }PRE_EFFECT_INFO; protected: @@ -150,6 +157,7 @@ class CEffectObject abstract : public CPartObject CInstance_Model* m_pInstance_ModelCom = { nullptr }; + protected: EFFECT_INFO m_EffectInfo = {}; _string m_strDiffuseName = {}; @@ -160,6 +168,9 @@ class CEffectObject abstract : public CPartObject _string m_strEmissiveName = {}; _string m_strDistortionName = {}; + _string m_strPath = {}; + _string m_strName = {}; + public: virtual void Free() override; }; diff --git a/Jusin154_Team3D/Editor/Public/Effect_Container.h b/Jusin154_Team3D/Editor/Public/Effect_Container.h new file mode 100644 index 000000000..f875f2383 --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/Effect_Container.h @@ -0,0 +1,54 @@ +#pragma once + +#include "Editor_Define.h" +#include "ContainerObject.h" + +NS_BEGIN(Engine) +NS_END + +NS_BEGIN(Editor) + +class CEffect_Container abstract : public CContainerObject +{ +protected: + CEffect_Container(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CEffect_Container(const CEffect_Container& rhs); + virtual ~CEffect_Container() = default; + +public: + virtual void Priority_Update(_float fTimeDelta) override; + virtual void Update(_float fTimeDelta) override; + virtual void Late_Update(_float fTimeDelta) override; + +public: +#ifdef _DEBUG + HRESULT Save_Package(const _char* pPath); +#endif + HRESULT Load_Package(const _char* pPath); +protected: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual HRESULT Ready_Components(void* pArg) override; + HRESULT Ready_Child(); + HRESULT Bind_ShaderResources() override; + + void Update_Event(_float fTimeDelta); + +protected: + _wstring m_wstrEffectName = {}; + + _bool m_isLoop = {}; + + _float m_fAccTime = {}; + _float m_fPreAccTime = {}; + _float m_fDuration = {}; + _float m_fDelay = {}; + _bool m_isDelayed = { false }; + + map<_float, function> m_Events = {}; + +public: + virtual void Free() override; +}; + +NS_END diff --git a/Jusin154_Team3D/Editor/Public/Effect_Editor.h b/Jusin154_Team3D/Editor/Public/Effect_Editor.h index 4080cf896..9a99b8766 100644 --- a/Jusin154_Team3D/Editor/Public/Effect_Editor.h +++ b/Jusin154_Team3D/Editor/Public/Effect_Editor.h @@ -1,7 +1,7 @@ #pragma once #include "Editor_Define.h" -#include "ContainerObject.h" +#include "Effect_Container.h" NS_BEGIN(Engine) class CModel; @@ -10,7 +10,7 @@ NS_END NS_BEGIN(Editor) -class CEffect_Editor final : public CContainerObject +class CEffect_Editor final : public CEffect_Container { private: CEffect_Editor(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); @@ -41,11 +41,17 @@ class CEffect_Editor final : public CContainerObject _string m_strCurrentEffectName = {}; _uint m_iNumPart = { 0 }; - class CEditEffect* m_pEditEffect = { nullptr }; + class CEditEffect* m_pEditEffect = { nullptr }; // 현재 선택된 이펙트 객체 + class CTrailObject* m_pTrailObject = { nullptr }; map<_wstring, vector>> m_MatFiles = {}; // map<머테리얼 이름, vector<텍스쳐이름 , 텍스쳐 경로>> _char m_szBuffer[MAX_PATH] = { "../Bin/Resources/Data/Effect/"}; + _char m_szTrailBuffer[MAX_PATH] = { "../Bin/Resources/Data/Effect/Trail/" }; + _char m_szPackageBuffer[MAX_PATH] = { "../Bin/Resources/Data/Effect/Package/" }; + _string m_strSavePath = {}; + _string m_strTrailSavePath = {}; + _string m_strPackageSavePath = {}; public: static CEffect_Editor* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); 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..6f49a2ef5 100644 --- a/Jusin154_Team3D/Editor/Public/Loader.h +++ b/Jusin154_Team3D/Editor/Public/Loader.h @@ -29,12 +29,9 @@ class CLoader final : public CBase ID3D11DeviceContext* m_pContext = { nullptr }; LEVEL m_eNextLevelID = { LEVEL::END }; - HANDLE m_hThread = {}; - _wstring m_strMessage = {}; _bool m_isFinished = { false }; - CRITICAL_SECTION m_CriticalSection = {}; CGameInstance* m_pGameInstance = { nullptr }; @@ -48,6 +45,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/MissionBanner_Border.h b/Jusin154_Team3D/Editor/Public/MissionBanner_Border.h index b85bdb006..6d51ead7e 100644 --- a/Jusin154_Team3D/Editor/Public/MissionBanner_Border.h +++ b/Jusin154_Team3D/Editor/Public/MissionBanner_Border.h @@ -19,6 +19,10 @@ class CMissionBanner_Border final : public CElementObject virtual HRESULT Render() override; virtual _vector Get_WorldPostion() override; + virtual void SizeUpX(_float fSizeX) override; + virtual void Lerp_PosY(_float fSizeY) override; + void Size_LerpOn(_float LerpX, _float fTimeDelta); + void Size_LerpOff(_float fTimeDelta); private: virtual HRESULT Bind_ShaderResources() override; @@ -32,6 +36,9 @@ class CMissionBanner_Border final : public CElementObject CShader* m_pShaderCom = { nullptr }; CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; + CGameObject* m_pMission_Icon = { nullptr }; + + _float m_fLerpTime{}; public: static CMissionBanner_Border* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); diff --git a/Jusin154_Team3D/Editor/Public/Mission_Icon.h b/Jusin154_Team3D/Editor/Public/Mission_Icon.h index b7753e4d6..7cd6094ba 100644 --- a/Jusin154_Team3D/Editor/Public/Mission_Icon.h +++ b/Jusin154_Team3D/Editor/Public/Mission_Icon.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "Editor_Define.h" #include "ElementObject.h" @@ -19,7 +19,9 @@ class CMission_Icon final : public CElementObject virtual HRESULT Render() override; virtual _vector Get_WorldPostion() override; - + virtual void MoveX(_float fX)override; + virtual void MoveY(_float fY)override; + virtual void Lerp_PosY(_float fLerpY) override; private: virtual HRESULT Bind_ShaderResources() override; virtual HRESULT Ready_Components(void* pArg) override; @@ -30,8 +32,8 @@ class CMission_Icon final : public CElementObject void QuestType(QUESTYPE eType); private: - CTexture* m_pDiffuse_TextureCom = { nullptr }; - CShader* m_pShaderCom = { nullptr }; + CTexture* m_pDiffuse_TextureCom = { nullptr }; + CShader* m_pShaderCom = { nullptr }; CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; QUESTYPE m_eQuestType = QUESTYPE::END; _uint m_iType{}; @@ -43,4 +45,4 @@ class CMission_Icon final : public CElementObject void Describe_Entity() override; }; -NS_END \ No newline at end of file +NS_END diff --git a/Jusin154_Team3D/Editor/Public/Mission_Panel.h b/Jusin154_Team3D/Editor/Public/Mission_Panel.h index 0ec0bb886..aaf1e0291 100644 --- a/Jusin154_Team3D/Editor/Public/Mission_Panel.h +++ b/Jusin154_Team3D/Editor/Public/Mission_Panel.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "Editor_Define.h" #include "PanelObject.h" @@ -36,7 +36,6 @@ class CMission_Panel final : public CPanelObject CGameObject* m_pMissionBanner_Key = { nullptr }; CGameObject* m_pMission_KeyHold = { nullptr }; CGameObject* m_pMission_Key = { nullptr }; - CGameObject* m_pMission_Icon = { nullptr }; CGameObject* m_pActive_Icon = { nullptr }; public: @@ -46,4 +45,4 @@ class CMission_Panel final : public CPanelObject void Describe_Entity() override; }; -NS_END \ No newline at end of file +NS_END diff --git a/Jusin154_Team3D/Editor/Public/NomalJap.h b/Jusin154_Team3D/Editor/Public/NomalJap.h new file mode 100644 index 000000000..8873292dd --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/NomalJap.h @@ -0,0 +1,41 @@ +#pragma once + +#include "Editor_Define.h" +#include "Effect_Container.h" + +NS_BEGIN(Engine) +NS_END + +NS_BEGIN(Editor) + +class CNomalJap final : public CEffect_Container +{ +private: + CNomalJap(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CNomalJap(const CNomalJap& rhs); + virtual ~CNomalJap() = default; + +public: + virtual void Priority_Update(_float fTimeDelta) override; + virtual void Update(_float fTimeDelta) override; + virtual void Late_Update(_float fTimeDelta) override; + + +private: + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual HRESULT Ready_Components(void* pArg) override; + HRESULT Ready_Child(); + HRESULT Bind_ShaderResources() override; + +private: + _wstring m_wstrEffectName = {}; + +public: + static CNomalJap* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual void Free() override; + CGameObject* Clone(void* pArg, CGameObject* pOwner) override; + void Describe_Entity() override; +}; + +NS_END diff --git a/Jusin154_Team3D/Editor/Public/Spell_Slot.h b/Jusin154_Team3D/Editor/Public/Spell_Slot.h index 92f3d582b..8cc18fdc0 100644 --- a/Jusin154_Team3D/Editor/Public/Spell_Slot.h +++ b/Jusin154_Team3D/Editor/Public/Spell_Slot.h @@ -29,7 +29,7 @@ class CSpell_Slot final : public CElementObject private: CTexture* m_pDiffuse_TextureCom = { nullptr }; CShader* m_pShaderCom = { nullptr }; - CVIBuffer_Rect* m_pVIBufferCom = { nullptr }; + CVIBuffer_UI_Instance* m_pVIBufferCom = { nullptr }; public: static CSpell_Slot* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); diff --git a/Jusin154_Team3D/Editor/Public/TrailObject.h b/Jusin154_Team3D/Editor/Public/TrailObject.h new file mode 100644 index 000000000..c332731be --- /dev/null +++ b/Jusin154_Team3D/Editor/Public/TrailObject.h @@ -0,0 +1,67 @@ +#pragma once + +#include "Editor_Define.h" +#include "EffectObject.h" + +NS_BEGIN(Engine) +class CShader; +class CTexture; +class CTrail; +NS_END + +NS_BEGIN(Editor) + +class CTrailObject final : public CPartObject +{ +private: + CTrailObject(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + CTrailObject(const CTrailObject& rhs); + virtual ~CTrailObject() = default; + +public: + virtual void Priority_Update(_float fTimeDelta) override; + virtual void Update(_float fTimeDelta) override; + virtual void Late_Update(_float fTimeDelta) override; + +public: +#ifdef _DEBUG + HRESULT Save_Path(HANDLE hFile); + HRESULT Save_Trail(const _char* pPath); +#endif + HRESULT Load_Trail(const _char* pPath, LEVEL eLevel); +private: + HRESULT Bind_ShaderResources() override; + virtual HRESULT Initialize_Prototype() override; + virtual HRESULT Initialize(void* pArg) override; + virtual HRESULT Ready_Components(void* pArg) override; + virtual HRESULT Render() override; + +public: + static CTrailObject* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); + virtual CGameObject* Clone(void* pArg, class CGameObject* pOwner) override; + virtual void Free() override; + void Describe_Entity() override; + +private: + CTexture* m_pDiffuse_TextureCom = { nullptr }; + CTexture* m_pNoise_TextureCom = { nullptr }; + CTexture* m_pMasking_TextureCom = { nullptr }; + + CShader* m_pShaderCom = { nullptr }; + CTrail* m_pTrailCom = { nullptr }; + + _string m_strTrailDiffuseName = {}; + _string m_strTrailNoiseName = {}; + _string m_strTrailMaskingName = {}; + + _string m_strPath = {}; + _string m_strName = {}; + + _bool m_isDiffuse = {}; + _bool m_isNoise = {}; + _bool m_isMask = {}; + + EFFECT_TYPE m_eEffectType = { EFFECT_TYPE::TRAIL }; +}; + +NS_END 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 3ddc2f1e7..3ce9b7364 100644 --- a/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Defines.hlsli +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Defines.hlsli @@ -1,258 +1,12 @@ +#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; - -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; +#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" - SrcBlend[2] = one; - DestBlend[2] = one; - BlendOp[2] = Add; -}; +#endif // ENGINE_SHADER_DEFINES_HLSLI -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; -} 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..f16a08d3c --- /dev/null +++ b/Jusin154_Team3D/Engine/Bin/Resources/ShaderFiles/Engine_Shader_Functions.hlsli @@ -0,0 +1,185 @@ +#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 vToView, float3 vToLight, + 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(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; + + float D = NDF_ggxtr(vNormal, vHalfVector, fAlpha); + float G = Geometry_Smith(vNormal, vToView, vToLight, k); + float3 F = Fresnel_Schlick(saturate(dot(vHalfVector, vToView)), vFO); + + float3 vNumerator = D * G * F; + float fDenominator = max(4.f * NdotL * NdotV, 1e-7); + float3 specularBRDF = vNumerator / fDenominator; + + 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..1a8c94894 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,62 @@ 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 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb; + float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1.f); + float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv); - Out.vShade = g_vLightDiffuse * saturate(max(dot(normalize(g_vLightDir) * -1.f, vNormal), 0.f) + (g_vLightAmbient * g_vMtrlAmbient)); + float fViewZ = vDepth.y * g_fFar; - vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord); + 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); + } - float fViewZ = vDepthDesc.y * g_fFar; - - vector vPosition; + float3 vF0 = float3(0.04f, 0.04f, 0.04f); + float fMetallic = 0.f; + float fRoughness = 0.5f; + float fOcclusion = 1.f; + float fAttenuation = 1.f; -{ // 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 vToView = normalize(g_vCamPosition.xyz - vWorldPosition.xyz); // 픽셀에서 카메라로 + float3 vToLight = 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; - 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 + { + fMetallic = 0.f; + + float3 vSRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb; + vF0 = vSRO.rrr; + fRoughness = vSRO.g; + fOcclusion = vSRO.b; + } - Out.vSpecular = (g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(normalize(vLook) * -1.f, normalize(vReflect)), 0.f), 50.f); + float fDiffuseAOStrength = lerp(0.3f, 1.f, fOcclusion); + + PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vToView, vToLight, 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 +162,62 @@ 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 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb; + float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1.f); + float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv); - vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord); - float fViewZ = vDepthDesc.y * g_fFar; + float fViewZ = vDepth.y * g_fFar; - 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); - - 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 vF0 = float3(0.04f, 0.04f, 0.04f); + float fMetallic = 0.f; + float fRoughness = 0.5f; + float fOcclusion = 1.f; + float fAttenuation = 1.f; - vector vLook = vPosition - g_vCamPosition; - vector vReflect = reflect(vLightDir, vNormal); + float3 vToView = normalize(g_vCamPosition.xyz - vWorldPosition.xyz); // 픽셀에서 카메라로 + float3 vToLight = normalize(g_vLightPos.xyz - vWorldPosition.xyz); // 픽셀에서 라이트로 - Out.vSpecular = fAttenuation * ((g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(normalize(vLook) * -1.f, normalize(vReflect)), 0.f), 50.f)); + { + float fDistance = length(vToLight); + fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange); + if (fAttenuation <= 0.f) { discard; } + } + + 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 + { + fMetallic = 0.f; + float3 vSRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb; + vF0 = vSRO.rrr; + fRoughness = vSRO.g; + fOcclusion = vSRO.b; + } + + PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vToView, vToLight, 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 +226,67 @@ 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 vAlbedo = g_DiffuseTexture.Sample(DefaultSampler, uv).rgb; + float3 vNormal = normalize(g_NormalTexture.Sample(DefaultSampler, uv).xyz * 2.f - 1.f); + float4 vDepth = g_DepthTexture.Sample(DefaultSampler, uv); - vector vDepthDesc = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord); - float fViewZ = vDepthDesc.y * g_fFar; + float fViewZ = vDepth.y * g_fFar; - 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); - - 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); - if (fCosAngle < g_fSpotOuterAngle) + + float3 vF0 = float3(0.04f, 0.04f, 0.04f); + float fMetallic = 0.f; + float fRoughness = 0.5f; + float fOcclusion = 1.f; + float fAttenuation = 1.f; + + float3 vToView = normalize(g_vCamPosition.xyz - vWorldPosition.xyz); // 픽셀에서 카메라로 + float3 vToLight = normalize(g_vLightPos.xyz - vWorldPosition.xyz); // 픽셀에서 라이트로 + { - discard; + float fDistance = length(vToLight); + fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange); + if (fAttenuation <= 0.f) { discard; } } - float fSpotAttenenuation = saturate((fCosAngle - g_fSpotInnerAngle) / (g_fSpotInnerAngle - g_fSpotOuterAngle)); + float fCosAngle = dot(vToView, g_vLightDir.xyz); + if (fCosAngle < g_fSpotOuterAngle) { discard; } + + 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))); + 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 + { + fMetallic = 0.f; + float3 vSRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb; + vF0 = vSRO.rrr; + fRoughness = vSRO.g; + fOcclusion = vSRO.b; + } - vector vLook = vPosition - g_vCamPosition; - vector vReflect = reflect(vLightDir, vNormal); + PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vToView, vToLight, vAlbedo, fMetallic, fRoughness, g_vLightDiffuse.rgb, fAttenuation, vF0); - Out.vSpecular = fAttenuation * ((g_vLightSpecular * g_vMtrlSpecular) * pow(max(dot(normalize(vLook) * -1.f, normalize(vReflect)), 0.f), 50.f)); + Out.vShade = float4(PBR_Out.vShade, 1.f); + Out.vSpecular = float4(PBR_Out.vSpecular, 1.f); return Out; } @@ -271,6 +336,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 +443,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 +451,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 +461,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 +471,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 +481,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 +491,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 +501,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 8a6995cd4..04205cc2b 100644 --- a/Jusin154_Team3D/Engine/Default/Engine.vcxproj +++ b/Jusin154_Team3D/Engine/Default/Engine.vcxproj @@ -29,7 +29,7 @@ DynamicLibrary true - v145 + v143 Unicode @@ -299,6 +299,7 @@ call Update_Lib.bat + @@ -543,6 +544,7 @@ call Update_Lib.bat + @@ -561,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 f5daf229f..99f6ac3c8 100644 --- a/Jusin154_Team3D/Engine/Default/Engine.vcxproj.filters +++ b/Jusin154_Team3D/Engine/Default/Engine.vcxproj.filters @@ -277,6 +277,12 @@ {dae29f0c-1727-4423-a3ca-9ef27460520b} + + {1e10fa90-da5b-4285-a7a3-c4211b4cccbb} + + + {701cf231-2892-4d72-9615-dbe9285c28f4} + {d9f03f43-e9d1-4a50-b465-e1000462bd3e} @@ -531,6 +537,9 @@ 02.Element\02.Component\02.VIBuffer\Terrain\QuadTree + + 00.System\02.ThreadHolder + @@ -1148,6 +1157,9 @@ 02.Element\02.Component\02.VIBuffer\Terrain\QuadTree + + 00.System\02.ThreadHolder + @@ -1195,9 +1207,6 @@ 99.Define\99.THIRDPARTY\FMOD - - 99.Define\01.SHADER - @@ -1215,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/ComputeShader.cpp b/Jusin154_Team3D/Engine/Private/ComputeShader.cpp index e1660bda6..ddbd98b00 100644 --- a/Jusin154_Team3D/Engine/Private/ComputeShader.cpp +++ b/Jusin154_Team3D/Engine/Private/ComputeShader.cpp @@ -84,6 +84,8 @@ vector CComputeShader::Dispatch(_uint iSRVIndex, _uint if (SUCCEEDED(m_pContext->Map(m_pOutputStagingBuffer[i], 0, D3D11_MAP_READ, 0, &StagingSubResource))) { + + StagingSubResources.push_back(StagingSubResource); m_pContext->Unmap(m_pOutputStagingBuffer[i], 0); @@ -320,7 +322,7 @@ CComputeShader* CComputeShader::Create(ID3D11Device* pDevice, ID3D11DeviceContex { CComputeShader* pInstance = new CComputeShader(pDevice, pContext); - if (FAILED(pInstance->Initialize(pShaderFilePath, pStartFunctionName, iNumElement, iNumInputBuffer, iNumOutputBuffer, iOutputStructStride, iInputStructStride))) + if (FAILED(pInstance->Initialize(pShaderFilePath, pStartFunctionName, iNumElement, iNumInputBuffer, iNumOutputBuffer, iInputStructStride, iOutputStructStride))) { MSG_BOX("Failed to Created : CComputeShader Prototype"); SAFE_RELEASE(pInstance); diff --git a/Jusin154_Team3D/Engine/Private/ElementObject.cpp b/Jusin154_Team3D/Engine/Private/ElementObject.cpp index ccb3036bd..bab8ba454 100644 --- a/Jusin154_Team3D/Engine/Private/ElementObject.cpp +++ b/Jusin154_Team3D/Engine/Private/ElementObject.cpp @@ -43,7 +43,6 @@ void CElementObject::Update(_float fTimeDelta) m_fSortZ, 1.f)); m_fCurrent_Position = XMVectorSet(m_fX, m_fY, 0.f, 1.f); - m_vNine_Slice = _float4(m_fLeft, m_fRight, m_fTop, m_fBottom); m_vLerp_Position = XMVectorSet(m_fLerpX, m_fLerpY, 0.f, 1.f); } @@ -85,45 +84,45 @@ _bool CElementObject::Chack_Visible() void CElementObject::Nine_Slice_Left(_float X) { - m_fLeft = X; + m_vNine_Slice.x = X; } void CElementObject::Nine_Slice_Right(_float Y) { - m_fRight = Y; + m_vNine_Slice.y = Y; } void CElementObject::Nine_Slice_Top(_float Z) { - m_fTop = Z; + m_vNine_Slice.z = Z; } void CElementObject::Nine_Slice_Bottom(_float W) { - m_fBottom = W; + m_vNine_Slice.w = W; } _float CElementObject::Get_Nine_Slice_Left() { - return m_fLeft; + return m_vNine_Slice.x; } _float CElementObject::Get_Nine_Slice_Right() { - return m_fRight; + return m_vNine_Slice.y; } _float CElementObject::Get_Nine_Slice_Top() { - return m_fTop; + return m_vNine_Slice.z; } _float CElementObject::Get_Nine_Slice_Bottom() { - return m_fBottom; + return m_vNine_Slice.w; } -void CElementObject::Start_Lerp(_float fTimeDelta, _bool Alpha) +void CElementObject::Start_Lerp(_float fTimeDelta) { _vector Pos = m_fCurrent_Position; @@ -150,7 +149,7 @@ void CElementObject::Start_Lerp(_float fTimeDelta, _bool Alpha) } } -void CElementObject::Reset_Pos(_float fTimeDelta, _bool Alpha) +void CElementObject::Reset_Pos(_float fTimeDelta) { _vector Pos = m_fCurrent_Position; @@ -166,7 +165,7 @@ void CElementObject::Reset_Pos(_float fTimeDelta, _bool Alpha) { m_fX = m_fOrigin_Position.x; m_fY = m_fOrigin_Position.y; - m_bLerpOn = false; + m_bLerpOff = false; } else @@ -177,6 +176,14 @@ void CElementObject::Reset_Pos(_float fTimeDelta, _bool Alpha) } } +void CElementObject::Start_Size_Lerp(_float fTimeDelta) +{ +} + +void CElementObject::Reset_Size_Lerp(_float fTimeDelta) +{ +} + _vector CElementObject::Get_Lerp_Pos() { return m_vLerp_Position; diff --git a/Jusin154_Team3D/Engine/Private/GameInstance.cpp b/Jusin154_Team3D/Engine/Private/GameInstance.cpp index b37b1ba2f..6fe14a25c 100644 --- a/Jusin154_Team3D/Engine/Private/GameInstance.cpp +++ b/Jusin154_Team3D/Engine/Private/GameInstance.cpp @@ -16,6 +16,7 @@ #include "Collider_Manager.h" #include "Picking.h" #include "PhysX_Manager.h" +#include "ThreadHolder.h" IMPLEMENT_SINGLETON(CGameInstance) @@ -47,6 +48,10 @@ HRESULT CGameInstance::Initialize_Engine(const ENGINE_DESC& EngineDesc, ID3D11De } } } + m_pThreadHolder = CThreadHolder::Create(4); + if (nullptr == m_pThreadHolder) { + return E_FAIL; + } m_pObject_Manager = CGameObject_Manager::Create(EngineDesc.iNumLevels); if (nullptr == m_pObject_Manager) { return E_FAIL; @@ -764,6 +769,8 @@ _bool CGameInstance::Toggle_MouseCenter() void CGameInstance::Release_Engine() { + SAFE_RELEASE(m_pThreadHolder); + DestroyInstance(); SAFE_RELEASE(m_pPicking); 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..5f24755c0 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_SPECULAR / (_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/PanelObject.cpp b/Jusin154_Team3D/Engine/Private/PanelObject.cpp index bc10f900e..73c36b4f2 100644 --- a/Jusin154_Team3D/Engine/Private/PanelObject.cpp +++ b/Jusin154_Team3D/Engine/Private/PanelObject.cpp @@ -138,17 +138,17 @@ void CPanelObject::ElementAllVisible(_bool bVisible) } } -void CPanelObject::Add_Function(wstring Name, functionEvent) +void CPanelObject::Add_Function(wstring Name, functionEvent) { m_ElementFunction_map.emplace(Name, Event); } -void CPanelObject::Function_Callback(wstring Name) +void CPanelObject::Function_Callback(wstring Name, void* pArg) { auto range = m_ElementFunction_map.equal_range(Name); for (auto it = range.first; it != range.second; ++it) { - it->second(); + it->second(pArg); } } 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/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/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..974777947 --- /dev/null +++ b/Jusin154_Team3D/Engine/Private/ThreadHolder.cpp @@ -0,0 +1,73 @@ +#include "pch.h" + +#include "ThreadHolder.h" + +CThreadHolder::CThreadHolder() +{ +} + +CThreadHolder::~CThreadHolder() +{ +} + +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; +} + +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; + } + + job = move(m_JobQueue.front()); + m_JobQueue.pop(); + } lock.unlock(); + + job(); + } +} + +CThreadHolder* CThreadHolder::Create(_uint iSize) +{ + CThreadHolder* pInstance = new CThreadHolder(); + if (FAILED(pInstance->Initialize(iSize))) { + SAFE_RELEASE(pInstance); + } + return pInstance; +} + +void CThreadHolder::Free() +{ + __super::Free(); + + { + unique_lock lock(m_mtxJobQueue); + m_bStop_All = true; + } + + m_cvJobQueue.notify_all(); + + for (auto& thread : m_Workers) { + thread.join(); + } +} + +void CThreadHolder::Describe_Entity() +{ +} diff --git a/Jusin154_Team3D/Engine/Private/Trail.cpp b/Jusin154_Team3D/Engine/Private/Trail.cpp index 7a3078077..d0a4e3279 100644 --- a/Jusin154_Team3D/Engine/Private/Trail.cpp +++ b/Jusin154_Team3D/Engine/Private/Trail.cpp @@ -13,39 +13,40 @@ CTrail::CTrail(const CTrail& rhs) HRESULT CTrail::Initialize_Prototype() { + return S_OK; +} + +HRESULT CTrail::Initialize(void* pArg) +{ + TRAIL_DESC* pDesc = static_cast(pArg); + + if (pDesc == nullptr) + return E_FAIL; + + m_TrailDesc = *pDesc; + m_iNumVertexBuffers = 1; - m_iNumVertices = 4; + m_iNumVertices = 256; m_iVertexStride = sizeof(VTXPOSTEX); - m_iNumIndices = 6; + m_iNumIndices = (m_iNumVertices / 2 - 1) * 6; m_iIndexStride = 4; m_eIndexFormat = DXGI_FORMAT_R32_UINT; m_ePrimitive = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; + m_pVertices = new VTXPOSTEX[m_iNumVertices]; + #pragma region VTX_BUFFER D3D11_BUFFER_DESC VBDesc{}; VBDesc.ByteWidth = m_iVertexStride * m_iNumVertices; - VBDesc.Usage = D3D11_USAGE_DEFAULT; + VBDesc.Usage = D3D11_USAGE_DYNAMIC; VBDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; - VBDesc.CPUAccessFlags = 0; + VBDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE; VBDesc.MiscFlags = 0; VBDesc.StructureByteStride = m_iVertexStride; VTXPOSTEX* pVertices = new VTXPOSTEX[m_iNumVertices]{}; - m_pVertexPositions = new _float3[m_iNumIndices]{}; - - m_pVertexPositions[0] = pVertices[0].vPosition = _float3(-0.5f, 0.5f, 0.f); - pVertices[0].vTexcoord = _float2(0.0f, 0.0f); - - m_pVertexPositions[1] = pVertices[1].vPosition = _float3(0.5f, 0.5f, 0.f); - pVertices[1].vTexcoord = _float2(1.0f, 0.0f); - - m_pVertexPositions[2] = pVertices[2].vPosition = _float3(0.5f, -0.5f, 0.f); - pVertices[2].vTexcoord = _float2(1.0f, 1.0f); - - m_pVertexPositions[3] = pVertices[3].vPosition = _float3(-0.5f, -0.5f, 0.f); - pVertices[3].vTexcoord = _float2(0.0f, 1.0f); D3D11_SUBRESOURCE_DATA InitialVBDate{}; InitialVBDate.pSysMem = pVertices; @@ -58,9 +59,10 @@ HRESULT CTrail::Initialize_Prototype() #pragma endregion #pragma region IDX_BUFFER + D3D11_BUFFER_DESC IBDesc{}; IBDesc.ByteWidth = m_iIndexStride * m_iNumIndices; - IBDesc.Usage = D3D11_USAGE_DEFAULT; + IBDesc.Usage = D3D11_USAGE_IMMUTABLE; IBDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; IBDesc.CPUAccessFlags = 0; IBDesc.MiscFlags = 0; @@ -69,13 +71,27 @@ HRESULT CTrail::Initialize_Prototype() _uint* pIndices = new _uint[m_iNumIndices]{}; - pIndices[0] = 0; - pIndices[1] = 1; - pIndices[2] = 2; + _uint iIndex = { 0 }; - pIndices[3] = 0; - pIndices[4] = 2; - pIndices[5] = 3; + for (_uint i = 0; i < m_iNumVertices / 2 - 1; i++) + { + _uint iStartIndex = i * 2; + + _uint Indicies[4] = { + iStartIndex , + iStartIndex + 1, + iStartIndex + 2, + iStartIndex + 3 + }; + + pIndices[iIndex++] = Indicies[0]; + pIndices[iIndex++] = Indicies[1]; + pIndices[iIndex++] = Indicies[2]; + + pIndices[iIndex++] = Indicies[1]; + pIndices[iIndex++] = Indicies[3]; + pIndices[iIndex++] = Indicies[2]; + } D3D11_SUBRESOURCE_DATA InitialIBDate{}; InitialIBDate.pSysMem = pIndices; @@ -83,16 +99,116 @@ HRESULT CTrail::Initialize_Prototype() if (FAILED(m_pDevice->CreateBuffer(&IBDesc, &InitialIBDate, &m_pIB))) { return E_FAIL; } + Safe_Delete_Array(pIndices); #pragma endregion - - return S_OK; } -HRESULT CTrail::Initialize(void* pArg) +void CTrail::Trail_Update(_float fDeltaTime, _fmatrix WorldMatrix) { + + _vector vLow = XMVector3TransformCoord(XMLoadFloat3(&m_TrailDesc.vLow), WorldMatrix); + _vector vHigh = XMVector3TransformCoord(XMLoadFloat3(&m_TrailDesc.vHigh), WorldMatrix); + + + //한칸씩 밀기 + memmove(m_PreLow, m_PreLow + 1, sizeof(VTXPOSTEX)); + memmove(m_PreHigh, m_PreHigh + 1, sizeof(VTXPOSTEX)); + + m_PreLow[1] = vLow; + m_PreHigh[1] = vHigh; + + if (m_iNumCount < 4) + { + XMStoreFloat3(&m_pVertices[m_iNumCount++].vPosition, vLow); + XMStoreFloat3(&m_pVertices[m_iNumCount++].vPosition, vHigh); + + //카운트가 적으면 시도하지 않음 + return; + } + + //시작점 끝점 내점 두개를 이용하여 보간할 것임 + + for (size_t i = 0; i < 4; i++) + { + _float iRatio = (_float)i / 3; + _vector vLerpLow = XMVectorCatmullRom(XMLoadFloat3(&m_pVertices[m_iNumCount - 2].vPosition), m_PreLow[0], m_PreLow[1], m_PreLow[1] + (m_PreLow[1] - m_PreLow[0]), iRatio); // LoW + _vector vLerpHigh = XMVectorCatmullRom(XMLoadFloat3(&m_pVertices[m_iNumCount - 1].vPosition), m_PreHigh[0], m_PreHigh[1], m_PreHigh[1] + (m_PreHigh[1] - m_PreHigh[0]), iRatio); + + XMStoreFloat3(&m_pVertices[m_iNumCount++].vPosition, vLerpLow); + XMStoreFloat3(&m_pVertices[m_iNumCount++].vPosition, vLerpHigh); + + if (m_iNumCount >= m_iNumVertices) + { + memmove(m_pVertices, m_pVertices + 2, sizeof(VTXPOSTEX) * (m_iNumCount - 2)); + + m_iNumCount -= 2; + } + + } + + //XMStoreFloat3(&m_pVertices[0].vPosition, vLow); + //XMStoreFloat3(&m_pVertices[1].vPosition, vHigh); + + for (_uint i = 0; i < m_iNumCount; i += 2) + { + + _float u = ((_float)i / (m_iNumCount - 2)); + + if (m_iNumCount - 2 <= 0) + u = 0; + + m_pVertices[i].vTexcoord = _float2(u, 0); // Low + + m_pVertices[i + 1].vTexcoord = _float2(u, 1); // High + } + + + D3D11_MAPPED_SUBRESOURCE VBResource{}; + + if (SUCCEEDED(m_pContext->Map(m_pVB, 0, D3D11_MAP_WRITE_DISCARD, 0, &VBResource))) + { + + memcpy(VBResource.pData, m_pVertices, sizeof(VTXPOSTEX) * m_iNumVertices); + + m_pContext->Unmap(m_pVB, 0); + } + +} + +#ifdef _DEBUG +HRESULT CTrail::Save_Trail(HANDLE hFile) +{ + DWORD dwByte(0); + + if (!WriteFile(hFile, &m_TrailDesc, sizeof(TRAIL_DESC), &dwByte, nullptr)) { + return E_FAIL; + } + + return S_OK; +} +#endif + +HRESULT CTrail::Load_Trail(HANDLE hFile) +{ + DWORD dwByte(0); + + if (!ReadFile(hFile, &m_TrailDesc, sizeof(TRAIL_DESC), &dwByte, nullptr)) { + return E_FAIL; + } + + return S_OK; +} + +HRESULT CTrail::Render() +{ + if (m_iNumCount < 4) + return S_OK; + + m_pContext->DrawIndexed( ((m_iNumCount / 2) - 1) * 6, 0, 0); + return S_OK; } @@ -126,9 +242,13 @@ void CTrail::Free() { __super::Free(); - + Safe_Delete_Array(m_pVertices); } void CTrail::Describe_Entity() { + + GUI::InputFloat3("Low", (_float*)&m_TrailDesc.vLow); + GUI::InputFloat3("High", (_float*)&m_TrailDesc.vHigh); + } diff --git a/Jusin154_Team3D/Engine/Private/UIObject.cpp b/Jusin154_Team3D/Engine/Private/UIObject.cpp index 197fa9885..17554e268 100644 --- a/Jusin154_Team3D/Engine/Private/UIObject.cpp +++ b/Jusin154_Team3D/Engine/Private/UIObject.cpp @@ -83,13 +83,6 @@ HRESULT CUIObject::Initialize(void* pArg) m_bVisible = true; - m_fLeft = 0.f; - m_fRight = m_fSizeX; - m_fTop = 0.f; - m_fBottom = m_fSizeY; - - m_vNine_Slice = _float4(m_fLeft, m_fRight, m_fTop, m_fBottom); - return S_OK; } @@ -145,6 +138,16 @@ void CUIObject::SizeUpdate(_float fSizeX, _float fSizeY) m_fSizeY = fSizeY; } +void CUIObject::SizeUpX(_float fSizeX) +{ + m_fSizeX = fSizeX; +} + +void CUIObject::SizeUpY(_float fSizeY) +{ + m_fSizeY = fSizeY; +} + void CUIObject::SizeUpdate_float(_float3 fSizeXY) { m_fSizeX = fSizeXY.x; @@ -280,42 +283,42 @@ _float2 CUIObject::Get_UV() void CUIObject::Nine_Slice_Left(_float X) { - m_fLeft = -m_fSizeX * 0.5f + X; + m_vNine_Slice.x = X; } void CUIObject::Nine_Slice_Right(_float Y) { - m_fRight = m_fSizeX * 0.5f - Y; + m_vNine_Slice.y =Y; } void CUIObject::Nine_Slice_Top(_float Z) { - m_fTop = -m_fSizeY * 0.5f + Z; + m_vNine_Slice.z = Z; } void CUIObject::Nine_Slice_Bottom(_float W) { - m_fBottom = m_fSizeY * 0.5f - W; + m_vNine_Slice.w = W; } _float CUIObject::Get_Nine_Slice_Left() { - return m_fLeft; + return m_vNine_Slice.y; } _float CUIObject::Get_Nine_Slice_Right() { - return m_fRight; + return m_vNine_Slice.y; } _float CUIObject::Get_Nine_Slice_Top() { - return m_fTop; + return m_vNine_Slice.z; } _float CUIObject::Get_Nine_Slice_Bottom() { - return m_fBottom; + return m_vNine_Slice.w; } _float2 CUIObject::Get_Origin_Position() @@ -348,11 +351,19 @@ void CUIObject::Lerp_PosY(_float PosY) m_fLerpY = PosY; } -void CUIObject::Start_Lerp(_float fTimeDelta, _bool Alpha) +void CUIObject::Start_Lerp(_float fTimeDelta) { } -void CUIObject::Reset_Pos(_float fTimeDelta, _bool Alpha) +void CUIObject::Reset_Pos(_float fTimeDelta) +{ +} + +void CUIObject::Start_Size_Lerp(_float fTimeDelta) +{ +} + +void CUIObject::Reset_Size_Lerp(_float fTimeDelta) { } @@ -442,11 +453,11 @@ _float CUIObject::Get_CoolTime() return m_fCoolTime; } -void CUIObject::Add_Function(wstring Name, function Evnet) +void CUIObject::Add_Function(wstring Name, function Evnet) { } -void CUIObject::Function_Callback(wstring Name) +void CUIObject::Function_Callback(wstring Name, void* pArg) { } diff --git a/Jusin154_Team3D/Engine/Private/VIBuffer.cpp b/Jusin154_Team3D/Engine/Private/VIBuffer.cpp index 418461da2..6d5e5b61a 100644 --- a/Jusin154_Team3D/Engine/Private/VIBuffer.cpp +++ b/Jusin154_Team3D/Engine/Private/VIBuffer.cpp @@ -1,4 +1,4 @@ -#include "pch.h" +#include "pch.h" #include "VIBuffer.h" CVIBuffer::CVIBuffer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext) @@ -49,6 +49,7 @@ HRESULT CVIBuffer::Bind_Resources() HRESULT CVIBuffer::Render() { m_pContext->DrawIndexed(m_iNumIndices, 0, 0); + return S_OK; } diff --git a/Jusin154_Team3D/Engine/Private/VIBuffer_UI_Instance.cpp b/Jusin154_Team3D/Engine/Private/VIBuffer_UI_Instance.cpp index 6a1868346..43d7c688a 100644 --- a/Jusin154_Team3D/Engine/Private/VIBuffer_UI_Instance.cpp +++ b/Jusin154_Team3D/Engine/Private/VIBuffer_UI_Instance.cpp @@ -11,6 +11,8 @@ CVIBuffer_UI_Instance::CVIBuffer_UI_Instance(const CVIBuffer_UI_Instance& Protot : CVIBuffer_Instance{ Prototype } , m_pInstanceVertices{ Prototype.m_pInstanceVertices } , m_fSize{ Prototype.m_fSize } + , m_fPositionOffSetX{ Prototype.m_fPositionOffSetX } + , m_fPositionOffSetY{ Prototype.m_fPositionOffSetY } , m_fPosition{ Prototype.m_fPosition } { } @@ -118,10 +120,16 @@ HRESULT CVIBuffer_UI_Instance::Initialize_Prototype(const INSTANCE_DESC* pInstan m_fPosition = new _float2[m_iNumInstance]; ZeroMemory(m_fPosition, sizeof(_float2) * m_iNumInstance); + m_fPositionOffSetX = new _float[m_iNumInstance]; + ZeroMemory(m_fPositionOffSetX, sizeof(_float) * m_iNumInstance); + + m_fPositionOffSetY = new _float[m_iNumInstance]; + ZeroMemory(m_fPositionOffSetY, sizeof(_float) * m_iNumInstance); + for (size_t i = 0; i < m_iNumInstance; ++i) { m_pInstanceVertices[i].fSize = (pDesc->vSize); - m_pInstanceVertices[i].fPos = _float2(pDesc->vPsition.x + 75 * i, pDesc->vPsition.y); + m_pInstanceVertices[i].fPos = _float2(pDesc->vPsition.x, pDesc->vPsition.y); } m_InstanceInitialDesc.pSysMem = m_pInstanceVertices; @@ -140,19 +148,23 @@ HRESULT CVIBuffer_UI_Instance::Initialize(void* pArg) return S_OK; } -void CVIBuffer_UI_Instance::Set_Pos(_float fX, _float fY, _float OffSet) +void CVIBuffer_UI_Instance::Set_Pos(_float fX, _float fY, _float OffSetX, _float OffSetY, _uint iCols) { - D3D11_MAPPED_SUBRESOURCE SubResource{}; + D3D11_MAPPED_SUBRESOURCE SubResource{}; m_pContext->Map(m_pVBInstance, 0, D3D11_MAP_WRITE_NO_OVERWRITE, 0, &SubResource); VTX_INSTANCE_UI* pVertices = static_cast(SubResource.pData); - for (size_t i = 0; i < m_iNumInstance; i++) + for (_uint i = 0; i < m_iNumInstance; i++) { - pVertices[i].fPos.x = fX + m_pInstanceVertices[i].fPos.x; // 인덱스 * 간격 - pVertices[i].fPos.y = fY; + _uint col = i % iCols; // 가로 인덱스 + _uint row = i / iCols; // 세로 인덱스 + + pVertices[i].fPos.x = fX + col * OffSetX; + pVertices[i].fPos.y = fY + row * OffSetY; } + m_pContext->Unmap(m_pVBInstance, 0); } @@ -183,7 +195,7 @@ CVIBuffer_UI_Instance* CVIBuffer_UI_Instance::Create(ID3D11Device* pDevice, ID3D MSG_BOX("Failed to Created : CVIBuffer_UI_Instance"); Safe_Release(pInstance); } - + return pInstance; } 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/ComputeShader.h b/Jusin154_Team3D/Engine/Public/ComputeShader.h index d13457208..0f179343f 100644 --- a/Jusin154_Team3D/Engine/Public/ComputeShader.h +++ b/Jusin154_Team3D/Engine/Public/ComputeShader.h @@ -34,7 +34,7 @@ class ENGINE_DLL CComputeShader final : public CBase private: vector m_pInputSRV = {}; vector m_pOutputUAV = {}; - vector< ID3D11ShaderResourceView*> m_pOutputSRV = {}; + vector m_pOutputSRV = {}; vector m_pInputBuffer = {}; vector m_pOutputBuffer = {}; @@ -57,4 +57,4 @@ class ENGINE_DLL CComputeShader final : public CBase }; -NS_END \ No newline at end of file +NS_END diff --git a/Jusin154_Team3D/Engine/Public/ElementObject.h b/Jusin154_Team3D/Engine/Public/ElementObject.h index 6718bfa69..8ace2e23b 100644 --- a/Jusin154_Team3D/Engine/Public/ElementObject.h +++ b/Jusin154_Team3D/Engine/Public/ElementObject.h @@ -30,8 +30,10 @@ class ENGINE_DLL CElementObject abstract : public CUIObject virtual _float Get_Nine_Slice_Top() override; virtual _float Get_Nine_Slice_Bottom() override; - virtual void Start_Lerp(_float fTimeDelta, _bool Alpha = false) override; - virtual void Reset_Pos(_float fTimeDelta, _bool Alpha = false) override; + virtual void Start_Lerp(_float fTimeDelta) override; + virtual void Reset_Pos(_float fTimeDelta)override; + virtual void Start_Size_Lerp(_float fTimeDelta) override; + virtual void Reset_Size_Lerp(_float fTimeDelta) override; virtual _vector Get_Lerp_Pos() override; protected: 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..287c5071d 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]; }; @@ -321,11 +321,23 @@ typedef struct tagVertexModelInstanceParticleDesc #pragma endregion +typedef struct tagVertexInstance_UIDesc +{ + static constexpr unsigned int iNumElements = {4}; + static constexpr D3D11_INPUT_ELEMENT_DESC Elements[] = { + { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0}, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0}, + + { "TEXCOORD", 1, DXGI_FORMAT_R32G32_FLOAT, 1, 0, D3D11_INPUT_PER_INSTANCE_DATA, 1 }, + { "TEXCOORD", 2, DXGI_FORMAT_R32G32_FLOAT, 1, 8, D3D11_INPUT_PER_INSTANCE_DATA, 1 } + }; + +}VTX_POSTEX_INSTANCE_UI; typedef struct tagPhsXUserData { PHYSX_KIND eKind = PHYSX_KIND::NOT_DEFINED; - class CGameObject* pOwner = { nullptr }; + class CGameObject* pOwner = { nullptr }; _float4x4 BeforeMatrix = { }; _uint iSubKind = UINT_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/GameInstance.h b/Jusin154_Team3D/Engine/Public/GameInstance.h index 0f7449f89..2a596ee8e 100644 --- a/Jusin154_Team3D/Engine/Public/GameInstance.h +++ b/Jusin154_Team3D/Engine/Public/GameInstance.h @@ -1,5 +1,6 @@ #pragma once #include "Prototype_Manager.h" +#include "ThreadHolder.h" #include "GameObject_Manager.h" NS_BEGIN(Engine) @@ -93,7 +94,6 @@ class ENGINE_DLL CGameInstance final : public CBase void Clear_Objects_With_Layers(_uint iLevelIndex); #pragma endregion - #pragma region RENDERER HRESULT Add_RenderGroup(RENDER eRenderGroup, class CGameObject* pRenderObject); #pragma endregion @@ -203,7 +203,16 @@ class ENGINE_DLL CGameInstance final : public CBase HRESULT SaveTriMeshes(const _char* pPath, vector& TriMeshes); HRESULT LoadTriMeshes(const _char* pPath, vector& TriMeshes); // 모델 불러왔던 경로에 그대로 있음 #pragma endregion - +#pragma region THREADHOLDER + template + future> EnqueueJob(Function&& func, Args&&... args) + { + return m_pThreadHolder->EnqueueJob( + forward(func), + forward(args)... + ); + } +#pragma endregion public: void Add_ModelToMap(const _char* filePath, CModel* pModel) @@ -244,6 +253,7 @@ class ENGINE_DLL CGameInstance final : public CBase class CCollider_Manager* m_pCollider_Manager = { nullptr }; class CPhysX_Manager* m_pPhysX_Manager = { nullptr }; class CPicking* m_pPicking = { nullptr }; + class CThreadHolder* m_pThreadHolder = { nullptr }; #ifdef _DEBUG private: diff --git a/Jusin154_Team3D/Engine/Public/GameObject.h b/Jusin154_Team3D/Engine/Public/GameObject.h index 4d068bad7..f4d6b9e3f 100644 --- a/Jusin154_Team3D/Engine/Public/GameObject.h +++ b/Jusin154_Team3D/Engine/Public/GameObject.h @@ -8,6 +8,7 @@ NS_BEGIN(Engine) class ENGINE_DLL CGameObject abstract : public CBase { + protected: CGameObject(ID3D11Device * pDevice, ID3D11DeviceContext * pContext); CGameObject(const CGameObject& rhs); @@ -112,4 +113,4 @@ class ENGINE_DLL CGameObject abstract virtual void Describe_Entity()PURE; }; -NS_END \ No newline at end of file +NS_END 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/PanelObject.h b/Jusin154_Team3D/Engine/Public/PanelObject.h index 4dc8c4deb..c661f9c47 100644 --- a/Jusin154_Team3D/Engine/Public/PanelObject.h +++ b/Jusin154_Team3D/Engine/Public/PanelObject.h @@ -31,8 +31,8 @@ class ENGINE_DLL CPanelObject abstract : public CUIObject virtual const vector Element_Name(); virtual void ElementAllVisible(_bool bVisible); - virtual void Add_Function(wstring Name, function Evnet) override; - virtual void Function_Callback(wstring Name) override; + virtual void Add_Function(wstring Name, function Evnet) override; + virtual void Function_Callback(wstring Name, void* pArg = nullptr) override; protected: virtual void Add_Element(wstring Name, class CGameObject* pElement); virtual _bool Chack_Visible() override; @@ -42,7 +42,7 @@ class ENGINE_DLL CPanelObject abstract : public CUIObject vector m_ElementName; // 엘리멘트들의 이름을 전해주기 위해서 map m_Elements_map; // 캔버스에서 내가 원하는 패널을 찾기 위해서 - multimap> m_ElementFunction_map; + multimap> m_ElementFunction_map; _int m_iElements_Count{}; // 전체 엘리멘트의 갯수 diff --git a/Jusin154_Team3D/Engine/Public/PartObject.h b/Jusin154_Team3D/Engine/Public/PartObject.h index 713ee5e26..114793e13 100644 --- a/Jusin154_Team3D/Engine/Public/PartObject.h +++ b/Jusin154_Team3D/Engine/Public/PartObject.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include "GameObject.h" @@ -7,7 +7,7 @@ NS_BEGIN(Engine) class ENGINE_DLL CPartObject abstract : public CGameObject { public: - typedef struct tagPartObjectDesc + typedef struct tagPartObjectDesc { class CTransform* pParentTransform = { nullptr }; }PARTOBJECT_DESC; @@ -38,4 +38,4 @@ class ENGINE_DLL CPartObject abstract : public CGameObject virtual void Free() override; }; -NS_END \ No newline at end of file +NS_END diff --git a/Jusin154_Team3D/Engine/Public/Prototype_Manager.h b/Jusin154_Team3D/Engine/Public/Prototype_Manager.h index 75f3cf073..9b2949287 100644 --- a/Jusin154_Team3D/Engine/Public/Prototype_Manager.h +++ b/Jusin154_Team3D/Engine/Public/Prototype_Manager.h @@ -16,6 +16,7 @@ #include "FSM.h" #include "State.h" #include "VIBuffer_UI_Instance.h" +#include "Trail.h" NS_BEGIN(Engine) 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/ThreadHolder.h b/Jusin154_Team3D/Engine/Public/ThreadHolder.h new file mode 100644 index 000000000..9b31cc6a8 --- /dev/null +++ b/Jusin154_Team3D/Engine/Public/ThreadHolder.h @@ -0,0 +1,55 @@ +#pragma once + +#include "Base.h" + +NS_BEGIN(Engine) + + +class ENGINE_DLL CThreadHolder final : public CBase +{ +private: + CThreadHolder(); + ~CThreadHolder(); +public: + template + future> EnqueueJob(Function&& func, Args&&... args) + { + if (true == m_bStop_All) { + throw runtime_error("ThreadPool 사용 중지됨"); + } + using return_type = invoke_result_t; + + auto job = make_shared>(bind(forward(func), forward(args)...)); + future job_result_future = job->get_future(); + { + lock_guard lock(m_mtxJobQueue); + m_JobQueue.push([job]() { (*job)(); }); + } + m_cvJobQueue.notify_one(); + + return job_result_future; + } + + + +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); + void WorkerThread(); + +public: + static CThreadHolder* Create(_uint iSize); + virtual void Free() override; + void Describe_Entity(); +}; + +NS_END diff --git a/Jusin154_Team3D/Engine/Public/Trail.h b/Jusin154_Team3D/Engine/Public/Trail.h index 1a53f5315..9172a8e15 100644 --- a/Jusin154_Team3D/Engine/Public/Trail.h +++ b/Jusin154_Team3D/Engine/Public/Trail.h @@ -6,11 +6,25 @@ NS_BEGIN(Engine) class ENGINE_DLL CTrail final : public CVIBuffer { +public: + typedef struct tagTrailDesc + { + _float3 vHigh; + _float3 vLow; + }TRAIL_DESC; protected: CTrail(ID3D11Device* pDevice, ID3D11DeviceContext* pContext); CTrail(const CTrail& rhs); virtual ~CTrail() = default; +public: + void Trail_Update(_float fDeltaTime, _fmatrix WorldMatrix); + +#ifdef _DEBUG + HRESULT Save_Trail(HANDLE hFile); +#endif + HRESULT Load_Trail(HANDLE hFile); + private: virtual HRESULT Initialize_Prototype() override; virtual HRESULT Initialize(void* pArg) override; @@ -20,6 +34,21 @@ class ENGINE_DLL CTrail final : virtual CTrail* Clone(void* pArg, class CGameObject* pOwner = nullptr) override; virtual void Free() override; virtual void Describe_Entity() override; + virtual HRESULT Render() override; +private: + TRAIL_DESC m_TrailDesc = {}; + + _uint m_iNumCount = {}; + + _vector m_PreHigh[2] = {}; + _vector m_PreLow[2] = {}; + + VTXPOSTEX* m_pVertices = { nullptr }; + + _float m_fAccTime = {}; + _float m_fTrailUpdateTime = {}; + + _uint m_iNumVerticesPerInstance = {}; }; NS_END diff --git a/Jusin154_Team3D/Engine/Public/UIObject.h b/Jusin154_Team3D/Engine/Public/UIObject.h index 741437e22..1a7ca0bb8 100644 --- a/Jusin154_Team3D/Engine/Public/UIObject.h +++ b/Jusin154_Team3D/Engine/Public/UIObject.h @@ -33,6 +33,8 @@ typedef struct tagUIObjectDesc virtual void MoveX(_float fX); virtual void MoveY(_float fY); virtual void SizeUpdate(_float fSizeX, _float fSizeY); + virtual void SizeUpX(_float fSizeX); + virtual void SizeUpY(_float fSizeY); virtual void SizeUpdate_float(_float3 fSizeXY); virtual void Set_Time(_float fTime); virtual void Set_TimeMult(_float Mult); @@ -80,8 +82,10 @@ typedef struct tagUIObjectDesc virtual void Lerp_PosX(_float PosX); virtual void Lerp_PosY(_float PosY); - virtual void Start_Lerp(_float fTimeDelta, _bool Alpha = true); - virtual void Reset_Pos(_float fTimeDelta, _bool Alpha = true); + virtual void Start_Lerp(_float fTimeDelta); + virtual void Reset_Pos(_float fTimeDelta); + virtual void Start_Size_Lerp(_float fTimeDelta); + virtual void Reset_Size_Lerp(_float fTimeDelta); virtual _vector Get_Lerp_Pos(); virtual void LerpOn(); virtual void LerpOff(); @@ -101,8 +105,8 @@ typedef struct tagUIObjectDesc virtual void Set_CoolTime(_float CoolTime); virtual _float Get_CoolTime(); - virtual void Add_Function(wstring Name, function Evnet); - virtual void Function_Callback(wstring Name); + virtual void Add_Function(wstring Name, function Evnet); + virtual void Function_Callback(wstring Name, void* pArg = nullptr); protected: _vector m_fOrigin_Position_vector{}; _float2 m_fOrigin_Position{}; @@ -151,10 +155,6 @@ typedef struct tagUIObjectDesc _float m_fMoveSpeed{}; _float4 m_vNine_Slice{}; - _float m_fLeft{}; - _float m_fRight{}; - _float m_fTop{}; - _float m_fBottom{}; protected: virtual HRESULT Initialize_Prototype(); diff --git a/Jusin154_Team3D/Engine/Public/VIBuffer_Instance.h b/Jusin154_Team3D/Engine/Public/VIBuffer_Instance.h index e82650657..22045cc94 100644 --- a/Jusin154_Team3D/Engine/Public/VIBuffer_Instance.h +++ b/Jusin154_Team3D/Engine/Public/VIBuffer_Instance.h @@ -10,7 +10,9 @@ class ENGINE_DLL CVIBuffer_Instance abstract : public CVIBuffer typedef struct tagInstanceDesc { _uint iNum = {}; - _float2 vSize = { }; + _float2 vSize = {}; + _float fPositionOffSetX{}; + _float fPositionOffSetY{}; _float2 vPsition = {}; }INSTANCE_DESC; protected: diff --git a/Jusin154_Team3D/Engine/Public/VIBuffer_UI_Instance.h b/Jusin154_Team3D/Engine/Public/VIBuffer_UI_Instance.h index 757d892c0..bd82f5c1f 100644 --- a/Jusin154_Team3D/Engine/Public/VIBuffer_UI_Instance.h +++ b/Jusin154_Team3D/Engine/Public/VIBuffer_UI_Instance.h @@ -20,7 +20,7 @@ class ENGINE_DLL CVIBuffer_UI_Instance final : public CVIBuffer_Instance virtual HRESULT Initialize(void* pArg) override; public: - virtual void Set_Pos(_float fX, _float fY,_float OffSet); + virtual void Set_Pos(_float fX, _float fY, _float OffSetX, _float OffSetY, _uint iCols); virtual void Set_Size(_float fSizeX, _float fSizeY); virtual void Set_Cloned(_bool isCloned) { m_isCloned = isCloned; } @@ -28,6 +28,8 @@ class ENGINE_DLL CVIBuffer_UI_Instance final : public CVIBuffer_Instance VTX_INSTANCE_UI* m_pInstanceVertices = { nullptr }; _bool m_isCloned = { false }; _float2* m_fSize{ nullptr }; + _float* m_fPositionOffSetX{}; + _float* m_fPositionOffSetY{}; _float2* m_fPosition{ nullptr }; _float m_fAddPosition{}; diff --git a/Jusin154_Team3D/Engine/Public/pch.h b/Jusin154_Team3D/Engine/Public/pch.h index 8a61f4686..c27ab5229 100644 --- a/Jusin154_Team3D/Engine/Public/pch.h +++ b/Jusin154_Team3D/Engine/Public/pch.h @@ -54,6 +54,11 @@ using namespace DirectX; #include #include #include +#include +#include +#include +#include + using namespace std;