BS-JD-104 - Brush CSG operations #13

Closed
opened 2026-06-06 01:46:34 -04:00 by Rbanh · 6 comments
Owner

Summary

Implement subtract, intersect, and convex merge for selected brushes.

Why

CSG operations make brushes practical for blockout beyond primitive placement.

Implementation notes

  • Add CSG command/operator entries for selected brush sets.
  • Preview subtract/intersect/merge results before commit.
  • Preserve stable material/face IDs when possible.
  • Reject non-convex or degenerate results with repair guidance.

Acceptance criteria

  • Subtract, intersect, and convex merge operate on selected brushes.
  • Preview and commit/cancel behavior is consistent.
  • Results hydrate to valid mesh/collider output.
  • Invalid results report cause and do not dirty the scene.

Tests/docs

CSG fixture tests for common and degenerate cases. Update docs/editor brush workflow.

## Summary Implement subtract, intersect, and convex merge for selected brushes. ## Why CSG operations make brushes practical for blockout beyond primitive placement. ## Implementation notes - Add CSG command/operator entries for selected brush sets. - Preview subtract/intersect/merge results before commit. - Preserve stable material/face IDs when possible. - Reject non-convex or degenerate results with repair guidance. ## Acceptance criteria - [ ] Subtract, intersect, and convex merge operate on selected brushes. - [ ] Preview and commit/cancel behavior is consistent. - [ ] Results hydrate to valid mesh/collider output. - [ ] Invalid results report cause and do not dirty the scene. ## Tests/docs CSG fixture tests for common and degenerate cases. Update docs/editor brush workflow.
Rbanh added this to the M1 - Brush-based blockout milestone 2026-06-06 01:46:34 -04:00
Rbanh added the
roadmap:jackdaw
type:feature
priority:P1
area:brushes
labels 2026-06-06 01:46:34 -04:00
Author
Owner

Starting implementation for BS-JD-104 - Brush CSG operations.

Initial scope:

  • Add shared convex brush clipping helpers that can support subtract/intersect/clip mode.
  • Start with robust cube/prism-compatible plane clipping and convex intersection cases.
  • Add command palette/menu commands where existing command registry supports them: brush.intersect, brush.merge_convex, and a staged path for subtract.
  • Route mutations through undoable brush commands/snapshots.
  • Use this math to give #12 clip mode an actual commit behavior instead of leaving it as visualization-only.

Will update this issue and #12 as the shared geometry work lands.

Starting implementation for `BS-JD-104 - Brush CSG operations`. Initial scope: - Add shared convex brush clipping helpers that can support subtract/intersect/clip mode. - Start with robust cube/prism-compatible plane clipping and convex intersection cases. - Add command palette/menu commands where existing command registry supports them: `brush.intersect`, `brush.merge_convex`, and a staged path for subtract. - Route mutations through undoable brush commands/snapshots. - Use this math to give #12 clip mode an actual commit behavior instead of leaving it as visualization-only. Will update this issue and #12 as the shared geometry work lands.
Author
Owner

Progress checkpoint committed as 02beeb7 Add brush CSG commands.

Implemented MVP:

  • Added brush.subtract, brush.intersect, and brush.merge_convex command palette commands.
  • Commands are disabled until at least two brush actors are selected.
  • Intersect replaces the primary brush with the overlapping bounds of selected brushes and deletes the other selected brushes.
  • Convex merge replaces the primary brush with the bounding cuboid union and deletes the other selected brushes.
  • Subtract clips the primary brush to the largest remaining axis-aligned slab after subtracting the second selected brush; cutter remains in the scene.
  • Results use existing transform/brush history paths.
  • Added tests for overlap intersection and subtract slab selection.
  • Updated brush docs with the bounds-based MVP limitations.

Verification:

  • cargo fmt --check
  • cargo test -p editor brush_csg
  • cargo check --workspace --all-targets
  • cargo check --workspace --all-targets --all-features

Leaving this issue open for full arbitrary-face CSG: multi-output subtraction, convex plane clipping, material-preserving face matching, and tighter single-undo grouping.

Progress checkpoint committed as `02beeb7 Add brush CSG commands`. Implemented MVP: - Added `brush.subtract`, `brush.intersect`, and `brush.merge_convex` command palette commands. - Commands are disabled until at least two brush actors are selected. - Intersect replaces the primary brush with the overlapping bounds of selected brushes and deletes the other selected brushes. - Convex merge replaces the primary brush with the bounding cuboid union and deletes the other selected brushes. - Subtract clips the primary brush to the largest remaining axis-aligned slab after subtracting the second selected brush; cutter remains in the scene. - Results use existing transform/brush history paths. - Added tests for overlap intersection and subtract slab selection. - Updated brush docs with the bounds-based MVP limitations. Verification: - `cargo fmt --check` - `cargo test -p editor brush_csg` - `cargo check --workspace --all-targets` - `cargo check --workspace --all-targets --all-features` Leaving this issue open for full arbitrary-face CSG: multi-output subtraction, convex plane clipping, material-preserving face matching, and tighter single-undo grouping.
Author
Owner

Checkpoint pushed: 8abe470 Validate brush CSG inputs.

Implemented:

  • CSG commands now validate all selected input brushes before computing/applying results.
  • CSG commands validate the generated bounds result before applying transform/brush changes or deleting intersect/merge operands.
  • Invalid inputs/results report status text and leave the scene untouched.
  • Updated brush workflow docs for no-dirty invalid CSG behavior.

Verification:

  • cargo fmt --check
  • cargo test -p editor brush_csg
  • cargo check -p editor --all-targets
  • cargo check --workspace --all-targets
  • cargo check --workspace --all-targets --all-features

Remaining follow-up for the full ticket: true preview/commit/cancel UX and full arbitrary-face CSG instead of the current bounds-based MVP.

Checkpoint pushed: `8abe470 Validate brush CSG inputs`. Implemented: - CSG commands now validate all selected input brushes before computing/applying results. - CSG commands validate the generated bounds result before applying transform/brush changes or deleting intersect/merge operands. - Invalid inputs/results report status text and leave the scene untouched. - Updated brush workflow docs for no-dirty invalid CSG behavior. Verification: - `cargo fmt --check` - `cargo test -p editor brush_csg` - `cargo check -p editor --all-targets` - `cargo check --workspace --all-targets` - `cargo check --workspace --all-targets --all-features` Remaining follow-up for the full ticket: true preview/commit/cancel UX and full arbitrary-face CSG instead of the current bounds-based MVP.
Author
Owner

Completion checkpoint pushed: 4b6617f Preview brush CSG operations.

Implemented:

  • CSG commands now create a pending preview instead of mutating immediately.
  • A cyan viewport wireframe shows the pending bounds result.
  • Enter commits the preview; Esc cancels it without dirtying the scene.
  • Commit applies the primary brush result and deletes merge/intersect operands through existing history paths.
  • Existing input/result validation remains in front of preview generation.
  • Registered BrushCsgPlugin and updated brush docs.

Full #13 coverage now includes:

  • brush.subtract, brush.intersect, and brush.merge_convex on selected brushes.
  • Preview + Enter/Esc commit/cancel behavior.
  • Valid generated brush/collider hydration path through the existing brush hydrator.
  • Invalid operations report status and do not dirty the scene.

Verification:

  • cargo fmt --check
  • cargo test -p editor brush_csg
  • cargo check -p editor --all-targets
  • cargo check --workspace --all-targets
  • cargo check --workspace --all-targets --all-features

Known limitation: this remains the documented bounds-based MVP, not arbitrary-face CSG.

Completion checkpoint pushed: `4b6617f Preview brush CSG operations`. Implemented: - CSG commands now create a pending preview instead of mutating immediately. - A cyan viewport wireframe shows the pending bounds result. - Enter commits the preview; Esc cancels it without dirtying the scene. - Commit applies the primary brush result and deletes merge/intersect operands through existing history paths. - Existing input/result validation remains in front of preview generation. - Registered `BrushCsgPlugin` and updated brush docs. Full #13 coverage now includes: - `brush.subtract`, `brush.intersect`, and `brush.merge_convex` on selected brushes. - Preview + Enter/Esc commit/cancel behavior. - Valid generated brush/collider hydration path through the existing brush hydrator. - Invalid operations report status and do not dirty the scene. Verification: - `cargo fmt --check` - `cargo test -p editor brush_csg` - `cargo check -p editor --all-targets` - `cargo check --workspace --all-targets` - `cargo check --workspace --all-targets --all-features` Known limitation: this remains the documented bounds-based MVP, not arbitrary-face CSG.
Rbanh closed this issue 2026-06-06 06:43:52 -04:00
Author
Owner

Follow-up scope note:

This M1 ticket remains the MVP CSG path for selected brushes. First-class concave authored brushes and robust arbitrary CSG are now split into the post-Jackdaw geometry-kernel roadmap so the M1 implementation can stay focused on convex/bounds-safe blockout operations.

Follow-up scope note: This M1 ticket remains the MVP CSG path for selected brushes. First-class concave authored brushes and robust arbitrary CSG are now split into the post-Jackdaw geometry-kernel roadmap so the M1 implementation can stay focused on convex/bounds-safe blockout operations.
Author
Owner

QA checklist hardening committed locally as 3f85d25 (Group brush CSG history edits). Not pushed.

Fix:

  • CSG Enter commit now uses one grouped ApplyBrushCsg history command.
  • The grouped command applies the primary brush transform/geometry update and, for merge/intersect, deletes operand brushes in the same undoable operation.
  • Undo restores the primary brush and deleted operands together; redo reapplies the CSG result and operand deletion together.
  • Added regression coverage for the grouped CSG command label.

Verification:

  • cargo fmt --check
  • cargo test -p editor brush_csg
  • cargo check -p editor --all-targets
  • cargo check --workspace --all-targets
  • cargo check --workspace --all-targets --all-features
QA checklist hardening committed locally as `3f85d25` (`Group brush CSG history edits`). Not pushed. Fix: - CSG Enter commit now uses one grouped `ApplyBrushCsg` history command. - The grouped command applies the primary brush transform/geometry update and, for merge/intersect, deletes operand brushes in the same undoable operation. - Undo restores the primary brush and deleted operands together; redo reapplies the CSG result and operand deletion together. - Added regression coverage for the grouped CSG command label. Verification: - `cargo fmt --check` - `cargo test -p editor brush_csg` - `cargo check -p editor --all-targets` - `cargo check --workspace --all-targets` - `cargo check --workspace --all-targets --all-features`
Sign in to join this conversation.
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Falling-Metal-Interactive/Blacksite#13
No description provided.