Jul 27, 2008

How To Create DirectX (.X) file

Using Tools
  • Get yourself a program named TrueSpace or Milkshape, which can export Models into this format (and create them)
  • Get a Plug in for any other 3D modeler (Maya Plugin and others are included with the DirectX9 SDK)
  • Create 3DS Files using almost Any Modeler (3DS is more or less a standard format) and use the Program supplied with the SDK to convert it into .X format
  • Open the File in WordPad and u can create/modify them, since they are not stored in any compressed/unreadable format (although for this u need to know how the file is build)
Programmatically
  1. Create the mesh
    D3DXCreateMeshFVF(...)
  2. Lock the vertex buffer and copy your vertices into it
    outMesh->LockVertexBuffer(...)
  3. Lock the index bufer and copy indices into it
    outMesh->LockIndexBuffer(...)
  4. Save it to a file
    D3DXSaveMeshToX(...)

No comments: