Jump to content
  • Advertisement
Sign in to follow this  
Lonewolf9383

Trying to understand D3DXMESH and subsets

This topic is 4850 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

Hi, i am currently working on a project to create an octree from a DirectX9 mesh. What i am trying to do is find all of the vertice points while recognising and keeping them in the same submesh. I decided the first thing i need to do is to try and figure out how the DrawSubSet function works so that i get a better idea of where the vertice data is stored. I have got quite a way using GetAttribute to get the details of each submesh. I then hit my problem. I am replacing the DrawSubSet function with the DrawIndexedPrimitive: if (FAILED (pdx9->DrawIndexedPrimitive (D3DPT_TRIANGLELIST , pAttributeTable[Index].VertexStart, 0, pAttributeTable[Index].VertexCount, pAttributeTable[Index].FaceStart, pAttributeTable[Index].FaceCount))) The call works perfectly for the first submesh but any other submeshes are not drawn properly. It seems to draw garbage in the right area of the model but all the faces are corrupt. Stepping through the program i can see that pAttributeTable.VertexStart etc.. are all updated as i expect them to be but there must be some sort of offset i need to add to get it to start at the right point in the index list? Has anyone else tried a similar program and could they get it to work? It all sounded simple when i first started out :-( Thanks to anyone who can help :-) [Edited by - Lonewolf9383 on August 5, 2005 10:26:20 AM]

Share this post


Link to post
Share on other sites
Advertisement

I had a similar problem, only i took a different root. I decided to strip the vertex and index data out of the mesh (and threw it away). I then went through and found out where each polygon was in the octree, and so on.

Sorry not much help to your problem, just an idea to pass by you.

Hope you crack it.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Hi, Thanks for the reply :)

How did you identify each of the submeshes?

Thanks again

Share this post


Link to post
Share on other sites

I beleive the subset id points the material/texture, so if you had 2 materials you would have 2 subsets. Don't quote em on this but i believe this is how the .x file works. But i think you are after sub objects???!!??, i was only concerned with getting groups of materials. I suspect there must be some
sub-mesh properties in it somewhere.

A quick search on google lead to this, i remember looking at it a while back, it's a good resouce.

http://www.mvps.org/directx/articles/d3dxmesh.htm


Hope it helps, if i remember i'll drag out my old code and have a look, and let you know.


Laters

Share this post


Link to post
Share on other sites
That looks like exactly what i need :-D

It looks like the weblink has all the details i need to load it all in and manipulate it.

Thanks for the help, i finally feel like i can get somewhere now after several days of pulling out my hair ;)

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!