Question

Dr Roger Rowland on Fri, 23 Jan 2015 12:03:49


I know that there is a CMO loader in the DirectXTK, and I can see what the code does, but I can't find any formal description of the CMO format itself.

That makes it hard for me to write my own loader in cases where I can't use DirectXTK (e.g. in C++/CLI projects because the TK uses WRL) and I can't even verify if the existing code handles the full CMO specification.

Could somebody kindly point me to the documentation of the CMO format itself?

Thanks in advance,

Roger


Sponsored



Replies

Jamles Hez on Mon, 26 Jan 2015 03:30:02


Hi Roger,

See a similar post: https://social.msdn.microsoft.com/Forums/windowsapps/en-US/72156001-11eb-41d6-88e3-d572f47561d5/load-cmo-model-in-directx-111?forum=wingameswithdirectx

Where you can find both documentation and sample here :)

--James

Dr Roger Rowland on Mon, 26 Jan 2015 07:22:55


Thanks James,

But unless I'm missing something I can't see any documentation of the CMO format (which is what I want) - if I'm just missing a link in that linked post, would you be good enough to replicate it here? All I can find is what I already found - a code sample.

Regards,

Roger

Jamles Hez on Mon, 26 Jan 2015 07:33:34


Hi Roger,

Here we go: https://directxmesh.codeplex.com/wikipage?title=CMO&referringTitle=Geometry%20formats

At the bottom of the page, there is a human readable cmo format explanation: cmodump.cpp

Also paste here, these are all what I can found, hope it helps.

    // UINT - Mesh count
    // { [Mesh count]
    //      UINT - Length of name
    //      wchar_t[] - Name of mesh (if length > 0)
    //      UINT - Material count
    //      { [Material count]
    //          UINT - Length of material name
    //          wchar_t[] - Name of material (if length > 0)
    //          Material structure
    //          UINT - Length of pixel shader name
    //          wchar_t[] - Name of pixel shader (if length > 0)
    //          { [8]
    //              UINT - Length of texture name
    //              wchar_t[] - Name of texture (if length > 0)
    //          }
    //      }
    //      BYTE - 1 if there is skeletal animation data present
    //      UINT - SubMesh count
    //      { [SubMesh count]
    //          SubMesh structure
    //      }
    //      UINT - IB Count
    //      { [IB Count]
    //          UINT - Number of USHORTs in IB
    //          USHORT[] - Array of indices
    //      }
    //      UINT - VB Count
    //      { [VB Count]
    //          UINT - Number of verts in VB
    //          Vertex[] - Array of vertices
    //      }
    //      UINT - Skinning VB Count
    //      { [Skinning VB Count]
    //          UINT - Number of verts in Skinning VB
    //          SkinningVertex[] - Array of skinning verts
    //      }
    //      MeshExtents structure
    //      [If skeleton animation data is not present, file ends here]
    //      UINT - Bone count
    //      { [Bone count]
    //          UINT - Length of bone name
    //          wchar_t[] - Bone name (if length > 0)
    //          Bone structure
    //      }
    //      UINT - Animation clip count
    //      { [Animation clip count]
    //          UINT - Length of clip name
    //          wchar_t[] - Clip name (if length > 0)
    //          float - Start time
    //          float - End time
    //          UINT - Keyframe count
    //          { [Keyframe count]
    //              Keyframe structure
    //          }
    //      }
    // }

--James

Dr Roger Rowland on Mon, 26 Jan 2015 07:38:47


Ok, thanks, I expect that's the best I can hope for at the moment.

It's not quite the sort of thing I was expecting though, it seems to be not mature enough yet and I'd assumed that the fact that VS2013 supports it means that there is some kind of "official" documented format.

I'll treat this a volatile for now, but it will get me moving again.

Thanks for the help.

Roger