diff --git a/rtsim/src/gen/mod.rs b/rtsim/src/gen/mod.rs index a61e613b12..d60956c04c 100644 --- a/rtsim/src/gen/mod.rs +++ b/rtsim/src/gen/mod.rs @@ -118,6 +118,7 @@ impl Data { kind, PlotKind::House(_) | PlotKind::Workshop(_) + | PlotKind::AirshipDock(_) | PlotKind::Plaza | PlotKind::SavannahPit(_) | PlotKind::SavannahHut(_) diff --git a/world/src/site2/mod.rs b/world/src/site2/mod.rs index a1f89ce381..6161e56dd7 100644 --- a/world/src/site2/mod.rs +++ b/world/src/site2/mod.rs @@ -591,7 +591,7 @@ impl Site { (8.0, 3), (5.0, 4), (5.0, 5), - (30.0, 6), + (15.0, 6), ]); let mut castles = 0; diff --git a/world/src/site2/plot/airship_dock.rs b/world/src/site2/plot/airship_dock.rs index 620165b64a..36ed15f3c7 100644 --- a/world/src/site2/plot/airship_dock.rs +++ b/world/src/site2/plot/airship_dock.rs @@ -1,15 +1,17 @@ use super::*; -use crate::Land; +use crate::{site2::gen::PrimitiveTransform, Land}; use common::terrain::{Block, BlockKind, SpriteKind}; use rand::prelude::*; +use std::f32::consts::PI; use vek::*; - /// Represents house data generated by the `generate()` method pub struct AirshipDock { /// Axis aligned bounding region for the house bounds: Aabr, /// Approximate altitude of the door tile pub(crate) alt: i32, + rotation: f32, + pub door_tile: Vec2, } impl AirshipDock { @@ -21,14 +23,26 @@ impl AirshipDock { door_dir: Vec2, tile_aabr: Aabr, ) -> Self { + let door_tile_pos: Vec2 = site.tile_center_wpos(door_tile); let bounds = Aabr { min: site.tile_wpos(tile_aabr.min), max: site.tile_wpos(tile_aabr.max), }; + let rotation = if door_dir.y < 0 { + PI + } else if door_dir.x < 0 { + PI / 2.0 + } else if door_dir.y > 0 { + 3.0 * PI / 2.0 + } else { + 0.0 + }; Self { + door_tile: door_tile_pos, bounds, alt: land.get_alt_approx(site.tile_center_wpos(door_tile + door_dir)) as i32, + rotation, } } } @@ -47,23 +61,31 @@ impl Structure for AirshipDock { let center = self.bounds.center(); let height = base + 28; - // Base + //rotation + + //lower doorway painter - .aabb(Aabb { - min: (self.bounds.min + 1).with_z(base - 16), - max: Vec2::new(self.bounds.max.x, self.bounds.max.y).with_z(base), - }) - .fill(brick.clone()); + .cylinder_with_radius( + Vec2::new(center.x - 1, center.y + 12).with_z(base - 5), + 4.5, + 7.0, + ) + .rotate_about_min(Mat3::new(1, 0, 0, 0, 0, -1, 0, 1, 0)) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(wood.clone()); //bracing painter .cylinder_with_radius(center.with_z(height), 7.0, 7.0) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(wood.clone()); painter .cylinder_with_radius(center.with_z(height + 1), 7.0, 5.0) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .clear(); painter .cylinder_with_radius(center.with_z(height + 7), 8.0, 1.0) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(wood.clone()); //platform edging @@ -75,8 +97,9 @@ impl Structure for AirshipDock { }, 5.0, ) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(woodalt.clone()); - //platforrm + //platform painter .superquadric( Aabb { @@ -85,6 +108,7 @@ impl Structure for AirshipDock { }, 5.0, ) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(wood.clone()); painter .superquadric( @@ -94,6 +118,7 @@ impl Structure for AirshipDock { }, 5.0, ) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .clear(); //platform walkway bits painter @@ -101,44 +126,87 @@ impl Structure for AirshipDock { min: Vec2::new(center.x - 2, center.y - 22).with_z(height + 8), max: Vec2::new(center.x + 2, center.y + 16).with_z(height + 10), }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(woodalt.clone()); painter .aabb(Aabb { min: Vec2::new(center.x - 1, center.y - 22).with_z(height + 8), max: Vec2::new(center.x + 1, center.y + 16).with_z(height + 10), }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(wood.clone()); painter .aabb(Aabb { min: Vec2::new(center.x - 2, center.y - 16).with_z(height + 9), max: Vec2::new(center.x + 2, center.y + 10).with_z(height + 10), }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .clear(); painter .aabb(Aabb { min: Vec2::new(center.x - 1, center.y - 22).with_z(height + 9), max: Vec2::new(center.x + 1, center.y + 16).with_z(height + 10), }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .clear(); //column painter .cylinder_with_radius(center.with_z(base), 6.0, 45.0) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(brick.clone()); //column thick bits painter .cylinder_with_radius(center.with_z(base + 35), 7.0, 3.0) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(brick.clone()); painter .cylinder_with_radius(center.with_z(base), 7.0, 1.0) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(brick.clone()); painter .cylinder_with_radius(center.with_z(base), 5.0, 45.0) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .clear(); + //lower doorway cut + painter + .cylinder_with_radius( + Vec2::new(center.x - 1, center.y + 12).with_z(base - 5), + 3.5, + 7.0, + ) + .rotate_about_min(Mat3::new(1, 0, 0, 0, 0, -1, 0, 1, 0)) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .clear(); + // Base + painter + .aabb(Aabb { + min: Vec2::new(center.x - 11, center.y - 11).with_z(base - 16), + max: Vec2::new(center.x + 11, center.y + 11).with_z(base), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(brick.clone()); + + //stair cut + painter + .aabb(Aabb { + min: Vec2::new(center.x - 6, center.y + 9).with_z(base - 1), + max: Vec2::new(center.x + 4, center.y + 11).with_z(base), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .clear(); + painter + .aabb(Aabb { + min: Vec2::new(center.x - 5, center.y + 10).with_z(base - 2), + max: Vec2::new(center.x + 3, center.y + 11).with_z(base - 1), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .clear(); //cone painter .cone_with_radius(center.with_z(base + 45), 8.0, 18.0) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(wood.clone()); //remove 1/4 cyl painter @@ -146,12 +214,14 @@ impl Structure for AirshipDock { min: Vec2::new(center.x - 1, center.y + 1).with_z(height + 9), max: Vec2::new(center.x + 6, center.y + 6).with_z(height + 17), }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(brick.clone()); painter .aabb(Aabb { min: Vec2::new(center.x, center.y + 2).with_z(height + 9), max: Vec2::new(center.x + 6, center.y + 7).with_z(height + 17), }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .clear(); //platform cleanup painter @@ -159,6 +229,7 @@ impl Structure for AirshipDock { min: Vec2::new(center.x - 2, center.y - 15).with_z(height + 8), max: Vec2::new(center.x + 6, center.y + 9).with_z(height + 9), }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(wood.clone()); //upper door @@ -167,30 +238,50 @@ impl Structure for AirshipDock { min: Vec2::new(center.x + 5, center.y - 2).with_z(height + 10), max: Vec2::new(center.x + 7, center.y + 2).with_z(height + 13), }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(brick.clone()); painter .aabb(Aabb { min: Vec2::new(center.x + 5, center.y - 1).with_z(height + 10), max: Vec2::new(center.x + 7, center.y + 1).with_z(height + 15), }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(brick.clone()); painter .aabb(Aabb { min: Vec2::new(center.x + 5, center.y - 1).with_z(height + 10), max: Vec2::new(center.x + 7, center.y + 1).with_z(height + 13), }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .clear(); //door sprites - painter.rotated_sprite( - Vec2::new(center.x + 6, center.y - 1).with_z(height + 10), - SpriteKind::Door, - 2, - ); - painter.rotated_sprite( - Vec2::new(center.x + 6, center.y).with_z(height + 10), - SpriteKind::Door, - 6, - ); + + let door_rot = if self.rotation == 0.0 { + (2, 6) + } else if self.rotation == PI / 2.0 { + (4, 0) + } else if self.rotation == PI { + (6, 2) //good + } else { + (0, 4) + }; + let sprite_fill = Fill::Block(Block::air(SpriteKind::Door).with_ori(door_rot.0).unwrap()); + painter + .aabb(Aabb { + min: Vec3::new(center.x + 6, center.y - 1, height + 10), + max: Vec3::new(center.x + 7, center.y + 0, height + 11), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + let sprite_fill = Fill::Block(Block::air(SpriteKind::Door).with_ori(door_rot.1).unwrap()); + painter + .aabb(Aabb { + min: Vec3::new(center.x + 6, center.y + 0, height + 10), + max: Vec3::new(center.x + 7, center.y + 1, height + 11), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + //bracing diagonal bits painter .line( @@ -198,6 +289,7 @@ impl Structure for AirshipDock { Vec2::new(center.x + 11, center.y - 3).with_z(height + 8), 0.8, ) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(wood.clone()); painter .line( @@ -205,6 +297,7 @@ impl Structure for AirshipDock { Vec2::new(center.x + 11, center.y + 2).with_z(height + 8), 0.8, ) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(wood.clone()); // painter @@ -213,6 +306,7 @@ impl Structure for AirshipDock { Vec2::new(center.x - 6, center.y - 3).with_z(height), 0.8, ) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(wood.clone()); painter .line( @@ -220,6 +314,7 @@ impl Structure for AirshipDock { Vec2::new(center.x - 6, center.y + 2).with_z(height), 0.8, ) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(wood.clone()); // painter @@ -228,6 +323,7 @@ impl Structure for AirshipDock { Vec2::new(center.x - 3, center.y - 6).with_z(height), 0.8, ) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(wood.clone()); painter .line( @@ -235,6 +331,7 @@ impl Structure for AirshipDock { Vec2::new(center.x + 2, center.y - 6).with_z(height), 0.8, ) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(wood.clone()); // painter @@ -243,6 +340,7 @@ impl Structure for AirshipDock { Vec2::new(center.x - 3, center.y + 9).with_z(height + 7), 0.8, ) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(wood.clone()); painter .line( @@ -250,11 +348,13 @@ impl Structure for AirshipDock { Vec2::new(center.x + 2, center.y + 9).with_z(height + 7), 0.8, ) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(wood.clone()); //stairs painter .cylinder_with_radius(center.with_z(height + 8), 5.0, 1.0) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .clear(); let stairs_clear1 = painter.cylinder_with_radius(center.with_z(base), 5.0, 38.0); @@ -264,7 +364,8 @@ impl Structure for AirshipDock { stairs_clear1, dungeon::spiral_staircase(center.with_z(base + 3), 6.0, 0.5, 9.0), )) - .fill(brick.clone()); + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(wood.clone()); //clean up interface at top painter @@ -272,101 +373,115 @@ impl Structure for AirshipDock { min: Vec2::new(center.x + 1, center.y + 3).with_z(height + 8), max: Vec2::new(center.x + 4, center.y + 5).with_z(height + 9), }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(wood.clone()); painter .aabb(Aabb { min: Vec2::new(center.x + 0, center.y + 2).with_z(height + 9), max: Vec2::new(center.x + 6, center.y + 7).with_z(height + 10), }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(brick.clone()); painter .aabb(Aabb { min: Vec2::new(center.x + 1, center.y + 3).with_z(height + 9), max: Vec2::new(center.x + 6, center.y + 7).with_z(height + 10), }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .clear(); painter .aabb(Aabb { min: Vec2::new(center.x + 0, center.y + 2).with_z(height + 9), max: Vec2::new(center.x + 1, center.y + 3).with_z(height + 17), }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) .fill(brick.clone()); - //windows - painter.fill( - painter.aabb(Aabb { + //corner column + painter + .aabb(Aabb { + min: Vec2::new(center.x + 0, center.y + 2).with_z(height + 9), + max: Vec2::new(center.x + 1, center.y + 3).with_z(height + 17), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(brick.clone()); + + let window_rot = if self.rotation == 0.0 || self.rotation == PI { + (2, 4) + } else { + (4, 2) + }; + let sprite_fill = Fill::Block( + Block::air(SpriteKind::Window1) + .with_ori(window_rot.0) + .unwrap(), + ); + //upper window + painter + .aabb(Aabb { min: Vec2::new(center.x - 6, center.y - 1).with_z(height + 12), max: Vec2::new(center.x - 5, center.y + 1).with_z(height + 15), - }), - Fill::Block(Block::air(SpriteKind::Window1).with_ori(2).unwrap()), - ); + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + //lower windows - painter.fill( - painter.aabb(Aabb { + painter + .aabb(Aabb { min: Vec2::new(center.x - 6, center.y - 1).with_z(base + 19), max: Vec2::new(center.x - 5, center.y + 1).with_z(base + 22), - }), - Fill::Block(Block::air(SpriteKind::Window1).with_ori(2).unwrap()), - ); - - painter.fill( - painter.aabb(Aabb { + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + painter + .aabb(Aabb { min: Vec2::new(center.x - 6, center.y - 1).with_z(base + 1), max: Vec2::new(center.x - 5, center.y + 1).with_z(base + 4), - }), - Fill::Block(Block::air(SpriteKind::Window1).with_ori(2).unwrap()), - ); - - painter.fill( - painter.aabb(Aabb { + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + painter + .aabb(Aabb { min: Vec2::new(center.x + 5, center.y - 1).with_z(base + 4), max: Vec2::new(center.x + 6, center.y + 1).with_z(base + 7), - }), - Fill::Block(Block::air(SpriteKind::Window1).with_ori(2).unwrap()), - ); - painter.fill( - painter.aabb(Aabb { + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + painter + .aabb(Aabb { min: Vec2::new(center.x + 5, center.y - 1).with_z(base + 22), max: Vec2::new(center.x + 6, center.y + 1).with_z(base + 25), - }), - Fill::Block(Block::air(SpriteKind::Window1).with_ori(2).unwrap()), - ); - - painter.fill( - painter.aabb(Aabb { + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + painter + .aabb(Aabb { min: Vec2::new(center.x + 5, center.y - 1).with_z(base + 30), max: Vec2::new(center.x + 6, center.y + 1).with_z(base + 33), - }), - Fill::Block(Block::air(SpriteKind::Window1).with_ori(2).unwrap()), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + + let sprite_fill = Fill::Block( + Block::air(SpriteKind::Window1) + .with_ori(window_rot.1) + .unwrap(), ); //side windows - painter.fill( - painter.aabb(Aabb { + painter + .aabb(Aabb { min: Vec2::new(center.x - 1, center.y + 5).with_z(base + 17), max: Vec2::new(center.x + 1, center.y + 6).with_z(base + 20), - }), - Fill::Block(Block::air(SpriteKind::Window1).with_ori(4).unwrap()), - ); - - painter.fill( - painter.aabb(Aabb { + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + painter + .aabb(Aabb { min: Vec2::new(center.x - 1, center.y - 6).with_z(base + 13), max: Vec2::new(center.x + 1, center.y - 5).with_z(base + 16), - }), - Fill::Block(Block::air(SpriteKind::Window1).with_ori(4).unwrap()), - ); - //lower doorway - painter - .aabb(Aabb { - min: Vec2::new(center.x - 4, center.y + 4).with_z(base + 0), - max: Vec2::new(center.x + 1, center.y + 7).with_z(base + 4), }) - .clear(); - painter - .aabb(Aabb { - min: Vec2::new(center.x - 4, center.y + 8).with_z(base), - max: Vec2::new(center.x + 1, center.y + 9).with_z(base + 1), - }) - .clear(); + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + //lights painter.rotated_sprite( Vec2::new(center.x - 3, center.y + 5).with_z(base + 8), @@ -451,93 +566,133 @@ impl Structure for AirshipDock { ); //upper lighting - painter.rotated_sprite( - Vec2::new(center.x + 14, center.y + 8).with_z(base + 35), - SpriteKind::Lantern, - 6, - ); - painter.rotated_sprite( - Vec2::new(center.x + 14, center.y - 15).with_z(base + 35), - SpriteKind::Lantern, - 6, - ); - painter.rotated_sprite( - Vec2::new(center.x - 11, center.y + 8).with_z(base + 35), - SpriteKind::Lantern, - 6, - ); - painter.rotated_sprite( - Vec2::new(center.x - 11, center.y - 15).with_z(base + 35), - SpriteKind::Lantern, - 6, - ); + let sprite_fill = Fill::Block(Block::air(SpriteKind::Lantern).with_ori(2).unwrap()); - painter.rotated_sprite( - Vec2::new(center.x + 4, center.y + 5).with_z(base + 44), - SpriteKind::Lantern, - 6, - ); - painter.rotated_sprite( - Vec2::new(center.x + 4, center.y - 5).with_z(base + 44), - SpriteKind::Lantern, - 6, - ); - painter.rotated_sprite( - Vec2::new(center.x - 5, center.y + 4).with_z(base + 44), - SpriteKind::Lantern, - 6, - ); - painter.rotated_sprite( - Vec2::new(center.x - 5, center.y - 5).with_z(base + 44), - SpriteKind::Lantern, - 6, - ); + //on walkway lamps + painter + .aabb(Aabb { + min: Vec3::new(center.x - 2, center.y + 15, height + 7), + max: Vec3::new(center.x - 1, center.y + 16, height + 8), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + painter + .aabb(Aabb { + min: Vec3::new(center.x + 1, center.y + 15, height + 7), + max: Vec3::new(center.x + 2, center.y + 16, height + 8), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + painter + .aabb(Aabb { + min: Vec3::new(center.x - 2, center.y - 21, height + 7), + max: Vec3::new(center.x - 1, center.y - 22, height + 8), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + painter + .aabb(Aabb { + min: Vec3::new(center.x + 1, center.y - 21, height + 7), + max: Vec3::new(center.x + 2, center.y - 22, height + 8), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + + //on platform lamps + painter + .aabb(Aabb { + min: Vec3::new(center.x - 11, center.y + 8, height + 7), + max: Vec3::new(center.x - 10, center.y + 9, height + 8), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + painter + .aabb(Aabb { + min: Vec3::new(center.x + 14, center.y + 8, height + 7), + max: Vec3::new(center.x + 15, center.y + 9, height + 8), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + painter + .aabb(Aabb { + min: Vec3::new(center.x - 11, center.y - 15, height + 7), + max: Vec3::new(center.x - 10, center.y - 14, height + 8), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + painter + .aabb(Aabb { + min: Vec3::new(center.x + 14, center.y - 15, height + 7), + max: Vec3::new(center.x + 15, center.y - 14, height + 8), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + //on cone lamps + painter + .aabb(Aabb { + min: Vec3::new(center.x - 6, center.y + 5, height + 16), + max: Vec3::new(center.x - 5, center.y + 6, height + 17), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + painter + .aabb(Aabb { + min: Vec3::new(center.x + 5, center.y + 5, height + 16), + max: Vec3::new(center.x + 6, center.y + 6, height + 17), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + painter + .aabb(Aabb { + min: Vec3::new(center.x - 6, center.y - 6, height + 16), + max: Vec3::new(center.x - 5, center.y - 5, height + 17), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + painter + .aabb(Aabb { + min: Vec3::new(center.x + 5, center.y - 6, height + 16), + max: Vec3::new(center.x + 6, center.y - 5, height + 17), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); - painter.rotated_sprite( - Vec2::new(center.x + 1, center.y + 15).with_z(base + 35), - SpriteKind::Lantern, - 6, - ); - painter.rotated_sprite( - Vec2::new(center.x + 1, center.y - 22).with_z(base + 35), - SpriteKind::Lantern, - 6, - ); - painter.rotated_sprite( - Vec2::new(center.x - 2, center.y + 15).with_z(base + 35), - SpriteKind::Lantern, - 6, - ); - painter.rotated_sprite( - Vec2::new(center.x - 2, center.y - 22).with_z(base + 35), - SpriteKind::Lantern, - 6, - ); //interior - painter.rotated_sprite( - Vec2::new(center.x - 2, center.y - 3).with_z(base + 5), - SpriteKind::Lantern, - 6, - ); - painter.rotated_sprite( - Vec2::new(center.x - 2, center.y - 3).with_z(base + 15), - SpriteKind::Lantern, - 6, - ); - painter.rotated_sprite( - Vec2::new(center.x - 2, center.y - 3).with_z(base + 24), - SpriteKind::Lantern, - 6, - ); - painter.rotated_sprite( - Vec2::new(center.x - 2, center.y - 3).with_z(base + 33), - SpriteKind::Lantern, - 6, - ); - painter.rotated_sprite( - Vec2::new(center.x - 2, center.y - 3).with_z(base + 44), - SpriteKind::Lantern, - 6, - ); + + painter + .aabb(Aabb { + min: Vec3::new(center.x - 2, center.y - 3, base + 6), + max: Vec3::new(center.x - 1, center.y + -2, base + 7), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + painter + .aabb(Aabb { + min: Vec3::new(center.x - 2, center.y - 3, base + 15), + max: Vec3::new(center.x - 1, center.y + -2, base + 16), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + painter + .aabb(Aabb { + min: Vec3::new(center.x - 2, center.y - 3, base + 24), + max: Vec3::new(center.x - 1, center.y + -2, base + 25), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + painter + .aabb(Aabb { + min: Vec3::new(center.x - 2, center.y - 3, base + 33), + max: Vec3::new(center.x - 1, center.y + -2, base + 34), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); + painter + .aabb(Aabb { + min: Vec3::new(center.x - 2, center.y - 3, base + 44), + max: Vec3::new(center.x - 1, center.y + -2, base + 45), + }) + .rotate_about(Mat3::rotation_z(self.rotation).as_(), center.with_z(base)) + .fill(sprite_fill.clone()); } }