Improve sea chapel performance.

This commit is contained in:
Joshua Yanovski 2023-04-03 02:08:44 -07:00
parent 05489e5b7e
commit 8d9680c68b

View File

@ -318,33 +318,33 @@ impl SeaChapel {
Dir::NegX,
)
.fill(white, filler);
let main_upper_half = painter.cylinder(Aabb {
let main_upper_half = painter.aabb(Aabb {
min: (center - (diameter / 2)).with_z(base - (diameter / 8) + (diameter / 2)),
max: (center + (diameter / 2)).with_z(base - (diameter / 8) + diameter),
});
}).as_kind();
// chapel 1st washed out top
main_upper_half.intersect(
painter
.sphere(Aabb {
min: (center - (diameter / 2)).with_z(base - (diameter / 8)),
max: (center + (diameter / 2)).with_z(base - (diameter / 8) + diameter),
})
.intersect(main_upper_half)
.fill(washed, filler);
).fill(washed, filler);
// chapel 1st top
main_upper_half.intersect(
painter
.sphere(Aabb {
min: (center - (diameter / 2) + 1).with_z(base - (diameter / 8)),
max: (center + (diameter / 2)).with_z(base - (diameter / 8) + diameter),
})
.intersect(main_upper_half)
.fill(top, filler);
).fill(top, filler);
main_upper_half.intersect(
painter
.cylinder(Aabb {
min: (center - (diameter / 2)).with_z(base - (diameter / 8)),
max: (center + (diameter / 2)).with_z(base - (diameter / 8) + (diameter / 2)),
})
.intersect(main_upper_half)
.clear(filler);
).clear(filler);
// chapel small top room
painter
.sphere(Aabb {
@ -354,12 +354,13 @@ impl SeaChapel {
.with_z(base - (diameter / 8) + diameter + (diameter / 3)),
})
.fill(white, filler);
let small_upper_half = painter.cylinder(Aabb {
let small_upper_half = painter.aabb(Aabb {
min: (center - (diameter / 3)).with_z(base - (diameter / 8) + diameter),
max: (center + (diameter / 3))
.with_z(base - (diameter / 8) + diameter + (diameter / 3)),
});
}).as_kind();
// chapel small washed out top
small_upper_half.intersect(
painter
.sphere(Aabb {
min: (center - (diameter / 3))
@ -367,9 +368,9 @@ impl SeaChapel {
max: (center + (diameter / 3))
.with_z(base - (diameter / 8) + diameter + (diameter / 3)),
})
.intersect(small_upper_half)
.fill(washed, filler);
).fill(washed, filler);
// chapel small top
small_upper_half.intersect(
painter
.sphere(Aabb {
min: (center - (diameter / 3) + 1)
@ -377,17 +378,16 @@ impl SeaChapel {
max: (center + (diameter / 3))
.with_z(base - (diameter / 8) + diameter + (diameter / 3)),
})
.intersect(small_upper_half)
.fill(top, filler);
).fill(top, filler);
small_upper_half.intersect(
painter
.cylinder(Aabb {
min: (center - (diameter / 3))
.with_z(base - (diameter / 8) + diameter - (diameter / 3)),
max: (center + (diameter / 3)).with_z(base - (diameter / 8) + diameter),
})
.intersect(small_upper_half)
.clear(filler);
).clear(filler);
// ground to top room stairway3
let center_s3 = Vec2::new(center.x, center.y - (diameter / 2));
@ -400,13 +400,14 @@ impl SeaChapel {
.with_z(base - (diameter / 8) + (diameter / 2) + (diameter / 3) - 3),
})
.fill(white, filler);
let stairway3_upper_half = painter.cylinder(Aabb {
let stairway3_upper_half = painter.aabb(Aabb {
min: (center_s3 - (diameter / 6))
.with_z(base - (diameter / 8) + (diameter / 2) + (diameter / 6) - 3),
max: (center_s3 + (diameter / 6))
.with_z(base - (diameter / 8) + (diameter / 2) + (diameter / 3) - 3),
});
}).as_kind();
// stairway3 top washed out
stairway3_upper_half.intersect(
painter
.sphere(Aabb {
min: (center_s3 - (diameter / 6))
@ -414,9 +415,9 @@ impl SeaChapel {
max: (center_s3 + (diameter / 6))
.with_z(base - (diameter / 8) + (diameter / 2) + (diameter / 3) - 3),
})
.intersect(stairway3_upper_half)
.fill(washed, filler);
).fill(washed, filler);
// stairway3 top
stairway3_upper_half.intersect(
painter
.sphere(Aabb {
min: (center_s3 - (diameter / 6) + 1)
@ -424,8 +425,8 @@ impl SeaChapel {
max: (center_s3 + (diameter / 6))
.with_z(base - (diameter / 8) + (diameter / 2) + (diameter / 3) - 3),
})
.intersect(stairway3_upper_half)
.fill(top, filler);
).fill(top, filler);
stairway3_upper_half.intersect(
painter
.cylinder(Aabb {
min: (center_s3 - (diameter / 6))
@ -433,8 +434,7 @@ impl SeaChapel {
max: (center_s3 + (diameter / 6))
.with_z(base - (diameter / 8) + (diameter / 2) + (diameter / 6) - 3),
})
.intersect(stairway3_upper_half)
.clear(filler);
).clear(filler);
// stairway3 top gold ring
painter
.cylinder(Aabb {
@ -445,6 +445,12 @@ impl SeaChapel {
})
.fill(gold, filler);
// stairway3 clear top halfway
painter.aabb(Aabb {
min: (center_s3 - (diameter / 6))
.with_z(base - (diameter / 8) + (diameter / 2) + (diameter / 6) - 7),
max: (center_s3 + (diameter / 6))
.with_z(base - (diameter / 8) + (diameter / 2) + (diameter / 3) - 3),
}).as_kind().intersect(
painter
.sphere(Aabb {
min: (center_s3 - (diameter / 6) + 1)
@ -452,13 +458,6 @@ impl SeaChapel {
max: (center_s3 + (diameter / 6) - 1)
.with_z(base - (diameter / 8) + (diameter / 2) + (diameter / 3) - 4),
})
.intersect(
painter.cylinder(Aabb {
min: (center_s3 - (diameter / 6))
.with_z(base - (diameter / 8) + (diameter / 2) + (diameter / 6) - 7),
max: (center_s3 + (diameter / 6))
.with_z(base - (diameter / 8) + (diameter / 2) + (diameter / 3) - 3),
}),
)
.clear(filler);
// stairway3 top window1
@ -908,13 +907,14 @@ impl SeaChapel {
.with_z(base - (diameter / 8) + diameter - (diameter / 4) + (diameter / 3)),
})
.fill(white, filler);
let stairway1_upper_half = painter.cylinder(Aabb {
let stairway1_upper_half = painter.aabb(Aabb {
min: (center_s1 - (diameter / 6))
.with_z(base - (diameter / 8) + diameter - (diameter / 4) + (diameter / 6)),
max: (center_s1 + (diameter / 6))
.with_z(base - (diameter / 8) + diameter - (diameter / 4) + (diameter / 3)),
});
}).as_kind();
// stairway1 top washed out
stairway1_upper_half.intersect(
painter
.sphere(Aabb {
min: (center_s1 - (diameter / 6))
@ -922,9 +922,9 @@ impl SeaChapel {
max: (center_s1 + (diameter / 6))
.with_z(base - (diameter / 8) + diameter - (diameter / 4) + (diameter / 3)),
})
.intersect(stairway1_upper_half)
.fill(washed, filler);
).fill(washed, filler);
// stairway1 top
stairway1_upper_half.intersect(
painter
.sphere(Aabb {
min: (center_s1 - (diameter / 6) + 1)
@ -932,8 +932,8 @@ impl SeaChapel {
max: (center_s1 + (diameter / 6))
.with_z(base - (diameter / 8) + diameter - (diameter / 4) + (diameter / 3)),
})
.intersect(stairway1_upper_half)
.fill(top, filler);
).fill(top, filler);
stairway1_upper_half.intersect(
painter
.cylinder(Aabb {
min: (center_s1 - (diameter / 6))
@ -941,8 +941,7 @@ impl SeaChapel {
max: (center_s1 + (diameter / 6))
.with_z(base - (diameter / 8) + diameter - (diameter / 4) + (diameter / 6)),
})
.intersect(stairway1_upper_half)
.clear(filler);
).clear(filler);
// stairway1 top gold ring
painter
.cylinder(Aabb {
@ -1014,13 +1013,14 @@ impl SeaChapel {
.with_z(base - (diameter / 8) + diameter - (diameter / 10) + (diameter / 3)),
})
.fill(white, filler);
let stairway2_upper_half = painter.cylinder(Aabb {
let stairway2_upper_half = painter.aabb(Aabb {
min: (center_s2 - (diameter / 6))
.with_z(base - (diameter / 8) + diameter - (diameter / 10) + (diameter / 6)),
max: (center_s2 + (diameter / 6))
.with_z(base - (diameter / 8) + diameter - (diameter / 10) + (diameter / 3)),
});
}).as_kind();
// stairway2 top washed out
stairway2_upper_half.intersect(
painter
.sphere(Aabb {
min: (center_s2 - (diameter / 6))
@ -1028,9 +1028,9 @@ impl SeaChapel {
max: (center_s2 + (diameter / 6))
.with_z(base - (diameter / 8) + diameter - (diameter / 10) + (diameter / 3)),
})
.intersect(stairway2_upper_half)
.fill(washed, filler);
).fill(washed, filler);
// stairway2 top
stairway2_upper_half.intersect(
painter
.sphere(Aabb {
min: (center_s2 - (diameter / 6) + 1)
@ -1038,8 +1038,8 @@ impl SeaChapel {
max: (center_s2 + (diameter / 6))
.with_z(base - (diameter / 8) + diameter - (diameter / 10) + (diameter / 3)),
})
.intersect(stairway2_upper_half)
.fill(top, filler);
).fill(top, filler);
stairway2_upper_half.intersect(
painter
.cylinder(Aabb {
min: (center_s2 - (diameter / 6))
@ -1047,8 +1047,7 @@ impl SeaChapel {
max: (center_s2 + (diameter / 6))
.with_z(base - (diameter / 8) + diameter - (diameter / 10) + (diameter / 6)),
})
.intersect(stairway2_upper_half)
.clear(filler);
).clear(filler);
// stairway2 top gold ring
painter
.cylinder(Aabb {
@ -1070,6 +1069,13 @@ impl SeaChapel {
})
.clear(filler);
// stairway1 clear top halfway
painter.aabb(Aabb {
min: (center_s1 - (diameter / 6) + 1)
.with_z(base - (diameter / 8) + diameter - (diameter / 8)),
max: (center_s1 + (diameter / 6) - 1).with_z(
base - (diameter / 8) + diameter - (diameter / 4) + (diameter / 3) - 1,
),
}).as_kind().intersect(
painter
.sphere(Aabb {
min: (center_s1 - (diameter / 6) + 1)
@ -1077,17 +1083,14 @@ impl SeaChapel {
max: (center_s1 + (diameter / 6) - 1)
.with_z(base - (diameter / 8) + diameter - (diameter / 4) + (diameter / 3) - 1),
})
.intersect(
painter.cylinder(Aabb {
min: (center_s1 - (diameter / 6) + 1)
.with_z(base - (diameter / 8) + diameter - (diameter / 8)),
max: (center_s1 + (diameter / 6) - 1).with_z(
base - (diameter / 8) + diameter - (diameter / 4) + (diameter / 3) - 1,
),
}),
)
.clear(filler);
).clear(filler);
// stairway2 clear top halfway
painter.aabb(Aabb {
min: (center_s2 - (diameter / 6) + 1).with_z(base - (diameter / 8) + diameter + 2),
max: (center_s2 + (diameter / 6) - 1).with_z(
base - (diameter / 8) + diameter - (diameter / 10) + (diameter / 3) - 1,
),
}).as_kind().intersect(
painter
.sphere(Aabb {
min: (center_s2 - (diameter / 6) + 1)
@ -1096,13 +1099,7 @@ impl SeaChapel {
base - (diameter / 8) + diameter - (diameter / 10) + (diameter / 3) - 1,
),
})
.intersect(painter.cylinder(Aabb {
min: (center_s2 - (diameter / 6) + 1).with_z(base - (diameter / 8) + diameter + 2),
max: (center_s2 + (diameter / 6) - 1).with_z(
base - (diameter / 8) + diameter - (diameter / 10) + (diameter / 3) - 1,
),
}))
.clear(filler);
).clear(filler);
// stairway2 top window1
painter
.aabb(Aabb {
@ -2313,26 +2310,26 @@ impl SeaChapel {
)
}
// water basin
painter
painter.aabb(Aabb {
min: (center - diameter + (diameter / 5) + 1).with_z(base - (4 * diameter / 3)),
max: (center + diameter - (diameter / 5) - 1).with_z(base - (2 * diameter / 3) + 1),
}).as_kind().intersect(
painter
.sphere(Aabb {
min: (center - diameter + (diameter / 5) + 1).with_z(base - (4 * diameter / 3)),
max: (center + diameter - (diameter / 5) - 1).with_z(base + 1),
})
.intersect(painter.cylinder(Aabb {
min: (center - diameter + (diameter / 5) + 1).with_z(base - (4 * diameter / 3)),
max: (center + diameter - (diameter / 5) - 1).with_z(base - (2 * diameter / 3) + 1),
}))
.fill(white, filler);
).fill(white, filler);
painter.aabb(Aabb {
min: (center - diameter + (diameter / 5) + 2).with_z(base - (4 * diameter / 3) + 1),
max: (center + diameter - (diameter / 5) - 2).with_z(base - (2 * diameter / 3) + 1),
}).as_kind().intersect(
painter
.sphere(Aabb {
min: (center - diameter + (diameter / 5) + 2).with_z(base - (4 * diameter / 3) + 1),
max: (center + diameter - (diameter / 5) - 2).with_z(base + 1),
})
.intersect(painter.cylinder(Aabb {
min: (center - diameter + (diameter / 5) + 2).with_z(base - (4 * diameter / 3) + 1),
max: (center + diameter - (diameter / 5) - 2).with_z(base - (2 * diameter / 3) + 1),
}))
.fill(water, filler);
).fill(water, filler);
// stairway1 bottom
painter
.sphere(Aabb {
@ -2798,6 +2795,12 @@ impl SeaChapel {
})
.fill(water, filler);
// fill underwater chamber halfway with air
painter.aabb(Aabb {
min: (center - (diameter / 3) + 1)
.with_z(base - (3 * diameter / 3) - (diameter / 6) + 1),
max: (center + (diameter / 3) - 1)
.with_z(base - (2 * diameter / 3) - (diameter / 6) - 1),
}).as_kind().intersect(
painter
.sphere(Aabb {
min: (center - (diameter / 3) + 1)
@ -2805,15 +2808,7 @@ impl SeaChapel {
max: (center + (diameter / 3) - 1)
.with_z(base - (2 * diameter / 3) - (diameter / 6) - 1),
})
.intersect(
painter.cylinder(Aabb {
min: (center - (diameter / 3) + 1)
.with_z(base - (3 * diameter / 3) - (diameter / 6) + 1),
max: (center + (diameter / 3) - 1)
.with_z(base - (2 * diameter / 3) - (diameter / 6) - 1),
}),
)
.clear(filler);
).clear(filler);
// chapel underwater chamber mobile1
painter
.cone(Aabb {
@ -3030,6 +3025,18 @@ impl SeaChapel {
),
})
.fill(white, filler);
painter.aabb(Aabb {
min: Vec3::new(
center.x - (diameter / 4) + 1,
center.y - (diameter / 2) - (diameter / 4) + 1,
base - 1,
),
max: Vec3::new(
center.x + (diameter / 4 - 1),
center.y - (diameter / 2) + (diameter / 4) - 1,
base - (diameter / 4) + (diameter / 2) - 1,
),
}).as_kind().intersect(
painter
.sphere(Aabb {
min: Vec3::new(
@ -3043,19 +3050,7 @@ impl SeaChapel {
base - (diameter / 4) + (diameter / 2) - 1,
),
})
.intersect(painter.cylinder(Aabb {
min: Vec3::new(
center.x - (diameter / 4) + 1,
center.y - (diameter / 2) - (diameter / 4) + 1,
base - 1,
),
max: Vec3::new(
center.x + (diameter / 4 - 1),
center.y - (diameter / 2) + (diameter / 4) - 1,
base - (diameter / 4) + (diameter / 2) - 1,
),
}))
.clear(filler);
).clear(filler);
painter
.aabb(Aabb {
min: Vec3::new(
@ -3277,6 +3272,18 @@ impl SeaChapel {
),
})
.fill(white, filler);
painter.aabb(Aabb {
min: Vec3::new(
center.x - (diameter / 4) + 1,
center.y + (diameter / 2) - (diameter / 4) + 1,
base - 1,
),
max: Vec3::new(
center.x + (diameter / 4 - 1),
center.y + (diameter / 2) + (diameter / 4) - 1,
base - (diameter / 4) + (diameter / 2) - 1,
),
}).as_kind().intersect(
painter
.sphere(Aabb {
min: Vec3::new(
@ -3290,19 +3297,7 @@ impl SeaChapel {
base - (diameter / 4) + (diameter / 2) - 1,
),
})
.intersect(painter.cylinder(Aabb {
min: Vec3::new(
center.x - (diameter / 4) + 1,
center.y + (diameter / 2) - (diameter / 4) + 1,
base - 1,
),
max: Vec3::new(
center.x + (diameter / 4 - 1),
center.y + (diameter / 2) + (diameter / 4) - 1,
base - (diameter / 4) + (diameter / 2) - 1,
),
}))
.clear(filler);
).clear(filler);
painter
.aabb(Aabb {
min: Vec3::new(
@ -3705,26 +3700,26 @@ impl SeaChapel {
base - (bldg_diameter / 15) + (bldg_diameter / 4) - 1,
),
});
let bldg_top_half = painter.cylinder(Aabb {
let bldg_top_half = painter.aabb(Aabb {
min: (bldg_center - (bldg_diameter / 4))
.with_z(base - (bldg_diameter / 15) + (bldg_diameter / 4)),
max: (bldg_center + (bldg_diameter / 4))
.with_z(base - (bldg_diameter / 15) + (bldg_diameter / 2)),
});
let bldg_top = painter
}).as_kind();
let bldg_top = bldg_top_half.intersect(
painter
.sphere(Aabb {
min: (bldg_center - (bldg_diameter / 4)).with_z(base - (bldg_diameter / 15)),
max: (bldg_center + (bldg_diameter / 4))
.with_z(base - (bldg_diameter / 15) + (bldg_diameter / 2)),
})
.intersect(bldg_top_half);
let bldg_washed_top = painter
}));
let bldg_washed_top = bldg_top_half.intersect(
painter
.sphere(Aabb {
min: (bldg_center - (bldg_diameter / 4)).with_z(base - (bldg_diameter / 15)),
max: (bldg_center + (bldg_diameter / 4) - 1)
.with_z(base - (bldg_diameter / 15) + (bldg_diameter / 2)),
})
.intersect(bldg_top_half);
}));
let bldg_room_goldring = painter.cylinder(Aabb {
min: (bldg_center - (bldg_diameter / 4))
.with_z(base - (bldg_diameter / 15) + (bldg_diameter / 4) + 1),
@ -3810,14 +3805,15 @@ impl SeaChapel {
base - (bldg_diameter / 15) + (bldg_diameter / 2) - 1,
),
});
let bldg_room2_top_half = painter.cylinder(Aabb {
let bldg_room2_top_half = painter.aabb(Aabb {
min: (bldg_center - (bldg_diameter / 6) + 1)
.with_z(base - (bldg_diameter / 15) + (bldg_diameter / 2)),
max: (bldg_center + (bldg_diameter / 6)).with_z(
base - (bldg_diameter / 15) + (bldg_diameter / 2) + (bldg_diameter / 6),
),
});
let bldg_room2_top = painter
}).as_kind();
let bldg_room2_top = bldg_room2_top_half.intersect(
painter
.sphere(Aabb {
min: (bldg_center - (bldg_diameter / 6) + 1).with_z(
base - (bldg_diameter / 15) + (bldg_diameter / 2) - (bldg_diameter / 6),
@ -3825,9 +3821,9 @@ impl SeaChapel {
max: (bldg_center + (bldg_diameter / 6)).with_z(
base - (bldg_diameter / 15) + (bldg_diameter / 2) + (bldg_diameter / 6),
),
})
.intersect(bldg_room2_top_half);
let bldg_room2_washed_top = painter
}));
let bldg_room2_washed_top = bldg_room2_top_half.intersect(
painter
.sphere(Aabb {
min: (bldg_center - (bldg_diameter / 6)).with_z(
base - (bldg_diameter / 15) + (bldg_diameter / 2) - (bldg_diameter / 6),
@ -3835,8 +3831,7 @@ impl SeaChapel {
max: (bldg_center + (bldg_diameter / 6)).with_z(
base - (bldg_diameter / 15) + (bldg_diameter / 2) + (bldg_diameter / 6),
),
})
.intersect(bldg_room2_top_half);
}));
let bldg_room2_goldring = painter.cylinder(Aabb {
min: (bldg_center - (bldg_diameter / 6))
.with_z(base - (bldg_diameter / 15) + (bldg_diameter / 2) + 1),
@ -3938,7 +3933,7 @@ impl SeaChapel {
- 2,
),
};
let bldg_room3_washed_top_half = painter.cylinder(Aabb {
let bldg_room3_washed_top_half = painter.aabb(Aabb {
min: (bldg_center - (bldg_diameter / 7)).with_z(
base - (bldg_diameter / 15)
+ tower_height
@ -3953,8 +3948,9 @@ impl SeaChapel {
+ (2 * (bldg_diameter / 7))
- 2,
),
});
let bldg_room3_washed_top = painter
}).as_kind();
let bldg_room3_washed_top = bldg_room3_washed_top_half.intersect(
painter
.sphere(Aabb {
min: (bldg_center - (bldg_diameter / 7)).with_z(
base - (bldg_diameter / 15) + tower_height + (bldg_diameter / 4) - 2,
@ -3966,9 +3962,9 @@ impl SeaChapel {
+ (2 * (bldg_diameter / 7))
- 2,
),
})
.intersect(bldg_room3_washed_top_half);
let bldg_room3_top = painter
}));
let bldg_room3_top = bldg_room3_washed_top_half.intersect(
painter
.sphere(Aabb {
min: (bldg_center - (bldg_diameter / 7) + 1).with_z(
base - (bldg_diameter / 15) + tower_height + (bldg_diameter / 4) - 2,
@ -3980,8 +3976,7 @@ impl SeaChapel {
+ (2 * (bldg_diameter / 7))
- 2,
),
})
.intersect(bldg_room3_washed_top_half);
}));
let bldg_room3_goldring = Aabb {
min: (bldg_center - (bldg_diameter / 7)).with_z(
base - (bldg_diameter / 15)
@ -4768,28 +4763,28 @@ impl SeaChapel {
su_bldg_base + (su_bldg_diameter / 15) + 2,
),
};
let su_bldg_top_half = painter.cylinder(Aabb {
let su_bldg_top_half = painter.aabb(Aabb {
min: (su_bldg_center - (su_bldg_diameter / 6))
.with_z(su_bldg_base - (su_bldg_diameter / 15) + (su_bldg_diameter / 6)),
max: (su_bldg_center + (su_bldg_diameter / 6))
.with_z(su_bldg_base - (su_bldg_diameter / 15) + (su_bldg_diameter / 3)),
});
let su_bldg_top = painter
}).as_kind();
let su_bldg_top = su_bldg_top_half.intersect(
painter
.sphere(Aabb {
min: (su_bldg_center - (su_bldg_diameter / 6))
.with_z(su_bldg_base - (su_bldg_diameter / 15)),
max: (su_bldg_center + (su_bldg_diameter / 6))
.with_z(su_bldg_base - (su_bldg_diameter / 15) + (su_bldg_diameter / 3)),
})
.intersect(su_bldg_top_half);
let su_bldg_washed_top = painter
}));
let su_bldg_washed_top = su_bldg_top_half.intersect(
painter
.sphere(Aabb {
min: (su_bldg_center - (su_bldg_diameter / 6))
.with_z(su_bldg_base - (su_bldg_diameter / 15)),
max: (su_bldg_center + (su_bldg_diameter / 6) - 1)
.with_z(su_bldg_base - (su_bldg_diameter / 15) + (su_bldg_diameter / 3)),
})
.intersect(su_bldg_top_half);
}));
let su_bldg_goldring = Aabb {
min: (su_bldg_center - (su_bldg_diameter / 6))
.with_z(su_bldg_base - (su_bldg_diameter / 15) + (su_bldg_diameter / 6) + 1),