[fix] mesh PhysX

This commit is contained in:
kimnuri
2025-12-07 11:47:49 +09:00
parent a88be9c111
commit cf8ea71f85
5 changed files with 389 additions and 388 deletions
+9 -3
View File
@@ -185,7 +185,7 @@ HRESULT CMesh::Initialize_Prototype(MODEL eType, const CModel* pModel, SaveMesh*
m_Vertices.clear();
m_Vertices.reserve(_SaveMesh->Vertices.size());
XMMATRIX matPre = PreTransformMatrix;
_matrix matPre = PreTransformMatrix;
for (size_t i = 0; i < _SaveMesh->Vertices.size(); ++i)
{
@@ -210,6 +210,11 @@ HRESULT CMesh::Initialize_Prototype(MODEL eType, const CModel* pModel, SaveMesh*
hr = Ready_VertexBuffer_For_Anim(pModel, _SaveMesh);
break;
case Engine::MODEL::ENVIROMENT:
m_pVertexPositions = new _float3[m_iNumVertices];
for (size_t i = 0; i < m_iNumVertices; ++i)
{
memcpy_s(m_pVertexPositions, sizeof(_float3) * m_iNumVertices, m_Vertices.data(), sizeof(_float3) * m_iNumVertices);
}
break;
default:
break;
@@ -266,6 +271,7 @@ HRESULT CMesh::Ready_VertexBuffer_For_NonAnim(SaveMesh* SaveMesh, _fmatrix PreTr
for (_uint i = 0; i < m_iNumVertices; ++i)
{
memcpy(&pVertices[i].vPosition, &SaveMesh->Vertices[i].Pos, sizeof(_float3));
memcpy(&m_pVertexPositions[i], &SaveMesh->Vertices[i].Pos, sizeof(_float3));
XMStoreFloat3(&pVertices[i].vPosition,
XMVector3TransformCoord(XMLoadFloat3(&pVertices[i].vPosition), PreTransformMatrix));
@@ -426,9 +432,9 @@ PSX::PxTriangleMesh* CMesh::ConvertToPxMesh(const PSX::PxCookingParams* pParam,
tMeshDesc.points.stride = sizeof(PSX::PxVec3);
Vertices.resize(m_iNumVertices);
XMVector3TransformCoordStream(
reinterpret_cast<XMFLOAT3*>(Vertices.data()), // dest
reinterpret_cast<_float3*>(Vertices.data()), // dest
sizeof(PSX::PxVec3),
reinterpret_cast<const XMFLOAT3*>(m_pVertexPositions), // src
reinterpret_cast<const _float3*>(m_pVertexPositions), // src
sizeof(PSX::PxVec3),
m_iNumVertices,
WorldMatrix