diff --git a/voxygen/src/scene/debug.rs b/voxygen/src/scene/debug.rs index 6cc99c35e3..b0fb2959f7 100644 --- a/voxygen/src/scene/debug.rs +++ b/voxygen/src/scene/debug.rs @@ -265,6 +265,7 @@ pub struct Debug { pending_locals: HashMap, pending_deletes: HashSet, models: HashMap, Bound>)>, + casts_shadow: HashSet, } impl Debug { @@ -275,12 +276,16 @@ impl Debug { pending_locals: HashMap::new(), pending_deletes: HashSet::new(), models: HashMap::new(), + casts_shadow: HashSet::new(), } } pub fn add_shape(&mut self, shape: DebugShape) -> DebugShapeId { let id = DebugShapeId(self.next_shape_id.0); self.next_shape_id.0 += 1; + if matches!(shape, DebugShape::TrainTrack { .. }) { + self.casts_shadow.insert(id); + } self.pending_shapes.insert(id, shape); id } @@ -335,8 +340,10 @@ impl Debug { } pub fn render_shadows<'a>(&'a self, drawer: &mut DebugShadowDrawer<'_, 'a>) { - for (model, locals) in self.models.values() { - drawer.draw(model, locals); + for id in self.casts_shadow.iter() { + if let Some((model, locals)) = self.models.get(id) { + drawer.draw(model, locals); + } } } }