Merge branch 'Develope' into Effect
This commit is contained in:
@@ -228,6 +228,24 @@ float3 DecodeNormalFromRG(Texture2D NormalMap, SamplerState Samp, float2 uv)
|
||||
return normalize(n);
|
||||
}
|
||||
|
||||
// BackGround ForeGround 합은 1
|
||||
float2 DepthCompare(float fCenterDepth, float fSampleDepth, float fDepthScale)
|
||||
{
|
||||
return saturate(0.5f + float2(fDepthScale, -fDepthScale) * (fSampleDepth - fCenterDepth));
|
||||
}
|
||||
|
||||
float2 SpreadCompare(float fOffsetLength, float2 fSpreadLength, float fPixelToSampleUnitsScale)
|
||||
{
|
||||
return saturate(fPixelToSampleUnitsScale * fSpreadLength - fOffsetLength + 1.f);
|
||||
}
|
||||
|
||||
float SampleWeight(float fCenterDepth, float fSampleDepth, float fOffsetLength, float fCenterSpreadLength, float fSampleSpreadLength, float fPixelToSampleUnitsScale, float fDepthScale)
|
||||
{
|
||||
float2 vDepthCompare = DepthCompare(fCenterDepth, fSampleDepth, fDepthScale);
|
||||
float2 vSpreadCompare = SpreadCompare(fOffsetLength, float2(fCenterSpreadLength, fSampleSpreadLength), fPixelToSampleUnitsScale);
|
||||
return dot(vDepthCompare, vSpreadCompare);
|
||||
}
|
||||
|
||||
float4x4 RotateX(float fAngle)
|
||||
{
|
||||
float fCos = cos(radians(fAngle));
|
||||
@@ -451,5 +469,43 @@ float4 BlendDiffuse(float4 vDiffuseA, Texture2D DiffuseBlendTexture, float2 vTex
|
||||
|
||||
}
|
||||
|
||||
float2 CalcVelocityUV(float4 vCurrentProjPos, float4 vPreviousProjPos)
|
||||
{
|
||||
if (vCurrentProjPos.w <= FLT_EPSILON5 || vPreviousProjPos.w <= FLT_EPSILON5) {
|
||||
return float2(0.0f, 0.0f);
|
||||
}
|
||||
|
||||
float2 currentUV = (vCurrentProjPos.xy/vCurrentProjPos.w);
|
||||
float2 previousUV = (vPreviousProjPos.xy / vCurrentProjPos.w);
|
||||
|
||||
currentUV.y *= -1.f;
|
||||
previousUV.y *= -1.f;
|
||||
|
||||
return currentUV - previousUV;
|
||||
}
|
||||
|
||||
float3 DownSampleFast(Texture2D SrcTexture2D, float2 vCenterTexcoord, float2 vSrcTexelSize, float2 vResolution)
|
||||
{
|
||||
float2 uv = float2(0.f, 0.f);
|
||||
float3 vCenterColor = SrcTexture2D.SampleLevel(BorderZeroSampler, uv, 0);
|
||||
uv = vCenterTexcoord + vSrcTexelSize * float2(-1.0, -1.0);
|
||||
float3 fLTColor = BilinearFetches(vResolution, SrcTexture2D, uv, BorderZeroLinearSampler);
|
||||
uv = vCenterTexcoord + vSrcTexelSize * float2(0.0, -1.0);
|
||||
float3 fTColor = SrcTexture2D.SampleLevel(BorderZeroSampler, uv, 0);
|
||||
uv = vCenterTexcoord + vSrcTexelSize * float2(+1.0, -1.0);
|
||||
float3 fRTColor = BilinearFetches(vResolution, SrcTexture2D, uv, BorderZeroLinearSampler);
|
||||
uv = vCenterTexcoord + vSrcTexelSize * float2(-1.0, 0.0);
|
||||
float3 fLColor = SrcTexture2D.SampleLevel(BorderZeroSampler, uv, 0);
|
||||
uv = vCenterTexcoord + vSrcTexelSize * float2(1.0, 0.0);
|
||||
float3 fRColor = SrcTexture2D.SampleLevel(BorderZeroSampler, uv, 0);
|
||||
uv = vCenterTexcoord + vSrcTexelSize * float2(-1.0, +1.0);
|
||||
float3 fLBColor = BilinearFetches(vResolution, SrcTexture2D, uv, BorderZeroLinearSampler);
|
||||
uv = vCenterTexcoord + vSrcTexelSize * float2(0.0, 1.0);
|
||||
float3 fBColor = SrcTexture2D.SampleLevel(BorderZeroSampler, uv, 0);
|
||||
uv = vCenterTexcoord + vSrcTexelSize * float2(+1.0, +1.0);
|
||||
float3 fRBColor = BilinearFetches(vResolution, SrcTexture2D, uv, BorderZeroLinearSampler);
|
||||
|
||||
return vCenterColor * 0.25f + (fLTColor + fRTColor + fLBColor + fRBColor) * 0.0625f + (fTColor + fLColor + fRColor + fBColor) * 0.125f;
|
||||
}
|
||||
|
||||
#endif // ENGINE_SHADER_FUNCTIONS_HLSLI
|
||||
|
||||
@@ -6,6 +6,7 @@ matrix g_LightViewMatrix_MIDDLE, g_LightProjMatrix_MIDDLE;
|
||||
matrix g_LightViewMatrix_FAR, g_LightProjMatrix_FAR;
|
||||
matrix g_PreShadowLightViewMatrix, g_PreShadowLightProjMatrix;
|
||||
|
||||
|
||||
float4 g_SamplePos[64];
|
||||
float g_fFar;
|
||||
float g_fShadowFar_NEAR;
|
||||
@@ -70,6 +71,12 @@ Texture2D g_BlurWeightXTexture;
|
||||
Texture2D g_SurfaceTexture;
|
||||
Texture2D g_OriginalTexture;
|
||||
|
||||
Texture2D g_ColorTexture;
|
||||
Texture2D g_VelocityTexture;
|
||||
|
||||
int g_iMBSampleCount;
|
||||
int g_fMBBlurRadius;
|
||||
float g_iMBType;
|
||||
|
||||
vector g_vLightDiffuse;
|
||||
vector g_vLightAmbient;
|
||||
@@ -137,6 +144,10 @@ struct VS_OUT
|
||||
float4 vPosition : SV_POSITION;
|
||||
float2 vTexcoord : TEXCOORD0;
|
||||
};
|
||||
struct PS_OUT_VELOCITYBLUR
|
||||
{
|
||||
float4 vColor : SV_TARGET0;
|
||||
};
|
||||
VS_OUT VS_MAIN(VS_IN In)
|
||||
{
|
||||
VS_OUT Out;
|
||||
@@ -213,6 +224,30 @@ struct PS_OUT_SSAO_BLUR
|
||||
{
|
||||
float fBlur : SV_TARGET0;
|
||||
};
|
||||
// g_ColorTexture;
|
||||
// g_DepthTexture;
|
||||
// g_VelocityTexture;
|
||||
// g_fFar
|
||||
// g_fMBBlurRadius
|
||||
// g_iMBType
|
||||
// g_iMBSampleCount
|
||||
PS_OUT_VELOCITYBLUR PS_MOTIONBLUR_X(PS_IN In)
|
||||
{
|
||||
PS_OUT_VELOCITYBLUR Out = (PS_OUT_VELOCITYBLUR)0;
|
||||
//float2 uv = In.vTexcoord;
|
||||
//float2 vSrcTexelSize = float2(1.f / g_vResolution.x, 1.f / g_vResolution.y);
|
||||
//float3 vColor = (0.f, 0.f, 0.f);
|
||||
|
||||
//for (int i = -g_iMBSampleCount; i < g_iMBSampleCount; ++i)
|
||||
//{
|
||||
// vTexcoord.x = In.vTexcoord.x + (float) i / g_vResolution.x;
|
||||
// vTexcoord.y = In.vTexcoord.y;
|
||||
|
||||
// vColor += g_fWeights_32[i + 15] * g_BlurTexture.Sample(ClampSampler, vTexcoord);
|
||||
//}
|
||||
|
||||
return Out;
|
||||
}
|
||||
PS_OUT_LIGHT PS_MAIN_DIRECTIONAL(PS_IN In)
|
||||
{
|
||||
PS_OUT_LIGHT Out;
|
||||
@@ -759,48 +794,34 @@ PS_OUT_FLT4_SINGLE PS_MAIN_EMBOSS(PS_IN In)
|
||||
{
|
||||
PS_OUT_FLT4_SINGLE Out;
|
||||
float2 uv = In.vTexcoord;
|
||||
float fMask = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0).a;
|
||||
float fSrcAlpha = g_DiffuseTexture.Sample(PointSampler, uv).a;
|
||||
float2 vSrcTexelSize = float2(1.f / g_vResolution.x, 1.f / g_vResolution.y);
|
||||
float3 vColor = (0.f, 0.f, 0.f);
|
||||
|
||||
uint iMask = (uint) round(fMask * 255.f); // int a = 1 -> // vBloom.a = (enum / 255);
|
||||
//if (0 != iMask) {
|
||||
// 주변 4개 셀(LT RT LB RB)및 중앙을 이중선형샘플링, 이후 자체적으로 이중선형샘플링
|
||||
|
||||
float3 vCenterColor = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0);
|
||||
uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, -1.0);
|
||||
float3 fLTColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler);
|
||||
uv = In.vTexcoord + vSrcTexelSize * float2(0.0, -1.0);
|
||||
float3 fTColor = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0);
|
||||
uv = In.vTexcoord + vSrcTexelSize * float2(+1.0, -1.0);
|
||||
float3 fRTColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler);
|
||||
uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, 0.0);
|
||||
float3 fLColor = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0);
|
||||
uv = In.vTexcoord + vSrcTexelSize * float2(1.0, 0.0);
|
||||
float3 fRColor = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0);
|
||||
uv = In.vTexcoord + vSrcTexelSize * float2(-1.0, +1.0);
|
||||
float3 fLBColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler);
|
||||
uv = In.vTexcoord + vSrcTexelSize * float2(0.0, 1.0);
|
||||
float3 fBColor = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0);
|
||||
uv = In.vTexcoord + vSrcTexelSize * float2(+1.0, +1.0);
|
||||
float3 fRBColor = BilinearFetches(g_vResolution, g_DiffuseTexture, uv, BorderZeroLinearSampler);
|
||||
vColor = DownSampleFast(g_DiffuseTexture, In.vTexcoord, vSrcTexelSize, g_vResolution);
|
||||
|
||||
|
||||
|
||||
// vSample /= fWeight 이중선형샘플러가 자체적으로 웨이츠 계싼해주기 때문에 안해도 상관없을듯
|
||||
vColor = vCenterColor * 0.25f + (fLTColor + fRTColor + fLBColor + fRBColor) * 0.0625f + (fTColor + fLColor + fRColor + fBColor) * 0.125f;
|
||||
//if (iMask == 2)
|
||||
//{
|
||||
// vColor *= 3.f;
|
||||
//}
|
||||
//}
|
||||
float fIntensity = dot(vColor, float3(0.2126f, 0.7152f, 0.0722f));
|
||||
fIntensity = max(FLT_EPSILON3, fIntensity);
|
||||
|
||||
|
||||
float fBloomIntensity = GetBloomCurve(fIntensity, g_fBloomThreshold, g_iBloomEmbossingPass);
|
||||
float3 bloomColor = (vColor * fBloomIntensity) / fIntensity;
|
||||
Out.vFirstTarget = float4(bloomColor, 1.f);
|
||||
Out.vFirstTarget = float4(bloomColor, fSrcAlpha);
|
||||
|
||||
return Out;
|
||||
}
|
||||
|
||||
PS_OUT_FLT4_SINGLE PS_MAIN_DOWNSAMPLE(PS_IN In)
|
||||
{
|
||||
PS_OUT_FLT4_SINGLE Out;
|
||||
float2 uv = In.vTexcoord;
|
||||
float fMask = g_DiffuseTexture.SampleLevel(BorderZeroSampler, uv, 0).a;
|
||||
float2 vSrcTexelSize = float2(1.f / g_vResolution.x, 1.f / g_vResolution.y);
|
||||
float3 vColor = (0.f, 0.f, 0.f);
|
||||
|
||||
vColor = DownSampleFast(g_DiffuseTexture, In.vTexcoord, vSrcTexelSize, g_vResolution);
|
||||
|
||||
Out.vFirstTarget = float4(vColor, 1.f);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -809,10 +830,10 @@ PS_OUT_FLT4_SINGLE PS_MAIN_BLOOM_ACCUM(PS_IN In)
|
||||
{
|
||||
PS_OUT_FLT4_SINGLE Out;
|
||||
|
||||
float3 vColorSrcA = g_DiffuseTexture.Sample(PointSampler, In.vTexcoord).xyz;
|
||||
float3 vColorSrcB = g_BlurTexture.Sample(BorderZeroSampler, In.vTexcoord).xyz;
|
||||
float4 vColorSrcA = g_DiffuseTexture.Sample(PointSampler, In.vTexcoord);
|
||||
float4 vColorSrcB = g_BlurTexture.Sample(BorderZeroSampler, In.vTexcoord);
|
||||
|
||||
Out.vFirstTarget = float4(saturate(vColorSrcA + vColorSrcB), 1.f);
|
||||
Out.vFirstTarget = saturate(vColorSrcA + vColorSrcB);
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -821,9 +842,9 @@ PS_OUT_FLT4_SINGLE PS_MAIN_BLOOM_FINISH(PS_IN In)
|
||||
PS_OUT_FLT4_SINGLE Out;
|
||||
|
||||
vector vColor = g_DiffuseTexture.Sample(PointSampler, In.vTexcoord);
|
||||
float3 vBloom = g_BlurTexture.Sample(BorderZeroSampler, In.vTexcoord).xyz;
|
||||
float4 vBloom = g_BlurTexture.Sample(BorderZeroSampler, In.vTexcoord);
|
||||
Out.vFirstTarget = vColor;
|
||||
Out.vFirstTarget += float4(vBloom, 1.f);
|
||||
Out.vFirstTarget += vBloom;
|
||||
|
||||
return Out;
|
||||
}
|
||||
@@ -1361,4 +1382,24 @@ technique11 DefaultTechnique
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_SSAO_BLUR();
|
||||
}
|
||||
|
||||
pass MotionBlurPass // 18
|
||||
{
|
||||
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_MOTIONBLUR_X();
|
||||
}
|
||||
pass DownSamplePass // 19
|
||||
{
|
||||
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_CAPTURE();
|
||||
GeometryShader = NULL;
|
||||
PixelShader = compile ps_5_0 PS_MAIN_DOWNSAMPLE();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
float PI = 3.141592;
|
||||
|
||||
struct KeyFrame
|
||||
{
|
||||
float3 vScale;
|
||||
@@ -17,104 +15,402 @@ struct Channel
|
||||
|
||||
struct LocalPos
|
||||
{
|
||||
float3 Scale;
|
||||
float pad0;
|
||||
|
||||
float4 Rotation;
|
||||
|
||||
float3 Translation;
|
||||
float pad1;
|
||||
row_major float4x4 Local;
|
||||
row_major float4x4 Combined;
|
||||
row_major float4x4 LocalCombined;
|
||||
};
|
||||
|
||||
struct BoneLocal
|
||||
{
|
||||
row_major float4x4 BoneLocal;
|
||||
};
|
||||
|
||||
StructuredBuffer<KeyFrame> g_KeyFrameBuffer : register(t0);
|
||||
StructuredBuffer<Channel> g_ChannelBuffer : register(t1);
|
||||
StructuredBuffer<KeyFrame> g_PrevKeyFrameBuffer : register(t2);
|
||||
StructuredBuffer<Channel> g_PrevChannelBuffer : register(t3);
|
||||
StructuredBuffer<int> g_ParentBuffer : register(t4);
|
||||
StructuredBuffer<BoneLocal> g_BoneLocalBuffer : register(t5);
|
||||
StructuredBuffer<uint> g_BoneRemap : register(t6);
|
||||
|
||||
RWStructuredBuffer<LocalPos> g_LocalPosOutput : register(u0);
|
||||
|
||||
|
||||
cbuffer AnimCB : register(b0)
|
||||
{
|
||||
float CurrentTime;
|
||||
float Duration;
|
||||
float Speed;
|
||||
int MeshBoneCount;
|
||||
int BoneCount;
|
||||
|
||||
int RootBoneIndex;
|
||||
int padding1;
|
||||
float PrevTime;
|
||||
float BlendRatio;
|
||||
|
||||
row_major float4x4 PreTransformMatrix;
|
||||
float4 RootInitRot;
|
||||
};
|
||||
|
||||
float4 quatSlerp(float4 q1, float4 q2, float t)
|
||||
static const float EPS = 1e-6f;
|
||||
|
||||
float4 QuatNormalize(float4 q)
|
||||
{
|
||||
float cosTheta = dot(q1, q2);
|
||||
return q * rsqrt(max(dot(q, q), EPS));
|
||||
}
|
||||
|
||||
float4 QuatSlerp(float4 a, float4 b, float t)
|
||||
{
|
||||
a = QuatNormalize(a);
|
||||
b = QuatNormalize(b);
|
||||
|
||||
float cosTheta = dot(a, b);
|
||||
|
||||
if (cosTheta < 0.0f)
|
||||
{
|
||||
q2 = -q2;
|
||||
b = -b;
|
||||
cosTheta = -cosTheta;
|
||||
}
|
||||
|
||||
if (cosTheta > 0.9995f)
|
||||
return normalize(lerp(q1, q2, t));
|
||||
return QuatNormalize(lerp(a, b, t));
|
||||
|
||||
float theta = acos(cosTheta);
|
||||
float sinTheta = sin(theta);
|
||||
float theta = acos(saturate(cosTheta));
|
||||
float sinTheta = max(sin(theta), EPS);
|
||||
|
||||
float w1 = sin((1.0f - t) * theta) / sinTheta;
|
||||
float w2 = sin(t * theta) / sinTheta;
|
||||
float w0 = sin((1.0f - t) * theta) / sinTheta;
|
||||
float w1 = sin(t * theta) / sinTheta;
|
||||
|
||||
return q1 * w1 + q2 * w2;
|
||||
return a * w0 + b * w1;
|
||||
}
|
||||
|
||||
float4x4 MakeAffine(float3 scale, float4 rot, float3 trans)
|
||||
{
|
||||
rot = QuatNormalize(rot);
|
||||
|
||||
float xx = rot.x * rot.x;
|
||||
float yy = rot.y * rot.y;
|
||||
float zz = rot.z * rot.z;
|
||||
float xy = rot.x * rot.y;
|
||||
float xz = rot.x * rot.z;
|
||||
float yz = rot.y * rot.z;
|
||||
float wx = rot.w * rot.x;
|
||||
float wy = rot.w * rot.y;
|
||||
float wz = rot.w * rot.z;
|
||||
|
||||
float4x4 M;
|
||||
|
||||
M._11 = (1 - 2 * (yy + zz)) * scale.x;
|
||||
M._12 = (2 * (xy + wz)) * scale.x;
|
||||
M._13 = (2 * (xz - wy)) * scale.x;
|
||||
M._14 = 0;
|
||||
|
||||
M._21 = (2 * (xy - wz)) * scale.y;
|
||||
M._22 = (1 - 2 * (xx + zz)) * scale.y;
|
||||
M._23 = (2 * (yz + wx)) * scale.y;
|
||||
M._24 = 0;
|
||||
|
||||
M._31 = (2 * (xz + wy)) * scale.z;
|
||||
M._32 = (2 * (yz - wx)) * scale.z;
|
||||
M._33 = (1 - 2 * (xx + yy)) * scale.z;
|
||||
M._34 = 0;
|
||||
|
||||
M._41 = trans.x;
|
||||
M._42 = trans.y;
|
||||
M._43 = trans.z;
|
||||
M._44 = 1;
|
||||
|
||||
return M;
|
||||
}
|
||||
|
||||
uint FindKeyIndexCur(uint start, uint count, float t)
|
||||
{
|
||||
uint lo = 0;
|
||||
uint hi = count - 1;
|
||||
|
||||
float t0 = g_KeyFrameBuffer[start + 0].fTrackPosition;
|
||||
if (t <= t0)
|
||||
return 0;
|
||||
|
||||
float tLast = g_KeyFrameBuffer[start + hi].fTrackPosition;
|
||||
if (t >= tLast)
|
||||
return hi - 1;
|
||||
|
||||
while (hi - lo > 1)
|
||||
{
|
||||
uint mid = (lo + hi) >> 1;
|
||||
float tm = g_KeyFrameBuffer[start + mid].fTrackPosition;
|
||||
if (t < tm)
|
||||
hi = mid;
|
||||
else
|
||||
lo = mid;
|
||||
}
|
||||
return lo;
|
||||
}
|
||||
|
||||
uint FindKeyIndexPrev(uint start, uint count, float t)
|
||||
{
|
||||
uint lo = 0;
|
||||
uint hi = count - 1;
|
||||
|
||||
float t0 = g_PrevKeyFrameBuffer[start + 0].fTrackPosition;
|
||||
if (t <= t0)
|
||||
return 0;
|
||||
|
||||
float tLast = g_PrevKeyFrameBuffer[start + hi].fTrackPosition;
|
||||
if (t >= tLast)
|
||||
return hi - 1;
|
||||
|
||||
while (hi - lo > 1)
|
||||
{
|
||||
uint mid = (lo + hi) >> 1;
|
||||
float tm = g_PrevKeyFrameBuffer[start + mid].fTrackPosition;
|
||||
if (t < tm)
|
||||
hi = mid;
|
||||
else
|
||||
lo = mid;
|
||||
}
|
||||
return lo;
|
||||
}
|
||||
|
||||
|
||||
[numthreads(256, 1, 1)]
|
||||
void CS_LocalSRT(uint3 DTID : SV_DispatchThreadID)
|
||||
float3 GetRow3(float4 v)
|
||||
{
|
||||
uint boneIndex = DTID.x;
|
||||
if (boneIndex >= (uint) BoneCount)
|
||||
return;
|
||||
|
||||
float time = CurrentTime;
|
||||
|
||||
Channel channel = g_ChannelBuffer[boneIndex];
|
||||
return v.xyz;
|
||||
}
|
||||
|
||||
LocalPos result;
|
||||
|
||||
uint firstIndex = channel.StartIndex;
|
||||
uint keyCount = channel.KeyCount;
|
||||
uint lastIndex = firstIndex + keyCount - 1;
|
||||
float4x4 SampleLocalPrev(uint bone, float t)
|
||||
{
|
||||
Channel ch = g_PrevChannelBuffer[bone];
|
||||
if (ch.KeyCount == 0)
|
||||
return g_BoneLocalBuffer[bone].BoneLocal;
|
||||
|
||||
KeyFrame keyLast = g_KeyFrameBuffer[lastIndex];
|
||||
uint start = ch.StartIndex;
|
||||
uint count = ch.KeyCount;
|
||||
|
||||
if (time >= keyLast.fTrackPosition)
|
||||
if (count == 1)
|
||||
{
|
||||
result.Scale = keyLast.vScale;
|
||||
result.Rotation = keyLast.vRotation;
|
||||
result.Translation = keyLast.vTranslation;
|
||||
result.pad0 = result.pad1 = 0.0f;
|
||||
KeyFrame k = g_PrevKeyFrameBuffer[start];
|
||||
float3 trans = k.vTranslation;
|
||||
float4 rot = k.vRotation;
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
trans = 0;
|
||||
rot = RootInitRot;
|
||||
}
|
||||
return MakeAffine(k.vScale, rot, trans);
|
||||
}
|
||||
|
||||
uint i0 = FindKeyIndexPrev(start, count, t);
|
||||
uint i1 = i0 + 1;
|
||||
|
||||
KeyFrame k0 = g_PrevKeyFrameBuffer[start + i0];
|
||||
KeyFrame k1 = g_PrevKeyFrameBuffer[start + i1];
|
||||
|
||||
float denom = max(EPS, (k1.fTrackPosition - k0.fTrackPosition));
|
||||
float ratio = saturate((t - k0.fTrackPosition) / denom);
|
||||
|
||||
float3 scale = lerp(k0.vScale, k1.vScale, ratio);
|
||||
float3 trans = lerp(k0.vTranslation, k1.vTranslation, ratio);
|
||||
float4 rot = QuatSlerp(k0.vRotation, k1.vRotation, ratio);
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
trans = 0;
|
||||
rot = RootInitRot;
|
||||
}
|
||||
return MakeAffine(scale, rot, trans);
|
||||
}
|
||||
|
||||
float4x4 SampleLocal(uint bone, float t)
|
||||
{
|
||||
Channel ch = g_ChannelBuffer[bone];
|
||||
if (ch.KeyCount == 0)
|
||||
return g_BoneLocalBuffer[bone].BoneLocal;
|
||||
|
||||
uint start = ch.StartIndex;
|
||||
uint count = ch.KeyCount;
|
||||
|
||||
if (count == 1)
|
||||
{
|
||||
KeyFrame k = g_KeyFrameBuffer[start];
|
||||
float3 trans = k.vTranslation;
|
||||
float4 rot = k.vRotation;
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
trans = 0;
|
||||
rot = RootInitRot;
|
||||
}
|
||||
return MakeAffine(k.vScale, rot, trans);
|
||||
}
|
||||
|
||||
uint i0 = FindKeyIndexCur(start, count, t);
|
||||
uint i1 = i0 + 1;
|
||||
|
||||
KeyFrame k0 = g_KeyFrameBuffer[start + i0];
|
||||
KeyFrame k1 = g_KeyFrameBuffer[start + i1];
|
||||
|
||||
float denom = max(EPS, (k1.fTrackPosition - k0.fTrackPosition));
|
||||
float ratio = saturate((t - k0.fTrackPosition) / denom);
|
||||
|
||||
float3 scale = lerp(k0.vScale, k1.vScale, ratio);
|
||||
float3 trans = lerp(k0.vTranslation, k1.vTranslation, ratio);
|
||||
float4 rot = QuatSlerp(k0.vRotation, k1.vRotation, ratio);
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
trans = 0;
|
||||
rot = RootInitRot;
|
||||
}
|
||||
return MakeAffine(scale, rot, trans);
|
||||
}
|
||||
void SampleLocalTRS_Cur(uint bone, float t, out float3 S, out float4 R, out float3 T)
|
||||
{
|
||||
Channel ch = g_ChannelBuffer[bone];
|
||||
|
||||
if (ch.KeyCount == 0)
|
||||
{
|
||||
S = float3(1, 1, 1);
|
||||
R = float4(0, 0, 0, 1);
|
||||
T = float3(0, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
uint start = ch.StartIndex;
|
||||
uint count = ch.KeyCount;
|
||||
|
||||
if (count == 1)
|
||||
{
|
||||
KeyFrame k = g_KeyFrameBuffer[start];
|
||||
S = k.vScale;
|
||||
R = QuatNormalize(k.vRotation);
|
||||
T = k.vTranslation;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (uint i = 0; i < keyCount - 1; ++i)
|
||||
{
|
||||
KeyFrame Sour = g_KeyFrameBuffer[firstIndex + i];
|
||||
KeyFrame Dest = g_KeyFrameBuffer[firstIndex + i + 1];
|
||||
uint i0 = FindKeyIndexCur(start, count, t);
|
||||
uint i1 = i0 + 1;
|
||||
|
||||
if (time >= Sour.fTrackPosition && time <= Dest.fTrackPosition)
|
||||
{
|
||||
float ratio = (time - Sour.fTrackPosition) /
|
||||
(Dest.fTrackPosition - Sour.fTrackPosition);
|
||||
KeyFrame k0 = g_KeyFrameBuffer[start + i0];
|
||||
KeyFrame k1 = g_KeyFrameBuffer[start + i1];
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
float denom = max(EPS, (k1.fTrackPosition - k0.fTrackPosition));
|
||||
float ratio = saturate((t - k0.fTrackPosition) / denom);
|
||||
|
||||
S = lerp(k0.vScale, k1.vScale, ratio);
|
||||
T = lerp(k0.vTranslation, k1.vTranslation, ratio);
|
||||
R = QuatSlerp(k0.vRotation, k1.vRotation, ratio);
|
||||
}
|
||||
|
||||
g_LocalPosOutput[channel.BoneIndex] = result;
|
||||
return;
|
||||
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
T = 0;
|
||||
R = RootInitRot;
|
||||
}
|
||||
}
|
||||
|
||||
void SampleLocalTRS_Prev(uint bone, float t, out float3 S, out float4 R, out float3 T)
|
||||
{
|
||||
Channel ch = g_PrevChannelBuffer[bone];
|
||||
|
||||
if (ch.KeyCount == 0)
|
||||
{
|
||||
S = float3(1, 1, 1);
|
||||
R = float4(0, 0, 0, 1);
|
||||
T = float3(0, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
uint start = ch.StartIndex;
|
||||
uint count = ch.KeyCount;
|
||||
|
||||
if (count == 1)
|
||||
{
|
||||
KeyFrame k = g_PrevKeyFrameBuffer[start];
|
||||
S = k.vScale;
|
||||
R = QuatNormalize(k.vRotation);
|
||||
T = k.vTranslation;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint i0 = FindKeyIndexPrev(start, count, t);
|
||||
uint i1 = i0 + 1;
|
||||
|
||||
KeyFrame k0 = g_PrevKeyFrameBuffer[start + i0];
|
||||
KeyFrame k1 = g_PrevKeyFrameBuffer[start + i1];
|
||||
|
||||
float denom = max(EPS, (k1.fTrackPosition - k0.fTrackPosition));
|
||||
float ratio = saturate((t - k0.fTrackPosition) / denom);
|
||||
|
||||
S = lerp(k0.vScale, k1.vScale, ratio);
|
||||
T = lerp(k0.vTranslation, k1.vTranslation, ratio);
|
||||
R = QuatSlerp(k0.vRotation, k1.vRotation, ratio);
|
||||
}
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
T = 0;
|
||||
R = RootInitRot;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
float4x4 SampleBlendedLocal(uint bone)
|
||||
{
|
||||
float br = saturate(BlendRatio);
|
||||
|
||||
if (br <= 0.0f)
|
||||
return SampleLocalPrev(bone, PrevTime);
|
||||
if (br >= 1.0f)
|
||||
return SampleLocal(bone, CurrentTime);
|
||||
|
||||
float3 sA, sB, tA, tB;
|
||||
float4 rA, rB;
|
||||
|
||||
SampleLocalTRS_Prev(bone, PrevTime, sA, rA, tA);
|
||||
SampleLocalTRS_Cur(bone, CurrentTime, sB, rB, tB);
|
||||
|
||||
float3 s = lerp(sA, sB, br);
|
||||
float3 t = lerp(tA, tB, br);
|
||||
float4 r = QuatSlerp(rA, rB, br);
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
t = 0;
|
||||
r = RootInitRot;
|
||||
}
|
||||
|
||||
return MakeAffine(s, r, t);
|
||||
}
|
||||
|
||||
[numthreads(256, 1, 1)]
|
||||
void CS_MAIN(uint3 DTid : SV_DispatchThreadID)
|
||||
{
|
||||
uint globalBone = DTid.x;
|
||||
if (globalBone >= (uint) BoneCount)
|
||||
return;
|
||||
|
||||
float4x4 localMat = SampleBlendedLocal(globalBone);
|
||||
g_LocalPosOutput[globalBone].Local = localMat;
|
||||
|
||||
float4x4 combined = localMat;
|
||||
int p = g_ParentBuffer[globalBone];
|
||||
while (p != -1)
|
||||
{
|
||||
combined = mul(combined, SampleBlendedLocal((uint) p));
|
||||
p = g_ParentBuffer[p];
|
||||
}
|
||||
|
||||
combined = mul(combined, PreTransformMatrix);
|
||||
g_LocalPosOutput[globalBone].Combined = combined;
|
||||
|
||||
for (uint local = 0; local < (uint) MeshBoneCount; ++local)
|
||||
{
|
||||
if (g_BoneRemap[local] == globalBone)
|
||||
{
|
||||
g_LocalPosOutput[local].LocalCombined = combined;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -212,6 +212,7 @@ call Update_Lib.bat
|
||||
<ClCompile Include="..\private\Font_Manager.cpp" />
|
||||
<ClCompile Include="..\private\QuadTree.cpp" />
|
||||
<ClCompile Include="..\private\OcclusionQuery.cpp" />
|
||||
<ClCompile Include="..\private\Quest.cpp" />
|
||||
<ClCompile Include="..\Private\Renderer_Declare.cpp" />
|
||||
<ClCompile Include="..\private\Resource_Manager.cpp" />
|
||||
<ClCompile Include="..\Private\RigidBody_Dynamic_Joint.cpp">
|
||||
@@ -434,6 +435,7 @@ call Update_Lib.bat
|
||||
<ClInclude Include="..\public\FSM.h" />
|
||||
<ClInclude Include="..\public\QuadTree.h" />
|
||||
<ClInclude Include="..\public\OcclusionQuery.h" />
|
||||
<ClInclude Include="..\public\Quest.h" />
|
||||
<ClInclude Include="..\public\Resource_Manager.h" />
|
||||
<ClInclude Include="..\Public\RigidBody_Dynamic_Joint.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
|
||||
@@ -304,6 +304,9 @@
|
||||
<Filter Include="02.Element\02.Component\12.Stat\Event">
|
||||
<UniqueIdentifier>{b31a93a4-8bba-4e94-8008-bbb9b458a55e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.Element\01.GameObject\51.Quest">
|
||||
<UniqueIdentifier>{5e5c6c23-470f-4e7a-93e0-303e5171f4fd}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Private\Base.cpp">
|
||||
@@ -582,6 +585,9 @@
|
||||
<ClCompile Include="..\Private\StatEvent.cpp">
|
||||
<Filter>02.Element\02.Component\12.Stat\Event</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\private\Quest.cpp">
|
||||
<Filter>02.Element\01.GameObject\51.Quest</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Public\Base.h">
|
||||
@@ -1226,6 +1232,9 @@
|
||||
<ClInclude Include="..\Public\StatEvent.h">
|
||||
<Filter>02.Element\02.Component\12.Stat\Event</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\Quest.h">
|
||||
<Filter>02.Element\01.GameObject\51.Quest</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\Public\Assimp\color4.inl">
|
||||
|
||||
@@ -34,7 +34,7 @@ CAnimation::CAnimation(const CAnimation& rhs)
|
||||
SAFE_ADDREF(pChannel);
|
||||
}
|
||||
}
|
||||
_bool CAnimation::Update_TransformationMatrices(const vector<class CBone*>& Bones, LOCALPOS_DESC** pLocalPosArray, _bool bIsLoop, _float fTimeDelta, _bool bIsSpine, vector<_uint> BoneMask,_vector vector[3])
|
||||
_bool CAnimation::Update_TransformationMatrices(const vector<class CBone*>& Bones, _bool bIsLoop, _float fTimeDelta, _bool bIsSpine, vector<_uint> BoneMask,_vector vector[3], _int RootBoneIndex)
|
||||
{
|
||||
m_fTempTrack += fTimeDelta * m_fAnimSpeed;
|
||||
m_fProgress = m_fTickPerSecond * fTimeDelta * m_fAnimSpeed;
|
||||
@@ -50,24 +50,16 @@ _bool CAnimation::Update_TransformationMatrices(const vector<class CBone*>& Bone
|
||||
Depart_Animation();
|
||||
m_fCurrentTrackPosition = m_fProgress;
|
||||
m_fTempTrack = 0.f;
|
||||
ResetRootMotion();
|
||||
ProgressAnimation(Bones, pLocalPosArray, bIsSpine, BoneMask, vector);
|
||||
ProgressAnimation(Bones, bIsSpine, BoneMask, vector, RootBoneIndex);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
ProgressAnimation(Bones, pLocalPosArray, bIsSpine, BoneMask, vector);
|
||||
ProgressAnimation(Bones, bIsSpine, BoneMask, vector, RootBoneIndex);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CAnimation::ResetRootMotion()
|
||||
{
|
||||
for (auto& pChannel : m_Channels){
|
||||
pChannel->ResetRootMotion();
|
||||
}
|
||||
}
|
||||
|
||||
void CAnimation::Depart_Animation()
|
||||
{
|
||||
m_fCurrentTrackPosition = 0.f;
|
||||
@@ -346,7 +338,6 @@ void CAnimation::CreateGPUData(ID3D11Device* pDevice)
|
||||
|
||||
CreateKeyFrameBuffer(pDevice, keyframes);
|
||||
CreateChannelBuffer(pDevice, channels);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -429,14 +420,14 @@ HRESULT CAnimation::Initialize(const vector<CBone*>& Bones, const CModel* pModel
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CAnimation::ProgressAnimation(const vector<CBone*>& Bones, LOCALPOS_DESC** pLocalPosArray, _bool bIsSpine,vector<_uint>BoneMask,_vector vector[3])
|
||||
void CAnimation::ProgressAnimation(const vector<CBone*>& Bones, _bool bIsSpine,vector<_uint>BoneMask,_vector vector[3], _int RootBoneIndex)
|
||||
{
|
||||
_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++], bIsSpine, BoneMask, vector);
|
||||
pChannel->Update_TransformationMatirx(Bones, m_fCurrentTrackPosition, &m_CurrentKeyFrameIndices[iIndex++], bIsSpine, BoneMask, vector,RootBoneIndex);
|
||||
m_vBoneTransformationMatrix.push_back(pChannel->Get_BoneTransformationMatrix());
|
||||
}
|
||||
}
|
||||
@@ -474,7 +465,7 @@ HRESULT CAnimation::CreateKeyFrameBuffer(ID3D11Device* pDevice,vector<KEYFRAME_D
|
||||
|
||||
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFEREX;
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
|
||||
srvDesc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
srvDesc.Buffer.FirstElement = 0;
|
||||
srvDesc.Buffer.NumElements = m_iKeyframeCount;
|
||||
@@ -490,7 +481,7 @@ HRESULT CAnimation::CreateChannelBuffer(ID3D11Device* pDevice, vector<CHANNEL_DE
|
||||
{
|
||||
D3D11_BUFFER_DESC desc{};
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.ByteWidth = (_int)sizeof(CHANNEL_DESC) * m_iChannelCount;
|
||||
desc.ByteWidth = (_int)sizeof(CHANNEL_DESC) * m_iBoneCount;
|
||||
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.StructureByteStride = (_int)sizeof(CHANNEL_DESC);
|
||||
@@ -503,10 +494,10 @@ HRESULT CAnimation::CreateChannelBuffer(ID3D11Device* pDevice, vector<CHANNEL_DE
|
||||
|
||||
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFEREX;
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
|
||||
srvDesc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
srvDesc.Buffer.FirstElement = 0;
|
||||
srvDesc.Buffer.NumElements = m_iChannelCount;
|
||||
srvDesc.Buffer.NumElements = m_iBoneCount;
|
||||
|
||||
if (FAILED(pDevice->CreateShaderResourceView(m_pChannelBuffer, &srvDesc, &m_pChannelSrv)))
|
||||
return E_FAIL;
|
||||
|
||||
@@ -113,115 +113,92 @@ HRESULT CChannel::Initialize(const vector<CBone*>& Bones, _uint iIndex)
|
||||
|
||||
void CChannel::Update_TransformationMatirx(
|
||||
const vector<CBone*>& Bones,
|
||||
LOCALPOS_DESC** pLocalPosArray,
|
||||
_float fCurrentTrackPosition,
|
||||
_uint* pCurrentKeyFrameIndex,
|
||||
_bool bIsSpine,
|
||||
vector<_uint> BoneMask,
|
||||
_vector vector[3])
|
||||
_vector vector[3],
|
||||
_int RootBoneIndex)
|
||||
{
|
||||
|
||||
if (0.f == fCurrentTrackPosition)
|
||||
*pCurrentKeyFrameIndex = 0;
|
||||
|
||||
KEYFRAME LastKeyFrame = m_KeyFrames.back();
|
||||
|
||||
_vector vScale{};
|
||||
_vector vRotation{};
|
||||
_vector vTranslation{};
|
||||
|
||||
if (fCurrentTrackPosition >= LastKeyFrame.fTrackPosition)
|
||||
if (m_iBoneIndex == RootBoneIndex ||Bones[m_iBoneIndex]->IsCPUEvaluated())
|
||||
{
|
||||
vScale = XMLoadFloat3(&LastKeyFrame.vScale);
|
||||
vRotation = XMLoadFloat4(&LastKeyFrame.vRotation);
|
||||
vTranslation = XMVectorSetW(XMLoadFloat3(&LastKeyFrame.vTranslation), 1.f);
|
||||
}
|
||||
if (0.f == fCurrentTrackPosition)
|
||||
*pCurrentKeyFrameIndex = 0;
|
||||
|
||||
else
|
||||
{
|
||||
while (fCurrentTrackPosition >= m_KeyFrames[*pCurrentKeyFrameIndex + 1].fTrackPosition)
|
||||
++*pCurrentKeyFrameIndex;
|
||||
KEYFRAME LastKeyFrame = m_KeyFrames.back();
|
||||
|
||||
_float3 vSourScale{}, vDestScale{};
|
||||
_float4 vSourRotation{}, vDestRotation{};
|
||||
_float3 vSourTranslation{}, vDestTranslation{};
|
||||
_vector vScale{};
|
||||
_vector vRotation{};
|
||||
_vector vTranslation{};
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
if (!bIsSpine)
|
||||
{
|
||||
m_IsUpper = BoneMask[m_iBoneIndex];
|
||||
m_ilayerIndex = m_IsUpper ? 1 : 0;
|
||||
//LocalPos = pLocalPosArray[m_ilayerIndex][m_iBoneIndex];
|
||||
}
|
||||
else
|
||||
{
|
||||
//LocalPos = pLocalPosArray[0][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);*/
|
||||
|
||||
if (Bones[m_iBoneIndex]->Compare_Name("Reference")|| Bones[m_iBoneIndex]->Compare_Name("root"))
|
||||
{
|
||||
if (vector)
|
||||
if (fCurrentTrackPosition >= LastKeyFrame.fTrackPosition)
|
||||
{
|
||||
vector[0] = vScale;
|
||||
vector[1] = vRotation;
|
||||
vector[2] = vTranslation;
|
||||
vScale = XMLoadFloat3(&LastKeyFrame.vScale);
|
||||
vRotation = XMLoadFloat4(&LastKeyFrame.vRotation);
|
||||
vTranslation = XMVectorSetW(XMLoadFloat3(&LastKeyFrame.vTranslation), 1.f);
|
||||
}
|
||||
}
|
||||
|
||||
if (bIsSpine)
|
||||
{
|
||||
m_BoneTransformationMatrix =
|
||||
XMMatrixAffineTransformation(vScale, XMVectorSet(0.f, 0.f, 0.f, 1.f), vRotation, vTranslation);
|
||||
else
|
||||
{
|
||||
while (fCurrentTrackPosition >= m_KeyFrames[*pCurrentKeyFrameIndex + 1].fTrackPosition)
|
||||
++*pCurrentKeyFrameIndex;
|
||||
|
||||
Bones[m_iBoneIndex]->Set_TransformationMatrix(m_BoneTransformationMatrix);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_ilayerIndex == 1)
|
||||
_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);
|
||||
|
||||
}
|
||||
if (!bIsSpine)
|
||||
{
|
||||
m_IsUpper = BoneMask[m_iBoneIndex];
|
||||
m_ilayerIndex = m_IsUpper ? 1 : 0;
|
||||
}
|
||||
if (m_iBoneIndex == RootBoneIndex)
|
||||
{
|
||||
if (vector)
|
||||
{
|
||||
vector[0] = vScale;
|
||||
vector[1] = vRotation;
|
||||
vector[2] = vTranslation;
|
||||
}
|
||||
}
|
||||
|
||||
if (bIsSpine)
|
||||
{
|
||||
m_BoneTransformationMatrix =
|
||||
XMMatrixAffineTransformation(vScale, XMVectorSet(0.f, 0.f, 0.f, 1.f), vRotation, vTranslation);
|
||||
|
||||
Bones[m_iBoneIndex]->Set_TransformationMatrix(m_BoneTransformationMatrix);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_ilayerIndex == 1)
|
||||
{
|
||||
m_BoneTransformationMatrix =
|
||||
XMMatrixAffineTransformation(vScale, XMVectorSet(0.f, 0.f, 0.f, 1.f), vRotation, vTranslation);
|
||||
|
||||
Bones[m_iBoneIndex]->Set_TransformationMatrix(m_BoneTransformationMatrix);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CChannel::ResetRootMotion()
|
||||
{
|
||||
m_vPrevRootPos = { 0.f, 0.f, 0.f };
|
||||
m_vPrevRootRot = { 0.f,0.f,0.f,0.f };
|
||||
m_bInitialRootRotSaved = false;
|
||||
m_bInitialRootPos = false;
|
||||
}
|
||||
|
||||
|
||||
KEYFRAME* CChannel::Get_Frame(_uint iIndex)
|
||||
{
|
||||
return &m_KeyFrames[iIndex];
|
||||
|
||||
@@ -113,6 +113,34 @@ vector<D3D11_MAPPED_SUBRESOURCE> CComputeShader::Dispatch(_uint iSRVIndex, _uint
|
||||
return StagingSubResources;
|
||||
}
|
||||
|
||||
void CComputeShader::Dispatch_ExternalSRV_UAV(
|
||||
_uint srvStartSlot, _uint uavStartSlot,
|
||||
const _float3& groupCount,
|
||||
ID3D11ShaderResourceView** ppSRVs, _uint srvCount,
|
||||
ID3D11UnorderedAccessView** ppUAVs, _uint uavCount,
|
||||
ID3D11Buffer* pConstantBuffer)
|
||||
{
|
||||
m_pContext->CSSetShader(m_pComputeShader, nullptr, 0);
|
||||
if (pConstantBuffer)
|
||||
m_pContext->CSSetConstantBuffers(0, 1, &pConstantBuffer);
|
||||
|
||||
m_pContext->CSSetShaderResources(srvStartSlot, srvCount, ppSRVs);
|
||||
m_pContext->CSSetUnorderedAccessViews(uavStartSlot, uavCount, ppUAVs, nullptr);
|
||||
|
||||
m_pContext->Dispatch((UINT)groupCount.x, (UINT)groupCount.y, (UINT)groupCount.z);
|
||||
|
||||
ID3D11ShaderResourceView* nullSRV[16] = {};
|
||||
ID3D11UnorderedAccessView* nullUAV[8] = {};
|
||||
m_pContext->CSSetShaderResources(srvStartSlot, srvCount, nullSRV);
|
||||
m_pContext->CSSetUnorderedAccessViews(uavStartSlot, uavCount, nullUAV, nullptr);
|
||||
|
||||
ID3D11Buffer* nullCB = nullptr;
|
||||
m_pContext->CSSetConstantBuffers(0, 1, &nullCB);
|
||||
m_pContext->CSSetShader(nullptr, nullptr, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CComputeShader::Bind_SRV(_uint iIndex)
|
||||
{
|
||||
m_pContext->CSSetShaderResources(iIndex, // 시작슬롯 번호
|
||||
|
||||
@@ -369,7 +369,7 @@ void CGameInstance::Compute_FrameCount()
|
||||
m_fTimer_Render_NonLight = Get_TimeDelta(TEXT("Timer_Render_NonLight"));
|
||||
m_fTimer_Render_Blend = Get_TimeDelta(TEXT("Timer_Render_Blend"));
|
||||
m_fTimer_Render_WeightBlend = Get_TimeDelta(TEXT("Timer_Render_WeightBlend"));
|
||||
m_fTimer_Render_Bloom = Get_TimeDelta(TEXT("Timer_Render_Bloom"));
|
||||
m_fTimer_Render_PostProcessing = Get_TimeDelta(TEXT("Timer_Render_PostProcessing"));
|
||||
m_fTimer_Render_LastColor = Get_TimeDelta(TEXT("Timer_Render_LastColor"));
|
||||
m_fTimer_Render_Tone_Mapping = Get_TimeDelta(TEXT("Timer_Render_Tone_Mapping"));
|
||||
m_fTimer_Render_UI = Get_TimeDelta(TEXT("Timer_Render_UI"));
|
||||
@@ -443,7 +443,7 @@ void CGameInstance::Present_TimeCost() const
|
||||
+ m_fTimer_Render_NonLight
|
||||
+ m_fTimer_Render_Blend
|
||||
+ m_fTimer_Render_WeightBlend
|
||||
+ m_fTimer_Render_Bloom
|
||||
+ m_fTimer_Render_PostProcessing
|
||||
+ m_fTimer_Render_LastColor
|
||||
+ m_fTimer_Render_Tone_Mapping
|
||||
+ m_fTimer_Render_UI
|
||||
@@ -524,9 +524,9 @@ void CGameInstance::Present_TimeCost() const
|
||||
GUI::Text("Render_WeightBlend %d", int(m_fTimer_Render_WeightBlend / fRenderer_Total * 100.f));
|
||||
}
|
||||
{
|
||||
GUI::ProgressBar(m_fTimer_Render_Bloom / fRenderer_Total, ImVec2(200.f, 0.f));
|
||||
GUI::ProgressBar(m_fTimer_Render_PostProcessing / fRenderer_Total, ImVec2(200.f, 0.f));
|
||||
GUI::SameLine(0.f, GUI::GetStyle().ItemInnerSpacing.x);
|
||||
GUI::Text("Render_Bloom %d", int(m_fTimer_Render_Bloom / fRenderer_Total * 100.f));
|
||||
GUI::Text("Render_PostProcessing %d", int(m_fTimer_Render_PostProcessing / fRenderer_Total * 100.f));
|
||||
}
|
||||
{
|
||||
GUI::ProgressBar(m_fTimer_Render_LastColor / fRenderer_Total, ImVec2(200.f, 0.f));
|
||||
@@ -689,6 +689,11 @@ HRESULT CGameInstance::Bind_PreShadowMatrix(CShader* pShader, const _char* pCons
|
||||
return m_pRenderer->Bind_PreShadowMatrix(pShader, pConstants, eType);
|
||||
}
|
||||
|
||||
HRESULT CGameInstance::Bind_PrevMatrix(CShader* pShader, const _char* pConstants, D3DTS eType)
|
||||
{
|
||||
return m_pRenderer->Bind_PrevMatrix(pShader, pConstants, eType);
|
||||
}
|
||||
|
||||
void CGameInstance::Set_Transform(D3DTS eState, _fmatrix TransformStateMatrix)
|
||||
{
|
||||
m_pPipeLine->Set_Transform(eState, TransformStateMatrix);
|
||||
@@ -854,13 +859,13 @@ HRESULT CGameInstance::Bind_RenderTarget(const _wstring& strTargetTag, CShader*
|
||||
return m_pRenderTarget_Manager->Bind_RenderTarget(strTargetTag, pShader, pConstantName);
|
||||
}
|
||||
|
||||
HRESULT CGameInstance::Copy_RenderTarget(const _wstring& strTargetTag, ID3D11Texture2D* pTexture2D)
|
||||
HRESULT CGameInstance::Copy_RenderTargetTo(const _wstring& strTargetTag, ID3D11Texture2D* pTexture2D)
|
||||
{
|
||||
return m_pRenderTarget_Manager->Copy_RenderTarget(strTargetTag, pTexture2D);
|
||||
return m_pRenderTarget_Manager->Copy_RenderTargetTo(strTargetTag, pTexture2D);
|
||||
}
|
||||
HRESULT CGameInstance::Paste_RenderTarget(const _wstring& strTargetTag, ID3D11Texture2D* pTexture2D)
|
||||
HRESULT CGameInstance::Copy_RenderTargetFrom(const _wstring& strTargetTag, ID3D11Texture2D* pTexture2D)
|
||||
{
|
||||
return m_pRenderTarget_Manager->Paste_RenderTarget(strTargetTag, pTexture2D);
|
||||
return m_pRenderTarget_Manager->Copy_RenderTargetFrom(strTargetTag, pTexture2D);
|
||||
}
|
||||
HRESULT CGameInstance::Accumulate_RenderTarget(CVIBuffer_Rect* pVIBuffer, CShader* pShader, const _wstring& wstrRenderTarget_SrcA, const _wstring& wstrRenderTarget_SrcB, const _wstring& wstrRenderTarget_Target, SHADER_PASS_DEFERRED ePass)
|
||||
{
|
||||
@@ -940,8 +945,6 @@ void CGameInstance::Add_ModelToMap(const _char* filePath, CModel* pModel)
|
||||
{
|
||||
m_ModelMap[filePath] = pModel;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
void CGameInstance::Add_SaveModel(const _char* filePath, SaveModel sModel)
|
||||
|
||||
@@ -23,8 +23,9 @@ HRESULT CMesh::Bind_BoneMatrices(const vector<class CBone*>& Bones, CShader* pSh
|
||||
|
||||
for (size_t i = 0; i < m_iNumBones; ++i) {
|
||||
XMStoreFloat4x4(&m_pBoneMatrices[i],
|
||||
XMLoadFloat4x4(&m_offsetMatrices[i]) * Bones[m_BoneIndices[i]]->Get_CombinedTransformationMatrix());
|
||||
/*XMLoadFloat4x4(&m_offsetMatrices[i]) **/ Bones[m_BoneIndices[i]]->Get_CombinedTransformationMatrix());
|
||||
}
|
||||
|
||||
if (0 == m_iNumBones) {
|
||||
return S_OK;
|
||||
}
|
||||
@@ -341,6 +342,7 @@ HRESULT CMesh::Ready_VertexBuffer_For_Anim(const CModel* pModel, SaveMesh* _Save
|
||||
pVertices[i].vTexcoord = _float2(0.f, 0.f);
|
||||
}
|
||||
|
||||
|
||||
m_iNumBones = (_uint)_SaveMesh->Bones.size();
|
||||
|
||||
m_offsetMatrices.reserve(m_iNumBones);
|
||||
@@ -363,6 +365,7 @@ HRESULT CMesh::Ready_VertexBuffer_For_Anim(const CModel* pModel, SaveMesh* _Save
|
||||
if (-1 == iBoneIndex)
|
||||
return E_FAIL;
|
||||
|
||||
m_BoneRemap.push_back((_uint)iBoneIndex);
|
||||
m_BoneIndices.push_back(iBoneIndex);
|
||||
m_offsetMatrices.push_back(OffsetMatrix);
|
||||
|
||||
@@ -409,12 +412,43 @@ HRESULT CMesh::Ready_VertexBuffer_For_Anim(const CModel* pModel, SaveMesh* _Save
|
||||
if (FAILED(m_pDevice->CreateBuffer(&VBDesc, &InitialVBData, &m_pVB)))
|
||||
return E_FAIL;
|
||||
|
||||
Create_BoneRemapBuffer();
|
||||
|
||||
|
||||
Safe_Delete_Array(pVertices);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CMesh::Create_BoneRemapBuffer()
|
||||
{
|
||||
D3D11_BUFFER_DESC desc{};
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.ByteWidth = sizeof(_uint) * (_uint)m_BoneRemap.size();
|
||||
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.StructureByteStride = sizeof(_uint);
|
||||
desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
|
||||
|
||||
D3D11_SUBRESOURCE_DATA init{};
|
||||
init.pSysMem = m_BoneRemap.data();
|
||||
|
||||
m_pDevice->CreateBuffer(&desc, &init, &m_pBoneRemapBuffer);
|
||||
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc{};
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
|
||||
srvDesc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
srvDesc.Buffer.FirstElement = 0;
|
||||
srvDesc.Buffer.NumElements = (_uint)m_BoneRemap.size();
|
||||
|
||||
m_pDevice->CreateShaderResourceView(
|
||||
m_pBoneRemapBuffer,
|
||||
&srvDesc,
|
||||
&m_pBoneRemapSRV);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CMesh::Initialize(void* pArg)
|
||||
{
|
||||
@@ -642,6 +676,8 @@ void CMesh::Free()
|
||||
{
|
||||
__super::Free();
|
||||
|
||||
SAFE_RELEASE(m_pBoneRemapBuffer);
|
||||
SAFE_RELEASE(m_pBoneRemapSRV);
|
||||
Safe_Delete_Array(m_pBoneMatrices);
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
|
||||
@@ -146,14 +146,6 @@ _bool CModel::Play_Animation(_float fTimeDelta, CTransform* pTransform)
|
||||
|
||||
_bool CModel::Play_Anim(_float fTimeDelta, CTransform* pTransform)
|
||||
{
|
||||
/*if (m_bLoopRestarted)
|
||||
{
|
||||
m_vPrevRootPos = { 0,0,0 };
|
||||
m_bLoopRestarted = false;
|
||||
}*/
|
||||
|
||||
//ComputeAnimation(m_iCurrentAnimIndex);
|
||||
|
||||
if (m_iPreAnimIndex >= 0 && m_iPreAnimIndex != m_iCurrentAnimIndex)
|
||||
{
|
||||
m_fBlendTime += fTimeDelta;
|
||||
@@ -165,9 +157,7 @@ _bool CModel::Play_Anim(_float fTimeDelta, CTransform* pTransform)
|
||||
CAnimation* pCurAnim = m_Animations[m_iCurrentAnimIndex];
|
||||
CAnimation* pPreAnim = m_Animations[m_iPreAnimIndex];
|
||||
|
||||
m_bIsFinishedAnim = pCurAnim->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsLoop, fTimeDelta, true, m_iBoneMask, m_vector);
|
||||
|
||||
pCurAnim->InterpAnim(pPreAnim, m_Bones, m_fRatio);
|
||||
m_bIsFinishedAnim = pCurAnim->Update_TransformationMatrices(m_Bones, m_bIsLoop, fTimeDelta, true, m_iBoneMask, m_vector,m_iRootBoneIndex);
|
||||
|
||||
if (m_fRatio >= 1.f)
|
||||
{
|
||||
@@ -177,11 +167,17 @@ _bool CModel::Play_Anim(_float fTimeDelta, CTransform* pTransform)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsLoop, fTimeDelta, true, m_iBoneMask, m_vector);
|
||||
m_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_bIsLoop, fTimeDelta, true, m_iBoneMask, m_vector, m_iRootBoneIndex);
|
||||
|
||||
m_iPreAnimIndex = m_iCurrentAnimIndex;
|
||||
}
|
||||
|
||||
|
||||
for (_uint i = 0; i < Get_NumMeshes(); i++)
|
||||
{
|
||||
ComputeAnimation(m_iCurrentAnimIndex, i);
|
||||
}
|
||||
|
||||
|
||||
if (m_bIsFinishedAnim)
|
||||
{
|
||||
if (m_bIsLoop)
|
||||
@@ -208,25 +204,29 @@ _bool CModel::Play_Anim(_float fTimeDelta, CTransform* pTransform)
|
||||
m_bInitialRootRotSaved = false;
|
||||
}
|
||||
|
||||
for (auto& pBone : m_Bones)
|
||||
m_Bones[m_iRootBoneIndex]->Update_CombinedTransformationMatrix(m_Bones, XMLoadFloat4x4(&m_PreTransformMatrix));
|
||||
|
||||
for (_uint i = 0; i < m_Bones.size(); ++i)
|
||||
{
|
||||
pBone->Update_CombinedTransformationMatrix(m_Bones, XMLoadFloat4x4(&m_PreTransformMatrix));
|
||||
if (m_Bones[i]->IsCPUEvaluated())
|
||||
{
|
||||
if (i == m_iRootBoneIndex)
|
||||
continue;
|
||||
|
||||
m_Bones[i]->Update_CombinedTransformationMatrix(
|
||||
m_Bones,
|
||||
XMLoadFloat4x4(&m_PreTransformMatrix)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
BeginFrame();
|
||||
|
||||
return m_bIsFinishedAnim;
|
||||
}
|
||||
|
||||
_bool CModel::Play_Dual_Anim(_float fTimeDelta, CTransform* pTransform)
|
||||
{
|
||||
/*if (m_bLoopRestarted)
|
||||
{
|
||||
m_vPrevRootPos = { 0,0,0 };
|
||||
m_bLoopRestarted = false;
|
||||
}*/
|
||||
|
||||
//ComputeAnimation(m_iCurrentAnimIndex);
|
||||
//ComputeAnimation_Second(m_iCurrSecondAnimIndex);
|
||||
|
||||
if (m_iPreAnimIndex >= 0 && m_iPreAnimIndex != m_iCurrentAnimIndex)
|
||||
{
|
||||
m_fBlendTime += fTimeDelta;
|
||||
@@ -242,12 +242,10 @@ _bool CModel::Play_Dual_Anim(_float fTimeDelta, CTransform* pTransform)
|
||||
|
||||
CAnimation* pSecondAnim = m_Animations[m_iCurrSecondAnimIndex];
|
||||
|
||||
m_bIsFinishedAnim = pCurAnim->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsLoop, fTimeDelta, true, m_iBoneMask, m_vector);
|
||||
pCurAnim->InterpAnim(pPreAnim, m_Bones, m_fRatio);
|
||||
m_bIsFinishedAnim = pCurAnim->Update_TransformationMatrices(m_Bones, m_bIsLoop, fTimeDelta, true, m_iBoneMask, m_vector, m_iRootBoneIndex);
|
||||
|
||||
m_bIsSecondFinishedAnim = pSecondAnim->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsSecondLoop, fTimeDelta, false, m_iBoneMask);
|
||||
m_bIsSecondFinishedAnim = pSecondAnim->Update_TransformationMatrices(m_Bones, m_bIsSecondLoop, fTimeDelta, false, m_iBoneMask,nullptr, m_iRootBoneIndex);
|
||||
|
||||
pSecondAnim->InterpSecondAnim(pCurAnim, m_iBoneMask, m_Bones, m_fSecondRatio);
|
||||
if (m_fRatio >= 1.f)
|
||||
{
|
||||
m_iPreAnimIndex = m_iCurrentAnimIndex;
|
||||
@@ -275,9 +273,9 @@ _bool CModel::Play_Dual_Anim(_float fTimeDelta, CTransform* pTransform)
|
||||
}
|
||||
|
||||
|
||||
m_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsLoop, fTimeDelta, true, m_iBoneMask, m_vector);
|
||||
m_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_bIsLoop, fTimeDelta, true, m_iBoneMask, m_vector);
|
||||
|
||||
m_bIsSecondFinishedAnim = m_Animations[m_iCurrSecondAnimIndex]->Update_TransformationMatrices(m_Bones, m_pLocalPos, m_bIsSecondLoop, fTimeDelta, false, m_iBoneMask);
|
||||
m_bIsSecondFinishedAnim = m_Animations[m_iCurrSecondAnimIndex]->Update_TransformationMatrices(m_Bones, m_bIsSecondLoop, fTimeDelta, false, m_iBoneMask);
|
||||
m_Animations[m_iCurrSecondAnimIndex]->InterpSecondAnim(m_Animations[m_iCurrentAnimIndex], m_iBoneMask, m_Bones, m_fSecondRatio);
|
||||
m_iPreAnimIndex = m_iCurrentAnimIndex;
|
||||
|
||||
@@ -338,11 +336,20 @@ _bool CModel::Play_Dual_Anim(_float fTimeDelta, CTransform* pTransform)
|
||||
}
|
||||
}
|
||||
|
||||
m_Bones[m_iRootBoneIndex]->Update_CombinedTransformationMatrix(m_Bones, XMLoadFloat4x4(&m_PreTransformMatrix));
|
||||
|
||||
|
||||
for (auto& pBone : m_Bones)
|
||||
for (_uint i = 0; i < m_Bones.size(); ++i)
|
||||
{
|
||||
pBone->Update_CombinedTransformationMatrix(m_Bones, XMLoadFloat4x4(&m_PreTransformMatrix));
|
||||
if (m_Bones[i]->IsCPUEvaluated())
|
||||
{
|
||||
if (i == m_iRootBoneIndex)
|
||||
continue;
|
||||
|
||||
m_Bones[i]->Update_CombinedTransformationMatrix(
|
||||
m_Bones,
|
||||
XMLoadFloat4x4(&m_PreTransformMatrix)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return m_bIsFinishedAnim;
|
||||
@@ -364,8 +371,8 @@ void CModel::Set_AnimationIndex(_uint iIndex, _bool isLoop, _float fAmount, _boo
|
||||
{
|
||||
m_iPreAnimIndex = m_iCurrentAnimIndex;
|
||||
|
||||
m_Animations[m_iCurrentAnimIndex]->Depart_Animation();
|
||||
m_Animations[m_iCurrentAnimIndex]->Set_AnimSpeed(1.f);
|
||||
/* m_Animations[m_iCurrentAnimIndex]->Depart_Animation();
|
||||
m_Animations[m_iCurrentAnimIndex]->Set_AnimSpeed(1.f);*/
|
||||
}
|
||||
|
||||
m_fBlendTime = 0.f;
|
||||
@@ -562,19 +569,47 @@ void CModel::Initialize_RootBone()
|
||||
}
|
||||
}
|
||||
|
||||
const _float4x4* CModel::Get_BoneMatrixPtr(const _char* pBoneName) const
|
||||
void CModel::BeginFrame()
|
||||
{
|
||||
vector<CBone*>::const_iterator iter = find_if(m_Bones.begin(), m_Bones.end(), [&](CBone* pBone)->_bool
|
||||
{
|
||||
if (true == pBone->Compare_Name(pBoneName))
|
||||
return true;
|
||||
fill(m_CPUBoneMask.begin(), m_CPUBoneMask.end(), false);
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
vector<_float4x4> CModel::Get_OffsetMatrix(_int iIndex)
|
||||
{
|
||||
return m_Meshes[iIndex]->Get_OffsetMatrix();
|
||||
}
|
||||
|
||||
void CModel::Apply_CPUMask_ToBones()
|
||||
{
|
||||
for (size_t i = 0; i < m_Bones.size(); ++i)
|
||||
m_Bones[i]->SetCPUEvaluated(m_CPUBoneMask[i]);
|
||||
}
|
||||
|
||||
|
||||
return (*iter)->Get_CombinedTransformationMatrixPtr();
|
||||
void CModel::Mark_CPUChain(_int boneIdx)
|
||||
{
|
||||
while (boneIdx >= 0)
|
||||
{
|
||||
if (m_CPUBoneMask[boneIdx])
|
||||
break;
|
||||
|
||||
m_CPUBoneMask[boneIdx] = true;
|
||||
boneIdx = m_Parent[boneIdx];
|
||||
}
|
||||
}
|
||||
|
||||
const _float4x4* CModel::Get_BoneMatrixPtr(const _char* pBoneName)
|
||||
{
|
||||
_int boneIdx = Get_BoneIndex(pBoneName);
|
||||
|
||||
if (boneIdx < 0)
|
||||
return nullptr;
|
||||
|
||||
Mark_CPUChain(boneIdx);
|
||||
|
||||
Apply_CPUMask_ToBones();
|
||||
|
||||
return m_Bones[boneIdx]->Get_CombinedTransformationMatrixPtr();
|
||||
}
|
||||
|
||||
_matrix CModel::Get_BoneMatrix(const _char* pBoneName) const
|
||||
@@ -587,7 +622,6 @@ _matrix CModel::Get_BoneMatrix(const _char* pBoneName) const
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
return (*iter)->Get_CombinedTransformationMatrix();
|
||||
}
|
||||
|
||||
@@ -1334,37 +1368,6 @@ HRESULT CModel::Assimp_Model_Load(const _char* pModelFilePath, MODEL eType, _fma
|
||||
|
||||
#endif // EDITOR_PROJECT
|
||||
|
||||
|
||||
|
||||
void CModel::Create_Temp()
|
||||
{
|
||||
for (auto& anim : m_Animations)
|
||||
{
|
||||
anim->CreateGPUData(m_pDevice);
|
||||
}
|
||||
}
|
||||
|
||||
void CModel::Create_LocalPosVB()
|
||||
{
|
||||
_uint iCount = (_uint)m_Bones.size();
|
||||
_uint iStride = sizeof(LOCALPOS_DESC);
|
||||
|
||||
D3D11_BUFFER_DESC desc = {};
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.ByteWidth = iStride * iCount;
|
||||
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS;
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.StructureByteStride = iStride;
|
||||
desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
|
||||
|
||||
HRESULT hr = m_pDevice->CreateBuffer(&desc, nullptr, &m_pLocalPosBuffer);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void CModel::InItialize_BoneIndex()
|
||||
{
|
||||
for (_uint i = 0; i < (_uint)m_Bones.size(); i++)
|
||||
@@ -1428,14 +1431,57 @@ void CModel::Initialize_BoneMasks()
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CModel::Create_ComputeShader()
|
||||
{
|
||||
_uint CS_InputStrides[] = {
|
||||
sizeof(KEYFRAME_DESC), // 키프레임
|
||||
sizeof(CHANNEL_DESC), // 채널
|
||||
sizeof(KEYFRAME_DESC), // 이전애님 키프레임
|
||||
sizeof(CHANNEL_DESC), // 이전애님 채널
|
||||
sizeof(int), // 부모 인덱스
|
||||
sizeof(_float4x4), // 로컬좌표
|
||||
sizeof(_uint)
|
||||
};
|
||||
|
||||
_uint CS_OutputStrides[] = {
|
||||
sizeof(BONE_DESC),
|
||||
};
|
||||
|
||||
CComputeShader::CS_INFO CS_Desc = {};
|
||||
|
||||
CS_Desc.iNumElement = (_uint)m_Bones.size();
|
||||
CS_Desc.iNumInputBuffer = 7;
|
||||
CS_Desc.iNumOutputBuffer = 1;
|
||||
|
||||
CS_Desc.iInputStructStride = CS_InputStrides;
|
||||
CS_Desc.iOutputStructStride = CS_OutputStrides;
|
||||
|
||||
m_pComputeShader = (CComputeShader*)m_pGameInstance->Clone_Asset_Prototype(g_iStaticLevel, TEXT("CS_Model"), &CS_Desc, nullptr);
|
||||
|
||||
if (nullptr == m_pComputeShader) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CModel::Create_Temp()
|
||||
{
|
||||
for (auto& anim : m_Animations)
|
||||
{
|
||||
anim->CreateGPUData(m_pDevice);
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CModel::Create_ParentVB()
|
||||
{
|
||||
D3D11_BUFFER_DESC desc{};
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.ByteWidth = (_int)sizeof(PARENT_DESC) * (_uint)m_Bones.size();
|
||||
desc.ByteWidth = sizeof(_int) * (_uint)m_Bones.size();
|
||||
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.StructureByteStride = (_int)sizeof(PARENT_DESC);
|
||||
desc.StructureByteStride = sizeof(_int);
|
||||
desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
|
||||
|
||||
D3D11_SUBRESOURCE_DATA init{};
|
||||
@@ -1443,9 +1489,189 @@ HRESULT CModel::Create_ParentVB()
|
||||
|
||||
m_pDevice->CreateBuffer(&desc, &init, &m_pParentBuffer);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CModel::Create_BoneLocalVB()
|
||||
{
|
||||
D3D11_BUFFER_DESC desc{};
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.ByteWidth = sizeof(_float4x4) * (_uint)m_Bones.size();
|
||||
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.StructureByteStride = sizeof(_float4x4);
|
||||
desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
|
||||
|
||||
D3D11_SUBRESOURCE_DATA init{};
|
||||
init.pSysMem = m_BoneLocal.data();
|
||||
|
||||
m_pDevice->CreateBuffer(&desc, &init, &m_pBoneLocalBuffer);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CModel::Create_BoneMatrixVB()
|
||||
{
|
||||
_uint iCount = (_uint)m_Bones.size();
|
||||
_uint iStride = sizeof(BONE_DESC);
|
||||
|
||||
D3D11_BUFFER_DESC desc = {};
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.ByteWidth = iStride * iCount;
|
||||
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS;
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.StructureByteStride = iStride;
|
||||
desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
|
||||
|
||||
HRESULT hr = m_pDevice->CreateBuffer(&desc, nullptr, &m_pBoneMatrixBuffer);
|
||||
|
||||
|
||||
D3D11_UNORDERED_ACCESS_VIEW_DESC uavDesc{};
|
||||
uavDesc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER;
|
||||
uavDesc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
uavDesc.Buffer.FirstElement = 0;
|
||||
uavDesc.Buffer.NumElements = (_uint)m_Bones.size();
|
||||
|
||||
m_pDevice->CreateUnorderedAccessView(
|
||||
m_pBoneMatrixBuffer,
|
||||
&uavDesc,
|
||||
&m_pBoneMatrixUAV
|
||||
);
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
HRESULT CModel::Create_Const()
|
||||
{
|
||||
|
||||
D3D11_BUFFER_DESC cbDesc = {};
|
||||
cbDesc.Usage = D3D11_USAGE_DYNAMIC;
|
||||
cbDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
|
||||
cbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
cbDesc.ByteWidth = sizeof(ANIMSTATE_DESC);
|
||||
|
||||
D3D11_SUBRESOURCE_DATA CBInitialDesc = {};
|
||||
|
||||
if (FAILED(m_pDevice->CreateBuffer(&cbDesc, nullptr, &m_pConstantBuffer)))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CModel::Create_ParentSrv()
|
||||
{
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
|
||||
srvDesc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
srvDesc.Buffer.FirstElement = 0;
|
||||
srvDesc.Buffer.NumElements = (_uint)m_Bones.size();
|
||||
|
||||
if (FAILED(m_pDevice->CreateShaderResourceView(m_pParentBuffer, &srvDesc, &m_pParentSRV)))
|
||||
return E_FAIL;
|
||||
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc1 = {};
|
||||
srvDesc1.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
|
||||
srvDesc1.Format = DXGI_FORMAT_UNKNOWN;
|
||||
srvDesc1.Buffer.FirstElement = 0;
|
||||
srvDesc1.Buffer.NumElements = (_uint)m_Bones.size();
|
||||
|
||||
if (FAILED(m_pDevice->CreateShaderResourceView(m_pBoneMatrixBuffer, &srvDesc1, &m_pBoneMatrixSRV)))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CModel::Create_BoneLocalSrv()
|
||||
{
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
|
||||
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
|
||||
srvDesc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
srvDesc.Buffer.FirstElement = 0;
|
||||
srvDesc.Buffer.NumElements = (_uint)m_Bones.size();
|
||||
|
||||
if (FAILED(m_pDevice->CreateShaderResourceView(m_pBoneLocalBuffer, &srvDesc, &m_pBoneLocalSRV)))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CModel::ComputeAnimation(_uint AnimIndex,_uint MeshIndex)
|
||||
{
|
||||
D3D11_MAPPED_SUBRESOURCE ConstantSubResource = {};
|
||||
|
||||
if (SUCCEEDED(m_pContext->Map(m_pConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &ConstantSubResource)))
|
||||
{
|
||||
ANIMSTATE_DESC* pDesc = static_cast<ANIMSTATE_DESC*>(ConstantSubResource.pData);
|
||||
|
||||
auto* anim = m_Animations[AnimIndex];
|
||||
pDesc->CurrentTime = anim->Get_CurrentTrackPosition();
|
||||
pDesc->Duration = anim->Get_Duration();
|
||||
pDesc->MeshBoneCount = m_Meshes[MeshIndex]->Get_NumBone();
|
||||
pDesc->BoneCount = (_uint)m_Bones.size();
|
||||
pDesc->RootBoneIndex = m_iRootBoneIndex;
|
||||
pDesc->PrevTime = m_Animations[m_iPreAnimIndex]->Get_CurrentTrackPosition();
|
||||
pDesc->BlendRatio = m_fRatio;
|
||||
pDesc->PreTransformMatrix = m_PreTransformMatrix;
|
||||
pDesc->RootInitRot = m_vInitialRootRot;
|
||||
m_pContext->Unmap(m_pConstantBuffer, 0);
|
||||
}
|
||||
|
||||
if (m_pComputeShader == nullptr)
|
||||
return;
|
||||
|
||||
_uint iGroupCountX = (_uint)(m_Bones.size() + 255) / 256;
|
||||
|
||||
ID3D11Buffer* CSBuffers[] =
|
||||
{
|
||||
m_Animations[AnimIndex]->Get_KeyFrameBuffer(),
|
||||
m_Animations[AnimIndex]->Get_ChannelBuffer(),
|
||||
m_Animations[m_iPreAnimIndex]->Get_KeyFrameBuffer(),
|
||||
m_Animations[m_iPreAnimIndex]->Get_ChannelBuffer(),
|
||||
m_pParentBuffer,
|
||||
m_pBoneLocalBuffer,
|
||||
m_Meshes[MeshIndex]->Get_BoneRemapBuffer()
|
||||
};
|
||||
|
||||
auto* anim = m_Animations[AnimIndex];
|
||||
ID3D11ShaderResourceView* srvs[] =
|
||||
{
|
||||
anim->Get_KeyFrameSrv(),
|
||||
anim->Get_ChannelSrv(),
|
||||
m_Animations[m_iPreAnimIndex]->Get_KeyFrameSrv(),
|
||||
m_Animations[m_iPreAnimIndex]->Get_ChannelSrv(),
|
||||
m_pParentSRV,
|
||||
m_pBoneLocalSRV,
|
||||
m_Meshes[MeshIndex]->Get_BoneRemapSRV()
|
||||
};
|
||||
|
||||
ID3D11UnorderedAccessView* uavs[] =
|
||||
{
|
||||
m_pBoneMatrixUAV
|
||||
};
|
||||
|
||||
m_pComputeShader->Dispatch_ExternalSRV_UAV(
|
||||
0,
|
||||
0,
|
||||
_float3((_float)iGroupCountX, 1.f, 1.f),
|
||||
srvs,
|
||||
7,
|
||||
uavs,
|
||||
1,
|
||||
m_pConstantBuffer
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
void CModel::Bind_OutPut_SRV_VS(_uint iIndex, _uint iBufferIndex)
|
||||
{
|
||||
m_pContext->VSSetShaderResources(iIndex,
|
||||
1, // 버퍼 개수
|
||||
&m_pBoneMatrixSRV);
|
||||
}
|
||||
|
||||
|
||||
#ifdef _DEBUG
|
||||
HRESULT CModel::Initialize_Prototype(MODEL eType, const _char* pModelFilePath, _fmatrix PreTransformMatrix)
|
||||
{
|
||||
@@ -1878,23 +2104,33 @@ HRESULT CModel::Initialize(void* pArg)
|
||||
|
||||
if (m_eType == MODEL::ANIM || m_eType == MODEL::PBR_ANIM || m_eType == MODEL::ANIM_LOCAL)
|
||||
{
|
||||
m_CPUBoneMask.resize(m_Bones.size(), false);
|
||||
Initialize_RootBone();
|
||||
InItialize_BoneIndex();
|
||||
Initialize_BoneMasks();
|
||||
|
||||
/*Create_Temp();
|
||||
m_Parent.resize(m_Bones.size());
|
||||
for (size_t i = 0; i < (_uint)m_Bones.size(); i++)
|
||||
{
|
||||
m_Parent[i].ParentIndex = m_Bones[i]->Get_ParentBoneIndex();
|
||||
m_Parent[i] = m_Bones[i]->Get_ParentBoneIndex();
|
||||
}
|
||||
|
||||
if (FAILED(Create_CS()))
|
||||
return E_FAIL;
|
||||
m_BoneLocal.resize(m_Bones.size());
|
||||
for (size_t i = 0; i < (_uint)m_Bones.size(); i++)
|
||||
{
|
||||
m_BoneLocal[i] = m_Bones[i]->Get_TransformationMatrix();
|
||||
}
|
||||
|
||||
Create_Con();
|
||||
Create_LocalPosVB();
|
||||
Create_ParentVB();*/
|
||||
Create_Const();
|
||||
Create_Temp();
|
||||
Create_BoneMatrixVB();
|
||||
Create_ParentVB();
|
||||
Create_BoneLocalVB();
|
||||
Create_ParentSrv();
|
||||
Create_BoneLocalSrv();
|
||||
|
||||
if (FAILED(Create_ComputeShader()))
|
||||
return E_FAIL;
|
||||
|
||||
}
|
||||
|
||||
@@ -2005,7 +2241,12 @@ void CModel::Free()
|
||||
SAFE_RELEASE(m_pComputeShader);
|
||||
SAFE_RELEASE(m_pConstantBuffer);
|
||||
SAFE_RELEASE(m_pParentBuffer);
|
||||
SAFE_RELEASE(m_pLocalPosBuffer);
|
||||
SAFE_RELEASE(m_pBoneLocalBuffer);
|
||||
SAFE_RELEASE(m_pBoneMatrixBuffer);
|
||||
SAFE_RELEASE(m_pParentSRV);
|
||||
SAFE_RELEASE(m_pBoneLocalSRV);
|
||||
SAFE_RELEASE(m_pBoneMatrixSRV);
|
||||
SAFE_RELEASE(m_pBoneMatrixUAV);
|
||||
|
||||
for (auto& pAnimation : m_Animations) {
|
||||
SAFE_RELEASE(pAnimation);
|
||||
|
||||
@@ -48,7 +48,7 @@ void CPicking::Update()
|
||||
#ifdef _DEBUG
|
||||
m_pGameInstance->Compute_TimeDelta(TEXT("Timer_Picking"));
|
||||
#endif // _DEBUG
|
||||
m_pGameInstance->Copy_RenderTarget(TEXT("Target_Depth"), m_pTexture2D);
|
||||
m_pGameInstance->Copy_RenderTargetTo(TEXT("Target_Depth"), m_pTexture2D);
|
||||
#ifdef _DEBUG
|
||||
m_pGameInstance->Compute_TimeDelta(TEXT("Timer_Picking"));
|
||||
#endif // _DEBUG
|
||||
|
||||
@@ -149,6 +149,13 @@ HRESULT CPrototype_Manager::Ready_EngineAssets()
|
||||
|
||||
}
|
||||
|
||||
if (FAILED(Add_Asset_Prototype(g_iStaticLevel, TEXT("CS_Model"),
|
||||
CComputeShader::Create(m_pDevice, m_pContext,
|
||||
L"../Bin/Resources/ShaderFiles/Shader_Mesh_Compute.hlsl", "CS_MAIN")))) {
|
||||
return E_FAIL;
|
||||
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
return S_OK;
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
#include "pch.h"
|
||||
#include "Quest.h"
|
||||
|
||||
CQuest::CQuest(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: CGameObject{ pDevice, pContext }
|
||||
{
|
||||
}
|
||||
|
||||
CQuest::CQuest(const CQuest& rhs)
|
||||
: CGameObject(rhs)
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT CQuest::Initialize_Prototype()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CQuest::Initialize(void* pArg)
|
||||
{
|
||||
QUESTINFO* Info = static_cast<QUESTINFO*>(pArg);
|
||||
m_iQuestID = Info->iQuestID;
|
||||
m_ObjectiveInfo = Info->ObjectiveInfo;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
_bool CQuest::Update_Objective(_int MonsterID)
|
||||
{
|
||||
for (_int i = 0; i < m_ObjectiveInfo.size(); ++i)
|
||||
{
|
||||
auto& it = m_ObjectiveInfo[i];
|
||||
|
||||
if (it.bClear == true)
|
||||
continue;
|
||||
|
||||
if (it.iTargetID != MonsterID)
|
||||
continue;
|
||||
|
||||
++it.iCurrentCount;
|
||||
|
||||
if (it.iCurrentCount >= it.iRequiredCount)
|
||||
it.bClear = true;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
for (_int i = 0; i < m_ObjectiveInfo.size(); ++i)
|
||||
{
|
||||
if (m_ObjectiveInfo[i].bClear == false)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
_int CQuest::Get_QuestID()
|
||||
{
|
||||
return m_iQuestID;
|
||||
}
|
||||
|
||||
void CQuest::Free()
|
||||
{
|
||||
__super::Free();
|
||||
}
|
||||
@@ -69,11 +69,11 @@ void CRenderTarget::Clear()
|
||||
m_pContext->ClearRenderTargetView(m_pRTV, reinterpret_cast<_float*>(&m_vClearColor));
|
||||
}
|
||||
|
||||
void CRenderTarget::Copy_Resource(ID3D11Texture2D* pTexture2D)
|
||||
void CRenderTarget::Copy_ResourceTo(ID3D11Texture2D* pTexture2D)
|
||||
{
|
||||
m_pContext->CopyResource(pTexture2D, m_pTexture2D);
|
||||
}
|
||||
void CRenderTarget::Paste_Resource(ID3D11Texture2D* pTexture2D)
|
||||
void CRenderTarget::Copy_ResourceFrom(ID3D11Texture2D* pTexture2D)
|
||||
{
|
||||
m_pContext->CopyResource(m_pTexture2D, pTexture2D);
|
||||
}
|
||||
|
||||
@@ -175,26 +175,26 @@ HRESULT CRenderTarget_Manager::Begin_MRT_NO_DepthStencil(const _wstring& strMRTT
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CRenderTarget_Manager::Copy_RenderTarget(const _wstring& strTargetTag, ID3D11Texture2D* pTexture2D)
|
||||
HRESULT CRenderTarget_Manager::Copy_RenderTargetTo(const _wstring& strTargetTag, ID3D11Texture2D* pTexture2D)
|
||||
{
|
||||
CRenderTarget* pRenderTarget = Find_RenderTarget(strTargetTag);
|
||||
if (nullptr == pRenderTarget) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
pRenderTarget->Copy_Resource(pTexture2D);
|
||||
pRenderTarget->Copy_ResourceTo(pTexture2D);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CRenderTarget_Manager::Paste_RenderTarget(const _wstring& strTargetTag, ID3D11Texture2D* pTexture2D)
|
||||
HRESULT CRenderTarget_Manager::Copy_RenderTargetFrom(const _wstring& strTargetTag, ID3D11Texture2D* pTexture2D)
|
||||
{
|
||||
CRenderTarget* pRenderTarget = Find_RenderTarget(strTargetTag);
|
||||
if (nullptr == pRenderTarget) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
pRenderTarget->Paste_Resource(pTexture2D);
|
||||
pRenderTarget->Copy_ResourceFrom(pTexture2D);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
@@ -367,6 +367,9 @@ HRESULT CRenderTarget_Manager::Refit_RenderTarget(CVIBuffer_Rect* pVIBuffer, CSh
|
||||
case Engine::SHADER_PASS_DEFERRED::BLOOM_BLURX:
|
||||
pConstantName = "g_DiffuseTexture";
|
||||
break;
|
||||
case Engine::SHADER_PASS_DEFERRED::DOWNSAMPLE:
|
||||
pConstantName = "g_DiffuseTexture";
|
||||
break;
|
||||
case Engine::SHADER_PASS_DEFERRED::BLOOM_BLURY:
|
||||
pConstantName = "g_BlurXTexture";
|
||||
break;
|
||||
|
||||
@@ -11,10 +11,6 @@ void CRenderer::Render()
|
||||
m_pContext->RSGetViewports(&iNumViewPort, &vp);
|
||||
_float2 vResolution = { vp.Width, vp.Height };
|
||||
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_vResolution", &vResolution, sizeof(_float2)))) {
|
||||
assert(false);
|
||||
}
|
||||
|
||||
Render_Priority();
|
||||
Render_Shadow();
|
||||
Render_NonBlend();
|
||||
@@ -32,12 +28,15 @@ void CRenderer::Render()
|
||||
Render_NonLight();
|
||||
Render_Blend();
|
||||
Render_WeightBlend();
|
||||
Render_Bloom();
|
||||
Render_PostProcessing();
|
||||
Render_LastColor();
|
||||
Render_Tone_Mapping();
|
||||
Render_UI();
|
||||
Render_UI_Overley();
|
||||
|
||||
memcpy_s(&m_MotionBlurPreViewMatrix, sizeof(_float4x4), m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW), sizeof(_float4x4));
|
||||
memcpy_s(&m_MotionBlurPreProjMatrix, sizeof(_float4x4), m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ), sizeof(_float4x4));
|
||||
|
||||
#ifdef _DEBUG
|
||||
static _bool m_bToggleDebug = false;
|
||||
Describe_Entitiy();
|
||||
@@ -116,6 +115,21 @@ HRESULT CRenderer::Bind_PreShadowMatrix(class CShader* pShader, const _char* pCo
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CRenderer::Bind_PrevMatrix(class CShader* pShader, const _char* pConstants, D3DTS eType)
|
||||
{
|
||||
if (D3DTS::VIEW == eType) {
|
||||
if (FAILED(pShader->Bind_Matrix(pConstants, &m_MotionBlurPreViewMatrix))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
else if (D3DTS::PROJ == eType) {
|
||||
if (FAILED(pShader->Bind_Matrix(pConstants, &m_MotionBlurPreProjMatrix))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CRenderer::Render_Occlusion()
|
||||
{
|
||||
COMPUTE_TIMEDELTA("Timer_Render_Occlusion");
|
||||
@@ -320,9 +334,9 @@ void CRenderer::Render_LightAcc()
|
||||
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_WorldMatrix", &m_ScreenWorldMatrix);
|
||||
m_pShader->Bind_Matrix("g_ViewMatrix", &m_ScreenViewMatrix);
|
||||
m_pShader->Bind_Matrix("g_ProjMatrix", &m_ScreenProjMatrix);
|
||||
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_vCamPosition", m_pGameInstance->Get_CamPosition(), sizeof(_float4));
|
||||
@@ -365,9 +379,9 @@ void CRenderer::Render_Combined()
|
||||
{
|
||||
// Bind_Resorces
|
||||
|
||||
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_WorldMatrix", &m_ScreenWorldMatrix);
|
||||
m_pShader->Bind_Matrix("g_ViewMatrix", &m_ScreenViewMatrix);
|
||||
m_pShader->Bind_Matrix("g_ProjMatrix", &m_ScreenProjMatrix);
|
||||
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));
|
||||
|
||||
@@ -459,9 +473,9 @@ void CRenderer::Render_EnvironmentPostProcess()
|
||||
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_WorldMatrix", &m_ScreenWorldMatrix);
|
||||
m_pShader->Bind_Matrix("g_ViewMatrix", &m_ScreenViewMatrix);
|
||||
m_pShader->Bind_Matrix("g_ProjMatrix", &m_ScreenProjMatrix);
|
||||
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));
|
||||
@@ -490,9 +504,9 @@ void CRenderer::Render_EnvironmentPostProcess()
|
||||
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_WorldMatrix", &m_ScreenWorldMatrix);
|
||||
m_pShader->Bind_Matrix("g_ViewMatrix", &m_ScreenViewMatrix);
|
||||
m_pShader->Bind_Matrix("g_ProjMatrix", &m_ScreenProjMatrix);
|
||||
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));
|
||||
@@ -575,9 +589,9 @@ void CRenderer::Render_WeightBlend()
|
||||
COMPUTE_TIMEDELTA("Timer_Render_WeightBlend");
|
||||
// Bind_Resorces
|
||||
|
||||
m_pWeightBlendShader->Bind_Matrix("g_WorldMatrix", &m_WorldMatrix);
|
||||
m_pWeightBlendShader->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix);
|
||||
m_pWeightBlendShader->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix);
|
||||
m_pWeightBlendShader->Bind_Matrix("g_WorldMatrix", &m_ScreenWorldMatrix);
|
||||
m_pWeightBlendShader->Bind_Matrix("g_ViewMatrix", &m_ScreenViewMatrix);
|
||||
m_pWeightBlendShader->Bind_Matrix("g_ProjMatrix", &m_ScreenProjMatrix);
|
||||
|
||||
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_WB_Color"), m_pWeightBlendShader, "g_MixedDiffuseTexture"))) {
|
||||
@@ -637,9 +651,9 @@ void CRenderer::Render_Blur()
|
||||
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_WorldMatrix", &m_ScreenWorldMatrix);
|
||||
m_pShader->Bind_Matrix("g_ViewMatrix", &m_ScreenViewMatrix);
|
||||
m_pShader->Bind_Matrix("g_ProjMatrix", &m_ScreenProjMatrix);
|
||||
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Blur"), m_pShader, "g_BlurTexture"))) {
|
||||
return;
|
||||
@@ -763,9 +777,9 @@ void CRenderer::Render_SSAO_BLUR()
|
||||
}
|
||||
{
|
||||
// Bind_Resorces
|
||||
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_WorldMatrix", &m_ScreenWorldMatrix);
|
||||
m_pShader->Bind_Matrix("g_ViewMatrix", &m_ScreenViewMatrix);
|
||||
m_pShader->Bind_Matrix("g_ProjMatrix", &m_ScreenProjMatrix);
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
|
||||
return;
|
||||
}
|
||||
@@ -806,20 +820,48 @@ void CRenderer::Render_Blend()
|
||||
COMPUTE_TIMEDELTA("Timer_Render_Blend");
|
||||
}
|
||||
|
||||
void CRenderer::Render_Bloom()
|
||||
void CRenderer::Render_PostProcessing()
|
||||
{
|
||||
COMPUTE_TIMEDELTA("Timer_Render_Bloom");
|
||||
// "Target_Bloom_Input"
|
||||
// "Target_Bloom"
|
||||
// "Target_Bloom_2x2"
|
||||
// "Target_Bloom_4x4"
|
||||
// "Target_Bloom_8x8"
|
||||
// "Target_Bloom_2x2_1"
|
||||
// "Target_Bloom_4x4_1"
|
||||
// "Target_Bloom_8x8_1"
|
||||
// "Target_Bloom_8x8_X"
|
||||
// "Target_Bloom_4x4_2"
|
||||
// "Target_Bloom_2x2_2"
|
||||
/* POSTPROCESSING */
|
||||
COMPUTE_TIMEDELTA("Timer_Render_PostProcessing");
|
||||
//{
|
||||
// ID3D11Texture2D* pBackBuffer = { nullptr };
|
||||
// m_pGameInstance->Get_BackBufferPTR(&pBackBuffer);
|
||||
// if (FAILED(m_pGameInstance->Copy_RenderTargetTo(TEXT("Target_AfterBlend"), pBackBuffer))) {
|
||||
// assert(false);
|
||||
// }
|
||||
// m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_AfterBlend"), TEXT("Target_AfterBlend2x2"), SHADER_PASS_DEFERRED::DOWNSAMPLE);
|
||||
//}
|
||||
///* MotionBlur */
|
||||
//
|
||||
//{ // Bind_Resorces
|
||||
// m_pShader->Bind_Matrix("g_WorldMatrix", &m_ScreenWorldMatrix);
|
||||
// m_pShader->Bind_Matrix("g_ViewMatrix", &m_ScreenViewMatrix);
|
||||
// m_pShader->Bind_Matrix("g_ProjMatrix", &m_ScreenProjMatrix);
|
||||
// m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float));
|
||||
// m_pShader->Bind_RawValue("g_fMBBlurRadius", &m_fMBBlurRadius, sizeof(_float));
|
||||
// m_pShader->Bind_RawValue("g_iMBSampleCount", &m_iMBSampleCount, sizeof(_int));
|
||||
// m_pShader->Bind_RawValue("g_iMBType", &m_iMBType, sizeof(_int));
|
||||
//}
|
||||
//{
|
||||
// // Bind_Targets
|
||||
// if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_AfterBlend2x2"), m_pShader, "g_ColorTexture"))) {
|
||||
// assert(false);
|
||||
// return;
|
||||
// }
|
||||
// if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Depth"), m_pShader, "g_DepthTexture"))) {
|
||||
// assert(false);
|
||||
// return;
|
||||
// }
|
||||
// if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_VelocityMap"), m_pShader, "g_VelocityTexture"))) {
|
||||
// assert(false);
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
//m_pShader->Begin(ENUM_CLASS(SHADER_PASS_DEFERRED::MOTIONBLUR));
|
||||
|
||||
//m_pVIBuffer->Bind_Resources();
|
||||
//m_pVIBuffer->Render();
|
||||
|
||||
if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_Bloom")))) {
|
||||
return;
|
||||
@@ -840,6 +882,19 @@ void CRenderer::Render_Bloom()
|
||||
return;
|
||||
}
|
||||
|
||||
// "Target_Bloom_Input"
|
||||
// "Target_Bloom"
|
||||
// "Target_Bloom_2x2"
|
||||
// "Target_Bloom_4x4"
|
||||
// "Target_Bloom_8x8"
|
||||
// "Target_Bloom_2x2_1"
|
||||
// "Target_Bloom_4x4_1"
|
||||
// "Target_Bloom_8x8_1"
|
||||
// "Target_Bloom_8x8_X"
|
||||
// "Target_Bloom_4x4_2"
|
||||
// "Target_Bloom_2x2_2"
|
||||
|
||||
|
||||
m_pShader->Bind_RawValue("g_fBloomThreshold", &m_fBloomThreshold, sizeof(_float));
|
||||
m_pShader->Bind_RawValue("g_iBloomEmbossingPass", &m_iBloomEmbossingPass, sizeof(_int));
|
||||
|
||||
@@ -867,7 +922,7 @@ void CRenderer::Render_Bloom()
|
||||
m_pGameInstance->Refit_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_2x2_2"), TEXT("Target_Bloom"), SHADER_PASS_DEFERRED::UPSAMPLE);
|
||||
m_pGameInstance->Finish_RenderTarget(m_pVIBuffer, m_pShader, TEXT("Target_Bloom_Input"), TEXT("Target_Bloom"), SHADER_PASS_DEFERRED::BLOOM_FINISH); // 9
|
||||
|
||||
COMPUTE_TIMEDELTA("Timer_Render_Bloom");
|
||||
COMPUTE_TIMEDELTA("Timer_Render_PostProcessing");
|
||||
}
|
||||
|
||||
void CRenderer::Render_Distortion()
|
||||
@@ -904,13 +959,13 @@ void CRenderer::Render_DistortionAcc()
|
||||
|
||||
m_pGameInstance->Get_BackBufferPTR(&pBackBufferTexture2D);
|
||||
|
||||
if (FAILED(m_pGameInstance->Paste_RenderTarget(TEXT("Target_PreEffect"), pBackBufferTexture2D))) {
|
||||
if (FAILED(m_pGameInstance->Copy_RenderTargetFrom(TEXT("Target_PreEffect"), pBackBufferTexture2D))) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_pDistortionShader->Bind_Matrix("g_WorldMatrix", &m_WorldMatrix);
|
||||
m_pDistortionShader->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix);
|
||||
m_pDistortionShader->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix);
|
||||
m_pDistortionShader->Bind_Matrix("g_WorldMatrix", &m_ScreenWorldMatrix);
|
||||
m_pDistortionShader->Bind_Matrix("g_ViewMatrix", &m_ScreenViewMatrix);
|
||||
m_pDistortionShader->Bind_Matrix("g_ProjMatrix", &m_ScreenProjMatrix);
|
||||
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Distortion"), m_pDistortionShader, "g_DistortionTexture"))) {
|
||||
return;
|
||||
@@ -981,9 +1036,9 @@ void CRenderer::Render_LastColor()
|
||||
COMPUTE_TIMEDELTA("Timer_Render_LastColor");
|
||||
// Bind_Resorces
|
||||
|
||||
m_pLastColorShader->Bind_Matrix("g_WorldMatrix", &m_WorldMatrix);
|
||||
m_pLastColorShader->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix);
|
||||
m_pLastColorShader->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix);
|
||||
m_pLastColorShader->Bind_Matrix("g_WorldMatrix", &m_ScreenWorldMatrix);
|
||||
m_pLastColorShader->Bind_Matrix("g_ViewMatrix", &m_ScreenViewMatrix);
|
||||
m_pLastColorShader->Bind_Matrix("g_ProjMatrix", &m_ScreenProjMatrix);
|
||||
|
||||
if (FAILED(m_pGameInstance->Bind_RenderTarget(TEXT("Target_Color"), m_pLastColorShader, "g_ColorTexture"))) {
|
||||
return;
|
||||
@@ -1002,13 +1057,13 @@ void CRenderer::Render_Tone_Mapping()
|
||||
{ // BackBuffer
|
||||
ID3D11Texture2D* pBackBuffer = nullptr;
|
||||
m_pGameInstance->Get_BackBufferPTR(&pBackBuffer);
|
||||
m_pGameInstance->Paste_RenderTarget(TEXT("Target_ToneMapping"), pBackBuffer);
|
||||
m_pGameInstance->Copy_RenderTargetFrom(TEXT("Target_ToneMapping"), pBackBuffer);
|
||||
SAFE_RELEASE(pBackBuffer);
|
||||
}
|
||||
|
||||
m_pLastColorShader->Bind_Matrix("g_WorldMatrix", &m_WorldMatrix);
|
||||
m_pLastColorShader->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix);
|
||||
m_pLastColorShader->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix);
|
||||
m_pLastColorShader->Bind_Matrix("g_WorldMatrix", &m_ScreenWorldMatrix);
|
||||
m_pLastColorShader->Bind_Matrix("g_ViewMatrix", &m_ScreenViewMatrix);
|
||||
m_pLastColorShader->Bind_Matrix("g_ProjMatrix", &m_ScreenProjMatrix);
|
||||
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_iToneMappingType", &m_iToneMappingType, sizeof(_uint)))) {
|
||||
assert(false);
|
||||
@@ -1046,10 +1101,10 @@ void CRenderer::Render_Debug()
|
||||
SAFE_RELEASE(pDebugCom);
|
||||
} m_DebugComponents.clear();
|
||||
|
||||
if (FAILED(m_pShader->Bind_Matrix("g_ViewMatrix", &m_ViewMatrix))) {
|
||||
if (FAILED(m_pShader->Bind_Matrix("g_ViewMatrix", &m_ScreenViewMatrix))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pShader->Bind_Matrix("g_ProjMatrix", &m_ProjMatrix))) {
|
||||
if (FAILED(m_pShader->Bind_Matrix("g_ProjMatrix", &m_ScreenProjMatrix))) {
|
||||
return;
|
||||
}
|
||||
if (FAILED(m_pShader->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
|
||||
|
||||
@@ -267,6 +267,16 @@ HRESULT CRenderer::Initialize()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* Target_AfterBlend */
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_AfterBlend"), (_uint)Viewport.Width, (_uint)Viewport.Height,
|
||||
DXGI_FORMAT_R16G16B16A16_FLOAT, _float4(0.0f, 0.0f, 0, 1.0f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_AfterBlend_2x2"), (_uint)(Viewport.Width * 0.5f), (_uint)(Viewport.Height * 0.5f),
|
||||
DXGI_FORMAT_R16G16B16A16_FLOAT, _float4(0.0f, 0.0f, 0, 1.0f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* Target_Color*/
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_Color"), (_uint)Viewport.Width, (_uint)Viewport.Height,
|
||||
DXGI_FORMAT_R32G32B32A32_FLOAT, _float4(0.0f, 0.0f, 0.0f, 0.0f)))) {
|
||||
@@ -338,6 +348,19 @@ HRESULT CRenderer::Initialize()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* Target_VelocityMap */
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_VelocityMap"), (_uint)Viewport.Width, (_uint)Viewport.Height,
|
||||
DXGI_FORMAT_R32G32_FLOAT, _float4(0.0f, 0.f, 0.f, 0.f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_BeforeNormal"), (_uint)Viewport.Width, (_uint)Viewport.Height,
|
||||
DXGI_FORMAT_R16G16B16A16_UNORM, _float4(0.0f, 0.f, 0.f, 0.f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_BeforeDepth"), (_uint)Viewport.Width, (_uint)Viewport.Height,
|
||||
DXGI_FORMAT_R32G32B32A32_FLOAT, _float4(0.0f, 1.f, 0.f, 0.f)))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_Distortion"), (_uint)(Viewport.Width), (_uint)(Viewport.Height),
|
||||
DXGI_FORMAT_R16G16B16A16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 0.0f)))) {
|
||||
return E_FAIL;
|
||||
@@ -372,6 +395,10 @@ HRESULT CRenderer::Initialize()
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_GameObjects"), TEXT("Target_Surface")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_GameObjects"), TEXT("Target_VelocityMap")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* MRT_SSAO */
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_SSAO_OCCLUSION"), TEXT("Target_SSAO_AmbientOcclusion")))) {
|
||||
return E_FAIL;
|
||||
@@ -457,10 +484,6 @@ HRESULT CRenderer::Initialize()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
//if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_WB"), TEXT("Target_Color")))) {
|
||||
// return E_FAIL;
|
||||
//}
|
||||
|
||||
/* MRT_Fog */
|
||||
if (FAILED(m_pGameInstance->Add_MRT(TEXT("MRT_Fog"), TEXT("Target_Fog")))) {
|
||||
return E_FAIL;
|
||||
@@ -510,12 +533,14 @@ HRESULT CRenderer::Initialize()
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
XMStoreFloat4x4(&m_WorldMatrix, XMMatrixScaling(Viewport.Width, Viewport.Height, 1.f));
|
||||
XMStoreFloat4x4(&m_ViewMatrix, XMMatrixIdentity());
|
||||
XMStoreFloat4x4(&m_ProjMatrix, XMMatrixOrthographicLH(Viewport.Width, Viewport.Height, 0.f, 1.f));
|
||||
XMStoreFloat4x4(&m_ScreenWorldMatrix, XMMatrixScaling(Viewport.Width, Viewport.Height, 1.f));
|
||||
XMStoreFloat4x4(&m_ScreenViewMatrix, XMMatrixIdentity());
|
||||
XMStoreFloat4x4(&m_ScreenProjMatrix, XMMatrixOrthographicLH(Viewport.Width, Viewport.Height, 0.f, 1.f));
|
||||
|
||||
Fill_Geometry(SSAO_SAMPLE_NUMBER);
|
||||
|
||||
XMStoreFloat4x4(&m_MotionBlurPreViewMatrix, XMMatrixIdentity());
|
||||
XMStoreFloat4x4(&m_MotionBlurPreProjMatrix, XMMatrixIdentity());
|
||||
return S_OK;
|
||||
}
|
||||
CRenderer* CRenderer::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
@@ -551,7 +576,6 @@ void CRenderer::Free()
|
||||
RenderObjects.clear();
|
||||
}
|
||||
|
||||
SAFE_RELEASE(m_pGlobalStaticCB);
|
||||
SAFE_RELEASE(m_pSSAO_NoiseTexture);
|
||||
SAFE_RELEASE(m_pSSAO_NoiseSRV);
|
||||
SAFE_RELEASE(m_pPreShadowDSV);
|
||||
|
||||
@@ -18,6 +18,7 @@ HRESULT CStat::Initialize_Prototype(tinyxml2::XMLNode* pChild)
|
||||
{
|
||||
auto pElement = pChild->ToElement();
|
||||
m_UnitInfo.pUnit_Name = CMyTools::ToWstring(pElement->Attribute("Name"));
|
||||
pElement->QueryIntAttribute("OBJECTID", &m_UnitInfo.iObjectID);
|
||||
pElement->QueryFloatAttribute("HP", &m_UnitInfo.fCurrentHp);
|
||||
pElement->QueryFloatAttribute("MAXHP", &m_UnitInfo.fMaxHp);
|
||||
pElement->QueryFloatAttribute("TARGETHP", &m_UnitInfo.fTargetHp);
|
||||
|
||||
@@ -92,7 +92,7 @@ HRESULT CTimer_Manager::Initialize()
|
||||
if (FAILED(Add_Timer(TEXT("Timer_Render_WeightBlend")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(Add_Timer(TEXT("Timer_Render_Bloom")))) {
|
||||
if (FAILED(Add_Timer(TEXT("Timer_Render_PostProcessing")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
if (FAILED(Add_Timer(TEXT("Timer_Render_LastColor")))) {
|
||||
|
||||
@@ -262,6 +262,7 @@ void CTransform::RewindMomentum()
|
||||
{
|
||||
m_vMomentum = m_vBackMomentum;
|
||||
m_vBackMomentum = { 0.f, 0.f, 0.f };
|
||||
m_PrevMatrix = m_WorldMatrix;
|
||||
}
|
||||
|
||||
void CTransform::BookMomentum(_fvector vMomentum)
|
||||
|
||||
@@ -502,6 +502,11 @@ const CUIObject::SPELLINFO CUIObject::Get_Info(_int Index)
|
||||
return SPELLINFO();
|
||||
}
|
||||
|
||||
const CUIObject::QUESTINFO CUIObject::Get_QuestInfo(_int Index)
|
||||
{
|
||||
return QUESTINFO();
|
||||
}
|
||||
|
||||
void CUIObject::Set_FontX(_float fFontX)
|
||||
{
|
||||
m_fFontX = fFontX;
|
||||
|
||||
@@ -14,6 +14,7 @@ CVIBuffer_Instance::CVIBuffer_Instance(const CVIBuffer_Instance& Prototype)
|
||||
, m_iInstanceStride{ Prototype.m_iInstanceStride }
|
||||
, m_iNumInstance{ Prototype.m_iNumInstance }
|
||||
, m_iNumIndexPerInstance{ Prototype.m_iNumIndexPerInstance }
|
||||
, m_iCopyCount{ Prototype.m_iCopyCount }
|
||||
{
|
||||
Safe_AddRef(m_pVBInstance);
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ HRESULT CVIBuffer_UI_Instance::Initialize_Prototype(const INSTANCE_DESC* pInstan
|
||||
#pragma region INSTANCE_BUFFER
|
||||
const UI_INSTANCE_DESC* pDesc = static_cast<const UI_INSTANCE_DESC*>(pInstanceDesc);
|
||||
|
||||
m_iNumInstance = pDesc->iNum;
|
||||
m_iNumInstance = m_iCopyCount = pDesc->iNum;
|
||||
m_iInstanceStride = sizeof(VTX_INSTANCE_UI);
|
||||
m_iNumIndexPerInstance = 6;
|
||||
|
||||
@@ -370,6 +370,11 @@ void CVIBuffer_UI_Instance::Set_Equip_Index(_uint iIndex)
|
||||
m_pContext->Unmap(m_pVBInstance, 0);
|
||||
}
|
||||
|
||||
void CVIBuffer_UI_Instance::Set_Draw(_int iCount)
|
||||
{
|
||||
m_iNumInstance = (iCount == -1) ? m_iCopyCount : iCount;
|
||||
}
|
||||
|
||||
CVIBuffer_UI_Instance* CVIBuffer_UI_Instance::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, const INSTANCE_DESC* pInstanceDesc)
|
||||
{
|
||||
CVIBuffer_UI_Instance* pInstance = new CVIBuffer_UI_Instance(pDevice, pContext);
|
||||
|
||||
@@ -11,9 +11,8 @@ class ENGINE_DLL CAnimation : public CBase
|
||||
CAnimation(const CAnimation& rhs);
|
||||
virtual ~CAnimation() = default;
|
||||
public:
|
||||
_bool Update_TransformationMatrices(const vector<class CBone*>& Bones, LOCALPOS_DESC** pLocalPosArray, _bool bIsLoop, _float fTimeDelta, _bool bIsSpine, vector<_uint> BoneMask,_vector vector[3] = nullptr);
|
||||
void ProgressAnimation(const vector<CBone*>& Bones,LOCALPOS_DESC** pLocalPosArray, _bool bIsSpine, vector<_uint> BoneMask, _vector vector[3]);
|
||||
void ResetRootMotion();
|
||||
_bool Update_TransformationMatrices(const vector<class CBone*>& Bones, _bool bIsLoop, _float fTimeDelta, _bool bIsSpine, vector<_uint> BoneMask,_vector vector[3] = nullptr, _int RootBoneIndex = -1);
|
||||
void ProgressAnimation(const vector<CBone*>& Bones, _bool bIsSpine, vector<_uint> BoneMask, _vector vector[3], _int RootBoneIndex);
|
||||
void Depart_Animation();
|
||||
void Set_AnimPause(_bool bValue) { m_bPause = bValue; }
|
||||
_float Get_AnimProgressRatio();
|
||||
@@ -38,6 +37,7 @@ class ENGINE_DLL CAnimation : public CBase
|
||||
_float Get_AnimSpeed() { return m_fAnimSpeed; }
|
||||
|
||||
_uint Get_ChannelCount() { return m_iNumChannels; }
|
||||
_uint Get_KeyFrameCount() { return m_iKeyframeCount; }
|
||||
_float Get_Duration() { return m_fDuration; }
|
||||
|
||||
ID3D11Buffer* Get_KeyFrameBuffer() { return m_pKeyFrameBuffer; }
|
||||
|
||||
@@ -30,12 +30,16 @@ class ENGINE_DLL CBone final : public CBase
|
||||
void Set_TransformationMatrix(_fmatrix TransformationMatrix); // 애니메이션에서 현재 로컬 매트릭스를 변경할 때 사용된다
|
||||
_float4x4 Get_TransformationMatrix() { return m_TransformationMatrix; }
|
||||
_int Get_ParentBoneIndex() { return m_iParentBoneIndex; }
|
||||
void SetCPUEvaluated(bool Evaluat) { m_bCPUEvaluated = Evaluat; }
|
||||
_bool IsCPUEvaluated() const { return m_bCPUEvaluated; }
|
||||
|
||||
private:
|
||||
_string m_strName = {};
|
||||
_float4x4 m_TransformationMatrix = {}; // 본의 현재 로컬 매트릭스
|
||||
_float4x4 m_CombinedTransformationMatrix = {}; // 본의 루트노드로부터 상대적인 복합매트릭스 ( 부모노드는 PreTranformMatrix와 월드좌표로부터 상대적임 )
|
||||
_float4x4 m_matInitial = {};
|
||||
_int m_iParentBoneIndex = { -1 }; // 부모본의 인덱스 ( 모델에 있는 본벡터의 인덱스 ) ( 부모는 인덱스 -1 고정 )
|
||||
_bool m_bCPUEvaluated = false;
|
||||
private:
|
||||
HRESULT Initialize(HANDLE hFile, DWORD& dwByte);
|
||||
// 바이너리
|
||||
|
||||
@@ -23,10 +23,9 @@ class ENGINE_DLL CChannel : public CBase
|
||||
CHANNEL_DESC Fill_GPU_ChannelDesc();
|
||||
|
||||
public:
|
||||
void Update_TransformationMatirx(const vector<class CBone*>& Bones, LOCALPOS_DESC** pLocalPosArray, _float fCurrentTrackPosition, _uint* pCurrentKeyFrameIndex, _bool bIsSpine, vector<_uint> BoneMask, _vector vector[3]);
|
||||
void Update_TransformationMatirx(const vector<class CBone*>& Bones, _float fCurrentTrackPosition, _uint* pCurrentKeyFrameIndex, _bool bIsSpine, vector<_uint> BoneMask, _vector vector[3], _int RootBoneIndex);
|
||||
_int Get_BoneIndex() { return { m_iBoneIndex }; }
|
||||
void Set_BoneIndex(_int iBoneIndex) { m_iBoneIndex = iBoneIndex; }
|
||||
void ResetRootMotion();
|
||||
_matrix Get_BoneTransformationMatrix() { return m_BoneTransformationMatrix; }
|
||||
|
||||
KEYFRAME* Get_Frame(_uint iIndex);
|
||||
@@ -58,13 +57,8 @@ class ENGINE_DLL CChannel : public CBase
|
||||
vector<KEYFRAME> m_KeyFrames; // 키프레임 벡터
|
||||
_float3 m_vPrevRootPos = { 0.f, 0.f, 0.f };
|
||||
_int m_ilayerIndex = 0;
|
||||
_float4 m_vPrevRootRot = { 0.f, 0.f, 0.f,0.f };
|
||||
_float4 m_vInitialRootRot = {};
|
||||
_matrix m_BoneTransformationMatrix = {};
|
||||
LOCALPOS_DESC LocalPos = {};
|
||||
vector<KEYFRAME_DESC> m_KeyFrameDesc;
|
||||
_bool m_bInitialRootPos = { false };
|
||||
_bool m_bInitialRootRotSaved = { false };
|
||||
_bool m_IsUpper = false;
|
||||
public:
|
||||
// 바이너리
|
||||
|
||||
@@ -26,10 +26,12 @@ class ENGINE_DLL CComputeShader final : public CComponent
|
||||
virtual HRESULT Initialize(void* pArg);
|
||||
public:
|
||||
vector<D3D11_MAPPED_SUBRESOURCE> Dispatch(_uint iSRVIndex, _uint iUAVIndex, _float3 vGroupCount, ID3D11Buffer** ppBuffers, ID3D11Buffer* pConstantBuffer = nullptr);
|
||||
void Dispatch_ExternalSRV_UAV(_uint srvStartSlot, _uint uavStartSlot, const _float3& groupCount, ID3D11ShaderResourceView** ppSRVs, _uint srvCount, ID3D11UnorderedAccessView** ppUAVs, _uint uavCount, ID3D11Buffer* pConstantBuffer);
|
||||
void Bind_OutPut_SRV(_uint iIndex, _uint iBufferIndex);
|
||||
void Bind_OutPut_SRV_VS(_uint iIndex, _uint iBufferIndex);
|
||||
ID3D11ComputeShader* Get_Compute() { return m_pComputeShader; }
|
||||
ID3D11UnorderedAccessView* GetOutputUAV(_uint iIndex) const;
|
||||
ID3D11Buffer* Get_OutputBuffer(_int iIndex) {return m_pOutputBuffer[iIndex]; }
|
||||
private:
|
||||
void Bind_SRV(_uint iIndex);
|
||||
void Bind_UAV(_uint iIndex);
|
||||
|
||||
@@ -48,10 +48,9 @@ enum class SHADER_PASS_CELL { DEBUG, END };
|
||||
|
||||
enum class SHADER_PASS_DEFERRED { DEBUG, DIRECTIONAL, POINT, COMBINED, BLUR, SPOT,
|
||||
UPSAMPLE, BLOOM_BLURX, BLOOM_BLURY, EMBOSSING, BLOOM_ACCUM, BLOOM_FINISH, BLURX_ENVIRONMENT,
|
||||
POSTCOMBINED, FOG, TONE_MAPPING, SSAO_OCCLUSION, SSAO_BLUR,
|
||||
POSTCOMBINED, FOG, TONE_MAPPING, SSAO_OCCLUSION, SSAO_BLUR, MOTIONBLUR, DOWNSAMPLE,
|
||||
END };
|
||||
|
||||
enum class QUESTTYPE {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 };
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#elif Bin
|
||||
#undef ASSERT_HYUNBIN
|
||||
#define ASSERT_HYUNBIN(expression) assert(expression)
|
||||
#define OPTIONAL_TRUE_KEYINPUTGUICHECK ||true
|
||||
//#define OPTIONAL_TRUE_KEYINPUTGUICHECK ||true
|
||||
#elif 인혁
|
||||
#undef ASSERT_INHYUK
|
||||
#define ASSERT_INHYUK(expression) assert(expression)
|
||||
|
||||
@@ -415,26 +415,14 @@ typedef struct tagChannelDesc
|
||||
//_uint Padding;
|
||||
}CHANNEL_DESC;
|
||||
|
||||
|
||||
typedef struct tagParentDesc
|
||||
{
|
||||
_int ParentIndex;
|
||||
}PARENT_DESC;
|
||||
|
||||
typedef struct tagLocalPos
|
||||
{
|
||||
_float3 Scale;
|
||||
_float pad0;
|
||||
_float4 Rotation;
|
||||
_float3 Translation;
|
||||
_float pad1;
|
||||
}LOCALPOS_DESC;
|
||||
|
||||
typedef struct tagBoneDesc
|
||||
typedef struct tagBoneMatrix
|
||||
{
|
||||
_float4x4 Local;
|
||||
_float4x4 Combined;
|
||||
_float4x4 LocalCombined;
|
||||
}BONE_DESC;
|
||||
|
||||
|
||||
typedef struct tagSSAO_Geometry_Hemisphere {
|
||||
_float3 SamplePos[SSAO_SAMPLE_NUMBER];
|
||||
}SSAO_GEOMETRY_HEMISPHERE;
|
||||
@@ -443,4 +431,9 @@ typedef struct tagSSAO_GeometryDirections_RANDOM_REAL {
|
||||
_float4 vDir[16];
|
||||
}SSAO_GEOMETRYDIRECTIONS_RANDOM_REAL;
|
||||
|
||||
typedef struct tagPrevVPMatrices {
|
||||
_float4x4 PrevViewMatrix;
|
||||
_float4x4 PrevProjMatrix;
|
||||
}PREVVPMATRICES;
|
||||
|
||||
NS_END
|
||||
|
||||
@@ -103,9 +103,7 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
HRESULT Add_RenderGroup(RENDER eRenderGroup, class CGameObject* pRenderObject);
|
||||
void Render_PreShadow(const _float4x4& ViewMatrix, const _float4x4& ProjMatrix);
|
||||
HRESULT Bind_PreShadowMatrix(class CShader* pShader, const _char* pConstants, D3DTS eType);
|
||||
#pragma endregion
|
||||
|
||||
#pragma region ASSET_MANAGER
|
||||
HRESULT Bind_PrevMatrix(class CShader* pShader, const _char* pConstants, D3DTS eType);
|
||||
#pragma endregion
|
||||
|
||||
#pragma region KEY_MANAGER
|
||||
@@ -174,8 +172,8 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
HRESULT Begin_MRT_NO_DepthStencil(const _wstring& strMRTTag);
|
||||
HRESULT End_MRT();
|
||||
HRESULT Bind_RenderTarget(const _wstring& strTargetTag, class CShader* pShader, const _char* pConstantName);
|
||||
HRESULT Copy_RenderTarget(const _wstring& strTargetTag, ID3D11Texture2D* pTexture2D);
|
||||
HRESULT Paste_RenderTarget(const _wstring& strTargetTag, ID3D11Texture2D* pTexture2D);
|
||||
HRESULT Copy_RenderTargetTo(const _wstring& strTargetTag, ID3D11Texture2D* pTexture2D);
|
||||
HRESULT Copy_RenderTargetFrom(const _wstring& strTargetTag, ID3D11Texture2D* pTexture2D);
|
||||
HRESULT Accumulate_RenderTarget(class CVIBuffer_Rect* pVIBuffer, class CShader* pShader, const _wstring& wstrRenderTarget_SrcA, const _wstring& wstrRenderTarget_SrcB, const _wstring& wstrRenderTarget_Target, SHADER_PASS_DEFERRED ePass);
|
||||
HRESULT Refit_RenderTarget(class CVIBuffer_Rect* pVIBuffer, class CShader* pShader, const _wstring& wstrRenderTargetInput, const _wstring& wstrRenderTargetOutput, SHADER_PASS_DEFERRED ePass);
|
||||
HRESULT Finish_RenderTarget(class CVIBuffer_Rect* pVIBuffer, class CShader* pShader, const _wstring& wstrRenderTargetOriginal, const _wstring& wstrRenderTargetBloomed, SHADER_PASS_DEFERRED ePass);
|
||||
@@ -335,7 +333,7 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
_float m_fTimer_Render_NonLight = { 0.f };
|
||||
_float m_fTimer_Render_Blend = { 0.f };
|
||||
_float m_fTimer_Render_WeightBlend = { 0.f };
|
||||
_float m_fTimer_Render_Bloom = { 0.f };
|
||||
_float m_fTimer_Render_PostProcessing = { 0.f };
|
||||
_float m_fTimer_Render_LastColor = { 0.f };
|
||||
_float m_fTimer_Render_Tone_Mapping = { 0.f };
|
||||
_float m_fTimer_Render_UI = { 0.f };
|
||||
|
||||
@@ -18,15 +18,16 @@ class ENGINE_DLL CMesh final : public CVIBuffer
|
||||
void SeT_MaterialIndex(_uint iMaterialIndex) { m_iMaterialIndex = iMaterialIndex; }
|
||||
|
||||
const _char* Get_Name() const { return m_strName.c_str(); }
|
||||
_int Get_NumBone() { return m_iNumBones; }
|
||||
HRESULT Bind_BoneMatrices(const vector<class CBone*>& Bones, class CShader* pShader, const _char* pConstantName);
|
||||
HRESULT Bind_BoneMatrices(_float4x4* pCombinedMatrices, class CShader* pShader, const _char* pConstantName);
|
||||
HRESULT Render_Indexed(_uint IndexCount, _uint StartIndexLocation, _uint BaseVertexLocation);
|
||||
|
||||
#ifdef EDITOR_PROJECT
|
||||
private:
|
||||
virtual HRESULT Initialize_Prototype(MODEL eType, vector<class CBone*>& Bones, const aiMesh* pAIMesh, _fmatrix& PreTransformMatrix);
|
||||
HRESULT Ready_VertexBuffer_For_NonAnim(const aiMesh* pAIMesh, _fmatrix PreTransformMatrix);
|
||||
HRESULT Ready_VertexBuffer_For_Anim(vector<class CBone*>& Bones, const aiMesh* pAIMesh);
|
||||
|
||||
public:
|
||||
static CMesh* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, MODEL eType, vector<class CBone*>& Bones, const aiMesh* pAIMesh, _fmatrix& PreTransformMatrix);
|
||||
#endif // EDITOR_PROJECT
|
||||
@@ -38,13 +39,16 @@ class ENGINE_DLL CMesh final : public CVIBuffer
|
||||
virtual HRESULT Render_Instance(_uint iNumInstance);
|
||||
|
||||
_uint Get_Vertex() { return m_iNumVertices; }
|
||||
vector<_float4x4> Get_OffsetMatrix() { return m_offsetMatrices; }
|
||||
ID3D11ShaderResourceView* Get_BoneRemapSRV() { return m_pBoneRemapSRV; }
|
||||
ID3D11Buffer* Get_BoneRemapBuffer() { return m_pBoneRemapBuffer; }
|
||||
private:
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
// 바이너리
|
||||
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);
|
||||
|
||||
HRESULT Create_BoneRemapBuffer();
|
||||
private:
|
||||
_string m_strName = { };
|
||||
_uint m_iMaterialIndex = {};
|
||||
@@ -54,6 +58,11 @@ class ENGINE_DLL CMesh final : public CVIBuffer
|
||||
vector<_int> m_BoneIndices;
|
||||
_float4x4* m_pBoneMatrices = { nullptr };
|
||||
vector<_float4x4> m_offsetMatrices;
|
||||
vector<_uint> m_BoneRemap;
|
||||
ID3D11ShaderResourceView* m_pBoneRemapSRV = nullptr;
|
||||
ID3D11Buffer* m_pBoneRemapBuffer = nullptr;
|
||||
|
||||
|
||||
|
||||
// 바이너리
|
||||
std::vector<_uint> m_Indices;
|
||||
|
||||
@@ -11,10 +11,15 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
{
|
||||
_float CurrentTime;
|
||||
_float Duration;
|
||||
_float Speed;
|
||||
_int MeshBoneCount;
|
||||
_int BoneCount;
|
||||
_float4x4 PreTransformMatrix;
|
||||
|
||||
_int RootBoneIndex;
|
||||
_int Padding;
|
||||
_float PrevTime;
|
||||
_float BlendRatio;
|
||||
_float4x4 PreTransformMatrix;
|
||||
_float4 RootInitRot;
|
||||
}ANIMSTATE_DESC;
|
||||
|
||||
private:
|
||||
@@ -59,28 +64,32 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
void Set_BlendDuration(_float Duration) { m_fBlendDuration = Duration; }
|
||||
#pragma endregion
|
||||
#pragma region Mesh
|
||||
const _char* Get_MeshName(_uint iIndex);
|
||||
_uint Get_NumMeshes() const { return m_iNumMeshes; }
|
||||
void Update_RootBone(_float Amount = 1.f);
|
||||
void Initialize_RootBone();
|
||||
const _char* Get_MeshName(_uint iIndex);
|
||||
_uint Get_NumMeshes() const { return m_iNumMeshes; }
|
||||
void Update_RootBone(_float Amount = 1.f);
|
||||
void Initialize_RootBone();
|
||||
void BeginFrame();
|
||||
vector<_float4x4> Get_OffsetMatrix(_int iIndex);
|
||||
void Apply_CPUMask_ToBones();
|
||||
void Mark_CPUChain(_int boneIdx);
|
||||
#pragma endregion
|
||||
#pragma region Bone
|
||||
HRESULT Bind_BoneMatrices(_uint iMeshIndex, class CShader* pShader, const _char* pConstantName);
|
||||
const _float4x4* Get_BoneMatrixPtr(const _char* pBoneName) const;
|
||||
const _float4x4* Get_BoneMatrixPtr(const _char* pBoneName);
|
||||
_matrix Get_BoneMatrix(const _char* pBoneName) const;
|
||||
_matrix Get_BoneLocalMatrix(const _char* pBoneName) const;
|
||||
static _int Get_BoneIndex(const _char* pBoneName, vector<class CBone*> Bones); // 본의 벡터와 이름을 넘겨주면 인덱스를 넘겨줌 ( n 순회 )
|
||||
_int Get_BoneIndex(const _char* pBoneName) const;
|
||||
_matrix Get_BoneMatrix(_uint iBoneIndex);
|
||||
void Combined_BoneMatrix();
|
||||
|
||||
#pragma endregion
|
||||
#pragma region Material
|
||||
HRESULT Bind_Material(_uint iMeshIndex, class CShader* pShader);
|
||||
HRESULT Begin(_uint iMeshIndex, class CShader* pShader, _bool OutLine = false);
|
||||
#pragma endregion
|
||||
|
||||
void ComputeAnimation(_uint AnimIndex);
|
||||
void ComputeAnimation(_uint AnimIndex, _uint MeshIndex);
|
||||
void Bind_OutPut_SRV_VS(_uint iIndex, _uint iBufferIndex);
|
||||
void ComputeAnimation_Second(_uint AnimIndex);
|
||||
void InItialize_BoneIndex();
|
||||
|
||||
@@ -146,8 +155,7 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
_int m_iCurrSecondAnimIndex = { -1 };
|
||||
_int m_iBoneIndex[ENUM_CLASS(BLEND_BONE::END)] = { -1,-1,-1,-1,-1,-1 };
|
||||
vector<vector<_uint>> m_BoneMask;
|
||||
|
||||
|
||||
vector<_bool> m_CPUBoneMask;
|
||||
|
||||
// 바이너리
|
||||
SaveModel* m_pSaveModel = { nullptr };
|
||||
@@ -161,18 +169,19 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
_matrix m_BoneTransformationMatrix = {};
|
||||
_float4 m_vInitialRootRot = {};
|
||||
|
||||
_float m_fRadius = { 0.f }; // 컬링용 Radius
|
||||
_int m_iRootBoneIndex = { -1 }; // 루트본의 인덱스
|
||||
_float m_fRadius = { 0.f }; // 컬링용 Radius
|
||||
_int m_iRootBoneIndex = { -1 }; // 루트본의 인덱스
|
||||
_vector m_vector[3];
|
||||
|
||||
vector<_uint> m_iBoneMask;
|
||||
_bool m_bInitialRootPos = { false };
|
||||
_bool m_bInitialRootRotSaved = { false };
|
||||
_bool m_bLoopRestarted = false;
|
||||
_bool m_bIsSecondFinishedAnim = { false };
|
||||
_bool m_bIsSecondLoop = { false };
|
||||
_bool m_bRatio = { false };
|
||||
_bool m_bRootBone = {};
|
||||
_bool m_bIsSecondFinishedAnim = { false };
|
||||
_bool m_bIsSecondLoop = { false };
|
||||
_bool m_bRatio = { false };
|
||||
_bool m_bRootBone = {};
|
||||
_float4x4 m_RootMatrix = {};
|
||||
|
||||
private:
|
||||
#ifdef EDITOR_PROJECT
|
||||
@@ -184,26 +193,37 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
#pragma region Compute
|
||||
|
||||
private:
|
||||
HRESULT Create_ComputeShader();
|
||||
HRESULT Create_ParentVB();
|
||||
void Create_Temp();
|
||||
void Create_LocalPosVB();
|
||||
HRESULT Create_BoneLocalVB();
|
||||
HRESULT Create_Temp();
|
||||
HRESULT Create_BoneMatrixVB();
|
||||
HRESULT Create_Const();
|
||||
HRESULT Create_ParentSrv();
|
||||
HRESULT Create_BoneLocalSrv();
|
||||
|
||||
_uint m_iNumBuffer = {};
|
||||
_uint m_iNumBuffer = {};
|
||||
|
||||
vector<_int> m_Parent = {};
|
||||
vector<_float4x4> m_BoneLocal = {};
|
||||
|
||||
vector<PARENT_DESC> m_Parent = {};
|
||||
vector<ANIMSTATE_DESC> m_AnimRanges;
|
||||
|
||||
LOCALPOS_DESC* m_pLocalPos[2] = { nullptr };
|
||||
|
||||
class CComputeShader* m_pComputeShader = nullptr;
|
||||
|
||||
ID3D11Buffer* m_pConstantBuffer = { nullptr };
|
||||
|
||||
ID3D11Buffer* m_pParentBuffer = { nullptr };
|
||||
ID3D11Buffer* m_pLocalPosBuffer = { nullptr };
|
||||
ID3D11Buffer* m_pBoneMatrixBuffer = { nullptr };
|
||||
ID3D11Buffer* m_pBoneLocalBuffer = { nullptr };
|
||||
|
||||
ID3D11ShaderResourceView* m_pParentSRV = {};
|
||||
ID3D11ShaderResourceView* m_pBoneLocalSRV = {};
|
||||
ID3D11ShaderResourceView* m_pBoneMatrixSRV = {};
|
||||
ID3D11UnorderedAccessView* m_pBoneMatrixUAV = {};
|
||||
#pragma endregion
|
||||
|
||||
private:
|
||||
|
||||
// 바이너리
|
||||
virtual HRESULT Initialize_Prototype(MODEL eType, const _char* pModelFilePath, _fmatrix PreTransformMatrix);
|
||||
void LoadAdditionalAnimations(const char* ModelFilePath);
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include "GameObject.h"
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
|
||||
class ENGINE_DLL CQuest abstract : public CGameObject
|
||||
{
|
||||
public:
|
||||
typedef struct tagObjectiveInfo
|
||||
{
|
||||
_bool bClear{};
|
||||
_int iTargetID{};
|
||||
_int iRequiredCount{};
|
||||
_int iCurrentCount{};
|
||||
}OBJECTIVEINFO;
|
||||
|
||||
typedef struct tagRewardsInfo
|
||||
{
|
||||
_int iRewardType{};
|
||||
_int iRewardID{};
|
||||
}REWARDSINFO;
|
||||
|
||||
typedef struct tagQuestInfo
|
||||
{
|
||||
_int iQuestID{};
|
||||
_int iType{};
|
||||
_wstring pQuestName;
|
||||
_wstring pQuestInfo;
|
||||
vector<OBJECTIVEINFO> ObjectiveInfo;
|
||||
vector<REWARDSINFO> RewardsInfo;
|
||||
_int iAcceptState;
|
||||
}QUESTINFO;
|
||||
protected:
|
||||
CQuest(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CQuest(const CQuest& rhs);
|
||||
virtual ~CQuest() = default;
|
||||
|
||||
protected:
|
||||
virtual HRESULT Initialize_Prototype() override;
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
|
||||
public:
|
||||
virtual _bool Update_Objective(_int MonsterID);
|
||||
virtual _int Get_QuestID();
|
||||
|
||||
protected:
|
||||
vector<OBJECTIVEINFO> m_ObjectiveInfo;
|
||||
_int m_iQuestID{};
|
||||
|
||||
public:
|
||||
virtual void Free() override;
|
||||
};
|
||||
|
||||
NS_END
|
||||
@@ -17,8 +17,8 @@ class CRenderTarget final : public CBase
|
||||
HRESULT Initialize(_uint iSizeX, _uint iSizeY, DXGI_FORMAT ePixelFormat, const _float4& vClearColor);
|
||||
HRESULT Bind_ShaderResource(class CShader* pShader, const _char* pConstantName);
|
||||
void Clear();
|
||||
void Copy_Resource(ID3D11Texture2D* pTexture2D);
|
||||
void Paste_Resource(ID3D11Texture2D* pTexture2D);
|
||||
void Copy_ResourceTo(ID3D11Texture2D* pTexture2D);
|
||||
void Copy_ResourceFrom(ID3D11Texture2D* pTexture2D);
|
||||
void Get_TextureDesc(D3D11_TEXTURE2D_DESC& Desc);
|
||||
ID3D11ShaderResourceView* Get_SRV() const { return m_pSRV; }
|
||||
|
||||
|
||||
@@ -18,10 +18,11 @@ class CRenderTarget_Manager final : public CBase
|
||||
HRESULT Begin_MRT_NO_DepthStencil(const _wstring& strMRTTag);
|
||||
HRESULT End_MRT();
|
||||
HRESULT Bind_RenderTarget(const _wstring& strTargetTag, class CShader* pShader, const _char* pConstantName);
|
||||
HRESULT Copy_RenderTarget(const _wstring& strTargetTag, ID3D11Texture2D* pTexture2D);
|
||||
HRESULT Paste_RenderTarget(const _wstring& strTargetTag, ID3D11Texture2D* pTexture2D);
|
||||
HRESULT Copy_RenderTargetTo(const _wstring& strTargetTag, ID3D11Texture2D* pTexture2D);
|
||||
HRESULT Copy_RenderTargetFrom(const _wstring& strTargetTag, ID3D11Texture2D* pTexture2D);
|
||||
HRESULT Bind_CS_RenderTarget(_uint iIndex, const _wstring& strTargetTag);
|
||||
|
||||
|
||||
// 두 랜더타겟을 하나로 모음
|
||||
HRESULT Accumulate_RenderTarget(class CVIBuffer_Rect* pVIBuffer, class CShader* pShader, const _wstring& wstrRenderTarget_SrcA, const _wstring& wstrRenderTarget_SrcB, const _wstring& wstrRenderTarget_Target, SHADER_PASS_DEFERRED ePass);
|
||||
// 랜더 타겟의 크기를 dest로 다시 맞춤
|
||||
|
||||
@@ -13,8 +13,9 @@ class CRenderer final : public CBase
|
||||
public:
|
||||
void Render();
|
||||
HRESULT Add_RenderGroup(RENDER eRenderGroup, class CGameObject* pRenderObject);
|
||||
void Render_PreShadow(const _float4x4& ViewMatrix, const _float4x4& ProjMatrix);
|
||||
void Render_PreShadow(const _float4x4& ViewMatrix, const _float4x4& ProjMatrix);
|
||||
HRESULT Bind_PreShadowMatrix(class CShader* pShader, const _char* pConstants, D3DTS eType);
|
||||
HRESULT Bind_PrevMatrix(class CShader* pShader, const _char* pConstants, D3DTS eType);
|
||||
|
||||
#ifdef _DEBUG
|
||||
private:
|
||||
@@ -38,9 +39,9 @@ class CRenderer final : public CBase
|
||||
class CVIBuffer_Rect* m_pVIBuffer = { nullptr };
|
||||
|
||||
private:
|
||||
_float4x4 m_WorldMatrix = {};
|
||||
_float4x4 m_ViewMatrix = {};
|
||||
_float4x4 m_ProjMatrix = {};
|
||||
_float4x4 m_ScreenWorldMatrix = {};
|
||||
_float4x4 m_ScreenViewMatrix = {};
|
||||
_float4x4 m_ScreenProjMatrix = {};
|
||||
|
||||
ID3D11DepthStencilView* m_pShadowDSV_NEAR = { nullptr };
|
||||
ID3D11DepthStencilView* m_pShadowDSV_MIDDLE = { nullptr };
|
||||
@@ -48,12 +49,24 @@ class CRenderer final : public CBase
|
||||
ID3D11DepthStencilView* m_pPreShadowDSV = { nullptr };
|
||||
ID3D11ShaderResourceView* m_pSSAO_NoiseSRV = { nullptr };
|
||||
ID3D11Texture2D* m_pSSAO_NoiseTexture = { nullptr };
|
||||
ID3D11Buffer* m_pGlobalStaticCB = { nullptr };
|
||||
|
||||
_float4x4 m_MotionBlurPreViewMatrix = {};
|
||||
_float4x4 m_MotionBlurPreProjMatrix = {};
|
||||
|
||||
_float4x4 m_PreShadowView = {};
|
||||
_float4x4 m_PreShadowProj = {};
|
||||
|
||||
|
||||
|
||||
#pragma region TunningParameters
|
||||
/* TunningParam */
|
||||
|
||||
// MotionBlur
|
||||
_float m_fMBBlurRadius = { 1.f };
|
||||
_int m_iMBSampleCount = { 3 };
|
||||
_int m_iMBType = { 0 };
|
||||
|
||||
// ToneMapping
|
||||
_int m_iToneMappingType = { 2 };
|
||||
_float m_fExposure = { 0.7f };
|
||||
|
||||
@@ -75,6 +88,8 @@ class CRenderer final : public CBase
|
||||
|
||||
SSAO_GEOMETRY_HEMISPHERE m_tagSSAOGeometry = {};
|
||||
SSAO_GEOMETRYDIRECTIONS_RANDOM_REAL m_tagSSAOGeometryDirections = {};
|
||||
#pragma endregion
|
||||
|
||||
private:
|
||||
void Render_Occlusion();
|
||||
void Render_Priority();
|
||||
@@ -91,7 +106,7 @@ class CRenderer final : public CBase
|
||||
void Render_WeightBlend();
|
||||
void Render_NonLight();
|
||||
void Render_Blend();
|
||||
void Render_Bloom();
|
||||
void Render_PostProcessing();
|
||||
void Render_Distortion();
|
||||
void Render_DistortionAcc();
|
||||
void Render_LastColor();
|
||||
@@ -106,7 +121,7 @@ class CRenderer final : public CBase
|
||||
#endif
|
||||
|
||||
private:
|
||||
void Fill_Geometry(_uint iNumSample);
|
||||
void Fill_Geometry(_uint iNumSample);
|
||||
HRESULT Ready_ShadowDepthStencilView(_uint iSizeX, _uint iSizeY);
|
||||
|
||||
private:
|
||||
|
||||
@@ -9,6 +9,7 @@ class ENGINE_DLL CStat final : public CComponent
|
||||
typedef struct tagUnitInfo
|
||||
{
|
||||
_wstring pUnit_Name;
|
||||
_int iObjectID{};
|
||||
_float fCurrentHp{};
|
||||
_float fMaxHp{};
|
||||
_float fTargetHp{};
|
||||
|
||||
@@ -33,11 +33,12 @@ class ENGINE_DLL CTransform final :
|
||||
_float3 Get_Scale() const;
|
||||
_vector Get_QuarternionVector() const; // 현재 회전정보를 담고 있는 쿼터니언 벡터를 out
|
||||
_vector Get_RollPitchYawVector() const;
|
||||
_vector Get_State(STATE eState) const {
|
||||
_vector Get_State(STATE eState) const {
|
||||
return XMLoadFloat4(reinterpret_cast<const _float4*>(&m_WorldMatrix.m[ENUM_CLASS(eState)]));
|
||||
}
|
||||
const _float4* Get_StatePtr(STATE eState) { return reinterpret_cast<_float4*>(&m_WorldMatrix.m[ENUM_CLASS(eState)]); }
|
||||
const _float4x4* Get_WorldMatrixPtr() const { return &m_WorldMatrix; }
|
||||
const _float4x4* Get_PrevWorldMatrixPtr() const { return &m_PrevMatrix; }
|
||||
const _matrix Get_XMWorldMatrix() const { return XMLoadFloat4x4(&m_WorldMatrix); }
|
||||
const _matrix Get_WorldMatrixInv() const { return XMMatrixInverse(nullptr, XMLoadFloat4x4(&m_WorldMatrix)); }
|
||||
public:
|
||||
@@ -83,6 +84,7 @@ class ENGINE_DLL CTransform final :
|
||||
_float m_fSpeedPerSec = {};
|
||||
_float m_fRotationPerSec = {};
|
||||
_float4x4 m_WorldMatrix = {};
|
||||
_float4x4 m_PrevMatrix = {};
|
||||
_float m_fRadius = { 20.f };
|
||||
|
||||
_float3 m_vMomentum = {}; // 현재 프레임에 계산된 이동량
|
||||
|
||||
@@ -36,6 +36,32 @@ typedef struct tagSpellInfo
|
||||
_float fPreview{};
|
||||
_float fVidio{};
|
||||
}SPELLINFO;
|
||||
|
||||
typedef struct tagObjectiveInfo
|
||||
{
|
||||
_int iObjectType{};
|
||||
_int iTargetID{};
|
||||
_int iRequiredCount{};
|
||||
_int iCurrentCount{};
|
||||
}OBJECTIVEINFO;
|
||||
|
||||
typedef struct tagRewardsInfo
|
||||
{
|
||||
_int iRewardType{};
|
||||
_int iRewardID{};
|
||||
}REWARDSINFO;
|
||||
|
||||
typedef struct tagQuestInfo
|
||||
{
|
||||
_int iQuestID{};
|
||||
_int iType{};
|
||||
_wstring pQuestName;
|
||||
_wstring pQuestInfo;
|
||||
vector<OBJECTIVEINFO> ObjectiveInfo;
|
||||
vector<REWARDSINFO> RewardsInfo;
|
||||
_int iAcceptState;
|
||||
}QUESTINFO;
|
||||
|
||||
typedef struct SlotHover
|
||||
{
|
||||
_int iSlotID{};
|
||||
@@ -140,6 +166,7 @@ typedef struct SlotHover
|
||||
virtual _bool Get_Hover();
|
||||
|
||||
virtual const SPELLINFO Get_Info(_int Index);
|
||||
virtual const QUESTINFO Get_QuestInfo(_int Index);
|
||||
|
||||
virtual void Set_FontX(_float fFontX);
|
||||
virtual void Set_FontY(_float fFontY);
|
||||
|
||||
@@ -32,6 +32,7 @@ class ENGINE_DLL CVIBuffer_Instance abstract : public CVIBuffer
|
||||
D3D11_SUBRESOURCE_DATA m_InstanceInitialDesc = {};
|
||||
_uint m_iInstanceStride = {};
|
||||
_uint m_iNumInstance = {};
|
||||
_uint m_iCopyCount{};
|
||||
_uint m_iNumIndexPerInstance = {};
|
||||
public:
|
||||
virtual void Free() override;
|
||||
|
||||
@@ -38,6 +38,7 @@ class ENGINE_DLL CVIBuffer_UI_Instance final : public CVIBuffer_Instance
|
||||
_int Set_Mouse_Hover(_float2 fMousePos);
|
||||
void Set_Hover_Index(_uint iIndex);
|
||||
void Set_Equip_Index(_uint iIndex);
|
||||
void Set_Draw(_int iCount = -1);
|
||||
|
||||
private:
|
||||
VTX_INSTANCE_UI* m_pInstanceVertices = { nullptr };
|
||||
|
||||
Reference in New Issue
Block a user