From ea9717a6b42e183e730a9750d38f26fbb7a932d1 Mon Sep 17 00:00:00 2001 From: hyunbin14 Date: Thu, 1 Jan 2026 11:34:06 +0900 Subject: [PATCH] [fix] --- .../Client/Private/Goblin_Assassin.cpp | 3 + .../Client/Private/Goblin_Assassin_States.cpp | 64 +++---- Jusin154_Team3D/Client/Private/Player.cpp | 44 ++--- .../Client/Public/Goblin_Assassin.h | 1 + Jusin154_Team3D/Client/Public/Player.h | 1 - .../Data/AnimIndex/Goblin_Assassin.xml | 106 +++++++++++ .../ShaderFiles/Shader_NPC_PBR_Anim.hlsl | 167 ++++++++---------- Jusin154_Team3D/Engine/Private/Model.cpp | 2 +- 8 files changed, 220 insertions(+), 168 deletions(-) create mode 100644 Jusin154_Team3D/Editor/Bin/Resources/Data/AnimIndex/Goblin_Assassin.xml diff --git a/Jusin154_Team3D/Client/Private/Goblin_Assassin.cpp b/Jusin154_Team3D/Client/Private/Goblin_Assassin.cpp index 8fee914de..8c2030040 100644 --- a/Jusin154_Team3D/Client/Private/Goblin_Assassin.cpp +++ b/Jusin154_Team3D/Client/Private/Goblin_Assassin.cpp @@ -42,6 +42,9 @@ HRESULT CGoblin_Assassin::Initialize(void* pArg) Add_FSM(); + //Load_AnimXML("../Bin/Resources/Data/AnimIndex/Goblin_Assassin.xml"); + + Set_Anim(); { diff --git a/Jusin154_Team3D/Client/Private/Goblin_Assassin_States.cpp b/Jusin154_Team3D/Client/Private/Goblin_Assassin_States.cpp index d233fe7a6..e64e58746 100644 --- a/Jusin154_Team3D/Client/Private/Goblin_Assassin_States.cpp +++ b/Jusin154_Team3D/Client/Private/Goblin_Assassin_States.cpp @@ -944,6 +944,26 @@ void CGoblin_Assassin::Add_FSM() } +// +//void CGoblin_Assassin::Load_AnimXML(const string& path) +//{ +// tinyxml2::XMLDocument doc; +// doc.LoadFile(path.c_str()); +// +// tinyxml2::XMLElement* root = doc.FirstChildElement("Animations"); +// for (tinyxml2::XMLElement* elem = root->FirstChildElement("Anim"); +// elem; elem = elem->NextSiblingElement("Anim")) +// { +// const char* stateStr = elem->Attribute("state"); +// _int index = elem->IntAttribute("index"); +// _bool loop = elem->BoolAttribute("loop"); +// +// STATEANIM::ESTATE state = StringToStateAnim(stateStr); +// m_Animation[state] = { index, loop }; +// } +//} + + void CGoblin_Assassin::Set_Anim() { m_Animation[STATEANIM::IDLE] = { 22,true }; @@ -1035,48 +1055,4 @@ void CGoblin_Assassin::Set_Anim() m_Animation[STATEANIM::DEAD_L2] = { 322, false }; m_Animation[STATEANIM::DEAD_R] = { 323, false }; m_Animation[STATEANIM::DEAD_R2] = { 324, false }; - - //Tp 426 - // Tp Start 428 - // 76 공격끝 - - - - - - - - - // 걷기 시작 57 - // 걷기 루프 50 - // 뛰기 시작 157 - // 뛰기 루프 45 - // 나이프 던지기 85 - // 도끼 공격 444 - // 도끼 공격 후 76 - // 도끼 찍기 439 - // - - // 텀블링 히트 380 - // 디센도 찍기전 띄우기 371 - // 디센도 찍기 372 - - // 레비오소 피격 381 - // 착지 376 - // - - // Shuffle1 211 - // Shuffle2 215 - // Shuffle3 219 - // Shuffle4 223 - - //Jog 112도 L 148 - //Jog 112도 R 152 - // Jog 90 L 151 - // Jog 90 R 155 - - - // L 394 - // R 395 - // fwd 396 } diff --git a/Jusin154_Team3D/Client/Private/Player.cpp b/Jusin154_Team3D/Client/Private/Player.cpp index 4693889ff..38a9aafb7 100644 --- a/Jusin154_Team3D/Client/Private/Player.cpp +++ b/Jusin154_Team3D/Client/Private/Player.cpp @@ -121,7 +121,7 @@ HRESULT CPlayer::Initialize(void* pArg) m_bAI = false; - XMLoadFloat4x4(m_pBroomModel->Get_BoneMatrixPtr("broomSocket")); + //XMLoadFloat4x4(m_pBroomModel->Get_BoneMatrixPtr("broomSocket")); m_pModelCom->Set_Temp(true); @@ -603,14 +603,11 @@ HRESULT CPlayer::Bind_ShaderParameters(_uint iMeshOrder) #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"))) { - // return E_FAIL; - //} - + { CMesh* pMesh = m_pModelCom->Get_Mesh(ENUM_CLASS(PLAYER_MESH_ORDER::ROBE_CLOTH)); - _uint paletteCount = pMesh->Get_NumBone(); + _uint MeshBoneCount = pMesh->Get_NumBone(); - for (_uint i = 0; i < paletteCount; ++i) + for (_uint i = 0; i < MeshBoneCount; ++i) { XMStoreFloat4x4(&SkinMatrices[i] ,XMMatrixIdentity()); } @@ -619,7 +616,7 @@ HRESULT CPlayer::Bind_ShaderParameters(_uint iMeshOrder) vector<_uint> globalMask = m_pModelCom->Get_BoneMask(ENUM_CLASS(BLEND_BONE::HIPS_CLOTH)); vector<_int> boneIndices = pMesh->Get_BoneIndices(); - for (_uint i = 0; i < paletteCount; ++i) + for (_uint i = 0; i < MeshBoneCount; ++i) { _uint global = boneIndices[i]; if (global == 38) @@ -630,30 +627,19 @@ HRESULT CPlayer::Bind_ShaderParameters(_uint iMeshOrder) } } - array<_int, 256> paletteMask{}; - paletteMask.fill(0); + //array<_int, 256> paletteMask{}; + //paletteMask.fill(0); - for (_uint i = 0; i < paletteCount; ++i) - { - if (i == 29) - continue; - _uint global = boneIndices[i]; - paletteMask[i] = globalMask[global]; - } + //for (_uint i = 0; i < paletteCount; ++i) + //{ + // if (i == 29) + // continue; + // _uint global = boneIndices[i]; + // paletteMask[i] = globalMask[global]; + //} - m_pShaderCom->Bind_IntArray("g_RobeBoneMask", paletteMask.data(), 256); + //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; - }*/ GUI::DragFloat("TempWeight", &m_fTempWeight, 0.01f); if (FAILED(m_pShaderCom->Bind_RawValue("g_TempWeight", &m_fTempWeight, sizeof(_float)))) { diff --git a/Jusin154_Team3D/Client/Public/Goblin_Assassin.h b/Jusin154_Team3D/Client/Public/Goblin_Assassin.h index 3d3a77061..fee0cb5da 100644 --- a/Jusin154_Team3D/Client/Public/Goblin_Assassin.h +++ b/Jusin154_Team3D/Client/Public/Goblin_Assassin.h @@ -79,6 +79,7 @@ class CGoblin_Assassin final : public CMonster private: virtual void Add_FSM(); + void Load_AnimXML(const string& path); virtual void Set_Anim(); _float m_fSkillCoolTime[ENUM_CLASS(GOBLIN_ASSASSIN_SKILL::END)] = {}; diff --git a/Jusin154_Team3D/Client/Public/Player.h b/Jusin154_Team3D/Client/Public/Player.h index 9b4639bc0..6b0b20e27 100644 --- a/Jusin154_Team3D/Client/Public/Player.h +++ b/Jusin154_Team3D/Client/Public/Player.h @@ -164,7 +164,6 @@ class CPlayer final : public CUnit _float m_fNoInputTime = 0.f; _float m_fNeutralTime = 0.f; array<_float4x4, 256> SkinMatrices; - _int Temp = {0}; /* 무적 불 변수*/ #ifdef _DEBUG diff --git a/Jusin154_Team3D/Editor/Bin/Resources/Data/AnimIndex/Goblin_Assassin.xml b/Jusin154_Team3D/Editor/Bin/Resources/Data/AnimIndex/Goblin_Assassin.xml new file mode 100644 index 000000000..f5b58b93d --- /dev/null +++ b/Jusin154_Team3D/Editor/Bin/Resources/Data/AnimIndex/Goblin_Assassin.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl index 6207e7885..3cf4f1966 100644 --- a/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl +++ b/Jusin154_Team3D/Editor/Bin/Resources/ShaderFiles/Shader_NPC_PBR_Anim.hlsl @@ -189,80 +189,6 @@ VS_OUT VS_MAIN(VS_IN In) VS_OUT VS_MAIN_LEGACY(VS_IN In) { - // 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; @@ -270,31 +196,86 @@ VS_OUT VS_MAIN_LEGACY(VS_IN In) w /= sumW; 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 > g_TempWeight; - + matrix BoneMatrix = (matrix) 0; - - if (isRobe) + matrix TempBoneMatrix = (matrix) 0; + + int MinIdx = 30; + int MaxIdx = 41; + + if (idx.x >= MinIdx && idx.x <= MaxIdx) + //g_RobeBoneMask[idx.x] == 1) { - 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]); + TempBoneMatrix += mul(g_OffsetMatrix[In.vBlendIndex.x], + mul(g_BoneMatrices[In.vBlendIndex.x], w.x)); } 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); + TempBoneMatrix += mul(g_OffsetMatrix[In.vBlendIndex.x], + mul(g_BoneBuffer[In.vBlendIndex.x].LocalCombined, w.x)); } + if (idx.y >= MinIdx && idx.y <= MaxIdx) + //if (g_RobeBoneMask[idx.y] == 1) + { + 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 (idx.z >= MinIdx && idx.z <= MaxIdx) + //if (g_RobeBoneMask[idx.z] == 1) + { + 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 (idx.w >= MinIdx && idx.w <= MaxIdx) + //if (g_RobeBoneMask[idx.w] == 1) + { + 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; + + + + //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 > g_TempWeight; + + //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 = diff --git a/Jusin154_Team3D/Engine/Private/Model.cpp b/Jusin154_Team3D/Engine/Private/Model.cpp index c20758651..3d85f02d5 100644 --- a/Jusin154_Team3D/Engine/Private/Model.cpp +++ b/Jusin154_Team3D/Engine/Private/Model.cpp @@ -1506,7 +1506,7 @@ void CModel::Initialize_BoneMasks() { if (m_BoneMask[ENUM_CLASS(BLEND_BONE::HIPS_CLOTH)][i] == 1) { - if (i == 38) + if (i == m_iBoneIndex[ENUM_CLASS(BLEND_BONE::HIPS_CLOTH)]) continue; m_iSkipBoneCount++; m_SkipBoneindex.push_back(i);