benilla-re systems structs docs

CParticleEmitter2::DrawModelParticle

function · models · primitive

Address
0x7b4510 · 801 bytes, up to 0x7b4830
Signature
uint32_t __thiscall (CParticleEmitter2 *this, void *particle, const float *frame)
Meaning
Places, tints and shows one model particle's instance, or hides it under the twinkle
Confidence
verified, proof one
Finding
models/modelparticles#model-particle-placement
Test
models::alpha_distance_scale_difftest, models::color_byte_to_f32_difftest, models::flag200_scale_difftest, models::lod_index_scale_difftest, models::quat_billboard_matrix_difftest

Finding: Model particle placement in models: model particles

A drawn model particle samples its gradient (particles#gradients, by the byte +0xc) at its age with the emitter alpha +0x1a8, scales the size by +0x264 under flag 0x200, builds the rotation of its quaternion +0x20, scales it by the size and sets row 3 to the position. It multiplies that by the emitter matrix +0x1fc under flag 0x100, else by the draw's frame when passed, and gives the instance that base matrix, the diffuse (b2, b1, b0)/255 and alpha b3/255 of the colour bytes, and its visible flag; it returns 1. The rotation, with xx = 2x·x, wz = 2z·w and so on:

rowxyz
01 − (zz + yy)xy + wzxz − wy
1xy − wz1 − (zz + xx)yz + wx
2xz + wyyz − wx1 − (yy + xx)

The derivation is in the doc.

Callers 1

Callees 8

Calls and jumps by a bare address, from tables/calls.tsv.