hi,

I'm a bit confused as to how my graphics engine actually loads a model file.
Currently I'm using .x files, because that's what I was taught.
But I haven't asked the most important question, how do my graphics engine actually load a model file?

Using DirectX and the correspondent .x files, should mean that the file implements the same structural language as the D3DX graphics engine can read meaning, matrices, frames, joints etc:

FrameTransformMatrix {
    1.000000,0.000000,0.000000,0.000000,
    0.000000,1.000000,0.000000,0.000000,
    0.000000,0.000000,-1.000000,0.000000,
    0.000000,0.000000,0.000000,1.000000;;
  }
    Frame CHEST {

      FrameTransformMatrix {
        1.000000,0.000000,0.000000,0.000000,
        0.000000,-0.038100,0.999300,0.000000,
        0.000000,-0.999300,-0.038100,0.000000,
        0.000000,-0.236100,2.633800,1.000000;;
      }
//......

So, then I stumble on to different kinds of model files, such as .obj, .m3g, .3ds. And I've also seen some 'custom made' ones, like .mdx or .map

And now for the question:
How do I load these files into my graphics engine with the same results?

I'm assuming all different model files can be interpreted and loaded into the directx engine.

Open Asset Import Library, http://assimp.sourceforge.net/index.html, would be useful to load the different mesh formats into a single consistent interface. Then extract the required data from its structures and create your ID3DX* structures using this data. Loading of static mesh data in this way is trivial, animation data is also possible but at this stage I haven't yet done it. If you need additional advice following this path, post a follow-up in here :).

I have just gotten up to the mesh animating stage of my toy engine, once I have something useful working I might try writing a tutorial.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.