Improve quick brush creation workflow

This commit is contained in:
Rbanh committed 2026-06-06 14:16:12 -04:00
1 parent f09d35e54e
commit 48b1448c57
9 files changed
+701 -61

No files matched your search

+6 -8
View File
@@ -438,11 +438,9 @@ impl BrushDesc {
}
pub fn extruded_prism(base_vertices: &[Vec3], height: f32) -> Option<Self> {
if crate::brush_math::validate_floor_polygon(base_vertices).is_err() {
return None;
}
let mut base = crate::brush_math::normalize_floor_polygon(base_vertices).ok()?;
crate::brush_math::validate_floor_polygon(&base).ok()?;
let height = height.max(0.001);
let mut base = base_vertices.to_vec();
if crate::brush_math::signed_area_xz(&base) < 0.0 {
base.reverse();
}
@@ -450,12 +448,12 @@ impl BrushDesc {
.iter()
.map(|vertex| *vertex + Vec3::Y * height)
.collect();
let mut bottom = base.clone();
bottom.reverse();
let mut top_face = top;
top_face.reverse();
let mut faces = Vec::with_capacity(base.len() + 2);
faces.push(brush_face("face:+y", Vec3::Y, top));
faces.push(brush_face("face:-y", Vec3::NEG_Y, bottom));
faces.push(brush_face("face:+y", Vec3::Y, top_face));
faces.push(brush_face("face:-y", Vec3::NEG_Y, base.clone()));
for index in 0..base.len() {
let next = (index + 1) % base.len();
let a = base[index];