Merge branch 'CapsizeGlimmer/fix_lanterns' into 'master'

Fix infinitys and NaNs in lights

See merge request veloren/veloren!966
This commit is contained in:
Monty Marz 2020-05-04 22:14:33 +00:00
commit 846c3a9a0b

View File

@ -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