diff --git a/Jusin154_Team3D/Client/Private/Player.cpp b/Jusin154_Team3D/Client/Private/Player.cpp index 74ee706e0..4693889ff 100644 --- a/Jusin154_Team3D/Client/Private/Player.cpp +++ b/Jusin154_Team3D/Client/Private/Player.cpp @@ -607,69 +607,38 @@ HRESULT CPlayer::Bind_ShaderParameters(_uint iMeshOrder) // 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)); + CMesh* pMesh = m_pModelCom->Get_Mesh(ENUM_CLASS(PLAYER_MESH_ORDER::ROBE_CLOTH)); _uint paletteCount = pMesh->Get_NumBone(); - for (_uint p = 0; p < paletteCount; ++p) + for (_uint i = 0; i < paletteCount; ++i) { - XMStoreFloat4x4(& SkinMatrices[p] ,XMMatrixIdentity()); + XMStoreFloat4x4(&SkinMatrices[i] ,XMMatrixIdentity()); } _uint temp = 0; - auto globalMask = m_pModelCom->Get_BoneMask(ENUM_CLASS(BLEND_BONE::HIPS_CLOTH)); + vector<_uint> globalMask = m_pModelCom->Get_BoneMask(ENUM_CLASS(BLEND_BONE::HIPS_CLOTH)); vector<_int> boneIndices = pMesh->Get_BoneIndices(); - for (_uint p = 0; p < paletteCount; ++p) + for (_uint i = 0; i < paletteCount; ++i) { - _uint global = boneIndices[p]; - //if (global == 38) - // continue; + _uint global = boneIndices[i]; + if (global == 38) + continue; if (globalMask[global] == 1) { - SkinMatrices[p] = - m_pRobePart->Get_RobeJointAnchorMatrix(temp++); + SkinMatrices[i] = m_pRobePart->Get_RobeJointAnchorMatrix(temp++); } } array<_int, 256> paletteMask{}; paletteMask.fill(0); - for (_uint p = 0; p < paletteCount; ++p) + for (_uint i = 0; i < paletteCount; ++i) { - _uint global = boneIndices[p]; - paletteMask[p] = globalMask[global]; + if (i == 29) + continue; + _uint global = boneIndices[i]; + paletteMask[i] = globalMask[global]; } m_pShaderCom->Bind_IntArray("g_RobeBoneMask", paletteMask.data(), 256); @@ -685,6 +654,11 @@ HRESULT CPlayer::Bind_ShaderParameters(_uint iMeshOrder) { return E_FAIL; }*/ + GUI::DragFloat("TempWeight", &m_fTempWeight, 0.01f); + + if (FAILED(m_pShaderCom->Bind_RawValue("g_TempWeight", &m_fTempWeight, sizeof(_float)))) { + return E_FAIL; + } if (FAILED(m_pShaderCom->Bind_Matrices( diff --git a/Jusin154_Team3D/Client/Private/PlayerRobe.cpp b/Jusin154_Team3D/Client/Private/PlayerRobe.cpp index e624979a8..c9141fd58 100644 --- a/Jusin154_Team3D/Client/Private/PlayerRobe.cpp +++ b/Jusin154_Team3D/Client/Private/PlayerRobe.cpp @@ -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, true); + m_pRobeMainAnchor->Move_Kinematic(SocketMatrixFixed, false); 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,11 +52,10 @@ HRESULT CPlayerRobe::Render() HRESULT CPlayerRobe::Update_RobeSocketPosition() { { - 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)); + PSX::PxTransform pxTransform = {}; + _matrix WorldMatrix = {}; _matrix OwnerInvWorldMatrix = m_pParentTransformCom->Get_WorldMatrixInv(); - 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) { + for (_uint i = 0; 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; @@ -537,9 +536,6 @@ 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: diff --git a/Jusin154_Team3D/Client/Public/Player.h b/Jusin154_Team3D/Client/Public/Player.h index 82d4abd34..9b4639bc0 100644 --- a/Jusin154_Team3D/Client/Public/Player.h +++ b/Jusin154_Team3D/Client/Public/Player.h @@ -79,6 +79,14 @@ class CPlayer final : public CUnit class CBroomRaceManager* m_pBroomRaceManager = { nullptr }; class CRaceRing* m_pRaceRing = { nullptr }; + + + + + + + + _float m_fTempWeight = {}; private: virtual HRESULT Initialize_Prototype() override; virtual HRESULT Initialize(void* pArg) override; diff --git a/Jusin154_Team3D/Client/Public/Player_ENUM.h b/Jusin154_Team3D/Client/Public/Player_ENUM.h index e56b67816..7ad5c5a99 100644 --- a/Jusin154_Team3D/Client/Public/Player_ENUM.h +++ b/Jusin154_Team3D/Client/Public/Player_ENUM.h @@ -23,10 +23,8 @@ enum class PLAYER_MESH_ORDER { END }; -static const _char* PLAYER_JOINT_BONE_NAMES[13] = { - "Hips_Cloth" - - , "RightUpLeg_Cloth" +static const _char* PLAYER_JOINT_BONE_NAMES[12] = { + "RightUpLeg_Cloth" , "RightLeg_Cloth" , "RightDownLeg_Cloth" , "RightDownRightLeg_Cloth" @@ -44,9 +42,7 @@ static const _char* PLAYER_JOINT_BONE_NAMES[13] = { }; enum class PLAYER_JOINT_BONE_ORDER { - HIPS_CLOTH - - , RIGHTUP + RIGHTUP , RIGHT , RIGHTDOWN , RIGHTDOWNRIGHT 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 38f004a51..6207e7885 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 @@ -33,6 +33,9 @@ float g_fDisolveAmount; float g_fDisolveRatio; +float g_TempWeight; + + Texture2D g_DiffuseTexture : register(t00); Texture2D g_SpecularTexture : register(t01); @@ -274,7 +277,7 @@ VS_OUT VS_MAIN_LEGACY(VS_IN In) + g_RobeBoneMask[idx.z] * w.z + g_RobeBoneMask[idx.w] * w.w; - bool isRobe = robeWeight > 0.6f; + bool isRobe = robeWeight > g_TempWeight; matrix BoneMatrix = (matrix) 0; diff --git a/Jusin154_Team3D/Engine/Private/Model.cpp b/Jusin154_Team3D/Engine/Private/Model.cpp index a8f4f8702..c20758651 100644 --- a/Jusin154_Team3D/Engine/Private/Model.cpp +++ b/Jusin154_Team3D/Engine/Private/Model.cpp @@ -1506,6 +1506,8 @@ void CModel::Initialize_BoneMasks() { if (m_BoneMask[ENUM_CLASS(BLEND_BONE::HIPS_CLOTH)][i] == 1) { + if (i == 38) + continue; m_iSkipBoneCount++; m_SkipBoneindex.push_back(i); }