CM2Model
struct · models · 1064 bytes
- Meaning
- Holds a model instance: its scene, shared model, transforms, animation state and children
- Confidence
- verified, proof one
- Finding
- models/model#instance-object
Finding: Instance object in models: the instance
The constructor sets the reference count to 1, the base, world and transport matrices to
identity, the diffuse multiplier to (1, 1, 1), the depth-fill flag and the two loaded-children
flags to 1, and picks the skinning routine. Initialize links the instance to its scene, adds a
reference to the shared model and, for a copy, to the source instance, and attaches a new instance
of each of the source's children at the same attachment id.
| offset | holds |
|---|---|
+0x010, +0x014 | loaded, textures loaded |
+0x02c, +0x030, +0x034 | scene, shared model, copy source |
+0x038, +0x03c | deferred call queue: head, address of the tail link |
+0x040 | frame of the last animation |
+0x090, +0x094 | bone states (0x118 each), bone matrices (64 bytes each) |
+0x0bc, +0x0fc, +0x13c | base matrix, world matrix, transport matrix |
+0x180, +0x184, +0x190 | alpha, diffuse multiplier, emissive colour |
+0x1cc, +0x1d0, +0x1d4 | parent, attachment id, attachment index in the parent |
+0x1dc, +0x1e4 | first child, next sibling |
+0x3b8 | lighting record in use |
The derivation is in the doc.
Fields 31
| offset | size | type | name | meaning | confidence | finding |
|---|---|---|---|---|---|---|
0x0000 | 4 | uint32_t | m_refCount | Holds the instance's reference count | verified, proof one | models/model#instance-object |
0x0010 | 4 | uint32_t | m_loaded | Holds 1 once the instance's state is built | verified, proof one | models/model#instance-object |
0x0014 | 4 | uint32_t | m_texturesLoaded | Holds 1 once the instance's textures are loaded | verified, proof one | models/model#instance-object |
0x002c | 4 | M2Scene * | m_scene | Holds the scene the instance belongs to | verified, proof one | models/model#instance-object |
0x0030 | 4 | CM2Shared * | m_shared | Holds the shared model of the instance's file | verified, proof one | models/model#instance-object |
0x0034 | 4 | CM2Model * | m_copySource | Holds the instance copied from, until the load ends | verified, proof one | models/model#instance-object |
0x0038 | 4 | void * | m_deferredHead | Holds the first deferred call record | verified, proof one | models/model#instance-object |
0x003c | 4 | void * | m_deferredTail | Holds the address of the deferred queue's tail link | verified, proof one | models/model#instance-object |
0x0040 | 4 | uint32_t | m_animatedFrame | Holds the scene frame the instance last animated in | verified, proof one | models/model#instance-object |
0x0070 | 4 | void * | m_doneCallback | Holds the animation-done callback, or null | verified, proof one | animation/hosts#doodad-model |
0x0078 | 4 | uint32_t | m_doneArg1 | Holds the first stored argument the done callback is called with | verified, proof one | animation/hosts#doodad-model |
0x007c | 4 | uint32_t | m_doneArg2 | Holds the second stored argument the done callback is called with | verified, proof one | animation/hosts#doodad-model |
0x0090 | 4 | void * | m_boneStates | Holds the bone states, 0x118 bytes each | verified, proof one | models/model#instance-object |
0x0094 | 4 | void * | m_boneMatrices | Holds the bone matrices, 64 bytes each | verified, proof one | models/model#instance-object |
0x00bc | 64 | float[16] | m_baseMatrix | Holds the instance's base matrix | verified, proof one | models/model#instance-object |
0x00fc | 64 | float[16] | m_worldMatrix | Holds the instance's world matrix | verified, proof one | models/model#instance-object |
0x013c | 64 | float[16] | m_transportMatrix | Holds the copied transport matrix the reference frame points at | verified, proof one | models/model#reference-frame |
0x017c | 4 | float * | m_referenceFrame | Holds the reference frame, the transport matrix, or null | verified, proof one | models/model#reference-frame |
0x0180 | 4 | float | m_alpha | Holds the instance alpha | verified, proof one | models/model#instance-object |
0x0184 | 12 | float[3] | m_diffuse | Holds the diffuse colour multiplier | verified, proof one | models/model#instance-object |
0x0190 | 12 | float[3] | m_emissive | Holds the emissive colour | verified, proof one | models/model#instance-object |
0x01cc | 4 | CM2Model * | m_parent | Holds the instance this one is attached to | verified, proof one | models/model#instance-object |
0x01d0 | 4 | uint32_t | m_attachId | Holds the attachment id it is attached at | verified, proof one | models/model#instance-object |
0x01d4 | 4 | uint32_t | m_attachIndex | Holds the attachment index in the parent, 0xffff while unresolved | verified, proof one | models/model#instance-object |
0x01dc | 4 | CM2Model * | m_firstChild | Holds the first attached instance | verified, proof one | models/model#instance-object |
0x01e4 | 4 | CM2Model * | m_nextSibling | Holds the next instance attached to the same parent | verified, proof one | models/model#instance-object |
0x03b8 | 4 | M2Lighting * | m_lighting | Holds the lighting record the instance draws with | verified, proof one | models/model#instance-object |
0x03bc | 4 | void * | m_lightingCallback | Holds the callback that adds to the instance lighting record | verified, proof one | models/model#instance-setters |
0x03c0 | 4 | void * | m_lightingArg | Holds the lighting callback argument | verified, proof one | models/model#instance-setters |
0x03c4 | 4 | void * | m_cameraStates | Holds the camera states, 0x84 bytes each with the camera at +0x80 | verified, proof one | models/model#key-bones-and-cameras |
0x03ec | 4 | M2TextureUnit * | m_ownUnits | Holds the instance's own batch table: whole copies of the first unit of each run it keeps | verified, proof two | models/records#texture-unit-layer |