Jump to content
  • Advertisement
Sign in to follow this  
xissburg

Loading meshes from one xfile into individual D3DXMESHes

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

hmm...I'll start with an example about what I wanna do: In 3dsmax, I model one sphere and one capsule. They are distinct objects. Then I export the full scene using PandaDXExporter. When I load the mesh into a d3d app the sphere and the capsule acts like one object...I want to know how could I load the sphere into a D3DXMESH a the capsule into another D3DXMESH from the same file. Thanks ;)

Share this post


Link to post
Share on other sites
Advertisement
Hi, the mesh should have separate subsets. When you make separate things like two cubes, or something in 3dsmax etc, then D3DXMESH should load them as separate subsets. Try calling DrawSubset(1), or DrawSubset(2) etc. I think the normal DrawSubset(0), draws all the subsets.

Share this post


Link to post
Share on other sites
the DrawSubset(x) function draws the mesh's subset that has the material with index x, so if the sphere and the capsule have 2 different materials (or 2 different texture, it's QUITE the same), calling DrawSubset(0) will render the one with material[0]. if they share the same material, calling DrawSubset(0) will draw them both.

Share this post


Link to post
Share on other sites
:P....maybe you didnt understand :) ...I've looked inside the x file and I've seen that the objects are not the same geometry inside the Xfile. Because of that, I think I can load each object in individuals D3DXMESHes. Is it really possible?

Share this post


Link to post
Share on other sites
You want D3DXLoadMeshHierarchyFromX. The seperate meshes should end up in the field pMeshContainer->MeshData.pMesh of one of the frames in the hierarchy. But you need to implement the abstract class ID3DXAllocateHierarchy to get it to work.

Example here:
http://www.toymaker.info/Games/html/load_x_hierarchy.html

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!