Archived

This topic is now archived and is closed to further replies.

N00bish question. Todally lost with Loading an X object

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

I just can''t figure out how to load an x object (direct x 9.0 - Visual c++ 6.0) using the CD3Dfile class. I would really be greatfull if someone would brother to explain me how to do it! I tried to learn it first from the tutorials with the SDK, but the Load Mesh tutorial didn''t use the class at all!!! I used the Direct x 9.0 app wizard to create direct x 9.0 application and I noticed there is the CD3Dfile class wich seems to be good, but I can''t figure out how to use it... so... please?

Share this post


Link to post
Share on other sites
I''d use the Direct3D Extension Library. (D3DX)

The .X is like a tree. Every branch can have other branches but some branches have leaves too
So you load the frames (branch, don''t mess this up with the animation frame, this is just a data-frame) and each frame can contain other (data)frames and/or some actual data.
Using the D3DX Library, you can loop through all the frames and load data if necessary. The "How-To" I won''t bother to tell, but the best advice would be: Copy&Paste =)

.lick

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
CD3DFile already makes use of the D3DX mesh (and texture) related functions and COM object interfaces. and it will automatically load the various frames and meshes within the .x file, building a hierarchy of CD3DFrame/CD3DMesh objects.

all you have to do to load a .x file is to use the Create method, passing the app''s D3D device pointer and a string containing the .x file''s filename, e.g.,

m_Mesh.Create(m_pd3dDevice, "mymodel.x" ;

rendering is just as easy, e.g.,

m_Mesh.Render(m_pd3dDevice) ;

if you take a look at the source code for the ShadowVolume sample, for instance, you''ll find everything you need to do when using a CD3DFile object. just search in the ShadowVolume.cpp file for "m_pAirplane".

Share this post


Link to post
Share on other sites
ADvice: Use a Vertex Buffer and an Index Buffer to draw instead of CD3DMesh::Render() which uses the bitchy ID3DXBaseMesh->DrawSubset().

.lick

Share this post


Link to post
Share on other sites