benilla-re systems structs docs

M2DrawSetMaterial

function · models · primitive

Address
0x70c190 · 2232 bytes, up to 0x70ca47
Meaning
Sets an element's blend, alpha test, cull, depth and material colours on the device
Confidence
verified, proof one
Finding
models/render#material-state
Test
models::color_scale_difftest, models::normalize_residual_difftest, models::rgba_pack_value_difftest, models::scale_add_difftest

Finding: Material state in models: drawing

statevalue
colour write mask0 for a depth-only element, else 0xf
blendthe table 0x811fe0 at 7k + blend; for a depth-only element, 1 when blend is 1
alpha referenceblend 0: 0; blend 1: ftol(alpha · 224.0); otherwise 1
cullon unless material flag 4
depth teston unless material flag 8 or instance flag 2
depth writeon unless material flag 0x10 or instance flag 2
normalizeset only without vertex shaders and for kinds other than 2: off when row 0 of a one-bone submesh's bone matrix, or for a kind above 2 of the instance's world matrix, has `

The blend table holds 0, 1, 2, 10, 3, 4, 5 for list 0 and 2, 2, 2, 10, 3, 4, 5 for lists 1 and 2. Blend 5 draws with diffuse 0 and emissive 1, blend 6 with emissive 0.5; other blends use the instance diffuse times the colour animation and the instance emissive, and an unlit material adds the diffuse into the emissive and zeroes the diffuse.

The derivation is in the doc.

Callers 3

Callees 4

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