[Modify] 병합 수락
This commit is contained in:
@@ -7,6 +7,18 @@ sampler DefaultSampler = sampler_state
|
||||
AddressU = wrap;
|
||||
AddressV = wrap;
|
||||
};
|
||||
sampler AnisoTropy_BLUR_Sampler = sampler_state // 밉맵이 있어야 의미가 있음
|
||||
{
|
||||
Filter = AnisoTropic;
|
||||
MaxAnisotropy = 16;
|
||||
AddressU = wrap;
|
||||
AddressV = wrap;
|
||||
AddressW = wrap;
|
||||
MipLodBias = 0.5f; // 밉맵 레벨 +1시켜서 의도적으로 뭉갬
|
||||
MinLOD = 0;
|
||||
MaxLOD = 0xFFFFFFFF;
|
||||
ComparisonFunc = ALWAYS;
|
||||
};
|
||||
|
||||
sampler ClampSampler = sampler_state
|
||||
{
|
||||
|
||||
@@ -15,6 +15,12 @@ RasterizerState RS_Nocull
|
||||
DepthClipEnable = false;
|
||||
};
|
||||
|
||||
RasterizerState RS_NocullOcclusion
|
||||
{
|
||||
FillMode = Solid;
|
||||
CullMode = None;
|
||||
};
|
||||
|
||||
RasterizerState RS_Nocull_Wireframe
|
||||
{
|
||||
FillMode = Wireframe;
|
||||
@@ -79,7 +85,7 @@ DepthStencilState DSS_Effect
|
||||
StencilEnable = false;
|
||||
};
|
||||
|
||||
DepthStencilState DSS_Default_OutLine_Write
|
||||
DepthStencilState DSS_Default_Environment_SWrite
|
||||
{
|
||||
DepthEnable = true;
|
||||
DepthWriteMask = true;
|
||||
@@ -99,8 +105,49 @@ DepthStencilState DSS_Default_OutLine_Write
|
||||
BackFaceStencilPass = Replace;
|
||||
BackFaceStencilFunc = Always;
|
||||
};
|
||||
DepthStencilState DSS_Default_Environment_SRead
|
||||
{
|
||||
DepthEnable = true;
|
||||
DepthWriteMask = false;
|
||||
DepthFunc = less_equal;
|
||||
|
||||
DepthStencilState DSS_Default_OutLine_Read
|
||||
StencilEnable = true;
|
||||
StencilReadMask = 0xff; // <-- ff -> 1111 1111 씀
|
||||
StencilWriteMask = 0x00; // <-- 00 -> 0000 0000 안씀
|
||||
|
||||
FrontFaceStencilFail = Keep;
|
||||
FrontFaceStencilDepthFail = Keep;
|
||||
FrontFaceStencilPass = Keep;
|
||||
FrontFaceStencilFunc = Equal;
|
||||
|
||||
BackFaceStencilFail = Keep;
|
||||
BackFaceStencilDepthFail = Keep;
|
||||
BackFaceStencilPass = Keep;
|
||||
BackFaceStencilFunc = NOT_Equal;
|
||||
};
|
||||
|
||||
DepthStencilState DSS_Default_OutLine_SWrite
|
||||
{
|
||||
DepthEnable = true;
|
||||
DepthWriteMask = zero;
|
||||
DepthFunc = less_equal;
|
||||
|
||||
StencilEnable = true;
|
||||
StencilReadMask = 0xff;
|
||||
StencilWriteMask = 0xff;
|
||||
|
||||
FrontFaceStencilFail = Keep;
|
||||
FrontFaceStencilDepthFail = Keep;
|
||||
FrontFaceStencilPass = Replace;
|
||||
FrontFaceStencilFunc = Always;
|
||||
|
||||
BackFaceStencilFail = Keep;
|
||||
BackFaceStencilDepthFail = Keep;
|
||||
BackFaceStencilPass = Replace;
|
||||
BackFaceStencilFunc = Always;
|
||||
};
|
||||
|
||||
DepthStencilState DSS_Default_OutLine_SRead
|
||||
{
|
||||
DepthEnable = true;
|
||||
DepthWriteMask = zero;
|
||||
@@ -118,7 +165,13 @@ DepthStencilState DSS_Default_OutLine_Read
|
||||
BackFaceStencilFail = Keep;
|
||||
BackFaceStencilDepthFail = Keep;
|
||||
BackFaceStencilPass = Keep;
|
||||
BackFaceStencilFunc = Equal;
|
||||
BackFaceStencilFunc = NOT_Equal;
|
||||
};
|
||||
|
||||
DepthStencilState DSS_Occlusion
|
||||
{
|
||||
DepthEnable = true;
|
||||
DepthWriteMask = zero;
|
||||
};
|
||||
|
||||
BlendState BS_None
|
||||
@@ -233,6 +286,28 @@ BlendState BS_WeightBlend
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
BlendState BS_WhiteMask
|
||||
{
|
||||
BlendEnable[0] = false;
|
||||
BlendEnable[1] = false;
|
||||
BlendEnable[2] = false;
|
||||
BlendEnable[3] = false;
|
||||
BlendEnable[4] = false;
|
||||
BlendEnable[5] = false;
|
||||
BlendEnable[6] = false;
|
||||
BlendEnable[7] = false;
|
||||
|
||||
RenderTargetWriteMask[0] = 0;
|
||||
RenderTargetWriteMask[1] = 0;
|
||||
RenderTargetWriteMask[2] = 0;
|
||||
RenderTargetWriteMask[3] = 0;
|
||||
RenderTargetWriteMask[4] = 0;
|
||||
RenderTargetWriteMask[5] = 0;
|
||||
RenderTargetWriteMask[6] = 0;
|
||||
RenderTargetWriteMask[7] = 0;
|
||||
|
||||
};
|
||||
|
||||
#endif // ENGINE_SHADER_STATES_HLSLI
|
||||
|
||||
@@ -13,6 +13,11 @@ float2 g_vResolution;
|
||||
|
||||
uint g_iBloomEmbossingPass;
|
||||
float g_fThreshold;
|
||||
float g_fDepthThreshold;
|
||||
float g_fFocusDistance;
|
||||
float g_fFarBlurStart;
|
||||
float g_fFarBlurEnd;
|
||||
float g_fDOFBlurMultiplier;
|
||||
|
||||
Texture2D g_Texture;
|
||||
|
||||
@@ -92,8 +97,8 @@ struct PS_IN
|
||||
|
||||
struct PS_OUT_BACKBUFFER
|
||||
{
|
||||
float4 vBackBuffer : SV_TARGET0;
|
||||
float4 vBloomBuffer : SV_Target1;
|
||||
float4 vBackBuffer : SV_TARGET0;
|
||||
float4 vEnvironment : SV_Target1;
|
||||
};
|
||||
|
||||
PS_OUT_BACKBUFFER PS_MAIN_DEBUG(PS_IN In)
|
||||
@@ -101,7 +106,7 @@ PS_OUT_BACKBUFFER PS_MAIN_DEBUG(PS_IN In)
|
||||
PS_OUT_BACKBUFFER Out;
|
||||
|
||||
Out.vBackBuffer = g_Texture.Sample(DefaultSampler, In.vTexcoord);
|
||||
Out.vBloomBuffer = float4(0.f, 0.f, 0.f, 0.f);
|
||||
Out.vEnvironment = float4(0.f, 0.f, 0.f, 0.f);
|
||||
return Out;
|
||||
}
|
||||
|
||||
@@ -123,7 +128,7 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
|
||||
|
||||
float fViewZ = vDepth.y * g_fFar;
|
||||
|
||||
float4 vWorldPosition;
|
||||
float4 vWorldPosition; // 월드 복원
|
||||
{
|
||||
vWorldPosition.x = uv.x * 2 - 1;
|
||||
vWorldPosition.y = uv.y * -2 + 1;
|
||||
@@ -140,6 +145,7 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
|
||||
float fOcclusion = 1.f;
|
||||
float fAttenuation = 1.f;
|
||||
|
||||
float fCameraDistance = length(g_vCamPosition.xyz - vWorldPosition.xyz);
|
||||
float3 vToView = normalize(g_vCamPosition.xyz - vWorldPosition.xyz); // 픽셀에서 카메라로
|
||||
float3 vToLight = normalize(-g_vLightDir.xyz); // 픽셀에서 라이트로
|
||||
|
||||
@@ -158,9 +164,9 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
|
||||
fMetallic = 0.f;
|
||||
|
||||
float3 vSRO = g_SurfaceTexture.Sample(DefaultSampler, uv).rgb;
|
||||
vF0 = vSRO.rrr;
|
||||
fRoughness = vSRO.g;
|
||||
fOcclusion = vSRO.b;
|
||||
vF0 = vSRO.rrr;
|
||||
fRoughness = vSRO.g;
|
||||
fOcclusion = vSRO.b;
|
||||
}
|
||||
else // basic Lighting(phong blinn) // if you were here, you miss some assets.
|
||||
{
|
||||
@@ -170,7 +176,14 @@ PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
|
||||
return Out;
|
||||
}
|
||||
|
||||
float fDiffuseAOStrength = lerp(0.3f, 5.f, fOcclusion);
|
||||
float fDiffuseAOStrength = lerp(0.3f, 3.f, fOcclusion);
|
||||
{ // 수치조정 // 디렉셔널
|
||||
float fMinRoughness = 0.05f;
|
||||
fRoughness = max(fRoughness, fMinRoughness); // 러프니스 최소값 보장
|
||||
fRoughness = saturate(saturate(fCameraDistance * 0.01f) * 0.1f + fRoughness); // 거리기반 러프니스 ( 대충 멀수록 반짝반짝한건 더 뭉개져서 표현 )
|
||||
vF0 = min(vF0, 0.9f); // 메탈릭 상한선
|
||||
}
|
||||
|
||||
|
||||
PBR_LIGHT_OUT PBR_Out = PBR_Lighting(vNormal, vToView, vToLight, vAlbedo, fMetallic, fRoughness, g_vLightDiffuse.rgb, fAttenuation, vF0);
|
||||
|
||||
@@ -208,31 +221,35 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
|
||||
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); // 픽셀에서 라이트로
|
||||
float fCameraDistance = length(g_vCamPosition.xyz - vWorldPosition.xyz);
|
||||
float fLightDistance = length(g_vLightPos.xyz - vWorldPosition.xyz);
|
||||
float3 vToView = normalize(g_vCamPosition.xyz - vWorldPosition.xyz); // 픽셀에서 카메라로
|
||||
float3 vToLight = normalize(g_vLightPos.xyz - vWorldPosition.xyz); // 픽셀에서 라이트로
|
||||
|
||||
fAttenuation = saturate((g_fLightRange - fLightDistance) / g_fLightRange);
|
||||
if (fAttenuation <= 0.f)
|
||||
{
|
||||
float fDistance = length(vToLight);
|
||||
fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange);
|
||||
if (fAttenuation <= 0.f) { discard; }
|
||||
Out.vShade = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 1.f);
|
||||
return Out;
|
||||
}
|
||||
|
||||
|
||||
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;
|
||||
@@ -246,8 +263,18 @@ PS_OUT_LIGHT PS_MAIN_POINT(PS_IN In)
|
||||
return Out;
|
||||
}
|
||||
|
||||
float fDiffuseAOStrength = lerp(0.3f, 3.f, fOcclusion);
|
||||
{ // 수치조정 // 점광원
|
||||
float fMinRoughness = 0.05f;
|
||||
fRoughness = max(fRoughness, fMinRoughness); // 러프니스 최소값 보장
|
||||
fRoughness = saturate(saturate(fCameraDistance * 0.01f) * 0.1f + fRoughness); // 거리기반 러프니스 ( 대충 멀수록 반짝반짝한건 더 뭉개져서 표현 )
|
||||
vF0 = min(vF0, 0.9f); // 메탈릭 상한선
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
@@ -266,7 +293,7 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
|
||||
float fViewZ = vDepth.y * g_fFar;
|
||||
|
||||
float4 vWorldPosition;
|
||||
float4 vWorldPosition; // 월드 복원
|
||||
{
|
||||
vWorldPosition.x = uv.x * 2 - 1;
|
||||
vWorldPosition.y = uv.y * -2 + 1;
|
||||
@@ -283,16 +310,26 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
float fOcclusion = 1.f;
|
||||
float fAttenuation = 1.f;
|
||||
|
||||
float fCameraDistance = length(g_vCamPosition.xyz - vWorldPosition.xyz);
|
||||
float fLightDistance = length(g_vLightPos.xyz - vWorldPosition.xyz);
|
||||
float3 vToView = normalize(g_vCamPosition.xyz - vWorldPosition.xyz); // 픽셀에서 카메라로
|
||||
float3 vToLight = normalize(g_vLightPos.xyz - vWorldPosition.xyz); // 픽셀에서 라이트로
|
||||
|
||||
fAttenuation = saturate((g_fLightRange - fLightDistance) / g_fLightRange);
|
||||
if (fAttenuation <= 0.f)
|
||||
{
|
||||
float fDistance = length(vToLight);
|
||||
fAttenuation = saturate((g_fLightRange - fDistance) / g_fLightRange);
|
||||
if (fAttenuation <= 0.f) { discard; }
|
||||
Out.vShade = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 1.f);
|
||||
return Out;
|
||||
}
|
||||
|
||||
float fCosAngle = dot(vToView, g_vLightDir.xyz);
|
||||
if (fCosAngle < g_fSpotOuterAngle) { discard; }
|
||||
if (fCosAngle < g_fSpotOuterAngle)
|
||||
{
|
||||
Out.vShade = float4(0.f, 0.f, 0.f, 1.f);
|
||||
Out.vSpecular = float4(0.f, 0.f, 0.f, 1.f);
|
||||
return Out;
|
||||
}
|
||||
|
||||
float fSpotAttenenuation = saturate((fCosAngle - g_fSpotInnerAngle) / (g_fSpotInnerAngle - g_fSpotOuterAngle));
|
||||
fAttenuation *= fSpotAttenenuation;
|
||||
@@ -303,12 +340,13 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
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;
|
||||
@@ -322,23 +360,33 @@ PS_OUT_LIGHT PS_MAIN_SPOT(PS_IN In)
|
||||
return Out;
|
||||
}
|
||||
|
||||
float fDiffuseAOStrength = lerp(0.3f, 3.f, fOcclusion);
|
||||
{ // 수치조정 // 점광원
|
||||
float fMinRoughness = 0.05f;
|
||||
fRoughness = max(fRoughness, fMinRoughness); // 러프니스 최소값 보장
|
||||
fRoughness = saturate(saturate(fCameraDistance * 0.01f) * 0.1f + fRoughness); // 거리기반 러프니스 ( 대충 멀수록 반짝반짝한건 더 뭉개져서 표현 )
|
||||
vF0 = min(vF0, 0.9f); // 메탈릭 상한선
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
//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
|
||||
//};
|
||||
float g_fWeights_32[32] =
|
||||
{
|
||||
0.000477, 0.000888, 0.001585, 0.002720, 0.004485, 0.007105, 0.010814, 0.015813,
|
||||
0.022216, 0.029988, 0.038893, 0.048463, 0.058021, 0.066740, 0.073759, 0.078320,
|
||||
0.079902, 0.078320, 0.073759, 0.066740, 0.058021, 0.048463, 0.038893, 0.029988,
|
||||
0.022216, 0.015813, 0.010814, 0.007105, 0.004485, 0.002720, 0.001585, 0.000888
|
||||
};
|
||||
|
||||
float g_fWeights[128] =
|
||||
float g_fWeights_128[128] =
|
||||
{
|
||||
0.000209902, 0.000241594, 0.000277451, 0.000317919, 0.000363477, 0.000414637, 0.000471944, 0.000535974,
|
||||
0.000607333, 0.000686659, 0.000774615, 0.000871889, 0.00097919, 0.00109725, 0.00122679, 0.00136858,
|
||||
@@ -423,11 +471,11 @@ PS_OUT_BACKBUFFER PS_MAIN_COMBINED(PS_IN In)
|
||||
vTexcoord.x = In.vTexcoord.x;
|
||||
vTexcoord.y = In.vTexcoord.y + (float) i / g_vResolution.y;
|
||||
|
||||
vColor += g_fWeights[i + 63] * g_BlurXTexture.Sample(ClampSampler, vTexcoord);
|
||||
vColor += g_fWeights_128[i + 63] * g_BlurXTexture.Sample(ClampSampler, vTexcoord);
|
||||
}
|
||||
|
||||
Out.vBackBuffer += vColor;
|
||||
Out.vBloomBuffer;
|
||||
Out.vEnvironment = Out.vBackBuffer;
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -475,6 +523,7 @@ PS_OUT_FLT4_SINGLE PS_MAIN_EMBOSS(PS_IN In)
|
||||
}
|
||||
|
||||
float fIntensity = dot(vColor, float3(0.2126f, 0.7152f, 0.0722f)); // 대략적인 밝기 ( 인간적인 )
|
||||
|
||||
if (fIntensity <= 1e-4f)
|
||||
{
|
||||
Out.vSingleTarget = 0;
|
||||
@@ -519,7 +568,6 @@ PS_OUT_FLT4_SINGLE PS_MAIN_BLOOM_FINISH(PS_IN In)
|
||||
return Out;
|
||||
}
|
||||
|
||||
|
||||
PS_OUT_BLUR_X PS_MAIN_BLUR_X(PS_IN In)
|
||||
{
|
||||
PS_OUT_BLUR_X Out;
|
||||
@@ -532,7 +580,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X(PS_IN In)
|
||||
vTexcoord.x = In.vTexcoord.x + (float) i / g_vResolution.x;
|
||||
vTexcoord.y = In.vTexcoord.y;
|
||||
|
||||
vColor += g_fWeights[i + 63] * g_BlurTexture.Sample(ClampSampler, vTexcoord);
|
||||
vColor += g_fWeights_128[i + 63] * g_BlurTexture.Sample(ClampSampler, vTexcoord);
|
||||
}
|
||||
|
||||
Out.vBlurX = vColor;
|
||||
@@ -541,6 +589,172 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_X(PS_IN In)
|
||||
return Out;
|
||||
}
|
||||
|
||||
PS_OUT_BLUR_X PS_MAIN_BLUR_X_ENV(PS_IN In)
|
||||
{
|
||||
PS_OUT_BLUR_X Out;
|
||||
|
||||
vector vDepthDesc;
|
||||
float2 vTexcoord;
|
||||
float fSampleViewZ;
|
||||
float4 vColor = 0.f;
|
||||
float fBlurAmount = 0.0f;
|
||||
|
||||
float4 vCenter = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vOriginal = g_BlurTexture.Sample(ClampSampler, In.vTexcoord);
|
||||
float fCenterViewZ = vCenter.y * g_fFar;
|
||||
|
||||
float fTerrain = (1.f / 255.f);
|
||||
if (false == AlmostEqual3(vCenter.a, fTerrain))
|
||||
{ // 터레인셀이 아니면 스킵
|
||||
Out.vBlurX = vOriginal;
|
||||
Out.vBlurWeight = 0.0f;
|
||||
return Out;
|
||||
}
|
||||
|
||||
if (fCenterViewZ > g_fFocusDistance)
|
||||
{
|
||||
// 현재 셀이 초점거리보다 멀면 블러
|
||||
// 블러되는 양은 (현재 셀의 거리가 얼마나 더 멀리 있냐) // END보다 멀면 최대치이므로 saturate
|
||||
float fValue = saturate((fCenterViewZ - g_fFarBlurStart) / (g_fFarBlurEnd - g_fFarBlurStart));
|
||||
fBlurAmount = fValue; // 0~1
|
||||
}
|
||||
|
||||
if (fBlurAmount <= FLT_EPSILON3) {
|
||||
// 최소치 이내면 블러 안함
|
||||
Out.vBlurX = vOriginal;
|
||||
Out.vBlurWeight = 0.0f;
|
||||
return Out;
|
||||
}
|
||||
|
||||
float fAcc = 0.f;
|
||||
for (int i = -16; i < 16; ++i)
|
||||
{
|
||||
vTexcoord.x = In.vTexcoord.x + ((float) i / g_vResolution.x) * fBlurAmount * g_fDOFBlurMultiplier;
|
||||
vTexcoord.y = In.vTexcoord.y;
|
||||
|
||||
vDepthDesc = g_DepthTexture.Sample(DefaultSampler, vTexcoord);
|
||||
|
||||
if (false == AlmostEqual3(vDepthDesc.a, fTerrain))
|
||||
{ // 터레인셀이 아니면 스킵
|
||||
continue;
|
||||
}
|
||||
fSampleViewZ = vDepthDesc.y * g_fFar;
|
||||
if (abs(fCenterViewZ - fSampleViewZ) > g_fDepthThreshold)
|
||||
{ // 센터 위치와 z값이 너무 많이 차이나면 샘플링 스킵
|
||||
continue;
|
||||
}
|
||||
|
||||
vColor += g_fWeights_32[i + 16] * g_BlurTexture.Sample(ClampSampler, vTexcoord);
|
||||
fAcc += g_fWeights_32[i + 16];
|
||||
}
|
||||
|
||||
if (fAcc <= FLT_EPSILON3)
|
||||
{ // 블러 실패하면 원본값 씀
|
||||
Out.vBlurX = vOriginal;
|
||||
Out.vBlurWeight = 0.0f;
|
||||
return Out;
|
||||
}
|
||||
else
|
||||
{
|
||||
vColor.xyz /= fAcc;
|
||||
}
|
||||
|
||||
Out.vBlurX = vColor;
|
||||
Out.vBlurWeight = fAcc;
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
PS_OUT_BACKBUFFER PS_MAIN_POSTCOMBINED(PS_IN In)
|
||||
{
|
||||
PS_OUT_BACKBUFFER Out;
|
||||
|
||||
vector vDepthDesc;
|
||||
float2 vTexcoord;
|
||||
float fSampleViewZ;
|
||||
float4 vColor = 0.f;
|
||||
float fBlurAmount = 0.0f;
|
||||
|
||||
float4 vOriginal = g_DiffuseTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float4 vCenter = g_DepthTexture.Sample(DefaultSampler, In.vTexcoord);
|
||||
float fCenterViewZ = vCenter.y * g_fFar;
|
||||
|
||||
float fTerrain = (1.f / 255.f);
|
||||
if (false == AlmostEqual3(vCenter.a, fTerrain))
|
||||
{ // 터레인셀이 아니면 스킵
|
||||
Out.vBackBuffer = vOriginal;
|
||||
Out.vEnvironment = 0.0f;
|
||||
return Out;
|
||||
}
|
||||
|
||||
if (fCenterViewZ > g_fFocusDistance)
|
||||
{
|
||||
// 현재 셀이 초점거리보다 멀면 블러
|
||||
// 블러되는 양은 (현재 셀의 거리가 얼마나 더 멀리 있냐) // END보다 멀면 최대치이므로 saturate
|
||||
float fValue = saturate((fCenterViewZ - g_fFarBlurStart) / (g_fFarBlurEnd - g_fFarBlurStart));
|
||||
fBlurAmount = fValue; // 0~1
|
||||
}
|
||||
|
||||
if (fBlurAmount <= FLT_EPSILON3)
|
||||
{
|
||||
// 최소치 이내면 블러 스킵
|
||||
Out.vBackBuffer = vOriginal;
|
||||
Out.vEnvironment = 0.0f;
|
||||
return Out;
|
||||
}
|
||||
|
||||
float fAcc = 0.f;
|
||||
for (int i = -16; i < 16; ++i)
|
||||
{
|
||||
vTexcoord.x = In.vTexcoord.x;
|
||||
vTexcoord.y = In.vTexcoord.y + ((float) i / g_vResolution.y) * fBlurAmount * g_fDOFBlurMultiplier;
|
||||
|
||||
vDepthDesc = g_DepthTexture.Sample(DefaultSampler, vTexcoord);
|
||||
|
||||
if (false == AlmostEqual3(vDepthDesc.a, fTerrain))
|
||||
{ // 터레인셀이 아니면 스킵
|
||||
continue;
|
||||
}
|
||||
fSampleViewZ = vDepthDesc.y * g_fFar;
|
||||
if (abs(fCenterViewZ - fSampleViewZ) > g_fDepthThreshold)
|
||||
{ // 센터 위치와 z값이 너무 많이 차이나면 샘플링 스킵
|
||||
continue;
|
||||
}
|
||||
|
||||
vColor += g_fWeights_32[i + 16] * g_BlurTexture.Sample(ClampSampler, vTexcoord);
|
||||
fAcc += g_fWeights_32[i + 16];
|
||||
}
|
||||
if (fAcc <= FLT_EPSILON3)
|
||||
{ // 블러 실패하면 원본값 씀
|
||||
Out.vBackBuffer = vOriginal;
|
||||
Out.vEnvironment = 0.0f;
|
||||
return Out;
|
||||
return Out;
|
||||
}
|
||||
else
|
||||
{
|
||||
vColor.xyz /= fAcc;
|
||||
}
|
||||
|
||||
float fOriginalLumen = length(vOriginal.rgb);
|
||||
float fBlurLumen = length(vColor.rgb);
|
||||
|
||||
float fLumenScale = 1.0f;
|
||||
if (fBlurLumen > 1e-4f)
|
||||
{
|
||||
fLumenScale = fOriginalLumen / fBlurLumen;
|
||||
}
|
||||
float3 vBlurMatched = vColor.rgb * fLumenScale;
|
||||
|
||||
float fBlendAmount = saturate(fBlurAmount * g_fDOFBlurMultiplier);
|
||||
float3 finalColor = lerp(vOriginal.rgb, vBlurMatched, fBlendAmount);
|
||||
|
||||
Out.vBackBuffer = float4(vColor.xyz, vOriginal.a);
|
||||
Out.vEnvironment = 0.f;
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
PS_OUT_BLUR_X PS_MAIN_BLUR_Y(PS_IN In)
|
||||
{
|
||||
PS_OUT_BLUR_X Out;
|
||||
@@ -553,7 +767,7 @@ PS_OUT_BLUR_X PS_MAIN_BLUR_Y(PS_IN In)
|
||||
vTexcoord.x = In.vTexcoord.x;
|
||||
vTexcoord.y = In.vTexcoord.y + (float) i / g_vResolution.y;
|
||||
|
||||
vColor += g_fWeights[i + 63] * g_BlurTexture.Sample(ClampSampler, vTexcoord);
|
||||
vColor += g_fWeights_128[i + 63] * g_BlurTexture.Sample(ClampSampler, vTexcoord);
|
||||
}
|
||||
|
||||
Out.vBlurX = vColor;
|
||||
@@ -684,4 +898,22 @@ technique11 DefaultTechnique
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_MAIN_BLOOM_FINISH();
|
||||
}
|
||||
pass BlurX_ENV_Pass // 12
|
||||
{
|
||||
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_BLUR_X_ENV();
|
||||
}
|
||||
pass PostCombinedPass // 13
|
||||
{
|
||||
SetRasterizerState(RS_Default);
|
||||
SetDepthStencilState(DSS_Default_Environment_SRead, 1);
|
||||
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_POSTCOMBINED();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,80 +72,49 @@ void CS_LocalSRT(uint3 DTID : SV_DispatchThreadID)
|
||||
uint boneIndex = DTID.x;
|
||||
if (boneIndex >= (uint) BoneCount)
|
||||
return;
|
||||
|
||||
|
||||
float time = CurrentTime;
|
||||
if (Duration > 0)
|
||||
time = min(time, Duration);
|
||||
|
||||
|
||||
Channel channel = g_ChannelBuffer[boneIndex];
|
||||
|
||||
LocalPos result;
|
||||
|
||||
if (channel.KeyCount == 0)
|
||||
{
|
||||
result.Scale = float3(1, 1, 1);
|
||||
result.Rotation = float4(0, 0, 0, 1);
|
||||
result.Translation = float3(0, 0, 0);
|
||||
result.pad0 = result.pad1 = 0.0f;
|
||||
|
||||
g_LocalPosOutput[boneIndex] = result;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
uint firstIndex = channel.StartIndex;
|
||||
uint lastIndex = channel.StartIndex + channel.KeyCount - 1;
|
||||
uint keyCount = channel.KeyCount;
|
||||
uint lastIndex = firstIndex + keyCount - 1;
|
||||
|
||||
KeyFrame keyframe1 = g_KeyFrameBuffer[firstIndex];
|
||||
KeyFrame keyframe2 = g_KeyFrameBuffer[lastIndex];
|
||||
KeyFrame keyLast = g_KeyFrameBuffer[lastIndex];
|
||||
|
||||
if (time <= keyframe1.fTrackPosition)
|
||||
if (time >= keyLast.fTrackPosition)
|
||||
{
|
||||
result.Scale = keyframe1.vScale;
|
||||
result.Rotation = keyframe1.vRotation;
|
||||
result.Translation = keyframe1.vTranslation;
|
||||
result.Scale = keyLast.vScale;
|
||||
result.Rotation = keyLast.vRotation;
|
||||
result.Translation = keyLast.vTranslation;
|
||||
result.pad0 = result.pad1 = 0.0f;
|
||||
|
||||
g_LocalPosOutput[boneIndex] = result;
|
||||
return;
|
||||
}
|
||||
|
||||
if (time >= keyframe2.fTrackPosition)
|
||||
else
|
||||
{
|
||||
result.Scale = keyframe2.vScale;
|
||||
result.Rotation = keyframe2.vRotation;
|
||||
result.Translation = keyframe2.vTranslation;
|
||||
result.pad0 = result.pad1 = 0.0f;
|
||||
|
||||
g_LocalPosOutput[boneIndex] = result;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint i = 0; i < channel.KeyCount - 1; ++i)
|
||||
{
|
||||
uint A = channel.StartIndex + i;
|
||||
uint B = channel.StartIndex + i + 1;
|
||||
|
||||
KeyFrame ka = g_KeyFrameBuffer[A];
|
||||
KeyFrame kb = g_KeyFrameBuffer[B];
|
||||
|
||||
if (time >= ka.fTrackPosition && time <= kb.fTrackPosition)
|
||||
for (uint i = 0; i < keyCount - 1; ++i)
|
||||
{
|
||||
float t = (time - ka.fTrackPosition) / (kb.fTrackPosition - ka.fTrackPosition);
|
||||
KeyFrame Sour = g_KeyFrameBuffer[firstIndex + i];
|
||||
KeyFrame Dest = g_KeyFrameBuffer[firstIndex + i + 1];
|
||||
|
||||
result.Scale = lerp(ka.vScale, kb.vScale, t);
|
||||
result.Rotation = quatSlerp(ka.vRotation, kb.vRotation, t);
|
||||
result.Translation = lerp(ka.vTranslation, kb.vTranslation, t);
|
||||
result.pad0 = result.pad1 = 0.0f;
|
||||
if (time >= Sour.fTrackPosition && time <= Dest.fTrackPosition)
|
||||
{
|
||||
float ratio = (time - Sour.fTrackPosition) /
|
||||
(Dest.fTrackPosition - Sour.fTrackPosition);
|
||||
|
||||
g_LocalPosOutput[boneIndex] = result;
|
||||
return;
|
||||
result.Scale = lerp(Sour.vScale, Dest.vScale, ratio);
|
||||
result.Rotation = quatSlerp(Sour.vRotation, Dest.vRotation, ratio);
|
||||
result.Translation = lerp(Sour.vTranslation, Dest.vTranslation, ratio);
|
||||
result.pad0 = result.pad1 = 0.0f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
result.Scale = keyframe2.vScale;
|
||||
result.Rotation = keyframe2.vRotation;
|
||||
result.Translation = keyframe2.vTranslation;
|
||||
result.pad0 = result.pad1 = 0.0f;
|
||||
g_LocalPosOutput[channel.BoneIndex] = result;
|
||||
return;
|
||||
|
||||
|
||||
g_LocalPosOutput[boneIndex] = result;
|
||||
}
|
||||
|
||||
@@ -208,6 +208,7 @@ call Update_Lib.bat
|
||||
<ClCompile Include="..\Private\ContainerObject.cpp" />
|
||||
<ClCompile Include="..\Private\DebugDraw.cpp" />
|
||||
<ClCompile Include="..\private\QuadTree.cpp" />
|
||||
<ClCompile Include="..\private\OcclusionQuery.cpp" />
|
||||
<ClCompile Include="..\Private\RigidBody_Dynamic_Joint.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
@@ -311,6 +312,7 @@ call Update_Lib.bat
|
||||
<ClCompile Include="..\private\UIObject.cpp" />
|
||||
<ClCompile Include="..\Private\Unit.cpp" />
|
||||
<ClCompile Include="..\Private\VIBuffer.cpp" />
|
||||
<ClCompile Include="..\private\VIBuffer_Box.cpp" />
|
||||
<ClCompile Include="..\Private\VIBuffer_Cell.cpp" />
|
||||
<ClCompile Include="..\Private\VIBuffer_Cube.cpp" />
|
||||
<ClCompile Include="..\Private\Instance_Model.cpp" />
|
||||
@@ -423,6 +425,7 @@ call Update_Lib.bat
|
||||
<ClInclude Include="..\Public\Bounding_Sphere.h" />
|
||||
<ClInclude Include="..\public\FSM.h" />
|
||||
<ClInclude Include="..\public\QuadTree.h" />
|
||||
<ClInclude Include="..\public\OcclusionQuery.h" />
|
||||
<ClInclude Include="..\Public\RigidBody_Dynamic_Joint.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
@@ -556,6 +559,7 @@ call Update_Lib.bat
|
||||
<ClInclude Include="..\public\UIObject.h" />
|
||||
<ClInclude Include="..\Public\Unit.h" />
|
||||
<ClInclude Include="..\Public\VIBuffer.h" />
|
||||
<ClInclude Include="..\public\VIBuffer_Box.h" />
|
||||
<ClInclude Include="..\Public\VIBuffer_Cell.h" />
|
||||
<ClInclude Include="..\Public\VIBuffer_Cube.h" />
|
||||
<ClInclude Include="..\Public\Instance_Model.h" />
|
||||
|
||||
@@ -289,6 +289,12 @@
|
||||
<Filter Include="99.Define\99.THIRDPARTY\PHYSX">
|
||||
<UniqueIdentifier>{5948985e-f67e-4627-aca4-09b8e9edc359}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.Element\02.Component\02.VIBuffer\Box">
|
||||
<UniqueIdentifier>{f1ac53f8-59f6-4371-a48c-c331f337ebe7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.Element\02.Component\11.Query">
|
||||
<UniqueIdentifier>{432b36d5-fdf6-456a-bc71-8bf793a42314}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Private\Base.cpp">
|
||||
@@ -546,6 +552,12 @@
|
||||
<ClCompile Include="..\Private\VIBuffer_Model_Instance.cpp">
|
||||
<Filter>02.Element\02.Component\02.VIBuffer\Instance\Model_Instance</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\private\OcclusionQuery.cpp">
|
||||
<Filter>02.Element\02.Component\11.Query</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\private\VIBuffer_Box.cpp">
|
||||
<Filter>02.Element\02.Component\02.VIBuffer\Box</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Public\Base.h">
|
||||
@@ -1172,6 +1184,12 @@
|
||||
<ClInclude Include="..\Public\VIBuffer_Model_Instance.h">
|
||||
<Filter>02.Element\02.Component\02.VIBuffer\Instance\Model_Instance</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\OcclusionQuery.h">
|
||||
<Filter>02.Element\02.Component\11.Query</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\VIBuffer_Box.h">
|
||||
<Filter>02.Element\02.Component\02.VIBuffer\Box</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\Public\Assimp\color4.inl">
|
||||
|
||||
@@ -33,7 +33,7 @@ CAnimation::CAnimation(const CAnimation& rhs)
|
||||
SAFE_ADDREF(pChannel);
|
||||
}
|
||||
}
|
||||
_bool CAnimation::Update_TransformationMatrices(const vector<class CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _bool bIsLoop, _float fTimeDelta,_vector vector[3], _float m_fAmount)
|
||||
_bool CAnimation::Update_TransformationMatrices(const vector<class CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _bool bIsLoop, _float fTimeDelta,_vector vector[3])
|
||||
{
|
||||
m_fProgress = m_fTickPerSecond * fTimeDelta * m_fAnimSpeed;
|
||||
m_fCurrentTrackPosition += m_fProgress;
|
||||
@@ -48,12 +48,12 @@ _bool CAnimation::Update_TransformationMatrices(const vector<class CBone*>& Bone
|
||||
Depart_Animation();
|
||||
m_fCurrentTrackPosition = m_fProgress;
|
||||
ResetRootMotion();
|
||||
ProgressAnimation(Bones, pLocalPosArray, vector, m_fAmount);
|
||||
ProgressAnimation(Bones, pLocalPosArray, vector);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
ProgressAnimation(Bones, pLocalPosArray, vector, m_fAmount);
|
||||
ProgressAnimation(Bones, pLocalPosArray, vector);
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -309,14 +309,14 @@ HRESULT CAnimation::Initialize(const vector<CBone*>& Bones, const CModel* pModel
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CAnimation::ProgressAnimation(const vector<CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray,_vector vector[3], _float m_fAmount)
|
||||
void CAnimation::ProgressAnimation(const vector<CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray,_vector vector[3])
|
||||
{
|
||||
_uint iIndex = {};
|
||||
if (m_vBoneTransformationMatrix.size() > 0) {
|
||||
m_vBoneTransformationMatrix.clear();
|
||||
}
|
||||
for (auto& pChannel : m_Channels) {
|
||||
pChannel->Update_TransformationMatirx(Bones, pLocalPosArray, m_fCurrentTrackPosition, &m_CurrentKeyFrameIndices[iIndex++], vector, m_fAmount);
|
||||
pChannel->Update_TransformationMatirx(Bones, pLocalPosArray, m_fCurrentTrackPosition, &m_CurrentKeyFrameIndices[iIndex++], vector);
|
||||
m_vBoneTransformationMatrix.push_back(pChannel->Get_BoneTransformationMatrix());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,6 +168,32 @@ HRESULT CCamera::Ready_Shadow()
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CCamera::ZoomIn(_float fTimeDelta)
|
||||
{
|
||||
if (m_fFovy > XMConvertToRadians(40.f))
|
||||
{
|
||||
m_fFovy -= (fTimeDelta * 1.2f);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CCamera::Set_Fov(_float fFovy, _float fTimeDelta,_bool& bZoomIn)
|
||||
{
|
||||
if (fFovy > m_fFovy)
|
||||
{
|
||||
m_fFovy += (fTimeDelta * 0.6f);
|
||||
}
|
||||
else if(fFovy < m_fFovy)
|
||||
{
|
||||
m_fFovy -= (fTimeDelta * 0.6f);
|
||||
}
|
||||
|
||||
if (fFovy == m_fFovy)
|
||||
{
|
||||
bZoomIn = false;
|
||||
}
|
||||
}
|
||||
|
||||
void CCamera::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
@@ -116,81 +116,31 @@ void CChannel::Update_TransformationMatirx(
|
||||
const LOCALPOS_DESC* pLocalPosArray,
|
||||
_float fCurrentTrackPosition,
|
||||
_uint* pCurrentKeyFrameIndex,
|
||||
_vector vector[3],_float m_fAmount)
|
||||
_vector vector[3])
|
||||
{
|
||||
const LOCALPOS_DESC& LocalPos = pLocalPosArray[m_iBoneIndex];
|
||||
|
||||
if (0.f == fCurrentTrackPosition)
|
||||
*pCurrentKeyFrameIndex = 0;
|
||||
|
||||
KEYFRAME LastKeyFrame = m_KeyFrames.back();
|
||||
|
||||
_vector vScale{};
|
||||
_vector vRotation{};
|
||||
_vector vTranslation{};
|
||||
|
||||
if (fCurrentTrackPosition >= LastKeyFrame.fTrackPosition)
|
||||
{
|
||||
vScale = XMLoadFloat3(&LastKeyFrame.vScale);
|
||||
vRotation = XMLoadFloat4(&LastKeyFrame.vRotation);
|
||||
vTranslation = XMVectorSetW(XMLoadFloat3(&LastKeyFrame.vTranslation), 1.f);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
while (fCurrentTrackPosition >= m_KeyFrames[*pCurrentKeyFrameIndex + 1].fTrackPosition){
|
||||
++*pCurrentKeyFrameIndex;
|
||||
}
|
||||
|
||||
_float3 vSourScale{}, vDestScale{};
|
||||
_float4 vSourRotation{}, vDestRotation{};
|
||||
_float3 vSourTranslation{}, vDestTranslation{};
|
||||
|
||||
vSourScale = m_KeyFrames[*pCurrentKeyFrameIndex].vScale;
|
||||
vDestScale = m_KeyFrames[*pCurrentKeyFrameIndex + 1].vScale;
|
||||
|
||||
vSourRotation = m_KeyFrames[*pCurrentKeyFrameIndex].vRotation;
|
||||
vDestRotation = m_KeyFrames[*pCurrentKeyFrameIndex + 1].vRotation;
|
||||
|
||||
vSourTranslation = m_KeyFrames[*pCurrentKeyFrameIndex].vTranslation;
|
||||
vDestTranslation = m_KeyFrames[*pCurrentKeyFrameIndex + 1].vTranslation;
|
||||
|
||||
_float fRatio = (fCurrentTrackPosition - m_KeyFrames[*pCurrentKeyFrameIndex].fTrackPosition) /
|
||||
(m_KeyFrames[*pCurrentKeyFrameIndex + 1].fTrackPosition - m_KeyFrames[*pCurrentKeyFrameIndex].fTrackPosition);
|
||||
|
||||
vScale = XMVectorLerp(XMLoadFloat3(&vSourScale), XMLoadFloat3(&vDestScale), fRatio);
|
||||
vRotation = XMQuaternionSlerp(XMLoadFloat4(&vSourRotation), XMLoadFloat4(&vDestRotation), fRatio);
|
||||
vTranslation = XMVectorSetW(XMVectorLerp(XMLoadFloat3(&vSourTranslation), XMLoadFloat3(&vDestTranslation), fRatio), 1.f);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//const LOCALPOS_DESC& LocalPos = pLocalPosArray[m_iBoneIndex];
|
||||
|
||||
//_vector vScale = XMLoadFloat3(&LocalPos.Scale);
|
||||
//_vector vRotation = XMLoadFloat4(&LocalPos.Rotation);
|
||||
//_vector vTranslation = XMVectorSet(
|
||||
// LocalPos.Translation.x,
|
||||
// LocalPos.Translation.y,
|
||||
// LocalPos.Translation.z,
|
||||
// 1.f);
|
||||
_vector vScale = XMLoadFloat3(&LocalPos.Scale);
|
||||
_vector vRotation = XMLoadFloat4(&LocalPos.Rotation);
|
||||
_vector vTranslation = XMVectorSet(
|
||||
LocalPos.Translation.x,
|
||||
LocalPos.Translation.y,
|
||||
LocalPos.Translation.z,
|
||||
1.f);
|
||||
|
||||
if (Bones[m_iBoneIndex]->Compare_Name("Reference"))
|
||||
{
|
||||
vector[0] = vScale;
|
||||
vector[1] = vRotation;
|
||||
vector[2] = vTranslation;
|
||||
vTranslation = XMVectorZero();
|
||||
}
|
||||
|
||||
m_BoneTransformationMatrix =
|
||||
XMMatrixAffineTransformation(vScale, XMVectorSet(0.f, 0.f, 0.f, 1.f), vRotation, vTranslation);
|
||||
m_BoneTransformationMatrix =
|
||||
XMMatrixAffineTransformation(vScale, XMVectorSet(0.f, 0.f, 0.f, 1.f), vRotation, vTranslation);
|
||||
|
||||
Bones[m_iBoneIndex]->Set_TransformationMatrix(m_BoneTransformationMatrix);
|
||||
Bones[m_iBoneIndex]->Set_TransformationMatrix(m_BoneTransformationMatrix);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CChannel::ResetRootMotion()
|
||||
{
|
||||
m_vPrevRootPos = { 0.f, 0.f, 0.f };
|
||||
|
||||
@@ -69,6 +69,11 @@ PSX::PxController* CCharacter_Controller::Get_Controller()
|
||||
return m_pController;
|
||||
}
|
||||
|
||||
PSX::PxControllerCollisionFlags CCharacter_Controller::Get_CollisionFlags()
|
||||
{
|
||||
return m_eBeforeCollisionFlags;
|
||||
}
|
||||
|
||||
void CCharacter_Controller::Resize_Volume(_float fHeight)
|
||||
{
|
||||
m_pController->resize(fHeight);
|
||||
@@ -159,7 +164,7 @@ void CCharacter_Controller::Move(_float fTimeDelta)
|
||||
const PSX::PxObstacleContext* pPxObstacles = { nullptr }; // 캐릭터가 충돌해야할 추가적인 장애물 객체?, 닿은 장애물은 캐시된다?
|
||||
|
||||
if (true == m_bGravity) {
|
||||
m_pTransform->AccumulateMomentum(XMVectorSet(0.f, -GRAVITY * fTimeDelta, 0.f, 0.f));
|
||||
m_pTransform->AccumulateMomentum(XMVectorSet(0.f, -GRAVITY * m_fGravity * fTimeDelta, 0.f, 0.f));
|
||||
}
|
||||
XMStoreFloat3((_float3*)&pxVecMomentum, m_pTransform->Get_CurrentMomentum());
|
||||
|
||||
@@ -182,10 +187,10 @@ _vector CCharacter_Controller::Get_Position()
|
||||
return XMVectorSet((_float)pxVPos.x, (_float)pxVPos.y, (_float)pxVPos.z, 1.f);
|
||||
}
|
||||
|
||||
_float3 CCharacter_Controller::Get_FootPosition()
|
||||
_vector CCharacter_Controller::Get_FootPosition()
|
||||
{
|
||||
PSX::PxExtendedVec3 pxLVecfootPos = m_pController->getFootPosition();
|
||||
return { (_float)pxLVecfootPos.x, (_float)pxLVecfootPos.y, (_float)pxLVecfootPos.z };
|
||||
return XMVectorSet((_float)pxLVecfootPos.x, (_float)pxLVecfootPos.y, (_float)pxLVecfootPos.z, 1.f );
|
||||
}
|
||||
|
||||
HRESULT CCharacter_Controller::Initialize_Prototype()
|
||||
@@ -326,6 +331,7 @@ void CCharacter_Controller::Free()
|
||||
void CCharacter_Controller::Describe_Entity()
|
||||
{
|
||||
GUI::Begin("Character_Controller");
|
||||
GUI::Text("Gravity : %d ", m_bGravity);
|
||||
m_pTransform->Describe_Entity();
|
||||
GUI::TextLinkOpenURL("More details here", "https://dev-treadmill.tistory.com/158");
|
||||
_float fContact = m_pController->getContactOffset();
|
||||
@@ -372,7 +378,8 @@ void CCharacter_Controller::Describe_Entity()
|
||||
GUIHelpMarker("A capsule is affected by its lower sphere and tends to generate an up vector on steps.\nIn eEASY, the up vector is combined with the step offset, allowing easier climbing; in eCONSTRAINED, the up vector is removed during step detection and only the step offset is used.");
|
||||
}
|
||||
}
|
||||
|
||||
GUI::Text("%.1f", XMConvertToDegrees(acosf(m_fSlopeLimit))); GUI::SameLine(); GUI::SliderFloat("m_fSlopeLimit", &m_fSlopeLimit, 0.0f, 1.f);
|
||||
GUI::SliderFloat("m_fGravity_Multiplier", &m_fGravity, 0.0f, 3.f);
|
||||
if (GUI::SliderFloat3("Volume", (_float*)&vVolume, 0.1f, 10.f, "%.2f")) {
|
||||
Modify_Volume(vVolume);
|
||||
}GUIHelpMarker("Box uses vSize; Capsule uses x->fRadius, y->fHeight.\nThe capsule's fHeight is likely the distance from the lower sphere center to the upper sphere center.");
|
||||
|
||||
@@ -285,6 +285,7 @@ void CGameInstance::Present_TimeCost() const
|
||||
+ m_fTimer_DrawCall
|
||||
+ m_fTimer_Present;
|
||||
|
||||
GUI::PushItemWidth(80);
|
||||
GUI::Begin("Previous_Frame_Timer");
|
||||
{
|
||||
GUI::ProgressBar(m_fTimer_PriorityUpdate / fTotal, ImVec2(200.f, 0.f));
|
||||
@@ -652,6 +653,11 @@ void CGameInstance::RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTr
|
||||
return m_pPhysX_Manager->RegistTriMesh(pName, pPxTriMesh);
|
||||
}
|
||||
|
||||
void CGameInstance::RegistHeight(const _tchar* pName, PSX::PxHeightFieldDesc& Desc)
|
||||
{
|
||||
return m_pPhysX_Manager->RegistHeight(pName, Desc);
|
||||
}
|
||||
|
||||
PSX::PxRigidDynamic* CGameInstance::Add_DynamicActor(CRigidBody_Dynamic& RigidBody)
|
||||
{
|
||||
return m_pPhysX_Manager->Add_DynamicActor(RigidBody);
|
||||
|
||||
@@ -113,6 +113,12 @@ _bool CModel::Play_Animation(_float fTimeDelta, CTransform* pTransform)
|
||||
if (m_iCurrentAnimIndex < 0 || m_iCurrentAnimIndex >= (_int)m_iNumAnimations)
|
||||
return false;
|
||||
|
||||
if (m_bLoopRestarted)
|
||||
{
|
||||
m_vPrevRootPos = { 0,0,0 };
|
||||
m_bLoopRestarted = false;
|
||||
}
|
||||
|
||||
ComputeAnimation();
|
||||
|
||||
if (m_iPreAnimIndex >= 0 && m_iPreAnimIndex != m_iCurrentAnimIndex)
|
||||
@@ -136,22 +142,11 @@ _bool CModel::Play_Animation(_float fTimeDelta, CTransform* pTransform)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsLoop, fTimeDelta, m_vector, m_fAmount);
|
||||
|
||||
m_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsLoop, fTimeDelta, m_vector);
|
||||
|
||||
m_iPreAnimIndex = m_iCurrentAnimIndex;
|
||||
}
|
||||
|
||||
if (m_bIsFinishedAnim)
|
||||
{
|
||||
if (m_bIsLoop)
|
||||
{
|
||||
m_vPrevRootPos = { 0.f, 0.f, 0.f };
|
||||
}
|
||||
else
|
||||
XMStoreFloat3(&m_vPrevRootPos, m_vector[2]);
|
||||
}
|
||||
|
||||
if (m_bRatio) {
|
||||
Update_RootBone(m_fAmount * m_fRatio);
|
||||
}
|
||||
@@ -162,10 +157,18 @@ _bool CModel::Play_Animation(_float fTimeDelta, CTransform* pTransform)
|
||||
|
||||
if (m_bIsFinishedAnim)
|
||||
{
|
||||
if (m_bIsLoop)
|
||||
{
|
||||
m_bLoopRestarted = true;
|
||||
}
|
||||
else
|
||||
XMStoreFloat3(&m_vPrevRootPos, m_vector[2]);
|
||||
|
||||
m_vPrevRootRot = { 0.f,0.f,0.f,0.f };
|
||||
m_bInitialRootRotSaved = false;
|
||||
}
|
||||
|
||||
|
||||
for (auto& pBone : m_Bones)
|
||||
{
|
||||
pBone->Update_CombinedTransformationMatrix(m_Bones, XMLoadFloat4x4(&m_PreTransformMatrix));
|
||||
@@ -237,7 +240,7 @@ void CModel::Update_RootBone(_float Amount)
|
||||
if (!m_bInitialRootRotSaved)
|
||||
{
|
||||
m_vInitialRootRot = curRotF4;
|
||||
//m_vPrevRootRot = curRotF4;
|
||||
m_vPrevRootRot = curRotF4;
|
||||
m_bInitialRootRotSaved = true;
|
||||
}
|
||||
else
|
||||
@@ -280,7 +283,7 @@ void CModel::Initialize_RootBone()
|
||||
{
|
||||
for (_uint i = 0; i < (_uint)m_Bones.size(); i++)
|
||||
{
|
||||
if (m_Bones[i]->Compare_Name("Reference"))
|
||||
if (m_Bones[i]->Compare_Name("Reference") || m_Bones[i]->Compare_Name("root"))
|
||||
{
|
||||
m_iRootBoneIndex = i;
|
||||
}
|
||||
@@ -1025,6 +1028,17 @@ void CModel::ComputeAnimation()
|
||||
m_pLocalPos = static_cast<LOCALPOS_DESC*>(outSubs[0].pData);
|
||||
}
|
||||
|
||||
void CModel::InItialize_SpineIndex()
|
||||
{
|
||||
for (_uint i = 0; i < (_uint)m_Bones.size(); i++)
|
||||
{
|
||||
if (m_Bones[i]->Compare_Name("Spine"))
|
||||
{
|
||||
m_iSpineIndex = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
HRESULT CModel::Create_ParentVB()
|
||||
{
|
||||
@@ -1405,10 +1419,6 @@ void CModel::LoadAnim(const _char* fileName)
|
||||
|
||||
HRESULT CModel::Initialize(void* pArg)
|
||||
{
|
||||
m_pLerpAnim = CLerpAnim::Create((_uint)m_Bones.size(), 1.f, m_Bones);
|
||||
if (nullptr == m_pLerpAnim) {
|
||||
return E_FAIL;
|
||||
}
|
||||
m_pTransform = m_pOwner->Get_Component<CTransform>();
|
||||
SAFE_ADDREF(m_pTransform);
|
||||
|
||||
@@ -1416,6 +1426,7 @@ HRESULT CModel::Initialize(void* pArg)
|
||||
if (m_eType == MODEL::ANIM)
|
||||
{
|
||||
Initialize_RootBone();
|
||||
InItialize_SpineIndex();
|
||||
Create_Temp();
|
||||
m_Parent.resize(m_Bones.size());
|
||||
for (size_t i = 0; i < (_uint)m_Bones.size(); i++)
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
#include "pch.h"
|
||||
#include "OcclusionQuery.h"
|
||||
|
||||
COcclusionQuery::COcclusionQuery(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
:CComponent(pDevice, pContext)
|
||||
{
|
||||
}
|
||||
|
||||
COcclusionQuery::COcclusionQuery(const COcclusionQuery& rhs)
|
||||
:CComponent(rhs)
|
||||
{
|
||||
}
|
||||
|
||||
void COcclusionQuery::Begin_Query()
|
||||
{
|
||||
m_pContext->Begin(m_pQuery);
|
||||
}
|
||||
|
||||
_bool COcclusionQuery::isDraw()
|
||||
{
|
||||
UINT64 iNumSample;
|
||||
|
||||
if (m_pContext->GetData(m_pQuery, &iNumSample, sizeof(UINT64), 0) != S_OK)
|
||||
return m_bPreFrameDraw;
|
||||
|
||||
0 < iNumSample ? m_bThisFrameDraw = true : m_bThisFrameDraw = false;
|
||||
|
||||
_bool bDraw = { false };
|
||||
|
||||
if(true == m_bThisFrameDraw)
|
||||
m_NumCullFrame = 0;
|
||||
else
|
||||
{
|
||||
if(m_NumCullFrame < 5)
|
||||
++m_NumCullFrame;
|
||||
}
|
||||
|
||||
m_bPreFrameDraw = m_bThisFrameDraw;
|
||||
|
||||
return m_NumCullFrame < 5;
|
||||
}
|
||||
|
||||
void COcclusionQuery::End_Query()
|
||||
{
|
||||
m_pContext->End(m_pQuery);
|
||||
}
|
||||
|
||||
HRESULT COcclusionQuery::Initialize_Prototype()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT COcclusionQuery::Initialize(void* pArg)
|
||||
{
|
||||
D3D11_QUERY_DESC queryDesc = {};
|
||||
|
||||
queryDesc.Query = D3D11_QUERY_OCCLUSION;
|
||||
queryDesc.MiscFlags = 0;
|
||||
|
||||
if (FAILED(m_pDevice->CreateQuery(&queryDesc, &m_pQuery)))
|
||||
{
|
||||
MSG_BOX("Failed to Created : ID3D11Query");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
m_bPreFrameDraw = m_bThisFrameDraw = true;
|
||||
m_NumCullFrame = 0;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
COcclusionQuery* COcclusionQuery::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
COcclusionQuery* pInstance = new COcclusionQuery(pDevice, pContext);
|
||||
if (FAILED(pInstance->Initialize_Prototype()))
|
||||
{
|
||||
MSG_BOX("Failed to Created : COcclusionQuery");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
CComponent* COcclusionQuery::Clone(void* pArg, CGameObject* pOwner)
|
||||
{
|
||||
COcclusionQuery* pInstance = new COcclusionQuery(*this);
|
||||
pInstance->m_pOwner = pOwner;
|
||||
|
||||
if (FAILED(pInstance->Initialize(pArg)))
|
||||
{
|
||||
MSG_BOX("Failed to Cloned : COcclusionQuery");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
void COcclusionQuery::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
SAFE_RELEASE(m_pQuery);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
void COcclusionQuery::Describe_Entity()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
@@ -77,15 +77,17 @@ PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody_Static& RigidBody
|
||||
// PxRigidStatic 씬의 정적 바디 인터페이스
|
||||
PSX::PxRigidStatic* pActor = m_pPhysics->createRigidStatic(pxWorldMatrix);
|
||||
PSX::PxShape* pShape = { nullptr };
|
||||
PSX::PxTriangleMesh* pPxMesh = Find_TriangleMesh(RigidBody.Get_PxMeshKey());
|
||||
PSX::PxTriangleMeshGeometry* pPxMeshGeometry = { nullptr };
|
||||
|
||||
PSX::PxGeometry* pGeometry = { nullptr };
|
||||
|
||||
switch (RigidBody.Get_Type())
|
||||
{
|
||||
case ACTOR::PLANE:
|
||||
break;
|
||||
case ACTOR::TRIANGLEMESH:
|
||||
{ // SetUp Geometry
|
||||
PSX::PxTriangleMesh* pPxMesh = Find_TriangleMesh(RigidBody.Get_PxMeshKey());
|
||||
PSX::PxTriangleMeshGeometry* pPxMeshGeometry = { nullptr };
|
||||
|
||||
_vector vPos, vRotq, vScale;
|
||||
XMMatrixDecompose(&vScale, &vRotq, &vPos, WorldMatrix);
|
||||
vRotq = XMQuaternionNormalize(vRotq);
|
||||
@@ -103,17 +105,40 @@ PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody_Static& RigidBody
|
||||
// pPxMeshGeometry->meshFlags |= PSX::PxMeshGeometryFlag::eDOUBLE_SIDED;
|
||||
// 유효성 체크
|
||||
PX_ASSERT(pPxMeshGeometry->isValid());
|
||||
pGeometry = pPxMeshGeometry;
|
||||
m_TriangleMeshGeometry.emplace(RigidBody.Get_PxMeshKey(), pPxMeshGeometry);
|
||||
}
|
||||
break;
|
||||
case ACTOR::HEIGHTFIELD:
|
||||
break;
|
||||
{ // SetUp HeightField
|
||||
PSX::PxHeightField* pHeightField = Find_HeightField(RigidBody.Get_PxMeshKey());
|
||||
PSX::PxHeightFieldGeometry* pPxHeightGeometry = { nullptr };
|
||||
|
||||
_vector vPos, vRotq, vScale;
|
||||
XMMatrixDecompose(&vScale, &vRotq, &vPos, WorldMatrix);
|
||||
vRotq = XMQuaternionNormalize(vRotq);
|
||||
|
||||
PSX::PxTransform out;
|
||||
XMStoreFloat3((_float3*)&out.p, vPos);
|
||||
XMStoreFloat4((_float4*)&out.q, vRotq);
|
||||
PSX::PxMeshScale meshScale(
|
||||
PSX::PxVec3(fabsf(vScale.m128_f32[0]), fabsf(vScale.m128_f32[1]), fabsf(vScale.m128_f32[2])),
|
||||
PSX::PxQuat(PSX::PxIdentity) // 스케일 축은 로컬 기준
|
||||
);
|
||||
pPxHeightGeometry = new PSX::PxHeightFieldGeometry(pHeightField);
|
||||
|
||||
// 유효성 체크
|
||||
PX_ASSERT(pPxHeightGeometry->isValid());
|
||||
pGeometry = pPxHeightGeometry;
|
||||
m_HeightFieldGeometry.emplace(RigidBody.Get_PxMeshKey(), pPxHeightGeometry);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
assert(false);
|
||||
break;
|
||||
}
|
||||
|
||||
pShape = PSX::PxRigidActorExt::createExclusiveShape(*pActor, *pPxMeshGeometry, *m_pMaterials[ENUM_CLASS(RigidBody.Get_MaterialType())]);
|
||||
pShape = PSX::PxRigidActorExt::createExclusiveShape(*pActor, *pGeometry, *m_pMaterials[ENUM_CLASS(RigidBody.Get_MaterialType())]);
|
||||
|
||||
pShape->setFlags(RigidBody.Get_ShapeFlags());
|
||||
pShape->setContactOffset(RigidBody.Get_ContactOffset());
|
||||
@@ -144,6 +169,17 @@ void CPhysX_Manager::RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxT
|
||||
{
|
||||
m_TriangleMeshes.emplace(CMyTools::ToWstring(pName), pPxTriMesh);
|
||||
}
|
||||
void CPhysX_Manager::RegistHeight(const _tchar* pName, PSX::PxHeightFieldDesc& Desc)
|
||||
{
|
||||
PSX::PxHeightField* pHeightField = PxCreateHeightField(Desc);
|
||||
if (nullptr == pHeightField) {
|
||||
assert(false);
|
||||
}
|
||||
else {
|
||||
m_HeightFields.emplace(pName, pHeightField);
|
||||
}
|
||||
|
||||
}
|
||||
#ifdef EDITOR_PROJECT
|
||||
|
||||
HRESULT CPhysX_Manager::ConvertToTriMeshes(vector<class CMesh*>& Meshes, vector<PSX::PxTriangleMesh*>& pxTriMeshes, _fmatrix WorldMatrix)
|
||||
@@ -243,6 +279,15 @@ PSX::PxTriangleMesh* CPhysX_Manager::Find_TriangleMesh(const _tchar* pMeshName)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PSX::PxHeightField* CPhysX_Manager::Find_HeightField(const _tchar* pFieldName)
|
||||
{
|
||||
map<_wstring, PSX::PxHeightField*>::iterator iter = m_HeightFields.find(pFieldName);
|
||||
if (iter != m_HeightFields.end()) {
|
||||
return iter->second;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void CPhysX_Manager::Update_Kinematic()
|
||||
{
|
||||
for (auto& pBody : m_pActiveBodys) {
|
||||
@@ -489,16 +534,20 @@ HRESULT CPhysX_Manager::Initialize()
|
||||
m_pMaterials.push_back(m_pPhysics->createMaterial(0.5f, 0.5f, 0.6f));
|
||||
|
||||
// m_pScene->overlap();??????
|
||||
#ifdef EDITOR_PROJECT
|
||||
|
||||
PlaneData.eKind = PHYSX_KIND::BODY_STATIC;
|
||||
PlaneData.iSubKind = UINT_MAX;
|
||||
PlaneData.pOwner = nullptr;
|
||||
PlaneData.pBody = nullptr;
|
||||
if (true == m_bDebugCreatePlane) {
|
||||
PlaneData.eKind = PHYSX_KIND::BODY_STATIC;
|
||||
PlaneData.iSubKind = UINT_MAX;
|
||||
PlaneData.pOwner = nullptr;
|
||||
PlaneData.pBody = nullptr;
|
||||
|
||||
PSX::PxRigidStatic* pGroundPlane = PxCreatePlane(*m_pPhysics, physx::PxPlane(0, 1, 0, 0), *m_pMaterials[ENUM_CLASS(PXMATERIAL::DEFAULT)]);
|
||||
pGroundPlane->userData = &PlaneData;
|
||||
pGroundPlane->setName("PHYSX_MANAGER_PLANE");
|
||||
m_pScene->addActor(*pGroundPlane);;
|
||||
PSX::PxRigidStatic* pGroundPlane = PxCreatePlane(*m_pPhysics, physx::PxPlane(0, 1, 0, 0), *m_pMaterials[ENUM_CLASS(PXMATERIAL::DEFAULT)]);
|
||||
pGroundPlane->userData = &PlaneData;
|
||||
pGroundPlane->setName("PHYSX_MANAGER_PLANE");
|
||||
m_pScene->addActor(*pGroundPlane);
|
||||
}
|
||||
#endif
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -537,7 +586,7 @@ CPhysX_Manager* CPhysX_Manager::Create(ID3D11Device* pDevice, ID3D11DeviceContex
|
||||
void CPhysX_Manager::Free()
|
||||
{
|
||||
ClearScene();
|
||||
|
||||
|
||||
for (auto& pMeshes : m_TriangleMeshes) {
|
||||
pMeshes.second->release();
|
||||
} m_TriangleMeshes.clear();
|
||||
@@ -546,6 +595,14 @@ void CPhysX_Manager::Free()
|
||||
Safe_Delete(pGeometry.second);
|
||||
} m_TriangleMeshGeometry.clear();
|
||||
|
||||
for (auto& pGeometry : m_HeightFieldGeometry) {
|
||||
Safe_Delete(pGeometry.second);
|
||||
} m_HeightFieldGeometry.clear();
|
||||
|
||||
for (auto& pField : m_HeightFields) {
|
||||
pField.second->release();
|
||||
} m_HeightFields.clear();
|
||||
|
||||
if (nullptr != m_pCookingParam) {
|
||||
Safe_Delete(m_pCookingParam);
|
||||
}
|
||||
|
||||
@@ -58,8 +58,9 @@ HRESULT CRenderTarget_Manager::Begin_MRT(const _wstring& strMultiRenderTargetKey
|
||||
|
||||
list<CRenderTarget*>* pMRTList = Find_MRT(strMultiRenderTargetKey);
|
||||
|
||||
if (nullptr == pMRTList)
|
||||
if (nullptr == pMRTList){
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
_uint iNumRenderTargets = { 0 };
|
||||
ID3D11RenderTargetView* pRenderTargetViews[D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT] = {};
|
||||
|
||||
@@ -57,13 +57,14 @@ void CRenderer::Render()
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_vResolution", &vResolution, sizeof(_float2)))) {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
Render_Priority();
|
||||
Render_Shadow();
|
||||
Render_NonBlend();
|
||||
Render_LightAcc();
|
||||
Render_Blur();
|
||||
Render_Combined();
|
||||
Render_Occlusion();
|
||||
Render_EnvironmentPostProcess();
|
||||
Render_Effect();
|
||||
Render_NonLight();
|
||||
Render_Blend();
|
||||
@@ -73,6 +74,7 @@ void CRenderer::Render()
|
||||
Render_UI();
|
||||
|
||||
#ifdef _DEBUG
|
||||
Describe_Entitiy();
|
||||
m_pGameInstance->RenderTarget_Debuger();
|
||||
|
||||
if(m_pGameInstance->Key_Pressing(DIK_F10)){
|
||||
@@ -81,6 +83,26 @@ void CRenderer::Render()
|
||||
#endif
|
||||
}
|
||||
|
||||
void CRenderer::Render_Occlusion()
|
||||
{
|
||||
m_RenderObjects[ENUM_CLASS(RENDER::OCCLUSION)].sort([](CGameObject* pSour, CGameObject* pDest)->_bool {
|
||||
return pSour->Get_Depth() < pDest->Get_Depth();
|
||||
});
|
||||
|
||||
for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::OCCLUSION)])
|
||||
{
|
||||
if (nullptr != pRenderObject) {
|
||||
if (FAILED(pRenderObject->Render_BoundingBox())) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
SAFE_RELEASE(pRenderObject);
|
||||
}
|
||||
|
||||
m_RenderObjects[ENUM_CLASS(RENDER::OCCLUSION)].clear();
|
||||
}
|
||||
|
||||
void CRenderer::Render_Priority()
|
||||
{
|
||||
for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::PRIORITY)])
|
||||
@@ -205,6 +227,9 @@ void CRenderer::Render_LightAcc()
|
||||
|
||||
void CRenderer::Render_Combined()
|
||||
{
|
||||
if (FAILED(m_pGameInstance->Begin_MRT_Include_BackBuffer(TEXT("MRT_Combined")))) {
|
||||
return;
|
||||
}
|
||||
{
|
||||
// Bind_Resorces
|
||||
|
||||
@@ -274,6 +299,74 @@ void CRenderer::Render_Combined()
|
||||
|
||||
m_pShader->Begin(ENUM_CLASS(SHADER_PASS_DEFERRED::COMBINED));
|
||||
|
||||
m_pVIBuffer->Bind_Resources();
|
||||
m_pVIBuffer->Render();
|
||||
if (FAILED(m_pGameInstance->End_MRT())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void CRenderer::Render_EnvironmentPostProcess()
|
||||
{
|
||||
if (m_pGameInstance->Key_Up(DIK_END)) {
|
||||
m_bDOF_ENV = !m_bDOF_ENV;
|
||||
}
|
||||
if (false == m_bDOF_ENV) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_Blur_X")))) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_pShader->Bind_Matrix("g_WorldMatrix", &m_WorldMatrix);
|
||||
m_pShader->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix);
|
||||
m_pShader->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix);
|
||||
m_pShader->Bind_Matrix("g_invMatView", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW_INV));
|
||||
m_pShader->Bind_Matrix("g_invmatProj", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ_INV));
|
||||
m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float));
|
||||
m_pShader->Bind_RawValue("g_fDepthThreshold", &m_fDOF_ENV_CutThreshold, sizeof(_float));
|
||||
m_pShader->Bind_RawValue("g_fFocusDistance", &m_fDOF_ENV_FocusDistance, sizeof(_float));
|
||||
m_pShader->Bind_RawValue("g_fFarBlurStart", &m_fDOF_ENV_StartDistance, sizeof(_float));
|
||||
m_pShader->Bind_RawValue("g_fFarBlurEnd", &m_fDOF_ENV_MaxEnd, sizeof(_float));
|
||||
m_pShader->Bind_RawValue("g_fDOFBlurMultiplier", &m_fDOF_ENV_AmountRadius, sizeof(_float));
|
||||
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Depth"), m_pShader, "g_DepthTexture"))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_AfterCombined"), m_pShader, "g_BlurTexture"))) {
|
||||
return;
|
||||
}
|
||||
m_pShader->Begin(ENUM_CLASS(SHADER_PASS_DEFERRED::BLURX_ENVIRONMENT));
|
||||
|
||||
m_pVIBuffer->Bind_Resources();
|
||||
m_pVIBuffer->Render();
|
||||
if (FAILED(m_pGameInstance->End_MRT())) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_pShader->Bind_Matrix("g_WorldMatrix", &m_WorldMatrix);
|
||||
m_pShader->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix);
|
||||
m_pShader->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix);
|
||||
m_pShader->Bind_Matrix("g_invMatView", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW_INV));
|
||||
m_pShader->Bind_Matrix("g_invmatProj", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ_INV));
|
||||
m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float));
|
||||
m_pShader->Bind_RawValue("g_fDepthThreshold", &m_fDOF_ENV_CutThreshold, sizeof(_float));
|
||||
m_pShader->Bind_RawValue("g_fFocusDistance", &m_fDOF_ENV_FocusDistance, sizeof(_float));
|
||||
m_pShader->Bind_RawValue("g_fFarBlurStart", &m_fDOF_ENV_StartDistance, sizeof(_float));
|
||||
m_pShader->Bind_RawValue("g_fFarBlurEnd", &m_fDOF_ENV_MaxEnd, sizeof(_float));
|
||||
m_pShader->Bind_RawValue("g_fDOFBlurMultiplier", &m_fDOF_ENV_AmountRadius, sizeof(_float));
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Depth"), m_pShader, "g_DepthTexture"))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Blur_X"), m_pShader, "g_BlurTexture"))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_AfterCombined"), m_pShader, "g_DiffuseTexture"))) {
|
||||
return;
|
||||
}
|
||||
m_pShader->Begin(ENUM_CLASS(SHADER_PASS_DEFERRED::POSTCOMBINED));
|
||||
|
||||
m_pVIBuffer->Bind_Resources();
|
||||
m_pVIBuffer->Render();
|
||||
}
|
||||
@@ -284,7 +377,6 @@ void CRenderer::Render_Effect()
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::EFFECT)])
|
||||
{
|
||||
if (nullptr != pRenderObject)
|
||||
@@ -295,7 +387,6 @@ void CRenderer::Render_Effect()
|
||||
|
||||
m_RenderObjects[ENUM_CLASS(RENDER::EFFECT)].clear();
|
||||
|
||||
|
||||
if (FAILED(m_pGameInstance->End_MRT())) {
|
||||
return;
|
||||
}
|
||||
@@ -350,7 +441,7 @@ void CRenderer::Render_Blur()
|
||||
if (nullptr != pRenderObject)
|
||||
if (FAILED(pRenderObject->Render_Blur())) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
|
||||
SAFE_RELEASE(pRenderObject);
|
||||
}
|
||||
@@ -415,12 +506,6 @@ void CRenderer::Render_Bloom()
|
||||
m_bPostProcessing_BLOOM = !m_bPostProcessing_BLOOM;
|
||||
}
|
||||
if(true == m_bPostProcessing_BLOOM) {
|
||||
GUI::Begin("PostProcessing_Bloom");
|
||||
GUI::PushItemWidth(80);
|
||||
GUI::DragFloat("g_fThreshold", &m_fThreshold, 0.01f, 0.02f, 100.f, "%.3f");
|
||||
GUI::SliderInt("g_iEmbossingPass", &m_iBloomEmbossingPass, 0, 2, "%d");
|
||||
GUI::End();
|
||||
|
||||
//{ // BackBuffer
|
||||
// ID3D11Texture2D* pBackBuffer = nullptr;
|
||||
// m_pGameInstance->Get_BackBufferPTR(&pBackBuffer);
|
||||
@@ -620,6 +705,12 @@ HRESULT CRenderer::Initialize()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* Target_Depth */
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_Terrain_Depth"), (_uint)Viewport.Width, (_uint)Viewport.Height,
|
||||
DXGI_FORMAT_R32G32B32A32_FLOAT, _float4(0.0f, 1.f, 0.f, 0.f)))) {
|
||||
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)))) {
|
||||
@@ -706,6 +797,11 @@ HRESULT CRenderer::Initialize()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* Target_AfterCombined */
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_AfterCombined"), (_uint)Viewport.Width, (_uint)Viewport.Height,
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM, _float4(0.0f, 0.0f, 0.0f, 0.0f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
/* Target_Color*/
|
||||
@@ -753,6 +849,11 @@ HRESULT CRenderer::Initialize()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* MRT_Combined */
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Combined"), TEXT("Target_AfterCombined")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* MRT_LightAcc */
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_LightAcc"), TEXT("Target_Shade")))) {
|
||||
return E_FAIL;
|
||||
@@ -777,6 +878,7 @@ HRESULT CRenderer::Initialize()
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Blur"), TEXT("Target_Blur_Weight")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* MRT_Blur */
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Bloom"), TEXT("Target_Bloom_Input")))) {
|
||||
return E_FAIL;
|
||||
@@ -807,8 +909,6 @@ HRESULT CRenderer::Initialize()
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_WB"), TEXT("Target_Color")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
m_pShader = (CShader*)m_pGameInstance->Clone_Asset_Prototype(g_iStaticLevel, FX_DEFERRED, nullptr, nullptr);
|
||||
@@ -883,3 +983,49 @@ void CRenderer::Free()
|
||||
SAFE_RELEASE(m_pContext);
|
||||
SAFE_RELEASE(m_pGameInstance);
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
void CRenderer::Describe_Entitiy()
|
||||
{
|
||||
GUI::Begin("Renderer");
|
||||
GUI::PushItemWidth(80);
|
||||
if (GUI::CollapsingHeader("PostProcessing_Bloom"))
|
||||
{
|
||||
GUI::BeginChild("PostProcessing_Bloom");
|
||||
GUI::PushItemWidth(80);
|
||||
GUI::DragFloat("g_fThreshold", &m_fThreshold, 0.01f, 0.02f, 100.f, "%.3f");
|
||||
GUI::SliderInt("g_iEmbossingPass", &m_iBloomEmbossingPass, 0, 2, "%d");
|
||||
GUI::PopItemWidth();
|
||||
GUI::EndChild();
|
||||
}
|
||||
if (GUI::CollapsingHeader("Environment DOF"))
|
||||
{
|
||||
GUI::BeginChild("DOF_ENV", ImVec2(0, 0), true);
|
||||
GUI::PushItemWidth(80.0f);
|
||||
|
||||
GUI::Text("Far DOF (Environment)");
|
||||
GUI::Separator();
|
||||
|
||||
GUI::DragFloat("Depth Cut", &m_fDOF_ENV_CutThreshold, 0.001f, 0.0f, 20.0f, "%.4f");
|
||||
|
||||
GUI::DragFloat("Focus Dist", &m_fDOF_ENV_FocusDistance, 1.0f, 0.1f, 125.f, "%.1f");
|
||||
|
||||
GUI::DragFloat("Blur Start", &m_fDOF_ENV_StartDistance, 1.0f, 0.1f, 250.f, "%.1f");
|
||||
|
||||
GUI::DragFloat("Blur End", &m_fDOF_ENV_MaxEnd, 1.0f, 1.0f, 500.f, "%.1f");
|
||||
|
||||
GUI::DragFloat("Max Radius", &m_fDOF_ENV_AmountRadius, 0.1f, 0.0f, 10.0f, "%.2f");
|
||||
|
||||
if (m_fDOF_ENV_StartDistance < m_fDOF_ENV_FocusDistance){
|
||||
m_fDOF_ENV_StartDistance = m_fDOF_ENV_FocusDistance;
|
||||
}
|
||||
|
||||
if (m_fDOF_ENV_MaxEnd < m_fDOF_ENV_StartDistance + 1.0f){
|
||||
m_fDOF_ENV_MaxEnd = m_fDOF_ENV_StartDistance + 1.0f;
|
||||
}
|
||||
|
||||
GUI::PopItemWidth();
|
||||
GUI::EndChild();
|
||||
}
|
||||
GUI::End();
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -30,6 +30,8 @@ HRESULT CRigidBody_Static::Initialize(void* pArg)
|
||||
if (FAILED(__super::Initialize(pArg))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
RIGIDBODY_STATIC_DESC* pDesc = static_cast<RIGIDBODY_STATIC_DESC*>(pArg);
|
||||
m_pMeshName = pDesc->pMeshName;
|
||||
m_tagData.pOwner = m_pOwner;
|
||||
XMStoreFloat4x4(&m_tagData.BeforeMatrix, m_pTransform->Get_XMWorldMatrix());
|
||||
m_tagData.pBody = this;
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
#include "pch.h"
|
||||
#include "VIBuffer_Box.h"
|
||||
|
||||
CVIBuffer_Box::CVIBuffer_Box(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: CVIBuffer(pDevice, pContext)
|
||||
{
|
||||
}
|
||||
|
||||
CVIBuffer_Box::CVIBuffer_Box(const CVIBuffer_Box& rhs)
|
||||
: CVIBuffer(rhs)
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT CVIBuffer_Box::Update(_float3* pVertexDatas)
|
||||
{
|
||||
D3D11_MAPPED_SUBRESOURCE SubResource{};
|
||||
m_pContext->Map(m_pVB, 0, D3D11_MAP_WRITE_DISCARD, 0, &SubResource);
|
||||
|
||||
VTXPOS* pVertices = static_cast<VTXPOS*>(SubResource.pData);
|
||||
|
||||
for (_uint i = 0; i < m_iNumVertices; ++i)
|
||||
{
|
||||
memcpy(&pVertices[i].vPosition, &pVertexDatas[i], sizeof(_float3));
|
||||
}
|
||||
|
||||
m_pContext->Unmap(m_pVB, 0);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CVIBuffer_Box::Initialize_Prototype()
|
||||
{
|
||||
m_iNumVertexBuffers = 1;
|
||||
m_iNumVertices = 8;
|
||||
m_iVertexStride = sizeof(VTXPOS);
|
||||
|
||||
m_iIndexStride = 2;
|
||||
m_iNumIndices = 36;
|
||||
|
||||
m_eIndexFormat = DXGI_FORMAT_R16_UINT;
|
||||
m_ePrimitive = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST;
|
||||
|
||||
#pragma region IB_BUFFER
|
||||
D3D11_BUFFER_DESC IBDesc{};
|
||||
IBDesc.ByteWidth = m_iIndexStride * m_iNumIndices;
|
||||
IBDesc.Usage = D3D11_USAGE_DEFAULT;
|
||||
IBDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
|
||||
IBDesc.StructureByteStride = m_iIndexStride;
|
||||
IBDesc.CPUAccessFlags = 0;
|
||||
IBDesc.MiscFlags = 0;
|
||||
|
||||
|
||||
_ushort* pIndices = new _ushort[m_iNumIndices];
|
||||
ZeroMemory(pIndices, sizeof(_ushort) * m_iNumIndices);
|
||||
|
||||
/* + x */
|
||||
pIndices[0] = 1; pIndices[1] = 5; pIndices[2] = 6;
|
||||
pIndices[3] = 1; pIndices[4] = 6; pIndices[5] = 2;
|
||||
|
||||
/* - x */
|
||||
pIndices[6] = 4; pIndices[7] = 0; pIndices[8] = 3;
|
||||
pIndices[9] = 4; pIndices[10] = 3; pIndices[11] = 7;
|
||||
|
||||
/* + y */
|
||||
pIndices[12] = 4; pIndices[13] = 5; pIndices[14] = 1;
|
||||
pIndices[15] = 4; pIndices[16] = 1; pIndices[17] = 0;
|
||||
|
||||
/* - y */
|
||||
pIndices[18] = 3; pIndices[19] = 2; pIndices[20] = 6;
|
||||
pIndices[21] = 3; pIndices[22] = 6; pIndices[23] = 7;
|
||||
|
||||
/* + z */
|
||||
pIndices[24] = 5; pIndices[25] = 4; pIndices[26] = 7;
|
||||
pIndices[27] = 5; pIndices[28] = 7; pIndices[29] = 6;
|
||||
|
||||
/* - z */
|
||||
pIndices[30] = 0; pIndices[31] = 1; pIndices[32] = 2;
|
||||
pIndices[33] = 0; pIndices[34] = 2; pIndices[35] = 3;
|
||||
|
||||
|
||||
D3D11_SUBRESOURCE_DATA IBRes{};
|
||||
IBRes.pSysMem = pIndices;
|
||||
|
||||
if (FAILED(m_pDevice->CreateBuffer(&IBDesc, &IBRes, &m_pIB))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
Safe_Delete_Array(pIndices);
|
||||
#pragma endregion
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CVIBuffer_Box::Initialize(void* pArg)
|
||||
{
|
||||
if (nullptr == pArg)
|
||||
{
|
||||
#ifdef EDITOR_PROJECT
|
||||
if(FAILED(Ready_VIBuffer_Editor()))
|
||||
return E_FAIL;
|
||||
#else
|
||||
return E_FAIL;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
if(FAILED(Ready_VIBuffer(pArg)))
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CVIBuffer_Box::Ready_VIBuffer(void* pArg)
|
||||
{
|
||||
_float3* pCorners = static_cast<_float3*>(pArg);
|
||||
|
||||
#pragma region VTX_BUFFER
|
||||
D3D11_BUFFER_DESC VBDesc{};
|
||||
VBDesc.ByteWidth = m_iVertexStride * m_iNumVertices;
|
||||
VBDesc.Usage = D3D11_USAGE_DEFAULT;
|
||||
VBDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
||||
VBDesc.CPUAccessFlags = 0;
|
||||
VBDesc.MiscFlags = 0;
|
||||
VBDesc.StructureByteStride = m_iVertexStride;
|
||||
|
||||
VTXPOS* pVertices = new VTXPOS[m_iNumVertices];
|
||||
memset(pVertices, 0, sizeof(VTXPOS) * m_iNumVertices);
|
||||
|
||||
pVertices[0].vPosition = pCorners[0];
|
||||
pVertices[1].vPosition = pCorners[1];
|
||||
pVertices[2].vPosition = pCorners[2];
|
||||
pVertices[3].vPosition = pCorners[3];
|
||||
pVertices[4].vPosition = pCorners[4];
|
||||
pVertices[5].vPosition = pCorners[5];
|
||||
pVertices[6].vPosition = pCorners[6];
|
||||
pVertices[7].vPosition = pCorners[7];
|
||||
|
||||
D3D11_SUBRESOURCE_DATA VBRes{};
|
||||
VBRes.pSysMem = pVertices;
|
||||
|
||||
if (FAILED(m_pDevice->CreateBuffer(&VBDesc, &VBRes, &m_pVB))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
Safe_Delete_Array(pVertices);
|
||||
|
||||
#pragma endregion
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#ifdef EDITOR_PROJECT
|
||||
HRESULT CVIBuffer_Box::Ready_VIBuffer_Editor()
|
||||
{
|
||||
#pragma region VTX_BUFFER
|
||||
D3D11_BUFFER_DESC VBDesc{};
|
||||
VBDesc.ByteWidth = m_iVertexStride * m_iNumVertices;
|
||||
VBDesc.Usage = D3D11_USAGE_DYNAMIC;
|
||||
VBDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
|
||||
VBDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
VBDesc.MiscFlags = 0;
|
||||
VBDesc.StructureByteStride = m_iVertexStride;
|
||||
|
||||
VTXPOS* pVertices = new VTXPOS[m_iNumVertices];
|
||||
memset(pVertices, 0, sizeof(VTXPOS) * m_iNumVertices);
|
||||
|
||||
pVertices[0].vPosition = _float3(-0.5f, 0.5f, -0.5f);
|
||||
pVertices[1].vPosition = _float3(0.5f, 0.5f, -0.5f);
|
||||
pVertices[2].vPosition = _float3(0.5f, -0.5f, -0.5f);
|
||||
pVertices[3].vPosition = _float3(-0.5f, -0.5f, -0.5f);
|
||||
pVertices[4].vPosition = _float3(-0.5f, 0.5f, 0.5f);
|
||||
pVertices[5].vPosition = _float3(0.5f, 0.5f, 0.5f);
|
||||
pVertices[6].vPosition = _float3(0.5f, -0.5f, 0.5f);
|
||||
pVertices[7].vPosition = _float3(-0.5f, -0.5f, 0.5f);
|
||||
|
||||
D3D11_SUBRESOURCE_DATA VBRes{};
|
||||
VBRes.pSysMem = pVertices;
|
||||
|
||||
if (FAILED(m_pDevice->CreateBuffer(&VBDesc, &VBRes, &m_pVB))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
Safe_Delete_Array(pVertices);
|
||||
|
||||
#pragma endregion
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
CVIBuffer_Box* CVIBuffer_Box::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
CVIBuffer_Box* pInstance = new CVIBuffer_Box(pDevice, pContext);
|
||||
|
||||
if (FAILED(pInstance->Initialize_Prototype()))
|
||||
{
|
||||
MSG_BOX("Failed to Created : CVIBuffer_Rect");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
CVIBuffer_Box* CVIBuffer_Box::Clone(void* pArg, CGameObject* pOwner)
|
||||
{
|
||||
CVIBuffer_Box* pInstance = new CVIBuffer_Box(*this);
|
||||
pInstance->m_pOwner = pOwner;
|
||||
if (FAILED(pInstance->Initialize(pArg)))
|
||||
{
|
||||
MSG_BOX("Failed to Cloned : CVIBuffer_Box");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
void CVIBuffer_Box::Free()
|
||||
{
|
||||
__super::Free();
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
|
||||
void CVIBuffer_Box::Describe_Entity()
|
||||
{
|
||||
}
|
||||
|
||||
#endif // _DEBUG
|
||||
@@ -389,6 +389,44 @@ HRESULT CVIBuffer_Terrain::Initialize(void* pArg)
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CVIBuffer_Terrain::ConvertToHeightField(const _tchar* pStaticKey)
|
||||
{
|
||||
vector<PSX::PxHeightFieldSample> pxSamples = {};
|
||||
pxSamples.resize(m_iNumVerticesZ * m_iNumVerticesX);
|
||||
|
||||
for (_uint iRow = 0; iRow < m_iNumVerticesZ; ++iRow) {
|
||||
for (_uint iCol = 0; iCol < m_iNumVerticesX; ++iCol) {
|
||||
_uint iIndex = iRow * m_iNumVerticesX + iCol;
|
||||
_uint iPhysXIndex = iCol * m_iNumVerticesZ + iRow;
|
||||
|
||||
_float fRealHeight = m_HeigthValues[iIndex];
|
||||
PSX::PxI16 iClampHeight = (PSX::PxI16)(PSX::PxClamp(fRealHeight, -32767.f, 32767.f));
|
||||
|
||||
PSX::PxHeightFieldSample& pxSample = pxSamples[iPhysXIndex];
|
||||
|
||||
pxSample.height = iClampHeight;
|
||||
pxSample.materialIndex0 = pxSample.materialIndex1 = 0;
|
||||
pxSample.clearTessFlag();
|
||||
}
|
||||
}
|
||||
|
||||
PSX::PxHeightFieldDesc Desc{};
|
||||
Desc.format = PSX::PxHeightFieldFormat::eS16_TM;
|
||||
Desc.nbRows = m_iNumVerticesZ;
|
||||
Desc.nbColumns = m_iNumVerticesX;
|
||||
|
||||
Desc.samples.data = pxSamples.data();
|
||||
Desc.samples.stride = sizeof(PSX::PxHeightFieldSample);
|
||||
Desc.convexEdgeThreshold = 0;
|
||||
if (false == Desc.isValid()) {
|
||||
assert(false);
|
||||
}
|
||||
else {
|
||||
m_pGameInstance->RegistHeight(pStaticKey, Desc);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
_bool CVIBuffer_Terrain::Picking(_fmatrix WorldMatrix, _float3* pOut)
|
||||
{
|
||||
_matrix WorldInv = XMMatrixInverse(nullptr, WorldMatrix);
|
||||
|
||||
@@ -11,8 +11,8 @@ class ENGINE_DLL CAnimation : public CBase
|
||||
CAnimation(const CAnimation& rhs);
|
||||
virtual ~CAnimation() = default;
|
||||
public:
|
||||
_bool Update_TransformationMatrices(const vector<class CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _bool bIsLoop, _float fTimeDelta, _vector vector[3], _float m_fAmount = 1.f);
|
||||
void ProgressAnimation(const vector<CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _vector vector[3], _float m_fAmount);
|
||||
_bool Update_TransformationMatrices(const vector<class CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _bool bIsLoop, _float fTimeDelta, _vector vector[3]);
|
||||
void ProgressAnimation(const vector<CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _vector vector[3]);
|
||||
void ResetRootMotion();
|
||||
void Depart_Animation();
|
||||
void Set_AnimPause(_bool bValue) { m_bPause = bValue; }
|
||||
@@ -21,7 +21,7 @@ class ENGINE_DLL CAnimation : public CBase
|
||||
_int Get_AnimProgressPostion(const _char* pAnimChannelName);
|
||||
void Set_AnimProgressPostion(const _char* pChannelName, _uint iPosition);
|
||||
vector<_int>* Capture_Bones();
|
||||
void InterpAnim(CAnimation* pPreAnim, vector<CBone*>& Bones, float fRatio);
|
||||
void InterpAnim(CAnimation* pPreAnim, vector<CBone*>& Bones, _float fRatio);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -44,6 +44,8 @@ class ENGINE_DLL CCamera abstract : public CGameObject
|
||||
_bool IsImportantThan(CCamera* pOther) const;
|
||||
const _float* Get_CurrentFar();
|
||||
HRESULT Ready_Shadow();
|
||||
void ZoomIn(_float fTimeDelta);
|
||||
void Set_Fov(_float fFovy,_float fTimeDelta, _bool& bZoomIn);
|
||||
|
||||
protected:
|
||||
_float m_fFovy = {};
|
||||
|
||||
@@ -23,7 +23,7 @@ class ENGINE_DLL CChannel : public CBase
|
||||
CHANNEL_DESC Fill_GPU_ChannelDesc();
|
||||
|
||||
public:
|
||||
void Update_TransformationMatirx(const vector<class CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _float fCurrentTrackPosition, _uint* pCurrentKeyFrameIndex, _vector vector[3],_float m_fAmount = 1.f);
|
||||
void Update_TransformationMatirx(const vector<class CBone*>& Bones, const LOCALPOS_DESC* pLocalPosArray, _float fCurrentTrackPosition, _uint* pCurrentKeyFrameIndex, _vector vector[3]);
|
||||
_int Get_BoneIndex() { return { m_iBoneIndex }; }
|
||||
void Set_BoneIndex(_int iBoneIndex) { m_iBoneIndex = iBoneIndex; }
|
||||
void ResetRootMotion();
|
||||
|
||||
@@ -54,8 +54,9 @@ class ENGINE_DLL CCharacter_Controller final :
|
||||
void Move(_float fTimeDelta); // 이동 // 충돌보정만 있음,
|
||||
void Set_Position(_fvector vNewPos); // 순간이동
|
||||
_vector Get_Position();
|
||||
_float3 Get_FootPosition(); // ContactOffset이 고려된 발바닥 위치( 실제보다 바닥 위치가 더 아래에 위치한다는 뜻 )
|
||||
|
||||
_vector Get_FootPosition(); // ContactOffset이 고려된 발바닥 위치( 실제보다 바닥 위치가 더 아래에 위치한다는 뜻 )
|
||||
|
||||
PSX::PxControllerCollisionFlags Get_CollisionFlags();
|
||||
void Resize_Volume(_float fHeight); // 높이를 수정하고 바닥에 붙임
|
||||
void Modify_Volume(_float3 fVolume);
|
||||
_float3 Get_Volume();
|
||||
@@ -69,9 +70,10 @@ class ENGINE_DLL CCharacter_Controller final :
|
||||
private:
|
||||
ACTOR m_eBodyType = { ACTOR::END };
|
||||
PSX::PxController* m_pController = { nullptr };
|
||||
CTransform* m_pTransform = { nullptr };
|
||||
CTransform* m_pTransform = { nullptr };
|
||||
_bool m_bAutoStepping = { false };
|
||||
_float m_fSlopeLimit = { 0.f }; // cosf각도, 오르막 경사각 제한. ( 추가설정 필요함 )
|
||||
_float m_fGravity = { 0.094f };
|
||||
_float m_fSlopeLimit = { 0.302f/*0~1*/}; // cosf각도, 오르막 경사각 제한. ( 추가설정 필요함 )
|
||||
PhsXUserData m_tagData = {};
|
||||
|
||||
PSX::PxControllerCollisionFlags m_eBeforeCollisionFlags = {};
|
||||
|
||||
@@ -5,7 +5,7 @@ NS_BEGIN(Engine)
|
||||
enum class STATE { RIGHT, UP, LOOK, POSITION, END };
|
||||
enum class LIGHT { DIRECTIONAL, POINT, SPOT, END };
|
||||
enum class COLLIDER { AABB, OBB, SPHERE, END };
|
||||
enum class RENDER { PRIORITY, SHADOW, NONBLEND, DECAL, BLUR, NONLIGHT, EFFECT ,BLEND, BLOOM, UI, END };
|
||||
enum class RENDER { OCCLUSION, PRIORITY, SHADOW, NONBLEND, DECAL, BLUR, NONLIGHT, EFFECT ,BLEND, BLOOM, UI, END };
|
||||
enum class RAY { LOCAL, WORLD, END };
|
||||
enum class ACTOR { BOX, CAPSULE, SPHERE, PLANE, TRIANGLEMESH, HEIGHTFIELD, END };
|
||||
|
||||
@@ -34,7 +34,7 @@ enum class NAVI_POINT { A, B, C, END };
|
||||
enum class NAVI_LINE { AB, BC, CA, END };
|
||||
enum class SHADER_PASS_CELL { DEBUG, END };
|
||||
|
||||
enum class SHADER_PASS_DEFERRED { DEBUG, DIRECTIONAL, POINT, COMBINED, BLUR, SPOT, REFIT, EMBOSSING, BLOOM_BLURX, BLOOM_BLURY, BLOOM_ACCUM, BLOOM_FINISH, END };
|
||||
enum class SHADER_PASS_DEFERRED { DEBUG, DIRECTIONAL, POINT, COMBINED, BLUR, SPOT, REFIT, EMBOSSING, BLOOM_BLURX, BLOOM_BLURY, BLOOM_ACCUM, BLOOM_FINISH, BLURX_ENVIRONMENT, POSTCOMBINED, END };
|
||||
|
||||
enum class QUESTYPE {MAIN, SUB, END};
|
||||
enum class TEXTURE_MOUNT_SLOT0 { NOT_DEFINED, METALLIC, SPECULAR, HEIGHT, END };
|
||||
@@ -90,6 +90,14 @@ enum class PHYSX_KIND {
|
||||
|
||||
NS_END
|
||||
|
||||
|
||||
/*
|
||||
// 스텐실 버퍼 마스크
|
||||
// 0000 0001 -> 아웃라인
|
||||
// 0000 0010 -> 터레인 및 지형 및 건물 등등
|
||||
|
||||
*/
|
||||
|
||||
//enum PxRigidBodyFlag::Enum // createBody에 들어감
|
||||
//{
|
||||
// // 해당 바디는 키네마틱 모드가 됨.
|
||||
|
||||
@@ -241,6 +241,18 @@ typedef struct tagVertexPositionTexcoord {
|
||||
|
||||
}VTXPOSTEX;
|
||||
|
||||
typedef struct tagVertexPositionNormal {
|
||||
_float3 vPosition = {};
|
||||
_float3 vNormal = {};
|
||||
|
||||
static constexpr _uint iNumElements = { 2 };
|
||||
static constexpr D3D11_INPUT_ELEMENT_DESC Elements[] = {
|
||||
{ "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 },
|
||||
{ "NORMAL", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 }
|
||||
};
|
||||
|
||||
}VTXPOSNOR;
|
||||
|
||||
typedef struct tagVertexPositionNormalTexcoord {
|
||||
_float3 vPosition = {};
|
||||
_float3 vNormal = {};
|
||||
|
||||
@@ -20,7 +20,10 @@ enum ESTATE : _u64Flag
|
||||
SKILL2 = 1ULL << 13,
|
||||
ANCIENT_THROW = 1ULL << 14,
|
||||
MAPHELP = 1ULL << 15,
|
||||
STOP = 1ULL << 16,
|
||||
POTION = 1ULL << 16,
|
||||
STOP = 1ULL << 17,
|
||||
HIT = 1ULL << 18,
|
||||
BROOM_RIDE = 1ULL << 19,
|
||||
END
|
||||
};
|
||||
NS_END
|
||||
|
||||
@@ -193,6 +193,7 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
#pragma region PhysX_Manager
|
||||
PSX::PxMaterial* Create_Material(_float3* vMatInfo);
|
||||
void RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTriMesh);
|
||||
void RegistHeight(const _tchar* pName, PSX::PxHeightFieldDesc& Desc);
|
||||
PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody_Dynamic& RigidBody);
|
||||
PSX::PxRigidStatic* Add_StaticActor(CRigidBody_Static& RigidBody);
|
||||
PSX::PxRevoluteJoint* Create_PxRevoluteJoint(PSX::PxRigidActor* pActorFrame, PSX::PxTransform& pxLocalWallFrame, PSX::PxRigidActor* pActorObject, PSX::PxTransform& pxLocalActorFrame);
|
||||
@@ -254,6 +255,7 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
class CPhysX_Manager* m_pPhysX_Manager = { nullptr };
|
||||
class CPicking* m_pPicking = { nullptr };
|
||||
class CThreadHolder* m_pThreadHolder = { nullptr };
|
||||
class COcclusionQuery* m_pOcclusionQuery = { nullptr };
|
||||
|
||||
#ifdef _DEBUG
|
||||
private:
|
||||
|
||||
@@ -24,6 +24,7 @@ class ENGINE_DLL CGameObject abstract
|
||||
virtual HRESULT Render_Blur() { return S_OK; }
|
||||
virtual HRESULT Render_Bloom() { return S_OK; }
|
||||
virtual HRESULT Render_OutLine() { return S_OK; }
|
||||
virtual HRESULT Render_BoundingBox() { return S_OK; }
|
||||
|
||||
virtual _float Get_Depth(); // z 소팅 할 때 쓰시면 됨
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
virtual HRESULT Render_Indexed(_uint iMeshIndex, _uint IndexCount, _uint StartIndexLocation, _uint BaseVertexLocation);
|
||||
#pragma endregion
|
||||
#pragma region Animation
|
||||
_bool Play_Animation(_float fTimeDelta, class CTransform* pTransform = nullptr ); // 애니메이션에 델타타임을 넣어줌
|
||||
_bool Play_Animation(_float fTimeDelta, class CTransform* pTransform = nullptr); // 애니메이션에 델타타임을 넣어줌
|
||||
void Set_AnimationIndex(_uint iIndex, _bool isLoop = true, _float fAmount = 1.f, _bool bRatio = false);
|
||||
_bool IsFinishedAnim() const { return m_bIsFinishedAnim; }
|
||||
_bool IsLoopAnim() const { return m_bIsLoop; }
|
||||
@@ -71,6 +71,7 @@ void Combined_BoneMatrix();
|
||||
#pragma endregion
|
||||
|
||||
void ComputeAnimation();
|
||||
void InItialize_SpineIndex();
|
||||
|
||||
public:
|
||||
#ifdef EDITOR_PROJECT
|
||||
@@ -119,7 +120,7 @@ void Combined_BoneMatrix();
|
||||
|
||||
_int m_iPreAnimIndex = { -1 };
|
||||
_float m_fBlendTime = { 0.f };
|
||||
_float m_fBlendDuration = { 0.2f };
|
||||
_float m_fBlendDuration = { 0.3f };
|
||||
|
||||
_float m_fRadius = { 0.f }; // 컬링용 Radius
|
||||
_float3 m_vRadiusOffset = {}; // 컬링용 Radius Offset
|
||||
@@ -133,7 +134,8 @@ void Combined_BoneMatrix();
|
||||
_matrix m_DeltaAnimationMatrix = {}; // 루트본의 델타애니메이션
|
||||
class CTransform* m_pTransform = { nullptr }; // 모델 대상의 트랜스폼
|
||||
|
||||
_float m_fRatio = {};
|
||||
_float m_fRatio = {};
|
||||
_int m_iSpineIndex = { -1 };
|
||||
|
||||
// 바이너리
|
||||
SaveModel* m_pSaveModel = { nullptr };
|
||||
@@ -151,6 +153,8 @@ void Combined_BoneMatrix();
|
||||
_float4 m_vInitialRootRot = {};
|
||||
|
||||
_vector m_vector[3];
|
||||
_bool m_bLoopRestarted = false;
|
||||
|
||||
|
||||
#pragma region Compute
|
||||
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include "Component.h"
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
|
||||
class ENGINE_DLL COcclusionQuery final : public CComponent
|
||||
{
|
||||
private:
|
||||
COcclusionQuery(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
COcclusionQuery(const COcclusionQuery& rhs);
|
||||
virtual ~COcclusionQuery() = default;
|
||||
|
||||
public:
|
||||
void Begin_Query();
|
||||
_bool isDraw();
|
||||
void End_Query();
|
||||
|
||||
private:
|
||||
ID3D11Query* m_pQuery = { nullptr };
|
||||
|
||||
_bool m_bPreFrameDraw = {};
|
||||
_bool m_bThisFrameDraw = {};
|
||||
_uint m_NumCullFrame = {};
|
||||
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
|
||||
public:
|
||||
static COcclusionQuery* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
virtual CComponent* Clone(void* pArg, class CGameObject* pOwner = nullptr) override;
|
||||
virtual void Free() override;
|
||||
#ifdef _DEBUG
|
||||
void Describe_Entity() override;
|
||||
#endif // _DEBUG
|
||||
};
|
||||
|
||||
NS_END
|
||||
@@ -1,4 +1,4 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
|
||||
@@ -27,6 +27,7 @@ class CPhysX_Manager final : public CBase
|
||||
PSX::PxRevoluteJoint* Create_PxRevoluteJoint(PSX::PxRigidActor* pActorFrame, PSX::PxTransform& pxLocalWallFrame, PSX::PxRigidActor* pActorObject, PSX::PxTransform& pxLocalActorFrame);
|
||||
|
||||
void RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTriMesh);
|
||||
void RegistHeight(const _tchar* pName, PSX::PxHeightFieldDesc& Desc);
|
||||
PSX::PxMaterial* Create_Material(const _float3* vMatInfo);
|
||||
#ifdef EDITOR_PROJECT
|
||||
|
||||
@@ -36,6 +37,7 @@ class CPhysX_Manager final : public CBase
|
||||
HRESULT LoadTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||
//HRESULT LoadTriMeshes_Binary(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||
PSX::PxTriangleMesh* Find_TriangleMesh(const _tchar* pMeshName);
|
||||
PSX::PxHeightField* Find_HeightField(const _tchar* pFieldName);
|
||||
|
||||
void Update(_float fTimeDelta);
|
||||
void ClearScene();
|
||||
@@ -80,11 +82,20 @@ class CPhysX_Manager final : public CBase
|
||||
|
||||
unordered_set<PSX::PxActor*> m_pActiveBodys = { };
|
||||
unordered_set<PSX::PxActor*> m_pRestBodies = { }; // 피직스의 액터로 구별되기 때문에 피직스액터 포인터를 키로 사용함
|
||||
|
||||
map<_wstring, PSX::PxTriangleMesh*> m_TriangleMeshes = {};
|
||||
map<_wstring, PSX::PxTriangleMeshGeometry*> m_TriangleMeshGeometry = {};
|
||||
|
||||
map<_wstring, PSX::PxHeightField*> m_HeightFields = {};
|
||||
map<_wstring, PSX::PxHeightFieldGeometry*> m_HeightFieldGeometry = {};
|
||||
|
||||
|
||||
#ifdef EDITOR_PROJECT
|
||||
_bool m_bDebugCreatePlane = { true };
|
||||
PhsXUserData PlaneData = {};
|
||||
#else
|
||||
_bool m_bDebugCreatePlane = { false };
|
||||
#endif // EDITOR_PROJECT
|
||||
|
||||
vector<PSX::PxMaterial*> m_pMaterials = { };
|
||||
_uint m_iNumLevel = {};
|
||||
|
||||
@@ -16,7 +16,9 @@
|
||||
#include "FSM.h"
|
||||
#include "State.h"
|
||||
#include "VIBuffer_UI_Instance.h"
|
||||
#include "VIBuffer_Box.h"
|
||||
#include "Trail.h"
|
||||
#include "OcclusionQuery.h"
|
||||
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
|
||||
@@ -40,21 +40,31 @@ class CRenderer final : public CBase
|
||||
_float4x4 m_ProjMatrix = {};
|
||||
|
||||
ID3D11DepthStencilView* m_pShadowDSV = { nullptr };
|
||||
ID3D11DepthStencilView* m_pOcclusionDSV = { nullptr };
|
||||
|
||||
SHADOW_LIGHT_DESC m_PreShadowDesc = {};
|
||||
_float4x4 m_PreShadowMatrices[ENUM_CLASS(D3DTS::END)] = {};
|
||||
|
||||
_bool m_bPostProcessing_BLOOM = { false };
|
||||
_bool m_bDOF_ENV = { false };
|
||||
_int m_iBloomEmbossingPass = { 0 };
|
||||
_float m_fThreshold = { 1.26f };
|
||||
_float m_fDOF_ENV_CutThreshold = { 0.1350f };
|
||||
_float m_fDOF_ENV_FocusDistance = { 31.1f };
|
||||
_float m_fDOF_ENV_StartDistance = { 53.1f };
|
||||
_float m_fDOF_ENV_MaxEnd = { 360.f };
|
||||
_float m_fDOF_ENV_AmountRadius = { 1.f };
|
||||
|
||||
|
||||
private:
|
||||
void Render_Occlusion();
|
||||
void Render_Priority();
|
||||
void Render_Shadow();
|
||||
void Render_NonBlend();
|
||||
void Render_LightAcc();
|
||||
void Render_Blur();
|
||||
void Render_Combined();
|
||||
void Render_EnvironmentPostProcess();
|
||||
void Render_Effect();
|
||||
void Render_WeightBlend();
|
||||
void Render_NonLight();
|
||||
@@ -71,12 +81,17 @@ class CRenderer final : public CBase
|
||||
|
||||
private:
|
||||
HRESULT Ready_ShadowDepthStencilView(_uint iSizeX, _uint iSizeY);
|
||||
HRESULT Ready_OcclusionDepthStencilView(_uint iSizeX, _uint iSizeY);
|
||||
|
||||
private:
|
||||
HRESULT Initialize();
|
||||
public:
|
||||
static CRenderer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
virtual void Free();
|
||||
#ifdef _DEBUG
|
||||
virtual void Describe_Entitiy();
|
||||
#endif // _DEBUG
|
||||
|
||||
};
|
||||
|
||||
NS_END
|
||||
|
||||
@@ -14,7 +14,7 @@ class ENGINE_DLL CRigidBody_Static : public CRigidBody
|
||||
|
||||
}RIGIDBODY_STATIC_PROTOTYPEDESC;
|
||||
|
||||
typedef struct tagRigidBody_STATIC_Desc : public CRigidBody::RIGIDBODY_PROTOTYPEDESC
|
||||
typedef struct tagRigidBody_STATIC_Desc : public CRigidBody::RIGIDBODY_DESC
|
||||
{
|
||||
const _tchar* pMeshName = { nullptr };
|
||||
}RIGIDBODY_STATIC_DESC;
|
||||
|
||||
@@ -4,17 +4,18 @@
|
||||
NS_BEGIN(STATEANIM)
|
||||
enum ESTATE
|
||||
{
|
||||
IDLE, IDLE_TURN_L, IDLE_TURN_R, IDLE_TURN_BWD,
|
||||
IDLE,IDLE_AIM, IDLE_TURN_L, IDLE_TURN_R, IDLE_TURN_BWD,
|
||||
MOVE,
|
||||
WALK, WALK_FWD, WALK_BWD,WALK_STOP,
|
||||
JOG,JOG_FWD,JOG_RIGHT,JOG_LEFT, JOG_BWD,JOG_STOP,
|
||||
WALK, WALK_FWD,WALK_RIGHT,WALK_LEFT, WALK_BWD,WALK_STOP,
|
||||
JOG, JOG_FWD, JOG_RIGHT, JOG_LEFT, JOG_BWD, JOG_STOP, JOG_AIM_LEFT, JOG_AIM_RIGHT, JOG_AIM_BWD, JOG_AIM_STOP_L, JOG_AIM_STOP_R, JOG_AIM_STOP_BWD,
|
||||
SPRINT,
|
||||
JUMP,JUMP_JOG,JUMP_SPRINT,
|
||||
LAND,
|
||||
DODGE,DODGE_BLINK, DODGE_LEFT, DODGE_RIGHT,
|
||||
COMBAT, LIGHT_ATTACK, SPELL, SKILL, SKILL2,
|
||||
MAPHELP,
|
||||
MAPHELP,POTION,
|
||||
ACCIO,DESCENDO,DIFFINDO,DEPULSO,LUMOS,DISILLUSION_ENTER,DISILLUSION_EXIT, ANCIENT_THROW,
|
||||
BROOM_IDLE,BROOM_FWD, BROOM_HOVER_IDLE, BROOM_HOVER_START,BROOM_MOUNT, BROOM_MOUNT_END,
|
||||
HIT, HIT_FWD, HIT_BWD, HIT_BWD2, HIT_BWD3, HIT_BWD4, HIT_L, HIT_R,
|
||||
KNOCKDOWN, KNOCKDOWN_FWD, KNOCKDOWN_FWD_SPLT, KNOCKDOWN_FWD_SPLT_HOLD, KNOCKDOWN_BWD, KNOCKDOWN_BWD_SPLT, KNOCKDOWN_BWD_SPLT_HOLD,
|
||||
GETUP, GETUP_BWD, GETUP_FWD, GETUP_L, GETUP_L_FD, GETUP_L_FU, GETUP_R, GETUP_R_FD, GETUP_R_FU, GETUP_SLOUCH,
|
||||
@@ -22,7 +23,9 @@ enum ESTATE
|
||||
KNOCKBACK, KNOCKBACK2,
|
||||
TUMBLE, TUMBLE2,
|
||||
PETRIFICUSED_START,
|
||||
|
||||
////////////////////////// 빗자루
|
||||
BROOM_MOUNT_B, BROOM_HOVER_IDLE_B, BROOM_HOVER_STOP_B,BROOM_FLY_DOWN_B, BROOM_FLY_LEFT_B, BROOM_FLY_RIGHT_B, BROOM_FLY_UP_B,BROOM_FLY_B,
|
||||
/// ////////////////////////////
|
||||
END
|
||||
};
|
||||
NS_END
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
#include "VIBuffer.h"
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
|
||||
class ENGINE_DLL CVIBuffer_Box final :
|
||||
public CVIBuffer
|
||||
{
|
||||
private:
|
||||
CVIBuffer_Box(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CVIBuffer_Box(const CVIBuffer_Box& rhs);
|
||||
virtual ~CVIBuffer_Box() = default;
|
||||
|
||||
public:
|
||||
virtual HRESULT Update(_float3* pVertices);
|
||||
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
|
||||
HRESULT Ready_VIBuffer(void* pArg);
|
||||
#ifdef EDITOR_PROJECT
|
||||
HRESULT Ready_VIBuffer_Editor();
|
||||
#endif
|
||||
|
||||
public:
|
||||
static CVIBuffer_Box* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
virtual CVIBuffer_Box* Clone(void* pArg, class CGameObject* pOwner = nullptr) override;
|
||||
virtual void Free() override;
|
||||
#ifdef _DEBUG
|
||||
void Describe_Entity() override;
|
||||
#endif // _DEBUG
|
||||
};
|
||||
|
||||
NS_END
|
||||
@@ -24,6 +24,7 @@ class ENGINE_DLL CVIBuffer_Terrain final : public CVIBuffer
|
||||
#endif // EDITOR_PROJECT
|
||||
virtual HRESULT Initialize_Prototype(const _char* pFilePath, _uint iSizeX, _uint iSizeZ);
|
||||
virtual HRESULT Initialize(void* pArg);
|
||||
void ConvertToHeightField(const _tchar* pStaticKey);
|
||||
|
||||
_bool Picking(_fmatrix WorldMatrix, _float3* pOut);
|
||||
void Culling(_fmatrix WorldMatrix);
|
||||
|
||||
Reference in New Issue
Block a user