Skip to content

MCMD Filespecification

WorldSEnder edited this page Aug 23, 2015 · 3 revisions

The MCMD File format

.mcmd is a binary file-type that holds the visual data of a model. It also offers a way to identify the author uniquely.

Without further-a-do here is the current file specification:

<File>

fieldtype fieldlength description
unsigned long 8 bytes magic number, must be 0x4d484643204d444cL
unsigned long 8 bytes UUIDmost, uniquely identifies a model
unsigned long 8 bytes UUIDleast, different versions of the same model should have the same UUID
<String> ? bytes Artist's name
unsigned int 4 bytes (v) file version
<FileV​v> ? bytes Differs for different file versions

Currently the following File versions are currently in effect: Version 1

<FileV1>

fieldtype fieldlength description
unsigned byte 1 byte (n) number of parts
unsigned byte 1 byte (m) number of bones
<ModelPart>[​n] ? bytes array of model parts, tightly packed
<ModelBone>[​m] ? bytes array of bones, tightly packed
unsigned byte[​m] m bytes bone's parents as indices in the above list, 0xFF means no parent
must result in a tree-ish structure

<ModelPart>

fieldtype fieldlength description
unsigned short 2 bytes (p) number of points in this part
unsigned short 2 bytes (f) number of faces (must be triangles) of this part
<String> ? btyes name of this part
<Material> ? bytes material on this part
<Point>[​p] ? btyes array of points, tightly packed
unsigned short[3*​f] ? bytes render order of the points as indices. Each tripple makes up one face.

<ModelBone>

fieldtype fieldlength description
<String> ? bytes name of the bone
<Quaternion> 16 bytes rotation of this bone (in its parent's local matrix)
<Vector3> 12 bytes offset of this bone (in its parent's local matrix)

<Material>

<Point>

fieldtype fieldlength description
<Vector3> 12 bytes coordinates of the point in model space
<Vector3> 12 bytes normal vector of this point
<Vector2> 8 bytes texture coordinates of this point
<Bindings> ? btyes bone/transform bindings of this point

<Quaternion>

fieldtype fieldlength description
float 4 bytes x-value of the quaternion
float 4 bytes y-value of the quaternion
float 4 bytes z-value of the quaternion
float 4 bytes w-value of the quaternion

<Vector3>

fieldtype fieldlength description
float 4 bytes x-value of the vector
float 4 bytes y-value of the vector
float 4 bytes z-value of the vector

<Vector2>

fieldtype fieldlength description
float 4 bytes x-value of the vector
float 4 bytes y-value of the vector

<Bindings>

<Bindings> = <Binding> <Binding> <Binding> <Binding> | <Binding> <Binding> <Binding> "0xFF" | <Binding> <Binding> "0xFF" | <Binding> "0xFF" | "0xFF"

<String>

<String> = <char> <String> | "0x00"

<char> is any valid unicode UTF-8 byte sequence except 0x00.