small fixes

This commit is contained in:
d1str4ught
2025-08-22 20:39:23 +02:00
parent 5b71a1e352
commit 6e42f1af3c
5 changed files with 6 additions and 16 deletions

View File

@@ -56,7 +56,7 @@ void CGrannyMesh::DeformPNTVertices(void * dstBaseVertices, D3DXMATRIX * boneMat
int vtxCount = GrannyGetMeshVertexCount(pgrnMesh); int vtxCount = GrannyGetMeshVertexCount(pgrnMesh);
// WORK // WORK
int * boneIndices = (int*)GrannyGetMeshBindingToBoneIndices(pgrnMeshBinding); granny_int32x * boneIndices = (granny_int32x*)GrannyGetMeshBindingToBoneIndices(pgrnMeshBinding);
// END_OF_WORK // END_OF_WORK
GrannyDeformVertices( GrannyDeformVertices(

View File

@@ -196,15 +196,8 @@ bool CGrannyModel::LoadMeshs()
} }
m_bHaveBlendThing |= rMesh.HaveBlendThing(); m_bHaveBlendThing |= rMesh.HaveBlendThing();
granny_int32x grni32xTypeCount = GrannyGetTotalTypeSize(pgrnMesh->PrimaryVertexData->VertexType) / sizeof(granny_vertex_data); for (int i = 0; pgrnMesh->PrimaryVertexData->VertexType[i].Name != nullptr; ++i)
int i = 0;
while (i < grni32xTypeCount)
{ {
if (NULL == pgrnMesh->PrimaryVertexData->VertexType[i].Name || 0 == strlen(pgrnMesh->PrimaryVertexData->VertexType[i].Name))
{
++i;
continue;
}
if ( 0 == strcmp(pgrnMesh->PrimaryVertexData->VertexType[i].Name, GrannyVertexPositionName) ) if ( 0 == strcmp(pgrnMesh->PrimaryVertexData->VertexType[i].Name, GrannyVertexPositionName) )
m_dwFvF |= D3DFVF_XYZ; m_dwFvF |= D3DFVF_XYZ;
else if ( 0 == strcmp(pgrnMesh->PrimaryVertexData->VertexType[i].Name, GrannyVertexNormalName) ) else if ( 0 == strcmp(pgrnMesh->PrimaryVertexData->VertexType[i].Name, GrannyVertexNormalName) )
@@ -213,7 +206,6 @@ bool CGrannyModel::LoadMeshs()
m_dwFvF |= D3DFVF_TEX1; m_dwFvF |= D3DFVF_TEX1;
else if ( 0 == strcmp(pgrnMesh->PrimaryVertexData->VertexType[i].Name, GrannyVertexTextureCoordinatesName"1") ) else if ( 0 == strcmp(pgrnMesh->PrimaryVertexData->VertexType[i].Name, GrannyVertexTextureCoordinatesName"1") )
m_dwFvF |= D3DFVF_TEX2; m_dwFvF |= D3DFVF_TEX2;
++i;
} }
vtxPos += GrannyGetMeshVertexCount(pgrnMesh); vtxPos += GrannyGetMeshVertexCount(pgrnMesh);

View File

@@ -125,7 +125,8 @@ bool CGraphicIndexBuffer::Create(int idxCount, D3DFORMAT d3dFmt)
Destroy(); Destroy();
m_iidxCount = idxCount; m_iidxCount = idxCount;
m_dwBufferSize = sizeof(WORD) * idxCount; UINT bytesPerIndex = (d3dFmt == D3DFMT_INDEX32) ? 4u : 2u;
m_dwBufferSize = bytesPerIndex * idxCount;
m_d3dFmt = d3dFmt; m_d3dFmt = d3dFmt;
return CreateDeviceObjects(); return CreateDeviceObjects();

View File

@@ -61,10 +61,7 @@ bool CGraphicVertexBuffer::Unlock() const
bool CGraphicVertexBuffer::IsEmpty() const bool CGraphicVertexBuffer::IsEmpty() const
{ {
if (m_lpd3dVB) return m_lpd3dVB == nullptr;
return true;
else
return false;
} }
bool CGraphicVertexBuffer::LockDynamic(void** pretVertices) bool CGraphicVertexBuffer::LockDynamic(void** pretVertices)

View File

@@ -15,7 +15,7 @@ bool CDynamicVertexBuffer::Create(int vtxCount, int fvf)
m_vtxCount = vtxCount; m_vtxCount = vtxCount;
m_fvf = fvf; m_fvf = fvf;
return CGraphicVertexBuffer::Create(m_vtxCount, m_fvf, D3DUSAGE_DYNAMIC, D3DPOOL_SYSTEMMEM); return CGraphicVertexBuffer::Create(m_vtxCount, m_fvf, D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY, D3DPOOL_DEFAULT);
} }
CDynamicVertexBuffer::CDynamicVertexBuffer() CDynamicVertexBuffer::CDynamicVertexBuffer()