Add clay pieces, masking, and topology editing to sculpt

Add pastel presets, piece selection and colors, mask brushes, subdivision and conservative decimation with bounded worker operations and mixed undo history.

Amp-Thread-ID: https://ampcode.com/threads/T-01a0b4b4-202c-73f1-984d-9a55c88f9c83
Co-authored-by: Heaust Azure <heaust.azure@gmail.com>
This commit is contained in:
Amp
2026-10-01 07:55:48 +00:00
co-authored by heaust
parent d930d8172f
commit d279ec4123
21 changed files with 2564 additions and 131 deletions
+6 -1
View File
@@ -62,7 +62,9 @@ export class BVH {
this.bounds(node);
return node;
};
this.root = build(Array.from({ length: this.leaves.length }, (_, i) => i));
this.root = this.leaves.length
? build(Array.from({ length: this.leaves.length }, (_, i) => i))
: null;
this.marks = new Uint32Array(mesh.positions.length / 3);
this.generation = 0;
}
@@ -86,6 +88,7 @@ export class BVH {
}
}
refit(faces) {
if (!this.root) return;
const dirty = new Set(faces.map((f) => this.leaves[f]));
for (const leaf of dirty) this.bounds(leaf);
let parents = new Set([...dirty].map((n) => n.parent).filter(Boolean));
@@ -99,6 +102,7 @@ export class BVH {
}
}
raycast(origin, direction) {
if (!this.root) return null;
let best = null;
const entry = (n) => {
let near = 0,
@@ -135,6 +139,7 @@ export class BVH {
return best;
}
within(center, radius) {
if (!this.root) return [];
const result = [],
gen = ++this.generation,
r2 = radius * radius;