benilla-re systems structs docs

animation

rowsnamedverifiedproof twotested
functions0––––
globals0––––
structs0––––
fields0––––
all0––––

Docs

animation: attachment space

The space in which a model instance's matrices are built. Every bone matrix, every attachment matrix and every transposed constant a draw uploads is relative to the camera, not to the map: the world position the unit's model carries is cancelled once, at the root instance, by the scene's view matrix, and a child instance starts from its parent's bone matrix. The device is left with identity view and world transforms for the whole model pass. This doc holds the three facts that make that so; the arithmetic of each is models/scene and kernel.

animation: billboards

The last stage of a bone in the bone loop: a bone whose flags carry a billboard bit has its palette matrix turned to face the camera. The stage reads the palette entry the bone has just been given (pose), keeps the length of each row and the position of the bone's pivot, and in the billboard cases replaces the directions of the rows. It runs in the space of the palette, which for a scene-driven instance is the view the scene passes as the root parent matrix (models/scene#animate-pass), so the camera axes are constants there. The code is 0x7151f9 through 0x71594e of CM2Model::Animate, with its jump table at 0x718788 and index bytes at 0x71879c.

animation: bone clocks

What a bone's state holds and how its two clocks are computed. Every bone of an instance has a state of 0x118 bytes with two sequence slots, the primary and the blend. The head of the bone loop turns each slot's record, cursors, speed and offset into a time and a range slot, copies them from the parent for a bone without a record, ends the blend slot when its fade is over, and picks the blend weight that the samplers use. The code is 0x714530 through 0x71492d in CM2Model::Animate. models/animation#sequence-time and #blend-weight state the formulas in short; this doc gives the branches and the order.

animation: element loops

After the bone loop, the animate pass runs one loop over each family of animated records in the shared model header and samples their tracks into the instance's state arrays: colours, transparency, texture frames, texture transforms, lights, cameras, ribbons, particle emitters and attachment bytes. Each family has a header count and array, a record stride, a fixed set of tracks at fixed record offsets, and a state of the shape tracks gives each value. This doc maps the families and states; what the values mean to the draw is models/lights, models/ribbons, models/emission and models/render. The code is 0x715966 through 0x7185e1 of CM2Model::Animate.

animation: model hosts

What plays the animation of a model that no unit controls: the first sequence a model arms, the completion callbacks the placed-doodad and game object code install, the per-frame registration that puts a model on its scene's animate list, and the clock a model's global sequences run from. A map doodad, a world game object and a spell effect all go through the same model instance (models/model); they differ in who installs the callbacks and who registers the model each frame.

animation: the animate pass

One call of CM2Model::Animate poses a model instance for a frame. It reads the instance's bone states and the arrays of the shared model's header, and writes the bone matrices, the sampled values of every animated element, the instance's world matrix and the inputs its draw colours come from. Then it calls itself for each visible attached child. The code is one function of M2Model.cpp, which models owns, so animation owns no function row and no object file. This doc holds the pass as a whole: its gates and exits, what runs before the bone loop and after the element loops, and the arrays it walks. The bones' clocks are clock, their matrices pose and billboards, the sampling of a track tracks, the element loops elements, and the calls that start a sequence playback.

animation: overview

How a model instance is animated: the clocks of its bones, the sampling of key tracks, the bone matrices, the billboards, the animated elements of a model, the calls that start a sequence, and the object-layer code that chooses what a unit plays. The system has no object file and no function of its own. The evaluator is one function of models' M2Model.cpp, and the choosing of sequences belongs to the unit code of objectlayer, so every row it touches is owned there and every doc says Roots: none.

The docs split by topic. kernel is the pass as a whole, clock the bone clocks, pose the bone matrices, billboards the facing stage, tracks the sampling of a track, elements the loops over colours, lights, cameras, ribbons and emitters, attachspace the space the matrices are built in, playback the call that starts a sequence, units the unit tracks that call it, and hosts the models no unit controls. models/animation states the same code in short, and objectlayer/unitanim holds the unit's side of the sequence tables.

animation: starting a sequence

What a play call does to the bone states that the animate pass reads. CM2Model::PlayAnimation (0x7121a0) arms one bone: it picks the sequence record, a variation and a repeat count, writes the bone's primary slot or its blend slot with a play window, and starts or ends a fade. The animate pass then spreads the bone's time to the bones below it (clock). Two setters retime a running play. A call made before the model has loaded is queued and replayed (models/model#deferred-calls). models/animation#playing-an-animation states the arithmetic; this doc gives the order of the steps, which bone and slot are written, and when a call changes nothing.

animation: bone matrices

How the bone loop turns a bone's clocks into its matrix. For each bone it picks the matrix of its parent, edits that matrix for the bone's ignore-parent flags, builds the bone's own matrix from its rotation, scale and translation tracks, multiplies the two into the matrix palette at instance +0x94, and then hands the result to the billboard stage (billboards). The code is 0x71492d through 0x7151f9 of CM2Model::Animate. Matrices are row-major 4×4 floats and a point is a row vector, so a product a · b applies a first. models/animation#bone-transform states the result in short; this doc gives the order of the steps and the rounding.

animation: tracks

How the pass reads an animated value. A track is a 0x1c-byte record in the shared model: an interpolation word, a global sequence word, and count and pointer pairs for ranges, key times and values. The key search turns a time into a pair of keys and a fraction, and each element family reads its values from the pair by a fixed block of code. This doc gives the search, the shape of a sampling block with its blend, the interpolations and the quaternion blend. models/animation#key-lookup states the search in short. Matrix and quaternion routines that the client picks by processor are stated for the one a current SSE processor runs (models/animation#dispatched-matrix-math).

animation: unit tracks

How a unit's animation code arms the bone slots of playback. A unit has up to three tracks: bone 0 of its body model, a split key bone of the body model (+0xd5c, the upper body), and bone 0 of its mount model. CGUnit_C::PlayAnimation (0x5fe2f0) reads the three tracks' states, routes the requested animation onto one or two of them, and plays each through PlayTrack (0x5fdba0). When a sequence ends, the model calls the unit back and the unit releases the key bone or picks the next base animation. objectlayer/unitanim holds the animation sets and the choice of the base animation; this doc holds the routing, the hand-overs and the release.

Closure

The docs list no roots.

Functions 0

addressnameclassconfidencetestclosure