[merge commit]

This commit is contained in:
kimnuri
2025-11-17 10:03:14 +09:00
106 changed files with 2252 additions and 358 deletions
+1 -1
View File
@@ -46,4 +46,4 @@
*.RTF diff=astextplain
*.fbx filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
@@ -194,8 +194,8 @@ BlendState BS_WeightBlend
BlendEnable[7] = true;
SrcBlend[0] = Inv_Src_Alpha;
DestBlend[0] = Src_Alpha;
SrcBlend[0] = Src_Alpha;
DestBlend[0] = Inv_Src_Alpha;
BlendOp[0] = Add;
@@ -57,31 +57,9 @@ PS_OUT_BACKBUFFER PS_OUT_LASTCOLOR(PS_IN In)
discard;
}
int iOption = vColorTexture.a * 10;
Out.vBackBuffer = vColorTexture;
switch (iOption)
{
case 1:
Out.vBackBuffer.rgb /= vColorTexture.rgb;
break;
case 2:
Out.vBackBuffer.rgb += vColorTexture.rgb;
break;
case 3:
Out.vBackBuffer.rgb -= vColorTexture.rgb;
break;
case 4:
Out.vBackBuffer.rgb *= vColorTexture.rgb;
break;
case 5:
Out.vBackBuffer.rgb = vColorTexture.rgb;
break;
default:
break;
}
return Out;
}
@@ -21,10 +21,13 @@ struct ParticleValue
float2 vMaskingUVMoveTime;
float2 vDiffuseUVMoveTime;
float2 vDistortionUVMoveTime;
float2 vNoiseUVMoveTime;
float2 vAniTime;
float2 vAniIndex;
};
@@ -16,7 +16,16 @@ vector g_vCamPosition;
Texture2D g_DiffuseTexture;
Texture2D g_NormalTexture;
Texture2D g_MaskingTexture;
Texture2D g_DAOTexture;
Texture2D g_THVTexture;
float3 g_RootColor;
float3 g_TipColor;
float3 g_DyeColor;
float g_DyeOpacity;
float g_HairRoughness;
matrix g_BoneMatrices[512];
@@ -274,31 +283,38 @@ PS_OUT_BLUR PS_MAIN_BLUR(PS_IN_BLUR In)
return Out;
}
PS_OUT PS_MAIN_TEST(PS_IN In)
PS_OUT PS_HAIR(PS_IN In)
{
PS_OUT Out;
float4 vMtrlDiffuse = g_TestColor;
float4 vMtrlMask = g_MaskingTexture.Sample(DefaultSampler, In.vTexcoord);
float fAlpha = vMtrlMask.r;
if (fAlpha < 0.1f)
float4 DAO = g_DAOTexture.Sample(DefaultSampler, In.vTexcoord);
float alpha = DAO.a;
if (alpha < 0.1f)
discard;
float4 THV = g_THVTexture.Sample(DefaultSampler, In.vTexcoord);
float rootMask = THV.r;
float tipMask = THV.g;
float variation = THV.b;
float3 baseColor = lerp(g_RootColor, g_TipColor, tipMask);
baseColor *= lerp(0.8, 1.2, variation);
baseColor = lerp(baseColor, g_DyeColor, g_DyeOpacity);
float4 vNormalDesc = g_NormalTexture.Sample(MirrorSampler, In.vTexcoord);
float3x3 WorldMatrix = float3x3(In.vTangent, In.vBinormal * -1.f, In.vNormal);
float3 vNormal = mul(vNormalDesc.xyz * 2.f - 1.f, WorldMatrix);
float3 normal = mul(vNormalDesc.xyz * 2.f - 1.f, WorldMatrix);
if (g_bRimLight)
{
float fRimLight = GetRimLight(g_vCamPosition.xyz, In.vWorldPos.xyz, vNormal, g_fRimPower, g_fRimStrength);
vMtrlDiffuse.rgb = lerp(vMtrlDiffuse.rgb, g_vRimColor.rgb, fRimLight);
float fRim = GetRimLight(g_vCamPosition.xyz, In.vWorldPos.xyz, normal, g_fRimPower, g_fRimStrength);
baseColor = lerp(baseColor, g_vRimColor.rgb, fRim);
}
Out.vDiffuse = float4(vMtrlDiffuse.rgb * vMtrlMask.r, g_TestColor.a);
Out.vNormal = float4(vNormal * 0.5f + 0.5f, 0.f);
Out.vDiffuse = float4(baseColor, alpha);
Out.vNormal = float4(normal * 0.5f + 0.5f, 0.f);
Out.vDepth = float4(In.vProjPos.z / In.vProjPos.w, In.vProjPos.w / g_fFar, 0.0f, 1.f);
return Out;
@@ -376,14 +392,14 @@ technique11 DefaultTechnique
PixelShader = compile ps_5_0 PS_MAIN_BLUR();
}
pass TestPass
pass HairPass
{
SetRasterizerState(RS_Default);
SetDepthStencilState(DSS_Default, 0);
SetBlendState(BS_AlphaBlend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
VertexShader = compile vs_5_0 VS_MAIN();
GeometryShader = NULL;
PixelShader = compile ps_5_0 PS_MAIN_TEST();
PixelShader = compile ps_5_0 PS_HAIR();
}
pass EyeLashPass
@@ -29,10 +29,15 @@ Texture2D g_NormalTexture : register(t1);
Texture2D g_MaskingTexture : register(t2);
Texture2D g_DissolveTexture : register(t3);
Texture2D g_NoiseTexture : register(t4);
Texture2D g_EmissiveTexture : register(t6);
StructuredBuffer<ParticleValue> g_ParticleValue : register(t5);
Texture2D g_EmissiveTexture : register(t6);
Texture2D g_DepthStencilTexture : register(t7);
float4 g_vCamPosition;
vector g_vColor;
@@ -204,25 +209,24 @@ PS_OUT BlendedWeight(vector fDiffuse, float fLinearZ)
float fWeight =
max(
min(1.0, max(max(vColor.r, vColor.g), vColor.b) * fAlpha),
fAlpha
) *
clamp(
0.03 / (1e-4 + pow(fLinearZ / 200, 4.0)),
1e-2, 3e3
);
min(1.0, max(max(vColor.r, vColor.g), vColor.b) * fAlpha), fAlpha)
*
clamp( 0.01 / (1e-4 + pow(fLinearZ / 200, 4.0)), 0.01f, 1000 );
//float fWeight = clamp(0.03f / (1e-5 + pow(fLinearZ, 4.0f)), 0.01, 3e3);
//float fWeight = clamp(0.03f / (1e-5 + pow(fLinearZ, 2.0f)), 0.01, 3e3);
//fWeight = max(fWeight, 1.0);
//이게 오리지널 웨이트 함수
//float fWeight = pow(fLinearZ, -2.5);
//float fWeight = clamp(pow(fLinearZ, -2.5f), 1.0f, 1000.0f);
Out.vDiffuse = vector(vColor.rgb * fAlpha, fAlpha) * fWeight;
Out.vRevealage.r = fAlpha;
Out.vColorTarget = vector(0.f, 0.f, 0.f, 0.f);
Out.vRevealage.a = fAlpha;
return Out;
}
@@ -349,6 +353,9 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In)
vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlMask.r);
if (vMtrlDiffuse.a <= 0.f)
discard;
if (g_isDissolve == true)
{
vMtrlDissolve = g_DissolveTexture.Sample(DefaultSampler, In.vTexcoord);
@@ -369,7 +376,18 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In)
}
Out = BlendedWeight(vMtrlDiffuse , In.vProjPos.w);
int2 iTexel = int2(In.vPosition.xy);
float fDepthStencilValue = g_DepthStencilTexture.Load(int3(iTexel, 0)).r;
float fbias = 0.00005f;
if (fDepthStencilValue <= In.vProjPos.z / In.vProjPos.w + fbias)
discard;
Out = BlendedWeight(vMtrlDiffuse, In.vProjPos.w);
//if (vMtrlDiffuse.a >= g_fEmissiveCutAlpha)
@@ -565,7 +583,7 @@ technique11 DefaultTechnique
pass NON_NOMALMAP
{
SetRasterizerState(RS_Nocull);
SetDepthStencilState(DSS_Default, 0);
SetDepthStencilState(DSS_None, 0);
SetBlendState(BS_WB_Acc, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
VertexShader = compile vs_5_0 VS_MAIN();
GeometryShader = NULL;
@@ -194,8 +194,8 @@ BlendState BS_WeightBlend
BlendEnable[7] = true;
SrcBlend[0] = Inv_Src_Alpha;
DestBlend[0] = Src_Alpha;
SrcBlend[0] = Src_Alpha;
DestBlend[0] = Inv_Src_Alpha;
BlendOp[0] = Add;
@@ -57,31 +57,9 @@ PS_OUT_BACKBUFFER PS_OUT_LASTCOLOR(PS_IN In)
discard;
}
int iOption = vColorTexture.a * 10;
Out.vBackBuffer = vColorTexture;
switch (iOption)
{
case 1:
Out.vBackBuffer.rgb /= vColorTexture.rgb;
break;
case 2:
Out.vBackBuffer.rgb += vColorTexture.rgb;
break;
case 3:
Out.vBackBuffer.rgb -= vColorTexture.rgb;
break;
case 4:
Out.vBackBuffer.rgb *= vColorTexture.rgb;
break;
case 5:
Out.vBackBuffer.rgb = vColorTexture.rgb;
break;
default:
break;
}
return Out;
}
@@ -21,10 +21,13 @@ struct ParticleValue
float2 vMaskingUVMoveTime;
float2 vDiffuseUVMoveTime;
float2 vDistortionUVMoveTime;
float2 vNoiseUVMoveTime;
float2 vAniTime;
float2 vAniIndex;
};
@@ -14,6 +14,7 @@ struct ParticleValue
float2 vMaskingUVMoveTime;
float2 vDiffuseUVMoveTime;
float2 vDistortionUVMoveTime;
float2 vNoiseUVMoveTime;
float2 vAniTime;
@@ -35,6 +36,7 @@ StructuredBuffer<ParticleValue> g_ParticleValue : register(t5);
Texture2D g_EmissiveTexture : register(t6);
Texture2D g_DepthStencilTexture : register(t7);
Texture2D g_DistortionTexture : register(t8);
@@ -44,27 +46,30 @@ vector g_vColor;
float2 g_vDiffuseUVGainAmount;
float2 g_vMaskingUVGainAmount;
float2 g_vNoiseUVGainAmount;
float2 g_vDiffuseNoiseUVGainAmount;
float2 g_vMaskNoiseUVGainAmount;
//
int g_iMaskMoveLerpOption;
int g_iDiffuseMoveLerpOption;
int g_iMaskNoiseMoveLerpOption;
int g_iDiffuseNoiseMoveLerpOption;
int g_iNoiseMoveLerpOption;
//
float2 g_vDiffuseDistortionUVGainAmount;
float2 g_vMaskDistortionUVGainAmount;
int g_iMaskDistortionMoveLerpOption;
int g_iDiffuseDistortionMoveLerpOption;
//
float2 g_vUVCutting;
float2 g_vUVMaskCutting;
float g_fDiffuseAlpha;
int g_iBlurWeight; // 블러 강도
float g_fBlurIntensity; //블러 세기
float g_fNoiseDistortionIntensity; // 노이즈 왜곡 세기
float g_fNoiseDistortionIntensity; // 디스토션 왜곡 세기
float4 g_vEmissive;
float g_fColorOption;
float g_fEmissiveCutAlpha;
bool g_isDiffuse;
@@ -72,9 +77,13 @@ bool g_isMasking;
bool g_isDissolve;
bool g_isNoise;
bool g_isEmissive;
bool g_isDistortion;
bool g_isDiffuseUVMove;
bool g_isMaskUVMove;
bool g_isNoiseUVMove;
bool g_isReverseDissolve;
float g_fFar;
@@ -197,40 +206,36 @@ struct PS_OUT
};
PS_OUT BlendedWeight(vector fDiffuse, float fLinearZ , PS_IN In , float fProjZ)
PS_OUT BlendedWeight(vector fDiffuse, float fLinearZ)
{
PS_OUT Out;
float3 vColor = fDiffuse.rgb;
float fAlpha = fDiffuse.a;
// float fWeight =
//max(
// min(1.0, max(max(vColor.r, vColor.g), vColor.b) * fAlpha),
// fAlpha
//) *
//clamp(
// 0.01 / (1e-4 + pow(fLinearZ / 200, 4.0)),
// 0.01f, 1000
//);
// min(1.0, max(max(vColor.r, vColor.g), vColor.b) * fAlpha), fAlpha)
// *
// clamp(0.01 / (1e-4 + pow(fLinearZ / 200, 4.0)), 0.01f, 1000);
float fWeight = clamp(0.03f / (1e-5 + pow(fLinearZ, 2.0f)), 0.01, 3e3);
fWeight = max(fWeight, 1.0);
//float fWeight = clamp(0.03f / (1e-5 + pow(fLinearZ, 4.0f)), 0.01, 3e3);
//fWeight = max(fWeight, 1.0);
//이게 오리지널 웨이트 함수
//float fWeight = pow(fLinearZ, -2.5);
//float fWeight = clamp(pow(fLinearZ, -2.5f), 1.0f, 1000.0f);
Out.vDiffuse = vector(vColor.rgb * fAlpha, fAlpha) * fWeight;
float fWeight = clamp(pow(fLinearZ, -2.5f), 1.0f, 1000.0f);
Out.vDiffuse = vector(vColor.rgb * fAlpha, fAlpha) * fWeight;
Out.vRevealage.r = fAlpha;
Out.vRevealage.a = fAlpha;
return Out;
}
@@ -271,11 +276,13 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In)
vector vMtrlMask;
vector vMtrlNoise;
vector vMtrlDissolve;
vector vMtrlDistortion;
float fAnimIndex = g_ParticleValue[In.iGPUIndex].vAniIndex.x;
float2 vDiffuseTime = g_ParticleValue[In.iGPUIndex].vDiffuseUVMoveTime;
float2 vMaskingTime = g_ParticleValue[In.iGPUIndex].vMaskingUVMoveTime;
float2 vNoiseUVMoveTime = g_ParticleValue[In.iGPUIndex].vNoiseUVMoveTime;
float2 vDistortionUVMoveTime = g_ParticleValue[In.iGPUIndex].vDistortionUVMoveTime;
if (g_isDiffuse == true)
{
@@ -288,57 +295,74 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In)
UV += SelectLerpUV((g_vDiffuseUVGainAmount / g_vUVCutting), (vDiffuseTime.x / vDiffuseTime.y), g_iDiffuseMoveLerpOption);
}
/* 노이즈 */
if (g_isNoise == true)
/* 디퓨즈 디스토션 */
if (g_isDistortion == true)
{
float2 vNoiseUV = In.vTexcoord + SelectLerpUV(g_vDiffuseNoiseUVGainAmount, (vNoiseUVMoveTime.x / vNoiseUVMoveTime.y), g_iDiffuseNoiseMoveLerpOption);
float2 vDistortion = In.vTexcoord + SelectLerpUV(g_vDiffuseDistortionUVGainAmount, (vDistortionUVMoveTime.x / vDistortionUVMoveTime.y), g_iDiffuseDistortionMoveLerpOption);
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, vNoiseUV);
vMtrlDistortion = g_DistortionTexture.Sample(DefaultSampler, vDistortion);
//0.5f를 빼는 이유는 중심을 0으로 옮겨서 양음수 방향으로 offset을 줄수 있다.
vMtrlNoise.rg -= 0.5f;
vMtrlDistortion.rg -= 0.5f;
//아마 분할되었다면 noise도 분할해야할듯
vMtrlNoise.rg /= g_vUVCutting;
vMtrlDistortion.rg /= g_vUVCutting;
//노이즈 텍스쳐로 uv를 왜곡함
//디스토션(노이즈) 텍스쳐로 uv를 왜곡함
UV = UV + (vMtrlNoise).rg * g_fNoiseDistortionIntensity;
UV = UV + (vMtrlDistortion).rg * g_fNoiseDistortionIntensity;
}
/* 최종 색깔 */
vMtrlDiffuse = g_DiffuseTexture.Sample(DefaultSampler, UV);
if (g_vColor.a > 0)
vMtrlDiffuse += g_vColor;
if (vMtrlDiffuse.a < 0.3f)
discard;
}
else
{
vMtrlDiffuse = g_vColor;
}
/* 노이즈 */
if(g_isNoise)
{
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, In.vTexcoord);
vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlNoise.r);
vMtrlDiffuse *= vMtrlNoise;
}
if (g_isMasking == true)
{
float2 vMaskTexcoord = In.vTexcoord;
vMaskTexcoord = UV_Cutting(In.vTexcoord, g_vUVMaskCutting, int(fAnimIndex.x));
if (g_isNoise == true)
// 마스크 디스토션
if (g_isDistortion == true)
{
float2 UV; // 이미지의 UV값
float2 vNoiseUV = In.vTexcoord + SelectLerpUV(g_vMaskNoiseUVGainAmount, (vNoiseUVMoveTime.x / vNoiseUVMoveTime.y), g_iMaskNoiseMoveLerpOption);
float2 vDistortionUV = In.vTexcoord + SelectLerpUV(g_vMaskDistortionUVGainAmount, (vNoiseUVMoveTime.x / vNoiseUVMoveTime.y), g_iMaskDistortionMoveLerpOption);
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, vNoiseUV);
vMtrlDistortion = g_DistortionTexture.Sample(DefaultSampler, vDistortionUV);
//노이즈 텍스쳐로 uv를 왜곡함
vMaskTexcoord = vMaskTexcoord + (vMtrlNoise - 0.5f).rg * g_fNoiseDistortionIntensity;
//디스토션(노이즈) 텍스쳐로 uv를 왜곡함
vMaskTexcoord = vMaskTexcoord + (vMtrlDistortion - 0.5f).r / g_vUVCutting * g_fNoiseDistortionIntensity;
vMtrlDiffuse *= vMtrlDistortion.r;
}
if (g_isMaskUVMove)
@@ -348,6 +372,7 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In)
}
vMtrlMask = g_MaskingTexture.Sample(PointSampler, vMaskTexcoord);
}
else
{
@@ -358,6 +383,8 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In)
vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlMask.r);
if (vMtrlDiffuse.a <= 0.f)
discard;
@@ -365,38 +392,52 @@ PS_OUT PS_NON_NORMALMAP(PS_IN In)
{
vMtrlDissolve = g_DissolveTexture.Sample(DefaultSampler, In.vTexcoord);
if (vMtrlDissolve.r < (In.vLifeTime.x / In.vLifeTime.y))
discard;
if(g_isReverseDissolve == true)
{
if (vMtrlDissolve.r >= (In.vLifeTime.x / In.vLifeTime.y))
discard;
}
else
{
if (vMtrlDissolve.r < (In.vLifeTime.x / In.vLifeTime.y))
discard;
}
}
vMtrlDiffuse.a *= g_fDiffuseAlpha;
// 색깔 추가할 처리 (이미시브)
float4 vEmissiveMtrl;
float4 vEmissiveMtrl = vector(0.f ,0.f ,0.f ,0.f);
if (g_isEmissive == true)
{
vEmissiveMtrl = g_EmissiveTexture.Sample(DefaultSampler, In.vTexcoord);
}
int2 texel = int2(In.vPosition.xy);
float fDepthStencilValue = g_DepthStencilTexture.Load(int3(texel, 0));
int2 iTexel = int2(In.vPosition.xy);
float bias = 0.0005f;
float fDepthStencilValue = g_DepthStencilTexture.Load(int3(iTexel, 0)).r;
if (fDepthStencilValue + bias < In.vProjPos.z / In.vProjPos.w)
float fbias = 0.000005f;
if (fDepthStencilValue <= In.vProjPos.z / In.vProjPos.w + fbias)
discard;
Out = BlendedWeight(vMtrlDiffuse, In.vProjPos.w, In, In.vProjPos.z / In.vProjPos.w);
//if (vMtrlDiffuse.a >= g_fEmissiveCutAlpha)
// Out.vColorTarget = vector(g_vEmissive.rgb + vEmissiveMtrl.rgb, g_fColorOption / 10.f);
//else
// Out.vColorTarget = vector(0.f, 0.f, 0.f, 0.f);
Out = BlendedWeight(vMtrlDiffuse, In.vProjPos.w);
if (vMtrlDiffuse.a / g_fDiffuseAlpha > g_fEmissiveCutAlpha)
{
float3 vEmissiveColor= g_vEmissive.rgb * g_vEmissive.a + vEmissiveMtrl.rgb * (1 - g_vEmissive.a);
Out.vColorTarget = vector(vEmissiveColor, vMtrlDiffuse.a);
}
else
Out.vColorTarget = vector(0.f, 0.f, 0.f, 0.f);
return Out;
}
@@ -458,11 +499,13 @@ PS_BLUR_OUT PS_BLUR(PS_BLUR_IN In)
vector vMtrlMask;
vector vMtrlNoise;
vector vMtrlDissolve;
vector vMtrlDistortion;
float fAnimIndex = g_ParticleValue[In.iGPUIndex].vAniIndex.x;
float2 vDiffuseTime = g_ParticleValue[In.iGPUIndex].vDiffuseUVMoveTime;
float2 vMaskingTime = g_ParticleValue[In.iGPUIndex].vMaskingUVMoveTime;
float2 vNoiseUVMoveTime = g_ParticleValue[In.iGPUIndex].vNoiseUVMoveTime;
float2 vDistortionUVMoveTime = g_ParticleValue[In.iGPUIndex].vDistortionUVMoveTime;
if (g_isDiffuse == true)
{
@@ -475,57 +518,70 @@ PS_BLUR_OUT PS_BLUR(PS_BLUR_IN In)
UV += SelectLerpUV((g_vDiffuseUVGainAmount / g_vUVCutting), (vDiffuseTime.x / vDiffuseTime.y), g_iDiffuseMoveLerpOption);
}
/* 노이즈 */
if (g_isNoise == true)
/* 디퓨즈 디스토션 */
if (g_isDistortion == true)
{
float2 vNoiseUV = In.vTexcoord + SelectLerpUV(g_vDiffuseNoiseUVGainAmount, (vNoiseUVMoveTime.x / vNoiseUVMoveTime.y), g_iDiffuseNoiseMoveLerpOption);
float2 vDistortion = In.vTexcoord + SelectLerpUV(g_vDiffuseDistortionUVGainAmount, (vDistortionUVMoveTime.x / vDistortionUVMoveTime.y), g_iDiffuseDistortionMoveLerpOption);
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, vNoiseUV);
vMtrlDistortion = g_DistortionTexture.Sample(DefaultSampler, vDistortion);
//0.5f를 빼는 이유는 중심을 0으로 옮겨서 양음수 방향으로 offset을 줄수 있다.
vMtrlNoise.rg -= 0.5f;
vMtrlDistortion.rg -= 0.5f;
//아마 분할되었다면 noise도 분할해야할듯
vMtrlNoise.rg /= g_vUVCutting;
vMtrlDistortion.rg /= g_vUVCutting;
//노이즈 텍스쳐로 uv를 왜곡함
//디스토션(노이즈) 텍스쳐로 uv를 왜곡함
UV = UV + (vMtrlNoise).rg * g_fNoiseDistortionIntensity;
UV = UV + (vMtrlDistortion).rg * g_fNoiseDistortionIntensity;
}
/* 최종 색깔 */
vMtrlDiffuse = g_DiffuseTexture.Sample(DefaultSampler, UV);
if (g_vColor.a > 0)
vMtrlDiffuse += g_vColor;
if (vMtrlDiffuse.a < 0.3f)
discard;
}
else
{
vMtrlDiffuse = g_vColor;
}
/* 노이즈 */
if (g_isNoise)
{
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, In.vTexcoord);
vMtrlDiffuse *= vMtrlNoise;
}
if (g_isMasking == true)
{
float2 vMaskTexcoord = In.vTexcoord;
vMaskTexcoord = UV_Cutting(In.vTexcoord, g_vUVMaskCutting, int(fAnimIndex.x));
if (g_isNoise == true)
// 마스크 디스토션
if (g_isDistortion == true)
{
float2 UV; // 이미지의 UV값
float2 vNoiseUV = In.vTexcoord + SelectLerpUV(g_vMaskNoiseUVGainAmount, (vNoiseUVMoveTime.x / vNoiseUVMoveTime.y), g_iMaskNoiseMoveLerpOption);
float2 vDistortionUV = In.vTexcoord + SelectLerpUV(g_vMaskDistortionUVGainAmount, (vNoiseUVMoveTime.x / vNoiseUVMoveTime.y), g_iMaskDistortionMoveLerpOption);
vMtrlNoise = g_NoiseTexture.Sample(DefaultSampler, vNoiseUV);
vMtrlDistortion = g_DistortionTexture.Sample(DefaultSampler, vDistortionUV);
//노이즈 텍스쳐로 uv를 왜곡함
vMaskTexcoord = vMaskTexcoord + (vMtrlNoise - 0.5f).rg * g_fNoiseDistortionIntensity;
//디스토션(노이즈) 텍스쳐로 uv를 왜곡함
vMaskTexcoord = vMaskTexcoord + (vMtrlDistortion - 0.5f).r / g_vUVCutting * g_fNoiseDistortionIntensity;
vMtrlDiffuse *= vMtrlDistortion.r;
}
if (g_isMaskUVMove)
@@ -535,6 +591,7 @@ PS_BLUR_OUT PS_BLUR(PS_BLUR_IN In)
}
vMtrlMask = g_MaskingTexture.Sample(PointSampler, vMaskTexcoord);
}
else
{
@@ -545,25 +602,40 @@ PS_BLUR_OUT PS_BLUR(PS_BLUR_IN In)
vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlMask.r);
if (g_isDissolve == true)
{
vMtrlDissolve = g_DissolveTexture.Sample(DefaultSampler, In.vTexcoord);
if (vMtrlDissolve.r < (In.vLifeTime.x / In.vLifeTime.y))
discard;
}
vMtrlDiffuse.a = saturate(vMtrlDiffuse.a * vMtrlMask.r);
if (vMtrlDiffuse.a <= 0.f)
discard;
if (g_isDissolve == true)
{
vMtrlDissolve = g_DissolveTexture.Sample(DefaultSampler, In.vTexcoord);
if (vMtrlDissolve.r < (In.vLifeTime.x / In.vLifeTime.y))
discard;
if(g_isReverseDissolve == true)
{
if (vMtrlDissolve.r >= (In.vLifeTime.x / In.vLifeTime.y))
discard;
}
else
{
if (vMtrlDissolve.r < (In.vLifeTime.x / In.vLifeTime.y))
discard;
}
}
vMtrlDiffuse.a *= g_fDiffuseAlpha;
// 색깔 추가할 처리 (이미시브)
float4 vEmissiveMtrl = vector(0.f, 0.f, 0.f, 0.f);
if (g_isEmissive == true)
{
vEmissiveMtrl = g_EmissiveTexture.Sample(DefaultSampler, In.vTexcoord);
}
Out.vDiffuse = vMtrlDiffuse * g_fBlurIntensity;
Out.vBlurWeight.r = g_iBlurWeight / 32.f;
@@ -587,7 +659,7 @@ technique11 DefaultTechnique
{
SetRasterizerState(RS_Nocull);
SetDepthStencilState(DSS_None, 0);
SetBlendState(BS_WB_Acc, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
SetBlendState(BS_Blend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
VertexShader = compile vs_5_0 VS_MAIN();
GeometryShader = NULL;
PixelShader = compile ps_5_0 PS_NON_NORMALMAP();
@@ -596,7 +668,7 @@ technique11 DefaultTechnique
pass Blur
{
SetRasterizerState(RS_Nocull);
SetDepthStencilState(DSS_Default, 0);
SetDepthStencilState(DSS_Effect, 0);
SetBlendState(BS_AlphaBlend, float4(0.f, 0.f, 0.f, 0.f), 0xffffffff);
VertexShader = compile vs_5_0 VS_BLUR();
GeometryShader = NULL;
@@ -48,14 +48,21 @@ PS_OUT PS_MAIN(PS_IN In)
{
PS_OUT Out;
vector vMixedDiffuse = g_MixedDiffuseTexture.Sample(PointSampler, In.vTexcoord);
vector vRevealage = g_RevealageTexture.Sample(PointSampler, In.vTexcoord);
float fRevealage = g_RevealageTexture.Sample(PointSampler, In.vTexcoord);
if(vRevealage.b >= 1.f)
discard;
Out.vBackBuffer = vector(vMixedDiffuse.rgb / fRevealage , fRevealage);
//float fClamp;
//fClamp = clamp(vMixedDiffuse.a, 1e-4, 5e4);
//Out.vBackBuffer = vector(vMixedDiffuse.rgb / fClamp, fRevealage);
Out.vBackBuffer = vector(vMixedDiffuse.rgb / max(vMixedDiffuse.a, 1e-5), 1 - vRevealage.r);
return Out;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 314 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 301 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 447 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 439 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 520 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 531 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 549 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

@@ -214,6 +214,12 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="..\Public\Player.h" />
<ClInclude Include="..\Public\State_Dodge.h" />
<ClInclude Include="..\Public\State_Idle.h" />
<ClInclude Include="..\Public\State_Jump.h" />
<ClInclude Include="..\Public\State_Sprint.h" />
<ClInclude Include="..\Public\State_Walk.h" />
<ClInclude Include="..\public\Terrain.h" />
<ClInclude Include="..\Public\Level_PhysXLab.h" />
<ClInclude Include="..\Public\TestEffect.h" />
@@ -304,6 +310,12 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\Private\Player.cpp" />
<ClCompile Include="..\Private\State_Dodge.cpp" />
<ClCompile Include="..\Private\State_Idle.cpp" />
<ClCompile Include="..\Private\State_Jump.cpp" />
<ClCompile Include="..\Private\State_Sprint.cpp" />
<ClCompile Include="..\Private\State_Walk.cpp" />
<ClCompile Include="..\private\Terrain.cpp" />
<ClCompile Include="..\Private\Level_PhysXLab.cpp" />
<ClCompile Include="..\Private\TestEffect.cpp" />
@@ -232,6 +232,27 @@
<Filter Include="02.GameObjects\Dummys\DummyPhysX\PhysXFreeDoor">
<UniqueIdentifier>{3131278b-18f5-4b84-ba85-73104998e9c9}</UniqueIdentifier>
</Filter>
<Filter Include="80.State">
<UniqueIdentifier>{9c21aba5-00c1-4b4c-8a82-dac7a156fd9b}</UniqueIdentifier>
</Filter>
<Filter Include="80.State\State_Dodge">
<UniqueIdentifier>{b017e167-f48d-4417-a924-765ab802cff5}</UniqueIdentifier>
</Filter>
<Filter Include="80.State\State_Idle">
<UniqueIdentifier>{d5681f71-af29-4418-bf3a-a1486c6ba171}</UniqueIdentifier>
</Filter>
<Filter Include="80.State\State_Walk">
<UniqueIdentifier>{43bc0f97-0b7d-406b-900c-0fae023023ec}</UniqueIdentifier>
</Filter>
<Filter Include="80.State\State_Sprint">
<UniqueIdentifier>{1cac1aa6-ea12-429e-8a84-ca2bf44c2be4}</UniqueIdentifier>
</Filter>
<Filter Include="80.State\State_Jump">
<UniqueIdentifier>{904a7ae5-33fe-49a1-9f31-27443acc9e1a}</UniqueIdentifier>
</Filter>
<Filter Include="02.GameObjects\Player">
<UniqueIdentifier>{680910fd-aee2-4f69-b644-12b36b0f635b}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="Editor.h">
@@ -450,6 +471,24 @@
<ClInclude Include="..\Public\Dummy_PhysXWall.h">
<Filter>02.GameObjects\Dummys\DummyPhysX\PhysXWall</Filter>
</ClInclude>
<ClInclude Include="..\Public\State_Dodge.h">
<Filter>80.State\State_Dodge</Filter>
</ClInclude>
<ClInclude Include="..\Public\State_Idle.h">
<Filter>80.State\State_Idle</Filter>
</ClInclude>
<ClInclude Include="..\Public\State_Walk.h">
<Filter>80.State\State_Walk</Filter>
</ClInclude>
<ClInclude Include="..\Public\State_Sprint.h">
<Filter>80.State\State_Sprint</Filter>
</ClInclude>
<ClInclude Include="..\Public\State_Jump.h">
<Filter>80.State\State_Jump</Filter>
</ClInclude>
<ClInclude Include="..\Public\Player.h">
<Filter>02.GameObjects\Player</Filter>
</ClInclude>
<ClInclude Include="..\Public\Dummy_PhysXDoorSet.h">
<Filter>02.GameObjects\Dummys\DummyPhysX\PhysXDoorSet</Filter>
</ClInclude>
@@ -682,6 +721,24 @@
<ClCompile Include="..\Private\Dummy_PhysXDoorFrame.cpp">
<Filter>02.GameObjects\Dummys\DummyPhysX\PhysXDoorSet\PhysXDoorFrame</Filter>
</ClCompile>
<ClCompile Include="..\Private\State_Dodge.cpp">
<Filter>80.State\State_Dodge</Filter>
</ClCompile>
<ClCompile Include="..\Private\State_Idle.cpp">
<Filter>80.State\State_Idle</Filter>
</ClCompile>
<ClCompile Include="..\Private\State_Walk.cpp">
<Filter>80.State\State_Walk</Filter>
</ClCompile>
<ClCompile Include="..\Private\State_Sprint.cpp">
<Filter>80.State\State_Sprint</Filter>
</ClCompile>
<ClCompile Include="..\Private\State_Jump.cpp">
<Filter>80.State\State_Jump</Filter>
</ClCompile>
<ClCompile Include="..\Private\Player.cpp">
<Filter>02.GameObjects\Player</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="Editor.rc">
+88 -14
View File
@@ -3,14 +3,19 @@
#include "GameInstance.h"
#include "DebugCamera.h"
#include "State_Idle.h"
#include "State_Walk.h"
#include "State_Dodge.h"
#include "State_Sprint.h"
#include "State_Jump.h"
CDummyObject::CDummyObject(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
: CGameObject(pDevice, pContext)
: CUnit(pDevice, pContext)
{
}
CDummyObject::CDummyObject(const CDummyObject& Prototype)
: CGameObject(Prototype)
: CUnit(Prototype)
{
}
@@ -32,7 +37,11 @@ HRESULT CDummyObject::Initialize(void* pArg)
if (FAILED(Ready_Components()))
return E_FAIL;
m_pModelCom->Set_AnimationIndex(0);
Add_FSM();
Set_Anim();
m_pFSM->Change_State(FSMSTATE::IDLE);
return S_OK;
}
@@ -44,14 +53,16 @@ void CDummyObject::Priority_Update(_float fTimeDelta)
void CDummyObject::Update(_float fTimeDelta)
{
Check_State();
m_pFSM->Update(fTimeDelta);
m_pModelCom->Play_Animation(fTimeDelta,m_pTransformCom);
}
void CDummyObject::Late_Update(_float fTimeDelta)
{
if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this);
}
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this);
}
HRESULT CDummyObject::Render()
@@ -87,9 +98,51 @@ HRESULT CDummyObject::Render()
return S_OK;
}
_bool CDummyObject::IsWalking()
{
if (m_pGameInstance->Key_Pressing(DIK_UP) || m_pGameInstance->Key_Pressing(DIK_DOWN))
{
return true;
}
return false;
}
_bool CDummyObject::IsDodge()
{
if (m_pGameInstance->Key_Down(DIK_LCONTROL))
{
return true;
}
return false;
}
_bool CDummyObject::IsSprint()
{
if (m_pGameInstance->Key_Pressing(DIK_LSHIFT) && m_pGameInstance->Key_Pressing(DIK_UP))
{
return true;
}
return false;
}
_bool CDummyObject::IsJump()
{
if (m_pGameInstance->Key_Down(DIK_SPACE))
{
return true;
}
return false;
}
HRESULT CDummyObject::Ready_Components()
{
__super::Ready_Components(nullptr);
CTransform::TRANSFORM_DESC Desc = {};
Desc.fSpeedPerSec = 10.f;
Desc.fRotationPerSec = XMConvertToRadians(180.0f);
Desc.fRadius = 10.f;
__super::Ready_Components(&Desc);
/* Com_Model */
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, m_strModelPrototypeTag,
@@ -122,6 +175,34 @@ HRESULT CDummyObject::Bind_ShaderResources()
return S_OK;
}
void CDummyObject::Add_FSM()
{
m_pFSM->Add_State(FSMSTATE::IDLE, new CState_Idle());
m_pFSM->Add_State(FSMSTATE::WALK, new CState_Walk());
m_pFSM->Add_State(FSMSTATE::DODGE, new CState_Dodge());
m_pFSM->Add_State(FSMSTATE::SPRINT, new CState_Sprint());
m_pFSM->Add_State(FSMSTATE::JUMP, new CState_Jump());
}
void CDummyObject::Set_Anim()
{
m_Animation[FSMSTATE::IDLE] = { 41,true };
m_Animation[FSMSTATE::DODGE] = { 802,false };
m_Animation[FSMSTATE::WALK_FWD] = { 167,true };
m_Animation[FSMSTATE::WALK_BWD] = { 166,true };
m_Animation[FSMSTATE::SPRINT] = { 599,true };
m_Animation[FSMSTATE::JUMP] = { 205,false };
}
void CDummyObject::Check_State()
{
IsWalking();
IsDodge();
IsSprint();
}
CDummyObject* CDummyObject::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
{
CDummyObject* pInstance = new CDummyObject(pDevice, pContext);
@@ -131,7 +212,6 @@ CDummyObject* CDummyObject::Create(ID3D11Device* pDevice, ID3D11DeviceContext* p
MSG_BOX("Failed to Created : CDummyObject");
SAFE_RELEASE(pInstance);
}
return pInstance;
}
@@ -144,18 +224,12 @@ CGameObject* CDummyObject::Clone(void* pArg, CGameObject* pOwner)
MSG_BOX("Failed to Cloned : CDummyObject");
SAFE_RELEASE(pInstance);
}
return pInstance;
}
void CDummyObject::Free()
{
__super::Free();
SAFE_RELEASE(m_pShaderCom);
SAFE_RELEASE(m_pModelCom);
}
void CDummyObject::Describe_Entity()
+122 -51
View File
@@ -59,20 +59,14 @@ void CEditEffect::Late_Update(_float fTimeDelta)
if (m_pInstance_ModelCom == nullptr)
return;
ASSERT_JINWOO(false && "이거 고쳐야됨, 아래꺼를 위에껄로")
//{
// if (m_pGameInstance->isIn_WorldFrustum(Get_WorldPostion(), m_pTransformCom->Get_Radius())) {
// m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this);
// }
//}
//{
// _float4* vPos = (_float4*)(m_pTransformCom->Get_WorldMatrixPtr()->m[3]);
// if (m_EffectInfo.isBlur == true)
// m_pGameInstance->Add_RenderGroup(RENDER::BLUR, this, *vPos, m_pTransformCom->Get_Radius());
if (m_EffectInfo.isBlur == true)
{
m_pGameInstance->Add_RenderGroup(RENDER::BLUR, this);
}
m_pGameInstance->Add_RenderGroup(RENDER::EFFECT, this);
// m_pGameInstance->Add_RenderGroup(m_EffectInfo.eRenderOrder, this, *vPos, m_pTransformCom->Get_Radius());
//}
}
void CEditEffect::Reference_Mat_For_EditEffect()
@@ -80,9 +74,9 @@ void CEditEffect::Reference_Mat_For_EditEffect()
string strName = {};
const char* pCompute[] = { "DIFFUSE" , "MASK", "NOISE", "DISSOLVE" };
const char* pCompute[] = { "DIFFUSE" , "MASK", "NOISE", "DISSOLVE" , "DISTORTION" , "EMISSIVE"};
if (ImGui::Combo("OPTION", &m_iSelectTextureNum, pCompute, 4))
if (ImGui::Combo("OPTION", &m_iSelectTextureNum, pCompute, 6))
{
}
switch (m_iSelectTextureNum)
@@ -119,6 +113,24 @@ void CEditEffect::Reference_Mat_For_EditEffect()
m_strDissolveName = strName;
}
break;
case 4:
strName = dynamic_cast<CEffect_Editor*>(m_pOwner)->Reference_Mat_For_EditEffect((CComponent**)&m_pDistortion_TextureCom, this);
if (strName != "")
{
m_strDistortionName = strName;
}
break;
case 5:
strName = dynamic_cast<CEffect_Editor*>(m_pOwner)->Reference_Mat_For_EditEffect((CComponent**)&m_pEmissive_TextureCom, this);
if (strName != "")
{
m_strEmissiveName = strName;
}
break;
default:
break;
@@ -245,6 +257,24 @@ HRESULT CEditEffect::Save_Effect(const _char* pPath)
}
}
if (m_EffectInfo.isDistortion)
{
size_t iComponentLength = m_strDistortionName.length();
const _char* pFileComponentPath = m_strDistortionName.c_str();
if (!WriteFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) {
return E_FAIL;
}
if (iComponentLength != 0)
{
if (!WriteFile(hFile, pFileComponentPath, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) {
return E_FAIL;
}
}
}
size_t iComponentLength = m_strModelName.length();
const _char* pFileComponentPath = m_strModelName.c_str();
@@ -332,6 +362,7 @@ void CEditEffect::Describe_Entity()
GUI::Checkbox("Diffuse", &m_EffectInfo.isDiffuse);
GUI::Checkbox("Masking", &m_EffectInfo.isMasking);
GUI::Checkbox("Dissolve", &m_EffectInfo.isDissolve);
GUI::Checkbox("Distortion", &m_EffectInfo.isDistortion);
GUI::Checkbox("Noise", &m_EffectInfo.isNoise);
@@ -365,14 +396,6 @@ void CEditEffect::Describe_Entity()
if (GUI::TreeNode("EMISSIVE"))
{
const char* pCompute[] = {"NONE", "DIV" , "PLUS", "SUBSTRACT", "MULTY" , "EQUL" };
_int iColorOption = (_int)m_EffectInfo.fColorOption;
if (ImGui::Combo("OPTION", &iColorOption, pCompute , 6))
{
m_EffectInfo.fColorOption = (_float)iColorOption;
}
ImGui::PushItemWidth(80);
GUI::DragFloat("EmissiveCutAlpha", &m_EffectInfo.fEmissiveCutAlpha, 0.005f, 0.f, 1.f);
@@ -465,6 +488,7 @@ void CEditEffect::Describe_Entity()
if (GUI::TreeNode("DIFFUSE"))
{
GUI::DragFloat("Diffuse Alpha", &m_EffectInfo.fDiffuseAlpha , 0.01f, 0.f, 1.f);
ImGui::PushItemWidth(80);
GUI::Checkbox("DiffuseUVMove", &m_EffectInfo.isDiffuseUVMove);
@@ -554,6 +578,9 @@ void CEditEffect::Describe_Entity()
{
if (GUI::TreeNode("DISSOLV_TEX"))
{
GUI::Checkbox("Reverse Dissolve", &m_EffectInfo.isReverseDissolve);
_string strName = m_strDissolveName = m_pGameInstance->Asset_Description<CTexture>(ENUM_CLASS(LEVEL::EFFECT), "DISSOLVE_TEXTURE", (CComponent**)&m_pDissolve_TextureCom, nullptr, this);
if (strName != "") {
@@ -568,40 +595,82 @@ void CEditEffect::Describe_Entity()
}
}
if (m_EffectInfo.isDistortion == true)
{
if (GUI::TreeNode("DISTORTION"))
{
ImGui::PushItemWidth(80);
GUI::DragFloat("DistortionIntensity", &m_EffectInfo.fNoiseDistortionIntensity, 0.005f, 0.f, 1.f);
GUI::Spacing();
GUI::DragFloat2("DiffuseDistortionUVGainAmount", (_float*)&m_EffectInfo.vDiffuseDistortionUVGainAmount, 0.01f);
_int iDiffuseNoiseMoveLerpOption = (_int)m_EffectInfo.iDiffuseDistortionMoveLerpOption;
if (ImGui::Combo("LerpDiffuseDistortionMove Option", &iDiffuseNoiseMoveLerpOption, pLerp, 9))
{
m_EffectInfo.iDiffuseDistortionMoveLerpOption = iDiffuseNoiseMoveLerpOption;
}
GUI::Spacing();
GUI::DragFloat2("MaskDistortionUVGainAmount", (_float*)&m_EffectInfo.vMaskDistortionUVGainAmount, 0.01f);
_int iMaskNoiseMoveLerpOption = (_int)m_EffectInfo.iMaskDistortionMoveLerpOption;
if (ImGui::Combo("Lerp MaskDistortionMove Option", &iMaskNoiseMoveLerpOption, pLerp, 9))
{
m_EffectInfo.iMaskDistortionMoveLerpOption = iMaskNoiseMoveLerpOption;
}
GUI::Spacing();
ImGui::PopItemWidth();
if (GUI::TreeNode("DISTORTION_TEX"))
{
_string strName = m_pGameInstance->Asset_Description<CTexture>(ENUM_CLASS(LEVEL::EFFECT), "DISTORTION_TEXTURE", (CComponent**)&m_pDistortion_TextureCom, nullptr, this);
if (strName != "") {
m_strDistortionName = strName;
}
GUI::TreePop();
}
GUI::TreePop();
}
}
if (m_EffectInfo.isNoise == true)
{
if (GUI::TreeNode("NOISE"))
{
GUI::Checkbox("NoiseMove", &m_EffectInfo.isNoiseUVMove);
ImGui::PushItemWidth(80);
GUI::DragFloat("NoiseDistortionIntensity", &m_EffectInfo.fNoiseDistortionIntensity, 0.005f, 0.f, 1.f);
GUI::Spacing();
GUI::DragFloat2("DiffuseNoiseUVGainAmount", (_float*)&m_EffectInfo.vDiffuseNoiseUVGainAmount, 0.01f);
_int iDiffuseNoiseMoveLerpOption = (_int)m_EffectInfo.iDiffuseNoiseMoveLerpOption;
if (ImGui::Combo("Lerp DiffuseNoiseMove Option", &iDiffuseNoiseMoveLerpOption, pLerp, 9))
{
m_EffectInfo.iDiffuseNoiseMoveLerpOption = iDiffuseNoiseMoveLerpOption;
}
GUI::Spacing();
GUI::DragFloat2("MaskNoiseUVGainAmount", (_float*)&m_EffectInfo.vMaskNoiseUVGainAmount, 0.01f);
_int iMaskNoiseMoveLerpOption = (_int)m_EffectInfo.iMaskNoiseMoveLerpOption;
if (ImGui::Combo("Lerp MaskNoiseMove Option", &iMaskNoiseMoveLerpOption, pLerp, 9))
{
m_EffectInfo.iMaskNoiseMoveLerpOption = iMaskNoiseMoveLerpOption;
}
GUI::Spacing();
GUI::DragFloat2("NoiseUVGainAmount", (_float*)&m_EffectInfo.vNoiseUVGainAmount, 0.01f);
ImGui::PopItemWidth();
GUI::Spacing();
_int iMaskMoveLerpOption = (_int)m_EffectInfo.iNoiseMoveLerpOption;
if (ImGui::Combo("Lerp NoiseMove Option", &iMaskMoveLerpOption, pLerp, 9))
{
m_EffectInfo.iMaskMoveLerpOption = iMaskMoveLerpOption;
}
if (GUI::TreeNode("NOISE_TEX"))
{
_string strName = m_pGameInstance->Asset_Description<CTexture>(ENUM_CLASS(LEVEL::EFFECT), "NOISE_TEXTURE", (CComponent**)&m_pNoise_TextureCom, nullptr, this);
@@ -609,15 +678,17 @@ void CEditEffect::Describe_Entity()
if (strName != "") {
m_strNoiseName = strName;
}
GUI::TreePop();
}
GUI::Separator(); GUI::Spacing();
GUI::TreePop();
}
}
GUI::Separator(); GUI::Spacing();
}
+288 -14
View File
@@ -273,6 +273,30 @@ HRESULT CEffectObject::Load(const _char* pFilePath , LEVEL eLevel)
return E_FAIL;
}
if (m_EffectInfo.isDistortion)
{
size_t iComponentLength = {};
if (!ReadFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) {
return E_FAIL;
}
if (iComponentLength != 0)
{
_char szName[MAX_PATH] = {};
if (!ReadFile(hFile, &szName, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) {
return E_FAIL;
}
m_strDistortionName = szName;
}
if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(eLevel), CMyTools::ToWstring(m_strDistortionName),
reinterpret_cast<CComponent**>(&m_pDistortion_TextureCom))))
return E_FAIL;
}
size_t iComponentLength = {};
@@ -302,6 +326,232 @@ HRESULT CEffectObject::Load(const _char* pFilePath , LEVEL eLevel)
return S_OK;
}
#ifdef _DEBUG
HRESULT CEffectObject::LoadPre(const _char* pFilePath, LEVEL eLevel)
{
_string strPerfectFilePath = pFilePath;
HANDLE hFile = CreateFileW(
CMyTools::ToWstring(strPerfectFilePath).c_str(), // 파일 이름
GENERIC_READ, // 읽기 모드
FILE_SHARE_READ, // 다른 프로세스도 읽기 가능
NULL,
OPEN_EXISTING, // 기존 파일 열기
FILE_ATTRIBUTE_NORMAL,
NULL
);
if (hFile == INVALID_HANDLE_VALUE) {
MessageBox(NULL, L"오브젝트 읽기 실패", L"System Message", MB_OK);
return E_FAIL;
}
DWORD dwByte(0);
PRE_EFFECT_INFO PreEffectInfo = {};
if (!ReadFile(hFile, &PreEffectInfo, sizeof(PRE_EFFECT_INFO), &dwByte, nullptr)) {
return E_FAIL;
}
memcpy(&m_EffectInfo, &PreEffectInfo, sizeof(PRE_EFFECT_INFO));
m_EffectInfo.LightDesc.pPosition = m_pTransformCom->Get_StatePtr(STATE::POSITION);
m_EffectInfo.LightDesc.iLevel = ENUM_CLASS(eLevel);
if (m_EffectInfo.LightDesc.eType != LIGHT::DIRECTIONAL) // 0이 아닐때만 생성
{
if (FAILED(Add_Component<CLight>(g_iStaticLevel, &m_pLightCom, &m_EffectInfo.LightDesc)))
{
return E_FAIL;
}
}
if (m_EffectInfo.isDiffuse)
{
size_t iComponentLength = {};
if (!ReadFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) {
return E_FAIL;
}
if (iComponentLength != 0)
{
_char szName[MAX_PATH] = {};
if (!ReadFile(hFile, &szName, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) {
return E_FAIL;
}
m_strDiffuseName = szName;
}
if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(eLevel), CMyTools::ToWstring(m_strDiffuseName),
reinterpret_cast<CComponent**>(&m_pDiffuse_TextureCom))))
return E_FAIL;
}
if (m_EffectInfo.isNoise)
{
size_t iComponentLength = {};
if (!ReadFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) {
return E_FAIL;
}
if (iComponentLength != 0)
{
_char szName[MAX_PATH] = {};
if (!ReadFile(hFile, &szName, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) {
return E_FAIL;
}
m_strNoiseName = szName;
}
if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(eLevel), CMyTools::ToWstring(m_strNoiseName),
reinterpret_cast<CComponent**>(&m_pNoise_TextureCom))))
return E_FAIL;
}
if (m_EffectInfo.isMasking)
{
size_t iComponentLength = {};
if (!ReadFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) {
return E_FAIL;
}
if (iComponentLength != 0)
{
_char szName[MAX_PATH] = {};
if (!ReadFile(hFile, &szName, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) {
return E_FAIL;
}
m_strMaskingName = szName;
}
if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(eLevel), CMyTools::ToWstring(m_strMaskingName),
reinterpret_cast<CComponent**>(&m_pMasking_TextureCom))))
return E_FAIL;
}
if (m_EffectInfo.isDissolve)
{
size_t iComponentLength = {};
if (!ReadFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) {
return E_FAIL;
}
if (iComponentLength != 0)
{
_char szName[MAX_PATH] = {};
if (!ReadFile(hFile, &szName, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) {
return E_FAIL;
}
m_strDissolveName = szName;
}
if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(eLevel), CMyTools::ToWstring(m_strDissolveName),
reinterpret_cast<CComponent**>(&m_pDissolve_TextureCom))))
return E_FAIL;
}
if (m_EffectInfo.isEmissive)
{
size_t iComponentLength = {};
if (!ReadFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) {
return E_FAIL;
}
if (iComponentLength != 0)
{
_char szName[MAX_PATH] = {};
if (!ReadFile(hFile, &szName, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) {
return E_FAIL;
}
m_strEmissiveName = szName;
}
if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(eLevel), CMyTools::ToWstring(m_strEmissiveName),
reinterpret_cast<CComponent**>(&m_pEmissive_TextureCom))))
return E_FAIL;
}
if (m_EffectInfo.isDistortion)
{
size_t iComponentLength = {};
if (!ReadFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) {
return E_FAIL;
}
if (iComponentLength != 0)
{
_char szName[MAX_PATH] = {};
if (!ReadFile(hFile, &szName, sizeof(_char) * ((DWORD)iComponentLength + 1), &dwByte, nullptr)) {
return E_FAIL;
}
m_strDistortionName = szName;
}
if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(eLevel), CMyTools::ToWstring(m_strDistortionName),
reinterpret_cast<CComponent**>(&m_pDistortion_TextureCom))))
return E_FAIL;
}
size_t iComponentLength = {};
if (!ReadFile(hFile, &iComponentLength, sizeof(size_t), &dwByte, nullptr)) {
return E_FAIL;
}
if (iComponentLength != 0)
{
_char szName[MAX_PATH] = {};
if (!ReadFile(hFile, &szName, sizeof(_char) * ((DWORD)(DWORD)iComponentLength + 1), &dwByte, nullptr)) {
return E_FAIL;
}
m_strModelName = szName;
}
if (FAILED(__super::Add_Asset_Component(ENUM_CLASS(eLevel), CMyTools::ToWstring(m_strModelName),
reinterpret_cast<CComponent**>(&m_pInstance_ModelCom))))
return E_FAIL;;
m_pInstance_ModelCom->Load_InstanceModel(hFile);
CloseHandle(hFile);
return S_OK;
}
#endif // _DEBUG
HRESULT CEffectObject::Bind_ShaderResources()
{
@@ -337,6 +587,10 @@ HRESULT CEffectObject::Bind_ShaderResources()
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_isDistortion", &m_EffectInfo.isDistortion, sizeof(_bool)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_isDiffuseUVMove", &m_EffectInfo.isDiffuseUVMove, sizeof(_bool)))) {
return E_FAIL;
}
@@ -345,6 +599,16 @@ HRESULT CEffectObject::Bind_ShaderResources()
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_isNoiseUVMove", &m_EffectInfo.isNoiseUVMove, sizeof(_bool)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_isReverseDissolve", &m_EffectInfo.isReverseDissolve, sizeof(_bool)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_vColor", &m_EffectInfo.vColor, sizeof(_float4)))) {
return E_FAIL;
}
@@ -353,10 +617,6 @@ HRESULT CEffectObject::Bind_ShaderResources()
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_fColorOption", &m_EffectInfo.fColorOption, sizeof(_float)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_fEmissiveCutAlpha", &m_EffectInfo.fEmissiveCutAlpha, sizeof(_float)))) {
return E_FAIL;
}
@@ -373,16 +633,21 @@ HRESULT CEffectObject::Bind_ShaderResources()
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_vDiffuseNoiseUVGainAmount", &m_EffectInfo.vDiffuseNoiseUVGainAmount, sizeof(_float2)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_vMaskNoiseUVGainAmount", &m_EffectInfo.vMaskNoiseUVGainAmount, sizeof(_float2)))) {
if (FAILED(m_pShaderCom->Bind_RawValue("g_vNoiseUVGainAmount", &m_EffectInfo.vNoiseUVGainAmount, sizeof(_float2)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_vDiffuseDistortionUVGainAmount", &m_EffectInfo.vDiffuseDistortionUVGainAmount, sizeof(_float2)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_vMaskDistortionUVGainAmount", &m_EffectInfo.vMaskDistortionUVGainAmount, sizeof(_float2)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_vUVCutting", &m_EffectInfo.vUVCutting, sizeof(_float2)))) {
return E_FAIL;
}
@@ -400,12 +665,16 @@ HRESULT CEffectObject::Bind_ShaderResources()
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_iMaskNoiseMoveLerpOption", &m_EffectInfo.iMaskNoiseMoveLerpOption, sizeof(_int)))) {
if (FAILED(m_pShaderCom->Bind_RawValue("g_iMaskDistortionMoveLerpOption", &m_EffectInfo.iMaskDistortionMoveLerpOption, sizeof(_int)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_iDiffuseNoiseMoveLerpOption", &m_EffectInfo.iDiffuseNoiseMoveLerpOption, sizeof(_int)))) {
if (FAILED(m_pShaderCom->Bind_RawValue("g_iDiffuseDistortionMoveLerpOption", &m_EffectInfo.iDiffuseDistortionMoveLerpOption, sizeof(_int)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_fDiffuseAlpha", &m_EffectInfo.fDiffuseAlpha, sizeof(_float)))) {
return E_FAIL;
}
@@ -447,9 +716,13 @@ HRESULT CEffectObject::Bind_ShaderResources()
}
}
if (m_pDistortion_TextureCom != nullptr)
{
if (FAILED(m_pDistortion_TextureCom->Bind_ShaderResource(m_pShaderCom, "g_DistortionTexture", 0))) {
return E_FAIL;
}
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
return E_FAIL;
}
@@ -498,6 +771,7 @@ void CEffectObject::Free()
SAFE_RELEASE(m_pMasking_TextureCom);
SAFE_RELEASE(m_pDissolve_TextureCom);
SAFE_RELEASE(m_pEmissive_TextureCom);
SAFE_RELEASE(m_pDistortion_TextureCom);
SAFE_RELEASE(m_pShaderCom);
SAFE_RELEASE(m_pInstance_ModelCom);
@@ -23,7 +23,8 @@ HRESULT CEffect_Editor::Initialize_Prototype()
{
ReadMaterials("../Bin/Resources/VFX/Particles/Magic/Protego");
ReadMaterials("../Bin/Resources/VFX/Particles/Magic/Confringo");
for (auto iter : m_MatFiles)
@@ -33,7 +34,7 @@ HRESULT CEffect_Editor::Initialize_Prototype()
{
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::EFFECT), vec_iter.first,
CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, vec_iter.second.c_str(), 0, vec_iter.first)))) {
return E_FAIL;
continue;
}
}
@@ -104,6 +105,61 @@ HRESULT CEffect_Editor::Ready_Child()
return S_OK;
}
HRESULT CEffect_Editor::ReSaveFile(const _char* pDirectoryPath)
{
_uint iIndex = {};
for (const auto& file : filesystem::directory_iterator(pDirectoryPath))
{
if (file.is_directory())
continue;
string ext = file.path().extension().string();
if (strcmp(ext.c_str(),".bin"))
continue;
_char szFilePath[MAX_PATH] = {};
strcpy_s(szFilePath, MAX_PATH, file.path().string().c_str());
/////////////////////////////
CEditEffect* pEditEffect = nullptr;
CPartObject::PARTOBJECT_DESC PartsDesc{};
PartsDesc.pParentTransform = m_pTransformCom;
if (FAILED(Add_PartObject<CEditEffect>("ReSaveFile" + iIndex++ , ENUM_CLASS(LEVEL::EFFECT), &pEditEffect, &PartsDesc)))
return E_FAIL;
if (FAILED(pEditEffect->LoadPre(szFilePath, LEVEL::EFFECT)))
{
Safe_Release(pEditEffect);
continue;
}
_string strPath = szFilePath;
size_t iPos;
while ((iPos = strPath.find(ext)) != std::string::npos) {
strPath.erase(iPos, ext.length());
};
pEditEffect->Save_Effect(strPath.c_str());
Safe_Release(pEditEffect);
}
return S_OK;
}
void CEffect_Editor::ReadMaterials(const char* pDirectoryName)
{
for (const auto& file : filesystem::directory_iterator(pDirectoryName))
@@ -283,8 +339,12 @@ _string CEffect_Editor::Reference_Mat_For_EditEffect(CComponent** pTexture, CGam
, wstrTextureInfo.first // 이름
);
if(strName != "")
if (strName != "")
{
GUI::TreePop();
return strName;
}
};
@@ -374,6 +434,11 @@ void CEffect_Editor::Describe_Entity()
{
Load_Edit(m_strSavePath.c_str());
}
if (GUI::Button("RESAVE"))
{
ReSaveFile(m_strSavePath.c_str());
}
ImGui::End();
@@ -15,7 +15,7 @@
#include "DummySkyBox.h"
#include "MainLight.h"
#include "Terrain.h"
#include "Player.h"
CLevel_ObjectViewer::CLevel_ObjectViewer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID)
: CLevel{ pDevice, pContext, ENUM_CLASS(eLevelID) }
@@ -54,6 +54,8 @@ void CLevel_ObjectViewer::Update(_float fTimeDelta)
Dummy_Object_Setting();
Parts_Object_Setting();
Find_Anim();
}
HRESULT CLevel_ObjectViewer::Render()
@@ -373,6 +375,14 @@ void CLevel_ObjectViewer::Dummy_Object_Setting()
GUI::Button(pModel->Get_AnimList(pModel->Get_AnimIndex()));
GUI::SameLine();
_char label[24];
sprintf_s(label, "%s %d", "AnimIndex", pModel->Get_AnimIndex());
GUI::Text(label);
_float AnimTrack = pModel->Get_CurrentTrackPosition();
GUI::DragFloat("AnimTrack", &AnimTrack);
@@ -619,7 +629,27 @@ void CLevel_ObjectViewer::Load_KeyFrame(const _char* Name)
fclose(fp);
}
void CLevel_ObjectViewer::Find_Anim()
{
GUI::InputText("FindAnim", m_FindAnimName, sizeof(m_FindAnimName));
if (!m_Objects.empty())
{
CModel* pModel = m_Objects[m_iObjectIndex]->Get_Component<CModel>();
for (_uint i = 0; i < pModel->Get_AnimSize(); i++)
{
if (strstr(pModel->Get_AnimList(i), m_FindAnimName))
{
if (GUI::Button(pModel->Get_AnimList(i)))
{
pModel->Set_AnimationIndex(i);
pModel->Set_CurrentTrackPosition(0.f);
pModel->Play_Animation(0.f);
}
}
}
}
}
HRESULT CLevel_ObjectViewer::Ready_Layer_Camera(const _wstring& strLayerTag)
@@ -663,6 +693,9 @@ HRESULT CLevel_ObjectViewer::Ready_Layer_Dummy(const _wstring& strLayerTag)
if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CTerrain>(g_iStaticLevel, NEXT_LEVEL, strLayerTag)))
return E_FAIL;
/*if (FAILED(m_pGameInstance->Add_GameObject_ToLayer<CPlayer>(g_iStaticLevel, NEXT_LEVEL, strLayerTag)))
return E_FAIL;*/
return S_OK;
}
+20 -7
View File
@@ -20,6 +20,7 @@
#include "Hair.h"
#include "DummySkyBox.h"
#include "DummyObject.h"
#include "Player.h"
#include <filesystem>
#pragma endregion
@@ -478,6 +479,16 @@ HRESULT CLoader::Loading_For_Effect()
});
Asset_FileLoad("../Bin/Resources/Models/Effect/Goo", L"Prototype_Instance_Model_", [&](_wstring wstrFileName, const _char* pFilePath) {
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::EFFECT), wstrFileName,
CInstance_Model::Create(m_pDevice, m_pContext, pFilePath, MODEL::NONANIM, XMMatrixScaling(0.1f, 0.1f, 0.1f) * XMMatrixIdentity(), 0))))
return E_FAIL;
return S_OK;
});
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Desc_Box"),
CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/Box/Box.bin", XMMatrixIdentity()))))
return E_FAIL;
@@ -951,7 +962,7 @@ HRESULT CLoader::Loading_For_ObjectViewer()
#pragma endregion
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Npc_Model"),
CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Human/Npc/Npc.bin", XMMatrixScaling(0.0001f, 0.0001f, 0.0001f) * XMMatrixIdentity()))))
CModel::Create(m_pDevice, m_pContext, MODEL::ANIM, "../Bin/Resources/Models/Human/Npc/Npc.bin", XMMatrixIdentity()))))
return E_FAIL;
if (FAILED(m_pGameInstance->Add_Asset_Prototype(ENUM_CLASS(LEVEL::STATIC), TEXT("Prototype_Component_Broom_Model"),
@@ -968,12 +979,6 @@ HRESULT CLoader::Loading_For_ObjectViewer()
CModel::Create(m_pDevice, m_pContext, MODEL::NONANIM, "../Bin/Resources/Models/Box/Box.bin", XMMatrixIdentity()))))
return E_FAIL;
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("MaskTexture"),
CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::INCREMENTAL, TEXT("../Bin/Resources/Models/Human/Hair/Mask%d.png"), 5)))) {
return E_FAIL;
}
if (FAILED(m_pGameInstance->Add_Asset_Prototype(g_iStaticLevel, TEXT("TerrainTest"),
CTexture::Create(m_pDevice, m_pContext, TEXTURE_LOAD_TYPE::SINGLE, TEXT("../Bin/Resources/Textures/Cursor/UI_T_CursorRings.dds"), 0)))) {
return E_FAIL;
@@ -1016,6 +1021,14 @@ HRESULT CLoader::Loading_For_ObjectViewer()
if (FAILED(m_pGameInstance->Add_Prototype<CTerrain>(g_iStaticLevel, CTerrain::Create(m_pDevice, m_pContext))))
return E_FAIL;
/* For.Prototype_Component_FSM */
if (FAILED(m_pGameInstance->Add_Prototype<CFSM>(g_iStaticLevel, CFSM::Create(m_pDevice, m_pContext))))
return E_FAIL;
/* For.Prototype_GameObject_Player */
if (FAILED(m_pGameInstance->Add_Prototype<CPlayer>(g_iStaticLevel, CPlayer::Create(m_pDevice, m_pContext))))
return E_FAIL;
m_strMessage = TEXT("Loading Success!");
m_isFinished = true;
+233
View File
@@ -0,0 +1,233 @@
#include "pch.h"
#include "Player.h"
#include "GameInstance.h"
#include "DebugCamera.h"
#include "State_Idle.h"
#include "State_Walk.h"
#include "State_Dodge.h"
#include "State_Sprint.h"
#include "State_Jump.h"
CPlayer::CPlayer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
: CUnit(pDevice, pContext)
{
}
CPlayer::CPlayer(const CPlayer& Prototype)
: CUnit(Prototype)
{
}
HRESULT CPlayer::Initialize_Prototype()
{
return S_OK;
}
HRESULT CPlayer::Initialize(void* pArg)
{
if (FAILED(__super::Initialize(pArg)))
return E_FAIL;
if (FAILED(Ready_Components()))
return E_FAIL;
Add_FSM();
Set_Anim();
m_pFSM->Change_State(FSMSTATE::IDLE);
return S_OK;
}
void CPlayer::Priority_Update(_float fTimeDelta)
{
}
void CPlayer::Update(_float fTimeDelta)
{
Check_State();
m_pFSM->Update(fTimeDelta);
m_pModelCom->Play_Animation(fTimeDelta, m_pTransformCom);
}
void CPlayer::Late_Update(_float fTimeDelta)
{
m_pGameInstance->Add_RenderGroup(RENDER::BLEND, this);
}
HRESULT CPlayer::Render()
{
if (FAILED(Bind_ShaderResources())) {
return E_FAIL;
}
_uint iNumMeshes = m_pModelCom->Get_NumMeshes();
for (_uint i = 0; i < iNumMeshes; i++)
{
if (FAILED(m_pModelCom->Bind_BoneMatrices(i, m_pShaderCom, "g_BoneMatrices"))) {
return E_FAIL;
}
if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_DiffuseTexture", aiTextureType_DIFFUSE, 0))) {
return E_FAIL;
}
if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom, "g_NormalTexture", aiTextureType_NORMALS, 0))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Begin(ENUM_CLASS(SHADER_PASS_ANIM::DEFAULT)))) {
return E_FAIL;
}
if (FAILED(m_pModelCom->Render(i))) {
return E_FAIL;
}
}
return S_OK;
}
_bool CPlayer::IsWalking()
{
if (m_pGameInstance->Key_Pressing(DIK_UP) || m_pGameInstance->Key_Pressing(DIK_DOWN))
{
return true;
}
return false;
}
_bool CPlayer::IsDodge()
{
if (m_pGameInstance->Key_Down(DIK_LCONTROL))
{
return true;
}
return false;
}
_bool CPlayer::IsSprint()
{
if (m_pGameInstance->Key_Pressing(DIK_LSHIFT) && m_pGameInstance->Key_Pressing(DIK_UP))
{
return true;
}
return false;
}
_bool CPlayer::IsJump()
{
if (m_pGameInstance->Key_Down(DIK_SPACE))
{
return true;
}
return false;
}
HRESULT CPlayer::Ready_Components()
{
CTransform::TRANSFORM_DESC Desc = {};
Desc.fSpeedPerSec = 10.f;
Desc.fRotationPerSec = 10.f;
Desc.fRadius = 10.f;
__super::Ready_Components(&Desc);
/* Com_Model */
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, TEXT("Prototype_Component_Npc_Model"),
reinterpret_cast<CComponent**>(&m_pModelCom))))
return E_FAIL;
/* Com_Shader */
if (FAILED(__super::Add_Asset_Component(g_iStaticLevel, FX_ANIMMESH,
reinterpret_cast<CComponent**>(&m_pShaderCom))))
return E_FAIL;
return S_OK;
}
HRESULT CPlayer::Bind_ShaderResources()
{
if (FAILED(m_pTransformCom->Bind_ShaderResource(m_pShaderCom, "g_WorldMatrix"))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_Matrix("g_ViewMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::VIEW)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_Matrix("g_ProjMatrix", m_pGameInstance->Get_Transform_Float4x4(D3DTS::PROJ)))) {
return E_FAIL;
}
if (FAILED(m_pShaderCom->Bind_RawValue("g_fFar", m_pGameInstance->Get_CurrentCameraFar(), sizeof(_float)))) {
return E_FAIL;
}
return S_OK;
}
void CPlayer::Add_FSM()
{
m_pFSM->Add_State(FSMSTATE::IDLE, new CState_Idle());
m_pFSM->Add_State(FSMSTATE::WALK, new CState_Walk());
m_pFSM->Add_State(FSMSTATE::DODGE, new CState_Dodge());
m_pFSM->Add_State(FSMSTATE::SPRINT, new CState_Sprint());
m_pFSM->Add_State(FSMSTATE::JUMP, new CState_Jump());
}
void CPlayer::Set_Anim()
{
m_Animation[FSMSTATE::IDLE] = { 41,true };
m_Animation[FSMSTATE::DODGE] = { 802,false };
m_Animation[FSMSTATE::WALK_FWD] = { 167,true };
m_Animation[FSMSTATE::WALK_BWD] = { 166,true };
m_Animation[FSMSTATE::SPRINT] = { 599,true };
m_Animation[FSMSTATE::JUMP] = { 205,false };
}
void CPlayer::Check_State()
{
IsWalking();
IsDodge();
IsSprint();
}
CPlayer* CPlayer::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
{
CPlayer* pInstance = new CPlayer(pDevice, pContext);
if (FAILED(pInstance->Initialize_Prototype()))
{
MSG_BOX("Failed to Created : CPlayer");
SAFE_RELEASE(pInstance);
}
return pInstance;
}
CGameObject* CPlayer::Clone(void* pArg, CGameObject* pOwner)
{
CPlayer* pInstance = new CPlayer(*this);
if (FAILED(pInstance->Initialize(pArg)))
{
MSG_BOX("Failed to Cloned : CPlayer");
SAFE_RELEASE(pInstance);
}
return pInstance;
}
void CPlayer::Free()
{
__super::Free();
}
void CPlayer::Describe_Entity()
{
}
@@ -0,0 +1,45 @@
#include "pch.h"
#include "State_Dodge.h"
#include "Unit.h"
CState_Dodge::CState_Dodge()
:CState()
{
}
void CState_Dodge::Enter()
{
auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::DODGE);
m_pModel->Set_AnimationIndex(anim.first, anim.second);
}
void CState_Dodge::Update(_float fTimeDelta)
{
if (CheckExitState())
return;
}
void CState_Dodge::Exit()
{
}
_bool CState_Dodge::CheckExitState()
{
if (m_pModel->IsFinishedAnim())
m_pFSM->Change_State(FSMSTATE::IDLE);
if (m_pOwner->IsWalking())
m_pFSM->Change_State(FSMSTATE::WALK);
return false;
}
void CState_Dodge::Free()
{
__super::Free();
}
void CState_Dodge::Describe_Entity()
{
}
@@ -0,0 +1,50 @@
#include "pch.h"
#include "State_Idle.h"
#include "Unit.h"
CState_Idle::CState_Idle()
:CState()
{
}
void CState_Idle::Enter()
{
auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::IDLE);
m_pModel->Set_AnimationIndex(anim.first, anim.second);
}
void CState_Idle::Update(_float fTimeDelta)
{
if (CheckExitState())
return;
}
void CState_Idle::Exit()
{
}
_bool CState_Idle::CheckExitState()
{
if (m_pOwner->IsWalking())
m_pFSM->Change_State(FSMSTATE::WALK);
if (m_pOwner->IsDodge())
m_pFSM->Change_State(FSMSTATE::DODGE);
if (m_pOwner->IsSprint())
m_pFSM->Change_State(FSMSTATE::SPRINT);
if (m_pOwner->IsJump())
m_pFSM->Change_State(FSMSTATE::JUMP);
return false;
}
void CState_Idle::Free()
{
__super::Free();
}
void CState_Idle::Describe_Entity()
{
}
@@ -0,0 +1,42 @@
#include "pch.h"
#include "State_Jump.h"
#include "Unit.h"
CState_Jump::CState_Jump()
:CState()
{
}
void CState_Jump::Enter()
{
auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::JUMP);
m_pModel->Set_AnimationIndex(anim.first, anim.second);
}
void CState_Jump::Update(_float fTimeDelta)
{
if (CheckExitState())
return;
}
void CState_Jump::Exit()
{
}
_bool CState_Jump::CheckExitState()
{
if (m_pModel->IsFinishedAnim())
m_pFSM->Change_State(FSMSTATE::IDLE);
return false;
}
void CState_Jump::Free()
{
__super::Free();
}
void CState_Jump::Describe_Entity()
{
}
@@ -0,0 +1,51 @@
#include "pch.h"
#include "State_Sprint.h"
#include "Unit.h"
CState_Sprint::CState_Sprint()
:CState()
{
}
void CState_Sprint::Enter()
{
auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::SPRINT);
m_pModel->Set_AnimationIndex(anim.first, anim.second);
}
void CState_Sprint::Update(_float fTimeDelta)
{
if (CheckExitState())
return;
auto Transform = m_pOwner->Get_Component<CTransform>();
if (m_pGameInstance->Key_Pressing(DIK_LEFT))
Transform->Turn(-Transform->Get_State(STATE::UP), fTimeDelta);
if (m_pGameInstance->Key_Pressing(DIK_RIGHT))
Transform->Turn(Transform->Get_State(STATE::UP), fTimeDelta);
}
void CState_Sprint::Exit()
{
}
_bool CState_Sprint::CheckExitState()
{
if (!m_pOwner->IsSprint())
m_pFSM->Change_State(FSMSTATE::WALK);
else if (!m_pOwner->IsWalking())
m_pFSM->Change_State(FSMSTATE::IDLE);
return false;
}
void CState_Sprint::Free()
{
__super::Free();
}
void CState_Sprint::Describe_Entity()
{
}
@@ -0,0 +1,65 @@
#include "pch.h"
#include "State_Walk.h"
#include "Unit.h"
CState_Walk::CState_Walk()
:CState()
{
}
void CState_Walk::Enter()
{
if (m_pGameInstance->Key_Down(DIK_UP))
{
auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::WALK_FWD);
m_pModel->Set_AnimationIndex(anim.first, anim.second);
}
if (m_pGameInstance->Key_Down(DIK_DOWN))
{
auto anim = m_pOwner->Get_AnimInfo(FSMSTATE::WALK_BWD);
m_pModel->Set_AnimationIndex(anim.first, anim.second);
}
}
void CState_Walk::Update(_float fTimeDelta)
{
if (CheckExitState())
return;
auto Transform = m_pOwner->Get_Component<CTransform>();
if (m_pGameInstance->Key_Pressing(DIK_LEFT))
Transform->Turn(-Transform->Get_State(STATE::UP), fTimeDelta);
if (m_pGameInstance->Key_Pressing(DIK_RIGHT))
Transform->Turn(Transform->Get_State(STATE::UP), fTimeDelta);
}
void CState_Walk::Exit()
{
}
_bool CState_Walk::CheckExitState()
{
if (m_pOwner->IsSprint())
m_pFSM->Change_State(FSMSTATE::SPRINT);
else if (m_pOwner->IsDodge())
m_pFSM->Change_State(FSMSTATE::DODGE);
else if (!m_pOwner->IsWalking())
m_pFSM->Change_State(FSMSTATE::IDLE);
return false;
}
void CState_Walk::Free()
{
__super::Free();
}
void CState_Walk::Describe_Entity()
{
}
+11 -23
View File
@@ -1,22 +1,12 @@
#pragma once
#include "Editor_Define.h"
#include "GameObject.h"
NS_BEGIN(Engine)
class CShader;
class CModel;
NS_END
#include "Unit.h"
NS_BEGIN(Editor)
class CDummyObject final : public CGameObject
class CDummyObject final : public CUnit
{
public:
typedef struct tagObjectDesc
{
const _tchar* pModelPrototypeTag;
}PARTS_OBJECT_DESC;
private:
CDummyObject(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
CDummyObject(const CDummyObject& Prototype);
@@ -31,21 +21,19 @@ class CDummyObject final : public CGameObject
virtual HRESULT Render() override;
public:
_wstring& Get_PrototypeTag() { return m_strModelPrototypeTag; }
private:
CShader* m_pShaderCom = { nullptr };
CModel* m_pModelCom = { nullptr };
_wstring m_strModelPrototypeTag;
_bool m_bRimLight = { true };
_float m_fRimLightPower = { 3.2f };
_float m_fRimLightStrength = { 3.04f };
_float3 m_vRimLightColor = { 69.f / 255.f, 5.f / 255.f, 10.f / 255.f };
virtual _bool IsWalking() override;
virtual _bool IsDodge() override;
virtual _bool IsSprint() override;
virtual _bool IsJump() override;
private:
HRESULT Ready_Components();
HRESULT Bind_ShaderResources();
virtual void Add_FSM();
virtual void Set_Anim();
void Check_State();
public:
static CDummyObject* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr) override;
+69 -7
View File
@@ -21,17 +21,21 @@ class CEffectObject abstract : public CPartObject
_float2 vDiffuseUVGainAmount = {};
_float2 vMaskingUVGainAmount = {};
_float2 vNoiseUVGainAmount = {};
_float2 vDiffuseNoiseUVGainAmount = {};
_float2 vMaskNoiseUVGainAmount = {};
_float2 vDiffuseDistortionUVGainAmount = {};
_float2 vMaskDistortionUVGainAmount = {};
_float2 vUVCutting = { 1.f ,1.f };
_float2 vUVMaskCutting = { 1.f ,1.f };
_int iMaskMoveLerpOption = { 0 };
_int iDiffuseMoveLerpOption = { 0 };
_int iMaskNoiseMoveLerpOption = { 0 };
_int iDiffuseNoiseMoveLerpOption = { 0 };
_int iNoiseMoveLerpOption = { 0 };
_int iMaskDistortionMoveLerpOption = { 0 };
_int iDiffuseDistortionMoveLerpOption = { 0 };
_int iBlurWeight = { 0 };
@@ -40,14 +44,15 @@ class CEffectObject abstract : public CPartObject
_bool isDissolve = {};
_bool isNoise = {};
_bool isEmissive = {};
_bool isDistortion = {};
_bool isDiffuseUVMove = {};
_bool isNoiseUVMove = {};
_bool isMaskUVMove = {};
_bool isBlur = {};
_bool isBillboard = {};
_float4 vEmissive = { 0.f ,0.f ,0.f ,0.f };
_float fColorOption = {};
_float fDiffuseAlpha = { 1.f };
_float fBlurIntensity = {};
_float fNoiseDistortionIntensity = {};
_float fEmissiveCutAlpha = {};
@@ -55,8 +60,57 @@ class CEffectObject abstract : public CPartObject
LIGHT_DESC LightDesc = {};
RENDER eRenderOrder = { RENDER::EFFECT };
_bool isReverseDissolve = {};
}EFFECT_INFO;
typedef struct tagPreEffectInfo
{
_float4 vColor = { 0.f ,0.f ,0.f ,1.f };
_float2 vDiffuseUVGainAmount = {};
_float2 vMaskingUVGainAmount = {};
_float2 vNoiseUVGainAmount = {};
_float2 vDiffuseDistortionUVGainAmount = {};
_float2 vMaskDistortionUVGainAmount = {};
_float2 vUVCutting = { 1.f ,1.f };
_float2 vUVMaskCutting = { 1.f ,1.f };
_int iMaskMoveLerpOption = { 0 };
_int iDiffuseMoveLerpOption = { 0 };
_int iNoiseMoveLerpOption = { 0 };
_int iMaskDistortionMoveLerpOption = { 0 };
_int iDiffuseDistortionMoveLerpOption = { 0 };
_int iBlurWeight = { 0 };
_bool isDiffuse = {};
_bool isMasking = {};
_bool isDissolve = {};
_bool isNoise = {};
_bool isEmissive = {};
_bool isDistortion = {};
_bool isDiffuseUVMove = {};
_bool isNoiseUVMove = {};
_bool isMaskUVMove = {};
_bool isBlur = {};
_bool isBillboard = {};
_float4 vEmissive = { 0.f ,0.f ,0.f ,0.f };
_float fDiffuseAlpha = { 1.f };
_float fBlurIntensity = {};
_float fNoiseDistortionIntensity = {};
_float fEmissiveCutAlpha = {};
LIGHT_DESC LightDesc = {};
RENDER eRenderOrder = { RENDER::EFFECT };
}PRE_EFFECT_INFO;
protected:
CEffectObject(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
CEffectObject(const CEffectObject& rhs);
@@ -70,6 +124,13 @@ class CEffectObject abstract : public CPartObject
virtual HRESULT Render_Blur() override;
public:
HRESULT Load(const _char* pFilePath, LEVEL eLevel);
public:
#ifdef _DEBUG
HRESULT LoadPre(const _char* pFilePath, LEVEL eLevel);
#endif // DEBUG
protected:
virtual HRESULT Bind_ShaderResources() override;
virtual HRESULT Ready_Components(void* pArg) override;
@@ -82,6 +143,7 @@ class CEffectObject abstract : public CPartObject
CTexture* m_pMasking_TextureCom = { nullptr };
CTexture* m_pDissolve_TextureCom = { nullptr };
CTexture* m_pEmissive_TextureCom = { nullptr };
CTexture* m_pDistortion_TextureCom = { nullptr };
CShader* m_pShaderCom = { nullptr };
CLight* m_pLightCom = { nullptr };
@@ -96,7 +158,7 @@ class CEffectObject abstract : public CPartObject
_string m_strDissolveName = {};
_string m_strModelName = {};
_string m_strEmissiveName = {};
_string m_strDistortionName = {};
public:
virtual void Free() override;
@@ -33,6 +33,7 @@ class CEffect_Editor final : public CContainerObject
HRESULT Ready_Child();
HRESULT Bind_ShaderResources() override;
private:
HRESULT ReSaveFile(const _char* pDirectoryPath);
void ReadMaterials(const char* pDirectoryName);
void ReadMaterial(_wstring wstrFileName, const char* pFilePath);
@@ -39,7 +39,7 @@ class CLevel_ObjectViewer final : public CLevel
void Save_LayerName(const _char* Layer);
_wchar* Save_ModelName(const _char* Category);
void Load_KeyFrame(const _char* Name);
void Find_Anim();
private:
vector<CGameObject*> m_Objects;
@@ -56,6 +56,7 @@ class CLevel_ObjectViewer final : public CLevel
_wchar m_wszLayer[MAX_PATH];
_wchar m_wszPreLayer[MAX_PATH];
_char m_DummyPath[MAX_PATH];
_char m_FindAnimName[256] = {};
public:
static CLevel_ObjectViewer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, LEVEL eLevelID);
virtual void Free() override;
+44
View File
@@ -0,0 +1,44 @@
#pragma once
#include "Editor_Define.h"
#include "Unit.h"
NS_BEGIN(Editor)
class CPlayer final : public CUnit
{
private:
CPlayer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
CPlayer(const CPlayer& Prototype);
virtual ~CPlayer() = default;
public:
virtual HRESULT Initialize_Prototype() override;
virtual HRESULT Initialize(void* pArg) override;
virtual void Priority_Update(_float fTimeDelta) override;
virtual void Update(_float fTimeDelta) override;
virtual void Late_Update(_float fTimeDelta) override;
virtual HRESULT Render() override;
public:
virtual _bool IsWalking() override;
virtual _bool IsDodge() override;
virtual _bool IsSprint() override;
virtual _bool IsJump() override;
private:
HRESULT Ready_Components();
HRESULT Bind_ShaderResources();
virtual void Add_FSM();
virtual void Set_Anim();
void Check_State();
public:
static CPlayer* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
virtual CGameObject* Clone(void* pArg, CGameObject* pOwner = nullptr) override;
virtual void Free() override;
virtual void Describe_Entity() override;
};
NS_END
@@ -0,0 +1,19 @@
#pragma once
#include "Editor_Define.h"
#include "State.h"
class CState_Dodge final : public CState
{
public:
CState_Dodge();
virtual ~CState_Dodge() = default;
public:
virtual void Enter();
virtual void Update(_float fTimeDelta);
virtual void Exit();
virtual _bool CheckExitState();
public:
virtual void Free() override;
virtual void Describe_Entity();
};
@@ -0,0 +1,21 @@
#pragma once
#include "Editor_Define.h"
#include "State.h"
class CState_Idle final : public CState
{
public:
CState_Idle();
virtual ~CState_Idle() = default;
public:
virtual void Enter();
virtual void Update(_float fTimeDelta);
virtual void Exit();
virtual _bool CheckExitState();
public:
virtual void Free() override;
virtual void Describe_Entity();
};
@@ -0,0 +1,20 @@
#pragma once
#include "Editor_Define.h"
#include "State.h"
class CState_Jump final : public CState
{
public:
CState_Jump();
virtual ~CState_Jump() = default;
public:
virtual void Enter();
virtual void Update(_float fTimeDelta);
virtual void Exit();
virtual _bool CheckExitState();
public:
virtual void Free() override;
virtual void Describe_Entity();
};
@@ -0,0 +1,21 @@
#pragma once
#include "Editor_Define.h"
#include "State.h"
class CState_Sprint final : public CState
{
public:
CState_Sprint();
virtual ~CState_Sprint() = default;
public:
virtual void Enter();
virtual void Update(_float fTimeDelta);
virtual void Exit();
virtual _bool CheckExitState();
public:
virtual void Free() override;
virtual void Describe_Entity();
};
@@ -0,0 +1,21 @@
#pragma once
#include "Editor_Define.h"
#include "State.h"
class CState_Walk final : public CState
{
public:
CState_Walk();
virtual ~CState_Walk() = default;
public:
virtual void Enter();
virtual void Update(_float fTimeDelta);
virtual void Exit();
virtual _bool CheckExitState();
public:
virtual void Free() override;
virtual void Describe_Entity();
};
@@ -194,8 +194,8 @@ BlendState BS_WeightBlend
BlendEnable[7] = true;
SrcBlend[0] = Inv_Src_Alpha;
DestBlend[0] = Src_Alpha;
SrcBlend[0] = Src_Alpha;
DestBlend[0] = Inv_Src_Alpha;
BlendOp[0] = Add;
@@ -57,31 +57,9 @@ PS_OUT_BACKBUFFER PS_OUT_LASTCOLOR(PS_IN In)
discard;
}
int iOption = vColorTexture.a * 10;
Out.vBackBuffer = vColorTexture;
switch (iOption)
{
case 1:
Out.vBackBuffer.rgb /= vColorTexture.rgb;
break;
case 2:
Out.vBackBuffer.rgb += vColorTexture.rgb;
break;
case 3:
Out.vBackBuffer.rgb -= vColorTexture.rgb;
break;
case 4:
Out.vBackBuffer.rgb *= vColorTexture.rgb;
break;
case 5:
Out.vBackBuffer.rgb = vColorTexture.rgb;
break;
default:
break;
}
return Out;
}
@@ -21,10 +21,13 @@ struct ParticleValue
float2 vMaskingUVMoveTime;
float2 vDiffuseUVMoveTime;
float2 vDistortionUVMoveTime;
float2 vNoiseUVMoveTime;
float2 vAniTime;
float2 vAniIndex;
};
@@ -48,14 +48,21 @@ PS_OUT PS_MAIN(PS_IN In)
{
PS_OUT Out;
vector vMixedDiffuse = g_MixedDiffuseTexture.Sample(PointSampler, In.vTexcoord);
vector vRevealage = g_RevealageTexture.Sample(PointSampler, In.vTexcoord);
float fRevealage = g_RevealageTexture.Sample(PointSampler, In.vTexcoord);
if(vRevealage.b >= 1.f)
discard;
Out.vBackBuffer = vector(vMixedDiffuse.rgb / fRevealage , fRevealage);
//float fClamp;
//fClamp = clamp(vMixedDiffuse.a, 1e-4, 5e4);
//Out.vBackBuffer = vector(vMixedDiffuse.rgb / fClamp, fRevealage);
Out.vBackBuffer = vector(vMixedDiffuse.rgb / max(vMixedDiffuse.a, 1e-5), 1 - vRevealage.r);
return Out;
}
@@ -212,6 +212,7 @@ call Update_Lib.bat
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="..\private\ElementObject.cpp" />
<ClCompile Include="..\Private\FSM.cpp" />
<ClCompile Include="..\Private\GameInstance.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
</ExcludedFromBuild>
@@ -295,6 +296,7 @@ call Update_Lib.bat
<ClCompile Include="..\Private\Shader.cpp" />
<ClCompile Include="..\Private\Shadow.cpp" />
<ClCompile Include="..\Private\SoundSrc.cpp" />
<ClCompile Include="..\Private\State.cpp" />
<ClCompile Include="..\Private\Texture.cpp" />
<ClCompile Include="..\Private\Timer.cpp" />
<ClCompile Include="..\Private\Timer_Manager.cpp" />
@@ -304,6 +306,7 @@ call Update_Lib.bat
<ClCompile Include="..\Private\Transform.cpp" />
<ClCompile Include="..\private\UIComponent.cpp" />
<ClCompile Include="..\private\UIObject.cpp" />
<ClCompile Include="..\Private\Unit.cpp" />
<ClCompile Include="..\Private\VIBuffer.cpp" />
<ClCompile Include="..\Private\VIBuffer_Cell.cpp" />
<ClCompile Include="..\Private\VIBuffer_Cube.cpp" />
@@ -411,6 +414,7 @@ call Update_Lib.bat
<ClInclude Include="..\Public\Bounding_AABB.h" />
<ClInclude Include="..\Public\Bounding_OBB.h" />
<ClInclude Include="..\Public\Bounding_Sphere.h" />
<ClInclude Include="..\public\FSM.h" />
<ClInclude Include="..\Public\RigidBody_Dynamic_Joint.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
@@ -532,6 +536,7 @@ call Update_Lib.bat
<ClInclude Include="..\Public\Shader.h" />
<ClInclude Include="..\Public\Shadow.h" />
<ClInclude Include="..\Public\SoundSrc.h" />
<ClInclude Include="..\Public\State.h" />
<ClInclude Include="..\Public\Texture.h" />
<ClInclude Include="..\Public\Timer.h" />
<ClInclude Include="..\Public\Timer_Manager.h" />
@@ -539,6 +544,7 @@ call Update_Lib.bat
<ClInclude Include="..\Public\Transform.h" />
<ClInclude Include="..\public\UIComponent.h" />
<ClInclude Include="..\public\UIObject.h" />
<ClInclude Include="..\Public\Unit.h" />
<ClInclude Include="..\Public\VIBuffer.h" />
<ClInclude Include="..\Public\VIBuffer_Cell.h" />
<ClInclude Include="..\Public\VIBuffer_Cube.h" />
@@ -259,6 +259,15 @@
<Filter Include="02.Element\02.Component\08.Character_Controller\CallBack">
<UniqueIdentifier>{05865481-fa20-4432-a5a7-945d4f8c7f3c}</UniqueIdentifier>
</Filter>
<Filter Include="02.Element\02.Component\10.FSM">
<UniqueIdentifier>{0014599a-3877-4fe8-b32f-1dafc3753c6b}</UniqueIdentifier>
</Filter>
<Filter Include="02.Element\02.Component\10.FSM\State">
<UniqueIdentifier>{cf6beeeb-6caa-46ef-b9d9-3b1daf43a7f1}</UniqueIdentifier>
</Filter>
<Filter Include="02.Element\01.GameObject\Unit">
<UniqueIdentifier>{a4560f1b-c4f4-4705-bbf8-6a60977d3211}</UniqueIdentifier>
</Filter>
<Filter Include="02.Element\02.Component\07.RigidBody\20.Joint">
<UniqueIdentifier>{869c0ee8-a853-40d4-90ea-3e1501fa8529}</UniqueIdentifier>
</Filter>
@@ -489,6 +498,15 @@
<ClCompile Include="..\Public\NCallBack_Playable_Behavior.cpp">
<Filter>02.Element\02.Component\08.Character_Controller\CallBack</Filter>
</ClCompile>
<ClCompile Include="..\Private\FSM.cpp">
<Filter>02.Element\02.Component\10.FSM</Filter>
</ClCompile>
<ClCompile Include="..\Private\State.cpp">
<Filter>02.Element\02.Component\10.FSM\State</Filter>
</ClCompile>
<ClCompile Include="..\Private\Unit.cpp">
<Filter>02.Element\01.GameObject\Unit</Filter>
</ClCompile>
<ClCompile Include="..\Private\RigidBody_Dynamic_Joint.cpp">
<Filter>02.Element\02.Component\07.RigidBody\20.Joint</Filter>
</ClCompile>
@@ -1085,6 +1103,15 @@
<ClInclude Include="..\Public\NCallBack_Playable_Behavior.h">
<Filter>02.Element\02.Component\08.Character_Controller\CallBack</Filter>
</ClInclude>
<ClInclude Include="..\public\FSM.h">
<Filter>02.Element\02.Component\10.FSM</Filter>
</ClInclude>
<ClInclude Include="..\Public\State.h">
<Filter>02.Element\02.Component\10.FSM\State</Filter>
</ClInclude>
<ClInclude Include="..\Public\Unit.h">
<Filter>02.Element\01.GameObject\Unit</Filter>
</ClInclude>
<ClInclude Include="..\Public\RigidBody_Dynamic_Joint.h">
<Filter>02.Element\02.Component\07.RigidBody\20.Joint</Filter>
</ClInclude>
+72 -8
View File
@@ -4,6 +4,7 @@
#include "Channel.h"
#include "Model.h"
#include "Transform.h"
#include "Bone.h"
CAnimation::CAnimation()
{
@@ -48,8 +49,11 @@ _bool CAnimation::Update_TransformationMatrices(const vector<class CBone*>& Bone
}
_uint iIndex = {};
if (m_vBoneTransformationMatrix.size() > 0)
m_vBoneTransformationMatrix.clear();
for (auto& pChannel : m_Channels) {
pChannel->Update_TransformationMatirx(Bones, m_fCurrentTrackPosition, &m_CurrentKeyFrameIndices[iIndex++],pTransform);
m_vBoneTransformationMatrix.push_back(pChannel->Get_BoneTransformationMatrix());
}
return false;
@@ -105,18 +109,78 @@ vector<_int>* CAnimation::Capture_Bones()
return &m_DestBones;
}
void CAnimation::Remap_Channels_By_Name(CModel* TargetModel)
void CAnimation::InterpAnim(CAnimation* pPreAnim, vector<CBone*>& Bones, float fRatio)
{
for (auto& channel : m_Channels)
if (!pPreAnim) return;
if (m_Channels.empty() || pPreAnim->m_Channels.empty()) return;
size_t CurCount = m_vBoneTransformationMatrix.size();
size_t PreCount = pPreAnim->m_vBoneTransformationMatrix.size();
if (CurCount == 0 || PreCount == 0)
return;
if (CurCount > PreCount)
{
const string& name = channel->Get_Name();
pPreAnim->m_vBoneTransformationMatrix.resize(CurCount, XMMatrixIdentity());
}
else if (CurCount < PreCount)
{
m_vBoneTransformationMatrix.resize(PreCount, XMMatrixIdentity());
}
int idx = TargetModel->Get_BoneIndex(name.c_str());
size_t Count = m_vBoneTransformationMatrix.size();
if (idx != -1)
channel->Set_BoneIndex(idx);
else
channel->Set_BoneIndex(-1);
unordered_map<_string, int> PreBoneMap;
PreBoneMap.reserve(pPreAnim->m_Channels.size());
for (size_t j = 0; j < pPreAnim->m_Channels.size(); j++)
{
PreBoneMap[pPreAnim->m_pSaveAnim->Channels[j].ChannelName] = (int)j;
}
for (size_t i = 0; i < m_Channels.size(); i++)
{
const _string& BoneName = m_pSaveAnim->Channels[i].ChannelName;
auto iter = PreBoneMap.find(BoneName);
if (iter == PreBoneMap.end())
{
_int BoneIndex = m_Channels[i]->Get_BoneIndex();
if (BoneIndex < Bones.size())
Bones[BoneIndex]->Set_TransformationMatrix(m_vBoneTransformationMatrix[i]);
continue;
}
int PreIndex = iter->second;
_matrix CurMat = m_vBoneTransformationMatrix[i];
_matrix PreMat = pPreAnim->m_vBoneTransformationMatrix[PreIndex];
_vector CurScale, CurRot, CurPos;
_vector PreScale, PreRot, PrePos;
XMMatrixDecompose(&CurScale, &CurRot, &CurPos, CurMat);
XMMatrixDecompose(&PreScale, &PreRot, &PrePos, PreMat);
_vector FinalScale = XMVectorLerp(PreScale, CurScale, fRatio);
_vector FinalRot = XMQuaternionSlerp(PreRot, CurRot, fRatio);
_vector FinalPos = XMVectorLerp(PrePos, CurPos, fRatio);
if (BoneName == "Reference")
{
FinalPos = XMVectorZero();
}
_matrix FinalMat = XMMatrixAffineTransformation(FinalScale, XMVectorZero(), FinalRot, FinalPos);
int BoneIndex = m_Channels[i]->Get_BoneIndex();
if (BoneIndex < Bones.size())
{
Bones[BoneIndex]->Set_TransformationMatrix(FinalMat);
}
m_vBoneTransformationMatrix[i] = FinalMat;
}
}
+5 -3
View File
@@ -154,7 +154,7 @@ void CChannel::Update_TransformationMatirx(const vector<CBone*>& Bones, _float f
_vector vDeltaAdjusted = {};
XMMATRIX pre = XMLoadFloat4x4(&m_PreTransformMatrix);
vDeltaAdjusted = XMVector3TransformNormal(vDeltaLocal, pre*20.f);
vDeltaAdjusted = XMVector3TransformNormal(vDeltaLocal, pre);
_vector vRight = pTransform->Get_State(STATE::RIGHT);
_vector vUp = pTransform->Get_State(STATE::UP);
@@ -166,6 +166,8 @@ void CChannel::Update_TransformationMatirx(const vector<CBone*>& Bones, _float f
_vector vDeltaWorld = vRight * dx + vUp * dz + vLook * dy;
vDeltaWorld *= 0.01f;
_vector vCurrentPos = pTransform->Get_State(STATE::POSITION);
_vector vTargetPos = vCurrentPos + vDeltaWorld;
@@ -175,9 +177,9 @@ void CChannel::Update_TransformationMatirx(const vector<CBone*>& Bones, _float f
vTranslation = XMVectorZero();
}
_matrix BoneTransformationMatrix = XMMatrixAffineTransformation(vScale, XMVectorSet(0.f, 0.f, 0.f, 1.f), vRotation, vTranslation);
m_BoneTransformationMatrix = XMMatrixAffineTransformation(vScale, XMVectorSet(0.f, 0.f, 0.f, 1.f), vRotation, vTranslation);
Bones[m_iBoneIndex]->Set_TransformationMatrix(BoneTransformationMatrix);
Bones[m_iBoneIndex]->Set_TransformationMatrix(m_BoneTransformationMatrix);
}
+95
View File
@@ -0,0 +1,95 @@
#include "pch.h"
#include "FSM.h"
#include "State.h"
CFSM::CFSM(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
:CComponent(pDevice, pContext)
{
m_States.resize(FSMSTATE::END);
}
CFSM::CFSM(const CFSM& rhs)
: CComponent(rhs),
m_States(rhs.m_States)
{
}
HRESULT CFSM::Initialize_Prototype()
{
return S_OK;
}
HRESULT CFSM::Initialize(void* pArg)
{
return S_OK;
}
void CFSM::Add_State(_uint iIndex, CState* state)
{
m_States[iIndex] = state;
m_States[iIndex]->Set_Owner(m_pOwner);
m_States[iIndex]->Set_Component();
}
void CFSM::Change_State(_uint iIndex)
{
if (m_pCurrent)
m_pCurrent->Exit();
m_pCurrent = m_States[iIndex];
if (m_pCurrent)
m_pCurrent->Enter();
}
void CFSM::Update(_float fTimeDelta)
{
if (m_pCurrent)
m_pCurrent->Update(fTimeDelta);
}
CFSM* CFSM::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
{
CFSM* pInstance = new CFSM(pDevice, pContext);
if (FAILED(pInstance->Initialize_Prototype()))
{
MSG_BOX("Failed to Created : CFSM");
SAFE_RELEASE(pInstance);
}
return pInstance;
}
CComponent* CFSM::Clone(void* pArg, class CGameObject* pOwner)
{
CFSM* pInstance = new CFSM(*this);
pInstance->m_pOwner = pOwner;
if (FAILED(pInstance->Initialize(pArg)))
{
MSG_BOX("Failed to Cloned : CFSM");
SAFE_RELEASE(pInstance);
}
return pInstance;
}
void CFSM::Free()
{
__super::Free();
SAFE_RELEASE(m_pCurrent);
for (auto& states : m_States)
{
SAFE_RELEASE(states);
}
m_States.clear();
}
void CFSM::Describe_Entity()
{
}
@@ -540,6 +540,12 @@ void CInstance_Model::Describe_Entity()
Instane_Buffer_ReStruct();
}
if (ImGui::DragFloat2("DistortionUVMoveTime", reinterpret_cast<_float*>(&m_InstanceDesc.vDistortionUVMoveTime)))
{
Instane_Buffer_ReStruct();
}
if (ImGui::DragFloat2("NoiseUVMoveTime", reinterpret_cast<_float*>(&m_InstanceDesc.vNoiseUVMoveTime)))
{
Instane_Buffer_ReStruct();
+19 -4
View File
@@ -151,11 +151,25 @@ _bool CModel::Play_Animation(_float fTimeDelta,CTransform* pTransform)
return false; // 잘못된 초기화
}
if (true == m_pLerpAnim->IsLerping()) { // 럴프중이면 자동으로 럴프 Update를 부름
m_bIsFinishedLerp = m_pLerpAnim->Update_TransformationMatrices(m_Bones, fTimeDelta);
}
else { // 럴프중이지 않다면 실제 애니메이션 재생을 시작함
if (m_iPreAnimIndex != m_iCurrentAnimIndex && m_iPreAnimIndex != 0)
{
m_fBlendTime += fTimeDelta;
_float fRatio = m_fBlendTime / m_fBlendDuration;
fRatio = min(fRatio, 1.f);
m_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_bIsLoop, fTimeDelta, pTransform);
m_Animations[m_iCurrentAnimIndex]->InterpAnim(m_Animations[m_iPreAnimIndex], m_Bones, fRatio);
if (fRatio >= 1.f)
{
m_iPreAnimIndex = m_iCurrentAnimIndex;
m_fBlendTime = 0.f;
}
}
else
{
m_bIsFinishedAnim = m_Animations[m_iCurrentAnimIndex]->Update_TransformationMatrices(m_Bones, m_bIsLoop, fTimeDelta, pTransform);
m_iPreAnimIndex = m_iCurrentAnimIndex;
}
for (_int i = 0; i < m_Bones.size(); ++i)
@@ -199,6 +213,7 @@ void CModel::Set_AnimationIndex(_uint iIndex, _bool isLoop)
m_iCurrentAnimIndex = iIndex;
m_bIsLoop = isLoop;
m_Animations[m_iCurrentAnimIndex]->ResetRootMotion();
m_Animations[m_iCurrentAnimIndex]->Depart_Animation();
}
else
m_iCurrentAnimIndex = -1;
+4 -3
View File
@@ -26,6 +26,7 @@ HRESULT CRenderer::Add_RenderGroup(RENDER eRenderGroup, CGameObject* pRenderObje
if (RENDER::UI == eRenderGroup || RENDER::PRIORITY == eRenderGroup /* || RENDER::SHADOW == eRenderGroup*/ || RENDER::BLUR == eRenderGroup) {
bPossible = true;
}
bPossible = true;
if (true == bPossible) {
m_RenderObjects[ENUM_CLASS(eRenderGroup)].push_back(pRenderObject);
@@ -72,7 +73,7 @@ void CRenderer::Render()
#ifdef _DEBUG
m_pGameInstance->RenderTarget_Debuger();
if(m_pGameInstance->Key_Pressing(DIK_F10))
Render_Debug();
#endif
@@ -587,14 +588,14 @@ HRESULT CRenderer::Initialize()
/*WB_COLOR*/
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_WB_Color"), (_uint)Viewport.Width, (_uint)Viewport.Height,
DXGI_FORMAT_R16G16B16A16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 1.0f)))) {
DXGI_FORMAT_R16G16B16A16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 0.0f)))) {
return E_FAIL;
}
/* WB_A*/
if (FAILED(m_pGameInstance->Add_RenderTarget(TEXT("Target_WB_Revealage"), (_uint)Viewport.Width, (_uint)Viewport.Height,
DXGI_FORMAT_R16G16B16A16_FLOAT, _float4(1.0f, 1.0f, 1.0f, 1.0f)))) {
DXGI_FORMAT_R16_FLOAT, _float4(0.0f, 0.0f, 0.0f, 0.0f)))) {
return E_FAIL;
}
+49
View File
@@ -0,0 +1,49 @@
#include "pch.h"
#include "State.h"
#include "GameInstance.h"
#include "Unit.h"
CState::CState()
: m_pGameInstance{ CGameInstance::GetInstance() }
{
SAFE_ADDREF(m_pGameInstance);
}
void CState::Enter()
{
}
void CState::Update(_float fTimeDelta)
{
}
void CState::Exit()
{
}
_bool CState::CheckExitState()
{
return true;
}
void CState::Set_Owner(CGameObject* pOwner)
{
m_pOwner = dynamic_cast<CUnit*>(pOwner);
};
void CState::Set_Component()
{
m_pModel = m_pOwner->Get_Component<CModel>();
m_pFSM = m_pOwner->Get_Component<CFSM>();
}
void CState::Free()
{
__super::Free();
SAFE_RELEASE(m_pGameInstance);
}
void CState::Describe_Entity()
{
}
+76
View File
@@ -0,0 +1,76 @@
#include "pch.h"
#include "Unit.h"
#include "GameInstance.h"
CUnit::CUnit(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
: CGameObject(pDevice, pContext)
{
}
CUnit::CUnit(const CUnit& Prototype)
: CGameObject(Prototype)
{
}
HRESULT CUnit::Initialize_Prototype()
{
return S_OK;
}
HRESULT CUnit::Initialize(void* pArg)
{
if (FAILED(__super::Initialize(pArg)))
return E_FAIL;
m_Animation.resize(FSMSTATE::END);
return S_OK;
}
void CUnit::Priority_Update(_float fTimeDelta)
{
}
void CUnit::Update(_float fTimeDelta)
{
}
void CUnit::Late_Update(_float fTimeDelta)
{
}
HRESULT CUnit::Render()
{
return S_OK;
}
HRESULT CUnit::Ready_Components(void *pArg)
{
__super::Ready_Components(pArg);
/* Com_FSM */
if (FAILED(Add_Component<CFSM>(g_iStaticLevel, &m_pFSM)))
return E_FAIL;
return S_OK;
}
HRESULT CUnit::Bind_ShaderResources()
{
return S_OK;
}
void CUnit::Free()
{
__super::Free();
SAFE_RELEASE(m_pShaderCom);
SAFE_RELEASE(m_pModelCom);
SAFE_RELEASE(m_pFSM);
}
void CUnit::Describe_Entity()
{
}
+2 -2
View File
@@ -20,6 +20,7 @@ class ENGINE_DLL CAnimation : public CBase
_int Get_AnimProgressPostion(const _char* pAnimChannelName);
void Set_AnimProgressPostion(const _char* pChannelName, _uint iPosition);
vector<_int>* Capture_Bones();
void InterpAnim(CAnimation* pPreAnim, vector<CBone*>& Bones, float fRatio);
vector<LERPDESC> Get_StartFrameInformations() { return m_StartKeyFrames; }
const _string& Get_Name() const { return m_strName; }
@@ -28,7 +29,6 @@ class ENGINE_DLL CAnimation : public CBase
_float Get_CurrentTrackPosition() { return m_fCurrentTrackPosition; }
void Set_AnimSpeed(_float fSpeed) { m_fAnimSpeed = fSpeed; }
_float Get_AnimSpeed() { return m_fAnimSpeed; }
void Remap_Channels_By_Name(class CModel* TargetModel);
#ifdef EDITOR_PROJECT
private:
HRESULT Initialize(const vector<class CBone*>& Bones, const aiAnimation* pAIAnimation);
@@ -63,7 +63,7 @@ class ENGINE_DLL CAnimation : public CBase
vector<_int> m_DestBones; // 이 애니메이션에서 영향을 받는 본들의 집합
vector<LERPDESC> m_StartKeyFrames; // 이 애니메이션의 영향을 받는 본들의 초기값
vector<_matrix> m_vBoneTransformationMatrix = {};
public:
static CAnimation* Create(HANDLE hFile, DWORD& dwByte);
// 바이너리
+2
View File
@@ -23,6 +23,7 @@ class ENGINE_DLL CChannel : public CBase
_int Get_BoneIndex() { return { m_iBoneIndex }; }
void Set_BoneIndex(_int iBoneIndex) { m_iBoneIndex = iBoneIndex; }
void ResetRootMotion() { m_vPrevRootPos = { 0.f, 0.f, 0.f }; }
_matrix Get_BoneTransformationMatrix() { return m_BoneTransformationMatrix; }
KEYFRAME* Get_Frame(_uint iIndex);
void Set_Frame(_uint iIndex, KEYFRAME& kf);
@@ -45,6 +46,7 @@ class ENGINE_DLL CChannel : public CBase
_float4x4 m_PreTransformMatrix = {};
vector<KEYFRAME> m_KeyFrames; // 키프레임 벡터
_float3 m_vPrevRootPos = { 0.f, 0.f, 0.f };
_matrix m_BoneTransformationMatrix = {};
public:
static CChannel* Create(const vector<class CBone*>& Bones, _uint iIndex); // 럴프전용
static CChannel* Create(HANDLE hFile, DWORD& dwByte);

Some files were not shown because too many files have changed in this diff Show More