How can I load an XFile?

The following steps can be used to load an X File

1. Load the XFile into the LPD3DXMESH structure, material info into the LPD3DXBUFFER structure and number of MeshSubsetMaterials using the D3DXLoadMeshFromX Function call

/* EXTRACT DATA OF ALL MESH SUBSETS FROM MATERIAL BUFFER */
2. Loop until the data of all materials is extracted a. Extract the material properties into a D3DMATERIAL9 array b. Set the Ambience color for the materials as D3DX doesn't do it by default c. Extract the Texture names from the pD3DXMtrlBuffer and Load the Textures into LPDIRECT3DTEXTURE9 array

/* DRAW ALL MESH SUBSETS */
3. Loop until the all materials are drawn a. Set the texture and material for this subset b. Draw the Mesh Subset

/* DESTROY ALL MESH SUBSETS */
4. a. Destroy the D3DMATERIAL9 Materials array b. Loop through all mesh subsets and release all Mesh Textures and in the end destroy the LPDIRECT3DTEXTURE9 array c. Destroy the mesh The sample application "XFile.zip" shows how to load a XFile and to display it.

FAQ Menu

 
Printer friendly version of the FAQ-DIRECTX-Load-XFile page


Sponsored links

Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Check Out IT Certification Preparation Materials
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Six Sigma Certification
100% Online-Six Sigma Certificate from Villanova - Find Out More Now.
SSH and SFTP support for .NET
Add complete SSH and SFTP support to your .NET framework application
3 Months Free - ASP.NET Web Hosting
3 Months Free & No Setup Fees on ASP.NET 3.5/2.0 Hosting on Windows 2008/2003 Servers ? Click Here!

Advertisement



Free Magazine

Free Magazines
eWeek The essential technology information source for builders of e-business.... subscribe now

Newsletter | Submit Content | About | Advertising | Awards | Contact Us | Link to us |
© 1996-2008 Community Networks Ltd All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Synchron Data - .NET development.