Jump to content


DX9 and UpdateSkinnedMesh


  • You cannot reply to this topic
No replies to this topic

#1 Lost

    New Member

  • Members
  • PipPip
  • 27 posts

Posted 27 November 2006 - 09:30 AM

Does anyone understand the math behind the DX9 function UpdateSkinnedMesh() ?
How are these new matrices applied to the vertex buffer, programmically?
Reason I'm asking, is I might try to do it myself if I can't get UpdateSkinnedMesh to work.


for (UINT i = 0; i < Bones; ++i)

  D3DXMatrixMultiply(&m_boneMatrices[i],&pMesh->exBoneOffsets[i], pMesh->exFrameCombinedMatrixPointer[i]);


void *srcPtr;

void *destPtr;

pMesh->MeshData.pMesh->LockVertexBuffer(D3DLOCK_READONLY, (void**)&srcPtr);

pMesh->exSkinMesh->LockVertexBuffer(0, (void**)&destPtr);


pMesh->pSkinInfo->UpdateSkinnedMesh( m_boneMatrices, NULL, srcPtr, destPtr );


pMesh->exSkinMesh->UnlockVertexBuffer();

pMesh->MeshData.pMesh->UnlockVertexBuffer();


Couple questions on the above code:
1. If I have only one mesh, can the source and dest vertex buffers be the same?
2. If I set all the m_boneMatrices matrices to Identity and call UpdateSkinnedMesh,
will my vertex buffer change? (just as an experiment)

Because I tried both 1&2, and some of my vertices change, like get
zeroed out. Not sure what is happening. Matrices look ok.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users