benilla-re systems structs docs

CGxDeviceD3d::SetMaterial

function · gx · primitive

Address
0x5a2e20 · 144 bytes, up to 0x5a2eaf
Signature
void __thiscall (CGxDeviceD3d *this, uint32_t diffuse, uint32_t emissive, uint32_t specular, float power)
Meaning
Builds the D3DMATERIAL9 from packed colours and sets it
Confidence
verified, proof one
Finding
gx/draw#lighting-at-draw-time

Finding: Lighting at draw time in gx: drawing

Before each draw Direct3D runs 0x5a1b20: it flushes render state (0x594210), then 0x5a1b60, which decides lighting from id 14. Lighting on: LIGHTING is capability bit 0, AMBIENT id 6, and each dirty light is set and enabled. Lighting off with a vertex colour or id 1 equal to 0xffffffff: LIGHTING 0 and AMBIENT id 6. Lighting off with no vertex colour and id 1 not white: all four lights disabled, LIGHTING 1, AMBIENT 0xffffffff. Then 0x5a1dd0 sets FILLMODE to solid (3) or wireframe (2) from capability bit 9, 0x5a1e30 the diffuse and ambient material source to the vertex colour when the format has one and to the material otherwise, and 0x5a1ee0 the changed clip planes.

The derivation is in the doc.

Callers 1

Callees 1

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