[add] Additional RobeMethod

This commit is contained in:
kimnuri
2026-01-01 15:01:54 +09:00
parent 761b2dae62
commit 486c954a7c
7 changed files with 86 additions and 80 deletions
@@ -87,7 +87,6 @@ HRESULT CMainApp::Render()
m_pGameInstance->Draw();
GUI::Render();
//m_pGameInstance->Render_Font(TEXT("HYHL"), TEXT("피곤해 못 써"), _float2(0.f, 0.f), XMVectorSet(1.f, 0.f, 0.f, 1.f));
ImGui_ImplDX11_RenderDrawData(GUI::GetDrawData());
m_pGameInstance->Render_End();
+5 -11
View File
@@ -252,9 +252,6 @@ 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;
}
@@ -600,10 +597,7 @@ HRESULT CPlayer::Bind_ShaderParameters(_uint iMeshOrder)
break;
#ifdef _DEBUG
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();
@@ -619,8 +613,8 @@ HRESULT CPlayer::Bind_ShaderParameters(_uint iMeshOrder)
for (_uint i = 0; i < paletteCount; ++i)
{
_uint global = boneIndices[i];
//if (global == 38)
// continue;
if (global == 38)
continue;
if (globalMask[global] == 1)
{
SkinMatrices[i] = m_pRobePart->Get_RobeJointAnchorMatrix(temp++);
@@ -632,8 +626,8 @@ HRESULT CPlayer::Bind_ShaderParameters(_uint iMeshOrder)
for (_uint i = 0; i < paletteCount; ++i)
{
//if (i == 29)
// continue;
if (i == 29)
continue;
_uint global = boneIndices[i];
paletteMask[i] = globalMask[global];
}
+3 -49
View File
@@ -72,15 +72,6 @@ HRESULT CPlayerRobe::Update_RobeSocketPosition()
m_pModelCom->Set_BoneCombinedTransformation(PLAYER_JOINT_BONE_NAMES[i], LocalMatrix);
}
}
//{
// D3D11_MAPPED_SUBRESOURCE SubResource{};
// if (FAILED(m_pContext->Map(m_pBoneCombinedMatrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &SubResource))) {
// return E_FAIL;
// }
// memcpy_s(SubResource.pData, sizeof(_float4x4) * ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END), m_ReconstructedJointAnchorMatirces, sizeof(_float4x4) * ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END));
// m_pContext->Unmap(m_pBoneCombinedMatrixBuffer, 0);
//}
//m_pModelCom->ComputeInsertionBoneBuffer(m_BoneInsertionDesc, m_pBoneCombinedMatrixSRV);
return S_OK;
}
@@ -115,35 +106,6 @@ HRESULT CPlayerRobe::Helper_RouteJointGenerater(CRigidBody_Dynamic::RIGIDBODY_DY
return S_OK;
}
HRESULT CPlayerRobe::Create_BoneCombinedMatrixSRV()
{
D3D11_BUFFER_DESC desc{};
desc.Usage = D3D11_USAGE_DYNAMIC;
desc.ByteWidth = sizeof(_float4x4) * ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END);
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
desc.StructureByteStride = sizeof(_float4x4);
desc.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
if (FAILED(m_pDevice->CreateBuffer(&desc, nullptr, &m_pBoneCombinedMatrixBuffer))) {
return E_FAIL;
}
D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc = {};
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_BUFFER;
srvDesc.Format = DXGI_FORMAT_UNKNOWN;
srvDesc.Buffer.FirstElement = 0;
srvDesc.Buffer.NumElements = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END);
if (FAILED(m_pDevice->CreateShaderResourceView(m_pBoneCombinedMatrixBuffer, &srvDesc, &m_pBoneCombinedMatrixSRV))){
return E_FAIL;
}
return S_OK;
}
HRESULT CPlayerRobe::Update_LegsPosition()
{
_matrix WorldMatrix = m_pParentTransformCom->Get_XMWorldMatrix();
@@ -526,13 +488,6 @@ HRESULT CPlayerRobe::Initialize(void* pArg)
m_pRightFootLocalMatrix = m_pModelCom->Get_BoneMatrixPtr("RightFoot");
m_pRightLegLocalMatrix = m_pModelCom->Get_BoneMatrixPtr("RightLeg");
{
ZeroMemory(&m_BoneInsertionDesc, sizeof(m_BoneInsertionDesc));
m_BoneInsertionDesc.iMatrixCount = ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END);
m_BoneInsertionDesc.iStartOffset = m_pModelCom->Get_BoneIndex(PLAYER_JOINT_BONE_NAMES[ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::RIGHTUP)]);
}
Create_BoneCombinedMatrixSRV();
XMStoreFloat4x4(&m_PreTransformMatrix, XMLoadFloat4x4(m_pModelCom->Get_PreTransformMatrixPtr()));
for (_uint i = 0; i < ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END); ++i) {
@@ -647,8 +602,6 @@ void CPlayerRobe::Free()
#ifdef _DEBUG
SAFE_RELEASE(m_pDepthStencilStateNone);
#endif // _DEBUG
SAFE_RELEASE(m_pBoneCombinedMatrixSRV);
SAFE_RELEASE(m_pBoneCombinedMatrixBuffer);
SAFE_RELEASE(m_pRightLeg);
SAFE_RELEASE(m_pLeftLeg);
SAFE_RELEASE(m_pRobeMainAnchor);
@@ -666,12 +619,13 @@ void CPlayerRobe::Describe_Entity()
GUI::Begin("PhysX");
if (GUI::CollapsingHeader("Robe")) {
for (_uint i = 0; i < ENUM_CLASS(PLAYER_JOINT_ORDER::END); ++i) {
if (GUI::BeginChild("##i")) {
if (GUI::BeginChild(("Child ID: " + to_string((size_t)(this))).c_str())) {
GUI::EndChild();
}
GUI::EndChild();
}
}
GUI::End();
}
#endif // _DEBUG
@@ -56,10 +56,6 @@ class CPlayerRobe final : public CPartObject
CRigidBody_Dynamic* m_pRobeJointAnchor[ENUM_CLASS(PLAYER_JOINT_BONE_ORDER::END)] = { nullptr };
PSX::PxD6Joint* m_pDynamicJoints[ENUM_CLASS(PLAYER_JOINT_ORDER::END)] = { nullptr };
ID3D11Buffer* m_pBoneCombinedMatrixBuffer = { nullptr };
ID3D11ShaderResourceView* m_pBoneCombinedMatrixSRV = { nullptr };
CModel::BONEINSERTION_DESC m_BoneInsertionDesc = {};
vector<_float4x4> m_PrevRobeBoneMatrices = { };
#ifdef _DEBUG
unique_ptr<GeometricPrimitive> m_pMainShape = { nullptr };
@@ -76,7 +72,6 @@ class CPlayerRobe final : public CPartObject
HRESULT Update_LegsPosition();
HRESULT Helper_RouteJointGenerater(CRigidBody_Dynamic::RIGIDBODY_DYNAMIC_DESC& Desc_Body, ROUTE_DESC& Desc_Route, _matrix* xmAnchorMatricesWorld);
HRESULT Create_BoneCombinedMatrixSRV();
#ifdef _DEBUG
HRESULT Render_BonePhysX();
HRESULT Render_Legs();
@@ -1,6 +1,7 @@
#ifndef ENGINE_SHADER_DEFINES_HLSLI
#define ENGINE_SHADER_DEFINES_HLSLI
#pragma pack_matrix(row_major)
#include "Engine_Shader_Constants.hlsli"
#include "Engine_Shader_Structures.hlsli"
#include "Engine_Shader_Samplers.hlsli"
@@ -266,7 +266,7 @@ 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);
float sumW = max(dot(w, 1.0f), FLT_EPSILON5);
w /= sumW;
uint4 idx = In.vBlendIndex;
@@ -278,26 +278,88 @@ VS_OUT VS_MAIN_LEGACY(VS_IN In)
+ 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]);
uint iIndex = idx.x;
float fWeight = w.x;
if (isRobe)
{
if (29 == iIndex)
{
BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneBuffer[iIndex].LocalCombined));
}
else
{
BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneMatrices[iIndex]));
}
}
else
{
BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneBuffer[iIndex].LocalCombined));
}
}
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);
uint iIndex = idx.y;
float fWeight = w.y;
if (isRobe)
{
if (29 == iIndex)
{
BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneBuffer[iIndex].LocalCombined));
}
else
{
BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneMatrices[iIndex]));
}
}
else
{
BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneBuffer[iIndex].LocalCombined));
}
}
{
uint iIndex = idx.z;
float fWeight = w.z;
if (isRobe)
{
if (29 == iIndex)
{
BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneBuffer[iIndex].LocalCombined));
}
else
{
BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneMatrices[iIndex]));
}
}
else
{
BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneBuffer[iIndex].LocalCombined));
}
}
{
uint iIndex = idx.w;
float fWeight = w.w;
if (isRobe)
{
if (29 == iIndex)
{
BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneBuffer[iIndex].LocalCombined));
matrix PrevBoneMatrix =
}
else
{
BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneMatrices[iIndex]));
}
}
else
{
BoneMatrix += mul(fWeight, mul(g_OffsetMatrix[iIndex], g_BoneBuffer[iIndex].LocalCombined));
}
}
matrix PrevBoneMatrix =
mul(g_OffsetMatrix[In.vBlendIndex.x],
mul(g_PrevBoneMatrices[In.vBlendIndex.x], w.x))
+ mul(g_OffsetMatrix[In.vBlendIndex.y],
@@ -1,6 +1,7 @@
#ifndef ENGINE_SHADER_DEFINES_HLSLI
#define ENGINE_SHADER_DEFINES_HLSLI
#pragma pack_matrix(row_major)
#include "Engine_Shader_Constants.hlsli"
#include "Engine_Shader_Structures.hlsli"
#include "Engine_Shader_Samplers.hlsli"