Sign in to follow this  
xissburg

Loading meshes from one xfile into individual D3DXMESHes

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
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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this