Skip to content
This repository was archived by the owner on Oct 10, 2023. It is now read-only.

MSLC DATA Chunk

Marcus Kertesz edited this page Feb 27, 2022 · 2 revisions

Contains data for a single mesh.

Chunk Header

Size (bytes) Name Expected Value Type Notes
4 Type 'DATA' String (ascii)
4 ID 'MSCL' String (ascii)
4 Version '2' UInt32
4 Size (bytes) - UInt32
4 Name Size '1' UInt32
- Name '' String (ascii) Null Terminated ('\x00')

Layout

Data

Size (bytes) Name Expected Value Type
4 ??? '0' Int32
1 Flag (???) '0' / '1' Byte
4 Value (???) - Int32
4 ??? '0' Int32
4 Bone Weight Count - Int32
- Bone Weight References - List[Bone Weight References]
4 Vertex Count - Int32
4 Vertex Layout Code (???) '37' / '39' Int32
- Vertex Data - (Vertex Data)(#Vertex-Data)
4 ??? '0' Int32
4 Sub Mesh Count - Int32
- Sub Mesh Data - List[Bone Weight Data]
- Remaining Data - List[Byte]

Bone Weight References

Represents a name and index of a Bone, defined in the [SKEL-Chunk].

Index represents the index of the Bone within the Bones array, defined in [SKEL-Chunk].

Name -should- match the Bone referenced.

Layout

Size (bytes) Name Expected Value Type
4 Name Size - Int32
- Name - String (ascii)
4 Index - Int32

Vertex Data

Raw mesh data, vertexes are NOT interlaced. Each part of the vertex buffer is read independently.

For brevity, Vertex Count (defined in the main layout) is labelled Vc in the table.

Layout

Size (bytes) Name Expected Value Type Layout Code(s)
12 * Vc Positions - Float3 '37' / '39'
16 * Vc Bone Weights - Bone Weight Data '39'
12 * Vc Normals - Float3 '37' / '39'
8 * Vc Uvs - Float2 '37' / '39'

Bone Weight Data

Each bone weight is 16 bytes long, and can hold at most 3 weights.

Unused bone indexes contain '-1' (decimal) or '\xff' (hex).
Indexes should match one of the bones defined in the [#Bone Weight References].

Weights should sum to 1, unless no weights are being applied.

Layout

Size (bytes) Name Expected Value Type
4 Weight 1 - Float
4 Weight 2 - Float
4 Weight 3 - Float
1 Bone Index 1 - Byte
1 Bone Index 2 - Byte
1 Bone Index 3 - Byte
1 PADDING '\xff' Byte

Used In

WHM-Chunky

Clone this wiki locally