adjust chieftain hut, start alter

This commit is contained in:
jshipsey
2022-01-24 03:02:13 -05:00
committed by Sam
parent 82c976919e
commit cb48dd0a75

View File

@ -442,6 +442,7 @@ impl Structure for GnarlingFortification {
}) })
.for_each(|(point, next_point)| { .for_each(|(point, next_point)| {
// 2d world positions of each point in wall segment // 2d world positions of each point in wall segment
let point = point;
let start_wpos = point + self.origin; let start_wpos = point + self.origin;
let end_wpos = next_point + self.origin; let end_wpos = next_point + self.origin;
@ -545,127 +546,202 @@ impl Structure for GnarlingFortification {
// Create towers // Create towers
self.wall_towers.iter().for_each(|point| { self.wall_towers.iter().for_each(|point| {
let wpos = point.xy() + self.origin; let wpos = point.xy() + self.origin;
let darkwood = Fill::Block(Block::new(BlockKind::Wood, Rgb::new(55, 25, 8)));
let darkwood2 = Fill::Block(Block::new(BlockKind::Wood, Rgb::new(71, 33, 11)));
// Tower base // Tower base
let tower_depth = 3; let tower_depth = 3;
let tower_base_pos = wpos.with_z(land.get_alt_approx(wpos) as i32 - tower_depth); let tower_base_pos = wpos.with_z(land.get_alt_approx(wpos) as i32 - tower_depth);
let tower_radius = 5.; let tower_radius = 5.0;
let tower_height = 20.0; let tower_height = 30.0;
painter let randx = wpos.x.abs() % 10;
let randy = wpos.y.abs() % 10;
let randz = (land.get_alt_approx(wpos) as i32).abs() % 10;
//layers of rings, starting at exterior
let outside = painter
.prim(Primitive::cylinder( .prim(Primitive::cylinder(
tower_base_pos, wpos.with_z(land.get_alt_approx(wpos) as i32),
tower_radius, tower_radius,
tower_depth as f32 + tower_height - 5.0, tower_height,
)) ))
.fill(Fill::Block(Block::new( .without(painter.prim(Primitive::cylinder(
BlockKind::Wood, wpos.with_z(land.get_alt_approx(wpos) as i32),
Rgb::new(55, 25, 8), //dark brown tower_radius - 1.0,
tower_height,
))); )));
painter outside.fill(Fill::Block(Block::new(
.prim(Primitive::cylinder(
wpos.with_z(
land.get_alt_approx(wpos) as i32 - tower_depth
+ tower_depth as i32
+ tower_height as i32
- 5,
),
tower_radius,
5.0,
))
.fill(Fill::Block(Block::new(
BlockKind::Wood,
Rgb::new(115, 58, 26), //light brown
)));
painter
.prim(Primitive::cylinder(tower_base_pos, tower_radius + 1.0, 5.0))
.fill(Fill::Block(Block::new(
BlockKind::Wood,
Rgb::new(22, 36, 20), //green
)));
let red_deco1 = painter.aabb(Aabb {
min: Vec2::new(wpos.x - 5, wpos.y - 1)
.with_z(land.get_alt_approx(wpos) as i32 - tower_depth),
max: Vec2::new(wpos.x + 5, wpos.y + 1)
.with_z(land.get_alt_approx(wpos) as i32 - tower_depth + 16),
});
let red_deco2 = painter.aabb(Aabb {
min: Vec2::new(wpos.x - 1, wpos.y - 5)
.with_z(land.get_alt_approx(wpos) as i32 - tower_depth),
max: Vec2::new(wpos.x + 1, wpos.y + 5)
.with_z(land.get_alt_approx(wpos) as i32 - tower_depth + 16),
});
let red_deco = red_deco1.union(red_deco2);
red_deco.fill(Fill::Block(Block::new(
BlockKind::Wood, BlockKind::Wood,
Rgb::new(102, 31, 24), //red Rgb::new(71, 33, 11),
))); )));
// Tower cylinder
let tower_floor_pos = wpos.with_z(land.get_alt_approx(wpos) as i32);
painter painter
.prim(Primitive::cylinder( .prim(Primitive::cylinder(
tower_floor_pos, wpos.with_z(land.get_alt_approx(wpos) as i32),
tower_radius - 1.0, tower_radius - 1.0,
tower_height, tower_height,
)) ))
.fill(Fill::Block(Block::empty()));
// Tower top floor
let top_floor_z = (land.get_alt_approx(wpos) + tower_height - 2.0) as i32;
let tower_top_floor_pos = wpos.with_z(top_floor_z);
painter
.prim(Primitive::cylinder(tower_top_floor_pos, tower_radius, 1.0))
.fill(Fill::Block(Block::new( .fill(Fill::Block(Block::new(
BlockKind::Wood, BlockKind::Wood,
Rgb::new(55, 25, 8), Rgb::new(55, 25, 8),
))); )));
painter
// Tower roof poles .prim(Primitive::cylinder(
let roof_pole_height = 5; wpos.with_z(land.get_alt_approx(wpos) as i32),
let relative_pole_positions = [ tower_radius - 2.0,
Vec2::new(-4, -4), tower_height,
Vec2::new(-4, 3), ))
Vec2::new(3, -4), .fill(Fill::Block(Block::new(
Vec2::new(3, 3), BlockKind::Wood,
]; Rgb::new(71, 33, 11),
relative_pole_positions )));
.iter() painter
.map(|rpos| wpos + rpos) .prim(Primitive::cylinder(
.for_each(|pole_pos| { wpos.with_z(land.get_alt_approx(wpos) as i32),
painter tower_radius - 3.0,
.line( tower_height,
pole_pos.with_z(top_floor_z), ))
pole_pos.with_z(top_floor_z + roof_pole_height), .fill(Fill::Block(Block::new(
1., BlockKind::Wood,
) Rgb::new(55, 25, 8),
.fill(Fill::Block(Block::new( )));
BlockKind::Wood, painter
Rgb::new(55, 25, 8), .prim(Primitive::cylinder(
))); wpos.with_z(land.get_alt_approx(wpos) as i32),
}); tower_radius - 4.0,
tower_height,
// Tower roof ))
let roof_sphere_radius = 10; .fill(Fill::Block(Block::new(
let roof_radius = tower_radius + 1.0; BlockKind::Wood,
let roof_height = 3; Rgb::new(71, 33, 11),
)));
let roof_cyl = painter.prim(Primitive::cylinder( //top layer, green above the tower
wpos.with_z(top_floor_z + roof_pole_height), painter
roof_radius, .prim(Primitive::cylinder(
roof_height as f32, wpos.with_z(land.get_alt_approx(wpos) as i32 + tower_height as i32),
)); tower_radius,
2.0,
))
.fill(Fill::Block(Block::new(
BlockKind::Wood,
Rgb::new(22, 36, 20),
)));
//standing area one block deeper
painter
.prim(Primitive::cylinder(
wpos.with_z(land.get_alt_approx(wpos) as i32 + tower_height as i32 - 9),
tower_radius - 1.0,
1.0,
))
.fill(Fill::Block(Block::empty()));
//remove top sphere from trunk
painter
.prim(Primitive::sphere(
Vec2::new(wpos.x - (randy - 5) / 2, wpos.y - (randz - 5) / 2).with_z(
land.get_alt_approx(wpos) as i32 + tower_height as i32 + 6 - randx / 3,
),
5.5,
))
.fill(Fill::Block(Block::empty()));
//remove bark from exterior layer
painter
.prim(Primitive::sphere(
Vec2::new(wpos.x - (randy - 5) * 2, wpos.y - (randz - 5) * 2)
.with_z(land.get_alt_approx(wpos) as i32 + randx * 2),
7.5,
))
.intersect(outside)
.fill(Fill::Block(Block::empty()));
painter painter
.prim(Primitive::sphere( .prim(Primitive::sphere(
wpos.with_z(top_floor_z + roof_pole_height + roof_height - roof_sphere_radius), Vec2::new(wpos.x - (randx - 5) * 2, wpos.y - (randy - 5) * 2)
roof_sphere_radius as f32, .with_z(land.get_alt_approx(wpos) as i32 + randz * 2),
5.5,
)) ))
.intersect(roof_cyl) .intersect(outside)
.fill(Fill::Block(Block::empty()));
//cut out standing room
painter
.aabb(Aabb {
min: Vec2::new(wpos.x - 3, wpos.y - 10)
.with_z(land.get_alt_approx(wpos) as i32 + tower_height as i32 - 8),
max: Vec2::new(wpos.x + 3, wpos.y + 10)
.with_z(land.get_alt_approx(wpos) as i32 + tower_height as i32 - 3),
})
.fill(Fill::Block(Block::empty()));
painter
.aabb(Aabb {
min: Vec2::new(wpos.x - 10, wpos.y - 3)
.with_z(land.get_alt_approx(wpos) as i32 + tower_height as i32 - 8),
max: Vec2::new(wpos.x + 10, wpos.y + 3)
.with_z(land.get_alt_approx(wpos) as i32 + tower_height as i32 - 3),
})
.fill(Fill::Block(Block::empty()));
painter
.aabb(Aabb {
min: Vec2::new(wpos.x - 2, wpos.y - 10)
.with_z(land.get_alt_approx(wpos) as i32 + tower_height as i32 - 8),
max: Vec2::new(wpos.x + 2, wpos.y + 10)
.with_z(land.get_alt_approx(wpos) as i32 + tower_height as i32 - 2),
})
.fill(Fill::Block(Block::empty()));
painter
.aabb(Aabb {
min: Vec2::new(wpos.x - 10, wpos.y - 2)
.with_z(land.get_alt_approx(wpos) as i32 + tower_height as i32 - 8),
max: Vec2::new(wpos.x + 10, wpos.y + 2)
.with_z(land.get_alt_approx(wpos) as i32 + tower_height as i32 - 2),
})
.fill(Fill::Block(Block::empty()));
//flags
painter
.aabb(Aabb {
min: Vec2::new(wpos.x - 2, wpos.y - tower_radius as i32 - 1)
.with_z(land.get_alt_approx(wpos) as i32 + tower_height as i32 - 16),
max: Vec2::new(wpos.x + 2, wpos.y + tower_radius as i32 + 1)
.with_z(land.get_alt_approx(wpos) as i32 + tower_height as i32 - 10),
})
.intersect(outside)
.fill(Fill::Block(Block::new( .fill(Fill::Block(Block::new(
BlockKind::Leaves, BlockKind::Wood,
Rgb::new(22, 36, 20), Rgb::new(102, 31, 24), //red
)));
painter
.aabb(Aabb {
min: Vec2::new(wpos.x - tower_radius as i32 - 1, wpos.y - 2)
.with_z(land.get_alt_approx(wpos) as i32 + tower_height as i32 - 16),
max: Vec2::new(wpos.x + tower_radius as i32 + 1, wpos.y + 2)
.with_z(land.get_alt_approx(wpos) as i32 + tower_height as i32 - 10),
})
.intersect(outside)
.fill(Fill::Block(Block::new(
BlockKind::Wood,
Rgb::new(102, 31, 24), //red
)));
painter
.aabb(Aabb {
min: Vec2::new(wpos.x - 1, wpos.y - tower_radius as i32 - 1)
.with_z(land.get_alt_approx(wpos) as i32 + tower_height as i32 - 17),
max: Vec2::new(wpos.x + 1, wpos.y + tower_radius as i32 + 1)
.with_z(land.get_alt_approx(wpos) as i32 + tower_height as i32 - 16),
})
.intersect(outside)
.fill(Fill::Block(Block::new(
BlockKind::Wood,
Rgb::new(102, 31, 24), //red
)));
painter
.aabb(Aabb {
min: Vec2::new(wpos.x - tower_radius as i32 - 1, wpos.y - 1)
.with_z(land.get_alt_approx(wpos) as i32 + tower_height as i32 - 17),
max: Vec2::new(wpos.x + tower_radius as i32 + 1, wpos.y + 1)
.with_z(land.get_alt_approx(wpos) as i32 + tower_height as i32 - 16),
})
.intersect(outside)
.fill(Fill::Block(Block::new(
BlockKind::Wood,
Rgb::new(102, 31, 24), //red
))); )));
}); });
@ -686,14 +762,9 @@ impl Structure for GnarlingFortification {
roof_height: f32, roof_height: f32,
roof_overhang: f32, roof_overhang: f32,
) { ) {
let randx = ((wpos.x.abs() as f32 / 10.0 let randx = wpos.x.abs() % 10;
- (wpos.x.abs() as f32 / 10.0).trunc()) let randy = wpos.y.abs() % 10;
* 10.0) as i32; let randz = alt.abs() % 10;
let randy = ((wpos.y.abs() as f32 / 10.0
- (wpos.y.abs() as f32 / 10.0).trunc())
* 10.0) as i32;
let randz = ((alt.abs() as f32 / 10.0 - (alt.abs() as f32 / 10.0).trunc())
* 10.0) as i32;
let hut_wall_height = hut_wall_height + randy as f32 / 3.0; let hut_wall_height = hut_wall_height + randy as f32 / 3.0;
// Floor // Floor
let base = wpos.with_z(alt - 4); let base = wpos.with_z(alt - 4);
@ -846,8 +917,8 @@ impl Structure for GnarlingFortification {
))); )));
let platform = painter.aabb(Aabb { let platform = painter.aabb(Aabb {
min: (wpos - 13).with_z(alt + raise), min: (wpos - 20).with_z(alt + raise),
max: (wpos + 13).with_z(alt + raise + 1), max: (wpos + 20).with_z(alt + raise + 1),
}); });
painter.fill( painter.fill(
@ -856,39 +927,38 @@ impl Structure for GnarlingFortification {
); );
let support_1 = painter.line( let support_1 = painter.line(
(wpos - 12).with_z(alt - 3), (wpos - 19).with_z(alt - 3),
(wpos - 12).with_z(alt + raise), (wpos - 19).with_z(alt + raise),
2.0, 2.0,
); );
let support_alt = painter.line( let support_inner_1 = painter.aabb(Aabb {
(wpos - 12).with_z(alt - 3), min: (wpos - 19).with_z(alt - 3),
(wpos - 12).with_z(alt + raise), max: (wpos - 15).with_z(alt + raise),
2.0, });
); let support_2 = support_1.translate(Vec3::new(0, 37, 0));
let support_2 = support_1.translate(Vec3::new(0, 23, 0)); let support_3 = support_1.translate(Vec3::new(37, 0, 0));
let support_3 = support_1.translate(Vec3::new(23, 0, 0)); let support_4 = support_1.translate(Vec3::new(37, 37, 0));
let support_4 = support_1.translate(Vec3::new(23, 23, 0)); let support_inner_1 = support_inner_1.translate(Vec3::new(0, 17, 0));
let support_5 = support_alt.translate(Vec3::new(0, 12, 0)); let support_inner_2 = support_inner_1.translate(Vec3::new(34, 0, 0));
let support_6 = support_alt.translate(Vec3::new(12, 0, 0)); let support_inner_3 = support_inner_1.translate(Vec3::new(17, 17, 0));
let support_7 = support_alt.translate(Vec3::new(12, 23, 0)); let support_inner_4 = support_inner_1.translate(Vec3::new(17, -17, 0));
let support_8 = support_alt.translate(Vec3::new(23, 12, 0));
let supports = support_1 let supports = support_1
.union(support_2) .union(support_2)
.union(support_3) .union(support_3)
.union(support_4) .union(support_4)
.union(support_5) .union(support_inner_1)
.union(support_6) .union(support_inner_2)
.union(support_7) .union(support_inner_3)
.union(support_8); .union(support_inner_4);
painter.fill( painter.fill(
supports, supports,
Fill::Block(Block::new(BlockKind::Wood, Rgb::new(55, 25, 8))), Fill::Block(Block::new(BlockKind::Wood, Rgb::new(55, 25, 8))),
); );
let height_1 = 6.0; let height_1 = 10.0;
let height_2 = 8.0; let height_2 = 12.0;
let rad_1 = 11.0; let rad_1 = 18.0;
let rad_2 = 8.0; let rad_2 = 15.0;
// Wall // Wall
let floor_pos = wpos.with_z(alt + 1 + raise); let floor_pos = wpos.with_z(alt + 1 + raise);
@ -896,7 +966,7 @@ impl Structure for GnarlingFortification {
.prim(Primitive::cylinder(floor_pos, rad_1, height_1)) .prim(Primitive::cylinder(floor_pos, rad_1, height_1))
.fill(Fill::Block(Block::new( .fill(Fill::Block(Block::new(
BlockKind::Wood, BlockKind::Wood,
Rgb::new(115, 58, 26), Rgb::new(71, 33, 11),
))); )));
painter painter
.prim(Primitive::cylinder(floor_pos, rad_1 - 1.0, height_1)) .prim(Primitive::cylinder(floor_pos, rad_1 - 1.0, height_1))
@ -907,11 +977,11 @@ impl Structure for GnarlingFortification {
.prim(Primitive::cylinder(floor2_pos, rad_2, height_2)) .prim(Primitive::cylinder(floor2_pos, rad_2, height_2))
.fill(Fill::Block(Block::new( .fill(Fill::Block(Block::new(
BlockKind::Wood, BlockKind::Wood,
Rgb::new(115, 58, 26), Rgb::new(71, 33, 11),
))); )));
// Roof // Roof
let roof_radius = rad_1 + 4.0; let roof_radius = rad_1 + 5.0;
let roof1 = painter.prim(Primitive::cone( let roof1 = painter.prim(Primitive::cone(
wpos.with_z(alt + 1 + height_1 as i32 + raise), wpos.with_z(alt + 1 + height_1 as i32 + raise),
roof_radius, roof_radius,
@ -932,28 +1002,34 @@ impl Structure for GnarlingFortification {
BlockKind::Leaves, BlockKind::Leaves,
Rgb::new(22, 36, 20), Rgb::new(22, 36, 20),
))); )));
let centerspot = painter.line(
(wpos + 1).with_z(alt + raise + height_1 as i32 + 2),
(wpos + 1).with_z(alt + raise + height_1 as i32 + 2),
1.0,
);
let roof_support_1 = painter.line( let roof_support_1 = painter.line(
(wpos + 1).with_z(alt + raise + height_1 as i32 - 3), (wpos + rad_1 as i32 - 7).with_z(alt + raise + height_1 as i32 - 2),
(wpos + 10).with_z(alt + raise + height_1 as i32), (wpos + rad_1 as i32 - 2).with_z(alt + raise + height_1 as i32),
1.5, 1.5,
); );
let roof_strut = painter.line( let roof_strut = painter.line(
(wpos + 1).with_z(alt + raise + height_1 as i32 + 2), (wpos + rad_1 as i32 - 7).with_z(alt + raise + height_1 as i32 + 2),
(wpos + 10).with_z(alt + raise + height_1 as i32 + 2), (wpos + rad_1 as i32 - 2).with_z(alt + raise + height_1 as i32 + 2),
1.0, 1.0,
); );
let wall2support = painter.line( let wall2support = painter.line(
(wpos + rad_2 as i32 - 3).with_z(alt + raise + height_1 as i32 + 6), (wpos + rad_2 as i32 - 5).with_z(alt + raise + height_1 as i32 + 7),
(wpos + rad_2 as i32 - 3).with_z(alt + raise + height_1 as i32 + 8), (wpos + rad_2 as i32 - 5).with_z(alt + raise + height_1 as i32 + 12),
1.0, 1.5,
); );
let wall2roof = painter.line( let wall2roof = painter.line(
(wpos + rad_2 as i32 - 4).with_z(alt + raise + height_1 as i32 + 9), (wpos + rad_2 as i32 - 7).with_z(alt + raise + height_2 as i32 + 12),
(wpos + rad_2 as i32 - 3).with_z(alt + raise + height_1 as i32 + 9), (wpos + rad_2 as i32 - 4).with_z(alt + raise + height_2 as i32 + 10),
2.0, 2.0,
); );
let roof_support_1 = roof_support_1 let roof_support_1 = centerspot
.union(roof_support_1)
.union(roof_strut) .union(roof_strut)
.union(wall2support) .union(wall2support)
.union(wall2roof); .union(wall2roof);
@ -974,18 +1050,13 @@ impl Structure for GnarlingFortification {
Fill::Block(Block::new(BlockKind::Wood, Rgb::new(55, 25, 8))), Fill::Block(Block::new(BlockKind::Wood, Rgb::new(55, 25, 8))),
); );
let spot = painter.line(
(wpos + 1).with_z(alt + raise + height_1 as i32 + 2),
(wpos + 1).with_z(alt + raise + height_1 as i32 + 2),
1.0,
);
let spike_1 = painter.line( let spike_1 = painter.line(
(wpos + rad_2 as i32 - 1).with_z(alt + raise + height_1 as i32 + 2), (wpos + rad_2 as i32 - 5).with_z(alt + raise + height_1 as i32 + 2),
(wpos + rad_2 as i32 + 2).with_z(alt + raise + height_1 as i32 + 6), (wpos + rad_2 as i32 - 1).with_z(alt + raise + height_1 as i32 + 8),
1.0, 1.3,
); );
let spike_1 = spot.union(spike_1); let spike_1 = centerspot.union(spike_1);
let spike_2 = spike_1.rotate(Mat3::new(1, 0, 0, 0, -1, 0, 0, 0, 1)); let spike_2 = spike_1.rotate(Mat3::new(1, 0, 0, 0, -1, 0, 0, 0, 1));
let spike_3 = spike_1.rotate(Mat3::new(-1, 0, 0, 0, 1, 0, 0, 0, 1)); let spike_3 = spike_1.rotate(Mat3::new(-1, 0, 0, 0, 1, 0, 0, 0, 1));
@ -1002,7 +1073,7 @@ impl Structure for GnarlingFortification {
min: Vec2::new(wpos.x - 2, wpos.y - 15) min: Vec2::new(wpos.x - 2, wpos.y - 15)
.with_z(alt + raise + height_1 as i32 + 3), .with_z(alt + raise + height_1 as i32 + 3),
max: Vec2::new(wpos.x + 2, wpos.y + 15) max: Vec2::new(wpos.x + 2, wpos.y + 15)
.with_z(alt + raise + height_1 as i32 + 8), .with_z(alt + raise + height_1 as i32 + height_2 as i32),
}) })
.fill(Fill::Block(Block::empty())); .fill(Fill::Block(Block::empty()));
painter painter
@ -1010,7 +1081,7 @@ impl Structure for GnarlingFortification {
min: Vec2::new(wpos.x - 3, wpos.y - 15) min: Vec2::new(wpos.x - 3, wpos.y - 15)
.with_z(alt + raise + height_1 as i32 + 4), .with_z(alt + raise + height_1 as i32 + 4),
max: Vec2::new(wpos.x + 3, wpos.y + 15) max: Vec2::new(wpos.x + 3, wpos.y + 15)
.with_z(alt + raise + height_1 as i32 + 7), .with_z(alt + raise + height_1 as i32 + 10),
}) })
.fill(Fill::Block(Block::empty())); .fill(Fill::Block(Block::empty()));
painter painter
@ -1018,7 +1089,7 @@ impl Structure for GnarlingFortification {
min: Vec2::new(wpos.x - 15, wpos.y - 2) min: Vec2::new(wpos.x - 15, wpos.y - 2)
.with_z(alt + raise + height_1 as i32 + 3), .with_z(alt + raise + height_1 as i32 + 3),
max: Vec2::new(wpos.x + 15, wpos.y + 2) max: Vec2::new(wpos.x + 15, wpos.y + 2)
.with_z(alt + raise + height_1 as i32 + 8), .with_z(alt + raise + height_1 as i32 + height_2 as i32),
}) })
.fill(Fill::Block(Block::empty())); .fill(Fill::Block(Block::empty()));
painter painter
@ -1026,14 +1097,50 @@ impl Structure for GnarlingFortification {
min: Vec2::new(wpos.x - 15, wpos.y - 3) min: Vec2::new(wpos.x - 15, wpos.y - 3)
.with_z(alt + raise + height_1 as i32 + 4), .with_z(alt + raise + height_1 as i32 + 4),
max: Vec2::new(wpos.x + 15, wpos.y + 3) max: Vec2::new(wpos.x + 15, wpos.y + 3)
.with_z(alt + raise + height_1 as i32 + 7), .with_z(alt + raise + height_1 as i32 + 10),
})
.fill(Fill::Block(Block::empty()));
//
painter
.aabb(Aabb {
min: Vec2::new(wpos.x - 18, wpos.y - 2)
.with_z(alt + raise + height_1 as i32 - 9),
max: Vec2::new(wpos.x + 18, wpos.y + 2)
.with_z(alt + raise + height_1 as i32 - 1),
}) })
.fill(Fill::Block(Block::empty())); .fill(Fill::Block(Block::empty()));
painter painter
.aabb(Aabb { .aabb(Aabb {
min: Vec2::new(wpos.x - 15, wpos.y - 1) min: Vec2::new(wpos.x - 2, wpos.y - 18)
.with_z(alt + raise + height_1 as i32 - 9),
max: Vec2::new(wpos.x + 2, wpos.y + 18)
.with_z(alt + raise + height_1 as i32 - 1),
})
.fill(Fill::Block(Block::empty()));
painter
.aabb(Aabb {
min: Vec2::new(wpos.x - 18, wpos.y - 3)
.with_z(alt + raise + height_1 as i32 - 9),
max: Vec2::new(wpos.x + 18, wpos.y + 3)
.with_z(alt + raise + height_1 as i32 - 3), .with_z(alt + raise + height_1 as i32 - 3),
max: Vec2::new(wpos.x + 15, wpos.y + 1) })
.fill(Fill::Block(Block::empty()));
painter
.aabb(Aabb {
min: Vec2::new(wpos.x - 3, wpos.y - 18)
.with_z(alt + raise + height_1 as i32 - 9),
max: Vec2::new(wpos.x + 3, wpos.y + 18)
.with_z(alt + raise + height_1 as i32 - 3),
})
.fill(Fill::Block(Block::empty()));
//Roofing details
painter
.aabb(Aabb {
min: Vec2::new(wpos.x - 23, wpos.y - 2)
.with_z(alt + raise + height_1 as i32 - 3),
max: Vec2::new(wpos.x + 23, wpos.y + 2)
.with_z(alt + raise + height_1 as i32 + 7), .with_z(alt + raise + height_1 as i32 + 7),
}) })
.intersect(roof1) .intersect(roof1)
@ -1042,12 +1149,11 @@ impl Structure for GnarlingFortification {
BlockKind::Leaves, BlockKind::Leaves,
Rgb::new(55, 25, 8), Rgb::new(55, 25, 8),
))); )));
//Roofing details
painter painter
.aabb(Aabb { .aabb(Aabb {
min: Vec2::new(wpos.x - 15, wpos.y - 1) min: Vec2::new(wpos.x - 23, wpos.y - 2)
.with_z(alt + raise + height_1 as i32 - 3), .with_z(alt + raise + height_1 as i32 - 3),
max: Vec2::new(wpos.x + 15, wpos.y + 1) max: Vec2::new(wpos.x + 23, wpos.y + 2)
.with_z(alt + raise + height_1 as i32 + 7), .with_z(alt + raise + height_1 as i32 + 7),
}) })
.intersect(roof1) .intersect(roof1)
@ -1057,9 +1163,9 @@ impl Structure for GnarlingFortification {
))); )));
painter painter
.aabb(Aabb { .aabb(Aabb {
min: Vec2::new(wpos.x - 1, wpos.y - 15) min: Vec2::new(wpos.x - 2, wpos.y - 23)
.with_z(alt + raise + height_1 as i32 - 3), .with_z(alt + raise + height_1 as i32 - 3),
max: Vec2::new(wpos.x + 1, wpos.y + 15) max: Vec2::new(wpos.x + 2, wpos.y + 23)
.with_z(alt + raise + height_1 as i32 + 7), .with_z(alt + raise + height_1 as i32 + 7),
}) })
.intersect(roof1) .intersect(roof1)
@ -1070,9 +1176,9 @@ impl Structure for GnarlingFortification {
))); )));
painter painter
.aabb(Aabb { .aabb(Aabb {
min: Vec2::new(wpos.x - 1, wpos.y - 15) min: Vec2::new(wpos.x - 2, wpos.y - 23)
.with_z(alt + raise + height_1 as i32 - 3), .with_z(alt + raise + height_1 as i32 - 3),
max: Vec2::new(wpos.x + 1, wpos.y + 15) max: Vec2::new(wpos.x + 2, wpos.y + 23)
.with_z(alt + raise + height_1 as i32 + 7), .with_z(alt + raise + height_1 as i32 + 7),
}) })
.intersect(roof1) .intersect(roof1)
@ -1106,23 +1212,167 @@ impl Structure for GnarlingFortification {
); );
}, },
GnarlingStructure::Longhut => { GnarlingStructure::Longhut => {
let hut_radius = 5.0; let randx = wpos.x.abs() % 10;
let hut_wall_height = 15.0; let randy = wpos.y.abs() % 10;
let door_height = 3; let randz = alt.abs() % 10;
let roof_height = 3.0; let length = 14;
let roof_overhang = 1.0; let width = 6;
let height = alt + 12;
let low1 = painter.aabb(Aabb {
min: Vec2::new(wpos.x - width, wpos.y - length).with_z(height + 1),
max: Vec2::new(wpos.x + width, wpos.y + length).with_z(height + 2),
});
generate_longhut( let low2 = painter.aabb(Aabb {
painter, min: Vec2::new(wpos.x - length, wpos.y - width).with_z(height + 1),
wpos, max: Vec2::new(wpos.x + length, wpos.y + width).with_z(height + 2),
alt, });
*door_dir, let top1 = painter.aabb(Aabb {
hut_radius, min: Vec2::new(wpos.x - width + 1, wpos.y - length + 1)
hut_wall_height, .with_z(height + 2),
door_height, max: Vec2::new(wpos.x + width - 1, wpos.y + length - 1)
roof_height, .with_z(height + 2 + 1),
roof_overhang, });
let top2 = painter.aabb(Aabb {
min: Vec2::new(wpos.x - length + 1, wpos.y - width + 1)
.with_z(height + 2),
max: Vec2::new(wpos.x + length - 1, wpos.y + width - 1)
.with_z(height + 2 + 1),
});
let low = low1.union(low2);
let top = top1.union(top2);
let roof = low1.union(low2).union(top1).union(top2);
let moss = roof.translate(Vec3::new(0, 0, 1)).without(top).without(low);
top.fill(Fill::Block(Block::new(
BlockKind::Leaves,
Rgb::new(55, 25, 8),
)));
low.fill(Fill::Block(Block::new(
BlockKind::Leaves,
Rgb::new(71, 33, 11),
)));
moss.fill(Fill::Block(Block::new(
BlockKind::Leaves,
Rgb::new(22, 36, 20),
)));
painter
.prim(Primitive::sphere(
Vec2::new(wpos.x + randy - 5, wpos.y + randz - 5)
.with_z(height + 4),
7.0,
))
.intersect(moss)
.fill(Fill::Block(Block::empty()));
painter
.prim(Primitive::sphere(
Vec2::new(wpos.x + randx - 5, wpos.y + randy - 5)
.with_z(height + 4),
4.0,
))
.intersect(moss)
.fill(Fill::Block(Block::empty()));
painter
.prim(Primitive::sphere(
Vec2::new(wpos.x + 2 * (randz - 5), wpos.y + 2 * (randx - 5))
.with_z(height + 4),
4.0,
))
.intersect(moss)
.fill(Fill::Block(Block::empty()));
//outside leg
painter
.aabb(Aabb {
min: Vec2::new(wpos.x - length, wpos.y - width).with_z(alt),
max: Vec2::new(wpos.x - length + 1, wpos.y - width + 1)
.with_z(height + 1),
})
.fill(Fill::Block(Block::new(
BlockKind::Leaves,
Rgb::new(55, 25, 8),
)));
//inside leg
let legp1 = painter.aabb(Aabb {
min: Vec2::new(wpos.x - width, wpos.y - width).with_z(alt),
max: Vec2::new(wpos.x - width + 2, wpos.y - width + 2)
.with_z(height + 2),
});
let legp2 = painter.line(
Vec2::new(wpos.x - width, wpos.y - width).with_z(height - 6),
Vec2::new(wpos.x - width + 3, wpos.y - width + 3).with_z(height),
1.0,
); );
let leg1 = legp1.union(legp2);
let leg2 = leg1
.rotate(Mat3::new(0, 1, 0, -1, 0, 0, 0, 0, 1))
.translate(Vec3::new(1, width * 2 + 1, 0));
let leg3 = leg1
.rotate(Mat3::new(0, -1, 0, 1, 0, 0, 0, 0, 1))
.translate(Vec3::new(width * 2 + 1, 1, 0));
let leg4 = leg1
.rotate(Mat3::new(-1, 0, 0, 0, -1, 0, 0, 0, 1))
.translate(Vec3::new(width * 2 + 2, width * 2 + 2, 0));
let legs = leg1.union(leg2).union(leg3).union(leg4);
legs.fill(Fill::Block(Block::new(
BlockKind::Leaves,
Rgb::new(55, 25, 8),
)));
let spike1 = painter.line(
Vec2::new(wpos.x - 12, wpos.y + 2).with_z(height + 3),
Vec2::new(wpos.x - 7, wpos.y + 2).with_z(height + 5),
1.0,
);
let spike2 = painter.line(
Vec2::new(wpos.x - 12, wpos.y - 3).with_z(height + 3),
Vec2::new(wpos.x - 7, wpos.y - 3).with_z(height + 5),
1.0,
);
let spikes = spike1.union(spike2);
let spikesalt = spikes
.rotate(Mat3::new(-1, 0, 0, 0, -1, 0, 0, 0, 1))
.translate(Vec3::new(26, 8, 0));
let spikeshalf = spikes.union(spikesalt);
let spikesotherhalf = spikeshalf
.rotate(Mat3::new(0, -1, 0, 1, 0, 0, 0, 0, 1))
.translate(Vec3::new(16, -9, 0));
let spikesall = spikeshalf.union(spikesotherhalf);
spikesall.fill(Fill::Block(Block::new(
BlockKind::Leaves,
Rgb::new(184, 177, 134),
)));
let crystal1 = painter.aabb(Aabb {
min: Vec2::new(wpos.x - 2, wpos.y - 3).with_z(alt),
max: Vec2::new(wpos.x + 2, wpos.y + 1).with_z(alt + 7),
});
let crystal2 = painter.aabb(Aabb {
min: Vec2::new(wpos.x - 3, wpos.y - 3).with_z(alt),
max: Vec2::new(wpos.x + 3, wpos.y + 1).with_z(alt + 6),
});
let crystal3 = painter.aabb(Aabb {
min: Vec2::new(wpos.x - 2, wpos.y - 2).with_z(alt),
max: Vec2::new(wpos.x + 4, wpos.y + 3).with_z(alt + 4),
});
let crystal4 = painter.aabb(Aabb {
min: Vec2::new(wpos.x - 1, wpos.y - 4).with_z(alt),
max: Vec2::new(wpos.x + 2, wpos.y + 2).with_z(alt + 8),
});
let crystalp1 = crystal1.union(crystal3);
let crystalp2 = crystal2.union(crystal4);
crystalp1.fill(Fill::Block(Block::new(
BlockKind::GlowingRock,
Rgb::new(50, 255, 210),
)));
crystalp2.fill(Fill::Block(Block::new(
BlockKind::GlowingRock,
Rgb::new(36, 187, 151),
)));
}, },
GnarlingStructure::Totem => { GnarlingStructure::Totem => {
let totem_pos = wpos.with_z(alt); let totem_pos = wpos.with_z(alt);
@ -1141,31 +1391,13 @@ impl Structure for GnarlingFortification {
.fill(Fill::Prefab(Box::new(totem), totem_pos, self.seed)); .fill(Fill::Prefab(Box::new(totem), totem_pos, self.seed));
}, },
GnarlingStructure::ChieftainHut => { GnarlingStructure::ChieftainHut => {
let hut_radius = 12.0;
let hut_wall_height = 6.0;
let door_height = 3;
let roof_height = 7.0;
let roof_overhang = 2.0;
generate_hut(
painter,
wpos,
alt,
*door_dir,
hut_radius,
hut_wall_height,
door_height,
roof_height,
roof_overhang,
);
let hut_radius = 5.0; let hut_radius = 5.0;
let hut_wall_height = 14.0; let hut_wall_height = 15.0;
let door_height = 3; let door_height = 3;
let roof_height = 6.0; let roof_height = 3.0;
let roof_overhang = 1.0; let roof_overhang = 1.0;
generate_hut( generate_longhut(
painter, painter,
wpos, wpos,
alt, alt,
@ -1515,7 +1747,7 @@ impl Structure for GnarlingFortification {
painter.fill( painter.fill(
towerplatform, towerplatform,
Fill::Block(Block::new(BlockKind::Wood, Rgb::new(115, 58, 26))), Fill::Block(Block::new(BlockKind::Wood, Rgb::new(71, 33, 11))),
); );
let towervertical = supports let towervertical = supports
.union(platform_1_supports) .union(platform_1_supports)