diff --git a/src/main.rs b/src/main.rs index 48885b5..107a070 100644 --- a/src/main.rs +++ b/src/main.rs @@ -35,6 +35,7 @@ const FG: Color = Color::new(0.7686, 0.7216, 0.4078, 1.0); const SPEED: f64 = 0.1; const BOING_RADIUS: f64 = 30.0; const LIGHT_RADIUS: f32 = 128.; +const WALL_THICKNESS: f32 = 5.; #[macroquad::main("BasicShapes")] async fn main() { @@ -90,7 +91,18 @@ async fn main() { let w1 = w1.as_f32(); let w2 = w2.as_f32(); if shadows::wall_needs_to_be_drawn(w1, w2, mouse_position, LIGHT_RADIUS) { - shadows::draw_wall(w1, w2, mouse_position, LIGHT_RADIUS); + let perpendicular = (w1 - w2).perp(); + let shift = perpendicular / perpendicular.length() * WALL_THICKNESS; + let points = [ + w1 + shift, + w1 - shift, + w2 + shift, + w2 - shift, + ]; + shadows::draw_wall(points[0], points[1], mouse_position, LIGHT_RADIUS); + shadows::draw_wall(points[1], points[2], mouse_position, LIGHT_RADIUS); + shadows::draw_wall(points[2], points[3], mouse_position, LIGHT_RADIUS); + shadows::draw_wall(points[3], points[0], mouse_position, LIGHT_RADIUS); } }