Sign in to follow this  

Loading X files

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

When loading a .X file using the CD3DMesh class (i.e ->Create..etc), would someone be so kind as to explain how I would go about loading and setting up material data for the mesh so as to change the specular components and such? I appear to have over looked this area :D Thanks, Pete

Share this post


Link to post
Share on other sites
I dont' have access to the CD3DMesh class source code at the moment so this may not be of much help. BUT, if I remember correctly, the CD3DMesh class has some sort of a LoadMeshFromXFile function. If you use 3d Max (or some other 3d software) to create a mesh with a material, the LoadMeshFromXFile function will import the material data along with everything else. Then it's just a matter of

(not sure of the actual variable names here but you'll find something similar in the class implementation)
Mesh->p_Material.ambient.r= <value >= 1.0f;>
Mesh->p_Material.ambient.g= <value >= 1.0f;>
Mesh->p_Material.ambient.b= <value >= 1.0f;>

The CD3DMesh class is only a sample class and doesn't include functions for every type of operation you may need, but it served as a good starter class for me and I built onto it to suit my needs. Also, the MS samples use different implementations of the sample classes in different samples. I think you'll find a more fully implemented CD3DMesh class in some of the more complicated samples. Try looking at the SkinnedMesh sample. If your CD3DMesh class doesn't have any sort of p_Material variable then you probably copied it from a sample that doesn't use materials.

I hope this was helpful.

Share this post


Link to post
Share on other sites

This topic is 4663 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.

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