Jump to content
  • Advertisement
Sign in to follow this  
ryt

changing vectors of an x file

This topic is 4779 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ths is how i did it:

Vertex* tri;
xFile->LockVertexBuffer(D3DLOCK_NOOVERWRITE, (void**)&tri);
for(DWORD i = 0; i < xFile->GetNumVertices(); i++){
tri = Vertex(angle,angle,angle);
}
xFile->UnlockVertexBuffer();
my Vertex isnt the same as xFile, but i dont know how to retrive it, i tried with GetFVF() but i dont know how to implement it

Share this post


Link to post
Share on other sites
Advertisement
There are two ways to do this. The first is that you can clone the mesh to force it to have a specific vertex format. To do this, use the ID3DXMesh::CloneMesh or ID3DXMesh::CloneMeshFVF methods. Once you do this, you can lock the vertex buffer and use a pointer to your vertex structure to access the data.

The second, and more flexible way, is to figure out at what offset within the vertex buffer is the particular data you want to change. For example, if you want to change the NORMAL vector of a vertex, then you need to call ID3DXMesh::GetDeclaration to get a detailed description of the vertex format. Then you look through that array until you find the element tagged as a normal vector. You can then use this offset number to offset from the beginning of the vertex buffer's memory.

neneboricua

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!