pub struct LightRig {
pub lights: [Light; 3],
pub ambient: (i32, i32, i32),
}Expand description
A rig of up to 3 directional lights – the maximum the PSX GTE supports natively.
Fields§
§lights: [Light; 3]Three light slots; unused slots should be Light::OFF.
ambient: (i32, i32, i32)Ambient term added before material multiply. Q3.12 per
channel in an i32 (GTE’s BK register is 20-bit signed).
Implementations§
Source§impl LightRig
impl LightRig
Sourcepub const fn new(lights: [Light; 3], ambient: (i32, i32, i32)) -> Self
pub const fn new(lights: [Light; 3], ambient: (i32, i32, i32)) -> Self
Build a rig from 3 lights + an ambient term.
Sourcepub fn for_object(&self, rotation: &Mat3I16) -> LightRig
pub fn for_object(&self, rotation: &Mat3I16) -> LightRig
Return a new rig with every light’s direction rotated into
the frame in which rotation is the object’s local → world
transform. I.e., if you pass the same Mat3I16 you pass to
scene::load_rotation for RTPS, the returned rig is in
object-local space – correct for feeding LLM when lighting
mesh vertices that are themselves in local space.
Math: world_vert = R × local_vert, so local = R⁻¹ × world,
and since R is a rotation, R⁻¹ = Rᵀ. We compute
local_dir = Rᵀ × world_dir component-wise.
Sourcepub fn rotated(&self, rotation: &Mat3I16) -> LightRig
pub fn rotated(&self, rotation: &Mat3I16) -> LightRig
Return a new rig with every light’s direction rotated by
rotation (direct R × dir, not the transpose).
Used to animate world-space lights over time – e.g. an
orbiting key light. Compose this BEFORE [for_object] so
the per-object transpose applies on top of the animation.