Hitboxes no longer cast shadows.

This commit is contained in:
Avi Weinstock 2022-11-10 18:26:11 -05:00
parent 18657fdb66
commit e72719ddf1

View File

@ -265,6 +265,7 @@ pub struct Debug {
pending_locals: HashMap<DebugShapeId, ([f32; 4], [f32; 4], [f32; 4])>,
pending_deletes: HashSet<DebugShapeId>,
models: HashMap<DebugShapeId, (Model<DebugVertex>, Bound<Consts<DebugLocals>>)>,
casts_shadow: HashSet<DebugShapeId>,
}
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);
}
}
}
}