[Fix] 망토

This commit is contained in:
hyunbin14
2025-12-31 22:30:03 +09:00
parent c75f549b64
commit f60d211051
12 changed files with 260 additions and 40 deletions
@@ -40,6 +40,7 @@ void CLevel_Loading::Update(_float fTimeDelta)
{
#ifdef _DEBUG
#ifdef 기무리
#elif Bin
m_bNextLevel = true;
#endif // 기무리
#endif // _DEBUG
@@ -28,6 +28,7 @@ void CLevel_Logo::Update(_float fTimeDelta)
{
#ifdef _DEBUG
#ifdef 기무리
#elif Bin
m_pGameInstance->Set_LevelToChange();
#endif // 기무리
#endif // _DEBUG
+99 -2
View File
@@ -17,6 +17,7 @@
#include "PlayerRobe.h"
#include "RaceRing.h"
#include "Wand.h"
#include "Mesh.h"
CPlayer::CPlayer(ID3D11Device* pDevice, ID3D11DeviceContext* pContext)
: CUnit(pDevice, pContext)
@@ -220,6 +221,7 @@ void CPlayer::Late_Update(_float fTimeDelta)
////////////////////////////////////////////////////////////////////////////
#ifdef 기무리
#else Bin
if (nullptr == m_pRobePart) {
{
CPlayerRobe::PlayerRobe_DESC Desc{};
@@ -251,6 +253,9 @@ HRESULT CPlayer::Render()
for (_uint i = 0; i < iNumMeshes; i++)
{
if (PLAYER_MESH_ORDER::LOWER == (PLAYER_MESH_ORDER)i) {
continue;
}
if (FAILED(m_pModelCom->Bind_Material(i, m_pShaderCom))) {
return E_FAIL;
}
@@ -261,7 +266,6 @@ HRESULT CPlayer::Render()
// }
//#endif // 기무리
//#endif // _DEBUG
if (FAILED(m_pShaderCom->Bind_Matrices(
"g_OffsetMatrix",
m_pModelCom->Get_OffsetMatrix(i).data(),
@@ -597,15 +601,108 @@ HRESULT CPlayer::Bind_ShaderParameters(_uint iMeshOrder)
break;
#ifdef _DEBUG
#ifdef 기무리
#elif Bin
case PLAYER_MESH_ORDER::ROBE_CLOTH:
if (FAILED(m_pModelCom->Bind_BoneMatrices(ENUM_CLASS(PLAYER_MESH_ORDER::ROBE_CLOTH), m_pShaderCom, "g_BoneMatrices"))) {
{//if (FAILED(m_pModelCom->Bind_BoneMatrices(ENUM_CLASS(PLAYER_MESH_ORDER::ROBE_CLOTH), m_pShaderCom, "g_BoneMatrices"))) {
// return E_FAIL;
//}
/*for (_int i = 0; i < 256; ++i)
XMStoreFloat4x4(&SkinMatrices[i], XMMatrixIdentity());
vector<_uint> robeIdx = m_pModelCom->Get_BoneMask(ENUM_CLASS(BLEND_BONE::HIPS_CLOTH));
Temp = 0;
for (_int i = 0; i < robeIdx.size(); ++i)
{
if (i == 38)
continue;
if (robeIdx[i] == 1)
{
SkinMatrices[i] = m_pRobePart->Get_RobeJointAnchorMatrix(Temp);
Temp++;
}
}
auto globalMask = m_pModelCom->Get_BoneMask(ENUM_CLASS(BLEND_BONE::HIPS_CLOTH));
array<_uint, 256> paletteMask{};
paletteMask.fill(0);
for (_int palette = 0; palette < m_pModelCom->Get_Mesh(ENUM_CLASS(PLAYER_MESH_ORDER::ROBE_CLOTH))->Get_NumBone(); ++palette)
{
_uint global = m_pModelCom->Get_Mesh(ENUM_CLASS(PLAYER_MESH_ORDER::ROBE_CLOTH))->Get_BoneIndices()[palette];
paletteMask[palette] = globalMask[global];
}*/
auto pMesh = m_pModelCom->Get_Mesh(ENUM_CLASS(PLAYER_MESH_ORDER::ROBE_CLOTH));
_uint paletteCount = pMesh->Get_NumBone();
for (_uint p = 0; p < paletteCount; ++p)
{
XMStoreFloat4x4(& SkinMatrices[p] ,XMMatrixIdentity());
}
_uint temp = 0;
auto globalMask = m_pModelCom->Get_BoneMask(ENUM_CLASS(BLEND_BONE::HIPS_CLOTH));
vector<_int> boneIndices = pMesh->Get_BoneIndices();
for (_uint p = 0; p < paletteCount; ++p)
{
_uint global = boneIndices[p];
//if (global == 38)
// continue;
if (globalMask[global] == 1)
{
SkinMatrices[p] =
m_pRobePart->Get_RobeJointAnchorMatrix(temp++);
}
}
array<_int, 256> paletteMask{};
paletteMask.fill(0);
for (_uint p = 0; p < paletteCount; ++p)
{
_uint global = boneIndices[p];
paletteMask[p] = globalMask[global];
}
m_pShaderCom->Bind_IntArray("g_RobeBoneMask", paletteMask.data(), 256);
// Bind_Matrices("g_BoneMatrices", SkinMatrices.data(), 256);
/* if (FAILED(m_pShaderCom->Bind_RawValue(
"g_RobeBoneMask",
robeIdx.data(),
sizeof(_uint) *(_int)robeIdx.size()
)))
{
return E_FAIL;
}*/
if (FAILED(m_pShaderCom->Bind_Matrices(
"g_BoneMatrices",
SkinMatrices.data(),
(_int)SkinMatrices.size()
)))
{
return E_FAIL;
}
if (nullptr != m_pRobePart) {
if (FAILED(m_pRobePart->Bind_PrevBoneMatrices(m_pShaderCom, "g_PrevBoneMatrices"))) {
return E_FAIL;
}
}
}
break;
#endif
#endif // _DEBUG
+18 -12
View File
@@ -20,7 +20,7 @@ void CPlayerRobe::Update(_float fTimeDelta)
_matrix SocketMatrixFixed = (XMMatrixRotationZ(XM_PI) * XMLoadFloat4x4(m_pSocketMatrix)) *
XMLoadFloat4x4(m_pParentTransformCom->Get_WorldMatrixPtr());
m_pRobeMainAnchor->Move_Kinematic(SocketMatrixFixed, false);
m_pRobeMainAnchor->Move_Kinematic(SocketMatrixFixed, true);
m_pRobeMainAnchor->Get_Actor()->wakeUp();
Update_LegsPosition();
@@ -30,13 +30,13 @@ void CPlayerRobe::Update(_float fTimeDelta)
void CPlayerRobe::Late_Update(_float fTimeDelta)
{
#ifdef _DEBUG
for (_uint i = 0; i < ENUM_CLASS(PLAYER_JOINT_ORDER::END); ++i) {
PSX::PxConstraintFlags pxConstraintFlags = m_pDynamicJoints[i]->getConstraintFlags();
const bool bBroken = (pxConstraintFlags.isSet(PSX::PxConstraintFlag::eBROKEN));
if (true == bBroken) {
assert(false);
}
}
//for (_uint i = 0; i < ENUM_CLASS(PLAYER_JOINT_ORDER::END); ++i) {
// PSX::PxConstraintFlags pxConstraintFlags = m_pDynamicJoints[i]->getConstraintFlags();
// const bool bBroken = (pxConstraintFlags.isSet(PSX::PxConstraintFlag::eBROKEN));
// if (true == bBroken) {
// assert(false);
// }
//}
m_pGameInstance->Add_RenderGroup(RENDER::NONLIGHT, this);
#endif // _DEBUG
}
@@ -52,13 +52,14 @@ HRESULT CPlayerRobe::Render()
HRESULT CPlayerRobe::Update_RobeSocketPosition()
{
{
PSX::PxTransform pxTransform = {};
_matrix WorldMatrix = {};
PSX::PxTransform pxTransform = m_pRobeJointAnchor[ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::HIPS_CLOTH)]->Get_GlobalPosition();
_matrix WorldMatrix = XMMatrixAffineTransformation(XMVectorSet(1.f, 1.f, 1.f, 0.f), XMVectorZero(), XMLoadFloat4((_float4*)&pxTransform.q), XMVectorSetW(XMLoadFloat3((_float3*)&pxTransform.p), 1.f));
_matrix OwnerInvWorldMatrix = m_pParentTransformCom->Get_WorldMatrixInv();
for (_uint i = 0; i < ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END); ++i) {
m_pModelCom->Set_BoneCombinedTransformation(PLAYER_JOINT_BONE_NAMES[ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::HIPS_CLOTH)], WorldMatrix * OwnerInvWorldMatrix);
for (_uint i = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::RIGHTUP); i < ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END); ++i) {
pxTransform = m_pRobeJointAnchor[i]->Get_GlobalPosition();
WorldMatrix = XMMatrixAffineTransformation(XMVectorSet(1.f, 1.f, 1.f, 0.f), XMVectorZero(), XMLoadFloat4((_float4*)&pxTransform.q), XMVectorSetW(XMLoadFloat3((_float3*)&pxTransform.p), 1.f));
_fmatrix LocalMatrix = WorldMatrix* OwnerInvWorldMatrix;
_fmatrix LocalMatrix = WorldMatrix * OwnerInvWorldMatrix;
XMStoreFloat4x4(&m_ReconstructedJointAnchorMatirces[i], LocalMatrix);
m_pModelCom->Set_BoneCombinedTransformation(PLAYER_JOINT_BONE_NAMES[i], LocalMatrix);
}
@@ -504,6 +505,8 @@ HRESULT CPlayerRobe::Initialize(void* pArg)
m_pSocketMatrix = pDesc->pSocketMatrix;
m_pModelCom = pDesc->pModel;
m_ReconstructedJointAnchorMatirces.resize(ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END));
m_iBoneNum = m_pModelCom->Get_MeshInfluencedBoneNum(ENUM_CLASS(PLAYER_MESH_ORDER::ROBE_CLOTH));
m_PrevRobeBoneMatrices.resize(m_iBoneNum);
if (FAILED(m_pModelCom->Capture_BoneMatrices(ENUM_CLASS(PLAYER_MESH_ORDER::ROBE_CLOTH), m_PrevRobeBoneMatrices))) {
@@ -534,6 +537,9 @@ HRESULT CPlayerRobe::Initialize(void* pArg)
switch ((PLAYER_JOINT_BONE_ORDER)i)
{
case PLAYER_JOINT_BONE_ORDER::HIPS_CLOTH:
iParentIndex = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::HIPS_CLOTH);
break;
case PLAYER_JOINT_BONE_ORDER::RIGHTUP:
case PLAYER_JOINT_BONE_ORDER::TAILUP:
case PLAYER_JOINT_BONE_ORDER::LEFTUP:
+2 -1
View File
@@ -155,7 +155,8 @@ class CPlayer final : public CUnit
_float m_fabsDir = 0.f;
_float m_fNoInputTime = 0.f;
_float m_fNeutralTime = 0.f;
array<_float4x4, 256> SkinMatrices;
_int Temp = {0};
/* 무적 불 변수*/
#ifdef _DEBUG
+4 -1
View File
@@ -34,6 +34,8 @@ class CPlayerRobe final : public CPartObject
virtual HRESULT Render() override;
HRESULT Update_RobeSocketPosition();
HRESULT Bind_PrevBoneMatrices(CShader* pShader, const _char* pConstant);
vector<_float4x4> Get_RobeJointAnchorMatrix() const { return m_ReconstructedJointAnchorMatirces; }
_float4x4 Get_RobeJointAnchorMatrix(_uint iIndex) const { return m_ReconstructedJointAnchorMatirces[iIndex]; }
private:
_float4x4 m_PreTransformMatrix = { };
const _float4x4* m_pSocketMatrix = { nullptr };
@@ -42,7 +44,8 @@ class CPlayerRobe final : public CPartObject
const _float4x4* m_pRightFootLocalMatrix = { nullptr };
const _float4x4* m_pRightLegLocalMatrix = { nullptr };
const _float4x4* m_RobeJointAnchorMatrices[ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END)] = { nullptr };
_float4x4 m_ReconstructedJointAnchorMatirces[ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END)] = { };
vector<_float4x4> m_ReconstructedJointAnchorMatirces = { };
//_float4x4 m_ReconstructedJointAnchorMatirces[ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END)] = { };
CModel* m_pModelCom = { nullptr };
_int m_iBoneNum = -1;
+15 -11
View File
@@ -23,26 +23,30 @@ enum class PLAYER_MESH_ORDER {
END
};
static const _char* PLAYER_JOINT_BONE_NAMES[12] = {
"RightUpLeg_Cloth"
, "TailUp_Cloth"
, "LeftUpLeg_Cloth"
static const _char* PLAYER_JOINT_BONE_NAMES[13] = {
"Hips_Cloth"
, "RightUpLeg_Cloth"
, "RightLeg_Cloth"
, "Tail_Cloth"
, "LeftLeg_Cloth"
, "RightDownLeg_Cloth"
, "RightDownRightLeg_Cloth"
, "LeftUpLeg_Cloth"
, "LeftLeg_Cloth"
, "LeftDownLeg_Cloth"
, "LeftDownLeftLeg_Cloth"
, "TailUp_Cloth"
, "Tail_Cloth"
, "TailLeftDown_Cloth"
, "TailRightDown_Cloth"
, "TailLeftDown_Cloth"
, "LeftDownLeftLeg_Cloth"
, "LeftDownLeg_Cloth"
};
enum class PLAYER_JOINT_BONE_ORDER {
RIGHTUP
HIPS_CLOTH
, RIGHTUP
, RIGHT
, RIGHTDOWN
, RIGHTDOWNRIGHT
@@ -74,6 +74,7 @@ Texture2D g_DeadDisolveBurnTexture;
int g_iBinded_Texture[27];
matrix g_BoneMatrices[256];
matrix g_PrevBoneMatrices[256];
int g_RobeBoneMask[256];
struct VS_IN_MESH
{
@@ -185,21 +186,113 @@ VS_OUT VS_MAIN(VS_IN In)
VS_OUT VS_MAIN_LEGACY(VS_IN In)
{
VS_OUT Out = (VS_OUT)0;
// VS_OUT Out = (VS_OUT)0;
// float4 w = In.vBlendWeight;
// float sumW = max(dot(w, 1.0f), 1e-6f);
// w /= sumW;
// matrix BoneMatrix = (matrix)0;
// matrix TempBoneMatrix = (matrix) 0;
// int iLeftHand = 29;
// int iRightHand = 41;
// if (In.vBlendIndex.x >= iLeftHand && In.vBlendIndex.x <= iRightHand)
// {
// TempBoneMatrix += mul(g_OffsetMatrix[In.vBlendIndex.x],
// mul(g_BoneMatrices[In.vBlendIndex.x], w.x));
// }
// else
// {
// TempBoneMatrix += mul(g_OffsetMatrix[In.vBlendIndex.x],
// mul(g_BoneBuffer[In.vBlendIndex.x].LocalCombined, w.x));
// }
// if (In.vBlendIndex.y >= iLeftHand && In.vBlendIndex.y <= iRightHand)
// {
// TempBoneMatrix += mul(g_OffsetMatrix[In.vBlendIndex.y],
// mul(g_BoneMatrices[In.vBlendIndex.y], w.y));
// }
// else
// {
// TempBoneMatrix += mul(g_OffsetMatrix[In.vBlendIndex.y],
// mul(g_BoneBuffer[In.vBlendIndex.y].LocalCombined, w.y));
// }
// if (In.vBlendIndex.z >= iLeftHand && In.vBlendIndex.z <= iRightHand)
// {
// TempBoneMatrix += mul(g_OffsetMatrix[In.vBlendIndex.z],
// mul(g_BoneMatrices[In.vBlendIndex.z], w.z));
// }
// else
// {
// TempBoneMatrix += mul(g_OffsetMatrix[In.vBlendIndex.z],
// mul(g_BoneBuffer[In.vBlendIndex.z].LocalCombined, w.z));
// }
// if (In.vBlendIndex.w >= iLeftHand && In.vBlendIndex.w <= iRightHand)
// {
// TempBoneMatrix += mul(g_OffsetMatrix[In.vBlendIndex.w],
// mul(g_BoneMatrices[In.vBlendIndex.w], w.w));
// }
// else
// {
// TempBoneMatrix += mul(g_OffsetMatrix[In.vBlendIndex.w],
// mul(g_BoneBuffer[In.vBlendIndex.w].LocalCombined, w.w));
// }
// BoneMatrix = TempBoneMatrix;
//// BoneMatrix =
//// mul(g_OffsetMatrix[In.vBlendIndex.x],
//// mul(g_BoneBuffer[In.vBlendIndex.x].LocalCombined, w.x));
//// +mul(g_OffsetMatrix[In.vBlendIndex.y],
//// mul(g_BoneBuffer[In.vBlendIndex.y].LocalCombined, w.y))
//// + mul(g_OffsetMatrix[In.vBlendIndex.z],
//// mul(g_BoneBuffer[In.vBlendIndex.z].LocalCombined, w.z))
//// + mul(g_OffsetMatrix[In.vBlendIndex.w],
//// mul(g_BoneBuffer[In.vBlendIndex.w].LocalCombined, w.w));
////BoneMatrix =
//// mul(g_OffsetMatrix[In.vBlendIndex.x],
//// mul(g_BoneMatrices[In.vBlendIndex.x], w.x))
//// + mul(g_OffsetMatrix[In.vBlendIndex.y],
//// mul(g_BoneMatrices[In.vBlendIndex.y], w.y))
//// + mul(g_OffsetMatrix[In.vBlendIndex.z],
//// mul(g_BoneMatrices[In.vBlendIndex.z], w.z))
//// + mul(g_OffsetMatrix[In.vBlendIndex.w],
//// mul(g_BoneMatrices[In.vBlendIndex.w], w.w));
VS_OUT Out = (VS_OUT) 0;
float4 w = In.vBlendWeight;
float sumW = max(dot(w, 1.0f), 1e-6f);
w /= sumW;
matrix BoneMatrix =
mul(g_OffsetMatrix[In.vBlendIndex.x],
mul(g_BoneMatrices[In.vBlendIndex.x], w.x))
+ mul(g_OffsetMatrix[In.vBlendIndex.y],
mul(g_BoneMatrices[In.vBlendIndex.y], w.y))
+ mul(g_OffsetMatrix[In.vBlendIndex.z],
mul(g_BoneMatrices[In.vBlendIndex.z], w.z))
+ mul(g_OffsetMatrix[In.vBlendIndex.w],
mul(g_BoneMatrices[In.vBlendIndex.w], w.w));
uint4 idx = In.vBlendIndex;
float robeWeight =
g_RobeBoneMask[idx.x] * w.x
+ g_RobeBoneMask[idx.y] * w.y
+ g_RobeBoneMask[idx.z] * w.z
+ g_RobeBoneMask[idx.w] * w.w;
bool isRobe = robeWeight > 0.6f;
matrix BoneMatrix = (matrix) 0;
if (isRobe)
{
BoneMatrix += w.x * mul(g_OffsetMatrix[idx.x], g_BoneMatrices[idx.x]);
BoneMatrix += w.y * mul(g_OffsetMatrix[idx.y], g_BoneMatrices[idx.y]);
BoneMatrix += w.z * mul(g_OffsetMatrix[idx.z], g_BoneMatrices[idx.z]);
BoneMatrix += w.w * mul(g_OffsetMatrix[idx.w], g_BoneMatrices[idx.w]);
}
else
{
BoneMatrix += w.x * mul(g_OffsetMatrix[idx.x], g_BoneBuffer[idx.x].LocalCombined);
BoneMatrix += w.y * mul(g_OffsetMatrix[idx.y], g_BoneBuffer[idx.y].LocalCombined);
BoneMatrix += w.z * mul(g_OffsetMatrix[idx.z], g_BoneBuffer[idx.z].LocalCombined);
BoneMatrix += w.w * mul(g_OffsetMatrix[idx.w], g_BoneBuffer[idx.w].LocalCombined);
}
matrix PrevBoneMatrix =
mul(g_OffsetMatrix[In.vBlendIndex.x],
@@ -54,11 +54,13 @@ HRESULT CGameInstance::Initialize_Engine(const ENGINE_DESC& EngineDesc, ID3D11De
#ifdef _DEBUG
#ifdef 기무리
m_pThreadHolder = CThreadHolder::Create(12);
#endif // 기무리
#ifndef 기무리
#elif Bin
m_pThreadHolder = CThreadHolder::Create(12);
#else
m_pThreadHolder = CThreadHolder::Create(6);
#endif // !기무리
#endif //
#endif // _DEBUG
#ifndef _DEBUG
m_pThreadHolder = CThreadHolder::Create(12);
#endif // !_DEBUG
@@ -187,8 +187,16 @@ PSX::PxD6Joint* CPhysX_Manager::Create_PxD6Joint(PSX::PxRigidDynamic* pActor0, P
PSX::PxD6Joint* pJoint = PSX::PxD6JointCreate(*m_pPhysics, pActor0, pxLocalParentPOs, pActor1, pxLocalChildPos);
#ifdef 기무리
pActor0->setSolverIterationCounts(8, 2);
pActor1->setSolverIterationCounts(8, 2);
#elif Bin
pActor0->setSolverIterationCounts(8, 2);
pActor1->setSolverIterationCounts(8, 2);
#else
pActor0->setSolverIterationCounts(4, 1);
pActor1->setSolverIterationCounts(4, 1);
#endif // 기무리
pJoint->setMotion(PSX::PxD6Axis::eX, PSX::PxD6Motion::eLOCKED);
pJoint->setMotion(PSX::PxD6Axis::eY, PSX::PxD6Motion::eLOCKED);
@@ -755,6 +763,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());
+1
View File
@@ -23,6 +23,7 @@ class ENGINE_DLL CMesh final : public CVIBuffer
HRESULT Bind_BoneMatrices(_float4x4* pCombinedMatrices, class CShader* pShader, const _char* pConstantName);
HRESULT Render_Indexed(_uint IndexCount, _uint StartIndexLocation, _uint BaseVertexLocation);
HRESULT Copy_BoneMatrices(vector<_float4x4>& pDestination);
vector<_int> Get_BoneIndices() { return m_BoneIndices; }
#ifdef EDITOR_PROJECT
private:
virtual HRESULT Initialize_Prototype(MODEL eType, vector<class CBone*>& Bones, const aiMesh* pAIMesh, _fmatrix& PreTransformMatrix);
+2
View File
@@ -65,6 +65,7 @@ class ENGINE_DLL CModel final : public CComponent
void Set_HeadAimWeight(_float fWeight) { m_fHeadAimWeight = fWeight; }
_bool Get_PlayHeadBone() const { return m_bHeadBone; }
_int Get_SkipBoneIndex(_int Index) { return m_SkipBoneindex[Index]; }
vector<_uint> Get_BoneMask(_int iIndex){ return m_BoneMask[iIndex]; }
#pragma endregion
#pragma region Animation
_bool Play_Animation(_float fTimeDelta, class CTransform* pTransform = nullptr); // 애니메이션에 델타타임을 넣어줌
@@ -105,6 +106,7 @@ class ENGINE_DLL CModel final : public CComponent
void Apply_CPU_HeadAim();
void Apply_CPUMask_ToBones();
void Mark_CPUChain(_int boneIdx);
class CMesh* Get_Mesh(_uint iIndex) { return m_Meshes[iIndex]; }
#pragma endregion
#pragma region Bone
const _float4x4* Get_BoneMatrixPtr(const _char* pBoneName);