//THIS IS NOT A C FILE
//THIS MAY BE WRONG
#define MDR_XYZ_SCALE (1.0/64)
#define MAX_QPATH 64

mdrObject
{
  //-Start mdrObject-
  int  ident;  //=RDM5
  int  version;  //=2

  char[MAX_QPATH]  name;  // of model

  int  numFrames;
  int  numBones;
  //ofsFrames>0 -> use mdrFrame
  //ofsFrames<0 -> use mdrCompFrame
  int  ofsFrames;  // rlt -Start mdrObject-

  int  numLODs;
  int  ofsLODs;  // rlt -Start mdrObject-

  int  numTags;
  int  ofsTags;  // rlt -Start mdrObject-

  int  ofsEnd;  // rlt -Start mdrObject-

  mdrFrame[numFrames]  frames;  //data //if(ofsFrames>0)
  //mdrCompFrame[numFrames] frames //data //if(ofsFrames<0)

  mdrLOD[numLODs]  LODs;  // data

  mdrTags[numTags]  tags;  //data

  //-End mdrObject-
}

mdrFrame
{
  float[3]  minBound;
  float[3]  maxBound;
  float[3]  localOrigin;  // midpoint of bounds, used for sphere cull
  float  radius;  // dist from localOrigin to corner
  char[16]  name;
  mdrBone[numBones]  bones;
}

//order
mdrBone
{
  float[3]  loc;
  float[3]  x;
  float[3]  y;
  float[3]  z;
}

mdrCompFrame
{
  float[3]  minBound;
  float[3]  maxBound;
  float[3]  localOrigin;  // midpoint of bounds, used for sphere cull
  float  radius;  // dist from localOrigin to corner
  mdrCompBone[numBones]  bones;
}

//order???
mdrCompBone
{
  short[3] loc;
  short[3] x;
  short[3] y;
  short[3] z;
}

mdrLOD{
  //-Start mdrLOD-
  int  numSurfaces;
  int  ofsSurfaces; //rlt -Start mdrLOD-
  int  ofsEnd; //rlt -Start mdrLOD- //points next mdrLOD
  mdrSurface[numSurfaces] surfaces;
  //-End mdrLOD-
}

mdrSurface{
  //-Start mdrSurface-
  int  ident; // ????

  char[MAX_QPATH]  name;  // polyset name
  char[MAX_QPATH]  shader;
  int  shaderIndex;  // for in-game use

  int  ofsHeader; // this will be a negative number ????

  int  numVerts;
  int  ofsVerts; //rlt -Start mdrSurface-

  int  numTriangles;
  int  ofsTriangles; //rlt -Start mdrSurface-

  // Bone references are a set of ints representing all the bones
  // present in any vertex weights for this surface.  This is
  // needed because a model may have surfaces that need to be
  // drawn at different sort times, and we don't want to have
  // to re-interpolate all the bones for each surface.
  int  numBoneReferences;
  int  ofsBoneReferences; //rlt -Start mdrSurface-

  int  ofsEnd;  // next surface follows

  mdrVertex[numVerts] verts;

  mdrTriangle[numTriangles] triangles;

  int[numBoneReferences] boneReferences;
  //-End mdrSurface-
}

mdrVertex
{
  float[3]  normal;
  float[2]  texCoords;
  int  numWeights;
  mdrWeight[numWeights] weights;
}

mdrWeight
{
  int  boneIndex;  // these are indexes into the boneReferences,
  float  boneWeight;  // not the global per-frame bone list
  float[3]  offset;
}

mdrWeight
{
  int[3]  indexes;
}

//VCXZET
//thanks to: Thilo and Phaethon