M2DrawSetMaterial
function · models · primitive
- Address
0x70c190· 2232 bytes, up to0x70ca47- 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
| state | value |
|---|---|
| colour write mask | 0 for a depth-only element, else 0xf |
| blend | the table 0x811fe0 at 7k + blend; for a depth-only element, 1 when blend is 1 |
| alpha reference | blend 0: 0; blend 1: ftol(alpha · 224.0); otherwise 1 |
| cull | on unless material flag 4 |
| depth test | on unless material flag 8 or instance flag 2 |
| depth write | on unless material flag 0x10 or instance flag 2 |
| normalize | set 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
- M2DrawBeginEmitter models
- M2DrawBatch models
- M2DrawBatchedRun models
Callees 4
- __ftol crt
- GxRsSetWord gx
- GxRsSetFloat gx
- GxRsSet gx
Calls and jumps by a bare address, from tables/calls.tsv.