Skip to main content
gamedev.net
🔒 Locked

Getting Vertex data

Started by TheMac 1 reply 350+ views
Original Post
TheMac
TheMac
I'm trying to find the max/min vertex positions on a mesh so I can dynamically assign a bounding box to the mesh if one isn't provided. I think the best way of doing this (since I'm working with a number of different file types) is to pass the vertex buffer to a function to iterate through the bufer and find it that way. If I'm wrong or if you know of a better way let me know. Either way, I'm working with an XFile first, but I load them using the D3DX library, so I don't know how to get the raw vertex buffer by its self. There's a function called GetPrivateData that is apart of the IDirect3DVertexBuffer9 interface, but it needs a REFGUID. Does anyone know what thats for, or how I can get it, or if this is even the right method to use? Or just any general input about what I'm doing to get a bounding box around any mesh would be great too! Thanks.
Stowelly
Stowelly
ive been working on this stuff myself over the last 3 or so weeks so may be able to help

ive been using bounding spheres which obtain the radius and centre from just the mesh

D3DXComputeBoundingSphere(
(D3DXVECTOR3*)v,
pMesh->MeshData.pMesh->GetNumVertices(),
D3DXGetFVFVertexSize(pMesh->MeshData.pMesh->GetFVF()),
¢re,
&boundRadius );

i did have boxes for a while but couldnt seem to get them centred for all meshes so moved to spheres, but i did boxes like this

D3DXComputeBoundingBox(
(D3DXVECTOR3*)v,
xMesh->GetNumVertices(),
D3DXGetFVFVertexSize(pMesh->MeshData.pMesh->GetFVF()),
&boundMin,
&boundMax);


you can obtain the vertex info easily through the ID3DXSkinInfo interface.


hope this helps
http://stowelly.co.uk/
TheMac
TheMac
I'll look into the SkinnedMesh interface.

Thanks.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.