M3 SC2: Difference between revisions

From wowdev
Jump to navigation Jump to search
Line 172: Line 172:
Size: 0x24
Size: 0x24
  struct{
  struct{
     Reference u16_;
     Reference u16_; //Triangles
     Reference regn;
     Reference regn;
     Reference bat;
     Reference bat;

Revision as of 18:56, 26 February 2010

This file format is actually no WoW file format. Its the next generation of the MDX model format which had MDX (m1) in WC3 / prior to WoW, MDX2 (m2) in WoW, MDX2.2 (m2 with skin and anim) in WoW:WotLK and MDX3 (m3) in SC2.

As always, the format has similarities but also big revamps like on references this time.

Instead of using direct references, the references are now all in one global list. This list also contains the type and number of entries referenced (as well as another uint32). If one block references another one, it only says, how many of that data is referenced (similar to the entry in the reference table) and which reference is referenced (the id in the global list).

The reference table consists of entries of this structure:

struct referenceentry 
{
  /*0x00*/ uint32_t type;
  /*0x04*/ uint32_t offset;
  /*0x08*/ uint32_t nEntries;
  /*0x0C*/ uint32_t nFields;//this defines, how many Entries belong to that structure(like 'LAYR'+'CHAR' entries)
};

When a block is referenced somewhere, the reference looks like this:

struct reference 
{
  /*0x00*/ uint32_t entries;
  /*0x04*/ uint32_t referenceid;
};

The position of the reference table is not fixed and mostly on the end of the file due to easier saving. The position is told in the header of the file:

struct MD33
{
  /*0x00*/ uint32_t token; // 'MD33'
  /*0x04*/ uint32_t offsettotable;
  /*0x08*/ uint32_t entriesoftable;
  /*0x0C*/ reference MODL;
};

The MODL block is the actual information about the model.

Typelist

'CHAR' = char, contains a zero-terminated string of Length nEntries

'U32_' = uint32

'I32_' = int32

'U16_' = uint16

'U8__' = uint8 = unsigned char

'I8__' = int8 = char

'QUAT' = Quaternion

'VEC2' = Vector2D

'VEC3' = Vector3D

'VEC4' = Vector4D

'REAL' = Float

'BNDS' = Bounds

struct{
   Vec3D min;
   Vec3D max;
   float radius;
}Bounds;

'FLAG' = Flags

struct{//???
  uint16 unk1;
  uint16 unk2;
}Flags;

'STC_'

Size: 0x8D

Follows after some blocks, additional information?

'SD**'

The Sequence Data block contains information about animated things, it's the replacement for the Animation-Blocks. The two following chars define the type of the animation(like 4Q=Quaternion, see list below). The timeline is made of int32's

struct SD
{
    /*0x00*/ Reference timeline;
    /*0x08*/ uint32 flags;
    /*0x0C*/ uint32 length;
    /*0x08*/ Reference data;
};

'SD4Q': Sequence Data Quaternion

'SD3V': Sequence Data Vector3D

'SD2V': Sequence Data Vector2D

'SD3R': Sequence Data Float

'SDS6': Sequence Data Short

'SDEV': Sequence Data Event

'SDMB': Sequence Data Model Bounds

'SDFG': Sequence Data Flags

'EVNT'

Size: 0x5C

Events


'MODL'

type: 'MODL'
size: 0x228

The 'CHAR'-block following contains the *.max filename at blizzard.

Sequences

type: 'SEQS' Size: 0x58

struct SEQS
{
    /*0x00*/ int32 d1;
    /*0x04*/ int32 d2;
    /*0x08*/ Reference name;
    /*0x10*/ int32 d3;
    /*0x14*/ int32 length;
    /*0x18*/ int32 d4;
    /*0x1C*/ uint32 flags;
    /*0x20*/ int32 unk[5];
    /*0x34*/ Bounds extents;
    /*0x50*/ int32 d5;
    /*0x54*/ int32 d6;
};

This defines the Animation sequences. The 'CHAR'-block after 'SEQS' contains the name of the Animation (like 'Stand', 'Stand Work' etc.)

Bones

type: 'BONE'
Size: 0x9C
struct BONE
{
    /*0x00*/ int32 d1; // Keybone?
    /*0x04*/ Reference name;
    /*0x0C*/ uint32 flags;
    /*0x10*/ int16 parent;
    /*0x9C*/
};

This block contains the bones, the 'CHAR'-block afterwards contains the name of the bone.

'MAT_'

Material

Texture Layers

type: 'LAYR' size: 0x160

typedef struct{
    int unk;
    Reference name;
    int unk2[85];
}LAYR;

'IREF'

Matrix? size: 0x40

struct{
  float unk[16];
}IREF;

'DIV_'

Size: 0x24

struct{
   Reference u16_; //Triangles
   Reference regn;
   Reference bat;
   Reference msec;
   uint32 unk;// 1
}DIV_;

Partly retrieved from http://code.google.com/p/libm3/wiki