Loading meshes from one xfile into individual D3DXMESHes

Started by
6 comments, last by xissburg 17 years, 6 months ago
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 ;)
.
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.
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.
D3DXSplitMesh
Every time you implement a singleton, God kills a kitten. Please, think of the kittens!
the FACTOR is u EXPORTED the scene "as 1 x-file".
: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?
.
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
oh yeah...as I can see this is the way...thanks a lot man ;)
.

This topic is closed to new replies.

Advertisement