Merge branch 'Develope' into Effect
This commit is contained in:
@@ -557,23 +557,23 @@ float2 CalcVelocityUV(float4 vCurrentProjPos, float4 vPreviousProjPos, float fIn
|
||||
float3 DownSampleFast(Texture2D SrcTexture2D, float2 vCenterTexcoord, float2 vSrcTexelSize, float2 vResolution)
|
||||
{
|
||||
float2 uv = float2(0.f, 0.f);
|
||||
float3 vCenterColor = SrcTexture2D.SampleLevel(BorderZeroSampler, vCenterTexcoord, 0);
|
||||
float3 vCenterColor = SrcTexture2D.SampleLevel(BorderZeroSampler, vCenterTexcoord, 0).rgb;
|
||||
uv = vCenterTexcoord + vSrcTexelSize * float2(-1.0, -1.0);
|
||||
float3 fLTColor = BilinearFetches(vResolution, SrcTexture2D, uv, BorderZeroSampler);
|
||||
float3 fLTColor = BilinearFetches(vResolution, SrcTexture2D, uv, BorderZeroSampler).rgb;
|
||||
uv = vCenterTexcoord + vSrcTexelSize * float2(0.0, -1.0);
|
||||
float3 fTColor = SrcTexture2D.SampleLevel(BorderZeroSampler, uv, 0);
|
||||
float3 fTColor = SrcTexture2D.SampleLevel(BorderZeroSampler, uv, 0).rgb;
|
||||
uv = vCenterTexcoord + vSrcTexelSize * float2(+1.0, -1.0);
|
||||
float3 fRTColor = BilinearFetches(vResolution, SrcTexture2D, uv, BorderZeroSampler);
|
||||
float3 fRTColor = BilinearFetches(vResolution, SrcTexture2D, uv, BorderZeroSampler).rgb;
|
||||
uv = vCenterTexcoord + vSrcTexelSize * float2(-1.0, 0.0);
|
||||
float3 fLColor = SrcTexture2D.SampleLevel(BorderZeroSampler, uv, 0);
|
||||
float3 fLColor = SrcTexture2D.SampleLevel(BorderZeroSampler, uv, 0).rgb;
|
||||
uv = vCenterTexcoord + vSrcTexelSize * float2(1.0, 0.0);
|
||||
float3 fRColor = SrcTexture2D.SampleLevel(BorderZeroSampler, uv, 0);
|
||||
float3 fRColor = SrcTexture2D.SampleLevel(BorderZeroSampler, uv, 0).rgb;
|
||||
uv = vCenterTexcoord + vSrcTexelSize * float2(-1.0, +1.0);
|
||||
float3 fLBColor = BilinearFetches(vResolution, SrcTexture2D, uv, BorderZeroSampler);
|
||||
float3 fLBColor = BilinearFetches(vResolution, SrcTexture2D, uv, BorderZeroSampler).rgb;
|
||||
uv = vCenterTexcoord + vSrcTexelSize * float2(0.0, 1.0);
|
||||
float3 fBColor = SrcTexture2D.SampleLevel(BorderZeroSampler, uv, 0);
|
||||
float3 fBColor = SrcTexture2D.SampleLevel(BorderZeroSampler, uv, 0).rgb;
|
||||
uv = vCenterTexcoord + vSrcTexelSize * float2(+1.0, +1.0);
|
||||
float3 fRBColor = BilinearFetches(vResolution, SrcTexture2D, uv, BorderZeroSampler);
|
||||
float3 fRBColor = BilinearFetches(vResolution, SrcTexture2D, uv, BorderZeroSampler).rgb;
|
||||
|
||||
return vCenterColor * 0.25f + (fLTColor + fRTColor + fLBColor + fRBColor) * 0.0625f + (fTColor + fLColor + fRColor + fBColor) * 0.125f;
|
||||
}
|
||||
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
struct LocalPos
|
||||
{
|
||||
row_major float4x4 Combined;
|
||||
row_major float4x4 Local;
|
||||
row_major float4x4 LocalCombined;
|
||||
};
|
||||
|
||||
struct BoneCombined
|
||||
{
|
||||
row_major float4x4 BoneCombinedTransformation;
|
||||
};
|
||||
|
||||
StructuredBuffer<BoneCombined> g_CombinedMatIn : register(t0);
|
||||
|
||||
RWStructuredBuffer<LocalPos> g_LocalPosOutput : register(u0);
|
||||
|
||||
cbuffer BoneInsertionCB : register(b0)
|
||||
{
|
||||
uint iStartOffset;
|
||||
uint iMatrixCount;
|
||||
uint iPad0;
|
||||
uint iPad1;
|
||||
};
|
||||
|
||||
[numthreads(256, 1, 1)]
|
||||
void CS_MAIN(uint3 DTid : SV_DispatchThreadID)
|
||||
{
|
||||
uint iBoneIndex = DTid.x;
|
||||
|
||||
if (iBoneIndex >= iMatrixCount)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
float4x4 CombinedMatrix = g_CombinedMatIn[iBoneIndex].BoneCombinedTransformation;
|
||||
|
||||
g_LocalPosOutput[iBoneIndex+iStartOffset].LocalCombined = CombinedMatrix;
|
||||
g_LocalPosOutput[iBoneIndex+iStartOffset].Combined = CombinedMatrix;
|
||||
|
||||
}
|
||||
@@ -25,6 +25,7 @@ StructuredBuffer<Channel> g_PrevChannelBuffer : register(t3);
|
||||
StructuredBuffer<int> g_ParentBuffer : register(t4);
|
||||
StructuredBuffer<BoneLocal> g_BoneLocalBuffer : register(t5);
|
||||
StructuredBuffer<uint> g_BoneRemap : register(t6);
|
||||
StructuredBuffer<int> g_SkipBone : register(t7);
|
||||
|
||||
|
||||
RWStructuredBuffer<float4x4> g_LocalMatrixOut : register(u0);
|
||||
@@ -42,7 +43,17 @@ cbuffer AnimCB : register(b0)
|
||||
float BlendRatio;
|
||||
|
||||
int RootBoneIndex;
|
||||
float3 _pad0;
|
||||
int PlayHeadBone;
|
||||
int HeadBoneIndex;
|
||||
float HeadAimWeight;
|
||||
|
||||
int SkipCount;
|
||||
int _pad0;
|
||||
int _pad1;
|
||||
int _pad2;
|
||||
|
||||
float3 TargetDir_Local;
|
||||
float padding3;
|
||||
|
||||
row_major float4x4 PreTransformMatrix;
|
||||
float4 RootInitRot;
|
||||
@@ -163,6 +174,37 @@ void DecomposeAffine_RowMajor(row_major float4x4 M, out float3 S, out float4 R,
|
||||
|
||||
R = QuatNormalize(q);
|
||||
}
|
||||
row_major float4x4 ApplyHeadAim(uint bone, row_major float4x4 M)
|
||||
{
|
||||
if (PlayHeadBone != 1)
|
||||
return M;
|
||||
if (bone != HeadBoneIndex)
|
||||
return M;
|
||||
if (HeadAimWeight <= 0.f)
|
||||
return M;
|
||||
|
||||
float3 curFwd = normalize(float3(M._31, M._32, M._33));
|
||||
float3 target = normalize(TargetDir_Local);
|
||||
|
||||
float d = dot(curFwd, target);
|
||||
|
||||
float3 axis = cross(curFwd, target);
|
||||
float axisLen = length(axis);
|
||||
if (axisLen <= EPS)
|
||||
return M;
|
||||
|
||||
axis /= axisLen;
|
||||
|
||||
float angle = acos(saturate(d));
|
||||
angle *= saturate(HeadAimWeight);
|
||||
|
||||
float4 qAim = float4(axis * sin(angle * 0.5f), cos(angle * 0.5f));
|
||||
qAim = QuatNormalize(qAim);
|
||||
|
||||
row_major float4x4 AimM = MakeAffine(float3(1, 1, 1), qAim, float3(0, 0, 0));
|
||||
return mul(AimM, M);
|
||||
}
|
||||
|
||||
|
||||
uint FindKeyIndexCur(uint start, uint count, float t)
|
||||
{
|
||||
@@ -274,55 +316,36 @@ void SampleLocalTRS_Prev(uint bone, float t, out float3 S, out float4 R, out flo
|
||||
|
||||
row_major float4x4 SampleBlendedLocal(uint bone)
|
||||
{
|
||||
if (PrevAnimIndex == -1)
|
||||
float3 S;
|
||||
float4 R;
|
||||
float3 T;
|
||||
|
||||
if (PrevAnimIndex == -1 || CurrentAnimIndex == PrevAnimIndex)
|
||||
{
|
||||
float3 S;
|
||||
float4 R;
|
||||
float3 T;
|
||||
SampleLocalTRS_Cur(bone, CurrentTime, S, R, T);
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
T = 0;
|
||||
R = RootInitRot;
|
||||
}
|
||||
return MakeAffine(S, R, T);
|
||||
}
|
||||
|
||||
if (CurrentAnimIndex == PrevAnimIndex)
|
||||
{
|
||||
float3 S;
|
||||
float4 R;
|
||||
float3 T;
|
||||
SampleLocalTRS_Cur(bone, CurrentTime, S, R, T);
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
T = 0;
|
||||
R = RootInitRot;
|
||||
}
|
||||
return MakeAffine(S, R, T);
|
||||
row_major float4x4 M = MakeAffine(S, R, T);
|
||||
return ApplyHeadAim(bone, M);
|
||||
}
|
||||
|
||||
float br = saturate(BlendRatio);
|
||||
|
||||
float3 sA, sB, tA, tB;
|
||||
float4 rA, rB;
|
||||
|
||||
float prevT = PrevTime;
|
||||
|
||||
if (BlendRatio < 1e-4f)
|
||||
{
|
||||
prevT = CurrentTime;
|
||||
}
|
||||
|
||||
|
||||
float prevT = (BlendRatio < 1e-4f) ? CurrentTime : PrevTime;
|
||||
|
||||
SampleLocalTRS_Prev(bone, prevT, 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);
|
||||
S = lerp(sA, sB, br);
|
||||
T = lerp(tA, tB, br);
|
||||
R = QuatSlerp(rA, rB, br);
|
||||
|
||||
if (bone == RootBoneIndex)
|
||||
{
|
||||
@@ -330,15 +353,31 @@ row_major float4x4 SampleBlendedLocal(uint bone)
|
||||
R = RootInitRot;
|
||||
}
|
||||
|
||||
return MakeAffine(S, R, T);
|
||||
row_major float4x4 M = MakeAffine(S, R, T);
|
||||
return ApplyHeadAim(bone, M);
|
||||
}
|
||||
|
||||
|
||||
[numthreads(256, 1, 1)]
|
||||
void CS_LOCAL(uint3 DTid : SV_DispatchThreadID)
|
||||
{
|
||||
uint bone = DTid.x;
|
||||
|
||||
if (bone >= BoneCount)
|
||||
return;
|
||||
|
||||
if (SkipCount != 0)
|
||||
{
|
||||
for (int i = 0; i < SkipCount; i++)
|
||||
{
|
||||
if (bone == g_SkipBone[i])
|
||||
{
|
||||
g_LocalMatrixOut[bone] = g_BoneLocalBuffer[bone].BoneLocal;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
g_LocalMatrixOut[bone] = SampleBlendedLocal(bone);
|
||||
}
|
||||
|
||||
@@ -24,7 +24,17 @@ cbuffer AnimCB : register(b0)
|
||||
float BlendRatio;
|
||||
|
||||
int RootBoneIndex;
|
||||
float3 _pad0;
|
||||
int PlayHeadBone;
|
||||
int HeadBoneIndex;
|
||||
float HeadAimWeight;
|
||||
|
||||
int SkipCount;
|
||||
int _pad0;
|
||||
int _pad1;
|
||||
int _pad2;
|
||||
|
||||
float3 TargetDir_Local;
|
||||
float padding3;
|
||||
|
||||
row_major float4x4 PreTransformMatrix;
|
||||
float4 RootInitRot;
|
||||
|
||||
@@ -28,11 +28,14 @@ cbuffer g_ConstantBuffer : register(b0) // b0 << 이 숫자와 컨스턴트 쉐
|
||||
row_major matrix InvProjMatrix;
|
||||
row_major matrix InvViewMatrix;
|
||||
|
||||
row_major matrix ShadowViewMatrix;
|
||||
row_major matrix ShadowViewProjMatrix;
|
||||
|
||||
float fAsymmetryParameter;
|
||||
float padding0;
|
||||
float padding1;
|
||||
float padding2;
|
||||
}
|
||||
uint iNumLight;
|
||||
float fHeightOffset;
|
||||
float fBaseHeight;
|
||||
};
|
||||
|
||||
float ConvertNdcZToDepth(float ndcZ);
|
||||
float SliceTickness(float ndcZ, uint dimZ);
|
||||
|
||||
@@ -5,16 +5,17 @@ static const float EPSILON = 1e-6f;
|
||||
|
||||
struct LightData
|
||||
{
|
||||
uint itype;
|
||||
float3 vDirection;
|
||||
|
||||
float3 vPosition;
|
||||
float fRange;
|
||||
|
||||
float4 vColor;
|
||||
float3 vDirection;
|
||||
float fRange;
|
||||
float4 vPosition;
|
||||
float4 vDiffuse;
|
||||
};
|
||||
|
||||
//StructuredBuffer<LightData> g_LightBuffer : register(t1);
|
||||
StructuredBuffer<LightData> g_LightBuffer : register(t0);
|
||||
Texture2D<float4> g_ShadowMap : register(t1);
|
||||
Texture2D<float4> NoiseTexture : register(t2);
|
||||
|
||||
SamplerState g_Sampler : register(s0);
|
||||
|
||||
RWTexture3D<float4> g_VolumeUAV : register(u0);
|
||||
|
||||
@@ -39,18 +40,22 @@ cbuffer g_ConstantBuffer : register(b0) // b0 << 이 숫자와 컨스턴트 쉐
|
||||
row_major matrix InvProjMatrix;
|
||||
row_major matrix InvViewMatrix;
|
||||
|
||||
row_major matrix ShadowViewMatrix;
|
||||
row_major matrix ShadowViewProjMatrix;
|
||||
|
||||
float fAsymmetryParameter;
|
||||
float padding0;
|
||||
float padding1;
|
||||
float padding2;
|
||||
}
|
||||
uint iNumLight;
|
||||
float fHeightOffset;
|
||||
float fBaseHeight;
|
||||
};
|
||||
|
||||
float3 ConvertThreadIdToNdc(uint3 id, uint3 dims);
|
||||
float ConvertNdcZToDepth(float ndcZ);
|
||||
float3 ConvertToWorldPosition(float3 ndc, float depth);
|
||||
float3 ConvertThreadIdToWorldPosition(uint3 id, uint3 dims);
|
||||
float HenyeyGreensteinPhaseFunction(float3 vInputDir, float3 vOutputDir, float fAnisotropy);
|
||||
|
||||
float ComputePointLightVisible(float3 vLightDir, float fRange);
|
||||
float ComputeShadowVisibility(float3 vWorldPosition);
|
||||
// 볼륨 텍스쳐 밀도, 산란 계산
|
||||
[numthreads(8, 8, 4)]
|
||||
void CS_MAIN( uint3 DispatchThreadID : SV_DispatchThreadID)
|
||||
@@ -60,18 +65,40 @@ void CS_MAIN( uint3 DispatchThreadID : SV_DispatchThreadID)
|
||||
if (!all(DispatchThreadID < dims))
|
||||
return;
|
||||
|
||||
float3 worldPosition = ConvertThreadIdToWorldPosition(DispatchThreadID, dims);
|
||||
float3 toCamera = normalize(vCameraPosition - worldPosition);
|
||||
float3 vWorldPosition = ConvertThreadIdToWorldPosition(DispatchThreadID, dims);
|
||||
float3 toCamera = normalize(vCameraPosition - vWorldPosition);
|
||||
|
||||
float3 lighting = vLightColor.rgb * vLightColor.a;
|
||||
float3 lightDir = normalize(vLightDirection);
|
||||
float3 toLight = -lightDir;
|
||||
float3 lighting = float3(0.1f, 0.1f, 0.1f); //vLightColor.rgb * vLightColor.a;
|
||||
|
||||
float phase = HenyeyGreensteinPhaseFunction(lightDir, toCamera, fAsymmetryParameter);
|
||||
float3 lightDir = float3(0.f, 0.f, 0.f);
|
||||
|
||||
lighting += vLightColor.rgb * vLightColor.rgb * phase;
|
||||
[loop]
|
||||
for (uint i = 0; i < iNumLight; ++i)
|
||||
{
|
||||
float visibility = 1.f;
|
||||
|
||||
if (0.f < length(g_LightBuffer[i].vDirection))
|
||||
{
|
||||
lightDir = normalize(g_LightBuffer[i].vDirection);
|
||||
visibility = ComputeShadowVisibility(vWorldPosition);
|
||||
|
||||
g_VolumeUAV[DispatchThreadID] = float4(lighting * fLightIntensity * fDensity, fDensity);
|
||||
}
|
||||
else
|
||||
{
|
||||
lightDir = vWorldPosition - g_LightBuffer[i].vPosition.xyz;
|
||||
visibility = ComputePointLightVisible(lightDir, g_LightBuffer[i].fRange);
|
||||
lightDir = normalize(lightDir);
|
||||
}
|
||||
|
||||
float3 toLight = -lightDir;
|
||||
float phase = HenyeyGreensteinPhaseFunction(lightDir, toCamera, fAsymmetryParameter);
|
||||
|
||||
lighting += g_LightBuffer[i].vDiffuse.rgb * g_LightBuffer[i].vDiffuse.a * phase * visibility;
|
||||
}
|
||||
|
||||
float fHeightDensity = max(0.1f, exp(-(vWorldPosition.y - fBaseHeight) * fHeightOffset)) * fDensity;
|
||||
|
||||
g_VolumeUAV[DispatchThreadID] = float4(lighting * fLightIntensity * fHeightDensity, fHeightDensity);
|
||||
}
|
||||
|
||||
float3 ConvertThreadIdToNdc(uint3 id, uint3 dims)
|
||||
@@ -109,3 +136,26 @@ float HenyeyGreensteinPhaseFunction(float3 vInputDir, float3 vOutputDir, float f
|
||||
float denom = pow(1.f + (fAsymmetryParameter * fAsymmetryParameter) - 2.f * fAsymmetryParameter * cosTheta, 3.f / 2.f);
|
||||
return (1.f / (4.f * PI)) * ((1.f - (fAsymmetryParameter * fAsymmetryParameter)) / max(denom, EPSILON));
|
||||
}
|
||||
|
||||
float ComputePointLightVisible(float3 vLightDir, float fRange)
|
||||
{
|
||||
float fDistance = length(vLightDir);
|
||||
|
||||
if (fDistance < fRange)
|
||||
return 1.f;
|
||||
else
|
||||
return 0.f;
|
||||
}
|
||||
|
||||
float ComputeShadowVisibility(float3 vWorldPosition)
|
||||
{
|
||||
float4 vShadowCoord = mul(float4(vWorldPosition, 1.f), ShadowViewProjMatrix);
|
||||
float3 DepthUV = vShadowCoord.xyz / vShadowCoord.w;
|
||||
|
||||
DepthUV.x = DepthUV.x * 0.5f + 0.5f;
|
||||
DepthUV.y = DepthUV.y * -0.5f + 0.5f;
|
||||
|
||||
//float fNoise = NoiseTexture.SampleLevel(g_Sampler, DepthUV.xy, 4).r;
|
||||
|
||||
return 1.f;
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@
|
||||
<PreprocessorDefinitions>ENGINE_EXPORTS;IMGUI_EXPORTS;TINYXML2_EXPORT;EDITOR_PROJECT;$(USERNAME);_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<AdditionalIncludeDirectories>../Public/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>../Public/;../Public/PhysX/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
@@ -151,7 +151,7 @@ call Update_Lib.bat
|
||||
<PreprocessorDefinitions>ENGINE_EXPORTS;IMGUI_EXPORTS;TINYXML2_EXPORT;$(USERNAME);NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<AdditionalIncludeDirectories>../Public/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>../Public/;../Public/PhysX/;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
@@ -208,6 +208,7 @@ call Update_Lib.bat
|
||||
<ClCompile Include="..\Private\ComputeShader.cpp" />
|
||||
<ClCompile Include="..\Private\ContainerObject.cpp" />
|
||||
<ClCompile Include="..\Private\DebugDraw.cpp" />
|
||||
<ClCompile Include="..\Private\Dynamic_D6Joint.cpp" />
|
||||
<ClCompile Include="..\private\Fog.cpp" />
|
||||
<ClCompile Include="..\private\Font.cpp" />
|
||||
<ClCompile Include="..\private\Font_Manager.cpp" />
|
||||
@@ -218,10 +219,6 @@ call Update_Lib.bat
|
||||
<ClCompile Include="..\Private\Renderer_Declare.cpp" />
|
||||
<ClCompile Include="..\Private\RenderEventDebugger.cpp" />
|
||||
<ClCompile Include="..\private\Resource_Manager.cpp" />
|
||||
<ClCompile Include="..\Private\RigidBody_Dynamic_Joint.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\private\ElementObject.cpp" />
|
||||
<ClCompile Include="..\Private\FSM.cpp" />
|
||||
<ClCompile Include="..\Private\GameInstance.cpp">
|
||||
@@ -426,6 +423,7 @@ call Update_Lib.bat
|
||||
<ClInclude Include="..\Public\Bounding_OBB.h" />
|
||||
<ClInclude Include="..\Public\Bounding_Sphere.h" />
|
||||
<ClInclude Include="..\Public\CallBack_QueryFilterCallback.h" />
|
||||
<ClInclude Include="..\Public\Dynamic_D6Joint.h" />
|
||||
<ClInclude Include="..\public\Fog.h" />
|
||||
<ClInclude Include="..\public\Font.h" />
|
||||
<ClInclude Include="..\public\Font_Manager.h" />
|
||||
@@ -436,10 +434,6 @@ call Update_Lib.bat
|
||||
<ClInclude Include="..\public\Quest.h" />
|
||||
<ClInclude Include="..\Public\RenderEventDebugger.h" />
|
||||
<ClInclude Include="..\public\Resource_Manager.h" />
|
||||
<ClInclude Include="..\Public\RigidBody_Dynamic_Joint.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\Camera.h">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
</ExcludedFromBuild>
|
||||
@@ -633,6 +627,10 @@ call Update_Lib.bat
|
||||
<None Include="..\Public\fMod\fmod_errors.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<FxCompile Include="..\Bin\Resources\ShaderFiles\Shader_BoneCombinedInsertion_Compute.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Effect</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">5.0</ShaderModel>
|
||||
</FxCompile>
|
||||
<FxCompile Include="..\Bin\Resources\ShaderFiles\Shader_Distortion.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Effect</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">5.0</ShaderModel>
|
||||
|
||||
@@ -292,9 +292,6 @@
|
||||
<Filter Include="02.Element\02.Component\09.Light">
|
||||
<UniqueIdentifier>{7c82051e-19af-4284-8156-16f504db30b6}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="03.Management\04. Font_Manager">
|
||||
<UniqueIdentifier>{bba1e91b-87a8-4a7b-8e4e-b42d2041d8eb}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="02.Element\01.GameObject\01. Font">
|
||||
<UniqueIdentifier>{7eab7292-025e-40d7-aa71-73e7a3c71ea7}</UniqueIdentifier>
|
||||
</Filter>
|
||||
@@ -316,6 +313,9 @@
|
||||
<Filter Include="01.Utility\08.Volumetric">
|
||||
<UniqueIdentifier>{950977f0-f3c9-42f1-83f1-270b4bebf7ef}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="03.Management\04.Font_Manager">
|
||||
<UniqueIdentifier>{bba1e91b-87a8-4a7b-8e4e-b42d2041d8eb}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Private\Base.cpp">
|
||||
@@ -546,9 +546,6 @@
|
||||
<ClCompile Include="..\private\VIBuffer_Instance.cpp">
|
||||
<Filter>02.Element\02.Component\02.VIBuffer\Instance</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Private\RigidBody_Dynamic_Joint.cpp">
|
||||
<Filter>02.Element\02.Component\07.RigidBody\20.Joint</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Private\Trail.cpp">
|
||||
<Filter>02.Element\02.Component\02.VIBuffer\Trail</Filter>
|
||||
</ClCompile>
|
||||
@@ -577,7 +574,7 @@
|
||||
<Filter>03.Management\02.Resource_Manager</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\private\Font_Manager.cpp">
|
||||
<Filter>03.Management\04. Font_Manager</Filter>
|
||||
<Filter>03.Management\04.Font_Manager</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\private\Font.cpp">
|
||||
<Filter>02.Element\01.GameObject\01. Font</Filter>
|
||||
@@ -603,6 +600,9 @@
|
||||
<ClCompile Include="..\private\Volumetric.cpp">
|
||||
<Filter>01.Utility\08.Volumetric</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Private\Dynamic_D6Joint.cpp">
|
||||
<Filter>02.Element\02.Component\07.RigidBody\20.Joint</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Public\Base.h">
|
||||
@@ -1196,9 +1196,6 @@
|
||||
<ClInclude Include="..\public\VIBuffer_Instance.h">
|
||||
<Filter>02.Element\02.Component\02.VIBuffer\Instance</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\RigidBody_Dynamic_Joint.h">
|
||||
<Filter>02.Element\02.Component\07.RigidBody\20.Joint</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\Trail.h">
|
||||
<Filter>02.Element\02.Component\02.VIBuffer\Trail</Filter>
|
||||
</ClInclude>
|
||||
@@ -1230,7 +1227,7 @@
|
||||
<Filter>03.Management\02.Resource_Manager</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\Font_Manager.h">
|
||||
<Filter>03.Management\04. Font_Manager</Filter>
|
||||
<Filter>03.Management\04.Font_Manager</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\public\Font.h">
|
||||
<Filter>02.Element\01.GameObject\01. Font</Filter>
|
||||
@@ -1256,6 +1253,9 @@
|
||||
<ClInclude Include="..\public\Volumetric.h">
|
||||
<Filter>01.Utility\08.Volumetric</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Public\Dynamic_D6Joint.h">
|
||||
<Filter>02.Element\02.Component\07.RigidBody\20.Joint</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\Public\Assimp\color4.inl">
|
||||
@@ -1356,5 +1356,8 @@
|
||||
<FxCompile Include="..\Bin\Resources\ShaderFiles\Shader_Volumetric_Accumulate.hlsl">
|
||||
<Filter>99.Define\01.SHADER</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="..\Bin\Resources\ShaderFiles\Shader_BoneCombinedInsertion_Compute.hlsl">
|
||||
<Filter>99.Define\01.SHADER</Filter>
|
||||
</FxCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -164,11 +164,7 @@ void CChannel::Update_TransformationMatirx(
|
||||
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)
|
||||
@@ -185,23 +181,6 @@ void CChannel::Update_TransformationMatirx(
|
||||
XMMatrixAffineTransformation(vScale, XMVectorSet(0.f, 0.f, 0.f, 1.f), vRotation, vTranslation);
|
||||
|
||||
Bones[m_iBoneIndex]->Set_TransformationMatrix(m_BoneTransformationMatrix);
|
||||
//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);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include "GameInstance.h"
|
||||
#include "GameObject.h"
|
||||
|
||||
CPhysX_CctQueryFilterCallback CCharacter_Controller::s_QueryFilterCallback_IGNORE_Shield = {};
|
||||
CPhysX_CctQueryFilterCallback CCharacter_Controller::s_QueryFilterCallback_IGNORE_GLOBAL = {};
|
||||
|
||||
CCharacter_Controller::CCharacter_Controller(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: CComponent{ pDevice, pContext }
|
||||
@@ -214,7 +214,7 @@ _bool CCharacter_Controller::UpdateGroundByCast(_float fTimeDelta)
|
||||
|
||||
PSX::PxRigidActor* hitActor = sweepHit.actor;
|
||||
|
||||
PhsXUserData* hitUserData = static_cast<PhsXUserData*>(hitActor->userData);
|
||||
PHYSX_USERDATA* hitUserData = static_cast<PHYSX_USERDATA*>(hitActor->userData);
|
||||
|
||||
switch (PXOBJECT(hitUserData->iSubKind))
|
||||
{
|
||||
@@ -262,7 +262,7 @@ void CCharacter_Controller::Move(_float fTimeDelta)
|
||||
PSX::PxVec3 pxVecMomentum = {}; // 순간 이동량
|
||||
_float fMinimumDistant = FLT_EPSILON3; // 이동량 오차 허용치, ( 크면 클수록 이동이 더 일찍 끝난다, 순간 이동량보다 같거나 더 크면 안움직일듯? )
|
||||
PSX::PxControllerFilters pxFilter = {}; // 충돌 대상 필터
|
||||
pxFilter.mFilterCallback = &s_QueryFilterCallback_IGNORE_Shield; // 쉴드 무시
|
||||
pxFilter.mFilterCallback = &s_QueryFilterCallback_IGNORE_GLOBAL; // 쉴드 무시
|
||||
const PSX::PxObstacleContext* pPxObstacles = { nullptr }; // 캐릭터가 충돌해야할 추가적인 장애물 객체?, 닿은 장애물은 캐시된다?
|
||||
if (true == m_bGravity) {
|
||||
if (0 >= m_iIsOnGround) { // 공중: 무조건 중력
|
||||
@@ -323,7 +323,7 @@ HRESULT CCharacter_Controller::Initialize(void* pArg)
|
||||
m_pTransform = pDesc->pTransform;
|
||||
m_fWalkableSlopeDegree = pDesc->fWalkableSlope;
|
||||
}
|
||||
{ // PhsXUserData
|
||||
{ // PHYSX_USERDATA
|
||||
m_tagData.eKind = PHYSX_KIND::CCTActor;
|
||||
m_tagData.pOwner = m_pOwner;
|
||||
XMStoreFloat4x4(&m_tagData.BeforeMatrix, m_pTransform->Get_XMWorldMatrix());
|
||||
@@ -347,7 +347,6 @@ HRESULT CCharacter_Controller::Initialize(void* pArg)
|
||||
Desc.material = m_pGameInstance->Create_Material(&pDesc->fMaterial);
|
||||
m_pController = m_pGameInstance->Add_BoxController(Desc);
|
||||
m_pController->setUserData(&m_tagData);
|
||||
m_pController->getActor()->userData = &m_tagData;
|
||||
} break;
|
||||
case ACTOR::CAPSULE:
|
||||
{
|
||||
@@ -363,14 +362,16 @@ HRESULT CCharacter_Controller::Initialize(void* pArg)
|
||||
Desc.material = m_pGameInstance->Create_Material(&pDesc->fMaterial);
|
||||
m_pController = m_pGameInstance->Add_CapsuleController(Desc);
|
||||
m_pController->setUserData(&m_tagData);
|
||||
m_pController->getActor()->userData = &m_tagData;
|
||||
} break;
|
||||
default:
|
||||
assert(false); // PhysX에서 불가능
|
||||
return E_FAIL;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
PSX::PxRigidDynamic* pActor = m_pController->getActor();
|
||||
pActor->userData = &m_tagData;
|
||||
m_pGameInstance->ApplyFilterData(pActor);
|
||||
m_pController->setStepOffset(pDesc->fStepOffset);
|
||||
|
||||
if (nullptr == m_pController) {
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
#include "pch.h"
|
||||
#include "Dynamic_D6Joint.h"
|
||||
#include "GameInstance.h"
|
||||
|
||||
CDynamic_D6Joint::CDynamic_D6Joint(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: CComponent(pDevice, pContext)
|
||||
{
|
||||
}
|
||||
|
||||
CDynamic_D6Joint::CDynamic_D6Joint(const CDynamic_D6Joint& rhs)
|
||||
: CComponent(rhs)
|
||||
{
|
||||
}
|
||||
|
||||
HRESULT CDynamic_D6Joint::Initialize_Prototype()
|
||||
{
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CDynamic_D6Joint::Initialize(void* pArg)
|
||||
{
|
||||
DYNAMICJOINT_DESC* pDesc = static_cast<DYNAMICJOINT_DESC*>(pArg);
|
||||
m_pJoint = m_pGameInstance->Create_PxD6Joint(pDesc->pActor0, pDesc->pActor1, *pDesc->pxJointWorldPos);
|
||||
return S_OK;
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
|
||||
HRESULT CDynamic_D6Joint::Add_DebugShape()
|
||||
{
|
||||
if (nullptr != m_pMainShape){
|
||||
m_pMainShape.reset();
|
||||
}
|
||||
m_pMainShape = (GeometricPrimitive::CreateSphere(m_pContext, 0.05f, 10, false, false));
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
HRESULT CDynamic_D6Joint::Render()
|
||||
{
|
||||
//PSX::PxTransform pxTranform = m_pRigidBody->getGlobalPose();
|
||||
//_matrix WorldMatrix = XMMatrixTranslation(m_vLocalTranslation.x, m_vLocalTranslation.y, m_vLocalTranslation.z) * XMMatrixAffineTransformation(XMVectorSet(1.f, 1.f, 1.f, 0.f), XMVectorZero(), XMLoadFloat4((_float4*)&pxTranform.q), XMVectorSetW(XMLoadFloat3((_float3*)&pxTranform.p), 1.f));
|
||||
//_matrix ViewMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW);
|
||||
//_matrix ProjMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ);
|
||||
//_vector vColor = CMyTools::ColorRGB_A_HEXtoVECTOR(0x2fc48000, 1.f);
|
||||
|
||||
//m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
#endif // _DEBUG
|
||||
|
||||
|
||||
CDynamic_D6Joint* CDynamic_D6Joint::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
CDynamic_D6Joint* pInstance = new CDynamic_D6Joint(pDevice, pContext);
|
||||
|
||||
if (FAILED(pInstance->Initialize_Prototype())) {
|
||||
MSG_BOX("CDynamic_D6Joint Prototype Created Failed");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
CComponent* CDynamic_D6Joint::Clone(void* pArg, CGameObject* pOwner)
|
||||
{
|
||||
CDynamic_D6Joint* pInstance = new CDynamic_D6Joint(*this);
|
||||
pInstance->m_pOwner = pOwner;
|
||||
if (FAILED(pInstance->Initialize(pArg))) {
|
||||
MSG_BOX("CDynamic_D6Joint Prototype Created Failed");
|
||||
SAFE_RELEASE(pInstance);
|
||||
}
|
||||
|
||||
return pInstance;
|
||||
}
|
||||
|
||||
void CDynamic_D6Joint::Free()
|
||||
{
|
||||
__super::Free();
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
|
||||
void CDynamic_D6Joint::Describe_Entity()
|
||||
{
|
||||
}
|
||||
|
||||
#endif // _DEBUG
|
||||
@@ -82,7 +82,7 @@ HRESULT CGameInstance::Initialize_Engine(const ENGINE_DESC& EngineDesc, ID3D11De
|
||||
if (nullptr == m_pKey_Manager) {
|
||||
return E_FAIL;
|
||||
}
|
||||
m_pPipeLine = CPipeLine::Create();
|
||||
m_pPipeLine = CPipeLine::Create(*ppDevice, *ppContext);
|
||||
if (nullptr == m_pPipeLine) {
|
||||
return E_FAIL;
|
||||
}
|
||||
@@ -724,6 +724,11 @@ _matrix CGameInstance::Get_Transform_Matrix(D3DTS eState)
|
||||
return m_pPipeLine->Get_Transform_Matrix(eState);
|
||||
}
|
||||
|
||||
_matrix CGameInstance::Get_ShadowTransform_Matrix(D3DTS eState, SHADOW eShadowType)
|
||||
{
|
||||
return m_pPipeLine->Get_ShadowTransform_Matrix(eState, eShadowType);
|
||||
}
|
||||
|
||||
const _float4* CGameInstance::Get_CamPosition()
|
||||
{
|
||||
return m_pPipeLine->Get_CamPosition();
|
||||
@@ -794,6 +799,16 @@ _float CGameInstance::Get_ShadowBoxFar(_uint iShadowBoxIndex)
|
||||
return m_pPipeLine->Get_ShadowBoxFar(iShadowBoxIndex);
|
||||
}
|
||||
|
||||
HRESULT CGameInstance::Begin_OutLine_Write(_uint iDSSRef)
|
||||
{
|
||||
return m_pPipeLine->Begin_OutLine_Write(iDSSRef);
|
||||
}
|
||||
|
||||
HRESULT CGameInstance::End_OutLine_Write()
|
||||
{
|
||||
return m_pPipeLine->End_OutLine_Write();
|
||||
}
|
||||
|
||||
void CGameInstance::Add_Light(_uint _iCurrentLevel, CLight* _pLight)
|
||||
{
|
||||
m_pLight_Manager->Add_Light(_iCurrentLevel, _pLight);
|
||||
@@ -819,6 +834,15 @@ HRESULT CGameInstance::Render_Lights(_uint _iCurrentLevel, CShader* pShader, CVI
|
||||
return m_pLight_Manager->Render_Lights(_iCurrentLevel, pShader, pVIBuffer);
|
||||
}
|
||||
|
||||
list<class CLight*>* CGameInstance::Get_LightList(_uint _iCurrentLevel)
|
||||
{
|
||||
return m_pLight_Manager->Get_LightList(_iCurrentLevel);
|
||||
}
|
||||
|
||||
_uint CGameInstance::Get_NumLight(_uint _iCurrentLevel)
|
||||
{
|
||||
return m_pLight_Manager->Get_NumLight(_iCurrentLevel);
|
||||
}
|
||||
|
||||
HRESULT CGameInstance::Add_ColliderGroup(_uint iColliderGroup, class CCollider* pBounding)
|
||||
{
|
||||
@@ -908,6 +932,11 @@ HRESULT CGameInstance::Clear_RenderTarget(const _wstring& strRenderTargetKey)
|
||||
return m_pRenderTarget_Manager->Clear_RenderTarget(strRenderTargetKey);
|
||||
}
|
||||
|
||||
ID3D11ShaderResourceView* CGameInstance::Get_RenderTarget_SRV(const _wstring& strRenderTargetKey)
|
||||
{
|
||||
return m_pRenderTarget_Manager->Get_RenderTarget_SRV(strRenderTargetKey);
|
||||
}
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CGameInstance::RenderTarget_Debuger()
|
||||
{
|
||||
@@ -1017,9 +1046,13 @@ PSX::PxRigidStatic* CGameInstance::Add_StaticActor(CRigidBody_Static& RigidBody,
|
||||
{
|
||||
return m_pPhysX_Manager->Add_StaticActor(RigidBody, iLevel);
|
||||
}
|
||||
PSX::PxRevoluteJoint* CGameInstance::Create_PxRevoluteJoint(PSX::PxRigidActor* pActorFrame, PSX::PxTransform& pxLocalWallFrame, PSX::PxRigidActor* pActorObject, PSX::PxTransform& pxLocalActorFrame, _uint iLevel)
|
||||
PSX::PxJoint* CGameInstance::Create_PxJoint(PHYSX_JOINT eType, PSX::PxRigidActor* pActor0, PSX::PxTransform& pxLocalFrame0, PSX::PxRigidActor* pActor1, PSX::PxTransform& pxLocalFrame1)
|
||||
{
|
||||
return m_pPhysX_Manager->Create_PxRevoluteJoint(pActorFrame, pxLocalWallFrame, pActorObject, pxLocalActorFrame, iLevel);
|
||||
return m_pPhysX_Manager->Create_PxJoint(eType, pActor0, pxLocalFrame0, pActor1, pxLocalFrame1);
|
||||
}
|
||||
PSX::PxD6Joint* CGameInstance::Create_PxD6Joint(PSX::PxRigidDynamic* pActor0, PSX::PxRigidDynamic* pActor1, const PSX::PxTransform& pxJointWorldPos)
|
||||
{
|
||||
return m_pPhysX_Manager->Create_PxD6Joint(pActor0, pActor1, pxJointWorldPos);
|
||||
}
|
||||
_bool CGameInstance::SphereCast(_float fRadius, _float3 vStartPos, _float3 vDir, _float fDistance, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer)
|
||||
{
|
||||
@@ -1065,6 +1098,10 @@ void CGameInstance::Release_Actor(PSX::PxActor& Actor)
|
||||
{
|
||||
m_pPhysX_Manager->Release_Actor(Actor);
|
||||
}
|
||||
void CGameInstance::ApplyFilterData(PSX::PxRigidActor* pRigidActor)
|
||||
{
|
||||
m_pPhysX_Manager->ApplyFilterData(pRigidActor);
|
||||
}
|
||||
HRESULT CGameInstance::ConvertToTriMeshes(vector<class CMesh*>& Meshes, vector<class PSX::PxTriangleMesh*>& pxTriMeshes, _fmatrix WorldMatrix)
|
||||
{
|
||||
return m_pPhysX_Manager->ConvertToTriMeshes(Meshes, pxTriMeshes, WorldMatrix);
|
||||
@@ -1074,7 +1111,7 @@ HRESULT CGameInstance::SaveTriMeshes(const _char* pPath, vector<PSX::PxTriangleM
|
||||
{
|
||||
return m_pPhysX_Manager->SaveTriMeshes(pPath, TriMeshes);
|
||||
}
|
||||
void CGameInstance::Add_Editor_Plane(PhsXUserData& PlaneData)
|
||||
void CGameInstance::Add_Editor_Plane(PHYSX_USERDATA& PlaneData)
|
||||
{
|
||||
m_pPhysX_Manager->Add_Editor_Plane(PlaneData);
|
||||
}
|
||||
@@ -1316,6 +1353,11 @@ void CGameInstance::Setting_Volumetirc(_float fDensity, _float fLightIntensity,
|
||||
m_pVolumetric->Setting_Volumetirc(fDensity , fLightIntensity , fAsymmetryParameter, fDepthPackExponent);
|
||||
}
|
||||
|
||||
void CGameInstance::Update_Volumetric()
|
||||
{
|
||||
m_pVolumetric->Update();
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
void CGameInstance::Release_Engine()
|
||||
{
|
||||
|
||||
@@ -220,7 +220,14 @@ void CLight::Describe_Entity()
|
||||
|
||||
GUI::Spacing();
|
||||
|
||||
if (m_LightDesc.eType == LIGHT::DIRECTIONAL)
|
||||
{
|
||||
GUI::Text("Direction:");
|
||||
GUI::InputFloat3("##Direction", (_float*)m_LightDesc.pDirection);
|
||||
}
|
||||
m_pOwner->Get_Component<CTransform>()->Describe_Entity();
|
||||
|
||||
|
||||
|
||||
GUI::TreePop();
|
||||
}
|
||||
|
||||
@@ -84,6 +84,14 @@ const LIGHT_DESC* CLight_Manager::Get_Light_Info(_uint _iCurrentLevel, _uint _iL
|
||||
return (*iter)->Get_LightDesc();
|
||||
}
|
||||
|
||||
_uint CLight_Manager::Get_NumLight(_uint _iCurrentLevel)
|
||||
{
|
||||
if(true == m_Lights[_iCurrentLevel].empty())
|
||||
return 0;
|
||||
|
||||
return static_cast<_uint>(m_Lights[_iCurrentLevel].size());
|
||||
}
|
||||
|
||||
|
||||
HRESULT CLight_Manager::Render_Lights(_uint iCurrentLevel, CShader* pShader, CVIBuffer* pVIBuffer)
|
||||
{
|
||||
|
||||
@@ -691,6 +691,8 @@ HRESULT CMaterial::Add_Texture(const _char* pTextureFolderPath, string& FileType
|
||||
return S_OK;
|
||||
else if (!strcmp(FileType.c_str(), "Ground MRO/SRO"))
|
||||
return S_OK;
|
||||
else if (!strcmp(FileType.c_str(), "Corruption Mask"))
|
||||
return S_OK;
|
||||
else if (!strcmp(FileType.c_str(), "Rock_Texture")) {
|
||||
eTexture = aiTextureType::aiTextureType_DIFFUSE;
|
||||
}
|
||||
|
||||
@@ -422,6 +422,7 @@ HRESULT CMesh::Ready_VertexBuffer_For_Anim(const CModel* pModel, SaveMesh* _Save
|
||||
|
||||
HRESULT CMesh::Create_BoneRemapBuffer()
|
||||
{
|
||||
|
||||
D3D11_BUFFER_DESC desc{};
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.ByteWidth = sizeof(_uint) * (_uint)m_BoneRemap.size();
|
||||
|
||||
@@ -95,7 +95,7 @@ HRESULT CModel::Bind_Material(_uint iMeshIndex, CShader* pShader)
|
||||
return m_Materials[iMaterialIndex]->Bind_SRV(pShader, m_eType);
|
||||
}
|
||||
|
||||
HRESULT CModel::Begin(_uint iMeshIndex, CShader* pShader, _bool OutLine)
|
||||
HRESULT CModel::Begin(_uint iMeshIndex, CShader* pShader)
|
||||
{
|
||||
if (iMeshIndex >= m_iNumMeshes) {
|
||||
return E_FAIL;
|
||||
@@ -107,12 +107,7 @@ HRESULT CModel::Begin(_uint iMeshIndex, CShader* pShader, _bool OutLine)
|
||||
return E_FAIL;
|
||||
}
|
||||
HRESULT hr = { E_FAIL };
|
||||
if (false == OutLine) {
|
||||
hr = pShader->Begin(m_Materials[iMaterialIndex]->Get_UsingPass());
|
||||
}
|
||||
else {
|
||||
hr = pShader->Begin(m_Materials[iMaterialIndex]->Get_OutLinePass());
|
||||
}
|
||||
hr = pShader->Begin(m_Materials[iMaterialIndex]->Get_UsingPass());
|
||||
return hr;
|
||||
}
|
||||
|
||||
@@ -177,6 +172,8 @@ _bool CModel::Play_Anim(_float fTimeDelta, CTransform* pTransform)
|
||||
|
||||
ComputeAnimation(m_iCurrentAnimIndex, m_iIndexAnimPlayableMesh);
|
||||
|
||||
Apply_CPU_HeadAim();
|
||||
|
||||
if (m_bIsFinishedAnim)
|
||||
{
|
||||
if (m_bIsLoop)
|
||||
@@ -517,6 +514,47 @@ vector<_float4x4> CModel::Get_OffsetMatrix(_int iIndex)
|
||||
return m_Meshes[iIndex]->Get_OffsetMatrix();
|
||||
}
|
||||
|
||||
void CModel::Apply_CPU_HeadAim()
|
||||
{
|
||||
_int headIdx = m_iBoneIndex[ENUM_CLASS(BLEND_BONE::HEAD)];
|
||||
if (headIdx < 0)
|
||||
return;
|
||||
|
||||
_float4x4 localF = m_Bones[headIdx]->Get_TransformationMatrix();
|
||||
_matrix local = XMLoadFloat4x4(&localF);
|
||||
|
||||
_vector headFwd = XMVector3Normalize(local.r[2]);
|
||||
|
||||
_vector dirWS = XMVector3Normalize(m_vTargetPos - m_pTransform->Get_State(STATE::POSITION));
|
||||
|
||||
_matrix worldInv = m_pTransform->Get_WorldMatrixInv();
|
||||
|
||||
_vector dirLocal = XMVector3Normalize(XMVector3TransformNormal(dirWS, worldInv));
|
||||
|
||||
_float dot = XMVectorGetX(XMVector3Dot(headFwd, dirLocal));
|
||||
dot = clamp(dot, -1.f, 1.f);
|
||||
|
||||
_float angle = acosf(dot) * m_fHeadAimWeight;
|
||||
|
||||
_vector axis = XMVector3Cross(headFwd, dirLocal);
|
||||
if (XMVector3LengthSq(axis).m128_f32[0] < 1e-6f)
|
||||
return;
|
||||
|
||||
axis = XMVector3Normalize(axis);
|
||||
|
||||
_vector qAim = XMQuaternionRotationAxis(axis, angle);
|
||||
|
||||
_matrix aimRot = XMMatrixRotationQuaternion(qAim);
|
||||
_matrix newLocal = aimRot * local;
|
||||
|
||||
m_Bones[headIdx]->Set_TransformationMatrix(newLocal);
|
||||
|
||||
Mark_CPUChain(headIdx);
|
||||
Apply_CPUMask_ToBones();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CModel::Apply_CPUMask_ToBones()
|
||||
{
|
||||
for (size_t i = 0; i < m_Bones.size(); ++i)
|
||||
@@ -551,6 +589,20 @@ const _float4x4* CModel::Get_BoneMatrixPtr(const _char* pBoneName)
|
||||
return m_Bones[boneIdx]->Get_CombinedTransformationMatrixPtr();
|
||||
}
|
||||
|
||||
_matrix CModel::Get_BoneMatrix(const _char* pBoneName)
|
||||
{
|
||||
_int boneIdx = Get_BoneIndex(pBoneName);
|
||||
|
||||
if (boneIdx < 0)
|
||||
return XMMatrixIdentity();
|
||||
|
||||
Mark_CPUChain(boneIdx);
|
||||
|
||||
Apply_CPUMask_ToBones();
|
||||
|
||||
return m_Bones[boneIdx]->Get_CombinedTransformationMatrix();
|
||||
}
|
||||
|
||||
_matrix CModel::Get_BoneMatrix(const _char* pBoneName) const
|
||||
{
|
||||
vector<CBone*>::const_iterator iter = find_if(m_Bones.begin(), m_Bones.end(), [&](CBone* pBone)->_bool
|
||||
@@ -564,6 +616,20 @@ _matrix CModel::Get_BoneMatrix(const _char* pBoneName) const
|
||||
return (*iter)->Get_CombinedTransformationMatrix();
|
||||
}
|
||||
|
||||
const _float4x4* CModel::Get_BoneLocalMatrixPtr(const _char* pBoneName)
|
||||
{
|
||||
_int boneIdx = Get_BoneIndex(pBoneName);
|
||||
|
||||
if (boneIdx < 0)
|
||||
return nullptr;
|
||||
|
||||
Mark_CPUChain(boneIdx);
|
||||
|
||||
Apply_CPUMask_ToBones();
|
||||
|
||||
return m_Bones[boneIdx]->Get_TransformationMatrixPtr();
|
||||
}
|
||||
|
||||
_matrix CModel::Get_BoneLocalMatrix(const _char* pBoneName) const
|
||||
{
|
||||
vector<CBone*>::const_iterator iter = find_if(m_Bones.begin(), m_Bones.end(), [&](CBone* pBone)->_bool
|
||||
@@ -597,6 +663,18 @@ void CModel::Combined_BoneMatrix()
|
||||
}
|
||||
}
|
||||
|
||||
void CModel::Combined_BoneMatrix(_int iStartBoneIndex, _uint iBoneCount)
|
||||
{
|
||||
if (iStartBoneIndex < 0) {
|
||||
return;
|
||||
}
|
||||
_matrix IdenMatrix = XMMatrixIdentity();
|
||||
_uint iEndIndex = (_uint)iStartBoneIndex + iBoneCount;
|
||||
for (_uint i = iStartBoneIndex; i < iEndIndex; ++i) {
|
||||
m_Bones[i]->Update_CombinedTransformationMatrix(m_Bones, IdenMatrix);
|
||||
}
|
||||
}
|
||||
|
||||
_int CModel::Find_BoneIndex(const _char* pBoneName)
|
||||
{
|
||||
if (pBoneName == nullptr)
|
||||
@@ -611,6 +689,16 @@ _int CModel::Find_BoneIndex(const _char* pBoneName)
|
||||
return -1;
|
||||
}
|
||||
|
||||
HRESULT CModel::Set_BoneCombinedTransformation(const _char* pBoneName, _fmatrix newTransformation)
|
||||
{
|
||||
_int iBoneIndex = Find_BoneIndex(pBoneName);
|
||||
if (iBoneIndex < 0) {
|
||||
return E_FAIL;
|
||||
}
|
||||
m_Bones[iBoneIndex]->Set_CombinedTransformationMatrix(newTransformation);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
void CModel::Set_CurrentTrackPosition(_float TrackPosition)
|
||||
{
|
||||
@@ -1341,6 +1429,14 @@ void CModel::InItialize_BoneIndex()
|
||||
{
|
||||
m_iBoneIndex[ENUM_CLASS(BLEND_BONE::NECK)] = i;
|
||||
}
|
||||
if (m_Bones[i]->Compare_Name("head"))
|
||||
{
|
||||
m_iBoneIndex[ENUM_CLASS(BLEND_BONE::HEAD)] = i;
|
||||
}
|
||||
if (m_Bones[i]->Compare_Name("Hips_Cloth"))
|
||||
{
|
||||
m_iBoneIndex[ENUM_CLASS(BLEND_BONE::HIPS_CLOTH)] = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1373,6 +1469,19 @@ void CModel::Initialize_BoneMasks()
|
||||
BuildMask(m_iBoneIndex[ENUM_CLASS(BLEND_BONE::SHOULDER_L)], m_BoneMask[ENUM_CLASS(BLEND_BONE::SHOULDER_L)]);
|
||||
BuildMask(m_iBoneIndex[ENUM_CLASS(BLEND_BONE::SHOULDER_R)], m_BoneMask[ENUM_CLASS(BLEND_BONE::SHOULDER_R)]);
|
||||
BuildMask(m_iBoneIndex[ENUM_CLASS(BLEND_BONE::NECK)], m_BoneMask[ENUM_CLASS(BLEND_BONE::NECK)]);
|
||||
BuildMask(m_iBoneIndex[ENUM_CLASS(BLEND_BONE::HIPS_CLOTH)], m_BoneMask[ENUM_CLASS(BLEND_BONE::HIPS_CLOTH)]);
|
||||
|
||||
if (m_iBoneIndex[ENUM_CLASS(BLEND_BONE::HIPS_CLOTH)] != -1)
|
||||
{
|
||||
for (_uint i = 0; i < (_uint)m_BoneMask[ENUM_CLASS(BLEND_BONE::HIPS_CLOTH)].size(); i++)
|
||||
{
|
||||
if (m_BoneMask[ENUM_CLASS(BLEND_BONE::HIPS_CLOTH)][i] == 1)
|
||||
{
|
||||
m_iSkipBoneCount++;
|
||||
m_SkipBoneindex.push_back(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (_uint i = 0; i < m_Bones.size(); i++)
|
||||
{
|
||||
@@ -1421,9 +1530,10 @@ HRESULT CModel::Create_ComputeShaderLocal()
|
||||
sizeof(CHANNEL_DESC), // 채널
|
||||
sizeof(KEYFRAME_DESC), // 이전애님 키프레임
|
||||
sizeof(CHANNEL_DESC), // 이전애님 채널
|
||||
sizeof(int), // 부모 인덱스
|
||||
sizeof(_int), // 부모 인덱스
|
||||
sizeof(_float4x4), // 로컬좌표
|
||||
sizeof(_uint)
|
||||
sizeof(_uint),
|
||||
sizeof(_int) //스킵본 인덱스
|
||||
};
|
||||
|
||||
_uint CS_OutputStrides[] = {
|
||||
@@ -1433,7 +1543,7 @@ HRESULT CModel::Create_ComputeShaderLocal()
|
||||
CComputeShader::CS_INFO CS_Desc = {};
|
||||
|
||||
CS_Desc.iNumElement = (_uint)m_Bones.size();
|
||||
CS_Desc.iNumInputBuffer = 7;
|
||||
CS_Desc.iNumInputBuffer = 8;
|
||||
CS_Desc.iNumOutputBuffer = 1;
|
||||
|
||||
CS_Desc.iInputStructStride = CS_InputStrides;
|
||||
@@ -1448,6 +1558,34 @@ HRESULT CModel::Create_ComputeShaderLocal()
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CModel::Create_ComputeShaderBoneInsertion()
|
||||
{
|
||||
_uint CS_InputStrides[] = {
|
||||
sizeof(_float4x4)
|
||||
};
|
||||
|
||||
_uint CS_OutputStrides[] = {
|
||||
sizeof(BONE_DESC),
|
||||
};
|
||||
|
||||
CComputeShader::CS_INFO CS_Desc = {};
|
||||
|
||||
CS_Desc.iNumElement = (_uint)m_Bones.size();
|
||||
CS_Desc.iNumInputBuffer = 1;
|
||||
CS_Desc.iNumOutputBuffer = 1;
|
||||
|
||||
CS_Desc.iInputStructStride = CS_InputStrides;
|
||||
CS_Desc.iOutputStructStride = CS_OutputStrides;
|
||||
|
||||
m_pCS_BoneInsertion = (CComputeShader*)m_pGameInstance->Clone_Asset_Prototype(g_iStaticLevel, CS_BONEINSERT, &CS_Desc, nullptr);
|
||||
|
||||
if (nullptr == m_pCS_BoneInsertion) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CModel::Create_Temp()
|
||||
{
|
||||
for (auto& anim : m_Animations)
|
||||
@@ -1493,6 +1631,33 @@ HRESULT CModel::Create_BoneLocalVB()
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CModel::Create_SkipBoneVB()
|
||||
{
|
||||
D3D11_BUFFER_DESC desc{};
|
||||
desc.Usage = D3D11_USAGE_DEFAULT;
|
||||
desc.ByteWidth = sizeof(_int) * (_uint)m_Bones.size();
|
||||
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||
desc.CPUAccessFlags = 0;
|
||||
desc.StructureByteStride = sizeof(_int);
|
||||
desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
|
||||
|
||||
D3D11_SUBRESOURCE_DATA init{};
|
||||
init.pSysMem = m_SkipBoneindex.data();
|
||||
|
||||
m_pDevice->CreateBuffer(&desc, &init, &m_pSkipBoneBuffer);
|
||||
|
||||
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_pSkipBoneBuffer, &srvDesc, &m_pSkipBoneSRV)))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CModel::Create_BoneMatrixVB()
|
||||
{
|
||||
_uint iCount = (_uint)m_Bones.size();
|
||||
@@ -1546,18 +1711,28 @@ HRESULT CModel::Create_BoneMatrixVB()
|
||||
|
||||
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_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;
|
||||
if (FAILED(m_pDevice->CreateBuffer(&cbDesc, nullptr, &m_pConstantBuffer))){
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
{
|
||||
D3D11_BUFFER_DESC cbDesc = {};
|
||||
cbDesc.Usage = D3D11_USAGE_DYNAMIC;
|
||||
cbDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
|
||||
cbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
cbDesc.ByteWidth = sizeof(BONEINSERTION_DESC);
|
||||
|
||||
if (FAILED(m_pDevice->CreateBuffer(&cbDesc, nullptr, &m_pInsertionCB))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
}
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -1685,6 +1860,8 @@ void CModel::ComputeAnimation(_uint AnimIndex,_uint MeshIndex)
|
||||
|
||||
void CModel::ComputeLocal(_uint AnimIndex, _uint MeshIndex)
|
||||
{
|
||||
|
||||
|
||||
D3D11_MAPPED_SUBRESOURCE ConstantSubResource = {};
|
||||
|
||||
auto* anim = m_Animations[AnimIndex];
|
||||
@@ -1697,13 +1874,40 @@ void CModel::ComputeLocal(_uint AnimIndex, _uint MeshIndex)
|
||||
pDesc->Duration = anim->Get_Duration();
|
||||
pDesc->MeshBoneCount = m_Meshes[MeshIndex]->Get_NumBone();
|
||||
pDesc->BoneCount = (_uint)m_Bones.size();
|
||||
|
||||
pDesc->CurrentAnimIndex = m_iCurrentAnimIndex;
|
||||
pDesc->PrevAnimIndex = m_iPreAnimIndex;
|
||||
pDesc->PrevTime = m_Animations[m_iPreAnimIndex]->Get_CurrentTrackPosition();
|
||||
pDesc->BlendRatio = m_fRatio;
|
||||
|
||||
pDesc->RootBoneIndex = m_iRootBoneIndex;
|
||||
pDesc->PlayHeadBone = m_bHeadBone;
|
||||
pDesc->HeadBoneIndex = m_iBoneIndex[ENUM_CLASS(BLEND_BONE::HEAD)];
|
||||
pDesc->HeadAimWeight = m_fHeadAimWeight;
|
||||
|
||||
pDesc->SkipCount = m_iSkipBoneCount;
|
||||
pDesc->padding0 = 0;
|
||||
pDesc->padding1 = 0;
|
||||
pDesc->padding2 = 0;
|
||||
|
||||
if (m_iBoneIndex[ENUM_CLASS(BLEND_BONE::HEAD)] != -1)
|
||||
{
|
||||
_vector dirWS = XMVector3Normalize(m_vTargetPos - m_pTransform->Get_State(STATE::POSITION));
|
||||
|
||||
_matrix worldInv = m_pTransform->Get_WorldMatrixInv();
|
||||
|
||||
_vector dirLocal = XMVector3Normalize(XMVector3TransformNormal(dirWS, worldInv));
|
||||
|
||||
XMStoreFloat3(&pDesc->TargetDir_Local, dirLocal);
|
||||
}
|
||||
else {
|
||||
pDesc->TargetDir_Local = _float3(0.f, 0.f, 0.f);
|
||||
}
|
||||
pDesc->padding3 = 0.f;
|
||||
|
||||
pDesc->PreTransformMatrix = m_PreTransformMatrix;
|
||||
pDesc->RootInitRot = m_vInitialRootRot;
|
||||
|
||||
m_pContext->Unmap(m_pConstantBuffer, 0);
|
||||
}
|
||||
|
||||
@@ -1721,7 +1925,8 @@ void CModel::ComputeLocal(_uint AnimIndex, _uint MeshIndex)
|
||||
m_Animations[m_iPreAnimIndex]->Get_ChannelBuffer(),
|
||||
m_pParentBuffer,
|
||||
m_pBoneLocalBuffer,
|
||||
m_Meshes[MeshIndex]->Get_BoneRemapBuffer()
|
||||
m_Meshes[MeshIndex]->Get_BoneRemapBuffer(),
|
||||
m_pSkipBoneBuffer
|
||||
};
|
||||
|
||||
ID3D11ShaderResourceView* srvs[] =
|
||||
@@ -1732,7 +1937,8 @@ void CModel::ComputeLocal(_uint AnimIndex, _uint MeshIndex)
|
||||
m_Animations[m_iPreAnimIndex]->Get_ChannelSrv(),
|
||||
m_pParentSRV,
|
||||
m_pBoneLocalSRV,
|
||||
m_Meshes[MeshIndex]->Get_BoneRemapSRV()
|
||||
m_Meshes[MeshIndex]->Get_BoneRemapSRV(),
|
||||
m_pSkipBoneSRV
|
||||
};
|
||||
|
||||
ID3D11UnorderedAccessView* uavs[] =
|
||||
@@ -1745,7 +1951,7 @@ void CModel::ComputeLocal(_uint AnimIndex, _uint MeshIndex)
|
||||
0,
|
||||
_float3((_float)iGroupCountX, 1.f, 1.f),
|
||||
srvs,
|
||||
7,
|
||||
8,
|
||||
uavs,
|
||||
1,
|
||||
m_pConstantBuffer
|
||||
@@ -1755,13 +1961,62 @@ void CModel::ComputeLocal(_uint AnimIndex, _uint MeshIndex)
|
||||
UINT counts[1] = { 0 };
|
||||
m_pContext->CSSetUnorderedAccessViews(0, 1, nullUAV, counts);
|
||||
|
||||
ID3D11ShaderResourceView* nullSRV[7] = { nullptr };
|
||||
ID3D11ShaderResourceView* nullSRV[8] = { nullptr };
|
||||
|
||||
m_pContext->CSSetShaderResources(0, 7, nullSRV);
|
||||
m_pContext->CSSetShaderResources(0, 8, nullSRV);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CModel::ComputeInsertionBoneBuffer(BONEINSERTION_DESC& CBDesc, ID3D11ShaderResourceView* pSRV)
|
||||
{
|
||||
if (m_pComputeShader == nullptr){
|
||||
return;
|
||||
}
|
||||
|
||||
D3D11_MAPPED_SUBRESOURCE ConstantSubResource = {};
|
||||
|
||||
if (SUCCEEDED(m_pContext->Map(m_pInsertionCB, 0, D3D11_MAP_WRITE_DISCARD, 0, &ConstantSubResource)))
|
||||
{
|
||||
BONEINSERTION_DESC* pDesc = static_cast<BONEINSERTION_DESC*>(ConstantSubResource.pData);
|
||||
memcpy_s(pDesc, sizeof(BONEINSERTION_DESC), &CBDesc, sizeof(BONEINSERTION_DESC));
|
||||
m_pContext->Unmap(m_pInsertionCB, 0);
|
||||
}
|
||||
|
||||
ID3D11ShaderResourceView* srvs[] =
|
||||
{
|
||||
pSRV,
|
||||
};
|
||||
|
||||
ID3D11UnorderedAccessView* uavs[] =
|
||||
{
|
||||
m_pBoneMatrixUAV
|
||||
};
|
||||
_uint iThreadPerX = 256;
|
||||
_uint iGroupCountX = (CBDesc.iMatrixCount + iThreadPerX - 1) / iThreadPerX;
|
||||
if (iGroupCountX == 0) {
|
||||
iGroupCountX = 1;
|
||||
}
|
||||
|
||||
m_pCS_BoneInsertion->Dispatch_ExternalSRV_UAV(
|
||||
0,
|
||||
0,
|
||||
_float3((_float)iGroupCountX, 1.f, 1.f),
|
||||
srvs,
|
||||
1,
|
||||
uavs,
|
||||
1,
|
||||
m_pInsertionCB
|
||||
);
|
||||
|
||||
ID3D11UnorderedAccessView* nullUAV[1] = { nullptr };
|
||||
UINT counts[1] = { 0 };
|
||||
m_pContext->CSSetUnorderedAccessViews(0, 1, nullUAV, counts);
|
||||
|
||||
ID3D11ShaderResourceView* nullSRV[1] = { nullptr };
|
||||
m_pContext->CSSetShaderResources(0, 1, nullSRV);
|
||||
}
|
||||
|
||||
|
||||
void CModel::Bind_OutPut_SRV_VS(_uint iIndex, _uint iBufferIndex)
|
||||
{
|
||||
@@ -2231,6 +2486,7 @@ HRESULT CModel::Initialize(void* pArg)
|
||||
Create_BoneMatrixVB();
|
||||
Create_ParentVB();
|
||||
Create_BoneLocalVB();
|
||||
Create_SkipBoneVB();
|
||||
Create_ParentSrv();
|
||||
Create_BoneLocalSrv();
|
||||
|
||||
@@ -2242,6 +2498,10 @@ HRESULT CModel::Initialize(void* pArg)
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(Create_ComputeShaderBoneInsertion())){
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_Meshes.size(); i++)
|
||||
{
|
||||
if (1 < m_Meshes[i]->Get_NumBone()) {
|
||||
@@ -2249,10 +2509,10 @@ HRESULT CModel::Initialize(void* pArg)
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (-1 == m_iIndexAnimPlayableMesh) {
|
||||
/* if (-1 == m_iIndexAnimPlayableMesh) {
|
||||
|
||||
assert(false);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
@@ -2362,16 +2622,20 @@ void CModel::Free()
|
||||
|
||||
SAFE_RELEASE(m_pComputeShader);
|
||||
SAFE_RELEASE(m_pCS_AnimLocal);
|
||||
SAFE_RELEASE(m_pCS_BoneInsertion);
|
||||
SAFE_RELEASE(m_pConstantBuffer);
|
||||
SAFE_RELEASE(m_pParentBuffer);
|
||||
SAFE_RELEASE(m_pBoneLocalBuffer);
|
||||
SAFE_RELEASE(m_pBoneMatrixBuffer);
|
||||
SAFE_RELEASE(m_pPrevBoneMatrixBuffer);
|
||||
SAFE_RELEASE(m_pSkipBoneBuffer);
|
||||
SAFE_RELEASE(m_pLocalMatrixBuffer);
|
||||
SAFE_RELEASE(m_pInsertionCB);
|
||||
SAFE_RELEASE(m_pParentSRV);
|
||||
SAFE_RELEASE(m_pBoneLocalSRV);
|
||||
SAFE_RELEASE(m_pBoneMatrixSRV);
|
||||
SAFE_RELEASE(m_pPrevBoneMatrixSRV);
|
||||
SAFE_RELEASE(m_pSkipBoneSRV);
|
||||
SAFE_RELEASE(m_pBoneMatrixUAV);
|
||||
SAFE_RELEASE(m_pLocalMatrixSRV);
|
||||
SAFE_RELEASE(m_pLocalMatrixUAV);
|
||||
|
||||
@@ -19,7 +19,7 @@ CPhysX_Manager::CPhysX_Manager(ID3D11Device* pDevice, ID3D11DeviceContext* pCont
|
||||
PSX::PxRigidDynamic* CPhysX_Manager::Add_DynamicActor(CRigidBody_Dynamic& RigidBody, _uint iLevel)
|
||||
{
|
||||
_matrix WorldMatrix = RigidBody.Get_TransformPtr()->Get_XMWorldMatrix();
|
||||
PSX::PxTransform pxWorldMatrix = XMWorldToPx_NoScale(WorldMatrix);
|
||||
PSX::PxTransform pxWorldMatrix = XMWorldToPx_NoScaleNoFlip(WorldMatrix);
|
||||
|
||||
// PxRigidDynamic 씬의 동적 바디 인터페이스
|
||||
PSX::PxRigidDynamic* pActorDynamic = m_pPhysics->createRigidDynamic(pxWorldMatrix);
|
||||
@@ -36,6 +36,7 @@ PSX::PxRigidDynamic* CPhysX_Manager::Add_DynamicActor(CRigidBody_Dynamic& RigidB
|
||||
case ACTOR::CAPSULE:
|
||||
geoHolder = PSX::PxCapsuleGeometry(vVolume.x, vVolume.y);
|
||||
pShape = PSX::PxRigidActorExt::createExclusiveShape(*pActorDynamic, geoHolder.capsule(), *m_pMaterials[ENUM_CLASS(RigidBody.Get_MaterialType())]);
|
||||
FixCapsuleShapeAxisToY(pShape);
|
||||
break;
|
||||
case ACTOR::SPHERE:
|
||||
geoHolder = PSX::PxSphereGeometry(vVolume.x);
|
||||
@@ -59,6 +60,8 @@ PSX::PxRigidDynamic* CPhysX_Manager::Add_DynamicActor(CRigidBody_Dynamic& RigidB
|
||||
|
||||
PSX::PxRigidBodyExt::updateMassAndInertia(*pActorDynamic, (PSX::PxReal)RigidBody.Get_Density());
|
||||
m_pRestBodies[iLevel].insert(pActorDynamic);
|
||||
pActorDynamic->userData = RigidBody.Get_UserDataPtr();
|
||||
ApplyFilterData(pActorDynamic);
|
||||
Attach_Actor(*pActorDynamic, iLevel);
|
||||
|
||||
return pActorDynamic;
|
||||
@@ -67,11 +70,11 @@ PSX::PxRigidDynamic* CPhysX_Manager::Add_DynamicActor(CRigidBody_Dynamic& RigidB
|
||||
PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody_Static& RigidBody, _uint iLevel)
|
||||
{
|
||||
_matrix WorldMatrix = RigidBody.Get_TransformPtr()->Get_XMWorldMatrix();
|
||||
PSX::PxTransform pxWorldMatrix = XMWorldToPx_NoScale(WorldMatrix);
|
||||
PSX::PxTransform pxWorldMatrix = XMWorldToPx_NoScaleNoFlip(WorldMatrix);
|
||||
|
||||
|
||||
// PxRigidStatic 씬의 정적 바디 인터페이스
|
||||
PSX::PxRigidStatic* pActor = m_pPhysics->createRigidStatic(pxWorldMatrix);
|
||||
PSX::PxRigidStatic* pActorStatic = m_pPhysics->createRigidStatic(pxWorldMatrix);
|
||||
PSX::PxShape* pShape = { nullptr };
|
||||
PSX::PxGeometry* pGeometry = { nullptr };
|
||||
|
||||
@@ -130,24 +133,83 @@ PSX::PxRigidStatic* CPhysX_Manager::Add_StaticActor(CRigidBody_Static& RigidBody
|
||||
break;
|
||||
}
|
||||
|
||||
pShape = PSX::PxRigidActorExt::createExclusiveShape(*pActor, *pGeometry, *m_pMaterials[ENUM_CLASS(RigidBody.Get_MaterialType())]);
|
||||
pShape = PSX::PxRigidActorExt::createExclusiveShape(*pActorStatic, *pGeometry, *m_pMaterials[ENUM_CLASS(RigidBody.Get_MaterialType())]);
|
||||
|
||||
pShape->setFlags(RigidBody.Get_ShapeFlags());
|
||||
pShape->setContactOffset(RigidBody.Get_ContactOffset());
|
||||
pShape->setRestOffset(0.f);
|
||||
|
||||
m_pRestBodies[iLevel].insert(pActor);
|
||||
Attach_Actor(*pActor, iLevel);
|
||||
m_pRestBodies[iLevel].insert(pActorStatic);
|
||||
ApplyFilterData(pActorStatic);
|
||||
Attach_Actor(*pActorStatic, iLevel);
|
||||
|
||||
return pActor;
|
||||
return pActorStatic;
|
||||
}
|
||||
|
||||
PSX::PxRevoluteJoint* CPhysX_Manager::Create_PxRevoluteJoint(PSX::PxRigidActor* pActorFrame, PSX::PxTransform& pxLocalWallFrame, PSX::PxRigidActor* pActorObject, PSX::PxTransform& pxLocalActorFrame, _uint iLevel)
|
||||
PSX::PxJoint* CPhysX_Manager::Create_PxJoint(PHYSX_JOINT eType, PSX::PxRigidActor* pActor0, PSX::PxTransform& pxLocalFrame0, PSX::PxRigidActor* pActor1, PSX::PxTransform& pxLocalFrame1)
|
||||
{
|
||||
PSX::PxRevoluteJoint* pJoint = PSX::PxRevoluteJointCreate(*m_pPhysics, pActorFrame, pxLocalWallFrame, pActorObject, pxLocalActorFrame);
|
||||
PSX::PxJoint* pOut = { nullptr };
|
||||
switch (eType)
|
||||
{
|
||||
case PHYSX_JOINT::D6:
|
||||
{
|
||||
PSX::PxD6Joint* pJoint = PSX::PxD6JointCreate(*m_pPhysics, pActor0, pxLocalFrame0, pActor1, pxLocalFrame1);
|
||||
pOut = pJoint;
|
||||
}
|
||||
break;
|
||||
case PHYSX_JOINT::DISTANCE:
|
||||
{
|
||||
PSX::PxDistanceJoint* pJoint = PSX::PxDistanceJointCreate(*m_pPhysics, pActor0, pxLocalFrame0, pActor1, pxLocalFrame1);
|
||||
pOut = pJoint;
|
||||
}
|
||||
break;
|
||||
case PHYSX_JOINT::REVOLUTE:
|
||||
{
|
||||
PSX::PxRevoluteJoint* pJoint = PSX::PxRevoluteJointCreate(*m_pPhysics, pActor0, pxLocalFrame0, pActor1, pxLocalFrame1);
|
||||
pOut = pJoint;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
assert(nullptr != pOut);
|
||||
|
||||
assert(nullptr != pJoint);
|
||||
return pOut;
|
||||
}
|
||||
|
||||
PSX::PxD6Joint* CPhysX_Manager::Create_PxD6Joint(PSX::PxRigidDynamic* pActor0, PSX::PxRigidDynamic* pActor1, const PSX::PxTransform& pxJointWorldPos)
|
||||
{
|
||||
const PSX::PxTransform pxWorldParentPos = pActor0->getGlobalPose();
|
||||
const PSX::PxTransform pxWorldChildPos = pActor1->getGlobalPose();
|
||||
|
||||
const PSX::PxTransform pxLocalParentPOs = pxWorldParentPos.transformInv(pxJointWorldPos);
|
||||
const PSX::PxTransform pxLocalChildPos = pxWorldChildPos.transformInv(pxJointWorldPos);
|
||||
|
||||
PSX::PxD6Joint* pJoint = PSX::PxD6JointCreate(*m_pPhysics, pActor0, pxLocalParentPOs, pActor1, pxLocalChildPos);
|
||||
|
||||
pActor0->setSolverIterationCounts(8, 2);
|
||||
pActor1->setSolverIterationCounts(8, 2);
|
||||
|
||||
pJoint->setMotion(PSX::PxD6Axis::eX, PSX::PxD6Motion::eLOCKED);
|
||||
pJoint->setMotion(PSX::PxD6Axis::eY, PSX::PxD6Motion::eLOCKED);
|
||||
pJoint->setMotion(PSX::PxD6Axis::eZ, PSX::PxD6Motion::eLOCKED);
|
||||
pJoint->setMotion(PSX::PxD6Axis::eTWIST, PSX::PxD6Motion::eLIMITED);
|
||||
pJoint->setMotion(PSX::PxD6Axis::eSWING1, PSX::PxD6Motion::eLIMITED);
|
||||
pJoint->setMotion(PSX::PxD6Axis::eSWING2, PSX::PxD6Motion::eLIMITED);
|
||||
|
||||
|
||||
pJoint->setTwistLimit(PSX::PxJointAngularLimitPair(-0.35f, 0.35f)); // 20도
|
||||
pJoint->setSwingLimit(PSX::PxJointLimitCone(0.10f, 0.10f)); // 40도
|
||||
|
||||
pJoint->setDrive(PSX::PxD6Drive::eSLERP, PSX::PxD6JointDrive(50.0f, 10.0f, FLT_MAX, true));
|
||||
pJoint->setDrivePosition(PSX::PxTransform(PSX::PxIdentity)); //생성 시 프레임 기준
|
||||
//pJoint->setDrive(PSX::PxD6Drive::eSLERP, PSX::PxD6JointDrive(0.0f, 0.0f, 0.0f, false));
|
||||
|
||||
pJoint->setConstraintFlag(PSX::PxConstraintFlag::eVISUALIZATION, true);
|
||||
pJoint->setConstraintFlag(PSX::PxConstraintFlag::eIMPROVED_SLERP, true);
|
||||
pJoint->setConstraintFlag(PSX::PxConstraintFlag::eCOLLISION_ENABLED, false);
|
||||
|
||||
pJoint->setBreakForce(1e30f, 1e30f);
|
||||
return pJoint;
|
||||
}
|
||||
|
||||
@@ -297,7 +359,7 @@ HRESULT CPhysX_Manager::SaveTriMeshes(const _char* pPath, vector<PSX::PxTriangle
|
||||
assert(ok);
|
||||
return (ok ? S_OK : E_FAIL);
|
||||
}
|
||||
void CPhysX_Manager::Add_Editor_Plane(PhsXUserData& PlaneData)
|
||||
void CPhysX_Manager::Add_Editor_Plane(PHYSX_USERDATA& PlaneData)
|
||||
{
|
||||
PlaneData.eKind = PHYSX_KIND::BODY_STATIC;
|
||||
PlaneData.iSubKind = UINT_MAX;
|
||||
@@ -377,9 +439,13 @@ void CPhysX_Manager::Update_Kinematic()
|
||||
|
||||
if (pActor->getRigidBodyFlags() & PSX::PxRigidBodyFlag::eKINEMATIC)
|
||||
{
|
||||
const CTransform* pTransform = static_cast<PhsXUserData*>(pBody->userData)->pOwner->Get_Component<CTransform>();
|
||||
PHYSX_USERDATA* pUserData = (PHYSX_USERDATA*)pBody->userData;
|
||||
if (false == pUserData->bAutoOwnerTranslation) {
|
||||
continue;
|
||||
}
|
||||
const CTransform* pTransform = pUserData->pOwner->Get_Component<CTransform>();
|
||||
|
||||
pActor->setKinematicTarget(XMWorldToPx_NoScale(pTransform->Get_XMWorldMatrix()));
|
||||
pActor->setKinematicTarget(XMWorldToPx_NoScaleNoFlip(pTransform->Get_XMWorldMatrix()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -414,12 +480,15 @@ void CPhysX_Manager::Update_Dynamic_ActiveActors()
|
||||
PSX::PxActor** ppActiveActors = m_pScene->getActiveActors(iNumActiveActor);
|
||||
|
||||
for (PSX::PxU32 i = 0; i < iNumActiveActor; ++i) {
|
||||
PhsXUserData* pUserData = (PhsXUserData*)ppActiveActors[i]->userData;
|
||||
PHYSX_USERDATA* pUserData = (PHYSX_USERDATA*)ppActiveActors[i]->userData;
|
||||
PSX::PxRigidDynamic* pActorDynamic = ppActiveActors[i]->is<PSX::PxRigidDynamic>();
|
||||
if (nullptr != pActorDynamic) {
|
||||
if (nullptr == ppActiveActors[i]->userData) {
|
||||
continue;
|
||||
}
|
||||
if (false == pUserData->bAutoOwnerTranslation) {
|
||||
continue;
|
||||
}
|
||||
CTransform* pTransform = pUserData->pOwner->Get_Component<CTransform>();
|
||||
|
||||
PSX::PxTransform pPxTransform = pActorDynamic->getGlobalPose();
|
||||
@@ -432,6 +501,107 @@ void CPhysX_Manager::Update_Dynamic_ActiveActors()
|
||||
}
|
||||
}
|
||||
|
||||
void CPhysX_Manager::FixCapsuleShapeAxisToY(PSX::PxShape* pShape)
|
||||
{
|
||||
PSX::PxTransform shapeLocalPose = pShape->getLocalPose();
|
||||
|
||||
// X -> Y : Z축 기준 +90도 회전
|
||||
shapeLocalPose.q = PSX::PxQuat(PSX::PxHalfPi, PSX::PxVec3(0.f, 0.f, 1.f)) * shapeLocalPose.q;
|
||||
|
||||
pShape->setLocalPose(shapeLocalPose);
|
||||
}
|
||||
|
||||
uint32_t CPhysX_Manager::ConvertPhysxKindToBit(const PHYSX_USERDATA& physxUserData)
|
||||
{
|
||||
if (physxUserData.eKind == PHYSX_KIND::BODY_STATIC)
|
||||
return COLLISIONCATERGORY_BIT32::WorldStatic;
|
||||
|
||||
if (physxUserData.eKind == PHYSX_KIND::CCTActor)
|
||||
return COLLISIONCATERGORY_BIT32::CharacterController;
|
||||
|
||||
if (physxUserData.eKind == PHYSX_KIND::BODY_DYNAMIC)
|
||||
{
|
||||
_bool isJointRelatedPart =
|
||||
physxUserData.iSubKind == ENUM_CLASS(PXOBJECT::JOINT_ANCHOR) ||
|
||||
physxUserData.iSubKind == ENUM_CLASS(PXOBJECT::JOINT_ROUTE);
|
||||
|
||||
if (true == isJointRelatedPart)
|
||||
return COLLISIONCATERGORY_BIT32::JointedParts;
|
||||
|
||||
return COLLISIONCATERGORY_BIT32::WorldDynamic;
|
||||
}
|
||||
|
||||
return 0u;
|
||||
}
|
||||
|
||||
uint32_t CPhysX_Manager::BuildCollisionMaskFromCategoryBit(uint32_t iMyBit)
|
||||
{
|
||||
if (iMyBit == COLLISIONCATERGORY_BIT32::CharacterController)
|
||||
{
|
||||
// CCT는 조인트 파츠 충돌x
|
||||
return COLLISIONCATERGORY_BIT32::WorldStatic | COLLISIONCATERGORY_BIT32::WorldDynamic;
|
||||
}
|
||||
|
||||
if (iMyBit == COLLISIONCATERGORY_BIT32::JointedParts)
|
||||
{
|
||||
// 조인트 파츠도 CCT 충돌x
|
||||
return COLLISIONCATERGORY_BIT32::WorldStatic | COLLISIONCATERGORY_BIT32::WorldDynamic;
|
||||
}
|
||||
|
||||
// 기본값
|
||||
return COLLISIONCATERGORY_BIT32::WorldStatic | COLLISIONCATERGORY_BIT32::WorldDynamic | COLLISIONCATERGORY_BIT32::CharacterController | COLLISIONCATERGORY_BIT32::JointedParts;
|
||||
}
|
||||
|
||||
void CPhysX_Manager::ApplyFilterData(PSX::PxRigidActor* pRigidActor)
|
||||
{
|
||||
if (pRigidActor == nullptr){
|
||||
return;
|
||||
}
|
||||
|
||||
PHYSX_USERDATA* physxUserData = reinterpret_cast<PHYSX_USERDATA*>(pRigidActor->userData);
|
||||
if (physxUserData == nullptr){
|
||||
return;
|
||||
}
|
||||
|
||||
const uint32_t CategoryBit = ConvertPhysxKindToBit(*physxUserData); // who am i
|
||||
const uint32_t MaskBits = BuildCollisionMaskFromCategoryBit(CategoryBit); // for what
|
||||
|
||||
PSX::PxFilterData DATAfilter = {};
|
||||
DATAfilter.word0 = CategoryBit; // 나는 누구인가
|
||||
DATAfilter.word1 = MaskBits; // 누구와 부딪힐 것인가
|
||||
|
||||
const PSX::PxU32 shapeCount = pRigidActor->getNbShapes();
|
||||
vector<PSX::PxShape*> shapes(shapeCount);
|
||||
pRigidActor->getShapes(shapes.data(), shapeCount);
|
||||
|
||||
for (PSX::PxShape* shape : shapes)
|
||||
{
|
||||
shape->setSimulationFilterData(DATAfilter);
|
||||
}
|
||||
}
|
||||
|
||||
PSX::PxFilterFlags CPhysX_Manager::SimulationFilterShader(PSX::PxFilterObjectAttributes pxAttributes0, PSX::PxFilterData pxFilterData0, PSX::PxFilterObjectAttributes pxAttributes1, PSX::PxFilterData pxFilterData1, PSX::PxPairFlags& pxPairFlags, const void* pConstantBlock, PSX::PxU32 iConstantBlockSize)
|
||||
{
|
||||
_bool bFilter0_1 = (pxFilterData0.word0 & pxFilterData1.word1) != 0u;
|
||||
_bool bFilter1_0 = (pxFilterData1.word0 & pxFilterData0.word1) != 0u;
|
||||
|
||||
if (!bFilter0_1 || !bFilter1_0)
|
||||
{
|
||||
// Event. 접촉제거
|
||||
return PSX::PxFilterFlag::eSUPPRESS;
|
||||
}
|
||||
|
||||
if (PSX::PxFilterObjectIsTrigger(pxAttributes0) || PSX::PxFilterObjectIsTrigger(pxAttributes1))
|
||||
{
|
||||
// 트리거 처리
|
||||
pxPairFlags = PSX::PxPairFlag::eTRIGGER_DEFAULT;
|
||||
return PSX::PxFilterFlag::eDEFAULT;
|
||||
}
|
||||
|
||||
pxPairFlags = PSX::PxPairFlag::eCONTACT_DEFAULT;
|
||||
return PSX::PxFilterFlag::eDEFAULT;
|
||||
}
|
||||
|
||||
void CPhysX_Manager::ClearScene(_uint iLevel)
|
||||
{
|
||||
for (auto& pBody : m_pActiveBodys[iLevel]) {
|
||||
@@ -585,6 +755,7 @@ HRESULT CPhysX_Manager::Initialize(_uint iLevel)
|
||||
#ifndef _DEBUG
|
||||
m_pPhysics = PxCreatePhysics(PX_PHYSICS_VERSION, *m_pFoundation, m_ToleranceScale, true);
|
||||
#endif // _DEBUG
|
||||
PxInitExtensions(*m_pPhysics, m_pPvd);
|
||||
|
||||
m_pCookingParam = new PSX::PxCookingParams(m_pPhysics->getTolerancesScale());
|
||||
m_pCookingParam->meshPreprocessParams |= PSX::PxMeshPreprocessingFlag::eWELD_VERTICES;
|
||||
@@ -597,9 +768,10 @@ HRESULT CPhysX_Manager::Initialize(_uint iLevel)
|
||||
assert(false);
|
||||
return E_FAIL;
|
||||
}
|
||||
sceneDesc.solverType = PSX::PxSolverType::Enum::eTGS;
|
||||
sceneDesc.cpuDispatcher = m_pDispatcher;
|
||||
//sceneDesc.simulationEventCallback = ; // fetchResults 때 불림. 아래 필터랑, pair랑 같이 짝꿍임. 좀 더 공부해야 쓸 수 있을듯;;
|
||||
sceneDesc.filterShader = PSX::PxDefaultSimulationFilterShader; // 레이어 충돌, 오브젝트에 속성을 주고 복잡한 필터링 충돌 식
|
||||
sceneDesc.filterShader = &SimulationFilterShader;// PSX::PxDefaultSimulationFilterShader; // 레이어 충돌, 오브젝트에 속성을 주고 복잡한 필터링 충돌 식
|
||||
sceneDesc.flags =
|
||||
PSX::PxSceneFlag::eENABLE_PCM // 기본 true, 현대적인 충돌시스템 적용
|
||||
| PSX::PxSceneFlag::eENABLE_ACTIVE_ACTORS // 현재 움직임이 있는 액터만 가져옴
|
||||
@@ -609,7 +781,7 @@ HRESULT CPhysX_Manager::Initialize(_uint iLevel)
|
||||
//| PSX::PxSceneFlag::eDISABLE_CONTACT_REPORT_BUFFER_RESIZE // 접촉 리포트버퍼 리사이즈 금지 -> 보통 끔
|
||||
//| PSX::PxSceneFlag::eDISABLE_CONTACT_CACHE // 접촉 캐시를 금지 -> 그냥 켜두자, 캐시 있는게 보통 더 낫다
|
||||
//| PSX::PxSceneFlag::eREQUIRE_RW_LOCK // 멀티스레딩 환경에서 혹시라도 락 걸고 접근하지 않아 발생할 일을 제거,
|
||||
//| PSX::PxSceneFlag::eENABLE_STABILIZATION // 물체가 얽힌 상황에서 불안정한걸 방지. 추가비용인듯
|
||||
| PSX::PxSceneFlag::eENABLE_STABILIZATION // 물체가 얽힌 상황에서 불안정한걸 방지. 추가비용인듯
|
||||
//| PSX::PxSceneFlag::eENABLE_AVERAGE_POINT // 이해 못하겠음
|
||||
//| PSX::PxSceneFlag::eEnable_GPU_Dynamics // 피직스 그래픽가속 설정. 여기선 세팅 안돼서 비활성화ㅏ
|
||||
//| PSX::PxSceneFlag::eEnable_Direct_GPU_API // 직접 그래픽버퍼를 다루게끔 설정
|
||||
@@ -627,7 +799,14 @@ HRESULT CPhysX_Manager::Initialize(_uint iLevel)
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
// SCENE
|
||||
m_pScene = m_pPhysics->createScene(sceneDesc);
|
||||
#ifdef _DEBUG
|
||||
m_pScene->setVisualizationParameter(PSX::PxVisualizationParameter::Enum::eJOINT_LOCAL_FRAMES, 1.f);
|
||||
m_pScene->setVisualizationParameter(PSX::PxVisualizationParameter::Enum::eJOINT_LIMITS, 1.f);
|
||||
#endif // _DEBUG
|
||||
|
||||
|
||||
|
||||
// CCT
|
||||
m_pCCTManager = PxCreateControllerManager(*m_pScene);
|
||||
@@ -654,7 +833,7 @@ HRESULT CPhysX_Manager::Initialize(_uint iLevel)
|
||||
PlaneData.pOwner = nullptr;
|
||||
PlaneData.pBody = nullptr;
|
||||
|
||||
PSX::PxRigidStatic* pGroundPlane = PxCreatePlane(*m_pPhysics, physx::PxPlane(0, 1, 0, 85), *m_pMaterials[ENUM_CLASS(PXMATERIAL::DEFAULT)]);
|
||||
PSX::PxRigidStatic* pGroundPlane = PxCreatePlane(*m_pPhysics, physx::PxPlane(0, 1, 0, 80), *m_pMaterials[ENUM_CLASS(PXMATERIAL::DEFAULT)]);
|
||||
pGroundPlane->userData = &PlaneData;
|
||||
pGroundPlane->setName("PHYSX_MANAGER_PLANE");
|
||||
m_pScene->addActor(*pGroundPlane);
|
||||
@@ -740,7 +919,7 @@ void CPhysX_Manager::Free()
|
||||
if (nullptr != m_pDispatcher) {
|
||||
m_pDispatcher->release(); m_pDispatcher = nullptr;
|
||||
}
|
||||
|
||||
PxCloseExtensions();
|
||||
if (nullptr != m_pPhysics) {
|
||||
m_pPhysics->release(); m_pPhysics = nullptr;
|
||||
}
|
||||
|
||||
@@ -3,9 +3,13 @@
|
||||
#include "Shader.h"
|
||||
#include "GameInstance.h"
|
||||
|
||||
CPipeLine::CPipeLine()
|
||||
:m_pGameInstance(CGameInstance::GetInstance())
|
||||
CPipeLine::CPipeLine(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
: m_pDevice{ pDevice }
|
||||
, m_pContext{ pContext }
|
||||
, m_pGameInstance{ CGameInstance::GetInstance() }
|
||||
{
|
||||
SAFE_ADDREF(m_pDevice);
|
||||
SAFE_ADDREF(m_pContext);
|
||||
SAFE_ADDREF(m_pGameInstance);
|
||||
}
|
||||
|
||||
@@ -24,6 +28,23 @@ _matrix CPipeLine::Get_Transform_Matrix(D3DTS eState)
|
||||
return XMLoadFloat4x4(&m_TransformStateMatrices[ENUM_CLASS(eState)]);
|
||||
}
|
||||
|
||||
_matrix CPipeLine::Get_ShadowTransform_Matrix(D3DTS eState, SHADOW eShadowType)
|
||||
{
|
||||
_uint iPass = UINT_MAX;
|
||||
if (0 < ((_ubyte)eShadowType & (_ubyte)SHADOW::SHADOW_NEAR)) {
|
||||
iPass = 0;
|
||||
}
|
||||
else if (0 < ((_ubyte)eShadowType & (_ubyte)SHADOW::SHADOW_MIDDLE)) {
|
||||
iPass = 1;
|
||||
}
|
||||
else if (0 < ((_ubyte)eShadowType & (_ubyte)SHADOW::SHADOW_FAR)) {
|
||||
iPass = 2;
|
||||
}
|
||||
assert(iPass != UINT_MAX);
|
||||
|
||||
return XMLoadFloat4x4(&m_ShadowTransformStateMatrices[iPass][ENUM_CLASS(eState)]);
|
||||
}
|
||||
|
||||
const _float4* CPipeLine::Get_CamPosition()
|
||||
{
|
||||
return &m_vCamPosition;
|
||||
@@ -150,6 +171,20 @@ HRESULT CPipeLine::Load_GlobalSRV(const _tchar* wszKeyGlobalSRV, filesystem::pat
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CPipeLine::Begin_OutLine_Write(_uint iDSSRef)
|
||||
{
|
||||
m_pContext->OMGetDepthStencilState(&m_pPrevDSS, &m_iPrevDSSRef);
|
||||
m_pContext->OMSetDepthStencilState(m_pDSS_OutLineWrite, iDSSRef);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CPipeLine::End_OutLine_Write()
|
||||
{
|
||||
m_pContext->OMSetDepthStencilState(m_pPrevDSS, m_iPrevDSSRef);
|
||||
SAFE_RELEASE(m_pPrevDSS);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CPipeLine::Ready_Shadow_Light(const _float4& vShadowDirRPYQuat)
|
||||
{
|
||||
_vector vShadowQuat = XMQuaternionNormalize(XMLoadFloat4(&vShadowDirRPYQuat));
|
||||
@@ -256,6 +291,30 @@ HRESULT CPipeLine::Initialize()
|
||||
XMStoreFloat4x4(&m_TransformStateMatrices[i], XMMatrixIdentity());
|
||||
}
|
||||
|
||||
if (nullptr == m_pDSS_OutLineWrite) {
|
||||
D3D11_DEPTH_STENCIL_DESC depthStencilDescription{};
|
||||
depthStencilDescription.DepthEnable = TRUE;
|
||||
depthStencilDescription.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL; // true에 해당
|
||||
depthStencilDescription.DepthFunc = D3D11_COMPARISON_LESS_EQUAL; // less_equal
|
||||
|
||||
depthStencilDescription.StencilEnable = TRUE;
|
||||
depthStencilDescription.StencilReadMask = 0xFF;
|
||||
depthStencilDescription.StencilWriteMask = 0xFF;
|
||||
|
||||
// FrontFace
|
||||
depthStencilDescription.FrontFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
|
||||
depthStencilDescription.FrontFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP;
|
||||
depthStencilDescription.FrontFace.StencilPassOp = D3D11_STENCIL_OP_REPLACE; // Replace
|
||||
depthStencilDescription.FrontFace.StencilFunc = D3D11_COMPARISON_ALWAYS; // Always
|
||||
|
||||
// BackFace
|
||||
depthStencilDescription.BackFace.StencilFailOp = D3D11_STENCIL_OP_KEEP;
|
||||
depthStencilDescription.BackFace.StencilDepthFailOp = D3D11_STENCIL_OP_KEEP;
|
||||
depthStencilDescription.BackFace.StencilPassOp = D3D11_STENCIL_OP_REPLACE;
|
||||
depthStencilDescription.BackFace.StencilFunc = D3D11_COMPARISON_ALWAYS;
|
||||
m_pDevice->CreateDepthStencilState(&depthStencilDescription, &m_pDSS_OutLineWrite);
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -440,9 +499,9 @@ ID3D11ShaderResourceView* CPipeLine::Find_GlobalShaderResourceView(const _tchar*
|
||||
return (*iter).second;
|
||||
}
|
||||
|
||||
CPipeLine* CPipeLine::Create()
|
||||
CPipeLine* CPipeLine::Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
|
||||
{
|
||||
CPipeLine* pInstance = new CPipeLine();
|
||||
CPipeLine* pInstance = new CPipeLine(pDevice, pContext);
|
||||
|
||||
if (FAILED(pInstance->Initialize()))
|
||||
{
|
||||
@@ -455,6 +514,10 @@ CPipeLine* CPipeLine::Create()
|
||||
void CPipeLine::Free()
|
||||
{
|
||||
__super::Free();
|
||||
SAFE_RELEASE(m_pDevice);
|
||||
SAFE_RELEASE(m_pContext);
|
||||
SAFE_RELEASE(m_pDSS_OutLineWrite);
|
||||
SAFE_RELEASE(m_pGameInstance);
|
||||
for (auto& pairSRV : m_mapGlobalSRV) {
|
||||
SAFE_RELEASE(pairSRV.second);
|
||||
}
|
||||
|
||||
@@ -147,7 +147,6 @@ HRESULT CPrototype_Manager::Ready_EngineAssets()
|
||||
CComputeShader::Create(m_pDevice, m_pContext,
|
||||
L"../Bin/Resources/ShaderFiles/Shader_Instance_Compute.hlsl", "CS_MAIN")))) {
|
||||
return E_FAIL;
|
||||
|
||||
}
|
||||
|
||||
if (FAILED(Add_Asset_Prototype(g_iStaticLevel, CS_MODEL,
|
||||
@@ -161,7 +160,12 @@ HRESULT CPrototype_Manager::Ready_EngineAssets()
|
||||
CComputeShader::Create(m_pDevice, m_pContext,
|
||||
L"../Bin/Resources/ShaderFiles/Shader_Local_Compute.hlsl", "CS_LOCAL")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if (FAILED(Add_Asset_Prototype(g_iStaticLevel, CS_BONEINSERT,
|
||||
CComputeShader::Create(m_pDevice, m_pContext,
|
||||
L"../Bin/Resources/ShaderFiles/Shader_BoneCombinedInsertion_Compute.hlsl", "CS_MAIN")))) {
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
#pragma endregion
|
||||
|
||||
@@ -252,6 +252,16 @@ HRESULT CRenderTarget_Manager::Clear_RenderTarget(const _wstring& strRenderTarge
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
ID3D11ShaderResourceView* CRenderTarget_Manager::Get_RenderTarget_SRV(const _wstring& strRenderTargetKey)
|
||||
{
|
||||
CRenderTarget* pRenderTarget = Find_RenderTarget(strRenderTargetKey);
|
||||
|
||||
if(nullptr == pRenderTarget)
|
||||
return nullptr;
|
||||
|
||||
return pRenderTarget->Get_SRV();
|
||||
}
|
||||
|
||||
|
||||
HRESULT CRenderTarget_Manager::Accumulate_RenderTarget(CVIBuffer_Rect* pVIBuffer, CShader* pShader,
|
||||
const _wstring& wstrRenderTarget_SrcA, const _wstring& wstrRenderTarget_SrcB,
|
||||
|
||||
@@ -21,28 +21,34 @@ CRigidBody_Dynamic::CRigidBody_Dynamic(const CRigidBody_Dynamic& rhs) :
|
||||
#ifdef _DEBUG
|
||||
HRESULT CRigidBody_Dynamic::Render()
|
||||
{
|
||||
_matrix WorldMatrix = XMMatrixTranslation(m_vLocalTranslation.x, m_vLocalTranslation.y, m_vLocalTranslation.z) * m_pTransform->Get_XMWorldMatrix();
|
||||
return Render(nullptr);
|
||||
}
|
||||
HRESULT CRigidBody_Dynamic::Render(function<void()> custumState)
|
||||
{
|
||||
PSX::PxTransform pxTranform = m_pRigidBody->getGlobalPose();
|
||||
_matrix WorldMatrix = XMMatrixTranslation(m_vLocalTranslation.x, m_vLocalTranslation.y, m_vLocalTranslation.z)
|
||||
* XMMatrixAffineTransformation(XMVectorSet(1.f, 1.f, 1.f, 0.f), XMVectorZero(), XMLoadFloat4((_float4*)&pxTranform.q), XMVectorSetW(XMLoadFloat3((_float3*)&pxTranform.p), 1.f));
|
||||
_matrix ViewMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW);
|
||||
_matrix ProjMatrix = m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ);
|
||||
_vector vColor = CMyTools::ColorRGB_A_HEXtoVECTOR(0x2fc48000, 1.f);
|
||||
|
||||
switch (m_eActorType)
|
||||
{
|
||||
case ACTOR::BOX:
|
||||
{
|
||||
m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true);
|
||||
m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true, custumState);
|
||||
} break;
|
||||
case ACTOR::CAPSULE:
|
||||
{
|
||||
m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true);
|
||||
_matrix WorldUp = XMMatrixTranslationFromVector(m_pTransform->Get_State(STATE::UP) * m_vhalfGeometryInfo.y);
|
||||
_matrix WorldDown = XMMatrixTranslationFromVector(m_pTransform->Get_State(STATE::UP) * -m_vhalfGeometryInfo.y);
|
||||
m_pSubShape->Draw(WorldUp * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true);
|
||||
m_pSubShape->Draw(WorldDown * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true);
|
||||
WorldMatrix = XMMatrixAffineTransformation(XMVectorSet(1.f, 1.f, 1.f, 0.f), XMVectorZero(), XMQuaternionMultiply(XMQuaternionRotationAxis(XMVectorSet(0.f, 1.f, 0.f, 0.f), XMConvertToRadians(90.f)), XMLoadFloat4((_float4*)&pxTranform.q)), XMVectorSetW(XMLoadFloat3((_float3*)&pxTranform.p), 1.f));
|
||||
m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true, custumState);
|
||||
_matrix WorldUp = XMMatrixTranslationFromVector(WorldMatrix.r[1] * m_vhalfGeometryInfo.y);
|
||||
_matrix WorldDown = XMMatrixTranslationFromVector(WorldMatrix.r[1] * -m_vhalfGeometryInfo.y);
|
||||
m_pSubShape->Draw(WorldUp * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true, custumState);
|
||||
m_pSubShape->Draw(WorldDown * WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true, custumState);
|
||||
} break;
|
||||
case ACTOR::SPHERE:
|
||||
{
|
||||
m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true);
|
||||
m_pMainShape->Draw(WorldMatrix, ViewMatrix, ProjMatrix, vColor, nullptr, true, custumState);
|
||||
} break;
|
||||
default:
|
||||
break;
|
||||
@@ -50,6 +56,10 @@ HRESULT CRigidBody_Dynamic::Render()
|
||||
return S_OK;
|
||||
}
|
||||
#endif
|
||||
void CRigidBody_Dynamic::Set_Name(const _char* szName)
|
||||
{
|
||||
m_pRigidBody->setName(szName);
|
||||
}
|
||||
void CRigidBody_Dynamic::Set_HalfGeometryInfo(_float3 vhalfGeometryInfo)
|
||||
{
|
||||
m_vhalfGeometryInfo = vhalfGeometryInfo;
|
||||
@@ -101,17 +111,26 @@ void CRigidBody_Dynamic::Set_HalfGeometryInfo(_float3 vhalfGeometryInfo)
|
||||
Add_DebugShape();
|
||||
#endif // _DEBUG
|
||||
}
|
||||
void CRigidBody_Dynamic::Move_LocalPos(_float4 vNewRotQ, _float3 vNewTranslation)
|
||||
void CRigidBody_Dynamic::Move_LocalPos(_matrix newLocalPos)
|
||||
{
|
||||
m_vLocalRotQ = vNewRotQ;
|
||||
m_vLocalTranslation = vNewTranslation;
|
||||
_vector vScale, vPos, vRotQ;
|
||||
XMMatrixDecompose(&vScale, &vRotQ, &vPos, newLocalPos);
|
||||
Move_LocalPos(vPos, vRotQ);
|
||||
}
|
||||
void CRigidBody_Dynamic::Move_LocalPos(_float4& vNewRotQ, _float3& vNewTranslation)
|
||||
{
|
||||
Move_LocalPos(XMLoadFloat4(&vNewRotQ), XMLoadFloat3(&vNewTranslation));
|
||||
}
|
||||
void CRigidBody_Dynamic::Move_LocalPos(_fvector vNewRotQ, _gvector vNewTranslation)
|
||||
{
|
||||
XMStoreFloat4(&m_vLocalRotQ, vNewRotQ);
|
||||
XMStoreFloat3(&m_vLocalTranslation, vNewTranslation);
|
||||
PSX::PxShape* pShape = { nullptr };
|
||||
m_pRigidBody->getShapes(&pShape, m_pRigidBody->getNbShapes());
|
||||
pShape->setLocalPose(PSX::PxTransform(vNewTranslation.x, vNewTranslation.y, vNewTranslation.z, PSX::PxQuat(vNewRotQ.x, vNewRotQ.y, vNewRotQ.z, vNewRotQ.w)));
|
||||
pShape->setLocalPose(PSX::PxTransform(m_vLocalTranslation.x, m_vLocalTranslation.y, m_vLocalTranslation.z, PSX::PxQuat(m_vLocalRotQ.x, m_vLocalRotQ.y, m_vLocalRotQ.z, m_vLocalRotQ.w)));
|
||||
#ifdef _DEBUG
|
||||
Add_DebugShape();
|
||||
#endif // _DEBUG
|
||||
|
||||
}
|
||||
_float CRigidBody_Dynamic::Get_Mass()
|
||||
{
|
||||
@@ -137,6 +156,31 @@ void CRigidBody_Dynamic::Set_Kinematic(_bool bKinematic)
|
||||
m_pRigidBody->setRigidBodyFlag(PSX::PxRigidBodyFlag::eKINEMATIC, bKinematic);
|
||||
}
|
||||
|
||||
void CRigidBody_Dynamic::Move_Kinematic(_fmatrix xmTransform, _bool bTeleport)
|
||||
{
|
||||
_vector vScale, vPos, vRotQ;
|
||||
XMMatrixDecompose(&vScale, &vRotQ, &vPos, xmTransform);
|
||||
Move_Kinematic(vPos, vRotQ, bTeleport);
|
||||
}
|
||||
|
||||
void CRigidBody_Dynamic::Move_Kinematic(_fvector vPos, _gvector vRotq, _bool bTeleport)
|
||||
{
|
||||
PSX::PxTransform pxTransform = {};
|
||||
XMStoreFloat3((_float3*)&pxTransform.p, vPos);
|
||||
XMStoreFloat4((_float4*)&pxTransform.q, vRotq);
|
||||
Move_Kinematic(pxTransform, bTeleport);
|
||||
}
|
||||
|
||||
void CRigidBody_Dynamic::Move_Kinematic(PSX::PxTransform& pxDestination, _bool bTeleport)
|
||||
{
|
||||
if (true == bTeleport) {
|
||||
Set_Transform(pxDestination, bTeleport);
|
||||
}
|
||||
else {
|
||||
m_pRigidBody->setKinematicTarget(pxDestination);
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CRigidBody_Dynamic::ConvertToCCT(CCharacter_Controller& CCTOriginal)
|
||||
{
|
||||
m_pTransform->Set_WorldMatrix(m_pRigidBody->getGlobalPose());
|
||||
@@ -164,26 +208,33 @@ _vector CRigidBody_Dynamic::Get_Position()
|
||||
return vPos;
|
||||
}
|
||||
|
||||
void CRigidBody_Dynamic::Set_Position(_vector vPos)
|
||||
void CRigidBody_Dynamic::Set_Position(_vector vPos, _bool bTeleport)
|
||||
{
|
||||
PSX::PxTransform pxTransform = m_pRigidBody->getGlobalPose();
|
||||
pxTransform.p.x = vPos.m128_f32[0];
|
||||
pxTransform.p.y = vPos.m128_f32[1];
|
||||
pxTransform.p.z = vPos.m128_f32[2];
|
||||
Set_Transform(pxTransform);
|
||||
Set_Transform(pxTransform, bTeleport);
|
||||
}
|
||||
|
||||
void CRigidBody_Dynamic::Set_Rotation(_vector vRotQ)
|
||||
void CRigidBody_Dynamic::Set_Rotation(_vector vRotQ, _bool bTeleport)
|
||||
{
|
||||
PSX::PxTransform pxTransform = m_pRigidBody->getGlobalPose();
|
||||
pxTransform.q.x = vRotQ.m128_f32[0];
|
||||
pxTransform.q.y = vRotQ.m128_f32[1];
|
||||
pxTransform.q.z = vRotQ.m128_f32[2];
|
||||
pxTransform.q.w = vRotQ.m128_f32[3];
|
||||
Set_Transform(pxTransform);
|
||||
Set_Transform(pxTransform, bTeleport);
|
||||
}
|
||||
|
||||
void CRigidBody_Dynamic::Set_Transform(_vector vPos, _vector vRotQ)
|
||||
void CRigidBody_Dynamic::Set_Transform(_matrix WorldMatrix, _bool bTeleport)
|
||||
{
|
||||
_vector vScale, vPos, vRotQ;
|
||||
XMMatrixDecompose(&vScale, &vRotQ, &vPos, WorldMatrix);
|
||||
Set_Transform(vPos, vRotQ, bTeleport);
|
||||
}
|
||||
|
||||
void CRigidBody_Dynamic::Set_Transform(_vector vPos, _vector vRotQ, _bool bTeleport)
|
||||
{
|
||||
PSX::PxTransform pxTransform = m_pRigidBody->getGlobalPose();
|
||||
pxTransform.p.x = vPos.m128_f32[0];
|
||||
@@ -194,12 +245,42 @@ void CRigidBody_Dynamic::Set_Transform(_vector vPos, _vector vRotQ)
|
||||
pxTransform.q.y = vRotQ.m128_f32[1];
|
||||
pxTransform.q.z = vRotQ.m128_f32[2];
|
||||
pxTransform.q.w = vRotQ.m128_f32[3];
|
||||
Set_Transform(pxTransform);
|
||||
Set_Transform(pxTransform, bTeleport);
|
||||
}
|
||||
|
||||
void CRigidBody_Dynamic::Set_Transform(PSX::PxTransform pxTransform)
|
||||
void CRigidBody_Dynamic::Set_CenterTransform(_vector vStart, _vector vEnd, _bool bTeleport)
|
||||
{
|
||||
m_pRigidBody->setGlobalPose(pxTransform);
|
||||
_vector vCenterWorldPos = (vStart + vEnd) * 0.5f;
|
||||
_vector vRotQ = XMQuaternionIdentity();
|
||||
_vector vDir = XMVectorSetW(vEnd - vStart, 0.f);
|
||||
_float vLength = XMVectorGetX(XMVector3Length(vDir));
|
||||
if (vLength > FLT_EPSILON5) {
|
||||
vDir = XMVector3Normalize(vDir);
|
||||
vRotQ = CMyTools::MakeQuaternionFromTo(XMVectorSet(0.f, 1.f, 0.f, 0.f), vDir);
|
||||
}
|
||||
if (true == bTeleport) {
|
||||
Set_Transform(vCenterWorldPos, vRotQ, bTeleport);
|
||||
}
|
||||
else {
|
||||
if (m_pRigidBody->getRigidBodyFlags() & PSX::PxRigidBodyFlag::eKINEMATIC) {
|
||||
Move_Kinematic(vCenterWorldPos, vRotQ);
|
||||
}
|
||||
else {
|
||||
Set_Transform(vCenterWorldPos, vRotQ, bTeleport);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CRigidBody_Dynamic::Set_Transform(PSX::PxTransform pxTransform, _bool bTeleport)
|
||||
{
|
||||
m_pRigidBody->setGlobalPose(pxTransform, true);
|
||||
|
||||
if (true == bTeleport) {
|
||||
m_pRigidBody->setLinearVelocity(PSX::PxVec3(0.f, 0.f, 0.f));
|
||||
m_pRigidBody->setAngularVelocity(PSX::PxVec3(0.f, 0.f, 0.f));
|
||||
m_pRigidBody->clearForce();
|
||||
m_pRigidBody->clearTorque();
|
||||
}
|
||||
}
|
||||
|
||||
_float3 CRigidBody_Dynamic::Get_FootPosition()
|
||||
@@ -244,6 +325,19 @@ _float3 CRigidBody_Dynamic::Get_HeadPosition()
|
||||
return vOut;
|
||||
}
|
||||
|
||||
PSX::PxTransform CRigidBody_Dynamic::Get_GlobalPosition()
|
||||
{
|
||||
return m_pRigidBody->getGlobalPose();
|
||||
}
|
||||
|
||||
PSX::PxTransform CRigidBody_Dynamic::Get_HeadPositionPxTransform()
|
||||
{
|
||||
PSX::PxTransform pxTransform = m_pRigidBody->getGlobalPose();
|
||||
_float3 vFootPos = Get_HeadPosition();
|
||||
pxTransform.p = { vFootPos.x, vFootPos.y, vFootPos.z };
|
||||
return pxTransform;
|
||||
}
|
||||
|
||||
PSX::PxTransform CRigidBody_Dynamic::Get_FootPositionPxTransform()
|
||||
{
|
||||
PSX::PxTransform pxTransform = m_pRigidBody->getGlobalPose();
|
||||
@@ -283,22 +377,42 @@ HRESULT CRigidBody_Dynamic::Initialize(void* pArg)
|
||||
return E_FAIL;
|
||||
}
|
||||
#endif // _DEBUG
|
||||
RIGIDBODY_DYNAMIC_DESC* pDesc = static_cast<RIGIDBODY_DYNAMIC_DESC*>(pArg);
|
||||
m_tagData.pOwner = m_pOwner;
|
||||
XMStoreFloat4x4(&m_tagData.BeforeMatrix, m_pTransform->Get_XMWorldMatrix());
|
||||
m_tagData.pBody = this;
|
||||
m_tagData.bAutoOwnerTranslation = pDesc->bAutoOwnerTranslation;
|
||||
m_pRigidBody = m_pGameInstance->Add_DynamicActor(*this, m_pGameInstance->Get_NextLevelID());
|
||||
m_pRigidBody->userData = &m_tagData;
|
||||
m_pRigidBody->setCMassLocalPose(m_PxMassCenter);
|
||||
m_pRigidBody->setRigidDynamicLockFlags(m_eLockFlag);
|
||||
m_pRigidBody->setLinearDamping(m_vDamping.x);
|
||||
m_pRigidBody->setAngularDamping(m_vDamping.y);
|
||||
Move_LocalPos(m_vLocalRotQ, m_vLocalTranslation);
|
||||
//m_pRigidBody->joint;
|
||||
//PSX::PxRevol
|
||||
if (ACTOR::CAPSULE != m_eActorType) {
|
||||
Move_LocalPos(m_vLocalRotQ, m_vLocalTranslation);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
//void CRigidBody_Dynamic::Move(PSX::PxTransform& pxTransform, _bool bTeleport)
|
||||
//{
|
||||
// if (m_pRigidBody->getRigidBodyFlags().isSet(PSX::PxRigidBodyFlag::eKINEMATIC)) {
|
||||
// m_pRigidBody->setKinematicTarget(pxTransform);
|
||||
// }
|
||||
// else {
|
||||
// m_pRigidBody->setGlobalPose(pxTransform, true);
|
||||
//
|
||||
// if (true == bTeleport) {
|
||||
// m_pRigidBody->setLinearVelocity(PSX::PxVec3(0.f, 0.f, 0.f));
|
||||
// m_pRigidBody->setAngularVelocity(PSX::PxVec3(0.f, 0.f, 0.f));
|
||||
// m_pRigidBody->clearForce();
|
||||
// m_pRigidBody->clearTorque();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
#ifdef _DEBUG
|
||||
HRESULT CRigidBody_Dynamic::Add_DebugShape()
|
||||
{
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
#include "pch.h"
|
||||
@@ -27,18 +27,71 @@ HRESULT CVolumetric::Initialize()
|
||||
if(FAILED(CreateResourceViews()))
|
||||
return E_FAIL;
|
||||
|
||||
if(FAILED(Create_SamplerState()))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
void CVolumetric::Update()
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CVolumetric::Cumpute_Volume()
|
||||
{
|
||||
EVENTSCOPE_("Render_Cumpute_Volume");
|
||||
|
||||
XMStoreFloat4x4(&m_ShadowViewMatrix,
|
||||
m_pGameInstance->Get_ShadowTransform_Matrix(D3DTS::VIEW, SHADOW::SHADOW_MIDDLE));
|
||||
XMStoreFloat4x4(&m_ShadowViewProjMatrix,
|
||||
m_pGameInstance->Get_ShadowTransform_Matrix(D3DTS::VIEW, SHADOW::SHADOW_MIDDLE) *
|
||||
m_pGameInstance->Get_ShadowTransform_Matrix(D3DTS::PROJ, SHADOW::SHADOW_MIDDLE)
|
||||
);
|
||||
|
||||
/* Light Buffer Update */
|
||||
D3D11_MAPPED_SUBRESOURCE LightSubResource = {};
|
||||
if (FAILED(m_pContext->Map(m_pLightInfoBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &LightSubResource)))
|
||||
{
|
||||
MSG_BOX("Failed to Map : CVolumetric");
|
||||
}
|
||||
else
|
||||
{
|
||||
_uint iCurentLevel = m_pGameInstance->Get_CurrentLevelID();
|
||||
|
||||
m_iNumLights = min(m_iMaxNumLights, m_pGameInstance->Get_NumLight(iCurentLevel));
|
||||
|
||||
if (0 != m_iNumLights)
|
||||
{
|
||||
|
||||
CS_LIGHT_DESC* pDesc = static_cast<CS_LIGHT_DESC*>(LightSubResource.pData);
|
||||
list<class CLight*>* Lights = m_pGameInstance->Get_LightList(iCurentLevel);
|
||||
|
||||
_uint iIndex = 0;
|
||||
for (auto& Light : *Lights)
|
||||
{
|
||||
const LIGHT_DESC* pLihgtDesc = Light->Get_LightDesc();
|
||||
memcpy(&pDesc[iIndex].vDiffuse, &pLihgtDesc->vDiffuse, sizeof(_float4));
|
||||
if(LIGHT::DIRECTIONAL != pLihgtDesc->eType)
|
||||
{
|
||||
memcpy(&pDesc[iIndex].vPosition, pLihgtDesc->pPosition, sizeof(_float3));
|
||||
ZeroMemory(&pDesc[iIndex].vDirection, sizeof(_float3));
|
||||
}
|
||||
else
|
||||
memcpy(&pDesc[iIndex].vDirection , pLihgtDesc->pDirection, sizeof(_float4));
|
||||
|
||||
pDesc[iIndex].fRange = pLihgtDesc->fRange;
|
||||
++iIndex;
|
||||
if (m_iMaxNumLights <= iIndex)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_pContext->Unmap(m_pLightInfoBuffer, 0);
|
||||
}
|
||||
|
||||
|
||||
/* Constannt Buffer Update */
|
||||
D3D11_MAPPED_SUBRESOURCE ConstantSubResource = {};
|
||||
|
||||
if (FAILED(m_pContext->Map(m_pConstantBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &ConstantSubResource)))
|
||||
@@ -74,10 +127,13 @@ void CVolumetric::Cumpute_Volume()
|
||||
XMStoreFloat4x4(&pDesc->InvProjMatrix, m_pGameInstance->Get_Transform_Matrix(D3DTS::PROJ_INV));
|
||||
XMStoreFloat4x4(&pDesc->InvViewMatrix, m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW_INV));
|
||||
|
||||
XMStoreFloat4x4(&pDesc->ShadowViewMatrix, XMLoadFloat4x4(&m_ShadowViewMatrix));
|
||||
XMStoreFloat4x4(&pDesc->ShadowViewProjMatrix, XMLoadFloat4x4(&m_ShadowViewProjMatrix));
|
||||
|
||||
pDesc->fAsymmetryParameter = m_fAsymmetryParameter;
|
||||
pDesc->padding0 = 0.f;
|
||||
pDesc->padding1 = 0.f;
|
||||
pDesc->padding2 = 0.f;
|
||||
pDesc->iNumLight = m_iNumLights;
|
||||
pDesc->fHeightOffset = m_fHieghtOffset;
|
||||
pDesc->fBaseHeight = m_fBaseHeight;
|
||||
|
||||
m_pContext->Unmap(m_pConstantBuffer, 0);
|
||||
}
|
||||
@@ -88,6 +144,15 @@ void CVolumetric::Cumpute_Volume()
|
||||
|
||||
//SRV, UAV 바인딩
|
||||
m_pContext->CSSetUnorderedAccessViews(0, 1, &m_pVolumeUAV, nullptr);
|
||||
m_pContext->CSSetShaderResources(0, 1, &m_pLightInfoSRV);
|
||||
|
||||
// Sampler 바인딩
|
||||
m_pContext->CSSetSamplers(0, 1, &m_pSamplerState);
|
||||
|
||||
// 쉐도우 맵 바인딩
|
||||
ID3D11ShaderResourceView* ShadowSRV[1] = { m_pGameInstance->Get_RenderTarget_SRV(TEXT("Target_Shadow_Middle")) };
|
||||
m_pContext->CSSetShaderResources(1, 1, ShadowSRV);
|
||||
m_pContext->CSSetShaderResources(2, 1, &m_pNoiseTexture);
|
||||
|
||||
//컴퓨트 쉐이더 실행
|
||||
XMUINT3 vGroupCount = { (160 + 7) / 8, (90 + 7) / 8, (128 + 3) / 4 };
|
||||
@@ -169,6 +234,9 @@ void CVolumetric::Free()
|
||||
|
||||
SAFE_RELEASE(m_pConstantBuffer);
|
||||
SAFE_RELEASE(m_pLightInfoBuffer);
|
||||
SAFE_RELEASE(m_pLightInfoSRV);
|
||||
SAFE_RELEASE(m_pSamplerState);
|
||||
SAFE_RELEASE(m_pNoiseTexture);
|
||||
|
||||
SAFE_RELEASE(m_pAccVolumeUAV);
|
||||
SAFE_RELEASE(m_pAccVolumeSRV);
|
||||
@@ -193,10 +261,12 @@ void CVolumetric::Describe_Entity()
|
||||
_bool open = true;
|
||||
GUI::Begin("SYSTEM", &open, IMGUI_GLOBAL_BEGIN_FLAG);
|
||||
if (GUI::CollapsingHeader("VOLUMETRIC")) {
|
||||
GUI::SliderFloat("Density", &m_fDensity,0.01f, 5.f);
|
||||
GUI::SliderFloat("LightIntensity", &m_fLightIntensity, 0.01f, 5.f);
|
||||
GUI::SliderFloat("AsymmetryParameter", &m_fAsymmetryParameter, 0.01f, 5.f);
|
||||
GUI::SliderFloat("Density", &m_fDensity,0.001f, 5.f);
|
||||
GUI::SliderFloat("LightIntensity", &m_fLightIntensity, 0.01f, 0.5f, "%.4f");
|
||||
GUI::SliderFloat("AsymmetryParameter", &m_fAsymmetryParameter, -0.9f, 0.9f, "%.4f");
|
||||
GUI::SliderFloat("DepthPackExponent", &m_fDepthPackExponent, 0.01f, 5.f);
|
||||
GUI::SliderFloat("HieghtOffset", &m_fHieghtOffset, 0.f, 1.f, "%.5f");
|
||||
GUI::InputFloat("BaseHeight", &m_fBaseHeight, 0.1f, 1.f);
|
||||
}
|
||||
GUI::End();
|
||||
|
||||
@@ -268,8 +338,6 @@ HRESULT CVolumetric::CreateBuffers()
|
||||
cbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
cbDesc.ByteWidth = sizeof(CS_VOLUME_CONSTANT_DESC);
|
||||
|
||||
D3D11_SUBRESOURCE_DATA CBInitialDesc = {};
|
||||
|
||||
if (FAILED(m_pDevice->CreateBuffer(&cbDesc, nullptr, &m_pConstantBuffer)))
|
||||
return E_FAIL;
|
||||
|
||||
@@ -304,13 +372,26 @@ HRESULT CVolumetric::CreateBuffers()
|
||||
XMStoreFloat4x4(&pDesc->InvViewMatrix, m_pGameInstance->Get_Transform_Matrix(D3DTS::VIEW_INV));
|
||||
|
||||
pDesc->fAsymmetryParameter = 0.0f;
|
||||
pDesc->padding0 = 0.f;
|
||||
pDesc->padding1 = 0.f;
|
||||
pDesc->padding2 = 0.f;
|
||||
pDesc->iNumLight = 0;
|
||||
pDesc->fHeightOffset = 0.f;
|
||||
pDesc->fBaseHeight = 0.f;
|
||||
|
||||
m_pContext->Unmap(m_pConstantBuffer, 0);
|
||||
}
|
||||
|
||||
|
||||
// 라이트 정보 버퍼 생성
|
||||
D3D11_BUFFER_DESC cbLIghtDesc = {};
|
||||
cbLIghtDesc.Usage = D3D11_USAGE_DYNAMIC;
|
||||
cbLIghtDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
|
||||
cbLIghtDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
|
||||
cbLIghtDesc.ByteWidth = sizeof(CS_LIGHT_DESC) * m_iMaxNumLights;
|
||||
cbLIghtDesc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
|
||||
cbLIghtDesc.StructureByteStride = sizeof(CS_LIGHT_DESC);
|
||||
|
||||
if (FAILED(m_pDevice->CreateBuffer(&cbLIghtDesc, nullptr, &m_pLightInfoBuffer)))
|
||||
return E_FAIL;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -358,6 +439,48 @@ HRESULT CVolumetric::CreateResourceViews()
|
||||
if (FAILED(m_pDevice->CreateUnorderedAccessView(m_pAccumulateTexture3D, &UAV_Decs, &m_pAccVolumeUAV)))
|
||||
return E_FAIL;
|
||||
|
||||
// Light Info SRV
|
||||
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
|
||||
srvDesc.Format = DXGI_FORMAT_UNKNOWN;
|
||||
srvDesc.ViewDimension = D3D_SRV_DIMENSION_BUFFER;
|
||||
srvDesc.Buffer.FirstElement = 0;
|
||||
srvDesc.Buffer.NumElements = m_iMaxNumLights;
|
||||
|
||||
if (FAILED(m_pDevice->CreateShaderResourceView(m_pLightInfoBuffer, &srvDesc, &m_pLightInfoSRV)))
|
||||
return E_FAIL;
|
||||
|
||||
|
||||
// Noise Texture SRV
|
||||
|
||||
if(FAILED(CreateDDSTextureFromFile(m_pDevice,
|
||||
TEXT("C:/MeshTable/Game/Environment/MasterMaterials/BaseTextures/Noise/T_PerlinNoise.dds"),
|
||||
nullptr,
|
||||
&m_pNoiseTexture
|
||||
)))
|
||||
{
|
||||
assert(false);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT CVolumetric::Create_SamplerState()
|
||||
{
|
||||
D3D11_SAMPLER_DESC desc = {};
|
||||
desc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR;
|
||||
|
||||
desc.AddressU = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||
desc.AddressV = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||
desc.AddressW = D3D11_TEXTURE_ADDRESS_CLAMP;
|
||||
desc.MinLOD = 0.0f;
|
||||
desc.MaxLOD = D3D11_FLOAT32_MAX;
|
||||
if (FAILED(m_pDevice->CreateSamplerState(&desc, &m_pSamplerState)))
|
||||
{
|
||||
assert(false);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,18 +11,12 @@ class ENGINE_DLL CBone final : public CBase
|
||||
CBone(const CBone& other);
|
||||
virtual ~CBone() = default;
|
||||
public:
|
||||
_matrix Get_CombinedTransformationMatrix() const {
|
||||
return XMLoadFloat4x4(&m_CombinedTransformationMatrix);
|
||||
}
|
||||
_float4x4* Get_CombinedTransformationMatrixPtr() {
|
||||
return &m_CombinedTransformationMatrix;
|
||||
}
|
||||
void Set_CombinedTransformationMatrixPtr(_matrix& newMatrix) {
|
||||
return XMStoreFloat4x4(&m_CombinedTransformationMatrix, newMatrix);
|
||||
}
|
||||
_bool Compare_Name(const _char* pBoneName) const {
|
||||
return !strcmp(pBoneName, m_strName.c_str());
|
||||
}
|
||||
_matrix Get_CombinedTransformationMatrix() const { return XMLoadFloat4x4(&m_CombinedTransformationMatrix); }
|
||||
_float4x4* Get_CombinedTransformationMatrixPtr() { return &m_CombinedTransformationMatrix; }
|
||||
_float4x4* Get_TransformationMatrixPtr() { return &m_TransformationMatrix; };
|
||||
|
||||
void Set_CombinedTransformationMatrix(_fmatrix newMatrix) { return XMStoreFloat4x4(&m_CombinedTransformationMatrix, newMatrix); }
|
||||
_bool Compare_Name(const _char* pBoneName) const { return !strcmp(pBoneName, m_strName.c_str()); }
|
||||
void Get_KeyFrame(KEYFRAME& kf, _bool bIsCurrentFrame); // 현재 본의 로컬매트릭스를 캡쳐해서 키프레임으로 성분 분해하여 올려보낸다.
|
||||
const _char* Get_Name() const { return m_strName.c_str(); }
|
||||
_float3 Get_LocalPosition();
|
||||
|
||||
@@ -9,12 +9,30 @@ class CPhysX_CctQueryFilterCallback final : public PSX::PxQueryFilterCallback
|
||||
{
|
||||
if (actor != nullptr && actor->userData != nullptr)
|
||||
{
|
||||
PhsXUserData* physxUserData = (PhsXUserData*)actor->userData;
|
||||
PHYSX_USERDATA* physxUserData = (PHYSX_USERDATA*)actor->userData;
|
||||
|
||||
if (physxUserData->eKind == PHYSX_KIND::BODY_DYNAMIC)
|
||||
{
|
||||
if (PXOBJECT(physxUserData->iSubKind) == PXOBJECT::SKILL_PROTEGO)
|
||||
switch (PXOBJECT(physxUserData->iSubKind))
|
||||
{
|
||||
case PXOBJECT::LEG:
|
||||
return PSX::PxQueryHitType::eNONE;
|
||||
break;
|
||||
case PXOBJECT::SKILL_PROTEGO:
|
||||
return PSX::PxQueryHitType::eNONE;
|
||||
break;
|
||||
case PXOBJECT::GOBLIN_PROTEGO:
|
||||
return PSX::PxQueryHitType::eNONE;
|
||||
break;
|
||||
case PXOBJECT::JOINT_ROUTE:
|
||||
return PSX::PxQueryHitType::eNONE;
|
||||
break;
|
||||
case PXOBJECT::JOINT_ANCHOR:
|
||||
return PSX::PxQueryHitType::eNONE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class ENGINE_DLL CCharacter_Controller final :
|
||||
/* dev-treadmill.tistory.com/159 */
|
||||
// 기본적으로 아무 힘도 받지 않는, 주지 않는 놈임
|
||||
// kinematic 기반임
|
||||
static CPhysX_CctQueryFilterCallback s_QueryFilterCallback_IGNORE_Shield;
|
||||
static CPhysX_CctQueryFilterCallback s_QueryFilterCallback_IGNORE_GLOBAL;
|
||||
public:
|
||||
#pragma region STRUCT
|
||||
typedef struct tagCharacter_ControllerDesc
|
||||
@@ -93,7 +93,7 @@ class ENGINE_DLL CCharacter_Controller final :
|
||||
_float m_fCurrentSlopeDegree = { 0.f };
|
||||
_int m_iIsOnGround = { 0 };
|
||||
_float4 m_vAccHeight = { 0.f, 0.16f, 0.f, 0.01f };
|
||||
PhsXUserData m_tagData = {};
|
||||
PHYSX_USERDATA m_tagData = {};
|
||||
|
||||
PSX::PxControllerCollisionFlags m_eBeforeCollisionFlags = {};
|
||||
_bool m_bActive = { true };
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
#include "Component.h"
|
||||
|
||||
NS_BEGIN(Engine)
|
||||
class CTransform;
|
||||
class CMesh;
|
||||
|
||||
class ENGINE_DLL CDynamic_D6Joint final : public CComponent
|
||||
{
|
||||
public:
|
||||
typedef struct tagDynamicJointDesc {
|
||||
PHYSX_JOINT eType;
|
||||
PSX::PxRigidDynamic* pActor0;
|
||||
PSX::PxRigidDynamic* pActor1;
|
||||
const PSX::PxTransform* pxJointWorldPos;
|
||||
}DYNAMICJOINT_DESC;
|
||||
private:
|
||||
CDynamic_D6Joint(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
CDynamic_D6Joint(const CDynamic_D6Joint& rhs);
|
||||
~CDynamic_D6Joint() = default;
|
||||
|
||||
public:
|
||||
#ifdef _DEBUG
|
||||
virtual HRESULT Render()override;
|
||||
#endif // _DEBUG
|
||||
PSX::PxD6Joint* Get_JointPtr() { return m_pJoint; };
|
||||
private:
|
||||
PSX::PxD6Joint* m_pJoint = { nullptr };
|
||||
|
||||
#ifdef _DEBUG
|
||||
unique_ptr<GeometricPrimitive> m_pMainShape = { nullptr };
|
||||
#endif // _DEBUG
|
||||
|
||||
private:
|
||||
HRESULT Initialize_Prototype();
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
|
||||
#ifdef _DEBUG
|
||||
HRESULT Add_DebugShape();
|
||||
#endif
|
||||
|
||||
public:
|
||||
static CDynamic_D6Joint* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
virtual CComponent* Clone(void* pArg, class CGameObject* pOwner = nullptr) override;
|
||||
virtual void Free() override;
|
||||
#ifdef _DEBUG
|
||||
virtual void Describe_Entity() override;
|
||||
#endif // _DEBUG
|
||||
};
|
||||
|
||||
NS_END
|
||||
@@ -8,7 +8,7 @@ enum class COLLIDER { AABB, OBB, SPHERE, END };
|
||||
enum class RENDER {PRIORITY, SHADOW_NEAR, NONBLEND, DECAL, BLUR, NONLIGHT, EFFECT ,BLEND, BLOOM, DISTORTION, BULR_MESH ,UI, OCCLUSION, SHADOW_MIDDLE, PRESHADOW, UI_OVERLAY ,END };
|
||||
enum class RAY { LOCAL, WORLD, END };
|
||||
enum class ACTOR { BOX, CAPSULE, SPHERE, PLANE, TRIANGLEMESH, HEIGHTFIELD, END };
|
||||
enum class BLEND_BONE{SPINE,SHOULDER_L,SHOULDER_R,NECK,SHOULDER_NECK_L, SHOULDER_NECK_R,END};
|
||||
enum class BLEND_BONE{SPINE,SHOULDER_L,SHOULDER_R,NECK,SHOULDER_NECK_L, SHOULDER_NECK_R,HEAD, HIPS_CLOTH, END};
|
||||
enum class STAT { NAME, CURRENTHP, MAXHP, TARGETHP, MELEE, MAGIC, DEFENSE, SPEED, AGILITY, LEVEL, EXPERIENCE, MAX_EXPERIENCE, GOLD, END };
|
||||
//enum class CONDITION { POISON, HPREGENERATION, PANIC, GRAP, END };
|
||||
enum class SHADOW : _ubyte {
|
||||
@@ -118,9 +118,17 @@ enum class PHYSX_KIND {
|
||||
OBSTACLEActor,
|
||||
};
|
||||
|
||||
enum class PHYSX_JOINT {
|
||||
D6,
|
||||
DISTANCE,
|
||||
REVOLUTE,
|
||||
END
|
||||
};
|
||||
|
||||
enum class PXOBJECT : _uint {
|
||||
#pragma region NOT_DEFINE
|
||||
NOT_DEFINE = 000,
|
||||
NOT_DEFINE = 0,
|
||||
LEG,
|
||||
#pragma endregion
|
||||
#pragma region PLAYER
|
||||
PLAYER = 10,
|
||||
@@ -144,13 +152,7 @@ enum class PXOBJECT : _uint {
|
||||
GOBLIN_SHIELD_BREAK_MAGIC,
|
||||
GOBLIN_NORMAL_MAGIC,
|
||||
TROLL_GROUND_STRIKE,
|
||||
|
||||
/*
|
||||
* _int iKind;
|
||||
* if (iKind > 100 && iKind < 200){
|
||||
* dammage
|
||||
*/
|
||||
|
||||
GOBLIN_PROTEGO,
|
||||
#pragma endregion
|
||||
#pragma region ALLY_HITBOX
|
||||
ALLY_HITBOX = 200,
|
||||
@@ -216,6 +218,8 @@ enum class PXOBJECT : _uint {
|
||||
#pragma region NOCOLLIDE
|
||||
NOCOLLIDE = 900,
|
||||
GAIL,
|
||||
JOINT_ROUTE,
|
||||
JOINT_ANCHOR,
|
||||
|
||||
#pragma endregion
|
||||
END = 999
|
||||
@@ -223,7 +227,7 @@ enum class PXOBJECT : _uint {
|
||||
|
||||
enum class HIT_TYPE : _ubyte
|
||||
{
|
||||
HIT_NONE = 0,
|
||||
HIT_NONE = 0, // 히트모션 없음
|
||||
HIT_PROJECTILE = 1 << 0, // 발사체
|
||||
HIT_MEDIUM = 1 << 1, // 적당한 공격
|
||||
HIT_HEAVY = 1 << 2, // 강공격
|
||||
|
||||
@@ -47,7 +47,7 @@ unsigned long Safe_Release(T& pInstance)
|
||||
return dwRefCnt;
|
||||
}
|
||||
|
||||
static PSX::PxTransform XMWorldToPx_NoScale(const _fmatrix& WorldMatrix)
|
||||
static PSX::PxTransform XMWorldToPx_NoScaleNoFlip(const _fmatrix& WorldMatrix)
|
||||
{
|
||||
_vector vPos, vRotq, vScale;
|
||||
XMMatrixDecompose(&vScale, &vRotq, &vPos, WorldMatrix);
|
||||
@@ -60,6 +60,8 @@ static PSX::PxTransform XMWorldToPx_NoScale(const _fmatrix& WorldMatrix)
|
||||
return out;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void GUIHelpMarker(const char* desc)
|
||||
{
|
||||
GUI::SameLine();
|
||||
|
||||
@@ -98,6 +98,7 @@
|
||||
#define CS_INSTANCE_MODEL TEXT("CS_INSTANCE_MODEL")
|
||||
#define CS_MODEL TEXT("CS_MODEL")
|
||||
#define CS_LOCAL TEXT("CS_LOCAL")
|
||||
#define CS_BONEINSERT TEXT("CS_BONEINSERT")
|
||||
|
||||
|
||||
#define SAFE_ADDREF(pInstance) Safe_AddRef(pInstance)
|
||||
|
||||
@@ -373,9 +373,10 @@ typedef struct tagVertexInstance_UIDesc
|
||||
|
||||
}VTX_POSTEX_INSTANCE_UI;
|
||||
|
||||
typedef struct tagPhsXUserData {
|
||||
typedef struct tagPHYSX_USERDATA {
|
||||
|
||||
PHYSX_KIND eKind = PHYSX_KIND::NOT_DEFINED;
|
||||
_bool bAutoOwnerTranslation = true;
|
||||
|
||||
class CGameObject* pOwner = { nullptr };
|
||||
_float4x4 BeforeMatrix = { };
|
||||
@@ -387,7 +388,11 @@ typedef struct tagPhsXUserData {
|
||||
class CObstacle_Controller* pObstacle = { nullptr };
|
||||
};
|
||||
|
||||
}PhsXUserData;
|
||||
}PHYSX_USERDATA;
|
||||
|
||||
typedef struct tagD6JointDesc {
|
||||
|
||||
}PHYSX_JOINT_D6Desc;
|
||||
|
||||
typedef struct tagOnCollsionInfo
|
||||
{
|
||||
|
||||
@@ -53,6 +53,8 @@ enum ESTATE : _u64Flag
|
||||
SWIPE = 1ULL << 46,
|
||||
SLIDE = 1ULL << 47,
|
||||
FALL = 1ULL << 48,
|
||||
SLASH = 1ULL << 49,
|
||||
DASH = 1ULL << 50,
|
||||
END
|
||||
};
|
||||
NS_END
|
||||
|
||||
@@ -94,7 +94,7 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
}
|
||||
return hr;
|
||||
}
|
||||
void Set_LayerEnabled(_bool isEnable);
|
||||
|
||||
class CLayer* Get_Layer(_uint iLayerLevelIndex, const _wstring& strLayerTag);
|
||||
void Clear_Objects_With_Layers(_uint iLevelIndex);
|
||||
|
||||
@@ -136,6 +136,7 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
void Set_Transform(D3DTS eState, _fmatrix TransformStateMatrix);
|
||||
const _float4x4* Get_Transform_Float4x4(D3DTS eState);
|
||||
_matrix Get_Transform_Matrix(D3DTS eState);
|
||||
_matrix Get_ShadowTransform_Matrix(D3DTS eState, SHADOW eShadowType);
|
||||
const _float4* Get_CamPosition();
|
||||
const _vector Get_CamXMPosition();
|
||||
void Transform_Frustum_ToLocalSpace(_fmatrix WorldMatrixInverse);
|
||||
@@ -151,6 +152,8 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
HRESULT Bind_Shadow_Resource(class CShader* pShader, const _char* pConstantName, D3DTS eType, SHADOW eShadowType) const;
|
||||
const _float4x4* Get_ShadowMatricesPtr(_uint iShadowBoxIndex);
|
||||
_float Get_ShadowBoxFar(_uint iShadowBoxIndex);
|
||||
HRESULT Begin_OutLine_Write(_uint iDSSMask);
|
||||
HRESULT End_OutLine_Write();
|
||||
#pragma endregion
|
||||
#pragma region LIGHT_MANAGER
|
||||
void Add_Light(_uint _iCurrentLevel, class CLight* _pLight);
|
||||
@@ -158,6 +161,8 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
void Delete_Light(_uint _iCurrentLevel, class CLight* _pLight);
|
||||
const LIGHT_DESC* Get_Light_Info(_uint _iCurrentLevel, _uint _iLightIndex);
|
||||
HRESULT Render_Lights(_uint _iCurrentLevel, class CShader* pShader, class CVIBuffer* pVIBuffer);
|
||||
list<class CLight*>* Get_LightList(_uint _iCurrentLevel);
|
||||
_uint Get_NumLight(_uint _iCurrentLevel);
|
||||
#pragma endregion
|
||||
#pragma region COLLIDER_MANAGER
|
||||
HRESULT Add_ColliderGroup(_uint iColliderGroup, class CCollider* pBounding);
|
||||
@@ -183,6 +188,7 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
HRESULT Finish_RenderTarget(class CVIBuffer_Rect* pVIBuffer, class CShader* pShader, const _wstring& wstrRenderTargetOriginal, const _wstring& wstrRenderTargetBloomed, SHADER_PASS_DEFERRED ePass);
|
||||
HRESULT Bind_CS_RenderTarget(_uint iIndex, const _wstring& strTargetTag);
|
||||
HRESULT Clear_RenderTarget(const _wstring& strRenderTargetKey);
|
||||
ID3D11ShaderResourceView* Get_RenderTarget_SRV(const _wstring& strRenderTargetKey);
|
||||
#ifdef _DEBUG
|
||||
void RenderTarget_Debuger();
|
||||
HRESULT Render_RenderTarget_Debug(class CShader* pShader, class CVIBuffer_Rect* pVIBuffer);
|
||||
@@ -212,7 +218,8 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
void RegistHeight(const _tchar* pName, PSX::PxHeightFieldDesc& Desc, _uint iLevel);
|
||||
PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody_Dynamic& RigidBody, _uint iLevel);
|
||||
PSX::PxRigidStatic* Add_StaticActor(CRigidBody_Static& RigidBody, _uint iLevel);
|
||||
PSX::PxRevoluteJoint* Create_PxRevoluteJoint(PSX::PxRigidActor* pActorFrame, PSX::PxTransform& pxLocalWallFrame, PSX::PxRigidActor* pActorObject, PSX::PxTransform& pxLocalActorFrame, _uint iLevel);
|
||||
PSX::PxJoint* Create_PxJoint(PHYSX_JOINT eType, PSX::PxRigidActor* pActor0, PSX::PxTransform& pxLocalFrame0, PSX::PxRigidActor* pActor1, PSX::PxTransform& pxLocalFrame1);
|
||||
PSX::PxD6Joint* Create_PxD6Joint(PSX::PxRigidDynamic* pActor0, PSX::PxRigidDynamic* pActor1, const PSX::PxTransform& pxJointWorldPos);
|
||||
|
||||
_bool SphereCast(_float fRadius, _float3 vStartPos, _float3 vDir, _float fDistance, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer);
|
||||
_bool SphereCast(_float fRadius, _fvector vStartPos, _gvector vDir, _float fDistance, PSX::PxHitFlags flagHitsData, PSX::PxQueryFlags flagQuery, PSX::PxSweepBuffer& hitBuffer);
|
||||
@@ -226,12 +233,13 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
void Attach_Actor(PSX::PxActor& Actor, _uint iLevel);
|
||||
void Detach_Actor(PSX::PxActor& pActor, _uint iLevel);
|
||||
void Release_Actor(PSX::PxActor& Actor);
|
||||
void ApplyFilterData(PSX::PxRigidActor* pRigidActor);
|
||||
HRESULT ConvertToTriMeshes(vector<class CMesh*>& Meshes, vector<class PSX::PxTriangleMesh*>& pxTriMeshes, _fmatrix WorldMatrix = XMMatrixIdentity());
|
||||
#ifdef EDITOR_PROJECT
|
||||
HRESULT SaveTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||
#endif // EDITOR_PROJECT
|
||||
HRESULT LoadTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes); // 모델 불러왔던 경로에 그대로 있음
|
||||
void Add_Editor_Plane(PhsXUserData& PlaneData);
|
||||
void Add_Editor_Plane(PHYSX_USERDATA& PlaneData);
|
||||
#pragma endregion
|
||||
#pragma region THREADHOLDER
|
||||
template<class Function, class... Args>
|
||||
@@ -270,6 +278,7 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
ID3D11ShaderResourceView* Get_VolumeSRV();
|
||||
_float* Get_DepthPackExponentPtr();
|
||||
void Setting_Volumetirc(_float fDensity, _float fLightIntensity, _float fAsymmetryParameter, _float fDepthPackExponent);
|
||||
void Update_Volumetric();
|
||||
#pragma endregion
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@ class CLight_Manager final : public CBase
|
||||
void Delete_Light(_uint _iCurrentLevel, class CLight* _pLight);
|
||||
void Light_Clear(_uint _iCurrentLevel);
|
||||
const LIGHT_DESC* Get_Light_Info(_uint _iCurrentLevel ,_uint _iLightIndex);
|
||||
|
||||
list<class CLight*>* Get_LightList(_uint _iCurrentLevel) { return &m_Lights[_iCurrentLevel]; }
|
||||
_uint Get_NumLight(_uint _iCurrentLevel);
|
||||
public:
|
||||
HRESULT Render_Lights(_uint iCurrentLevel, class CShader* pShader, class CVIBuffer* pVIBuffer);
|
||||
|
||||
|
||||
@@ -20,12 +20,28 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
_float BlendRatio;
|
||||
|
||||
_int RootBoneIndex;
|
||||
_float3 padding;
|
||||
_int PlayHeadBone;
|
||||
_int HeadBoneIndex;
|
||||
_float HeadAimWeight;
|
||||
|
||||
_int SkipCount;
|
||||
_int padding0;
|
||||
_int padding1;
|
||||
_int padding2;
|
||||
|
||||
_float3 TargetDir_Local;
|
||||
_float padding3;
|
||||
|
||||
_float4x4 PreTransformMatrix;
|
||||
_float4 RootInitRot;
|
||||
}ANIMSTATE_DESC;
|
||||
|
||||
typedef struct tagBoneInsertionDesc {
|
||||
_uint iStartOffset;
|
||||
_uint iMatrixCount;
|
||||
_uint iPad0;
|
||||
_uint iPad1;
|
||||
}BONEINSERTION_DESC;
|
||||
|
||||
|
||||
private:
|
||||
@@ -43,6 +59,12 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
virtual HRESULT Render_Indexed(_uint iMeshIndex, _uint IndexCount, _uint StartIndexLocation, _uint BaseVertexLocation);
|
||||
MODEL Get_Type() { return m_eType; }
|
||||
void Set_Temp(_bool Temp) { m_bTemp = Temp; }
|
||||
void Set_TargetPos(_vector vTargetPos) { m_vTargetPos = vTargetPos; }
|
||||
void Set_HeadPos(_vector vHeadPos) { m_vHeadPos = vHeadPos; }
|
||||
void Play_HeadBone(_bool bPlay) { m_bHeadBone = bPlay; }
|
||||
void Set_HeadAimWeight(_float fWeight) { m_fHeadAimWeight = fWeight; }
|
||||
_bool Get_PlayHeadBone() const { return m_bHeadBone; }
|
||||
_int Get_SkipBoneIndex(_int Index) { return m_SkipBoneindex[Index]; }
|
||||
#pragma endregion
|
||||
#pragma region Animation
|
||||
_bool Play_Animation(_float fTimeDelta, class CTransform* pTransform = nullptr); // 애니메이션에 델타타임을 넣어줌
|
||||
@@ -77,34 +99,40 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
void Update_RootBone(_float Amount = 1.f);
|
||||
void Initialize_RootBone();
|
||||
vector<_float4x4> Get_OffsetMatrix(_int iIndex);
|
||||
void Apply_CPU_HeadAim();
|
||||
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);
|
||||
_matrix Get_BoneMatrix(const _char* pBoneName);
|
||||
_matrix Get_BoneMatrix(const _char* pBoneName) const;
|
||||
const _float4x4* Get_BoneLocalMatrixPtr(const _char* pBoneName);
|
||||
_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();
|
||||
void Combined_BoneMatrix(_int iStartBoneIndex, _uint iBoneCount);
|
||||
_int Find_BoneIndex(const _char* pBoneName);
|
||||
HRESULT Set_BoneCombinedTransformation(const _char* pBoneName, _fmatrix newTransformation);
|
||||
|
||||
#pragma endregion
|
||||
#pragma region Material
|
||||
HRESULT Bind_Material(_uint iMeshIndex, class CShader* pShader);
|
||||
HRESULT Begin(_uint iMeshIndex, class CShader* pShader, _bool OutLine = false);
|
||||
HRESULT Begin(_uint iMeshIndex, class CShader* pShader);
|
||||
#pragma endregion
|
||||
|
||||
void ComputeAnimation(_uint AnimIndex, _uint MeshIndex);
|
||||
void ComputeLocal(_uint AnimIndex, _uint MeshIndex);
|
||||
void Bind_OutPut_SRV_VS(_uint iIndex, _uint iBufferIndex);
|
||||
void Bind_OutPut_SRV_VS_Prev(_uint iIndex, _uint iBufferIndex);
|
||||
void ComputeAnimation_Second(_uint AnimIndex);
|
||||
void InItialize_BoneIndex();
|
||||
void ComputeAnimation(_uint AnimIndex, _uint MeshIndex);
|
||||
void ComputeLocal(_uint AnimIndex, _uint MeshIndex);
|
||||
void ComputeInsertionBoneBuffer(BONEINSERTION_DESC& CBDesc, ID3D11ShaderResourceView* pSRV);
|
||||
void Bind_OutPut_SRV_VS(_uint iIndex, _uint iBufferIndex);
|
||||
void Bind_OutPut_SRV_VS_Prev(_uint iIndex, _uint iBufferIndex);
|
||||
void ComputeAnimation_Second(_uint AnimIndex);
|
||||
void InItialize_BoneIndex();
|
||||
|
||||
void Initialize_BoneMasks();
|
||||
void Initialize_BoneMasks();
|
||||
|
||||
public:
|
||||
HRESULT Ready_PhysXMeshes(_fmatrix& PreTransformMatrix, _uint iLevel);
|
||||
@@ -164,7 +192,7 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
|
||||
_float m_fRatio = {};
|
||||
_int m_iCurrSecondAnimIndex = { -1 };
|
||||
_int m_iBoneIndex[ENUM_CLASS(BLEND_BONE::END)] = { -1,-1,-1,-1,-1,-1 };
|
||||
_int m_iBoneIndex[ENUM_CLASS(BLEND_BONE::END)] = { -1,-1,-1,-1,-1,-1,-1,-1 };
|
||||
vector<vector<_uint>> m_BoneMask;
|
||||
vector<_bool> m_CPUBoneMask;
|
||||
|
||||
@@ -185,16 +213,22 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
_int m_iIndexAnimPlayableMesh = { -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 = {};
|
||||
_float4x4 m_RootMatrix = {};
|
||||
_bool m_bTemp = {false};
|
||||
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 = {};
|
||||
_float4x4 m_RootMatrix = {};
|
||||
_bool m_bTemp = {false};
|
||||
_vector m_vTargetPos = XMVectorZero();
|
||||
_vector m_vHeadPos = XMVectorZero();
|
||||
_bool m_bHeadBone = { false };
|
||||
_float m_fHeadAimWeight = { 0.f };
|
||||
_int m_iSkipBoneCount = {};
|
||||
vector<_int> m_SkipBoneindex = {};
|
||||
|
||||
|
||||
private:
|
||||
@@ -209,8 +243,10 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
private:
|
||||
HRESULT Create_ComputeShader();
|
||||
HRESULT Create_ComputeShaderLocal();
|
||||
HRESULT Create_ComputeShaderBoneInsertion();
|
||||
HRESULT Create_ParentVB();
|
||||
HRESULT Create_BoneLocalVB();
|
||||
HRESULT Create_SkipBoneVB();
|
||||
HRESULT Create_Temp();
|
||||
HRESULT Create_BoneMatrixVB();
|
||||
HRESULT Create_Const();
|
||||
@@ -219,31 +255,33 @@ class ENGINE_DLL CModel final : public CComponent
|
||||
|
||||
HRESULT Create_Local();
|
||||
|
||||
_uint m_iNumBuffer = {};
|
||||
_uint m_iNumBuffer = {};
|
||||
|
||||
vector<_int> m_Parent = {};
|
||||
vector<_int> m_Parent = {};
|
||||
vector<_float4x4> m_BoneLocal = {};
|
||||
|
||||
vector<ANIMSTATE_DESC> m_AnimRanges;
|
||||
|
||||
vector<_float4x4> m_BoneMatrixCPU;
|
||||
|
||||
class CComputeShader* m_pComputeShader = nullptr;
|
||||
class CComputeShader* m_pCS_AnimLocal = nullptr;
|
||||
class CComputeShader* m_pCS_BoneInsertion = nullptr;
|
||||
|
||||
ID3D11Buffer* m_pConstantBuffer = { nullptr };
|
||||
ID3D11Buffer* m_pParentBuffer = { nullptr };
|
||||
ID3D11Buffer* m_pBoneMatrixBuffer = { nullptr };
|
||||
ID3D11Buffer* m_pPrevBoneMatrixBuffer = { nullptr };
|
||||
ID3D11Buffer* m_pBoneLocalBuffer = { nullptr };
|
||||
ID3D11Buffer* m_pSkipBoneBuffer = { nullptr };
|
||||
ID3D11Buffer* m_pLocalMatrixBuffer = { nullptr };
|
||||
|
||||
ID3D11Buffer* m_pInsertionCB = { nullptr };
|
||||
|
||||
ID3D11ShaderResourceView* m_pParentSRV = { nullptr };
|
||||
ID3D11ShaderResourceView* m_pBoneLocalSRV = { nullptr };
|
||||
ID3D11ShaderResourceView* m_pBoneMatrixSRV = { nullptr };
|
||||
ID3D11ShaderResourceView* m_pPrevBoneMatrixSRV = { nullptr };
|
||||
ID3D11ShaderResourceView* m_pLocalMatrixSRV = { nullptr };
|
||||
ID3D11ShaderResourceView* m_pSkipBoneSRV = { nullptr };
|
||||
|
||||
ID3D11UnorderedAccessView* m_pBoneMatrixUAV = { nullptr };
|
||||
ID3D11UnorderedAccessView* m_pLocalMatrixUAV = { nullptr };
|
||||
|
||||
@@ -11,35 +11,35 @@ class CMyTools {
|
||||
#pragma region Color
|
||||
// [(255, 255, 255, xx), alpha] -> [(0~1, 0~1, 0~1, alpha)]
|
||||
// 0xRRGGBBxx, alpha -> _float4( 0~1, 0~1, 0~1, alpha )
|
||||
static _float4 ColorRGB_A_HEXtoFLOAT4(_uint hexCode, _float alpha) {
|
||||
inline static _float4 ColorRGB_A_HEXtoFLOAT4(_uint hexCode, _float alpha) {
|
||||
float r, g, b, a; DecodeRGBA(hexCode, r, g, b, a, false); a = alpha;
|
||||
return _float4(r, g, b, a);
|
||||
}
|
||||
|
||||
// [(255, 255, 255, 255)] -> [(0~1, 0~1, 0~1, 0~1)]
|
||||
// 0xRRGGBBAA -> _float4( 0~1, 0~1, 0~1, 0~1 )
|
||||
static _float4 ColorRGBA_HEXtoFLOAT4(_uint hexCode) {
|
||||
inline static _float4 ColorRGBA_HEXtoFLOAT4(_uint hexCode) {
|
||||
float r, g, b, a; DecodeRGBA(hexCode, r, g, b, a, true);
|
||||
return _float4(r, g, b, a);
|
||||
}
|
||||
|
||||
// [(255, 255, 255, xx), alpha] -> [(0~1, 0~1, 0~1, alpha)]
|
||||
// 0xRRGGBBxx, alpha -> _vector( 0~1, 0~1, 0~1, alpha )
|
||||
static _vector ColorRGB_A_HEXtoVECTOR(_uint hexCode, _float alpha) {
|
||||
inline static _vector ColorRGB_A_HEXtoVECTOR(_uint hexCode, _float alpha) {
|
||||
float r, g, b, a; DecodeRGBA(hexCode, r, g, b, a, false); a = alpha;
|
||||
return XMVectorSet(r, g, b, a);
|
||||
}
|
||||
|
||||
// [(255, 255, 255, 255)] -> [(0~1, 0~1, 0~1, 0~1)]
|
||||
// 0xRRGGBBAA -> _vector( 0~1, 0~1, 0~1, 0~1 )
|
||||
static _vector ColorRGBA_HEXtoVECTOR(_uint hexCode) {
|
||||
inline static _vector ColorRGBA_HEXtoVECTOR(_uint hexCode) {
|
||||
float r, g, b, a; DecodeRGBA(hexCode, r, g, b, a, true);
|
||||
return XMVectorSet(r, g, b, a);
|
||||
}
|
||||
#pragma endregion
|
||||
#pragma region String
|
||||
// wstring --> string 변환
|
||||
static _string ToString(const _wstring& var)
|
||||
inline static _string ToString(const _wstring& var)
|
||||
{
|
||||
int size_needed = WideCharToMultiByte(CP_UTF8, 0, var.c_str(),
|
||||
(int)var.size(), nullptr, 0, nullptr, nullptr);
|
||||
@@ -52,7 +52,7 @@ class CMyTools {
|
||||
}
|
||||
|
||||
// string --> wstring 변환
|
||||
static _wstring ToWstring(const _string& var)
|
||||
inline static _wstring ToWstring(const _string& var)
|
||||
{
|
||||
int size_needed = MultiByteToWideChar(CP_UTF8, 0, var.c_str(),
|
||||
(int)var.size(), nullptr, 0);
|
||||
@@ -65,7 +65,7 @@ class CMyTools {
|
||||
}
|
||||
|
||||
// source에 keyword가 있는지 검사
|
||||
static _bool ContainsString(const char* source, const char* keyword) {
|
||||
inline static _bool ContainsString(const char* source, const char* keyword) {
|
||||
if (!source || !keyword || *keyword == '\0') {
|
||||
return false;
|
||||
}
|
||||
@@ -75,13 +75,13 @@ class CMyTools {
|
||||
#pragma endregion
|
||||
#pragma region Mathematics
|
||||
// ratio로 현재 value 가져오기
|
||||
static _float Lerp_f1D(_float fA, _float fB, _float fRatio)
|
||||
inline static _float Lerp_f1D(_float fA, _float fB, _float fRatio)
|
||||
{
|
||||
return fA + (fB - fA) * fRatio;
|
||||
}
|
||||
|
||||
// value로 현재 ratio 가져오기
|
||||
static _float InverseLerp_f1D(_float fA, _float fB, _float fValue)
|
||||
inline static _float InverseLerp_f1D(_float fA, _float fB, _float fValue)
|
||||
{
|
||||
if (fA == fB) {
|
||||
return 0.0f;
|
||||
@@ -101,7 +101,7 @@ class CMyTools {
|
||||
}
|
||||
|
||||
// dx9에 있던 IntersectTri
|
||||
static _bool IntersectTri(
|
||||
inline static _bool IntersectTri(
|
||||
const _fvector& vPos, const _fvector& vDir,
|
||||
const _fvector& vertexA, const _gvector& vertexB, const _hvector& vertexC,
|
||||
_float& t, _float& u, _float& v)
|
||||
@@ -130,17 +130,24 @@ class CMyTools {
|
||||
|
||||
return t >= 0.f;
|
||||
}
|
||||
|
||||
// 매트릭스 럴프
|
||||
static void MatrixLerp( _In_ _float4x4* pMatOrigin, // Origin -> 0
|
||||
inline static void MatrixLerp( _In_ _float4x4* pMatOrigin, // Origin -> 0
|
||||
_In_ _float4x4* pMatTarget, // Target -> 1
|
||||
_Out_ _float4x4& matOut, _float fRatio) {
|
||||
_matrix matOrigin = XMLoadFloat4x4(pMatOrigin);
|
||||
_matrix matTarget = XMLoadFloat4x4(pMatTarget);
|
||||
MatrixLerp(&matOrigin, &matTarget, matOut, fRatio);
|
||||
}
|
||||
|
||||
inline static void MatrixLerp( _In_ _matrix* pMatOrigin, // Origin -> 0
|
||||
_In_ _matrix* pMatTarget, // Target -> 1
|
||||
_Out_ _float4x4& matOut, _float fRatio) {
|
||||
fRatio = Saturate(fRatio);
|
||||
|
||||
_vector vTargetScale{}, vTargetRotq{}, vTargetTrans{};
|
||||
_vector vOriginScale{}, vOriginRotq{}, vOriginTrans{};
|
||||
XMMatrixDecompose(&vTargetScale, &vTargetRotq, &vTargetTrans, XMLoadFloat4x4(pMatTarget));
|
||||
XMMatrixDecompose(&vOriginScale, &vOriginRotq, &vOriginTrans, XMLoadFloat4x4(pMatOrigin));
|
||||
XMMatrixDecompose(&vTargetScale, &vTargetRotq, &vTargetTrans, *pMatTarget);
|
||||
XMMatrixDecompose(&vOriginScale, &vOriginRotq, &vOriginTrans, *pMatOrigin);
|
||||
|
||||
vTargetScale = XMVectorLerp(vOriginScale, vTargetScale, fRatio);
|
||||
vTargetRotq = XMQuaternionSlerp(vOriginRotq, vTargetRotq, fRatio);
|
||||
@@ -150,7 +157,7 @@ class CMyTools {
|
||||
}
|
||||
|
||||
// 비슷하면 1 직교하면 0 완전 반대방향일수록 -1
|
||||
static _float DirectionCompare(_vector a, _vector b)
|
||||
inline static _float DirectionCompare(_vector a, _vector b)
|
||||
{
|
||||
_vector vNormalA = XMVector3Normalize(a);
|
||||
_vector vNormalB = XMVector3Normalize(b);
|
||||
@@ -158,7 +165,7 @@ class CMyTools {
|
||||
}
|
||||
|
||||
// hlsl에 있는 Saturate
|
||||
static _float Saturate(_float fValue) {
|
||||
inline static _float Saturate(_float fValue) {
|
||||
if (fValue > 1.f) {
|
||||
fValue = 1.f;
|
||||
}
|
||||
@@ -169,7 +176,7 @@ class CMyTools {
|
||||
}
|
||||
|
||||
// 입력 라디안이 들어오면 -PI ~ +PI로 정규화된 라디안으로 변경
|
||||
static _float NormalizeRadian(_float fRadian)
|
||||
inline static _float NormalizeRadian(_float fRadian)
|
||||
{
|
||||
fRadian = fmodf(fRadian, XM_2PI);
|
||||
if (fRadian <= -XM_PI) {
|
||||
@@ -267,6 +274,40 @@ class CMyTools {
|
||||
vAccumulateRadianPitchYaw.x = -fPitchLimitRadian;
|
||||
}
|
||||
}
|
||||
static inline _vector MakeQuaternionFromTo(_vector vAOrigin, _vector vBDest)
|
||||
{
|
||||
vAOrigin = XMVector3Normalize(vAOrigin);
|
||||
vBDest = XMVector3Normalize(vBDest);
|
||||
|
||||
_float fDot = XMVectorGetX(XMVector3Dot(vAOrigin, vBDest));
|
||||
|
||||
if ( 1.f - fDot < FLT_EPSILON) { // 같은 방향 제외
|
||||
return XMQuaternionIdentity();
|
||||
}
|
||||
if (fDot < -1.f + FLT_EPSILON) { // 반대방향 제외
|
||||
_vector vTempAxis = XMVector3Cross(vAOrigin, XMVectorSet(1.f, 0.f, 0.f, 0.f));
|
||||
_float fTempLength = XMVectorGetX(XMVector3Length(vTempAxis));
|
||||
|
||||
if (fTempLength < FLT_EPSILON5) {
|
||||
vTempAxis = XMVector3Cross(vAOrigin, XMVectorSet(0.f, 0.f, 1.f, 0.f));
|
||||
}
|
||||
|
||||
vTempAxis = XMVector3Normalize(vTempAxis);
|
||||
return XMQuaternionRotationAxis(vTempAxis, XM_PI);
|
||||
}
|
||||
|
||||
_vector vRotAxis = XMVector3Cross(vAOrigin, vBDest);
|
||||
_float fRotLength = XMVectorGetX(XMVector3Length(vRotAxis));
|
||||
if (fRotLength < FLT_EPSILON5) {
|
||||
return XMQuaternionIdentity();
|
||||
}
|
||||
vRotAxis = XMVector3Normalize(vRotAxis);
|
||||
|
||||
_float fRotAngle = acosf(clamp(fDot, -1.f, 1.f));
|
||||
_vector vRotQ = XMQuaternionRotationAxis(vRotAxis, fRotAngle);
|
||||
return XMQuaternionNormalize(vRotQ);
|
||||
}
|
||||
|
||||
|
||||
inline static void SortHitsByDistance(vector<PSX::PxRaycastHit>& hits)
|
||||
{
|
||||
@@ -296,6 +337,24 @@ class CMyTools {
|
||||
|
||||
return (Alphabet - 'A');
|
||||
}
|
||||
|
||||
inline static PSX::PxTransform MakeJointWorldPoseFromRouteEnd(PSX::PxRigidActor* routeRigidActor, _float3 vCapsuleHalfLengths, bool isHeadEnd)
|
||||
{
|
||||
PSX::PxShape* shapeArray[1] = {};
|
||||
routeRigidActor->getShapes(shapeArray, 1);
|
||||
|
||||
PSX::PxShape* routeShape = shapeArray[0];
|
||||
|
||||
const PSX::PxTransform pxRouteWorldTransfom = PSX::PxShapeExt::getGlobalPose(*routeShape, *routeRigidActor);
|
||||
|
||||
const PSX::PxVec3 capsuleAxisWorld = pxRouteWorldTransfom.q.rotate(PSX::PxVec3(1.f, 0.f, 0.f));
|
||||
|
||||
PSX::PxTransform jointWorldPose;
|
||||
jointWorldPose.q = pxRouteWorldTransfom.q;
|
||||
jointWorldPose.p = pxRouteWorldTransfom.p + (isHeadEnd ? 1.f : -1.f) * capsuleAxisWorld * (vCapsuleHalfLengths.y + vCapsuleHalfLengths.x);
|
||||
|
||||
return jointWorldPose;
|
||||
}
|
||||
#pragma endregion
|
||||
#pragma region FileSystem
|
||||
//static void Folder_Func(/* 재귀적으로 탐색할지 */ _In_ _bool bRecursive,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions
|
||||
// are met:
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
|
||||
@@ -11,6 +11,16 @@ class CMesh;
|
||||
|
||||
class CPhysX_Manager final : public CBase
|
||||
{
|
||||
private:
|
||||
// 주의: 피직스 내부 플래그 전용. 건드리려면 먼저 말하고 건드리기
|
||||
// 가장 기본이 되는 필터 플래그
|
||||
enum COLLISIONCATERGORY_BIT32 : uint32_t
|
||||
{
|
||||
CharacterController = 1u << 0
|
||||
, JointedParts = 1u << 1
|
||||
, WorldStatic = 1u << 2
|
||||
, WorldDynamic = 1u << 3
|
||||
};
|
||||
private:
|
||||
CPhysX_Manager(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
virtual ~CPhysX_Manager() = default;
|
||||
@@ -23,7 +33,10 @@ class CPhysX_Manager final : public CBase
|
||||
|
||||
PSX::PxRigidDynamic* Add_DynamicActor(CRigidBody_Dynamic& RigidBody, _uint iLevel);
|
||||
PSX::PxRigidStatic* Add_StaticActor(CRigidBody_Static& RigidBody, _uint iLevel);
|
||||
PSX::PxRevoluteJoint* Create_PxRevoluteJoint(PSX::PxRigidActor* pActorFrame, PSX::PxTransform& pxLocalWallFrame, PSX::PxRigidActor* pActorObject, PSX::PxTransform& pxLocalActorFrame, _uint iLevel);
|
||||
|
||||
// https://documentation.help/nvidia-physx-sdk-guide/Joints.html
|
||||
PSX::PxJoint* Create_PxJoint(PHYSX_JOINT eType, PSX::PxRigidActor* pActor0, PSX::PxTransform& pxLocalFrame0, PSX::PxRigidActor* pActor1, PSX::PxTransform& pxLocalFrame1);
|
||||
PSX::PxD6Joint* Create_PxD6Joint(PSX::PxRigidDynamic* pActor0, PSX::PxRigidDynamic* pActor1, const PSX::PxTransform& pxJointWorldPos);
|
||||
|
||||
void RegistTriMesh(const _char* pName, PSX::PxTriangleMesh* pPxTriMesh, _uint iLevel);
|
||||
void RegistHeight(const _tchar* pName, PSX::PxHeightFieldDesc& Desc, _uint iLevel);
|
||||
@@ -41,7 +54,7 @@ class CPhysX_Manager final : public CBase
|
||||
#ifdef EDITOR_PROJECT
|
||||
|
||||
HRESULT SaveTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||
void Add_Editor_Plane(PhsXUserData& PlaneData);
|
||||
void Add_Editor_Plane(PHYSX_USERDATA& PlaneData);
|
||||
#endif // EDITOR_PROJECT
|
||||
HRESULT LoadTriMeshes(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||
//HRESULT LoadTriMeshes_Binary(const _char* pPath, vector<PSX::PxTriangleMesh*>& TriMeshes);
|
||||
@@ -60,6 +73,7 @@ class CPhysX_Manager final : public CBase
|
||||
public:
|
||||
PSX::PxController* Add_CapsuleController(PSX::PxCapsuleControllerDesc& Desc);
|
||||
PSX::PxController* Add_BoxController(PSX::PxBoxControllerDesc& Desc);
|
||||
void ApplyFilterData(PSX::PxRigidActor* pRigidActor);
|
||||
|
||||
PSX::PxController* Get_Controller(_uint iControllerIndex);
|
||||
void ReleaseController(_uint iControllerIndex);
|
||||
@@ -102,7 +116,7 @@ class CPhysX_Manager final : public CBase
|
||||
map<_wstring, PSX::PxHeightFieldGeometry*>* m_HeightFieldGeometry = { nullptr };
|
||||
|
||||
|
||||
PhsXUserData PlaneData = {};
|
||||
PHYSX_USERDATA PlaneData = {};
|
||||
|
||||
vector<PSX::PxMaterial*> m_pMaterials = { };
|
||||
_uint m_iNumLevel = { UINT_MAX };
|
||||
@@ -114,7 +128,13 @@ class CPhysX_Manager final : public CBase
|
||||
|
||||
void Update_Kinematic();
|
||||
void Update_Dynamic_ActiveActors();
|
||||
//void Update_Dynamic_AllActors();
|
||||
void FixCapsuleShapeAxisToY(PSX::PxShape* pShape);
|
||||
uint32_t ConvertPhysxKindToBit(const PHYSX_USERDATA& physxKind);
|
||||
uint32_t BuildCollisionMaskFromCategoryBit(uint32_t iMyBit);
|
||||
static PSX::PxFilterFlags SimulationFilterShader(PSX::PxFilterObjectAttributes pxAttributes0, PSX::PxFilterData pxFilterData0,
|
||||
PSX::PxFilterObjectAttributes pxAttributes1, PSX::PxFilterData pxFilterData1,
|
||||
PSX::PxPairFlags& pxPairFlags, const void* pConstantBlock, PSX::PxU32 iConstantBlockSize);
|
||||
|
||||
|
||||
public:
|
||||
static CPhysX_Manager* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext, _uint iLevel);
|
||||
|
||||
@@ -21,12 +21,13 @@ cascade
|
||||
class CPipeLine final : public CBase
|
||||
{
|
||||
private:
|
||||
CPipeLine();
|
||||
CPipeLine(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
virtual ~CPipeLine() = default;
|
||||
public:
|
||||
void Set_Transform(D3DTS eState, _fmatrix TransformStateMatrix);
|
||||
const _float4x4* Get_Transform_Float4x4(D3DTS eState);
|
||||
_matrix Get_Transform_Matrix(D3DTS eState);
|
||||
_matrix Get_ShadowTransform_Matrix(D3DTS eState, SHADOW eShadowType);
|
||||
|
||||
const _float4* Get_CamPosition();
|
||||
const _vector Get_CamXMPosition();
|
||||
@@ -43,6 +44,9 @@ class CPipeLine final : public CBase
|
||||
HRESULT Bind_GlobalSRV(class CShader* pShader, const _tchar* wszKeyGlobalSRV, const _char* pConstantName);
|
||||
HRESULT Load_GlobalSRV(const _tchar* wszKeyGlobalSRV, filesystem::path pathSRVFolder);
|
||||
|
||||
HRESULT Begin_OutLine_Write(_uint iDSSRef);
|
||||
HRESULT End_OutLine_Write();
|
||||
|
||||
HRESULT Ready_Shadow_Light(const _float4& vShadowDirRPYQuat);
|
||||
HRESULT Bind_Shadow_Resource(class CShader* pShader, const _char* pConstantName, D3DTS eType, SHADOW eShadowType) const;
|
||||
const _float4x4* Get_ShadowMatricesPtr(_uint iShadowBoxIndex);
|
||||
@@ -51,6 +55,8 @@ class CPipeLine final : public CBase
|
||||
void Update(); // Objects의 Priority, Update사이에서 불려야만 함
|
||||
|
||||
private:
|
||||
ID3D11Device* m_pDevice = { nullptr };
|
||||
ID3D11DeviceContext* m_pContext = { nullptr };
|
||||
class CGameInstance* m_pGameInstance = { nullptr };
|
||||
_float4x4 m_TransformStateMatrices[ENUM_CLASS(D3DTS::END)] = {};
|
||||
_float4x4 m_ShadowTransformStateMatrices[3][ENUM_CLASS(D3DTS::END)] = {};
|
||||
@@ -83,6 +89,10 @@ class CPipeLine final : public CBase
|
||||
_float4 m_vShadowInvDirectionalRPYQuat = { 0.f, 0.f, 0.f, 1.f };
|
||||
|
||||
unordered_map<_wstring, ID3D11ShaderResourceView*> m_mapGlobalSRV = {};
|
||||
ID3D11DepthStencilState* m_pDSS_OutLineWrite = { nullptr };
|
||||
ID3D11DepthStencilState* m_pPrevDSS = { nullptr };
|
||||
_uint m_iPrevDSSRef = { };
|
||||
|
||||
private:
|
||||
HRESULT Initialize();
|
||||
void Make_Planes(const _float4* pPoints, _float4* pPlanes);
|
||||
@@ -93,7 +103,7 @@ class CPipeLine final : public CBase
|
||||
ID3D11ShaderResourceView* Find_GlobalShaderResourceView(const _tchar* wszKeyGlobalSRV);
|
||||
|
||||
public:
|
||||
static CPipeLine* Create();
|
||||
static CPipeLine* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
virtual void Free() override;
|
||||
#ifdef _DEBUG
|
||||
virtual void Describe_Entity();
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "Navigation.h"
|
||||
#include "RigidBody_Dynamic.h"
|
||||
#include "RigidBody_Static.h"
|
||||
#include "Dynamic_D6Joint.h"
|
||||
#include "Texture.h"
|
||||
#include "Cell.h"
|
||||
#include "Model.h"
|
||||
|
||||
@@ -23,7 +23,7 @@ class CRenderTarget_Manager final : public CBase
|
||||
HRESULT Copy_RenderTargetAToB(const _wstring& strATag, const _wstring& strBTag);
|
||||
HRESULT Bind_CS_RenderTarget(_uint iIndex, const _wstring& strTargetTag);
|
||||
HRESULT Clear_RenderTarget(const _wstring& strRenderTargetKey);
|
||||
|
||||
ID3D11ShaderResourceView* Get_RenderTarget_SRV(const _wstring& strRenderTargetKey);
|
||||
// 두 랜더타겟을 하나로 모음
|
||||
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로 다시 맞춤
|
||||
|
||||
@@ -39,6 +39,8 @@ class ENGINE_DLL CRigidBody abstract : public CComponent
|
||||
PSX::PxShapeFlags Get_ShapeFlags() const { return m_ePxShapeFlags; }
|
||||
PSX::PxRigidBodyFlags Get_RigidBodyFlags() const { return m_ePxRigidBodyFlags; }
|
||||
|
||||
PHYSX_USERDATA* Get_UserDataPtr() { return &m_tagData; };
|
||||
|
||||
protected:
|
||||
ACTOR m_eActorType = ACTOR::END;
|
||||
PSX::PxRigidBodyFlags m_ePxRigidBodyFlags = { };
|
||||
@@ -49,7 +51,7 @@ class ENGINE_DLL CRigidBody abstract : public CComponent
|
||||
_float3 m_vLocalTranslation = { 0.f, 0.f, 0.f };
|
||||
|
||||
CTransform* m_pTransform = { nullptr };
|
||||
PhsXUserData m_tagData = {};
|
||||
PHYSX_USERDATA m_tagData = {};
|
||||
|
||||
protected:
|
||||
virtual HRESULT Initialize(void* pArg);
|
||||
|
||||
@@ -19,7 +19,7 @@ class ENGINE_DLL CRigidBody_Dynamic : public CRigidBody
|
||||
|
||||
typedef struct tagRigidBody_DYNAMIC_Desc : public CRigidBody::RIGIDBODY_DESC
|
||||
{
|
||||
|
||||
_bool bAutoOwnerTranslation = true;
|
||||
}RIGIDBODY_DYNAMIC_DESC;
|
||||
|
||||
private:
|
||||
@@ -31,18 +31,27 @@ class ENGINE_DLL CRigidBody_Dynamic : public CRigidBody
|
||||
#ifdef _DEBUG
|
||||
_float3 Get_LocalTranslation() {return m_vLocalTranslation; }
|
||||
virtual HRESULT Render()override;
|
||||
HRESULT Render(function<void()> custumState);
|
||||
#endif // _DEBUG
|
||||
|
||||
virtual PSX::PxRigidDynamic* Get_Actor() override { return m_pRigidBody; };
|
||||
void Set_Name(const _char* szName);
|
||||
_float3 Get_HalfGeometryInfo() const { return m_vhalfGeometryInfo; }
|
||||
void Set_HalfGeometryInfo(_float3 vhalfGeometryInfo);
|
||||
void Move_LocalPos(_float4 vNewRotQ, _float3 vNewTranslation);
|
||||
|
||||
|
||||
void Move_LocalPos(_matrix newLocalPos);// 캡슐은 이 함수 쓸 거면 말하고 써야함
|
||||
void Move_LocalPos(_fvector vNewRotQ, _gvector vNewTranslation);// 캡슐은 이 함수 쓸 거면 말하고 써야함
|
||||
void Move_LocalPos(_float4& vNewRotQ, _float3& vNewTranslation);// 캡슐은 이 함수 쓸 거면 말하고 써야함
|
||||
_float Get_Density() const { return m_fDensity; }
|
||||
_float Get_Mass();
|
||||
|
||||
virtual void Add_Force(_fvector vForce, PSX::PxForceMode::Enum eType = PSX::PxForceMode::Enum::eFORCE); // 속도 + 방향
|
||||
virtual void Add_Torque(_fvector vDirection, PSX::PxForceMode::Enum eType = PSX::PxForceMode::Enum::eFORCE); // 방향 ( 회전축은 MassCenter )
|
||||
void Set_Kinematic(_bool bKinematic);
|
||||
void Move_Kinematic(_fmatrix xmTransform, _bool bTeleport = true);
|
||||
void Move_Kinematic(_fvector vPos, _gvector vRotq, _bool bTeleport = true);
|
||||
void Move_Kinematic(PSX::PxTransform& pxDestination, _bool bTeleport = true);
|
||||
|
||||
HRESULT ConvertToCCT(class CCharacter_Controller& CCTOriginal);
|
||||
void Detach_Actor(_uint iLevel);
|
||||
@@ -50,12 +59,20 @@ class ENGINE_DLL CRigidBody_Dynamic : public CRigidBody
|
||||
void SetActive(_bool bCondition) { m_bActive = bCondition; }
|
||||
|
||||
_vector Get_Position();
|
||||
void Set_Position(_vector vPos);
|
||||
void Set_Rotation(_vector vRotQ);
|
||||
void Set_Transform(_vector vPos, _vector vRotQ);
|
||||
void Set_Transform(PSX::PxTransform pxTransform);
|
||||
void Set_Position(_vector vPos, _bool bTeleport);
|
||||
void Set_Rotation(_vector vRotQ, _bool bTeleport);
|
||||
void Set_AutoOwnerTranlation(_bool bAutoOwnerTranslation) { m_tagData.bAutoOwnerTranslation = bAutoOwnerTranslation; };
|
||||
_bool Get_AutoOwnerTranlation() { return m_tagData.bAutoOwnerTranslation; };
|
||||
|
||||
void Set_Transform(_matrix WorldMatrix, _bool bTeleport);
|
||||
void Set_Transform(_vector vPos, _vector vRotQ, _bool bTeleport);
|
||||
void Set_Transform(PSX::PxTransform pxTransform, _bool bTeleport);
|
||||
|
||||
void Set_CenterTransform(_vector vStart, _vector vEnd, _bool bTeleport);
|
||||
_float3 Get_FootPosition();
|
||||
_float3 Get_HeadPosition();
|
||||
PSX::PxTransform Get_GlobalPosition();
|
||||
PSX::PxTransform Get_HeadPositionPxTransform();
|
||||
PSX::PxTransform Get_FootPositionPxTransform();
|
||||
private:
|
||||
PSX::PxRigidDynamic* m_pRigidBody = { nullptr }; // 실제 시뮬레이션을 도는 본체
|
||||
@@ -75,6 +92,7 @@ class ENGINE_DLL CRigidBody_Dynamic : public CRigidBody
|
||||
private:
|
||||
HRESULT Initialize_Prototype(RIGIDBODY_PROTOTYPE_DYNAMIC_DESC& Desc);
|
||||
virtual HRESULT Initialize(void* pArg) override;
|
||||
// void Move(PSX::PxTransform& pxTransform, _bool bTeleport);
|
||||
|
||||
#ifdef _DEBUG
|
||||
HRESULT Add_DebugShape();
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
#pragma once
|
||||
class CDynamic_Joint
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
@@ -26,7 +26,7 @@ enum ESTATE
|
||||
BROOM_IDLE,BROOM_FWD,BROOM_LEFT,BROOM_RIGHT,BROOM_DOWN,BROOM_UP, BROOM_REVELIO, BROOM_HOVER_IDLE, BROOM_HOVER_FWD, BROOM_HOVER_LEFT, BROOM_HOVER_RIGHT, BROOM_HOVER_START, BROOM_HOVER_REVELIO,BROOM_MOUNT, BROOM_MOUNT_END,BROOM_DISMOUNT,BROOM_TURBO_FWD, BROOM_TURBO_DOWN, BROOM_TURBO_UP, BROOM_TURBO_LEFT, BROOM_TURBO_RIGHT,
|
||||
RUSH_START,RUSH_LOOP,RUSH_END,
|
||||
THROW_ROCK_START,THROW_ROCK,
|
||||
BACKHAND_SWING_JOG,SWING_FWD,SLAM,
|
||||
BACKHAND_SWING_JOG,SWING_FWD,SLAM,SLASH,DASH,
|
||||
SUSTAIN_START,SUSTAIN_LOOP,SUSTAIN_END,
|
||||
BLINK,BLINK_START,
|
||||
HIT, HIT_FWD, HIT_BWD, HIT_BWD2, HIT_BWD3, HIT_BWD4, HIT_L, HIT_R,HIT_FACE,HIT_FACE_END,HIT_LEVIOSO,INCARCEROUS,
|
||||
|
||||
@@ -27,12 +27,22 @@ class CVolumetric final : public CBase
|
||||
_float4x4 InvProjMatrix;
|
||||
_float4x4 InvViewMatrix;
|
||||
|
||||
_float4x4 ShadowViewMatrix;
|
||||
_float4x4 ShadowViewProjMatrix;
|
||||
|
||||
_float fAsymmetryParameter;
|
||||
_float padding0;
|
||||
_float padding1;
|
||||
_float padding2;
|
||||
_uint iNumLight;
|
||||
_float fHeightOffset;
|
||||
_float fBaseHeight;
|
||||
}CS_VOLUME_CONSTANT_DESC;
|
||||
|
||||
typedef struct tagCSLightDesc
|
||||
{
|
||||
_float3 vDirection;
|
||||
_float fRange;
|
||||
_float4 vPosition;
|
||||
_float4 vDiffuse;
|
||||
}CS_LIGHT_DESC;
|
||||
|
||||
private:
|
||||
CVolumetric(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
@@ -46,7 +56,7 @@ class CVolumetric final : public CBase
|
||||
HRESULT Dispatch();
|
||||
|
||||
ID3D11ShaderResourceView* Get_VolumeSRV() { return m_pAccVolumeSRV; }
|
||||
_float* Get_DepthPackExponentPtr() { return &m_fDepthPackExponent; }
|
||||
_float* Get_DepthPackExponentPtr() { return &m_fDepthPackExponent; }
|
||||
|
||||
void Setting_Volumetirc(_float fDensity , _float fLightIntensity, _float fAsymmetryParameter , _float fDepthPackExponent);
|
||||
private:
|
||||
@@ -56,6 +66,8 @@ class CVolumetric final : public CBase
|
||||
ID3D11Texture3D* m_pTexture3D = { nullptr };
|
||||
ID3D11Texture3D* m_pAccumulateTexture3D = { nullptr };
|
||||
|
||||
ID3D11ShaderResourceView* m_pNoiseTexture = { nullptr };
|
||||
|
||||
ID3D11ShaderResourceView* m_pVolumeSRV = {nullptr};
|
||||
ID3D11UnorderedAccessView* m_pVolumeUAV = { nullptr };
|
||||
|
||||
@@ -64,6 +76,7 @@ class CVolumetric final : public CBase
|
||||
|
||||
ID3D11Buffer* m_pConstantBuffer = { nullptr };
|
||||
ID3D11Buffer* m_pLightInfoBuffer = { nullptr };
|
||||
ID3D11ShaderResourceView* m_pLightInfoSRV = { nullptr };
|
||||
|
||||
ID3D11ComputeShader* m_pCSVolumeCalculate = { nullptr };
|
||||
ID3DBlob* m_pCSBlobCalculate = { nullptr };
|
||||
@@ -71,10 +84,19 @@ class CVolumetric final : public CBase
|
||||
ID3D11ComputeShader* m_pCSVolumeAccumulate = { nullptr };
|
||||
ID3DBlob* m_pCSBlobAccumulate = { nullptr };
|
||||
|
||||
_float m_fDensity = { 0.5f };
|
||||
_float m_fLightIntensity = { 1.f };
|
||||
_float m_fAsymmetryParameter = { 0.2f };
|
||||
_float m_fDepthPackExponent = { 2.f };
|
||||
ID3D11SamplerState* m_pSamplerState = { nullptr };
|
||||
|
||||
_float m_fDensity = { 0.953f }; // 밀도
|
||||
_float m_fLightIntensity = { 0.01f }; // 광원 강도
|
||||
_float m_fAsymmetryParameter = { 0.5344f }; // 이방성 계수 값이 클 수록 들어오는 방향으로 나가는 빛의 양이 많아짐
|
||||
_float m_fDepthPackExponent = { 1.f }; // 깊이 비선형 분포 지수
|
||||
_float m_fHieghtOffset = { 0.f };
|
||||
_float m_fBaseHeight = { 0.f };
|
||||
_uint m_iNumLights = { 1 };
|
||||
_uint m_iMaxNumLights = { 20 };
|
||||
|
||||
_float4x4 m_ShadowViewMatrix = {};
|
||||
_float4x4 m_ShadowViewProjMatrix = {};
|
||||
|
||||
#ifdef _DEBUG
|
||||
class CRenderEventDebugger m_AnnotationHelper = {};
|
||||
@@ -87,6 +109,7 @@ class CVolumetric final : public CBase
|
||||
HRESULT CreateBlob();
|
||||
HRESULT CreateBuffers();
|
||||
HRESULT CreateResourceViews();
|
||||
HRESULT Create_SamplerState();
|
||||
|
||||
public:
|
||||
static CVolumetric* Create(ID3D11Device* pDevice, ID3D11DeviceContext* pContext);
|
||||
|
||||
@@ -79,9 +79,9 @@ using namespace FMOD;
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable: 26495)
|
||||
#pragma warning(disable: 33010)
|
||||
|
||||
#include "PhysX/PxPhysics.h"
|
||||
#include "PhysX/foundation/PxMath.h"
|
||||
#include "PhysX/PxPhysicsAPI.h"
|
||||
#include "PhysX/extensions/PxExtensionsAPI.h"
|
||||
#pragma warning(pop)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user