diff options
| author | Valentin Popov <valentin@popov.link> | 2026-11-12 13:04:46 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-11-12 13:04:46 +0300 |
| commit | bcd075820a7fbe72d3c293a4e4365a349c7a9958 (patch) | |
| tree | 8041104b8eff4d9a2f190e4b866c03293dbece67 /crates/fparkan-fx/src | |
| parent | 98d8a99bc162176919ad19593007b2a20252bf84 (diff) | |
| download | fparkan-bcd075820a7fbe72d3c293a4e4365a349c7a9958.tar.xz fparkan-bcd075820a7fbe72d3c293a4e4365a349c7a9958.zip | |
fix(render): disable specular from opposite celestial lights
Diffstat (limited to 'crates/fparkan-fx/src')
| -rw-r--r-- | crates/fparkan-fx/src/sky.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/fparkan-fx/src/sky.rs b/crates/fparkan-fx/src/sky.rs index 1b793f09..4e81df40 100644 --- a/crates/fparkan-fx/src/sky.rs +++ b/crates/fparkan-fx/src/sky.rs @@ -870,6 +870,8 @@ pub struct SkySpriteFrame<'a> { pub struct DirectionalLightFrame { /// False means the light slot must be removed from the light manager. pub active: bool, + /// False for the opposite light, whose native flags disable specular. + pub specular_enabled: bool, /// Direction used by the native light manager. pub direction: [f32; 3], /// RGB value passed to the native light manager without another intensity @@ -880,6 +882,7 @@ pub struct DirectionalLightFrame { impl DirectionalLightFrame { const INACTIVE: Self = Self { active: false, + specular_enabled: false, direction: [0.0; 3], color: [0.0; 3], }; @@ -1146,11 +1149,13 @@ impl SunFrame { [ DirectionalLightFrame { active: true, + specular_enabled: true, direction: self.direction, color: self.color, }, DirectionalLightFrame { active: true, + specular_enabled: false, direction: self.direction.map(|component| -component), color: self.secondary_color, }, @@ -2040,6 +2045,8 @@ mod tests { ] ); let lights = frame.directional_lights(); + assert!(lights[0].specular_enabled); + assert!(!lights[1].specular_enabled); assert_eq!(lights[0].color, frame.color); assert_eq!(lights[1].direction, frame.direction.map(|value| -value)); assert_eq!( |
