Your methods of traversing the vertex buffer of a unknown mesh ( DirectX)

Started by
2 comments, last by xujiezhige 12 years, 2 months ago
If you get a pointer to a unknown mesh, how do you tarverse the vertex buffer?

like:
HRESULT Func( LPD3DXMESH pMesh )
{
[color=#ff0000]VERTEX* p = NULL;
pMesh->LockVertexBuffer( 0, &p );
.....
}

How do you define the [color=#ff0000]VERTEX mentioned above?
Advertisement

How do you define the [color=#ff0000]VERTEX mentioned above?


You can't. What you can do is get the array of vertex elements with GetDeclaration, and use that to determine the stride of the vertices as well as the offset of any particular element within a single vertex.
SOS
Oh, thank you, MJP.
I learn it.

This topic is closed to new replies.

Advertisement