Table of Contents

Class M2RootTbc

Namespace
WoWLib.Formats.M2.Root
Assembly
WoWLib.dll

An MD20 model body for one client version: header scalars plus every offset-addressed block, decoded. A version's class carries ONLY the members that version defines. See https://wowdev.wiki/M2.

public class M2RootTbc : M2Root, IDisposable
Inheritance
M2RootTbc
Implements
Inherited Members

Constructors

M2RootTbc()

public M2RootTbc()

M2RootTbc(M2RootTbc)

Copy-construct: a deep copy of other (the C++ copy constructor).

public M2RootTbc(M2RootTbc other)

Parameters

other M2RootTbc

Properties

AttachmentLookupTable

Attachment lookup: attachment id -> index.

public Vector<ushort> AttachmentLookupTable { get; }

Property Value

Vector<ushort>

Attachments

Attachment points (weapons, effects, name plates).

public Vector<M2AttachmentVanillaToTbc> Attachments { get; }

Property Value

Vector<M2AttachmentVanillaToTbc>

BoneLookupTable

Bone lookup: skin sections select bone subsets through it.

public Vector<ushort> BoneLookupTable { get; }

Property Value

Vector<ushort>

Bones

The bones (MAX_BONES nominally 256).

public Vector<M2CompBoneTbc> Bones { get; }

Property Value

Vector<M2CompBoneTbc>

BoundingBox

The render bounds.

public CAaBox BoundingBox { get; set; }

Property Value

CAaBox

BoundingSphereRadius

The render bounding-sphere radius.

public float BoundingSphereRadius { get; set; }

Property Value

float

CameraLookupTable

Camera lookup: camera type -> index.

public Vector<ushort> CameraLookupTable { get; }

Property Value

Vector<ushort>

Cameras

Cameras (portrait, character info, flyby).

public Vector<M2CameraVanillaToTbc> Cameras { get; }

Property Value

Vector<M2CameraVanillaToTbc>

CollisionBox

The collision bounds.

public CAaBox CollisionBox { get; set; }

Property Value

CAaBox

CollisionNormals

Collision-hull per-face normals.

public Vector<C3Vector> CollisionNormals { get; }

Property Value

Vector<C3Vector>

CollisionSphereRadius

The collision bounding-sphere radius.

public float CollisionSphereRadius { get; set; }

Property Value

float

CollisionTriangles

Collision-hull triangle indices (3 per face).

public Vector<ushort> CollisionTriangles { get; }

Property Value

Vector<ushort>

CollisionVertices

Collision-hull vertices.

public Vector<C3Vector> CollisionVertices { get; }

Property Value

Vector<C3Vector>

Colors

Color and alpha animations, referenced from skin batches.

public Vector<M2ColorVanillaToTbc> Colors { get; }

Property Value

Vector<M2ColorVanillaToTbc>

Events

Timed events (sounds, footsteps, death thud).

public Vector<M2EventVanillaToTbc> Events { get; }

Property Value

Vector<M2EventVanillaToTbc>

FormatVersion

The MD20 format version (256 vanilla .. 274 Legion+).

public uint FormatVersion { get; set; }

Property Value

uint

GlobalFlags

Global flags, see GlobalFlags.

public GlobalFlags GlobalFlags { get; set; }

Property Value

GlobalFlags

GlobalLoops

Global-sequence loop lengths (timestamps).

public Vector<M2Loop> GlobalLoops { get; }

Property Value

Vector<M2Loop>

KeyBoneLookup

Key-bone lookup: key bone slot -> bone index, -1 if none.

public Vector<short> KeyBoneLookup { get; }

Property Value

Vector<short>

Lights

Model lights.

public Vector<M2LightVanillaToTbc> Lights { get; }

Property Value

Vector<M2LightVanillaToTbc>

Materials

Materials: render flags + blending modes.

public Vector<M2Material> Materials { get; }

Property Value

Vector<M2Material>

Name

The model's internal name; empty in 9.2+ files.

public string Name { get; set; }

Property Value

string

ParticleEmitters

Particle emitters.

public Vector<M2ParticleTbc> ParticleEmitters { get; }

Property Value

Vector<M2ParticleTbc>

PlayableAnimationLookup

Playable-animation fallbacks, one per AnimationData.dbc id (pre-WotLK).

public Vector<M2SequenceFallback> PlayableAnimationLookup { get; }

Property Value

Vector<M2SequenceFallback>

ReplacableTextureLookup

Replacable-texture reverse lookup: replacable id -> texture index or -1.

public Vector<short> ReplacableTextureLookup { get; }

Property Value

Vector<short>

RibbonEmitters

Ribbon (trail) emitters.

public Vector<M2RibbonVanillaToTbc> RibbonEmitters { get; }

Property Value

Vector<M2RibbonVanillaToTbc>

SequenceLookups

Animation-id hash table: AnimationData.dbc id -> sequence index, quadratic probing, -1 empty.

public Vector<short> SequenceLookups { get; }

Property Value

Vector<short>

Sequences

The animation sequences.

public Vector<M2SequenceVanillaToTbc> Sequences { get; }

Property Value

Vector<M2SequenceVanillaToTbc>

SkinProfiles

The skin profiles (LOD views), embedded in the model pre-WotLK; WotLK+ moves them to .skin files.

public Vector<M2SkinProfileTbcToWotlk> SkinProfiles { get; }

Property Value

Vector<M2SkinProfileTbcToWotlk>

TextureCombinerCombos

Second-texture material override combos; present in the layout only under global flag 0x8 (TBC+).

public Vector<ushort> TextureCombinerCombos { get; }

Property Value

Vector<ushort>

TextureFlipbooks

Texture flipbooks (pre-WotLK; never seen engaged).

public Vector<M2TextureFlipbookVanillaToTbc> TextureFlipbooks { get; }

Property Value

Vector<M2TextureFlipbookVanillaToTbc>

TextureLookupTable

Texture lookup: batches select textures through it.

public Vector<ushort> TextureLookupTable { get; }

Property Value

Vector<ushort>

TextureMappingLookupTable

Texture-mapping lookup: -1 environment, 0 first UV set, 1 second (unused since Cata).

public Vector<short> TextureMappingLookupTable { get; }

Property Value

Vector<short>

TextureTransforms

UV animations.

public Vector<M2TextureTransformVanillaToTbc> TextureTransforms { get; }

Property Value

Vector<M2TextureTransformVanillaToTbc>

TextureTransformsLookupTable

Texture-transform lookup: batches select UV animations through it, -1 static.

public Vector<short> TextureTransformsLookupTable { get; }

Property Value

Vector<short>

TextureWeights

Global transparency weights.

public Vector<M2TextureWeightVanillaToTbc> TextureWeights { get; }

Property Value

Vector<M2TextureWeightVanillaToTbc>

Textures

The texture definitions.

public Vector<M2Texture> Textures { get; }

Property Value

Vector<M2Texture>

TransparencyLookupTable

Transparency lookup: batches select texture weights through it.

public Vector<ushort> TransparencyLookupTable { get; }

Property Value

Vector<ushort>

Vertices

The global vertex list (Z-up model space).

public Vector<M2Vertex> Vertices { get; }

Property Value

Vector<M2Vertex>

Methods

Dispose()

Release the native object now. Optional: the finalizer releases it on collection anyway - dispose (or using) when you want native memory back promptly.

public override void Dispose()

EnsureValid()

Validate and raise on the first error instead of returning a report — the assert-style face of validate().

public void EnsureValid()

Read(byte[])

Deserialize file bytes into this entity, replacing its contents. Offsets resolve against the given buffer; sequence-gated data is read inline.

public void Read(byte[] data)

Parameters

data byte[]

the file (or containing-chunk payload) bytes

Validate()

Check the logical integrity contracts this file must satisfy to LOAD in the client — companion-array counts, lookup ranges — which write() deliberately never enforces. Call it before writing when you want to know the result will load. A file read from a client and left unmodified reports no errors; warnings mark states real client files ship.

public ValidationReport Validate()

Returns

ValidationReport

every violated contract, in member order

Write()

Serialize this entity in wowlib's canonical layout (an offset format has no byte-perfect round-trip guarantee; a written entity re-reads equal instead).

public byte[] Write()

Returns

byte[]

the file bytes

Operators

operator ==(M2RootTbc?, M2RootTbc?)

public static bool operator ==(M2RootTbc? l, M2RootTbc? r)

Parameters

l M2RootTbc
r M2RootTbc

Returns

bool

operator !=(M2RootTbc?, M2RootTbc?)

public static bool operator !=(M2RootTbc? l, M2RootTbc? r)

Parameters

l M2RootTbc
r M2RootTbc

Returns

bool