M3 SC2: Difference between revisions

From wowdev
Jump to navigation Jump to search
No edit summary
No edit summary
Line 40: Line 40:


'U8__' = uint8 = unsigned char
'U8__' = uint8 = unsigned char
'I8__' = int8 = char


'QUAT' = Quaternion
'QUAT' = Quaternion
'VEC2' = Vector2D


'VEC3' = Vector3D
'VEC3' = Vector3D
'VEC4' = Vector4D


'REAL' = Float
'REAL' = Float
Line 51: Line 57:
Follows after some blocks, additional information?
Follows after some blocks, additional information?


== 'SDEV' ==
== 'SD**'==
  Size: 0x18
  // Complete
 
struct SD
== 'SD3V' ==
{
Most likely Animations with Vector3D, after it there are following pairs of I32_ and VEC3
    /*0x00*/ Reference timeline;
 
    /*0x08*/ Reference data;
== 'SD4Q' ==
};
Most likely Animations with Quaternions, after it there are following pairs of I32_ and QUAT
 
== 'SDR3' ==
Most likely Animations with Vector3D, after it there are following pairs of I32_ and REAL


== 'EVNT' ==
== 'EVNT' ==
  Size: 0x5C
  Size: 0x5C
Events?
Events
=== 'SDEV' ===
Size: 0x18
Sequence Data Event


== 'SDG_' ==
== 'SDG_' ==
Line 80: Line 85:
This defines the Animation sequences.
This defines the Animation sequences.
The 'CHAR'-block after 'SEQS' contains the name of the Animation (like 'Stand', 'Stand Work' etc.)
The 'CHAR'-block after 'SEQS' contains the name of the Animation (like 'Stand', 'Stand Work' etc.)
== 'SD4Q' ==
Sequence Data Quaternion
== 'SD3V' ==
Sequence Data Vector3D
== 'SD3R' ==
Sequence Data Float


== Bones ==
== Bones ==
  type: 'BONE'
  type: 'BONE'
  Size: 0x9C
  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.
This block contains the bones, the 'CHAR'-block afterwards contains the name of the bone.
== 'MAT_'==
Material


== Texture Layers ==
== Texture Layers ==
  type: 'LAYR'
  type: 'LAYR'
  size: 0x160
  size: 0x160
== 'IREF' ==
Matrix?
''Partly retrieved from http://code.google.com/p/libm3/wiki''

Revision as of 16:46, 24 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

'STC_'

Size: 0x8D

Follows after some blocks, additional information?

'SD**'

// Complete
struct SD
{
    /*0x00*/ Reference timeline;
    /*0x08*/ Reference data;
};

'EVNT'

Size: 0x5C

Events

'SDEV'

Size: 0x18

Sequence Data Event

'SDG_'

'MODL'

type: 'MODL'
size: 0x228

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

Sequences

type: 'SEQS'
Size: 0x58

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

'SD4Q'

Sequence Data Quaternion

'SD3V'

Sequence Data Vector3D

'SD3R'

Sequence Data Float

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

'IREF'

Matrix?


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