mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix infinitys and NaNs in lights
This commit is contained in:
parent
e5a87f4338
commit
28c454f9ca
@ -136,7 +136,11 @@ impl FigureMgr {
|
||||
if let Some(emitter) = light_emitter_opt {
|
||||
(
|
||||
emitter.col,
|
||||
emitter.strength,
|
||||
if emitter.strength.is_finite() {
|
||||
emitter.strength
|
||||
} else {
|
||||
0.0
|
||||
},
|
||||
emitter.flicker,
|
||||
emitter.animated,
|
||||
)
|
||||
@ -149,6 +153,9 @@ impl FigureMgr {
|
||||
if let Some(state) = self.character_states.get(&entity) {
|
||||
light_anim.offset = state.lantern_offset;
|
||||
}
|
||||
if !light_anim.strength.is_finite() {
|
||||
light_anim.strength = 0.0;
|
||||
}
|
||||
if animated {
|
||||
let flicker = (rand::random::<f32>() - 0.5) * flicker / dt.sqrt();
|
||||
// Close gap between current and target strength by 95% per second
|
||||
|
Loading…
Reference in New Issue
Block a user