Skip to content

Fix CSG subtract for composite base meshes#297

Open
tracygardner wants to merge 5 commits intomainfrom
codex/fix-csg-subtract-for-composite-glb-meshes
Open

Fix CSG subtract for composite base meshes#297
tracygardner wants to merge 5 commits intomainfrom
codex/fix-csg-subtract-for-composite-glb-meshes

Conversation

@tracygardner
Copy link
Contributor

Motivation

  • Composite GLB bases were being reduced to a single child with material for CSG, which broke subtraction on multi-part models.
  • The result mesh should keep material/visual reference from a material-bearing descendant while using the full composite geometry for CSG operations.

Description

  • Introduced referenceMesh (the first descendant with a material or the base) and kept actualBase for geometry preparation in subtractMeshes, subtractMeshesMerge, and subtractMeshesIndividual.
  • Continued to call prepareMeshForCSG(actualBase) so composite children are merged into a geometry-ready mesh while preserving the separate referenceMesh for copying materials and transforms.
  • Replaced previous uses of actualBase in applyResultMeshProperties with referenceMesh so the result inherits the correct material and visual properties.
  • Kept existing CSG cloning, merging, and cleanup logic unchanged to preserve prior behavior for subtraction approaches.

Testing

  • No automated tests were run for this change.
  • Manual validation was not recorded in automated test outputs.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant