Skip to content

armgit / kiln

Public Imported from GitHub
0

Build and revise procedural 3D assets with your coding agent. Local MCP server, CLI and TypeScript engine with rendered review, editable source and GLB export.

Compare the components inside a welded mesh (#304) (#322)

Matthew Kissinger7e7a1e002a34
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ee8aff9c..a6732c70 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,19 @@ does not publish a package.
## Unreleased
+- The floating-parts warning and `GEO_PART_CONNECTIVITY` now see primitives merged into one mesh
+ (#304). One mesh was one bounding box, so a welded component was never compared with the rest at
+ any distance. Each mesh is now split into its connected components, through triangles and shared
+ positions, and each gets its own box; the 2 cm floor is unchanged. Many loose components of one
+ mesh collapse to one finding that locates the nearest one and what it sits nearest to. Instanced
+ and skinned meshes, LOD alternates and foliage or decal names stay whole, as does a mesh over
+ 262,144 vertices or 256 components, which a finding names. Over the 86 historical examples this
+ moves connectivity findings from 18 in 8 assets to 43 in 9, beside part-volume's 3,575 in 86 and
+ open-surface's 916 in 50. All 25 new ones are in `demo-dauntless-cv-08`, whose per-material meshes
+ had bridged unrelated parts: its deck markings were one box across the whole deck. A split can
+ therefore report parts that no welded mesh contains. `partsAnalyzed` now counts components, and
+ connectivity groups gain a `node` field.
+
- A build over the evaluator's output budget now says which budget it reached (#317). The error
names the stage (`glb` or `response`), the limit, the size and, for a GLB, the triangle count,
and says what to try next; it was `Evaluator output limit exceeded.` alone. The fixed wire
diff --git a/dist/agent-run.mjs b/dist/agent-run.mjs
index fc7c844b..135372c4 100644
--- a/dist/agent-run.mjs
+++ b/dist/agent-run.mjs
@@ -16877,9 +16877,135 @@ var init_lod2 = __esm(() => {
init_lod();
});
-// src/qa/part-connectivity.ts
+// src/qa/mesh-components.ts
import * as THREE15 from "three";
-function collectParts2(root, exempt, supports) {
+function find(parent, start) {
+ let root = start;
+ while (parent[root] !== root)
+ root = parent[root];
+ for (let at = start;parent[at] !== root; ) {
+ const next = parent[at];
+ parent[at] = root;
+ at = next;
+ }
+ return root;
+}
+function union(parent, a, b) {
+ const ra = find(parent, a);
+ const rb = find(parent, b);
+ if (ra < rb)
+ parent[rb] = ra;
+ else
+ parent[ra] = rb;
+}
+function walkComponents(geometry) {
+ const position = geometry.getAttribute("position");
+ const version = position?.version ?? 0;
+ const cached = cache.get(geometry);
+ if (cached && cached.version === version)
+ return cached;
+ const store = (result) => {
+ cache.set(geometry, result);
+ return result;
+ };
+ if (position?.itemSize !== 3 || position.count > MAX_SPLIT_VERTICES)
+ return store({ version, count: 0 });
+ const parent = new Int32Array(position.count);
+ const used = new Uint8Array(position.count);
+ for (let i = 0;i < parent.length; i++)
+ parent[i] = i;
+ const finite = new Uint8Array(position.count);
+ const bounds = new THREE15.Box3;
+ const point = new THREE15.Vector3;
+ for (let i = 0;i < position.count; i++) {
+ point.fromBufferAttribute(position, i);
+ if (Number.isFinite(point.x) && Number.isFinite(point.y) && Number.isFinite(point.z)) {
+ finite[i] = 1;
+ bounds.expandByPoint(point);
+ }
+ }
+ const index = geometry.getIndex();
+ const triangles = (index?.count ?? position.count) - (index?.count ?? position.count) % 3;
+ const corner = (at) => index ? index.getX(at) : at;
+ for (let at = 0;at < triangles; at += 3) {
+ const a = corner(at);
+ const b = corner(at + 1);
+ const c = corner(at + 2);
+ if (!finite[a] || !finite[b] || !finite[c])
+ continue;
+ used[a] = used[b] = used[c] = 1;
+ union(parent, a, b);
+ union(parent, b, c);
+ }
+ const size = bounds.isEmpty() ? new THREE15.Vector3 : bounds.getSize(new THREE15.Vector3);
+ const tolerance = Math.max(size.x, size.y, size.z) * 0.000001 || 1;
+ const seen = new Map;
+ for (let i = 0;i < position.count; i++) {
+ if (!used[i])
+ continue;
+ point.fromBufferAttribute(position, i).sub(bounds.min).divideScalar(tolerance);
+ const key = `${Math.round(point.x)},${Math.round(point.y)},${Math.round(point.z)}`;
+ const first = seen.get(key);
+ if (first === undefined)
+ seen.set(key, i);
+ else
+ union(parent, first, i);
+ }
+ const labels = new Int32Array(position.count).fill(-1);
+ const byRoot = new Map;
+ for (let i = 0;i < position.count; i++) {
+ if (!used[i])
+ continue;
+ const root = find(parent, i);
+ let label = byRoot.get(root);
+ if (label === undefined) {
+ label = byRoot.size;
+ byRoot.set(root, label);
+ if (byRoot.size > MAX_MESH_COMPONENTS)
+ return store({ version, count: byRoot.size });
+ }
+ labels[i] = label;
+ }
+ return store({ version, count: byRoot.size, labels });
+}
+function meshComponentBoxes(mesh, budget) {
+ const flagged = mesh;
+ if (flagged.isInstancedMesh || flagged.isSkinnedMesh || STANDS_APART_NAME.test(mesh.name) || (lodLevel(mesh) ?? 0) > 0)
+ return;
+ const geometry = mesh.geometry;
+ const position = geometry?.getAttribute("position");
+ if (!position)
+ return;
+ const walked = walkComponents(geometry);
+ if (!walked.labels || walked.count > 1 && budget.components + walked.count > MAX_SCENE_COMPONENTS) {
+ budget.unsplit.push(mesh.name || "(unnamed mesh)");
+ return;
+ }
+ if (walked.count < 1)
+ return;
+ if (walked.count > 1)
+ budget.components += walked.count;
+ const boxes = Array.from({ length: walked.count }, () => new THREE15.Box3);
+ const point = new THREE15.Vector3;
+ for (let i = 0;i < position.count; i++) {
+ const label = walked.labels[i];
+ if (label < 0)
+ continue;
+ point.fromBufferAttribute(position, i).applyMatrix4(mesh.matrixWorld);
+ boxes[label].expandByPoint(point);
+ }
+ return boxes;
+}
+var MAX_SPLIT_VERTICES = 262144, MAX_MESH_COMPONENTS = 256, MAX_SCENE_COMPONENTS = 4096, STANDS_APART_NAME, splitBudget = () => ({ components: 0, unsplit: [] }), cache;
+var init_mesh_components = __esm(() => {
+ init_lod2();
+ STANDS_APART_NAME = /(?:^|_)(?:leaf|leaves|foliage|frond|card|decal|billboard|petal)/i;
+ cache = new WeakMap;
+});
+
+// src/qa/part-connectivity.ts
+import * as THREE16 from "three";
+function collectParts2(root, exempt, budget, supports) {
const parts = [];
let lodExcluded = 0;
root.updateWorldMatrix(true, true);
@@ -16892,15 +17018,29 @@ function collectParts2(root, exempt, supports) {
lodExcluded++;
return;
}
- if (EXEMPT_NAME.test(name)) {
+ if (STANDS_APART_NAME.test(name)) {
exempt.push(name);
return;
}
- const box = new THREE15.Box3().setFromObject(mesh);
+ const box = new THREE16.Box3().setFromObject(mesh);
if (box.isEmpty())
return;
+ const components = meshComponentBoxes(mesh, budget);
+ if (components && components.length > 1) {
+ for (const [index, piece] of components.entries()) {
+ const support = restingSupport(mesh, piece.min.y, supports);
+ parts.push({
+ name: `${name} (welded component ${index + 1} of ${components.length})`,
+ node: name,
+ weldedOf: components.length,
+ box: piece,
+ ...support ? { support } : {}
+ });
+ }
+ return;
+ }
const support = restingSupport(mesh, box.min.y, supports);
- parts.push({ name, box, ...support ? { support } : {} });
+ parts.push({ name, node: name, box, ...support ? { support } : {} });
});
return { parts, lodExcluded };
}
@@ -16910,14 +17050,37 @@ function boxGap(a, b) {
const dz = Math.max(0, Math.max(a.min.z - b.max.z, b.min.z - a.max.z));
return Math.hypot(dx, dy, dz);
}
+function collapseWeldedGroups(groups) {
+ const byMesh = new Map;
+ const out = [];
+ for (const group of groups) {
+ const mesh = group.welded?.mesh;
+ const first = mesh === undefined ? undefined : byMesh.get(mesh);
+ if (mesh === undefined)
+ out.push(group);
+ else if (!first) {
+ byMesh.set(mesh, group);
+ out.push(group);
+ } else {
+ first.parts.push(...group.parts);
+ if (group.gap < first.gap) {
+ first.gap = group.gap;
+ first.welded = group.welded;
+ }
+ }
+ }
+ return out;
+}
function analyzePartConnectivity(root, supports) {
const exempt = [];
- const { parts, lodExcluded } = collectParts2(root, exempt, supports);
+ const budget = splitBudget();
+ const { parts, lodExcluded } = collectParts2(root, exempt, budget, supports);
const report = {
partsAnalyzed: parts.length,
mainComponentSize: parts.length,
exempt,
lodExcluded,
+ unsplit: budget.unsplit,
groups: []
};
if (parts.length < 2)
@@ -16968,15 +17131,25 @@ function analyzePartConnectivity(root, supports) {
if (index === mainIndex)
continue;
let gap = Number.POSITIVE_INFINITY;
+ let nearestMember = members[0];
+ let nearestMain = main[0];
for (const m of members) {
for (const b of main) {
- gap = Math.min(gap, boxGap(parts[m].box, parts[b].box));
+ const between = boxGap(parts[m].box, parts[b].box);
+ if (between < gap) {
+ gap = between;
+ nearestMember = m;
+ nearestMain = b;
+ }
}
}
+ const node = parts[members[0]].node;
+ const welded = members.every((m) => parts[m].weldedOf && parts[m].node === node);
const lowest = members.reduce((a, b) => parts[b].box.min.y < parts[a].box.min.y ? b : a);
const support = parts[lowest].support;
report.groups.push({
parts: members.map((m) => parts[m].name),
+ node,
gap: Math.round(gap * 1e6) / 1e6,
...support && members.every((m) => parts[m].support) ? {
externalSupport: {
@@ -16984,19 +17157,30 @@ function analyzePartConnectivity(root, supports) {
bottomY: Math.round(parts[lowest].box.min.y * 1e6) / 1e6,
tolerance: support.tolerance ?? CONNECTIVITY_TOLERANCE
}
+ } : welded ? {
+ welded: {
+ mesh: node,
+ components: parts[members[0]].weldedOf,
+ detached: locationOf(parts[nearestMember]),
+ nearest: locationOf(parts[nearestMain])
+ }
} : {}
});
}
+ report.groups = collapseWeldedGroups(report.groups);
report.groups.sort((a, b) => b.parts.length - a.parts.length || a.gap - b.gap);
return report;
}
function inspectPartConnectivity(scene, supports) {
- if (!(scene instanceof THREE15.Object3D))
+ if (!(scene instanceof THREE16.Object3D))
return [];
const report = analyzePartConnectivity(scene, supports);
const lodNote = report.lodExcluded === 1 ? " 1 part on an LOD level above 0 was not analyzed." : report.lodExcluded > 1 ? ` ${report.lodExcluded} parts on LOD levels above 0 were not analyzed.` : "";
+ const unsplitNote = report.unsplit.length ? ` Over the split budget, so measured as one box: ${report.unsplit.slice(0, 5).map((mesh) => JSON.stringify(mesh)).join(", ")}${report.unsplit.length > 5 ? ` and ${report.unsplit.length - 5} more` : ""}.` : "";
return report.groups.map((group) => {
- const listed = group.parts.map((p) => JSON.stringify(p)).join(", ");
+ const named = group.parts.slice(0, MAX_LISTED_PARTS).map((p) => JSON.stringify(p));
+ const unnamed = group.parts.length - named.length;
+ const listed = `${named.join(", ")}${unnamed > 0 ? `, +${unnamed} more` : ""}`;
const subject = group.parts.length === 1 ? `Part ${listed} is` : `A group of ${group.parts.length} parts (${listed}) is`;
const declared = group.externalSupport;
if (declared)
@@ -17006,7 +17190,7 @@ function inspectPartConnectivity(scene, supports) {
dimension: "visualQuality",
profile: "geometry.partConnectivity",
message: `${subject} separate from the largest component and rests on the support declared in requirements.externalSupport at Y=${declared.planeY.toFixed(3)} m (bottom at Y=${declared.bottomY.toFixed(3)} m). Information only: the support is composed outside this asset.${lodNote}`,
- affected: { node: group.parts[0] },
+ affected: { node: group.node },
measurement: {
name: "bottomToSupportPlane",
actual: declared.bottomY,
@@ -17015,13 +17199,36 @@ function inspectPartConnectivity(scene, supports) {
},
repairText: "No change is needed for a declared support. Remove the part from requirements.externalSupport if it should attach within this asset."
};
+ if (group.welded) {
+ const { mesh, components, detached, nearest } = group.welded;
+ const span = ({ min, max }) => `[${min.join(", ")}] to [${max.join(", ")}]`;
+ return {
+ code: "GEO_PART_CONNECTIVITY",
+ disposition: "observe",
+ dimension: "visualQuality",
+ profile: "geometry.partConnectivity",
+ message: `Mesh ${JSON.stringify(mesh)} is one drawn part, but ${group.parts.length} of its ${components} welded components ${group.parts.length === 1 ? "is" : "are"} separate from the largest component in the rest-pose bounding boxes of visible parts; the nearest box gap is ${group.gap.toFixed(3)} m. Nearest detached: ${span(detached)}. It is nearest to ${JSON.stringify(nearest.part)} at ${span(nearest)}. This may be intentional. Box adjacency is not physical attachment evidence: a gap under ${CONNECTIVITY_TOLERANCE} m reads as contact.${lodNote}${unsplitNote}`,
+ affected: { node: mesh },
+ measurement: {
+ name: "gapToMainComponent",
+ actual: group.gap,
+ expected: CONNECTIVITY_TOLERANCE,
+ breakdown: {
+ weldedComponents: components,
+ detachedComponents: group.parts.length,
+ ...report.lodExcluded ? { lodExcludedParts: report.lodExcluded } : {}
+ }
+ },
+ repairText: "Check whether the separation is intentional. One mesh moves and hides as one, so a component meant to attach needs its gap closed in the merged geometry; one meant to stand apart reads better as its own part."
+ };
+ }
return {
code: "GEO_PART_CONNECTIVITY",
disposition: "observe",
dimension: "visualQuality",
profile: "geometry.partConnectivity",
- message: `${subject} separate from the largest component in the rest-pose bounding boxes of visible parts; the nearest box gap is ${group.gap.toFixed(3)} m. This may be intentional. Box adjacency is not physical attachment evidence: a gap under ${CONNECTIVITY_TOLERANCE} m reads as contact, and primitives welded into one mesh form one box.${lodNote}`,
- affected: { node: group.parts[0] },
+ message: `${subject} separate from the largest component in the rest-pose bounding boxes of visible parts; the nearest box gap is ${group.gap.toFixed(3)} m. This may be intentional. Box adjacency is not physical attachment evidence: a gap under ${CONNECTIVITY_TOLERANCE} m reads as contact.${lodNote}${unsplitNote}`,
+ affected: { node: group.node },
measurement: {
name: "gapToMainComponent",
actual: group.gap,
@@ -17032,11 +17239,19 @@ function inspectPartConnectivity(scene, supports) {
};
});
}
-var CONNECTIVITY_TOLERANCE = 0.02, EXEMPT_NAME, PART_CONNECTIVITY_QA_RULE;
+var CONNECTIVITY_TOLERANCE = 0.02, MAX_LISTED_PARTS = 12, rounded = (v) => [
+ Math.round(v.x * 1e4) / 1e4,
+ Math.round(v.y * 1e4) / 1e4,
+ Math.round(v.z * 1e4) / 1e4
+], locationOf = (part) => ({
+ part: part.name,
+ min: rounded(part.box.min),
+ max: rounded(part.box.max)
+}), PART_CONNECTIVITY_QA_RULE;
var init_part_connectivity = __esm(() => {
init_lod2();
+ init_mesh_components();
init_registry();
- EXEMPT_NAME = /(?:^|_)(?:leaf|leaves|foliage|frond|card|decal|billboard|petal)/i;
PART_CONNECTIVITY_QA_RULE = Object.freeze({
id: "GEO_PART_CONNECTIVITY",
profile: "geometry.partConnectivity",
@@ -17051,7 +17266,7 @@ var init_part_connectivity = __esm(() => {
});
// src/geometry.ts
-import * as THREE16 from "three";
+import * as THREE17 from "three";
function finiteArray(values, label, length) {
const result = Array.from(values);
if (length !== undefined && result.length !== length)
@@ -17065,8 +17280,8 @@ function meshGeo(data) {
if (positions.length < 9 || positions.length % 3)
throw new Error("meshGeo positions: need at least three xyz vertices");
const count = positions.length / 3;
- const geometry = new THREE16.BufferGeometry;
- geometry.setAttribute("position", new THREE16.Float32BufferAttribute(positions, 3));
+ const geometry = new THREE17.BufferGeometry;
+ geometry.setAttribute("position", new THREE17.Float32BufferAttribute(positions, 3));
if (data.indices) {
const indices = Array.from(data.indices);
if (!indices.length || indices.length % 3)
@@ -17078,7 +17293,7 @@ function meshGeo(data) {
throw new Error("meshGeo: non-indexed positions must form complete triangles");
if (data.normals) {
const normals = finiteArray(data.normals, "meshGeo normals", count * 3);
- geometry.setAttribute("normal", new THREE16.Float32BufferAttribute(normals, 3));
+ geometry.setAttribute("normal", new THREE17.Float32BufferAttribute(normals, 3));
for (let i = 0;i < count; i++)
if (Math.hypot(normals[i * 3], normals[i * 3 + 1], normals[i * 3 + 2]) === 0)
throw new Error("meshGeo normals: zero-length normal");
@@ -17086,36 +17301,36 @@ function meshGeo(data) {
} else
geometry.computeVertexNormals();
if (data.uvs)
- geometry.setAttribute("uv", new THREE16.Float32BufferAttribute(finiteArray(data.uvs, "meshGeo uvs", count * 2), 2));
+ geometry.setAttribute("uv", new THREE17.Float32BufferAttribute(finiteArray(data.uvs, "meshGeo uvs", count * 2), 2));
if (data.tangents) {
const tangents = finiteArray(data.tangents, "meshGeo tangents", count * 4);
for (let i = 0;i < count; i++) {
if (Math.abs(Math.hypot(tangents[i * 4], tangents[i * 4 + 1], tangents[i * 4 + 2]) - 1) > 0.0001 || Math.abs(tangents[i * 4 + 3]) !== 1)
throw new Error("meshGeo tangents: expected unit xyz and handedness +1 or -1");
}
- geometry.setAttribute("tangent", new THREE16.Float32BufferAttribute(tangents, 4));
+ geometry.setAttribute("tangent", new THREE17.Float32BufferAttribute(tangents, 4));
}
geometry.computeBoundingBox();
geometry.computeBoundingSphere();
return geometry;
}
function boundsScale(bounds) {
- const size = bounds.getSize(new THREE16.Vector3);
+ const size = bounds.getSize(new THREE17.Vector3);
const scale = Math.hypot(size.x, size.y, size.z);
if (!Number.isFinite(scale))
throw new Error("Geometry position extent must be finite");
return scale;
}
function positionFrame(position) {
- const bounds = new THREE16.Box3;
- const point = new THREE16.Vector3;
+ const bounds = new THREE17.Box3;
+ const point = new THREE17.Vector3;
for (let i = 0;i < position.count; i++) {
point.fromBufferAttribute(position, i);
if ([point.x, point.y, point.z].every(Number.isFinite))
bounds.expandByPoint(point);
}
return {
- origin: bounds.isEmpty() ? new THREE16.Vector3 : bounds.min,
+ origin: bounds.isEmpty() ? new THREE17.Vector3 : bounds.min,
scale: boundsScale(bounds)
};
}
@@ -17155,11 +17370,11 @@ function geometryDiagnostics(geometry, tolerance) {
solid: { closed: false, manifold: true, orientation: "mixed", signedVolume: 0 }
};
let signedVolume = 0;
- const pa = new THREE16.Vector3, pb = new THREE16.Vector3, pc = new THREE16.Vector3;
+ const pa = new THREE17.Vector3, pb = new THREE17.Vector3, pc = new THREE17.Vector3;
const ids = [];
const points = new Map;
const finite = [];
- const point = new THREE16.Vector3;
+ const point = new THREE17.Vector3;
for (let i = 0;i < p.count; i++) {
point.fromBufferAttribute(p, i);
finite[i] = [point.x, point.y, point.z].every(Number.isFinite);
@@ -17172,7 +17387,7 @@ function geometryDiagnostics(geometry, tolerance) {
}
const indices = geometry.index ? Array.from(geometry.index.array) : Array.from({ length: p.count }, (_, i) => i);
const edges = new Map;
- const a = new THREE16.Vector3, b = new THREE16.Vector3, c = new THREE16.Vector3;
+ const a = new THREE17.Vector3, b = new THREE17.Vector3, c = new THREE17.Vector3;
for (let i = 0;i < indices.length; i += 3) {
result.triangles++;
const triangle = indices.slice(i, i + 3);
@@ -17257,8 +17472,8 @@ function parametricSurface(sample, options = {}) {
if (orientation !== "uv" && orientation !== "vu")
throw new Error("parametricSurface orientation must be uv or vu");
const positions = [], uvs = [], indices = [];
- const sampledBounds = new THREE16.Box3;
- const sampledPoint = new THREE16.Vector3;
+ const sampledBounds = new THREE17.Box3;
+ const sampledPoint = new THREE17.Vector3;
for (let j = 0;j <= nv; j++)
for (let i = 0;i <= nu; i++) {
const point = sample(u[0] + (u[1] - u[0]) * i / nu, v[0] + (v[1] - v[0]) * j / nv);
@@ -17300,8 +17515,8 @@ function parametricSurface(sample, options = {}) {
const sums = new Map;
for (let i = 0;i < normal.count; i++) {
const id = find(i);
- const sum = sums.get(id) ?? new THREE16.Vector3;
- sum.add(new THREE16.Vector3().fromBufferAttribute(normal, i));
+ const sum = sums.get(id) ?? new THREE17.Vector3;
+ sum.add(new THREE17.Vector3().fromBufferAttribute(normal, i));
sums.set(id, sum);
}
for (let i = 0;i < normal.count; i++) {
@@ -17326,13 +17541,13 @@ function creaseNormals(geometry, options = {}) {
const keys = [];
const faces = [];
for (let i = 0;i < position.count; i += 3) {
- const a = new THREE16.Vector3().fromBufferAttribute(position, i);
- const b = new THREE16.Vector3().fromBufferAttribute(position, i + 1);
- const c = new THREE16.Vector3().fromBufferAttribute(position, i + 2);
+ const a = new THREE17.Vector3().fromBufferAttribute(position, i);
+ const b = new THREE17.Vector3().fromBufferAttribute(position, i + 1);
+ const c = new THREE17.Vector3().fromBufferAttribute(position, i + 2);
const face = b.sub(a).divideScalar(scale).cross(c.sub(a).divideScalar(scale)).normalize();
faces.push(face);
for (let j = i;j < i + 3; j++) {
- const point = new THREE16.Vector3().fromBufferAttribute(position, j);
+ const point = new THREE17.Vector3().fromBufferAttribute(position, j);
if (![point.x, point.y, point.z].every(Number.isFinite))
throw new Error("creaseNormals positions must be finite");
const key = positionKey(point, frame.origin, tolerance);
@@ -17343,15 +17558,15 @@ function creaseNormals(geometry, options = {}) {
}
}
const normals = new Float32Array(position.count * 3);
- const threshold = Math.cos(THREE16.MathUtils.degToRad(angle));
+ const threshold = Math.cos(THREE17.MathUtils.degToRad(angle));
for (let i = 0;i < position.count; i++) {
- const face = faces[Math.floor(i / 3)], sum = new THREE16.Vector3;
+ const face = faces[Math.floor(i / 3)], sum = new THREE17.Vector3;
for (const other of adjacent.get(keys[i]))
if (face.dot(faces[other]) >= threshold - 0.000000000001)
sum.add(faces[other]);
sum.normalize().toArray(normals, i * 3);
}
- out.setAttribute("normal", new THREE16.BufferAttribute(normals, 3));
+ out.setAttribute("normal", new THREE17.BufferAttribute(normals, 3));
out.deleteAttribute("tangent");
out.computeBoundingBox();
out.computeBoundingSphere();
@@ -17363,14 +17578,14 @@ var init_geometry = __esm(() => {
});
// src/qa/open-surface-penetration.ts
-import * as THREE17 from "three";
+import * as THREE18 from "three";
function buildHierarchy(triangles) {
- const box = new THREE17.Box3;
+ const box = new THREE18.Box3;
for (const triangle of triangles)
box.union(triangle.box);
if (triangles.length <= 4)
return { box, triangles };
- const size = box.getSize(new THREE17.Vector3);
+ const size = box.getSize(new THREE18.Vector3);
const axis = size.x >= size.y && size.x >= size.z ? "x" : size.y >= size.z ? "y" : "z";
const center = (triangle) => triangle.box.min[axis] / 2 + triangle.box.max[axis] / 2;
const sorted = [...triangles].sort((a, b) => center(a) - center(b));
@@ -17394,15 +17609,15 @@ function worldTriangles(mesh) {
const id = index ? index.getX(at) : at;
if (!Number.isSafeInteger(id) || id < 0 || id >= position.count)
return null;
- const point = new THREE17.Vector3().fromBufferAttribute(position, id).applyMatrix4(mesh.matrixWorld);
+ const point = new THREE18.Vector3().fromBufferAttribute(position, id).applyMatrix4(mesh.matrixWorld);
return [point.x, point.y, point.z].every(Number.isFinite) ? point : null;
};
for (let i = 0;i < count; i += 3) {
const a = vertex(i), b = vertex(i + 1), c = vertex(i + 2);
if (!a || !b || !c)
return null;
- const triangle = new THREE17.Triangle(a, b, c);
- triangles.push({ triangle, box: new THREE17.Box3().setFromPoints([a, b, c]) });
+ const triangle = new THREE18.Triangle(a, b, c);
+ triangles.push({ triangle, box: new THREE18.Box3().setFromPoints([a, b, c]) });
}
return triangles.length ? triangles : null;
}
@@ -17503,7 +17718,7 @@ class Budget {
function nearestDistance(root, point, budget) {
let best = Infinity;
const stack = [root];
- const scratch = new THREE17.Vector3;
+ const scratch = new THREE18.Vector3;
while (stack.length) {
const node = stack.pop();
if (boxDistanceSquared(node.box, point) >= best)
@@ -17522,10 +17737,10 @@ function nearestDistance(root, point, budget) {
return Number.isFinite(best) ? Math.sqrt(best) : null;
}
function parity(root, point, direction, budget) {
- const ray = new THREE17.Ray(point, direction);
+ const ray = new THREE18.Ray(point, direction);
const stack = [root];
- const hit = new THREE17.Vector3;
- const barycentric = new THREE17.Vector3;
+ const hit = new THREE18.Vector3;
+ const barycentric = new THREE18.Vector3;
let crossings = 0;
while (stack.length) {
const node = stack.pop();
@@ -17573,7 +17788,7 @@ function analyzeOpenSurfacePenetration(root, contactTolerance = OPEN_SURFACE_CON
skipped: [],
penetrations: []
};
- if (!(root instanceof THREE17.Object3D))
+ if (!(root instanceof THREE18.Object3D))
return evidence;
const parts = collectParts3(root, evidence.skipped);
const open = parts.filter((part) => !part.closed);
@@ -17638,7 +17853,7 @@ function analyzeOpenSurfacePenetration(root, contactTolerance = OPEN_SURFACE_CON
}
const matrix = candidate.open.mesh.matrixWorld;
const limit = Math.min(position.count, MAX_SAMPLED_VERTICES);
- const vertex = new THREE17.Vector3;
+ const vertex = new THREE18.Vector3;
let depth = 0;
let penetrating = 0;
let tested = 0;
@@ -17768,9 +17983,9 @@ var init_open_surface_penetration = __esm(() => {
init_lod2();
init_registry();
PARITY_DIRECTIONS = Object.freeze([
- new THREE17.Vector3(1, 0, 0),
- new THREE17.Vector3(0.5773502691896258, 0.5773502691896258, 0.5773502691896258),
- new THREE17.Vector3(-0.2672612419124244, 0.5345224838248488, 0.8017837257372732)
+ new THREE18.Vector3(1, 0, 0),
+ new THREE18.Vector3(0.5773502691896258, 0.5773502691896258, 0.5773502691896258),
+ new THREE18.Vector3(-0.2672612419124244, 0.5345224838248488, 0.8017837257372732)
]);
OPEN_SURFACE_PENETRATION_QA_RULE = Object.freeze({
id: "GEO_OPEN_SURFACE_PENETRATION",
@@ -17786,9 +18001,9 @@ var init_open_surface_penetration = __esm(() => {
});
// src/sweep-analysis.ts
-import * as THREE18 from "three";
+import * as THREE19 from "three";
function segmentHitsTriangle(a, b, tri, epsilon) {
- const plane = new THREE18.Plane().setFromCoplanarPoints(tri.a, tri.b, tri.c);
+ const plane = new THREE19.Plane().setFromCoplanarPoints(tri.a, tri.b, tri.c);
if (plane.normal.lengthSq() === 0)
return false;
const da = plane.distanceToPoint(a), db = plane.distanceToPoint(b);
@@ -17826,7 +18041,7 @@ function recordSweepAnalysis(geometry, rings, profiles, closed) {
return result;
}
const unique = closed ? rings.length - 1 : rings.length;
- const centers = rings.map((ring) => ring.reduce((sum, p) => sum.add(p), new THREE18.Vector3).divideScalar(ring.length));
+ const centers = rings.map((ring) => ring.reduce((sum, p) => sum.add(p), new THREE19.Vector3).divideScalar(ring.length));
for (let i = closed ? 0 : 1;i < (closed ? unique : unique - 1); i++) {
const a = centers[(i - 1 + unique) % unique], b = centers[i], c = centers[(i + 1) % unique];
const u = b.clone().sub(a), v = c.clone().sub(b);
@@ -17840,17 +18055,17 @@ function recordSweepAnalysis(geometry, rings, profiles, closed) {
const triangles = new Map;
const faces = (index) => {
if (!triangles.has(index))
- triangles.set(index, THREE18.ShapeUtils.triangulateShape(profiles[index], []).map(([a, b, c]) => new THREE18.Triangle(rings[index][a], rings[index][b], rings[index][c])));
+ triangles.set(index, THREE19.ShapeUtils.triangulateShape(profiles[index], []).map(([a, b, c]) => new THREE19.Triangle(rings[index][a], rings[index][b], rings[index][c])));
return triangles.get(index);
};
for (let i = 1;i < rings.length; i++) {
- const boundsA = new THREE18.Box3().setFromPoints(rings[i - 1]);
- const boundsB = new THREE18.Box3().setFromPoints(rings[i]);
+ const boundsA = new THREE19.Box3().setFromPoints(rings[i - 1]);
+ const boundsB = new THREE19.Box3().setFromPoints(rings[i]);
if (!boundsA.intersectsBox(boundsB)) {
result.ringPairsChecked++;
continue;
}
- const epsilon = Math.max(boundsA.getSize(new THREE18.Vector3).length(), boundsB.getSize(new THREE18.Vector3).length()) * 0.0000000001;
+ const epsilon = Math.max(boundsA.getSize(new THREE19.Vector3).length(), boundsB.getSize(new THREE19.Vector3).length()) * 0.0000000001;
let hit = false;
pair:
for (const [a, b] of [
@@ -18005,7 +18220,7 @@ var init_open_shell = __esm(() => {
});
// src/qa/self-intersection.ts
-import * as THREE19 from "three";
+import * as THREE20 from "three";
function boxOverlapRatio2(a, b) {
const shared = Math.max(0, Math.min(a.max.x, b.max.x) - Math.max(a.min.x, b.min.x)) * Math.max(0, Math.min(a.max.y, b.max.y) - Math.max(a.min.y, b.min.y)) * Math.max(0, Math.min(a.max.z, b.max.z) - Math.max(a.min.z, b.min.z));
const ratio = shared / Math.min(boxVolume(a), boxVolume(b));
@@ -18056,8 +18271,8 @@ function collectParts4(root, skipped) {
const box = mesh.geometry.boundingBox.clone().applyMatrix4(mesh.matrixWorld);
if (box.isEmpty())
return;
- const center = box.getCenter(new THREE19.Vector3);
- const size = box.getSize(new THREE19.Vector3);
+ const center = box.getCenter(new THREE20.Vector3);
+ const size = box.getSize(new THREE20.Vector3);
const scale = Math.max(size.x, size.y, size.z);
if (![...box.min, ...box.max, scale].every(Number.isFinite) || !(scale > 0) || !Number.isFinite(mesh.matrixWorld.determinant()) || mesh.matrixWorld.determinant() === 0) {
skipped.push({
@@ -18089,7 +18304,7 @@ function meshToArrays(part) {
matrix.elements[12] -= center.x;
matrix.elements[13] -= center.y;
matrix.elements[14] -= center.z;
- const v = new THREE19.Vector3;
+ const v = new THREE20.Vector3;
const verts = new Float32Array(position.count * 3);
for (let i = 0;i < position.count; i++) {
v.set(position.getX(i), position.getY(i), position.getZ(i)).applyMatrix4(matrix).divideScalar(scale);
@@ -18437,7 +18652,7 @@ var init_self_intersection = __esm(() => {
});
// src/vehicle.ts
-import * as THREE20 from "three";
+import * as THREE21 from "three";
function assertId(value, name) {
if (!ID_PATTERN.test(value))
throw new TypeError(`${name} must be a stable identifier`);
@@ -18472,7 +18687,7 @@ function createTypedSocket(kind, input, parent) {
if (!input.position.every(Number.isFinite))
throw new TypeError(`${kind}.${id} position must be finite`);
const rotation = normalizedQuaternion(input.rotation);
- const node = new THREE20.Object3D;
+ const node = new THREE21.Object3D;
node.name = `Socket_${kind}_${id}`;
node.position.set(...input.position);
node.quaternion.set(...rotation);
@@ -18493,7 +18708,7 @@ function createTypedSocket(kind, input, parent) {
return node;
}
function createVehicleFrame(name, options = {}) {
- const root = new THREE20.Object3D;
+ const root = new THREE21.Object3D;
root.name = name;
stampSemanticMetadataV1(root, semantic2([KILN_SEMANTIC_ROLES.vehicleFrame, KILN_SEMANTIC_ROLES.vehicleForward], {
frames: [
@@ -18518,7 +18733,7 @@ function createVehicleFrame(name, options = {}) {
};
}
function cylinderZ(radius, width, segments = 16) {
- const geometry = new THREE20.CylinderGeometry(radius, radius, width, segments);
+ const geometry = new THREE21.CylinderGeometry(radius, radius, width, segments);
geometry.rotateX(Math.PI / 2);
return geometry;
}
@@ -18535,14 +18750,14 @@ function defaultTireGeometry(radius, width) {
if (width >= radius * 2)
throw new RangeError("default wheel tire width must be less than its diameter");
const tube = width / 2;
- return new THREE20.TorusGeometry(radius - tube, tube, 8, 20);
+ return new THREE21.TorusGeometry(radius - tube, tube, 8, 20);
}
function checkWheelGeometry(part, geometry, radius, width) {
const positions = geometry.getAttribute("position");
if (positions?.itemSize !== 3 || positions.count < 1 || positions.count > 2000000)
throw new RangeError(`wheel ${part} position must have 1..2000000 three-component samples.`);
- const bounds = new THREE20.Box3;
- const point = new THREE20.Vector3;
+ const bounds = new THREE21.Box3;
+ const point = new THREE21.Vector3;
let actualRadius = 0;
for (let i = 0;i < positions.count; i++) {
point.fromBufferAttribute(positions, i);
@@ -18552,7 +18767,7 @@ function checkWheelGeometry(part, geometry, radius, width) {
actualRadius = Math.max(actualRadius, Math.hypot(point.x, point.y));
}
const actualWidth = bounds.max.z - bounds.min.z;
- const center = bounds.getCenter(new THREE20.Vector3);
+ const center = bounds.getCenter(new THREE21.Vector3);
const tolerance = 0.00001 * Math.max(radius, width, actualRadius, actualWidth);
const differences = [];
if (Math.abs(actualRadius - radius) > tolerance)
@@ -18597,11 +18812,11 @@ function createWheelAssembly(name, materials, options) {
const index = assertId(String(options.index), "wheel index");
const key = `${options.side}.${index}`;
const parent = options.parent;
- const root = new THREE20.Object3D;
+ const root = new THREE21.Object3D;
root.name = `${name}_Assembly_${options.side}_${index}`;
let steeringPivot;
if (options.steering) {
- steeringPivot = new THREE20.Object3D;
+ steeringPivot = new THREE21.Object3D;
steeringPivot.name = `SteeringPivot_${options.side}_${index}`;
steeringPivot.position.set(...options.position ?? [0, 0, 0]);
stampSemanticMetadataV1(steeringPivot, semantic2([semanticRole(ROLE.steeringPivot, key)], {
@@ -18612,7 +18827,7 @@ function createWheelAssembly(name, materials, options) {
}));
root.add(steeringPivot);
}
- const spinPivot = new THREE20.Object3D;
+ const spinPivot = new THREE21.Object3D;
spinPivot.name = `WheelPivot_${options.side}_${index}`;
if (!steeringPivot)
spinPivot.position.set(...options.position ?? [0, 0, 0]);
@@ -18633,9 +18848,9 @@ function createWheelAssembly(name, materials, options) {
]
}));
(steeringPivot ?? root).add(spinPivot);
- const tire = new THREE20.Mesh(options.geometries?.tire ?? defaultTireGeometry(radius, width), materials.tire);
- const rim = new THREE20.Mesh(options.geometries?.rim ?? cylinderZ(rimRadius, rimWidth), materials.rim);
- const hub = new THREE20.Mesh(options.geometries?.hub ?? cylinderZ(hubRadius, hubWidth), materials.hub ?? materials.rim);
+ const tire = new THREE21.Mesh(options.geometries?.tire ?? defaultTireGeometry(radius, width), materials.tire);
+ const rim = new THREE21.Mesh(options.geometries?.rim ?? cylinderZ(rimRadius, rimWidth), materials.rim);
+ const hub = new THREE21.Mesh(options.geometries?.hub ?? cylinderZ(hubRadius, hubWidth), materials.hub ?? materials.rim);
tire.name = `Tire_${options.side}_${index}`;
rim.name = `Rim_${options.side}_${index}`;
hub.name = `Hub_${options.side}_${index}`;
@@ -18655,7 +18870,7 @@ function createWheelAssembly(name, materials, options) {
]
}));
spinPivot.add(tire, rim, hub);
- const contact = new THREE20.Object3D;
+ const contact = new THREE21.Object3D;
contact.name = `Contact_${options.side}_${index}`;
contact.position.y = -radius;
stampSemanticMetadataV1(contact, semantic2([semanticRole(ROLE.wheelContact, key), semanticRole(ROLE.contact, key)], {
@@ -18713,10 +18928,10 @@ function objectBoundsInFrame(object, frame) {
object.updateWorldMatrix(true, true);
frame.updateWorldMatrix(true, false);
const worldToFrame = frame.matrixWorld.clone().invert();
- const bounds = new THREE20.Box3;
+ const bounds = new THREE21.Box3;
let found = false;
object.traverse((node) => {
- if (!(node instanceof THREE20.Mesh) || !(node.geometry instanceof THREE20.BufferGeometry))
+ if (!(node instanceof THREE21.Mesh) || !(node.geometry instanceof THREE21.BufferGeometry))
return;
node.geometry.computeBoundingBox();
const local = node.geometry.boundingBox;
@@ -18726,7 +18941,7 @@ function objectBoundsInFrame(object, frame) {
for (const x of [local.min.x, local.max.x])
for (const y of [local.min.y, local.max.y])
for (const z of [local.min.z, local.max.z]) {
- bounds.expandByPoint(new THREE20.Vector3(x, y, z).applyMatrix4(matrix));
+ bounds.expandByPoint(new THREE21.Vector3(x, y, z).applyMatrix4(matrix));
found = true;
}
});
@@ -18738,9 +18953,9 @@ function dimensions(object, frame) {
const bounds = objectBoundsInFrame(object, frame);
if (!bounds)
return;
- const size = bounds.getSize(new THREE20.Vector3);
+ const size = bounds.getSize(new THREE21.Vector3);
return {
- center: bounds.getCenter(new THREE20.Vector3),
+ center: bounds.getCenter(new THREE21.Vector3),
radius: Math.max(size.x, size.y) / 2,
width: size.z
};
@@ -18750,7 +18965,7 @@ function resolved(source, id, root, pivot, parts) {
const tire = dimensions(parts.tire, pivot);
const rim = dimensions(parts.rim, pivot);
const hub = dimensions(parts.hub, pivot);
- const centerLocal = tire?.center ?? rim?.center ?? hub?.center ?? new THREE20.Vector3;
+ const centerLocal = tire?.center ?? rim?.center ?? hub?.center ?? new THREE21.Vector3;
const toWorld = (value) => value.clone().applyMatrix4(pivot.matrixWorld);
return {
id,
@@ -18765,11 +18980,11 @@ function resolved(source, id, root, pivot, parts) {
...parts.hub ? { hub: parts.hub } : {},
...parts.contact ? { contact: parts.contact } : {},
centerWorld: toWorld(centerLocal),
- pivotCenterWorld: new THREE20.Vector3().setFromMatrixPosition(pivot.matrixWorld),
+ pivotCenterWorld: new THREE21.Vector3().setFromMatrixPosition(pivot.matrixWorld),
...tire ? { tireCenterWorld: toWorld(tire.center) } : {},
...rim ? { rimCenterWorld: toWorld(rim.center) } : {},
...hub ? { hubCenterWorld: toWorld(hub.center) } : {},
- spinAxisWorld: new THREE20.Vector3(0, 0, 1).transformDirection(pivot.matrixWorld),
+ spinAxisWorld: new THREE21.Vector3(0, 0, 1).transformDirection(pivot.matrixWorld),
...tire ? { radius: tire.radius, width: tire.width } : {},
...rim ? { rimRadius: rim.radius, rimWidth: rim.width } : {},
...hub ? { hubRadius: hub.radius, hubWidth: hub.width } : {},
@@ -19106,7 +19321,7 @@ var EPSILON = 0.0000000001, DEFAULT_TOLERANCE = 0.000001, finiteVector = (value)
];
// src/qa/vehicle-advisory.ts
-import * as THREE21 from "three";
+import * as THREE22 from "three";
function advisory(context, value) {
return {
...value,
@@ -19180,7 +19395,7 @@ function isFender(node) {
return semanticRoles(node).some((role) => /(?:^|\.)(?:fender|wheel-arch)(?:\.|$)/i.test(role)) || /fender|wheel[ _.-]?arch/i.test(node.name);
}
function isChassisMesh(node) {
- if (!(node instanceof THREE21.Mesh) || isFender(node))
+ if (!(node instanceof THREE22.Mesh) || isFender(node))
return false;
return semanticRoles(node).some((role) => /^(?:vehicle\.)?(?:chassis|body|hull)(?:\.|$)/i.test(role)) || /chassis|vehicle[ _.-]?body|fuselage|hull/i.test(node.name);
}
@@ -19188,10 +19403,10 @@ function objectBoundsInFrame2(object, frame) {
object.updateWorldMatrix(true, true);
frame.updateWorldMatrix(true, false);
const worldToFrame = frame.matrixWorld.clone().invert();
- const bounds = new THREE21.Box3;
+ const bounds = new THREE22.Box3;
let found = false;
object.traverseVisible((part) => {
- if (!(part instanceof THREE21.Mesh) || !(part.geometry instanceof THREE21.BufferGeometry))
+ if (!(part instanceof THREE22.Mesh) || !(part.geometry instanceof THREE22.BufferGeometry))
return;
part.geometry.computeBoundingBox();
const box = part.geometry.boundingBox;
@@ -19201,7 +19416,7 @@ function objectBoundsInFrame2(object, frame) {
for (const x of [box.min.x, box.max.x])
for (const y of [box.min.y, box.max.y])
for (const z of [box.min.z, box.max.z]) {
- bounds.expandByPoint(new THREE21.Vector3(x, y, z).applyMatrix4(matrix));
+ bounds.expandByPoint(new THREE22.Vector3(x, y, z).applyMatrix4(matrix));
found = true;
}
});
@@ -19212,15 +19427,15 @@ function tuple5(value) {
}
function probeBox(id, root, bounds) {
root.updateWorldMatrix(true, false);
- const center = bounds.getCenter(new THREE21.Vector3).applyMatrix4(root.matrixWorld);
- const size = bounds.getSize(new THREE21.Vector3);
- const position = new THREE21.Vector3;
- const quaternion = new THREE21.Quaternion;
- const scale = new THREE21.Vector3;
+ const center = bounds.getCenter(new THREE22.Vector3).applyMatrix4(root.matrixWorld);
+ const size = bounds.getSize(new THREE22.Vector3);
+ const position = new THREE22.Vector3;
+ const quaternion = new THREE22.Quaternion;
+ const scale = new THREE22.Vector3;
root.matrixWorld.decompose(position, quaternion, scale);
- const xAxis = new THREE21.Vector3(1, 0, 0).applyQuaternion(quaternion).normalize();
- const yAxis = new THREE21.Vector3(0, 1, 0).applyQuaternion(quaternion).normalize();
- const zAxis = new THREE21.Vector3(0, 0, 1).applyQuaternion(quaternion).normalize();
+ const xAxis = new THREE22.Vector3(1, 0, 0).applyQuaternion(quaternion).normalize();
+ const yAxis = new THREE22.Vector3(0, 1, 0).applyQuaternion(quaternion).normalize();
+ const zAxis = new THREE22.Vector3(0, 0, 1).applyQuaternion(quaternion).normalize();
return createOrientedProbeBox3({
id,
frame: createProbeLocalFrame3({
@@ -19289,7 +19504,7 @@ function orientationFindings(context, root, intent) {
const bounds = wholeAssetBounds(root);
if (!bounds)
return [];
- const size = bounds.getSize(new THREE21.Vector3);
+ const size = bounds.getSize(new THREE22.Vector3);
const ratio = size.z / Math.max(size.x, 0.000000001);
if (ratio <= ORIENTATION_RATIO)
return [];
@@ -19333,13 +19548,13 @@ function weldedBoundaryEdges(root, loop) {
let triangleCount = 0;
const vertexKey = (point) => [point.x, point.y, point.z].map((value) => Math.round(value * 1e6)).join(",");
loop.traverseVisible((node) => {
- if (!(node instanceof THREE21.Mesh) || !(node.geometry instanceof THREE21.BufferGeometry))
+ if (!(node instanceof THREE22.Mesh) || !(node.geometry instanceof THREE22.BufferGeometry))
return;
const positions = node.geometry.getAttribute("position");
if (!positions)
return;
const matrix = inverse.clone().multiply(node.matrixWorld);
- const keys = Array.from({ length: positions.count }, (_, index) => vertexKey(new THREE21.Vector3().fromBufferAttribute(positions, index).applyMatrix4(matrix)));
+ const keys = Array.from({ length: positions.count }, (_, index) => vertexKey(new THREE22.Vector3().fromBufferAttribute(positions, index).applyMatrix4(matrix)));
const index = node.geometry.getIndex();
const indices = index ? Array.from(index.array, Number) : Array.from({ length: positions.count }, (_, value) => value);
for (let offset = 0;offset + 2 < indices.length; offset += 3) {
@@ -19409,7 +19624,7 @@ function trackProfileFindings(context, root, intent) {
const wheelBounds = objectBoundsInFrame2(roadWheel, root);
if (!wheelBounds)
continue;
- const center = wheelBounds.getCenter(new THREE21.Vector3);
+ const center = wheelBounds.getCenter(new THREE22.Vector3);
if (expanded.containsPoint(center))
continue;
const clamped = center.clone().clamp(expanded.min, expanded.max);
@@ -19435,7 +19650,7 @@ function trackProfileFindings(context, root, intent) {
return findings;
}
function inspectMobilityAdvisory(context) {
- if (!(context.scene instanceof THREE21.Object3D)) {
+ if (!(context.scene instanceof THREE22.Object3D)) {
return [];
}
const intent = context.mobility;
@@ -19482,7 +19697,7 @@ var init_vehicle_advisory = __esm(() => {
});
// src/qa/vehicle.ts
-import * as THREE22 from "three";
+import * as THREE23 from "three";
function finding3(context, value) {
return {
...value,
@@ -19499,7 +19714,7 @@ function rootAxis(root, axis) {
return axis.clone().transformDirection(root.matrixWorld);
}
function angleDegrees(a, b) {
- return THREE22.MathUtils.radToDeg(Math.acos(THREE22.MathUtils.clamp(a.clone().normalize().dot(b.clone().normalize()), -1, 1)));
+ return THREE23.MathUtils.radToDeg(Math.acos(THREE23.MathUtils.clamp(a.clone().normalize().dot(b.clone().normalize()), -1, 1)));
}
function isDescendant(node, ancestor) {
let current = node;
@@ -19547,7 +19762,7 @@ function wheelCountFindings(context, intent, wheels) {
}
function wheelGeometryFindings(context, root, wheels) {
const findings = [];
- const expectedAxle = rootAxis(root, new THREE22.Vector3(0, 0, 1));
+ const expectedAxle = rootAxis(root, new THREE23.Vector3(0, 0, 1));
for (const wheel of wheels) {
const disposition = componentDisposition(wheel);
const centerTolerance = Math.max(CENTER_MINIMUM, (wheel.radius ?? 0) * CENTER_RATIO);
@@ -19736,7 +19951,7 @@ function contactFindings(context, root, intent, wheels) {
function renderableMinYInRoot(rootInverse, node) {
let minimum = Infinity;
node.traverseVisible((part) => {
- if (!(part instanceof THREE22.Mesh) || !(part.geometry instanceof THREE22.BufferGeometry))
+ if (!(part instanceof THREE23.Mesh) || !(part.geometry instanceof THREE23.BufferGeometry))
return;
part.geometry.computeBoundingBox();
const bounds = part.geometry.boundingBox;
@@ -19746,7 +19961,7 @@ function renderableMinYInRoot(rootInverse, node) {
for (const x of [bounds.min.x, bounds.max.x]) {
for (const y of [bounds.min.y, bounds.max.y]) {
for (const z of [bounds.min.z, bounds.max.z]) {
- minimum = Math.min(minimum, new THREE22.Vector3(x, y, z).applyMatrix4(matrix).y);
+ minimum = Math.min(minimum, new THREE23.Vector3(x, y, z).applyMatrix4(matrix).y);
}
}
}
@@ -19764,7 +19979,7 @@ function supportContactFindings(context, root, intent) {
if (!isWheelContact && roles.some((role) => role.startsWith("contact."))) {
explicitContacts.push({
node,
- contactY: localPoint2(inverse, new THREE22.Vector3().setFromMatrixPosition(node.matrixWorld)).y,
+ contactY: localPoint2(inverse, new THREE23.Vector3().setFromMatrixPosition(node.matrixWorld)).y,
source: "contact"
});
}
@@ -19844,7 +20059,7 @@ function steeringFindings(context, root, intent, wheels) {
return [];
root.updateWorldMatrix(true, false);
const inverse = root.matrixWorld.clone().invert();
- const expectedAxis = rootAxis(root, new THREE22.Vector3(0, 1, 0));
+ const expectedAxis = rootAxis(root, new THREE23.Vector3(0, 1, 0));
const localCenters = wheels.map((wheel) => ({
wheel,
center: localPoint2(inverse, wheel.centerWorld)
@@ -19854,8 +20069,8 @@ function steeringFindings(context, root, intent, wheels) {
const findings = [];
for (const { wheel } of targets) {
const steering = wheel.steeringPivot;
- const centerDelta = steering ? localPoint2(inverse, new THREE22.Vector3().setFromMatrixPosition(steering.matrixWorld)).distanceTo(localPoint2(inverse, wheel.centerWorld)) : Infinity;
- const axisAngle = steering ? angleDegrees(new THREE22.Vector3(0, 1, 0).transformDirection(steering.matrixWorld), expectedAxis) : Infinity;
+ const centerDelta = steering ? localPoint2(inverse, new THREE23.Vector3().setFromMatrixPosition(steering.matrixWorld)).distanceTo(localPoint2(inverse, wheel.centerWorld)) : Infinity;
+ const axisAngle = steering ? angleDegrees(new THREE23.Vector3(0, 1, 0).transformDirection(steering.matrixWorld), expectedAxis) : Infinity;
if (!steering || !isDescendant(wheel.pivot, steering) || centerDelta > CENTER_MINIMUM || axisAngle > AXIS_TOLERANCE_DEGREES) {
const axisInvalid = axisAngle > AXIS_TOLERANCE_DEGREES;
findings.push(finding3(context, {
@@ -19910,14 +20125,14 @@ function propulsionFindings(context, root, intent) {
}
for (const component of candidates) {
const pivot = pivots.get(component.id);
- const box = new THREE22.Box3().setFromObject(component.node);
- const center = box.isEmpty() ? undefined : box.getCenter(new THREE22.Vector3);
- const pivotCenter = pivot ? new THREE22.Vector3().setFromMatrixPosition(pivot.matrixWorld) : undefined;
+ const box = new THREE23.Box3().setFromObject(component.node);
+ const center = box.isEmpty() ? undefined : box.getCenter(new THREE23.Vector3);
+ const pivotCenter = pivot ? new THREE23.Vector3().setFromMatrixPosition(pivot.matrixWorld) : undefined;
const delta = center && pivotCenter ? localPoint2(rootInverse, center).distanceTo(localPoint2(rootInverse, pivotCenter)) : Infinity;
const frameId = kind === "rotor" ? "propulsion-axis.+y" : "propulsion-axis.+x";
const axisFrame = readSemanticMetadataV1(pivot ?? component.node)?.frames.find((frame) => frame.id === frameId);
- const canonicalAxis = kind === "rotor" ? new THREE22.Vector3(0, 1, 0) : new THREE22.Vector3(1, 0, 0);
- const axisAngle = pivot && axisFrame ? angleDegrees(canonicalAxis.clone().applyQuaternion(new THREE22.Quaternion(...axisFrame.rotation)).transformDirection(pivot.matrixWorld), rootAxis(root, canonicalAxis)) : Infinity;
+ const canonicalAxis = kind === "rotor" ? new THREE23.Vector3(0, 1, 0) : new THREE23.Vector3(1, 0, 0);
+ const axisAngle = pivot && axisFrame ? angleDegrees(canonicalAxis.clone().applyQuaternion(new THREE23.Quaternion(...axisFrame.rotation)).transformDirection(pivot.matrixWorld), rootAxis(root, canonicalAxis)) : Infinity;
if (!pivot || !isDescendant(component.node, pivot) || delta > CENTER_MINIMUM || !axisFrame || axisAngle > AXIS_TOLERANCE_DEGREES) {
findings.push(finding3(context, {
code: "VEH_ROTOR_PIVOT",
@@ -19939,7 +20154,7 @@ function propulsionFindings(context, root, intent) {
return findings;
}
function inspectMobility(context) {
- if (!(context.scene instanceof THREE22.Object3D))
+ if (!(context.scene instanceof THREE23.Object3D))
return [];
const intent = context.mobility;
if (!intent)
@@ -20012,7 +20227,7 @@ var init_vehicle2 = __esm(() => {
});
// src/qa/vegetation.ts
-import * as THREE23 from "three";
+import * as THREE24 from "three";
function rolesOf2(node) {
return readSemanticMetadataV1(node)?.roles ?? [];
}
@@ -20028,22 +20243,22 @@ function pathOf(node, root) {
return names.reverse().join("/");
}
function localPoint3(rootInverse, node) {
- return node.getWorldPosition(new THREE23.Vector3).applyMatrix4(rootInverse);
+ return node.getWorldPosition(new THREE24.Vector3).applyMatrix4(rootInverse);
}
function meshLocalBox(mesh, rootInverse) {
- if (!(mesh.geometry instanceof THREE23.BufferGeometry))
+ if (!(mesh.geometry instanceof THREE24.BufferGeometry))
return;
mesh.geometry.computeBoundingBox();
const source = mesh.geometry.boundingBox;
if (!source || source.isEmpty())
return;
const base = rootInverse.clone().multiply(mesh.matrixWorld);
- const result = new THREE23.Box3;
- const count = mesh instanceof THREE23.InstancedMesh ? mesh.count : 1;
+ const result = new THREE24.Box3;
+ const count = mesh instanceof THREE24.InstancedMesh ? mesh.count : 1;
for (let index = 0;index < count; index++) {
const transform = base.clone();
- if (mesh instanceof THREE23.InstancedMesh) {
- const instance = new THREE23.Matrix4;
+ if (mesh instanceof THREE24.InstancedMesh) {
+ const instance = new THREE24.Matrix4;
mesh.getMatrixAt(index, instance);
transform.multiply(instance);
}
@@ -20056,7 +20271,7 @@ function collectRenderableBounds(root) {
const inverse = root.matrixWorld.clone().invert();
const values = [];
root.traverseVisible((node) => {
- if (!(node instanceof THREE23.Mesh))
+ if (!(node instanceof THREE24.Mesh))
return;
const box = meshLocalBox(node, inverse);
if (!box)
@@ -20074,7 +20289,7 @@ function vegetationIntent(intent) {
}
function inspectFoliageContact(context) {
const trusted = context.foliage;
- if (!trusted?.grounded || !(context.scene instanceof THREE23.Object3D))
+ if (!trusted?.grounded || !(context.scene instanceof THREE24.Object3D))
return [];
const planeY = context.groundPlaneY ?? 0;
const root = context.scene;
@@ -20112,7 +20327,7 @@ function inspectFoliageContact(context) {
}
const findings = [];
for (const contact of contacts) {
- const contactPoint = contact.frameTranslation ? new THREE23.Vector3(...contact.frameTranslation).applyMatrix4(contact.node.matrixWorld).applyMatrix4(inverse) : localPoint3(inverse, contact.node);
+ const contactPoint = contact.frameTranslation ? new THREE24.Vector3(...contact.frameTranslation).applyMatrix4(contact.node.matrixWorld).applyMatrix4(inverse) : localPoint3(inverse, contact.node);
const y = contactPoint.y;
const offset = y - planeY;
if (Math.abs(offset) <= VEGETATION_CONTACT_TOLERANCE_METERS)
@@ -20141,7 +20356,7 @@ function inspectFoliageContact(context) {
for (const support of semanticSupports) {
let minimumY = Infinity;
support.traverseVisible((node) => {
- if (!(node instanceof THREE23.Mesh))
+ if (!(node instanceof THREE24.Mesh))
return;
const box = meshLocalBox(node, inverse);
if (box)
@@ -20169,25 +20384,25 @@ function inspectFoliageContact(context) {
return findings;
}
function materialNames(node) {
- if (!(node instanceof THREE23.Mesh))
+ if (!(node instanceof THREE24.Mesh))
return [];
const materials = Array.isArray(node.material) ? node.material : [node.material];
return materials.filter(Boolean).map((material) => material.name ?? "");
}
function inspectFoliageScope(context) {
const trusted = context.foliage;
- if (!trusted?.standalone || !(context.scene instanceof THREE23.Object3D))
+ if (!trusted?.standalone || !(context.scene instanceof THREE24.Object3D))
return [];
const root = context.scene;
const renderables = collectRenderableBounds(root);
if (renderables.length === 0)
return [];
- const overall = renderables.reduce((box, value) => box.union(value.box), new THREE23.Box3);
- const overallSize = overall.getSize(new THREE23.Vector3);
+ const overall = renderables.reduce((box, value) => box.union(value.box), new THREE24.Box3);
+ const overallSize = overall.getSize(new THREE24.Vector3);
const findings = [];
for (const value of renderables) {
- const size = value.box.getSize(new THREE23.Vector3);
- const center = value.box.getCenter(new THREE23.Vector3);
+ const size = value.box.getSize(new THREE24.Vector3);
+ const center = value.box.getCenter(new THREE24.Vector3);
const names = [value.node.name, ...value.roles];
const nameEvidence = names.some((name) => CLUTTER_NAME.test(name));
const roleEvidence = value.roles.some((role) => /(?:terrain|soil|rock|pot|planter|base)/i.test(role));
@@ -20224,8 +20439,8 @@ function inspectFoliageScope(context) {
function unionVolume(boxes) {
if (boxes.length === 0)
return 0;
- const union = boxes.reduce((result, box) => result.union(box), new THREE23.Box3);
- const size = union.getSize(new THREE23.Vector3);
+ const union = boxes.reduce((result, box) => result.union(box), new THREE24.Box3);
+ const size = union.getSize(new THREE24.Vector3);
return size.x * size.y * size.z;
}
function projectedOccupancy(boxes, axes) {
@@ -20295,7 +20510,7 @@ function boxDistanceToPoint(box, point) {
function endpointRadius(position, axis, axisValue, tolerance, scale) {
const radialAxes = [0, 1, 2].filter((value) => value !== axis);
const points = [];
- const point = new THREE23.Vector3;
+ const point = new THREE24.Vector3;
for (let index = 0;index < position.count; index++) {
point.fromBufferAttribute(position, index);
if (Math.abs(point.getComponent(axis) - axisValue) <= tolerance)
@@ -20303,7 +20518,7 @@ function endpointRadius(position, axis, axisValue, tolerance, scale) {
}
if (points.length === 0)
return;
- const center = new THREE23.Vector3;
+ const center = new THREE24.Vector3;
center.setComponent(axis, axisValue);
for (const radialAxis of radialAxes) {
center.setComponent(radialAxis, points.reduce((sum, value) => sum + value.getComponent(radialAxis), 0) / points.length);
@@ -20317,7 +20532,7 @@ function endpointRadius(position, axis, axisValue, tolerance, scale) {
return { center, radius };
}
function growthNodeMeasurement(root, candidate, allCandidates, band) {
- if (!(candidate.node instanceof THREE23.Mesh))
+ if (!(candidate.node instanceof THREE24.Mesh))
return;
const geometry = candidate.node.geometry;
const position = geometry.getAttribute("position");
@@ -20329,9 +20544,9 @@ function growthNodeMeasurement(root, candidate, allCandidates, band) {
return;
root.updateWorldMatrix(true, true);
const relative = root.matrixWorld.clone().invert().multiply(candidate.node.matrixWorld);
- const relativeScale = new THREE23.Vector3;
- relative.decompose(new THREE23.Vector3, new THREE23.Quaternion, relativeScale);
- const size = geometryBox.getSize(new THREE23.Vector3);
+ const relativeScale = new THREE24.Vector3;
+ relative.decompose(new THREE24.Vector3, new THREE24.Quaternion, relativeScale);
+ const size = geometryBox.getSize(new THREE24.Vector3);
const scaledSizes = [
Math.abs(size.x * relativeScale.x),
Math.abs(size.y * relativeScale.y),
@@ -20398,7 +20613,7 @@ function measureFoliageGrowth(foliage, root) {
};
}
function inspectFoliageGrowth(context) {
- if (!context.foliage || !(context.scene instanceof THREE23.Object3D))
+ if (!context.foliage || !(context.scene instanceof THREE24.Object3D))
return [];
const measured = measureFoliageGrowth(context.foliage, context.scene);
const findings = [];
@@ -20449,7 +20664,7 @@ function measureVegetationFoliageAttachment(root) {
const support = renderables.filter((value) => roleOrNameSource(value, TRUNK_PATTERNS) || roleOrNameSource(value, BRANCH_PATTERNS));
const foliage = renderables.filter((value) => roleOrNameSource(value, CANOPY_PATTERNS));
const clusters = foliage.map((value) => {
- const size = value.box.getSize(new THREE23.Vector3);
+ const size = value.box.getSize(new THREE24.Vector3);
const threshold = stable7(Math.max(0.03, Math.min(0.18, size.length() * 0.12)));
const nearest = support.map((candidate) => ({ candidate, gap: distanceBetweenBoxes(value.box, candidate.box) })).sort((a, b) => a.gap - b.gap || (a.candidate.node.name || "").localeCompare(b.candidate.node.name || ""))[0];
const source = roleOrNameSource(value, CANOPY_PATTERNS) ?? "fallback";
@@ -20472,7 +20687,7 @@ function measureVegetationFoliageAttachment(root) {
};
}
function inspectFoliageAttachment(context) {
- if (!context.foliage || !(context.scene instanceof THREE23.Object3D))
+ if (!context.foliage || !(context.scene instanceof THREE24.Object3D))
return [];
return measureVegetationFoliageAttachment(context.scene).clusters.filter((cluster) => cluster.detached).map((cluster) => finding4(context, {
code: "VEG_FOLIAGE_DETACHED",
@@ -20492,9 +20707,9 @@ function inspectFoliageAttachment(context) {
}
function relativeTransformSignature(root, node) {
const matrix = root.matrixWorld.clone().invert().multiply(node.matrixWorld);
- const scale = new THREE23.Vector3;
- const quaternion = new THREE23.Quaternion;
- matrix.decompose(new THREE23.Vector3, quaternion, scale);
+ const scale = new THREE24.Vector3;
+ const quaternion = new THREE24.Quaternion;
+ matrix.decompose(new THREE24.Vector3, quaternion, scale);
if (quaternion.w < 0)
quaternion.set(-quaternion.x, -quaternion.y, -quaternion.z, -quaternion.w);
const values = [...scale.toArray(), ...quaternion.toArray()].map((value) => stable7(value));
@@ -20515,9 +20730,9 @@ function measureFoliageRepetition(requirements, root) {
nodes: values.map((value) => value.node.name || "foliage-cluster").sort()
})).sort((a, b) => a.signature.localeCompare(b.signature));
const supports = collectRenderableBounds(root).filter((value) => roleOrNameSource(value, TRUNK_PATTERNS));
- const centerBox = supports.reduce((box, value) => box.union(value.box), new THREE23.Box3);
- const centers = foliage.map((value) => value.box.getCenter(new THREE23.Vector3));
- const center = centerBox.isEmpty() ? centers.reduce((result, value) => result.add(value), new THREE23.Vector3).multiplyScalar(centers.length > 0 ? 1 / centers.length : 0) : centerBox.getCenter(new THREE23.Vector3);
+ const centerBox = supports.reduce((box, value) => box.union(value.box), new THREE24.Box3);
+ const centers = foliage.map((value) => value.box.getCenter(new THREE24.Vector3));
+ const center = centerBox.isEmpty() ? centers.reduce((result, value) => result.add(value), new THREE24.Vector3).multiplyScalar(centers.length > 0 ? 1 / centers.length : 0) : centerBox.getCenter(new THREE24.Vector3);
const radial = centers.map((value) => ({
angle: Math.atan2(value.z - center.z, value.x - center.x),
radius: Math.hypot(value.x - center.x, value.z - center.z)
@@ -20552,7 +20767,7 @@ function measureFoliageRepetition(requirements, root) {
};
}
function inspectFoliageRepetition(context) {
- if (!context.foliage || !(context.scene instanceof THREE23.Object3D))
+ if (!context.foliage || !(context.scene instanceof THREE24.Object3D))
return [];
const measured = measureFoliageRepetition(context.foliage, context.scene);
if (measured.suppressedForTopiary)
@@ -20610,7 +20825,7 @@ function measureFoliageCanopy(profile, root) {
}
function inspectFoliageCanopy(context) {
const trusted = context.foliage;
- if (!trusted?.canopyProfile || !(context.scene instanceof THREE23.Object3D))
+ if (!trusted?.canopyProfile || !(context.scene instanceof THREE24.Object3D))
return [];
const measurements = measureFoliageCanopy(trusted.canopyProfile, context.scene);
const bands = PROFILE_BANDS[measurements.profile];
@@ -20671,7 +20886,7 @@ function inspectFoliageCanopy(context) {
return findings;
}
function materialValue(material) {
- if (!(material instanceof THREE23.MeshStandardMaterial) && !(material instanceof THREE23.MeshBasicMaterial)) {
+ if (!(material instanceof THREE24.MeshStandardMaterial) && !(material instanceof THREE24.MeshBasicMaterial)) {
return;
}
const color = material.color;
@@ -20681,11 +20896,11 @@ function measureFoliageMaterials(mode, root) {
const values = [];
let foliageNodeCount = 0;
root.traverseVisible((node) => {
- if (!(node instanceof THREE23.Mesh))
+ if (!(node instanceof THREE24.Mesh))
return;
const bounds = {
node,
- box: new THREE23.Box3,
+ box: new THREE24.Box3,
roles: rolesOf2(node),
source: rolesOf2(node).length > 0 ? "semantic" : "fallback"
};
@@ -20712,7 +20927,7 @@ function measureFoliageMaterials(mode, root) {
};
}
function inspectFoliageMaterial(context) {
- if (!context.foliage || !(context.scene instanceof THREE23.Object3D))
+ if (!context.foliage || !(context.scene instanceof THREE24.Object3D))
return [];
if (!context.materialMode)
return [];
@@ -20914,7 +21129,7 @@ var init_character_repairs = __esm(() => {
});
// src/qa/character.ts
-import * as THREE24 from "three";
+import * as THREE25 from "three";
function isClipLike(value) {
if (typeof value !== "object" || value === null)
return false;
@@ -21152,7 +21367,7 @@ function contactFindings2(input, root) {
const planeY = input.groundPlaneY ?? 0;
const findings = [];
for (const contact of contacts) {
- const point = contact.node.getWorldPosition(new THREE24.Vector3).applyMatrix4(rootInverse);
+ const point = contact.node.getWorldPosition(new THREE25.Vector3).applyMatrix4(rootInverse);
const offset = point.y - planeY;
if (offset > tolerance) {
findings.push(block(input, "CHAR_CONTACT_FLOATING", `Ground contact ${contact.descriptor.role} is ${offset.toFixed(6)} m above asset-local ground.`, {
@@ -21417,13 +21632,13 @@ function declaredHeldItem(nodes) {
function characterJointScale(root) {
root.updateMatrixWorld(true);
const inverse = root.matrixWorld.clone().invert();
- const bounds = new THREE24.Box3;
+ const bounds = new THREE25.Box3;
for (const joint of collectCharacterJointNodes(root)) {
- bounds.expandByPoint(joint.node.getWorldPosition(new THREE24.Vector3).applyMatrix4(inverse));
+ bounds.expandByPoint(joint.node.getWorldPosition(new THREE25.Vector3).applyMatrix4(inverse));
}
if (bounds.isEmpty())
return 1;
- const size = bounds.getSize(new THREE24.Vector3);
+ const size = bounds.getSize(new THREE25.Vector3);
return Math.max(size.x, size.y, size.z, 1);
}
function heldItemMotionFindings(input, root, clips) {
@@ -21459,8 +21674,8 @@ function heldItemMotionFindings(input, root, clips) {
if (!cloneItem || !cloneAttachment)
continue;
const inverse = clone.matrixWorld.clone().invert();
- const itemPoint = cloneItem.getWorldPosition(new THREE24.Vector3).applyMatrix4(inverse);
- const gripPoint = cloneAttachment.getWorldPosition(new THREE24.Vector3).applyMatrix4(inverse);
+ const itemPoint = cloneItem.getWorldPosition(new THREE25.Vector3).applyMatrix4(inverse);
+ const gripPoint = cloneAttachment.getWorldPosition(new THREE25.Vector3).applyMatrix4(inverse);
const distance = itemPoint.distanceTo(gripPoint);
baseline ??= distance;
const drift = Math.abs(distance - baseline);
@@ -21493,7 +21708,7 @@ function heldItemMotionFindings(input, root, clips) {
function inspectRig(context) {
if (!context.rig)
return [];
- const root = context.scene instanceof THREE24.Object3D ? context.scene : undefined;
+ const root = context.scene instanceof THREE25.Object3D ? context.scene : undefined;
const clips = (context.clips ?? []).filter(isClipLike);
const findings = [];
if (root) {
@@ -21543,7 +21758,7 @@ var init_character2 = __esm(() => {
});
// src/qa/character-advisory.ts
-import * as THREE25 from "three";
+import * as THREE26 from "three";
function isClipLike2(value) {
if (typeof value !== "object" || value === null)
return false;
@@ -21566,16 +21781,16 @@ function jointPoints(root) {
const inverse = rootInverse(root);
return collectCharacterJointNodes(root).map((evidence) => ({
evidence,
- local: evidence.node.getWorldPosition(new THREE25.Vector3).applyMatrix4(inverse)
+ local: evidence.node.getWorldPosition(new THREE26.Vector3).applyMatrix4(inverse)
}));
}
function characterScale(points) {
if (points.length === 0)
return 1;
- const bounds = new THREE25.Box3;
+ const bounds = new THREE26.Box3;
for (const point of points)
bounds.expandByPoint(point.local);
- const size = bounds.getSize(new THREE25.Vector3);
+ const size = bounds.getSize(new THREE26.Vector3);
return Math.max(size.x, size.y, size.z, 1);
}
function pairKey(descriptor) {
@@ -21674,12 +21889,12 @@ function restChainFindings(context, root) {
}
function forwardMarkerFindings(context, root) {
root.updateMatrixWorld(true);
- const expected = new THREE25.Vector3(1, 0, 0).transformDirection(root.matrixWorld);
+ const expected = new THREE26.Vector3(1, 0, 0).transformDirection(root.matrixWorld);
const markers = collectCharacterJointNodes(root).filter((joint) => /(?:^|[._-])(?:toe|muzzle|head)(?:$|[._-])/i.test(joint.descriptor.role));
return markers.flatMap((marker) => {
- const quaternion = marker.node.getWorldQuaternion(new THREE25.Quaternion);
- const actual = new THREE25.Vector3(...marker.descriptor.localForwardAxis).applyQuaternion(quaternion).normalize();
- const angle = THREE25.MathUtils.radToDeg(Math.acos(THREE25.MathUtils.clamp(actual.dot(expected), -1, 1)));
+ const quaternion = marker.node.getWorldQuaternion(new THREE26.Quaternion);
+ const actual = new THREE26.Vector3(...marker.descriptor.localForwardAxis).applyQuaternion(quaternion).normalize();
+ const angle = THREE26.MathUtils.radToDeg(Math.acos(THREE26.MathUtils.clamp(actual.dot(expected), -1, 1)));
if (angle <= FORWARD_ANGLE_DEGREES)
return [];
return [
@@ -21733,7 +21948,7 @@ function sampleClip(root, clip) {
byRole: new Map(collectCharacterJointNodes(clone).map((evidence) => [
evidence.descriptor.role,
{
- point: evidence.node.getWorldPosition(new THREE25.Vector3).applyMatrix4(inverse),
+ point: evidence.node.getWorldPosition(new THREE26.Vector3).applyMatrix4(inverse),
evidence
}
]))
@@ -21845,12 +22060,12 @@ function phaseOppositionFindings(context, root, clips) {
return findings;
}
function signedBendDegrees(descriptor, quaternion) {
- const rest = new THREE25.Quaternion(...descriptor.rest.rotation);
+ const rest = new THREE26.Quaternion(...descriptor.rest.rotation);
const delta = rest.invert().multiply(quaternion).normalize();
- const axis = new THREE25.Vector3(delta.x, delta.y, delta.z);
- const signedMagnitude = axis.dot(new THREE25.Vector3(...descriptor.localBendAxis));
+ const axis = new THREE26.Vector3(delta.x, delta.y, delta.z);
+ const signedMagnitude = axis.dot(new THREE26.Vector3(...descriptor.localBendAxis));
const angle = 2 * Math.atan2(signedMagnitude, delta.w);
- return THREE25.MathUtils.radToDeg(THREE25.MathUtils.euclideanModulo(angle + Math.PI, Math.PI * 2) - Math.PI);
+ return THREE26.MathUtils.radToDeg(THREE26.MathUtils.euclideanModulo(angle + Math.PI, Math.PI * 2) - Math.PI);
}
function bendDirectionFindings(context, root, clips) {
const joints = collectCharacterJointNodes(root).filter((joint) => /(?:^|[._-])(?:knee|elbow)(?:$|[._-])/i.test(joint.descriptor.role));
@@ -21864,7 +22079,7 @@ function bendDirectionFindings(context, root, clips) {
let maximumFraction = 0;
for (const fraction of SAMPLE_FRACTIONS) {
const value = track.createInterpolant().evaluate(fraction * clip.duration);
- const bend = signedBendDegrees(joint.descriptor, new THREE25.Quaternion().fromArray(value).normalize());
+ const bend = signedBendDegrees(joint.descriptor, new THREE26.Quaternion().fromArray(value).normalize());
if (Math.abs(bend) > Math.abs(maximum)) {
maximum = bend;
maximumFraction = fraction;
@@ -21947,7 +22162,7 @@ function footSlideFindings(context, root, clips) {
return findings;
}
function inspectRigAdvisory(context) {
- if (!context.rig || !(context.scene instanceof THREE25.Object3D)) {
+ if (!context.rig || !(context.scene instanceof THREE26.Object3D)) {
return [];
}
const root = context.scene;
@@ -22066,7 +22281,7 @@ var init_architecture_repairs = __esm(() => {
});
// src/qa/architecture.ts
-import * as THREE26 from "three";
+import * as THREE27 from "three";
function hasRoofDimensions(value) {
return value.footprint !== undefined && value.roof?.ridgeAxis !== undefined && value.roof.rise !== undefined && value.roof.overhang !== undefined;
}
@@ -22076,7 +22291,7 @@ function semanticMetadata(node) {
function markerBounds(matrix) {
const bounds = emptyBounds();
for (let corner = 0;corner < 8; corner++) {
- expandBounds(bounds, new THREE26.Vector3(corner & 1 ? 0.5 : -0.5, corner & 2 ? 0.5 : -0.5, corner & 4 ? 0.5 : -0.5).applyMatrix4(matrix));
+ expandBounds(bounds, new THREE27.Vector3(corner & 1 ? 0.5 : -0.5, corner & 2 ? 0.5 : -0.5, corner & 4 ? 0.5 : -0.5).applyMatrix4(matrix));
}
return bounds;
}
@@ -22085,7 +22300,7 @@ function geometryPlaneNormal(geometry, relativeMatrix) {
const local = geometry.boundingBox;
if (!local)
return;
- const size = local.getSize(new THREE26.Vector3);
+ const size = local.getSize(new THREE27.Vector3);
const dimensions = [
["x", size.x],
["y", size.y],
@@ -22095,7 +22310,7 @@ function geometryPlaneNormal(geometry, relativeMatrix) {
const axis = dimensions[0]?.[0];
if (!axis)
return;
- const normal = new THREE26.Vector3(axis === "x" ? 1 : 0, axis === "y" ? 1 : 0, axis === "z" ? 1 : 0).transformDirection(relativeMatrix);
+ const normal = new THREE27.Vector3(axis === "x" ? 1 : 0, axis === "y" ? 1 : 0, axis === "z" ? 1 : 0).transformDirection(relativeMatrix);
if (normal.y < 0)
normal.multiplyScalar(-1);
return normal.normalize();
@@ -22107,7 +22322,7 @@ function geometryEvidence(geometry, relativeMatrix) {
if (position?.itemSize !== 3)
return { bounds, vertices, triangles: [] };
for (let index = 0;index < position.count; index++) {
- const point = new THREE26.Vector3(position.getX(index), position.getY(index), position.getZ(index));
+ const point = new THREE27.Vector3(position.getX(index), position.getY(index), position.getZ(index));
point.applyMatrix4(relativeMatrix);
vertices.push(point);
expandBounds(bounds, point);
@@ -22134,7 +22349,7 @@ function geometryEvidence(geometry, relativeMatrix) {
return { bounds, vertices, triangles, ...planeNormal ? { planeNormal } : {} };
}
function collectArchitectureEvidence(scene) {
- if (!(scene instanceof THREE26.Object3D))
+ if (!(scene instanceof THREE27.Object3D))
return;
scene.updateMatrixWorld(true);
const rootInverse = scene.matrixWorld.clone().invert();
@@ -22154,7 +22369,7 @@ function collectArchitectureEvidence(scene) {
const nodePath = parentPath ? `${parentPath}/${segment}` : segment;
const relativeMatrix = rootInverse.clone().multiply(node.matrixWorld);
const mesh = node;
- const isMesh = mesh.isMesh === true && mesh.geometry instanceof THREE26.BufferGeometry;
+ const isMesh = mesh.isMesh === true && mesh.geometry instanceof THREE27.BufferGeometry;
const evidence = isMesh ? geometryEvidence(mesh.geometry, relativeMatrix) : {
bounds: markerBounds(relativeMatrix),
vertices: [],
@@ -22213,7 +22428,7 @@ function architectureFinding(context, value) {
function averageNormal(normals) {
if (normals.length === 0)
return;
- const result = normals.reduce((sum, normal) => sum.add(normal), new THREE26.Vector3);
+ const result = normals.reduce((sum, normal) => sum.add(normal), new THREE27.Vector3);
return result.lengthSq() > EPSILON2 ? result.normalize() : undefined;
}
function intervalCoverage(min, max, expectedMin, expectedMax) {
@@ -22924,8 +23139,8 @@ function evaluateArchitectureQa(context) {
});
}
var PROFILE_RULE_ID2 = "ARCHITECTURE_PROFILE", EPSILON2 = 0.000001, ARCHITECTURE_REALISTIC_SCALE_BANDS, emptyBounds = () => ({
- min: new THREE26.Vector3(Infinity, Infinity, Infinity),
- max: new THREE26.Vector3(-Infinity, -Infinity, -Infinity)
+ min: new THREE27.Vector3(Infinity, Infinity, Infinity),
+ max: new THREE27.Vector3(-Infinity, -Infinity, -Infinity)
}), expandBounds = (bounds, point) => {
bounds.min.min(point);
bounds.max.max(point);
@@ -22969,7 +23184,7 @@ var init_architecture = __esm(() => {
});
// src/qa/environment.ts
-import * as THREE27 from "three";
+import * as THREE28 from "three";
function finding5(context, value) {
return { ...value, profile: context.profile ?? "asset.requirements.v1" };
}
@@ -22988,11 +23203,11 @@ function nodePath4(root, node) {
return names.reverse().join("/");
}
function transformedBox2(source, transform) {
- const result = new THREE27.Box3;
+ const result = new THREE28.Box3;
for (const x of [source.min.x, source.max.x]) {
for (const y of [source.min.y, source.max.y]) {
for (const z of [source.min.z, source.max.z]) {
- result.expandByPoint(new THREE27.Vector3(x, y, z).applyMatrix4(transform));
+ result.expandByPoint(new THREE28.Vector3(x, y, z).applyMatrix4(transform));
}
}
}
@@ -23001,16 +23216,16 @@ function transformedBox2(source, transform) {
function orientedBoxFromLocalBounds(root, node, source, relative = root.matrixWorld.clone().invert().multiply(node.matrixWorld)) {
if (!relative.elements.every(Number.isFinite))
return;
- const position = new THREE27.Vector3;
- const rotation = new THREE27.Quaternion;
- const scale = new THREE27.Vector3;
+ const position = new THREE28.Vector3;
+ const rotation = new THREE28.Quaternion;
+ const scale = new THREE28.Vector3;
relative.decompose(position, rotation, scale);
- const recomposed = new THREE27.Matrix4().compose(position, rotation, scale);
+ const recomposed = new THREE28.Matrix4().compose(position, rotation, scale);
const residual = Math.max(...relative.elements.map((component, index) => Math.abs(component - (recomposed.elements[index] ?? component))));
if (residual > 0.00001)
return;
- const center = source.getCenter(new THREE27.Vector3).applyMatrix4(relative);
- const sourceHalf = source.getSize(new THREE27.Vector3).multiplyScalar(0.5);
+ const center = source.getCenter(new THREE28.Vector3).applyMatrix4(relative);
+ const sourceHalf = source.getSize(new THREE28.Vector3).multiplyScalar(0.5);
const halfExtents = [
Math.abs(sourceHalf.x * scale.x),
Math.abs(sourceHalf.y * scale.y),
@@ -23031,24 +23246,24 @@ function collectParts5(root) {
const result = [];
root.traverseVisible((node) => {
const roles = rolesOf3(node);
- const renderable = node instanceof THREE27.Mesh;
+ const renderable = node instanceof THREE28.Mesh;
let box;
let orientedBox;
let source;
- if (renderable && node.geometry instanceof THREE27.BufferGeometry) {
+ if (renderable && node.geometry instanceof THREE28.BufferGeometry) {
node.geometry.computeBoundingBox();
if (node.geometry.boundingBox) {
source = node.geometry.boundingBox;
}
} else if (roles.length > 0) {
- source = new THREE27.Box3(new THREE27.Vector3(-0.5, -0.5, -0.5), new THREE27.Vector3(0.5, 0.5, 0.5));
+ source = new THREE28.Box3(new THREE28.Vector3(-0.5, -0.5, -0.5), new THREE28.Vector3(0.5, 0.5, 0.5));
}
const relative = rootInverse.clone().multiply(node.matrixWorld);
- const count = node instanceof THREE27.InstancedMesh ? node.count : 1;
+ const count = node instanceof THREE28.InstancedMesh ? node.count : 1;
for (let index = 0;index < count; index++) {
const transform = relative.clone();
- if (node instanceof THREE27.InstancedMesh) {
- const instance = new THREE27.Matrix4;
+ if (node instanceof THREE28.InstancedMesh) {
+ const instance = new THREE28.Matrix4;
node.getMatrixAt(index, instance);
transform.multiply(instance);
}
@@ -23079,9 +23294,9 @@ function resolveSocket(root, node, socket) {
return;
root.updateWorldMatrix(true, true);
const rootInverse = root.matrixWorld.clone().invert();
- const point = new THREE27.Vector3(...frame.translation).applyMatrix4(node.matrixWorld).applyMatrix4(rootInverse);
- const rootInverseQuaternion = root.getWorldQuaternion(new THREE27.Quaternion).invert();
- const rotation = node.getWorldQuaternion(new THREE27.Quaternion).multiply(new THREE27.Quaternion(...frame.rotation)).premultiply(rootInverseQuaternion).normalize();
+ const point = new THREE28.Vector3(...frame.translation).applyMatrix4(node.matrixWorld).applyMatrix4(rootInverse);
+ const rootInverseQuaternion = root.getWorldQuaternion(new THREE28.Quaternion).invert();
+ const rotation = node.getWorldQuaternion(new THREE28.Quaternion).multiply(new THREE28.Quaternion(...frame.rotation)).premultiply(rootInverseQuaternion).normalize();
return {
id: socket.id,
type: socket.type,
@@ -23110,7 +23325,7 @@ function socketByType(sockets, type) {
return sockets.find((socket) => socket.type === type);
}
function inspectPlacementSockets(context) {
- if (!(context.scene instanceof THREE27.Object3D)) {
+ if (!(context.scene instanceof THREE28.Object3D)) {
return [];
}
const root = context.scene;
@@ -23174,7 +23389,7 @@ function materialSignature(material) {
function boundarySamples(root, axis, side, bins = 12) {
root.updateWorldMatrix(true, true);
const inverse = root.matrixWorld.clone().invert();
- const localBounds = new THREE27.Box3;
+ const localBounds = new THREE28.Box3;
for (const part of collectParts5(root))
if (part.renderable && part.box)
localBounds.union(part.box);
@@ -23188,30 +23403,30 @@ function boundarySamples(root, axis, side, bins = 12) {
const crossExtent = Math.max(0.000000001, localBounds.max[crossAxis] - crossMin);
const byBin = new Map;
root.traverseVisible((node) => {
- if (!(node instanceof THREE27.Mesh) || !(node.geometry instanceof THREE27.BufferGeometry))
+ if (!(node instanceof THREE28.Mesh) || !(node.geometry instanceof THREE28.BufferGeometry))
return;
const positions = node.geometry.getAttribute("position");
if (positions?.itemSize !== 3)
return;
const normals = node.geometry.getAttribute("normal");
const relative = inverse.clone().multiply(node.matrixWorld);
- const count = node instanceof THREE27.InstancedMesh ? node.count : 1;
+ const count = node instanceof THREE28.InstancedMesh ? node.count : 1;
for (let instanceIndex = 0;instanceIndex < count; instanceIndex++) {
const transform = relative.clone();
- if (node instanceof THREE27.InstancedMesh) {
- const instance = new THREE27.Matrix4;
+ if (node instanceof THREE28.InstancedMesh) {
+ const instance = new THREE28.Matrix4;
node.getMatrixAt(instanceIndex, instance);
transform.multiply(instance);
}
- const normalMatrix = new THREE27.Matrix3().getNormalMatrix(transform);
+ const normalMatrix = new THREE28.Matrix3().getNormalMatrix(transform);
const material = materialSignature(node.material);
for (let index = 0;index < positions.count; index++) {
- const point = new THREE27.Vector3(positions.getX(index), positions.getY(index), positions.getZ(index)).applyMatrix4(transform);
+ const point = new THREE28.Vector3(positions.getX(index), positions.getY(index), positions.getZ(index)).applyMatrix4(transform);
if (Math.abs(point[axis] - edge) > band)
continue;
- const t = THREE27.MathUtils.clamp((point[crossAxis] - crossMin) / crossExtent, 0, 1);
+ const t = THREE28.MathUtils.clamp((point[crossAxis] - crossMin) / crossExtent, 0, 1);
const bin = Math.min(bins - 1, Math.floor(t * bins));
- const normal = normals ? new THREE27.Vector3(normals.getX(index), normals.getY(index), normals.getZ(index)).applyMatrix3(normalMatrix).normalize() : new THREE27.Vector3(0, 1, 0);
+ const normal = normals ? new THREE28.Vector3(normals.getX(index), normals.getY(index), normals.getZ(index)).applyMatrix3(normalMatrix).normalize() : new THREE28.Vector3(0, 1, 0);
const current = byBin.get(bin);
if (!current || point.y > current.height || point.y === current.height && normal.y > current.normal.y) {
byBin.set(bin, { bin, height: point.y, normal, material });
@@ -23234,7 +23449,7 @@ function edgePairMeasurements(root, axis, sockets) {
...positive.map((sample) => sample.bin)
]);
const maximumHeightDelta = pairs.length ? Math.max(...pairs.map(([a, b]) => Math.abs(a.height - b.height))) : Number.POSITIVE_INFINITY;
- const maximumNormalDeltaDegrees = pairs.length ? Math.max(...pairs.map(([a, b]) => THREE27.MathUtils.radToDeg(Math.acos(THREE27.MathUtils.clamp(a.normal.dot(b.normal), -1, 1))))) : 180;
+ const maximumNormalDeltaDegrees = pairs.length ? Math.max(...pairs.map(([a, b]) => THREE28.MathUtils.radToDeg(Math.acos(THREE28.MathUtils.clamp(a.normal.dot(b.normal), -1, 1))))) : 180;
const materialMismatch = pairs.some(([a, b]) => a.material !== b.material);
const negativeSocket = socketByType(sockets, `environment.tile.${axis}-negative`);
const positiveSocket = socketByType(sockets, `environment.tile.${axis}-positive`);
@@ -23251,7 +23466,7 @@ function edgePairMeasurements(root, axis, sockets) {
};
}
function inspectTileEdges(context) {
- if (context.tileable !== true || !(context.scene instanceof THREE27.Object3D)) {
+ if (context.tileable !== true || !(context.scene instanceof THREE28.Object3D)) {
return [];
}
const root = context.scene;
@@ -23334,7 +23549,7 @@ function isCorridor(part) {
return part.roles.some((role) => /^environment\.(?:navigation\.)?corridor(?:\.|$)/.test(role));
}
function inspectNavigationClearance(context) {
- if (context.navigable !== true || !(context.scene instanceof THREE27.Object3D)) {
+ if (context.navigable !== true || !(context.scene instanceof THREE28.Object3D)) {
return [];
}
const root = context.scene;
@@ -23464,7 +23679,7 @@ function functionalLayer(part) {
return part.roles.some((role) => role.startsWith("environment.functional") || role.startsWith("environment.layer") || role.startsWith("environment.path") || role.startsWith("environment.road") || role.startsWith("environment.bridge") || role.startsWith("environment.gate"));
}
function inspectSpatialSupport(context) {
- if (context.groundPlaneY === undefined || !(context.scene instanceof THREE27.Object3D)) {
+ if (context.groundPlaneY === undefined || !(context.scene instanceof THREE28.Object3D)) {
return [];
}
const root = context.scene;
@@ -23511,7 +23726,7 @@ function inspectSpatialSupport(context) {
}));
}
}
- const size = box.getSize(new THREE27.Vector3);
+ const size = box.getSize(new THREE28.Vector3);
if (box.min.y < context.groundPlaneY - 0.05 && size.y <= Math.max(0.05, Math.min(size.x, size.z) * 0.03) && Math.max(size.x, size.z) >= 1) {
findings.push(finding5(context, {
code: "ENV_GROUND_UNDECLARED_SKIRT",
@@ -23972,7 +24187,7 @@ function writtenNodeResolver(root, doc, purpose) {
// src/node-visibility.ts
import { KHRNodeVisibility } from "@gltf-transform/extensions";
-import * as THREE28 from "three";
+import * as THREE29 from "three";
function applyNodeVisibility(root, doc) {
const hidden = [];
root.traverse((node) => {
@@ -24015,7 +24230,7 @@ function drawnSceneBounds(scene) {
return;
const mesh = node.getMesh();
if (mesh) {
- const base = new THREE28.Matrix4().fromArray(node.getWorldMatrix());
+ const base = new THREE29.Matrix4().fromArray(node.getWorldMatrix());
const instances = node.getExtension("EXT_mesh_gpu_instancing");
const translation = instances?.getAttribute("TRANSLATION");
const rotation = instances?.getAttribute("ROTATION");
@@ -24026,7 +24241,7 @@ function drawnSceneBounds(scene) {
const t = translation?.getElement(i, []) ?? [0, 0, 0];
const r = rotation?.getElement(i, []) ?? [0, 0, 0, 1];
const s = scale?.getElement(i, []) ?? [1, 1, 1];
- const localMatrix = new THREE28.Matrix4().compose(new THREE28.Vector3().fromArray(t), new THREE28.Quaternion().fromArray(r), new THREE28.Vector3().fromArray(s));
+ const localMatrix = new THREE29.Matrix4().compose(new THREE29.Vector3().fromArray(t), new THREE29.Quaternion().fromArray(r), new THREE29.Vector3().fromArray(s));
matrices.push(base.clone().multiply(localMatrix).toArray());
}
const local = [0, 0, 0];
@@ -24067,12 +24282,12 @@ var init_node_visibility = __esm(() => {
});
// src/delivery-inspect.ts
-import * as THREE29 from "three";
+import * as THREE30 from "three";
import { PropertyType as PropertyType2 } from "@gltf-transform/core";
function decompose(matrix) {
- const translation = new THREE29.Vector3;
- const rotation = new THREE29.Quaternion;
- const scale = new THREE29.Vector3;
+ const translation = new THREE30.Vector3;
+ const rotation = new THREE30.Quaternion;
+ const scale = new THREE30.Vector3;
matrix.decompose(translation, rotation, scale);
const clean = (value) => Object.is(value, -0) ? 0 : value;
return {
@@ -24084,7 +24299,7 @@ function decompose(matrix) {
function drawnTriangles(visited) {
const values = [];
const local = [0, 0, 0];
- const point = new THREE29.Vector3;
+ const point = new THREE30.Vector3;
for (const { node, roles, hidden } of visited) {
const mesh = node.getMesh();
if (!mesh || hidden || roles.some((role) => role.startsWith("collider.")))
@@ -24097,7 +24312,7 @@ function drawnTriangles(visited) {
const copies = translation?.getCount() ?? rotation?.getCount() ?? scale?.getCount() ?? 1;
const matrices = [];
for (let i = 0;i < copies; i++) {
- const instance = new THREE29.Matrix4().compose(new THREE29.Vector3().fromArray(translation?.getElement(i, []) ?? [0, 0, 0]), new THREE29.Quaternion().fromArray(rotation?.getElement(i, []) ?? [0, 0, 0, 1]), new THREE29.Vector3().fromArray(scale?.getElement(i, []) ?? [1, 1, 1]));
+ const instance = new THREE30.Matrix4().compose(new THREE30.Vector3().fromArray(translation?.getElement(i, []) ?? [0, 0, 0]), new THREE30.Quaternion().fromArray(rotation?.getElement(i, []) ?? [0, 0, 0, 1]), new THREE30.Vector3().fromArray(scale?.getElement(i, []) ?? [1, 1, 1]));
matrices.push(base.clone().multiply(instance));
}
for (const primitive of mesh.listPrimitives()) {
@@ -24128,20 +24343,20 @@ function triangleOverlapsBox(a, b, c, h, tolerance) {
return false;
}
const e = [
- new THREE29.Vector3().subVectors(b, a),
- new THREE29.Vector3().subVectors(c, b),
- new THREE29.Vector3().subVectors(a, c)
+ new THREE30.Vector3().subVectors(b, a),
+ new THREE30.Vector3().subVectors(c, b),
+ new THREE30.Vector3().subVectors(a, c)
];
- const normal = new THREE29.Vector3().crossVectors(e[0], e[1]);
+ const normal = new THREE30.Vector3().crossVectors(e[0], e[1]);
const axes = [normal];
const units = [
- new THREE29.Vector3(1, 0, 0),
- new THREE29.Vector3(0, 1, 0),
- new THREE29.Vector3(0, 0, 1)
+ new THREE30.Vector3(1, 0, 0),
+ new THREE30.Vector3(0, 1, 0),
+ new THREE30.Vector3(0, 0, 1)
];
for (const unit of units)
for (const edge of e)
- axes.push(new THREE29.Vector3().crossVectors(unit, edge));
+ axes.push(new THREE30.Vector3().crossVectors(unit, edge));
for (const axis of axes) {
if (axis.lengthSq() < 0.000000000000000000000001)
continue;
@@ -24153,14 +24368,14 @@ function triangleOverlapsBox(a, b, c, h, tolerance) {
return true;
}
function closestPointOnTriangle(p, a, b, c) {
- const ab = new THREE29.Vector3().subVectors(b, a);
- const ac = new THREE29.Vector3().subVectors(c, a);
- const ap = new THREE29.Vector3().subVectors(p, a);
+ const ab = new THREE30.Vector3().subVectors(b, a);
+ const ac = new THREE30.Vector3().subVectors(c, a);
+ const ap = new THREE30.Vector3().subVectors(p, a);
const d1 = ab.dot(ap);
const d2 = ac.dot(ap);
if (d1 <= 0 && d2 <= 0)
return a.clone();
- const bp = new THREE29.Vector3().subVectors(p, b);
+ const bp = new THREE30.Vector3().subVectors(p, b);
const d3 = ab.dot(bp);
const d4 = ac.dot(bp);
if (d3 >= 0 && d4 <= d3)
@@ -24168,7 +24383,7 @@ function closestPointOnTriangle(p, a, b, c) {
const vc = d1 * d4 - d3 * d2;
if (vc <= 0 && d1 >= 0 && d3 <= 0)
return a.clone().addScaledVector(ab, d1 / (d1 - d3));
- const cp = new THREE29.Vector3().subVectors(p, c);
+ const cp = new THREE30.Vector3().subVectors(p, c);
const d5 = ab.dot(cp);
const d6 = ac.dot(cp);
if (d6 >= 0 && d5 <= d6)
@@ -24178,14 +24393,14 @@ function closestPointOnTriangle(p, a, b, c) {
return a.clone().addScaledVector(ac, d2 / (d2 - d6));
const va = d3 * d6 - d5 * d4;
if (va <= 0 && d4 - d3 >= 0 && d5 - d6 >= 0)
- return b.clone().addScaledVector(new THREE29.Vector3().subVectors(c, b), (d4 - d3) / (d4 - d3 + (d5 - d6)));
+ return b.clone().addScaledVector(new THREE30.Vector3().subVectors(c, b), (d4 - d3) / (d4 - d3 + (d5 - d6)));
const denominator = 1 / (va + vb + vc);
return a.clone().addScaledVector(ab, vb * denominator).addScaledVector(ac, vc * denominator);
}
function segmentSegmentDistanceSq(p1, q1, p2, q2) {
- const d1 = new THREE29.Vector3().subVectors(q1, p1);
- const d2 = new THREE29.Vector3().subVectors(q2, p2);
- const r = new THREE29.Vector3().subVectors(p1, p2);
+ const d1 = new THREE30.Vector3().subVectors(q1, p1);
+ const d2 = new THREE30.Vector3().subVectors(q2, p2);
+ const r = new THREE30.Vector3().subVectors(p1, p2);
const a = d1.dot(d1);
const e = d2.dot(d2);
const f = d2.dot(r);
@@ -24194,22 +24409,22 @@ function segmentSegmentDistanceSq(p1, q1, p2, q2) {
if (a <= 0.000000000000000000000001 && e <= 0.000000000000000000000001)
return r.lengthSq();
if (a <= 0.000000000000000000000001)
- t = THREE29.MathUtils.clamp(f / e, 0, 1);
+ t = THREE30.MathUtils.clamp(f / e, 0, 1);
else {
const c = d1.dot(r);
if (e <= 0.000000000000000000000001)
- s = THREE29.MathUtils.clamp(-c / a, 0, 1);
+ s = THREE30.MathUtils.clamp(-c / a, 0, 1);
else {
const b = d1.dot(d2);
const denominator = a * e - b * b;
- s = denominator !== 0 ? THREE29.MathUtils.clamp((b * f - c * e) / denominator, 0, 1) : 0;
+ s = denominator !== 0 ? THREE30.MathUtils.clamp((b * f - c * e) / denominator, 0, 1) : 0;
t = (b * s + f) / e;
if (t < 0) {
t = 0;
- s = THREE29.MathUtils.clamp(-c / a, 0, 1);
+ s = THREE30.MathUtils.clamp(-c / a, 0, 1);
} else if (t > 1) {
t = 1;
- s = THREE29.MathUtils.clamp((b - c) / a, 0, 1);
+ s = THREE30.MathUtils.clamp((b - c) / a, 0, 1);
}
}
}
@@ -24218,8 +24433,8 @@ function segmentSegmentDistanceSq(p1, q1, p2, q2) {
return c1.distanceToSquared(c2);
}
function segmentCrossesTriangle(p, q, a, b, c) {
- const hit = new THREE29.Vector3;
- const ray = new THREE29.Ray(p, new THREE29.Vector3().subVectors(q, p));
+ const hit = new THREE30.Vector3;
+ const ray = new THREE30.Ray(p, new THREE30.Vector3().subVectors(q, p));
const length = ray.direction.length();
if (length === 0)
return false;
@@ -24336,9 +24551,9 @@ function inspectDelivery(doc) {
visit(scene.listChildren(), segment3(scene.getName() || "Scene", 0), false, undefined);
const finding = (code, path, message) => summary.diagnostics.push({ code, path, message });
const { min, max } = drawnSceneBounds(scene);
- const bounds = new THREE29.Box3(new THREE29.Vector3(...min), new THREE29.Vector3(...max));
+ const bounds = new THREE30.Box3(new THREE30.Vector3(...min), new THREE30.Vector3(...max));
const finiteBounds = [...min, ...max].every(Number.isFinite);
- const diagonal = finiteBounds ? bounds.getSize(new THREE29.Vector3).length() : 0;
+ const diagonal = finiteBounds ? bounds.getSize(new THREE30.Vector3).length() : 0;
const tolerance = Math.max(0.0001, diagonal * 0.0001);
const colliderNodes = [];
for (const entry of visited) {
@@ -24417,23 +24632,23 @@ function inspectDelivery(doc) {
const triangles = colliderNodes.some(({ record }) => record.shape.kind !== "hull") ? drawnTriangles(visited) : new Float64Array;
const triangleCount = triangles.length / 9;
let overlapTests = 0;
- const a = new THREE29.Vector3;
- const b = new THREE29.Vector3;
- const c = new THREE29.Vector3;
+ const a = new THREE30.Vector3;
+ const b = new THREE30.Vector3;
+ const c = new THREE30.Vector3;
for (const { visit: entry, record } of colliderNodes) {
if (!entry.hidden)
finding("DELIVERY_COLLIDER_NOT_HIDDEN", record.path, "collider proxy draws; hide it (the delivery helpers do) so importers that ignore roles draw only the asset.");
const matrix = worldMatrix(entry.node);
- const proxyBounds = new THREE29.Box3;
+ const proxyBounds = new THREE30.Box3;
const mesh = entry.node.getMesh();
const local = [0, 0, 0];
for (const primitive of mesh?.listPrimitives() ?? []) {
const position = primitive.getAttribute("POSITION");
for (let i = 0;i < (position?.getCount() ?? 0); i++)
- proxyBounds.expandByPoint(new THREE29.Vector3().fromArray(position.getElement(i, local)).applyMatrix4(matrix));
+ proxyBounds.expandByPoint(new THREE30.Vector3().fromArray(position.getElement(i, local)).applyMatrix4(matrix));
}
if (proxyBounds.isEmpty())
- proxyBounds.expandByPoint(new THREE29.Vector3().setFromMatrixPosition(matrix));
+ proxyBounds.expandByPoint(new THREE30.Vector3().setFromMatrixPosition(matrix));
const expanded = bounds.clone().expandByScalar(tolerance);
if (!finiteBounds || !expanded.containsBox(proxyBounds))
finding("DELIVERY_COLLIDER_OUTSIDE_BOUNDS", record.path, "collider proxy reaches outside the bounds of the drawn asset.");
@@ -24444,11 +24659,11 @@ function inspectDelivery(doc) {
continue;
}
overlapTests += triangleCount;
- const toLocal = new THREE29.Matrix4;
+ const toLocal = new THREE30.Matrix4;
let touches = false;
if (record.shape.kind === "box") {
toLocal.copy(matrix).invert();
- const half = new THREE29.Vector3(0.5, 0.5, 0.5);
+ const half = new THREE30.Vector3(0.5, 0.5, 0.5);
const scale = Math.max(...record.transform.scale.map(Math.abs), 0.000000001);
for (let t = 0;t < triangleCount && !touches; t++) {
a.fromArray(triangles, t * 9).applyMatrix4(toLocal);
@@ -24458,10 +24673,10 @@ function inspectDelivery(doc) {
}
} else {
const { translation, rotation } = record.transform;
- toLocal.compose(new THREE29.Vector3(...translation), new THREE29.Quaternion(...rotation), new THREE29.Vector3(1, 1, 1)).invert();
+ toLocal.compose(new THREE30.Vector3(...translation), new THREE30.Quaternion(...rotation), new THREE30.Vector3(1, 1, 1)).invert();
const { radius, height } = record.shape;
- const p = new THREE29.Vector3(0, -height / 2 + radius, 0);
- const q = new THREE29.Vector3(0, height / 2 - radius, 0);
+ const p = new THREE30.Vector3(0, -height / 2 + radius, 0);
+ const q = new THREE30.Vector3(0, height / 2 - radius, 0);
for (let t = 0;t < triangleCount && !touches; t++) {
a.fromArray(triangles, t * 9).applyMatrix4(toLocal);
b.fromArray(triangles, t * 9 + 3).applyMatrix4(toLocal);
@@ -24480,7 +24695,7 @@ function inspectDelivery(doc) {
finding("DELIVERY_PORT_WITHOUT_MODULE", record.path, "port is not under a valid kit module; place ports under the root defineModule marked.");
continue;
}
- const point = new THREE29.Vector3(...record.transform.translation).applyMatrix4(worldMatrix(moduleEntry.node).invert());
+ const point = new THREE30.Vector3(...record.transform.translation).applyMatrix4(worldMatrix(moduleEntry.node).invert());
const [width, depth] = spec.footprint;
const [x0, x1, z0, z1] = spec.origin === "corner" ? [0, width, 0, depth] : [-width / 2, width / 2, -depth / 2, depth / 2];
const slack = Math.max(0.0001, Math.max(width, depth, spec.height) * 0.00001);
@@ -24494,7 +24709,7 @@ function inspectDelivery(doc) {
}
return summary;
}
-var DELIVERY_OVERLAP_TEST_LIMIT = 50000000, segment3 = (name, occurrence) => `/${encodeURIComponent(name)}[${occurrence}]`, roleTail = (role, base) => role.startsWith(`${base}.`) ? role.slice(base.length + 1) : undefined, worldMatrix = (node) => new THREE29.Matrix4().fromArray(node.getWorldMatrix());
+var DELIVERY_OVERLAP_TEST_LIMIT = 50000000, segment3 = (name, occurrence) => `/${encodeURIComponent(name)}[${occurrence}]`, roleTail = (role, base) => role.startsWith(`${base}.`) ? role.slice(base.length + 1) : undefined, worldMatrix = (node) => new THREE30.Matrix4().fromArray(node.getWorldMatrix());
var init_delivery_inspect = __esm(() => {
init_gltf_io();
init_semantic();
@@ -25335,7 +25550,7 @@ var init_requirements_run = __esm(() => {
});
// src/qa/skin-integrity.ts
-import * as THREE30 from "three";
+import * as THREE31 from "three";
function validAttribute(a, count, size) {
if (!a || a.itemSize !== size || a.count !== count || !Number.isSafeInteger(count) || count < 1)
return false;
@@ -25382,9 +25597,9 @@ function inspectSkinIntegrity(root) {
}
while (chain.length) {
const n = chain.pop();
- const local = n.matrixAutoUpdate ? new THREE30.Matrix4().compose(n.position, n.quaternion, n.scale) : n.matrix.clone();
+ const local = n.matrixAutoUpdate ? new THREE31.Matrix4().compose(n.position, n.quaternion, n.scale) : n.matrix.clone();
const parent = n.parent ? worlds.get(n.parent) : undefined;
- const value = n.matrixWorldAutoUpdate === false ? n.matrixWorld.clone() : parent ? new THREE30.Matrix4().multiplyMatrices(parent, local) : local;
+ const value = n.matrixWorldAutoUpdate === false ? n.matrixWorld.clone() : parent ? new THREE31.Matrix4().multiplyMatrices(parent, local) : local;
worlds.set(n, value);
}
return worlds.get(node);
@@ -25434,7 +25649,7 @@ function inspectSkinIntegrity(root) {
if (result.truncated)
break;
}
- if (!finiteAffine(mesh.bindMatrix) || !Number.isFinite(mesh.bindMatrix.determinant()) || mesh.bindMatrix.determinant() === 0 || ![THREE30.AttachedBindMode, THREE30.DetachedBindMode].includes(mesh.bindMode)) {
+ if (!finiteAffine(mesh.bindMatrix) || !Number.isFinite(mesh.bindMatrix.determinant()) || mesh.bindMatrix.determinant() === 0 || ![THREE31.AttachedBindMode, THREE31.DetachedBindMode].includes(mesh.bindMode)) {
add("SKIN_BIND_MATRIX", "Mesh requires a finite invertible affine bind matrix and an attached or detached bind mode.", "bindMatrix");
}
const position = mesh.geometry?.getAttribute("position"), count = position?.count ?? 0;
@@ -25483,7 +25698,7 @@ function inspectSkinIntegrity(root) {
add("SKIN_POSE_TRANSFORM", "Current mesh world transform must be finite and affine.");
continue;
}
- const inverse = mesh.bindMode === THREE30.AttachedBindMode ? meshWorld.clone().invert() : mesh.bindMatrix.clone().invert();
+ const inverse = mesh.bindMode === THREE31.AttachedBindMode ? meshWorld.clone().invert() : mesh.bindMatrix.clone().invert();
const matrices = [];
for (let joint = 0;joint < bones.length; joint++) {
const boneWorld = world(bones[joint]);
@@ -25491,13 +25706,13 @@ function inspectSkinIntegrity(root) {
add("SKIN_POSE_TRANSFORM", `Current transform for joint ${joint} must be finite and affine.`, `joints[${joint}]`);
break;
}
- matrices.push(new THREE30.Matrix4().multiplyMatrices(boneWorld, skeleton.boneInverses[joint]).multiply(mesh.bindMatrix));
+ matrices.push(new THREE31.Matrix4().multiplyMatrices(boneWorld, skeleton.boneInverses[joint]).multiply(mesh.bindMatrix));
}
if (result.findings.length !== start)
continue;
- const base = new THREE30.Vector3, posed = new THREE30.Vector3, temp = new THREE30.Vector3, box = new THREE30.Box3;
+ const base = new THREE31.Vector3, posed = new THREE31.Vector3, temp = new THREE31.Vector3, box = new THREE31.Box3;
for (let vertex = 0;vertex < count; vertex++) {
- THREE30.Mesh.prototype.getVertexPosition.call(mesh, vertex, base);
+ THREE31.Mesh.prototype.getVertexPosition.call(mesh, vertex, base);
posed.set(0, 0, 0);
for (let lane = 0;lane < 4; lane++) {
const weight = weights.getComponent(vertex, lane);
@@ -25694,7 +25909,7 @@ var init_material_export = __esm(() => {
});
// src/community-exporter.ts
-import * as THREE31 from "three";
+import * as THREE32 from "three";
import { GLTFExporter } from "three/addons/exporters/GLTFExporter.js";
import { GLB_BUFFER } from "@gltf-transform/core";
function resolveGltfExporter(value = typeof process !== "undefined" ? process.env["KILN_GLTF_EXPORTER"] : undefined) {
@@ -25724,7 +25939,7 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
return found;
const copy = cleanClone(source);
normalizeTextureTransform(copy);
- copy.source = new THREE31.TextureSource(source.image);
+ copy.source = new THREE32.TextureSource(source.image);
textures.set(source, copy);
const bytes = source.userData["encoded"];
if (bytes?.bytes) {
@@ -25733,8 +25948,8 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
encoded.push((async () => {
copy.image = await platform.decode(bytes.bytes);
Object.defineProperty(copy, "isDataTexture", { value: true });
- copy.format = THREE31.RGBAFormat;
- copy.type = THREE31.UnsignedByteType;
+ copy.format = THREE32.RGBAFormat;
+ copy.type = THREE32.UnsignedByteType;
})());
}
return copy;
@@ -25751,7 +25966,7 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
physical.sheen = 1;
}
for (const [key, value] of Object.entries(copy)) {
- if (value instanceof THREE31.Texture)
+ if (value instanceof THREE32.Texture)
copy[key] = texture(value);
}
materials.set(source, copy);
@@ -25767,15 +25982,15 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
if (!copy.matrixAutoUpdate)
copy.matrix.decompose(copy.position, copy.quaternion, copy.scale);
if (source.isScene) {
- copy = new THREE31.Group;
+ copy = new THREE32.Group;
copy.copy(shadow, false);
}
if (source.isSprite) {
const sprite = source;
- const geometry = new THREE31.PlaneGeometry(1, 1);
+ const geometry = new THREE32.PlaneGeometry(1, 1);
geometry.translate(0.5 - sprite.center.x, 0.5 - sprite.center.y, 0);
geometry.rotateZ(sprite.material.rotation);
- const spriteMaterial = new THREE31.MeshBasicMaterial({
+ const spriteMaterial = new THREE32.MeshBasicMaterial({
name: sprite.material.name,
color: sprite.material.color,
opacity: sprite.material.opacity,
@@ -25786,8 +26001,8 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
});
Object.assign(spriteMaterial.userData, authorExtras?.material(sprite.material));
originalMaterials.set(spriteMaterial, sprite.material);
- copy = new THREE31.Mesh(geometry, spriteMaterial);
- THREE31.Object3D.prototype.copy.call(copy, shadow, false);
+ copy = new THREE32.Mesh(geometry, spriteMaterial);
+ THREE32.Object3D.prototype.copy.call(copy, shadow, false);
}
Object.assign(copy.userData, authorExtras?.node(source), rigExtrasForExport(source), openShellExtras(source), kitExtras(source), repeatInstancesExtras(source));
const semantic = source.userData[KILN_SEMANTIC_EXTRAS_KEY];
@@ -25851,8 +26066,8 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
if (!context)
throw new Error("A 2D canvas is required to prepare export texture channels.");
context.putImageData(new ImageData(new Uint8ClampedArray(data), width, height), 0, 0);
- const adapted = new THREE31.Texture().copy(map);
- adapted.source = new THREE31.TextureSource(canvas);
+ const adapted = new THREE32.Texture().copy(map);
+ adapted.source = new THREE32.TextureSource(canvas);
canvasInputs.set(map, adapted);
const direct = directImages.get(map);
if (direct)
@@ -25861,7 +26076,7 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
};
for (const material of materials.values()) {
for (const [key, value] of Object.entries(material)) {
- if (value instanceof THREE31.Texture && value.flipY && value.image?.data)
+ if (value instanceof THREE32.Texture && value.flipY && value.image?.data)
material[key] = canvasInput(value);
}
const standard = material;
@@ -25883,8 +26098,8 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
}
cloned.tracks = cloned.tracks.filter((track) => {
try {
- const binding = THREE31.PropertyBinding.parseTrackName(track.name);
- return ["position", "quaternion", "scale", "morphTargetInfluences"].includes(binding.propertyName) && THREE31.PropertyBinding.findNode(copy, binding.nodeName) !== null;
+ const binding = THREE32.PropertyBinding.parseTrackName(track.name);
+ return ["position", "quaternion", "scale", "morphTargetInfluences"].includes(binding.propertyName) && THREE32.PropertyBinding.findNode(copy, binding.nodeName) !== null;
} catch {
return false;
}
@@ -26079,7 +26294,7 @@ function applyIndexPolicy(doc, policy) {
var init_index_policy = () => {};
// src/surface-bake.ts
-import * as THREE32 from "three";
+import * as THREE33 from "three";
function settings(value, label) {
if (value === false)
return;
@@ -26121,13 +26336,13 @@ function drawnMeshes(root) {
function weld(mesh) {
const position = mesh.geometry.getAttribute("position");
const world = [];
- const box = new THREE32.Box3;
+ const box = new THREE33.Box3;
for (let i = 0;i < position.count; i++) {
- const point = new THREE32.Vector3().fromBufferAttribute(position, i).applyMatrix4(mesh.matrixWorld);
+ const point = new THREE33.Vector3().fromBufferAttribute(position, i).applyMatrix4(mesh.matrixWorld);
world.push(point);
box.expandByPoint(point);
}
- const size = box.isEmpty() ? 0 : box.getSize(new THREE32.Vector3).length();
+ const size = box.isEmpty() ? 0 : box.getSize(new THREE33.Vector3).length();
const tolerance = size > 0 ? size * 0.000001 : 0.000000001;
const keys = new Map;
const ids = new Int32Array(position.count);
@@ -26161,7 +26376,7 @@ function bakeEdge(topology, thresholdDegrees, smoothing) {
const a = points[triangles[t]];
const b = points[triangles[t + 1]];
const c = points[triangles[t + 2]];
- normals.push(new THREE32.Vector3().subVectors(b, a).cross(new THREE32.Vector3().subVectors(c, a)).normalize());
+ normals.push(new THREE33.Vector3().subVectors(b, a).cross(new THREE33.Vector3().subVectors(c, a)).normalize());
}
const edges = new Map;
const neighbours = points.map(() => new Set);
@@ -26180,7 +26395,7 @@ function bakeEdge(topology, thresholdDegrees, smoothing) {
edges.set(key, list);
}
}
- const threshold = THREE32.MathUtils.degToRad(thresholdDegrees);
+ const threshold = THREE33.MathUtils.degToRad(thresholdDegrees);
const weights = new Float64Array(points.length);
for (const [key, incidences] of edges) {
let weight;
@@ -26190,10 +26405,10 @@ function bakeEdge(topology, thresholdDegrees, smoothing) {
const [[f1], [f2, opposite2]] = incidences;
const n1 = normals[f1];
const n2 = normals[f2];
- const angle = Math.acos(THREE32.MathUtils.clamp(n1.dot(n2), -1, 1));
+ const angle = Math.acos(THREE33.MathUtils.clamp(n1.dot(n2), -1, 1));
const [u] = key.split(":").map(Number);
const scale = Math.max(points[u].distanceTo(points[opposite2]), 0.000000000001);
- const side = new THREE32.Vector3().subVectors(points[opposite2], points[u]).dot(n1) / scale;
+ const side = new THREE33.Vector3().subVectors(points[opposite2], points[u]).dot(n1) / scale;
weight = side < -0.000000001 ? smoothstep2(threshold / 2, threshold, angle) : 0;
}
for (const id of key.split(":").map(Number))
@@ -26355,12 +26570,12 @@ function hemisphereDirections(count) {
const phi = i * golden;
const x = r * Math.cos(phi);
const y = r * Math.sin(phi);
- return new THREE32.Vector3(x, y, Math.sqrt(Math.max(0, 1 - x * x - y * y)));
+ return new THREE33.Vector3(x, y, Math.sqrt(Math.max(0, 1 - x * x - y * y)));
});
}
function occluderTriangles(occluders, bakedTier) {
const values = [];
- const point = new THREE32.Vector3;
+ const point = new THREE33.Vector3;
for (const mesh of drawnMeshes(occluders)) {
if (!drawn(mesh, null))
continue;
@@ -26424,12 +26639,12 @@ function bakeSurfaceAttributes(target, options = {}) {
let entry = bvhs.get(key);
if (!entry) {
const triangles = occluderTriangles(occluders, tier);
- const box = new THREE32.Box3;
+ const box = new THREE33.Box3;
for (let i = 0;i < triangles.length; i += 3)
- box.expandByPoint(new THREE32.Vector3(triangles[i], triangles[i + 1], triangles[i + 2]));
+ box.expandByPoint(new THREE33.Vector3(triangles[i], triangles[i + 1], triangles[i + 2]));
entry = {
bvh: new TriangleBvh(triangles),
- diagonal: box.isEmpty() ? 0 : box.getSize(new THREE32.Vector3).length()
+ diagonal: box.isEmpty() ? 0 : box.getSize(new THREE33.Vector3).length()
};
bvhs.set(key, entry);
}
@@ -26446,27 +26661,27 @@ function bakeSurfaceAttributes(target, options = {}) {
const welded = bakeEdge(topology, thresholdDegrees, smoothing);
const values = new Float32Array(sourceCount);
for (let i = 0;i < sourceCount; i++)
- values[i] = THREE32.MathUtils.clamp(welded[topology.ids[i]], 0, 1);
- geometry.setAttribute("_edge", new THREE32.BufferAttribute(values, 1));
+ values[i] = THREE33.MathUtils.clamp(welded[topology.ids[i]], 0, 1);
+ geometry.setAttribute("_edge", new THREE33.BufferAttribute(values, 1));
record._EDGE = { thresholdDegrees, smoothing };
}
if (cavityOptions) {
const { bvh, diagonal } = occlusion(tierOf(mesh));
const radius = cavityOptions.radius ?? SURFACE_BAKE_DEFAULTS.cavity.radiusFactor * diagonal;
const epsilon = Math.max(diagonal * 0.00001, 0.0000001);
- const normals = topology.points.map(() => new THREE32.Vector3);
+ const normals = topology.points.map(() => new THREE33.Vector3);
const { points, triangles } = topology;
for (let t = 0;t < triangles.length; t += 3) {
const a = points[triangles[t]];
- const face = new THREE32.Vector3().subVectors(points[triangles[t + 1]], a).cross(new THREE32.Vector3().subVectors(points[triangles[t + 2]], a));
+ const face = new THREE33.Vector3().subVectors(points[triangles[t + 1]], a).cross(new THREE33.Vector3().subVectors(points[triangles[t + 2]], a));
for (let k = 0;k < 3; k++)
normals[triangles[t + k]].add(face);
}
const exposure = new Float64Array(points.length);
- const tangent = new THREE32.Vector3;
- const bitangent = new THREE32.Vector3;
- const origin = new THREE32.Vector3;
- const direction = new THREE32.Vector3;
+ const tangent = new THREE33.Vector3;
+ const bitangent = new THREE33.Vector3;
+ const origin = new THREE33.Vector3;
+ const direction = new THREE33.Vector3;
points.forEach((point, id) => {
const normal = normals[id];
if (normal.lengthSq() === 0) {
@@ -26488,8 +26703,8 @@ function bakeSurfaceAttributes(target, options = {}) {
});
const values = new Float32Array(sourceCount);
for (let i = 0;i < sourceCount; i++)
- values[i] = THREE32.MathUtils.clamp(exposure[topology.ids[i]], 0, 1);
- geometry.setAttribute("_cavity", new THREE32.BufferAttribute(values, 1));
+ values[i] = THREE33.MathUtils.clamp(exposure[topology.ids[i]], 0, 1);
+ geometry.setAttribute("_cavity", new THREE33.BufferAttribute(values, 1));
record._CAVITY = { rays, radius };
}
geometry.userData = { ...geometry.userData, [SURFACE_BAKE_KEY]: record };
@@ -26509,7 +26724,7 @@ function surfaceBakeRecord(geometry) {
return record;
}
var SURFACE_ATTRIBUTES, SURFACE_BAKE_KEY = "kilnSurfaceBakeV1", SURFACE_BAKE_DEFAULTS, isObject3D2 = (value) => value?.isObject3D === true, smoothstep2 = (edge0, edge1, x) => {
- const t = THREE32.MathUtils.clamp((x - edge0) / (edge1 - edge0), 0, 1);
+ const t = THREE33.MathUtils.clamp((x - edge0) / (edge1 - edge0), 0, 1);
return t * t * (3 - 2 * t);
};
var init_surface_bake = __esm(() => {
@@ -27109,16 +27324,16 @@ function buildWallPanels(length, height, thickness, apertures) {
}
// src/assembly-transform.ts
-import * as THREE33 from "three";
+import * as THREE34 from "three";
function checkedTrs(matrix, label) {
const e = matrix.elements;
if (!e.every(Number.isFinite) || e[3] !== 0 || e[7] !== 0 || e[11] !== 0 || Math.abs(e[15] - 1) > 16 * Number.EPSILON)
throw new Error(`${label}: finite affine TRS is required.`);
if (!Number.isFinite(matrix.determinant()) || matrix.determinant() === 0)
throw new Error(`${label}: singular/zero-scale transforms are unsupported.`);
- const position = new THREE33.Vector3, quaternion = new THREE33.Quaternion, scale = new THREE33.Vector3;
+ const position = new THREE34.Vector3, quaternion = new THREE34.Quaternion, scale = new THREE34.Vector3;
matrix.decompose(position, quaternion, scale);
- const rebuilt = new THREE33.Matrix4().compose(position, quaternion, scale);
+ const rebuilt = new THREE34.Matrix4().compose(position, quaternion, scale);
if (rebuilt.elements.some((value, i) => !Number.isFinite(value) || Math.abs(value - e[i]) > 0.00000001 * Math.max(1, Math.abs(e[i]))))
throw new Error(`${label}: local shear cannot be represented losslessly as TRS.`);
return { position, quaternion, scale };
@@ -27126,7 +27341,7 @@ function checkedTrs(matrix, label) {
var init_assembly_transform = () => {};
// src/assembly.ts
-import * as THREE34 from "three";
+import * as THREE35 from "three";
function jsonData(value, label, ancestors = new Set) {
if (value === null || typeof value === "string" || typeof value === "boolean")
return;
@@ -27173,7 +27388,7 @@ function knownMetadata(source, parsed, label) {
throw new Error(`${label}: unsupported fields in known metadata would be lost during remapping.`);
}
function localMatrix(node) {
- return node.matrixAutoUpdate ? new THREE34.Matrix4().compose(node.position, node.quaternion, node.scale) : node.matrix.clone();
+ return node.matrixAutoUpdate ? new THREE35.Matrix4().compose(node.position, node.quaternion, node.scale) : node.matrix.clone();
}
function worldMatrix2(node) {
const chain = [], seen = new Set;
@@ -27183,7 +27398,7 @@ function worldMatrix2(node) {
seen.add(cursor);
chain.push(cursor);
}
- const result = new THREE34.Matrix4;
+ const result = new THREE35.Matrix4;
for (const entry of chain.reverse())
result.multiply(localMatrix(entry));
return result;
@@ -27199,7 +27414,7 @@ function census(root) {
const stack = [root];
while (stack.length) {
const node = stack.pop();
- if (!(node instanceof THREE34.Object3D) || ![THREE34.Object3D, THREE34.Group, THREE34.Mesh].includes(node.constructor))
+ if (!(node instanceof THREE35.Object3D) || ![THREE35.Object3D, THREE35.Group, THREE35.Mesh].includes(node.constructor))
throw new Error("Unsupported assembly node: only ordinary Object3D, Group and Mesh hierarchies are qualified; no skins, instances or custom node classes.");
if (matrices.has(node))
throw new Error("Assembly must be a tree; duplicate/cyclic children are unsupported.");
@@ -27215,21 +27430,21 @@ function census(root) {
checkedTrs(matrix, node.name || "unnamed node");
nodes.push(node);
matrices.set(node, matrix);
- if (node.onBeforeRender !== THREE34.Object3D.prototype.onBeforeRender || node.onAfterRender !== THREE34.Object3D.prototype.onAfterRender || node.onBeforeShadow !== THREE34.Object3D.prototype.onBeforeShadow || node.onAfterShadow !== THREE34.Object3D.prototype.onAfterShadow)
+ if (node.onBeforeRender !== THREE35.Object3D.prototype.onBeforeRender || node.onAfterRender !== THREE35.Object3D.prototype.onAfterRender || node.onBeforeShadow !== THREE35.Object3D.prototype.onBeforeShadow || node.onAfterShadow !== THREE35.Object3D.prototype.onAfterShadow)
throw new Error("Custom node render callbacks are unsupported in assembly replication.");
- if (node instanceof THREE34.Mesh) {
- if (!(node.geometry instanceof THREE34.BufferGeometry) || node.geometry instanceof THREE34.InstancedBufferGeometry)
+ if (node instanceof THREE35.Mesh) {
+ if (!(node.geometry instanceof THREE35.BufferGeometry) || node.geometry instanceof THREE35.InstancedBufferGeometry)
throw new Error("Unsupported assembly geometry type.");
if (Object.values(node.geometry.morphAttributes).some((attributes) => attributes?.length) || node.morphTargetInfluences?.length)
throw new Error("Assembly morph target replication is unsupported.");
const materials = Array.isArray(node.material) ? node.material : [node.material];
- if (materials.length === 0 || materials.some((material) => !(material instanceof THREE34.Material)))
+ if (materials.length === 0 || materials.some((material) => !(material instanceof THREE35.Material)))
throw new Error("Assembly mesh materials must be Material instances.");
}
if (!object(node.userData))
throw new Error("Assembly node metadata must be an object.");
jsonData(node.userData, node.name);
- if (!Array.isArray(node.animations) || node.animations.some((clip) => !(clip instanceof THREE34.AnimationClip)))
+ if (!Array.isArray(node.animations) || node.animations.some((clip) => !(clip instanceof THREE35.AnimationClip)))
throw new Error("Assembly node animations must contain AnimationClip instances.");
if (node.userData[KILN_SEMANTIC_EXTRAS_KEY] !== undefined) {
const metadata = readSemanticMetadataV1(node);
@@ -27270,11 +27485,11 @@ function describeAssembly(root, options = {}) {
const state = census(root), roles = new Map;
const frames = [], sockets = [], joints = [], materials = [];
const relative = new Map;
- const bounds = new THREE34.Box3, point = new THREE34.Vector3;
+ const bounds = new THREE35.Box3, point = new THREE35.Vector3;
let positionSamples = 0;
for (const [index, node] of state.nodes.entries()) {
const nodeId = `n${index}`;
- const matrix = node === root ? new THREE34.Matrix4 : relative.get(node.parent).clone().multiply(state.matrices.get(node));
+ const matrix = node === root ? new THREE35.Matrix4 : relative.get(node.parent).clone().multiply(state.matrices.get(node));
relative.set(node, matrix);
const metadata = state.semantics.get(node);
const descriptor = state.joints.get(node);
@@ -27296,7 +27511,7 @@ function describeAssembly(root, options = {}) {
for (const role of metadata?.roles ?? [])
addIndex(roles, role, node);
for (const frame of metadata?.frames ?? []) {
- const local = new THREE34.Matrix4().compose(new THREE34.Vector3(...frame.translation), new THREE34.Quaternion(...frame.rotation), new THREE34.Vector3(1, 1, 1));
+ const local = new THREE35.Matrix4().compose(new THREE35.Vector3(...frame.translation), new THREE35.Quaternion(...frame.rotation), new THREE35.Vector3(1, 1, 1));
frames.push({
node,
nodeId,
@@ -27306,7 +27521,7 @@ function describeAssembly(root, options = {}) {
}
for (const socket of metadata?.sockets ?? [])
sockets.push({ node, nodeId, socket: structuredClone(socket) });
- if (!(node instanceof THREE34.Mesh))
+ if (!(node instanceof THREE35.Mesh))
continue;
for (const [materialIndex, material] of (Array.isArray(node.material) ? node.material : [node.material]).entries())
materials.push({ node, nodeId, index: materialIndex, material });
@@ -27341,7 +27556,7 @@ function describeAssembly(root, options = {}) {
space: "root-local",
min: bounds.min.toArray(),
max: bounds.max.toArray(),
- size: bounds.getSize(new THREE34.Vector3).toArray()
+ size: bounds.getSize(new THREE35.Vector3).toArray()
},
clips,
ownership: {
@@ -27380,7 +27595,7 @@ function replicateAssembly(source, options) {
if (value !== undefined && !choices.includes(value))
throw new Error(`Unsupported assembly ${key} policy.`);
}
- if (options.parent !== undefined && !(options.parent instanceof THREE34.Object3D))
+ if (options.parent !== undefined && !(options.parent instanceof THREE35.Object3D))
throw new Error("Assembly parent must be an Object3D.");
const fresh = describeAssembly(source.root, { clips: source.clips }), state = census(source.root);
if (options.parent && state.nodes.includes(options.parent))
@@ -27413,16 +27628,16 @@ function replicateAssembly(source, options) {
throw new Error(`Unsupported custom metadata ${key} on ${node.name}; use copy-json only for inert data whose references you own.`);
}
jsonData(node.userData, node.name);
- if (node instanceof THREE34.Mesh) {
+ if (node instanceof THREE35.Mesh) {
if (options.geometry === "copy") {
jsonData(node.geometry.userData, `${node.name} geometry`);
- if (node.geometry.clone !== THREE34.BufferGeometry.prototype.clone || !threeConstructors.has(node.geometry.constructor))
+ if (node.geometry.clone !== THREE35.BufferGeometry.prototype.clone || !threeConstructors.has(node.geometry.constructor))
throw new Error("Copying custom geometry classes/clone implementations is unsupported; explicitly share the resource.");
}
if (options.materials === "copy")
for (const material of Array.isArray(node.material) ? node.material : [node.material]) {
jsonData(material.userData, `${node.name} material`);
- if (material.onBeforeCompile !== THREE34.Material.prototype.onBeforeCompile || material.onBeforeRender !== THREE34.Material.prototype.onBeforeRender || material.clone !== THREE34.Material.prototype.clone || !threeConstructors.has(material.constructor) || material.customProgramCacheKey !== THREE34.Material.prototype.customProgramCacheKey || material instanceof THREE34.ShaderMaterial)
+ if (material.onBeforeCompile !== THREE35.Material.prototype.onBeforeCompile || material.onBeforeRender !== THREE35.Material.prototype.onBeforeRender || material.clone !== THREE35.Material.prototype.clone || !threeConstructors.has(material.constructor) || material.customProgramCacheKey !== THREE35.Material.prototype.customProgramCacheKey || material instanceof THREE35.ShaderMaterial)
throw new Error("Copying custom/shader materials is unsupported; explicit sharing preserves their existing implementation.");
}
}
@@ -27510,9 +27725,9 @@ function replicateAssembly(source, options) {
const trackTargets = new Map;
const animatedNodes = new Set;
for (const clip of fresh.clips) {
- if (!(clip instanceof THREE34.AnimationClip))
+ if (!(clip instanceof THREE35.AnimationClip))
throw new Error("Assembly clips must be AnimationClip instances.");
- if (clip.blendMode !== THREE34.NormalAnimationBlendMode)
+ if (clip.blendMode !== THREE35.NormalAnimationBlendMode)
throw new Error("Additive/other animation blend modes are unsupported in assembly replication.");
jsonData(clip.userData, `Clip ${clip.name}`);
if (Object.keys(clip.userData).length && options.unknownMetadata !== "copy-json")
@@ -27539,7 +27754,7 @@ function replicateAssembly(source, options) {
if (options.space === "world") {
if (state.joints.has(source.root))
throw new Error("World placement of a declared joint root requires rest-transform rebasing; wrap it in an assembly root or use local placement.");
- const parentWorld = options.parent ? worldMatrix2(options.parent) : new THREE34.Matrix4;
+ const parentWorld = options.parent ? worldMatrix2(options.parent) : new THREE35.Matrix4;
if (!Number.isFinite(parentWorld.determinant()) || parentWorld.determinant() === 0)
throw new Error("World placement requires an invertible, nonsingular parent transform.");
rootMatrix = parentWorld.invert().multiply(worldMatrix2(source.root));
@@ -27580,7 +27795,7 @@ function replicateAssembly(source, options) {
return materials.get(material);
};
for (const node of state.nodes) {
- const copy = node instanceof THREE34.Mesh ? new THREE34.Mesh(node.geometry, node.material) : node instanceof THREE34.Group ? new THREE34.Group : new THREE34.Object3D;
+ const copy = node instanceof THREE35.Mesh ? new THREE35.Mesh(node.geometry, node.material) : node instanceof THREE35.Group ? new THREE35.Group : new THREE35.Object3D;
copy.copy(node, false);
copy.name = names.get(node);
copy.animations = [];
@@ -27593,7 +27808,7 @@ function replicateAssembly(source, options) {
}
copy.matrix.copy(matrix);
copy.matrixWorldNeedsUpdate = true;
- if (node instanceof THREE34.Mesh && copy instanceof THREE34.Mesh) {
+ if (node instanceof THREE35.Mesh && copy instanceof THREE35.Mesh) {
if (options.geometry === "copy") {
if (!geometries.has(node.geometry))
geometries.set(node.geometry, node.geometry.clone());
@@ -27658,7 +27873,7 @@ var init_assembly = __esm(() => {
KILN_CHARACTER_JOINT_EXTRAS_KEY,
KILN_CHARACTER_RIG_EXTRAS_KEY
]);
- threeConstructors = new Set(Object.values(THREE34));
+ threeConstructors = new Set(Object.values(THREE35));
});
// src/palette-check.ts
@@ -28199,7 +28414,7 @@ var init_budget = __esm(() => {
});
// src/animation-cubic.ts
-import * as THREE35 from "three";
+import * as THREE36 from "three";
function useCubicSpline(track) {
track.createInterpolant = cubicSplineFactory;
return track;
@@ -28207,7 +28422,7 @@ function useCubicSpline(track) {
var CubicSplineInterpolant, CubicSplineQuaternionInterpolant, cubicSplineFactory;
var init_animation_cubic = __esm(() => {
init_animation_spline();
- CubicSplineInterpolant = class CubicSplineInterpolant extends THREE35.Interpolant {
+ CubicSplineInterpolant = class CubicSplineInterpolant extends THREE36.Interpolant {
copySampleValue_(index) {
const result = this.resultBuffer;
const size = this.valueSize;
@@ -28235,7 +28450,7 @@ var init_animation_cubic = __esm(() => {
});
// src/architecture.ts
-import * as THREE36 from "three";
+import * as THREE37 from "three";
function positive4(value, name) {
if (!Number.isFinite(value) || value <= 0)
throw new RangeError(`${name} must be finite and > 0`);
@@ -28300,17 +28515,17 @@ function buildFace(roofRoot, profile, sideSign) {
const verticalRun = profile.ridgeY - profile.eaveY;
const downhillLength = Math.hypot(horizontalRun, verticalRun);
const alongRidge = (profile.ridgeAxis === "x" ? profile.spanX : profile.spanZ) + profile.overhang * 2;
- const downhill = profile.ridgeAxis === "x" ? new THREE36.Vector3(0, -verticalRun, sideSign * horizontalRun).normalize() : new THREE36.Vector3(sideSign * horizontalRun, -verticalRun, 0).normalize();
- const tangent = profile.ridgeAxis === "x" ? new THREE36.Vector3(sideSign, 0, 0) : new THREE36.Vector3(0, 0, -sideSign);
+ const downhill = profile.ridgeAxis === "x" ? new THREE37.Vector3(0, -verticalRun, sideSign * horizontalRun).normalize() : new THREE37.Vector3(sideSign * horizontalRun, -verticalRun, 0).normalize();
+ const tangent = profile.ridgeAxis === "x" ? new THREE37.Vector3(sideSign, 0, 0) : new THREE37.Vector3(0, 0, -sideSign);
const normal = downhill.clone().cross(tangent).normalize();
- const localToRoof = new THREE36.Matrix4().makeBasis(tangent, normal, downhill);
+ const localToRoof = new THREE37.Matrix4().makeBasis(tangent, normal, downhill);
localToRoof.setPosition(0, profile.ridgeY, 0);
const world = () => {
roofRoot.updateWorldMatrix(true, false);
return roofRoot.matrixWorld.clone().multiply(localToRoof);
};
const direction = (axis) => axis.clone().transformDirection(world());
- const point = (x, z) => new THREE36.Vector3(x, 0, z).applyMatrix4(world());
+ const point = (x, z) => new THREE37.Vector3(x, 0, z).applyMatrix4(world());
return {
side,
ridgeAxis: profile.ridgeAxis,
@@ -28320,13 +28535,13 @@ function buildFace(roofRoot, profile, sideSign) {
return world();
},
get ridgeTangent() {
- return direction(new THREE36.Vector3(1, 0, 0));
+ return direction(new THREE37.Vector3(1, 0, 0));
},
get downhillDirection() {
- return direction(new THREE36.Vector3(0, 0, 1));
+ return direction(new THREE37.Vector3(0, 0, 1));
},
get outwardNormal() {
- return direction(new THREE36.Vector3(0, 1, 0));
+ return direction(new THREE37.Vector3(0, 1, 0));
},
get ridgeStart() {
return point(-alongRidge / 2, 0);
@@ -28344,17 +28559,17 @@ function buildFace(roofRoot, profile, sideSign) {
};
}
function buildRoof(name, material, profile, parent) {
- const root = new THREE36.Object3D;
+ const root = new THREE37.Object3D;
root.name = name;
if (parent)
parent.add(root);
stampSemanticMetadataV1(root, roleMetadata([semanticRole(KILN_SEMANTIC_ROLES.roof, "assembly")], [relationship("separable-from", "architecture.shell.gable")]));
const faces = [buildFace(root, profile, 1), buildFace(root, profile, -1)];
const buildSlope = (face) => {
- const geometry = new THREE36.BoxGeometry(face.dimensions.alongRidge, profile.thickness, face.dimensions.downhill);
- const mesh = new THREE36.Mesh(geometry, material);
+ const geometry = new THREE37.BoxGeometry(face.dimensions.alongRidge, profile.thickness, face.dimensions.downhill);
+ const mesh = new THREE37.Mesh(geometry, material);
mesh.name = `Mesh_${name}_${face.side}`;
- const center = new THREE36.Matrix4().makeTranslation(0, -profile.thickness / 2, face.dimensions.downhill / 2);
+ const center = new THREE37.Matrix4().makeTranslation(0, -profile.thickness / 2, face.dimensions.downhill / 2);
setTransform(mesh, face.localToRoof.clone().multiply(center));
const coveredWall = profile.ridgeAxis === "x" ? face.side === "positive" ? "wall.right" : "wall.left" : face.side === "positive" ? "wall.front" : "wall.back";
stampSemanticMetadataV1(mesh, roleMetadata([semanticRole(KILN_SEMANTIC_ROLES.roof, "slope", face.side)], [
@@ -28424,7 +28639,7 @@ function createGableEndPanel(name, material, options) {
const ridgeAxis = options.ridgeAxis ?? "x";
const side = options.side ?? "positive";
const half = span / 2;
- const shape = new THREE36.Shape;
+ const shape = new THREE37.Shape;
shape.moveTo(-half, 0);
shape.lineTo(half, 0);
shape.lineTo(0, rise);
@@ -28443,7 +28658,7 @@ function createGableEndPanel(name, material, options) {
const right = opening.offset + opening.width / 2;
const bottom = opening.bottom;
const top = bottom + opening.height;
- const hole = new THREE36.Path;
+ const hole = new THREE37.Path;
hole.moveTo(left, bottom);
hole.lineTo(left, top);
hole.lineTo(right, top);
@@ -28451,7 +28666,7 @@ function createGableEndPanel(name, material, options) {
hole.closePath();
shape.holes.push(hole);
}
- const geometry = new THREE36.ExtrudeGeometry(shape, {
+ const geometry = new THREE37.ExtrudeGeometry(shape, {
depth: thickness,
bevelEnabled: false,
steps: 1
@@ -28460,7 +28675,7 @@ function createGableEndPanel(name, material, options) {
if (ridgeAxis === "x")
geometry.rotateY(-Math.PI / 2);
geometry.computeVertexNormals();
- const root = new THREE36.Mesh(geometry, material);
+ const root = new THREE37.Mesh(geometry, material);
root.name = `Mesh_${name}`;
stampSemanticMetadataV1(root, roleMetadata([`roof.gable.${side}`], [
relationship("adjacent-to", "roof.slope.positive"),
@@ -28476,7 +28691,7 @@ function createGableEndPanel(name, material, options) {
}
]));
const markers = normalized.map((opening, index) => {
- const marker = new THREE36.Object3D;
+ const marker = new THREE37.Object3D;
marker.name = `Opening_${name}_${opening.id ?? index + 1}`;
marker.position.set(ridgeAxis === "z" ? opening.offset : 0, opening.bottom + opening.height / 2, ridgeAxis === "x" ? opening.offset : 0);
marker.scale.set(ridgeAxis === "x" ? thickness : opening.width, opening.height, ridgeAxis === "x" ? opening.width : thickness);
@@ -28496,7 +28711,7 @@ function wallNeighbors(wall) {
}
function createShellWall(name, wall, material, length, height, thickness, openings) {
const axis = wallRunAxis(wall);
- const root = new THREE36.Object3D;
+ const root = new THREE37.Object3D;
root.name = `${name}_Wall_${wall}`;
const neighbors = wallNeighbors(wall);
stampSemanticMetadataV1(root, roleMetadata([`wall.${wall}`], [
@@ -28508,8 +28723,8 @@ function createShellWall(name, wall, material, length, height, thickness, openin
const panel = (suffix, lo, hi, y0, y1) => {
if (hi <= lo || y1 <= y0)
return;
- const geometry = axis === "x" ? new THREE36.BoxGeometry(hi - lo, y1 - y0, thickness) : new THREE36.BoxGeometry(thickness, y1 - y0, hi - lo);
- const mesh = new THREE36.Mesh(geometry, material);
+ const geometry = axis === "x" ? new THREE37.BoxGeometry(hi - lo, y1 - y0, thickness) : new THREE37.BoxGeometry(thickness, y1 - y0, hi - lo);
+ const mesh = new THREE37.Mesh(geometry, material);
mesh.name = `Mesh_${name}_${wall}_${suffix}`;
mesh.position.set(axis === "x" ? (lo + hi) / 2 : 0, (y0 + y1) / 2, axis === "z" ? (lo + hi) / 2 : 0);
root.add(mesh);
@@ -28526,7 +28741,7 @@ function createShellWall(name, wall, material, length, height, thickness, openin
panel(singleNames[segment.suffix] ?? segment.suffix.slice(1), segment.left, segment.right, segment.bottom, segment.top);
}
for (const opening of built.openings) {
- const marker = new THREE36.Object3D;
+ const marker = new THREE37.Object3D;
marker.name = `Opening_${wall}_${opening.id}`;
marker.position.set(axis === "x" ? opening.offset : 0, opening.sill + opening.height / 2, axis === "z" ? opening.offset : 0);
marker.scale.set(axis === "x" ? opening.width : opening.depth, opening.height, axis === "z" ? opening.width : opening.depth);
@@ -28549,7 +28764,7 @@ function createGableShell(name, materials, options) {
const closedEnds = options.closedEnds ?? true;
const enterable = options.enterable ?? true;
const shellOpenings = options.openings ?? (enterable ? [{ wall: "front", kind: "door" }] : []);
- const root = new THREE36.Object3D;
+ const root = new THREE37.Object3D;
root.name = name;
stampSemanticMetadataV1(root, roleMetadata(["architecture.shell.gable"], [relationship("contains", "floor"), relationship("contains", "roof.assembly")]));
const wallSpecs = {
@@ -28567,7 +28782,7 @@ function createGableShell(name, materials, options) {
walls[wall] = built.root;
openingMarkers.push(...built.openings);
}
- const floor = new THREE36.Mesh(new THREE36.BoxGeometry(spanX, floorThickness, spanZ), materials.floor ?? materials.wall);
+ const floor = new THREE37.Mesh(new THREE37.BoxGeometry(spanX, floorThickness, spanZ), materials.floor ?? materials.wall);
floor.name = `Mesh_${name}_Floor`;
floor.position.y = -floorThickness / 2;
stampSemanticMetadataV1(floor, roleMetadata(["floor"], ["front", "back", "left", "right"].map((wall) => relationship("adjacent-to", `wall.${wall}`))));
@@ -28682,13 +28897,13 @@ function createRoofSurfaceLayout(name, material, options) {
assertDimension("createRoofSurfaceLayout generated width", spec.width);
assertDimension("createRoofSurfaceLayout generated length", spec.length);
}
- const root = new THREE36.Object3D;
+ const root = new THREE37.Object3D;
root.name = name;
stampSemanticMetadataV1(root, roleMetadata([`roof.surface.${options.kind}`], [relationship("coverage-of", `roof.slope.${options.face.side}`)]));
const items = specs.map((spec, index) => {
- const mesh = new THREE36.Mesh(new THREE36.BoxGeometry(spec.width, thickness, spec.length), material);
+ const mesh = new THREE37.Mesh(new THREE37.BoxGeometry(spec.width, thickness, spec.length), material);
mesh.name = `Mesh_${name}_${index + 1}`;
- const local = new THREE36.Matrix4().makeTranslation(spec.x, thickness / 2 + 0.002, spec.z);
+ const local = new THREE37.Matrix4().makeTranslation(spec.x, thickness / 2 + 0.002, spec.z);
setTransform(mesh, faceToRoot.clone().multiply(local));
root.add(mesh);
return mesh;
@@ -28705,7 +28920,7 @@ var init_architecture2 = __esm(() => {
});
// src/gears.ts
-import * as THREE37 from "three";
+import * as THREE38 from "three";
function gearGeo(opts = {}) {
const {
teeth = 12,
@@ -28804,8 +29019,8 @@ function gearGeo(opts = {}) {
indices.push(tA, bA, bB);
indices.push(tA, bB, tB);
}
- const geo = new THREE37.BufferGeometry;
- geo.setAttribute("position", new THREE37.Float32BufferAttribute(positions, 3));
+ const geo = new THREE38.BufferGeometry;
+ geo.setAttribute("position", new THREE38.Float32BufferAttribute(positions, 3));
geo.setIndex(indices);
const nonIndexed = geo.toNonIndexed();
nonIndexed.computeVertexNormals();
@@ -28890,8 +29105,8 @@ function bladeGeo(opts = {}) {
indices.push(count + i, tip, count + j);
}
}
- const geo = new THREE37.BufferGeometry;
- geo.setAttribute("position", new THREE37.Float32BufferAttribute(positions, 3));
+ const geo = new THREE38.BufferGeometry;
+ geo.setAttribute("position", new THREE38.Float32BufferAttribute(positions, 3));
geo.setIndex(indices);
const nonIndexed = geo.toNonIndexed();
nonIndexed.computeVertexNormals();
@@ -28903,7 +29118,7 @@ var init_gears = __esm(() => {
});
// src/ops.ts
-import * as THREE38 from "three";
+import * as THREE39 from "three";
import { LoopSubdivision } from "three-subdivide/build/index.module.js";
import { mergeVertices as threeMergeVertices } from "three/examples/jsm/utils/BufferGeometryUtils.js";
function assertFiniteSourceFrame(name, source) {
@@ -28937,9 +29152,9 @@ function arrayLinear(namePrefix, source, count, offset, parent) {
}
function degreesOf(euler) {
return [
- THREE38.MathUtils.radToDeg(euler.x),
- THREE38.MathUtils.radToDeg(euler.y),
- THREE38.MathUtils.radToDeg(euler.z)
+ THREE39.MathUtils.radToDeg(euler.x),
+ THREE39.MathUtils.radToDeg(euler.y),
+ THREE39.MathUtils.radToDeg(euler.z)
];
}
function arrayRadial(namePrefix, source, count, axis = "y", parent, center, options = {}) {
@@ -28952,12 +29167,12 @@ function arrayRadial(namePrefix, source, count, axis = "y", parent, center, opti
if (center)
assertFiniteTriple("arrayRadial center", center);
const out = [];
- const pivot = center ? new THREE38.Vector3(...center) : new THREE38.Vector3;
+ const pivot = center ? new THREE39.Vector3(...center) : new THREE39.Vector3;
const basePos = source.position.clone().sub(pivot);
- const axisVec = axis === "x" ? new THREE38.Vector3(1, 0, 0) : axis === "z" ? new THREE38.Vector3(0, 0, 1) : new THREE38.Vector3(0, 1, 0);
+ const axisVec = axis === "x" ? new THREE39.Vector3(1, 0, 0) : axis === "z" ? new THREE39.Vector3(0, 0, 1) : new THREE39.Vector3(0, 1, 0);
const positions = [];
for (let i = 1;i < count; i++) {
- const position = basePos.clone().applyMatrix4(new THREE38.Matrix4().makeRotationAxis(axisVec, i / count * Math.PI * 2)).add(pivot);
+ const position = basePos.clone().applyMatrix4(new THREE39.Matrix4().makeRotationAxis(axisVec, i / count * Math.PI * 2)).add(pivot);
assertFiniteTriple("arrayRadial resulting position", position.toArray());
positions.push(position);
}
@@ -28996,7 +29211,7 @@ function repeatAlongCurve(source, points, options) {
assertFiniteTriple(`${name} points[${i}]`, point);
const up = options.up ?? [0, 1, 0];
assertFiniteTriple(`${name} up`, up);
- const upVector = new THREE38.Vector3(...up);
+ const upVector = new THREE39.Vector3(...up);
if (upVector.lengthSq() === 0)
throw new RangeError(`${name} up must not be zero.`);
upVector.normalize();
@@ -29035,13 +29250,13 @@ function repeatAlongCurve(source, points, options) {
segment++;
while (segment < points.length - 2 && cumulative[segment + 1] === cumulative[segment])
segment++;
- const a = new THREE38.Vector3(...points[segment]);
- const b = new THREE38.Vector3(...points[segment + 1]);
+ const a = new THREE39.Vector3(...points[segment]);
+ const b = new THREE39.Vector3(...points[segment + 1]);
const segmentLength = cumulative[segment + 1] - cumulative[segment];
const local = segmentLength > 0 ? (s - cumulative[segment]) / segmentLength : 0;
const position = a.clone().lerp(b, Math.min(Math.max(local, 0), 1));
- const k = THREE38.MathUtils.lerp(scale[0], scale[1], t);
- const rotation = new THREE38.Matrix4;
+ const k = THREE39.MathUtils.lerp(scale[0], scale[1], t);
+ const rotation = new THREE39.Matrix4;
let angle = 0;
if (align === "tangent") {
const tangent = b.clone().sub(a).normalize();
@@ -29049,17 +29264,17 @@ function repeatAlongCurve(source, points, options) {
if (side.lengthSq() < 0.000000000001)
side = previousUp.clone().sub(tangent.clone().multiplyScalar(previousUp.dot(tangent)));
if (side.lengthSq() < 0.000000000001)
- side = new THREE38.Vector3(Math.abs(tangent.x) < 0.9 ? 1 : 0, Math.abs(tangent.x) < 0.9 ? 0 : 1, 0).sub(tangent.clone().multiplyScalar(Math.abs(tangent.x) < 0.9 ? tangent.x : tangent.y));
+ side = new THREE39.Vector3(Math.abs(tangent.x) < 0.9 ? 1 : 0, Math.abs(tangent.x) < 0.9 ? 0 : 1, 0).sub(tangent.clone().multiplyScalar(Math.abs(tangent.x) < 0.9 ? tangent.x : tangent.y));
side.normalize();
previousUp = side;
- rotation.makeBasis(tangent, side, new THREE38.Vector3().crossVectors(tangent, side));
- angle = THREE38.MathUtils.degToRad(THREE38.MathUtils.lerp(twist[0], twist[1], t));
+ rotation.makeBasis(tangent, side, new THREE39.Vector3().crossVectors(tangent, side));
+ angle = THREE39.MathUtils.degToRad(THREE39.MathUtils.lerp(twist[0], twist[1], t));
}
for (const extra of opposite ? [0, Math.PI] : [0]) {
const turned = rotation.clone();
if (angle + extra)
- turned.multiply(new THREE38.Matrix4().makeRotationX(angle + extra));
- const matrix = new THREE38.Matrix4().makeTranslation(position.x, position.y, position.z).multiply(turned).multiply(new THREE38.Matrix4().makeScale(k, k, k));
+ turned.multiply(new THREE39.Matrix4().makeRotationX(angle + extra));
+ const matrix = new THREE39.Matrix4().makeTranslation(position.x, position.y, position.z).multiply(turned).multiply(new THREE39.Matrix4().makeScale(k, k, k));
if (!matrix.elements.every(Number.isFinite))
throw new RangeError(`${name} produced a non-finite copy transform.`);
frames.push({ matrix, t });
@@ -29091,9 +29306,9 @@ function repeatAlongCurve(source, points, options) {
const total = perCopy * copies;
if (total > GEOMETRY_ALLOCATION_LIMITS.curveRepeatVertices)
throw new RangeError(`${name} would produce ${total} vertices; the limit is ${GEOMETRY_ALLOCATION_LIMITS.curveRepeatVertices}. Reduce count, simplify the source, or use merge: false.`);
- const merged = new THREE38.BufferGeometry;
- const vector = new THREE38.Vector3;
- const normalMatrix = new THREE38.Matrix3;
+ const merged = new THREE39.BufferGeometry;
+ const vector = new THREE39.Vector3;
+ const normalMatrix = new THREE39.Matrix3;
for (const [key, attribute] of Object.entries(geometry.attributes)) {
const size = attribute.itemSize;
const transformed = key === "position" || key === "normal" || key === "tangent";
@@ -29117,13 +29332,13 @@ function repeatAlongCurve(source, points, options) {
}
}
}
- merged.setAttribute(key, new THREE38.BufferAttribute(out, size, transformed ? false : attribute.normalized));
+ merged.setAttribute(key, new THREE39.BufferAttribute(out, size, transformed ? false : attribute.normalized));
}
if (options.along) {
const along = new Float32Array(total);
for (let copy = 0;copy < copies; copy++)
along.fill(frames[copy].t, copy * perCopy, (copy + 1) * perCopy);
- merged.setAttribute("_along", new THREE38.BufferAttribute(along, 1));
+ merged.setAttribute("_along", new THREE39.BufferAttribute(along, 1));
}
const index = geometry.getIndex();
if (index) {
@@ -29131,7 +29346,7 @@ function repeatAlongCurve(source, points, options) {
for (let copy = 0;copy < copies; copy++)
for (let i = 0;i < index.count; i++)
indices[copy * index.count + i] = index.getX(i) + copy * perCopy;
- merged.setIndex(new THREE38.BufferAttribute(indices, 1));
+ merged.setIndex(new THREE39.BufferAttribute(indices, 1));
}
merged.computeBoundingBox();
merged.computeBoundingSphere();
@@ -29140,15 +29355,15 @@ function repeatAlongCurve(source, points, options) {
function mirror(name, source, axis, parent) {
if (source.matrixAutoUpdate)
source.updateMatrix();
- const reflected = new THREE38.Matrix4().makeScale(axis === "x" ? -1 : 1, axis === "y" ? -1 : 1, axis === "z" ? -1 : 1).multiply(source.matrix);
+ const reflected = new THREE39.Matrix4().makeScale(axis === "x" ? -1 : 1, axis === "y" ? -1 : 1, axis === "z" ? -1 : 1).multiply(source.matrix);
if (!reflected.elements.every(Number.isFinite) || reflected.determinant() === 0) {
throw new RangeError(`mirror("${name}"): source requires a finite, nonsingular local transform.`);
}
- const position = new THREE38.Vector3;
- const quaternion = new THREE38.Quaternion;
- const scale = new THREE38.Vector3;
+ const position = new THREE39.Vector3;
+ const quaternion = new THREE39.Quaternion;
+ const scale = new THREE39.Vector3;
reflected.decompose(position, quaternion, scale);
- const recomposed = new THREE38.Matrix4().compose(position, quaternion, scale);
+ const recomposed = new THREE39.Matrix4().compose(position, quaternion, scale);
if (reflected.elements.some((value, i) => Math.abs(value - recomposed.elements[i]) > 0.00000001 * Math.max(1, Math.abs(value)))) {
throw new RangeError(`mirror("${name}"): local shear cannot be represented by a reflected TRS.`);
}
@@ -29164,13 +29379,13 @@ function mergeVertices(geometry, opts = {}) {
const { tolerance = 0.0001, positionOnly = false } = typeof opts === "number" ? { tolerance: opts } : opts;
if (!positionOnly)
return threeMergeVertices(geometry, tolerance);
- const stripped = new THREE38.BufferGeometry;
+ const stripped = new THREE39.BufferGeometry;
const pos = geometry.getAttribute("position");
if (!pos)
return geometry;
- stripped.setAttribute("position", new THREE38.BufferAttribute(new Float32Array(pos.array), pos.itemSize, pos.normalized));
+ stripped.setAttribute("position", new THREE39.BufferAttribute(new Float32Array(pos.array), pos.itemSize, pos.normalized));
if (geometry.index) {
- stripped.setIndex(new THREE38.BufferAttribute(new Uint32Array(geometry.index.array), 1));
+ stripped.setIndex(new THREE39.BufferAttribute(new Uint32Array(geometry.index.array), 1));
}
return threeMergeVertices(stripped, tolerance);
}
@@ -29205,8 +29420,8 @@ function subdivide(geometry, iterations = 1, opts = {}) {
const { weld = true, preserveUV = false, ...subOpts } = opts;
const prepared = geometry.clone();
prepared.computeBoundingBox();
- const center = prepared.boundingBox.getCenter(new THREE38.Vector3);
- const extent = prepared.boundingBox.getSize(new THREE38.Vector3);
+ const center = prepared.boundingBox.getCenter(new THREE39.Vector3);
+ const extent = prepared.boundingBox.getSize(new THREE39.Vector3);
const size = Math.max(extent.x, extent.y, extent.z);
const normalizationScale = size > 0 ? 1e4 / size : 1;
if (!Number.isFinite(normalizationScale) || !center.toArray().every(Number.isFinite))
@@ -29236,13 +29451,13 @@ function subdivide(geometry, iterations = 1, opts = {}) {
const values = new Float32Array(attribute.count);
for (let i = 0;i < attribute.count; i++)
values[i] = decoded[i * 4 + component];
- input.setAttribute(lane, new THREE38.BufferAttribute(values, 1));
+ input.setAttribute(lane, new THREE39.BufferAttribute(values, 1));
lanes.push(lane);
}
input.deleteAttribute(name);
fourthComponents.push({ name, lanes });
} else
- input.setAttribute(name, new THREE38.BufferAttribute(decoded, components));
+ input.setAttribute(name, new THREE39.BufferAttribute(decoded, components));
}
for (const targets of Object.values(input.morphAttributes))
for (let target = 0;target < targets.length; target++) {
@@ -29251,7 +29466,7 @@ function subdivide(geometry, iterations = 1, opts = {}) {
for (let i = 0;i < attribute.count; i++)
for (let component = 0;component < 3; component++)
decoded[i * 3 + component] = attribute.getComponent(i, component);
- targets[target] = new THREE38.BufferAttribute(decoded, 3);
+ targets[target] = new THREE39.BufferAttribute(decoded, 3);
}
if (preserveUV)
subOpts.uvSmooth = false;
@@ -29265,7 +29480,7 @@ function subdivide(geometry, iterations = 1, opts = {}) {
values[i * 4 + component] = lane.getX(i);
output.deleteAttribute(lanes[component]);
}
- output.setAttribute(name, new THREE38.BufferAttribute(values, 4));
+ output.setAttribute(name, new THREE39.BufferAttribute(values, 4));
}
output.scale(1 / normalizationScale, 1 / normalizationScale, 1 / normalizationScale).translate(center.x, center.y, center.z);
output.userData = structuredClone(geometry.userData);
@@ -29330,9 +29545,9 @@ function assertTubeRadius(radius) {
}
function curveToMesh(points, radius, tubularSegments = 32, radialSegments = 8, closed = false) {
assertTubeRadius(radius);
- const vectors = points.map((p) => new THREE38.Vector3(p[0], p[1], p[2]));
- const curve = new THREE38.CatmullRomCurve3(vectors, closed);
- return new THREE38.TubeGeometry(curve, tubularSegments, radius, radialSegments, closed);
+ const vectors = points.map((p) => new THREE39.Vector3(p[0], p[1], p[2]));
+ const curve = new THREE39.CatmullRomCurve3(vectors, closed);
+ return new THREE39.TubeGeometry(curve, tubularSegments, radius, radialSegments, closed);
}
function normalizeSurfaceNormals(geo) {
const normal = geo.getAttribute("normal");
@@ -29363,15 +29578,15 @@ function lathe(profile, segments = 12) {
}
function revolveGeo(profile, options = {}) {
const { angle = Math.PI * 2, axis = [0, 1, 0], segments = 12 } = options;
- const points2d = profile.map((p) => new THREE38.Vector2(p[0], p[1]));
- const geo = normalizeSurfaceNormals(new THREE38.LatheGeometry(points2d, segments, 0, angle));
- const n = new THREE38.Vector3(axis[0], axis[1], axis[2]);
+ const points2d = profile.map((p) => new THREE39.Vector2(p[0], p[1]));
+ const geo = normalizeSurfaceNormals(new THREE39.LatheGeometry(points2d, segments, 0, angle));
+ const n = new THREE39.Vector3(axis[0], axis[1], axis[2]);
if (n.lengthSq() < 0.000000000001) {
throw new Error(`revolveGeo: axis must be a non-zero vector (got [${axis.join(",")}]).`);
}
n.normalize();
if (n.x !== 0 || n.y !== 1 || n.z !== 0) {
- const q = new THREE38.Quaternion().setFromUnitVectors(new THREE38.Vector3(0, 1, 0), n);
+ const q = new THREE39.Quaternion().setFromUnitVectors(new THREE39.Vector3(0, 1, 0), n);
geo.applyQuaternion(q);
}
return geo;
@@ -29387,9 +29602,9 @@ function pipeAlongPath(points, radius, options = {}) {
const smoothed = [];
smoothed.push(points[0]);
for (let i = 1;i < points.length - 1; i++) {
- const prev = new THREE38.Vector3(...points[i - 1]);
- const cur = new THREE38.Vector3(...points[i]);
- const next = new THREE38.Vector3(...points[i + 1]);
+ const prev = new THREE39.Vector3(...points[i - 1]);
+ const cur = new THREE39.Vector3(...points[i]);
+ const next = new THREE39.Vector3(...points[i + 1]);
const inDir = cur.clone().sub(prev);
const outDir = next.clone().sub(cur);
const inLen = inDir.length();
@@ -29407,12 +29622,12 @@ function pipeAlongPath(points, radius, options = {}) {
return curveToMesh(pathPoints, radius, tubularSegments, radialSegments, closed);
}
function bezierCurve(controlPoints, samples = 32) {
- const vecs = controlPoints.map((p) => new THREE38.Vector3(p[0], p[1], p[2]));
+ const vecs = controlPoints.map((p) => new THREE39.Vector3(p[0], p[1], p[2]));
let curve;
if (vecs.length === 3) {
- curve = new THREE38.QuadraticBezierCurve3(vecs[0], vecs[1], vecs[2]);
+ curve = new THREE39.QuadraticBezierCurve3(vecs[0], vecs[1], vecs[2]);
} else if (vecs.length === 4) {
- curve = new THREE38.CubicBezierCurve3(vecs[0], vecs[1], vecs[2], vecs[3]);
+ curve = new THREE39.CubicBezierCurve3(vecs[0], vecs[1], vecs[2], vecs[3]);
} else {
throw new Error(`bezierCurve: need 3 or 4 control points, got ${vecs.length}`);
}
@@ -29425,20 +29640,20 @@ var init_ops = __esm(() => {
});
// src/deformation-normals.ts
-import * as THREE39 from "three";
+import * as THREE40 from "three";
function recomputeDeformedNormals(source, output) {
const original = source.getAttribute("position");
const authored = source.getAttribute("normal");
const position = output.getAttribute("position");
const bounds = (attribute) => {
- const box = new THREE39.Box3().setFromBufferAttribute(attribute);
+ const box = new THREE40.Box3().setFromBufferAttribute(attribute);
return {
- center: box.getCenter(new THREE39.Vector3),
- size: box.getSize(new THREE39.Vector3).length() || 1
+ center: box.getCenter(new THREE40.Vector3),
+ size: box.getSize(new THREE40.Vector3).length() || 1
};
};
const before = bounds(original), after = bounds(position);
- const point = new THREE39.Vector3, normal = new THREE39.Vector3;
+ const point = new THREE40.Vector3, normal = new THREE40.Vector3;
const quantized = (attribute, index, frame) => {
point.fromBufferAttribute(attribute, index).sub(frame.center).divideScalar(frame.size);
return point.toArray().map((value) => Math.round(value * 1e7)).join(",");
@@ -29461,7 +29676,7 @@ function recomputeDeformedNormals(source, output) {
const sums = new Float64Array(classes.size * 3);
const index = output.index;
const corners = index?.count ?? position.count;
- const a = new THREE39.Vector3, b = new THREE39.Vector3, c = new THREE39.Vector3;
+ const a = new THREE40.Vector3, b = new THREE40.Vector3, c = new THREE40.Vector3;
for (let t = 0;t < corners; t += 3) {
const ia = index ? index.getX(t) : t;
const ib = index ? index.getX(t + 1) : t + 1;
@@ -29482,17 +29697,17 @@ function recomputeDeformedNormals(source, output) {
const offset = ids[i] * 3;
normal.set(sums[offset], sums[offset + 1], sums[offset + 2]).normalize().toArray(normals, i * 3);
}
- output.setAttribute("normal", new THREE39.BufferAttribute(normals, 3));
+ output.setAttribute("normal", new THREE40.BufferAttribute(normals, 3));
}
var init_deformation_normals = () => {};
// src/deform.ts
-import * as THREE40 from "three";
+import * as THREE41 from "three";
function geometryFrameMatrix(frame = {}) {
const origin = frame.origin ?? [0, 0, 0], rotation = frame.rotation ?? [0, 0, 0];
if (origin.length !== 3 || rotation.length !== 3 || ![...origin, ...rotation].every(Number.isFinite))
throw new Error("geometry frame requires finite xyz origin and rotation");
- return new THREE40.Matrix4().compose(new THREE40.Vector3(...origin), new THREE40.Quaternion().setFromEuler(new THREE40.Euler(...rotation.map(THREE40.MathUtils.degToRad), "XYZ")), new THREE40.Vector3(1, 1, 1));
+ return new THREE41.Matrix4().compose(new THREE41.Vector3(...origin), new THREE41.Quaternion().setFromEuler(new THREE41.Euler(...rotation.map(THREE41.MathUtils.degToRad), "XYZ")), new THREE41.Vector3(1, 1, 1));
}
function deform(geometry, options, map) {
const source = geometry.getAttribute("position");
@@ -29519,7 +29734,7 @@ function deform(geometry, options, map) {
throw new Error("deformation normals must be finite");
}
const matrix = geometryFrameMatrix(options.frame), inverse = matrix.clone().invert();
- const points = Array.from({ length: source.count }, (_, i) => new THREE40.Vector3().fromBufferAttribute(source, i).applyMatrix4(inverse));
+ const points = Array.from({ length: source.count }, (_, i) => new THREE41.Vector3().fromBufferAttribute(source, i).applyMatrix4(inverse));
if (points.some((p) => ![p.x, p.y, p.z].every(Number.isFinite)))
throw new Error("deformation positions must be finite");
let low = Infinity, high = -Infinity;
@@ -29542,7 +29757,7 @@ function deform(geometry, options, map) {
const point = points[i];
if (point.y < low - epsilon || point.y > high + epsilon)
continue;
- const t = length > 0 ? THREE40.MathUtils.clamp((point.y - low) / length, 0, 1) : 0;
+ const t = length > 0 ? THREE41.MathUtils.clamp((point.y - low) / length, 0, 1) : 0;
const weight = options.falloff?.(t) ?? 1;
if (!Number.isFinite(weight) || weight < 0 || weight > 1)
throw new Error("deformation falloff must return a finite weight between 0 and 1");
@@ -29576,31 +29791,31 @@ function deform(geometry, options, map) {
function twist(geometry, options) {
if (!Number.isFinite(options.angle))
throw new Error("twist angle must be finite degrees");
- return deform(geometry, options, (p, t) => p.applyAxisAngle(new THREE40.Vector3(0, 1, 0), THREE40.MathUtils.degToRad(options.angle) * t));
+ return deform(geometry, options, (p, t) => p.applyAxisAngle(new THREE41.Vector3(0, 1, 0), THREE41.MathUtils.degToRad(options.angle) * t));
}
function bend(geometry, options) {
if (!Number.isFinite(options.angle))
throw new Error("bend angle must be finite degrees");
- const angle = THREE40.MathUtils.degToRad(options.angle);
+ const angle = THREE41.MathUtils.degToRad(options.angle);
return deform(geometry, options, (p, t, low, length) => {
if (Math.abs(angle) < 0.0000000001 || length === 0)
return p;
const radius = length / angle, theta = angle * t;
- return new THREE40.Vector3(radius - (radius - p.x) * Math.cos(theta), low + (radius - p.x) * Math.sin(theta), p.z);
+ return new THREE41.Vector3(radius - (radius - p.x) * Math.cos(theta), low + (radius - p.x) * Math.sin(theta), p.z);
});
}
function taper(geometry, options) {
const start = options.startScale ?? [1, 1], end = options.endScale;
if (start.length !== 2 || end.length !== 2 || ![...start, ...end].every((n) => Number.isFinite(n) && n > 0))
throw new Error("taper scales must be two finite positive values");
- return deform(geometry, options, (p, t) => p.set(p.x * THREE40.MathUtils.lerp(start[0], end[0], t), p.y, p.z * THREE40.MathUtils.lerp(start[1], end[1], t)));
+ return deform(geometry, options, (p, t) => p.set(p.x * THREE41.MathUtils.lerp(start[0], end[0], t), p.y, p.z * THREE41.MathUtils.lerp(start[1], end[1], t)));
}
function displace(geometry, offset, options = {}) {
return deform(geometry, options, (p, t) => {
const delta = offset([p.x, p.y, p.z], t);
if (delta.length !== 3 || !delta.every(Number.isFinite))
throw new Error("displace callback must return three finite offsets");
- return p.add(new THREE40.Vector3(...delta));
+ return p.add(new THREE41.Vector3(...delta));
});
}
var init_deform = __esm(() => {
@@ -29608,7 +29823,7 @@ var init_deform = __esm(() => {
});
// src/sweep.ts
-import * as THREE41 from "three";
+import * as THREE42 from "three";
function rejectHoles(value, label) {
if ("holes" in value && value.holes !== undefined)
throw new AuthoringDiagnosticError("PROFILE_HOLES_UNSUPPORTED", `${label}: holes are unsupported. Use extrudeProfile for a holed cross-section with optional twist/taper; independently varying contours need explicit geometry or solid subtraction.`);
@@ -29616,9 +29831,9 @@ function rejectHoles(value, label) {
function profilePoints(profile) {
if (profile.length < 3 || profile.some((p) => p.length !== 2 || !p.every(Number.isFinite)))
throw new Error("profile requires at least three finite xy points");
- const points = profile.map((p) => new THREE41.Vector2(...p));
- const bounds = new THREE41.Box2().setFromPoints(points);
- const extent = bounds.getSize(new THREE41.Vector2).length();
+ const points = profile.map((p) => new THREE42.Vector2(...p));
+ const bounds = new THREE42.Box2().setFromPoints(points);
+ const extent = bounds.getSize(new THREE42.Vector2).length();
if (!(extent > 0) || !Number.isFinite(extent))
throw new Error("profile requires a finite nonzero extent");
const normalized = points.map((p) => p.clone().sub(bounds.min).divideScalar(extent));
@@ -29641,7 +29856,7 @@ function profilePoints(profile) {
throw new Error("profile self-intersects or touches itself");
}
}
- const area = THREE41.ShapeUtils.area(normalized);
+ const area = THREE42.ShapeUtils.area(normalized);
if (Math.abs(area) < 0.000000000001)
throw new Error("profile area must be nonzero");
if (area < 0)
@@ -29655,11 +29870,11 @@ function isCrease(first, second, creaseAngle) {
if (!(first.lengthSq() > 0 && second.lengthSq() > 0))
return false;
const angle = Math.atan2(first.clone().cross(second).length(), first.dot(second));
- return THREE41.MathUtils.radToDeg(angle) > creaseAngle + CREASE_TOLERANCE_DEGREES;
+ return THREE42.MathUtils.radToDeg(angle) > creaseAngle + CREASE_TOLERANCE_DEGREES;
}
function buildLoft(rings, profiles, closed, cap, firstFrameForward, creaseAngle) {
const n = rings[0].length, positions = [], uvs = [], indices = [];
- const centers = rings.map((r) => r.reduce((sum, p) => sum.add(p), new THREE41.Vector3).multiplyScalar(1 / n));
+ const centers = rings.map((r) => r.reduce((sum, p) => sum.add(p), new THREE42.Vector3).multiplyScalar(1 / n));
const lengths = [0];
for (let i = 1;i < centers.length; i++)
lengths.push(lengths[i - 1] + centers[i].distanceTo(centers[i - 1]));
@@ -29719,13 +29934,13 @@ function buildLoft(rings, profiles, closed, cap, firstFrameForward, creaseAngle)
continue;
const ring = rings[station], profile = profiles[station];
const start = positions.length / 3;
- const bounds = new THREE41.Box2().setFromPoints(profile);
- const size = bounds.getSize(new THREE41.Vector2);
+ const bounds = new THREE42.Box2().setFromPoints(profile);
+ const size = bounds.getSize(new THREE42.Vector2);
for (let j = 0;j < n; j++) {
positions.push(...ring[j].toArray());
uvs.push((profile[j].x - bounds.min.x) / (size.x || 1), (profile[j].y - bounds.min.y) / (size.y || 1));
}
- for (const tri of THREE41.ShapeUtils.triangulateShape(profile, [])) {
+ for (const tri of THREE42.ShapeUtils.triangulateShape(profile, [])) {
if (station === 0)
indices.push(...tri.map((j) => start + j));
else
@@ -29738,7 +29953,7 @@ function buildLoft(rings, profiles, closed, cap, firstFrameForward, creaseAngle)
const out = meshGeo({ positions, indices, uvs });
const normal = out.getAttribute("normal");
const share = (a, b) => {
- const sum = new THREE41.Vector3().fromBufferAttribute(normal, a).add(new THREE41.Vector3().fromBufferAttribute(normal, b)).normalize();
+ const sum = new THREE42.Vector3().fromBufferAttribute(normal, a).add(new THREE42.Vector3().fromBufferAttribute(normal, b)).normalize();
normal.setXYZ(a, sum.x, sum.y, sum.z);
normal.setXYZ(b, sum.x, sum.y, sum.z);
};
@@ -29776,8 +29991,8 @@ function loftProfiles(sections, options = {}) {
if (profiles.some((p) => p.length !== profiles[0].length))
throw new Error("loftProfiles sections must have the same point count and correspondence");
const frames = sections.map((section) => geometryFrameMatrix(section.frame));
- const rings = profiles.map((profile, i) => profile.map((p) => new THREE41.Vector3(p.x, 0, p.y).applyMatrix4(frames[i])));
- const out = buildLoft(rings, profiles, false, loftCapEnds(options.cap), new THREE41.Vector3(0, 1, 0).transformDirection(frames[0]));
+ const rings = profiles.map((profile, i) => profile.map((p) => new THREE42.Vector3(p.x, 0, p.y).applyMatrix4(frames[i])));
+ const out = buildLoft(rings, profiles, false, loftCapEnds(options.cap), new THREE42.Vector3(0, 1, 0).transformDirection(frames[0]));
const analysis = recordSweepAnalysis(out, rings, profiles, false);
out.userData.kilnGeometryWarnings = analysis.complete ? [] : [
{
@@ -29800,8 +30015,8 @@ function sweepProfile(profile, path, options = {}) {
const cap = sweepCapEnds(options.cap, closed);
if (path.length < (closed ? 3 : 2) || path.some((p) => p.length !== 3 || !p.every(Number.isFinite)))
throw new Error("sweepProfile requires finite path points (two open or three closed)");
- const stations = path.map((p) => new THREE41.Vector3(...p));
- const pathExtent = new THREE41.Box3().setFromPoints(stations).getSize(new THREE41.Vector3).length();
+ const stations = path.map((p) => new THREE42.Vector3(...p));
+ const pathExtent = new THREE42.Box3().setFromPoints(stations).getSize(new THREE42.Vector3).length();
if (!(pathExtent > 0) || !Number.isFinite(pathExtent))
throw new Error("sweepProfile path stations must be distinct with finite extent");
const pathTolerance = pathExtent * 0.0000000001;
@@ -29842,7 +30057,7 @@ function sweepProfile(profile, path, options = {}) {
});
return incoming.clone().add(outgoing).normalize();
});
- const up = options.up ? new THREE41.Vector3(...options.up) : Math.abs(tangents[0].z) < 0.9 ? new THREE41.Vector3(0, 0, 1) : new THREE41.Vector3(1, 0, 0);
+ const up = options.up ? new THREE42.Vector3(...options.up) : Math.abs(tangents[0].z) < 0.9 ? new THREE42.Vector3(0, 0, 1) : new THREE42.Vector3(1, 0, 0);
const upLength = Math.hypot(up.x, up.y, up.z);
if (!(upLength > 0) || !Number.isFinite(upLength))
throw new Error("sweepProfile up must be a finite nonzero vector");
@@ -29859,7 +30074,7 @@ function sweepProfile(profile, path, options = {}) {
}
const distances = [0];
for (let i = 1;i < stations.length; i++) {
- z = z.clone().applyQuaternion(new THREE41.Quaternion().setFromUnitVectors(tangents[i - 1], tangents[i]));
+ z = z.clone().applyQuaternion(new THREE42.Quaternion().setFromUnitVectors(tangents[i - 1], tangents[i]));
normals.push(z);
distances.push(distances[i - 1] + stations[i].distanceTo(stations[i - 1]));
}
@@ -29869,7 +30084,7 @@ function sweepProfile(profile, path, options = {}) {
correction = Math.atan2(tangents[0].dot(normals[normals.length - 1].clone().cross(normals[0])), normals[normals.length - 1].dot(normals[0]));
const rings = stations.map((station, i) => {
const tangent = tangents[i], t = distances[i] / total;
- const axisZ = normals[i].clone().applyAxisAngle(tangent, (correction + THREE41.MathUtils.degToRad(twist)) * t);
+ const axisZ = normals[i].clone().applyAxisAngle(tangent, (correction + THREE42.MathUtils.degToRad(twist)) * t);
const axisX = tangent.clone().cross(axisZ).normalize(), scale = scales[i];
return points.map((p) => station.clone().addScaledVector(axisX, p.x * scale[0]).addScaledVector(axisZ, p.y * scale[1]));
});
@@ -29894,7 +30109,7 @@ var init_sweep2 = __esm(() => {
});
// src/simplify.ts
-import * as THREE42 from "three";
+import * as THREE43 from "three";
function loadSimplifier() {
simplifierReady ??= import("meshoptimizer/simplifier").then(async ({ MeshoptSimplifier }) => {
await MeshoptSimplifier.ready;
@@ -29916,7 +30131,7 @@ function gather(attribute, vertices) {
for (let i = 0;i < vertices.length; i++)
for (let c = 0;c < attribute.itemSize; c++)
values[i * attribute.itemSize + c] = raw(attribute, vertices[i], c);
- const out = new THREE42.BufferAttribute(values, attribute.itemSize, attribute.normalized);
+ const out = new THREE43.BufferAttribute(values, attribute.itemSize, attribute.normalized);
out.name = attribute.name;
return out;
}
@@ -30201,14 +30416,14 @@ async function simplifyGeometry(geometry, options) {
indexValues[i] = remap[w];
}
const sources = Uint32Array.from(used, (w) => representative[w]);
- const out = new THREE42.BufferGeometry;
+ const out = new THREE43.BufferGeometry;
out.name = geometry.name;
const outPosition = new Float32Array(sources.length * 3);
for (let i = 0;i < used.length; i++)
outPosition.set(positions.subarray(used[i] * 3, used[i] * 3 + 3), i * 3);
for (const [name, attribute] of Object.entries(geometry.attributes)) {
if (name === "position") {
- const attr = new THREE42.BufferAttribute(outPosition, 3);
+ const attr = new THREE43.BufferAttribute(outPosition, 3);
attr.name = attribute.name;
out.setAttribute(name, attr);
} else
@@ -30217,7 +30432,7 @@ async function simplifyGeometry(geometry, options) {
for (const [name, targets] of Object.entries(geometry.morphAttributes))
out.morphAttributes[name] = targets.map((target) => gather(target, sources));
out.morphTargetsRelative = geometry.morphTargetsRelative;
- out.setIndex(new THREE42.BufferAttribute(indexValues, 1));
+ out.setIndex(new THREE43.BufferAttribute(indexValues, 1));
for (const group of outGroups)
out.addGroup(group.start, group.count, group.materialIndex);
out.computeBoundingBox();
@@ -30272,7 +30487,7 @@ var init_simplify = __esm(() => {
});
// src/solids.ts
-import * as THREE43 from "three";
+import * as THREE44 from "three";
async function getManifoldModule() {
if (_module)
return _module;
@@ -30302,10 +30517,10 @@ function computationFrame(parts) {
meshes.push(mesh);
});
}
- const origin = meshes.length ? new THREE43.Vector3().setFromMatrixPosition(meshes[0].matrixWorld) : new THREE43.Vector3;
+ const origin = meshes.length ? new THREE44.Vector3().setFromMatrixPosition(meshes[0].matrixWorld) : new THREE44.Vector3;
const matrices = new Map;
- const bounds = new THREE43.Box3;
- const point = new THREE43.Vector3;
+ const bounds = new THREE44.Box3;
+ const point = new THREE44.Vector3;
for (const mesh of meshes) {
const matrix = mesh.matrixWorld.clone();
matrix.elements[12] -= origin.x;
@@ -30322,11 +30537,11 @@ function computationFrame(parts) {
bounds.expandByPoint(point);
}
}
- const size = bounds.getSize(new THREE43.Vector3);
+ const size = bounds.getSize(new THREE44.Vector3);
const scale = Math.hypot(size.x, size.y, size.z);
if (!Number.isFinite(scale))
throw new Error("CSG: combined operand extent must be finite");
- return { origin, center: bounds.getCenter(new THREE43.Vector3), scale: scale || 1, matrices };
+ return { origin, center: bounds.getCenter(new THREE44.Vector3), scale: scale || 1, matrices };
}
function retainNotes(target, notes) {
if (!Array.isArray(notes))
@@ -30406,7 +30621,7 @@ function threeToManifold(src, mod, label, context) {
else
context.missingUV.add(mesh.name || label);
}
- const point = new THREE43.Vector3;
+ const point = new THREE44.Vector3;
for (let i = 0;i < position.count; i++) {
point.fromBufferAttribute(position, i).applyMatrix4(context.frame.matrices.get(mesh)).sub(context.frame.center).divideScalar(context.frame.scale);
if (![point.x, point.y, point.z].every((n) => Number.isFinite(Math.fround(n))))
@@ -30549,11 +30764,11 @@ function solidMeshToGeometry({ mesh, collapsed }, opts = {}) {
if (uvs)
uvs.set(mesh.vertProperties.subarray(i + 3, i + 5), v * 2);
}
- const geometry = new THREE43.BufferGeometry;
- geometry.setAttribute("position", new THREE43.BufferAttribute(positions, 3));
- geometry.setIndex(new THREE43.BufferAttribute(new Uint32Array(mesh.triVerts), 1));
+ const geometry = new THREE44.BufferGeometry;
+ geometry.setAttribute("position", new THREE44.BufferAttribute(positions, 3));
+ geometry.setIndex(new THREE44.BufferAttribute(new Uint32Array(mesh.triVerts), 1));
if (uvs)
- geometry.setAttribute("uv", new THREE43.BufferAttribute(uvs, 2));
+ geometry.setAttribute("uv", new THREE44.BufferAttribute(uvs, 2));
const out = opts.smooth ? geometry : geometry.toNonIndexed();
out.computeVertexNormals();
if (opts.smooth && uvs) {
@@ -30584,7 +30799,7 @@ function firstMaterial(src) {
if (!material && mesh.isMesh)
material = Array.isArray(mesh.material) ? mesh.material[0] : mesh.material;
});
- return material ?? new THREE43.MeshStandardMaterial;
+ return material ?? new THREE44.MeshStandardMaterial;
}
function outputMesh(result, name, parts, opts, context, isHull) {
const materialized = materializeSolid(result);
@@ -30643,7 +30858,7 @@ function outputMesh(result, name, parts, opts, context, isHull) {
retainNotes(context.geometryWarnings, geometry.userData.kilnGeometryWarnings);
if (context.geometryWarnings.size)
geometry.userData.kilnGeometryWarnings = [...context.geometryWarnings.values()];
- const output = new THREE43.Mesh(geometry, context.preserve && !isHull && materials.length ? materials : firstMaterial(parts[0]));
+ const output = new THREE44.Mesh(geometry, context.preserve && !isHull && materials.length ? materials : firstMaterial(parts[0]));
output.name = `Mesh_${name}`;
output.position.copy(context.frame.origin);
return output;
@@ -31052,7 +31267,7 @@ function smoothUnionSpheres(point, spheres, blend) {
}
// src/organic.ts
-import * as THREE44 from "three";
+import * as THREE45 from "three";
function assertSafePathCount(name, count) {
if (!Number.isSafeInteger(count))
throw new Error(`${name} derived sample count must be a safe integer; reduce sample counts.`);
@@ -31084,8 +31299,8 @@ function catmullRomPath(controlPoints, samplesPerSpan = 8, closed = false) {
assertSafePathCount("catmullRomPath", spans * samplesPerSpan + 1);
if (controlPoints.some((p) => p.length !== 3 || !p.every(Number.isFinite)))
throw new Error("catmullRomPath control points must be finite [x,y,z] triples");
- const vectors = controlPoints.map((p) => new THREE44.Vector3(p[0], p[1], p[2]));
- const curve = new THREE44.CatmullRomCurve3(vectors, closed);
+ const vectors = controlPoints.map((p) => new THREE45.Vector3(p[0], p[1], p[2]));
+ const curve = new THREE45.CatmullRomCurve3(vectors, closed);
const points = curve.getPoints(spans * samplesPerSpan);
if (closed)
points.pop();
@@ -31139,8 +31354,8 @@ function spiralPath(options) {
throw new Error("spiralPath center must be a finite [x,y,z] triple");
if (axis.length !== 3 || forward.length !== 3 || ![...axis, ...forward].every(Number.isFinite))
throw new Error("spiralPath axis and forward must be finite [x,y,z] triples");
- const up = new THREE44.Vector3(...axis);
- const fwd = new THREE44.Vector3(...forward);
+ const up = new THREE45.Vector3(...axis);
+ const fwd = new THREE45.Vector3(...forward);
if (up.lengthSq() < 0.000000000001 || fwd.lengthSq() < 0.000000000001)
throw new Error("spiralPath axis and forward must be nonzero");
up.normalize();
@@ -31148,7 +31363,7 @@ function spiralPath(options) {
if (horiz.lengthSq() < 0.000000000001)
throw new Error("spiralPath forward must not be parallel to axis");
horiz.normalize();
- const right = new THREE44.Vector3().crossVectors(up, horiz).normalize();
+ const right = new THREE45.Vector3().crossVectors(up, horiz).normalize();
const out = [];
for (let i = 0;i <= samples; i++) {
const u = i / samples;
@@ -31262,7 +31477,7 @@ var init_seeded_random = __esm(() => {
});
// src/uv-shapes.ts
-import * as THREE45 from "three";
+import * as THREE46 from "three";
function remapUV(geo, options = {}) {
if (!options || typeof options !== "object" || Array.isArray(options) || Object.keys(options).some((key) => !["scale", "offset"].includes(key))) {
throw new Error("remapUV: options may contain only scale and offset.");
@@ -31291,7 +31506,7 @@ function remapUV(geo, options = {}) {
}
const cloned = geo.clone();
cloned.userData = structuredClone(geo.userData);
- cloned.setAttribute("uv", new THREE45.Float32BufferAttribute(values, 2));
+ cloned.setAttribute("uv", new THREE46.Float32BufferAttribute(values, 2));
if ((scale[0] !== 1 || scale[1] !== 1) && cloned.hasAttribute("tangent")) {
cloned.deleteAttribute("tangent");
const previous = cloned.userData.kilnAttributeWarnings;
@@ -31308,13 +31523,13 @@ function remapUV(geo, options = {}) {
var init_uv_shapes = () => {};
// src/texture-atlas.ts
-import * as THREE46 from "three";
+import * as THREE47 from "three";
async function textureAtlas(input, options = {}) {
const compiled = await compileTextureAtlasSpecV1(input, options);
- const texture = new THREE46.DataTexture(compiled.pixels, compiled.spec.width, compiled.spec.height, THREE46.RGBAFormat, THREE46.UnsignedByteType);
+ const texture = new THREE47.DataTexture(compiled.pixels, compiled.spec.width, compiled.spec.height, THREE47.RGBAFormat, THREE47.UnsignedByteType);
texture.name = "Atlas";
texture.flipY = false;
- texture.colorSpace = compiled.spec.usage === "albedo" || compiled.spec.usage === "emissive" ? THREE46.SRGBColorSpace : THREE46.NoColorSpace;
+ texture.colorSpace = compiled.spec.usage === "albedo" || compiled.spec.usage === "emissive" ? THREE47.SRGBColorSpace : THREE47.NoColorSpace;
applyPortableSamplerV1(texture, compiled.spec.sampler);
texture.userData.kilnAtlas = { spec: compiled.spec, manifest: compiled.manifest };
texture.userData.kilnTexture = {
@@ -31372,7 +31587,7 @@ function remapUVToAtlas(geometry, atlas, name, options) {
bytes += buffer.byteLength;
}
} else {
- bytes += attribute.array.byteLength * (attribute.constructor === THREE46.BufferAttribute || attribute.constructor === THREE46.InstancedBufferAttribute ? 1 : 2);
+ bytes += attribute.array.byteLength * (attribute.constructor === THREE47.BufferAttribute || attribute.constructor === THREE47.InstancedBufferAttribute ? 1 : 2);
}
};
for (const attr of Object.values(geometry.attributes))
@@ -31597,7 +31812,7 @@ var init_portable_material_runtime = __esm(() => {
});
// src/uv-data.ts
-import * as THREE47 from "three";
+import * as THREE48 from "three";
function validateAtlasRemap(mesh, inputIndex, sourceCount) {
const count = mesh.vertexCount;
if (!Number.isSafeInteger(count) || count < 1 || count > GEOMETRY_ALLOCATION_LIMITS.unwrapVertices)
@@ -31632,7 +31847,7 @@ function remapUnwrapAttribute(attribute, oldIndexes) {
for (let c = 0;c < attribute.itemSize; c++)
array[i * attribute.itemSize + c] = attribute.array[oldIndexes[i] * stride + offset + c];
}
- const output = attribute.isFloat16BufferAttribute ? new THREE47.Float16BufferAttribute(array, attribute.itemSize, attribute.normalized) : new THREE47.BufferAttribute(array, attribute.itemSize, attribute.normalized);
+ const output = attribute.isFloat16BufferAttribute ? new THREE48.Float16BufferAttribute(array, attribute.itemSize, attribute.normalized) : new THREE48.BufferAttribute(array, attribute.itemSize, attribute.normalized);
output.name = attribute.name;
output.setUsage(interleaved(attribute) ? attribute.data.usage : attribute.usage);
if (!interleaved(attribute))
@@ -31744,7 +31959,7 @@ var init_uv_data = __esm(() => {
});
// src/uv.ts
-import * as THREE48 from "three";
+import * as THREE49 from "three";
async function getXatlas() {
if (!_xatlasReady) {
_xatlasReady = (async () => {
@@ -31776,7 +31991,7 @@ async function autoUnwrap(geometry, opts = {}) {
if (result.atlasCount !== 1 || !Number.isSafeInteger(result.width) || result.width <= 0 || !Number.isSafeInteger(result.height) || result.height <= 0)
throw new Error("autoUnwrap: xatlas must return one valid atlas; multiple atlas pages are unsupported.");
const remap = validateAtlasRemap(mesh, prepared.index, geometry.getAttribute("position").count);
- const out = new THREE48.BufferGeometry;
+ const out = new THREE49.BufferGeometry;
for (const [name, attribute] of Object.entries(geometry.attributes)) {
if (name === "uv" || name === "tangent" || name === "normal" && !prepared.useNormals)
continue;
@@ -31786,8 +32001,8 @@ async function autoUnwrap(geometry, opts = {}) {
out.morphAttributes[name] = targets.map((attribute) => remapUnwrapAttribute(attribute, remap.oldIndexes));
}
out.morphTargetsRelative = geometry.morphTargetsRelative;
- out.setIndex(new THREE48.BufferAttribute(new Uint32Array(remap.index), 1));
- out.setAttribute("uv", new THREE48.BufferAttribute(new Float32Array(remap.uv), 2));
+ out.setIndex(new THREE49.BufferAttribute(new Uint32Array(remap.index), 1));
+ out.setAttribute("uv", new THREE49.BufferAttribute(new Float32Array(remap.uv), 2));
out.name = geometry.name;
out.groups = geometry.groups.map((group) => ({ ...group }));
out.setDrawRange(geometry.drawRange.start, geometry.drawRange.count);
@@ -31822,11 +32037,11 @@ function repairZeroNormals(geo) {
if (broken.size === 0)
return;
const acc = new Float32Array(normal.count * 3);
- const a = new THREE48.Vector3;
- const b = new THREE48.Vector3;
- const c = new THREE48.Vector3;
- const face = new THREE48.Vector3;
- const edge = new THREE48.Vector3;
+ const a = new THREE49.Vector3;
+ const b = new THREE49.Vector3;
+ const c = new THREE49.Vector3;
+ const face = new THREE49.Vector3;
+ const edge = new THREE49.Vector3;
for (let t = 0;t + 2 < index.count; t += 3) {
const tri = [index.getX(t), index.getX(t + 1), index.getX(t + 2)];
if (!tri.some((i) => broken.has(i)))
@@ -31862,7 +32077,7 @@ var init_uv = __esm(() => {
});
// src/uv-project.ts
-import * as THREE49 from "three";
+import * as THREE50 from "three";
function projectUV(geometry, options) {
if (!options || typeof options !== "object" || Array.isArray(options) || !["planar", "box", "cylindrical"].includes(options.projection) || Object.keys(options).some((key) => !["projection", "frame", "seamDegrees", "angularRange", "caps", "metersPerUnit"].includes(key)))
throw new Error("projectUV: select an explicit planar, box or cylindrical projection with documented options.");
@@ -31903,15 +32118,15 @@ function projectUV(geometry, options) {
throw new Error("projectUV: index contains an invalid vertex reference.");
}
const points = [];
- const bounds = new THREE49.Box3;
+ const bounds = new THREE50.Box3;
for (let i = 0;i < positions.count; i++) {
- const point = new THREE49.Vector3().fromBufferAttribute(positions, i).applyMatrix4(inverse);
+ const point = new THREE50.Vector3().fromBufferAttribute(positions, i).applyMatrix4(inverse);
if (![point.x, point.y, point.z].every(Number.isFinite))
throw new Error("projectUV: frame-local positions must be finite.");
points.push(point);
bounds.expandByPoint(point);
}
- const extent = bounds.getSize(new THREE49.Vector3);
+ const extent = bounds.getSize(new THREE50.Vector3);
const fit = (point, axis) => metric !== undefined ? point[axis] / metric : extent[axis] > 0 ? (point[axis] - bounds.min[axis]) / extent[axis] : 0.5;
const flip = (point, axis) => metric !== undefined ? -point[axis] / metric : 1 - fit(point, axis);
const outputUVs = new Float32Array(corners * 2);
@@ -31926,8 +32141,8 @@ function projectUV(geometry, options) {
if (metric !== undefined) {
uScale = fullWrap ? Math.max(1, Math.round(2 * Math.PI * radius / metric)) : sweep * radius / metric;
}
- const normal = new THREE49.Vector3;
- const edge = new THREE49.Vector3;
+ const normal = new THREE50.Vector3;
+ const edge = new THREE50.Vector3;
for (let i = 0;i < corners; i += 3) {
const triangle = [0, 1, 2].map((offset) => points[index ? index.getX(i + offset) : i + offset]);
normal.subVectors(triangle[1], triangle[0]).cross(edge.subVectors(triangle[2], triangle[0])).normalize();
@@ -31983,7 +32198,7 @@ function projectUV(geometry, options) {
const out = geometry.index ? geometry.toNonIndexed() : geometry.clone();
out.userData = structuredClone(geometry.userData);
out.setDrawRange(geometry.drawRange.start, geometry.drawRange.count);
- out.setAttribute("uv", new THREE49.Float32BufferAttribute(outputUVs, 2));
+ out.setAttribute("uv", new THREE50.Float32BufferAttribute(outputUVs, 2));
if (out.hasAttribute("tangent")) {
out.deleteAttribute("tangent");
const previous = out.userData.kilnAttributeWarnings;
@@ -32004,17 +32219,17 @@ var init_uv_project = __esm(() => {
});
// src/primitives.ts
-import * as THREE50 from "three";
+import * as THREE51 from "three";
function vectorToTuple(v) {
return [v.x, v.y, v.z];
}
function createRoot(name) {
- const root = new THREE50.Object3D;
+ const root = new THREE51.Object3D;
root.name = name;
return root;
}
function createPivot(name, position = [0, 0, 0], parent) {
- const pivot = new THREE50.Object3D;
+ const pivot = new THREE51.Object3D;
pivot.name = `Joint_${name}`;
pivot.position.set(...position);
if (parent)
@@ -32046,16 +32261,16 @@ function assertPartArgs(name, geometry2, material) {
}
function createPart(name, geometry2, material, options = {}) {
assertPartArgs(name, geometry2, material);
- const mesh = new THREE50.Mesh(geometry2, material);
+ const mesh = new THREE51.Mesh(geometry2, material);
mesh.name = `Mesh_${name}`;
if (options.position)
mesh.position.set(...options.position);
if (options.rotation)
- mesh.rotation.set(THREE50.MathUtils.degToRad(options.rotation[0]), THREE50.MathUtils.degToRad(options.rotation[1]), THREE50.MathUtils.degToRad(options.rotation[2]));
+ mesh.rotation.set(THREE51.MathUtils.degToRad(options.rotation[0]), THREE51.MathUtils.degToRad(options.rotation[1]), THREE51.MathUtils.degToRad(options.rotation[2]));
if (options.scale)
mesh.scale.set(...options.scale);
if (options.pivot) {
- const pivot = new THREE50.Object3D;
+ const pivot = new THREE51.Object3D;
pivot.name = `Joint_${name}`;
pivot.add(mesh);
mesh.position.set(0, 0, 0);
@@ -32078,7 +32293,7 @@ function capsuleGeo(radius, height, segments = 6) {
assertDimension("capsuleGeo height (straight middle length)", height, true);
assertDimension("capsuleGeo outer half-length", height / 2 + radius);
assertPrimitiveSegments("capsuleGeo segments", segments, 3);
- return new THREE50.CapsuleGeometry(radius, height, 2, segments);
+ return new THREE51.CapsuleGeometry(radius, height, 2, segments);
}
function capsuleXGeo(radius, length, segments = 6) {
const geo = capsuleGeo(radius, length, segments);
@@ -32097,7 +32312,7 @@ function cylinderGeo(radiusTop, radiusBottom, height, segments = 8) {
throw new RangeError("cylinderGeo requires at least one positive radius.");
assertDimension("cylinderGeo height", height);
assertPrimitiveSegments("cylinderGeo segments", segments, 3);
- return new THREE50.CylinderGeometry(radiusTop, radiusBottom, height, segments);
+ return new THREE51.CylinderGeometry(radiusTop, radiusBottom, height, segments);
}
function cylinderXGeo(radiusTop, radiusBottom, length, segments = 8) {
const geo = cylinderGeo(radiusTop, radiusBottom, length, segments);
@@ -32112,20 +32327,20 @@ function cylinderZGeo(radiusTop, radiusBottom, length, segments = 8) {
function boxGeo(width, height, depth) {
for (const [name, value] of Object.entries({ width, height, depth }))
assertDimension(`boxGeo ${name} (use planeGeo for a sheet)`, value);
- return new THREE50.BoxGeometry(width, height, depth);
+ return new THREE51.BoxGeometry(width, height, depth);
}
function sphereGeo(radius, widthSegments = 8, heightSegments = 6) {
assertDimension("sphereGeo radius", radius);
assertPrimitiveSegments("sphereGeo widthSegments", widthSegments, 3);
assertPrimitiveSegments("sphereGeo heightSegments", heightSegments, 2);
assertPrimitiveGrid("sphereGeo", widthSegments, heightSegments);
- return new THREE50.SphereGeometry(radius, widthSegments, heightSegments);
+ return new THREE51.SphereGeometry(radius, widthSegments, heightSegments);
}
function coneGeo(radius, height, segments = 8) {
assertDimension("coneGeo radius", radius);
assertDimension("coneGeo height", height);
assertPrimitiveSegments("coneGeo segments", segments, 3);
- return new THREE50.ConeGeometry(radius, height, segments);
+ return new THREE51.ConeGeometry(radius, height, segments);
}
function coneXGeo(radius, length, segments = 8) {
const geo = coneGeo(radius, length, segments);
@@ -32142,7 +32357,7 @@ function cylinderOnAxis(center, normal, radiusBottom, height, options = {}) {
const segments = options.segments ?? 8;
assertFiniteTriple("cylinderOnAxis center", center);
assertFiniteTriple("cylinderOnAxis normal", normal);
- const n = new THREE50.Vector3(normal[0], normal[1], normal[2]);
+ const n = new THREE51.Vector3(normal[0], normal[1], normal[2]);
const len = Math.hypot(...normal);
if (len < 0.000001) {
throw new Error(`cylinderOnAxis: normal must be a non-zero vector (got [${normal.join(",")}]).`);
@@ -32150,7 +32365,7 @@ function cylinderOnAxis(center, normal, radiusBottom, height, options = {}) {
const magnitude = Math.max(...normal.map(Math.abs));
n.set(normal[0] / magnitude, normal[1] / magnitude, normal[2] / magnitude).normalize();
const geo = cylinderGeo(radiusTop, radiusBottom, height, segments);
- const q = new THREE50.Quaternion().setFromUnitVectors(new THREE50.Vector3(0, 1, 0), n);
+ const q = new THREE51.Quaternion().setFromUnitVectors(new THREE51.Vector3(0, 1, 0), n);
geo.applyQuaternion(q);
geo.translate(center[0], center[1], center[2]);
return geo;
@@ -32172,7 +32387,7 @@ function torusGeo(radius, tube, radialSegments = 8, tubularSegments = 12) {
assertPrimitiveSegments("torusGeo radialSegments", radialSegments, 3);
assertPrimitiveSegments("torusGeo tubularSegments", tubularSegments, 3);
assertPrimitiveGrid("torusGeo", radialSegments, tubularSegments);
- return new THREE50.TorusGeometry(radius, tube, radialSegments, tubularSegments);
+ return new THREE51.TorusGeometry(radius, tube, radialSegments, tubularSegments);
}
function planeGeo(width, height, widthSegments = 1, heightSegments = 1) {
assertDimension("planeGeo width", width);
@@ -32180,14 +32395,14 @@ function planeGeo(width, height, widthSegments = 1, heightSegments = 1) {
assertPrimitiveSegments("planeGeo widthSegments", widthSegments, 1);
assertPrimitiveSegments("planeGeo heightSegments", heightSegments, 1);
assertPrimitiveGrid("planeGeo", widthSegments, heightSegments);
- return new THREE50.PlaneGeometry(width, height, widthSegments, heightSegments);
+ return new THREE51.PlaneGeometry(width, height, widthSegments, heightSegments);
}
function decalBox(width, height, depth = 0.01) {
assertDimension("decalBox width", width);
assertDimension("decalBox height", height);
assertDimension("decalBox depth", depth, true);
const d = Math.max(depth, 0.002);
- return new THREE50.BoxGeometry(width, height, d);
+ return new THREE51.BoxGeometry(width, height, d);
}
function validateCardFrame(name, width, height, yPivot) {
assertDimension(`${name} width`, width);
@@ -32201,7 +32416,7 @@ function foliageCardGeo(opts = {}) {
const h = opts.height ?? 1;
const yPivot = opts.yPivot ?? 0;
validateCardFrame("foliageCardGeo", w, h, yPivot);
- const geom = new THREE50.PlaneGeometry(w, h);
+ const geom = new THREE51.PlaneGeometry(w, h);
geom.translate(0, h * (0.5 - yPivot), 0);
geom.userData["kilnGeometryRole"] = "foliageCard";
return geom;
@@ -32217,12 +32432,12 @@ function crossedQuadsGeo(opts = {}) {
const geometries = [];
for (let i = 0;i < planes; i++) {
const angle = i / planes * Math.PI;
- const quad = new THREE50.PlaneGeometry(w, h);
+ const quad = new THREE51.PlaneGeometry(w, h);
quad.translate(0, h * (0.5 - yPivot), 0);
quad.rotateY(angle);
geometries.push(quad);
}
- const out = new THREE50.BufferGeometry;
+ const out = new THREE51.BufferGeometry;
const posCount = geometries.reduce((sum, g) => sum + (g.attributes.position?.count ?? 0), 0);
const positions = new Float32Array(posCount * 3);
const normals = new Float32Array(posCount * 3);
@@ -32249,9 +32464,9 @@ function crossedQuadsGeo(opts = {}) {
}
vOffset += p.count;
}
- out.setAttribute("position", new THREE50.BufferAttribute(positions, 3));
- out.setAttribute("normal", new THREE50.BufferAttribute(normals, 3));
- out.setAttribute("uv", new THREE50.BufferAttribute(uvs, 2));
+ out.setAttribute("position", new THREE51.BufferAttribute(positions, 3));
+ out.setAttribute("normal", new THREE51.BufferAttribute(normals, 3));
+ out.setAttribute("uv", new THREE51.BufferAttribute(uvs, 2));
out.setIndex(indices);
out.userData["kilnGeometryRole"] = "foliageCard";
return out;
@@ -32266,7 +32481,7 @@ function octaGridPlane(opts) {
const h = opts.height ?? 1;
const yPivot = opts.yPivot ?? 0;
validateCardFrame("octaGridPlane", w, h, yPivot);
- const geom = new THREE50.PlaneGeometry(w, h);
+ const geom = new THREE51.PlaneGeometry(w, h);
geom.translate(0, h * (0.5 - yPivot), 0);
const uv = geom.attributes.uv;
const du = 1 / opts.tilesX;
@@ -32362,8 +32577,8 @@ function wingGeo(options = {}) {
7,
6
];
- const geo = new THREE50.BufferGeometry;
- geo.setAttribute("position", new THREE50.BufferAttribute(vertices, 3));
+ const geo = new THREE51.BufferGeometry;
+ geo.setAttribute("position", new THREE51.BufferAttribute(vertices, 3));
geo.setIndex(tipChord === 0 ? [0, 1, 3, 4, 7, 5, 0, 2, 6, 0, 6, 4, 1, 5, 7, 1, 7, 3, 0, 4, 5, 0, 5, 1] : indices);
geo.computeVertexNormals();
return geo;
@@ -32394,17 +32609,17 @@ function createWingPair(name, material, options) {
};
}
function beamBetween(name, start, end, radius, material, options = {}) {
- const a = new THREE50.Vector3(...start);
- const b = new THREE50.Vector3(...end);
+ const a = new THREE51.Vector3(...start);
+ const b = new THREE51.Vector3(...end);
const direction = b.clone().sub(a);
const length = direction.length();
if (length <= 0.0001) {
throw new Error(`beamBetween("${name}"): start and end must be different points (got start=[${start.join(",")}], end=[${end.join(",")}], delta=${length.toExponential(2)}). Pick two distinct endpoints or switch to cylinderGeo with an explicit length + position.`);
}
- const mesh = new THREE50.Mesh(cylinderGeo(radius, radius, length, options.segments ?? 8), material);
+ const mesh = new THREE51.Mesh(cylinderGeo(radius, radius, length, options.segments ?? 8), material);
mesh.name = `Mesh_${name}`;
mesh.position.copy(a.add(b).multiplyScalar(0.5));
- mesh.quaternion.setFromUnitVectors(new THREE50.Vector3(0, 1, 0), direction.normalize());
+ mesh.quaternion.setFromUnitVectors(new THREE51.Vector3(0, 1, 0), direction.normalize());
if (options.parent)
options.parent.add(mesh);
return mesh;
@@ -32413,11 +32628,11 @@ function snapTo(part, host, options = {}) {
const overlap = options.overlap ?? 0.02;
part.updateWorldMatrix(true, true);
host.updateWorldMatrix(true, true);
- const a = new THREE50.Box3().setFromObject(part);
- const b = new THREE50.Box3().setFromObject(host);
+ const a = new THREE51.Box3().setFromObject(part);
+ const b = new THREE51.Box3().setFromObject(host);
if (a.isEmpty() || b.isEmpty())
return part;
- const delta = new THREE50.Vector3;
+ const delta = new THREE51.Vector3;
for (const axis of ["x", "y", "z"]) {
if (a.min[axis] > b.max[axis])
delta[axis] = b.max[axis] - a.min[axis];
@@ -32433,7 +32648,7 @@ function snapTo(part, host, options = {}) {
delta[dominant] = -overlap;
const parent = part.parent;
if (parent) {
- const p0 = new THREE50.Vector3;
+ const p0 = new THREE51.Vector3;
part.getWorldPosition(p0);
const p1 = p0.clone().add(delta);
const l0 = parent.worldToLocal(p0.clone());
@@ -32468,8 +32683,8 @@ function createLadder(name, options) {
throw new RangeError("createLadder rungCount must be an integer from 0 to 10000.");
if (widthAxis !== "x" && widthAxis !== "z")
throw new RangeError("createLadder widthAxis must be x or z.");
- const bottomVec = new THREE50.Vector3;
- const topVec = new THREE50.Vector3(...top).sub(new THREE50.Vector3(...bottom));
+ const bottomVec = new THREE51.Vector3;
+ const topVec = new THREE51.Vector3(...top).sub(new THREE51.Vector3(...bottom));
const length = Math.hypot(topVec.x, topVec.y, topVec.z);
assertDimension("createLadder endpoint distance", length);
if (length <= 0.0001)
@@ -32477,7 +32692,7 @@ function createLadder(name, options) {
const along = topVec.clone().divideScalar(length);
if (widthDirection !== undefined)
assertFiniteTriple("createLadder widthDirection", widthDirection);
- let across = widthDirection ? new THREE50.Vector3(...widthDirection) : widthAxis === "x" ? new THREE50.Vector3(1, 0, 0) : new THREE50.Vector3(0, 0, 1);
+ let across = widthDirection ? new THREE51.Vector3(...widthDirection) : widthAxis === "x" ? new THREE51.Vector3(1, 0, 0) : new THREE51.Vector3(0, 0, 1);
const largest = Math.max(Math.abs(across.x), Math.abs(across.y), Math.abs(across.z));
if (!largest)
throw new RangeError("createLadder widthDirection must be nonzero.");
@@ -32487,19 +32702,19 @@ function createLadder(name, options) {
if (widthDirection)
throw new RangeError("createLadder widthDirection must not be parallel to the endpoints.");
const axes = [
- new THREE50.Vector3(1, 0, 0),
- new THREE50.Vector3(0, 1, 0),
- new THREE50.Vector3(0, 0, 1)
+ new THREE51.Vector3(1, 0, 0),
+ new THREE51.Vector3(0, 1, 0),
+ new THREE51.Vector3(0, 0, 1)
];
across = axes.reduce((best, axis) => Math.abs(axis.dot(along)) < Math.abs(best.dot(along)) ? axis : best);
across.addScaledVector(along, -across.dot(along));
}
across.normalize();
const offset = across.clone().multiplyScalar(width / 2);
- const root = new THREE50.Object3D;
+ const root = new THREE51.Object3D;
root.name = name;
root.position.set(...bottom);
- const rotation = new THREE50.Quaternion().setFromRotationMatrix(new THREE50.Matrix4().makeBasis(across, along, across.clone().cross(along))).toArray();
+ const rotation = new THREE51.Quaternion().setFromRotationMatrix(new THREE51.Matrix4().makeBasis(across, along, across.clone().cross(along))).toArray();
stampSemanticMetadataV1(root, {
roles: ["ladder"],
frames: [
@@ -32539,7 +32754,7 @@ function wallWithOpening(name, material, options) {
if (opening && openings)
throw new TypeError("wallWithOpening: use opening or openings, not both.");
const built = buildWallPanels(length, height, thickness, openings ?? (opening ? [opening] : []));
- const group = new THREE50.Object3D;
+ const group = new THREE51.Object3D;
group.name = name;
const panel = (suffix, lenStart, lenEnd, yLo, yHi) => {
const segLen = lenEnd - lenStart;
@@ -32570,7 +32785,7 @@ function room(name, material, options = {}) {
parent
} = options;
const openings = options.openings ?? [{ wall: "front", kind: "door" }];
- const root = new THREE50.Object3D;
+ const root = new THREE51.Object3D;
root.name = name;
const wall = (suffix, len, axis, pos, which) => {
const w = wallWithOpening(`${name}_Wall${suffix}`, material, {
@@ -32624,7 +32839,7 @@ function createStairs(name, material, options) {
if (Math.abs(totalRise) < 0.0001 || Math.abs(totalRun) < 0.0001) {
throw new Error(`createStairs("${name}"): totalRise and totalRun must be non-zero (got rise=${totalRise}, run=${totalRun}).`);
}
- const root = new THREE50.Object3D;
+ const root = new THREE51.Object3D;
root.name = name;
const stepRise = totalRise / steps;
const stepRun = totalRun / steps;
@@ -32654,7 +32869,7 @@ function requireColor(color, fn) {
}
function gameMaterial(color, options = {}) {
requireColor(color, "gameMaterial");
- const material = new THREE50.MeshStandardMaterial({
+ const material = new THREE51.MeshStandardMaterial({
color,
metalness: options.metalness ?? 0,
roughness: options.roughness ?? 0.8,
@@ -32668,7 +32883,7 @@ function gameMaterial(color, options = {}) {
}
function basicMaterial(color, options = {}) {
requireColor(color, "basicMaterial");
- const material = new THREE50.MeshBasicMaterial({
+ const material = new THREE51.MeshBasicMaterial({
color,
transparent: options.transparent ?? false,
opacity: options.opacity ?? 1
@@ -32679,13 +32894,13 @@ function basicMaterial(color, options = {}) {
}
function glassMaterial(color, options = {}) {
requireColor(color, "glassMaterial");
- const material = new THREE50.MeshStandardMaterial({
+ const material = new THREE51.MeshStandardMaterial({
color,
transparent: true,
opacity: options.opacity ?? 0.35,
roughness: options.roughness ?? 0.1,
metalness: options.metalness ?? 0,
- side: THREE50.DoubleSide
+ side: THREE51.DoubleSide
});
if (options.name !== undefined)
material.name = assertMaterialName(options.name, "glassMaterial");
@@ -32693,7 +32908,7 @@ function glassMaterial(color, options = {}) {
}
function lambertMaterial(color, options = {}) {
requireColor(color, "lambertMaterial");
- const material = new THREE50.MeshLambertMaterial({
+ const material = new THREE51.MeshLambertMaterial({
color,
flatShading: options.flatShading ?? true,
emissive: options.emissive ?? 0
@@ -32706,12 +32921,12 @@ function threeInterpolation(mode) {
if (mode !== undefined && !TRACK_INTERPOLATIONS.includes(mode)) {
throw new Error(`Animation interpolation must be one of ${TRACK_INTERPOLATIONS.join(", ")}.`);
}
- return mode === "STEP" ? THREE50.InterpolateDiscrete : THREE50.InterpolateLinear;
+ return mode === "STEP" ? THREE51.InterpolateDiscrete : THREE51.InterpolateLinear;
}
function interpolatedTrack(Type, name, times, values, interpolation) {
if (!isCubicInterpolation(interpolation))
return new Type(name, times, values, threeInterpolation(interpolation));
- const quaternion = Type === THREE50.QuaternionKeyframeTrack;
+ const quaternion = Type === THREE51.QuaternionKeyframeTrack;
return useCubicSpline(new Type(name, times, cubicSplineValues(times, values, quaternion ? 4 : 3, interpolation, quaternion)));
}
function animationNumber(value, label) {
@@ -32765,15 +32980,15 @@ function rotationTrack(jointName, keyframes, interpolation) {
animationKeys(jointName, keyframes, "rotation", interpolation);
const times = [];
const values = [];
- const euler = new THREE50.Euler;
- const quat = new THREE50.Quaternion;
+ const euler = new THREE51.Euler;
+ const quat = new THREE51.Quaternion;
for (const kf of keyframes) {
times.push(kf.time);
- euler.set(THREE50.MathUtils.degToRad(kf.rotation[0]), THREE50.MathUtils.degToRad(kf.rotation[1]), THREE50.MathUtils.degToRad(kf.rotation[2]));
+ euler.set(THREE51.MathUtils.degToRad(kf.rotation[0]), THREE51.MathUtils.degToRad(kf.rotation[1]), THREE51.MathUtils.degToRad(kf.rotation[2]));
quat.setFromEuler(euler);
values.push(quat.x, quat.y, quat.z, quat.w);
}
- return interpolatedTrack(THREE50.QuaternionKeyframeTrack, `${jointName}.quaternion`, times, values, interpolation);
+ return interpolatedTrack(THREE51.QuaternionKeyframeTrack, `${jointName}.quaternion`, times, values, interpolation);
}
function positionTrack(jointName, keyframes, interpolation) {
animationKeys(jointName, keyframes, "position", interpolation);
@@ -32783,7 +32998,7 @@ function positionTrack(jointName, keyframes, interpolation) {
times.push(kf.time);
values.push(...kf.position);
}
- return interpolatedTrack(THREE50.VectorKeyframeTrack, `${jointName}.position`, times, values, interpolation);
+ return interpolatedTrack(THREE51.VectorKeyframeTrack, `${jointName}.position`, times, values, interpolation);
}
function scaleTrack(jointName, keyframes, interpolation) {
animationKeys(jointName, keyframes, "scale", interpolation);
@@ -32793,7 +33008,7 @@ function scaleTrack(jointName, keyframes, interpolation) {
times.push(kf.time);
values.push(...kf.scale);
}
- return interpolatedTrack(THREE50.VectorKeyframeTrack, `${jointName}.scale`, times, values, interpolation);
+ return interpolatedTrack(THREE51.VectorKeyframeTrack, `${jointName}.scale`, times, values, interpolation);
}
function createClip(name, duration, tracks, options) {
if (typeof name !== "string" || !name.trim())
@@ -32806,7 +33021,7 @@ function createClip(name, duration, tracks, options) {
const loop = clipLoopOption(options);
const names = new Set;
for (const track of tracks) {
- if (!(track instanceof THREE50.KeyframeTrack))
+ if (!(track instanceof THREE51.KeyframeTrack))
throw new Error("Animation clip tracks must be KeyframeTrack instances.");
if (typeof track.name !== "string")
throw new Error("Animation track target/channel must use a string name.");
@@ -32820,12 +33035,12 @@ function createClip(name, duration, tracks, options) {
throw new Error(`Duplicate animation target/channel: ${track.name}.`);
names.add(track.name);
const quaternion = channel === "quaternion";
- const Type = quaternion ? THREE50.QuaternionKeyframeTrack : THREE50.VectorKeyframeTrack;
+ const Type = quaternion ? THREE51.QuaternionKeyframeTrack : THREE51.VectorKeyframeTrack;
if (!(track instanceof Type))
throw new Error(`Animation channel ${channel} requires ${quaternion ? "QuaternionKeyframeTrack" : "VectorKeyframeTrack"}.`);
const cubic = isCubicSplineTrack(track);
const mode = track.getInterpolation();
- if (!cubic && mode !== THREE50.InterpolateLinear && mode !== THREE50.InterpolateDiscrete) {
+ if (!cubic && mode !== THREE51.InterpolateLinear && mode !== THREE51.InterpolateDiscrete) {
throw new Error("Animation interpolation must be LINEAR, STEP or CUBICSPLINE (the glTF sampler modes); three.js smooth and Bezier interpolants have no glTF form.");
}
animationTimes(track.times, track.name);
@@ -32848,7 +33063,7 @@ function createClip(name, duration, tracks, options) {
throw new Error(`Animation clip duration ${duration} does not include every key of ${track.name}.`);
}
}
- const clip = new THREE50.AnimationClip(name, duration, tracks);
+ const clip = new THREE51.AnimationClip(name, duration, tracks);
if (loop !== undefined)
clip.userData.kilnLoopIntent = loop ? "loop" : "once";
return clip;
@@ -32925,12 +33140,12 @@ function createInstance(name, source, options = {}) {
if (!sourceMesh) {
throw new Error(`createInstance("${name}"): source "${source.name}" has no Mesh to clone from`);
}
- const mesh = new THREE50.Mesh(sourceMesh.geometry, sourceMesh.material);
+ const mesh = new THREE51.Mesh(sourceMesh.geometry, sourceMesh.material);
mesh.name = `Mesh_${name}`;
if (options.position)
mesh.position.set(...options.position);
if (options.rotation)
- mesh.rotation.set(THREE50.MathUtils.degToRad(options.rotation[0]), THREE50.MathUtils.degToRad(options.rotation[1]), THREE50.MathUtils.degToRad(options.rotation[2]));
+ mesh.rotation.set(THREE51.MathUtils.degToRad(options.rotation[0]), THREE51.MathUtils.degToRad(options.rotation[1]), THREE51.MathUtils.degToRad(options.rotation[2]));
if (options.scale)
mesh.scale.set(...options.scale);
if (options.parent)
@@ -33223,7 +33438,7 @@ function buildSandboxGlobals(usage, options = {}) {
getJointNames: wrap("getJointNames", getJointNames),
materialBudgetAdvisory: wrap("materialBudgetAdvisory", materialBudgetAdvisory),
seededRandom: wrap("seededRandom", seededRandom),
- THREE: THREE50,
+ THREE: THREE51,
Math,
console: options.console ?? console
};
@@ -33352,7 +33567,7 @@ import {
PropertyType as PropertyType4
} from "@gltf-transform/core";
import { createTransform, dequantizePrimitive, joinPrimitives } from "@gltf-transform/functions";
-import * as THREE51 from "three";
+import * as THREE52 from "three";
function isSingular(matrix) {
const e = matrix.elements;
const scale = Math.hypot(e[0], e[1], e[2]) * Math.hypot(e[4], e[5], e[6]) * Math.hypot(e[8], e[9], e[10]);
@@ -33470,10 +33685,10 @@ function reverseWinding(prim) {
}
}
function bake(prim, matrix) {
- const linear = new THREE51.Matrix3().setFromMatrix4(matrix);
- const normalMatrix = new THREE51.Matrix3().getNormalMatrix(matrix);
+ const linear = new THREE52.Matrix3().setFromMatrix4(matrix);
+ const normalMatrix = new THREE52.Matrix3().getNormalMatrix(matrix);
const mirrored = matrix.determinant() < 0;
- const v = new THREE51.Vector3;
+ const v = new THREE52.Vector3;
const each = (semantic, apply) => {
const attribute = prim.getAttribute(semantic);
const element = [];
@@ -33497,7 +33712,7 @@ function destinationOf(entries) {
let best = Infinity;
let bestScale = Infinity;
for (const { node } of entries) {
- const linear = new THREE51.Matrix3().setFromMatrix4(worldOf(node));
+ const linear = new THREE52.Matrix3().setFromMatrix4(worldOf(node));
const norm = Math.hypot(...linear.elements);
const inverseNorm = Math.hypot(...linear.clone().invert().elements);
const condition = norm * inverseNorm;
@@ -33511,9 +33726,9 @@ function destinationOf(entries) {
return chosen;
}
function checkPositionPrecision(input, output, sourceWorld, destinationWorld, reversed) {
- const expected = new THREE51.Vector3;
- const actual = new THREE51.Vector3;
- const bounds = new THREE51.Box3;
+ const expected = new THREE52.Vector3;
+ const actual = new THREE52.Vector3;
+ const bounds = new THREE52.Box3;
const element = [];
let error = 0;
let magnitude = 0;
@@ -33834,7 +34049,7 @@ function rigidMerge(options = {}, onSummary) {
onSummary?.(summary);
});
}
-var JOINT_PIVOT, RESTART_MODES, BAKED, MAX_VERTICES = 65534, MAX_BYTES_PER_SAVED_DRAW = 4096, hasKeys = (value) => Object.keys(value).length > 0, worldOf = (node) => new THREE51.Matrix4().fromArray(node.getWorldMatrix()), nodeUsers = (mesh) => mesh.listParents().filter((parent) => parent.propertyType === PropertyType4.NODE).length, accessorsOf = (prim) => {
+var JOINT_PIVOT, RESTART_MODES, BAKED, MAX_VERTICES = 65534, MAX_BYTES_PER_SAVED_DRAW = 4096, hasKeys = (value) => Object.keys(value).length > 0, worldOf = (node) => new THREE52.Matrix4().fromArray(node.getWorldMatrix()), nodeUsers = (mesh) => mesh.listParents().filter((parent) => parent.propertyType === PropertyType4.NODE).length, accessorsOf = (prim) => {
const indices = prim.getIndices();
return indices ? [...prim.listAttributes(), indices] : prim.listAttributes();
}, primitiveBytes = (primitives) => [...new Set(primitives.flatMap(accessorsOf))].reduce((sum, a) => sum + (a.getArray()?.byteLength ?? 0), 0), countPrimitives = (nodes) => [...nodes].reduce((sum, node) => sum + (node.getMesh()?.listPrimitives().length ?? 0), 0);
@@ -35184,7 +35399,7 @@ var init_kit = __esm(() => {
// src/texture-bake.ts
import { createHash as createHash8 } from "node:crypto";
-import * as THREE52 from "three";
+import * as THREE53 from "three";
function readPixels(texture) {
const image = texture.image;
if (!image)
@@ -35311,7 +35526,7 @@ async function bakeSceneTextures(root, warnings) {
mime: "image/png",
bytes
};
- const colorSpace = entry.texture.colorSpace === THREE52.SRGBColorSpace ? "srgb" : "linear";
+ const colorSpace = entry.texture.colorSpace === THREE53.SRGBColorSpace ? "srgb" : "linear";
const recipe = entry.texture.userData["kilnProcedural"];
const primaryUsage = atlasRecord?.spec.usage ?? recipe?.usage ?? (entry.bindings.some(({ slot }) => slot === "roughnessMap") && entry.bindings.some(({ slot }) => slot === "metalnessMap") ? "metallicRoughness" : entry.bindings[0]?.usage ?? "albedo");
if (!encoded)
@@ -35394,10 +35609,10 @@ function computeTangentBasis(geometry) {
}
}
const out = new Float32Array(vertexCount * 4);
- const n = new THREE52.Vector3;
- const t = new THREE52.Vector3;
- const tmp = new THREE52.Vector3;
- const tmp2 = new THREE52.Vector3;
+ const n = new THREE53.Vector3;
+ const t = new THREE53.Vector3;
+ const tmp = new THREE53.Vector3;
+ const tmp2 = new THREE53.Vector3;
for (let v = 0;v < vertexCount; v++) {
n.set(normal.getX(v), normal.getY(v), normal.getZ(v));
t.set(tan1[v * 3], tan1[v * 3 + 1], tan1[v * 3 + 2]);
@@ -35417,7 +35632,7 @@ function computeTangentBasis(geometry) {
out[v * 4 + 2] = tmp.z;
out[v * 4 + 3] = w;
}
- geometry.setAttribute("tangent", new THREE52.BufferAttribute(out, 4));
+ geometry.setAttribute("tangent", new THREE53.BufferAttribute(out, 4));
}
function ensureNormalMapTangents(root, warnings) {
let count = 0;
@@ -35655,7 +35870,7 @@ import {
KHRTextureBasisu as KHRTextureBasisu2
} from "@gltf-transform/extensions";
import { cloneDocument, dedup, prune, quantize, reorder } from "@gltf-transform/functions";
-import * as THREE53 from "three";
+import * as THREE54 from "three";
function meshSignature(mesh, ids) {
const id = (property) => {
if (!property)
@@ -35803,8 +36018,8 @@ function isCoreMaterialUse(parent) {
return parent.propertyType === PropertyType5.MATERIAL;
}
function decomposeDelta(before, after) {
- const delta = new THREE53.Matrix4().fromArray(before).invert().multiply(new THREE53.Matrix4().fromArray(after));
- const position = new THREE53.Vector3, quaternion = new THREE53.Quaternion, scale = new THREE53.Vector3;
+ const delta = new THREE54.Matrix4().fromArray(before).invert().multiply(new THREE54.Matrix4().fromArray(after));
+ const position = new THREE54.Vector3, quaternion = new THREE54.Quaternion, scale = new THREE54.Vector3;
delta.decompose(position, quaternion, scale);
return {
scale: scale.x,
@@ -35832,12 +36047,12 @@ function positionGridSteps(doc, bits) {
if (level.propertyType === PropertyType5.NODE)
lodBase.set(level, node);
const world = (node) => {
- const matrix = new THREE53.Matrix4().fromArray(node.getWorldMatrix());
+ const matrix = new THREE54.Matrix4().fromArray(node.getWorldMatrix());
let top = node;
while (top.getParentNode())
top = top.getParentNode();
const placed = lodBase.get(top)?.getParentNode();
- return placed ? new THREE53.Matrix4().fromArray(placed.getWorldMatrix()).multiply(matrix) : matrix;
+ return placed ? new THREE54.Matrix4().fromArray(placed.getWorldMatrix()).multiply(matrix) : matrix;
};
const halfExtent = (mesh) => {
const min = [Infinity, Infinity, Infinity];
@@ -35985,7 +36200,7 @@ async function deliverRuntimeThreeGlb(bytes, meshoptEncoder, options = {}, layou
const original = matrices.get(node);
const moved = original === undefined;
const split = moved || proxyNodes.has(node);
- const reference = moved ? new THREE53.Matrix4().identity().toArray() : original;
+ const reference = moved ? new THREE54.Matrix4().identity().toArray() : original;
const current = [...node.getMatrix()];
const { scale, offset } = decomposeDelta(reference, current);
if (!moved && Math.abs(scale - 1) < 0.000000000001 && offset.every((v) => v === 0))
@@ -36181,13 +36396,13 @@ var init_exporter_node = __esm(() => {
});
// src/views/character.ts
-import * as THREE54 from "three";
-function rounded(value) {
+import * as THREE55 from "three";
+function rounded2(value) {
const result = Math.round(value * 1e9) / 1e9;
return Object.is(result, -0) ? 0 : result;
}
function tuple6(vector) {
- return [rounded(vector.x), rounded(vector.y), rounded(vector.z)];
+ return [rounded2(vector.x), rounded2(vector.y), rounded2(vector.z)];
}
function chainIdFor(descriptor, byRole) {
if (AXIAL_ROLES.has(descriptor.role))
@@ -36223,9 +36438,9 @@ function buildCharacterDiagnosticDescriptor(root, findings = []) {
const invalidPaths = new Set(invalidFindingNodePaths);
const joints = evidence.map((joint) => {
const relative = rootInverse.clone().multiply(joint.node.matrixWorld);
- const position = new THREE54.Vector3().setFromMatrixPosition(relative);
- const forward = new THREE54.Vector3(...joint.descriptor.localForwardAxis).transformDirection(relative).multiplyScalar(0.2).add(position);
- const bend = new THREE54.Vector3(...joint.descriptor.localBendAxis).transformDirection(relative).multiplyScalar(0.2).add(position);
+ const position = new THREE55.Vector3().setFromMatrixPosition(relative);
+ const forward = new THREE55.Vector3(...joint.descriptor.localForwardAxis).transformDirection(relative).multiplyScalar(0.2).add(position);
+ const bend = new THREE55.Vector3(...joint.descriptor.localBendAxis).transformDirection(relative).multiplyScalar(0.2).add(position);
const chainId = chainIdFor(joint.descriptor, descriptorByRole);
return {
role: joint.descriptor.role,
@@ -37207,7 +37422,7 @@ import {
PropertyBinding as PropertyBinding3,
VectorKeyframeTrack as VectorKeyframeTrack2,
Quaternion as Quaternion20,
- Vector3 as Vector341,
+ Vector3 as Vector342,
InterpolateDiscrete as InterpolateDiscrete2,
InterpolateLinear as InterpolateLinear2
} from "three";
@@ -37391,7 +37606,7 @@ function instanceMatrices(node) {
translations?.getElement(index, translation);
rotations?.getElement(index, rotation);
scales?.getElement(index, scale);
- const local = new Matrix418().compose(new Vector341(translations ? translation[0] : 0, translations ? translation[1] : 0, translations ? translation[2] : 0), new Quaternion20(rotations ? rotation[0] : 0, rotations ? rotation[1] : 0, rotations ? rotation[2] : 0, rotations ? rotation[3] : 1).normalize(), new Vector341(scales ? scale[0] : 1, scales ? scale[1] : 1, scales ? scale[2] : 1));
+ const local = new Matrix418().compose(new Vector342(translations ? translation[0] : 0, translations ? translation[1] : 0, translations ? translation[2] : 0), new Quaternion20(rotations ? rotation[0] : 0, rotations ? rotation[1] : 0, rotations ? rotation[2] : 0, rotations ? rotation[3] : 1).normalize(), new Vector342(scales ? scale[0] : 1, scales ? scale[1] : 1, scales ? scale[2] : 1));
matrices.push(world.clone().multiply(local));
}
return { matrices, count };
@@ -37498,7 +37713,7 @@ function localInstanceMatrices(node) {
translations?.getElement(index, translation);
rotations?.getElement(index, rotation);
scales?.getElement(index, scale);
- return new Matrix418().compose(new Vector341(...translations ? translation.slice(0, 3) : [0, 0, 0]), new Quaternion20(...rotations ? rotation.slice(0, 4) : [0, 0, 0, 1]).normalize(), new Vector341(...scales ? scale.slice(0, 3) : [1, 1, 1]));
+ return new Matrix418().compose(new Vector342(...translations ? translation.slice(0, 3) : [0, 0, 0]), new Quaternion20(...rotations ? rotation.slice(0, 4) : [0, 0, 0, 1]).normalize(), new Vector342(...scales ? scale.slice(0, 3) : [1, 1, 1]));
});
}
async function loadGlbReviewScene(bytes) {
@@ -37872,7 +38087,7 @@ var init_renderer_id = __esm(() => {
});
// src/views/scene-raster.ts
-import * as THREE55 from "three";
+import * as THREE56 from "three";
var DEG2;
var init_scene_raster = __esm(() => {
init_evaluator();
@@ -37884,18 +38099,18 @@ var init_scene_raster = __esm(() => {
});
// src/views/vehicle.ts
-import * as THREE56 from "three";
+import * as THREE57 from "three";
function hasRole2(node, prefix) {
return readSemanticMetadataV1(node)?.roles.some((role) => role === prefix || role.startsWith(`${prefix}.`)) ?? false;
}
function chassisBounds(root, inverse) {
- const bounds = new THREE56.Box3;
+ const bounds = new THREE57.Box3;
let found = false;
root.traverse((node) => {
if (!hasRole2(node, "chassis"))
return;
node.traverse((part) => {
- if (!(part instanceof THREE56.Mesh) || !(part.geometry instanceof THREE56.BufferGeometry))
+ if (!(part instanceof THREE57.Mesh) || !(part.geometry instanceof THREE57.BufferGeometry))
return;
part.geometry.computeBoundingBox();
const box = part.geometry.boundingBox;
@@ -37905,7 +38120,7 @@ function chassisBounds(root, inverse) {
for (const x of [box.min.x, box.max.x])
for (const y of [box.min.y, box.max.y])
for (const z of [box.min.z, box.max.z]) {
- bounds.expandByPoint(new THREE56.Vector3(x, y, z).applyMatrix4(matrix));
+ bounds.expandByPoint(new THREE57.Vector3(x, y, z).applyMatrix4(matrix));
found = true;
}
});
@@ -37973,33 +38188,33 @@ function tagDiagnostic(node, role) {
stampSemanticMetadataV1(node, { roles: [role] });
}
function rod(name, start, end, radius, color, role) {
- const from = new THREE56.Vector3(...start);
- const to = new THREE56.Vector3(...end);
+ const from = new THREE57.Vector3(...start);
+ const to = new THREE57.Vector3(...end);
const direction = to.clone().sub(from);
const length = direction.length();
- const geometry = length > 0.000000001 ? new THREE56.CylinderGeometry(radius, radius, length, 8) : new THREE56.SphereGeometry(radius, 8, 6);
- const result = new THREE56.Mesh(geometry, new THREE56.MeshBasicMaterial({ color }));
+ const geometry = length > 0.000000001 ? new THREE57.CylinderGeometry(radius, radius, length, 8) : new THREE57.SphereGeometry(radius, 8, 6);
+ const result = new THREE57.Mesh(geometry, new THREE57.MeshBasicMaterial({ color }));
result.name = name;
result.position.copy(from).add(to).multiplyScalar(0.5);
if (length > 0.000000001) {
- result.quaternion.setFromUnitVectors(new THREE56.Vector3(0, 1, 0), direction.multiplyScalar(1 / length));
+ result.quaternion.setFromUnitVectors(new THREE57.Vector3(0, 1, 0), direction.multiplyScalar(1 / length));
}
tagDiagnostic(result, role);
return result;
}
function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagnostics(root)) {
- const overlay = new THREE56.Group;
+ const overlay = new THREE57.Group;
overlay.name = "VehicleDiagnosticOverlay";
const chassisSpan = descriptor.chassisBox ? Math.max(descriptor.chassisBox.max[0] - descriptor.chassisBox.min[0], descriptor.chassisBox.max[1] - descriptor.chassisBox.min[1], descriptor.chassisBox.max[2] - descriptor.chassisBox.min[2]) : 1;
const thickness = Math.max(0.01, chassisSpan * 0.008);
- const arrow = new THREE56.Group;
+ const arrow = new THREE57.Group;
arrow.name = "Diagnostic_Forward_+X";
tagDiagnostic(arrow, "diagnostic.vehicle.forward");
arrow.add(rod("Diagnostic_Forward_Shaft", descriptor.forwardArrow.start, [descriptor.forwardArrow.end[0] - 0.12, 0, 0], thickness, 16724804, "diagnostic.vehicle.forward"));
- const arrowHead = new THREE56.Mesh(new THREE56.ConeGeometry(thickness * 3.2, 0.24, 10), new THREE56.MeshBasicMaterial({ color: 16724804 }));
+ const arrowHead = new THREE57.Mesh(new THREE57.ConeGeometry(thickness * 3.2, 0.24, 10), new THREE57.MeshBasicMaterial({ color: 16724804 }));
arrowHead.name = "Diagnostic_Forward_Head";
arrowHead.position.set(descriptor.forwardArrow.end[0] - 0.12, 0, 0);
- arrowHead.quaternion.setFromUnitVectors(new THREE56.Vector3(0, 1, 0), new THREE56.Vector3(1, 0, 0));
+ arrowHead.quaternion.setFromUnitVectors(new THREE57.Vector3(0, 1, 0), new THREE57.Vector3(1, 0, 0));
tagDiagnostic(arrowHead, "diagnostic.vehicle.forward");
arrow.add(arrowHead);
overlay.add(arrow);
@@ -38007,18 +38222,18 @@ function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagno
overlay.add(rod(`Diagnostic_Axle_${axle.id}`, axle.start, axle.end, thickness, 3386111, `diagnostic.vehicle.axle.${axle.id}`));
}
for (const wheel of descriptor.wheels) {
- const ring = new THREE56.Mesh(new THREE56.TorusGeometry(wheel.radius, Math.min(thickness, wheel.radius * 0.15), 6, 32), new THREE56.MeshBasicMaterial({ color: 16763955 }));
+ const ring = new THREE57.Mesh(new THREE57.TorusGeometry(wheel.radius, Math.min(thickness, wheel.radius * 0.15), 6, 32), new THREE57.MeshBasicMaterial({ color: 16763955 }));
ring.name = `Diagnostic_Wheel_${wheel.id}`;
ring.position.set(...wheel.center);
- const axle = new THREE56.Vector3(...wheel.axle);
+ const axle = new THREE57.Vector3(...wheel.axle);
if (axle.lengthSq() > 0.000000000001) {
- ring.quaternion.setFromUnitVectors(new THREE56.Vector3(0, 0, 1), axle.normalize());
+ ring.quaternion.setFromUnitVectors(new THREE57.Vector3(0, 0, 1), axle.normalize());
}
tagDiagnostic(ring, `diagnostic.vehicle.wheel.${wheel.id}`);
overlay.add(ring);
}
if (descriptor.chassisBox) {
- const chassis = new THREE56.Group;
+ const chassis = new THREE57.Group;
chassis.name = "Diagnostic_ChassisBox";
tagDiagnostic(chassis, "diagnostic.vehicle.chassis");
const { min, max } = descriptor.chassisBox;
@@ -38052,7 +38267,7 @@ function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagno
overlay.add(chassis);
}
if (descriptor.supportPlaneY !== undefined) {
- const plane = new THREE56.Group;
+ const plane = new THREE57.Group;
plane.name = "Diagnostic_SupportPlane";
tagDiagnostic(plane, "diagnostic.vehicle.support-plane");
const halfX = Math.max(1, ...descriptor.chassisBox ? [Math.abs(descriptor.chassisBox.min[0]), Math.abs(descriptor.chassisBox.max[0])] : [], ...descriptor.wheels.map((wheel) => Math.abs(wheel.center[0]) + wheel.radius)) + 0.2;
@@ -38650,7 +38865,7 @@ var init_views = __esm(() => {
});
// src/views/character-capture.ts
-import * as THREE57 from "three";
+import * as THREE58 from "three";
function drawLine2(rgb, width, height, from, to, color) {
let x0 = Math.round(from[0]);
let y0 = Math.round(from[1]);
@@ -38687,22 +38902,22 @@ function drawCross(rgb, width, height, point, color, radius = 3) {
}
function projector(root, cameraId, size) {
root.updateMatrixWorld(true);
- const bounds = new THREE57.Box3().setFromObject(root);
+ const bounds = new THREE58.Box3().setFromObject(root);
if (bounds.isEmpty())
- bounds.set(new THREE57.Vector3(-0.5, 0, -0.5), new THREE57.Vector3(0.5, 1, 0.5));
- const center = bounds.getCenter(new THREE57.Vector3);
- const camera = cameraId === "front" ? new THREE57.Vector3(1, 0, 0) : new THREE57.Vector3(0, 0, 1);
- const upHint = new THREE57.Vector3(0, 1, 0);
- const xAxis = new THREE57.Vector3().crossVectors(upHint, camera).normalize();
- const yAxis = new THREE57.Vector3().crossVectors(camera, xAxis).normalize();
+ bounds.set(new THREE58.Vector3(-0.5, 0, -0.5), new THREE58.Vector3(0.5, 1, 0.5));
+ const center = bounds.getCenter(new THREE58.Vector3);
+ const camera = cameraId === "front" ? new THREE58.Vector3(1, 0, 0) : new THREE58.Vector3(0, 0, 1);
+ const upHint = new THREE58.Vector3(0, 1, 0);
+ const xAxis = new THREE58.Vector3().crossVectors(upHint, camera).normalize();
+ const yAxis = new THREE58.Vector3().crossVectors(camera, xAxis).normalize();
let extent = 0.000001;
for (let corner = 0;corner < 8; corner++) {
- const point = new THREE57.Vector3(corner & 1 ? bounds.max.x : bounds.min.x, corner & 2 ? bounds.max.y : bounds.min.y, corner & 4 ? bounds.max.z : bounds.min.z).sub(center);
+ const point = new THREE58.Vector3(corner & 1 ? bounds.max.x : bounds.min.x, corner & 2 ? bounds.max.y : bounds.min.y, corner & 4 ? bounds.max.z : bounds.min.z).sub(center);
extent = Math.max(extent, Math.abs(point.dot(xAxis)), Math.abs(point.dot(yAxis)));
}
const scale = size * 0.45 / extent;
return (assetPoint) => {
- const world = new THREE57.Vector3(...assetPoint).applyMatrix4(root.matrixWorld).sub(center);
+ const world = new THREE58.Vector3(...assetPoint).applyMatrix4(root.matrixWorld).sub(center);
return [size / 2 + world.dot(xAxis) * scale, size / 2 - world.dot(yAxis) * scale];
};
}
@@ -38828,7 +39043,7 @@ var init_character_capture = __esm(() => {
});
// src/render.ts
-import * as THREE58 from "three";
+import * as THREE59 from "three";
import { Document, Logger as Logger2 } from "@gltf-transform/core";
import { KHRMaterialsEmissiveStrength } from "@gltf-transform/extensions";
import { dedup as dedup2, instance, palette, weld as weld2, prune as prune2, mergeDocuments } from "@gltf-transform/functions";
@@ -39058,7 +39273,7 @@ function bridgeMaterial(doc, threeMat, cache, textureCache, authorExtras, atlas)
} else if (stdMat.transparent) {
mat.setAlphaMode("BLEND");
}
- if (stdMat.side === THREE58.DoubleSide) {
+ if (stdMat.side === THREE59.DoubleSide) {
mat.setDoubleSided(true);
}
if (stdMat.map) {
@@ -39135,7 +39350,7 @@ function bridgeMaterial(doc, threeMat, cache, textureCache, authorExtras, atlas)
} else if (common.transparent || (common.opacity ?? 1) < 1) {
mat.setAlphaMode("BLEND");
}
- if (threeMat.side === THREE58.DoubleSide)
+ if (threeMat.side === THREE59.DoubleSide)
mat.setDoubleSided(true);
if (common.map && !mat.getBaseColorTexture()) {
const texture = bridgeTexture(doc, common.map, textureCache);
@@ -39298,7 +39513,7 @@ function bridgeNode(doc, buf, threeObj, matCache, nodeMap, meshCache, texCache,
const cacheKey = `kiln-sprite-quad:${centerX}:${centerY}:${rotation}__${threeMat.uuid}`;
let gtMesh = meshCache.get(cacheKey);
if (!gtMesh) {
- const geometry = new THREE58.PlaneGeometry(1, 1);
+ const geometry = new THREE59.PlaneGeometry(1, 1);
if (centerX !== 0.5 || centerY !== 0.5) {
geometry.translate(0.5 - centerX, 0.5 - centerY, 0);
}
@@ -39322,9 +39537,9 @@ function animationInterpolation(track) {
if (isCubicSplineTrack(track))
return "CUBICSPLINE";
const mode = track.getInterpolation();
- if (mode === THREE58.InterpolateDiscrete)
+ if (mode === THREE59.InterpolateDiscrete)
return "STEP";
- if (mode === THREE58.InterpolateLinear)
+ if (mode === THREE59.InterpolateLinear)
return "LINEAR";
throw new Error(`Unsupported animation interpolation on ${track.name}; use LINEAR, STEP or CUBICSPLINE.`);
}
@@ -39859,6 +40074,22 @@ function inspectGeneratedAnimation(root, clips) {
}
return warnings;
}
+function collapseWeldedFloaters(floaters, pieces) {
+ for (let i = 0;i < floaters.length; i++) {
+ const mesh = floaters[i].welded;
+ if (!mesh)
+ continue;
+ const detached = floaters.filter((floater) => floater.welded === mesh).length;
+ if (detached < 2)
+ continue;
+ const of = pieces.find((piece) => piece.welded?.mesh === mesh)?.welded?.of ?? detached;
+ floaters[i].name = `${mesh} (${detached} of its ${of} welded components)`;
+ for (let j = floaters.length - 1;j > i; j--)
+ if (floaters[j].welded === mesh)
+ floaters.splice(j, 1);
+ floaters[i].welded = undefined;
+ }
+}
function collectMeshStats(root) {
root.updateMatrixWorld(true);
const out = [];
@@ -39888,8 +40119,8 @@ function collectMeshStats(root) {
if (!Number.isFinite(box.min.x) || !Number.isFinite(box.max.x)) {
return;
}
- const center = new THREE58.Vector3;
- const size = new THREE58.Vector3;
+ const center = new THREE59.Vector3;
+ const size = new THREE59.Vector3;
box.getCenter(center);
box.getSize(size);
out.push({
@@ -39905,7 +40136,7 @@ function collectMeshStats(root) {
return out;
}
function minimalGapVector(a, b) {
- const v = new THREE58.Vector3;
+ const v = new THREE59.Vector3;
for (const axis of ["x", "y", "z"]) {
if (a.min[axis] > b.max[axis])
v[axis] = b.max[axis] - a.min[axis];
@@ -39923,10 +40154,10 @@ function inspectSceneStructure(root, opts = {}) {
return warnings;
const cat = opts.category?.toLowerCase();
if (cat === "vehicle" || cat === "weapon" || cat === "boat" || cat === "aircraft") {
- const all = new THREE58.Box3;
+ const all = new THREE59.Box3;
for (const m of meshes)
all.union(m.box);
- const size = new THREE58.Vector3;
+ const size = new THREE59.Vector3;
all.getSize(size);
if (cat === "aircraft") {
if (size.y > size.x * 1.2) {
@@ -39950,17 +40181,28 @@ function inspectSceneStructure(root, opts = {}) {
warnings.push(`Stray plane "${m.name}" at world origin (centroid ≈ [0,0,0]). Replace planeGeo with decalBox and position on a host surface, or move this mesh into place.`);
}
}
- if (meshes.length > 1) {
+ const budget = splitBudget();
+ const pieces = meshes.flatMap((mesh) => {
+ const boxes = meshComponentBoxes(mesh.object, budget);
+ if (!boxes || boxes.length < 2)
+ return [mesh];
+ return boxes.map((box, index) => ({
+ ...mesh,
+ box,
+ welded: { mesh: mesh.name, index: index + 1, of: boxes.length }
+ }));
+ });
+ if (pieces.length > 1) {
const floaters = [];
const supported = [];
- for (let i = 0;i < meshes.length; i++) {
- const a = meshes[i];
+ for (let i = 0;i < pieces.length; i++) {
+ const a = pieces[i];
const ax = a.box.clone().expandByScalar(FLOATING_EXPAND);
let overlapsAny = false;
- for (let j = 0;j < meshes.length; j++) {
+ for (let j = 0;j < pieces.length; j++) {
if (i === j)
continue;
- const b = meshes[j];
+ const b = pieces[j];
if (ax.intersectsBox(b.box)) {
overlapsAny = true;
break;
@@ -39976,19 +40218,25 @@ function inspectSceneStructure(root, opts = {}) {
const declared = declaredSupports(a.object, opts.externalSupport)[0];
let nearest;
let nearestGap;
- for (let j = 0;j < meshes.length; j++) {
+ for (let j = 0;j < pieces.length; j++) {
if (i === j)
continue;
- const gap = minimalGapVector(a.box, meshes[j].box);
+ const gap = minimalGapVector(a.box, pieces[j].box);
if (!nearestGap || gap.length() < nearestGap.length()) {
- nearest = meshes[j];
+ nearest = pieces[j];
nearestGap = gap;
}
}
- const fix = nearest && nearestGap ? ` Fix: shift "${a.name}" by [${nearestGap.x.toFixed(3)}, ${nearestGap.y.toFixed(3)}, ${nearestGap.z.toFixed(3)}] toward "${nearest.name}", or call snapTo(part, hostPart) to do it automatically.` : "";
+ const fix = a.welded ? ` Fix: one mesh moves and hides as one, so close the gap in the merged geometry, or author the component as its own part. It spans ${spanText(a.box)}.` : nearest && nearestGap ? ` Fix: shift "${a.name}" by [${nearestGap.x.toFixed(3)}, ${nearestGap.y.toFixed(3)}, ${nearestGap.z.toFixed(3)}] toward "${nearest.name}", or call snapTo(part, hostPart) to do it automatically.` : "";
const mismatch = declared ? ` It is named in a declared external support at Y=${declared.planeY.toFixed(3)}, but its bottom is at Y=${a.box.min.y.toFixed(3)}.` : "";
- floaters.push({ name: a.name, fix: fix + mismatch });
+ const name = a.welded ? `${a.welded.mesh} (welded component ${a.welded.index} of ${a.welded.of})` : a.name;
+ floaters.push({
+ name,
+ fix: fix + mismatch,
+ ...a.welded ? { welded: a.welded.mesh } : {}
+ });
}
+ collapseWeldedFloaters(floaters, pieces);
if (floaters.length > 0) {
const entries = floaters.slice(0, FLOATER_FIXES_SHOWN).map(({ name, fix }) => `${name}${fix ? ` —${fix}` : ""}`);
const rest = floaters.slice(FLOATER_FIXES_SHOWN);
@@ -39998,7 +40246,7 @@ function inspectSceneStructure(root, opts = {}) {
names.push(`+${rest.length - names.length} more`);
entries.push(`+${rest.length} more floating: ${names.join(", ")} — the same fix applies: shift each onto its nearest sibling, or call snapTo(part, hostPart).`);
}
- warnings.push(`Floating parts (no mesh overlap with any sibling, 2cm tol): ${entries.join(" | ")} — Coverage: drawn meshes only, at 2cm. A smaller gap reads as contact and a primitive welded into another mesh is never seen, so a silent pass is not a fit audit; measure contacts in the destination.`);
+ warnings.push(`Floating parts (no mesh overlap with any sibling, 2cm tol): ${entries.join(" | ")} — Coverage: drawn meshes only, at 2cm. Welded components inside one mesh are compared the same way, box to box. A smaller gap reads as contact, so a silent pass is not a fit audit; measure contacts in the destination.${budget.unsplit.length ? ` Over the split budget, so measured as one box: ${budget.unsplit.slice(0, FLOATER_NAMES_SHOWN).join(", ")}.` : ""}`);
}
if (supported.length > 0) {
const shown = supported.slice(0, FLOATER_NAMES_SHOWN);
@@ -40009,11 +40257,12 @@ function inspectSceneStructure(root, opts = {}) {
}
return warnings;
}
-var engineIO, TYPE_SCALAR = "SCALAR", TYPE_VEC2 = "VEC2", TYPE_VEC3 = "VEC3", TYPE_VEC4 = "VEC4", ACCESSOR_TYPES, GROUND_CONTACT_TOLERANCE = 0.02, GLTF_MIN_FILTER, GLTF_MAG_FILTER, GLTF_WRAP, REVIEW_CLIPS_EXTRAS_KEY2 = "kilnReviewClipsV1", REVIEW_CLIP_LIMITS2, PALETTE_MIN = 4, INSTANCE_MIN = 5, FLOATER_FIXES_SHOWN = 6, FLOATER_NAMES_SHOWN = 24;
+var engineIO, TYPE_SCALAR = "SCALAR", TYPE_VEC2 = "VEC2", TYPE_VEC3 = "VEC3", TYPE_VEC4 = "VEC4", ACCESSOR_TYPES, GROUND_CONTACT_TOLERANCE = 0.02, GLTF_MIN_FILTER, GLTF_MAG_FILTER, GLTF_WRAP, REVIEW_CLIPS_EXTRAS_KEY2 = "kilnReviewClipsV1", REVIEW_CLIP_LIMITS2, PALETTE_MIN = 4, INSTANCE_MIN = 5, spanText = (box) => `[${box.min.toArray().map((v) => v.toFixed(3)).join(", ")}] to [${box.max.toArray().map((v) => v.toFixed(3)).join(", ")}]`, FLOATER_FIXES_SHOWN = 6, FLOATER_NAMES_SHOWN = 24;
var init_render = __esm(() => {
init_requirements_context();
init_requirements_run();
init_requirements_report();
+ init_mesh_components();
init_skin_integrity();
init_authoring_diagnostic();
init_gltf_io();
@@ -40051,18 +40300,18 @@ var init_render = __esm(() => {
engineIO = createGltfIO;
ACCESSOR_TYPES = [TYPE_SCALAR, TYPE_VEC2, TYPE_VEC3, TYPE_VEC4];
GLTF_MIN_FILTER = {
- [THREE58.NearestFilter]: 9728,
- [THREE58.LinearFilter]: 9729,
- [THREE58.NearestMipmapNearestFilter]: 9984,
- [THREE58.LinearMipmapNearestFilter]: 9985,
- [THREE58.NearestMipmapLinearFilter]: 9986,
- [THREE58.LinearMipmapLinearFilter]: 9987
- };
- GLTF_MAG_FILTER = { [THREE58.NearestFilter]: 9728, [THREE58.LinearFilter]: 9729 };
+ [THREE59.NearestFilter]: 9728,
+ [THREE59.LinearFilter]: 9729,
+ [THREE59.NearestMipmapNearestFilter]: 9984,
+ [THREE59.LinearMipmapNearestFilter]: 9985,
+ [THREE59.NearestMipmapLinearFilter]: 9986,
+ [THREE59.LinearMipmapLinearFilter]: 9987
+ };
+ GLTF_MAG_FILTER = { [THREE59.NearestFilter]: 9728, [THREE59.LinearFilter]: 9729 };
GLTF_WRAP = {
- [THREE58.ClampToEdgeWrapping]: 33071,
- [THREE58.MirroredRepeatWrapping]: 33648,
- [THREE58.RepeatWrapping]: 10497
+ [THREE59.ClampToEdgeWrapping]: 33071,
+ [THREE59.MirroredRepeatWrapping]: 33648,
+ [THREE59.RepeatWrapping]: 10497
};
REVIEW_CLIP_LIMITS2 = {
clips: 32,
@@ -40663,28 +40912,28 @@ var exports_part_placement = {};
__export(exports_part_placement, {
createPartPlacementReader: () => createPartPlacementReader
});
-import * as THREE59 from "three";
+import * as THREE60 from "three";
function createPartPlacementReader(root) {
const bounds = createPartBoundsReader(root);
- const position = new THREE59.Vector3;
- const quaternion = new THREE59.Quaternion;
- const scale = new THREE59.Vector3;
+ const position = new THREE60.Vector3;
+ const quaternion = new THREE60.Quaternion;
+ const scale = new THREE60.Vector3;
return (node) => {
node.matrixWorld.decompose(position, quaternion, scale);
const box = bounds(node);
return {
- position: rounded2(position.toArray()),
- quaternion: rounded2(quaternion.toArray()),
- scale: rounded2(scale.toArray()),
+ position: rounded3(position.toArray()),
+ quaternion: rounded3(quaternion.toArray()),
+ scale: rounded3(scale.toArray()),
mirrored: node.matrixWorld.determinant() < 0,
- bounds: box ? { min: rounded2(box.min), max: rounded2(box.max) } : null
+ bounds: box ? { min: rounded3(box.min), max: rounded3(box.max) } : null
};
};
}
var round4 = (value) => {
const rounded = Math.round(value * 1e6) / 1e6;
return rounded === 0 ? 0 : rounded;
-}, rounded2 = (values) => values.map(round4);
+}, rounded3 = (values) => values.map(round4);
var init_part_placement = __esm(() => {
init_raster();
});
@@ -40819,13 +41068,13 @@ var init_inspect = __esm(() => {
});
// src/views/measurement.ts
-import { Box3 as Box327, Vector3 as Vector346 } from "three";
+import { Box3 as Box328, Vector3 as Vector347 } from "three";
function describeSubjectFrame(root, subject) {
const selected = selectCameraSubject(root, subject);
selected.node.updateWorldMatrix(true, true);
const matrix = selected.node.matrixWorld;
- const bounds = new Box327().setFromObject(selected.node);
- const local = new Box327;
+ const bounds = new Box328().setFromObject(selected.node);
+ const local = new Box328;
const invertible = matrix.determinant() !== 0;
const inverse = matrix.clone().invert();
selected.node.traverse((node) => {
@@ -40836,10 +41085,10 @@ function describeSubjectFrame(root, subject) {
if (!attr)
return;
for (let i = 0;i < attr.count; i++)
- local.expandByPoint(new Vector346().fromBufferAttribute(attr, i).applyMatrix4(mesh.matrixWorld).applyMatrix4(inverse));
+ local.expandByPoint(new Vector347().fromBufferAttribute(attr, i).applyMatrix4(mesh.matrixWorld).applyMatrix4(inverse));
});
const box = (b) => b.isEmpty() ? null : { min: b.min.toArray(), max: b.max.toArray() };
- const axis = (i) => new Vector346().setFromMatrixColumn(matrix, i).normalize().toArray();
+ const axis = (i) => new Vector347().setFromMatrixColumn(matrix, i).normalize().toArray();
return {
path: selected.path,
name: selected.name,
@@ -40849,7 +41098,7 @@ function describeSubjectFrame(root, subject) {
invertible,
worldMatrix: matrix.toArray(),
axes: { frame: "world", x: axis(0), y: axis(1), z: axis(2) },
- origin: new Vector346().setFromMatrixPosition(matrix).toArray()
+ origin: new Vector347().setFromMatrixPosition(matrix).toArray()
};
}
function measureAttachment(root, input) {
@@ -40862,7 +41111,7 @@ function measureAttachment(root, input) {
return {
path: selected.path,
local: [...local],
- world: new Vector346(...local).applyMatrix4(selected.node.matrixWorld).toArray()
+ world: new Vector347(...local).applyMatrix4(selected.node.matrixWorld).toArray()
};
};
const from = endpoint(input.from), to = endpoint(input.to);
@@ -40872,7 +41121,7 @@ function measureAttachment(root, input) {
method: "straight-line anchor distance",
from,
to,
- distance: new Vector346(...from.world).distanceTo(new Vector346(...to.world))
+ distance: new Vector347(...from.world).distanceTo(new Vector347(...to.world))
};
}
var init_measurement = __esm(() => {
@@ -40884,7 +41133,7 @@ import {
PropertyType as PropertyType6
} from "@gltf-transform/core";
import { ALL_EXTENSIONS as ALL_EXTENSIONS2 } from "@gltf-transform/extensions";
-import { Box3 as Box328, Matrix4 as Matrix419, Quaternion as Quaternion23, Vector3 as Vector347 } from "three";
+import { Box3 as Box329, Matrix4 as Matrix419, Quaternion as Quaternion23, Vector3 as Vector348 } from "three";
async function accessorFingerprint(accessor) {
const array = accessor?.getArray();
if (!accessor || !array)
@@ -40903,7 +41152,7 @@ function bounds(box) {
return box.isEmpty() ? null : {
min: box.min.toArray(),
max: box.max.toArray(),
- size: box.getSize(new Vector347).toArray()
+ size: box.getSize(new Vector348).toArray()
};
}
async function digest3(bytes) {
@@ -40919,7 +41168,7 @@ function placements(node) {
const rotation = instances.getAttribute("ROTATION");
const scale = instances.getAttribute("SCALE");
const count = translation?.getCount() ?? rotation?.getCount() ?? scale?.getCount() ?? 1;
- return Array.from({ length: count }, (_, i) => world.clone().multiply(new Matrix419().compose(new Vector347().fromArray(translation?.getElement(i, []) ?? [0, 0, 0]), new Quaternion23().fromArray(rotation?.getElement(i, []) ?? [0, 0, 0, 1]), new Vector347().fromArray(scale?.getElement(i, []) ?? [1, 1, 1]))));
+ return Array.from({ length: count }, (_, i) => world.clone().multiply(new Matrix419().compose(new Vector348().fromArray(translation?.getElement(i, []) ?? [0, 0, 0]), new Quaternion23().fromArray(rotation?.getElement(i, []) ?? [0, 0, 0, 1]), new Vector348().fromArray(scale?.getElement(i, []) ?? [1, 1, 1]))));
}
function triangleCorners(mode, count) {
const corners = [];
@@ -40986,7 +41235,7 @@ async function drawnGeometryDigests(doc) {
}
const data = new Float32Array(triangles * RECORD);
const others = [];
- const point = new Vector347;
+ const point = new Vector348;
const element = [0, 0, 0];
const texcoord = [0, 0];
const corner = new Float32Array(15);
@@ -41069,7 +41318,7 @@ async function revisionTotals(doc) {
const { vertices, geometry, uv } = await drawnGeometryDigests(doc);
const scene = doc.getRoot().getDefaultScene() ?? doc.getRoot().listScenes()[0];
const drawnBounds = scene ? drawnSceneBounds(scene) : null;
- const box = drawnBounds && [...drawnBounds.min, ...drawnBounds.max].every(Number.isFinite) ? new Box328(new Vector347(...drawnBounds.min), new Vector347(...drawnBounds.max)) : new Box328;
+ const box = drawnBounds && [...drawnBounds.min, ...drawnBounds.max].every(Number.isFinite) ? new Box329(new Vector348(...drawnBounds.min), new Vector348(...drawnBounds.max)) : new Box329;
return {
triangles: metrics.triangles,
vertices,
@@ -41144,7 +41393,7 @@ async function snapshot3(bytes) {
if (depth > 128)
throw new Error("Revision comparison hierarchy exceeds 128 levels.");
const names = new Set;
- const combined = new Box328;
+ const combined = new Box329;
const placed = siblings.flatMap((node) => [
{ node, drawn: true },
...lowerLevels(node).map((level) => ({ node: level, drawn: false }))
@@ -41161,7 +41410,7 @@ async function snapshot3(bytes) {
if (node.listExtensions().some((extension) => extension.extensionName !== MSFT_LOD && extension.extensionName !== "KHR_node_visibility") || mesh?.listExtensions().length)
throw new Error("Revision comparison does not support node/mesh extensions (including instancing).");
const primitives = mesh?.listPrimitives() ?? [];
- const own = new Box328;
+ const own = new Box329;
const matrix = parentWorld.clone().multiply(new Matrix419().fromArray(node.getMatrix()));
if (matrix.elements.some((value) => !Number.isFinite(value)))
throw new Error("Revision comparison requires finite transforms.");
@@ -41182,7 +41431,7 @@ async function snapshot3(bytes) {
if (!Number.isInteger(vertex) || vertex < 0 || vertex >= position.getCount())
throw new Error("Revision comparison found an invalid vertex index.");
position.getElement(vertex, element);
- const point = new Vector347(...element).applyMatrix4(matrix);
+ const point = new Vector348(...element).applyMatrix4(matrix);
if (point.toArray().some((value) => !Number.isFinite(value)))
throw new Error("Revision comparison requires finite positions.");
own.expandByPoint(point);
@@ -41382,20 +41631,20 @@ var init_revision_comparison = __esm(() => {
// src/views/surface-distance.ts
import {
- Box3 as Box329,
+ Box3 as Box330,
Matrix4 as Matrix420,
Ray as Ray3,
Triangle as Triangle3,
- Vector3 as Vector348
+ Vector3 as Vector349
} from "three";
function hierarchy(triangles) {
- const box = new Box329;
+ const box = new Box330;
for (const triangle of triangles)
box.union(triangle.box);
const count = triangles.length;
if (count <= 4)
return { box, count, triangles };
- const size = box.getSize(new Vector348);
+ const size = box.getSize(new Vector349);
const axis = size.x >= size.y && size.x >= size.z ? "x" : size.y >= size.z ? "y" : "z";
const center = (triangle) => triangle.box.min[axis] / 2 + triangle.box.max[axis] / 2;
triangles.sort((a, b) => center(a) - center(b));
@@ -41414,7 +41663,7 @@ function boxDistanceSquared2(a, b) {
}
function collect(node, paths) {
const triangles = [];
- const bounds = new Box329;
+ const bounds = new Box330;
node.updateWorldMatrix(true, true);
node.traverseVisible((child) => {
const mesh = child;
@@ -41447,13 +41696,13 @@ function collect(node, paths) {
const id = index ? index.getX(i + offset) : i + offset;
if (!Number.isSafeInteger(id) || id < 0 || id >= position.count)
throw new Error("Surface distance encountered an invalid triangle index.");
- const point = new Vector348().fromBufferAttribute(position, id).applyMatrix4(matrix);
+ const point = new Vector349().fromBufferAttribute(position, id).applyMatrix4(matrix);
if (![point.x, point.y, point.z].every(Number.isFinite))
throw new Error("Surface distance encountered a non-finite world position.");
return point;
};
const triangle = new Triangle3(vertex(0), vertex(1), vertex(2));
- const box = new Box329().setFromPoints([triangle.a, triangle.b, triangle.c]);
+ const box = new Box330().setFromPoints([triangle.a, triangle.b, triangle.c]);
bounds.union(box);
triangles.push({
triangle,
@@ -41506,10 +41755,10 @@ function trianglePair(a, b) {
const av = [a.a, a.b, a.c], bv = [b.a, b.b, b.c];
if (b.getArea() > 0)
for (const p of av)
- record(p, b.closestPointToPoint(p, new Vector348));
+ record(p, b.closestPointToPoint(p, new Vector349));
if (a.getArea() > 0)
for (const q of bv)
- record(a.closestPointToPoint(q, new Vector348), q);
+ record(a.closestPointToPoint(q, new Vector349), q);
for (let i = 0;i < 3; i++) {
const p = av[i], q = av[(i + 1) % 3];
for (let j = 0;j < 3; j++)
@@ -41522,9 +41771,9 @@ function trianglePair(a, b) {
const length = delta.length();
if (length === 0)
continue;
- const hit = new Ray3(origin, delta.divideScalar(length)).intersectTriangle(target.a, target.b, target.c, false, new Vector348);
+ const hit = new Ray3(origin, delta.divideScalar(length)).intersectTriangle(target.a, target.b, target.c, false, new Vector349);
if (hit && origin.distanceTo(hit) <= length) {
- const onFace = target.closestPointToPoint(hit, new Vector348);
+ const onFace = target.closestPointToPoint(hit, new Vector349);
if (vertices === av)
record(hit, onFace);
else
@@ -41690,7 +41939,7 @@ __export(exports_draw_diagnostics, {
});
import { Primitive as Primitive3 } from "@gltf-transform/core";
import { cloneDocument as cloneDocument2 } from "@gltf-transform/functions";
-import * as THREE60 from "three";
+import * as THREE61 from "three";
function withinLimits(doc) {
const root = doc.getRoot();
if (root.listNodes().length > MAX_NODES2 || root.listAccessors().length > 4096 || root.listMaterials().length > 2048 || root.listTextures().length > 256 || root.listScenes().length > 32 || doc.getGraph().listEdges().length > 32768)
@@ -41743,7 +41992,7 @@ function collect2(doc, keep) {
function overlaps(a, b) {
if (Math.abs(a.normal.dot(b.normal)) < 1 - 0.00000001 || !a.bounds.intersectsBox(b.bounds))
return false;
- const tolerance = Math.max(a.bounds.getSize(new THREE60.Vector3).length(), b.bounds.getSize(new THREE60.Vector3).length(), 0.000000000001) * 0.000001;
+ const tolerance = Math.max(a.bounds.getSize(new THREE61.Vector3).length(), b.bounds.getSize(new THREE61.Vector3).length(), 0.000000000001) * 0.000001;
if (b.points.some((p) => Math.abs(a.normal.dot(p.clone().sub(a.points[0]))) > tolerance))
return false;
const normal = a.normal.toArray().map(Math.abs);
@@ -41785,7 +42034,7 @@ function observe(uses) {
unexaminedPrimitiveUses++;
continue;
}
- const matrix = new THREE60.Matrix4().fromArray(node.getWorldMatrix());
+ const matrix = new THREE61.Matrix4().fromArray(node.getWorldMatrix());
if (primitive.getAttribute("TANGENT") && matrix.determinant() < 0)
mirrored.set(part.id, part);
const position = primitive.getAttribute("POSITION");
@@ -41799,14 +42048,14 @@ function observe(uses) {
const amount = Math.min(count, 8, MAX_SAMPLES - samples.length);
for (let i = 0;i < amount; i++) {
const start = Math.floor(i * count / amount) * 3;
- const points = [0, 1, 2].map((j) => new THREE60.Vector3().fromArray(position.getElement(indices ? indices.getScalar(start + j) : start + j, [])).applyMatrix4(matrix));
+ const points = [0, 1, 2].map((j) => new THREE61.Vector3().fromArray(position.getElement(indices ? indices.getScalar(start + j) : start + j, [])).applyMatrix4(matrix));
const normal = points[1].clone().sub(points[0]).cross(points[2].clone().sub(points[0]));
if (!Number.isFinite(normal.lengthSq()) || normal.lengthSq() === 0)
continue;
samples.push({
points,
normal: normal.normalize(),
- bounds: new THREE60.Box3().setFromPoints(points),
+ bounds: new THREE61.Box3().setFromPoints(points),
part
});
}
@@ -48844,7 +49093,7 @@ function createCachedEvaluatorPort(evaluator, options) {
// src/tools/registry.ts
init_validation();
-import * as THREE61 from "three";
+import * as THREE62 from "three";
// src/evaluator/source-check.ts
init_validation();
@@ -49489,8 +49738,8 @@ function collectSceneMetrics(root) {
let meshes = 0;
const materialSet = new Set;
let lowestPart;
- const box = new THREE61.Box3;
- const point = new THREE61.Vector3;
+ const box = new THREE62.Box3;
+ const point = new THREE62.Vector3;
root.updateWorldMatrix(true, true);
root.traverseVisible((node) => {
const n = node;
@@ -49506,7 +49755,7 @@ function collectSceneMetrics(root) {
const mesh = node;
const position = mesh.geometry.getAttribute("position");
const index = mesh.geometry.index;
- const mb = new THREE61.Box3;
+ const mb = new THREE62.Box3;
if (position) {
for (let i = 0;i < (index?.count ?? position.count); i++) {
point.fromBufferAttribute(position, index ? index.getX(i) : i);
@@ -49521,7 +49770,7 @@ function collectSceneMetrics(root) {
});
let bbox;
if (!box.isEmpty()) {
- const size = new THREE61.Vector3;
+ const size = new THREE62.Vector3;
box.getSize(size);
bbox = {
min: [box.min.x, box.min.y, box.min.z],
diff --git a/dist/build.json b/dist/build.json
index 2fc4acdd..447b40b9 100644
--- a/dist/build.json
+++ b/dist/build.json
@@ -2,10 +2,10 @@
"schemaVersion": 1,
"entries": {
"worker": {
- "identity": "sha256:20096a0f76f451db878ce17903d33be602452af6c732c6df93843ce6d90ffbf5",
+ "identity": "sha256:fba6d13661be1de1d146fbaa6aa3e80b8ca6660614281617a516b26f4389bca8",
"engineVersion": "1.6.0",
"toolchain": "[email protected]",
- "sourceHash": "d82abaac51497bb95ebdf349b61ce27cff7ecdccbeec79bab7f2ee0a5b480b85",
+ "sourceHash": "3bfb596b14cd4f2ea462ffa606b90e88f1aafc24872176d4c21edb4665cd6d11",
"rendererSourceHash": "27927c48b377f7694251a76c0cecd05216fcbbb8a7d03e8bf2bd681dabb5573a",
"dependencyHash": "af916d063d319fe3c11d1acc13211950eea82bb5ebb87ae4eb60008d72fa7f10",
"dependencies": {
@@ -37,13 +37,13 @@
},
"target": "node",
"file": "evaluator-worker.mjs",
- "bundleHash": "sha256:99c009df78ef1da11fa1232eedf6b97da6792b9dfe4852196fcb0dcabdea23eb"
+ "bundleHash": "sha256:eaba26a5f78ba7430675224d4f690344c4bafb0feeda387dc3831bbae80c7cca"
},
"agent-run": {
- "identity": "sha256:20096a0f76f451db878ce17903d33be602452af6c732c6df93843ce6d90ffbf5",
+ "identity": "sha256:fba6d13661be1de1d146fbaa6aa3e80b8ca6660614281617a516b26f4389bca8",
"engineVersion": "1.6.0",
"toolchain": "[email protected]",
- "sourceHash": "d82abaac51497bb95ebdf349b61ce27cff7ecdccbeec79bab7f2ee0a5b480b85",
+ "sourceHash": "3bfb596b14cd4f2ea462ffa606b90e88f1aafc24872176d4c21edb4665cd6d11",
"rendererSourceHash": "27927c48b377f7694251a76c0cecd05216fcbbb8a7d03e8bf2bd681dabb5573a",
"dependencyHash": "af916d063d319fe3c11d1acc13211950eea82bb5ebb87ae4eb60008d72fa7f10",
"dependencies": {
@@ -75,13 +75,13 @@
},
"target": "node",
"file": "agent-run.mjs",
- "bundleHash": "sha256:70ade618edc49cbf09615733a23c45deb68504f263753c013df28c9f2b68e597"
+ "bundleHash": "sha256:0865874dc38389b1af4f1327b6badea53c73c1f4e1f4ee69a7fc2088813ea6ff"
},
"agent-providers": {
- "identity": "sha256:20096a0f76f451db878ce17903d33be602452af6c732c6df93843ce6d90ffbf5",
+ "identity": "sha256:fba6d13661be1de1d146fbaa6aa3e80b8ca6660614281617a516b26f4389bca8",
"engineVersion": "1.6.0",
"toolchain": "[email protected]",
- "sourceHash": "d82abaac51497bb95ebdf349b61ce27cff7ecdccbeec79bab7f2ee0a5b480b85",
+ "sourceHash": "3bfb596b14cd4f2ea462ffa606b90e88f1aafc24872176d4c21edb4665cd6d11",
"rendererSourceHash": "27927c48b377f7694251a76c0cecd05216fcbbb8a7d03e8bf2bd681dabb5573a",
"dependencyHash": "af916d063d319fe3c11d1acc13211950eea82bb5ebb87ae4eb60008d72fa7f10",
"dependencies": {
@@ -116,10 +116,10 @@
"bundleHash": "sha256:9d6faf03d307321bc2e3bd5ce5bdee0bbbf61e0ebed8bfebfa1fb072287b83fa"
},
"mcp": {
- "identity": "sha256:20096a0f76f451db878ce17903d33be602452af6c732c6df93843ce6d90ffbf5",
+ "identity": "sha256:fba6d13661be1de1d146fbaa6aa3e80b8ca6660614281617a516b26f4389bca8",
"engineVersion": "1.6.0",
"toolchain": "[email protected]",
- "sourceHash": "d82abaac51497bb95ebdf349b61ce27cff7ecdccbeec79bab7f2ee0a5b480b85",
+ "sourceHash": "3bfb596b14cd4f2ea462ffa606b90e88f1aafc24872176d4c21edb4665cd6d11",
"rendererSourceHash": "27927c48b377f7694251a76c0cecd05216fcbbb8a7d03e8bf2bd681dabb5573a",
"dependencyHash": "af916d063d319fe3c11d1acc13211950eea82bb5ebb87ae4eb60008d72fa7f10",
"dependencies": {
@@ -154,10 +154,10 @@
"bundleHash": "sha256:ec8ccc0d1f25184650191131ad5dcd25e1434408f92bdf8d2ef150e1bf5f266b"
},
"cli": {
- "identity": "sha256:20096a0f76f451db878ce17903d33be602452af6c732c6df93843ce6d90ffbf5",
+ "identity": "sha256:fba6d13661be1de1d146fbaa6aa3e80b8ca6660614281617a516b26f4389bca8",
"engineVersion": "1.6.0",
"toolchain": "[email protected]",
- "sourceHash": "d82abaac51497bb95ebdf349b61ce27cff7ecdccbeec79bab7f2ee0a5b480b85",
+ "sourceHash": "3bfb596b14cd4f2ea462ffa606b90e88f1aafc24872176d4c21edb4665cd6d11",
"rendererSourceHash": "27927c48b377f7694251a76c0cecd05216fcbbb8a7d03e8bf2bd681dabb5573a",
"dependencyHash": "af916d063d319fe3c11d1acc13211950eea82bb5ebb87ae4eb60008d72fa7f10",
"dependencies": {
@@ -189,13 +189,13 @@
},
"target": "node",
"file": "cli.mjs",
- "bundleHash": "sha256:4bd432be5ccad7711c89aedae8f4ca355cd13962da9ab9e9cf993cf6fdc6d7bf"
+ "bundleHash": "sha256:3edbacda3cec0596595bb93b02e34b32dd057aa8f7d2dae60b69597853a768e4"
},
"engine": {
- "identity": "sha256:20096a0f76f451db878ce17903d33be602452af6c732c6df93843ce6d90ffbf5",
+ "identity": "sha256:fba6d13661be1de1d146fbaa6aa3e80b8ca6660614281617a516b26f4389bca8",
"engineVersion": "1.6.0",
"toolchain": "[email protected]",
- "sourceHash": "d82abaac51497bb95ebdf349b61ce27cff7ecdccbeec79bab7f2ee0a5b480b85",
+ "sourceHash": "3bfb596b14cd4f2ea462ffa606b90e88f1aafc24872176d4c21edb4665cd6d11",
"rendererSourceHash": "27927c48b377f7694251a76c0cecd05216fcbbb8a7d03e8bf2bd681dabb5573a",
"dependencyHash": "af916d063d319fe3c11d1acc13211950eea82bb5ebb87ae4eb60008d72fa7f10",
"dependencies": {
@@ -227,7 +227,7 @@
},
"target": "node",
"file": "mcp-engine.mjs",
- "bundleHash": "sha256:8f1663acee54d91c408e066e0facc28a69738fb350a0f23138169489143ed4ca"
+ "bundleHash": "sha256:d2fc8cf72cb518bbc07fea0abf3c440f99c2d805cee100590e6e0361789fb6fe"
}
}
}
diff --git a/dist/cli.mjs b/dist/cli.mjs
index 9f1b35e5..faaaef33 100644
--- a/dist/cli.mjs
+++ b/dist/cli.mjs
@@ -12795,9 +12795,135 @@ var init_lod2 = __esm(() => {
init_lod();
});
-// src/qa/part-connectivity.ts
+// src/qa/mesh-components.ts
import * as THREE12 from "three";
-function collectParts2(root, exempt, supports) {
+function find(parent, start) {
+ let root = start;
+ while (parent[root] !== root)
+ root = parent[root];
+ for (let at = start;parent[at] !== root; ) {
+ const next = parent[at];
+ parent[at] = root;
+ at = next;
+ }
+ return root;
+}
+function union(parent, a, b) {
+ const ra = find(parent, a);
+ const rb = find(parent, b);
+ if (ra < rb)
+ parent[rb] = ra;
+ else
+ parent[ra] = rb;
+}
+function walkComponents(geometry) {
+ const position = geometry.getAttribute("position");
+ const version = position?.version ?? 0;
+ const cached = cache.get(geometry);
+ if (cached && cached.version === version)
+ return cached;
+ const store = (result) => {
+ cache.set(geometry, result);
+ return result;
+ };
+ if (position?.itemSize !== 3 || position.count > MAX_SPLIT_VERTICES)
+ return store({ version, count: 0 });
+ const parent = new Int32Array(position.count);
+ const used = new Uint8Array(position.count);
+ for (let i = 0;i < parent.length; i++)
+ parent[i] = i;
+ const finite = new Uint8Array(position.count);
+ const bounds = new THREE12.Box3;
+ const point = new THREE12.Vector3;
+ for (let i = 0;i < position.count; i++) {
+ point.fromBufferAttribute(position, i);
+ if (Number.isFinite(point.x) && Number.isFinite(point.y) && Number.isFinite(point.z)) {
+ finite[i] = 1;
+ bounds.expandByPoint(point);
+ }
+ }
+ const index = geometry.getIndex();
+ const triangles = (index?.count ?? position.count) - (index?.count ?? position.count) % 3;
+ const corner = (at) => index ? index.getX(at) : at;
+ for (let at = 0;at < triangles; at += 3) {
+ const a = corner(at);
+ const b = corner(at + 1);
+ const c = corner(at + 2);
+ if (!finite[a] || !finite[b] || !finite[c])
+ continue;
+ used[a] = used[b] = used[c] = 1;
+ union(parent, a, b);
+ union(parent, b, c);
+ }
+ const size = bounds.isEmpty() ? new THREE12.Vector3 : bounds.getSize(new THREE12.Vector3);
+ const tolerance = Math.max(size.x, size.y, size.z) * 0.000001 || 1;
+ const seen = new Map;
+ for (let i = 0;i < position.count; i++) {
+ if (!used[i])
+ continue;
+ point.fromBufferAttribute(position, i).sub(bounds.min).divideScalar(tolerance);
+ const key = `${Math.round(point.x)},${Math.round(point.y)},${Math.round(point.z)}`;
+ const first = seen.get(key);
+ if (first === undefined)
+ seen.set(key, i);
+ else
+ union(parent, first, i);
+ }
+ const labels = new Int32Array(position.count).fill(-1);
+ const byRoot = new Map;
+ for (let i = 0;i < position.count; i++) {
+ if (!used[i])
+ continue;
+ const root = find(parent, i);
+ let label = byRoot.get(root);
+ if (label === undefined) {
+ label = byRoot.size;
+ byRoot.set(root, label);
+ if (byRoot.size > MAX_MESH_COMPONENTS)
+ return store({ version, count: byRoot.size });
+ }
+ labels[i] = label;
+ }
+ return store({ version, count: byRoot.size, labels });
+}
+function meshComponentBoxes(mesh, budget) {
+ const flagged = mesh;
+ if (flagged.isInstancedMesh || flagged.isSkinnedMesh || STANDS_APART_NAME.test(mesh.name) || (lodLevel(mesh) ?? 0) > 0)
+ return;
+ const geometry = mesh.geometry;
+ const position = geometry?.getAttribute("position");
+ if (!position)
+ return;
+ const walked = walkComponents(geometry);
+ if (!walked.labels || walked.count > 1 && budget.components + walked.count > MAX_SCENE_COMPONENTS) {
+ budget.unsplit.push(mesh.name || "(unnamed mesh)");
+ return;
+ }
+ if (walked.count < 1)
+ return;
+ if (walked.count > 1)
+ budget.components += walked.count;
+ const boxes = Array.from({ length: walked.count }, () => new THREE12.Box3);
+ const point = new THREE12.Vector3;
+ for (let i = 0;i < position.count; i++) {
+ const label = walked.labels[i];
+ if (label < 0)
+ continue;
+ point.fromBufferAttribute(position, i).applyMatrix4(mesh.matrixWorld);
+ boxes[label].expandByPoint(point);
+ }
+ return boxes;
+}
+var MAX_SPLIT_VERTICES = 262144, MAX_MESH_COMPONENTS = 256, MAX_SCENE_COMPONENTS = 4096, STANDS_APART_NAME, splitBudget = () => ({ components: 0, unsplit: [] }), cache;
+var init_mesh_components = __esm(() => {
+ init_lod2();
+ STANDS_APART_NAME = /(?:^|_)(?:leaf|leaves|foliage|frond|card|decal|billboard|petal)/i;
+ cache = new WeakMap;
+});
+
+// src/qa/part-connectivity.ts
+import * as THREE13 from "three";
+function collectParts2(root, exempt, budget, supports) {
const parts = [];
let lodExcluded = 0;
root.updateWorldMatrix(true, true);
@@ -12810,15 +12936,29 @@ function collectParts2(root, exempt, supports) {
lodExcluded++;
return;
}
- if (EXEMPT_NAME.test(name)) {
+ if (STANDS_APART_NAME.test(name)) {
exempt.push(name);
return;
}
- const box = new THREE12.Box3().setFromObject(mesh);
+ const box = new THREE13.Box3().setFromObject(mesh);
if (box.isEmpty())
return;
+ const components = meshComponentBoxes(mesh, budget);
+ if (components && components.length > 1) {
+ for (const [index, piece] of components.entries()) {
+ const support = restingSupport(mesh, piece.min.y, supports);
+ parts.push({
+ name: `${name} (welded component ${index + 1} of ${components.length})`,
+ node: name,
+ weldedOf: components.length,
+ box: piece,
+ ...support ? { support } : {}
+ });
+ }
+ return;
+ }
const support = restingSupport(mesh, box.min.y, supports);
- parts.push({ name, box, ...support ? { support } : {} });
+ parts.push({ name, node: name, box, ...support ? { support } : {} });
});
return { parts, lodExcluded };
}
@@ -12828,14 +12968,37 @@ function boxGap(a, b) {
const dz = Math.max(0, Math.max(a.min.z - b.max.z, b.min.z - a.max.z));
return Math.hypot(dx, dy, dz);
}
+function collapseWeldedGroups(groups) {
+ const byMesh = new Map;
+ const out = [];
+ for (const group of groups) {
+ const mesh = group.welded?.mesh;
+ const first = mesh === undefined ? undefined : byMesh.get(mesh);
+ if (mesh === undefined)
+ out.push(group);
+ else if (!first) {
+ byMesh.set(mesh, group);
+ out.push(group);
+ } else {
+ first.parts.push(...group.parts);
+ if (group.gap < first.gap) {
+ first.gap = group.gap;
+ first.welded = group.welded;
+ }
+ }
+ }
+ return out;
+}
function analyzePartConnectivity(root, supports) {
const exempt = [];
- const { parts, lodExcluded } = collectParts2(root, exempt, supports);
+ const budget = splitBudget();
+ const { parts, lodExcluded } = collectParts2(root, exempt, budget, supports);
const report = {
partsAnalyzed: parts.length,
mainComponentSize: parts.length,
exempt,
lodExcluded,
+ unsplit: budget.unsplit,
groups: []
};
if (parts.length < 2)
@@ -12886,15 +13049,25 @@ function analyzePartConnectivity(root, supports) {
if (index === mainIndex)
continue;
let gap = Number.POSITIVE_INFINITY;
+ let nearestMember = members[0];
+ let nearestMain = main[0];
for (const m of members) {
for (const b of main) {
- gap = Math.min(gap, boxGap(parts[m].box, parts[b].box));
+ const between = boxGap(parts[m].box, parts[b].box);
+ if (between < gap) {
+ gap = between;
+ nearestMember = m;
+ nearestMain = b;
+ }
}
}
+ const node = parts[members[0]].node;
+ const welded = members.every((m) => parts[m].weldedOf && parts[m].node === node);
const lowest = members.reduce((a, b) => parts[b].box.min.y < parts[a].box.min.y ? b : a);
const support = parts[lowest].support;
report.groups.push({
parts: members.map((m) => parts[m].name),
+ node,
gap: Math.round(gap * 1e6) / 1e6,
...support && members.every((m) => parts[m].support) ? {
externalSupport: {
@@ -12902,19 +13075,30 @@ function analyzePartConnectivity(root, supports) {
bottomY: Math.round(parts[lowest].box.min.y * 1e6) / 1e6,
tolerance: support.tolerance ?? CONNECTIVITY_TOLERANCE
}
+ } : welded ? {
+ welded: {
+ mesh: node,
+ components: parts[members[0]].weldedOf,
+ detached: locationOf(parts[nearestMember]),
+ nearest: locationOf(parts[nearestMain])
+ }
} : {}
});
}
+ report.groups = collapseWeldedGroups(report.groups);
report.groups.sort((a, b) => b.parts.length - a.parts.length || a.gap - b.gap);
return report;
}
function inspectPartConnectivity(scene, supports) {
- if (!(scene instanceof THREE12.Object3D))
+ if (!(scene instanceof THREE13.Object3D))
return [];
const report = analyzePartConnectivity(scene, supports);
const lodNote = report.lodExcluded === 1 ? " 1 part on an LOD level above 0 was not analyzed." : report.lodExcluded > 1 ? ` ${report.lodExcluded} parts on LOD levels above 0 were not analyzed.` : "";
+ const unsplitNote = report.unsplit.length ? ` Over the split budget, so measured as one box: ${report.unsplit.slice(0, 5).map((mesh) => JSON.stringify(mesh)).join(", ")}${report.unsplit.length > 5 ? ` and ${report.unsplit.length - 5} more` : ""}.` : "";
return report.groups.map((group) => {
- const listed = group.parts.map((p) => JSON.stringify(p)).join(", ");
+ const named = group.parts.slice(0, MAX_LISTED_PARTS).map((p) => JSON.stringify(p));
+ const unnamed = group.parts.length - named.length;
+ const listed = `${named.join(", ")}${unnamed > 0 ? `, +${unnamed} more` : ""}`;
const subject = group.parts.length === 1 ? `Part ${listed} is` : `A group of ${group.parts.length} parts (${listed}) is`;
const declared = group.externalSupport;
if (declared)
@@ -12924,7 +13108,7 @@ function inspectPartConnectivity(scene, supports) {
dimension: "visualQuality",
profile: "geometry.partConnectivity",
message: `${subject} separate from the largest component and rests on the support declared in requirements.externalSupport at Y=${declared.planeY.toFixed(3)} m (bottom at Y=${declared.bottomY.toFixed(3)} m). Information only: the support is composed outside this asset.${lodNote}`,
- affected: { node: group.parts[0] },
+ affected: { node: group.node },
measurement: {
name: "bottomToSupportPlane",
actual: declared.bottomY,
@@ -12933,13 +13117,36 @@ function inspectPartConnectivity(scene, supports) {
},
repairText: "No change is needed for a declared support. Remove the part from requirements.externalSupport if it should attach within this asset."
};
+ if (group.welded) {
+ const { mesh, components, detached, nearest } = group.welded;
+ const span = ({ min, max }) => `[${min.join(", ")}] to [${max.join(", ")}]`;
+ return {
+ code: "GEO_PART_CONNECTIVITY",
+ disposition: "observe",
+ dimension: "visualQuality",
+ profile: "geometry.partConnectivity",
+ message: `Mesh ${JSON.stringify(mesh)} is one drawn part, but ${group.parts.length} of its ${components} welded components ${group.parts.length === 1 ? "is" : "are"} separate from the largest component in the rest-pose bounding boxes of visible parts; the nearest box gap is ${group.gap.toFixed(3)} m. Nearest detached: ${span(detached)}. It is nearest to ${JSON.stringify(nearest.part)} at ${span(nearest)}. This may be intentional. Box adjacency is not physical attachment evidence: a gap under ${CONNECTIVITY_TOLERANCE} m reads as contact.${lodNote}${unsplitNote}`,
+ affected: { node: mesh },
+ measurement: {
+ name: "gapToMainComponent",
+ actual: group.gap,
+ expected: CONNECTIVITY_TOLERANCE,
+ breakdown: {
+ weldedComponents: components,
+ detachedComponents: group.parts.length,
+ ...report.lodExcluded ? { lodExcludedParts: report.lodExcluded } : {}
+ }
+ },
+ repairText: "Check whether the separation is intentional. One mesh moves and hides as one, so a component meant to attach needs its gap closed in the merged geometry; one meant to stand apart reads better as its own part."
+ };
+ }
return {
code: "GEO_PART_CONNECTIVITY",
disposition: "observe",
dimension: "visualQuality",
profile: "geometry.partConnectivity",
- message: `${subject} separate from the largest component in the rest-pose bounding boxes of visible parts; the nearest box gap is ${group.gap.toFixed(3)} m. This may be intentional. Box adjacency is not physical attachment evidence: a gap under ${CONNECTIVITY_TOLERANCE} m reads as contact, and primitives welded into one mesh form one box.${lodNote}`,
- affected: { node: group.parts[0] },
+ message: `${subject} separate from the largest component in the rest-pose bounding boxes of visible parts; the nearest box gap is ${group.gap.toFixed(3)} m. This may be intentional. Box adjacency is not physical attachment evidence: a gap under ${CONNECTIVITY_TOLERANCE} m reads as contact.${lodNote}${unsplitNote}`,
+ affected: { node: group.node },
measurement: {
name: "gapToMainComponent",
actual: group.gap,
@@ -12950,11 +13157,19 @@ function inspectPartConnectivity(scene, supports) {
};
});
}
-var CONNECTIVITY_TOLERANCE = 0.02, EXEMPT_NAME, PART_CONNECTIVITY_QA_RULE;
+var CONNECTIVITY_TOLERANCE = 0.02, MAX_LISTED_PARTS = 12, rounded = (v) => [
+ Math.round(v.x * 1e4) / 1e4,
+ Math.round(v.y * 1e4) / 1e4,
+ Math.round(v.z * 1e4) / 1e4
+], locationOf = (part) => ({
+ part: part.name,
+ min: rounded(part.box.min),
+ max: rounded(part.box.max)
+}), PART_CONNECTIVITY_QA_RULE;
var init_part_connectivity = __esm(() => {
init_lod2();
+ init_mesh_components();
init_registry();
- EXEMPT_NAME = /(?:^|_)(?:leaf|leaves|foliage|frond|card|decal|billboard|petal)/i;
PART_CONNECTIVITY_QA_RULE = Object.freeze({
id: "GEO_PART_CONNECTIVITY",
profile: "geometry.partConnectivity",
@@ -12969,7 +13184,7 @@ var init_part_connectivity = __esm(() => {
});
// src/geometry.ts
-import * as THREE13 from "three";
+import * as THREE14 from "three";
function finiteArray(values, label, length) {
const result = Array.from(values);
if (length !== undefined && result.length !== length)
@@ -12983,8 +13198,8 @@ function meshGeo(data) {
if (positions.length < 9 || positions.length % 3)
throw new Error("meshGeo positions: need at least three xyz vertices");
const count = positions.length / 3;
- const geometry = new THREE13.BufferGeometry;
- geometry.setAttribute("position", new THREE13.Float32BufferAttribute(positions, 3));
+ const geometry = new THREE14.BufferGeometry;
+ geometry.setAttribute("position", new THREE14.Float32BufferAttribute(positions, 3));
if (data.indices) {
const indices = Array.from(data.indices);
if (!indices.length || indices.length % 3)
@@ -12996,7 +13211,7 @@ function meshGeo(data) {
throw new Error("meshGeo: non-indexed positions must form complete triangles");
if (data.normals) {
const normals = finiteArray(data.normals, "meshGeo normals", count * 3);
- geometry.setAttribute("normal", new THREE13.Float32BufferAttribute(normals, 3));
+ geometry.setAttribute("normal", new THREE14.Float32BufferAttribute(normals, 3));
for (let i = 0;i < count; i++)
if (Math.hypot(normals[i * 3], normals[i * 3 + 1], normals[i * 3 + 2]) === 0)
throw new Error("meshGeo normals: zero-length normal");
@@ -13004,36 +13219,36 @@ function meshGeo(data) {
} else
geometry.computeVertexNormals();
if (data.uvs)
- geometry.setAttribute("uv", new THREE13.Float32BufferAttribute(finiteArray(data.uvs, "meshGeo uvs", count * 2), 2));
+ geometry.setAttribute("uv", new THREE14.Float32BufferAttribute(finiteArray(data.uvs, "meshGeo uvs", count * 2), 2));
if (data.tangents) {
const tangents = finiteArray(data.tangents, "meshGeo tangents", count * 4);
for (let i = 0;i < count; i++) {
if (Math.abs(Math.hypot(tangents[i * 4], tangents[i * 4 + 1], tangents[i * 4 + 2]) - 1) > 0.0001 || Math.abs(tangents[i * 4 + 3]) !== 1)
throw new Error("meshGeo tangents: expected unit xyz and handedness +1 or -1");
}
- geometry.setAttribute("tangent", new THREE13.Float32BufferAttribute(tangents, 4));
+ geometry.setAttribute("tangent", new THREE14.Float32BufferAttribute(tangents, 4));
}
geometry.computeBoundingBox();
geometry.computeBoundingSphere();
return geometry;
}
function boundsScale(bounds) {
- const size = bounds.getSize(new THREE13.Vector3);
+ const size = bounds.getSize(new THREE14.Vector3);
const scale = Math.hypot(size.x, size.y, size.z);
if (!Number.isFinite(scale))
throw new Error("Geometry position extent must be finite");
return scale;
}
function positionFrame(position) {
- const bounds = new THREE13.Box3;
- const point = new THREE13.Vector3;
+ const bounds = new THREE14.Box3;
+ const point = new THREE14.Vector3;
for (let i = 0;i < position.count; i++) {
point.fromBufferAttribute(position, i);
if ([point.x, point.y, point.z].every(Number.isFinite))
bounds.expandByPoint(point);
}
return {
- origin: bounds.isEmpty() ? new THREE13.Vector3 : bounds.min,
+ origin: bounds.isEmpty() ? new THREE14.Vector3 : bounds.min,
scale: boundsScale(bounds)
};
}
@@ -13073,11 +13288,11 @@ function geometryDiagnostics(geometry, tolerance) {
solid: { closed: false, manifold: true, orientation: "mixed", signedVolume: 0 }
};
let signedVolume = 0;
- const pa = new THREE13.Vector3, pb = new THREE13.Vector3, pc = new THREE13.Vector3;
+ const pa = new THREE14.Vector3, pb = new THREE14.Vector3, pc = new THREE14.Vector3;
const ids = [];
const points = new Map;
const finite = [];
- const point = new THREE13.Vector3;
+ const point = new THREE14.Vector3;
for (let i = 0;i < p.count; i++) {
point.fromBufferAttribute(p, i);
finite[i] = [point.x, point.y, point.z].every(Number.isFinite);
@@ -13090,7 +13305,7 @@ function geometryDiagnostics(geometry, tolerance) {
}
const indices = geometry.index ? Array.from(geometry.index.array) : Array.from({ length: p.count }, (_, i) => i);
const edges = new Map;
- const a = new THREE13.Vector3, b = new THREE13.Vector3, c = new THREE13.Vector3;
+ const a = new THREE14.Vector3, b = new THREE14.Vector3, c = new THREE14.Vector3;
for (let i = 0;i < indices.length; i += 3) {
result.triangles++;
const triangle = indices.slice(i, i + 3);
@@ -13175,8 +13390,8 @@ function parametricSurface(sample, options = {}) {
if (orientation !== "uv" && orientation !== "vu")
throw new Error("parametricSurface orientation must be uv or vu");
const positions = [], uvs = [], indices = [];
- const sampledBounds = new THREE13.Box3;
- const sampledPoint = new THREE13.Vector3;
+ const sampledBounds = new THREE14.Box3;
+ const sampledPoint = new THREE14.Vector3;
for (let j = 0;j <= nv; j++)
for (let i = 0;i <= nu; i++) {
const point = sample(u[0] + (u[1] - u[0]) * i / nu, v[0] + (v[1] - v[0]) * j / nv);
@@ -13218,8 +13433,8 @@ function parametricSurface(sample, options = {}) {
const sums = new Map;
for (let i = 0;i < normal.count; i++) {
const id = find(i);
- const sum = sums.get(id) ?? new THREE13.Vector3;
- sum.add(new THREE13.Vector3().fromBufferAttribute(normal, i));
+ const sum = sums.get(id) ?? new THREE14.Vector3;
+ sum.add(new THREE14.Vector3().fromBufferAttribute(normal, i));
sums.set(id, sum);
}
for (let i = 0;i < normal.count; i++) {
@@ -13244,13 +13459,13 @@ function creaseNormals(geometry, options = {}) {
const keys = [];
const faces = [];
for (let i = 0;i < position.count; i += 3) {
- const a = new THREE13.Vector3().fromBufferAttribute(position, i);
- const b = new THREE13.Vector3().fromBufferAttribute(position, i + 1);
- const c = new THREE13.Vector3().fromBufferAttribute(position, i + 2);
+ const a = new THREE14.Vector3().fromBufferAttribute(position, i);
+ const b = new THREE14.Vector3().fromBufferAttribute(position, i + 1);
+ const c = new THREE14.Vector3().fromBufferAttribute(position, i + 2);
const face = b.sub(a).divideScalar(scale).cross(c.sub(a).divideScalar(scale)).normalize();
faces.push(face);
for (let j = i;j < i + 3; j++) {
- const point = new THREE13.Vector3().fromBufferAttribute(position, j);
+ const point = new THREE14.Vector3().fromBufferAttribute(position, j);
if (![point.x, point.y, point.z].every(Number.isFinite))
throw new Error("creaseNormals positions must be finite");
const key = positionKey(point, frame.origin, tolerance);
@@ -13261,15 +13476,15 @@ function creaseNormals(geometry, options = {}) {
}
}
const normals = new Float32Array(position.count * 3);
- const threshold = Math.cos(THREE13.MathUtils.degToRad(angle));
+ const threshold = Math.cos(THREE14.MathUtils.degToRad(angle));
for (let i = 0;i < position.count; i++) {
- const face = faces[Math.floor(i / 3)], sum = new THREE13.Vector3;
+ const face = faces[Math.floor(i / 3)], sum = new THREE14.Vector3;
for (const other of adjacent.get(keys[i]))
if (face.dot(faces[other]) >= threshold - 0.000000000001)
sum.add(faces[other]);
sum.normalize().toArray(normals, i * 3);
}
- out.setAttribute("normal", new THREE13.BufferAttribute(normals, 3));
+ out.setAttribute("normal", new THREE14.BufferAttribute(normals, 3));
out.deleteAttribute("tangent");
out.computeBoundingBox();
out.computeBoundingSphere();
@@ -13281,14 +13496,14 @@ var init_geometry = __esm(() => {
});
// src/qa/open-surface-penetration.ts
-import * as THREE14 from "three";
+import * as THREE15 from "three";
function buildHierarchy(triangles) {
- const box = new THREE14.Box3;
+ const box = new THREE15.Box3;
for (const triangle of triangles)
box.union(triangle.box);
if (triangles.length <= 4)
return { box, triangles };
- const size = box.getSize(new THREE14.Vector3);
+ const size = box.getSize(new THREE15.Vector3);
const axis = size.x >= size.y && size.x >= size.z ? "x" : size.y >= size.z ? "y" : "z";
const center = (triangle) => triangle.box.min[axis] / 2 + triangle.box.max[axis] / 2;
const sorted = [...triangles].sort((a, b) => center(a) - center(b));
@@ -13312,15 +13527,15 @@ function worldTriangles(mesh) {
const id = index ? index.getX(at) : at;
if (!Number.isSafeInteger(id) || id < 0 || id >= position.count)
return null;
- const point = new THREE14.Vector3().fromBufferAttribute(position, id).applyMatrix4(mesh.matrixWorld);
+ const point = new THREE15.Vector3().fromBufferAttribute(position, id).applyMatrix4(mesh.matrixWorld);
return [point.x, point.y, point.z].every(Number.isFinite) ? point : null;
};
for (let i = 0;i < count; i += 3) {
const a = vertex(i), b = vertex(i + 1), c = vertex(i + 2);
if (!a || !b || !c)
return null;
- const triangle = new THREE14.Triangle(a, b, c);
- triangles.push({ triangle, box: new THREE14.Box3().setFromPoints([a, b, c]) });
+ const triangle = new THREE15.Triangle(a, b, c);
+ triangles.push({ triangle, box: new THREE15.Box3().setFromPoints([a, b, c]) });
}
return triangles.length ? triangles : null;
}
@@ -13421,7 +13636,7 @@ class Budget {
function nearestDistance(root, point, budget) {
let best = Infinity;
const stack = [root];
- const scratch = new THREE14.Vector3;
+ const scratch = new THREE15.Vector3;
while (stack.length) {
const node = stack.pop();
if (boxDistanceSquared(node.box, point) >= best)
@@ -13440,10 +13655,10 @@ function nearestDistance(root, point, budget) {
return Number.isFinite(best) ? Math.sqrt(best) : null;
}
function parity(root, point, direction, budget) {
- const ray = new THREE14.Ray(point, direction);
+ const ray = new THREE15.Ray(point, direction);
const stack = [root];
- const hit = new THREE14.Vector3;
- const barycentric = new THREE14.Vector3;
+ const hit = new THREE15.Vector3;
+ const barycentric = new THREE15.Vector3;
let crossings = 0;
while (stack.length) {
const node = stack.pop();
@@ -13491,7 +13706,7 @@ function analyzeOpenSurfacePenetration(root, contactTolerance = OPEN_SURFACE_CON
skipped: [],
penetrations: []
};
- if (!(root instanceof THREE14.Object3D))
+ if (!(root instanceof THREE15.Object3D))
return evidence;
const parts = collectParts3(root, evidence.skipped);
const open = parts.filter((part) => !part.closed);
@@ -13556,7 +13771,7 @@ function analyzeOpenSurfacePenetration(root, contactTolerance = OPEN_SURFACE_CON
}
const matrix = candidate.open.mesh.matrixWorld;
const limit = Math.min(position.count, MAX_SAMPLED_VERTICES);
- const vertex = new THREE14.Vector3;
+ const vertex = new THREE15.Vector3;
let depth = 0;
let penetrating = 0;
let tested = 0;
@@ -13686,9 +13901,9 @@ var init_open_surface_penetration = __esm(() => {
init_lod2();
init_registry();
PARITY_DIRECTIONS = Object.freeze([
- new THREE14.Vector3(1, 0, 0),
- new THREE14.Vector3(0.5773502691896258, 0.5773502691896258, 0.5773502691896258),
- new THREE14.Vector3(-0.2672612419124244, 0.5345224838248488, 0.8017837257372732)
+ new THREE15.Vector3(1, 0, 0),
+ new THREE15.Vector3(0.5773502691896258, 0.5773502691896258, 0.5773502691896258),
+ new THREE15.Vector3(-0.2672612419124244, 0.5345224838248488, 0.8017837257372732)
]);
OPEN_SURFACE_PENETRATION_QA_RULE = Object.freeze({
id: "GEO_OPEN_SURFACE_PENETRATION",
@@ -13704,9 +13919,9 @@ var init_open_surface_penetration = __esm(() => {
});
// src/sweep-analysis.ts
-import * as THREE15 from "three";
+import * as THREE16 from "three";
function segmentHitsTriangle(a, b, tri, epsilon) {
- const plane = new THREE15.Plane().setFromCoplanarPoints(tri.a, tri.b, tri.c);
+ const plane = new THREE16.Plane().setFromCoplanarPoints(tri.a, tri.b, tri.c);
if (plane.normal.lengthSq() === 0)
return false;
const da = plane.distanceToPoint(a), db = plane.distanceToPoint(b);
@@ -13744,7 +13959,7 @@ function recordSweepAnalysis(geometry, rings, profiles, closed) {
return result;
}
const unique = closed ? rings.length - 1 : rings.length;
- const centers = rings.map((ring) => ring.reduce((sum, p) => sum.add(p), new THREE15.Vector3).divideScalar(ring.length));
+ const centers = rings.map((ring) => ring.reduce((sum, p) => sum.add(p), new THREE16.Vector3).divideScalar(ring.length));
for (let i = closed ? 0 : 1;i < (closed ? unique : unique - 1); i++) {
const a = centers[(i - 1 + unique) % unique], b = centers[i], c = centers[(i + 1) % unique];
const u = b.clone().sub(a), v = c.clone().sub(b);
@@ -13758,17 +13973,17 @@ function recordSweepAnalysis(geometry, rings, profiles, closed) {
const triangles = new Map;
const faces = (index) => {
if (!triangles.has(index))
- triangles.set(index, THREE15.ShapeUtils.triangulateShape(profiles[index], []).map(([a, b, c]) => new THREE15.Triangle(rings[index][a], rings[index][b], rings[index][c])));
+ triangles.set(index, THREE16.ShapeUtils.triangulateShape(profiles[index], []).map(([a, b, c]) => new THREE16.Triangle(rings[index][a], rings[index][b], rings[index][c])));
return triangles.get(index);
};
for (let i = 1;i < rings.length; i++) {
- const boundsA = new THREE15.Box3().setFromPoints(rings[i - 1]);
- const boundsB = new THREE15.Box3().setFromPoints(rings[i]);
+ const boundsA = new THREE16.Box3().setFromPoints(rings[i - 1]);
+ const boundsB = new THREE16.Box3().setFromPoints(rings[i]);
if (!boundsA.intersectsBox(boundsB)) {
result.ringPairsChecked++;
continue;
}
- const epsilon = Math.max(boundsA.getSize(new THREE15.Vector3).length(), boundsB.getSize(new THREE15.Vector3).length()) * 0.0000000001;
+ const epsilon = Math.max(boundsA.getSize(new THREE16.Vector3).length(), boundsB.getSize(new THREE16.Vector3).length()) * 0.0000000001;
let hit = false;
pair:
for (const [a, b] of [
@@ -13923,7 +14138,7 @@ var init_open_shell = __esm(() => {
});
// src/qa/self-intersection.ts
-import * as THREE16 from "three";
+import * as THREE17 from "three";
function boxOverlapRatio2(a, b) {
const shared = Math.max(0, Math.min(a.max.x, b.max.x) - Math.max(a.min.x, b.min.x)) * Math.max(0, Math.min(a.max.y, b.max.y) - Math.max(a.min.y, b.min.y)) * Math.max(0, Math.min(a.max.z, b.max.z) - Math.max(a.min.z, b.min.z));
const ratio = shared / Math.min(boxVolume(a), boxVolume(b));
@@ -13974,8 +14189,8 @@ function collectParts4(root, skipped) {
const box = mesh.geometry.boundingBox.clone().applyMatrix4(mesh.matrixWorld);
if (box.isEmpty())
return;
- const center = box.getCenter(new THREE16.Vector3);
- const size = box.getSize(new THREE16.Vector3);
+ const center = box.getCenter(new THREE17.Vector3);
+ const size = box.getSize(new THREE17.Vector3);
const scale = Math.max(size.x, size.y, size.z);
if (![...box.min, ...box.max, scale].every(Number.isFinite) || !(scale > 0) || !Number.isFinite(mesh.matrixWorld.determinant()) || mesh.matrixWorld.determinant() === 0) {
skipped.push({
@@ -14007,7 +14222,7 @@ function meshToArrays(part) {
matrix.elements[12] -= center.x;
matrix.elements[13] -= center.y;
matrix.elements[14] -= center.z;
- const v = new THREE16.Vector3;
+ const v = new THREE17.Vector3;
const verts = new Float32Array(position.count * 3);
for (let i = 0;i < position.count; i++) {
v.set(position.getX(i), position.getY(i), position.getZ(i)).applyMatrix4(matrix).divideScalar(scale);
@@ -14355,7 +14570,7 @@ var init_self_intersection = __esm(() => {
});
// src/vehicle.ts
-import * as THREE17 from "three";
+import * as THREE18 from "three";
function assertId(value, name) {
if (!ID_PATTERN.test(value))
throw new TypeError(`${name} must be a stable identifier`);
@@ -14390,7 +14605,7 @@ function createTypedSocket(kind, input, parent) {
if (!input.position.every(Number.isFinite))
throw new TypeError(`${kind}.${id} position must be finite`);
const rotation = normalizedQuaternion(input.rotation);
- const node = new THREE17.Object3D;
+ const node = new THREE18.Object3D;
node.name = `Socket_${kind}_${id}`;
node.position.set(...input.position);
node.quaternion.set(...rotation);
@@ -14411,7 +14626,7 @@ function createTypedSocket(kind, input, parent) {
return node;
}
function createVehicleFrame(name, options = {}) {
- const root = new THREE17.Object3D;
+ const root = new THREE18.Object3D;
root.name = name;
stampSemanticMetadataV1(root, semantic2([KILN_SEMANTIC_ROLES.vehicleFrame, KILN_SEMANTIC_ROLES.vehicleForward], {
frames: [
@@ -14436,7 +14651,7 @@ function createVehicleFrame(name, options = {}) {
};
}
function cylinderZ(radius, width, segments = 16) {
- const geometry = new THREE17.CylinderGeometry(radius, radius, width, segments);
+ const geometry = new THREE18.CylinderGeometry(radius, radius, width, segments);
geometry.rotateX(Math.PI / 2);
return geometry;
}
@@ -14453,14 +14668,14 @@ function defaultTireGeometry(radius, width) {
if (width >= radius * 2)
throw new RangeError("default wheel tire width must be less than its diameter");
const tube = width / 2;
- return new THREE17.TorusGeometry(radius - tube, tube, 8, 20);
+ return new THREE18.TorusGeometry(radius - tube, tube, 8, 20);
}
function checkWheelGeometry(part, geometry, radius, width) {
const positions = geometry.getAttribute("position");
if (positions?.itemSize !== 3 || positions.count < 1 || positions.count > 2000000)
throw new RangeError(`wheel ${part} position must have 1..2000000 three-component samples.`);
- const bounds = new THREE17.Box3;
- const point = new THREE17.Vector3;
+ const bounds = new THREE18.Box3;
+ const point = new THREE18.Vector3;
let actualRadius = 0;
for (let i = 0;i < positions.count; i++) {
point.fromBufferAttribute(positions, i);
@@ -14470,7 +14685,7 @@ function checkWheelGeometry(part, geometry, radius, width) {
actualRadius = Math.max(actualRadius, Math.hypot(point.x, point.y));
}
const actualWidth = bounds.max.z - bounds.min.z;
- const center = bounds.getCenter(new THREE17.Vector3);
+ const center = bounds.getCenter(new THREE18.Vector3);
const tolerance = 0.00001 * Math.max(radius, width, actualRadius, actualWidth);
const differences = [];
if (Math.abs(actualRadius - radius) > tolerance)
@@ -14515,11 +14730,11 @@ function createWheelAssembly(name, materials, options) {
const index = assertId(String(options.index), "wheel index");
const key = `${options.side}.${index}`;
const parent = options.parent;
- const root = new THREE17.Object3D;
+ const root = new THREE18.Object3D;
root.name = `${name}_Assembly_${options.side}_${index}`;
let steeringPivot;
if (options.steering) {
- steeringPivot = new THREE17.Object3D;
+ steeringPivot = new THREE18.Object3D;
steeringPivot.name = `SteeringPivot_${options.side}_${index}`;
steeringPivot.position.set(...options.position ?? [0, 0, 0]);
stampSemanticMetadataV1(steeringPivot, semantic2([semanticRole(ROLE.steeringPivot, key)], {
@@ -14530,7 +14745,7 @@ function createWheelAssembly(name, materials, options) {
}));
root.add(steeringPivot);
}
- const spinPivot = new THREE17.Object3D;
+ const spinPivot = new THREE18.Object3D;
spinPivot.name = `WheelPivot_${options.side}_${index}`;
if (!steeringPivot)
spinPivot.position.set(...options.position ?? [0, 0, 0]);
@@ -14551,9 +14766,9 @@ function createWheelAssembly(name, materials, options) {
]
}));
(steeringPivot ?? root).add(spinPivot);
- const tire = new THREE17.Mesh(options.geometries?.tire ?? defaultTireGeometry(radius, width), materials.tire);
- const rim = new THREE17.Mesh(options.geometries?.rim ?? cylinderZ(rimRadius, rimWidth), materials.rim);
- const hub = new THREE17.Mesh(options.geometries?.hub ?? cylinderZ(hubRadius, hubWidth), materials.hub ?? materials.rim);
+ const tire = new THREE18.Mesh(options.geometries?.tire ?? defaultTireGeometry(radius, width), materials.tire);
+ const rim = new THREE18.Mesh(options.geometries?.rim ?? cylinderZ(rimRadius, rimWidth), materials.rim);
+ const hub = new THREE18.Mesh(options.geometries?.hub ?? cylinderZ(hubRadius, hubWidth), materials.hub ?? materials.rim);
tire.name = `Tire_${options.side}_${index}`;
rim.name = `Rim_${options.side}_${index}`;
hub.name = `Hub_${options.side}_${index}`;
@@ -14573,7 +14788,7 @@ function createWheelAssembly(name, materials, options) {
]
}));
spinPivot.add(tire, rim, hub);
- const contact = new THREE17.Object3D;
+ const contact = new THREE18.Object3D;
contact.name = `Contact_${options.side}_${index}`;
contact.position.y = -radius;
stampSemanticMetadataV1(contact, semantic2([semanticRole(ROLE.wheelContact, key), semanticRole(ROLE.contact, key)], {
@@ -14631,10 +14846,10 @@ function objectBoundsInFrame(object, frame) {
object.updateWorldMatrix(true, true);
frame.updateWorldMatrix(true, false);
const worldToFrame = frame.matrixWorld.clone().invert();
- const bounds = new THREE17.Box3;
+ const bounds = new THREE18.Box3;
let found = false;
object.traverse((node) => {
- if (!(node instanceof THREE17.Mesh) || !(node.geometry instanceof THREE17.BufferGeometry))
+ if (!(node instanceof THREE18.Mesh) || !(node.geometry instanceof THREE18.BufferGeometry))
return;
node.geometry.computeBoundingBox();
const local = node.geometry.boundingBox;
@@ -14644,7 +14859,7 @@ function objectBoundsInFrame(object, frame) {
for (const x of [local.min.x, local.max.x])
for (const y of [local.min.y, local.max.y])
for (const z of [local.min.z, local.max.z]) {
- bounds.expandByPoint(new THREE17.Vector3(x, y, z).applyMatrix4(matrix));
+ bounds.expandByPoint(new THREE18.Vector3(x, y, z).applyMatrix4(matrix));
found = true;
}
});
@@ -14656,9 +14871,9 @@ function dimensions(object, frame) {
const bounds = objectBoundsInFrame(object, frame);
if (!bounds)
return;
- const size = bounds.getSize(new THREE17.Vector3);
+ const size = bounds.getSize(new THREE18.Vector3);
return {
- center: bounds.getCenter(new THREE17.Vector3),
+ center: bounds.getCenter(new THREE18.Vector3),
radius: Math.max(size.x, size.y) / 2,
width: size.z
};
@@ -14668,7 +14883,7 @@ function resolved(source, id, root, pivot, parts) {
const tire = dimensions(parts.tire, pivot);
const rim = dimensions(parts.rim, pivot);
const hub = dimensions(parts.hub, pivot);
- const centerLocal = tire?.center ?? rim?.center ?? hub?.center ?? new THREE17.Vector3;
+ const centerLocal = tire?.center ?? rim?.center ?? hub?.center ?? new THREE18.Vector3;
const toWorld = (value) => value.clone().applyMatrix4(pivot.matrixWorld);
return {
id,
@@ -14683,11 +14898,11 @@ function resolved(source, id, root, pivot, parts) {
...parts.hub ? { hub: parts.hub } : {},
...parts.contact ? { contact: parts.contact } : {},
centerWorld: toWorld(centerLocal),
- pivotCenterWorld: new THREE17.Vector3().setFromMatrixPosition(pivot.matrixWorld),
+ pivotCenterWorld: new THREE18.Vector3().setFromMatrixPosition(pivot.matrixWorld),
...tire ? { tireCenterWorld: toWorld(tire.center) } : {},
...rim ? { rimCenterWorld: toWorld(rim.center) } : {},
...hub ? { hubCenterWorld: toWorld(hub.center) } : {},
- spinAxisWorld: new THREE17.Vector3(0, 0, 1).transformDirection(pivot.matrixWorld),
+ spinAxisWorld: new THREE18.Vector3(0, 0, 1).transformDirection(pivot.matrixWorld),
...tire ? { radius: tire.radius, width: tire.width } : {},
...rim ? { rimRadius: rim.radius, rimWidth: rim.width } : {},
...hub ? { hubRadius: hub.radius, hubWidth: hub.width } : {},
@@ -15024,7 +15239,7 @@ var EPSILON = 0.0000000001, DEFAULT_TOLERANCE = 0.000001, finiteVector = (value)
];
// src/qa/vehicle-advisory.ts
-import * as THREE18 from "three";
+import * as THREE19 from "three";
function advisory(context, value) {
return {
...value,
@@ -15098,7 +15313,7 @@ function isFender(node) {
return semanticRoles(node).some((role) => /(?:^|\.)(?:fender|wheel-arch)(?:\.|$)/i.test(role)) || /fender|wheel[ _.-]?arch/i.test(node.name);
}
function isChassisMesh(node) {
- if (!(node instanceof THREE18.Mesh) || isFender(node))
+ if (!(node instanceof THREE19.Mesh) || isFender(node))
return false;
return semanticRoles(node).some((role) => /^(?:vehicle\.)?(?:chassis|body|hull)(?:\.|$)/i.test(role)) || /chassis|vehicle[ _.-]?body|fuselage|hull/i.test(node.name);
}
@@ -15106,10 +15321,10 @@ function objectBoundsInFrame2(object, frame) {
object.updateWorldMatrix(true, true);
frame.updateWorldMatrix(true, false);
const worldToFrame = frame.matrixWorld.clone().invert();
- const bounds = new THREE18.Box3;
+ const bounds = new THREE19.Box3;
let found = false;
object.traverseVisible((part) => {
- if (!(part instanceof THREE18.Mesh) || !(part.geometry instanceof THREE18.BufferGeometry))
+ if (!(part instanceof THREE19.Mesh) || !(part.geometry instanceof THREE19.BufferGeometry))
return;
part.geometry.computeBoundingBox();
const box = part.geometry.boundingBox;
@@ -15119,7 +15334,7 @@ function objectBoundsInFrame2(object, frame) {
for (const x of [box.min.x, box.max.x])
for (const y of [box.min.y, box.max.y])
for (const z of [box.min.z, box.max.z]) {
- bounds.expandByPoint(new THREE18.Vector3(x, y, z).applyMatrix4(matrix));
+ bounds.expandByPoint(new THREE19.Vector3(x, y, z).applyMatrix4(matrix));
found = true;
}
});
@@ -15130,15 +15345,15 @@ function tuple2(value) {
}
function probeBox(id, root, bounds) {
root.updateWorldMatrix(true, false);
- const center = bounds.getCenter(new THREE18.Vector3).applyMatrix4(root.matrixWorld);
- const size = bounds.getSize(new THREE18.Vector3);
- const position = new THREE18.Vector3;
- const quaternion = new THREE18.Quaternion;
- const scale = new THREE18.Vector3;
+ const center = bounds.getCenter(new THREE19.Vector3).applyMatrix4(root.matrixWorld);
+ const size = bounds.getSize(new THREE19.Vector3);
+ const position = new THREE19.Vector3;
+ const quaternion = new THREE19.Quaternion;
+ const scale = new THREE19.Vector3;
root.matrixWorld.decompose(position, quaternion, scale);
- const xAxis = new THREE18.Vector3(1, 0, 0).applyQuaternion(quaternion).normalize();
- const yAxis = new THREE18.Vector3(0, 1, 0).applyQuaternion(quaternion).normalize();
- const zAxis = new THREE18.Vector3(0, 0, 1).applyQuaternion(quaternion).normalize();
+ const xAxis = new THREE19.Vector3(1, 0, 0).applyQuaternion(quaternion).normalize();
+ const yAxis = new THREE19.Vector3(0, 1, 0).applyQuaternion(quaternion).normalize();
+ const zAxis = new THREE19.Vector3(0, 0, 1).applyQuaternion(quaternion).normalize();
return createOrientedProbeBox3({
id,
frame: createProbeLocalFrame3({
@@ -15207,7 +15422,7 @@ function orientationFindings(context, root, intent) {
const bounds = wholeAssetBounds(root);
if (!bounds)
return [];
- const size = bounds.getSize(new THREE18.Vector3);
+ const size = bounds.getSize(new THREE19.Vector3);
const ratio = size.z / Math.max(size.x, 0.000000001);
if (ratio <= ORIENTATION_RATIO)
return [];
@@ -15251,13 +15466,13 @@ function weldedBoundaryEdges(root, loop) {
let triangleCount = 0;
const vertexKey = (point) => [point.x, point.y, point.z].map((value) => Math.round(value * 1e6)).join(",");
loop.traverseVisible((node) => {
- if (!(node instanceof THREE18.Mesh) || !(node.geometry instanceof THREE18.BufferGeometry))
+ if (!(node instanceof THREE19.Mesh) || !(node.geometry instanceof THREE19.BufferGeometry))
return;
const positions = node.geometry.getAttribute("position");
if (!positions)
return;
const matrix = inverse.clone().multiply(node.matrixWorld);
- const keys = Array.from({ length: positions.count }, (_, index) => vertexKey(new THREE18.Vector3().fromBufferAttribute(positions, index).applyMatrix4(matrix)));
+ const keys = Array.from({ length: positions.count }, (_, index) => vertexKey(new THREE19.Vector3().fromBufferAttribute(positions, index).applyMatrix4(matrix)));
const index = node.geometry.getIndex();
const indices = index ? Array.from(index.array, Number) : Array.from({ length: positions.count }, (_, value) => value);
for (let offset = 0;offset + 2 < indices.length; offset += 3) {
@@ -15327,7 +15542,7 @@ function trackProfileFindings(context, root, intent) {
const wheelBounds = objectBoundsInFrame2(roadWheel, root);
if (!wheelBounds)
continue;
- const center = wheelBounds.getCenter(new THREE18.Vector3);
+ const center = wheelBounds.getCenter(new THREE19.Vector3);
if (expanded.containsPoint(center))
continue;
const clamped = center.clone().clamp(expanded.min, expanded.max);
@@ -15353,7 +15568,7 @@ function trackProfileFindings(context, root, intent) {
return findings;
}
function inspectMobilityAdvisory(context) {
- if (!(context.scene instanceof THREE18.Object3D)) {
+ if (!(context.scene instanceof THREE19.Object3D)) {
return [];
}
const intent = context.mobility;
@@ -15400,7 +15615,7 @@ var init_vehicle_advisory = __esm(() => {
});
// src/qa/vehicle.ts
-import * as THREE19 from "three";
+import * as THREE20 from "three";
function finding3(context, value) {
return {
...value,
@@ -15417,7 +15632,7 @@ function rootAxis(root, axis) {
return axis.clone().transformDirection(root.matrixWorld);
}
function angleDegrees(a, b) {
- return THREE19.MathUtils.radToDeg(Math.acos(THREE19.MathUtils.clamp(a.clone().normalize().dot(b.clone().normalize()), -1, 1)));
+ return THREE20.MathUtils.radToDeg(Math.acos(THREE20.MathUtils.clamp(a.clone().normalize().dot(b.clone().normalize()), -1, 1)));
}
function isDescendant(node, ancestor) {
let current = node;
@@ -15465,7 +15680,7 @@ function wheelCountFindings(context, intent, wheels) {
}
function wheelGeometryFindings(context, root, wheels) {
const findings = [];
- const expectedAxle = rootAxis(root, new THREE19.Vector3(0, 0, 1));
+ const expectedAxle = rootAxis(root, new THREE20.Vector3(0, 0, 1));
for (const wheel of wheels) {
const disposition = componentDisposition(wheel);
const centerTolerance = Math.max(CENTER_MINIMUM, (wheel.radius ?? 0) * CENTER_RATIO);
@@ -15654,7 +15869,7 @@ function contactFindings(context, root, intent, wheels) {
function renderableMinYInRoot(rootInverse, node) {
let minimum = Infinity;
node.traverseVisible((part) => {
- if (!(part instanceof THREE19.Mesh) || !(part.geometry instanceof THREE19.BufferGeometry))
+ if (!(part instanceof THREE20.Mesh) || !(part.geometry instanceof THREE20.BufferGeometry))
return;
part.geometry.computeBoundingBox();
const bounds = part.geometry.boundingBox;
@@ -15664,7 +15879,7 @@ function renderableMinYInRoot(rootInverse, node) {
for (const x of [bounds.min.x, bounds.max.x]) {
for (const y of [bounds.min.y, bounds.max.y]) {
for (const z of [bounds.min.z, bounds.max.z]) {
- minimum = Math.min(minimum, new THREE19.Vector3(x, y, z).applyMatrix4(matrix).y);
+ minimum = Math.min(minimum, new THREE20.Vector3(x, y, z).applyMatrix4(matrix).y);
}
}
}
@@ -15682,7 +15897,7 @@ function supportContactFindings(context, root, intent) {
if (!isWheelContact && roles.some((role) => role.startsWith("contact."))) {
explicitContacts.push({
node,
- contactY: localPoint2(inverse, new THREE19.Vector3().setFromMatrixPosition(node.matrixWorld)).y,
+ contactY: localPoint2(inverse, new THREE20.Vector3().setFromMatrixPosition(node.matrixWorld)).y,
source: "contact"
});
}
@@ -15762,7 +15977,7 @@ function steeringFindings(context, root, intent, wheels) {
return [];
root.updateWorldMatrix(true, false);
const inverse = root.matrixWorld.clone().invert();
- const expectedAxis = rootAxis(root, new THREE19.Vector3(0, 1, 0));
+ const expectedAxis = rootAxis(root, new THREE20.Vector3(0, 1, 0));
const localCenters = wheels.map((wheel) => ({
wheel,
center: localPoint2(inverse, wheel.centerWorld)
@@ -15772,8 +15987,8 @@ function steeringFindings(context, root, intent, wheels) {
const findings = [];
for (const { wheel } of targets) {
const steering = wheel.steeringPivot;
- const centerDelta = steering ? localPoint2(inverse, new THREE19.Vector3().setFromMatrixPosition(steering.matrixWorld)).distanceTo(localPoint2(inverse, wheel.centerWorld)) : Infinity;
- const axisAngle = steering ? angleDegrees(new THREE19.Vector3(0, 1, 0).transformDirection(steering.matrixWorld), expectedAxis) : Infinity;
+ const centerDelta = steering ? localPoint2(inverse, new THREE20.Vector3().setFromMatrixPosition(steering.matrixWorld)).distanceTo(localPoint2(inverse, wheel.centerWorld)) : Infinity;
+ const axisAngle = steering ? angleDegrees(new THREE20.Vector3(0, 1, 0).transformDirection(steering.matrixWorld), expectedAxis) : Infinity;
if (!steering || !isDescendant(wheel.pivot, steering) || centerDelta > CENTER_MINIMUM || axisAngle > AXIS_TOLERANCE_DEGREES) {
const axisInvalid = axisAngle > AXIS_TOLERANCE_DEGREES;
findings.push(finding3(context, {
@@ -15828,14 +16043,14 @@ function propulsionFindings(context, root, intent) {
}
for (const component of candidates) {
const pivot = pivots.get(component.id);
- const box = new THREE19.Box3().setFromObject(component.node);
- const center = box.isEmpty() ? undefined : box.getCenter(new THREE19.Vector3);
- const pivotCenter = pivot ? new THREE19.Vector3().setFromMatrixPosition(pivot.matrixWorld) : undefined;
+ const box = new THREE20.Box3().setFromObject(component.node);
+ const center = box.isEmpty() ? undefined : box.getCenter(new THREE20.Vector3);
+ const pivotCenter = pivot ? new THREE20.Vector3().setFromMatrixPosition(pivot.matrixWorld) : undefined;
const delta = center && pivotCenter ? localPoint2(rootInverse, center).distanceTo(localPoint2(rootInverse, pivotCenter)) : Infinity;
const frameId = kind === "rotor" ? "propulsion-axis.+y" : "propulsion-axis.+x";
const axisFrame = readSemanticMetadataV1(pivot ?? component.node)?.frames.find((frame) => frame.id === frameId);
- const canonicalAxis = kind === "rotor" ? new THREE19.Vector3(0, 1, 0) : new THREE19.Vector3(1, 0, 0);
- const axisAngle = pivot && axisFrame ? angleDegrees(canonicalAxis.clone().applyQuaternion(new THREE19.Quaternion(...axisFrame.rotation)).transformDirection(pivot.matrixWorld), rootAxis(root, canonicalAxis)) : Infinity;
+ const canonicalAxis = kind === "rotor" ? new THREE20.Vector3(0, 1, 0) : new THREE20.Vector3(1, 0, 0);
+ const axisAngle = pivot && axisFrame ? angleDegrees(canonicalAxis.clone().applyQuaternion(new THREE20.Quaternion(...axisFrame.rotation)).transformDirection(pivot.matrixWorld), rootAxis(root, canonicalAxis)) : Infinity;
if (!pivot || !isDescendant(component.node, pivot) || delta > CENTER_MINIMUM || !axisFrame || axisAngle > AXIS_TOLERANCE_DEGREES) {
findings.push(finding3(context, {
code: "VEH_ROTOR_PIVOT",
@@ -15857,7 +16072,7 @@ function propulsionFindings(context, root, intent) {
return findings;
}
function inspectMobility(context) {
- if (!(context.scene instanceof THREE19.Object3D))
+ if (!(context.scene instanceof THREE20.Object3D))
return [];
const intent = context.mobility;
if (!intent)
@@ -15930,7 +16145,7 @@ var init_vehicle2 = __esm(() => {
});
// src/qa/vegetation.ts
-import * as THREE20 from "three";
+import * as THREE21 from "three";
function rolesOf2(node) {
return readSemanticMetadataV1(node)?.roles ?? [];
}
@@ -15946,22 +16161,22 @@ function pathOf(node, root) {
return names.reverse().join("/");
}
function localPoint3(rootInverse, node) {
- return node.getWorldPosition(new THREE20.Vector3).applyMatrix4(rootInverse);
+ return node.getWorldPosition(new THREE21.Vector3).applyMatrix4(rootInverse);
}
function meshLocalBox(mesh, rootInverse) {
- if (!(mesh.geometry instanceof THREE20.BufferGeometry))
+ if (!(mesh.geometry instanceof THREE21.BufferGeometry))
return;
mesh.geometry.computeBoundingBox();
const source = mesh.geometry.boundingBox;
if (!source || source.isEmpty())
return;
const base = rootInverse.clone().multiply(mesh.matrixWorld);
- const result = new THREE20.Box3;
- const count = mesh instanceof THREE20.InstancedMesh ? mesh.count : 1;
+ const result = new THREE21.Box3;
+ const count = mesh instanceof THREE21.InstancedMesh ? mesh.count : 1;
for (let index = 0;index < count; index++) {
const transform = base.clone();
- if (mesh instanceof THREE20.InstancedMesh) {
- const instance = new THREE20.Matrix4;
+ if (mesh instanceof THREE21.InstancedMesh) {
+ const instance = new THREE21.Matrix4;
mesh.getMatrixAt(index, instance);
transform.multiply(instance);
}
@@ -15974,7 +16189,7 @@ function collectRenderableBounds(root) {
const inverse = root.matrixWorld.clone().invert();
const values = [];
root.traverseVisible((node) => {
- if (!(node instanceof THREE20.Mesh))
+ if (!(node instanceof THREE21.Mesh))
return;
const box = meshLocalBox(node, inverse);
if (!box)
@@ -15992,7 +16207,7 @@ function vegetationIntent(intent) {
}
function inspectFoliageContact(context) {
const trusted = context.foliage;
- if (!trusted?.grounded || !(context.scene instanceof THREE20.Object3D))
+ if (!trusted?.grounded || !(context.scene instanceof THREE21.Object3D))
return [];
const planeY = context.groundPlaneY ?? 0;
const root = context.scene;
@@ -16030,7 +16245,7 @@ function inspectFoliageContact(context) {
}
const findings = [];
for (const contact of contacts) {
- const contactPoint = contact.frameTranslation ? new THREE20.Vector3(...contact.frameTranslation).applyMatrix4(contact.node.matrixWorld).applyMatrix4(inverse) : localPoint3(inverse, contact.node);
+ const contactPoint = contact.frameTranslation ? new THREE21.Vector3(...contact.frameTranslation).applyMatrix4(contact.node.matrixWorld).applyMatrix4(inverse) : localPoint3(inverse, contact.node);
const y = contactPoint.y;
const offset = y - planeY;
if (Math.abs(offset) <= VEGETATION_CONTACT_TOLERANCE_METERS)
@@ -16059,7 +16274,7 @@ function inspectFoliageContact(context) {
for (const support of semanticSupports) {
let minimumY = Infinity;
support.traverseVisible((node) => {
- if (!(node instanceof THREE20.Mesh))
+ if (!(node instanceof THREE21.Mesh))
return;
const box = meshLocalBox(node, inverse);
if (box)
@@ -16087,25 +16302,25 @@ function inspectFoliageContact(context) {
return findings;
}
function materialNames(node) {
- if (!(node instanceof THREE20.Mesh))
+ if (!(node instanceof THREE21.Mesh))
return [];
const materials = Array.isArray(node.material) ? node.material : [node.material];
return materials.filter(Boolean).map((material) => material.name ?? "");
}
function inspectFoliageScope(context) {
const trusted = context.foliage;
- if (!trusted?.standalone || !(context.scene instanceof THREE20.Object3D))
+ if (!trusted?.standalone || !(context.scene instanceof THREE21.Object3D))
return [];
const root = context.scene;
const renderables = collectRenderableBounds(root);
if (renderables.length === 0)
return [];
- const overall = renderables.reduce((box, value) => box.union(value.box), new THREE20.Box3);
- const overallSize = overall.getSize(new THREE20.Vector3);
+ const overall = renderables.reduce((box, value) => box.union(value.box), new THREE21.Box3);
+ const overallSize = overall.getSize(new THREE21.Vector3);
const findings = [];
for (const value of renderables) {
- const size = value.box.getSize(new THREE20.Vector3);
- const center = value.box.getCenter(new THREE20.Vector3);
+ const size = value.box.getSize(new THREE21.Vector3);
+ const center = value.box.getCenter(new THREE21.Vector3);
const names = [value.node.name, ...value.roles];
const nameEvidence = names.some((name) => CLUTTER_NAME.test(name));
const roleEvidence = value.roles.some((role) => /(?:terrain|soil|rock|pot|planter|base)/i.test(role));
@@ -16142,8 +16357,8 @@ function inspectFoliageScope(context) {
function unionVolume(boxes) {
if (boxes.length === 0)
return 0;
- const union = boxes.reduce((result, box) => result.union(box), new THREE20.Box3);
- const size = union.getSize(new THREE20.Vector3);
+ const union = boxes.reduce((result, box) => result.union(box), new THREE21.Box3);
+ const size = union.getSize(new THREE21.Vector3);
return size.x * size.y * size.z;
}
function projectedOccupancy(boxes, axes) {
@@ -16213,7 +16428,7 @@ function boxDistanceToPoint(box, point) {
function endpointRadius(position, axis, axisValue, tolerance, scale) {
const radialAxes = [0, 1, 2].filter((value) => value !== axis);
const points = [];
- const point = new THREE20.Vector3;
+ const point = new THREE21.Vector3;
for (let index = 0;index < position.count; index++) {
point.fromBufferAttribute(position, index);
if (Math.abs(point.getComponent(axis) - axisValue) <= tolerance)
@@ -16221,7 +16436,7 @@ function endpointRadius(position, axis, axisValue, tolerance, scale) {
}
if (points.length === 0)
return;
- const center = new THREE20.Vector3;
+ const center = new THREE21.Vector3;
center.setComponent(axis, axisValue);
for (const radialAxis of radialAxes) {
center.setComponent(radialAxis, points.reduce((sum, value) => sum + value.getComponent(radialAxis), 0) / points.length);
@@ -16235,7 +16450,7 @@ function endpointRadius(position, axis, axisValue, tolerance, scale) {
return { center, radius };
}
function growthNodeMeasurement(root, candidate, allCandidates, band) {
- if (!(candidate.node instanceof THREE20.Mesh))
+ if (!(candidate.node instanceof THREE21.Mesh))
return;
const geometry = candidate.node.geometry;
const position = geometry.getAttribute("position");
@@ -16247,9 +16462,9 @@ function growthNodeMeasurement(root, candidate, allCandidates, band) {
return;
root.updateWorldMatrix(true, true);
const relative = root.matrixWorld.clone().invert().multiply(candidate.node.matrixWorld);
- const relativeScale = new THREE20.Vector3;
- relative.decompose(new THREE20.Vector3, new THREE20.Quaternion, relativeScale);
- const size = geometryBox.getSize(new THREE20.Vector3);
+ const relativeScale = new THREE21.Vector3;
+ relative.decompose(new THREE21.Vector3, new THREE21.Quaternion, relativeScale);
+ const size = geometryBox.getSize(new THREE21.Vector3);
const scaledSizes = [
Math.abs(size.x * relativeScale.x),
Math.abs(size.y * relativeScale.y),
@@ -16316,7 +16531,7 @@ function measureFoliageGrowth(foliage, root) {
};
}
function inspectFoliageGrowth(context) {
- if (!context.foliage || !(context.scene instanceof THREE20.Object3D))
+ if (!context.foliage || !(context.scene instanceof THREE21.Object3D))
return [];
const measured = measureFoliageGrowth(context.foliage, context.scene);
const findings = [];
@@ -16367,7 +16582,7 @@ function measureVegetationFoliageAttachment(root) {
const support = renderables.filter((value) => roleOrNameSource(value, TRUNK_PATTERNS) || roleOrNameSource(value, BRANCH_PATTERNS));
const foliage = renderables.filter((value) => roleOrNameSource(value, CANOPY_PATTERNS));
const clusters = foliage.map((value) => {
- const size = value.box.getSize(new THREE20.Vector3);
+ const size = value.box.getSize(new THREE21.Vector3);
const threshold = stable7(Math.max(0.03, Math.min(0.18, size.length() * 0.12)));
const nearest = support.map((candidate) => ({ candidate, gap: distanceBetweenBoxes(value.box, candidate.box) })).sort((a, b) => a.gap - b.gap || (a.candidate.node.name || "").localeCompare(b.candidate.node.name || ""))[0];
const source = roleOrNameSource(value, CANOPY_PATTERNS) ?? "fallback";
@@ -16390,7 +16605,7 @@ function measureVegetationFoliageAttachment(root) {
};
}
function inspectFoliageAttachment(context) {
- if (!context.foliage || !(context.scene instanceof THREE20.Object3D))
+ if (!context.foliage || !(context.scene instanceof THREE21.Object3D))
return [];
return measureVegetationFoliageAttachment(context.scene).clusters.filter((cluster) => cluster.detached).map((cluster) => finding4(context, {
code: "VEG_FOLIAGE_DETACHED",
@@ -16410,9 +16625,9 @@ function inspectFoliageAttachment(context) {
}
function relativeTransformSignature(root, node) {
const matrix = root.matrixWorld.clone().invert().multiply(node.matrixWorld);
- const scale = new THREE20.Vector3;
- const quaternion = new THREE20.Quaternion;
- matrix.decompose(new THREE20.Vector3, quaternion, scale);
+ const scale = new THREE21.Vector3;
+ const quaternion = new THREE21.Quaternion;
+ matrix.decompose(new THREE21.Vector3, quaternion, scale);
if (quaternion.w < 0)
quaternion.set(-quaternion.x, -quaternion.y, -quaternion.z, -quaternion.w);
const values = [...scale.toArray(), ...quaternion.toArray()].map((value) => stable7(value));
@@ -16433,9 +16648,9 @@ function measureFoliageRepetition(requirements, root) {
nodes: values.map((value) => value.node.name || "foliage-cluster").sort()
})).sort((a, b) => a.signature.localeCompare(b.signature));
const supports = collectRenderableBounds(root).filter((value) => roleOrNameSource(value, TRUNK_PATTERNS));
- const centerBox = supports.reduce((box, value) => box.union(value.box), new THREE20.Box3);
- const centers = foliage.map((value) => value.box.getCenter(new THREE20.Vector3));
- const center = centerBox.isEmpty() ? centers.reduce((result, value) => result.add(value), new THREE20.Vector3).multiplyScalar(centers.length > 0 ? 1 / centers.length : 0) : centerBox.getCenter(new THREE20.Vector3);
+ const centerBox = supports.reduce((box, value) => box.union(value.box), new THREE21.Box3);
+ const centers = foliage.map((value) => value.box.getCenter(new THREE21.Vector3));
+ const center = centerBox.isEmpty() ? centers.reduce((result, value) => result.add(value), new THREE21.Vector3).multiplyScalar(centers.length > 0 ? 1 / centers.length : 0) : centerBox.getCenter(new THREE21.Vector3);
const radial = centers.map((value) => ({
angle: Math.atan2(value.z - center.z, value.x - center.x),
radius: Math.hypot(value.x - center.x, value.z - center.z)
@@ -16470,7 +16685,7 @@ function measureFoliageRepetition(requirements, root) {
};
}
function inspectFoliageRepetition(context) {
- if (!context.foliage || !(context.scene instanceof THREE20.Object3D))
+ if (!context.foliage || !(context.scene instanceof THREE21.Object3D))
return [];
const measured = measureFoliageRepetition(context.foliage, context.scene);
if (measured.suppressedForTopiary)
@@ -16528,7 +16743,7 @@ function measureFoliageCanopy(profile, root) {
}
function inspectFoliageCanopy(context) {
const trusted = context.foliage;
- if (!trusted?.canopyProfile || !(context.scene instanceof THREE20.Object3D))
+ if (!trusted?.canopyProfile || !(context.scene instanceof THREE21.Object3D))
return [];
const measurements = measureFoliageCanopy(trusted.canopyProfile, context.scene);
const bands = PROFILE_BANDS[measurements.profile];
@@ -16589,7 +16804,7 @@ function inspectFoliageCanopy(context) {
return findings;
}
function materialValue(material) {
- if (!(material instanceof THREE20.MeshStandardMaterial) && !(material instanceof THREE20.MeshBasicMaterial)) {
+ if (!(material instanceof THREE21.MeshStandardMaterial) && !(material instanceof THREE21.MeshBasicMaterial)) {
return;
}
const color = material.color;
@@ -16599,11 +16814,11 @@ function measureFoliageMaterials(mode, root) {
const values = [];
let foliageNodeCount = 0;
root.traverseVisible((node) => {
- if (!(node instanceof THREE20.Mesh))
+ if (!(node instanceof THREE21.Mesh))
return;
const bounds = {
node,
- box: new THREE20.Box3,
+ box: new THREE21.Box3,
roles: rolesOf2(node),
source: rolesOf2(node).length > 0 ? "semantic" : "fallback"
};
@@ -16630,7 +16845,7 @@ function measureFoliageMaterials(mode, root) {
};
}
function inspectFoliageMaterial(context) {
- if (!context.foliage || !(context.scene instanceof THREE20.Object3D))
+ if (!context.foliage || !(context.scene instanceof THREE21.Object3D))
return [];
if (!context.materialMode)
return [];
@@ -16786,7 +17001,7 @@ var init_vegetation = __esm(() => {
});
// src/skin-binding.ts
-import * as THREE21 from "three";
+import * as THREE22 from "three";
function topRoot(node) {
while (node.parent)
node = node.parent;
@@ -16806,7 +17021,7 @@ function createSkinnedPart(name, geometry, material, options) {
}
}
function buildSkinnedPart(name, geometry, material, options) {
- if (typeof name !== "string" || !name.trim() || THREE21.PropertyBinding.sanitizeNodeName(name) !== name)
+ if (typeof name !== "string" || !name.trim() || THREE22.PropertyBinding.sanitizeNodeName(name) !== name)
throw new TypeError("createSkinnedPart name must be nonempty and free of animation binding punctuation.");
if (!geometry?.isBufferGeometry)
throw new TypeError("createSkinnedPart requires BufferGeometry.");
@@ -16824,7 +17039,7 @@ function buildSkinnedPart(name, geometry, material, options) {
for (const bone of bones) {
if (!bone?.isBone || topRoot(bone) !== top || members.has(bone))
throw new TypeError("createSkinnedPart bones must be distinct Bones in the parent hierarchy.");
- if (!bone.name || THREE21.PropertyBinding.sanitizeNodeName(bone.name) !== bone.name || names.has(bone.name))
+ if (!bone.name || THREE22.PropertyBinding.sanitizeNodeName(bone.name) !== bone.name || names.has(bone.name))
throw new TypeError("createSkinnedPart bones need unique animation-safe names.");
members.add(bone);
names.add(bone.name);
@@ -16871,9 +17086,9 @@ function buildSkinnedPart(name, geometry, material, options) {
for (const key of ["position", "rotation", "scale"])
if (options[key] !== undefined)
assertFiniteTriple(`createSkinnedPart ${key}`, options[key]);
- const local = new THREE21.Matrix4().compose(new THREE21.Vector3(...options.position ?? [0, 0, 0]), new THREE21.Quaternion().setFromEuler(new THREE21.Euler(...(options.rotation ?? [0, 0, 0]).map(THREE21.MathUtils.degToRad))), new THREE21.Vector3(...options.scale ?? [1, 1, 1]));
+ const local = new THREE22.Matrix4().compose(new THREE22.Vector3(...options.position ?? [0, 0, 0]), new THREE22.Quaternion().setFromEuler(new THREE22.Euler(...(options.rotation ?? [0, 0, 0]).map(THREE22.MathUtils.degToRad))), new THREE22.Vector3(...options.scale ?? [1, 1, 1]));
top.updateWorldMatrix(true, true);
- const bind = new THREE21.Matrix4().multiplyMatrices(parent.matrixWorld, local);
+ const bind = new THREE22.Matrix4().multiplyMatrices(parent.matrixWorld, local);
assertMatrix(bind, "mesh");
for (const bone of bones) {
assertMatrix(bone.matrixWorld, `bone ${bone.name}`);
@@ -16888,19 +17103,19 @@ function buildSkinnedPart(name, geometry, material, options) {
}
}
const owned = geometry.clone();
- owned.setAttribute("skinIndex", new THREE21.BufferAttribute(skinIndices, 4));
- owned.setAttribute("skinWeight", new THREE21.BufferAttribute(skinWeights, 4));
- const mesh = new THREE21.SkinnedMesh(owned, Array.isArray(material) ? [...material] : material);
+ owned.setAttribute("skinIndex", new THREE22.BufferAttribute(skinIndices, 4));
+ owned.setAttribute("skinWeight", new THREE22.BufferAttribute(skinWeights, 4));
+ const mesh = new THREE22.SkinnedMesh(owned, Array.isArray(material) ? [...material] : material);
mesh.name = `Mesh_${name}`;
if (options.position)
mesh.position.fromArray(options.position);
if (options.rotation)
- mesh.rotation.set(...options.rotation.map(THREE21.MathUtils.degToRad));
+ mesh.rotation.set(...options.rotation.map(THREE22.MathUtils.degToRad));
if (options.scale)
mesh.scale.fromArray(options.scale);
if (options.semantic)
stampSemanticMetadataV1(mesh, options.semantic);
- const skeleton = new THREE21.Skeleton([...bones], bones.map((bone) => bone.matrixWorld.clone().invert()));
+ const skeleton = new THREE22.Skeleton([...bones], bones.map((bone) => bone.matrixWorld.clone().invert()));
mesh.bind(skeleton, bind);
parent.add(mesh);
mesh.updateWorldMatrix(true, false);
@@ -16913,7 +17128,7 @@ var init_skin_binding = __esm(() => {
});
// src/character.ts
-import * as THREE22 from "three";
+import * as THREE23 from "three";
function validRole(value) {
return typeof value === "string" && /^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/.test(value);
}
@@ -17194,7 +17409,7 @@ function readCharacterRigGraphV1(target) {
return result.valid ? result.value : undefined;
}
function axisQuaternion(from, to) {
- const value = new THREE22.Quaternion().setFromUnitVectors(new THREE22.Vector3(...from), new THREE22.Vector3(...to));
+ const value = new THREE23.Quaternion().setFromUnitVectors(new THREE23.Vector3(...from), new THREE23.Vector3(...to));
return [value.x, value.y, value.z, value.w];
}
function stampCharacterJointDescriptorV1(target, input) {
@@ -17299,7 +17514,7 @@ function createJointChain(chainName, segments, options = {}) {
endEffector: segment.endEffector,
contact: segment.contact
});
- const node = new THREE22.Object3D;
+ const node = new THREE23.Object3D;
node.name = characterJointNodeName(chainName, segment.role);
node.position.fromArray(descriptor.rest.translation);
node.quaternion.fromArray(descriptor.rest.rotation);
@@ -17379,7 +17594,7 @@ function buildBoneChain(chainName, segments, options = {}) {
return descriptor;
});
const nodes = descriptors.map((descriptor) => {
- const node = new THREE22.Bone;
+ const node = new THREE23.Bone;
node.name = characterJointNodeName(chainName, descriptor.role);
node.position.fromArray(descriptor.rest.translation);
node.quaternion.fromArray(descriptor.rest.rotation);
@@ -17568,7 +17783,7 @@ var init_character_repairs = __esm(() => {
});
// src/qa/character.ts
-import * as THREE23 from "three";
+import * as THREE24 from "three";
function isClipLike(value) {
if (typeof value !== "object" || value === null)
return false;
@@ -17806,7 +18021,7 @@ function contactFindings2(input, root) {
const planeY = input.groundPlaneY ?? 0;
const findings = [];
for (const contact of contacts) {
- const point = contact.node.getWorldPosition(new THREE23.Vector3).applyMatrix4(rootInverse);
+ const point = contact.node.getWorldPosition(new THREE24.Vector3).applyMatrix4(rootInverse);
const offset = point.y - planeY;
if (offset > tolerance) {
findings.push(block(input, "CHAR_CONTACT_FLOATING", `Ground contact ${contact.descriptor.role} is ${offset.toFixed(6)} m above asset-local ground.`, {
@@ -18071,13 +18286,13 @@ function declaredHeldItem(nodes) {
function characterJointScale(root) {
root.updateMatrixWorld(true);
const inverse = root.matrixWorld.clone().invert();
- const bounds = new THREE23.Box3;
+ const bounds = new THREE24.Box3;
for (const joint of collectCharacterJointNodes(root)) {
- bounds.expandByPoint(joint.node.getWorldPosition(new THREE23.Vector3).applyMatrix4(inverse));
+ bounds.expandByPoint(joint.node.getWorldPosition(new THREE24.Vector3).applyMatrix4(inverse));
}
if (bounds.isEmpty())
return 1;
- const size = bounds.getSize(new THREE23.Vector3);
+ const size = bounds.getSize(new THREE24.Vector3);
return Math.max(size.x, size.y, size.z, 1);
}
function heldItemMotionFindings(input, root, clips) {
@@ -18113,8 +18328,8 @@ function heldItemMotionFindings(input, root, clips) {
if (!cloneItem || !cloneAttachment)
continue;
const inverse = clone.matrixWorld.clone().invert();
- const itemPoint = cloneItem.getWorldPosition(new THREE23.Vector3).applyMatrix4(inverse);
- const gripPoint = cloneAttachment.getWorldPosition(new THREE23.Vector3).applyMatrix4(inverse);
+ const itemPoint = cloneItem.getWorldPosition(new THREE24.Vector3).applyMatrix4(inverse);
+ const gripPoint = cloneAttachment.getWorldPosition(new THREE24.Vector3).applyMatrix4(inverse);
const distance = itemPoint.distanceTo(gripPoint);
baseline ??= distance;
const drift = Math.abs(distance - baseline);
@@ -18147,7 +18362,7 @@ function heldItemMotionFindings(input, root, clips) {
function inspectRig(context) {
if (!context.rig)
return [];
- const root = context.scene instanceof THREE23.Object3D ? context.scene : undefined;
+ const root = context.scene instanceof THREE24.Object3D ? context.scene : undefined;
const clips = (context.clips ?? []).filter(isClipLike);
const findings = [];
if (root) {
@@ -18197,7 +18412,7 @@ var init_character2 = __esm(() => {
});
// src/qa/character-advisory.ts
-import * as THREE24 from "three";
+import * as THREE25 from "three";
function isClipLike2(value) {
if (typeof value !== "object" || value === null)
return false;
@@ -18220,16 +18435,16 @@ function jointPoints(root) {
const inverse = rootInverse(root);
return collectCharacterJointNodes(root).map((evidence) => ({
evidence,
- local: evidence.node.getWorldPosition(new THREE24.Vector3).applyMatrix4(inverse)
+ local: evidence.node.getWorldPosition(new THREE25.Vector3).applyMatrix4(inverse)
}));
}
function characterScale(points) {
if (points.length === 0)
return 1;
- const bounds = new THREE24.Box3;
+ const bounds = new THREE25.Box3;
for (const point of points)
bounds.expandByPoint(point.local);
- const size = bounds.getSize(new THREE24.Vector3);
+ const size = bounds.getSize(new THREE25.Vector3);
return Math.max(size.x, size.y, size.z, 1);
}
function pairKey(descriptor) {
@@ -18328,12 +18543,12 @@ function restChainFindings(context, root) {
}
function forwardMarkerFindings(context, root) {
root.updateMatrixWorld(true);
- const expected = new THREE24.Vector3(1, 0, 0).transformDirection(root.matrixWorld);
+ const expected = new THREE25.Vector3(1, 0, 0).transformDirection(root.matrixWorld);
const markers = collectCharacterJointNodes(root).filter((joint) => /(?:^|[._-])(?:toe|muzzle|head)(?:$|[._-])/i.test(joint.descriptor.role));
return markers.flatMap((marker) => {
- const quaternion = marker.node.getWorldQuaternion(new THREE24.Quaternion);
- const actual = new THREE24.Vector3(...marker.descriptor.localForwardAxis).applyQuaternion(quaternion).normalize();
- const angle = THREE24.MathUtils.radToDeg(Math.acos(THREE24.MathUtils.clamp(actual.dot(expected), -1, 1)));
+ const quaternion = marker.node.getWorldQuaternion(new THREE25.Quaternion);
+ const actual = new THREE25.Vector3(...marker.descriptor.localForwardAxis).applyQuaternion(quaternion).normalize();
+ const angle = THREE25.MathUtils.radToDeg(Math.acos(THREE25.MathUtils.clamp(actual.dot(expected), -1, 1)));
if (angle <= FORWARD_ANGLE_DEGREES)
return [];
return [
@@ -18387,7 +18602,7 @@ function sampleClip(root, clip) {
byRole: new Map(collectCharacterJointNodes(clone).map((evidence) => [
evidence.descriptor.role,
{
- point: evidence.node.getWorldPosition(new THREE24.Vector3).applyMatrix4(inverse),
+ point: evidence.node.getWorldPosition(new THREE25.Vector3).applyMatrix4(inverse),
evidence
}
]))
@@ -18499,12 +18714,12 @@ function phaseOppositionFindings(context, root, clips) {
return findings;
}
function signedBendDegrees(descriptor, quaternion) {
- const rest = new THREE24.Quaternion(...descriptor.rest.rotation);
+ const rest = new THREE25.Quaternion(...descriptor.rest.rotation);
const delta = rest.invert().multiply(quaternion).normalize();
- const axis = new THREE24.Vector3(delta.x, delta.y, delta.z);
- const signedMagnitude = axis.dot(new THREE24.Vector3(...descriptor.localBendAxis));
+ const axis = new THREE25.Vector3(delta.x, delta.y, delta.z);
+ const signedMagnitude = axis.dot(new THREE25.Vector3(...descriptor.localBendAxis));
const angle = 2 * Math.atan2(signedMagnitude, delta.w);
- return THREE24.MathUtils.radToDeg(THREE24.MathUtils.euclideanModulo(angle + Math.PI, Math.PI * 2) - Math.PI);
+ return THREE25.MathUtils.radToDeg(THREE25.MathUtils.euclideanModulo(angle + Math.PI, Math.PI * 2) - Math.PI);
}
function bendDirectionFindings(context, root, clips) {
const joints = collectCharacterJointNodes(root).filter((joint) => /(?:^|[._-])(?:knee|elbow)(?:$|[._-])/i.test(joint.descriptor.role));
@@ -18518,7 +18733,7 @@ function bendDirectionFindings(context, root, clips) {
let maximumFraction = 0;
for (const fraction of SAMPLE_FRACTIONS) {
const value = track.createInterpolant().evaluate(fraction * clip.duration);
- const bend = signedBendDegrees(joint.descriptor, new THREE24.Quaternion().fromArray(value).normalize());
+ const bend = signedBendDegrees(joint.descriptor, new THREE25.Quaternion().fromArray(value).normalize());
if (Math.abs(bend) > Math.abs(maximum)) {
maximum = bend;
maximumFraction = fraction;
@@ -18601,7 +18816,7 @@ function footSlideFindings(context, root, clips) {
return findings;
}
function inspectRigAdvisory(context) {
- if (!context.rig || !(context.scene instanceof THREE24.Object3D)) {
+ if (!context.rig || !(context.scene instanceof THREE25.Object3D)) {
return [];
}
const root = context.scene;
@@ -18720,7 +18935,7 @@ var init_architecture_repairs = __esm(() => {
});
// src/qa/architecture.ts
-import * as THREE25 from "three";
+import * as THREE26 from "three";
function hasRoofDimensions(value) {
return value.footprint !== undefined && value.roof?.ridgeAxis !== undefined && value.roof.rise !== undefined && value.roof.overhang !== undefined;
}
@@ -18730,7 +18945,7 @@ function semanticMetadata(node) {
function markerBounds(matrix) {
const bounds = emptyBounds();
for (let corner = 0;corner < 8; corner++) {
- expandBounds(bounds, new THREE25.Vector3(corner & 1 ? 0.5 : -0.5, corner & 2 ? 0.5 : -0.5, corner & 4 ? 0.5 : -0.5).applyMatrix4(matrix));
+ expandBounds(bounds, new THREE26.Vector3(corner & 1 ? 0.5 : -0.5, corner & 2 ? 0.5 : -0.5, corner & 4 ? 0.5 : -0.5).applyMatrix4(matrix));
}
return bounds;
}
@@ -18739,7 +18954,7 @@ function geometryPlaneNormal(geometry, relativeMatrix) {
const local = geometry.boundingBox;
if (!local)
return;
- const size = local.getSize(new THREE25.Vector3);
+ const size = local.getSize(new THREE26.Vector3);
const dimensions = [
["x", size.x],
["y", size.y],
@@ -18749,7 +18964,7 @@ function geometryPlaneNormal(geometry, relativeMatrix) {
const axis = dimensions[0]?.[0];
if (!axis)
return;
- const normal = new THREE25.Vector3(axis === "x" ? 1 : 0, axis === "y" ? 1 : 0, axis === "z" ? 1 : 0).transformDirection(relativeMatrix);
+ const normal = new THREE26.Vector3(axis === "x" ? 1 : 0, axis === "y" ? 1 : 0, axis === "z" ? 1 : 0).transformDirection(relativeMatrix);
if (normal.y < 0)
normal.multiplyScalar(-1);
return normal.normalize();
@@ -18761,7 +18976,7 @@ function geometryEvidence(geometry, relativeMatrix) {
if (position?.itemSize !== 3)
return { bounds, vertices, triangles: [] };
for (let index = 0;index < position.count; index++) {
- const point = new THREE25.Vector3(position.getX(index), position.getY(index), position.getZ(index));
+ const point = new THREE26.Vector3(position.getX(index), position.getY(index), position.getZ(index));
point.applyMatrix4(relativeMatrix);
vertices.push(point);
expandBounds(bounds, point);
@@ -18788,7 +19003,7 @@ function geometryEvidence(geometry, relativeMatrix) {
return { bounds, vertices, triangles, ...planeNormal ? { planeNormal } : {} };
}
function collectArchitectureEvidence(scene) {
- if (!(scene instanceof THREE25.Object3D))
+ if (!(scene instanceof THREE26.Object3D))
return;
scene.updateMatrixWorld(true);
const rootInverse = scene.matrixWorld.clone().invert();
@@ -18808,7 +19023,7 @@ function collectArchitectureEvidence(scene) {
const nodePath = parentPath ? `${parentPath}/${segment}` : segment;
const relativeMatrix = rootInverse.clone().multiply(node.matrixWorld);
const mesh = node;
- const isMesh = mesh.isMesh === true && mesh.geometry instanceof THREE25.BufferGeometry;
+ const isMesh = mesh.isMesh === true && mesh.geometry instanceof THREE26.BufferGeometry;
const evidence = isMesh ? geometryEvidence(mesh.geometry, relativeMatrix) : {
bounds: markerBounds(relativeMatrix),
vertices: [],
@@ -18867,7 +19082,7 @@ function architectureFinding(context, value) {
function averageNormal(normals) {
if (normals.length === 0)
return;
- const result = normals.reduce((sum, normal) => sum.add(normal), new THREE25.Vector3);
+ const result = normals.reduce((sum, normal) => sum.add(normal), new THREE26.Vector3);
return result.lengthSq() > EPSILON2 ? result.normalize() : undefined;
}
function intervalCoverage(min, max, expectedMin, expectedMax) {
@@ -19578,8 +19793,8 @@ function evaluateArchitectureQa(context) {
});
}
var PROFILE_RULE_ID2 = "ARCHITECTURE_PROFILE", EPSILON2 = 0.000001, ARCHITECTURE_REALISTIC_SCALE_BANDS, emptyBounds = () => ({
- min: new THREE25.Vector3(Infinity, Infinity, Infinity),
- max: new THREE25.Vector3(-Infinity, -Infinity, -Infinity)
+ min: new THREE26.Vector3(Infinity, Infinity, Infinity),
+ max: new THREE26.Vector3(-Infinity, -Infinity, -Infinity)
}), expandBounds = (bounds, point) => {
bounds.min.min(point);
bounds.max.max(point);
@@ -19623,7 +19838,7 @@ var init_architecture = __esm(() => {
});
// src/qa/environment.ts
-import * as THREE26 from "three";
+import * as THREE27 from "three";
function finding5(context, value) {
return { ...value, profile: context.profile ?? "asset.requirements.v1" };
}
@@ -19642,11 +19857,11 @@ function nodePath4(root, node) {
return names.reverse().join("/");
}
function transformedBox2(source, transform) {
- const result = new THREE26.Box3;
+ const result = new THREE27.Box3;
for (const x of [source.min.x, source.max.x]) {
for (const y of [source.min.y, source.max.y]) {
for (const z of [source.min.z, source.max.z]) {
- result.expandByPoint(new THREE26.Vector3(x, y, z).applyMatrix4(transform));
+ result.expandByPoint(new THREE27.Vector3(x, y, z).applyMatrix4(transform));
}
}
}
@@ -19655,16 +19870,16 @@ function transformedBox2(source, transform) {
function orientedBoxFromLocalBounds(root, node, source, relative = root.matrixWorld.clone().invert().multiply(node.matrixWorld)) {
if (!relative.elements.every(Number.isFinite))
return;
- const position = new THREE26.Vector3;
- const rotation = new THREE26.Quaternion;
- const scale = new THREE26.Vector3;
+ const position = new THREE27.Vector3;
+ const rotation = new THREE27.Quaternion;
+ const scale = new THREE27.Vector3;
relative.decompose(position, rotation, scale);
- const recomposed = new THREE26.Matrix4().compose(position, rotation, scale);
+ const recomposed = new THREE27.Matrix4().compose(position, rotation, scale);
const residual = Math.max(...relative.elements.map((component, index) => Math.abs(component - (recomposed.elements[index] ?? component))));
if (residual > 0.00001)
return;
- const center = source.getCenter(new THREE26.Vector3).applyMatrix4(relative);
- const sourceHalf = source.getSize(new THREE26.Vector3).multiplyScalar(0.5);
+ const center = source.getCenter(new THREE27.Vector3).applyMatrix4(relative);
+ const sourceHalf = source.getSize(new THREE27.Vector3).multiplyScalar(0.5);
const halfExtents = [
Math.abs(sourceHalf.x * scale.x),
Math.abs(sourceHalf.y * scale.y),
@@ -19685,24 +19900,24 @@ function collectParts5(root) {
const result = [];
root.traverseVisible((node) => {
const roles = rolesOf3(node);
- const renderable = node instanceof THREE26.Mesh;
+ const renderable = node instanceof THREE27.Mesh;
let box;
let orientedBox;
let source;
- if (renderable && node.geometry instanceof THREE26.BufferGeometry) {
+ if (renderable && node.geometry instanceof THREE27.BufferGeometry) {
node.geometry.computeBoundingBox();
if (node.geometry.boundingBox) {
source = node.geometry.boundingBox;
}
} else if (roles.length > 0) {
- source = new THREE26.Box3(new THREE26.Vector3(-0.5, -0.5, -0.5), new THREE26.Vector3(0.5, 0.5, 0.5));
+ source = new THREE27.Box3(new THREE27.Vector3(-0.5, -0.5, -0.5), new THREE27.Vector3(0.5, 0.5, 0.5));
}
const relative = rootInverse.clone().multiply(node.matrixWorld);
- const count = node instanceof THREE26.InstancedMesh ? node.count : 1;
+ const count = node instanceof THREE27.InstancedMesh ? node.count : 1;
for (let index = 0;index < count; index++) {
const transform = relative.clone();
- if (node instanceof THREE26.InstancedMesh) {
- const instance = new THREE26.Matrix4;
+ if (node instanceof THREE27.InstancedMesh) {
+ const instance = new THREE27.Matrix4;
node.getMatrixAt(index, instance);
transform.multiply(instance);
}
@@ -19733,9 +19948,9 @@ function resolveSocket(root, node, socket) {
return;
root.updateWorldMatrix(true, true);
const rootInverse = root.matrixWorld.clone().invert();
- const point = new THREE26.Vector3(...frame.translation).applyMatrix4(node.matrixWorld).applyMatrix4(rootInverse);
- const rootInverseQuaternion = root.getWorldQuaternion(new THREE26.Quaternion).invert();
- const rotation = node.getWorldQuaternion(new THREE26.Quaternion).multiply(new THREE26.Quaternion(...frame.rotation)).premultiply(rootInverseQuaternion).normalize();
+ const point = new THREE27.Vector3(...frame.translation).applyMatrix4(node.matrixWorld).applyMatrix4(rootInverse);
+ const rootInverseQuaternion = root.getWorldQuaternion(new THREE27.Quaternion).invert();
+ const rotation = node.getWorldQuaternion(new THREE27.Quaternion).multiply(new THREE27.Quaternion(...frame.rotation)).premultiply(rootInverseQuaternion).normalize();
return {
id: socket.id,
type: socket.type,
@@ -19764,7 +19979,7 @@ function socketByType(sockets, type) {
return sockets.find((socket) => socket.type === type);
}
function inspectPlacementSockets(context) {
- if (!(context.scene instanceof THREE26.Object3D)) {
+ if (!(context.scene instanceof THREE27.Object3D)) {
return [];
}
const root = context.scene;
@@ -19828,7 +20043,7 @@ function materialSignature(material) {
function boundarySamples(root, axis, side, bins = 12) {
root.updateWorldMatrix(true, true);
const inverse = root.matrixWorld.clone().invert();
- const localBounds = new THREE26.Box3;
+ const localBounds = new THREE27.Box3;
for (const part of collectParts5(root))
if (part.renderable && part.box)
localBounds.union(part.box);
@@ -19842,30 +20057,30 @@ function boundarySamples(root, axis, side, bins = 12) {
const crossExtent = Math.max(0.000000001, localBounds.max[crossAxis] - crossMin);
const byBin = new Map;
root.traverseVisible((node) => {
- if (!(node instanceof THREE26.Mesh) || !(node.geometry instanceof THREE26.BufferGeometry))
+ if (!(node instanceof THREE27.Mesh) || !(node.geometry instanceof THREE27.BufferGeometry))
return;
const positions = node.geometry.getAttribute("position");
if (positions?.itemSize !== 3)
return;
const normals = node.geometry.getAttribute("normal");
const relative = inverse.clone().multiply(node.matrixWorld);
- const count = node instanceof THREE26.InstancedMesh ? node.count : 1;
+ const count = node instanceof THREE27.InstancedMesh ? node.count : 1;
for (let instanceIndex = 0;instanceIndex < count; instanceIndex++) {
const transform = relative.clone();
- if (node instanceof THREE26.InstancedMesh) {
- const instance = new THREE26.Matrix4;
+ if (node instanceof THREE27.InstancedMesh) {
+ const instance = new THREE27.Matrix4;
node.getMatrixAt(instanceIndex, instance);
transform.multiply(instance);
}
- const normalMatrix = new THREE26.Matrix3().getNormalMatrix(transform);
+ const normalMatrix = new THREE27.Matrix3().getNormalMatrix(transform);
const material = materialSignature(node.material);
for (let index = 0;index < positions.count; index++) {
- const point = new THREE26.Vector3(positions.getX(index), positions.getY(index), positions.getZ(index)).applyMatrix4(transform);
+ const point = new THREE27.Vector3(positions.getX(index), positions.getY(index), positions.getZ(index)).applyMatrix4(transform);
if (Math.abs(point[axis] - edge) > band)
continue;
- const t = THREE26.MathUtils.clamp((point[crossAxis] - crossMin) / crossExtent, 0, 1);
+ const t = THREE27.MathUtils.clamp((point[crossAxis] - crossMin) / crossExtent, 0, 1);
const bin = Math.min(bins - 1, Math.floor(t * bins));
- const normal = normals ? new THREE26.Vector3(normals.getX(index), normals.getY(index), normals.getZ(index)).applyMatrix3(normalMatrix).normalize() : new THREE26.Vector3(0, 1, 0);
+ const normal = normals ? new THREE27.Vector3(normals.getX(index), normals.getY(index), normals.getZ(index)).applyMatrix3(normalMatrix).normalize() : new THREE27.Vector3(0, 1, 0);
const current = byBin.get(bin);
if (!current || point.y > current.height || point.y === current.height && normal.y > current.normal.y) {
byBin.set(bin, { bin, height: point.y, normal, material });
@@ -19888,7 +20103,7 @@ function edgePairMeasurements(root, axis, sockets) {
...positive.map((sample) => sample.bin)
]);
const maximumHeightDelta = pairs.length ? Math.max(...pairs.map(([a, b]) => Math.abs(a.height - b.height))) : Number.POSITIVE_INFINITY;
- const maximumNormalDeltaDegrees = pairs.length ? Math.max(...pairs.map(([a, b]) => THREE26.MathUtils.radToDeg(Math.acos(THREE26.MathUtils.clamp(a.normal.dot(b.normal), -1, 1))))) : 180;
+ const maximumNormalDeltaDegrees = pairs.length ? Math.max(...pairs.map(([a, b]) => THREE27.MathUtils.radToDeg(Math.acos(THREE27.MathUtils.clamp(a.normal.dot(b.normal), -1, 1))))) : 180;
const materialMismatch = pairs.some(([a, b]) => a.material !== b.material);
const negativeSocket = socketByType(sockets, `environment.tile.${axis}-negative`);
const positiveSocket = socketByType(sockets, `environment.tile.${axis}-positive`);
@@ -19905,7 +20120,7 @@ function edgePairMeasurements(root, axis, sockets) {
};
}
function inspectTileEdges(context) {
- if (context.tileable !== true || !(context.scene instanceof THREE26.Object3D)) {
+ if (context.tileable !== true || !(context.scene instanceof THREE27.Object3D)) {
return [];
}
const root = context.scene;
@@ -19988,7 +20203,7 @@ function isCorridor(part) {
return part.roles.some((role) => /^environment\.(?:navigation\.)?corridor(?:\.|$)/.test(role));
}
function inspectNavigationClearance(context) {
- if (context.navigable !== true || !(context.scene instanceof THREE26.Object3D)) {
+ if (context.navigable !== true || !(context.scene instanceof THREE27.Object3D)) {
return [];
}
const root = context.scene;
@@ -20118,7 +20333,7 @@ function functionalLayer(part) {
return part.roles.some((role) => role.startsWith("environment.functional") || role.startsWith("environment.layer") || role.startsWith("environment.path") || role.startsWith("environment.road") || role.startsWith("environment.bridge") || role.startsWith("environment.gate"));
}
function inspectSpatialSupport(context) {
- if (context.groundPlaneY === undefined || !(context.scene instanceof THREE26.Object3D)) {
+ if (context.groundPlaneY === undefined || !(context.scene instanceof THREE27.Object3D)) {
return [];
}
const root = context.scene;
@@ -20165,7 +20380,7 @@ function inspectSpatialSupport(context) {
}));
}
}
- const size = box.getSize(new THREE26.Vector3);
+ const size = box.getSize(new THREE27.Vector3);
if (box.min.y < context.groundPlaneY - 0.05 && size.y <= Math.max(0.05, Math.min(size.x, size.z) * 0.03) && Math.max(size.x, size.z) >= 1) {
findings.push(finding5(context, {
code: "ENV_GROUND_UNDECLARED_SKIRT",
@@ -20626,7 +20841,7 @@ function writtenNodeResolver(root, doc, purpose) {
// src/node-visibility.ts
import { KHRNodeVisibility } from "@gltf-transform/extensions";
-import * as THREE27 from "three";
+import * as THREE28 from "three";
function applyNodeVisibility(root, doc) {
const hidden = [];
root.traverse((node) => {
@@ -20669,7 +20884,7 @@ function drawnSceneBounds(scene) {
return;
const mesh = node.getMesh();
if (mesh) {
- const base = new THREE27.Matrix4().fromArray(node.getWorldMatrix());
+ const base = new THREE28.Matrix4().fromArray(node.getWorldMatrix());
const instances = node.getExtension("EXT_mesh_gpu_instancing");
const translation = instances?.getAttribute("TRANSLATION");
const rotation = instances?.getAttribute("ROTATION");
@@ -20680,7 +20895,7 @@ function drawnSceneBounds(scene) {
const t = translation?.getElement(i, []) ?? [0, 0, 0];
const r = rotation?.getElement(i, []) ?? [0, 0, 0, 1];
const s = scale?.getElement(i, []) ?? [1, 1, 1];
- const localMatrix = new THREE27.Matrix4().compose(new THREE27.Vector3().fromArray(t), new THREE27.Quaternion().fromArray(r), new THREE27.Vector3().fromArray(s));
+ const localMatrix = new THREE28.Matrix4().compose(new THREE28.Vector3().fromArray(t), new THREE28.Quaternion().fromArray(r), new THREE28.Vector3().fromArray(s));
matrices.push(base.clone().multiply(localMatrix).toArray());
}
const local = [0, 0, 0];
@@ -20721,12 +20936,12 @@ var init_node_visibility = __esm(() => {
});
// src/delivery-inspect.ts
-import * as THREE28 from "three";
+import * as THREE29 from "three";
import { PropertyType as PropertyType2 } from "@gltf-transform/core";
function decompose(matrix) {
- const translation = new THREE28.Vector3;
- const rotation = new THREE28.Quaternion;
- const scale = new THREE28.Vector3;
+ const translation = new THREE29.Vector3;
+ const rotation = new THREE29.Quaternion;
+ const scale = new THREE29.Vector3;
matrix.decompose(translation, rotation, scale);
const clean = (value) => Object.is(value, -0) ? 0 : value;
return {
@@ -20738,7 +20953,7 @@ function decompose(matrix) {
function drawnTriangles(visited) {
const values = [];
const local = [0, 0, 0];
- const point = new THREE28.Vector3;
+ const point = new THREE29.Vector3;
for (const { node, roles, hidden } of visited) {
const mesh = node.getMesh();
if (!mesh || hidden || roles.some((role) => role.startsWith("collider.")))
@@ -20751,7 +20966,7 @@ function drawnTriangles(visited) {
const copies = translation?.getCount() ?? rotation?.getCount() ?? scale?.getCount() ?? 1;
const matrices = [];
for (let i = 0;i < copies; i++) {
- const instance = new THREE28.Matrix4().compose(new THREE28.Vector3().fromArray(translation?.getElement(i, []) ?? [0, 0, 0]), new THREE28.Quaternion().fromArray(rotation?.getElement(i, []) ?? [0, 0, 0, 1]), new THREE28.Vector3().fromArray(scale?.getElement(i, []) ?? [1, 1, 1]));
+ const instance = new THREE29.Matrix4().compose(new THREE29.Vector3().fromArray(translation?.getElement(i, []) ?? [0, 0, 0]), new THREE29.Quaternion().fromArray(rotation?.getElement(i, []) ?? [0, 0, 0, 1]), new THREE29.Vector3().fromArray(scale?.getElement(i, []) ?? [1, 1, 1]));
matrices.push(base.clone().multiply(instance));
}
for (const primitive of mesh.listPrimitives()) {
@@ -20782,20 +20997,20 @@ function triangleOverlapsBox(a, b, c, h, tolerance) {
return false;
}
const e = [
- new THREE28.Vector3().subVectors(b, a),
- new THREE28.Vector3().subVectors(c, b),
- new THREE28.Vector3().subVectors(a, c)
+ new THREE29.Vector3().subVectors(b, a),
+ new THREE29.Vector3().subVectors(c, b),
+ new THREE29.Vector3().subVectors(a, c)
];
- const normal = new THREE28.Vector3().crossVectors(e[0], e[1]);
+ const normal = new THREE29.Vector3().crossVectors(e[0], e[1]);
const axes = [normal];
const units = [
- new THREE28.Vector3(1, 0, 0),
- new THREE28.Vector3(0, 1, 0),
- new THREE28.Vector3(0, 0, 1)
+ new THREE29.Vector3(1, 0, 0),
+ new THREE29.Vector3(0, 1, 0),
+ new THREE29.Vector3(0, 0, 1)
];
for (const unit of units)
for (const edge of e)
- axes.push(new THREE28.Vector3().crossVectors(unit, edge));
+ axes.push(new THREE29.Vector3().crossVectors(unit, edge));
for (const axis of axes) {
if (axis.lengthSq() < 0.000000000000000000000001)
continue;
@@ -20807,14 +21022,14 @@ function triangleOverlapsBox(a, b, c, h, tolerance) {
return true;
}
function closestPointOnTriangle(p, a, b, c) {
- const ab = new THREE28.Vector3().subVectors(b, a);
- const ac = new THREE28.Vector3().subVectors(c, a);
- const ap = new THREE28.Vector3().subVectors(p, a);
+ const ab = new THREE29.Vector3().subVectors(b, a);
+ const ac = new THREE29.Vector3().subVectors(c, a);
+ const ap = new THREE29.Vector3().subVectors(p, a);
const d1 = ab.dot(ap);
const d2 = ac.dot(ap);
if (d1 <= 0 && d2 <= 0)
return a.clone();
- const bp = new THREE28.Vector3().subVectors(p, b);
+ const bp = new THREE29.Vector3().subVectors(p, b);
const d3 = ab.dot(bp);
const d4 = ac.dot(bp);
if (d3 >= 0 && d4 <= d3)
@@ -20822,7 +21037,7 @@ function closestPointOnTriangle(p, a, b, c) {
const vc = d1 * d4 - d3 * d2;
if (vc <= 0 && d1 >= 0 && d3 <= 0)
return a.clone().addScaledVector(ab, d1 / (d1 - d3));
- const cp = new THREE28.Vector3().subVectors(p, c);
+ const cp = new THREE29.Vector3().subVectors(p, c);
const d5 = ab.dot(cp);
const d6 = ac.dot(cp);
if (d6 >= 0 && d5 <= d6)
@@ -20832,14 +21047,14 @@ function closestPointOnTriangle(p, a, b, c) {
return a.clone().addScaledVector(ac, d2 / (d2 - d6));
const va = d3 * d6 - d5 * d4;
if (va <= 0 && d4 - d3 >= 0 && d5 - d6 >= 0)
- return b.clone().addScaledVector(new THREE28.Vector3().subVectors(c, b), (d4 - d3) / (d4 - d3 + (d5 - d6)));
+ return b.clone().addScaledVector(new THREE29.Vector3().subVectors(c, b), (d4 - d3) / (d4 - d3 + (d5 - d6)));
const denominator = 1 / (va + vb + vc);
return a.clone().addScaledVector(ab, vb * denominator).addScaledVector(ac, vc * denominator);
}
function segmentSegmentDistanceSq(p1, q1, p2, q2) {
- const d1 = new THREE28.Vector3().subVectors(q1, p1);
- const d2 = new THREE28.Vector3().subVectors(q2, p2);
- const r = new THREE28.Vector3().subVectors(p1, p2);
+ const d1 = new THREE29.Vector3().subVectors(q1, p1);
+ const d2 = new THREE29.Vector3().subVectors(q2, p2);
+ const r = new THREE29.Vector3().subVectors(p1, p2);
const a = d1.dot(d1);
const e = d2.dot(d2);
const f = d2.dot(r);
@@ -20848,22 +21063,22 @@ function segmentSegmentDistanceSq(p1, q1, p2, q2) {
if (a <= 0.000000000000000000000001 && e <= 0.000000000000000000000001)
return r.lengthSq();
if (a <= 0.000000000000000000000001)
- t = THREE28.MathUtils.clamp(f / e, 0, 1);
+ t = THREE29.MathUtils.clamp(f / e, 0, 1);
else {
const c = d1.dot(r);
if (e <= 0.000000000000000000000001)
- s = THREE28.MathUtils.clamp(-c / a, 0, 1);
+ s = THREE29.MathUtils.clamp(-c / a, 0, 1);
else {
const b = d1.dot(d2);
const denominator = a * e - b * b;
- s = denominator !== 0 ? THREE28.MathUtils.clamp((b * f - c * e) / denominator, 0, 1) : 0;
+ s = denominator !== 0 ? THREE29.MathUtils.clamp((b * f - c * e) / denominator, 0, 1) : 0;
t = (b * s + f) / e;
if (t < 0) {
t = 0;
- s = THREE28.MathUtils.clamp(-c / a, 0, 1);
+ s = THREE29.MathUtils.clamp(-c / a, 0, 1);
} else if (t > 1) {
t = 1;
- s = THREE28.MathUtils.clamp((b - c) / a, 0, 1);
+ s = THREE29.MathUtils.clamp((b - c) / a, 0, 1);
}
}
}
@@ -20872,8 +21087,8 @@ function segmentSegmentDistanceSq(p1, q1, p2, q2) {
return c1.distanceToSquared(c2);
}
function segmentCrossesTriangle(p, q, a, b, c) {
- const hit = new THREE28.Vector3;
- const ray = new THREE28.Ray(p, new THREE28.Vector3().subVectors(q, p));
+ const hit = new THREE29.Vector3;
+ const ray = new THREE29.Ray(p, new THREE29.Vector3().subVectors(q, p));
const length = ray.direction.length();
if (length === 0)
return false;
@@ -20990,9 +21205,9 @@ function inspectDelivery(doc) {
visit(scene.listChildren(), segment3(scene.getName() || "Scene", 0), false, undefined);
const finding = (code, path, message) => summary.diagnostics.push({ code, path, message });
const { min, max } = drawnSceneBounds(scene);
- const bounds = new THREE28.Box3(new THREE28.Vector3(...min), new THREE28.Vector3(...max));
+ const bounds = new THREE29.Box3(new THREE29.Vector3(...min), new THREE29.Vector3(...max));
const finiteBounds = [...min, ...max].every(Number.isFinite);
- const diagonal = finiteBounds ? bounds.getSize(new THREE28.Vector3).length() : 0;
+ const diagonal = finiteBounds ? bounds.getSize(new THREE29.Vector3).length() : 0;
const tolerance = Math.max(0.0001, diagonal * 0.0001);
const colliderNodes = [];
for (const entry of visited) {
@@ -21071,23 +21286,23 @@ function inspectDelivery(doc) {
const triangles = colliderNodes.some(({ record }) => record.shape.kind !== "hull") ? drawnTriangles(visited) : new Float64Array;
const triangleCount = triangles.length / 9;
let overlapTests = 0;
- const a = new THREE28.Vector3;
- const b = new THREE28.Vector3;
- const c = new THREE28.Vector3;
+ const a = new THREE29.Vector3;
+ const b = new THREE29.Vector3;
+ const c = new THREE29.Vector3;
for (const { visit: entry, record } of colliderNodes) {
if (!entry.hidden)
finding("DELIVERY_COLLIDER_NOT_HIDDEN", record.path, "collider proxy draws; hide it (the delivery helpers do) so importers that ignore roles draw only the asset.");
const matrix = worldMatrix(entry.node);
- const proxyBounds = new THREE28.Box3;
+ const proxyBounds = new THREE29.Box3;
const mesh = entry.node.getMesh();
const local = [0, 0, 0];
for (const primitive of mesh?.listPrimitives() ?? []) {
const position = primitive.getAttribute("POSITION");
for (let i = 0;i < (position?.getCount() ?? 0); i++)
- proxyBounds.expandByPoint(new THREE28.Vector3().fromArray(position.getElement(i, local)).applyMatrix4(matrix));
+ proxyBounds.expandByPoint(new THREE29.Vector3().fromArray(position.getElement(i, local)).applyMatrix4(matrix));
}
if (proxyBounds.isEmpty())
- proxyBounds.expandByPoint(new THREE28.Vector3().setFromMatrixPosition(matrix));
+ proxyBounds.expandByPoint(new THREE29.Vector3().setFromMatrixPosition(matrix));
const expanded = bounds.clone().expandByScalar(tolerance);
if (!finiteBounds || !expanded.containsBox(proxyBounds))
finding("DELIVERY_COLLIDER_OUTSIDE_BOUNDS", record.path, "collider proxy reaches outside the bounds of the drawn asset.");
@@ -21098,11 +21313,11 @@ function inspectDelivery(doc) {
continue;
}
overlapTests += triangleCount;
- const toLocal = new THREE28.Matrix4;
+ const toLocal = new THREE29.Matrix4;
let touches = false;
if (record.shape.kind === "box") {
toLocal.copy(matrix).invert();
- const half = new THREE28.Vector3(0.5, 0.5, 0.5);
+ const half = new THREE29.Vector3(0.5, 0.5, 0.5);
const scale = Math.max(...record.transform.scale.map(Math.abs), 0.000000001);
for (let t = 0;t < triangleCount && !touches; t++) {
a.fromArray(triangles, t * 9).applyMatrix4(toLocal);
@@ -21112,10 +21327,10 @@ function inspectDelivery(doc) {
}
} else {
const { translation, rotation } = record.transform;
- toLocal.compose(new THREE28.Vector3(...translation), new THREE28.Quaternion(...rotation), new THREE28.Vector3(1, 1, 1)).invert();
+ toLocal.compose(new THREE29.Vector3(...translation), new THREE29.Quaternion(...rotation), new THREE29.Vector3(1, 1, 1)).invert();
const { radius, height } = record.shape;
- const p = new THREE28.Vector3(0, -height / 2 + radius, 0);
- const q = new THREE28.Vector3(0, height / 2 - radius, 0);
+ const p = new THREE29.Vector3(0, -height / 2 + radius, 0);
+ const q = new THREE29.Vector3(0, height / 2 - radius, 0);
for (let t = 0;t < triangleCount && !touches; t++) {
a.fromArray(triangles, t * 9).applyMatrix4(toLocal);
b.fromArray(triangles, t * 9 + 3).applyMatrix4(toLocal);
@@ -21134,7 +21349,7 @@ function inspectDelivery(doc) {
finding("DELIVERY_PORT_WITHOUT_MODULE", record.path, "port is not under a valid kit module; place ports under the root defineModule marked.");
continue;
}
- const point = new THREE28.Vector3(...record.transform.translation).applyMatrix4(worldMatrix(moduleEntry.node).invert());
+ const point = new THREE29.Vector3(...record.transform.translation).applyMatrix4(worldMatrix(moduleEntry.node).invert());
const [width, depth] = spec.footprint;
const [x0, x1, z0, z1] = spec.origin === "corner" ? [0, width, 0, depth] : [-width / 2, width / 2, -depth / 2, depth / 2];
const slack = Math.max(0.0001, Math.max(width, depth, spec.height) * 0.00001);
@@ -21148,7 +21363,7 @@ function inspectDelivery(doc) {
}
return summary;
}
-var DELIVERY_OVERLAP_TEST_LIMIT = 50000000, segment3 = (name, occurrence) => `/${encodeURIComponent(name)}[${occurrence}]`, roleTail = (role, base) => role.startsWith(`${base}.`) ? role.slice(base.length + 1) : undefined, worldMatrix = (node) => new THREE28.Matrix4().fromArray(node.getWorldMatrix());
+var DELIVERY_OVERLAP_TEST_LIMIT = 50000000, segment3 = (name, occurrence) => `/${encodeURIComponent(name)}[${occurrence}]`, roleTail = (role, base) => role.startsWith(`${base}.`) ? role.slice(base.length + 1) : undefined, worldMatrix = (node) => new THREE29.Matrix4().fromArray(node.getWorldMatrix());
var init_delivery_inspect = __esm(() => {
init_gltf_io();
init_semantic();
@@ -21989,7 +22204,7 @@ var init_requirements_run = __esm(() => {
});
// src/qa/skin-integrity.ts
-import * as THREE29 from "three";
+import * as THREE30 from "three";
function validAttribute(a, count, size) {
if (!a || a.itemSize !== size || a.count !== count || !Number.isSafeInteger(count) || count < 1)
return false;
@@ -22036,9 +22251,9 @@ function inspectSkinIntegrity(root) {
}
while (chain.length) {
const n = chain.pop();
- const local = n.matrixAutoUpdate ? new THREE29.Matrix4().compose(n.position, n.quaternion, n.scale) : n.matrix.clone();
+ const local = n.matrixAutoUpdate ? new THREE30.Matrix4().compose(n.position, n.quaternion, n.scale) : n.matrix.clone();
const parent = n.parent ? worlds.get(n.parent) : undefined;
- const value = n.matrixWorldAutoUpdate === false ? n.matrixWorld.clone() : parent ? new THREE29.Matrix4().multiplyMatrices(parent, local) : local;
+ const value = n.matrixWorldAutoUpdate === false ? n.matrixWorld.clone() : parent ? new THREE30.Matrix4().multiplyMatrices(parent, local) : local;
worlds.set(n, value);
}
return worlds.get(node);
@@ -22088,7 +22303,7 @@ function inspectSkinIntegrity(root) {
if (result.truncated)
break;
}
- if (!finiteAffine(mesh.bindMatrix) || !Number.isFinite(mesh.bindMatrix.determinant()) || mesh.bindMatrix.determinant() === 0 || ![THREE29.AttachedBindMode, THREE29.DetachedBindMode].includes(mesh.bindMode)) {
+ if (!finiteAffine(mesh.bindMatrix) || !Number.isFinite(mesh.bindMatrix.determinant()) || mesh.bindMatrix.determinant() === 0 || ![THREE30.AttachedBindMode, THREE30.DetachedBindMode].includes(mesh.bindMode)) {
add("SKIN_BIND_MATRIX", "Mesh requires a finite invertible affine bind matrix and an attached or detached bind mode.", "bindMatrix");
}
const position = mesh.geometry?.getAttribute("position"), count = position?.count ?? 0;
@@ -22137,7 +22352,7 @@ function inspectSkinIntegrity(root) {
add("SKIN_POSE_TRANSFORM", "Current mesh world transform must be finite and affine.");
continue;
}
- const inverse = mesh.bindMode === THREE29.AttachedBindMode ? meshWorld.clone().invert() : mesh.bindMatrix.clone().invert();
+ const inverse = mesh.bindMode === THREE30.AttachedBindMode ? meshWorld.clone().invert() : mesh.bindMatrix.clone().invert();
const matrices = [];
for (let joint = 0;joint < bones.length; joint++) {
const boneWorld = world(bones[joint]);
@@ -22145,13 +22360,13 @@ function inspectSkinIntegrity(root) {
add("SKIN_POSE_TRANSFORM", `Current transform for joint ${joint} must be finite and affine.`, `joints[${joint}]`);
break;
}
- matrices.push(new THREE29.Matrix4().multiplyMatrices(boneWorld, skeleton.boneInverses[joint]).multiply(mesh.bindMatrix));
+ matrices.push(new THREE30.Matrix4().multiplyMatrices(boneWorld, skeleton.boneInverses[joint]).multiply(mesh.bindMatrix));
}
if (result.findings.length !== start)
continue;
- const base = new THREE29.Vector3, posed = new THREE29.Vector3, temp = new THREE29.Vector3, box = new THREE29.Box3;
+ const base = new THREE30.Vector3, posed = new THREE30.Vector3, temp = new THREE30.Vector3, box = new THREE30.Box3;
for (let vertex = 0;vertex < count; vertex++) {
- THREE29.Mesh.prototype.getVertexPosition.call(mesh, vertex, base);
+ THREE30.Mesh.prototype.getVertexPosition.call(mesh, vertex, base);
posed.set(0, 0, 0);
for (let lane = 0;lane < 4; lane++) {
const weight = weights.getComponent(vertex, lane);
@@ -22348,7 +22563,7 @@ var init_material_export = __esm(() => {
});
// src/community-exporter.ts
-import * as THREE30 from "three";
+import * as THREE31 from "three";
import { GLTFExporter } from "three/addons/exporters/GLTFExporter.js";
import { GLB_BUFFER } from "@gltf-transform/core";
function resolveGltfExporter(value = typeof process !== "undefined" ? process.env["KILN_GLTF_EXPORTER"] : undefined) {
@@ -22378,7 +22593,7 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
return found;
const copy = cleanClone(source);
normalizeTextureTransform(copy);
- copy.source = new THREE30.TextureSource(source.image);
+ copy.source = new THREE31.TextureSource(source.image);
textures.set(source, copy);
const bytes = source.userData["encoded"];
if (bytes?.bytes) {
@@ -22387,8 +22602,8 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
encoded.push((async () => {
copy.image = await platform.decode(bytes.bytes);
Object.defineProperty(copy, "isDataTexture", { value: true });
- copy.format = THREE30.RGBAFormat;
- copy.type = THREE30.UnsignedByteType;
+ copy.format = THREE31.RGBAFormat;
+ copy.type = THREE31.UnsignedByteType;
})());
}
return copy;
@@ -22405,7 +22620,7 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
physical.sheen = 1;
}
for (const [key, value] of Object.entries(copy)) {
- if (value instanceof THREE30.Texture)
+ if (value instanceof THREE31.Texture)
copy[key] = texture(value);
}
materials.set(source, copy);
@@ -22421,15 +22636,15 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
if (!copy.matrixAutoUpdate)
copy.matrix.decompose(copy.position, copy.quaternion, copy.scale);
if (source.isScene) {
- copy = new THREE30.Group;
+ copy = new THREE31.Group;
copy.copy(shadow, false);
}
if (source.isSprite) {
const sprite = source;
- const geometry = new THREE30.PlaneGeometry(1, 1);
+ const geometry = new THREE31.PlaneGeometry(1, 1);
geometry.translate(0.5 - sprite.center.x, 0.5 - sprite.center.y, 0);
geometry.rotateZ(sprite.material.rotation);
- const spriteMaterial = new THREE30.MeshBasicMaterial({
+ const spriteMaterial = new THREE31.MeshBasicMaterial({
name: sprite.material.name,
color: sprite.material.color,
opacity: sprite.material.opacity,
@@ -22440,8 +22655,8 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
});
Object.assign(spriteMaterial.userData, authorExtras?.material(sprite.material));
originalMaterials.set(spriteMaterial, sprite.material);
- copy = new THREE30.Mesh(geometry, spriteMaterial);
- THREE30.Object3D.prototype.copy.call(copy, shadow, false);
+ copy = new THREE31.Mesh(geometry, spriteMaterial);
+ THREE31.Object3D.prototype.copy.call(copy, shadow, false);
}
Object.assign(copy.userData, authorExtras?.node(source), rigExtrasForExport(source), openShellExtras(source), kitExtras(source), repeatInstancesExtras(source));
const semantic = source.userData[KILN_SEMANTIC_EXTRAS_KEY];
@@ -22505,8 +22720,8 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
if (!context)
throw new Error("A 2D canvas is required to prepare export texture channels.");
context.putImageData(new ImageData(new Uint8ClampedArray(data), width, height), 0, 0);
- const adapted = new THREE30.Texture().copy(map);
- adapted.source = new THREE30.TextureSource(canvas);
+ const adapted = new THREE31.Texture().copy(map);
+ adapted.source = new THREE31.TextureSource(canvas);
canvasInputs.set(map, adapted);
const direct = directImages.get(map);
if (direct)
@@ -22515,7 +22730,7 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
};
for (const material of materials.values()) {
for (const [key, value] of Object.entries(material)) {
- if (value instanceof THREE30.Texture && value.flipY && value.image?.data)
+ if (value instanceof THREE31.Texture && value.flipY && value.image?.data)
material[key] = canvasInput(value);
}
const standard = material;
@@ -22537,8 +22752,8 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
}
cloned.tracks = cloned.tracks.filter((track) => {
try {
- const binding = THREE30.PropertyBinding.parseTrackName(track.name);
- return ["position", "quaternion", "scale", "morphTargetInfluences"].includes(binding.propertyName) && THREE30.PropertyBinding.findNode(copy, binding.nodeName) !== null;
+ const binding = THREE31.PropertyBinding.parseTrackName(track.name);
+ return ["position", "quaternion", "scale", "morphTargetInfluences"].includes(binding.propertyName) && THREE31.PropertyBinding.findNode(copy, binding.nodeName) !== null;
} catch {
return false;
}
@@ -22733,7 +22948,7 @@ function applyIndexPolicy(doc, policy) {
var init_index_policy = () => {};
// src/surface-bake.ts
-import * as THREE31 from "three";
+import * as THREE32 from "three";
function settings(value, label) {
if (value === false)
return;
@@ -22775,13 +22990,13 @@ function drawnMeshes(root) {
function weld(mesh) {
const position = mesh.geometry.getAttribute("position");
const world = [];
- const box = new THREE31.Box3;
+ const box = new THREE32.Box3;
for (let i = 0;i < position.count; i++) {
- const point = new THREE31.Vector3().fromBufferAttribute(position, i).applyMatrix4(mesh.matrixWorld);
+ const point = new THREE32.Vector3().fromBufferAttribute(position, i).applyMatrix4(mesh.matrixWorld);
world.push(point);
box.expandByPoint(point);
}
- const size = box.isEmpty() ? 0 : box.getSize(new THREE31.Vector3).length();
+ const size = box.isEmpty() ? 0 : box.getSize(new THREE32.Vector3).length();
const tolerance = size > 0 ? size * 0.000001 : 0.000000001;
const keys = new Map;
const ids = new Int32Array(position.count);
@@ -22815,7 +23030,7 @@ function bakeEdge(topology, thresholdDegrees, smoothing) {
const a = points[triangles[t]];
const b = points[triangles[t + 1]];
const c = points[triangles[t + 2]];
- normals.push(new THREE31.Vector3().subVectors(b, a).cross(new THREE31.Vector3().subVectors(c, a)).normalize());
+ normals.push(new THREE32.Vector3().subVectors(b, a).cross(new THREE32.Vector3().subVectors(c, a)).normalize());
}
const edges = new Map;
const neighbours = points.map(() => new Set);
@@ -22834,7 +23049,7 @@ function bakeEdge(topology, thresholdDegrees, smoothing) {
edges.set(key, list);
}
}
- const threshold = THREE31.MathUtils.degToRad(thresholdDegrees);
+ const threshold = THREE32.MathUtils.degToRad(thresholdDegrees);
const weights = new Float64Array(points.length);
for (const [key, incidences] of edges) {
let weight;
@@ -22844,10 +23059,10 @@ function bakeEdge(topology, thresholdDegrees, smoothing) {
const [[f1], [f2, opposite2]] = incidences;
const n1 = normals[f1];
const n2 = normals[f2];
- const angle = Math.acos(THREE31.MathUtils.clamp(n1.dot(n2), -1, 1));
+ const angle = Math.acos(THREE32.MathUtils.clamp(n1.dot(n2), -1, 1));
const [u] = key.split(":").map(Number);
const scale = Math.max(points[u].distanceTo(points[opposite2]), 0.000000000001);
- const side = new THREE31.Vector3().subVectors(points[opposite2], points[u]).dot(n1) / scale;
+ const side = new THREE32.Vector3().subVectors(points[opposite2], points[u]).dot(n1) / scale;
weight = side < -0.000000001 ? smoothstep2(threshold / 2, threshold, angle) : 0;
}
for (const id of key.split(":").map(Number))
@@ -23009,12 +23224,12 @@ function hemisphereDirections(count) {
const phi = i * golden;
const x = r * Math.cos(phi);
const y = r * Math.sin(phi);
- return new THREE31.Vector3(x, y, Math.sqrt(Math.max(0, 1 - x * x - y * y)));
+ return new THREE32.Vector3(x, y, Math.sqrt(Math.max(0, 1 - x * x - y * y)));
});
}
function occluderTriangles(occluders, bakedTier) {
const values = [];
- const point = new THREE31.Vector3;
+ const point = new THREE32.Vector3;
for (const mesh of drawnMeshes(occluders)) {
if (!drawn(mesh, null))
continue;
@@ -23078,12 +23293,12 @@ function bakeSurfaceAttributes(target, options = {}) {
let entry = bvhs.get(key);
if (!entry) {
const triangles = occluderTriangles(occluders, tier);
- const box = new THREE31.Box3;
+ const box = new THREE32.Box3;
for (let i = 0;i < triangles.length; i += 3)
- box.expandByPoint(new THREE31.Vector3(triangles[i], triangles[i + 1], triangles[i + 2]));
+ box.expandByPoint(new THREE32.Vector3(triangles[i], triangles[i + 1], triangles[i + 2]));
entry = {
bvh: new TriangleBvh(triangles),
- diagonal: box.isEmpty() ? 0 : box.getSize(new THREE31.Vector3).length()
+ diagonal: box.isEmpty() ? 0 : box.getSize(new THREE32.Vector3).length()
};
bvhs.set(key, entry);
}
@@ -23100,27 +23315,27 @@ function bakeSurfaceAttributes(target, options = {}) {
const welded = bakeEdge(topology, thresholdDegrees, smoothing);
const values = new Float32Array(sourceCount);
for (let i = 0;i < sourceCount; i++)
- values[i] = THREE31.MathUtils.clamp(welded[topology.ids[i]], 0, 1);
- geometry.setAttribute("_edge", new THREE31.BufferAttribute(values, 1));
+ values[i] = THREE32.MathUtils.clamp(welded[topology.ids[i]], 0, 1);
+ geometry.setAttribute("_edge", new THREE32.BufferAttribute(values, 1));
record._EDGE = { thresholdDegrees, smoothing };
}
if (cavityOptions) {
const { bvh, diagonal } = occlusion(tierOf(mesh));
const radius = cavityOptions.radius ?? SURFACE_BAKE_DEFAULTS.cavity.radiusFactor * diagonal;
const epsilon = Math.max(diagonal * 0.00001, 0.0000001);
- const normals = topology.points.map(() => new THREE31.Vector3);
+ const normals = topology.points.map(() => new THREE32.Vector3);
const { points, triangles } = topology;
for (let t = 0;t < triangles.length; t += 3) {
const a = points[triangles[t]];
- const face = new THREE31.Vector3().subVectors(points[triangles[t + 1]], a).cross(new THREE31.Vector3().subVectors(points[triangles[t + 2]], a));
+ const face = new THREE32.Vector3().subVectors(points[triangles[t + 1]], a).cross(new THREE32.Vector3().subVectors(points[triangles[t + 2]], a));
for (let k = 0;k < 3; k++)
normals[triangles[t + k]].add(face);
}
const exposure = new Float64Array(points.length);
- const tangent = new THREE31.Vector3;
- const bitangent = new THREE31.Vector3;
- const origin = new THREE31.Vector3;
- const direction = new THREE31.Vector3;
+ const tangent = new THREE32.Vector3;
+ const bitangent = new THREE32.Vector3;
+ const origin = new THREE32.Vector3;
+ const direction = new THREE32.Vector3;
points.forEach((point, id) => {
const normal = normals[id];
if (normal.lengthSq() === 0) {
@@ -23142,8 +23357,8 @@ function bakeSurfaceAttributes(target, options = {}) {
});
const values = new Float32Array(sourceCount);
for (let i = 0;i < sourceCount; i++)
- values[i] = THREE31.MathUtils.clamp(exposure[topology.ids[i]], 0, 1);
- geometry.setAttribute("_cavity", new THREE31.BufferAttribute(values, 1));
+ values[i] = THREE32.MathUtils.clamp(exposure[topology.ids[i]], 0, 1);
+ geometry.setAttribute("_cavity", new THREE32.BufferAttribute(values, 1));
record._CAVITY = { rays, radius };
}
geometry.userData = { ...geometry.userData, [SURFACE_BAKE_KEY]: record };
@@ -23163,7 +23378,7 @@ function surfaceBakeRecord(geometry) {
return record;
}
var SURFACE_ATTRIBUTES, SURFACE_BAKE_KEY = "kilnSurfaceBakeV1", SURFACE_BAKE_DEFAULTS, isObject3D2 = (value) => value?.isObject3D === true, smoothstep2 = (edge0, edge1, x) => {
- const t = THREE31.MathUtils.clamp((x - edge0) / (edge1 - edge0), 0, 1);
+ const t = THREE32.MathUtils.clamp((x - edge0) / (edge1 - edge0), 0, 1);
return t * t * (3 - 2 * t);
};
var init_surface_bake = __esm(() => {
@@ -23798,16 +24013,16 @@ function buildWallPanels(length, height, thickness, apertures) {
}
// src/assembly-transform.ts
-import * as THREE32 from "three";
+import * as THREE33 from "three";
function checkedTrs(matrix, label) {
const e = matrix.elements;
if (!e.every(Number.isFinite) || e[3] !== 0 || e[7] !== 0 || e[11] !== 0 || Math.abs(e[15] - 1) > 16 * Number.EPSILON)
throw new Error(`${label}: finite affine TRS is required.`);
if (!Number.isFinite(matrix.determinant()) || matrix.determinant() === 0)
throw new Error(`${label}: singular/zero-scale transforms are unsupported.`);
- const position = new THREE32.Vector3, quaternion = new THREE32.Quaternion, scale = new THREE32.Vector3;
+ const position = new THREE33.Vector3, quaternion = new THREE33.Quaternion, scale = new THREE33.Vector3;
matrix.decompose(position, quaternion, scale);
- const rebuilt = new THREE32.Matrix4().compose(position, quaternion, scale);
+ const rebuilt = new THREE33.Matrix4().compose(position, quaternion, scale);
if (rebuilt.elements.some((value, i) => !Number.isFinite(value) || Math.abs(value - e[i]) > 0.00000001 * Math.max(1, Math.abs(e[i]))))
throw new Error(`${label}: local shear cannot be represented losslessly as TRS.`);
return { position, quaternion, scale };
@@ -23815,7 +24030,7 @@ function checkedTrs(matrix, label) {
var init_assembly_transform = () => {};
// src/assembly.ts
-import * as THREE33 from "three";
+import * as THREE34 from "three";
function jsonData(value, label, ancestors = new Set) {
if (value === null || typeof value === "string" || typeof value === "boolean")
return;
@@ -23862,7 +24077,7 @@ function knownMetadata(source, parsed, label) {
throw new Error(`${label}: unsupported fields in known metadata would be lost during remapping.`);
}
function localMatrix(node) {
- return node.matrixAutoUpdate ? new THREE33.Matrix4().compose(node.position, node.quaternion, node.scale) : node.matrix.clone();
+ return node.matrixAutoUpdate ? new THREE34.Matrix4().compose(node.position, node.quaternion, node.scale) : node.matrix.clone();
}
function worldMatrix2(node) {
const chain = [], seen = new Set;
@@ -23872,7 +24087,7 @@ function worldMatrix2(node) {
seen.add(cursor);
chain.push(cursor);
}
- const result = new THREE33.Matrix4;
+ const result = new THREE34.Matrix4;
for (const entry of chain.reverse())
result.multiply(localMatrix(entry));
return result;
@@ -23888,7 +24103,7 @@ function census(root) {
const stack = [root];
while (stack.length) {
const node = stack.pop();
- if (!(node instanceof THREE33.Object3D) || ![THREE33.Object3D, THREE33.Group, THREE33.Mesh].includes(node.constructor))
+ if (!(node instanceof THREE34.Object3D) || ![THREE34.Object3D, THREE34.Group, THREE34.Mesh].includes(node.constructor))
throw new Error("Unsupported assembly node: only ordinary Object3D, Group and Mesh hierarchies are qualified; no skins, instances or custom node classes.");
if (matrices.has(node))
throw new Error("Assembly must be a tree; duplicate/cyclic children are unsupported.");
@@ -23904,21 +24119,21 @@ function census(root) {
checkedTrs(matrix, node.name || "unnamed node");
nodes.push(node);
matrices.set(node, matrix);
- if (node.onBeforeRender !== THREE33.Object3D.prototype.onBeforeRender || node.onAfterRender !== THREE33.Object3D.prototype.onAfterRender || node.onBeforeShadow !== THREE33.Object3D.prototype.onBeforeShadow || node.onAfterShadow !== THREE33.Object3D.prototype.onAfterShadow)
+ if (node.onBeforeRender !== THREE34.Object3D.prototype.onBeforeRender || node.onAfterRender !== THREE34.Object3D.prototype.onAfterRender || node.onBeforeShadow !== THREE34.Object3D.prototype.onBeforeShadow || node.onAfterShadow !== THREE34.Object3D.prototype.onAfterShadow)
throw new Error("Custom node render callbacks are unsupported in assembly replication.");
- if (node instanceof THREE33.Mesh) {
- if (!(node.geometry instanceof THREE33.BufferGeometry) || node.geometry instanceof THREE33.InstancedBufferGeometry)
+ if (node instanceof THREE34.Mesh) {
+ if (!(node.geometry instanceof THREE34.BufferGeometry) || node.geometry instanceof THREE34.InstancedBufferGeometry)
throw new Error("Unsupported assembly geometry type.");
if (Object.values(node.geometry.morphAttributes).some((attributes) => attributes?.length) || node.morphTargetInfluences?.length)
throw new Error("Assembly morph target replication is unsupported.");
const materials = Array.isArray(node.material) ? node.material : [node.material];
- if (materials.length === 0 || materials.some((material) => !(material instanceof THREE33.Material)))
+ if (materials.length === 0 || materials.some((material) => !(material instanceof THREE34.Material)))
throw new Error("Assembly mesh materials must be Material instances.");
}
if (!object(node.userData))
throw new Error("Assembly node metadata must be an object.");
jsonData(node.userData, node.name);
- if (!Array.isArray(node.animations) || node.animations.some((clip) => !(clip instanceof THREE33.AnimationClip)))
+ if (!Array.isArray(node.animations) || node.animations.some((clip) => !(clip instanceof THREE34.AnimationClip)))
throw new Error("Assembly node animations must contain AnimationClip instances.");
if (node.userData[KILN_SEMANTIC_EXTRAS_KEY] !== undefined) {
const metadata = readSemanticMetadataV1(node);
@@ -23959,11 +24174,11 @@ function describeAssembly(root, options = {}) {
const state = census(root), roles = new Map;
const frames = [], sockets = [], joints = [], materials = [];
const relative = new Map;
- const bounds = new THREE33.Box3, point = new THREE33.Vector3;
+ const bounds = new THREE34.Box3, point = new THREE34.Vector3;
let positionSamples = 0;
for (const [index, node] of state.nodes.entries()) {
const nodeId = `n${index}`;
- const matrix = node === root ? new THREE33.Matrix4 : relative.get(node.parent).clone().multiply(state.matrices.get(node));
+ const matrix = node === root ? new THREE34.Matrix4 : relative.get(node.parent).clone().multiply(state.matrices.get(node));
relative.set(node, matrix);
const metadata = state.semantics.get(node);
const descriptor = state.joints.get(node);
@@ -23985,7 +24200,7 @@ function describeAssembly(root, options = {}) {
for (const role of metadata?.roles ?? [])
addIndex(roles, role, node);
for (const frame of metadata?.frames ?? []) {
- const local = new THREE33.Matrix4().compose(new THREE33.Vector3(...frame.translation), new THREE33.Quaternion(...frame.rotation), new THREE33.Vector3(1, 1, 1));
+ const local = new THREE34.Matrix4().compose(new THREE34.Vector3(...frame.translation), new THREE34.Quaternion(...frame.rotation), new THREE34.Vector3(1, 1, 1));
frames.push({
node,
nodeId,
@@ -23995,7 +24210,7 @@ function describeAssembly(root, options = {}) {
}
for (const socket of metadata?.sockets ?? [])
sockets.push({ node, nodeId, socket: structuredClone(socket) });
- if (!(node instanceof THREE33.Mesh))
+ if (!(node instanceof THREE34.Mesh))
continue;
for (const [materialIndex, material] of (Array.isArray(node.material) ? node.material : [node.material]).entries())
materials.push({ node, nodeId, index: materialIndex, material });
@@ -24030,7 +24245,7 @@ function describeAssembly(root, options = {}) {
space: "root-local",
min: bounds.min.toArray(),
max: bounds.max.toArray(),
- size: bounds.getSize(new THREE33.Vector3).toArray()
+ size: bounds.getSize(new THREE34.Vector3).toArray()
},
clips,
ownership: {
@@ -24069,7 +24284,7 @@ function replicateAssembly(source, options) {
if (value !== undefined && !choices.includes(value))
throw new Error(`Unsupported assembly ${key} policy.`);
}
- if (options.parent !== undefined && !(options.parent instanceof THREE33.Object3D))
+ if (options.parent !== undefined && !(options.parent instanceof THREE34.Object3D))
throw new Error("Assembly parent must be an Object3D.");
const fresh = describeAssembly(source.root, { clips: source.clips }), state = census(source.root);
if (options.parent && state.nodes.includes(options.parent))
@@ -24102,16 +24317,16 @@ function replicateAssembly(source, options) {
throw new Error(`Unsupported custom metadata ${key} on ${node.name}; use copy-json only for inert data whose references you own.`);
}
jsonData(node.userData, node.name);
- if (node instanceof THREE33.Mesh) {
+ if (node instanceof THREE34.Mesh) {
if (options.geometry === "copy") {
jsonData(node.geometry.userData, `${node.name} geometry`);
- if (node.geometry.clone !== THREE33.BufferGeometry.prototype.clone || !threeConstructors.has(node.geometry.constructor))
+ if (node.geometry.clone !== THREE34.BufferGeometry.prototype.clone || !threeConstructors.has(node.geometry.constructor))
throw new Error("Copying custom geometry classes/clone implementations is unsupported; explicitly share the resource.");
}
if (options.materials === "copy")
for (const material of Array.isArray(node.material) ? node.material : [node.material]) {
jsonData(material.userData, `${node.name} material`);
- if (material.onBeforeCompile !== THREE33.Material.prototype.onBeforeCompile || material.onBeforeRender !== THREE33.Material.prototype.onBeforeRender || material.clone !== THREE33.Material.prototype.clone || !threeConstructors.has(material.constructor) || material.customProgramCacheKey !== THREE33.Material.prototype.customProgramCacheKey || material instanceof THREE33.ShaderMaterial)
+ if (material.onBeforeCompile !== THREE34.Material.prototype.onBeforeCompile || material.onBeforeRender !== THREE34.Material.prototype.onBeforeRender || material.clone !== THREE34.Material.prototype.clone || !threeConstructors.has(material.constructor) || material.customProgramCacheKey !== THREE34.Material.prototype.customProgramCacheKey || material instanceof THREE34.ShaderMaterial)
throw new Error("Copying custom/shader materials is unsupported; explicit sharing preserves their existing implementation.");
}
}
@@ -24199,9 +24414,9 @@ function replicateAssembly(source, options) {
const trackTargets = new Map;
const animatedNodes = new Set;
for (const clip of fresh.clips) {
- if (!(clip instanceof THREE33.AnimationClip))
+ if (!(clip instanceof THREE34.AnimationClip))
throw new Error("Assembly clips must be AnimationClip instances.");
- if (clip.blendMode !== THREE33.NormalAnimationBlendMode)
+ if (clip.blendMode !== THREE34.NormalAnimationBlendMode)
throw new Error("Additive/other animation blend modes are unsupported in assembly replication.");
jsonData(clip.userData, `Clip ${clip.name}`);
if (Object.keys(clip.userData).length && options.unknownMetadata !== "copy-json")
@@ -24228,7 +24443,7 @@ function replicateAssembly(source, options) {
if (options.space === "world") {
if (state.joints.has(source.root))
throw new Error("World placement of a declared joint root requires rest-transform rebasing; wrap it in an assembly root or use local placement.");
- const parentWorld = options.parent ? worldMatrix2(options.parent) : new THREE33.Matrix4;
+ const parentWorld = options.parent ? worldMatrix2(options.parent) : new THREE34.Matrix4;
if (!Number.isFinite(parentWorld.determinant()) || parentWorld.determinant() === 0)
throw new Error("World placement requires an invertible, nonsingular parent transform.");
rootMatrix = parentWorld.invert().multiply(worldMatrix2(source.root));
@@ -24269,7 +24484,7 @@ function replicateAssembly(source, options) {
return materials.get(material);
};
for (const node of state.nodes) {
- const copy = node instanceof THREE33.Mesh ? new THREE33.Mesh(node.geometry, node.material) : node instanceof THREE33.Group ? new THREE33.Group : new THREE33.Object3D;
+ const copy = node instanceof THREE34.Mesh ? new THREE34.Mesh(node.geometry, node.material) : node instanceof THREE34.Group ? new THREE34.Group : new THREE34.Object3D;
copy.copy(node, false);
copy.name = names.get(node);
copy.animations = [];
@@ -24282,7 +24497,7 @@ function replicateAssembly(source, options) {
}
copy.matrix.copy(matrix);
copy.matrixWorldNeedsUpdate = true;
- if (node instanceof THREE33.Mesh && copy instanceof THREE33.Mesh) {
+ if (node instanceof THREE34.Mesh && copy instanceof THREE34.Mesh) {
if (options.geometry === "copy") {
if (!geometries.has(node.geometry))
geometries.set(node.geometry, node.geometry.clone());
@@ -24347,7 +24562,7 @@ var init_assembly = __esm(() => {
KILN_CHARACTER_JOINT_EXTRAS_KEY,
KILN_CHARACTER_RIG_EXTRAS_KEY
]);
- threeConstructors = new Set(Object.values(THREE33));
+ threeConstructors = new Set(Object.values(THREE34));
});
// src/palette-check.ts
@@ -24888,7 +25103,7 @@ var init_budget = __esm(() => {
});
// src/animation-cubic.ts
-import * as THREE34 from "three";
+import * as THREE35 from "three";
function useCubicSpline(track) {
track.createInterpolant = cubicSplineFactory;
return track;
@@ -24896,7 +25111,7 @@ function useCubicSpline(track) {
var CubicSplineInterpolant, CubicSplineQuaternionInterpolant, cubicSplineFactory;
var init_animation_cubic = __esm(() => {
init_animation_spline();
- CubicSplineInterpolant = class CubicSplineInterpolant extends THREE34.Interpolant {
+ CubicSplineInterpolant = class CubicSplineInterpolant extends THREE35.Interpolant {
copySampleValue_(index) {
const result = this.resultBuffer;
const size = this.valueSize;
@@ -24924,7 +25139,7 @@ var init_animation_cubic = __esm(() => {
});
// src/architecture.ts
-import * as THREE35 from "three";
+import * as THREE36 from "three";
function positive4(value, name) {
if (!Number.isFinite(value) || value <= 0)
throw new RangeError(`${name} must be finite and > 0`);
@@ -24989,17 +25204,17 @@ function buildFace(roofRoot, profile, sideSign) {
const verticalRun = profile.ridgeY - profile.eaveY;
const downhillLength = Math.hypot(horizontalRun, verticalRun);
const alongRidge = (profile.ridgeAxis === "x" ? profile.spanX : profile.spanZ) + profile.overhang * 2;
- const downhill = profile.ridgeAxis === "x" ? new THREE35.Vector3(0, -verticalRun, sideSign * horizontalRun).normalize() : new THREE35.Vector3(sideSign * horizontalRun, -verticalRun, 0).normalize();
- const tangent = profile.ridgeAxis === "x" ? new THREE35.Vector3(sideSign, 0, 0) : new THREE35.Vector3(0, 0, -sideSign);
+ const downhill = profile.ridgeAxis === "x" ? new THREE36.Vector3(0, -verticalRun, sideSign * horizontalRun).normalize() : new THREE36.Vector3(sideSign * horizontalRun, -verticalRun, 0).normalize();
+ const tangent = profile.ridgeAxis === "x" ? new THREE36.Vector3(sideSign, 0, 0) : new THREE36.Vector3(0, 0, -sideSign);
const normal = downhill.clone().cross(tangent).normalize();
- const localToRoof = new THREE35.Matrix4().makeBasis(tangent, normal, downhill);
+ const localToRoof = new THREE36.Matrix4().makeBasis(tangent, normal, downhill);
localToRoof.setPosition(0, profile.ridgeY, 0);
const world = () => {
roofRoot.updateWorldMatrix(true, false);
return roofRoot.matrixWorld.clone().multiply(localToRoof);
};
const direction = (axis) => axis.clone().transformDirection(world());
- const point = (x, z) => new THREE35.Vector3(x, 0, z).applyMatrix4(world());
+ const point = (x, z) => new THREE36.Vector3(x, 0, z).applyMatrix4(world());
return {
side,
ridgeAxis: profile.ridgeAxis,
@@ -25009,13 +25224,13 @@ function buildFace(roofRoot, profile, sideSign) {
return world();
},
get ridgeTangent() {
- return direction(new THREE35.Vector3(1, 0, 0));
+ return direction(new THREE36.Vector3(1, 0, 0));
},
get downhillDirection() {
- return direction(new THREE35.Vector3(0, 0, 1));
+ return direction(new THREE36.Vector3(0, 0, 1));
},
get outwardNormal() {
- return direction(new THREE35.Vector3(0, 1, 0));
+ return direction(new THREE36.Vector3(0, 1, 0));
},
get ridgeStart() {
return point(-alongRidge / 2, 0);
@@ -25033,17 +25248,17 @@ function buildFace(roofRoot, profile, sideSign) {
};
}
function buildRoof(name, material, profile, parent) {
- const root = new THREE35.Object3D;
+ const root = new THREE36.Object3D;
root.name = name;
if (parent)
parent.add(root);
stampSemanticMetadataV1(root, roleMetadata([semanticRole(KILN_SEMANTIC_ROLES.roof, "assembly")], [relationship("separable-from", "architecture.shell.gable")]));
const faces = [buildFace(root, profile, 1), buildFace(root, profile, -1)];
const buildSlope = (face) => {
- const geometry = new THREE35.BoxGeometry(face.dimensions.alongRidge, profile.thickness, face.dimensions.downhill);
- const mesh = new THREE35.Mesh(geometry, material);
+ const geometry = new THREE36.BoxGeometry(face.dimensions.alongRidge, profile.thickness, face.dimensions.downhill);
+ const mesh = new THREE36.Mesh(geometry, material);
mesh.name = `Mesh_${name}_${face.side}`;
- const center = new THREE35.Matrix4().makeTranslation(0, -profile.thickness / 2, face.dimensions.downhill / 2);
+ const center = new THREE36.Matrix4().makeTranslation(0, -profile.thickness / 2, face.dimensions.downhill / 2);
setTransform(mesh, face.localToRoof.clone().multiply(center));
const coveredWall = profile.ridgeAxis === "x" ? face.side === "positive" ? "wall.right" : "wall.left" : face.side === "positive" ? "wall.front" : "wall.back";
stampSemanticMetadataV1(mesh, roleMetadata([semanticRole(KILN_SEMANTIC_ROLES.roof, "slope", face.side)], [
@@ -25113,7 +25328,7 @@ function createGableEndPanel(name, material, options) {
const ridgeAxis = options.ridgeAxis ?? "x";
const side = options.side ?? "positive";
const half = span / 2;
- const shape = new THREE35.Shape;
+ const shape = new THREE36.Shape;
shape.moveTo(-half, 0);
shape.lineTo(half, 0);
shape.lineTo(0, rise);
@@ -25132,7 +25347,7 @@ function createGableEndPanel(name, material, options) {
const right = opening.offset + opening.width / 2;
const bottom = opening.bottom;
const top = bottom + opening.height;
- const hole = new THREE35.Path;
+ const hole = new THREE36.Path;
hole.moveTo(left, bottom);
hole.lineTo(left, top);
hole.lineTo(right, top);
@@ -25140,7 +25355,7 @@ function createGableEndPanel(name, material, options) {
hole.closePath();
shape.holes.push(hole);
}
- const geometry = new THREE35.ExtrudeGeometry(shape, {
+ const geometry = new THREE36.ExtrudeGeometry(shape, {
depth: thickness,
bevelEnabled: false,
steps: 1
@@ -25149,7 +25364,7 @@ function createGableEndPanel(name, material, options) {
if (ridgeAxis === "x")
geometry.rotateY(-Math.PI / 2);
geometry.computeVertexNormals();
- const root = new THREE35.Mesh(geometry, material);
+ const root = new THREE36.Mesh(geometry, material);
root.name = `Mesh_${name}`;
stampSemanticMetadataV1(root, roleMetadata([`roof.gable.${side}`], [
relationship("adjacent-to", "roof.slope.positive"),
@@ -25165,7 +25380,7 @@ function createGableEndPanel(name, material, options) {
}
]));
const markers = normalized.map((opening, index) => {
- const marker = new THREE35.Object3D;
+ const marker = new THREE36.Object3D;
marker.name = `Opening_${name}_${opening.id ?? index + 1}`;
marker.position.set(ridgeAxis === "z" ? opening.offset : 0, opening.bottom + opening.height / 2, ridgeAxis === "x" ? opening.offset : 0);
marker.scale.set(ridgeAxis === "x" ? thickness : opening.width, opening.height, ridgeAxis === "x" ? opening.width : thickness);
@@ -25185,7 +25400,7 @@ function wallNeighbors(wall) {
}
function createShellWall(name, wall, material, length, height, thickness, openings) {
const axis = wallRunAxis(wall);
- const root = new THREE35.Object3D;
+ const root = new THREE36.Object3D;
root.name = `${name}_Wall_${wall}`;
const neighbors = wallNeighbors(wall);
stampSemanticMetadataV1(root, roleMetadata([`wall.${wall}`], [
@@ -25197,8 +25412,8 @@ function createShellWall(name, wall, material, length, height, thickness, openin
const panel = (suffix, lo, hi, y0, y1) => {
if (hi <= lo || y1 <= y0)
return;
- const geometry = axis === "x" ? new THREE35.BoxGeometry(hi - lo, y1 - y0, thickness) : new THREE35.BoxGeometry(thickness, y1 - y0, hi - lo);
- const mesh = new THREE35.Mesh(geometry, material);
+ const geometry = axis === "x" ? new THREE36.BoxGeometry(hi - lo, y1 - y0, thickness) : new THREE36.BoxGeometry(thickness, y1 - y0, hi - lo);
+ const mesh = new THREE36.Mesh(geometry, material);
mesh.name = `Mesh_${name}_${wall}_${suffix}`;
mesh.position.set(axis === "x" ? (lo + hi) / 2 : 0, (y0 + y1) / 2, axis === "z" ? (lo + hi) / 2 : 0);
root.add(mesh);
@@ -25215,7 +25430,7 @@ function createShellWall(name, wall, material, length, height, thickness, openin
panel(singleNames[segment.suffix] ?? segment.suffix.slice(1), segment.left, segment.right, segment.bottom, segment.top);
}
for (const opening of built.openings) {
- const marker = new THREE35.Object3D;
+ const marker = new THREE36.Object3D;
marker.name = `Opening_${wall}_${opening.id}`;
marker.position.set(axis === "x" ? opening.offset : 0, opening.sill + opening.height / 2, axis === "z" ? opening.offset : 0);
marker.scale.set(axis === "x" ? opening.width : opening.depth, opening.height, axis === "z" ? opening.width : opening.depth);
@@ -25238,7 +25453,7 @@ function createGableShell(name, materials, options) {
const closedEnds = options.closedEnds ?? true;
const enterable = options.enterable ?? true;
const shellOpenings = options.openings ?? (enterable ? [{ wall: "front", kind: "door" }] : []);
- const root = new THREE35.Object3D;
+ const root = new THREE36.Object3D;
root.name = name;
stampSemanticMetadataV1(root, roleMetadata(["architecture.shell.gable"], [relationship("contains", "floor"), relationship("contains", "roof.assembly")]));
const wallSpecs = {
@@ -25256,7 +25471,7 @@ function createGableShell(name, materials, options) {
walls[wall] = built.root;
openingMarkers.push(...built.openings);
}
- const floor = new THREE35.Mesh(new THREE35.BoxGeometry(spanX, floorThickness, spanZ), materials.floor ?? materials.wall);
+ const floor = new THREE36.Mesh(new THREE36.BoxGeometry(spanX, floorThickness, spanZ), materials.floor ?? materials.wall);
floor.name = `Mesh_${name}_Floor`;
floor.position.y = -floorThickness / 2;
stampSemanticMetadataV1(floor, roleMetadata(["floor"], ["front", "back", "left", "right"].map((wall) => relationship("adjacent-to", `wall.${wall}`))));
@@ -25371,13 +25586,13 @@ function createRoofSurfaceLayout(name, material, options) {
assertDimension("createRoofSurfaceLayout generated width", spec.width);
assertDimension("createRoofSurfaceLayout generated length", spec.length);
}
- const root = new THREE35.Object3D;
+ const root = new THREE36.Object3D;
root.name = name;
stampSemanticMetadataV1(root, roleMetadata([`roof.surface.${options.kind}`], [relationship("coverage-of", `roof.slope.${options.face.side}`)]));
const items = specs.map((spec, index) => {
- const mesh = new THREE35.Mesh(new THREE35.BoxGeometry(spec.width, thickness, spec.length), material);
+ const mesh = new THREE36.Mesh(new THREE36.BoxGeometry(spec.width, thickness, spec.length), material);
mesh.name = `Mesh_${name}_${index + 1}`;
- const local = new THREE35.Matrix4().makeTranslation(spec.x, thickness / 2 + 0.002, spec.z);
+ const local = new THREE36.Matrix4().makeTranslation(spec.x, thickness / 2 + 0.002, spec.z);
setTransform(mesh, faceToRoot.clone().multiply(local));
root.add(mesh);
return mesh;
@@ -25394,7 +25609,7 @@ var init_architecture2 = __esm(() => {
});
// src/gears.ts
-import * as THREE36 from "three";
+import * as THREE37 from "three";
function gearGeo(opts = {}) {
const {
teeth = 12,
@@ -25493,8 +25708,8 @@ function gearGeo(opts = {}) {
indices.push(tA, bA, bB);
indices.push(tA, bB, tB);
}
- const geo = new THREE36.BufferGeometry;
- geo.setAttribute("position", new THREE36.Float32BufferAttribute(positions, 3));
+ const geo = new THREE37.BufferGeometry;
+ geo.setAttribute("position", new THREE37.Float32BufferAttribute(positions, 3));
geo.setIndex(indices);
const nonIndexed = geo.toNonIndexed();
nonIndexed.computeVertexNormals();
@@ -25579,8 +25794,8 @@ function bladeGeo(opts = {}) {
indices.push(count + i, tip, count + j);
}
}
- const geo = new THREE36.BufferGeometry;
- geo.setAttribute("position", new THREE36.Float32BufferAttribute(positions, 3));
+ const geo = new THREE37.BufferGeometry;
+ geo.setAttribute("position", new THREE37.Float32BufferAttribute(positions, 3));
geo.setIndex(indices);
const nonIndexed = geo.toNonIndexed();
nonIndexed.computeVertexNormals();
@@ -25592,7 +25807,7 @@ var init_gears = __esm(() => {
});
// src/ops.ts
-import * as THREE37 from "three";
+import * as THREE38 from "three";
import { LoopSubdivision } from "three-subdivide/build/index.module.js";
import { mergeVertices as threeMergeVertices } from "three/examples/jsm/utils/BufferGeometryUtils.js";
function assertFiniteSourceFrame(name, source) {
@@ -25626,9 +25841,9 @@ function arrayLinear(namePrefix, source, count, offset, parent) {
}
function degreesOf(euler) {
return [
- THREE37.MathUtils.radToDeg(euler.x),
- THREE37.MathUtils.radToDeg(euler.y),
- THREE37.MathUtils.radToDeg(euler.z)
+ THREE38.MathUtils.radToDeg(euler.x),
+ THREE38.MathUtils.radToDeg(euler.y),
+ THREE38.MathUtils.radToDeg(euler.z)
];
}
function arrayRadial(namePrefix, source, count, axis = "y", parent, center, options = {}) {
@@ -25641,12 +25856,12 @@ function arrayRadial(namePrefix, source, count, axis = "y", parent, center, opti
if (center)
assertFiniteTriple("arrayRadial center", center);
const out = [];
- const pivot = center ? new THREE37.Vector3(...center) : new THREE37.Vector3;
+ const pivot = center ? new THREE38.Vector3(...center) : new THREE38.Vector3;
const basePos = source.position.clone().sub(pivot);
- const axisVec = axis === "x" ? new THREE37.Vector3(1, 0, 0) : axis === "z" ? new THREE37.Vector3(0, 0, 1) : new THREE37.Vector3(0, 1, 0);
+ const axisVec = axis === "x" ? new THREE38.Vector3(1, 0, 0) : axis === "z" ? new THREE38.Vector3(0, 0, 1) : new THREE38.Vector3(0, 1, 0);
const positions = [];
for (let i = 1;i < count; i++) {
- const position = basePos.clone().applyMatrix4(new THREE37.Matrix4().makeRotationAxis(axisVec, i / count * Math.PI * 2)).add(pivot);
+ const position = basePos.clone().applyMatrix4(new THREE38.Matrix4().makeRotationAxis(axisVec, i / count * Math.PI * 2)).add(pivot);
assertFiniteTriple("arrayRadial resulting position", position.toArray());
positions.push(position);
}
@@ -25685,7 +25900,7 @@ function repeatAlongCurve(source, points, options) {
assertFiniteTriple(`${name} points[${i}]`, point);
const up = options.up ?? [0, 1, 0];
assertFiniteTriple(`${name} up`, up);
- const upVector = new THREE37.Vector3(...up);
+ const upVector = new THREE38.Vector3(...up);
if (upVector.lengthSq() === 0)
throw new RangeError(`${name} up must not be zero.`);
upVector.normalize();
@@ -25724,13 +25939,13 @@ function repeatAlongCurve(source, points, options) {
segment++;
while (segment < points.length - 2 && cumulative[segment + 1] === cumulative[segment])
segment++;
- const a = new THREE37.Vector3(...points[segment]);
- const b = new THREE37.Vector3(...points[segment + 1]);
+ const a = new THREE38.Vector3(...points[segment]);
+ const b = new THREE38.Vector3(...points[segment + 1]);
const segmentLength = cumulative[segment + 1] - cumulative[segment];
const local = segmentLength > 0 ? (s - cumulative[segment]) / segmentLength : 0;
const position = a.clone().lerp(b, Math.min(Math.max(local, 0), 1));
- const k = THREE37.MathUtils.lerp(scale[0], scale[1], t);
- const rotation = new THREE37.Matrix4;
+ const k = THREE38.MathUtils.lerp(scale[0], scale[1], t);
+ const rotation = new THREE38.Matrix4;
let angle = 0;
if (align === "tangent") {
const tangent = b.clone().sub(a).normalize();
@@ -25738,17 +25953,17 @@ function repeatAlongCurve(source, points, options) {
if (side.lengthSq() < 0.000000000001)
side = previousUp.clone().sub(tangent.clone().multiplyScalar(previousUp.dot(tangent)));
if (side.lengthSq() < 0.000000000001)
- side = new THREE37.Vector3(Math.abs(tangent.x) < 0.9 ? 1 : 0, Math.abs(tangent.x) < 0.9 ? 0 : 1, 0).sub(tangent.clone().multiplyScalar(Math.abs(tangent.x) < 0.9 ? tangent.x : tangent.y));
+ side = new THREE38.Vector3(Math.abs(tangent.x) < 0.9 ? 1 : 0, Math.abs(tangent.x) < 0.9 ? 0 : 1, 0).sub(tangent.clone().multiplyScalar(Math.abs(tangent.x) < 0.9 ? tangent.x : tangent.y));
side.normalize();
previousUp = side;
- rotation.makeBasis(tangent, side, new THREE37.Vector3().crossVectors(tangent, side));
- angle = THREE37.MathUtils.degToRad(THREE37.MathUtils.lerp(twist[0], twist[1], t));
+ rotation.makeBasis(tangent, side, new THREE38.Vector3().crossVectors(tangent, side));
+ angle = THREE38.MathUtils.degToRad(THREE38.MathUtils.lerp(twist[0], twist[1], t));
}
for (const extra of opposite ? [0, Math.PI] : [0]) {
const turned = rotation.clone();
if (angle + extra)
- turned.multiply(new THREE37.Matrix4().makeRotationX(angle + extra));
- const matrix = new THREE37.Matrix4().makeTranslation(position.x, position.y, position.z).multiply(turned).multiply(new THREE37.Matrix4().makeScale(k, k, k));
+ turned.multiply(new THREE38.Matrix4().makeRotationX(angle + extra));
+ const matrix = new THREE38.Matrix4().makeTranslation(position.x, position.y, position.z).multiply(turned).multiply(new THREE38.Matrix4().makeScale(k, k, k));
if (!matrix.elements.every(Number.isFinite))
throw new RangeError(`${name} produced a non-finite copy transform.`);
frames.push({ matrix, t });
@@ -25780,9 +25995,9 @@ function repeatAlongCurve(source, points, options) {
const total = perCopy * copies;
if (total > GEOMETRY_ALLOCATION_LIMITS.curveRepeatVertices)
throw new RangeError(`${name} would produce ${total} vertices; the limit is ${GEOMETRY_ALLOCATION_LIMITS.curveRepeatVertices}. Reduce count, simplify the source, or use merge: false.`);
- const merged = new THREE37.BufferGeometry;
- const vector = new THREE37.Vector3;
- const normalMatrix = new THREE37.Matrix3;
+ const merged = new THREE38.BufferGeometry;
+ const vector = new THREE38.Vector3;
+ const normalMatrix = new THREE38.Matrix3;
for (const [key, attribute] of Object.entries(geometry.attributes)) {
const size = attribute.itemSize;
const transformed = key === "position" || key === "normal" || key === "tangent";
@@ -25806,13 +26021,13 @@ function repeatAlongCurve(source, points, options) {
}
}
}
- merged.setAttribute(key, new THREE37.BufferAttribute(out, size, transformed ? false : attribute.normalized));
+ merged.setAttribute(key, new THREE38.BufferAttribute(out, size, transformed ? false : attribute.normalized));
}
if (options.along) {
const along = new Float32Array(total);
for (let copy = 0;copy < copies; copy++)
along.fill(frames[copy].t, copy * perCopy, (copy + 1) * perCopy);
- merged.setAttribute("_along", new THREE37.BufferAttribute(along, 1));
+ merged.setAttribute("_along", new THREE38.BufferAttribute(along, 1));
}
const index = geometry.getIndex();
if (index) {
@@ -25820,7 +26035,7 @@ function repeatAlongCurve(source, points, options) {
for (let copy = 0;copy < copies; copy++)
for (let i = 0;i < index.count; i++)
indices[copy * index.count + i] = index.getX(i) + copy * perCopy;
- merged.setIndex(new THREE37.BufferAttribute(indices, 1));
+ merged.setIndex(new THREE38.BufferAttribute(indices, 1));
}
merged.computeBoundingBox();
merged.computeBoundingSphere();
@@ -25829,15 +26044,15 @@ function repeatAlongCurve(source, points, options) {
function mirror(name, source, axis, parent) {
if (source.matrixAutoUpdate)
source.updateMatrix();
- const reflected = new THREE37.Matrix4().makeScale(axis === "x" ? -1 : 1, axis === "y" ? -1 : 1, axis === "z" ? -1 : 1).multiply(source.matrix);
+ const reflected = new THREE38.Matrix4().makeScale(axis === "x" ? -1 : 1, axis === "y" ? -1 : 1, axis === "z" ? -1 : 1).multiply(source.matrix);
if (!reflected.elements.every(Number.isFinite) || reflected.determinant() === 0) {
throw new RangeError(`mirror("${name}"): source requires a finite, nonsingular local transform.`);
}
- const position = new THREE37.Vector3;
- const quaternion = new THREE37.Quaternion;
- const scale = new THREE37.Vector3;
+ const position = new THREE38.Vector3;
+ const quaternion = new THREE38.Quaternion;
+ const scale = new THREE38.Vector3;
reflected.decompose(position, quaternion, scale);
- const recomposed = new THREE37.Matrix4().compose(position, quaternion, scale);
+ const recomposed = new THREE38.Matrix4().compose(position, quaternion, scale);
if (reflected.elements.some((value, i) => Math.abs(value - recomposed.elements[i]) > 0.00000001 * Math.max(1, Math.abs(value)))) {
throw new RangeError(`mirror("${name}"): local shear cannot be represented by a reflected TRS.`);
}
@@ -25853,13 +26068,13 @@ function mergeVertices(geometry, opts = {}) {
const { tolerance = 0.0001, positionOnly = false } = typeof opts === "number" ? { tolerance: opts } : opts;
if (!positionOnly)
return threeMergeVertices(geometry, tolerance);
- const stripped = new THREE37.BufferGeometry;
+ const stripped = new THREE38.BufferGeometry;
const pos = geometry.getAttribute("position");
if (!pos)
return geometry;
- stripped.setAttribute("position", new THREE37.BufferAttribute(new Float32Array(pos.array), pos.itemSize, pos.normalized));
+ stripped.setAttribute("position", new THREE38.BufferAttribute(new Float32Array(pos.array), pos.itemSize, pos.normalized));
if (geometry.index) {
- stripped.setIndex(new THREE37.BufferAttribute(new Uint32Array(geometry.index.array), 1));
+ stripped.setIndex(new THREE38.BufferAttribute(new Uint32Array(geometry.index.array), 1));
}
return threeMergeVertices(stripped, tolerance);
}
@@ -25894,8 +26109,8 @@ function subdivide(geometry, iterations = 1, opts = {}) {
const { weld = true, preserveUV = false, ...subOpts } = opts;
const prepared = geometry.clone();
prepared.computeBoundingBox();
- const center = prepared.boundingBox.getCenter(new THREE37.Vector3);
- const extent = prepared.boundingBox.getSize(new THREE37.Vector3);
+ const center = prepared.boundingBox.getCenter(new THREE38.Vector3);
+ const extent = prepared.boundingBox.getSize(new THREE38.Vector3);
const size = Math.max(extent.x, extent.y, extent.z);
const normalizationScale = size > 0 ? 1e4 / size : 1;
if (!Number.isFinite(normalizationScale) || !center.toArray().every(Number.isFinite))
@@ -25925,13 +26140,13 @@ function subdivide(geometry, iterations = 1, opts = {}) {
const values = new Float32Array(attribute.count);
for (let i = 0;i < attribute.count; i++)
values[i] = decoded[i * 4 + component];
- input.setAttribute(lane, new THREE37.BufferAttribute(values, 1));
+ input.setAttribute(lane, new THREE38.BufferAttribute(values, 1));
lanes.push(lane);
}
input.deleteAttribute(name);
fourthComponents.push({ name, lanes });
} else
- input.setAttribute(name, new THREE37.BufferAttribute(decoded, components));
+ input.setAttribute(name, new THREE38.BufferAttribute(decoded, components));
}
for (const targets of Object.values(input.morphAttributes))
for (let target = 0;target < targets.length; target++) {
@@ -25940,7 +26155,7 @@ function subdivide(geometry, iterations = 1, opts = {}) {
for (let i = 0;i < attribute.count; i++)
for (let component = 0;component < 3; component++)
decoded[i * 3 + component] = attribute.getComponent(i, component);
- targets[target] = new THREE37.BufferAttribute(decoded, 3);
+ targets[target] = new THREE38.BufferAttribute(decoded, 3);
}
if (preserveUV)
subOpts.uvSmooth = false;
@@ -25954,7 +26169,7 @@ function subdivide(geometry, iterations = 1, opts = {}) {
values[i * 4 + component] = lane.getX(i);
output.deleteAttribute(lanes[component]);
}
- output.setAttribute(name, new THREE37.BufferAttribute(values, 4));
+ output.setAttribute(name, new THREE38.BufferAttribute(values, 4));
}
output.scale(1 / normalizationScale, 1 / normalizationScale, 1 / normalizationScale).translate(center.x, center.y, center.z);
output.userData = structuredClone(geometry.userData);
@@ -26019,9 +26234,9 @@ function assertTubeRadius(radius) {
}
function curveToMesh(points, radius, tubularSegments = 32, radialSegments = 8, closed = false) {
assertTubeRadius(radius);
- const vectors = points.map((p) => new THREE37.Vector3(p[0], p[1], p[2]));
- const curve = new THREE37.CatmullRomCurve3(vectors, closed);
- return new THREE37.TubeGeometry(curve, tubularSegments, radius, radialSegments, closed);
+ const vectors = points.map((p) => new THREE38.Vector3(p[0], p[1], p[2]));
+ const curve = new THREE38.CatmullRomCurve3(vectors, closed);
+ return new THREE38.TubeGeometry(curve, tubularSegments, radius, radialSegments, closed);
}
function normalizeSurfaceNormals(geo) {
const normal = geo.getAttribute("normal");
@@ -26052,15 +26267,15 @@ function lathe(profile, segments = 12) {
}
function revolveGeo(profile, options = {}) {
const { angle = Math.PI * 2, axis = [0, 1, 0], segments = 12 } = options;
- const points2d = profile.map((p) => new THREE37.Vector2(p[0], p[1]));
- const geo = normalizeSurfaceNormals(new THREE37.LatheGeometry(points2d, segments, 0, angle));
- const n = new THREE37.Vector3(axis[0], axis[1], axis[2]);
+ const points2d = profile.map((p) => new THREE38.Vector2(p[0], p[1]));
+ const geo = normalizeSurfaceNormals(new THREE38.LatheGeometry(points2d, segments, 0, angle));
+ const n = new THREE38.Vector3(axis[0], axis[1], axis[2]);
if (n.lengthSq() < 0.000000000001) {
throw new Error(`revolveGeo: axis must be a non-zero vector (got [${axis.join(",")}]).`);
}
n.normalize();
if (n.x !== 0 || n.y !== 1 || n.z !== 0) {
- const q = new THREE37.Quaternion().setFromUnitVectors(new THREE37.Vector3(0, 1, 0), n);
+ const q = new THREE38.Quaternion().setFromUnitVectors(new THREE38.Vector3(0, 1, 0), n);
geo.applyQuaternion(q);
}
return geo;
@@ -26076,9 +26291,9 @@ function pipeAlongPath(points, radius, options = {}) {
const smoothed = [];
smoothed.push(points[0]);
for (let i = 1;i < points.length - 1; i++) {
- const prev = new THREE37.Vector3(...points[i - 1]);
- const cur = new THREE37.Vector3(...points[i]);
- const next = new THREE37.Vector3(...points[i + 1]);
+ const prev = new THREE38.Vector3(...points[i - 1]);
+ const cur = new THREE38.Vector3(...points[i]);
+ const next = new THREE38.Vector3(...points[i + 1]);
const inDir = cur.clone().sub(prev);
const outDir = next.clone().sub(cur);
const inLen = inDir.length();
@@ -26096,12 +26311,12 @@ function pipeAlongPath(points, radius, options = {}) {
return curveToMesh(pathPoints, radius, tubularSegments, radialSegments, closed);
}
function bezierCurve(controlPoints, samples = 32) {
- const vecs = controlPoints.map((p) => new THREE37.Vector3(p[0], p[1], p[2]));
+ const vecs = controlPoints.map((p) => new THREE38.Vector3(p[0], p[1], p[2]));
let curve;
if (vecs.length === 3) {
- curve = new THREE37.QuadraticBezierCurve3(vecs[0], vecs[1], vecs[2]);
+ curve = new THREE38.QuadraticBezierCurve3(vecs[0], vecs[1], vecs[2]);
} else if (vecs.length === 4) {
- curve = new THREE37.CubicBezierCurve3(vecs[0], vecs[1], vecs[2], vecs[3]);
+ curve = new THREE38.CubicBezierCurve3(vecs[0], vecs[1], vecs[2], vecs[3]);
} else {
throw new Error(`bezierCurve: need 3 or 4 control points, got ${vecs.length}`);
}
@@ -26114,20 +26329,20 @@ var init_ops = __esm(() => {
});
// src/deformation-normals.ts
-import * as THREE38 from "three";
+import * as THREE39 from "three";
function recomputeDeformedNormals(source, output) {
const original = source.getAttribute("position");
const authored = source.getAttribute("normal");
const position = output.getAttribute("position");
const bounds = (attribute) => {
- const box = new THREE38.Box3().setFromBufferAttribute(attribute);
+ const box = new THREE39.Box3().setFromBufferAttribute(attribute);
return {
- center: box.getCenter(new THREE38.Vector3),
- size: box.getSize(new THREE38.Vector3).length() || 1
+ center: box.getCenter(new THREE39.Vector3),
+ size: box.getSize(new THREE39.Vector3).length() || 1
};
};
const before = bounds(original), after = bounds(position);
- const point = new THREE38.Vector3, normal = new THREE38.Vector3;
+ const point = new THREE39.Vector3, normal = new THREE39.Vector3;
const quantized = (attribute, index, frame) => {
point.fromBufferAttribute(attribute, index).sub(frame.center).divideScalar(frame.size);
return point.toArray().map((value) => Math.round(value * 1e7)).join(",");
@@ -26150,7 +26365,7 @@ function recomputeDeformedNormals(source, output) {
const sums = new Float64Array(classes.size * 3);
const index = output.index;
const corners = index?.count ?? position.count;
- const a = new THREE38.Vector3, b = new THREE38.Vector3, c = new THREE38.Vector3;
+ const a = new THREE39.Vector3, b = new THREE39.Vector3, c = new THREE39.Vector3;
for (let t = 0;t < corners; t += 3) {
const ia = index ? index.getX(t) : t;
const ib = index ? index.getX(t + 1) : t + 1;
@@ -26171,17 +26386,17 @@ function recomputeDeformedNormals(source, output) {
const offset = ids[i] * 3;
normal.set(sums[offset], sums[offset + 1], sums[offset + 2]).normalize().toArray(normals, i * 3);
}
- output.setAttribute("normal", new THREE38.BufferAttribute(normals, 3));
+ output.setAttribute("normal", new THREE39.BufferAttribute(normals, 3));
}
var init_deformation_normals = () => {};
// src/deform.ts
-import * as THREE39 from "three";
+import * as THREE40 from "three";
function geometryFrameMatrix(frame = {}) {
const origin = frame.origin ?? [0, 0, 0], rotation = frame.rotation ?? [0, 0, 0];
if (origin.length !== 3 || rotation.length !== 3 || ![...origin, ...rotation].every(Number.isFinite))
throw new Error("geometry frame requires finite xyz origin and rotation");
- return new THREE39.Matrix4().compose(new THREE39.Vector3(...origin), new THREE39.Quaternion().setFromEuler(new THREE39.Euler(...rotation.map(THREE39.MathUtils.degToRad), "XYZ")), new THREE39.Vector3(1, 1, 1));
+ return new THREE40.Matrix4().compose(new THREE40.Vector3(...origin), new THREE40.Quaternion().setFromEuler(new THREE40.Euler(...rotation.map(THREE40.MathUtils.degToRad), "XYZ")), new THREE40.Vector3(1, 1, 1));
}
function deform(geometry, options, map) {
const source = geometry.getAttribute("position");
@@ -26208,7 +26423,7 @@ function deform(geometry, options, map) {
throw new Error("deformation normals must be finite");
}
const matrix = geometryFrameMatrix(options.frame), inverse = matrix.clone().invert();
- const points = Array.from({ length: source.count }, (_, i) => new THREE39.Vector3().fromBufferAttribute(source, i).applyMatrix4(inverse));
+ const points = Array.from({ length: source.count }, (_, i) => new THREE40.Vector3().fromBufferAttribute(source, i).applyMatrix4(inverse));
if (points.some((p) => ![p.x, p.y, p.z].every(Number.isFinite)))
throw new Error("deformation positions must be finite");
let low = Infinity, high = -Infinity;
@@ -26231,7 +26446,7 @@ function deform(geometry, options, map) {
const point = points[i];
if (point.y < low - epsilon || point.y > high + epsilon)
continue;
- const t = length > 0 ? THREE39.MathUtils.clamp((point.y - low) / length, 0, 1) : 0;
+ const t = length > 0 ? THREE40.MathUtils.clamp((point.y - low) / length, 0, 1) : 0;
const weight = options.falloff?.(t) ?? 1;
if (!Number.isFinite(weight) || weight < 0 || weight > 1)
throw new Error("deformation falloff must return a finite weight between 0 and 1");
@@ -26265,31 +26480,31 @@ function deform(geometry, options, map) {
function twist(geometry, options) {
if (!Number.isFinite(options.angle))
throw new Error("twist angle must be finite degrees");
- return deform(geometry, options, (p, t) => p.applyAxisAngle(new THREE39.Vector3(0, 1, 0), THREE39.MathUtils.degToRad(options.angle) * t));
+ return deform(geometry, options, (p, t) => p.applyAxisAngle(new THREE40.Vector3(0, 1, 0), THREE40.MathUtils.degToRad(options.angle) * t));
}
function bend(geometry, options) {
if (!Number.isFinite(options.angle))
throw new Error("bend angle must be finite degrees");
- const angle = THREE39.MathUtils.degToRad(options.angle);
+ const angle = THREE40.MathUtils.degToRad(options.angle);
return deform(geometry, options, (p, t, low, length) => {
if (Math.abs(angle) < 0.0000000001 || length === 0)
return p;
const radius = length / angle, theta = angle * t;
- return new THREE39.Vector3(radius - (radius - p.x) * Math.cos(theta), low + (radius - p.x) * Math.sin(theta), p.z);
+ return new THREE40.Vector3(radius - (radius - p.x) * Math.cos(theta), low + (radius - p.x) * Math.sin(theta), p.z);
});
}
function taper(geometry, options) {
const start = options.startScale ?? [1, 1], end = options.endScale;
if (start.length !== 2 || end.length !== 2 || ![...start, ...end].every((n) => Number.isFinite(n) && n > 0))
throw new Error("taper scales must be two finite positive values");
- return deform(geometry, options, (p, t) => p.set(p.x * THREE39.MathUtils.lerp(start[0], end[0], t), p.y, p.z * THREE39.MathUtils.lerp(start[1], end[1], t)));
+ return deform(geometry, options, (p, t) => p.set(p.x * THREE40.MathUtils.lerp(start[0], end[0], t), p.y, p.z * THREE40.MathUtils.lerp(start[1], end[1], t)));
}
function displace(geometry, offset, options = {}) {
return deform(geometry, options, (p, t) => {
const delta = offset([p.x, p.y, p.z], t);
if (delta.length !== 3 || !delta.every(Number.isFinite))
throw new Error("displace callback must return three finite offsets");
- return p.add(new THREE39.Vector3(...delta));
+ return p.add(new THREE40.Vector3(...delta));
});
}
var init_deform = __esm(() => {
@@ -26297,7 +26512,7 @@ var init_deform = __esm(() => {
});
// src/sweep.ts
-import * as THREE40 from "three";
+import * as THREE41 from "three";
function rejectHoles(value, label) {
if ("holes" in value && value.holes !== undefined)
throw new AuthoringDiagnosticError("PROFILE_HOLES_UNSUPPORTED", `${label}: holes are unsupported. Use extrudeProfile for a holed cross-section with optional twist/taper; independently varying contours need explicit geometry or solid subtraction.`);
@@ -26305,9 +26520,9 @@ function rejectHoles(value, label) {
function profilePoints(profile) {
if (profile.length < 3 || profile.some((p) => p.length !== 2 || !p.every(Number.isFinite)))
throw new Error("profile requires at least three finite xy points");
- const points = profile.map((p) => new THREE40.Vector2(...p));
- const bounds = new THREE40.Box2().setFromPoints(points);
- const extent = bounds.getSize(new THREE40.Vector2).length();
+ const points = profile.map((p) => new THREE41.Vector2(...p));
+ const bounds = new THREE41.Box2().setFromPoints(points);
+ const extent = bounds.getSize(new THREE41.Vector2).length();
if (!(extent > 0) || !Number.isFinite(extent))
throw new Error("profile requires a finite nonzero extent");
const normalized = points.map((p) => p.clone().sub(bounds.min).divideScalar(extent));
@@ -26330,7 +26545,7 @@ function profilePoints(profile) {
throw new Error("profile self-intersects or touches itself");
}
}
- const area = THREE40.ShapeUtils.area(normalized);
+ const area = THREE41.ShapeUtils.area(normalized);
if (Math.abs(area) < 0.000000000001)
throw new Error("profile area must be nonzero");
if (area < 0)
@@ -26344,11 +26559,11 @@ function isCrease(first, second, creaseAngle) {
if (!(first.lengthSq() > 0 && second.lengthSq() > 0))
return false;
const angle = Math.atan2(first.clone().cross(second).length(), first.dot(second));
- return THREE40.MathUtils.radToDeg(angle) > creaseAngle + CREASE_TOLERANCE_DEGREES;
+ return THREE41.MathUtils.radToDeg(angle) > creaseAngle + CREASE_TOLERANCE_DEGREES;
}
function buildLoft(rings, profiles, closed, cap, firstFrameForward, creaseAngle) {
const n = rings[0].length, positions = [], uvs = [], indices = [];
- const centers = rings.map((r) => r.reduce((sum, p) => sum.add(p), new THREE40.Vector3).multiplyScalar(1 / n));
+ const centers = rings.map((r) => r.reduce((sum, p) => sum.add(p), new THREE41.Vector3).multiplyScalar(1 / n));
const lengths = [0];
for (let i = 1;i < centers.length; i++)
lengths.push(lengths[i - 1] + centers[i].distanceTo(centers[i - 1]));
@@ -26408,13 +26623,13 @@ function buildLoft(rings, profiles, closed, cap, firstFrameForward, creaseAngle)
continue;
const ring = rings[station], profile = profiles[station];
const start = positions.length / 3;
- const bounds = new THREE40.Box2().setFromPoints(profile);
- const size = bounds.getSize(new THREE40.Vector2);
+ const bounds = new THREE41.Box2().setFromPoints(profile);
+ const size = bounds.getSize(new THREE41.Vector2);
for (let j = 0;j < n; j++) {
positions.push(...ring[j].toArray());
uvs.push((profile[j].x - bounds.min.x) / (size.x || 1), (profile[j].y - bounds.min.y) / (size.y || 1));
}
- for (const tri of THREE40.ShapeUtils.triangulateShape(profile, [])) {
+ for (const tri of THREE41.ShapeUtils.triangulateShape(profile, [])) {
if (station === 0)
indices.push(...tri.map((j) => start + j));
else
@@ -26427,7 +26642,7 @@ function buildLoft(rings, profiles, closed, cap, firstFrameForward, creaseAngle)
const out = meshGeo({ positions, indices, uvs });
const normal = out.getAttribute("normal");
const share = (a, b) => {
- const sum = new THREE40.Vector3().fromBufferAttribute(normal, a).add(new THREE40.Vector3().fromBufferAttribute(normal, b)).normalize();
+ const sum = new THREE41.Vector3().fromBufferAttribute(normal, a).add(new THREE41.Vector3().fromBufferAttribute(normal, b)).normalize();
normal.setXYZ(a, sum.x, sum.y, sum.z);
normal.setXYZ(b, sum.x, sum.y, sum.z);
};
@@ -26465,8 +26680,8 @@ function loftProfiles(sections, options = {}) {
if (profiles.some((p) => p.length !== profiles[0].length))
throw new Error("loftProfiles sections must have the same point count and correspondence");
const frames = sections.map((section) => geometryFrameMatrix(section.frame));
- const rings = profiles.map((profile, i) => profile.map((p) => new THREE40.Vector3(p.x, 0, p.y).applyMatrix4(frames[i])));
- const out = buildLoft(rings, profiles, false, loftCapEnds(options.cap), new THREE40.Vector3(0, 1, 0).transformDirection(frames[0]));
+ const rings = profiles.map((profile, i) => profile.map((p) => new THREE41.Vector3(p.x, 0, p.y).applyMatrix4(frames[i])));
+ const out = buildLoft(rings, profiles, false, loftCapEnds(options.cap), new THREE41.Vector3(0, 1, 0).transformDirection(frames[0]));
const analysis = recordSweepAnalysis(out, rings, profiles, false);
out.userData.kilnGeometryWarnings = analysis.complete ? [] : [
{
@@ -26489,8 +26704,8 @@ function sweepProfile(profile, path, options = {}) {
const cap = sweepCapEnds(options.cap, closed);
if (path.length < (closed ? 3 : 2) || path.some((p) => p.length !== 3 || !p.every(Number.isFinite)))
throw new Error("sweepProfile requires finite path points (two open or three closed)");
- const stations = path.map((p) => new THREE40.Vector3(...p));
- const pathExtent = new THREE40.Box3().setFromPoints(stations).getSize(new THREE40.Vector3).length();
+ const stations = path.map((p) => new THREE41.Vector3(...p));
+ const pathExtent = new THREE41.Box3().setFromPoints(stations).getSize(new THREE41.Vector3).length();
if (!(pathExtent > 0) || !Number.isFinite(pathExtent))
throw new Error("sweepProfile path stations must be distinct with finite extent");
const pathTolerance = pathExtent * 0.0000000001;
@@ -26531,7 +26746,7 @@ function sweepProfile(profile, path, options = {}) {
});
return incoming.clone().add(outgoing).normalize();
});
- const up = options.up ? new THREE40.Vector3(...options.up) : Math.abs(tangents[0].z) < 0.9 ? new THREE40.Vector3(0, 0, 1) : new THREE40.Vector3(1, 0, 0);
+ const up = options.up ? new THREE41.Vector3(...options.up) : Math.abs(tangents[0].z) < 0.9 ? new THREE41.Vector3(0, 0, 1) : new THREE41.Vector3(1, 0, 0);
const upLength = Math.hypot(up.x, up.y, up.z);
if (!(upLength > 0) || !Number.isFinite(upLength))
throw new Error("sweepProfile up must be a finite nonzero vector");
@@ -26548,7 +26763,7 @@ function sweepProfile(profile, path, options = {}) {
}
const distances = [0];
for (let i = 1;i < stations.length; i++) {
- z = z.clone().applyQuaternion(new THREE40.Quaternion().setFromUnitVectors(tangents[i - 1], tangents[i]));
+ z = z.clone().applyQuaternion(new THREE41.Quaternion().setFromUnitVectors(tangents[i - 1], tangents[i]));
normals.push(z);
distances.push(distances[i - 1] + stations[i].distanceTo(stations[i - 1]));
}
@@ -26558,7 +26773,7 @@ function sweepProfile(profile, path, options = {}) {
correction = Math.atan2(tangents[0].dot(normals[normals.length - 1].clone().cross(normals[0])), normals[normals.length - 1].dot(normals[0]));
const rings = stations.map((station, i) => {
const tangent = tangents[i], t = distances[i] / total;
- const axisZ = normals[i].clone().applyAxisAngle(tangent, (correction + THREE40.MathUtils.degToRad(twist)) * t);
+ const axisZ = normals[i].clone().applyAxisAngle(tangent, (correction + THREE41.MathUtils.degToRad(twist)) * t);
const axisX = tangent.clone().cross(axisZ).normalize(), scale = scales[i];
return points.map((p) => station.clone().addScaledVector(axisX, p.x * scale[0]).addScaledVector(axisZ, p.y * scale[1]));
});
@@ -26583,7 +26798,7 @@ var init_sweep2 = __esm(() => {
});
// src/simplify.ts
-import * as THREE41 from "three";
+import * as THREE42 from "three";
function loadSimplifier() {
simplifierReady ??= import("meshoptimizer/simplifier").then(async ({ MeshoptSimplifier }) => {
await MeshoptSimplifier.ready;
@@ -26605,7 +26820,7 @@ function gather(attribute, vertices) {
for (let i = 0;i < vertices.length; i++)
for (let c = 0;c < attribute.itemSize; c++)
values[i * attribute.itemSize + c] = raw(attribute, vertices[i], c);
- const out = new THREE41.BufferAttribute(values, attribute.itemSize, attribute.normalized);
+ const out = new THREE42.BufferAttribute(values, attribute.itemSize, attribute.normalized);
out.name = attribute.name;
return out;
}
@@ -26890,14 +27105,14 @@ async function simplifyGeometry(geometry, options) {
indexValues[i] = remap[w];
}
const sources = Uint32Array.from(used, (w) => representative[w]);
- const out = new THREE41.BufferGeometry;
+ const out = new THREE42.BufferGeometry;
out.name = geometry.name;
const outPosition = new Float32Array(sources.length * 3);
for (let i = 0;i < used.length; i++)
outPosition.set(positions.subarray(used[i] * 3, used[i] * 3 + 3), i * 3);
for (const [name, attribute] of Object.entries(geometry.attributes)) {
if (name === "position") {
- const attr = new THREE41.BufferAttribute(outPosition, 3);
+ const attr = new THREE42.BufferAttribute(outPosition, 3);
attr.name = attribute.name;
out.setAttribute(name, attr);
} else
@@ -26906,7 +27121,7 @@ async function simplifyGeometry(geometry, options) {
for (const [name, targets] of Object.entries(geometry.morphAttributes))
out.morphAttributes[name] = targets.map((target) => gather(target, sources));
out.morphTargetsRelative = geometry.morphTargetsRelative;
- out.setIndex(new THREE41.BufferAttribute(indexValues, 1));
+ out.setIndex(new THREE42.BufferAttribute(indexValues, 1));
for (const group of outGroups)
out.addGroup(group.start, group.count, group.materialIndex);
out.computeBoundingBox();
@@ -26961,7 +27176,7 @@ var init_simplify = __esm(() => {
});
// src/solids.ts
-import * as THREE42 from "three";
+import * as THREE43 from "three";
async function getManifoldModule() {
if (_module)
return _module;
@@ -26991,10 +27206,10 @@ function computationFrame(parts) {
meshes.push(mesh);
});
}
- const origin = meshes.length ? new THREE42.Vector3().setFromMatrixPosition(meshes[0].matrixWorld) : new THREE42.Vector3;
+ const origin = meshes.length ? new THREE43.Vector3().setFromMatrixPosition(meshes[0].matrixWorld) : new THREE43.Vector3;
const matrices = new Map;
- const bounds = new THREE42.Box3;
- const point = new THREE42.Vector3;
+ const bounds = new THREE43.Box3;
+ const point = new THREE43.Vector3;
for (const mesh of meshes) {
const matrix = mesh.matrixWorld.clone();
matrix.elements[12] -= origin.x;
@@ -27011,11 +27226,11 @@ function computationFrame(parts) {
bounds.expandByPoint(point);
}
}
- const size = bounds.getSize(new THREE42.Vector3);
+ const size = bounds.getSize(new THREE43.Vector3);
const scale = Math.hypot(size.x, size.y, size.z);
if (!Number.isFinite(scale))
throw new Error("CSG: combined operand extent must be finite");
- return { origin, center: bounds.getCenter(new THREE42.Vector3), scale: scale || 1, matrices };
+ return { origin, center: bounds.getCenter(new THREE43.Vector3), scale: scale || 1, matrices };
}
function retainNotes(target, notes) {
if (!Array.isArray(notes))
@@ -27095,7 +27310,7 @@ function threeToManifold(src, mod, label, context) {
else
context.missingUV.add(mesh.name || label);
}
- const point = new THREE42.Vector3;
+ const point = new THREE43.Vector3;
for (let i = 0;i < position.count; i++) {
point.fromBufferAttribute(position, i).applyMatrix4(context.frame.matrices.get(mesh)).sub(context.frame.center).divideScalar(context.frame.scale);
if (![point.x, point.y, point.z].every((n) => Number.isFinite(Math.fround(n))))
@@ -27238,11 +27453,11 @@ function solidMeshToGeometry({ mesh, collapsed }, opts = {}) {
if (uvs)
uvs.set(mesh.vertProperties.subarray(i + 3, i + 5), v * 2);
}
- const geometry = new THREE42.BufferGeometry;
- geometry.setAttribute("position", new THREE42.BufferAttribute(positions, 3));
- geometry.setIndex(new THREE42.BufferAttribute(new Uint32Array(mesh.triVerts), 1));
+ const geometry = new THREE43.BufferGeometry;
+ geometry.setAttribute("position", new THREE43.BufferAttribute(positions, 3));
+ geometry.setIndex(new THREE43.BufferAttribute(new Uint32Array(mesh.triVerts), 1));
if (uvs)
- geometry.setAttribute("uv", new THREE42.BufferAttribute(uvs, 2));
+ geometry.setAttribute("uv", new THREE43.BufferAttribute(uvs, 2));
const out = opts.smooth ? geometry : geometry.toNonIndexed();
out.computeVertexNormals();
if (opts.smooth && uvs) {
@@ -27273,7 +27488,7 @@ function firstMaterial(src) {
if (!material && mesh.isMesh)
material = Array.isArray(mesh.material) ? mesh.material[0] : mesh.material;
});
- return material ?? new THREE42.MeshStandardMaterial;
+ return material ?? new THREE43.MeshStandardMaterial;
}
function outputMesh(result, name, parts, opts, context, isHull) {
const materialized = materializeSolid(result);
@@ -27332,7 +27547,7 @@ function outputMesh(result, name, parts, opts, context, isHull) {
retainNotes(context.geometryWarnings, geometry.userData.kilnGeometryWarnings);
if (context.geometryWarnings.size)
geometry.userData.kilnGeometryWarnings = [...context.geometryWarnings.values()];
- const output = new THREE42.Mesh(geometry, context.preserve && !isHull && materials.length ? materials : firstMaterial(parts[0]));
+ const output = new THREE43.Mesh(geometry, context.preserve && !isHull && materials.length ? materials : firstMaterial(parts[0]));
output.name = `Mesh_${name}`;
output.position.copy(context.frame.origin);
return output;
@@ -27741,7 +27956,7 @@ function smoothUnionSpheres(point, spheres, blend) {
}
// src/organic.ts
-import * as THREE43 from "three";
+import * as THREE44 from "three";
function assertSafePathCount(name, count) {
if (!Number.isSafeInteger(count))
throw new Error(`${name} derived sample count must be a safe integer; reduce sample counts.`);
@@ -27773,8 +27988,8 @@ function catmullRomPath(controlPoints, samplesPerSpan = 8, closed = false) {
assertSafePathCount("catmullRomPath", spans * samplesPerSpan + 1);
if (controlPoints.some((p) => p.length !== 3 || !p.every(Number.isFinite)))
throw new Error("catmullRomPath control points must be finite [x,y,z] triples");
- const vectors = controlPoints.map((p) => new THREE43.Vector3(p[0], p[1], p[2]));
- const curve = new THREE43.CatmullRomCurve3(vectors, closed);
+ const vectors = controlPoints.map((p) => new THREE44.Vector3(p[0], p[1], p[2]));
+ const curve = new THREE44.CatmullRomCurve3(vectors, closed);
const points = curve.getPoints(spans * samplesPerSpan);
if (closed)
points.pop();
@@ -27828,8 +28043,8 @@ function spiralPath(options) {
throw new Error("spiralPath center must be a finite [x,y,z] triple");
if (axis.length !== 3 || forward.length !== 3 || ![...axis, ...forward].every(Number.isFinite))
throw new Error("spiralPath axis and forward must be finite [x,y,z] triples");
- const up = new THREE43.Vector3(...axis);
- const fwd = new THREE43.Vector3(...forward);
+ const up = new THREE44.Vector3(...axis);
+ const fwd = new THREE44.Vector3(...forward);
if (up.lengthSq() < 0.000000000001 || fwd.lengthSq() < 0.000000000001)
throw new Error("spiralPath axis and forward must be nonzero");
up.normalize();
@@ -27837,7 +28052,7 @@ function spiralPath(options) {
if (horiz.lengthSq() < 0.000000000001)
throw new Error("spiralPath forward must not be parallel to axis");
horiz.normalize();
- const right = new THREE43.Vector3().crossVectors(up, horiz).normalize();
+ const right = new THREE44.Vector3().crossVectors(up, horiz).normalize();
const out = [];
for (let i = 0;i <= samples; i++) {
const u = i / samples;
@@ -27951,7 +28166,7 @@ var init_seeded_random = __esm(() => {
});
// src/uv-shapes.ts
-import * as THREE44 from "three";
+import * as THREE45 from "three";
function remapUV(geo, options = {}) {
if (!options || typeof options !== "object" || Array.isArray(options) || Object.keys(options).some((key) => !["scale", "offset"].includes(key))) {
throw new Error("remapUV: options may contain only scale and offset.");
@@ -27980,7 +28195,7 @@ function remapUV(geo, options = {}) {
}
const cloned = geo.clone();
cloned.userData = structuredClone(geo.userData);
- cloned.setAttribute("uv", new THREE44.Float32BufferAttribute(values, 2));
+ cloned.setAttribute("uv", new THREE45.Float32BufferAttribute(values, 2));
if ((scale[0] !== 1 || scale[1] !== 1) && cloned.hasAttribute("tangent")) {
cloned.deleteAttribute("tangent");
const previous = cloned.userData.kilnAttributeWarnings;
@@ -27997,13 +28212,13 @@ function remapUV(geo, options = {}) {
var init_uv_shapes = () => {};
// src/texture-atlas.ts
-import * as THREE45 from "three";
+import * as THREE46 from "three";
async function textureAtlas(input, options = {}) {
const compiled = await compileTextureAtlasSpecV1(input, options);
- const texture = new THREE45.DataTexture(compiled.pixels, compiled.spec.width, compiled.spec.height, THREE45.RGBAFormat, THREE45.UnsignedByteType);
+ const texture = new THREE46.DataTexture(compiled.pixels, compiled.spec.width, compiled.spec.height, THREE46.RGBAFormat, THREE46.UnsignedByteType);
texture.name = "Atlas";
texture.flipY = false;
- texture.colorSpace = compiled.spec.usage === "albedo" || compiled.spec.usage === "emissive" ? THREE45.SRGBColorSpace : THREE45.NoColorSpace;
+ texture.colorSpace = compiled.spec.usage === "albedo" || compiled.spec.usage === "emissive" ? THREE46.SRGBColorSpace : THREE46.NoColorSpace;
applyPortableSamplerV1(texture, compiled.spec.sampler);
texture.userData.kilnAtlas = { spec: compiled.spec, manifest: compiled.manifest };
texture.userData.kilnTexture = {
@@ -28061,7 +28276,7 @@ function remapUVToAtlas(geometry, atlas, name, options) {
bytes += buffer.byteLength;
}
} else {
- bytes += attribute.array.byteLength * (attribute.constructor === THREE45.BufferAttribute || attribute.constructor === THREE45.InstancedBufferAttribute ? 1 : 2);
+ bytes += attribute.array.byteLength * (attribute.constructor === THREE46.BufferAttribute || attribute.constructor === THREE46.InstancedBufferAttribute ? 1 : 2);
}
};
for (const attr of Object.values(geometry.attributes))
@@ -28286,7 +28501,7 @@ var init_portable_material_runtime = __esm(() => {
});
// src/uv-data.ts
-import * as THREE46 from "three";
+import * as THREE47 from "three";
function validateAtlasRemap(mesh, inputIndex, sourceCount) {
const count = mesh.vertexCount;
if (!Number.isSafeInteger(count) || count < 1 || count > GEOMETRY_ALLOCATION_LIMITS.unwrapVertices)
@@ -28321,7 +28536,7 @@ function remapUnwrapAttribute(attribute, oldIndexes) {
for (let c = 0;c < attribute.itemSize; c++)
array[i * attribute.itemSize + c] = attribute.array[oldIndexes[i] * stride + offset + c];
}
- const output = attribute.isFloat16BufferAttribute ? new THREE46.Float16BufferAttribute(array, attribute.itemSize, attribute.normalized) : new THREE46.BufferAttribute(array, attribute.itemSize, attribute.normalized);
+ const output = attribute.isFloat16BufferAttribute ? new THREE47.Float16BufferAttribute(array, attribute.itemSize, attribute.normalized) : new THREE47.BufferAttribute(array, attribute.itemSize, attribute.normalized);
output.name = attribute.name;
output.setUsage(interleaved(attribute) ? attribute.data.usage : attribute.usage);
if (!interleaved(attribute))
@@ -28433,7 +28648,7 @@ var init_uv_data = __esm(() => {
});
// src/uv.ts
-import * as THREE47 from "three";
+import * as THREE48 from "three";
async function getXatlas() {
if (!_xatlasReady) {
_xatlasReady = (async () => {
@@ -28465,7 +28680,7 @@ async function autoUnwrap(geometry, opts = {}) {
if (result.atlasCount !== 1 || !Number.isSafeInteger(result.width) || result.width <= 0 || !Number.isSafeInteger(result.height) || result.height <= 0)
throw new Error("autoUnwrap: xatlas must return one valid atlas; multiple atlas pages are unsupported.");
const remap = validateAtlasRemap(mesh, prepared.index, geometry.getAttribute("position").count);
- const out = new THREE47.BufferGeometry;
+ const out = new THREE48.BufferGeometry;
for (const [name, attribute] of Object.entries(geometry.attributes)) {
if (name === "uv" || name === "tangent" || name === "normal" && !prepared.useNormals)
continue;
@@ -28475,8 +28690,8 @@ async function autoUnwrap(geometry, opts = {}) {
out.morphAttributes[name] = targets.map((attribute) => remapUnwrapAttribute(attribute, remap.oldIndexes));
}
out.morphTargetsRelative = geometry.morphTargetsRelative;
- out.setIndex(new THREE47.BufferAttribute(new Uint32Array(remap.index), 1));
- out.setAttribute("uv", new THREE47.BufferAttribute(new Float32Array(remap.uv), 2));
+ out.setIndex(new THREE48.BufferAttribute(new Uint32Array(remap.index), 1));
+ out.setAttribute("uv", new THREE48.BufferAttribute(new Float32Array(remap.uv), 2));
out.name = geometry.name;
out.groups = geometry.groups.map((group) => ({ ...group }));
out.setDrawRange(geometry.drawRange.start, geometry.drawRange.count);
@@ -28511,11 +28726,11 @@ function repairZeroNormals(geo) {
if (broken.size === 0)
return;
const acc = new Float32Array(normal.count * 3);
- const a = new THREE47.Vector3;
- const b = new THREE47.Vector3;
- const c = new THREE47.Vector3;
- const face = new THREE47.Vector3;
- const edge = new THREE47.Vector3;
+ const a = new THREE48.Vector3;
+ const b = new THREE48.Vector3;
+ const c = new THREE48.Vector3;
+ const face = new THREE48.Vector3;
+ const edge = new THREE48.Vector3;
for (let t = 0;t + 2 < index.count; t += 3) {
const tri = [index.getX(t), index.getX(t + 1), index.getX(t + 2)];
if (!tri.some((i) => broken.has(i)))
@@ -28551,7 +28766,7 @@ var init_uv = __esm(() => {
});
// src/uv-project.ts
-import * as THREE48 from "three";
+import * as THREE49 from "three";
function projectUV(geometry, options) {
if (!options || typeof options !== "object" || Array.isArray(options) || !["planar", "box", "cylindrical"].includes(options.projection) || Object.keys(options).some((key) => !["projection", "frame", "seamDegrees", "angularRange", "caps", "metersPerUnit"].includes(key)))
throw new Error("projectUV: select an explicit planar, box or cylindrical projection with documented options.");
@@ -28592,15 +28807,15 @@ function projectUV(geometry, options) {
throw new Error("projectUV: index contains an invalid vertex reference.");
}
const points = [];
- const bounds = new THREE48.Box3;
+ const bounds = new THREE49.Box3;
for (let i = 0;i < positions.count; i++) {
- const point = new THREE48.Vector3().fromBufferAttribute(positions, i).applyMatrix4(inverse);
+ const point = new THREE49.Vector3().fromBufferAttribute(positions, i).applyMatrix4(inverse);
if (![point.x, point.y, point.z].every(Number.isFinite))
throw new Error("projectUV: frame-local positions must be finite.");
points.push(point);
bounds.expandByPoint(point);
}
- const extent = bounds.getSize(new THREE48.Vector3);
+ const extent = bounds.getSize(new THREE49.Vector3);
const fit = (point, axis) => metric !== undefined ? point[axis] / metric : extent[axis] > 0 ? (point[axis] - bounds.min[axis]) / extent[axis] : 0.5;
const flip = (point, axis) => metric !== undefined ? -point[axis] / metric : 1 - fit(point, axis);
const outputUVs = new Float32Array(corners * 2);
@@ -28615,8 +28830,8 @@ function projectUV(geometry, options) {
if (metric !== undefined) {
uScale = fullWrap ? Math.max(1, Math.round(2 * Math.PI * radius / metric)) : sweep * radius / metric;
}
- const normal = new THREE48.Vector3;
- const edge = new THREE48.Vector3;
+ const normal = new THREE49.Vector3;
+ const edge = new THREE49.Vector3;
for (let i = 0;i < corners; i += 3) {
const triangle = [0, 1, 2].map((offset) => points[index ? index.getX(i + offset) : i + offset]);
normal.subVectors(triangle[1], triangle[0]).cross(edge.subVectors(triangle[2], triangle[0])).normalize();
@@ -28672,7 +28887,7 @@ function projectUV(geometry, options) {
const out = geometry.index ? geometry.toNonIndexed() : geometry.clone();
out.userData = structuredClone(geometry.userData);
out.setDrawRange(geometry.drawRange.start, geometry.drawRange.count);
- out.setAttribute("uv", new THREE48.Float32BufferAttribute(outputUVs, 2));
+ out.setAttribute("uv", new THREE49.Float32BufferAttribute(outputUVs, 2));
if (out.hasAttribute("tangent")) {
out.deleteAttribute("tangent");
const previous = out.userData.kilnAttributeWarnings;
@@ -28693,17 +28908,17 @@ var init_uv_project = __esm(() => {
});
// src/primitives.ts
-import * as THREE49 from "three";
+import * as THREE50 from "three";
function vectorToTuple(v) {
return [v.x, v.y, v.z];
}
function createRoot(name) {
- const root = new THREE49.Object3D;
+ const root = new THREE50.Object3D;
root.name = name;
return root;
}
function createPivot(name, position = [0, 0, 0], parent) {
- const pivot = new THREE49.Object3D;
+ const pivot = new THREE50.Object3D;
pivot.name = `Joint_${name}`;
pivot.position.set(...position);
if (parent)
@@ -28735,16 +28950,16 @@ function assertPartArgs(name, geometry2, material) {
}
function createPart(name, geometry2, material, options = {}) {
assertPartArgs(name, geometry2, material);
- const mesh = new THREE49.Mesh(geometry2, material);
+ const mesh = new THREE50.Mesh(geometry2, material);
mesh.name = `Mesh_${name}`;
if (options.position)
mesh.position.set(...options.position);
if (options.rotation)
- mesh.rotation.set(THREE49.MathUtils.degToRad(options.rotation[0]), THREE49.MathUtils.degToRad(options.rotation[1]), THREE49.MathUtils.degToRad(options.rotation[2]));
+ mesh.rotation.set(THREE50.MathUtils.degToRad(options.rotation[0]), THREE50.MathUtils.degToRad(options.rotation[1]), THREE50.MathUtils.degToRad(options.rotation[2]));
if (options.scale)
mesh.scale.set(...options.scale);
if (options.pivot) {
- const pivot = new THREE49.Object3D;
+ const pivot = new THREE50.Object3D;
pivot.name = `Joint_${name}`;
pivot.add(mesh);
mesh.position.set(0, 0, 0);
@@ -28767,7 +28982,7 @@ function capsuleGeo(radius, height, segments = 6) {
assertDimension("capsuleGeo height (straight middle length)", height, true);
assertDimension("capsuleGeo outer half-length", height / 2 + radius);
assertPrimitiveSegments("capsuleGeo segments", segments, 3);
- return new THREE49.CapsuleGeometry(radius, height, 2, segments);
+ return new THREE50.CapsuleGeometry(radius, height, 2, segments);
}
function capsuleXGeo(radius, length, segments = 6) {
const geo = capsuleGeo(radius, length, segments);
@@ -28786,7 +29001,7 @@ function cylinderGeo(radiusTop, radiusBottom, height, segments = 8) {
throw new RangeError("cylinderGeo requires at least one positive radius.");
assertDimension("cylinderGeo height", height);
assertPrimitiveSegments("cylinderGeo segments", segments, 3);
- return new THREE49.CylinderGeometry(radiusTop, radiusBottom, height, segments);
+ return new THREE50.CylinderGeometry(radiusTop, radiusBottom, height, segments);
}
function cylinderXGeo(radiusTop, radiusBottom, length, segments = 8) {
const geo = cylinderGeo(radiusTop, radiusBottom, length, segments);
@@ -28801,20 +29016,20 @@ function cylinderZGeo(radiusTop, radiusBottom, length, segments = 8) {
function boxGeo(width, height, depth) {
for (const [name, value] of Object.entries({ width, height, depth }))
assertDimension(`boxGeo ${name} (use planeGeo for a sheet)`, value);
- return new THREE49.BoxGeometry(width, height, depth);
+ return new THREE50.BoxGeometry(width, height, depth);
}
function sphereGeo(radius, widthSegments = 8, heightSegments = 6) {
assertDimension("sphereGeo radius", radius);
assertPrimitiveSegments("sphereGeo widthSegments", widthSegments, 3);
assertPrimitiveSegments("sphereGeo heightSegments", heightSegments, 2);
assertPrimitiveGrid("sphereGeo", widthSegments, heightSegments);
- return new THREE49.SphereGeometry(radius, widthSegments, heightSegments);
+ return new THREE50.SphereGeometry(radius, widthSegments, heightSegments);
}
function coneGeo(radius, height, segments = 8) {
assertDimension("coneGeo radius", radius);
assertDimension("coneGeo height", height);
assertPrimitiveSegments("coneGeo segments", segments, 3);
- return new THREE49.ConeGeometry(radius, height, segments);
+ return new THREE50.ConeGeometry(radius, height, segments);
}
function coneXGeo(radius, length, segments = 8) {
const geo = coneGeo(radius, length, segments);
@@ -28831,7 +29046,7 @@ function cylinderOnAxis(center, normal, radiusBottom, height, options = {}) {
const segments = options.segments ?? 8;
assertFiniteTriple("cylinderOnAxis center", center);
assertFiniteTriple("cylinderOnAxis normal", normal);
- const n = new THREE49.Vector3(normal[0], normal[1], normal[2]);
+ const n = new THREE50.Vector3(normal[0], normal[1], normal[2]);
const len = Math.hypot(...normal);
if (len < 0.000001) {
throw new Error(`cylinderOnAxis: normal must be a non-zero vector (got [${normal.join(",")}]).`);
@@ -28839,7 +29054,7 @@ function cylinderOnAxis(center, normal, radiusBottom, height, options = {}) {
const magnitude = Math.max(...normal.map(Math.abs));
n.set(normal[0] / magnitude, normal[1] / magnitude, normal[2] / magnitude).normalize();
const geo = cylinderGeo(radiusTop, radiusBottom, height, segments);
- const q = new THREE49.Quaternion().setFromUnitVectors(new THREE49.Vector3(0, 1, 0), n);
+ const q = new THREE50.Quaternion().setFromUnitVectors(new THREE50.Vector3(0, 1, 0), n);
geo.applyQuaternion(q);
geo.translate(center[0], center[1], center[2]);
return geo;
@@ -28861,7 +29076,7 @@ function torusGeo(radius, tube, radialSegments = 8, tubularSegments = 12) {
assertPrimitiveSegments("torusGeo radialSegments", radialSegments, 3);
assertPrimitiveSegments("torusGeo tubularSegments", tubularSegments, 3);
assertPrimitiveGrid("torusGeo", radialSegments, tubularSegments);
- return new THREE49.TorusGeometry(radius, tube, radialSegments, tubularSegments);
+ return new THREE50.TorusGeometry(radius, tube, radialSegments, tubularSegments);
}
function planeGeo(width, height, widthSegments = 1, heightSegments = 1) {
assertDimension("planeGeo width", width);
@@ -28869,14 +29084,14 @@ function planeGeo(width, height, widthSegments = 1, heightSegments = 1) {
assertPrimitiveSegments("planeGeo widthSegments", widthSegments, 1);
assertPrimitiveSegments("planeGeo heightSegments", heightSegments, 1);
assertPrimitiveGrid("planeGeo", widthSegments, heightSegments);
- return new THREE49.PlaneGeometry(width, height, widthSegments, heightSegments);
+ return new THREE50.PlaneGeometry(width, height, widthSegments, heightSegments);
}
function decalBox(width, height, depth = 0.01) {
assertDimension("decalBox width", width);
assertDimension("decalBox height", height);
assertDimension("decalBox depth", depth, true);
const d = Math.max(depth, 0.002);
- return new THREE49.BoxGeometry(width, height, d);
+ return new THREE50.BoxGeometry(width, height, d);
}
function validateCardFrame(name, width, height, yPivot) {
assertDimension(`${name} width`, width);
@@ -28890,7 +29105,7 @@ function foliageCardGeo(opts = {}) {
const h = opts.height ?? 1;
const yPivot = opts.yPivot ?? 0;
validateCardFrame("foliageCardGeo", w, h, yPivot);
- const geom = new THREE49.PlaneGeometry(w, h);
+ const geom = new THREE50.PlaneGeometry(w, h);
geom.translate(0, h * (0.5 - yPivot), 0);
geom.userData["kilnGeometryRole"] = "foliageCard";
return geom;
@@ -28906,12 +29121,12 @@ function crossedQuadsGeo(opts = {}) {
const geometries = [];
for (let i = 0;i < planes; i++) {
const angle = i / planes * Math.PI;
- const quad = new THREE49.PlaneGeometry(w, h);
+ const quad = new THREE50.PlaneGeometry(w, h);
quad.translate(0, h * (0.5 - yPivot), 0);
quad.rotateY(angle);
geometries.push(quad);
}
- const out = new THREE49.BufferGeometry;
+ const out = new THREE50.BufferGeometry;
const posCount = geometries.reduce((sum, g) => sum + (g.attributes.position?.count ?? 0), 0);
const positions = new Float32Array(posCount * 3);
const normals = new Float32Array(posCount * 3);
@@ -28938,9 +29153,9 @@ function crossedQuadsGeo(opts = {}) {
}
vOffset += p.count;
}
- out.setAttribute("position", new THREE49.BufferAttribute(positions, 3));
- out.setAttribute("normal", new THREE49.BufferAttribute(normals, 3));
- out.setAttribute("uv", new THREE49.BufferAttribute(uvs, 2));
+ out.setAttribute("position", new THREE50.BufferAttribute(positions, 3));
+ out.setAttribute("normal", new THREE50.BufferAttribute(normals, 3));
+ out.setAttribute("uv", new THREE50.BufferAttribute(uvs, 2));
out.setIndex(indices);
out.userData["kilnGeometryRole"] = "foliageCard";
return out;
@@ -28955,7 +29170,7 @@ function octaGridPlane(opts) {
const h = opts.height ?? 1;
const yPivot = opts.yPivot ?? 0;
validateCardFrame("octaGridPlane", w, h, yPivot);
- const geom = new THREE49.PlaneGeometry(w, h);
+ const geom = new THREE50.PlaneGeometry(w, h);
geom.translate(0, h * (0.5 - yPivot), 0);
const uv = geom.attributes.uv;
const du = 1 / opts.tilesX;
@@ -29051,8 +29266,8 @@ function wingGeo(options = {}) {
7,
6
];
- const geo = new THREE49.BufferGeometry;
- geo.setAttribute("position", new THREE49.BufferAttribute(vertices, 3));
+ const geo = new THREE50.BufferGeometry;
+ geo.setAttribute("position", new THREE50.BufferAttribute(vertices, 3));
geo.setIndex(tipChord === 0 ? [0, 1, 3, 4, 7, 5, 0, 2, 6, 0, 6, 4, 1, 5, 7, 1, 7, 3, 0, 4, 5, 0, 5, 1] : indices);
geo.computeVertexNormals();
return geo;
@@ -29083,17 +29298,17 @@ function createWingPair(name, material, options) {
};
}
function beamBetween(name, start, end, radius, material, options = {}) {
- const a = new THREE49.Vector3(...start);
- const b = new THREE49.Vector3(...end);
+ const a = new THREE50.Vector3(...start);
+ const b = new THREE50.Vector3(...end);
const direction = b.clone().sub(a);
const length = direction.length();
if (length <= 0.0001) {
throw new Error(`beamBetween("${name}"): start and end must be different points (got start=[${start.join(",")}], end=[${end.join(",")}], delta=${length.toExponential(2)}). Pick two distinct endpoints or switch to cylinderGeo with an explicit length + position.`);
}
- const mesh = new THREE49.Mesh(cylinderGeo(radius, radius, length, options.segments ?? 8), material);
+ const mesh = new THREE50.Mesh(cylinderGeo(radius, radius, length, options.segments ?? 8), material);
mesh.name = `Mesh_${name}`;
mesh.position.copy(a.add(b).multiplyScalar(0.5));
- mesh.quaternion.setFromUnitVectors(new THREE49.Vector3(0, 1, 0), direction.normalize());
+ mesh.quaternion.setFromUnitVectors(new THREE50.Vector3(0, 1, 0), direction.normalize());
if (options.parent)
options.parent.add(mesh);
return mesh;
@@ -29102,11 +29317,11 @@ function snapTo(part, host, options = {}) {
const overlap = options.overlap ?? 0.02;
part.updateWorldMatrix(true, true);
host.updateWorldMatrix(true, true);
- const a = new THREE49.Box3().setFromObject(part);
- const b = new THREE49.Box3().setFromObject(host);
+ const a = new THREE50.Box3().setFromObject(part);
+ const b = new THREE50.Box3().setFromObject(host);
if (a.isEmpty() || b.isEmpty())
return part;
- const delta = new THREE49.Vector3;
+ const delta = new THREE50.Vector3;
for (const axis of ["x", "y", "z"]) {
if (a.min[axis] > b.max[axis])
delta[axis] = b.max[axis] - a.min[axis];
@@ -29122,7 +29337,7 @@ function snapTo(part, host, options = {}) {
delta[dominant] = -overlap;
const parent = part.parent;
if (parent) {
- const p0 = new THREE49.Vector3;
+ const p0 = new THREE50.Vector3;
part.getWorldPosition(p0);
const p1 = p0.clone().add(delta);
const l0 = parent.worldToLocal(p0.clone());
@@ -29157,8 +29372,8 @@ function createLadder(name, options) {
throw new RangeError("createLadder rungCount must be an integer from 0 to 10000.");
if (widthAxis !== "x" && widthAxis !== "z")
throw new RangeError("createLadder widthAxis must be x or z.");
- const bottomVec = new THREE49.Vector3;
- const topVec = new THREE49.Vector3(...top).sub(new THREE49.Vector3(...bottom));
+ const bottomVec = new THREE50.Vector3;
+ const topVec = new THREE50.Vector3(...top).sub(new THREE50.Vector3(...bottom));
const length = Math.hypot(topVec.x, topVec.y, topVec.z);
assertDimension("createLadder endpoint distance", length);
if (length <= 0.0001)
@@ -29166,7 +29381,7 @@ function createLadder(name, options) {
const along = topVec.clone().divideScalar(length);
if (widthDirection !== undefined)
assertFiniteTriple("createLadder widthDirection", widthDirection);
- let across = widthDirection ? new THREE49.Vector3(...widthDirection) : widthAxis === "x" ? new THREE49.Vector3(1, 0, 0) : new THREE49.Vector3(0, 0, 1);
+ let across = widthDirection ? new THREE50.Vector3(...widthDirection) : widthAxis === "x" ? new THREE50.Vector3(1, 0, 0) : new THREE50.Vector3(0, 0, 1);
const largest = Math.max(Math.abs(across.x), Math.abs(across.y), Math.abs(across.z));
if (!largest)
throw new RangeError("createLadder widthDirection must be nonzero.");
@@ -29176,19 +29391,19 @@ function createLadder(name, options) {
if (widthDirection)
throw new RangeError("createLadder widthDirection must not be parallel to the endpoints.");
const axes = [
- new THREE49.Vector3(1, 0, 0),
- new THREE49.Vector3(0, 1, 0),
- new THREE49.Vector3(0, 0, 1)
+ new THREE50.Vector3(1, 0, 0),
+ new THREE50.Vector3(0, 1, 0),
+ new THREE50.Vector3(0, 0, 1)
];
across = axes.reduce((best, axis) => Math.abs(axis.dot(along)) < Math.abs(best.dot(along)) ? axis : best);
across.addScaledVector(along, -across.dot(along));
}
across.normalize();
const offset = across.clone().multiplyScalar(width / 2);
- const root = new THREE49.Object3D;
+ const root = new THREE50.Object3D;
root.name = name;
root.position.set(...bottom);
- const rotation = new THREE49.Quaternion().setFromRotationMatrix(new THREE49.Matrix4().makeBasis(across, along, across.clone().cross(along))).toArray();
+ const rotation = new THREE50.Quaternion().setFromRotationMatrix(new THREE50.Matrix4().makeBasis(across, along, across.clone().cross(along))).toArray();
stampSemanticMetadataV1(root, {
roles: ["ladder"],
frames: [
@@ -29228,7 +29443,7 @@ function wallWithOpening(name, material, options) {
if (opening && openings)
throw new TypeError("wallWithOpening: use opening or openings, not both.");
const built = buildWallPanels(length, height, thickness, openings ?? (opening ? [opening] : []));
- const group = new THREE49.Object3D;
+ const group = new THREE50.Object3D;
group.name = name;
const panel = (suffix, lenStart, lenEnd, yLo, yHi) => {
const segLen = lenEnd - lenStart;
@@ -29259,7 +29474,7 @@ function room(name, material, options = {}) {
parent
} = options;
const openings = options.openings ?? [{ wall: "front", kind: "door" }];
- const root = new THREE49.Object3D;
+ const root = new THREE50.Object3D;
root.name = name;
const wall = (suffix, len, axis, pos, which) => {
const w = wallWithOpening(`${name}_Wall${suffix}`, material, {
@@ -29313,7 +29528,7 @@ function createStairs(name, material, options) {
if (Math.abs(totalRise) < 0.0001 || Math.abs(totalRun) < 0.0001) {
throw new Error(`createStairs("${name}"): totalRise and totalRun must be non-zero (got rise=${totalRise}, run=${totalRun}).`);
}
- const root = new THREE49.Object3D;
+ const root = new THREE50.Object3D;
root.name = name;
const stepRise = totalRise / steps;
const stepRun = totalRun / steps;
@@ -29343,7 +29558,7 @@ function requireColor(color, fn) {
}
function gameMaterial(color, options = {}) {
requireColor(color, "gameMaterial");
- const material = new THREE49.MeshStandardMaterial({
+ const material = new THREE50.MeshStandardMaterial({
color,
metalness: options.metalness ?? 0,
roughness: options.roughness ?? 0.8,
@@ -29357,7 +29572,7 @@ function gameMaterial(color, options = {}) {
}
function basicMaterial(color, options = {}) {
requireColor(color, "basicMaterial");
- const material = new THREE49.MeshBasicMaterial({
+ const material = new THREE50.MeshBasicMaterial({
color,
transparent: options.transparent ?? false,
opacity: options.opacity ?? 1
@@ -29368,13 +29583,13 @@ function basicMaterial(color, options = {}) {
}
function glassMaterial(color, options = {}) {
requireColor(color, "glassMaterial");
- const material = new THREE49.MeshStandardMaterial({
+ const material = new THREE50.MeshStandardMaterial({
color,
transparent: true,
opacity: options.opacity ?? 0.35,
roughness: options.roughness ?? 0.1,
metalness: options.metalness ?? 0,
- side: THREE49.DoubleSide
+ side: THREE50.DoubleSide
});
if (options.name !== undefined)
material.name = assertMaterialName(options.name, "glassMaterial");
@@ -29382,7 +29597,7 @@ function glassMaterial(color, options = {}) {
}
function lambertMaterial(color, options = {}) {
requireColor(color, "lambertMaterial");
- const material = new THREE49.MeshLambertMaterial({
+ const material = new THREE50.MeshLambertMaterial({
color,
flatShading: options.flatShading ?? true,
emissive: options.emissive ?? 0
@@ -29395,12 +29610,12 @@ function threeInterpolation(mode) {
if (mode !== undefined && !TRACK_INTERPOLATIONS.includes(mode)) {
throw new Error(`Animation interpolation must be one of ${TRACK_INTERPOLATIONS.join(", ")}.`);
}
- return mode === "STEP" ? THREE49.InterpolateDiscrete : THREE49.InterpolateLinear;
+ return mode === "STEP" ? THREE50.InterpolateDiscrete : THREE50.InterpolateLinear;
}
function interpolatedTrack(Type, name, times, values, interpolation) {
if (!isCubicInterpolation(interpolation))
return new Type(name, times, values, threeInterpolation(interpolation));
- const quaternion = Type === THREE49.QuaternionKeyframeTrack;
+ const quaternion = Type === THREE50.QuaternionKeyframeTrack;
return useCubicSpline(new Type(name, times, cubicSplineValues(times, values, quaternion ? 4 : 3, interpolation, quaternion)));
}
function animationNumber(value, label) {
@@ -29454,15 +29669,15 @@ function rotationTrack(jointName, keyframes, interpolation) {
animationKeys(jointName, keyframes, "rotation", interpolation);
const times = [];
const values = [];
- const euler = new THREE49.Euler;
- const quat = new THREE49.Quaternion;
+ const euler = new THREE50.Euler;
+ const quat = new THREE50.Quaternion;
for (const kf of keyframes) {
times.push(kf.time);
- euler.set(THREE49.MathUtils.degToRad(kf.rotation[0]), THREE49.MathUtils.degToRad(kf.rotation[1]), THREE49.MathUtils.degToRad(kf.rotation[2]));
+ euler.set(THREE50.MathUtils.degToRad(kf.rotation[0]), THREE50.MathUtils.degToRad(kf.rotation[1]), THREE50.MathUtils.degToRad(kf.rotation[2]));
quat.setFromEuler(euler);
values.push(quat.x, quat.y, quat.z, quat.w);
}
- return interpolatedTrack(THREE49.QuaternionKeyframeTrack, `${jointName}.quaternion`, times, values, interpolation);
+ return interpolatedTrack(THREE50.QuaternionKeyframeTrack, `${jointName}.quaternion`, times, values, interpolation);
}
function positionTrack(jointName, keyframes, interpolation) {
animationKeys(jointName, keyframes, "position", interpolation);
@@ -29472,7 +29687,7 @@ function positionTrack(jointName, keyframes, interpolation) {
times.push(kf.time);
values.push(...kf.position);
}
- return interpolatedTrack(THREE49.VectorKeyframeTrack, `${jointName}.position`, times, values, interpolation);
+ return interpolatedTrack(THREE50.VectorKeyframeTrack, `${jointName}.position`, times, values, interpolation);
}
function scaleTrack(jointName, keyframes, interpolation) {
animationKeys(jointName, keyframes, "scale", interpolation);
@@ -29482,7 +29697,7 @@ function scaleTrack(jointName, keyframes, interpolation) {
times.push(kf.time);
values.push(...kf.scale);
}
- return interpolatedTrack(THREE49.VectorKeyframeTrack, `${jointName}.scale`, times, values, interpolation);
+ return interpolatedTrack(THREE50.VectorKeyframeTrack, `${jointName}.scale`, times, values, interpolation);
}
function createClip(name, duration, tracks, options) {
if (typeof name !== "string" || !name.trim())
@@ -29495,7 +29710,7 @@ function createClip(name, duration, tracks, options) {
const loop = clipLoopOption(options);
const names = new Set;
for (const track of tracks) {
- if (!(track instanceof THREE49.KeyframeTrack))
+ if (!(track instanceof THREE50.KeyframeTrack))
throw new Error("Animation clip tracks must be KeyframeTrack instances.");
if (typeof track.name !== "string")
throw new Error("Animation track target/channel must use a string name.");
@@ -29509,12 +29724,12 @@ function createClip(name, duration, tracks, options) {
throw new Error(`Duplicate animation target/channel: ${track.name}.`);
names.add(track.name);
const quaternion = channel === "quaternion";
- const Type = quaternion ? THREE49.QuaternionKeyframeTrack : THREE49.VectorKeyframeTrack;
+ const Type = quaternion ? THREE50.QuaternionKeyframeTrack : THREE50.VectorKeyframeTrack;
if (!(track instanceof Type))
throw new Error(`Animation channel ${channel} requires ${quaternion ? "QuaternionKeyframeTrack" : "VectorKeyframeTrack"}.`);
const cubic = isCubicSplineTrack(track);
const mode = track.getInterpolation();
- if (!cubic && mode !== THREE49.InterpolateLinear && mode !== THREE49.InterpolateDiscrete) {
+ if (!cubic && mode !== THREE50.InterpolateLinear && mode !== THREE50.InterpolateDiscrete) {
throw new Error("Animation interpolation must be LINEAR, STEP or CUBICSPLINE (the glTF sampler modes); three.js smooth and Bezier interpolants have no glTF form.");
}
animationTimes(track.times, track.name);
@@ -29537,7 +29752,7 @@ function createClip(name, duration, tracks, options) {
throw new Error(`Animation clip duration ${duration} does not include every key of ${track.name}.`);
}
}
- const clip = new THREE49.AnimationClip(name, duration, tracks);
+ const clip = new THREE50.AnimationClip(name, duration, tracks);
if (loop !== undefined)
clip.userData.kilnLoopIntent = loop ? "loop" : "once";
return clip;
@@ -29614,12 +29829,12 @@ function createInstance(name, source, options = {}) {
if (!sourceMesh) {
throw new Error(`createInstance("${name}"): source "${source.name}" has no Mesh to clone from`);
}
- const mesh = new THREE49.Mesh(sourceMesh.geometry, sourceMesh.material);
+ const mesh = new THREE50.Mesh(sourceMesh.geometry, sourceMesh.material);
mesh.name = `Mesh_${name}`;
if (options.position)
mesh.position.set(...options.position);
if (options.rotation)
- mesh.rotation.set(THREE49.MathUtils.degToRad(options.rotation[0]), THREE49.MathUtils.degToRad(options.rotation[1]), THREE49.MathUtils.degToRad(options.rotation[2]));
+ mesh.rotation.set(THREE50.MathUtils.degToRad(options.rotation[0]), THREE50.MathUtils.degToRad(options.rotation[1]), THREE50.MathUtils.degToRad(options.rotation[2]));
if (options.scale)
mesh.scale.set(...options.scale);
if (options.parent)
@@ -29912,7 +30127,7 @@ function buildSandboxGlobals(usage, options = {}) {
getJointNames: wrap("getJointNames", getJointNames),
materialBudgetAdvisory: wrap("materialBudgetAdvisory", materialBudgetAdvisory),
seededRandom: wrap("seededRandom", seededRandom),
- THREE: THREE49,
+ THREE: THREE50,
Math,
console: options.console ?? console
};
@@ -30055,7 +30270,7 @@ import {
PropertyType as PropertyType4
} from "@gltf-transform/core";
import { createTransform, dequantizePrimitive, joinPrimitives } from "@gltf-transform/functions";
-import * as THREE50 from "three";
+import * as THREE51 from "three";
function isSingular(matrix) {
const e = matrix.elements;
const scale = Math.hypot(e[0], e[1], e[2]) * Math.hypot(e[4], e[5], e[6]) * Math.hypot(e[8], e[9], e[10]);
@@ -30173,10 +30388,10 @@ function reverseWinding(prim) {
}
}
function bake(prim, matrix) {
- const linear = new THREE50.Matrix3().setFromMatrix4(matrix);
- const normalMatrix = new THREE50.Matrix3().getNormalMatrix(matrix);
+ const linear = new THREE51.Matrix3().setFromMatrix4(matrix);
+ const normalMatrix = new THREE51.Matrix3().getNormalMatrix(matrix);
const mirrored = matrix.determinant() < 0;
- const v = new THREE50.Vector3;
+ const v = new THREE51.Vector3;
const each = (semantic, apply) => {
const attribute = prim.getAttribute(semantic);
const element = [];
@@ -30200,7 +30415,7 @@ function destinationOf(entries) {
let best = Infinity;
let bestScale = Infinity;
for (const { node } of entries) {
- const linear = new THREE50.Matrix3().setFromMatrix4(worldOf(node));
+ const linear = new THREE51.Matrix3().setFromMatrix4(worldOf(node));
const norm = Math.hypot(...linear.elements);
const inverseNorm = Math.hypot(...linear.clone().invert().elements);
const condition = norm * inverseNorm;
@@ -30214,9 +30429,9 @@ function destinationOf(entries) {
return chosen;
}
function checkPositionPrecision(input, output, sourceWorld, destinationWorld, reversed) {
- const expected = new THREE50.Vector3;
- const actual = new THREE50.Vector3;
- const bounds = new THREE50.Box3;
+ const expected = new THREE51.Vector3;
+ const actual = new THREE51.Vector3;
+ const bounds = new THREE51.Box3;
const element = [];
let error = 0;
let magnitude = 0;
@@ -30537,7 +30752,7 @@ function rigidMerge(options = {}, onSummary) {
onSummary?.(summary);
});
}
-var JOINT_PIVOT, RESTART_MODES, BAKED, MAX_VERTICES = 65534, MAX_BYTES_PER_SAVED_DRAW = 4096, hasKeys = (value) => Object.keys(value).length > 0, worldOf = (node) => new THREE50.Matrix4().fromArray(node.getWorldMatrix()), nodeUsers = (mesh) => mesh.listParents().filter((parent) => parent.propertyType === PropertyType4.NODE).length, accessorsOf = (prim) => {
+var JOINT_PIVOT, RESTART_MODES, BAKED, MAX_VERTICES = 65534, MAX_BYTES_PER_SAVED_DRAW = 4096, hasKeys = (value) => Object.keys(value).length > 0, worldOf = (node) => new THREE51.Matrix4().fromArray(node.getWorldMatrix()), nodeUsers = (mesh) => mesh.listParents().filter((parent) => parent.propertyType === PropertyType4.NODE).length, accessorsOf = (prim) => {
const indices = prim.getIndices();
return indices ? [...prim.listAttributes(), indices] : prim.listAttributes();
}, primitiveBytes = (primitives) => [...new Set(primitives.flatMap(accessorsOf))].reduce((sum, a) => sum + (a.getArray()?.byteLength ?? 0), 0), countPrimitives = (nodes) => [...nodes].reduce((sum, node) => sum + (node.getMesh()?.listPrimitives().length ?? 0), 0);
@@ -33077,7 +33292,7 @@ var init_kit = __esm(() => {
// src/texture-bake.ts
import { createHash as createHash6 } from "node:crypto";
-import * as THREE51 from "three";
+import * as THREE52 from "three";
function readPixels(texture) {
const image = texture.image;
if (!image)
@@ -33204,7 +33419,7 @@ async function bakeSceneTextures(root, warnings) {
mime: "image/png",
bytes
};
- const colorSpace = entry.texture.colorSpace === THREE51.SRGBColorSpace ? "srgb" : "linear";
+ const colorSpace = entry.texture.colorSpace === THREE52.SRGBColorSpace ? "srgb" : "linear";
const recipe = entry.texture.userData["kilnProcedural"];
const primaryUsage = atlasRecord?.spec.usage ?? recipe?.usage ?? (entry.bindings.some(({ slot }) => slot === "roughnessMap") && entry.bindings.some(({ slot }) => slot === "metalnessMap") ? "metallicRoughness" : entry.bindings[0]?.usage ?? "albedo");
if (!encoded)
@@ -33287,10 +33502,10 @@ function computeTangentBasis(geometry) {
}
}
const out = new Float32Array(vertexCount * 4);
- const n = new THREE51.Vector3;
- const t = new THREE51.Vector3;
- const tmp = new THREE51.Vector3;
- const tmp2 = new THREE51.Vector3;
+ const n = new THREE52.Vector3;
+ const t = new THREE52.Vector3;
+ const tmp = new THREE52.Vector3;
+ const tmp2 = new THREE52.Vector3;
for (let v = 0;v < vertexCount; v++) {
n.set(normal.getX(v), normal.getY(v), normal.getZ(v));
t.set(tan1[v * 3], tan1[v * 3 + 1], tan1[v * 3 + 2]);
@@ -33310,7 +33525,7 @@ function computeTangentBasis(geometry) {
out[v * 4 + 2] = tmp.z;
out[v * 4 + 3] = w;
}
- geometry.setAttribute("tangent", new THREE51.BufferAttribute(out, 4));
+ geometry.setAttribute("tangent", new THREE52.BufferAttribute(out, 4));
}
function ensureNormalMapTangents(root, warnings) {
let count = 0;
@@ -33548,7 +33763,7 @@ import {
KHRTextureBasisu as KHRTextureBasisu2
} from "@gltf-transform/extensions";
import { cloneDocument, dedup, prune, quantize, reorder } from "@gltf-transform/functions";
-import * as THREE52 from "three";
+import * as THREE53 from "three";
function meshSignature(mesh, ids) {
const id = (property) => {
if (!property)
@@ -33696,8 +33911,8 @@ function isCoreMaterialUse(parent) {
return parent.propertyType === PropertyType5.MATERIAL;
}
function decomposeDelta(before, after) {
- const delta = new THREE52.Matrix4().fromArray(before).invert().multiply(new THREE52.Matrix4().fromArray(after));
- const position = new THREE52.Vector3, quaternion = new THREE52.Quaternion, scale = new THREE52.Vector3;
+ const delta = new THREE53.Matrix4().fromArray(before).invert().multiply(new THREE53.Matrix4().fromArray(after));
+ const position = new THREE53.Vector3, quaternion = new THREE53.Quaternion, scale = new THREE53.Vector3;
delta.decompose(position, quaternion, scale);
return {
scale: scale.x,
@@ -33725,12 +33940,12 @@ function positionGridSteps(doc, bits) {
if (level.propertyType === PropertyType5.NODE)
lodBase.set(level, node);
const world = (node) => {
- const matrix = new THREE52.Matrix4().fromArray(node.getWorldMatrix());
+ const matrix = new THREE53.Matrix4().fromArray(node.getWorldMatrix());
let top = node;
while (top.getParentNode())
top = top.getParentNode();
const placed = lodBase.get(top)?.getParentNode();
- return placed ? new THREE52.Matrix4().fromArray(placed.getWorldMatrix()).multiply(matrix) : matrix;
+ return placed ? new THREE53.Matrix4().fromArray(placed.getWorldMatrix()).multiply(matrix) : matrix;
};
const halfExtent = (mesh) => {
const min = [Infinity, Infinity, Infinity];
@@ -33878,7 +34093,7 @@ async function deliverRuntimeThreeGlb(bytes, meshoptEncoder, options = {}, layou
const original = matrices.get(node);
const moved = original === undefined;
const split = moved || proxyNodes.has(node);
- const reference = moved ? new THREE52.Matrix4().identity().toArray() : original;
+ const reference = moved ? new THREE53.Matrix4().identity().toArray() : original;
const current = [...node.getMatrix()];
const { scale, offset } = decomposeDelta(reference, current);
if (!moved && Math.abs(scale - 1) < 0.000000000001 && offset.every((v) => v === 0))
@@ -34074,13 +34289,13 @@ var init_exporter_node = __esm(() => {
});
// src/views/character.ts
-import * as THREE53 from "three";
-function rounded(value) {
+import * as THREE54 from "three";
+function rounded2(value) {
const result = Math.round(value * 1e9) / 1e9;
return Object.is(result, -0) ? 0 : result;
}
function tuple5(vector) {
- return [rounded(vector.x), rounded(vector.y), rounded(vector.z)];
+ return [rounded2(vector.x), rounded2(vector.y), rounded2(vector.z)];
}
function chainIdFor(descriptor, byRole) {
if (AXIAL_ROLES.has(descriptor.role))
@@ -34116,9 +34331,9 @@ function buildCharacterDiagnosticDescriptor(root, findings = []) {
const invalidPaths = new Set(invalidFindingNodePaths);
const joints = evidence.map((joint) => {
const relative = rootInverse.clone().multiply(joint.node.matrixWorld);
- const position = new THREE53.Vector3().setFromMatrixPosition(relative);
- const forward = new THREE53.Vector3(...joint.descriptor.localForwardAxis).transformDirection(relative).multiplyScalar(0.2).add(position);
- const bend = new THREE53.Vector3(...joint.descriptor.localBendAxis).transformDirection(relative).multiplyScalar(0.2).add(position);
+ const position = new THREE54.Vector3().setFromMatrixPosition(relative);
+ const forward = new THREE54.Vector3(...joint.descriptor.localForwardAxis).transformDirection(relative).multiplyScalar(0.2).add(position);
+ const bend = new THREE54.Vector3(...joint.descriptor.localBendAxis).transformDirection(relative).multiplyScalar(0.2).add(position);
const chainId = chainIdFor(joint.descriptor, descriptorByRole);
return {
role: joint.descriptor.role,
@@ -35530,7 +35745,7 @@ function prepareTriangleCoverage(ax, ay, bx, by, cx, cy, size) {
}
// src/views/raster.ts
-import { Vector3 as Vector339 } from "three";
+import { Vector3 as Vector340 } from "three";
function orbitDir(azimuthDeg, elevationDeg) {
const el = Math.min(MAX_ELEVATION_DEG, Math.max(MIN_ELEVATION_DEG, elevationDeg)) * Math.PI / 180;
const az = azimuthDeg * Math.PI / 180;
@@ -35565,7 +35780,7 @@ function updateSurfaceMatrices(root) {
function surfaceVertexReader(mesh, position) {
for (const bone of mesh.skeleton?.bones ?? [])
bone.updateWorldMatrix?.(true, false);
- const vertex = new Vector339;
+ const vertex = new Vector340;
if (mesh.getVertexPosition)
return (index) => mesh.getVertexPosition(index, vertex);
if (position.getX && position.getY && position.getZ)
@@ -35975,7 +36190,7 @@ function cloneReviewScene(root, options = {}) {
var init_scene_copy = () => {};
// src/views/camera.ts
-import { Vector3 as Vector340, Matrix4 as Matrix417, Euler as Euler5, Group as Group4 } from "three";
+import { Vector3 as Vector341, Matrix4 as Matrix417, Euler as Euler5, Group as Group4 } from "three";
function strict(value, keys, label) {
for (const key of Object.keys(value))
if (!keys.includes(key)) {
@@ -36069,14 +36284,14 @@ function cameraFromBounds(bounds, dir, padding = 1, up, sceneBounds = bounds) {
const z = vec(dir).normalize();
if (!z.length())
throw new Error("camera direction must be non-zero");
- const hint = up ? vec(up) : Math.abs(z.y) > 0.99 ? new Vector340(0, 0, -1) : new Vector340(0, 1, 0);
+ const hint = up ? vec(up) : Math.abs(z.y) > 0.99 ? new Vector341(0, 0, -1) : new Vector341(0, 1, 0);
const x = hint.clone().cross(z).normalize();
if (x.length() < 0.000000001)
throw new Error("camera up must not be collinear with view");
const y = z.clone().cross(x);
let extent = 0.000001;
for (let i = 0;i < 8; i++) {
- const p = new Vector340((i & 1 ? bounds.max : bounds.min)[0], (i & 2 ? bounds.max : bounds.min)[1], (i & 4 ? bounds.max : bounds.min)[2]).sub(target);
+ const p = new Vector341((i & 1 ? bounds.max : bounds.min)[0], (i & 2 ? bounds.max : bounds.min)[1], (i & 4 ? bounds.max : bounds.min)[2]).sub(target);
extent = Math.max(extent, Math.abs(p.dot(x)), Math.abs(p.dot(y)));
}
const depthMin = bounds.min.map((v, i) => Math.min(v, sceneBounds.min[i]));
@@ -36157,7 +36372,7 @@ function resolveAssetCamera(root, shot = {}) {
if (relative !== "world") {
const node = relative === "part" ? selected.node : rootNode;
dir.transformDirection(node.matrixWorld);
- up = tuple6(new Vector340(0, 1, 0).transformDirection(node.matrixWorld));
+ up = tuple6(new Vector341(0, 1, 0).transformDirection(node.matrixWorld));
}
camera = cameraFromBounds(bounds, tuple6(dir), request.padding ?? 1.2, up, measureBounds(root));
} else if (request.type === "explicit") {
@@ -36204,7 +36419,7 @@ function resolveAssetCamera(root, shot = {}) {
const position = vec(triple2(request.position, "position")).applyMatrix4(matrix);
const target = request.target ? vec(triple2(request.target, "target")).applyMatrix4(matrix) : vec(bounds.min).add(vec(bounds.max)).multiplyScalar(0.5);
const up = vec(triple2(request.up ?? [0, 1, 0], "up")).transformDirection(matrix);
- const offset = vec(triple2(request.targetOffset ?? [0, 0, 0], "targetOffset")).applyMatrix4(matrix).sub(new Vector340().setFromMatrixPosition(matrix));
+ const offset = vec(triple2(request.targetOffset ?? [0, 0, 0], "targetOffset")).applyMatrix4(matrix).sub(new Vector341().setFromMatrixPosition(matrix));
const radius = vec(bounds.max).sub(vec(bounds.min)).length();
camera = {
version: "kiln.camera.v1",
@@ -36333,11 +36548,11 @@ function rasterizeCamera(root, input, size = 384, backfaceCull = true, backdrop)
}
return result;
};
- const key = new Vector340(1.5, 2, 1).normalize();
+ const key = new Vector341(1.5, 2, 1).normalize();
const srgb = (n) => n <= 0.0031308 ? n * 12.92 : 1.055 * n ** (1 / 2.4) - 0.055;
const ordered = compositingOrder(collectTriangles(root).tris, (px, py, pz) => camera.projection === "perspective" ? Math.hypot(px - position.x, py - position.y, pz - position.z) : (position.x - px) * z.x + (position.y - py) * z.y + (position.z - pz) * z.z);
for (const tri of ordered) {
- const world = [0, 1, 2].map((i) => new Vector340(tri.v[i * 3], tri.v[i * 3 + 1], tri.v[i * 3 + 2]));
+ const world = [0, 1, 2].map((i) => new Vector341(tri.v[i * 3], tri.v[i * 3 + 1], tri.v[i * 3 + 2]));
const normal = world[1].clone().sub(world[0]).cross(world[2].clone().sub(world[0])).normalize().multiplyScalar(tri.windingParity);
const normalSign = visibleNormalSign(normal.dot(camera.projection === "perspective" ? position.clone().sub(world[0]) : z), tri.side, backfaceCull);
if (normalSign === 0)
@@ -36348,7 +36563,7 @@ function rasterizeCamera(root, input, size = 384, backfaceCull = true, backdrop)
const color = tri.color.map((c) => Math.round(srgb(c * light) * 255));
let polygon = world.map((p) => {
const d = p.clone().sub(position);
- return new Vector340(d.dot(x), d.dot(y), -d.dot(z));
+ return new Vector341(d.dot(x), d.dot(y), -d.dot(z));
});
polygon = clip(clip(polygon, camera.near, true), camera.far, false);
for (let t = 1;t < polygon.length - 1; t++) {
@@ -36380,7 +36595,7 @@ function rasterizeCamera(root, input, size = 384, backfaceCull = true, backdrop)
}
return out;
}
-var vec = (a) => new Vector340(...a), tuple6 = (v) => [v.x || 0, v.y || 0, v.z || 0], KEY_HINTS;
+var vec = (a) => new Vector341(...a), tuple6 = (v) => [v.x || 0, v.y || 0, v.z || 0], KEY_HINTS;
var init_camera = __esm(() => {
init_raster();
init_background();
@@ -37151,7 +37366,7 @@ import {
PropertyBinding as PropertyBinding3,
VectorKeyframeTrack as VectorKeyframeTrack2,
Quaternion as Quaternion20,
- Vector3 as Vector341,
+ Vector3 as Vector342,
InterpolateDiscrete as InterpolateDiscrete2,
InterpolateLinear as InterpolateLinear2
} from "three";
@@ -37335,7 +37550,7 @@ function instanceMatrices(node) {
translations?.getElement(index, translation);
rotations?.getElement(index, rotation);
scales?.getElement(index, scale);
- const local = new Matrix418().compose(new Vector341(translations ? translation[0] : 0, translations ? translation[1] : 0, translations ? translation[2] : 0), new Quaternion20(rotations ? rotation[0] : 0, rotations ? rotation[1] : 0, rotations ? rotation[2] : 0, rotations ? rotation[3] : 1).normalize(), new Vector341(scales ? scale[0] : 1, scales ? scale[1] : 1, scales ? scale[2] : 1));
+ const local = new Matrix418().compose(new Vector342(translations ? translation[0] : 0, translations ? translation[1] : 0, translations ? translation[2] : 0), new Quaternion20(rotations ? rotation[0] : 0, rotations ? rotation[1] : 0, rotations ? rotation[2] : 0, rotations ? rotation[3] : 1).normalize(), new Vector342(scales ? scale[0] : 1, scales ? scale[1] : 1, scales ? scale[2] : 1));
matrices.push(world.clone().multiply(local));
}
return { matrices, count };
@@ -37442,7 +37657,7 @@ function localInstanceMatrices(node) {
translations?.getElement(index, translation);
rotations?.getElement(index, rotation);
scales?.getElement(index, scale);
- return new Matrix418().compose(new Vector341(...translations ? translation.slice(0, 3) : [0, 0, 0]), new Quaternion20(...rotations ? rotation.slice(0, 4) : [0, 0, 0, 1]).normalize(), new Vector341(...scales ? scale.slice(0, 3) : [1, 1, 1]));
+ return new Matrix418().compose(new Vector342(...translations ? translation.slice(0, 3) : [0, 0, 0]), new Quaternion20(...rotations ? rotation.slice(0, 4) : [0, 0, 0, 1]).normalize(), new Vector342(...scales ? scale.slice(0, 3) : [1, 1, 1]));
});
}
async function loadGlbReviewScene(bytes) {
@@ -38247,7 +38462,7 @@ var init_renderer_id = __esm(() => {
});
// src/views/scene-raster.ts
-import * as THREE54 from "three";
+import * as THREE55 from "three";
var DEG2;
var init_scene_raster = __esm(() => {
init_evaluator();
@@ -38259,18 +38474,18 @@ var init_scene_raster = __esm(() => {
});
// src/views/vehicle.ts
-import * as THREE55 from "three";
+import * as THREE56 from "three";
function hasRole2(node, prefix) {
return readSemanticMetadataV1(node)?.roles.some((role) => role === prefix || role.startsWith(`${prefix}.`)) ?? false;
}
function chassisBounds(root, inverse) {
- const bounds = new THREE55.Box3;
+ const bounds = new THREE56.Box3;
let found = false;
root.traverse((node) => {
if (!hasRole2(node, "chassis"))
return;
node.traverse((part) => {
- if (!(part instanceof THREE55.Mesh) || !(part.geometry instanceof THREE55.BufferGeometry))
+ if (!(part instanceof THREE56.Mesh) || !(part.geometry instanceof THREE56.BufferGeometry))
return;
part.geometry.computeBoundingBox();
const box = part.geometry.boundingBox;
@@ -38280,7 +38495,7 @@ function chassisBounds(root, inverse) {
for (const x of [box.min.x, box.max.x])
for (const y of [box.min.y, box.max.y])
for (const z of [box.min.z, box.max.z]) {
- bounds.expandByPoint(new THREE55.Vector3(x, y, z).applyMatrix4(matrix));
+ bounds.expandByPoint(new THREE56.Vector3(x, y, z).applyMatrix4(matrix));
found = true;
}
});
@@ -38348,33 +38563,33 @@ function tagDiagnostic(node, role) {
stampSemanticMetadataV1(node, { roles: [role] });
}
function rod(name, start, end, radius, color, role) {
- const from = new THREE55.Vector3(...start);
- const to = new THREE55.Vector3(...end);
+ const from = new THREE56.Vector3(...start);
+ const to = new THREE56.Vector3(...end);
const direction = to.clone().sub(from);
const length = direction.length();
- const geometry = length > 0.000000001 ? new THREE55.CylinderGeometry(radius, radius, length, 8) : new THREE55.SphereGeometry(radius, 8, 6);
- const result = new THREE55.Mesh(geometry, new THREE55.MeshBasicMaterial({ color }));
+ const geometry = length > 0.000000001 ? new THREE56.CylinderGeometry(radius, radius, length, 8) : new THREE56.SphereGeometry(radius, 8, 6);
+ const result = new THREE56.Mesh(geometry, new THREE56.MeshBasicMaterial({ color }));
result.name = name;
result.position.copy(from).add(to).multiplyScalar(0.5);
if (length > 0.000000001) {
- result.quaternion.setFromUnitVectors(new THREE55.Vector3(0, 1, 0), direction.multiplyScalar(1 / length));
+ result.quaternion.setFromUnitVectors(new THREE56.Vector3(0, 1, 0), direction.multiplyScalar(1 / length));
}
tagDiagnostic(result, role);
return result;
}
function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagnostics(root)) {
- const overlay = new THREE55.Group;
+ const overlay = new THREE56.Group;
overlay.name = "VehicleDiagnosticOverlay";
const chassisSpan = descriptor.chassisBox ? Math.max(descriptor.chassisBox.max[0] - descriptor.chassisBox.min[0], descriptor.chassisBox.max[1] - descriptor.chassisBox.min[1], descriptor.chassisBox.max[2] - descriptor.chassisBox.min[2]) : 1;
const thickness = Math.max(0.01, chassisSpan * 0.008);
- const arrow = new THREE55.Group;
+ const arrow = new THREE56.Group;
arrow.name = "Diagnostic_Forward_+X";
tagDiagnostic(arrow, "diagnostic.vehicle.forward");
arrow.add(rod("Diagnostic_Forward_Shaft", descriptor.forwardArrow.start, [descriptor.forwardArrow.end[0] - 0.12, 0, 0], thickness, 16724804, "diagnostic.vehicle.forward"));
- const arrowHead = new THREE55.Mesh(new THREE55.ConeGeometry(thickness * 3.2, 0.24, 10), new THREE55.MeshBasicMaterial({ color: 16724804 }));
+ const arrowHead = new THREE56.Mesh(new THREE56.ConeGeometry(thickness * 3.2, 0.24, 10), new THREE56.MeshBasicMaterial({ color: 16724804 }));
arrowHead.name = "Diagnostic_Forward_Head";
arrowHead.position.set(descriptor.forwardArrow.end[0] - 0.12, 0, 0);
- arrowHead.quaternion.setFromUnitVectors(new THREE55.Vector3(0, 1, 0), new THREE55.Vector3(1, 0, 0));
+ arrowHead.quaternion.setFromUnitVectors(new THREE56.Vector3(0, 1, 0), new THREE56.Vector3(1, 0, 0));
tagDiagnostic(arrowHead, "diagnostic.vehicle.forward");
arrow.add(arrowHead);
overlay.add(arrow);
@@ -38382,18 +38597,18 @@ function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagno
overlay.add(rod(`Diagnostic_Axle_${axle.id}`, axle.start, axle.end, thickness, 3386111, `diagnostic.vehicle.axle.${axle.id}`));
}
for (const wheel of descriptor.wheels) {
- const ring = new THREE55.Mesh(new THREE55.TorusGeometry(wheel.radius, Math.min(thickness, wheel.radius * 0.15), 6, 32), new THREE55.MeshBasicMaterial({ color: 16763955 }));
+ const ring = new THREE56.Mesh(new THREE56.TorusGeometry(wheel.radius, Math.min(thickness, wheel.radius * 0.15), 6, 32), new THREE56.MeshBasicMaterial({ color: 16763955 }));
ring.name = `Diagnostic_Wheel_${wheel.id}`;
ring.position.set(...wheel.center);
- const axle = new THREE55.Vector3(...wheel.axle);
+ const axle = new THREE56.Vector3(...wheel.axle);
if (axle.lengthSq() > 0.000000000001) {
- ring.quaternion.setFromUnitVectors(new THREE55.Vector3(0, 0, 1), axle.normalize());
+ ring.quaternion.setFromUnitVectors(new THREE56.Vector3(0, 0, 1), axle.normalize());
}
tagDiagnostic(ring, `diagnostic.vehicle.wheel.${wheel.id}`);
overlay.add(ring);
}
if (descriptor.chassisBox) {
- const chassis = new THREE55.Group;
+ const chassis = new THREE56.Group;
chassis.name = "Diagnostic_ChassisBox";
tagDiagnostic(chassis, "diagnostic.vehicle.chassis");
const { min, max } = descriptor.chassisBox;
@@ -38427,7 +38642,7 @@ function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagno
overlay.add(chassis);
}
if (descriptor.supportPlaneY !== undefined) {
- const plane = new THREE55.Group;
+ const plane = new THREE56.Group;
plane.name = "Diagnostic_SupportPlane";
tagDiagnostic(plane, "diagnostic.vehicle.support-plane");
const halfX = Math.max(1, ...descriptor.chassisBox ? [Math.abs(descriptor.chassisBox.min[0]), Math.abs(descriptor.chassisBox.max[0])] : [], ...descriptor.wheels.map((wheel) => Math.abs(wheel.center[0]) + wheel.radius)) + 0.2;
@@ -39025,7 +39240,7 @@ var init_views = __esm(() => {
});
// src/views/character-capture.ts
-import * as THREE56 from "three";
+import * as THREE57 from "three";
function drawLine2(rgb, width, height, from, to, color) {
let x0 = Math.round(from[0]);
let y0 = Math.round(from[1]);
@@ -39062,22 +39277,22 @@ function drawCross(rgb, width, height, point, color, radius = 3) {
}
function projector(root, cameraId, size) {
root.updateMatrixWorld(true);
- const bounds = new THREE56.Box3().setFromObject(root);
+ const bounds = new THREE57.Box3().setFromObject(root);
if (bounds.isEmpty())
- bounds.set(new THREE56.Vector3(-0.5, 0, -0.5), new THREE56.Vector3(0.5, 1, 0.5));
- const center = bounds.getCenter(new THREE56.Vector3);
- const camera = cameraId === "front" ? new THREE56.Vector3(1, 0, 0) : new THREE56.Vector3(0, 0, 1);
- const upHint = new THREE56.Vector3(0, 1, 0);
- const xAxis = new THREE56.Vector3().crossVectors(upHint, camera).normalize();
- const yAxis = new THREE56.Vector3().crossVectors(camera, xAxis).normalize();
+ bounds.set(new THREE57.Vector3(-0.5, 0, -0.5), new THREE57.Vector3(0.5, 1, 0.5));
+ const center = bounds.getCenter(new THREE57.Vector3);
+ const camera = cameraId === "front" ? new THREE57.Vector3(1, 0, 0) : new THREE57.Vector3(0, 0, 1);
+ const upHint = new THREE57.Vector3(0, 1, 0);
+ const xAxis = new THREE57.Vector3().crossVectors(upHint, camera).normalize();
+ const yAxis = new THREE57.Vector3().crossVectors(camera, xAxis).normalize();
let extent = 0.000001;
for (let corner = 0;corner < 8; corner++) {
- const point = new THREE56.Vector3(corner & 1 ? bounds.max.x : bounds.min.x, corner & 2 ? bounds.max.y : bounds.min.y, corner & 4 ? bounds.max.z : bounds.min.z).sub(center);
+ const point = new THREE57.Vector3(corner & 1 ? bounds.max.x : bounds.min.x, corner & 2 ? bounds.max.y : bounds.min.y, corner & 4 ? bounds.max.z : bounds.min.z).sub(center);
extent = Math.max(extent, Math.abs(point.dot(xAxis)), Math.abs(point.dot(yAxis)));
}
const scale = size * 0.45 / extent;
return (assetPoint) => {
- const world = new THREE56.Vector3(...assetPoint).applyMatrix4(root.matrixWorld).sub(center);
+ const world = new THREE57.Vector3(...assetPoint).applyMatrix4(root.matrixWorld).sub(center);
return [size / 2 + world.dot(xAxis) * scale, size / 2 - world.dot(yAxis) * scale];
};
}
@@ -39203,7 +39418,7 @@ var init_character_capture = __esm(() => {
});
// src/render.ts
-import * as THREE57 from "three";
+import * as THREE58 from "three";
import { Document, Logger as Logger2 } from "@gltf-transform/core";
import { KHRMaterialsEmissiveStrength } from "@gltf-transform/extensions";
import { dedup as dedup2, instance, palette, weld as weld2, prune as prune2, mergeDocuments } from "@gltf-transform/functions";
@@ -39433,7 +39648,7 @@ function bridgeMaterial(doc, threeMat, cache, textureCache, authorExtras, atlas)
} else if (stdMat.transparent) {
mat.setAlphaMode("BLEND");
}
- if (stdMat.side === THREE57.DoubleSide) {
+ if (stdMat.side === THREE58.DoubleSide) {
mat.setDoubleSided(true);
}
if (stdMat.map) {
@@ -39510,7 +39725,7 @@ function bridgeMaterial(doc, threeMat, cache, textureCache, authorExtras, atlas)
} else if (common.transparent || (common.opacity ?? 1) < 1) {
mat.setAlphaMode("BLEND");
}
- if (threeMat.side === THREE57.DoubleSide)
+ if (threeMat.side === THREE58.DoubleSide)
mat.setDoubleSided(true);
if (common.map && !mat.getBaseColorTexture()) {
const texture = bridgeTexture(doc, common.map, textureCache);
@@ -39673,7 +39888,7 @@ function bridgeNode(doc, buf, threeObj, matCache, nodeMap, meshCache, texCache,
const cacheKey = `kiln-sprite-quad:${centerX}:${centerY}:${rotation}__${threeMat.uuid}`;
let gtMesh = meshCache.get(cacheKey);
if (!gtMesh) {
- const geometry = new THREE57.PlaneGeometry(1, 1);
+ const geometry = new THREE58.PlaneGeometry(1, 1);
if (centerX !== 0.5 || centerY !== 0.5) {
geometry.translate(0.5 - centerX, 0.5 - centerY, 0);
}
@@ -39697,9 +39912,9 @@ function animationInterpolation(track) {
if (isCubicSplineTrack(track))
return "CUBICSPLINE";
const mode = track.getInterpolation();
- if (mode === THREE57.InterpolateDiscrete)
+ if (mode === THREE58.InterpolateDiscrete)
return "STEP";
- if (mode === THREE57.InterpolateLinear)
+ if (mode === THREE58.InterpolateLinear)
return "LINEAR";
throw new Error(`Unsupported animation interpolation on ${track.name}; use LINEAR, STEP or CUBICSPLINE.`);
}
@@ -40244,6 +40459,22 @@ function inspectGeneratedAnimation(root, clips) {
}
return warnings;
}
+function collapseWeldedFloaters(floaters, pieces) {
+ for (let i = 0;i < floaters.length; i++) {
+ const mesh = floaters[i].welded;
+ if (!mesh)
+ continue;
+ const detached = floaters.filter((floater) => floater.welded === mesh).length;
+ if (detached < 2)
+ continue;
+ const of = pieces.find((piece) => piece.welded?.mesh === mesh)?.welded?.of ?? detached;
+ floaters[i].name = `${mesh} (${detached} of its ${of} welded components)`;
+ for (let j = floaters.length - 1;j > i; j--)
+ if (floaters[j].welded === mesh)
+ floaters.splice(j, 1);
+ floaters[i].welded = undefined;
+ }
+}
function collectMeshStats(root) {
root.updateMatrixWorld(true);
const out = [];
@@ -40273,8 +40504,8 @@ function collectMeshStats(root) {
if (!Number.isFinite(box.min.x) || !Number.isFinite(box.max.x)) {
return;
}
- const center = new THREE57.Vector3;
- const size = new THREE57.Vector3;
+ const center = new THREE58.Vector3;
+ const size = new THREE58.Vector3;
box.getCenter(center);
box.getSize(size);
out.push({
@@ -40290,7 +40521,7 @@ function collectMeshStats(root) {
return out;
}
function minimalGapVector(a, b) {
- const v = new THREE57.Vector3;
+ const v = new THREE58.Vector3;
for (const axis of ["x", "y", "z"]) {
if (a.min[axis] > b.max[axis])
v[axis] = b.max[axis] - a.min[axis];
@@ -40308,10 +40539,10 @@ function inspectSceneStructure(root, opts = {}) {
return warnings;
const cat = opts.category?.toLowerCase();
if (cat === "vehicle" || cat === "weapon" || cat === "boat" || cat === "aircraft") {
- const all = new THREE57.Box3;
+ const all = new THREE58.Box3;
for (const m of meshes)
all.union(m.box);
- const size = new THREE57.Vector3;
+ const size = new THREE58.Vector3;
all.getSize(size);
if (cat === "aircraft") {
if (size.y > size.x * 1.2) {
@@ -40335,17 +40566,28 @@ function inspectSceneStructure(root, opts = {}) {
warnings.push(`Stray plane "${m.name}" at world origin (centroid ≈ [0,0,0]). Replace planeGeo with decalBox and position on a host surface, or move this mesh into place.`);
}
}
- if (meshes.length > 1) {
+ const budget = splitBudget();
+ const pieces = meshes.flatMap((mesh) => {
+ const boxes = meshComponentBoxes(mesh.object, budget);
+ if (!boxes || boxes.length < 2)
+ return [mesh];
+ return boxes.map((box, index) => ({
+ ...mesh,
+ box,
+ welded: { mesh: mesh.name, index: index + 1, of: boxes.length }
+ }));
+ });
+ if (pieces.length > 1) {
const floaters = [];
const supported = [];
- for (let i = 0;i < meshes.length; i++) {
- const a = meshes[i];
+ for (let i = 0;i < pieces.length; i++) {
+ const a = pieces[i];
const ax = a.box.clone().expandByScalar(FLOATING_EXPAND);
let overlapsAny = false;
- for (let j = 0;j < meshes.length; j++) {
+ for (let j = 0;j < pieces.length; j++) {
if (i === j)
continue;
- const b = meshes[j];
+ const b = pieces[j];
if (ax.intersectsBox(b.box)) {
overlapsAny = true;
break;
@@ -40361,19 +40603,25 @@ function inspectSceneStructure(root, opts = {}) {
const declared = declaredSupports(a.object, opts.externalSupport)[0];
let nearest;
let nearestGap;
- for (let j = 0;j < meshes.length; j++) {
+ for (let j = 0;j < pieces.length; j++) {
if (i === j)
continue;
- const gap = minimalGapVector(a.box, meshes[j].box);
+ const gap = minimalGapVector(a.box, pieces[j].box);
if (!nearestGap || gap.length() < nearestGap.length()) {
- nearest = meshes[j];
+ nearest = pieces[j];
nearestGap = gap;
}
}
- const fix = nearest && nearestGap ? ` Fix: shift "${a.name}" by [${nearestGap.x.toFixed(3)}, ${nearestGap.y.toFixed(3)}, ${nearestGap.z.toFixed(3)}] toward "${nearest.name}", or call snapTo(part, hostPart) to do it automatically.` : "";
+ const fix = a.welded ? ` Fix: one mesh moves and hides as one, so close the gap in the merged geometry, or author the component as its own part. It spans ${spanText(a.box)}.` : nearest && nearestGap ? ` Fix: shift "${a.name}" by [${nearestGap.x.toFixed(3)}, ${nearestGap.y.toFixed(3)}, ${nearestGap.z.toFixed(3)}] toward "${nearest.name}", or call snapTo(part, hostPart) to do it automatically.` : "";
const mismatch = declared ? ` It is named in a declared external support at Y=${declared.planeY.toFixed(3)}, but its bottom is at Y=${a.box.min.y.toFixed(3)}.` : "";
- floaters.push({ name: a.name, fix: fix + mismatch });
+ const name = a.welded ? `${a.welded.mesh} (welded component ${a.welded.index} of ${a.welded.of})` : a.name;
+ floaters.push({
+ name,
+ fix: fix + mismatch,
+ ...a.welded ? { welded: a.welded.mesh } : {}
+ });
}
+ collapseWeldedFloaters(floaters, pieces);
if (floaters.length > 0) {
const entries = floaters.slice(0, FLOATER_FIXES_SHOWN).map(({ name, fix }) => `${name}${fix ? ` —${fix}` : ""}`);
const rest = floaters.slice(FLOATER_FIXES_SHOWN);
@@ -40383,7 +40631,7 @@ function inspectSceneStructure(root, opts = {}) {
names.push(`+${rest.length - names.length} more`);
entries.push(`+${rest.length} more floating: ${names.join(", ")} — the same fix applies: shift each onto its nearest sibling, or call snapTo(part, hostPart).`);
}
- warnings.push(`Floating parts (no mesh overlap with any sibling, 2cm tol): ${entries.join(" | ")} — Coverage: drawn meshes only, at 2cm. A smaller gap reads as contact and a primitive welded into another mesh is never seen, so a silent pass is not a fit audit; measure contacts in the destination.`);
+ warnings.push(`Floating parts (no mesh overlap with any sibling, 2cm tol): ${entries.join(" | ")} — Coverage: drawn meshes only, at 2cm. Welded components inside one mesh are compared the same way, box to box. A smaller gap reads as contact, so a silent pass is not a fit audit; measure contacts in the destination.${budget.unsplit.length ? ` Over the split budget, so measured as one box: ${budget.unsplit.slice(0, FLOATER_NAMES_SHOWN).join(", ")}.` : ""}`);
}
if (supported.length > 0) {
const shown = supported.slice(0, FLOATER_NAMES_SHOWN);
@@ -40394,11 +40642,12 @@ function inspectSceneStructure(root, opts = {}) {
}
return warnings;
}
-var engineIO, TYPE_SCALAR = "SCALAR", TYPE_VEC2 = "VEC2", TYPE_VEC3 = "VEC3", TYPE_VEC4 = "VEC4", ACCESSOR_TYPES, GROUND_CONTACT_TOLERANCE = 0.02, GLTF_MIN_FILTER, GLTF_MAG_FILTER, GLTF_WRAP, REVIEW_CLIPS_EXTRAS_KEY2 = "kilnReviewClipsV1", REVIEW_CLIP_LIMITS2, PALETTE_MIN = 4, INSTANCE_MIN = 5, FLOATER_FIXES_SHOWN = 6, FLOATER_NAMES_SHOWN = 24;
+var engineIO, TYPE_SCALAR = "SCALAR", TYPE_VEC2 = "VEC2", TYPE_VEC3 = "VEC3", TYPE_VEC4 = "VEC4", ACCESSOR_TYPES, GROUND_CONTACT_TOLERANCE = 0.02, GLTF_MIN_FILTER, GLTF_MAG_FILTER, GLTF_WRAP, REVIEW_CLIPS_EXTRAS_KEY2 = "kilnReviewClipsV1", REVIEW_CLIP_LIMITS2, PALETTE_MIN = 4, INSTANCE_MIN = 5, spanText = (box) => `[${box.min.toArray().map((v) => v.toFixed(3)).join(", ")}] to [${box.max.toArray().map((v) => v.toFixed(3)).join(", ")}]`, FLOATER_FIXES_SHOWN = 6, FLOATER_NAMES_SHOWN = 24;
var init_render = __esm(() => {
init_requirements_context();
init_requirements_run();
init_requirements_report();
+ init_mesh_components();
init_skin_integrity();
init_authoring_diagnostic();
init_gltf_io();
@@ -40436,18 +40685,18 @@ var init_render = __esm(() => {
engineIO = createGltfIO;
ACCESSOR_TYPES = [TYPE_SCALAR, TYPE_VEC2, TYPE_VEC3, TYPE_VEC4];
GLTF_MIN_FILTER = {
- [THREE57.NearestFilter]: 9728,
- [THREE57.LinearFilter]: 9729,
- [THREE57.NearestMipmapNearestFilter]: 9984,
- [THREE57.LinearMipmapNearestFilter]: 9985,
- [THREE57.NearestMipmapLinearFilter]: 9986,
- [THREE57.LinearMipmapLinearFilter]: 9987
- };
- GLTF_MAG_FILTER = { [THREE57.NearestFilter]: 9728, [THREE57.LinearFilter]: 9729 };
+ [THREE58.NearestFilter]: 9728,
+ [THREE58.LinearFilter]: 9729,
+ [THREE58.NearestMipmapNearestFilter]: 9984,
+ [THREE58.LinearMipmapNearestFilter]: 9985,
+ [THREE58.NearestMipmapLinearFilter]: 9986,
+ [THREE58.LinearMipmapLinearFilter]: 9987
+ };
+ GLTF_MAG_FILTER = { [THREE58.NearestFilter]: 9728, [THREE58.LinearFilter]: 9729 };
GLTF_WRAP = {
- [THREE57.ClampToEdgeWrapping]: 33071,
- [THREE57.MirroredRepeatWrapping]: 33648,
- [THREE57.RepeatWrapping]: 10497
+ [THREE58.ClampToEdgeWrapping]: 33071,
+ [THREE58.MirroredRepeatWrapping]: 33648,
+ [THREE58.RepeatWrapping]: 10497
};
REVIEW_CLIP_LIMITS2 = {
clips: 32,
@@ -40669,7 +40918,7 @@ var init_port = __esm(() => {
import { createHash as createHash8 } from "node:crypto";
import { join as join2, resolve as resolve4 } from "node:path";
import sharp from "sharp";
-import * as THREE58 from "three";
+import * as THREE59 from "three";
async function decodePng2(bytes) {
const { data, info } = await sharp(bytes, {
limitInputPixels: MATERIAL_LIBRARY_LIMITS.maxRecordPixels,
@@ -40878,14 +41127,14 @@ async function previewGlb(manifest, maps, tiles, planeMeters) {
material.color.setHex(p.baseColor);
if (textures.has("emissive") && p.emissive !== undefined)
material.emissive.setHex(p.emissive);
- const geometry = new THREE58.PlaneGeometry(planeMeters, planeMeters);
+ const geometry = new THREE59.PlaneGeometry(planeMeters, planeMeters);
geometry.rotateX(-Math.PI / 2);
const uv = geometry.getAttribute("uv");
for (let i = 0;i < uv.count; i++)
uv.setXY(i, uv.getX(i) * tiles, uv.getY(i) * tiles);
- const root = new THREE58.Group;
+ const root = new THREE59.Group;
root.name = `${manifest.materialId}-preview`;
- const mesh = new THREE58.Mesh(geometry, material);
+ const mesh = new THREE59.Mesh(geometry, material);
mesh.name = "tiles";
root.add(mesh);
await Promise.resolve().then(() => init_render());
@@ -52896,28 +53145,28 @@ var exports_part_placement = {};
__export(exports_part_placement, {
createPartPlacementReader: () => createPartPlacementReader
});
-import * as THREE59 from "three";
+import * as THREE60 from "three";
function createPartPlacementReader(root) {
const bounds = createPartBoundsReader(root);
- const position = new THREE59.Vector3;
- const quaternion = new THREE59.Quaternion;
- const scale = new THREE59.Vector3;
+ const position = new THREE60.Vector3;
+ const quaternion = new THREE60.Quaternion;
+ const scale = new THREE60.Vector3;
return (node) => {
node.matrixWorld.decompose(position, quaternion, scale);
const box = bounds(node);
return {
- position: rounded2(position.toArray()),
- quaternion: rounded2(quaternion.toArray()),
- scale: rounded2(scale.toArray()),
+ position: rounded3(position.toArray()),
+ quaternion: rounded3(quaternion.toArray()),
+ scale: rounded3(scale.toArray()),
mirrored: node.matrixWorld.determinant() < 0,
- bounds: box ? { min: rounded2(box.min), max: rounded2(box.max) } : null
+ bounds: box ? { min: rounded3(box.min), max: rounded3(box.max) } : null
};
};
}
var round4 = (value) => {
const rounded = Math.round(value * 1e6) / 1e6;
return rounded === 0 ? 0 : rounded;
-}, rounded2 = (values) => values.map(round4);
+}, rounded3 = (values) => values.map(round4);
var init_part_placement = __esm(() => {
init_raster();
});
@@ -53052,13 +53301,13 @@ var init_inspect = __esm(() => {
});
// src/views/measurement.ts
-import { Box3 as Box327, Vector3 as Vector346 } from "three";
+import { Box3 as Box328, Vector3 as Vector347 } from "three";
function describeSubjectFrame(root, subject) {
const selected = selectCameraSubject(root, subject);
selected.node.updateWorldMatrix(true, true);
const matrix = selected.node.matrixWorld;
- const bounds = new Box327().setFromObject(selected.node);
- const local = new Box327;
+ const bounds = new Box328().setFromObject(selected.node);
+ const local = new Box328;
const invertible = matrix.determinant() !== 0;
const inverse = matrix.clone().invert();
selected.node.traverse((node) => {
@@ -53069,10 +53318,10 @@ function describeSubjectFrame(root, subject) {
if (!attr)
return;
for (let i = 0;i < attr.count; i++)
- local.expandByPoint(new Vector346().fromBufferAttribute(attr, i).applyMatrix4(mesh.matrixWorld).applyMatrix4(inverse));
+ local.expandByPoint(new Vector347().fromBufferAttribute(attr, i).applyMatrix4(mesh.matrixWorld).applyMatrix4(inverse));
});
const box = (b) => b.isEmpty() ? null : { min: b.min.toArray(), max: b.max.toArray() };
- const axis = (i) => new Vector346().setFromMatrixColumn(matrix, i).normalize().toArray();
+ const axis = (i) => new Vector347().setFromMatrixColumn(matrix, i).normalize().toArray();
return {
path: selected.path,
name: selected.name,
@@ -53082,7 +53331,7 @@ function describeSubjectFrame(root, subject) {
invertible,
worldMatrix: matrix.toArray(),
axes: { frame: "world", x: axis(0), y: axis(1), z: axis(2) },
- origin: new Vector346().setFromMatrixPosition(matrix).toArray()
+ origin: new Vector347().setFromMatrixPosition(matrix).toArray()
};
}
function measureAttachment(root, input) {
@@ -53095,7 +53344,7 @@ function measureAttachment(root, input) {
return {
path: selected.path,
local: [...local],
- world: new Vector346(...local).applyMatrix4(selected.node.matrixWorld).toArray()
+ world: new Vector347(...local).applyMatrix4(selected.node.matrixWorld).toArray()
};
};
const from = endpoint(input.from), to = endpoint(input.to);
@@ -53105,7 +53354,7 @@ function measureAttachment(root, input) {
method: "straight-line anchor distance",
from,
to,
- distance: new Vector346(...from.world).distanceTo(new Vector346(...to.world))
+ distance: new Vector347(...from.world).distanceTo(new Vector347(...to.world))
};
}
var init_measurement = __esm(() => {
@@ -53117,7 +53366,7 @@ import {
PropertyType as PropertyType6
} from "@gltf-transform/core";
import { ALL_EXTENSIONS as ALL_EXTENSIONS2 } from "@gltf-transform/extensions";
-import { Box3 as Box328, Matrix4 as Matrix419, Quaternion as Quaternion23, Vector3 as Vector347 } from "three";
+import { Box3 as Box329, Matrix4 as Matrix419, Quaternion as Quaternion23, Vector3 as Vector348 } from "three";
async function accessorFingerprint(accessor) {
const array = accessor?.getArray();
if (!accessor || !array)
@@ -53136,7 +53385,7 @@ function bounds(box) {
return box.isEmpty() ? null : {
min: box.min.toArray(),
max: box.max.toArray(),
- size: box.getSize(new Vector347).toArray()
+ size: box.getSize(new Vector348).toArray()
};
}
async function digest8(bytes) {
@@ -53152,7 +53401,7 @@ function placements(node) {
const rotation = instances.getAttribute("ROTATION");
const scale = instances.getAttribute("SCALE");
const count = translation?.getCount() ?? rotation?.getCount() ?? scale?.getCount() ?? 1;
- return Array.from({ length: count }, (_, i) => world.clone().multiply(new Matrix419().compose(new Vector347().fromArray(translation?.getElement(i, []) ?? [0, 0, 0]), new Quaternion23().fromArray(rotation?.getElement(i, []) ?? [0, 0, 0, 1]), new Vector347().fromArray(scale?.getElement(i, []) ?? [1, 1, 1]))));
+ return Array.from({ length: count }, (_, i) => world.clone().multiply(new Matrix419().compose(new Vector348().fromArray(translation?.getElement(i, []) ?? [0, 0, 0]), new Quaternion23().fromArray(rotation?.getElement(i, []) ?? [0, 0, 0, 1]), new Vector348().fromArray(scale?.getElement(i, []) ?? [1, 1, 1]))));
}
function triangleCorners(mode, count) {
const corners = [];
@@ -53219,7 +53468,7 @@ async function drawnGeometryDigests(doc) {
}
const data = new Float32Array(triangles * RECORD);
const others = [];
- const point = new Vector347;
+ const point = new Vector348;
const element = [0, 0, 0];
const texcoord = [0, 0];
const corner = new Float32Array(15);
@@ -53302,7 +53551,7 @@ async function revisionTotals(doc) {
const { vertices, geometry, uv } = await drawnGeometryDigests(doc);
const scene = doc.getRoot().getDefaultScene() ?? doc.getRoot().listScenes()[0];
const drawnBounds = scene ? drawnSceneBounds(scene) : null;
- const box = drawnBounds && [...drawnBounds.min, ...drawnBounds.max].every(Number.isFinite) ? new Box328(new Vector347(...drawnBounds.min), new Vector347(...drawnBounds.max)) : new Box328;
+ const box = drawnBounds && [...drawnBounds.min, ...drawnBounds.max].every(Number.isFinite) ? new Box329(new Vector348(...drawnBounds.min), new Vector348(...drawnBounds.max)) : new Box329;
return {
triangles: metrics.triangles,
vertices,
@@ -53377,7 +53626,7 @@ async function snapshot3(bytes) {
if (depth > 128)
throw new Error("Revision comparison hierarchy exceeds 128 levels.");
const names = new Set;
- const combined = new Box328;
+ const combined = new Box329;
const placed = siblings.flatMap((node) => [
{ node, drawn: true },
...lowerLevels(node).map((level) => ({ node: level, drawn: false }))
@@ -53394,7 +53643,7 @@ async function snapshot3(bytes) {
if (node.listExtensions().some((extension) => extension.extensionName !== MSFT_LOD && extension.extensionName !== "KHR_node_visibility") || mesh?.listExtensions().length)
throw new Error("Revision comparison does not support node/mesh extensions (including instancing).");
const primitives = mesh?.listPrimitives() ?? [];
- const own = new Box328;
+ const own = new Box329;
const matrix = parentWorld.clone().multiply(new Matrix419().fromArray(node.getMatrix()));
if (matrix.elements.some((value) => !Number.isFinite(value)))
throw new Error("Revision comparison requires finite transforms.");
@@ -53415,7 +53664,7 @@ async function snapshot3(bytes) {
if (!Number.isInteger(vertex) || vertex < 0 || vertex >= position.getCount())
throw new Error("Revision comparison found an invalid vertex index.");
position.getElement(vertex, element);
- const point = new Vector347(...element).applyMatrix4(matrix);
+ const point = new Vector348(...element).applyMatrix4(matrix);
if (point.toArray().some((value) => !Number.isFinite(value)))
throw new Error("Revision comparison requires finite positions.");
own.expandByPoint(point);
@@ -53615,20 +53864,20 @@ var init_revision_comparison = __esm(() => {
// src/views/surface-distance.ts
import {
- Box3 as Box329,
+ Box3 as Box330,
Matrix4 as Matrix420,
Ray as Ray3,
Triangle as Triangle3,
- Vector3 as Vector348
+ Vector3 as Vector349
} from "three";
function hierarchy(triangles) {
- const box = new Box329;
+ const box = new Box330;
for (const triangle of triangles)
box.union(triangle.box);
const count = triangles.length;
if (count <= 4)
return { box, count, triangles };
- const size = box.getSize(new Vector348);
+ const size = box.getSize(new Vector349);
const axis = size.x >= size.y && size.x >= size.z ? "x" : size.y >= size.z ? "y" : "z";
const center = (triangle) => triangle.box.min[axis] / 2 + triangle.box.max[axis] / 2;
triangles.sort((a, b) => center(a) - center(b));
@@ -53647,7 +53896,7 @@ function boxDistanceSquared2(a, b) {
}
function collect(node, paths) {
const triangles = [];
- const bounds = new Box329;
+ const bounds = new Box330;
node.updateWorldMatrix(true, true);
node.traverseVisible((child) => {
const mesh = child;
@@ -53680,13 +53929,13 @@ function collect(node, paths) {
const id = index ? index.getX(i + offset) : i + offset;
if (!Number.isSafeInteger(id) || id < 0 || id >= position.count)
throw new Error("Surface distance encountered an invalid triangle index.");
- const point = new Vector348().fromBufferAttribute(position, id).applyMatrix4(matrix);
+ const point = new Vector349().fromBufferAttribute(position, id).applyMatrix4(matrix);
if (![point.x, point.y, point.z].every(Number.isFinite))
throw new Error("Surface distance encountered a non-finite world position.");
return point;
};
const triangle = new Triangle3(vertex(0), vertex(1), vertex(2));
- const box = new Box329().setFromPoints([triangle.a, triangle.b, triangle.c]);
+ const box = new Box330().setFromPoints([triangle.a, triangle.b, triangle.c]);
bounds.union(box);
triangles.push({
triangle,
@@ -53739,10 +53988,10 @@ function trianglePair(a, b) {
const av = [a.a, a.b, a.c], bv = [b.a, b.b, b.c];
if (b.getArea() > 0)
for (const p of av)
- record(p, b.closestPointToPoint(p, new Vector348));
+ record(p, b.closestPointToPoint(p, new Vector349));
if (a.getArea() > 0)
for (const q of bv)
- record(a.closestPointToPoint(q, new Vector348), q);
+ record(a.closestPointToPoint(q, new Vector349), q);
for (let i = 0;i < 3; i++) {
const p = av[i], q = av[(i + 1) % 3];
for (let j = 0;j < 3; j++)
@@ -53755,9 +54004,9 @@ function trianglePair(a, b) {
const length = delta.length();
if (length === 0)
continue;
- const hit = new Ray3(origin, delta.divideScalar(length)).intersectTriangle(target.a, target.b, target.c, false, new Vector348);
+ const hit = new Ray3(origin, delta.divideScalar(length)).intersectTriangle(target.a, target.b, target.c, false, new Vector349);
if (hit && origin.distanceTo(hit) <= length) {
- const onFace = target.closestPointToPoint(hit, new Vector348);
+ const onFace = target.closestPointToPoint(hit, new Vector349);
if (vertices === av)
record(hit, onFace);
else
@@ -53923,7 +54172,7 @@ __export(exports_draw_diagnostics, {
});
import { Primitive as Primitive3 } from "@gltf-transform/core";
import { cloneDocument as cloneDocument2 } from "@gltf-transform/functions";
-import * as THREE60 from "three";
+import * as THREE61 from "three";
function withinLimits(doc) {
const root = doc.getRoot();
if (root.listNodes().length > MAX_NODES2 || root.listAccessors().length > 4096 || root.listMaterials().length > 2048 || root.listTextures().length > 256 || root.listScenes().length > 32 || doc.getGraph().listEdges().length > 32768)
@@ -53976,7 +54225,7 @@ function collect2(doc, keep) {
function overlaps(a, b) {
if (Math.abs(a.normal.dot(b.normal)) < 1 - 0.00000001 || !a.bounds.intersectsBox(b.bounds))
return false;
- const tolerance = Math.max(a.bounds.getSize(new THREE60.Vector3).length(), b.bounds.getSize(new THREE60.Vector3).length(), 0.000000000001) * 0.000001;
+ const tolerance = Math.max(a.bounds.getSize(new THREE61.Vector3).length(), b.bounds.getSize(new THREE61.Vector3).length(), 0.000000000001) * 0.000001;
if (b.points.some((p) => Math.abs(a.normal.dot(p.clone().sub(a.points[0]))) > tolerance))
return false;
const normal = a.normal.toArray().map(Math.abs);
@@ -54018,7 +54267,7 @@ function observe(uses) {
unexaminedPrimitiveUses++;
continue;
}
- const matrix = new THREE60.Matrix4().fromArray(node.getWorldMatrix());
+ const matrix = new THREE61.Matrix4().fromArray(node.getWorldMatrix());
if (primitive.getAttribute("TANGENT") && matrix.determinant() < 0)
mirrored.set(part.id, part);
const position = primitive.getAttribute("POSITION");
@@ -54032,14 +54281,14 @@ function observe(uses) {
const amount = Math.min(count, 8, MAX_SAMPLES - samples.length);
for (let i = 0;i < amount; i++) {
const start = Math.floor(i * count / amount) * 3;
- const points = [0, 1, 2].map((j) => new THREE60.Vector3().fromArray(position.getElement(indices ? indices.getScalar(start + j) : start + j, [])).applyMatrix4(matrix));
+ const points = [0, 1, 2].map((j) => new THREE61.Vector3().fromArray(position.getElement(indices ? indices.getScalar(start + j) : start + j, [])).applyMatrix4(matrix));
const normal = points[1].clone().sub(points[0]).cross(points[2].clone().sub(points[0]));
if (!Number.isFinite(normal.lengthSq()) || normal.lengthSq() === 0)
continue;
samples.push({
points,
normal: normal.normalize(),
- bounds: new THREE60.Box3().setFromPoints(points),
+ bounds: new THREE61.Box3().setFromPoints(points),
part
});
}
@@ -54341,7 +54590,7 @@ var init_export_root = __esm(() => {
// src/tools/registry.ts
import { z as z25 } from "zod";
-import * as THREE61 from "three";
+import * as THREE62 from "three";
function proceduralTextureMaterialContract(rendered, context) {
const required = [...new Set(context.requiredProceduralTextureUsages ?? [])];
if (required.length === 0)
@@ -54638,8 +54887,8 @@ function collectSceneMetrics(root) {
let meshes = 0;
const materialSet = new Set;
let lowestPart;
- const box = new THREE61.Box3;
- const point = new THREE61.Vector3;
+ const box = new THREE62.Box3;
+ const point = new THREE62.Vector3;
root.updateWorldMatrix(true, true);
root.traverseVisible((node) => {
const n = node;
@@ -54655,7 +54904,7 @@ function collectSceneMetrics(root) {
const mesh = node;
const position = mesh.geometry.getAttribute("position");
const index = mesh.geometry.index;
- const mb = new THREE61.Box3;
+ const mb = new THREE62.Box3;
if (position) {
for (let i = 0;i < (index?.count ?? position.count); i++) {
point.fromBufferAttribute(position, index ? index.getX(i) : i);
@@ -54670,7 +54919,7 @@ function collectSceneMetrics(root) {
});
let bbox;
if (!box.isEmpty()) {
- const size = new THREE61.Vector3;
+ const size = new THREE62.Vector3;
box.getSize(size);
bbox = {
min: [box.min.x, box.min.y, box.min.z],
diff --git a/dist/evaluator-worker.mjs b/dist/evaluator-worker.mjs
index 5f66fb5b..638cf2a2 100644
--- a/dist/evaluator-worker.mjs
+++ b/dist/evaluator-worker.mjs
@@ -7088,9 +7088,135 @@ var init_lod2 = __esm(() => {
init_lod();
});
-// src/qa/part-connectivity.ts
+// src/qa/mesh-components.ts
import * as THREE9 from "three";
-function collectParts2(root, exempt, supports) {
+function find(parent, start) {
+ let root = start;
+ while (parent[root] !== root)
+ root = parent[root];
+ for (let at = start;parent[at] !== root; ) {
+ const next = parent[at];
+ parent[at] = root;
+ at = next;
+ }
+ return root;
+}
+function union(parent, a, b) {
+ const ra = find(parent, a);
+ const rb = find(parent, b);
+ if (ra < rb)
+ parent[rb] = ra;
+ else
+ parent[ra] = rb;
+}
+function walkComponents(geometry) {
+ const position = geometry.getAttribute("position");
+ const version = position?.version ?? 0;
+ const cached = cache.get(geometry);
+ if (cached && cached.version === version)
+ return cached;
+ const store = (result) => {
+ cache.set(geometry, result);
+ return result;
+ };
+ if (position?.itemSize !== 3 || position.count > MAX_SPLIT_VERTICES)
+ return store({ version, count: 0 });
+ const parent = new Int32Array(position.count);
+ const used = new Uint8Array(position.count);
+ for (let i = 0;i < parent.length; i++)
+ parent[i] = i;
+ const finite = new Uint8Array(position.count);
+ const bounds = new THREE9.Box3;
+ const point = new THREE9.Vector3;
+ for (let i = 0;i < position.count; i++) {
+ point.fromBufferAttribute(position, i);
+ if (Number.isFinite(point.x) && Number.isFinite(point.y) && Number.isFinite(point.z)) {
+ finite[i] = 1;
+ bounds.expandByPoint(point);
+ }
+ }
+ const index = geometry.getIndex();
+ const triangles = (index?.count ?? position.count) - (index?.count ?? position.count) % 3;
+ const corner = (at) => index ? index.getX(at) : at;
+ for (let at = 0;at < triangles; at += 3) {
+ const a = corner(at);
+ const b = corner(at + 1);
+ const c = corner(at + 2);
+ if (!finite[a] || !finite[b] || !finite[c])
+ continue;
+ used[a] = used[b] = used[c] = 1;
+ union(parent, a, b);
+ union(parent, b, c);
+ }
+ const size = bounds.isEmpty() ? new THREE9.Vector3 : bounds.getSize(new THREE9.Vector3);
+ const tolerance = Math.max(size.x, size.y, size.z) * 0.000001 || 1;
+ const seen = new Map;
+ for (let i = 0;i < position.count; i++) {
+ if (!used[i])
+ continue;
+ point.fromBufferAttribute(position, i).sub(bounds.min).divideScalar(tolerance);
+ const key = `${Math.round(point.x)},${Math.round(point.y)},${Math.round(point.z)}`;
+ const first = seen.get(key);
+ if (first === undefined)
+ seen.set(key, i);
+ else
+ union(parent, first, i);
+ }
+ const labels = new Int32Array(position.count).fill(-1);
+ const byRoot = new Map;
+ for (let i = 0;i < position.count; i++) {
+ if (!used[i])
+ continue;
+ const root = find(parent, i);
+ let label = byRoot.get(root);
+ if (label === undefined) {
+ label = byRoot.size;
+ byRoot.set(root, label);
+ if (byRoot.size > MAX_MESH_COMPONENTS)
+ return store({ version, count: byRoot.size });
+ }
+ labels[i] = label;
+ }
+ return store({ version, count: byRoot.size, labels });
+}
+function meshComponentBoxes(mesh, budget) {
+ const flagged = mesh;
+ if (flagged.isInstancedMesh || flagged.isSkinnedMesh || STANDS_APART_NAME.test(mesh.name) || (lodLevel(mesh) ?? 0) > 0)
+ return;
+ const geometry = mesh.geometry;
+ const position = geometry?.getAttribute("position");
+ if (!position)
+ return;
+ const walked = walkComponents(geometry);
+ if (!walked.labels || walked.count > 1 && budget.components + walked.count > MAX_SCENE_COMPONENTS) {
+ budget.unsplit.push(mesh.name || "(unnamed mesh)");
+ return;
+ }
+ if (walked.count < 1)
+ return;
+ if (walked.count > 1)
+ budget.components += walked.count;
+ const boxes = Array.from({ length: walked.count }, () => new THREE9.Box3);
+ const point = new THREE9.Vector3;
+ for (let i = 0;i < position.count; i++) {
+ const label = walked.labels[i];
+ if (label < 0)
+ continue;
+ point.fromBufferAttribute(position, i).applyMatrix4(mesh.matrixWorld);
+ boxes[label].expandByPoint(point);
+ }
+ return boxes;
+}
+var MAX_SPLIT_VERTICES = 262144, MAX_MESH_COMPONENTS = 256, MAX_SCENE_COMPONENTS = 4096, STANDS_APART_NAME, splitBudget = () => ({ components: 0, unsplit: [] }), cache;
+var init_mesh_components = __esm(() => {
+ init_lod2();
+ STANDS_APART_NAME = /(?:^|_)(?:leaf|leaves|foliage|frond|card|decal|billboard|petal)/i;
+ cache = new WeakMap;
+});
+
+// src/qa/part-connectivity.ts
+import * as THREE10 from "three";
+function collectParts2(root, exempt, budget, supports) {
const parts = [];
let lodExcluded = 0;
root.updateWorldMatrix(true, true);
@@ -7103,15 +7229,29 @@ function collectParts2(root, exempt, supports) {
lodExcluded++;
return;
}
- if (EXEMPT_NAME.test(name)) {
+ if (STANDS_APART_NAME.test(name)) {
exempt.push(name);
return;
}
- const box = new THREE9.Box3().setFromObject(mesh);
+ const box = new THREE10.Box3().setFromObject(mesh);
if (box.isEmpty())
return;
+ const components = meshComponentBoxes(mesh, budget);
+ if (components && components.length > 1) {
+ for (const [index, piece] of components.entries()) {
+ const support = restingSupport(mesh, piece.min.y, supports);
+ parts.push({
+ name: `${name} (welded component ${index + 1} of ${components.length})`,
+ node: name,
+ weldedOf: components.length,
+ box: piece,
+ ...support ? { support } : {}
+ });
+ }
+ return;
+ }
const support = restingSupport(mesh, box.min.y, supports);
- parts.push({ name, box, ...support ? { support } : {} });
+ parts.push({ name, node: name, box, ...support ? { support } : {} });
});
return { parts, lodExcluded };
}
@@ -7121,14 +7261,37 @@ function boxGap(a, b) {
const dz = Math.max(0, Math.max(a.min.z - b.max.z, b.min.z - a.max.z));
return Math.hypot(dx, dy, dz);
}
+function collapseWeldedGroups(groups) {
+ const byMesh = new Map;
+ const out = [];
+ for (const group of groups) {
+ const mesh = group.welded?.mesh;
+ const first = mesh === undefined ? undefined : byMesh.get(mesh);
+ if (mesh === undefined)
+ out.push(group);
+ else if (!first) {
+ byMesh.set(mesh, group);
+ out.push(group);
+ } else {
+ first.parts.push(...group.parts);
+ if (group.gap < first.gap) {
+ first.gap = group.gap;
+ first.welded = group.welded;
+ }
+ }
+ }
+ return out;
+}
function analyzePartConnectivity(root, supports) {
const exempt = [];
- const { parts, lodExcluded } = collectParts2(root, exempt, supports);
+ const budget = splitBudget();
+ const { parts, lodExcluded } = collectParts2(root, exempt, budget, supports);
const report = {
partsAnalyzed: parts.length,
mainComponentSize: parts.length,
exempt,
lodExcluded,
+ unsplit: budget.unsplit,
groups: []
};
if (parts.length < 2)
@@ -7179,15 +7342,25 @@ function analyzePartConnectivity(root, supports) {
if (index === mainIndex)
continue;
let gap = Number.POSITIVE_INFINITY;
+ let nearestMember = members[0];
+ let nearestMain = main[0];
for (const m of members) {
for (const b of main) {
- gap = Math.min(gap, boxGap(parts[m].box, parts[b].box));
+ const between = boxGap(parts[m].box, parts[b].box);
+ if (between < gap) {
+ gap = between;
+ nearestMember = m;
+ nearestMain = b;
+ }
}
}
+ const node = parts[members[0]].node;
+ const welded = members.every((m) => parts[m].weldedOf && parts[m].node === node);
const lowest = members.reduce((a, b) => parts[b].box.min.y < parts[a].box.min.y ? b : a);
const support = parts[lowest].support;
report.groups.push({
parts: members.map((m) => parts[m].name),
+ node,
gap: Math.round(gap * 1e6) / 1e6,
...support && members.every((m) => parts[m].support) ? {
externalSupport: {
@@ -7195,19 +7368,30 @@ function analyzePartConnectivity(root, supports) {
bottomY: Math.round(parts[lowest].box.min.y * 1e6) / 1e6,
tolerance: support.tolerance ?? CONNECTIVITY_TOLERANCE
}
+ } : welded ? {
+ welded: {
+ mesh: node,
+ components: parts[members[0]].weldedOf,
+ detached: locationOf(parts[nearestMember]),
+ nearest: locationOf(parts[nearestMain])
+ }
} : {}
});
}
+ report.groups = collapseWeldedGroups(report.groups);
report.groups.sort((a, b) => b.parts.length - a.parts.length || a.gap - b.gap);
return report;
}
function inspectPartConnectivity(scene, supports) {
- if (!(scene instanceof THREE9.Object3D))
+ if (!(scene instanceof THREE10.Object3D))
return [];
const report = analyzePartConnectivity(scene, supports);
const lodNote = report.lodExcluded === 1 ? " 1 part on an LOD level above 0 was not analyzed." : report.lodExcluded > 1 ? ` ${report.lodExcluded} parts on LOD levels above 0 were not analyzed.` : "";
+ const unsplitNote = report.unsplit.length ? ` Over the split budget, so measured as one box: ${report.unsplit.slice(0, 5).map((mesh) => JSON.stringify(mesh)).join(", ")}${report.unsplit.length > 5 ? ` and ${report.unsplit.length - 5} more` : ""}.` : "";
return report.groups.map((group) => {
- const listed = group.parts.map((p) => JSON.stringify(p)).join(", ");
+ const named = group.parts.slice(0, MAX_LISTED_PARTS).map((p) => JSON.stringify(p));
+ const unnamed = group.parts.length - named.length;
+ const listed = `${named.join(", ")}${unnamed > 0 ? `, +${unnamed} more` : ""}`;
const subject = group.parts.length === 1 ? `Part ${listed} is` : `A group of ${group.parts.length} parts (${listed}) is`;
const declared = group.externalSupport;
if (declared)
@@ -7217,7 +7401,7 @@ function inspectPartConnectivity(scene, supports) {
dimension: "visualQuality",
profile: "geometry.partConnectivity",
message: `${subject} separate from the largest component and rests on the support declared in requirements.externalSupport at Y=${declared.planeY.toFixed(3)} m (bottom at Y=${declared.bottomY.toFixed(3)} m). Information only: the support is composed outside this asset.${lodNote}`,
- affected: { node: group.parts[0] },
+ affected: { node: group.node },
measurement: {
name: "bottomToSupportPlane",
actual: declared.bottomY,
@@ -7226,13 +7410,36 @@ function inspectPartConnectivity(scene, supports) {
},
repairText: "No change is needed for a declared support. Remove the part from requirements.externalSupport if it should attach within this asset."
};
+ if (group.welded) {
+ const { mesh, components, detached, nearest } = group.welded;
+ const span = ({ min, max }) => `[${min.join(", ")}] to [${max.join(", ")}]`;
+ return {
+ code: "GEO_PART_CONNECTIVITY",
+ disposition: "observe",
+ dimension: "visualQuality",
+ profile: "geometry.partConnectivity",
+ message: `Mesh ${JSON.stringify(mesh)} is one drawn part, but ${group.parts.length} of its ${components} welded components ${group.parts.length === 1 ? "is" : "are"} separate from the largest component in the rest-pose bounding boxes of visible parts; the nearest box gap is ${group.gap.toFixed(3)} m. Nearest detached: ${span(detached)}. It is nearest to ${JSON.stringify(nearest.part)} at ${span(nearest)}. This may be intentional. Box adjacency is not physical attachment evidence: a gap under ${CONNECTIVITY_TOLERANCE} m reads as contact.${lodNote}${unsplitNote}`,
+ affected: { node: mesh },
+ measurement: {
+ name: "gapToMainComponent",
+ actual: group.gap,
+ expected: CONNECTIVITY_TOLERANCE,
+ breakdown: {
+ weldedComponents: components,
+ detachedComponents: group.parts.length,
+ ...report.lodExcluded ? { lodExcludedParts: report.lodExcluded } : {}
+ }
+ },
+ repairText: "Check whether the separation is intentional. One mesh moves and hides as one, so a component meant to attach needs its gap closed in the merged geometry; one meant to stand apart reads better as its own part."
+ };
+ }
return {
code: "GEO_PART_CONNECTIVITY",
disposition: "observe",
dimension: "visualQuality",
profile: "geometry.partConnectivity",
- message: `${subject} separate from the largest component in the rest-pose bounding boxes of visible parts; the nearest box gap is ${group.gap.toFixed(3)} m. This may be intentional. Box adjacency is not physical attachment evidence: a gap under ${CONNECTIVITY_TOLERANCE} m reads as contact, and primitives welded into one mesh form one box.${lodNote}`,
- affected: { node: group.parts[0] },
+ message: `${subject} separate from the largest component in the rest-pose bounding boxes of visible parts; the nearest box gap is ${group.gap.toFixed(3)} m. This may be intentional. Box adjacency is not physical attachment evidence: a gap under ${CONNECTIVITY_TOLERANCE} m reads as contact.${lodNote}${unsplitNote}`,
+ affected: { node: group.node },
measurement: {
name: "gapToMainComponent",
actual: group.gap,
@@ -7243,11 +7450,19 @@ function inspectPartConnectivity(scene, supports) {
};
});
}
-var CONNECTIVITY_TOLERANCE = 0.02, EXEMPT_NAME, PART_CONNECTIVITY_QA_RULE;
+var CONNECTIVITY_TOLERANCE = 0.02, MAX_LISTED_PARTS = 12, rounded = (v) => [
+ Math.round(v.x * 1e4) / 1e4,
+ Math.round(v.y * 1e4) / 1e4,
+ Math.round(v.z * 1e4) / 1e4
+], locationOf = (part) => ({
+ part: part.name,
+ min: rounded(part.box.min),
+ max: rounded(part.box.max)
+}), PART_CONNECTIVITY_QA_RULE;
var init_part_connectivity = __esm(() => {
init_lod2();
+ init_mesh_components();
init_registry();
- EXEMPT_NAME = /(?:^|_)(?:leaf|leaves|foliage|frond|card|decal|billboard|petal)/i;
PART_CONNECTIVITY_QA_RULE = Object.freeze({
id: "GEO_PART_CONNECTIVITY",
profile: "geometry.partConnectivity",
@@ -7262,7 +7477,7 @@ var init_part_connectivity = __esm(() => {
});
// src/geometry.ts
-import * as THREE10 from "three";
+import * as THREE11 from "three";
function finiteArray(values, label, length) {
const result = Array.from(values);
if (length !== undefined && result.length !== length)
@@ -7276,8 +7491,8 @@ function meshGeo(data) {
if (positions.length < 9 || positions.length % 3)
throw new Error("meshGeo positions: need at least three xyz vertices");
const count = positions.length / 3;
- const geometry = new THREE10.BufferGeometry;
- geometry.setAttribute("position", new THREE10.Float32BufferAttribute(positions, 3));
+ const geometry = new THREE11.BufferGeometry;
+ geometry.setAttribute("position", new THREE11.Float32BufferAttribute(positions, 3));
if (data.indices) {
const indices = Array.from(data.indices);
if (!indices.length || indices.length % 3)
@@ -7289,7 +7504,7 @@ function meshGeo(data) {
throw new Error("meshGeo: non-indexed positions must form complete triangles");
if (data.normals) {
const normals = finiteArray(data.normals, "meshGeo normals", count * 3);
- geometry.setAttribute("normal", new THREE10.Float32BufferAttribute(normals, 3));
+ geometry.setAttribute("normal", new THREE11.Float32BufferAttribute(normals, 3));
for (let i = 0;i < count; i++)
if (Math.hypot(normals[i * 3], normals[i * 3 + 1], normals[i * 3 + 2]) === 0)
throw new Error("meshGeo normals: zero-length normal");
@@ -7297,36 +7512,36 @@ function meshGeo(data) {
} else
geometry.computeVertexNormals();
if (data.uvs)
- geometry.setAttribute("uv", new THREE10.Float32BufferAttribute(finiteArray(data.uvs, "meshGeo uvs", count * 2), 2));
+ geometry.setAttribute("uv", new THREE11.Float32BufferAttribute(finiteArray(data.uvs, "meshGeo uvs", count * 2), 2));
if (data.tangents) {
const tangents = finiteArray(data.tangents, "meshGeo tangents", count * 4);
for (let i = 0;i < count; i++) {
if (Math.abs(Math.hypot(tangents[i * 4], tangents[i * 4 + 1], tangents[i * 4 + 2]) - 1) > 0.0001 || Math.abs(tangents[i * 4 + 3]) !== 1)
throw new Error("meshGeo tangents: expected unit xyz and handedness +1 or -1");
}
- geometry.setAttribute("tangent", new THREE10.Float32BufferAttribute(tangents, 4));
+ geometry.setAttribute("tangent", new THREE11.Float32BufferAttribute(tangents, 4));
}
geometry.computeBoundingBox();
geometry.computeBoundingSphere();
return geometry;
}
function boundsScale(bounds) {
- const size = bounds.getSize(new THREE10.Vector3);
+ const size = bounds.getSize(new THREE11.Vector3);
const scale = Math.hypot(size.x, size.y, size.z);
if (!Number.isFinite(scale))
throw new Error("Geometry position extent must be finite");
return scale;
}
function positionFrame(position) {
- const bounds = new THREE10.Box3;
- const point = new THREE10.Vector3;
+ const bounds = new THREE11.Box3;
+ const point = new THREE11.Vector3;
for (let i = 0;i < position.count; i++) {
point.fromBufferAttribute(position, i);
if ([point.x, point.y, point.z].every(Number.isFinite))
bounds.expandByPoint(point);
}
return {
- origin: bounds.isEmpty() ? new THREE10.Vector3 : bounds.min,
+ origin: bounds.isEmpty() ? new THREE11.Vector3 : bounds.min,
scale: boundsScale(bounds)
};
}
@@ -7366,11 +7581,11 @@ function geometryDiagnostics(geometry, tolerance) {
solid: { closed: false, manifold: true, orientation: "mixed", signedVolume: 0 }
};
let signedVolume = 0;
- const pa = new THREE10.Vector3, pb = new THREE10.Vector3, pc = new THREE10.Vector3;
+ const pa = new THREE11.Vector3, pb = new THREE11.Vector3, pc = new THREE11.Vector3;
const ids = [];
const points = new Map;
const finite = [];
- const point = new THREE10.Vector3;
+ const point = new THREE11.Vector3;
for (let i = 0;i < p.count; i++) {
point.fromBufferAttribute(p, i);
finite[i] = [point.x, point.y, point.z].every(Number.isFinite);
@@ -7383,7 +7598,7 @@ function geometryDiagnostics(geometry, tolerance) {
}
const indices = geometry.index ? Array.from(geometry.index.array) : Array.from({ length: p.count }, (_, i) => i);
const edges = new Map;
- const a = new THREE10.Vector3, b = new THREE10.Vector3, c = new THREE10.Vector3;
+ const a = new THREE11.Vector3, b = new THREE11.Vector3, c = new THREE11.Vector3;
for (let i = 0;i < indices.length; i += 3) {
result.triangles++;
const triangle = indices.slice(i, i + 3);
@@ -7468,8 +7683,8 @@ function parametricSurface(sample, options = {}) {
if (orientation !== "uv" && orientation !== "vu")
throw new Error("parametricSurface orientation must be uv or vu");
const positions = [], uvs = [], indices = [];
- const sampledBounds = new THREE10.Box3;
- const sampledPoint = new THREE10.Vector3;
+ const sampledBounds = new THREE11.Box3;
+ const sampledPoint = new THREE11.Vector3;
for (let j = 0;j <= nv; j++)
for (let i = 0;i <= nu; i++) {
const point = sample(u[0] + (u[1] - u[0]) * i / nu, v[0] + (v[1] - v[0]) * j / nv);
@@ -7511,8 +7726,8 @@ function parametricSurface(sample, options = {}) {
const sums = new Map;
for (let i = 0;i < normal.count; i++) {
const id = find(i);
- const sum = sums.get(id) ?? new THREE10.Vector3;
- sum.add(new THREE10.Vector3().fromBufferAttribute(normal, i));
+ const sum = sums.get(id) ?? new THREE11.Vector3;
+ sum.add(new THREE11.Vector3().fromBufferAttribute(normal, i));
sums.set(id, sum);
}
for (let i = 0;i < normal.count; i++) {
@@ -7537,13 +7752,13 @@ function creaseNormals(geometry, options = {}) {
const keys = [];
const faces = [];
for (let i = 0;i < position.count; i += 3) {
- const a = new THREE10.Vector3().fromBufferAttribute(position, i);
- const b = new THREE10.Vector3().fromBufferAttribute(position, i + 1);
- const c = new THREE10.Vector3().fromBufferAttribute(position, i + 2);
+ const a = new THREE11.Vector3().fromBufferAttribute(position, i);
+ const b = new THREE11.Vector3().fromBufferAttribute(position, i + 1);
+ const c = new THREE11.Vector3().fromBufferAttribute(position, i + 2);
const face = b.sub(a).divideScalar(scale).cross(c.sub(a).divideScalar(scale)).normalize();
faces.push(face);
for (let j = i;j < i + 3; j++) {
- const point = new THREE10.Vector3().fromBufferAttribute(position, j);
+ const point = new THREE11.Vector3().fromBufferAttribute(position, j);
if (![point.x, point.y, point.z].every(Number.isFinite))
throw new Error("creaseNormals positions must be finite");
const key = positionKey(point, frame.origin, tolerance);
@@ -7554,15 +7769,15 @@ function creaseNormals(geometry, options = {}) {
}
}
const normals = new Float32Array(position.count * 3);
- const threshold = Math.cos(THREE10.MathUtils.degToRad(angle));
+ const threshold = Math.cos(THREE11.MathUtils.degToRad(angle));
for (let i = 0;i < position.count; i++) {
- const face = faces[Math.floor(i / 3)], sum = new THREE10.Vector3;
+ const face = faces[Math.floor(i / 3)], sum = new THREE11.Vector3;
for (const other of adjacent.get(keys[i]))
if (face.dot(faces[other]) >= threshold - 0.000000000001)
sum.add(faces[other]);
sum.normalize().toArray(normals, i * 3);
}
- out.setAttribute("normal", new THREE10.BufferAttribute(normals, 3));
+ out.setAttribute("normal", new THREE11.BufferAttribute(normals, 3));
out.deleteAttribute("tangent");
out.computeBoundingBox();
out.computeBoundingSphere();
@@ -7574,14 +7789,14 @@ var init_geometry = __esm(() => {
});
// src/qa/open-surface-penetration.ts
-import * as THREE11 from "three";
+import * as THREE12 from "three";
function buildHierarchy(triangles) {
- const box = new THREE11.Box3;
+ const box = new THREE12.Box3;
for (const triangle of triangles)
box.union(triangle.box);
if (triangles.length <= 4)
return { box, triangles };
- const size = box.getSize(new THREE11.Vector3);
+ const size = box.getSize(new THREE12.Vector3);
const axis = size.x >= size.y && size.x >= size.z ? "x" : size.y >= size.z ? "y" : "z";
const center = (triangle) => triangle.box.min[axis] / 2 + triangle.box.max[axis] / 2;
const sorted = [...triangles].sort((a, b) => center(a) - center(b));
@@ -7605,15 +7820,15 @@ function worldTriangles(mesh) {
const id = index ? index.getX(at) : at;
if (!Number.isSafeInteger(id) || id < 0 || id >= position.count)
return null;
- const point = new THREE11.Vector3().fromBufferAttribute(position, id).applyMatrix4(mesh.matrixWorld);
+ const point = new THREE12.Vector3().fromBufferAttribute(position, id).applyMatrix4(mesh.matrixWorld);
return [point.x, point.y, point.z].every(Number.isFinite) ? point : null;
};
for (let i = 0;i < count; i += 3) {
const a = vertex(i), b = vertex(i + 1), c = vertex(i + 2);
if (!a || !b || !c)
return null;
- const triangle = new THREE11.Triangle(a, b, c);
- triangles.push({ triangle, box: new THREE11.Box3().setFromPoints([a, b, c]) });
+ const triangle = new THREE12.Triangle(a, b, c);
+ triangles.push({ triangle, box: new THREE12.Box3().setFromPoints([a, b, c]) });
}
return triangles.length ? triangles : null;
}
@@ -7714,7 +7929,7 @@ class Budget {
function nearestDistance(root, point, budget) {
let best = Infinity;
const stack = [root];
- const scratch = new THREE11.Vector3;
+ const scratch = new THREE12.Vector3;
while (stack.length) {
const node = stack.pop();
if (boxDistanceSquared(node.box, point) >= best)
@@ -7733,10 +7948,10 @@ function nearestDistance(root, point, budget) {
return Number.isFinite(best) ? Math.sqrt(best) : null;
}
function parity(root, point, direction, budget) {
- const ray = new THREE11.Ray(point, direction);
+ const ray = new THREE12.Ray(point, direction);
const stack = [root];
- const hit = new THREE11.Vector3;
- const barycentric = new THREE11.Vector3;
+ const hit = new THREE12.Vector3;
+ const barycentric = new THREE12.Vector3;
let crossings = 0;
while (stack.length) {
const node = stack.pop();
@@ -7784,7 +7999,7 @@ function analyzeOpenSurfacePenetration(root, contactTolerance = OPEN_SURFACE_CON
skipped: [],
penetrations: []
};
- if (!(root instanceof THREE11.Object3D))
+ if (!(root instanceof THREE12.Object3D))
return evidence;
const parts = collectParts3(root, evidence.skipped);
const open = parts.filter((part) => !part.closed);
@@ -7849,7 +8064,7 @@ function analyzeOpenSurfacePenetration(root, contactTolerance = OPEN_SURFACE_CON
}
const matrix = candidate.open.mesh.matrixWorld;
const limit = Math.min(position.count, MAX_SAMPLED_VERTICES);
- const vertex = new THREE11.Vector3;
+ const vertex = new THREE12.Vector3;
let depth = 0;
let penetrating = 0;
let tested = 0;
@@ -7979,9 +8194,9 @@ var init_open_surface_penetration = __esm(() => {
init_lod2();
init_registry();
PARITY_DIRECTIONS = Object.freeze([
- new THREE11.Vector3(1, 0, 0),
- new THREE11.Vector3(0.5773502691896258, 0.5773502691896258, 0.5773502691896258),
- new THREE11.Vector3(-0.2672612419124244, 0.5345224838248488, 0.8017837257372732)
+ new THREE12.Vector3(1, 0, 0),
+ new THREE12.Vector3(0.5773502691896258, 0.5773502691896258, 0.5773502691896258),
+ new THREE12.Vector3(-0.2672612419124244, 0.5345224838248488, 0.8017837257372732)
]);
OPEN_SURFACE_PENETRATION_QA_RULE = Object.freeze({
id: "GEO_OPEN_SURFACE_PENETRATION",
@@ -7997,9 +8212,9 @@ var init_open_surface_penetration = __esm(() => {
});
// src/sweep-analysis.ts
-import * as THREE12 from "three";
+import * as THREE13 from "three";
function segmentHitsTriangle(a, b, tri, epsilon) {
- const plane = new THREE12.Plane().setFromCoplanarPoints(tri.a, tri.b, tri.c);
+ const plane = new THREE13.Plane().setFromCoplanarPoints(tri.a, tri.b, tri.c);
if (plane.normal.lengthSq() === 0)
return false;
const da = plane.distanceToPoint(a), db = plane.distanceToPoint(b);
@@ -8037,7 +8252,7 @@ function recordSweepAnalysis(geometry, rings, profiles, closed) {
return result;
}
const unique = closed ? rings.length - 1 : rings.length;
- const centers = rings.map((ring) => ring.reduce((sum, p) => sum.add(p), new THREE12.Vector3).divideScalar(ring.length));
+ const centers = rings.map((ring) => ring.reduce((sum, p) => sum.add(p), new THREE13.Vector3).divideScalar(ring.length));
for (let i = closed ? 0 : 1;i < (closed ? unique : unique - 1); i++) {
const a = centers[(i - 1 + unique) % unique], b = centers[i], c = centers[(i + 1) % unique];
const u = b.clone().sub(a), v = c.clone().sub(b);
@@ -8051,17 +8266,17 @@ function recordSweepAnalysis(geometry, rings, profiles, closed) {
const triangles = new Map;
const faces = (index) => {
if (!triangles.has(index))
- triangles.set(index, THREE12.ShapeUtils.triangulateShape(profiles[index], []).map(([a, b, c]) => new THREE12.Triangle(rings[index][a], rings[index][b], rings[index][c])));
+ triangles.set(index, THREE13.ShapeUtils.triangulateShape(profiles[index], []).map(([a, b, c]) => new THREE13.Triangle(rings[index][a], rings[index][b], rings[index][c])));
return triangles.get(index);
};
for (let i = 1;i < rings.length; i++) {
- const boundsA = new THREE12.Box3().setFromPoints(rings[i - 1]);
- const boundsB = new THREE12.Box3().setFromPoints(rings[i]);
+ const boundsA = new THREE13.Box3().setFromPoints(rings[i - 1]);
+ const boundsB = new THREE13.Box3().setFromPoints(rings[i]);
if (!boundsA.intersectsBox(boundsB)) {
result.ringPairsChecked++;
continue;
}
- const epsilon = Math.max(boundsA.getSize(new THREE12.Vector3).length(), boundsB.getSize(new THREE12.Vector3).length()) * 0.0000000001;
+ const epsilon = Math.max(boundsA.getSize(new THREE13.Vector3).length(), boundsB.getSize(new THREE13.Vector3).length()) * 0.0000000001;
let hit = false;
pair:
for (const [a, b] of [
@@ -8216,7 +8431,7 @@ var init_open_shell = __esm(() => {
});
// src/qa/self-intersection.ts
-import * as THREE13 from "three";
+import * as THREE14 from "three";
function boxOverlapRatio2(a, b) {
const shared = Math.max(0, Math.min(a.max.x, b.max.x) - Math.max(a.min.x, b.min.x)) * Math.max(0, Math.min(a.max.y, b.max.y) - Math.max(a.min.y, b.min.y)) * Math.max(0, Math.min(a.max.z, b.max.z) - Math.max(a.min.z, b.min.z));
const ratio = shared / Math.min(boxVolume(a), boxVolume(b));
@@ -8267,8 +8482,8 @@ function collectParts4(root, skipped) {
const box = mesh.geometry.boundingBox.clone().applyMatrix4(mesh.matrixWorld);
if (box.isEmpty())
return;
- const center = box.getCenter(new THREE13.Vector3);
- const size = box.getSize(new THREE13.Vector3);
+ const center = box.getCenter(new THREE14.Vector3);
+ const size = box.getSize(new THREE14.Vector3);
const scale = Math.max(size.x, size.y, size.z);
if (![...box.min, ...box.max, scale].every(Number.isFinite) || !(scale > 0) || !Number.isFinite(mesh.matrixWorld.determinant()) || mesh.matrixWorld.determinant() === 0) {
skipped.push({
@@ -8300,7 +8515,7 @@ function meshToArrays(part) {
matrix.elements[12] -= center.x;
matrix.elements[13] -= center.y;
matrix.elements[14] -= center.z;
- const v = new THREE13.Vector3;
+ const v = new THREE14.Vector3;
const verts = new Float32Array(position.count * 3);
for (let i = 0;i < position.count; i++) {
v.set(position.getX(i), position.getY(i), position.getZ(i)).applyMatrix4(matrix).divideScalar(scale);
@@ -8648,7 +8863,7 @@ var init_self_intersection = __esm(() => {
});
// src/vehicle.ts
-import * as THREE14 from "three";
+import * as THREE15 from "three";
function assertId(value, name) {
if (!ID_PATTERN.test(value))
throw new TypeError(`${name} must be a stable identifier`);
@@ -8683,7 +8898,7 @@ function createTypedSocket(kind, input, parent) {
if (!input.position.every(Number.isFinite))
throw new TypeError(`${kind}.${id} position must be finite`);
const rotation = normalizedQuaternion(input.rotation);
- const node = new THREE14.Object3D;
+ const node = new THREE15.Object3D;
node.name = `Socket_${kind}_${id}`;
node.position.set(...input.position);
node.quaternion.set(...rotation);
@@ -8704,7 +8919,7 @@ function createTypedSocket(kind, input, parent) {
return node;
}
function createVehicleFrame(name, options = {}) {
- const root = new THREE14.Object3D;
+ const root = new THREE15.Object3D;
root.name = name;
stampSemanticMetadataV1(root, semantic2([KILN_SEMANTIC_ROLES.vehicleFrame, KILN_SEMANTIC_ROLES.vehicleForward], {
frames: [
@@ -8729,7 +8944,7 @@ function createVehicleFrame(name, options = {}) {
};
}
function cylinderZ(radius, width, segments = 16) {
- const geometry = new THREE14.CylinderGeometry(radius, radius, width, segments);
+ const geometry = new THREE15.CylinderGeometry(radius, radius, width, segments);
geometry.rotateX(Math.PI / 2);
return geometry;
}
@@ -8746,14 +8961,14 @@ function defaultTireGeometry(radius, width) {
if (width >= radius * 2)
throw new RangeError("default wheel tire width must be less than its diameter");
const tube = width / 2;
- return new THREE14.TorusGeometry(radius - tube, tube, 8, 20);
+ return new THREE15.TorusGeometry(radius - tube, tube, 8, 20);
}
function checkWheelGeometry(part, geometry, radius, width) {
const positions = geometry.getAttribute("position");
if (positions?.itemSize !== 3 || positions.count < 1 || positions.count > 2000000)
throw new RangeError(`wheel ${part} position must have 1..2000000 three-component samples.`);
- const bounds = new THREE14.Box3;
- const point = new THREE14.Vector3;
+ const bounds = new THREE15.Box3;
+ const point = new THREE15.Vector3;
let actualRadius = 0;
for (let i = 0;i < positions.count; i++) {
point.fromBufferAttribute(positions, i);
@@ -8763,7 +8978,7 @@ function checkWheelGeometry(part, geometry, radius, width) {
actualRadius = Math.max(actualRadius, Math.hypot(point.x, point.y));
}
const actualWidth = bounds.max.z - bounds.min.z;
- const center = bounds.getCenter(new THREE14.Vector3);
+ const center = bounds.getCenter(new THREE15.Vector3);
const tolerance = 0.00001 * Math.max(radius, width, actualRadius, actualWidth);
const differences = [];
if (Math.abs(actualRadius - radius) > tolerance)
@@ -8808,11 +9023,11 @@ function createWheelAssembly(name, materials, options) {
const index = assertId(String(options.index), "wheel index");
const key = `${options.side}.${index}`;
const parent = options.parent;
- const root = new THREE14.Object3D;
+ const root = new THREE15.Object3D;
root.name = `${name}_Assembly_${options.side}_${index}`;
let steeringPivot;
if (options.steering) {
- steeringPivot = new THREE14.Object3D;
+ steeringPivot = new THREE15.Object3D;
steeringPivot.name = `SteeringPivot_${options.side}_${index}`;
steeringPivot.position.set(...options.position ?? [0, 0, 0]);
stampSemanticMetadataV1(steeringPivot, semantic2([semanticRole(ROLE.steeringPivot, key)], {
@@ -8823,7 +9038,7 @@ function createWheelAssembly(name, materials, options) {
}));
root.add(steeringPivot);
}
- const spinPivot = new THREE14.Object3D;
+ const spinPivot = new THREE15.Object3D;
spinPivot.name = `WheelPivot_${options.side}_${index}`;
if (!steeringPivot)
spinPivot.position.set(...options.position ?? [0, 0, 0]);
@@ -8844,9 +9059,9 @@ function createWheelAssembly(name, materials, options) {
]
}));
(steeringPivot ?? root).add(spinPivot);
- const tire = new THREE14.Mesh(options.geometries?.tire ?? defaultTireGeometry(radius, width), materials.tire);
- const rim = new THREE14.Mesh(options.geometries?.rim ?? cylinderZ(rimRadius, rimWidth), materials.rim);
- const hub = new THREE14.Mesh(options.geometries?.hub ?? cylinderZ(hubRadius, hubWidth), materials.hub ?? materials.rim);
+ const tire = new THREE15.Mesh(options.geometries?.tire ?? defaultTireGeometry(radius, width), materials.tire);
+ const rim = new THREE15.Mesh(options.geometries?.rim ?? cylinderZ(rimRadius, rimWidth), materials.rim);
+ const hub = new THREE15.Mesh(options.geometries?.hub ?? cylinderZ(hubRadius, hubWidth), materials.hub ?? materials.rim);
tire.name = `Tire_${options.side}_${index}`;
rim.name = `Rim_${options.side}_${index}`;
hub.name = `Hub_${options.side}_${index}`;
@@ -8866,7 +9081,7 @@ function createWheelAssembly(name, materials, options) {
]
}));
spinPivot.add(tire, rim, hub);
- const contact = new THREE14.Object3D;
+ const contact = new THREE15.Object3D;
contact.name = `Contact_${options.side}_${index}`;
contact.position.y = -radius;
stampSemanticMetadataV1(contact, semantic2([semanticRole(ROLE.wheelContact, key), semanticRole(ROLE.contact, key)], {
@@ -8924,10 +9139,10 @@ function objectBoundsInFrame(object, frame) {
object.updateWorldMatrix(true, true);
frame.updateWorldMatrix(true, false);
const worldToFrame = frame.matrixWorld.clone().invert();
- const bounds = new THREE14.Box3;
+ const bounds = new THREE15.Box3;
let found = false;
object.traverse((node) => {
- if (!(node instanceof THREE14.Mesh) || !(node.geometry instanceof THREE14.BufferGeometry))
+ if (!(node instanceof THREE15.Mesh) || !(node.geometry instanceof THREE15.BufferGeometry))
return;
node.geometry.computeBoundingBox();
const local = node.geometry.boundingBox;
@@ -8937,7 +9152,7 @@ function objectBoundsInFrame(object, frame) {
for (const x of [local.min.x, local.max.x])
for (const y of [local.min.y, local.max.y])
for (const z of [local.min.z, local.max.z]) {
- bounds.expandByPoint(new THREE14.Vector3(x, y, z).applyMatrix4(matrix));
+ bounds.expandByPoint(new THREE15.Vector3(x, y, z).applyMatrix4(matrix));
found = true;
}
});
@@ -8949,9 +9164,9 @@ function dimensions(object, frame) {
const bounds = objectBoundsInFrame(object, frame);
if (!bounds)
return;
- const size = bounds.getSize(new THREE14.Vector3);
+ const size = bounds.getSize(new THREE15.Vector3);
return {
- center: bounds.getCenter(new THREE14.Vector3),
+ center: bounds.getCenter(new THREE15.Vector3),
radius: Math.max(size.x, size.y) / 2,
width: size.z
};
@@ -8961,7 +9176,7 @@ function resolved(source, id, root, pivot, parts) {
const tire = dimensions(parts.tire, pivot);
const rim = dimensions(parts.rim, pivot);
const hub = dimensions(parts.hub, pivot);
- const centerLocal = tire?.center ?? rim?.center ?? hub?.center ?? new THREE14.Vector3;
+ const centerLocal = tire?.center ?? rim?.center ?? hub?.center ?? new THREE15.Vector3;
const toWorld = (value) => value.clone().applyMatrix4(pivot.matrixWorld);
return {
id,
@@ -8976,11 +9191,11 @@ function resolved(source, id, root, pivot, parts) {
...parts.hub ? { hub: parts.hub } : {},
...parts.contact ? { contact: parts.contact } : {},
centerWorld: toWorld(centerLocal),
- pivotCenterWorld: new THREE14.Vector3().setFromMatrixPosition(pivot.matrixWorld),
+ pivotCenterWorld: new THREE15.Vector3().setFromMatrixPosition(pivot.matrixWorld),
...tire ? { tireCenterWorld: toWorld(tire.center) } : {},
...rim ? { rimCenterWorld: toWorld(rim.center) } : {},
...hub ? { hubCenterWorld: toWorld(hub.center) } : {},
- spinAxisWorld: new THREE14.Vector3(0, 0, 1).transformDirection(pivot.matrixWorld),
+ spinAxisWorld: new THREE15.Vector3(0, 0, 1).transformDirection(pivot.matrixWorld),
...tire ? { radius: tire.radius, width: tire.width } : {},
...rim ? { rimRadius: rim.radius, rimWidth: rim.width } : {},
...hub ? { hubRadius: hub.radius, hubWidth: hub.width } : {},
@@ -9317,7 +9532,7 @@ var EPSILON = 0.0000000001, DEFAULT_TOLERANCE = 0.000001, finiteVector = (value)
];
// src/qa/vehicle-advisory.ts
-import * as THREE15 from "three";
+import * as THREE16 from "three";
function advisory(context, value) {
return {
...value,
@@ -9391,7 +9606,7 @@ function isFender(node) {
return semanticRoles(node).some((role) => /(?:^|\.)(?:fender|wheel-arch)(?:\.|$)/i.test(role)) || /fender|wheel[ _.-]?arch/i.test(node.name);
}
function isChassisMesh(node) {
- if (!(node instanceof THREE15.Mesh) || isFender(node))
+ if (!(node instanceof THREE16.Mesh) || isFender(node))
return false;
return semanticRoles(node).some((role) => /^(?:vehicle\.)?(?:chassis|body|hull)(?:\.|$)/i.test(role)) || /chassis|vehicle[ _.-]?body|fuselage|hull/i.test(node.name);
}
@@ -9399,10 +9614,10 @@ function objectBoundsInFrame2(object, frame) {
object.updateWorldMatrix(true, true);
frame.updateWorldMatrix(true, false);
const worldToFrame = frame.matrixWorld.clone().invert();
- const bounds = new THREE15.Box3;
+ const bounds = new THREE16.Box3;
let found = false;
object.traverseVisible((part) => {
- if (!(part instanceof THREE15.Mesh) || !(part.geometry instanceof THREE15.BufferGeometry))
+ if (!(part instanceof THREE16.Mesh) || !(part.geometry instanceof THREE16.BufferGeometry))
return;
part.geometry.computeBoundingBox();
const box = part.geometry.boundingBox;
@@ -9412,7 +9627,7 @@ function objectBoundsInFrame2(object, frame) {
for (const x of [box.min.x, box.max.x])
for (const y of [box.min.y, box.max.y])
for (const z of [box.min.z, box.max.z]) {
- bounds.expandByPoint(new THREE15.Vector3(x, y, z).applyMatrix4(matrix));
+ bounds.expandByPoint(new THREE16.Vector3(x, y, z).applyMatrix4(matrix));
found = true;
}
});
@@ -9423,15 +9638,15 @@ function tuple2(value) {
}
function probeBox(id, root, bounds) {
root.updateWorldMatrix(true, false);
- const center = bounds.getCenter(new THREE15.Vector3).applyMatrix4(root.matrixWorld);
- const size = bounds.getSize(new THREE15.Vector3);
- const position = new THREE15.Vector3;
- const quaternion = new THREE15.Quaternion;
- const scale = new THREE15.Vector3;
+ const center = bounds.getCenter(new THREE16.Vector3).applyMatrix4(root.matrixWorld);
+ const size = bounds.getSize(new THREE16.Vector3);
+ const position = new THREE16.Vector3;
+ const quaternion = new THREE16.Quaternion;
+ const scale = new THREE16.Vector3;
root.matrixWorld.decompose(position, quaternion, scale);
- const xAxis = new THREE15.Vector3(1, 0, 0).applyQuaternion(quaternion).normalize();
- const yAxis = new THREE15.Vector3(0, 1, 0).applyQuaternion(quaternion).normalize();
- const zAxis = new THREE15.Vector3(0, 0, 1).applyQuaternion(quaternion).normalize();
+ const xAxis = new THREE16.Vector3(1, 0, 0).applyQuaternion(quaternion).normalize();
+ const yAxis = new THREE16.Vector3(0, 1, 0).applyQuaternion(quaternion).normalize();
+ const zAxis = new THREE16.Vector3(0, 0, 1).applyQuaternion(quaternion).normalize();
return createOrientedProbeBox3({
id,
frame: createProbeLocalFrame3({
@@ -9500,7 +9715,7 @@ function orientationFindings(context, root, intent) {
const bounds = wholeAssetBounds(root);
if (!bounds)
return [];
- const size = bounds.getSize(new THREE15.Vector3);
+ const size = bounds.getSize(new THREE16.Vector3);
const ratio = size.z / Math.max(size.x, 0.000000001);
if (ratio <= ORIENTATION_RATIO)
return [];
@@ -9544,13 +9759,13 @@ function weldedBoundaryEdges(root, loop) {
let triangleCount = 0;
const vertexKey = (point) => [point.x, point.y, point.z].map((value) => Math.round(value * 1e6)).join(",");
loop.traverseVisible((node) => {
- if (!(node instanceof THREE15.Mesh) || !(node.geometry instanceof THREE15.BufferGeometry))
+ if (!(node instanceof THREE16.Mesh) || !(node.geometry instanceof THREE16.BufferGeometry))
return;
const positions = node.geometry.getAttribute("position");
if (!positions)
return;
const matrix = inverse.clone().multiply(node.matrixWorld);
- const keys = Array.from({ length: positions.count }, (_, index) => vertexKey(new THREE15.Vector3().fromBufferAttribute(positions, index).applyMatrix4(matrix)));
+ const keys = Array.from({ length: positions.count }, (_, index) => vertexKey(new THREE16.Vector3().fromBufferAttribute(positions, index).applyMatrix4(matrix)));
const index = node.geometry.getIndex();
const indices = index ? Array.from(index.array, Number) : Array.from({ length: positions.count }, (_, value) => value);
for (let offset = 0;offset + 2 < indices.length; offset += 3) {
@@ -9620,7 +9835,7 @@ function trackProfileFindings(context, root, intent) {
const wheelBounds = objectBoundsInFrame2(roadWheel, root);
if (!wheelBounds)
continue;
- const center = wheelBounds.getCenter(new THREE15.Vector3);
+ const center = wheelBounds.getCenter(new THREE16.Vector3);
if (expanded.containsPoint(center))
continue;
const clamped = center.clone().clamp(expanded.min, expanded.max);
@@ -9646,7 +9861,7 @@ function trackProfileFindings(context, root, intent) {
return findings;
}
function inspectMobilityAdvisory(context) {
- if (!(context.scene instanceof THREE15.Object3D)) {
+ if (!(context.scene instanceof THREE16.Object3D)) {
return [];
}
const intent = context.mobility;
@@ -9693,7 +9908,7 @@ var init_vehicle_advisory = __esm(() => {
});
// src/qa/vehicle.ts
-import * as THREE16 from "three";
+import * as THREE17 from "three";
function finding3(context, value) {
return {
...value,
@@ -9710,7 +9925,7 @@ function rootAxis(root, axis) {
return axis.clone().transformDirection(root.matrixWorld);
}
function angleDegrees(a, b) {
- return THREE16.MathUtils.radToDeg(Math.acos(THREE16.MathUtils.clamp(a.clone().normalize().dot(b.clone().normalize()), -1, 1)));
+ return THREE17.MathUtils.radToDeg(Math.acos(THREE17.MathUtils.clamp(a.clone().normalize().dot(b.clone().normalize()), -1, 1)));
}
function isDescendant(node, ancestor) {
let current = node;
@@ -9758,7 +9973,7 @@ function wheelCountFindings(context, intent, wheels) {
}
function wheelGeometryFindings(context, root, wheels) {
const findings = [];
- const expectedAxle = rootAxis(root, new THREE16.Vector3(0, 0, 1));
+ const expectedAxle = rootAxis(root, new THREE17.Vector3(0, 0, 1));
for (const wheel of wheels) {
const disposition = componentDisposition(wheel);
const centerTolerance = Math.max(CENTER_MINIMUM, (wheel.radius ?? 0) * CENTER_RATIO);
@@ -9947,7 +10162,7 @@ function contactFindings(context, root, intent, wheels) {
function renderableMinYInRoot(rootInverse, node) {
let minimum = Infinity;
node.traverseVisible((part) => {
- if (!(part instanceof THREE16.Mesh) || !(part.geometry instanceof THREE16.BufferGeometry))
+ if (!(part instanceof THREE17.Mesh) || !(part.geometry instanceof THREE17.BufferGeometry))
return;
part.geometry.computeBoundingBox();
const bounds = part.geometry.boundingBox;
@@ -9957,7 +10172,7 @@ function renderableMinYInRoot(rootInverse, node) {
for (const x of [bounds.min.x, bounds.max.x]) {
for (const y of [bounds.min.y, bounds.max.y]) {
for (const z of [bounds.min.z, bounds.max.z]) {
- minimum = Math.min(minimum, new THREE16.Vector3(x, y, z).applyMatrix4(matrix).y);
+ minimum = Math.min(minimum, new THREE17.Vector3(x, y, z).applyMatrix4(matrix).y);
}
}
}
@@ -9975,7 +10190,7 @@ function supportContactFindings(context, root, intent) {
if (!isWheelContact && roles.some((role) => role.startsWith("contact."))) {
explicitContacts.push({
node,
- contactY: localPoint2(inverse, new THREE16.Vector3().setFromMatrixPosition(node.matrixWorld)).y,
+ contactY: localPoint2(inverse, new THREE17.Vector3().setFromMatrixPosition(node.matrixWorld)).y,
source: "contact"
});
}
@@ -10055,7 +10270,7 @@ function steeringFindings(context, root, intent, wheels) {
return [];
root.updateWorldMatrix(true, false);
const inverse = root.matrixWorld.clone().invert();
- const expectedAxis = rootAxis(root, new THREE16.Vector3(0, 1, 0));
+ const expectedAxis = rootAxis(root, new THREE17.Vector3(0, 1, 0));
const localCenters = wheels.map((wheel) => ({
wheel,
center: localPoint2(inverse, wheel.centerWorld)
@@ -10065,8 +10280,8 @@ function steeringFindings(context, root, intent, wheels) {
const findings = [];
for (const { wheel } of targets) {
const steering = wheel.steeringPivot;
- const centerDelta = steering ? localPoint2(inverse, new THREE16.Vector3().setFromMatrixPosition(steering.matrixWorld)).distanceTo(localPoint2(inverse, wheel.centerWorld)) : Infinity;
- const axisAngle = steering ? angleDegrees(new THREE16.Vector3(0, 1, 0).transformDirection(steering.matrixWorld), expectedAxis) : Infinity;
+ const centerDelta = steering ? localPoint2(inverse, new THREE17.Vector3().setFromMatrixPosition(steering.matrixWorld)).distanceTo(localPoint2(inverse, wheel.centerWorld)) : Infinity;
+ const axisAngle = steering ? angleDegrees(new THREE17.Vector3(0, 1, 0).transformDirection(steering.matrixWorld), expectedAxis) : Infinity;
if (!steering || !isDescendant(wheel.pivot, steering) || centerDelta > CENTER_MINIMUM || axisAngle > AXIS_TOLERANCE_DEGREES) {
const axisInvalid = axisAngle > AXIS_TOLERANCE_DEGREES;
findings.push(finding3(context, {
@@ -10121,14 +10336,14 @@ function propulsionFindings(context, root, intent) {
}
for (const component of candidates) {
const pivot = pivots.get(component.id);
- const box = new THREE16.Box3().setFromObject(component.node);
- const center = box.isEmpty() ? undefined : box.getCenter(new THREE16.Vector3);
- const pivotCenter = pivot ? new THREE16.Vector3().setFromMatrixPosition(pivot.matrixWorld) : undefined;
+ const box = new THREE17.Box3().setFromObject(component.node);
+ const center = box.isEmpty() ? undefined : box.getCenter(new THREE17.Vector3);
+ const pivotCenter = pivot ? new THREE17.Vector3().setFromMatrixPosition(pivot.matrixWorld) : undefined;
const delta = center && pivotCenter ? localPoint2(rootInverse, center).distanceTo(localPoint2(rootInverse, pivotCenter)) : Infinity;
const frameId = kind === "rotor" ? "propulsion-axis.+y" : "propulsion-axis.+x";
const axisFrame = readSemanticMetadataV1(pivot ?? component.node)?.frames.find((frame) => frame.id === frameId);
- const canonicalAxis = kind === "rotor" ? new THREE16.Vector3(0, 1, 0) : new THREE16.Vector3(1, 0, 0);
- const axisAngle = pivot && axisFrame ? angleDegrees(canonicalAxis.clone().applyQuaternion(new THREE16.Quaternion(...axisFrame.rotation)).transformDirection(pivot.matrixWorld), rootAxis(root, canonicalAxis)) : Infinity;
+ const canonicalAxis = kind === "rotor" ? new THREE17.Vector3(0, 1, 0) : new THREE17.Vector3(1, 0, 0);
+ const axisAngle = pivot && axisFrame ? angleDegrees(canonicalAxis.clone().applyQuaternion(new THREE17.Quaternion(...axisFrame.rotation)).transformDirection(pivot.matrixWorld), rootAxis(root, canonicalAxis)) : Infinity;
if (!pivot || !isDescendant(component.node, pivot) || delta > CENTER_MINIMUM || !axisFrame || axisAngle > AXIS_TOLERANCE_DEGREES) {
findings.push(finding3(context, {
code: "VEH_ROTOR_PIVOT",
@@ -10150,7 +10365,7 @@ function propulsionFindings(context, root, intent) {
return findings;
}
function inspectMobility(context) {
- if (!(context.scene instanceof THREE16.Object3D))
+ if (!(context.scene instanceof THREE17.Object3D))
return [];
const intent = context.mobility;
if (!intent)
@@ -10223,7 +10438,7 @@ var init_vehicle2 = __esm(() => {
});
// src/qa/vegetation.ts
-import * as THREE17 from "three";
+import * as THREE18 from "three";
function rolesOf2(node) {
return readSemanticMetadataV1(node)?.roles ?? [];
}
@@ -10239,22 +10454,22 @@ function pathOf(node, root) {
return names.reverse().join("/");
}
function localPoint3(rootInverse, node) {
- return node.getWorldPosition(new THREE17.Vector3).applyMatrix4(rootInverse);
+ return node.getWorldPosition(new THREE18.Vector3).applyMatrix4(rootInverse);
}
function meshLocalBox(mesh, rootInverse) {
- if (!(mesh.geometry instanceof THREE17.BufferGeometry))
+ if (!(mesh.geometry instanceof THREE18.BufferGeometry))
return;
mesh.geometry.computeBoundingBox();
const source = mesh.geometry.boundingBox;
if (!source || source.isEmpty())
return;
const base = rootInverse.clone().multiply(mesh.matrixWorld);
- const result = new THREE17.Box3;
- const count = mesh instanceof THREE17.InstancedMesh ? mesh.count : 1;
+ const result = new THREE18.Box3;
+ const count = mesh instanceof THREE18.InstancedMesh ? mesh.count : 1;
for (let index = 0;index < count; index++) {
const transform = base.clone();
- if (mesh instanceof THREE17.InstancedMesh) {
- const instance = new THREE17.Matrix4;
+ if (mesh instanceof THREE18.InstancedMesh) {
+ const instance = new THREE18.Matrix4;
mesh.getMatrixAt(index, instance);
transform.multiply(instance);
}
@@ -10267,7 +10482,7 @@ function collectRenderableBounds(root) {
const inverse = root.matrixWorld.clone().invert();
const values = [];
root.traverseVisible((node) => {
- if (!(node instanceof THREE17.Mesh))
+ if (!(node instanceof THREE18.Mesh))
return;
const box = meshLocalBox(node, inverse);
if (!box)
@@ -10285,7 +10500,7 @@ function vegetationIntent(intent) {
}
function inspectFoliageContact(context) {
const trusted = context.foliage;
- if (!trusted?.grounded || !(context.scene instanceof THREE17.Object3D))
+ if (!trusted?.grounded || !(context.scene instanceof THREE18.Object3D))
return [];
const planeY = context.groundPlaneY ?? 0;
const root = context.scene;
@@ -10323,7 +10538,7 @@ function inspectFoliageContact(context) {
}
const findings = [];
for (const contact of contacts) {
- const contactPoint = contact.frameTranslation ? new THREE17.Vector3(...contact.frameTranslation).applyMatrix4(contact.node.matrixWorld).applyMatrix4(inverse) : localPoint3(inverse, contact.node);
+ const contactPoint = contact.frameTranslation ? new THREE18.Vector3(...contact.frameTranslation).applyMatrix4(contact.node.matrixWorld).applyMatrix4(inverse) : localPoint3(inverse, contact.node);
const y = contactPoint.y;
const offset = y - planeY;
if (Math.abs(offset) <= VEGETATION_CONTACT_TOLERANCE_METERS)
@@ -10352,7 +10567,7 @@ function inspectFoliageContact(context) {
for (const support of semanticSupports) {
let minimumY = Infinity;
support.traverseVisible((node) => {
- if (!(node instanceof THREE17.Mesh))
+ if (!(node instanceof THREE18.Mesh))
return;
const box = meshLocalBox(node, inverse);
if (box)
@@ -10380,25 +10595,25 @@ function inspectFoliageContact(context) {
return findings;
}
function materialNames(node) {
- if (!(node instanceof THREE17.Mesh))
+ if (!(node instanceof THREE18.Mesh))
return [];
const materials = Array.isArray(node.material) ? node.material : [node.material];
return materials.filter(Boolean).map((material) => material.name ?? "");
}
function inspectFoliageScope(context) {
const trusted = context.foliage;
- if (!trusted?.standalone || !(context.scene instanceof THREE17.Object3D))
+ if (!trusted?.standalone || !(context.scene instanceof THREE18.Object3D))
return [];
const root = context.scene;
const renderables = collectRenderableBounds(root);
if (renderables.length === 0)
return [];
- const overall = renderables.reduce((box, value) => box.union(value.box), new THREE17.Box3);
- const overallSize = overall.getSize(new THREE17.Vector3);
+ const overall = renderables.reduce((box, value) => box.union(value.box), new THREE18.Box3);
+ const overallSize = overall.getSize(new THREE18.Vector3);
const findings = [];
for (const value of renderables) {
- const size = value.box.getSize(new THREE17.Vector3);
- const center = value.box.getCenter(new THREE17.Vector3);
+ const size = value.box.getSize(new THREE18.Vector3);
+ const center = value.box.getCenter(new THREE18.Vector3);
const names = [value.node.name, ...value.roles];
const nameEvidence = names.some((name) => CLUTTER_NAME.test(name));
const roleEvidence = value.roles.some((role) => /(?:terrain|soil|rock|pot|planter|base)/i.test(role));
@@ -10435,8 +10650,8 @@ function inspectFoliageScope(context) {
function unionVolume(boxes) {
if (boxes.length === 0)
return 0;
- const union = boxes.reduce((result, box) => result.union(box), new THREE17.Box3);
- const size = union.getSize(new THREE17.Vector3);
+ const union = boxes.reduce((result, box) => result.union(box), new THREE18.Box3);
+ const size = union.getSize(new THREE18.Vector3);
return size.x * size.y * size.z;
}
function projectedOccupancy(boxes, axes) {
@@ -10506,7 +10721,7 @@ function boxDistanceToPoint(box, point) {
function endpointRadius(position, axis, axisValue, tolerance, scale) {
const radialAxes = [0, 1, 2].filter((value) => value !== axis);
const points = [];
- const point = new THREE17.Vector3;
+ const point = new THREE18.Vector3;
for (let index = 0;index < position.count; index++) {
point.fromBufferAttribute(position, index);
if (Math.abs(point.getComponent(axis) - axisValue) <= tolerance)
@@ -10514,7 +10729,7 @@ function endpointRadius(position, axis, axisValue, tolerance, scale) {
}
if (points.length === 0)
return;
- const center = new THREE17.Vector3;
+ const center = new THREE18.Vector3;
center.setComponent(axis, axisValue);
for (const radialAxis of radialAxes) {
center.setComponent(radialAxis, points.reduce((sum, value) => sum + value.getComponent(radialAxis), 0) / points.length);
@@ -10528,7 +10743,7 @@ function endpointRadius(position, axis, axisValue, tolerance, scale) {
return { center, radius };
}
function growthNodeMeasurement(root, candidate, allCandidates, band) {
- if (!(candidate.node instanceof THREE17.Mesh))
+ if (!(candidate.node instanceof THREE18.Mesh))
return;
const geometry = candidate.node.geometry;
const position = geometry.getAttribute("position");
@@ -10540,9 +10755,9 @@ function growthNodeMeasurement(root, candidate, allCandidates, band) {
return;
root.updateWorldMatrix(true, true);
const relative = root.matrixWorld.clone().invert().multiply(candidate.node.matrixWorld);
- const relativeScale = new THREE17.Vector3;
- relative.decompose(new THREE17.Vector3, new THREE17.Quaternion, relativeScale);
- const size = geometryBox.getSize(new THREE17.Vector3);
+ const relativeScale = new THREE18.Vector3;
+ relative.decompose(new THREE18.Vector3, new THREE18.Quaternion, relativeScale);
+ const size = geometryBox.getSize(new THREE18.Vector3);
const scaledSizes = [
Math.abs(size.x * relativeScale.x),
Math.abs(size.y * relativeScale.y),
@@ -10609,7 +10824,7 @@ function measureFoliageGrowth(foliage, root) {
};
}
function inspectFoliageGrowth(context) {
- if (!context.foliage || !(context.scene instanceof THREE17.Object3D))
+ if (!context.foliage || !(context.scene instanceof THREE18.Object3D))
return [];
const measured = measureFoliageGrowth(context.foliage, context.scene);
const findings = [];
@@ -10660,7 +10875,7 @@ function measureVegetationFoliageAttachment(root) {
const support = renderables.filter((value) => roleOrNameSource(value, TRUNK_PATTERNS) || roleOrNameSource(value, BRANCH_PATTERNS));
const foliage = renderables.filter((value) => roleOrNameSource(value, CANOPY_PATTERNS));
const clusters = foliage.map((value) => {
- const size = value.box.getSize(new THREE17.Vector3);
+ const size = value.box.getSize(new THREE18.Vector3);
const threshold = stable7(Math.max(0.03, Math.min(0.18, size.length() * 0.12)));
const nearest = support.map((candidate) => ({ candidate, gap: distanceBetweenBoxes(value.box, candidate.box) })).sort((a, b) => a.gap - b.gap || (a.candidate.node.name || "").localeCompare(b.candidate.node.name || ""))[0];
const source = roleOrNameSource(value, CANOPY_PATTERNS) ?? "fallback";
@@ -10683,7 +10898,7 @@ function measureVegetationFoliageAttachment(root) {
};
}
function inspectFoliageAttachment(context) {
- if (!context.foliage || !(context.scene instanceof THREE17.Object3D))
+ if (!context.foliage || !(context.scene instanceof THREE18.Object3D))
return [];
return measureVegetationFoliageAttachment(context.scene).clusters.filter((cluster) => cluster.detached).map((cluster) => finding4(context, {
code: "VEG_FOLIAGE_DETACHED",
@@ -10703,9 +10918,9 @@ function inspectFoliageAttachment(context) {
}
function relativeTransformSignature(root, node) {
const matrix = root.matrixWorld.clone().invert().multiply(node.matrixWorld);
- const scale = new THREE17.Vector3;
- const quaternion = new THREE17.Quaternion;
- matrix.decompose(new THREE17.Vector3, quaternion, scale);
+ const scale = new THREE18.Vector3;
+ const quaternion = new THREE18.Quaternion;
+ matrix.decompose(new THREE18.Vector3, quaternion, scale);
if (quaternion.w < 0)
quaternion.set(-quaternion.x, -quaternion.y, -quaternion.z, -quaternion.w);
const values = [...scale.toArray(), ...quaternion.toArray()].map((value) => stable7(value));
@@ -10726,9 +10941,9 @@ function measureFoliageRepetition(requirements, root) {
nodes: values.map((value) => value.node.name || "foliage-cluster").sort()
})).sort((a, b) => a.signature.localeCompare(b.signature));
const supports = collectRenderableBounds(root).filter((value) => roleOrNameSource(value, TRUNK_PATTERNS));
- const centerBox = supports.reduce((box, value) => box.union(value.box), new THREE17.Box3);
- const centers = foliage.map((value) => value.box.getCenter(new THREE17.Vector3));
- const center = centerBox.isEmpty() ? centers.reduce((result, value) => result.add(value), new THREE17.Vector3).multiplyScalar(centers.length > 0 ? 1 / centers.length : 0) : centerBox.getCenter(new THREE17.Vector3);
+ const centerBox = supports.reduce((box, value) => box.union(value.box), new THREE18.Box3);
+ const centers = foliage.map((value) => value.box.getCenter(new THREE18.Vector3));
+ const center = centerBox.isEmpty() ? centers.reduce((result, value) => result.add(value), new THREE18.Vector3).multiplyScalar(centers.length > 0 ? 1 / centers.length : 0) : centerBox.getCenter(new THREE18.Vector3);
const radial = centers.map((value) => ({
angle: Math.atan2(value.z - center.z, value.x - center.x),
radius: Math.hypot(value.x - center.x, value.z - center.z)
@@ -10763,7 +10978,7 @@ function measureFoliageRepetition(requirements, root) {
};
}
function inspectFoliageRepetition(context) {
- if (!context.foliage || !(context.scene instanceof THREE17.Object3D))
+ if (!context.foliage || !(context.scene instanceof THREE18.Object3D))
return [];
const measured = measureFoliageRepetition(context.foliage, context.scene);
if (measured.suppressedForTopiary)
@@ -10821,7 +11036,7 @@ function measureFoliageCanopy(profile, root) {
}
function inspectFoliageCanopy(context) {
const trusted = context.foliage;
- if (!trusted?.canopyProfile || !(context.scene instanceof THREE17.Object3D))
+ if (!trusted?.canopyProfile || !(context.scene instanceof THREE18.Object3D))
return [];
const measurements = measureFoliageCanopy(trusted.canopyProfile, context.scene);
const bands = PROFILE_BANDS[measurements.profile];
@@ -10882,7 +11097,7 @@ function inspectFoliageCanopy(context) {
return findings;
}
function materialValue(material) {
- if (!(material instanceof THREE17.MeshStandardMaterial) && !(material instanceof THREE17.MeshBasicMaterial)) {
+ if (!(material instanceof THREE18.MeshStandardMaterial) && !(material instanceof THREE18.MeshBasicMaterial)) {
return;
}
const color = material.color;
@@ -10892,11 +11107,11 @@ function measureFoliageMaterials(mode, root) {
const values = [];
let foliageNodeCount = 0;
root.traverseVisible((node) => {
- if (!(node instanceof THREE17.Mesh))
+ if (!(node instanceof THREE18.Mesh))
return;
const bounds = {
node,
- box: new THREE17.Box3,
+ box: new THREE18.Box3,
roles: rolesOf2(node),
source: rolesOf2(node).length > 0 ? "semantic" : "fallback"
};
@@ -10923,7 +11138,7 @@ function measureFoliageMaterials(mode, root) {
};
}
function inspectFoliageMaterial(context) {
- if (!context.foliage || !(context.scene instanceof THREE17.Object3D))
+ if (!context.foliage || !(context.scene instanceof THREE18.Object3D))
return [];
if (!context.materialMode)
return [];
@@ -11079,7 +11294,7 @@ var init_vegetation = __esm(() => {
});
// src/skin-binding.ts
-import * as THREE18 from "three";
+import * as THREE19 from "three";
function topRoot(node) {
while (node.parent)
node = node.parent;
@@ -11099,7 +11314,7 @@ function createSkinnedPart(name, geometry, material, options) {
}
}
function buildSkinnedPart(name, geometry, material, options) {
- if (typeof name !== "string" || !name.trim() || THREE18.PropertyBinding.sanitizeNodeName(name) !== name)
+ if (typeof name !== "string" || !name.trim() || THREE19.PropertyBinding.sanitizeNodeName(name) !== name)
throw new TypeError("createSkinnedPart name must be nonempty and free of animation binding punctuation.");
if (!geometry?.isBufferGeometry)
throw new TypeError("createSkinnedPart requires BufferGeometry.");
@@ -11117,7 +11332,7 @@ function buildSkinnedPart(name, geometry, material, options) {
for (const bone of bones) {
if (!bone?.isBone || topRoot(bone) !== top || members.has(bone))
throw new TypeError("createSkinnedPart bones must be distinct Bones in the parent hierarchy.");
- if (!bone.name || THREE18.PropertyBinding.sanitizeNodeName(bone.name) !== bone.name || names.has(bone.name))
+ if (!bone.name || THREE19.PropertyBinding.sanitizeNodeName(bone.name) !== bone.name || names.has(bone.name))
throw new TypeError("createSkinnedPart bones need unique animation-safe names.");
members.add(bone);
names.add(bone.name);
@@ -11164,9 +11379,9 @@ function buildSkinnedPart(name, geometry, material, options) {
for (const key of ["position", "rotation", "scale"])
if (options[key] !== undefined)
assertFiniteTriple(`createSkinnedPart ${key}`, options[key]);
- const local = new THREE18.Matrix4().compose(new THREE18.Vector3(...options.position ?? [0, 0, 0]), new THREE18.Quaternion().setFromEuler(new THREE18.Euler(...(options.rotation ?? [0, 0, 0]).map(THREE18.MathUtils.degToRad))), new THREE18.Vector3(...options.scale ?? [1, 1, 1]));
+ const local = new THREE19.Matrix4().compose(new THREE19.Vector3(...options.position ?? [0, 0, 0]), new THREE19.Quaternion().setFromEuler(new THREE19.Euler(...(options.rotation ?? [0, 0, 0]).map(THREE19.MathUtils.degToRad))), new THREE19.Vector3(...options.scale ?? [1, 1, 1]));
top.updateWorldMatrix(true, true);
- const bind = new THREE18.Matrix4().multiplyMatrices(parent.matrixWorld, local);
+ const bind = new THREE19.Matrix4().multiplyMatrices(parent.matrixWorld, local);
assertMatrix(bind, "mesh");
for (const bone of bones) {
assertMatrix(bone.matrixWorld, `bone ${bone.name}`);
@@ -11181,19 +11396,19 @@ function buildSkinnedPart(name, geometry, material, options) {
}
}
const owned = geometry.clone();
- owned.setAttribute("skinIndex", new THREE18.BufferAttribute(skinIndices, 4));
- owned.setAttribute("skinWeight", new THREE18.BufferAttribute(skinWeights, 4));
- const mesh = new THREE18.SkinnedMesh(owned, Array.isArray(material) ? [...material] : material);
+ owned.setAttribute("skinIndex", new THREE19.BufferAttribute(skinIndices, 4));
+ owned.setAttribute("skinWeight", new THREE19.BufferAttribute(skinWeights, 4));
+ const mesh = new THREE19.SkinnedMesh(owned, Array.isArray(material) ? [...material] : material);
mesh.name = `Mesh_${name}`;
if (options.position)
mesh.position.fromArray(options.position);
if (options.rotation)
- mesh.rotation.set(...options.rotation.map(THREE18.MathUtils.degToRad));
+ mesh.rotation.set(...options.rotation.map(THREE19.MathUtils.degToRad));
if (options.scale)
mesh.scale.fromArray(options.scale);
if (options.semantic)
stampSemanticMetadataV1(mesh, options.semantic);
- const skeleton = new THREE18.Skeleton([...bones], bones.map((bone) => bone.matrixWorld.clone().invert()));
+ const skeleton = new THREE19.Skeleton([...bones], bones.map((bone) => bone.matrixWorld.clone().invert()));
mesh.bind(skeleton, bind);
parent.add(mesh);
mesh.updateWorldMatrix(true, false);
@@ -11206,7 +11421,7 @@ var init_skin_binding = __esm(() => {
});
// src/character.ts
-import * as THREE19 from "three";
+import * as THREE20 from "three";
function validRole(value) {
return typeof value === "string" && /^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/.test(value);
}
@@ -11487,7 +11702,7 @@ function readCharacterRigGraphV1(target) {
return result.valid ? result.value : undefined;
}
function axisQuaternion(from, to) {
- const value = new THREE19.Quaternion().setFromUnitVectors(new THREE19.Vector3(...from), new THREE19.Vector3(...to));
+ const value = new THREE20.Quaternion().setFromUnitVectors(new THREE20.Vector3(...from), new THREE20.Vector3(...to));
return [value.x, value.y, value.z, value.w];
}
function stampCharacterJointDescriptorV1(target, input) {
@@ -11592,7 +11807,7 @@ function createJointChain(chainName, segments, options = {}) {
endEffector: segment.endEffector,
contact: segment.contact
});
- const node = new THREE19.Object3D;
+ const node = new THREE20.Object3D;
node.name = characterJointNodeName(chainName, segment.role);
node.position.fromArray(descriptor.rest.translation);
node.quaternion.fromArray(descriptor.rest.rotation);
@@ -11672,7 +11887,7 @@ function buildBoneChain(chainName, segments, options = {}) {
return descriptor;
});
const nodes = descriptors.map((descriptor) => {
- const node = new THREE19.Bone;
+ const node = new THREE20.Bone;
node.name = characterJointNodeName(chainName, descriptor.role);
node.position.fromArray(descriptor.rest.translation);
node.quaternion.fromArray(descriptor.rest.rotation);
@@ -11861,7 +12076,7 @@ var init_character_repairs = __esm(() => {
});
// src/qa/character.ts
-import * as THREE20 from "three";
+import * as THREE21 from "three";
function isClipLike(value) {
if (typeof value !== "object" || value === null)
return false;
@@ -12099,7 +12314,7 @@ function contactFindings2(input, root) {
const planeY = input.groundPlaneY ?? 0;
const findings = [];
for (const contact of contacts) {
- const point = contact.node.getWorldPosition(new THREE20.Vector3).applyMatrix4(rootInverse);
+ const point = contact.node.getWorldPosition(new THREE21.Vector3).applyMatrix4(rootInverse);
const offset = point.y - planeY;
if (offset > tolerance) {
findings.push(block(input, "CHAR_CONTACT_FLOATING", `Ground contact ${contact.descriptor.role} is ${offset.toFixed(6)} m above asset-local ground.`, {
@@ -12364,13 +12579,13 @@ function declaredHeldItem(nodes) {
function characterJointScale(root) {
root.updateMatrixWorld(true);
const inverse = root.matrixWorld.clone().invert();
- const bounds = new THREE20.Box3;
+ const bounds = new THREE21.Box3;
for (const joint of collectCharacterJointNodes(root)) {
- bounds.expandByPoint(joint.node.getWorldPosition(new THREE20.Vector3).applyMatrix4(inverse));
+ bounds.expandByPoint(joint.node.getWorldPosition(new THREE21.Vector3).applyMatrix4(inverse));
}
if (bounds.isEmpty())
return 1;
- const size = bounds.getSize(new THREE20.Vector3);
+ const size = bounds.getSize(new THREE21.Vector3);
return Math.max(size.x, size.y, size.z, 1);
}
function heldItemMotionFindings(input, root, clips) {
@@ -12406,8 +12621,8 @@ function heldItemMotionFindings(input, root, clips) {
if (!cloneItem || !cloneAttachment)
continue;
const inverse = clone.matrixWorld.clone().invert();
- const itemPoint = cloneItem.getWorldPosition(new THREE20.Vector3).applyMatrix4(inverse);
- const gripPoint = cloneAttachment.getWorldPosition(new THREE20.Vector3).applyMatrix4(inverse);
+ const itemPoint = cloneItem.getWorldPosition(new THREE21.Vector3).applyMatrix4(inverse);
+ const gripPoint = cloneAttachment.getWorldPosition(new THREE21.Vector3).applyMatrix4(inverse);
const distance = itemPoint.distanceTo(gripPoint);
baseline ??= distance;
const drift = Math.abs(distance - baseline);
@@ -12440,7 +12655,7 @@ function heldItemMotionFindings(input, root, clips) {
function inspectRig(context) {
if (!context.rig)
return [];
- const root = context.scene instanceof THREE20.Object3D ? context.scene : undefined;
+ const root = context.scene instanceof THREE21.Object3D ? context.scene : undefined;
const clips = (context.clips ?? []).filter(isClipLike);
const findings = [];
if (root) {
@@ -12490,7 +12705,7 @@ var init_character2 = __esm(() => {
});
// src/qa/character-advisory.ts
-import * as THREE21 from "three";
+import * as THREE22 from "three";
function isClipLike2(value) {
if (typeof value !== "object" || value === null)
return false;
@@ -12513,16 +12728,16 @@ function jointPoints(root) {
const inverse = rootInverse(root);
return collectCharacterJointNodes(root).map((evidence) => ({
evidence,
- local: evidence.node.getWorldPosition(new THREE21.Vector3).applyMatrix4(inverse)
+ local: evidence.node.getWorldPosition(new THREE22.Vector3).applyMatrix4(inverse)
}));
}
function characterScale(points) {
if (points.length === 0)
return 1;
- const bounds = new THREE21.Box3;
+ const bounds = new THREE22.Box3;
for (const point of points)
bounds.expandByPoint(point.local);
- const size = bounds.getSize(new THREE21.Vector3);
+ const size = bounds.getSize(new THREE22.Vector3);
return Math.max(size.x, size.y, size.z, 1);
}
function pairKey(descriptor) {
@@ -12621,12 +12836,12 @@ function restChainFindings(context, root) {
}
function forwardMarkerFindings(context, root) {
root.updateMatrixWorld(true);
- const expected = new THREE21.Vector3(1, 0, 0).transformDirection(root.matrixWorld);
+ const expected = new THREE22.Vector3(1, 0, 0).transformDirection(root.matrixWorld);
const markers = collectCharacterJointNodes(root).filter((joint) => /(?:^|[._-])(?:toe|muzzle|head)(?:$|[._-])/i.test(joint.descriptor.role));
return markers.flatMap((marker) => {
- const quaternion = marker.node.getWorldQuaternion(new THREE21.Quaternion);
- const actual = new THREE21.Vector3(...marker.descriptor.localForwardAxis).applyQuaternion(quaternion).normalize();
- const angle = THREE21.MathUtils.radToDeg(Math.acos(THREE21.MathUtils.clamp(actual.dot(expected), -1, 1)));
+ const quaternion = marker.node.getWorldQuaternion(new THREE22.Quaternion);
+ const actual = new THREE22.Vector3(...marker.descriptor.localForwardAxis).applyQuaternion(quaternion).normalize();
+ const angle = THREE22.MathUtils.radToDeg(Math.acos(THREE22.MathUtils.clamp(actual.dot(expected), -1, 1)));
if (angle <= FORWARD_ANGLE_DEGREES)
return [];
return [
@@ -12680,7 +12895,7 @@ function sampleClip(root, clip) {
byRole: new Map(collectCharacterJointNodes(clone).map((evidence) => [
evidence.descriptor.role,
{
- point: evidence.node.getWorldPosition(new THREE21.Vector3).applyMatrix4(inverse),
+ point: evidence.node.getWorldPosition(new THREE22.Vector3).applyMatrix4(inverse),
evidence
}
]))
@@ -12792,12 +13007,12 @@ function phaseOppositionFindings(context, root, clips) {
return findings;
}
function signedBendDegrees(descriptor, quaternion) {
- const rest = new THREE21.Quaternion(...descriptor.rest.rotation);
+ const rest = new THREE22.Quaternion(...descriptor.rest.rotation);
const delta = rest.invert().multiply(quaternion).normalize();
- const axis = new THREE21.Vector3(delta.x, delta.y, delta.z);
- const signedMagnitude = axis.dot(new THREE21.Vector3(...descriptor.localBendAxis));
+ const axis = new THREE22.Vector3(delta.x, delta.y, delta.z);
+ const signedMagnitude = axis.dot(new THREE22.Vector3(...descriptor.localBendAxis));
const angle = 2 * Math.atan2(signedMagnitude, delta.w);
- return THREE21.MathUtils.radToDeg(THREE21.MathUtils.euclideanModulo(angle + Math.PI, Math.PI * 2) - Math.PI);
+ return THREE22.MathUtils.radToDeg(THREE22.MathUtils.euclideanModulo(angle + Math.PI, Math.PI * 2) - Math.PI);
}
function bendDirectionFindings(context, root, clips) {
const joints = collectCharacterJointNodes(root).filter((joint) => /(?:^|[._-])(?:knee|elbow)(?:$|[._-])/i.test(joint.descriptor.role));
@@ -12811,7 +13026,7 @@ function bendDirectionFindings(context, root, clips) {
let maximumFraction = 0;
for (const fraction of SAMPLE_FRACTIONS) {
const value = track.createInterpolant().evaluate(fraction * clip.duration);
- const bend = signedBendDegrees(joint.descriptor, new THREE21.Quaternion().fromArray(value).normalize());
+ const bend = signedBendDegrees(joint.descriptor, new THREE22.Quaternion().fromArray(value).normalize());
if (Math.abs(bend) > Math.abs(maximum)) {
maximum = bend;
maximumFraction = fraction;
@@ -12894,7 +13109,7 @@ function footSlideFindings(context, root, clips) {
return findings;
}
function inspectRigAdvisory(context) {
- if (!context.rig || !(context.scene instanceof THREE21.Object3D)) {
+ if (!context.rig || !(context.scene instanceof THREE22.Object3D)) {
return [];
}
const root = context.scene;
@@ -13013,7 +13228,7 @@ var init_architecture_repairs = __esm(() => {
});
// src/qa/architecture.ts
-import * as THREE22 from "three";
+import * as THREE23 from "three";
function hasRoofDimensions(value) {
return value.footprint !== undefined && value.roof?.ridgeAxis !== undefined && value.roof.rise !== undefined && value.roof.overhang !== undefined;
}
@@ -13023,7 +13238,7 @@ function semanticMetadata(node) {
function markerBounds(matrix) {
const bounds = emptyBounds();
for (let corner = 0;corner < 8; corner++) {
- expandBounds(bounds, new THREE22.Vector3(corner & 1 ? 0.5 : -0.5, corner & 2 ? 0.5 : -0.5, corner & 4 ? 0.5 : -0.5).applyMatrix4(matrix));
+ expandBounds(bounds, new THREE23.Vector3(corner & 1 ? 0.5 : -0.5, corner & 2 ? 0.5 : -0.5, corner & 4 ? 0.5 : -0.5).applyMatrix4(matrix));
}
return bounds;
}
@@ -13032,7 +13247,7 @@ function geometryPlaneNormal(geometry, relativeMatrix) {
const local = geometry.boundingBox;
if (!local)
return;
- const size = local.getSize(new THREE22.Vector3);
+ const size = local.getSize(new THREE23.Vector3);
const dimensions = [
["x", size.x],
["y", size.y],
@@ -13042,7 +13257,7 @@ function geometryPlaneNormal(geometry, relativeMatrix) {
const axis = dimensions[0]?.[0];
if (!axis)
return;
- const normal = new THREE22.Vector3(axis === "x" ? 1 : 0, axis === "y" ? 1 : 0, axis === "z" ? 1 : 0).transformDirection(relativeMatrix);
+ const normal = new THREE23.Vector3(axis === "x" ? 1 : 0, axis === "y" ? 1 : 0, axis === "z" ? 1 : 0).transformDirection(relativeMatrix);
if (normal.y < 0)
normal.multiplyScalar(-1);
return normal.normalize();
@@ -13054,7 +13269,7 @@ function geometryEvidence(geometry, relativeMatrix) {
if (position?.itemSize !== 3)
return { bounds, vertices, triangles: [] };
for (let index = 0;index < position.count; index++) {
- const point = new THREE22.Vector3(position.getX(index), position.getY(index), position.getZ(index));
+ const point = new THREE23.Vector3(position.getX(index), position.getY(index), position.getZ(index));
point.applyMatrix4(relativeMatrix);
vertices.push(point);
expandBounds(bounds, point);
@@ -13081,7 +13296,7 @@ function geometryEvidence(geometry, relativeMatrix) {
return { bounds, vertices, triangles, ...planeNormal ? { planeNormal } : {} };
}
function collectArchitectureEvidence(scene) {
- if (!(scene instanceof THREE22.Object3D))
+ if (!(scene instanceof THREE23.Object3D))
return;
scene.updateMatrixWorld(true);
const rootInverse = scene.matrixWorld.clone().invert();
@@ -13101,7 +13316,7 @@ function collectArchitectureEvidence(scene) {
const nodePath = parentPath ? `${parentPath}/${segment}` : segment;
const relativeMatrix = rootInverse.clone().multiply(node.matrixWorld);
const mesh = node;
- const isMesh = mesh.isMesh === true && mesh.geometry instanceof THREE22.BufferGeometry;
+ const isMesh = mesh.isMesh === true && mesh.geometry instanceof THREE23.BufferGeometry;
const evidence = isMesh ? geometryEvidence(mesh.geometry, relativeMatrix) : {
bounds: markerBounds(relativeMatrix),
vertices: [],
@@ -13160,7 +13375,7 @@ function architectureFinding(context, value) {
function averageNormal(normals) {
if (normals.length === 0)
return;
- const result = normals.reduce((sum, normal) => sum.add(normal), new THREE22.Vector3);
+ const result = normals.reduce((sum, normal) => sum.add(normal), new THREE23.Vector3);
return result.lengthSq() > EPSILON2 ? result.normalize() : undefined;
}
function intervalCoverage(min, max, expectedMin, expectedMax) {
@@ -13871,8 +14086,8 @@ function evaluateArchitectureQa(context) {
});
}
var PROFILE_RULE_ID2 = "ARCHITECTURE_PROFILE", EPSILON2 = 0.000001, ARCHITECTURE_REALISTIC_SCALE_BANDS, emptyBounds = () => ({
- min: new THREE22.Vector3(Infinity, Infinity, Infinity),
- max: new THREE22.Vector3(-Infinity, -Infinity, -Infinity)
+ min: new THREE23.Vector3(Infinity, Infinity, Infinity),
+ max: new THREE23.Vector3(-Infinity, -Infinity, -Infinity)
}), expandBounds = (bounds, point) => {
bounds.min.min(point);
bounds.max.max(point);
@@ -13916,7 +14131,7 @@ var init_architecture = __esm(() => {
});
// src/qa/environment.ts
-import * as THREE23 from "three";
+import * as THREE24 from "three";
function finding5(context, value) {
return { ...value, profile: context.profile ?? "asset.requirements.v1" };
}
@@ -13935,11 +14150,11 @@ function nodePath4(root, node) {
return names.reverse().join("/");
}
function transformedBox2(source, transform) {
- const result = new THREE23.Box3;
+ const result = new THREE24.Box3;
for (const x of [source.min.x, source.max.x]) {
for (const y of [source.min.y, source.max.y]) {
for (const z of [source.min.z, source.max.z]) {
- result.expandByPoint(new THREE23.Vector3(x, y, z).applyMatrix4(transform));
+ result.expandByPoint(new THREE24.Vector3(x, y, z).applyMatrix4(transform));
}
}
}
@@ -13948,16 +14163,16 @@ function transformedBox2(source, transform) {
function orientedBoxFromLocalBounds(root, node, source, relative = root.matrixWorld.clone().invert().multiply(node.matrixWorld)) {
if (!relative.elements.every(Number.isFinite))
return;
- const position = new THREE23.Vector3;
- const rotation = new THREE23.Quaternion;
- const scale = new THREE23.Vector3;
+ const position = new THREE24.Vector3;
+ const rotation = new THREE24.Quaternion;
+ const scale = new THREE24.Vector3;
relative.decompose(position, rotation, scale);
- const recomposed = new THREE23.Matrix4().compose(position, rotation, scale);
+ const recomposed = new THREE24.Matrix4().compose(position, rotation, scale);
const residual = Math.max(...relative.elements.map((component, index) => Math.abs(component - (recomposed.elements[index] ?? component))));
if (residual > 0.00001)
return;
- const center = source.getCenter(new THREE23.Vector3).applyMatrix4(relative);
- const sourceHalf = source.getSize(new THREE23.Vector3).multiplyScalar(0.5);
+ const center = source.getCenter(new THREE24.Vector3).applyMatrix4(relative);
+ const sourceHalf = source.getSize(new THREE24.Vector3).multiplyScalar(0.5);
const halfExtents = [
Math.abs(sourceHalf.x * scale.x),
Math.abs(sourceHalf.y * scale.y),
@@ -13978,24 +14193,24 @@ function collectParts5(root) {
const result = [];
root.traverseVisible((node) => {
const roles = rolesOf3(node);
- const renderable = node instanceof THREE23.Mesh;
+ const renderable = node instanceof THREE24.Mesh;
let box;
let orientedBox;
let source;
- if (renderable && node.geometry instanceof THREE23.BufferGeometry) {
+ if (renderable && node.geometry instanceof THREE24.BufferGeometry) {
node.geometry.computeBoundingBox();
if (node.geometry.boundingBox) {
source = node.geometry.boundingBox;
}
} else if (roles.length > 0) {
- source = new THREE23.Box3(new THREE23.Vector3(-0.5, -0.5, -0.5), new THREE23.Vector3(0.5, 0.5, 0.5));
+ source = new THREE24.Box3(new THREE24.Vector3(-0.5, -0.5, -0.5), new THREE24.Vector3(0.5, 0.5, 0.5));
}
const relative = rootInverse.clone().multiply(node.matrixWorld);
- const count = node instanceof THREE23.InstancedMesh ? node.count : 1;
+ const count = node instanceof THREE24.InstancedMesh ? node.count : 1;
for (let index = 0;index < count; index++) {
const transform = relative.clone();
- if (node instanceof THREE23.InstancedMesh) {
- const instance = new THREE23.Matrix4;
+ if (node instanceof THREE24.InstancedMesh) {
+ const instance = new THREE24.Matrix4;
node.getMatrixAt(index, instance);
transform.multiply(instance);
}
@@ -14026,9 +14241,9 @@ function resolveSocket(root, node, socket) {
return;
root.updateWorldMatrix(true, true);
const rootInverse = root.matrixWorld.clone().invert();
- const point = new THREE23.Vector3(...frame.translation).applyMatrix4(node.matrixWorld).applyMatrix4(rootInverse);
- const rootInverseQuaternion = root.getWorldQuaternion(new THREE23.Quaternion).invert();
- const rotation = node.getWorldQuaternion(new THREE23.Quaternion).multiply(new THREE23.Quaternion(...frame.rotation)).premultiply(rootInverseQuaternion).normalize();
+ const point = new THREE24.Vector3(...frame.translation).applyMatrix4(node.matrixWorld).applyMatrix4(rootInverse);
+ const rootInverseQuaternion = root.getWorldQuaternion(new THREE24.Quaternion).invert();
+ const rotation = node.getWorldQuaternion(new THREE24.Quaternion).multiply(new THREE24.Quaternion(...frame.rotation)).premultiply(rootInverseQuaternion).normalize();
return {
id: socket.id,
type: socket.type,
@@ -14057,7 +14272,7 @@ function socketByType(sockets, type) {
return sockets.find((socket) => socket.type === type);
}
function inspectPlacementSockets(context) {
- if (!(context.scene instanceof THREE23.Object3D)) {
+ if (!(context.scene instanceof THREE24.Object3D)) {
return [];
}
const root = context.scene;
@@ -14121,7 +14336,7 @@ function materialSignature(material) {
function boundarySamples(root, axis, side, bins = 12) {
root.updateWorldMatrix(true, true);
const inverse = root.matrixWorld.clone().invert();
- const localBounds = new THREE23.Box3;
+ const localBounds = new THREE24.Box3;
for (const part of collectParts5(root))
if (part.renderable && part.box)
localBounds.union(part.box);
@@ -14135,30 +14350,30 @@ function boundarySamples(root, axis, side, bins = 12) {
const crossExtent = Math.max(0.000000001, localBounds.max[crossAxis] - crossMin);
const byBin = new Map;
root.traverseVisible((node) => {
- if (!(node instanceof THREE23.Mesh) || !(node.geometry instanceof THREE23.BufferGeometry))
+ if (!(node instanceof THREE24.Mesh) || !(node.geometry instanceof THREE24.BufferGeometry))
return;
const positions = node.geometry.getAttribute("position");
if (positions?.itemSize !== 3)
return;
const normals = node.geometry.getAttribute("normal");
const relative = inverse.clone().multiply(node.matrixWorld);
- const count = node instanceof THREE23.InstancedMesh ? node.count : 1;
+ const count = node instanceof THREE24.InstancedMesh ? node.count : 1;
for (let instanceIndex = 0;instanceIndex < count; instanceIndex++) {
const transform = relative.clone();
- if (node instanceof THREE23.InstancedMesh) {
- const instance = new THREE23.Matrix4;
+ if (node instanceof THREE24.InstancedMesh) {
+ const instance = new THREE24.Matrix4;
node.getMatrixAt(instanceIndex, instance);
transform.multiply(instance);
}
- const normalMatrix = new THREE23.Matrix3().getNormalMatrix(transform);
+ const normalMatrix = new THREE24.Matrix3().getNormalMatrix(transform);
const material = materialSignature(node.material);
for (let index = 0;index < positions.count; index++) {
- const point = new THREE23.Vector3(positions.getX(index), positions.getY(index), positions.getZ(index)).applyMatrix4(transform);
+ const point = new THREE24.Vector3(positions.getX(index), positions.getY(index), positions.getZ(index)).applyMatrix4(transform);
if (Math.abs(point[axis] - edge) > band)
continue;
- const t = THREE23.MathUtils.clamp((point[crossAxis] - crossMin) / crossExtent, 0, 1);
+ const t = THREE24.MathUtils.clamp((point[crossAxis] - crossMin) / crossExtent, 0, 1);
const bin = Math.min(bins - 1, Math.floor(t * bins));
- const normal = normals ? new THREE23.Vector3(normals.getX(index), normals.getY(index), normals.getZ(index)).applyMatrix3(normalMatrix).normalize() : new THREE23.Vector3(0, 1, 0);
+ const normal = normals ? new THREE24.Vector3(normals.getX(index), normals.getY(index), normals.getZ(index)).applyMatrix3(normalMatrix).normalize() : new THREE24.Vector3(0, 1, 0);
const current = byBin.get(bin);
if (!current || point.y > current.height || point.y === current.height && normal.y > current.normal.y) {
byBin.set(bin, { bin, height: point.y, normal, material });
@@ -14181,7 +14396,7 @@ function edgePairMeasurements(root, axis, sockets) {
...positive.map((sample) => sample.bin)
]);
const maximumHeightDelta = pairs.length ? Math.max(...pairs.map(([a, b]) => Math.abs(a.height - b.height))) : Number.POSITIVE_INFINITY;
- const maximumNormalDeltaDegrees = pairs.length ? Math.max(...pairs.map(([a, b]) => THREE23.MathUtils.radToDeg(Math.acos(THREE23.MathUtils.clamp(a.normal.dot(b.normal), -1, 1))))) : 180;
+ const maximumNormalDeltaDegrees = pairs.length ? Math.max(...pairs.map(([a, b]) => THREE24.MathUtils.radToDeg(Math.acos(THREE24.MathUtils.clamp(a.normal.dot(b.normal), -1, 1))))) : 180;
const materialMismatch = pairs.some(([a, b]) => a.material !== b.material);
const negativeSocket = socketByType(sockets, `environment.tile.${axis}-negative`);
const positiveSocket = socketByType(sockets, `environment.tile.${axis}-positive`);
@@ -14198,7 +14413,7 @@ function edgePairMeasurements(root, axis, sockets) {
};
}
function inspectTileEdges(context) {
- if (context.tileable !== true || !(context.scene instanceof THREE23.Object3D)) {
+ if (context.tileable !== true || !(context.scene instanceof THREE24.Object3D)) {
return [];
}
const root = context.scene;
@@ -14281,7 +14496,7 @@ function isCorridor(part) {
return part.roles.some((role) => /^environment\.(?:navigation\.)?corridor(?:\.|$)/.test(role));
}
function inspectNavigationClearance(context) {
- if (context.navigable !== true || !(context.scene instanceof THREE23.Object3D)) {
+ if (context.navigable !== true || !(context.scene instanceof THREE24.Object3D)) {
return [];
}
const root = context.scene;
@@ -14411,7 +14626,7 @@ function functionalLayer(part) {
return part.roles.some((role) => role.startsWith("environment.functional") || role.startsWith("environment.layer") || role.startsWith("environment.path") || role.startsWith("environment.road") || role.startsWith("environment.bridge") || role.startsWith("environment.gate"));
}
function inspectSpatialSupport(context) {
- if (context.groundPlaneY === undefined || !(context.scene instanceof THREE23.Object3D)) {
+ if (context.groundPlaneY === undefined || !(context.scene instanceof THREE24.Object3D)) {
return [];
}
const root = context.scene;
@@ -14458,7 +14673,7 @@ function inspectSpatialSupport(context) {
}));
}
}
- const size = box.getSize(new THREE23.Vector3);
+ const size = box.getSize(new THREE24.Vector3);
if (box.min.y < context.groundPlaneY - 0.05 && size.y <= Math.max(0.05, Math.min(size.x, size.z) * 0.03) && Math.max(size.x, size.z) >= 1) {
findings.push(finding5(context, {
code: "ENV_GROUND_UNDECLARED_SKIRT",
@@ -15107,7 +15322,7 @@ function writtenNodeResolver(root, doc, purpose) {
// src/node-visibility.ts
import { KHRNodeVisibility } from "@gltf-transform/extensions";
-import * as THREE24 from "three";
+import * as THREE25 from "three";
function applyNodeVisibility(root, doc) {
const hidden = [];
root.traverse((node) => {
@@ -15150,7 +15365,7 @@ function drawnSceneBounds(scene) {
return;
const mesh = node.getMesh();
if (mesh) {
- const base = new THREE24.Matrix4().fromArray(node.getWorldMatrix());
+ const base = new THREE25.Matrix4().fromArray(node.getWorldMatrix());
const instances = node.getExtension("EXT_mesh_gpu_instancing");
const translation = instances?.getAttribute("TRANSLATION");
const rotation = instances?.getAttribute("ROTATION");
@@ -15161,7 +15376,7 @@ function drawnSceneBounds(scene) {
const t = translation?.getElement(i, []) ?? [0, 0, 0];
const r = rotation?.getElement(i, []) ?? [0, 0, 0, 1];
const s = scale?.getElement(i, []) ?? [1, 1, 1];
- const localMatrix = new THREE24.Matrix4().compose(new THREE24.Vector3().fromArray(t), new THREE24.Quaternion().fromArray(r), new THREE24.Vector3().fromArray(s));
+ const localMatrix = new THREE25.Matrix4().compose(new THREE25.Vector3().fromArray(t), new THREE25.Quaternion().fromArray(r), new THREE25.Vector3().fromArray(s));
matrices.push(base.clone().multiply(localMatrix).toArray());
}
const local = [0, 0, 0];
@@ -15202,12 +15417,12 @@ var init_node_visibility = __esm(() => {
});
// src/delivery-inspect.ts
-import * as THREE25 from "three";
+import * as THREE26 from "three";
import { PropertyType as PropertyType2 } from "@gltf-transform/core";
function decompose(matrix) {
- const translation = new THREE25.Vector3;
- const rotation = new THREE25.Quaternion;
- const scale = new THREE25.Vector3;
+ const translation = new THREE26.Vector3;
+ const rotation = new THREE26.Quaternion;
+ const scale = new THREE26.Vector3;
matrix.decompose(translation, rotation, scale);
const clean = (value) => Object.is(value, -0) ? 0 : value;
return {
@@ -15219,7 +15434,7 @@ function decompose(matrix) {
function drawnTriangles(visited) {
const values = [];
const local = [0, 0, 0];
- const point = new THREE25.Vector3;
+ const point = new THREE26.Vector3;
for (const { node, roles, hidden } of visited) {
const mesh = node.getMesh();
if (!mesh || hidden || roles.some((role) => role.startsWith("collider.")))
@@ -15232,7 +15447,7 @@ function drawnTriangles(visited) {
const copies = translation?.getCount() ?? rotation?.getCount() ?? scale?.getCount() ?? 1;
const matrices = [];
for (let i = 0;i < copies; i++) {
- const instance = new THREE25.Matrix4().compose(new THREE25.Vector3().fromArray(translation?.getElement(i, []) ?? [0, 0, 0]), new THREE25.Quaternion().fromArray(rotation?.getElement(i, []) ?? [0, 0, 0, 1]), new THREE25.Vector3().fromArray(scale?.getElement(i, []) ?? [1, 1, 1]));
+ const instance = new THREE26.Matrix4().compose(new THREE26.Vector3().fromArray(translation?.getElement(i, []) ?? [0, 0, 0]), new THREE26.Quaternion().fromArray(rotation?.getElement(i, []) ?? [0, 0, 0, 1]), new THREE26.Vector3().fromArray(scale?.getElement(i, []) ?? [1, 1, 1]));
matrices.push(base.clone().multiply(instance));
}
for (const primitive of mesh.listPrimitives()) {
@@ -15263,20 +15478,20 @@ function triangleOverlapsBox(a, b, c, h, tolerance) {
return false;
}
const e = [
- new THREE25.Vector3().subVectors(b, a),
- new THREE25.Vector3().subVectors(c, b),
- new THREE25.Vector3().subVectors(a, c)
+ new THREE26.Vector3().subVectors(b, a),
+ new THREE26.Vector3().subVectors(c, b),
+ new THREE26.Vector3().subVectors(a, c)
];
- const normal = new THREE25.Vector3().crossVectors(e[0], e[1]);
+ const normal = new THREE26.Vector3().crossVectors(e[0], e[1]);
const axes = [normal];
const units = [
- new THREE25.Vector3(1, 0, 0),
- new THREE25.Vector3(0, 1, 0),
- new THREE25.Vector3(0, 0, 1)
+ new THREE26.Vector3(1, 0, 0),
+ new THREE26.Vector3(0, 1, 0),
+ new THREE26.Vector3(0, 0, 1)
];
for (const unit of units)
for (const edge of e)
- axes.push(new THREE25.Vector3().crossVectors(unit, edge));
+ axes.push(new THREE26.Vector3().crossVectors(unit, edge));
for (const axis of axes) {
if (axis.lengthSq() < 0.000000000000000000000001)
continue;
@@ -15288,14 +15503,14 @@ function triangleOverlapsBox(a, b, c, h, tolerance) {
return true;
}
function closestPointOnTriangle(p, a, b, c) {
- const ab = new THREE25.Vector3().subVectors(b, a);
- const ac = new THREE25.Vector3().subVectors(c, a);
- const ap = new THREE25.Vector3().subVectors(p, a);
+ const ab = new THREE26.Vector3().subVectors(b, a);
+ const ac = new THREE26.Vector3().subVectors(c, a);
+ const ap = new THREE26.Vector3().subVectors(p, a);
const d1 = ab.dot(ap);
const d2 = ac.dot(ap);
if (d1 <= 0 && d2 <= 0)
return a.clone();
- const bp = new THREE25.Vector3().subVectors(p, b);
+ const bp = new THREE26.Vector3().subVectors(p, b);
const d3 = ab.dot(bp);
const d4 = ac.dot(bp);
if (d3 >= 0 && d4 <= d3)
@@ -15303,7 +15518,7 @@ function closestPointOnTriangle(p, a, b, c) {
const vc = d1 * d4 - d3 * d2;
if (vc <= 0 && d1 >= 0 && d3 <= 0)
return a.clone().addScaledVector(ab, d1 / (d1 - d3));
- const cp = new THREE25.Vector3().subVectors(p, c);
+ const cp = new THREE26.Vector3().subVectors(p, c);
const d5 = ab.dot(cp);
const d6 = ac.dot(cp);
if (d6 >= 0 && d5 <= d6)
@@ -15313,14 +15528,14 @@ function closestPointOnTriangle(p, a, b, c) {
return a.clone().addScaledVector(ac, d2 / (d2 - d6));
const va = d3 * d6 - d5 * d4;
if (va <= 0 && d4 - d3 >= 0 && d5 - d6 >= 0)
- return b.clone().addScaledVector(new THREE25.Vector3().subVectors(c, b), (d4 - d3) / (d4 - d3 + (d5 - d6)));
+ return b.clone().addScaledVector(new THREE26.Vector3().subVectors(c, b), (d4 - d3) / (d4 - d3 + (d5 - d6)));
const denominator = 1 / (va + vb + vc);
return a.clone().addScaledVector(ab, vb * denominator).addScaledVector(ac, vc * denominator);
}
function segmentSegmentDistanceSq(p1, q1, p2, q2) {
- const d1 = new THREE25.Vector3().subVectors(q1, p1);
- const d2 = new THREE25.Vector3().subVectors(q2, p2);
- const r = new THREE25.Vector3().subVectors(p1, p2);
+ const d1 = new THREE26.Vector3().subVectors(q1, p1);
+ const d2 = new THREE26.Vector3().subVectors(q2, p2);
+ const r = new THREE26.Vector3().subVectors(p1, p2);
const a = d1.dot(d1);
const e = d2.dot(d2);
const f = d2.dot(r);
@@ -15329,22 +15544,22 @@ function segmentSegmentDistanceSq(p1, q1, p2, q2) {
if (a <= 0.000000000000000000000001 && e <= 0.000000000000000000000001)
return r.lengthSq();
if (a <= 0.000000000000000000000001)
- t = THREE25.MathUtils.clamp(f / e, 0, 1);
+ t = THREE26.MathUtils.clamp(f / e, 0, 1);
else {
const c = d1.dot(r);
if (e <= 0.000000000000000000000001)
- s = THREE25.MathUtils.clamp(-c / a, 0, 1);
+ s = THREE26.MathUtils.clamp(-c / a, 0, 1);
else {
const b = d1.dot(d2);
const denominator = a * e - b * b;
- s = denominator !== 0 ? THREE25.MathUtils.clamp((b * f - c * e) / denominator, 0, 1) : 0;
+ s = denominator !== 0 ? THREE26.MathUtils.clamp((b * f - c * e) / denominator, 0, 1) : 0;
t = (b * s + f) / e;
if (t < 0) {
t = 0;
- s = THREE25.MathUtils.clamp(-c / a, 0, 1);
+ s = THREE26.MathUtils.clamp(-c / a, 0, 1);
} else if (t > 1) {
t = 1;
- s = THREE25.MathUtils.clamp((b - c) / a, 0, 1);
+ s = THREE26.MathUtils.clamp((b - c) / a, 0, 1);
}
}
}
@@ -15353,8 +15568,8 @@ function segmentSegmentDistanceSq(p1, q1, p2, q2) {
return c1.distanceToSquared(c2);
}
function segmentCrossesTriangle(p, q, a, b, c) {
- const hit = new THREE25.Vector3;
- const ray = new THREE25.Ray(p, new THREE25.Vector3().subVectors(q, p));
+ const hit = new THREE26.Vector3;
+ const ray = new THREE26.Ray(p, new THREE26.Vector3().subVectors(q, p));
const length = ray.direction.length();
if (length === 0)
return false;
@@ -15471,9 +15686,9 @@ function inspectDelivery(doc) {
visit(scene.listChildren(), segment3(scene.getName() || "Scene", 0), false, undefined);
const finding = (code, path, message) => summary.diagnostics.push({ code, path, message });
const { min, max } = drawnSceneBounds(scene);
- const bounds = new THREE25.Box3(new THREE25.Vector3(...min), new THREE25.Vector3(...max));
+ const bounds = new THREE26.Box3(new THREE26.Vector3(...min), new THREE26.Vector3(...max));
const finiteBounds = [...min, ...max].every(Number.isFinite);
- const diagonal = finiteBounds ? bounds.getSize(new THREE25.Vector3).length() : 0;
+ const diagonal = finiteBounds ? bounds.getSize(new THREE26.Vector3).length() : 0;
const tolerance = Math.max(0.0001, diagonal * 0.0001);
const colliderNodes = [];
for (const entry of visited) {
@@ -15552,23 +15767,23 @@ function inspectDelivery(doc) {
const triangles = colliderNodes.some(({ record }) => record.shape.kind !== "hull") ? drawnTriangles(visited) : new Float64Array;
const triangleCount = triangles.length / 9;
let overlapTests = 0;
- const a = new THREE25.Vector3;
- const b = new THREE25.Vector3;
- const c = new THREE25.Vector3;
+ const a = new THREE26.Vector3;
+ const b = new THREE26.Vector3;
+ const c = new THREE26.Vector3;
for (const { visit: entry, record } of colliderNodes) {
if (!entry.hidden)
finding("DELIVERY_COLLIDER_NOT_HIDDEN", record.path, "collider proxy draws; hide it (the delivery helpers do) so importers that ignore roles draw only the asset.");
const matrix = worldMatrix(entry.node);
- const proxyBounds = new THREE25.Box3;
+ const proxyBounds = new THREE26.Box3;
const mesh = entry.node.getMesh();
const local = [0, 0, 0];
for (const primitive of mesh?.listPrimitives() ?? []) {
const position = primitive.getAttribute("POSITION");
for (let i = 0;i < (position?.getCount() ?? 0); i++)
- proxyBounds.expandByPoint(new THREE25.Vector3().fromArray(position.getElement(i, local)).applyMatrix4(matrix));
+ proxyBounds.expandByPoint(new THREE26.Vector3().fromArray(position.getElement(i, local)).applyMatrix4(matrix));
}
if (proxyBounds.isEmpty())
- proxyBounds.expandByPoint(new THREE25.Vector3().setFromMatrixPosition(matrix));
+ proxyBounds.expandByPoint(new THREE26.Vector3().setFromMatrixPosition(matrix));
const expanded = bounds.clone().expandByScalar(tolerance);
if (!finiteBounds || !expanded.containsBox(proxyBounds))
finding("DELIVERY_COLLIDER_OUTSIDE_BOUNDS", record.path, "collider proxy reaches outside the bounds of the drawn asset.");
@@ -15579,11 +15794,11 @@ function inspectDelivery(doc) {
continue;
}
overlapTests += triangleCount;
- const toLocal = new THREE25.Matrix4;
+ const toLocal = new THREE26.Matrix4;
let touches = false;
if (record.shape.kind === "box") {
toLocal.copy(matrix).invert();
- const half = new THREE25.Vector3(0.5, 0.5, 0.5);
+ const half = new THREE26.Vector3(0.5, 0.5, 0.5);
const scale = Math.max(...record.transform.scale.map(Math.abs), 0.000000001);
for (let t = 0;t < triangleCount && !touches; t++) {
a.fromArray(triangles, t * 9).applyMatrix4(toLocal);
@@ -15593,10 +15808,10 @@ function inspectDelivery(doc) {
}
} else {
const { translation, rotation } = record.transform;
- toLocal.compose(new THREE25.Vector3(...translation), new THREE25.Quaternion(...rotation), new THREE25.Vector3(1, 1, 1)).invert();
+ toLocal.compose(new THREE26.Vector3(...translation), new THREE26.Quaternion(...rotation), new THREE26.Vector3(1, 1, 1)).invert();
const { radius, height } = record.shape;
- const p = new THREE25.Vector3(0, -height / 2 + radius, 0);
- const q = new THREE25.Vector3(0, height / 2 - radius, 0);
+ const p = new THREE26.Vector3(0, -height / 2 + radius, 0);
+ const q = new THREE26.Vector3(0, height / 2 - radius, 0);
for (let t = 0;t < triangleCount && !touches; t++) {
a.fromArray(triangles, t * 9).applyMatrix4(toLocal);
b.fromArray(triangles, t * 9 + 3).applyMatrix4(toLocal);
@@ -15615,7 +15830,7 @@ function inspectDelivery(doc) {
finding("DELIVERY_PORT_WITHOUT_MODULE", record.path, "port is not under a valid kit module; place ports under the root defineModule marked.");
continue;
}
- const point = new THREE25.Vector3(...record.transform.translation).applyMatrix4(worldMatrix(moduleEntry.node).invert());
+ const point = new THREE26.Vector3(...record.transform.translation).applyMatrix4(worldMatrix(moduleEntry.node).invert());
const [width, depth] = spec.footprint;
const [x0, x1, z0, z1] = spec.origin === "corner" ? [0, width, 0, depth] : [-width / 2, width / 2, -depth / 2, depth / 2];
const slack = Math.max(0.0001, Math.max(width, depth, spec.height) * 0.00001);
@@ -15629,7 +15844,7 @@ function inspectDelivery(doc) {
}
return summary;
}
-var DELIVERY_OVERLAP_TEST_LIMIT = 50000000, segment3 = (name, occurrence) => `/${encodeURIComponent(name)}[${occurrence}]`, roleTail = (role, base) => role.startsWith(`${base}.`) ? role.slice(base.length + 1) : undefined, worldMatrix = (node) => new THREE25.Matrix4().fromArray(node.getWorldMatrix());
+var DELIVERY_OVERLAP_TEST_LIMIT = 50000000, segment3 = (name, occurrence) => `/${encodeURIComponent(name)}[${occurrence}]`, roleTail = (role, base) => role.startsWith(`${base}.`) ? role.slice(base.length + 1) : undefined, worldMatrix = (node) => new THREE26.Matrix4().fromArray(node.getWorldMatrix());
var init_delivery_inspect = __esm(() => {
init_gltf_io();
init_semantic();
@@ -16533,7 +16748,7 @@ var init_requirements_run = __esm(() => {
});
// src/qa/skin-integrity.ts
-import * as THREE26 from "three";
+import * as THREE27 from "three";
function validAttribute(a, count, size) {
if (!a || a.itemSize !== size || a.count !== count || !Number.isSafeInteger(count) || count < 1)
return false;
@@ -16580,9 +16795,9 @@ function inspectSkinIntegrity(root) {
}
while (chain.length) {
const n = chain.pop();
- const local = n.matrixAutoUpdate ? new THREE26.Matrix4().compose(n.position, n.quaternion, n.scale) : n.matrix.clone();
+ const local = n.matrixAutoUpdate ? new THREE27.Matrix4().compose(n.position, n.quaternion, n.scale) : n.matrix.clone();
const parent = n.parent ? worlds.get(n.parent) : undefined;
- const value = n.matrixWorldAutoUpdate === false ? n.matrixWorld.clone() : parent ? new THREE26.Matrix4().multiplyMatrices(parent, local) : local;
+ const value = n.matrixWorldAutoUpdate === false ? n.matrixWorld.clone() : parent ? new THREE27.Matrix4().multiplyMatrices(parent, local) : local;
worlds.set(n, value);
}
return worlds.get(node);
@@ -16632,7 +16847,7 @@ function inspectSkinIntegrity(root) {
if (result.truncated)
break;
}
- if (!finiteAffine(mesh.bindMatrix) || !Number.isFinite(mesh.bindMatrix.determinant()) || mesh.bindMatrix.determinant() === 0 || ![THREE26.AttachedBindMode, THREE26.DetachedBindMode].includes(mesh.bindMode)) {
+ if (!finiteAffine(mesh.bindMatrix) || !Number.isFinite(mesh.bindMatrix.determinant()) || mesh.bindMatrix.determinant() === 0 || ![THREE27.AttachedBindMode, THREE27.DetachedBindMode].includes(mesh.bindMode)) {
add("SKIN_BIND_MATRIX", "Mesh requires a finite invertible affine bind matrix and an attached or detached bind mode.", "bindMatrix");
}
const position = mesh.geometry?.getAttribute("position"), count = position?.count ?? 0;
@@ -16681,7 +16896,7 @@ function inspectSkinIntegrity(root) {
add("SKIN_POSE_TRANSFORM", "Current mesh world transform must be finite and affine.");
continue;
}
- const inverse = mesh.bindMode === THREE26.AttachedBindMode ? meshWorld.clone().invert() : mesh.bindMatrix.clone().invert();
+ const inverse = mesh.bindMode === THREE27.AttachedBindMode ? meshWorld.clone().invert() : mesh.bindMatrix.clone().invert();
const matrices = [];
for (let joint = 0;joint < bones.length; joint++) {
const boneWorld = world(bones[joint]);
@@ -16689,13 +16904,13 @@ function inspectSkinIntegrity(root) {
add("SKIN_POSE_TRANSFORM", `Current transform for joint ${joint} must be finite and affine.`, `joints[${joint}]`);
break;
}
- matrices.push(new THREE26.Matrix4().multiplyMatrices(boneWorld, skeleton.boneInverses[joint]).multiply(mesh.bindMatrix));
+ matrices.push(new THREE27.Matrix4().multiplyMatrices(boneWorld, skeleton.boneInverses[joint]).multiply(mesh.bindMatrix));
}
if (result.findings.length !== start)
continue;
- const base = new THREE26.Vector3, posed = new THREE26.Vector3, temp = new THREE26.Vector3, box = new THREE26.Box3;
+ const base = new THREE27.Vector3, posed = new THREE27.Vector3, temp = new THREE27.Vector3, box = new THREE27.Box3;
for (let vertex = 0;vertex < count; vertex++) {
- THREE26.Mesh.prototype.getVertexPosition.call(mesh, vertex, base);
+ THREE27.Mesh.prototype.getVertexPosition.call(mesh, vertex, base);
posed.set(0, 0, 0);
for (let lane = 0;lane < 4; lane++) {
const weight = weights.getComponent(vertex, lane);
@@ -16842,7 +17057,7 @@ var init_material_export = __esm(() => {
});
// src/community-exporter.ts
-import * as THREE27 from "three";
+import * as THREE28 from "three";
import { GLTFExporter } from "three/addons/exporters/GLTFExporter.js";
import { GLB_BUFFER } from "@gltf-transform/core";
function resolveGltfExporter(value = typeof process !== "undefined" ? process.env["KILN_GLTF_EXPORTER"] : undefined) {
@@ -16872,7 +17087,7 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
return found;
const copy = cleanClone(source);
normalizeTextureTransform(copy);
- copy.source = new THREE27.TextureSource(source.image);
+ copy.source = new THREE28.TextureSource(source.image);
textures.set(source, copy);
const bytes = source.userData["encoded"];
if (bytes?.bytes) {
@@ -16881,8 +17096,8 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
encoded.push((async () => {
copy.image = await platform.decode(bytes.bytes);
Object.defineProperty(copy, "isDataTexture", { value: true });
- copy.format = THREE27.RGBAFormat;
- copy.type = THREE27.UnsignedByteType;
+ copy.format = THREE28.RGBAFormat;
+ copy.type = THREE28.UnsignedByteType;
})());
}
return copy;
@@ -16899,7 +17114,7 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
physical.sheen = 1;
}
for (const [key, value] of Object.entries(copy)) {
- if (value instanceof THREE27.Texture)
+ if (value instanceof THREE28.Texture)
copy[key] = texture(value);
}
materials.set(source, copy);
@@ -16915,15 +17130,15 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
if (!copy.matrixAutoUpdate)
copy.matrix.decompose(copy.position, copy.quaternion, copy.scale);
if (source.isScene) {
- copy = new THREE27.Group;
+ copy = new THREE28.Group;
copy.copy(shadow, false);
}
if (source.isSprite) {
const sprite = source;
- const geometry = new THREE27.PlaneGeometry(1, 1);
+ const geometry = new THREE28.PlaneGeometry(1, 1);
geometry.translate(0.5 - sprite.center.x, 0.5 - sprite.center.y, 0);
geometry.rotateZ(sprite.material.rotation);
- const spriteMaterial = new THREE27.MeshBasicMaterial({
+ const spriteMaterial = new THREE28.MeshBasicMaterial({
name: sprite.material.name,
color: sprite.material.color,
opacity: sprite.material.opacity,
@@ -16934,8 +17149,8 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
});
Object.assign(spriteMaterial.userData, authorExtras?.material(sprite.material));
originalMaterials.set(spriteMaterial, sprite.material);
- copy = new THREE27.Mesh(geometry, spriteMaterial);
- THREE27.Object3D.prototype.copy.call(copy, shadow, false);
+ copy = new THREE28.Mesh(geometry, spriteMaterial);
+ THREE28.Object3D.prototype.copy.call(copy, shadow, false);
}
Object.assign(copy.userData, authorExtras?.node(source), rigExtrasForExport(source), openShellExtras(source), kitExtras(source), repeatInstancesExtras(source));
const semantic = source.userData[KILN_SEMANTIC_EXTRAS_KEY];
@@ -16999,8 +17214,8 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
if (!context)
throw new Error("A 2D canvas is required to prepare export texture channels.");
context.putImageData(new ImageData(new Uint8ClampedArray(data), width, height), 0, 0);
- const adapted = new THREE27.Texture().copy(map);
- adapted.source = new THREE27.TextureSource(canvas);
+ const adapted = new THREE28.Texture().copy(map);
+ adapted.source = new THREE28.TextureSource(canvas);
canvasInputs.set(map, adapted);
const direct = directImages.get(map);
if (direct)
@@ -17009,7 +17224,7 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
};
for (const material of materials.values()) {
for (const [key, value] of Object.entries(material)) {
- if (value instanceof THREE27.Texture && value.flipY && value.image?.data)
+ if (value instanceof THREE28.Texture && value.flipY && value.image?.data)
material[key] = canvasInput(value);
}
const standard = material;
@@ -17031,8 +17246,8 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
}
cloned.tracks = cloned.tracks.filter((track) => {
try {
- const binding = THREE27.PropertyBinding.parseTrackName(track.name);
- return ["position", "quaternion", "scale", "morphTargetInfluences"].includes(binding.propertyName) && THREE27.PropertyBinding.findNode(copy, binding.nodeName) !== null;
+ const binding = THREE28.PropertyBinding.parseTrackName(track.name);
+ return ["position", "quaternion", "scale", "morphTargetInfluences"].includes(binding.propertyName) && THREE28.PropertyBinding.findNode(copy, binding.nodeName) !== null;
} catch {
return false;
}
@@ -17227,7 +17442,7 @@ function applyIndexPolicy(doc, policy) {
var init_index_policy = () => {};
// src/surface-bake.ts
-import * as THREE28 from "three";
+import * as THREE29 from "three";
function settings(value, label) {
if (value === false)
return;
@@ -17269,13 +17484,13 @@ function drawnMeshes(root) {
function weld(mesh) {
const position = mesh.geometry.getAttribute("position");
const world = [];
- const box = new THREE28.Box3;
+ const box = new THREE29.Box3;
for (let i = 0;i < position.count; i++) {
- const point = new THREE28.Vector3().fromBufferAttribute(position, i).applyMatrix4(mesh.matrixWorld);
+ const point = new THREE29.Vector3().fromBufferAttribute(position, i).applyMatrix4(mesh.matrixWorld);
world.push(point);
box.expandByPoint(point);
}
- const size = box.isEmpty() ? 0 : box.getSize(new THREE28.Vector3).length();
+ const size = box.isEmpty() ? 0 : box.getSize(new THREE29.Vector3).length();
const tolerance = size > 0 ? size * 0.000001 : 0.000000001;
const keys = new Map;
const ids = new Int32Array(position.count);
@@ -17309,7 +17524,7 @@ function bakeEdge(topology, thresholdDegrees, smoothing) {
const a = points[triangles[t]];
const b = points[triangles[t + 1]];
const c = points[triangles[t + 2]];
- normals.push(new THREE28.Vector3().subVectors(b, a).cross(new THREE28.Vector3().subVectors(c, a)).normalize());
+ normals.push(new THREE29.Vector3().subVectors(b, a).cross(new THREE29.Vector3().subVectors(c, a)).normalize());
}
const edges = new Map;
const neighbours = points.map(() => new Set);
@@ -17328,7 +17543,7 @@ function bakeEdge(topology, thresholdDegrees, smoothing) {
edges.set(key, list);
}
}
- const threshold = THREE28.MathUtils.degToRad(thresholdDegrees);
+ const threshold = THREE29.MathUtils.degToRad(thresholdDegrees);
const weights = new Float64Array(points.length);
for (const [key, incidences] of edges) {
let weight;
@@ -17338,10 +17553,10 @@ function bakeEdge(topology, thresholdDegrees, smoothing) {
const [[f1], [f2, opposite2]] = incidences;
const n1 = normals[f1];
const n2 = normals[f2];
- const angle = Math.acos(THREE28.MathUtils.clamp(n1.dot(n2), -1, 1));
+ const angle = Math.acos(THREE29.MathUtils.clamp(n1.dot(n2), -1, 1));
const [u] = key.split(":").map(Number);
const scale = Math.max(points[u].distanceTo(points[opposite2]), 0.000000000001);
- const side = new THREE28.Vector3().subVectors(points[opposite2], points[u]).dot(n1) / scale;
+ const side = new THREE29.Vector3().subVectors(points[opposite2], points[u]).dot(n1) / scale;
weight = side < -0.000000001 ? smoothstep(threshold / 2, threshold, angle) : 0;
}
for (const id of key.split(":").map(Number))
@@ -17503,12 +17718,12 @@ function hemisphereDirections(count) {
const phi = i * golden;
const x = r * Math.cos(phi);
const y = r * Math.sin(phi);
- return new THREE28.Vector3(x, y, Math.sqrt(Math.max(0, 1 - x * x - y * y)));
+ return new THREE29.Vector3(x, y, Math.sqrt(Math.max(0, 1 - x * x - y * y)));
});
}
function occluderTriangles(occluders, bakedTier) {
const values = [];
- const point = new THREE28.Vector3;
+ const point = new THREE29.Vector3;
for (const mesh of drawnMeshes(occluders)) {
if (!drawn(mesh, null))
continue;
@@ -17572,12 +17787,12 @@ function bakeSurfaceAttributes(target, options = {}) {
let entry = bvhs.get(key);
if (!entry) {
const triangles = occluderTriangles(occluders, tier);
- const box = new THREE28.Box3;
+ const box = new THREE29.Box3;
for (let i = 0;i < triangles.length; i += 3)
- box.expandByPoint(new THREE28.Vector3(triangles[i], triangles[i + 1], triangles[i + 2]));
+ box.expandByPoint(new THREE29.Vector3(triangles[i], triangles[i + 1], triangles[i + 2]));
entry = {
bvh: new TriangleBvh(triangles),
- diagonal: box.isEmpty() ? 0 : box.getSize(new THREE28.Vector3).length()
+ diagonal: box.isEmpty() ? 0 : box.getSize(new THREE29.Vector3).length()
};
bvhs.set(key, entry);
}
@@ -17594,27 +17809,27 @@ function bakeSurfaceAttributes(target, options = {}) {
const welded = bakeEdge(topology, thresholdDegrees, smoothing);
const values = new Float32Array(sourceCount);
for (let i = 0;i < sourceCount; i++)
- values[i] = THREE28.MathUtils.clamp(welded[topology.ids[i]], 0, 1);
- geometry.setAttribute("_edge", new THREE28.BufferAttribute(values, 1));
+ values[i] = THREE29.MathUtils.clamp(welded[topology.ids[i]], 0, 1);
+ geometry.setAttribute("_edge", new THREE29.BufferAttribute(values, 1));
record._EDGE = { thresholdDegrees, smoothing };
}
if (cavityOptions) {
const { bvh, diagonal } = occlusion(tierOf(mesh));
const radius = cavityOptions.radius ?? SURFACE_BAKE_DEFAULTS.cavity.radiusFactor * diagonal;
const epsilon = Math.max(diagonal * 0.00001, 0.0000001);
- const normals = topology.points.map(() => new THREE28.Vector3);
+ const normals = topology.points.map(() => new THREE29.Vector3);
const { points, triangles } = topology;
for (let t = 0;t < triangles.length; t += 3) {
const a = points[triangles[t]];
- const face = new THREE28.Vector3().subVectors(points[triangles[t + 1]], a).cross(new THREE28.Vector3().subVectors(points[triangles[t + 2]], a));
+ const face = new THREE29.Vector3().subVectors(points[triangles[t + 1]], a).cross(new THREE29.Vector3().subVectors(points[triangles[t + 2]], a));
for (let k = 0;k < 3; k++)
normals[triangles[t + k]].add(face);
}
const exposure = new Float64Array(points.length);
- const tangent = new THREE28.Vector3;
- const bitangent = new THREE28.Vector3;
- const origin = new THREE28.Vector3;
- const direction = new THREE28.Vector3;
+ const tangent = new THREE29.Vector3;
+ const bitangent = new THREE29.Vector3;
+ const origin = new THREE29.Vector3;
+ const direction = new THREE29.Vector3;
points.forEach((point, id) => {
const normal = normals[id];
if (normal.lengthSq() === 0) {
@@ -17636,8 +17851,8 @@ function bakeSurfaceAttributes(target, options = {}) {
});
const values = new Float32Array(sourceCount);
for (let i = 0;i < sourceCount; i++)
- values[i] = THREE28.MathUtils.clamp(exposure[topology.ids[i]], 0, 1);
- geometry.setAttribute("_cavity", new THREE28.BufferAttribute(values, 1));
+ values[i] = THREE29.MathUtils.clamp(exposure[topology.ids[i]], 0, 1);
+ geometry.setAttribute("_cavity", new THREE29.BufferAttribute(values, 1));
record._CAVITY = { rays, radius };
}
geometry.userData = { ...geometry.userData, [SURFACE_BAKE_KEY]: record };
@@ -17657,7 +17872,7 @@ function surfaceBakeRecord(geometry) {
return record;
}
var SURFACE_ATTRIBUTES, SURFACE_BAKE_KEY = "kilnSurfaceBakeV1", SURFACE_BAKE_DEFAULTS, isObject3D2 = (value) => value?.isObject3D === true, smoothstep = (edge0, edge1, x) => {
- const t = THREE28.MathUtils.clamp((x - edge0) / (edge1 - edge0), 0, 1);
+ const t = THREE29.MathUtils.clamp((x - edge0) / (edge1 - edge0), 0, 1);
return t * t * (3 - 2 * t);
};
var init_surface_bake = __esm(() => {
@@ -18148,16 +18363,16 @@ function buildWallPanels(length, height, thickness, apertures) {
}
// src/assembly-transform.ts
-import * as THREE29 from "three";
+import * as THREE30 from "three";
function checkedTrs(matrix, label) {
const e = matrix.elements;
if (!e.every(Number.isFinite) || e[3] !== 0 || e[7] !== 0 || e[11] !== 0 || Math.abs(e[15] - 1) > 16 * Number.EPSILON)
throw new Error(`${label}: finite affine TRS is required.`);
if (!Number.isFinite(matrix.determinant()) || matrix.determinant() === 0)
throw new Error(`${label}: singular/zero-scale transforms are unsupported.`);
- const position = new THREE29.Vector3, quaternion = new THREE29.Quaternion, scale = new THREE29.Vector3;
+ const position = new THREE30.Vector3, quaternion = new THREE30.Quaternion, scale = new THREE30.Vector3;
matrix.decompose(position, quaternion, scale);
- const rebuilt = new THREE29.Matrix4().compose(position, quaternion, scale);
+ const rebuilt = new THREE30.Matrix4().compose(position, quaternion, scale);
if (rebuilt.elements.some((value, i) => !Number.isFinite(value) || Math.abs(value - e[i]) > 0.00000001 * Math.max(1, Math.abs(e[i]))))
throw new Error(`${label}: local shear cannot be represented losslessly as TRS.`);
return { position, quaternion, scale };
@@ -18165,7 +18380,7 @@ function checkedTrs(matrix, label) {
var init_assembly_transform = () => {};
// src/assembly.ts
-import * as THREE30 from "three";
+import * as THREE31 from "three";
function jsonData(value, label, ancestors = new Set) {
if (value === null || typeof value === "string" || typeof value === "boolean")
return;
@@ -18212,7 +18427,7 @@ function knownMetadata(source, parsed, label) {
throw new Error(`${label}: unsupported fields in known metadata would be lost during remapping.`);
}
function localMatrix(node) {
- return node.matrixAutoUpdate ? new THREE30.Matrix4().compose(node.position, node.quaternion, node.scale) : node.matrix.clone();
+ return node.matrixAutoUpdate ? new THREE31.Matrix4().compose(node.position, node.quaternion, node.scale) : node.matrix.clone();
}
function worldMatrix2(node) {
const chain = [], seen = new Set;
@@ -18222,7 +18437,7 @@ function worldMatrix2(node) {
seen.add(cursor);
chain.push(cursor);
}
- const result = new THREE30.Matrix4;
+ const result = new THREE31.Matrix4;
for (const entry of chain.reverse())
result.multiply(localMatrix(entry));
return result;
@@ -18238,7 +18453,7 @@ function census(root) {
const stack = [root];
while (stack.length) {
const node = stack.pop();
- if (!(node instanceof THREE30.Object3D) || ![THREE30.Object3D, THREE30.Group, THREE30.Mesh].includes(node.constructor))
+ if (!(node instanceof THREE31.Object3D) || ![THREE31.Object3D, THREE31.Group, THREE31.Mesh].includes(node.constructor))
throw new Error("Unsupported assembly node: only ordinary Object3D, Group and Mesh hierarchies are qualified; no skins, instances or custom node classes.");
if (matrices.has(node))
throw new Error("Assembly must be a tree; duplicate/cyclic children are unsupported.");
@@ -18254,21 +18469,21 @@ function census(root) {
checkedTrs(matrix, node.name || "unnamed node");
nodes.push(node);
matrices.set(node, matrix);
- if (node.onBeforeRender !== THREE30.Object3D.prototype.onBeforeRender || node.onAfterRender !== THREE30.Object3D.prototype.onAfterRender || node.onBeforeShadow !== THREE30.Object3D.prototype.onBeforeShadow || node.onAfterShadow !== THREE30.Object3D.prototype.onAfterShadow)
+ if (node.onBeforeRender !== THREE31.Object3D.prototype.onBeforeRender || node.onAfterRender !== THREE31.Object3D.prototype.onAfterRender || node.onBeforeShadow !== THREE31.Object3D.prototype.onBeforeShadow || node.onAfterShadow !== THREE31.Object3D.prototype.onAfterShadow)
throw new Error("Custom node render callbacks are unsupported in assembly replication.");
- if (node instanceof THREE30.Mesh) {
- if (!(node.geometry instanceof THREE30.BufferGeometry) || node.geometry instanceof THREE30.InstancedBufferGeometry)
+ if (node instanceof THREE31.Mesh) {
+ if (!(node.geometry instanceof THREE31.BufferGeometry) || node.geometry instanceof THREE31.InstancedBufferGeometry)
throw new Error("Unsupported assembly geometry type.");
if (Object.values(node.geometry.morphAttributes).some((attributes) => attributes?.length) || node.morphTargetInfluences?.length)
throw new Error("Assembly morph target replication is unsupported.");
const materials = Array.isArray(node.material) ? node.material : [node.material];
- if (materials.length === 0 || materials.some((material) => !(material instanceof THREE30.Material)))
+ if (materials.length === 0 || materials.some((material) => !(material instanceof THREE31.Material)))
throw new Error("Assembly mesh materials must be Material instances.");
}
if (!object(node.userData))
throw new Error("Assembly node metadata must be an object.");
jsonData(node.userData, node.name);
- if (!Array.isArray(node.animations) || node.animations.some((clip) => !(clip instanceof THREE30.AnimationClip)))
+ if (!Array.isArray(node.animations) || node.animations.some((clip) => !(clip instanceof THREE31.AnimationClip)))
throw new Error("Assembly node animations must contain AnimationClip instances.");
if (node.userData[KILN_SEMANTIC_EXTRAS_KEY] !== undefined) {
const metadata = readSemanticMetadataV1(node);
@@ -18309,11 +18524,11 @@ function describeAssembly(root, options = {}) {
const state = census(root), roles = new Map;
const frames = [], sockets = [], joints = [], materials = [];
const relative = new Map;
- const bounds = new THREE30.Box3, point = new THREE30.Vector3;
+ const bounds = new THREE31.Box3, point = new THREE31.Vector3;
let positionSamples = 0;
for (const [index, node] of state.nodes.entries()) {
const nodeId = `n${index}`;
- const matrix = node === root ? new THREE30.Matrix4 : relative.get(node.parent).clone().multiply(state.matrices.get(node));
+ const matrix = node === root ? new THREE31.Matrix4 : relative.get(node.parent).clone().multiply(state.matrices.get(node));
relative.set(node, matrix);
const metadata = state.semantics.get(node);
const descriptor = state.joints.get(node);
@@ -18335,7 +18550,7 @@ function describeAssembly(root, options = {}) {
for (const role of metadata?.roles ?? [])
addIndex(roles, role, node);
for (const frame of metadata?.frames ?? []) {
- const local = new THREE30.Matrix4().compose(new THREE30.Vector3(...frame.translation), new THREE30.Quaternion(...frame.rotation), new THREE30.Vector3(1, 1, 1));
+ const local = new THREE31.Matrix4().compose(new THREE31.Vector3(...frame.translation), new THREE31.Quaternion(...frame.rotation), new THREE31.Vector3(1, 1, 1));
frames.push({
node,
nodeId,
@@ -18345,7 +18560,7 @@ function describeAssembly(root, options = {}) {
}
for (const socket of metadata?.sockets ?? [])
sockets.push({ node, nodeId, socket: structuredClone(socket) });
- if (!(node instanceof THREE30.Mesh))
+ if (!(node instanceof THREE31.Mesh))
continue;
for (const [materialIndex, material] of (Array.isArray(node.material) ? node.material : [node.material]).entries())
materials.push({ node, nodeId, index: materialIndex, material });
@@ -18380,7 +18595,7 @@ function describeAssembly(root, options = {}) {
space: "root-local",
min: bounds.min.toArray(),
max: bounds.max.toArray(),
- size: bounds.getSize(new THREE30.Vector3).toArray()
+ size: bounds.getSize(new THREE31.Vector3).toArray()
},
clips,
ownership: {
@@ -18419,7 +18634,7 @@ function replicateAssembly(source, options) {
if (value !== undefined && !choices.includes(value))
throw new Error(`Unsupported assembly ${key} policy.`);
}
- if (options.parent !== undefined && !(options.parent instanceof THREE30.Object3D))
+ if (options.parent !== undefined && !(options.parent instanceof THREE31.Object3D))
throw new Error("Assembly parent must be an Object3D.");
const fresh = describeAssembly(source.root, { clips: source.clips }), state = census(source.root);
if (options.parent && state.nodes.includes(options.parent))
@@ -18452,16 +18667,16 @@ function replicateAssembly(source, options) {
throw new Error(`Unsupported custom metadata ${key} on ${node.name}; use copy-json only for inert data whose references you own.`);
}
jsonData(node.userData, node.name);
- if (node instanceof THREE30.Mesh) {
+ if (node instanceof THREE31.Mesh) {
if (options.geometry === "copy") {
jsonData(node.geometry.userData, `${node.name} geometry`);
- if (node.geometry.clone !== THREE30.BufferGeometry.prototype.clone || !threeConstructors.has(node.geometry.constructor))
+ if (node.geometry.clone !== THREE31.BufferGeometry.prototype.clone || !threeConstructors.has(node.geometry.constructor))
throw new Error("Copying custom geometry classes/clone implementations is unsupported; explicitly share the resource.");
}
if (options.materials === "copy")
for (const material of Array.isArray(node.material) ? node.material : [node.material]) {
jsonData(material.userData, `${node.name} material`);
- if (material.onBeforeCompile !== THREE30.Material.prototype.onBeforeCompile || material.onBeforeRender !== THREE30.Material.prototype.onBeforeRender || material.clone !== THREE30.Material.prototype.clone || !threeConstructors.has(material.constructor) || material.customProgramCacheKey !== THREE30.Material.prototype.customProgramCacheKey || material instanceof THREE30.ShaderMaterial)
+ if (material.onBeforeCompile !== THREE31.Material.prototype.onBeforeCompile || material.onBeforeRender !== THREE31.Material.prototype.onBeforeRender || material.clone !== THREE31.Material.prototype.clone || !threeConstructors.has(material.constructor) || material.customProgramCacheKey !== THREE31.Material.prototype.customProgramCacheKey || material instanceof THREE31.ShaderMaterial)
throw new Error("Copying custom/shader materials is unsupported; explicit sharing preserves their existing implementation.");
}
}
@@ -18549,9 +18764,9 @@ function replicateAssembly(source, options) {
const trackTargets = new Map;
const animatedNodes = new Set;
for (const clip of fresh.clips) {
- if (!(clip instanceof THREE30.AnimationClip))
+ if (!(clip instanceof THREE31.AnimationClip))
throw new Error("Assembly clips must be AnimationClip instances.");
- if (clip.blendMode !== THREE30.NormalAnimationBlendMode)
+ if (clip.blendMode !== THREE31.NormalAnimationBlendMode)
throw new Error("Additive/other animation blend modes are unsupported in assembly replication.");
jsonData(clip.userData, `Clip ${clip.name}`);
if (Object.keys(clip.userData).length && options.unknownMetadata !== "copy-json")
@@ -18578,7 +18793,7 @@ function replicateAssembly(source, options) {
if (options.space === "world") {
if (state.joints.has(source.root))
throw new Error("World placement of a declared joint root requires rest-transform rebasing; wrap it in an assembly root or use local placement.");
- const parentWorld = options.parent ? worldMatrix2(options.parent) : new THREE30.Matrix4;
+ const parentWorld = options.parent ? worldMatrix2(options.parent) : new THREE31.Matrix4;
if (!Number.isFinite(parentWorld.determinant()) || parentWorld.determinant() === 0)
throw new Error("World placement requires an invertible, nonsingular parent transform.");
rootMatrix = parentWorld.invert().multiply(worldMatrix2(source.root));
@@ -18619,7 +18834,7 @@ function replicateAssembly(source, options) {
return materials.get(material);
};
for (const node of state.nodes) {
- const copy = node instanceof THREE30.Mesh ? new THREE30.Mesh(node.geometry, node.material) : node instanceof THREE30.Group ? new THREE30.Group : new THREE30.Object3D;
+ const copy = node instanceof THREE31.Mesh ? new THREE31.Mesh(node.geometry, node.material) : node instanceof THREE31.Group ? new THREE31.Group : new THREE31.Object3D;
copy.copy(node, false);
copy.name = names.get(node);
copy.animations = [];
@@ -18632,7 +18847,7 @@ function replicateAssembly(source, options) {
}
copy.matrix.copy(matrix);
copy.matrixWorldNeedsUpdate = true;
- if (node instanceof THREE30.Mesh && copy instanceof THREE30.Mesh) {
+ if (node instanceof THREE31.Mesh && copy instanceof THREE31.Mesh) {
if (options.geometry === "copy") {
if (!geometries.has(node.geometry))
geometries.set(node.geometry, node.geometry.clone());
@@ -18697,7 +18912,7 @@ var init_assembly = __esm(() => {
KILN_CHARACTER_JOINT_EXTRAS_KEY,
KILN_CHARACTER_RIG_EXTRAS_KEY
]);
- threeConstructors = new Set(Object.values(THREE30));
+ threeConstructors = new Set(Object.values(THREE31));
});
// src/palette-check.ts
@@ -19238,7 +19453,7 @@ var init_budget = __esm(() => {
});
// src/animation-cubic.ts
-import * as THREE31 from "three";
+import * as THREE32 from "three";
function useCubicSpline(track) {
track.createInterpolant = cubicSplineFactory;
return track;
@@ -19246,7 +19461,7 @@ function useCubicSpline(track) {
var CubicSplineInterpolant, CubicSplineQuaternionInterpolant, cubicSplineFactory;
var init_animation_cubic = __esm(() => {
init_animation_spline();
- CubicSplineInterpolant = class CubicSplineInterpolant extends THREE31.Interpolant {
+ CubicSplineInterpolant = class CubicSplineInterpolant extends THREE32.Interpolant {
copySampleValue_(index) {
const result = this.resultBuffer;
const size = this.valueSize;
@@ -19274,7 +19489,7 @@ var init_animation_cubic = __esm(() => {
});
// src/architecture.ts
-import * as THREE32 from "three";
+import * as THREE33 from "three";
function positive4(value, name) {
if (!Number.isFinite(value) || value <= 0)
throw new RangeError(`${name} must be finite and > 0`);
@@ -19339,17 +19554,17 @@ function buildFace(roofRoot, profile, sideSign) {
const verticalRun = profile.ridgeY - profile.eaveY;
const downhillLength = Math.hypot(horizontalRun, verticalRun);
const alongRidge = (profile.ridgeAxis === "x" ? profile.spanX : profile.spanZ) + profile.overhang * 2;
- const downhill = profile.ridgeAxis === "x" ? new THREE32.Vector3(0, -verticalRun, sideSign * horizontalRun).normalize() : new THREE32.Vector3(sideSign * horizontalRun, -verticalRun, 0).normalize();
- const tangent = profile.ridgeAxis === "x" ? new THREE32.Vector3(sideSign, 0, 0) : new THREE32.Vector3(0, 0, -sideSign);
+ const downhill = profile.ridgeAxis === "x" ? new THREE33.Vector3(0, -verticalRun, sideSign * horizontalRun).normalize() : new THREE33.Vector3(sideSign * horizontalRun, -verticalRun, 0).normalize();
+ const tangent = profile.ridgeAxis === "x" ? new THREE33.Vector3(sideSign, 0, 0) : new THREE33.Vector3(0, 0, -sideSign);
const normal = downhill.clone().cross(tangent).normalize();
- const localToRoof = new THREE32.Matrix4().makeBasis(tangent, normal, downhill);
+ const localToRoof = new THREE33.Matrix4().makeBasis(tangent, normal, downhill);
localToRoof.setPosition(0, profile.ridgeY, 0);
const world = () => {
roofRoot.updateWorldMatrix(true, false);
return roofRoot.matrixWorld.clone().multiply(localToRoof);
};
const direction = (axis) => axis.clone().transformDirection(world());
- const point = (x, z) => new THREE32.Vector3(x, 0, z).applyMatrix4(world());
+ const point = (x, z) => new THREE33.Vector3(x, 0, z).applyMatrix4(world());
return {
side,
ridgeAxis: profile.ridgeAxis,
@@ -19359,13 +19574,13 @@ function buildFace(roofRoot, profile, sideSign) {
return world();
},
get ridgeTangent() {
- return direction(new THREE32.Vector3(1, 0, 0));
+ return direction(new THREE33.Vector3(1, 0, 0));
},
get downhillDirection() {
- return direction(new THREE32.Vector3(0, 0, 1));
+ return direction(new THREE33.Vector3(0, 0, 1));
},
get outwardNormal() {
- return direction(new THREE32.Vector3(0, 1, 0));
+ return direction(new THREE33.Vector3(0, 1, 0));
},
get ridgeStart() {
return point(-alongRidge / 2, 0);
@@ -19383,17 +19598,17 @@ function buildFace(roofRoot, profile, sideSign) {
};
}
function buildRoof(name, material, profile, parent) {
- const root = new THREE32.Object3D;
+ const root = new THREE33.Object3D;
root.name = name;
if (parent)
parent.add(root);
stampSemanticMetadataV1(root, roleMetadata([semanticRole(KILN_SEMANTIC_ROLES.roof, "assembly")], [relationship("separable-from", "architecture.shell.gable")]));
const faces = [buildFace(root, profile, 1), buildFace(root, profile, -1)];
const buildSlope = (face) => {
- const geometry = new THREE32.BoxGeometry(face.dimensions.alongRidge, profile.thickness, face.dimensions.downhill);
- const mesh = new THREE32.Mesh(geometry, material);
+ const geometry = new THREE33.BoxGeometry(face.dimensions.alongRidge, profile.thickness, face.dimensions.downhill);
+ const mesh = new THREE33.Mesh(geometry, material);
mesh.name = `Mesh_${name}_${face.side}`;
- const center = new THREE32.Matrix4().makeTranslation(0, -profile.thickness / 2, face.dimensions.downhill / 2);
+ const center = new THREE33.Matrix4().makeTranslation(0, -profile.thickness / 2, face.dimensions.downhill / 2);
setTransform(mesh, face.localToRoof.clone().multiply(center));
const coveredWall = profile.ridgeAxis === "x" ? face.side === "positive" ? "wall.right" : "wall.left" : face.side === "positive" ? "wall.front" : "wall.back";
stampSemanticMetadataV1(mesh, roleMetadata([semanticRole(KILN_SEMANTIC_ROLES.roof, "slope", face.side)], [
@@ -19463,7 +19678,7 @@ function createGableEndPanel(name, material, options) {
const ridgeAxis = options.ridgeAxis ?? "x";
const side = options.side ?? "positive";
const half = span / 2;
- const shape = new THREE32.Shape;
+ const shape = new THREE33.Shape;
shape.moveTo(-half, 0);
shape.lineTo(half, 0);
shape.lineTo(0, rise);
@@ -19482,7 +19697,7 @@ function createGableEndPanel(name, material, options) {
const right = opening.offset + opening.width / 2;
const bottom = opening.bottom;
const top = bottom + opening.height;
- const hole = new THREE32.Path;
+ const hole = new THREE33.Path;
hole.moveTo(left, bottom);
hole.lineTo(left, top);
hole.lineTo(right, top);
@@ -19490,7 +19705,7 @@ function createGableEndPanel(name, material, options) {
hole.closePath();
shape.holes.push(hole);
}
- const geometry = new THREE32.ExtrudeGeometry(shape, {
+ const geometry = new THREE33.ExtrudeGeometry(shape, {
depth: thickness,
bevelEnabled: false,
steps: 1
@@ -19499,7 +19714,7 @@ function createGableEndPanel(name, material, options) {
if (ridgeAxis === "x")
geometry.rotateY(-Math.PI / 2);
geometry.computeVertexNormals();
- const root = new THREE32.Mesh(geometry, material);
+ const root = new THREE33.Mesh(geometry, material);
root.name = `Mesh_${name}`;
stampSemanticMetadataV1(root, roleMetadata([`roof.gable.${side}`], [
relationship("adjacent-to", "roof.slope.positive"),
@@ -19515,7 +19730,7 @@ function createGableEndPanel(name, material, options) {
}
]));
const markers = normalized.map((opening, index) => {
- const marker = new THREE32.Object3D;
+ const marker = new THREE33.Object3D;
marker.name = `Opening_${name}_${opening.id ?? index + 1}`;
marker.position.set(ridgeAxis === "z" ? opening.offset : 0, opening.bottom + opening.height / 2, ridgeAxis === "x" ? opening.offset : 0);
marker.scale.set(ridgeAxis === "x" ? thickness : opening.width, opening.height, ridgeAxis === "x" ? opening.width : thickness);
@@ -19535,7 +19750,7 @@ function wallNeighbors(wall) {
}
function createShellWall(name, wall, material, length, height, thickness, openings) {
const axis = wallRunAxis(wall);
- const root = new THREE32.Object3D;
+ const root = new THREE33.Object3D;
root.name = `${name}_Wall_${wall}`;
const neighbors = wallNeighbors(wall);
stampSemanticMetadataV1(root, roleMetadata([`wall.${wall}`], [
@@ -19547,8 +19762,8 @@ function createShellWall(name, wall, material, length, height, thickness, openin
const panel = (suffix, lo, hi, y0, y1) => {
if (hi <= lo || y1 <= y0)
return;
- const geometry = axis === "x" ? new THREE32.BoxGeometry(hi - lo, y1 - y0, thickness) : new THREE32.BoxGeometry(thickness, y1 - y0, hi - lo);
- const mesh = new THREE32.Mesh(geometry, material);
+ const geometry = axis === "x" ? new THREE33.BoxGeometry(hi - lo, y1 - y0, thickness) : new THREE33.BoxGeometry(thickness, y1 - y0, hi - lo);
+ const mesh = new THREE33.Mesh(geometry, material);
mesh.name = `Mesh_${name}_${wall}_${suffix}`;
mesh.position.set(axis === "x" ? (lo + hi) / 2 : 0, (y0 + y1) / 2, axis === "z" ? (lo + hi) / 2 : 0);
root.add(mesh);
@@ -19565,7 +19780,7 @@ function createShellWall(name, wall, material, length, height, thickness, openin
panel(singleNames[segment.suffix] ?? segment.suffix.slice(1), segment.left, segment.right, segment.bottom, segment.top);
}
for (const opening of built.openings) {
- const marker = new THREE32.Object3D;
+ const marker = new THREE33.Object3D;
marker.name = `Opening_${wall}_${opening.id}`;
marker.position.set(axis === "x" ? opening.offset : 0, opening.sill + opening.height / 2, axis === "z" ? opening.offset : 0);
marker.scale.set(axis === "x" ? opening.width : opening.depth, opening.height, axis === "z" ? opening.width : opening.depth);
@@ -19588,7 +19803,7 @@ function createGableShell(name, materials, options) {
const closedEnds = options.closedEnds ?? true;
const enterable = options.enterable ?? true;
const shellOpenings = options.openings ?? (enterable ? [{ wall: "front", kind: "door" }] : []);
- const root = new THREE32.Object3D;
+ const root = new THREE33.Object3D;
root.name = name;
stampSemanticMetadataV1(root, roleMetadata(["architecture.shell.gable"], [relationship("contains", "floor"), relationship("contains", "roof.assembly")]));
const wallSpecs = {
@@ -19606,7 +19821,7 @@ function createGableShell(name, materials, options) {
walls[wall] = built.root;
openingMarkers.push(...built.openings);
}
- const floor = new THREE32.Mesh(new THREE32.BoxGeometry(spanX, floorThickness, spanZ), materials.floor ?? materials.wall);
+ const floor = new THREE33.Mesh(new THREE33.BoxGeometry(spanX, floorThickness, spanZ), materials.floor ?? materials.wall);
floor.name = `Mesh_${name}_Floor`;
floor.position.y = -floorThickness / 2;
stampSemanticMetadataV1(floor, roleMetadata(["floor"], ["front", "back", "left", "right"].map((wall) => relationship("adjacent-to", `wall.${wall}`))));
@@ -19721,13 +19936,13 @@ function createRoofSurfaceLayout(name, material, options) {
assertDimension("createRoofSurfaceLayout generated width", spec.width);
assertDimension("createRoofSurfaceLayout generated length", spec.length);
}
- const root = new THREE32.Object3D;
+ const root = new THREE33.Object3D;
root.name = name;
stampSemanticMetadataV1(root, roleMetadata([`roof.surface.${options.kind}`], [relationship("coverage-of", `roof.slope.${options.face.side}`)]));
const items = specs.map((spec, index) => {
- const mesh = new THREE32.Mesh(new THREE32.BoxGeometry(spec.width, thickness, spec.length), material);
+ const mesh = new THREE33.Mesh(new THREE33.BoxGeometry(spec.width, thickness, spec.length), material);
mesh.name = `Mesh_${name}_${index + 1}`;
- const local = new THREE32.Matrix4().makeTranslation(spec.x, thickness / 2 + 0.002, spec.z);
+ const local = new THREE33.Matrix4().makeTranslation(spec.x, thickness / 2 + 0.002, spec.z);
setTransform(mesh, faceToRoot.clone().multiply(local));
root.add(mesh);
return mesh;
@@ -19744,7 +19959,7 @@ var init_architecture2 = __esm(() => {
});
// src/gears.ts
-import * as THREE33 from "three";
+import * as THREE34 from "three";
function gearGeo(opts = {}) {
const {
teeth = 12,
@@ -19843,8 +20058,8 @@ function gearGeo(opts = {}) {
indices.push(tA, bA, bB);
indices.push(tA, bB, tB);
}
- const geo = new THREE33.BufferGeometry;
- geo.setAttribute("position", new THREE33.Float32BufferAttribute(positions, 3));
+ const geo = new THREE34.BufferGeometry;
+ geo.setAttribute("position", new THREE34.Float32BufferAttribute(positions, 3));
geo.setIndex(indices);
const nonIndexed = geo.toNonIndexed();
nonIndexed.computeVertexNormals();
@@ -19929,8 +20144,8 @@ function bladeGeo(opts = {}) {
indices.push(count + i, tip, count + j);
}
}
- const geo = new THREE33.BufferGeometry;
- geo.setAttribute("position", new THREE33.Float32BufferAttribute(positions, 3));
+ const geo = new THREE34.BufferGeometry;
+ geo.setAttribute("position", new THREE34.Float32BufferAttribute(positions, 3));
geo.setIndex(indices);
const nonIndexed = geo.toNonIndexed();
nonIndexed.computeVertexNormals();
@@ -19942,7 +20157,7 @@ var init_gears = __esm(() => {
});
// src/ops.ts
-import * as THREE34 from "three";
+import * as THREE35 from "three";
import { LoopSubdivision } from "three-subdivide/build/index.module.js";
import { mergeVertices as threeMergeVertices } from "three/examples/jsm/utils/BufferGeometryUtils.js";
function assertFiniteSourceFrame(name, source) {
@@ -19976,9 +20191,9 @@ function arrayLinear(namePrefix, source, count, offset, parent) {
}
function degreesOf(euler) {
return [
- THREE34.MathUtils.radToDeg(euler.x),
- THREE34.MathUtils.radToDeg(euler.y),
- THREE34.MathUtils.radToDeg(euler.z)
+ THREE35.MathUtils.radToDeg(euler.x),
+ THREE35.MathUtils.radToDeg(euler.y),
+ THREE35.MathUtils.radToDeg(euler.z)
];
}
function arrayRadial(namePrefix, source, count, axis = "y", parent, center, options = {}) {
@@ -19991,12 +20206,12 @@ function arrayRadial(namePrefix, source, count, axis = "y", parent, center, opti
if (center)
assertFiniteTriple("arrayRadial center", center);
const out = [];
- const pivot = center ? new THREE34.Vector3(...center) : new THREE34.Vector3;
+ const pivot = center ? new THREE35.Vector3(...center) : new THREE35.Vector3;
const basePos = source.position.clone().sub(pivot);
- const axisVec = axis === "x" ? new THREE34.Vector3(1, 0, 0) : axis === "z" ? new THREE34.Vector3(0, 0, 1) : new THREE34.Vector3(0, 1, 0);
+ const axisVec = axis === "x" ? new THREE35.Vector3(1, 0, 0) : axis === "z" ? new THREE35.Vector3(0, 0, 1) : new THREE35.Vector3(0, 1, 0);
const positions = [];
for (let i = 1;i < count; i++) {
- const position = basePos.clone().applyMatrix4(new THREE34.Matrix4().makeRotationAxis(axisVec, i / count * Math.PI * 2)).add(pivot);
+ const position = basePos.clone().applyMatrix4(new THREE35.Matrix4().makeRotationAxis(axisVec, i / count * Math.PI * 2)).add(pivot);
assertFiniteTriple("arrayRadial resulting position", position.toArray());
positions.push(position);
}
@@ -20035,7 +20250,7 @@ function repeatAlongCurve(source, points, options) {
assertFiniteTriple(`${name} points[${i}]`, point);
const up = options.up ?? [0, 1, 0];
assertFiniteTriple(`${name} up`, up);
- const upVector = new THREE34.Vector3(...up);
+ const upVector = new THREE35.Vector3(...up);
if (upVector.lengthSq() === 0)
throw new RangeError(`${name} up must not be zero.`);
upVector.normalize();
@@ -20074,13 +20289,13 @@ function repeatAlongCurve(source, points, options) {
segment++;
while (segment < points.length - 2 && cumulative[segment + 1] === cumulative[segment])
segment++;
- const a = new THREE34.Vector3(...points[segment]);
- const b = new THREE34.Vector3(...points[segment + 1]);
+ const a = new THREE35.Vector3(...points[segment]);
+ const b = new THREE35.Vector3(...points[segment + 1]);
const segmentLength = cumulative[segment + 1] - cumulative[segment];
const local = segmentLength > 0 ? (s - cumulative[segment]) / segmentLength : 0;
const position = a.clone().lerp(b, Math.min(Math.max(local, 0), 1));
- const k = THREE34.MathUtils.lerp(scale[0], scale[1], t);
- const rotation = new THREE34.Matrix4;
+ const k = THREE35.MathUtils.lerp(scale[0], scale[1], t);
+ const rotation = new THREE35.Matrix4;
let angle = 0;
if (align === "tangent") {
const tangent = b.clone().sub(a).normalize();
@@ -20088,17 +20303,17 @@ function repeatAlongCurve(source, points, options) {
if (side.lengthSq() < 0.000000000001)
side = previousUp.clone().sub(tangent.clone().multiplyScalar(previousUp.dot(tangent)));
if (side.lengthSq() < 0.000000000001)
- side = new THREE34.Vector3(Math.abs(tangent.x) < 0.9 ? 1 : 0, Math.abs(tangent.x) < 0.9 ? 0 : 1, 0).sub(tangent.clone().multiplyScalar(Math.abs(tangent.x) < 0.9 ? tangent.x : tangent.y));
+ side = new THREE35.Vector3(Math.abs(tangent.x) < 0.9 ? 1 : 0, Math.abs(tangent.x) < 0.9 ? 0 : 1, 0).sub(tangent.clone().multiplyScalar(Math.abs(tangent.x) < 0.9 ? tangent.x : tangent.y));
side.normalize();
previousUp = side;
- rotation.makeBasis(tangent, side, new THREE34.Vector3().crossVectors(tangent, side));
- angle = THREE34.MathUtils.degToRad(THREE34.MathUtils.lerp(twist[0], twist[1], t));
+ rotation.makeBasis(tangent, side, new THREE35.Vector3().crossVectors(tangent, side));
+ angle = THREE35.MathUtils.degToRad(THREE35.MathUtils.lerp(twist[0], twist[1], t));
}
for (const extra of opposite ? [0, Math.PI] : [0]) {
const turned = rotation.clone();
if (angle + extra)
- turned.multiply(new THREE34.Matrix4().makeRotationX(angle + extra));
- const matrix = new THREE34.Matrix4().makeTranslation(position.x, position.y, position.z).multiply(turned).multiply(new THREE34.Matrix4().makeScale(k, k, k));
+ turned.multiply(new THREE35.Matrix4().makeRotationX(angle + extra));
+ const matrix = new THREE35.Matrix4().makeTranslation(position.x, position.y, position.z).multiply(turned).multiply(new THREE35.Matrix4().makeScale(k, k, k));
if (!matrix.elements.every(Number.isFinite))
throw new RangeError(`${name} produced a non-finite copy transform.`);
frames.push({ matrix, t });
@@ -20130,9 +20345,9 @@ function repeatAlongCurve(source, points, options) {
const total = perCopy * copies;
if (total > GEOMETRY_ALLOCATION_LIMITS.curveRepeatVertices)
throw new RangeError(`${name} would produce ${total} vertices; the limit is ${GEOMETRY_ALLOCATION_LIMITS.curveRepeatVertices}. Reduce count, simplify the source, or use merge: false.`);
- const merged = new THREE34.BufferGeometry;
- const vector = new THREE34.Vector3;
- const normalMatrix = new THREE34.Matrix3;
+ const merged = new THREE35.BufferGeometry;
+ const vector = new THREE35.Vector3;
+ const normalMatrix = new THREE35.Matrix3;
for (const [key, attribute] of Object.entries(geometry.attributes)) {
const size = attribute.itemSize;
const transformed = key === "position" || key === "normal" || key === "tangent";
@@ -20156,13 +20371,13 @@ function repeatAlongCurve(source, points, options) {
}
}
}
- merged.setAttribute(key, new THREE34.BufferAttribute(out, size, transformed ? false : attribute.normalized));
+ merged.setAttribute(key, new THREE35.BufferAttribute(out, size, transformed ? false : attribute.normalized));
}
if (options.along) {
const along = new Float32Array(total);
for (let copy = 0;copy < copies; copy++)
along.fill(frames[copy].t, copy * perCopy, (copy + 1) * perCopy);
- merged.setAttribute("_along", new THREE34.BufferAttribute(along, 1));
+ merged.setAttribute("_along", new THREE35.BufferAttribute(along, 1));
}
const index = geometry.getIndex();
if (index) {
@@ -20170,7 +20385,7 @@ function repeatAlongCurve(source, points, options) {
for (let copy = 0;copy < copies; copy++)
for (let i = 0;i < index.count; i++)
indices[copy * index.count + i] = index.getX(i) + copy * perCopy;
- merged.setIndex(new THREE34.BufferAttribute(indices, 1));
+ merged.setIndex(new THREE35.BufferAttribute(indices, 1));
}
merged.computeBoundingBox();
merged.computeBoundingSphere();
@@ -20179,15 +20394,15 @@ function repeatAlongCurve(source, points, options) {
function mirror(name, source, axis, parent) {
if (source.matrixAutoUpdate)
source.updateMatrix();
- const reflected = new THREE34.Matrix4().makeScale(axis === "x" ? -1 : 1, axis === "y" ? -1 : 1, axis === "z" ? -1 : 1).multiply(source.matrix);
+ const reflected = new THREE35.Matrix4().makeScale(axis === "x" ? -1 : 1, axis === "y" ? -1 : 1, axis === "z" ? -1 : 1).multiply(source.matrix);
if (!reflected.elements.every(Number.isFinite) || reflected.determinant() === 0) {
throw new RangeError(`mirror("${name}"): source requires a finite, nonsingular local transform.`);
}
- const position = new THREE34.Vector3;
- const quaternion = new THREE34.Quaternion;
- const scale = new THREE34.Vector3;
+ const position = new THREE35.Vector3;
+ const quaternion = new THREE35.Quaternion;
+ const scale = new THREE35.Vector3;
reflected.decompose(position, quaternion, scale);
- const recomposed = new THREE34.Matrix4().compose(position, quaternion, scale);
+ const recomposed = new THREE35.Matrix4().compose(position, quaternion, scale);
if (reflected.elements.some((value, i) => Math.abs(value - recomposed.elements[i]) > 0.00000001 * Math.max(1, Math.abs(value)))) {
throw new RangeError(`mirror("${name}"): local shear cannot be represented by a reflected TRS.`);
}
@@ -20203,13 +20418,13 @@ function mergeVertices(geometry, opts = {}) {
const { tolerance = 0.0001, positionOnly = false } = typeof opts === "number" ? { tolerance: opts } : opts;
if (!positionOnly)
return threeMergeVertices(geometry, tolerance);
- const stripped = new THREE34.BufferGeometry;
+ const stripped = new THREE35.BufferGeometry;
const pos = geometry.getAttribute("position");
if (!pos)
return geometry;
- stripped.setAttribute("position", new THREE34.BufferAttribute(new Float32Array(pos.array), pos.itemSize, pos.normalized));
+ stripped.setAttribute("position", new THREE35.BufferAttribute(new Float32Array(pos.array), pos.itemSize, pos.normalized));
if (geometry.index) {
- stripped.setIndex(new THREE34.BufferAttribute(new Uint32Array(geometry.index.array), 1));
+ stripped.setIndex(new THREE35.BufferAttribute(new Uint32Array(geometry.index.array), 1));
}
return threeMergeVertices(stripped, tolerance);
}
@@ -20244,8 +20459,8 @@ function subdivide(geometry, iterations = 1, opts = {}) {
const { weld = true, preserveUV = false, ...subOpts } = opts;
const prepared = geometry.clone();
prepared.computeBoundingBox();
- const center = prepared.boundingBox.getCenter(new THREE34.Vector3);
- const extent = prepared.boundingBox.getSize(new THREE34.Vector3);
+ const center = prepared.boundingBox.getCenter(new THREE35.Vector3);
+ const extent = prepared.boundingBox.getSize(new THREE35.Vector3);
const size = Math.max(extent.x, extent.y, extent.z);
const normalizationScale = size > 0 ? 1e4 / size : 1;
if (!Number.isFinite(normalizationScale) || !center.toArray().every(Number.isFinite))
@@ -20275,13 +20490,13 @@ function subdivide(geometry, iterations = 1, opts = {}) {
const values = new Float32Array(attribute.count);
for (let i = 0;i < attribute.count; i++)
values[i] = decoded[i * 4 + component];
- input.setAttribute(lane, new THREE34.BufferAttribute(values, 1));
+ input.setAttribute(lane, new THREE35.BufferAttribute(values, 1));
lanes.push(lane);
}
input.deleteAttribute(name);
fourthComponents.push({ name, lanes });
} else
- input.setAttribute(name, new THREE34.BufferAttribute(decoded, components));
+ input.setAttribute(name, new THREE35.BufferAttribute(decoded, components));
}
for (const targets of Object.values(input.morphAttributes))
for (let target = 0;target < targets.length; target++) {
@@ -20290,7 +20505,7 @@ function subdivide(geometry, iterations = 1, opts = {}) {
for (let i = 0;i < attribute.count; i++)
for (let component = 0;component < 3; component++)
decoded[i * 3 + component] = attribute.getComponent(i, component);
- targets[target] = new THREE34.BufferAttribute(decoded, 3);
+ targets[target] = new THREE35.BufferAttribute(decoded, 3);
}
if (preserveUV)
subOpts.uvSmooth = false;
@@ -20304,7 +20519,7 @@ function subdivide(geometry, iterations = 1, opts = {}) {
values[i * 4 + component] = lane.getX(i);
output.deleteAttribute(lanes[component]);
}
- output.setAttribute(name, new THREE34.BufferAttribute(values, 4));
+ output.setAttribute(name, new THREE35.BufferAttribute(values, 4));
}
output.scale(1 / normalizationScale, 1 / normalizationScale, 1 / normalizationScale).translate(center.x, center.y, center.z);
output.userData = structuredClone(geometry.userData);
@@ -20369,9 +20584,9 @@ function assertTubeRadius(radius) {
}
function curveToMesh(points, radius, tubularSegments = 32, radialSegments = 8, closed = false) {
assertTubeRadius(radius);
- const vectors = points.map((p) => new THREE34.Vector3(p[0], p[1], p[2]));
- const curve = new THREE34.CatmullRomCurve3(vectors, closed);
- return new THREE34.TubeGeometry(curve, tubularSegments, radius, radialSegments, closed);
+ const vectors = points.map((p) => new THREE35.Vector3(p[0], p[1], p[2]));
+ const curve = new THREE35.CatmullRomCurve3(vectors, closed);
+ return new THREE35.TubeGeometry(curve, tubularSegments, radius, radialSegments, closed);
}
function normalizeSurfaceNormals(geo) {
const normal = geo.getAttribute("normal");
@@ -20402,15 +20617,15 @@ function lathe(profile, segments = 12) {
}
function revolveGeo(profile, options = {}) {
const { angle = Math.PI * 2, axis = [0, 1, 0], segments = 12 } = options;
- const points2d = profile.map((p) => new THREE34.Vector2(p[0], p[1]));
- const geo = normalizeSurfaceNormals(new THREE34.LatheGeometry(points2d, segments, 0, angle));
- const n = new THREE34.Vector3(axis[0], axis[1], axis[2]);
+ const points2d = profile.map((p) => new THREE35.Vector2(p[0], p[1]));
+ const geo = normalizeSurfaceNormals(new THREE35.LatheGeometry(points2d, segments, 0, angle));
+ const n = new THREE35.Vector3(axis[0], axis[1], axis[2]);
if (n.lengthSq() < 0.000000000001) {
throw new Error(`revolveGeo: axis must be a non-zero vector (got [${axis.join(",")}]).`);
}
n.normalize();
if (n.x !== 0 || n.y !== 1 || n.z !== 0) {
- const q = new THREE34.Quaternion().setFromUnitVectors(new THREE34.Vector3(0, 1, 0), n);
+ const q = new THREE35.Quaternion().setFromUnitVectors(new THREE35.Vector3(0, 1, 0), n);
geo.applyQuaternion(q);
}
return geo;
@@ -20426,9 +20641,9 @@ function pipeAlongPath(points, radius, options = {}) {
const smoothed = [];
smoothed.push(points[0]);
for (let i = 1;i < points.length - 1; i++) {
- const prev = new THREE34.Vector3(...points[i - 1]);
- const cur = new THREE34.Vector3(...points[i]);
- const next = new THREE34.Vector3(...points[i + 1]);
+ const prev = new THREE35.Vector3(...points[i - 1]);
+ const cur = new THREE35.Vector3(...points[i]);
+ const next = new THREE35.Vector3(...points[i + 1]);
const inDir = cur.clone().sub(prev);
const outDir = next.clone().sub(cur);
const inLen = inDir.length();
@@ -20446,12 +20661,12 @@ function pipeAlongPath(points, radius, options = {}) {
return curveToMesh(pathPoints, radius, tubularSegments, radialSegments, closed);
}
function bezierCurve(controlPoints, samples = 32) {
- const vecs = controlPoints.map((p) => new THREE34.Vector3(p[0], p[1], p[2]));
+ const vecs = controlPoints.map((p) => new THREE35.Vector3(p[0], p[1], p[2]));
let curve;
if (vecs.length === 3) {
- curve = new THREE34.QuadraticBezierCurve3(vecs[0], vecs[1], vecs[2]);
+ curve = new THREE35.QuadraticBezierCurve3(vecs[0], vecs[1], vecs[2]);
} else if (vecs.length === 4) {
- curve = new THREE34.CubicBezierCurve3(vecs[0], vecs[1], vecs[2], vecs[3]);
+ curve = new THREE35.CubicBezierCurve3(vecs[0], vecs[1], vecs[2], vecs[3]);
} else {
throw new Error(`bezierCurve: need 3 or 4 control points, got ${vecs.length}`);
}
@@ -20464,20 +20679,20 @@ var init_ops = __esm(() => {
});
// src/deformation-normals.ts
-import * as THREE35 from "three";
+import * as THREE36 from "three";
function recomputeDeformedNormals(source, output) {
const original = source.getAttribute("position");
const authored = source.getAttribute("normal");
const position = output.getAttribute("position");
const bounds = (attribute) => {
- const box = new THREE35.Box3().setFromBufferAttribute(attribute);
+ const box = new THREE36.Box3().setFromBufferAttribute(attribute);
return {
- center: box.getCenter(new THREE35.Vector3),
- size: box.getSize(new THREE35.Vector3).length() || 1
+ center: box.getCenter(new THREE36.Vector3),
+ size: box.getSize(new THREE36.Vector3).length() || 1
};
};
const before = bounds(original), after = bounds(position);
- const point = new THREE35.Vector3, normal = new THREE35.Vector3;
+ const point = new THREE36.Vector3, normal = new THREE36.Vector3;
const quantized = (attribute, index, frame) => {
point.fromBufferAttribute(attribute, index).sub(frame.center).divideScalar(frame.size);
return point.toArray().map((value) => Math.round(value * 1e7)).join(",");
@@ -20500,7 +20715,7 @@ function recomputeDeformedNormals(source, output) {
const sums = new Float64Array(classes.size * 3);
const index = output.index;
const corners = index?.count ?? position.count;
- const a = new THREE35.Vector3, b = new THREE35.Vector3, c = new THREE35.Vector3;
+ const a = new THREE36.Vector3, b = new THREE36.Vector3, c = new THREE36.Vector3;
for (let t = 0;t < corners; t += 3) {
const ia = index ? index.getX(t) : t;
const ib = index ? index.getX(t + 1) : t + 1;
@@ -20521,17 +20736,17 @@ function recomputeDeformedNormals(source, output) {
const offset = ids[i] * 3;
normal.set(sums[offset], sums[offset + 1], sums[offset + 2]).normalize().toArray(normals, i * 3);
}
- output.setAttribute("normal", new THREE35.BufferAttribute(normals, 3));
+ output.setAttribute("normal", new THREE36.BufferAttribute(normals, 3));
}
var init_deformation_normals = () => {};
// src/deform.ts
-import * as THREE36 from "three";
+import * as THREE37 from "three";
function geometryFrameMatrix(frame = {}) {
const origin = frame.origin ?? [0, 0, 0], rotation = frame.rotation ?? [0, 0, 0];
if (origin.length !== 3 || rotation.length !== 3 || ![...origin, ...rotation].every(Number.isFinite))
throw new Error("geometry frame requires finite xyz origin and rotation");
- return new THREE36.Matrix4().compose(new THREE36.Vector3(...origin), new THREE36.Quaternion().setFromEuler(new THREE36.Euler(...rotation.map(THREE36.MathUtils.degToRad), "XYZ")), new THREE36.Vector3(1, 1, 1));
+ return new THREE37.Matrix4().compose(new THREE37.Vector3(...origin), new THREE37.Quaternion().setFromEuler(new THREE37.Euler(...rotation.map(THREE37.MathUtils.degToRad), "XYZ")), new THREE37.Vector3(1, 1, 1));
}
function deform(geometry, options, map) {
const source = geometry.getAttribute("position");
@@ -20558,7 +20773,7 @@ function deform(geometry, options, map) {
throw new Error("deformation normals must be finite");
}
const matrix = geometryFrameMatrix(options.frame), inverse = matrix.clone().invert();
- const points = Array.from({ length: source.count }, (_, i) => new THREE36.Vector3().fromBufferAttribute(source, i).applyMatrix4(inverse));
+ const points = Array.from({ length: source.count }, (_, i) => new THREE37.Vector3().fromBufferAttribute(source, i).applyMatrix4(inverse));
if (points.some((p) => ![p.x, p.y, p.z].every(Number.isFinite)))
throw new Error("deformation positions must be finite");
let low = Infinity, high = -Infinity;
@@ -20581,7 +20796,7 @@ function deform(geometry, options, map) {
const point = points[i];
if (point.y < low - epsilon || point.y > high + epsilon)
continue;
- const t = length > 0 ? THREE36.MathUtils.clamp((point.y - low) / length, 0, 1) : 0;
+ const t = length > 0 ? THREE37.MathUtils.clamp((point.y - low) / length, 0, 1) : 0;
const weight = options.falloff?.(t) ?? 1;
if (!Number.isFinite(weight) || weight < 0 || weight > 1)
throw new Error("deformation falloff must return a finite weight between 0 and 1");
@@ -20615,31 +20830,31 @@ function deform(geometry, options, map) {
function twist(geometry, options) {
if (!Number.isFinite(options.angle))
throw new Error("twist angle must be finite degrees");
- return deform(geometry, options, (p, t) => p.applyAxisAngle(new THREE36.Vector3(0, 1, 0), THREE36.MathUtils.degToRad(options.angle) * t));
+ return deform(geometry, options, (p, t) => p.applyAxisAngle(new THREE37.Vector3(0, 1, 0), THREE37.MathUtils.degToRad(options.angle) * t));
}
function bend(geometry, options) {
if (!Number.isFinite(options.angle))
throw new Error("bend angle must be finite degrees");
- const angle = THREE36.MathUtils.degToRad(options.angle);
+ const angle = THREE37.MathUtils.degToRad(options.angle);
return deform(geometry, options, (p, t, low, length) => {
if (Math.abs(angle) < 0.0000000001 || length === 0)
return p;
const radius = length / angle, theta = angle * t;
- return new THREE36.Vector3(radius - (radius - p.x) * Math.cos(theta), low + (radius - p.x) * Math.sin(theta), p.z);
+ return new THREE37.Vector3(radius - (radius - p.x) * Math.cos(theta), low + (radius - p.x) * Math.sin(theta), p.z);
});
}
function taper(geometry, options) {
const start = options.startScale ?? [1, 1], end = options.endScale;
if (start.length !== 2 || end.length !== 2 || ![...start, ...end].every((n) => Number.isFinite(n) && n > 0))
throw new Error("taper scales must be two finite positive values");
- return deform(geometry, options, (p, t) => p.set(p.x * THREE36.MathUtils.lerp(start[0], end[0], t), p.y, p.z * THREE36.MathUtils.lerp(start[1], end[1], t)));
+ return deform(geometry, options, (p, t) => p.set(p.x * THREE37.MathUtils.lerp(start[0], end[0], t), p.y, p.z * THREE37.MathUtils.lerp(start[1], end[1], t)));
}
function displace(geometry, offset, options = {}) {
return deform(geometry, options, (p, t) => {
const delta = offset([p.x, p.y, p.z], t);
if (delta.length !== 3 || !delta.every(Number.isFinite))
throw new Error("displace callback must return three finite offsets");
- return p.add(new THREE36.Vector3(...delta));
+ return p.add(new THREE37.Vector3(...delta));
});
}
var init_deform = __esm(() => {
@@ -20647,7 +20862,7 @@ var init_deform = __esm(() => {
});
// src/sweep.ts
-import * as THREE37 from "three";
+import * as THREE38 from "three";
function rejectHoles(value, label) {
if ("holes" in value && value.holes !== undefined)
throw new AuthoringDiagnosticError("PROFILE_HOLES_UNSUPPORTED", `${label}: holes are unsupported. Use extrudeProfile for a holed cross-section with optional twist/taper; independently varying contours need explicit geometry or solid subtraction.`);
@@ -20655,9 +20870,9 @@ function rejectHoles(value, label) {
function profilePoints(profile) {
if (profile.length < 3 || profile.some((p) => p.length !== 2 || !p.every(Number.isFinite)))
throw new Error("profile requires at least three finite xy points");
- const points = profile.map((p) => new THREE37.Vector2(...p));
- const bounds = new THREE37.Box2().setFromPoints(points);
- const extent = bounds.getSize(new THREE37.Vector2).length();
+ const points = profile.map((p) => new THREE38.Vector2(...p));
+ const bounds = new THREE38.Box2().setFromPoints(points);
+ const extent = bounds.getSize(new THREE38.Vector2).length();
if (!(extent > 0) || !Number.isFinite(extent))
throw new Error("profile requires a finite nonzero extent");
const normalized = points.map((p) => p.clone().sub(bounds.min).divideScalar(extent));
@@ -20680,7 +20895,7 @@ function profilePoints(profile) {
throw new Error("profile self-intersects or touches itself");
}
}
- const area = THREE37.ShapeUtils.area(normalized);
+ const area = THREE38.ShapeUtils.area(normalized);
if (Math.abs(area) < 0.000000000001)
throw new Error("profile area must be nonzero");
if (area < 0)
@@ -20694,11 +20909,11 @@ function isCrease(first, second, creaseAngle) {
if (!(first.lengthSq() > 0 && second.lengthSq() > 0))
return false;
const angle = Math.atan2(first.clone().cross(second).length(), first.dot(second));
- return THREE37.MathUtils.radToDeg(angle) > creaseAngle + CREASE_TOLERANCE_DEGREES;
+ return THREE38.MathUtils.radToDeg(angle) > creaseAngle + CREASE_TOLERANCE_DEGREES;
}
function buildLoft(rings, profiles, closed, cap, firstFrameForward, creaseAngle) {
const n = rings[0].length, positions = [], uvs = [], indices = [];
- const centers = rings.map((r) => r.reduce((sum, p) => sum.add(p), new THREE37.Vector3).multiplyScalar(1 / n));
+ const centers = rings.map((r) => r.reduce((sum, p) => sum.add(p), new THREE38.Vector3).multiplyScalar(1 / n));
const lengths = [0];
for (let i = 1;i < centers.length; i++)
lengths.push(lengths[i - 1] + centers[i].distanceTo(centers[i - 1]));
@@ -20758,13 +20973,13 @@ function buildLoft(rings, profiles, closed, cap, firstFrameForward, creaseAngle)
continue;
const ring = rings[station], profile = profiles[station];
const start = positions.length / 3;
- const bounds = new THREE37.Box2().setFromPoints(profile);
- const size = bounds.getSize(new THREE37.Vector2);
+ const bounds = new THREE38.Box2().setFromPoints(profile);
+ const size = bounds.getSize(new THREE38.Vector2);
for (let j = 0;j < n; j++) {
positions.push(...ring[j].toArray());
uvs.push((profile[j].x - bounds.min.x) / (size.x || 1), (profile[j].y - bounds.min.y) / (size.y || 1));
}
- for (const tri of THREE37.ShapeUtils.triangulateShape(profile, [])) {
+ for (const tri of THREE38.ShapeUtils.triangulateShape(profile, [])) {
if (station === 0)
indices.push(...tri.map((j) => start + j));
else
@@ -20777,7 +20992,7 @@ function buildLoft(rings, profiles, closed, cap, firstFrameForward, creaseAngle)
const out = meshGeo({ positions, indices, uvs });
const normal = out.getAttribute("normal");
const share = (a, b) => {
- const sum = new THREE37.Vector3().fromBufferAttribute(normal, a).add(new THREE37.Vector3().fromBufferAttribute(normal, b)).normalize();
+ const sum = new THREE38.Vector3().fromBufferAttribute(normal, a).add(new THREE38.Vector3().fromBufferAttribute(normal, b)).normalize();
normal.setXYZ(a, sum.x, sum.y, sum.z);
normal.setXYZ(b, sum.x, sum.y, sum.z);
};
@@ -20815,8 +21030,8 @@ function loftProfiles(sections, options = {}) {
if (profiles.some((p) => p.length !== profiles[0].length))
throw new Error("loftProfiles sections must have the same point count and correspondence");
const frames = sections.map((section) => geometryFrameMatrix(section.frame));
- const rings = profiles.map((profile, i) => profile.map((p) => new THREE37.Vector3(p.x, 0, p.y).applyMatrix4(frames[i])));
- const out = buildLoft(rings, profiles, false, loftCapEnds(options.cap), new THREE37.Vector3(0, 1, 0).transformDirection(frames[0]));
+ const rings = profiles.map((profile, i) => profile.map((p) => new THREE38.Vector3(p.x, 0, p.y).applyMatrix4(frames[i])));
+ const out = buildLoft(rings, profiles, false, loftCapEnds(options.cap), new THREE38.Vector3(0, 1, 0).transformDirection(frames[0]));
const analysis = recordSweepAnalysis(out, rings, profiles, false);
out.userData.kilnGeometryWarnings = analysis.complete ? [] : [
{
@@ -20839,8 +21054,8 @@ function sweepProfile(profile, path, options = {}) {
const cap = sweepCapEnds(options.cap, closed);
if (path.length < (closed ? 3 : 2) || path.some((p) => p.length !== 3 || !p.every(Number.isFinite)))
throw new Error("sweepProfile requires finite path points (two open or three closed)");
- const stations = path.map((p) => new THREE37.Vector3(...p));
- const pathExtent = new THREE37.Box3().setFromPoints(stations).getSize(new THREE37.Vector3).length();
+ const stations = path.map((p) => new THREE38.Vector3(...p));
+ const pathExtent = new THREE38.Box3().setFromPoints(stations).getSize(new THREE38.Vector3).length();
if (!(pathExtent > 0) || !Number.isFinite(pathExtent))
throw new Error("sweepProfile path stations must be distinct with finite extent");
const pathTolerance = pathExtent * 0.0000000001;
@@ -20881,7 +21096,7 @@ function sweepProfile(profile, path, options = {}) {
});
return incoming.clone().add(outgoing).normalize();
});
- const up = options.up ? new THREE37.Vector3(...options.up) : Math.abs(tangents[0].z) < 0.9 ? new THREE37.Vector3(0, 0, 1) : new THREE37.Vector3(1, 0, 0);
+ const up = options.up ? new THREE38.Vector3(...options.up) : Math.abs(tangents[0].z) < 0.9 ? new THREE38.Vector3(0, 0, 1) : new THREE38.Vector3(1, 0, 0);
const upLength = Math.hypot(up.x, up.y, up.z);
if (!(upLength > 0) || !Number.isFinite(upLength))
throw new Error("sweepProfile up must be a finite nonzero vector");
@@ -20898,7 +21113,7 @@ function sweepProfile(profile, path, options = {}) {
}
const distances = [0];
for (let i = 1;i < stations.length; i++) {
- z = z.clone().applyQuaternion(new THREE37.Quaternion().setFromUnitVectors(tangents[i - 1], tangents[i]));
+ z = z.clone().applyQuaternion(new THREE38.Quaternion().setFromUnitVectors(tangents[i - 1], tangents[i]));
normals.push(z);
distances.push(distances[i - 1] + stations[i].distanceTo(stations[i - 1]));
}
@@ -20908,7 +21123,7 @@ function sweepProfile(profile, path, options = {}) {
correction = Math.atan2(tangents[0].dot(normals[normals.length - 1].clone().cross(normals[0])), normals[normals.length - 1].dot(normals[0]));
const rings = stations.map((station, i) => {
const tangent = tangents[i], t = distances[i] / total;
- const axisZ = normals[i].clone().applyAxisAngle(tangent, (correction + THREE37.MathUtils.degToRad(twist)) * t);
+ const axisZ = normals[i].clone().applyAxisAngle(tangent, (correction + THREE38.MathUtils.degToRad(twist)) * t);
const axisX = tangent.clone().cross(axisZ).normalize(), scale = scales[i];
return points.map((p) => station.clone().addScaledVector(axisX, p.x * scale[0]).addScaledVector(axisZ, p.y * scale[1]));
});
@@ -20933,7 +21148,7 @@ var init_sweep2 = __esm(() => {
});
// src/simplify.ts
-import * as THREE38 from "three";
+import * as THREE39 from "three";
function loadSimplifier() {
simplifierReady ??= import("meshoptimizer/simplifier").then(async ({ MeshoptSimplifier }) => {
await MeshoptSimplifier.ready;
@@ -20955,7 +21170,7 @@ function gather(attribute, vertices) {
for (let i = 0;i < vertices.length; i++)
for (let c = 0;c < attribute.itemSize; c++)
values[i * attribute.itemSize + c] = raw(attribute, vertices[i], c);
- const out = new THREE38.BufferAttribute(values, attribute.itemSize, attribute.normalized);
+ const out = new THREE39.BufferAttribute(values, attribute.itemSize, attribute.normalized);
out.name = attribute.name;
return out;
}
@@ -21240,14 +21455,14 @@ async function simplifyGeometry(geometry, options) {
indexValues[i] = remap[w];
}
const sources = Uint32Array.from(used, (w) => representative[w]);
- const out = new THREE38.BufferGeometry;
+ const out = new THREE39.BufferGeometry;
out.name = geometry.name;
const outPosition = new Float32Array(sources.length * 3);
for (let i = 0;i < used.length; i++)
outPosition.set(positions.subarray(used[i] * 3, used[i] * 3 + 3), i * 3);
for (const [name, attribute] of Object.entries(geometry.attributes)) {
if (name === "position") {
- const attr = new THREE38.BufferAttribute(outPosition, 3);
+ const attr = new THREE39.BufferAttribute(outPosition, 3);
attr.name = attribute.name;
out.setAttribute(name, attr);
} else
@@ -21256,7 +21471,7 @@ async function simplifyGeometry(geometry, options) {
for (const [name, targets] of Object.entries(geometry.morphAttributes))
out.morphAttributes[name] = targets.map((target) => gather(target, sources));
out.morphTargetsRelative = geometry.morphTargetsRelative;
- out.setIndex(new THREE38.BufferAttribute(indexValues, 1));
+ out.setIndex(new THREE39.BufferAttribute(indexValues, 1));
for (const group of outGroups)
out.addGroup(group.start, group.count, group.materialIndex);
out.computeBoundingBox();
@@ -21311,7 +21526,7 @@ var init_simplify = __esm(() => {
});
// src/solids.ts
-import * as THREE39 from "three";
+import * as THREE40 from "three";
async function getManifoldModule() {
if (_module)
return _module;
@@ -21341,10 +21556,10 @@ function computationFrame(parts) {
meshes.push(mesh);
});
}
- const origin = meshes.length ? new THREE39.Vector3().setFromMatrixPosition(meshes[0].matrixWorld) : new THREE39.Vector3;
+ const origin = meshes.length ? new THREE40.Vector3().setFromMatrixPosition(meshes[0].matrixWorld) : new THREE40.Vector3;
const matrices = new Map;
- const bounds = new THREE39.Box3;
- const point = new THREE39.Vector3;
+ const bounds = new THREE40.Box3;
+ const point = new THREE40.Vector3;
for (const mesh of meshes) {
const matrix = mesh.matrixWorld.clone();
matrix.elements[12] -= origin.x;
@@ -21361,11 +21576,11 @@ function computationFrame(parts) {
bounds.expandByPoint(point);
}
}
- const size = bounds.getSize(new THREE39.Vector3);
+ const size = bounds.getSize(new THREE40.Vector3);
const scale = Math.hypot(size.x, size.y, size.z);
if (!Number.isFinite(scale))
throw new Error("CSG: combined operand extent must be finite");
- return { origin, center: bounds.getCenter(new THREE39.Vector3), scale: scale || 1, matrices };
+ return { origin, center: bounds.getCenter(new THREE40.Vector3), scale: scale || 1, matrices };
}
function retainNotes(target, notes) {
if (!Array.isArray(notes))
@@ -21445,7 +21660,7 @@ function threeToManifold(src, mod, label, context) {
else
context.missingUV.add(mesh.name || label);
}
- const point = new THREE39.Vector3;
+ const point = new THREE40.Vector3;
for (let i = 0;i < position.count; i++) {
point.fromBufferAttribute(position, i).applyMatrix4(context.frame.matrices.get(mesh)).sub(context.frame.center).divideScalar(context.frame.scale);
if (![point.x, point.y, point.z].every((n) => Number.isFinite(Math.fround(n))))
@@ -21588,11 +21803,11 @@ function solidMeshToGeometry({ mesh, collapsed }, opts = {}) {
if (uvs)
uvs.set(mesh.vertProperties.subarray(i + 3, i + 5), v * 2);
}
- const geometry = new THREE39.BufferGeometry;
- geometry.setAttribute("position", new THREE39.BufferAttribute(positions, 3));
- geometry.setIndex(new THREE39.BufferAttribute(new Uint32Array(mesh.triVerts), 1));
+ const geometry = new THREE40.BufferGeometry;
+ geometry.setAttribute("position", new THREE40.BufferAttribute(positions, 3));
+ geometry.setIndex(new THREE40.BufferAttribute(new Uint32Array(mesh.triVerts), 1));
if (uvs)
- geometry.setAttribute("uv", new THREE39.BufferAttribute(uvs, 2));
+ geometry.setAttribute("uv", new THREE40.BufferAttribute(uvs, 2));
const out = opts.smooth ? geometry : geometry.toNonIndexed();
out.computeVertexNormals();
if (opts.smooth && uvs) {
@@ -21623,7 +21838,7 @@ function firstMaterial(src) {
if (!material && mesh.isMesh)
material = Array.isArray(mesh.material) ? mesh.material[0] : mesh.material;
});
- return material ?? new THREE39.MeshStandardMaterial;
+ return material ?? new THREE40.MeshStandardMaterial;
}
function outputMesh(result, name, parts, opts, context, isHull) {
const materialized = materializeSolid(result);
@@ -21682,7 +21897,7 @@ function outputMesh(result, name, parts, opts, context, isHull) {
retainNotes(context.geometryWarnings, geometry.userData.kilnGeometryWarnings);
if (context.geometryWarnings.size)
geometry.userData.kilnGeometryWarnings = [...context.geometryWarnings.values()];
- const output = new THREE39.Mesh(geometry, context.preserve && !isHull && materials.length ? materials : firstMaterial(parts[0]));
+ const output = new THREE40.Mesh(geometry, context.preserve && !isHull && materials.length ? materials : firstMaterial(parts[0]));
output.name = `Mesh_${name}`;
output.position.copy(context.frame.origin);
return output;
@@ -22091,7 +22306,7 @@ function smoothUnionSpheres(point, spheres, blend) {
}
// src/organic.ts
-import * as THREE40 from "three";
+import * as THREE41 from "three";
function assertSafePathCount(name, count) {
if (!Number.isSafeInteger(count))
throw new Error(`${name} derived sample count must be a safe integer; reduce sample counts.`);
@@ -22123,8 +22338,8 @@ function catmullRomPath(controlPoints, samplesPerSpan = 8, closed = false) {
assertSafePathCount("catmullRomPath", spans * samplesPerSpan + 1);
if (controlPoints.some((p) => p.length !== 3 || !p.every(Number.isFinite)))
throw new Error("catmullRomPath control points must be finite [x,y,z] triples");
- const vectors = controlPoints.map((p) => new THREE40.Vector3(p[0], p[1], p[2]));
- const curve = new THREE40.CatmullRomCurve3(vectors, closed);
+ const vectors = controlPoints.map((p) => new THREE41.Vector3(p[0], p[1], p[2]));
+ const curve = new THREE41.CatmullRomCurve3(vectors, closed);
const points = curve.getPoints(spans * samplesPerSpan);
if (closed)
points.pop();
@@ -22178,8 +22393,8 @@ function spiralPath(options) {
throw new Error("spiralPath center must be a finite [x,y,z] triple");
if (axis.length !== 3 || forward.length !== 3 || ![...axis, ...forward].every(Number.isFinite))
throw new Error("spiralPath axis and forward must be finite [x,y,z] triples");
- const up = new THREE40.Vector3(...axis);
- const fwd = new THREE40.Vector3(...forward);
+ const up = new THREE41.Vector3(...axis);
+ const fwd = new THREE41.Vector3(...forward);
if (up.lengthSq() < 0.000000000001 || fwd.lengthSq() < 0.000000000001)
throw new Error("spiralPath axis and forward must be nonzero");
up.normalize();
@@ -22187,7 +22402,7 @@ function spiralPath(options) {
if (horiz.lengthSq() < 0.000000000001)
throw new Error("spiralPath forward must not be parallel to axis");
horiz.normalize();
- const right = new THREE40.Vector3().crossVectors(up, horiz).normalize();
+ const right = new THREE41.Vector3().crossVectors(up, horiz).normalize();
const out = [];
for (let i = 0;i <= samples; i++) {
const u = i / samples;
@@ -22522,7 +22737,7 @@ var init_procedural_texture_v3 = __esm(() => {
});
// src/procedural-texture.ts
-import * as THREE41 from "three";
+import * as THREE42 from "three";
function proceduralTextureSchemaVersion(input) {
if (!input || typeof input !== "object" || Array.isArray(input))
throw new ProceduralTextureError("proceduralTexture requires a plain JSON object.", "PROCEDURAL_TEXTURE_V3_CONTRACT");
@@ -22543,14 +22758,14 @@ function proceduralTexture(spec) {
if (proceduralTextureSchemaVersion(spec) === 3) {
const compiled = compileProceduralTextureSpecV3(spec);
const { width, height, usage, name } = compiled.spec;
- const tex = new THREE41.DataTexture(compiled.pixels, width, height, THREE41.RGBAFormat, THREE41.UnsignedByteType);
+ const tex = new THREE42.DataTexture(compiled.pixels, width, height, THREE42.RGBAFormat, THREE42.UnsignedByteType);
if (name)
tex.name = name;
- tex.colorSpace = usage === "albedo" || usage === "emissive" ? THREE41.SRGBColorSpace : THREE41.NoColorSpace;
- tex.wrapS = THREE41.RepeatWrapping;
- tex.wrapT = THREE41.RepeatWrapping;
- tex.minFilter = THREE41.LinearMipmapLinearFilter;
- tex.magFilter = THREE41.LinearFilter;
+ tex.colorSpace = usage === "albedo" || usage === "emissive" ? THREE42.SRGBColorSpace : THREE42.NoColorSpace;
+ tex.wrapS = THREE42.RepeatWrapping;
+ tex.wrapT = THREE42.RepeatWrapping;
+ tex.minFilter = THREE42.LinearMipmapLinearFilter;
+ tex.magFilter = THREE42.LinearFilter;
tex.generateMipmaps = true;
tex.needsUpdate = true;
tex.userData["kilnProcedural"] = {
@@ -22563,14 +22778,14 @@ function proceduralTexture(spec) {
}
const compiled = compileProceduralTextureSpecV2(spec);
const { size, usage, name, layers } = compiled.spec;
- const tex = new THREE41.DataTexture(compiled.pixels, size, size, THREE41.RGBAFormat, THREE41.UnsignedByteType);
+ const tex = new THREE42.DataTexture(compiled.pixels, size, size, THREE42.RGBAFormat, THREE42.UnsignedByteType);
if (name)
tex.name = name;
- tex.colorSpace = usage === "albedo" || usage === "emissive" ? THREE41.SRGBColorSpace : THREE41.NoColorSpace;
- tex.wrapS = THREE41.RepeatWrapping;
- tex.wrapT = THREE41.RepeatWrapping;
- tex.minFilter = THREE41.LinearMipmapLinearFilter;
- tex.magFilter = THREE41.LinearFilter;
+ tex.colorSpace = usage === "albedo" || usage === "emissive" ? THREE42.SRGBColorSpace : THREE42.NoColorSpace;
+ tex.wrapS = THREE42.RepeatWrapping;
+ tex.wrapT = THREE42.RepeatWrapping;
+ tex.minFilter = THREE42.LinearMipmapLinearFilter;
+ tex.magFilter = THREE42.LinearFilter;
tex.generateMipmaps = true;
tex.needsUpdate = true;
tex.userData["kilnProcedural"] = {
@@ -22624,13 +22839,13 @@ function normalMapFromHeight(source, opts = {}) {
out[o + 3] = 255;
}
}
- const tex = new THREE41.DataTexture(out, width, height, THREE41.RGBAFormat, THREE41.UnsignedByteType);
+ const tex = new THREE42.DataTexture(out, width, height, THREE42.RGBAFormat, THREE42.UnsignedByteType);
tex.name = opts.name ?? (source.name ? `${source.name}_Normal` : "");
- tex.colorSpace = THREE41.NoColorSpace;
- tex.wrapS = THREE41.RepeatWrapping;
- tex.wrapT = THREE41.RepeatWrapping;
- tex.minFilter = THREE41.LinearMipmapLinearFilter;
- tex.magFilter = THREE41.LinearFilter;
+ tex.colorSpace = THREE42.NoColorSpace;
+ tex.wrapS = THREE42.RepeatWrapping;
+ tex.wrapT = THREE42.RepeatWrapping;
+ tex.minFilter = THREE42.LinearMipmapLinearFilter;
+ tex.magFilter = THREE42.LinearFilter;
tex.generateMipmaps = true;
tex.needsUpdate = true;
return tex;
@@ -22728,7 +22943,7 @@ var init_seeded_random = __esm(() => {
});
// src/textures.ts
-import * as THREE42 from "three";
+import * as THREE43 from "three";
async function loadTexture(source, opts = {}) {
let bytes;
if (typeof source === "string") {
@@ -22749,7 +22964,7 @@ async function loadTexture(source, opts = {}) {
if (!meta.width || !meta.height) {
throw new Error("loadTexture: could not read image dimensions");
}
- const tex = new THREE42.DataTexture(new Uint8Array(data), meta.width, meta.height, THREE42.RGBAFormat, THREE42.UnsignedByteType);
+ const tex = new THREE43.DataTexture(new Uint8Array(data), meta.width, meta.height, THREE43.RGBAFormat, THREE43.UnsignedByteType);
const usage = opts.usage ?? "albedo";
const colorSpace = usage === "albedo" || usage === "emissive" ? "srgb" : "linear";
let hasAlpha = false;
@@ -22759,14 +22974,14 @@ async function loadTexture(source, opts = {}) {
break;
}
}
- tex.colorSpace = colorSpace === "srgb" ? THREE42.SRGBColorSpace : THREE42.NoColorSpace;
+ tex.colorSpace = colorSpace === "srgb" ? THREE43.SRGBColorSpace : THREE43.NoColorSpace;
if (opts.name)
tex.name = opts.name;
tex.needsUpdate = true;
- tex.wrapS = THREE42.RepeatWrapping;
- tex.wrapT = THREE42.RepeatWrapping;
- tex.minFilter = THREE42.LinearMipmapLinearFilter;
- tex.magFilter = THREE42.LinearFilter;
+ tex.wrapS = THREE43.RepeatWrapping;
+ tex.wrapT = THREE43.RepeatWrapping;
+ tex.minFilter = THREE43.LinearMipmapLinearFilter;
+ tex.magFilter = THREE43.LinearFilter;
tex.generateMipmaps = true;
tex.userData["encoded"] = {
mime,
@@ -22801,17 +23016,17 @@ function requireTextureUsage(texture, usage) {
if (meta && meta.usage !== usage) {
throw new TypeError(`Texture ${JSON.stringify(texture.name || "(unnamed)")} was loaded for ${meta.usage}, not ${usage}.`);
}
- texture.colorSpace = usage === "albedo" || usage === "emissive" ? THREE42.SRGBColorSpace : THREE42.NoColorSpace;
+ texture.colorSpace = usage === "albedo" || usage === "emissive" ? THREE43.SRGBColorSpace : THREE43.NoColorSpace;
}
function pbrMaterial(opts = {}) {
- const mat = new THREE42.MeshStandardMaterial;
+ const mat = new THREE43.MeshStandardMaterial;
const isTex = (v) => !!v?.isTexture;
if (isTex(opts.albedo)) {
requireTextureUsage(opts.albedo, "albedo");
mat.map = opts.albedo;
- mat.color = new THREE42.Color(16777215);
+ mat.color = new THREE43.Color(16777215);
} else if (opts.albedo !== undefined) {
- mat.color = new THREE42.Color(opts.albedo);
+ mat.color = new THREE43.Color(opts.albedo);
}
if (opts.normal) {
requireTextureUsage(opts.normal, "normal");
@@ -22849,9 +23064,9 @@ function pbrMaterial(opts = {}) {
if (isTex(opts.emissive)) {
requireTextureUsage(opts.emissive, "emissive");
mat.emissiveMap = opts.emissive;
- mat.emissive = new THREE42.Color(16777215);
+ mat.emissive = new THREE43.Color(16777215);
} else if (opts.emissive !== undefined) {
- mat.emissive = new THREE42.Color(opts.emissive);
+ mat.emissive = new THREE43.Color(opts.emissive);
}
if (opts.emissiveIntensity !== undefined) {
mat.emissiveIntensity = opts.emissiveIntensity;
@@ -22883,7 +23098,7 @@ function pbrMaterial(opts = {}) {
mat.transparent = true;
}
if (opts.doubleSided)
- mat.side = THREE42.DoubleSide;
+ mat.side = THREE43.DoubleSide;
mat.userData["kilnMaterial"] = {
alphaMode,
...alphaMode === "mask" ? { alphaCutoff: mat.alphaTest } : {},
@@ -23178,7 +23393,7 @@ var init_texture_atlas_pixels = __esm(() => {
});
// src/uv-shapes.ts
-import * as THREE43 from "three";
+import * as THREE44 from "three";
function remapUV(geo, options = {}) {
if (!options || typeof options !== "object" || Array.isArray(options) || Object.keys(options).some((key) => !["scale", "offset"].includes(key))) {
throw new Error("remapUV: options may contain only scale and offset.");
@@ -23207,7 +23422,7 @@ function remapUV(geo, options = {}) {
}
const cloned = geo.clone();
cloned.userData = structuredClone(geo.userData);
- cloned.setAttribute("uv", new THREE43.Float32BufferAttribute(values, 2));
+ cloned.setAttribute("uv", new THREE44.Float32BufferAttribute(values, 2));
if ((scale[0] !== 1 || scale[1] !== 1) && cloned.hasAttribute("tangent")) {
cloned.deleteAttribute("tangent");
const previous = cloned.userData.kilnAttributeWarnings;
@@ -23224,13 +23439,13 @@ function remapUV(geo, options = {}) {
var init_uv_shapes = () => {};
// src/texture-atlas.ts
-import * as THREE44 from "three";
+import * as THREE45 from "three";
async function textureAtlas(input, options = {}) {
const compiled = await compileTextureAtlasSpecV1(input, options);
- const texture = new THREE44.DataTexture(compiled.pixels, compiled.spec.width, compiled.spec.height, THREE44.RGBAFormat, THREE44.UnsignedByteType);
+ const texture = new THREE45.DataTexture(compiled.pixels, compiled.spec.width, compiled.spec.height, THREE45.RGBAFormat, THREE45.UnsignedByteType);
texture.name = "Atlas";
texture.flipY = false;
- texture.colorSpace = compiled.spec.usage === "albedo" || compiled.spec.usage === "emissive" ? THREE44.SRGBColorSpace : THREE44.NoColorSpace;
+ texture.colorSpace = compiled.spec.usage === "albedo" || compiled.spec.usage === "emissive" ? THREE45.SRGBColorSpace : THREE45.NoColorSpace;
applyPortableSamplerV1(texture, compiled.spec.sampler);
texture.userData.kilnAtlas = { spec: compiled.spec, manifest: compiled.manifest };
texture.userData.kilnTexture = {
@@ -23288,7 +23503,7 @@ function remapUVToAtlas(geometry, atlas, name, options) {
bytes += buffer.byteLength;
}
} else {
- bytes += attribute.array.byteLength * (attribute.constructor === THREE44.BufferAttribute || attribute.constructor === THREE44.InstancedBufferAttribute ? 1 : 2);
+ bytes += attribute.array.byteLength * (attribute.constructor === THREE45.BufferAttribute || attribute.constructor === THREE45.InstancedBufferAttribute ? 1 : 2);
}
};
for (const attr of Object.values(geometry.attributes))
@@ -25445,7 +25660,7 @@ var init_material_resources = __esm(() => {
});
// src/material-recipe-runtime.ts
-import * as THREE45 from "three";
+import * as THREE46 from "three";
async function applyMaterialRecipeV1(request, options = {}) {
const resolved = resolveMaterialRecipeV1(request);
const cache = options.cache ?? DEFAULT_APPROVED_TEXTURE_CACHE;
@@ -25468,9 +25683,9 @@ async function applyMaterialRecipeV1(request, options = {}) {
};
const material = pbrMaterial(materialOptions);
material.name = options.name ?? request.id;
- material.color.setRGB(resolved.baseColorFactor[0], resolved.baseColorFactor[1], resolved.baseColorFactor[2], THREE45.LinearSRGBColorSpace);
+ material.color.setRGB(resolved.baseColorFactor[0], resolved.baseColorFactor[1], resolved.baseColorFactor[2], THREE46.LinearSRGBColorSpace);
material.opacity = resolved.baseColorFactor[3];
- material.emissive.setRGB(resolved.emissiveFactor[0], resolved.emissiveFactor[1], resolved.emissiveFactor[2], THREE45.LinearSRGBColorSpace);
+ material.emissive.setRGB(resolved.emissiveFactor[0], resolved.emissiveFactor[1], resolved.emissiveFactor[2], THREE46.LinearSRGBColorSpace);
const resources = [...loaded.values()].map((entry) => entry.provenance).sort((a, b) => `${a.resourceId}:${a.usage}`.localeCompare(`${b.resourceId}:${b.usage}`));
const provenance = {
schemaVersion: 1,
@@ -25906,7 +26121,7 @@ var init_portable_material_runtime = __esm(() => {
});
// src/uv-data.ts
-import * as THREE46 from "three";
+import * as THREE47 from "three";
function validateAtlasRemap(mesh, inputIndex, sourceCount) {
const count = mesh.vertexCount;
if (!Number.isSafeInteger(count) || count < 1 || count > GEOMETRY_ALLOCATION_LIMITS.unwrapVertices)
@@ -25941,7 +26156,7 @@ function remapUnwrapAttribute(attribute, oldIndexes) {
for (let c = 0;c < attribute.itemSize; c++)
array[i * attribute.itemSize + c] = attribute.array[oldIndexes[i] * stride + offset + c];
}
- const output = attribute.isFloat16BufferAttribute ? new THREE46.Float16BufferAttribute(array, attribute.itemSize, attribute.normalized) : new THREE46.BufferAttribute(array, attribute.itemSize, attribute.normalized);
+ const output = attribute.isFloat16BufferAttribute ? new THREE47.Float16BufferAttribute(array, attribute.itemSize, attribute.normalized) : new THREE47.BufferAttribute(array, attribute.itemSize, attribute.normalized);
output.name = attribute.name;
output.setUsage(interleaved(attribute) ? attribute.data.usage : attribute.usage);
if (!interleaved(attribute))
@@ -26053,7 +26268,7 @@ var init_uv_data = __esm(() => {
});
// src/uv.ts
-import * as THREE47 from "three";
+import * as THREE48 from "three";
async function getXatlas() {
if (!_xatlasReady) {
_xatlasReady = (async () => {
@@ -26085,7 +26300,7 @@ async function autoUnwrap(geometry, opts = {}) {
if (result.atlasCount !== 1 || !Number.isSafeInteger(result.width) || result.width <= 0 || !Number.isSafeInteger(result.height) || result.height <= 0)
throw new Error("autoUnwrap: xatlas must return one valid atlas; multiple atlas pages are unsupported.");
const remap = validateAtlasRemap(mesh, prepared.index, geometry.getAttribute("position").count);
- const out = new THREE47.BufferGeometry;
+ const out = new THREE48.BufferGeometry;
for (const [name, attribute] of Object.entries(geometry.attributes)) {
if (name === "uv" || name === "tangent" || name === "normal" && !prepared.useNormals)
continue;
@@ -26095,8 +26310,8 @@ async function autoUnwrap(geometry, opts = {}) {
out.morphAttributes[name] = targets.map((attribute) => remapUnwrapAttribute(attribute, remap.oldIndexes));
}
out.morphTargetsRelative = geometry.morphTargetsRelative;
- out.setIndex(new THREE47.BufferAttribute(new Uint32Array(remap.index), 1));
- out.setAttribute("uv", new THREE47.BufferAttribute(new Float32Array(remap.uv), 2));
+ out.setIndex(new THREE48.BufferAttribute(new Uint32Array(remap.index), 1));
+ out.setAttribute("uv", new THREE48.BufferAttribute(new Float32Array(remap.uv), 2));
out.name = geometry.name;
out.groups = geometry.groups.map((group) => ({ ...group }));
out.setDrawRange(geometry.drawRange.start, geometry.drawRange.count);
@@ -26131,11 +26346,11 @@ function repairZeroNormals(geo) {
if (broken.size === 0)
return;
const acc = new Float32Array(normal.count * 3);
- const a = new THREE47.Vector3;
- const b = new THREE47.Vector3;
- const c = new THREE47.Vector3;
- const face = new THREE47.Vector3;
- const edge = new THREE47.Vector3;
+ const a = new THREE48.Vector3;
+ const b = new THREE48.Vector3;
+ const c = new THREE48.Vector3;
+ const face = new THREE48.Vector3;
+ const edge = new THREE48.Vector3;
for (let t = 0;t + 2 < index.count; t += 3) {
const tri = [index.getX(t), index.getX(t + 1), index.getX(t + 2)];
if (!tri.some((i) => broken.has(i)))
@@ -26171,7 +26386,7 @@ var init_uv = __esm(() => {
});
// src/uv-project.ts
-import * as THREE48 from "three";
+import * as THREE49 from "three";
function projectUV(geometry, options) {
if (!options || typeof options !== "object" || Array.isArray(options) || !["planar", "box", "cylindrical"].includes(options.projection) || Object.keys(options).some((key) => !["projection", "frame", "seamDegrees", "angularRange", "caps", "metersPerUnit"].includes(key)))
throw new Error("projectUV: select an explicit planar, box or cylindrical projection with documented options.");
@@ -26212,15 +26427,15 @@ function projectUV(geometry, options) {
throw new Error("projectUV: index contains an invalid vertex reference.");
}
const points = [];
- const bounds = new THREE48.Box3;
+ const bounds = new THREE49.Box3;
for (let i = 0;i < positions.count; i++) {
- const point = new THREE48.Vector3().fromBufferAttribute(positions, i).applyMatrix4(inverse);
+ const point = new THREE49.Vector3().fromBufferAttribute(positions, i).applyMatrix4(inverse);
if (![point.x, point.y, point.z].every(Number.isFinite))
throw new Error("projectUV: frame-local positions must be finite.");
points.push(point);
bounds.expandByPoint(point);
}
- const extent = bounds.getSize(new THREE48.Vector3);
+ const extent = bounds.getSize(new THREE49.Vector3);
const fit = (point, axis) => metric !== undefined ? point[axis] / metric : extent[axis] > 0 ? (point[axis] - bounds.min[axis]) / extent[axis] : 0.5;
const flip = (point, axis) => metric !== undefined ? -point[axis] / metric : 1 - fit(point, axis);
const outputUVs = new Float32Array(corners * 2);
@@ -26235,8 +26450,8 @@ function projectUV(geometry, options) {
if (metric !== undefined) {
uScale = fullWrap ? Math.max(1, Math.round(2 * Math.PI * radius / metric)) : sweep * radius / metric;
}
- const normal = new THREE48.Vector3;
- const edge = new THREE48.Vector3;
+ const normal = new THREE49.Vector3;
+ const edge = new THREE49.Vector3;
for (let i = 0;i < corners; i += 3) {
const triangle = [0, 1, 2].map((offset) => points[index ? index.getX(i + offset) : i + offset]);
normal.subVectors(triangle[1], triangle[0]).cross(edge.subVectors(triangle[2], triangle[0])).normalize();
@@ -26292,7 +26507,7 @@ function projectUV(geometry, options) {
const out = geometry.index ? geometry.toNonIndexed() : geometry.clone();
out.userData = structuredClone(geometry.userData);
out.setDrawRange(geometry.drawRange.start, geometry.drawRange.count);
- out.setAttribute("uv", new THREE48.Float32BufferAttribute(outputUVs, 2));
+ out.setAttribute("uv", new THREE49.Float32BufferAttribute(outputUVs, 2));
if (out.hasAttribute("tangent")) {
out.deleteAttribute("tangent");
const previous = out.userData.kilnAttributeWarnings;
@@ -26313,17 +26528,17 @@ var init_uv_project = __esm(() => {
});
// src/primitives.ts
-import * as THREE49 from "three";
+import * as THREE50 from "three";
function vectorToTuple(v) {
return [v.x, v.y, v.z];
}
function createRoot(name) {
- const root = new THREE49.Object3D;
+ const root = new THREE50.Object3D;
root.name = name;
return root;
}
function createPivot(name, position = [0, 0, 0], parent) {
- const pivot = new THREE49.Object3D;
+ const pivot = new THREE50.Object3D;
pivot.name = `Joint_${name}`;
pivot.position.set(...position);
if (parent)
@@ -26355,16 +26570,16 @@ function assertPartArgs(name, geometry2, material) {
}
function createPart(name, geometry2, material, options = {}) {
assertPartArgs(name, geometry2, material);
- const mesh = new THREE49.Mesh(geometry2, material);
+ const mesh = new THREE50.Mesh(geometry2, material);
mesh.name = `Mesh_${name}`;
if (options.position)
mesh.position.set(...options.position);
if (options.rotation)
- mesh.rotation.set(THREE49.MathUtils.degToRad(options.rotation[0]), THREE49.MathUtils.degToRad(options.rotation[1]), THREE49.MathUtils.degToRad(options.rotation[2]));
+ mesh.rotation.set(THREE50.MathUtils.degToRad(options.rotation[0]), THREE50.MathUtils.degToRad(options.rotation[1]), THREE50.MathUtils.degToRad(options.rotation[2]));
if (options.scale)
mesh.scale.set(...options.scale);
if (options.pivot) {
- const pivot = new THREE49.Object3D;
+ const pivot = new THREE50.Object3D;
pivot.name = `Joint_${name}`;
pivot.add(mesh);
mesh.position.set(0, 0, 0);
@@ -26387,7 +26602,7 @@ function capsuleGeo(radius, height, segments = 6) {
assertDimension("capsuleGeo height (straight middle length)", height, true);
assertDimension("capsuleGeo outer half-length", height / 2 + radius);
assertPrimitiveSegments("capsuleGeo segments", segments, 3);
- return new THREE49.CapsuleGeometry(radius, height, 2, segments);
+ return new THREE50.CapsuleGeometry(radius, height, 2, segments);
}
function capsuleXGeo(radius, length, segments = 6) {
const geo = capsuleGeo(radius, length, segments);
@@ -26406,7 +26621,7 @@ function cylinderGeo(radiusTop, radiusBottom, height, segments = 8) {
throw new RangeError("cylinderGeo requires at least one positive radius.");
assertDimension("cylinderGeo height", height);
assertPrimitiveSegments("cylinderGeo segments", segments, 3);
- return new THREE49.CylinderGeometry(radiusTop, radiusBottom, height, segments);
+ return new THREE50.CylinderGeometry(radiusTop, radiusBottom, height, segments);
}
function cylinderXGeo(radiusTop, radiusBottom, length, segments = 8) {
const geo = cylinderGeo(radiusTop, radiusBottom, length, segments);
@@ -26421,20 +26636,20 @@ function cylinderZGeo(radiusTop, radiusBottom, length, segments = 8) {
function boxGeo(width, height, depth) {
for (const [name, value] of Object.entries({ width, height, depth }))
assertDimension(`boxGeo ${name} (use planeGeo for a sheet)`, value);
- return new THREE49.BoxGeometry(width, height, depth);
+ return new THREE50.BoxGeometry(width, height, depth);
}
function sphereGeo(radius, widthSegments = 8, heightSegments = 6) {
assertDimension("sphereGeo radius", radius);
assertPrimitiveSegments("sphereGeo widthSegments", widthSegments, 3);
assertPrimitiveSegments("sphereGeo heightSegments", heightSegments, 2);
assertPrimitiveGrid("sphereGeo", widthSegments, heightSegments);
- return new THREE49.SphereGeometry(radius, widthSegments, heightSegments);
+ return new THREE50.SphereGeometry(radius, widthSegments, heightSegments);
}
function coneGeo(radius, height, segments = 8) {
assertDimension("coneGeo radius", radius);
assertDimension("coneGeo height", height);
assertPrimitiveSegments("coneGeo segments", segments, 3);
- return new THREE49.ConeGeometry(radius, height, segments);
+ return new THREE50.ConeGeometry(radius, height, segments);
}
function coneXGeo(radius, length, segments = 8) {
const geo = coneGeo(radius, length, segments);
@@ -26451,7 +26666,7 @@ function cylinderOnAxis(center, normal, radiusBottom, height, options = {}) {
const segments = options.segments ?? 8;
assertFiniteTriple("cylinderOnAxis center", center);
assertFiniteTriple("cylinderOnAxis normal", normal);
- const n = new THREE49.Vector3(normal[0], normal[1], normal[2]);
+ const n = new THREE50.Vector3(normal[0], normal[1], normal[2]);
const len = Math.hypot(...normal);
if (len < 0.000001) {
throw new Error(`cylinderOnAxis: normal must be a non-zero vector (got [${normal.join(",")}]).`);
@@ -26459,7 +26674,7 @@ function cylinderOnAxis(center, normal, radiusBottom, height, options = {}) {
const magnitude = Math.max(...normal.map(Math.abs));
n.set(normal[0] / magnitude, normal[1] / magnitude, normal[2] / magnitude).normalize();
const geo = cylinderGeo(radiusTop, radiusBottom, height, segments);
- const q = new THREE49.Quaternion().setFromUnitVectors(new THREE49.Vector3(0, 1, 0), n);
+ const q = new THREE50.Quaternion().setFromUnitVectors(new THREE50.Vector3(0, 1, 0), n);
geo.applyQuaternion(q);
geo.translate(center[0], center[1], center[2]);
return geo;
@@ -26481,7 +26696,7 @@ function torusGeo(radius, tube, radialSegments = 8, tubularSegments = 12) {
assertPrimitiveSegments("torusGeo radialSegments", radialSegments, 3);
assertPrimitiveSegments("torusGeo tubularSegments", tubularSegments, 3);
assertPrimitiveGrid("torusGeo", radialSegments, tubularSegments);
- return new THREE49.TorusGeometry(radius, tube, radialSegments, tubularSegments);
+ return new THREE50.TorusGeometry(radius, tube, radialSegments, tubularSegments);
}
function planeGeo(width, height, widthSegments = 1, heightSegments = 1) {
assertDimension("planeGeo width", width);
@@ -26489,14 +26704,14 @@ function planeGeo(width, height, widthSegments = 1, heightSegments = 1) {
assertPrimitiveSegments("planeGeo widthSegments", widthSegments, 1);
assertPrimitiveSegments("planeGeo heightSegments", heightSegments, 1);
assertPrimitiveGrid("planeGeo", widthSegments, heightSegments);
- return new THREE49.PlaneGeometry(width, height, widthSegments, heightSegments);
+ return new THREE50.PlaneGeometry(width, height, widthSegments, heightSegments);
}
function decalBox(width, height, depth = 0.01) {
assertDimension("decalBox width", width);
assertDimension("decalBox height", height);
assertDimension("decalBox depth", depth, true);
const d = Math.max(depth, 0.002);
- return new THREE49.BoxGeometry(width, height, d);
+ return new THREE50.BoxGeometry(width, height, d);
}
function validateCardFrame(name, width, height, yPivot) {
assertDimension(`${name} width`, width);
@@ -26510,7 +26725,7 @@ function foliageCardGeo(opts = {}) {
const h = opts.height ?? 1;
const yPivot = opts.yPivot ?? 0;
validateCardFrame("foliageCardGeo", w, h, yPivot);
- const geom = new THREE49.PlaneGeometry(w, h);
+ const geom = new THREE50.PlaneGeometry(w, h);
geom.translate(0, h * (0.5 - yPivot), 0);
geom.userData["kilnGeometryRole"] = "foliageCard";
return geom;
@@ -26526,12 +26741,12 @@ function crossedQuadsGeo(opts = {}) {
const geometries = [];
for (let i = 0;i < planes; i++) {
const angle = i / planes * Math.PI;
- const quad = new THREE49.PlaneGeometry(w, h);
+ const quad = new THREE50.PlaneGeometry(w, h);
quad.translate(0, h * (0.5 - yPivot), 0);
quad.rotateY(angle);
geometries.push(quad);
}
- const out = new THREE49.BufferGeometry;
+ const out = new THREE50.BufferGeometry;
const posCount = geometries.reduce((sum, g) => sum + (g.attributes.position?.count ?? 0), 0);
const positions = new Float32Array(posCount * 3);
const normals = new Float32Array(posCount * 3);
@@ -26558,9 +26773,9 @@ function crossedQuadsGeo(opts = {}) {
}
vOffset += p.count;
}
- out.setAttribute("position", new THREE49.BufferAttribute(positions, 3));
- out.setAttribute("normal", new THREE49.BufferAttribute(normals, 3));
- out.setAttribute("uv", new THREE49.BufferAttribute(uvs, 2));
+ out.setAttribute("position", new THREE50.BufferAttribute(positions, 3));
+ out.setAttribute("normal", new THREE50.BufferAttribute(normals, 3));
+ out.setAttribute("uv", new THREE50.BufferAttribute(uvs, 2));
out.setIndex(indices);
out.userData["kilnGeometryRole"] = "foliageCard";
return out;
@@ -26575,7 +26790,7 @@ function octaGridPlane(opts) {
const h = opts.height ?? 1;
const yPivot = opts.yPivot ?? 0;
validateCardFrame("octaGridPlane", w, h, yPivot);
- const geom = new THREE49.PlaneGeometry(w, h);
+ const geom = new THREE50.PlaneGeometry(w, h);
geom.translate(0, h * (0.5 - yPivot), 0);
const uv = geom.attributes.uv;
const du = 1 / opts.tilesX;
@@ -26671,8 +26886,8 @@ function wingGeo(options = {}) {
7,
6
];
- const geo = new THREE49.BufferGeometry;
- geo.setAttribute("position", new THREE49.BufferAttribute(vertices, 3));
+ const geo = new THREE50.BufferGeometry;
+ geo.setAttribute("position", new THREE50.BufferAttribute(vertices, 3));
geo.setIndex(tipChord === 0 ? [0, 1, 3, 4, 7, 5, 0, 2, 6, 0, 6, 4, 1, 5, 7, 1, 7, 3, 0, 4, 5, 0, 5, 1] : indices);
geo.computeVertexNormals();
return geo;
@@ -26703,17 +26918,17 @@ function createWingPair(name, material, options) {
};
}
function beamBetween(name, start, end, radius, material, options = {}) {
- const a = new THREE49.Vector3(...start);
- const b = new THREE49.Vector3(...end);
+ const a = new THREE50.Vector3(...start);
+ const b = new THREE50.Vector3(...end);
const direction = b.clone().sub(a);
const length = direction.length();
if (length <= 0.0001) {
throw new Error(`beamBetween("${name}"): start and end must be different points (got start=[${start.join(",")}], end=[${end.join(",")}], delta=${length.toExponential(2)}). Pick two distinct endpoints or switch to cylinderGeo with an explicit length + position.`);
}
- const mesh = new THREE49.Mesh(cylinderGeo(radius, radius, length, options.segments ?? 8), material);
+ const mesh = new THREE50.Mesh(cylinderGeo(radius, radius, length, options.segments ?? 8), material);
mesh.name = `Mesh_${name}`;
mesh.position.copy(a.add(b).multiplyScalar(0.5));
- mesh.quaternion.setFromUnitVectors(new THREE49.Vector3(0, 1, 0), direction.normalize());
+ mesh.quaternion.setFromUnitVectors(new THREE50.Vector3(0, 1, 0), direction.normalize());
if (options.parent)
options.parent.add(mesh);
return mesh;
@@ -26722,11 +26937,11 @@ function snapTo(part, host, options = {}) {
const overlap = options.overlap ?? 0.02;
part.updateWorldMatrix(true, true);
host.updateWorldMatrix(true, true);
- const a = new THREE49.Box3().setFromObject(part);
- const b = new THREE49.Box3().setFromObject(host);
+ const a = new THREE50.Box3().setFromObject(part);
+ const b = new THREE50.Box3().setFromObject(host);
if (a.isEmpty() || b.isEmpty())
return part;
- const delta = new THREE49.Vector3;
+ const delta = new THREE50.Vector3;
for (const axis of ["x", "y", "z"]) {
if (a.min[axis] > b.max[axis])
delta[axis] = b.max[axis] - a.min[axis];
@@ -26742,7 +26957,7 @@ function snapTo(part, host, options = {}) {
delta[dominant] = -overlap;
const parent = part.parent;
if (parent) {
- const p0 = new THREE49.Vector3;
+ const p0 = new THREE50.Vector3;
part.getWorldPosition(p0);
const p1 = p0.clone().add(delta);
const l0 = parent.worldToLocal(p0.clone());
@@ -26777,8 +26992,8 @@ function createLadder(name, options) {
throw new RangeError("createLadder rungCount must be an integer from 0 to 10000.");
if (widthAxis !== "x" && widthAxis !== "z")
throw new RangeError("createLadder widthAxis must be x or z.");
- const bottomVec = new THREE49.Vector3;
- const topVec = new THREE49.Vector3(...top).sub(new THREE49.Vector3(...bottom));
+ const bottomVec = new THREE50.Vector3;
+ const topVec = new THREE50.Vector3(...top).sub(new THREE50.Vector3(...bottom));
const length = Math.hypot(topVec.x, topVec.y, topVec.z);
assertDimension("createLadder endpoint distance", length);
if (length <= 0.0001)
@@ -26786,7 +27001,7 @@ function createLadder(name, options) {
const along = topVec.clone().divideScalar(length);
if (widthDirection !== undefined)
assertFiniteTriple("createLadder widthDirection", widthDirection);
- let across = widthDirection ? new THREE49.Vector3(...widthDirection) : widthAxis === "x" ? new THREE49.Vector3(1, 0, 0) : new THREE49.Vector3(0, 0, 1);
+ let across = widthDirection ? new THREE50.Vector3(...widthDirection) : widthAxis === "x" ? new THREE50.Vector3(1, 0, 0) : new THREE50.Vector3(0, 0, 1);
const largest = Math.max(Math.abs(across.x), Math.abs(across.y), Math.abs(across.z));
if (!largest)
throw new RangeError("createLadder widthDirection must be nonzero.");
@@ -26796,19 +27011,19 @@ function createLadder(name, options) {
if (widthDirection)
throw new RangeError("createLadder widthDirection must not be parallel to the endpoints.");
const axes = [
- new THREE49.Vector3(1, 0, 0),
- new THREE49.Vector3(0, 1, 0),
- new THREE49.Vector3(0, 0, 1)
+ new THREE50.Vector3(1, 0, 0),
+ new THREE50.Vector3(0, 1, 0),
+ new THREE50.Vector3(0, 0, 1)
];
across = axes.reduce((best, axis) => Math.abs(axis.dot(along)) < Math.abs(best.dot(along)) ? axis : best);
across.addScaledVector(along, -across.dot(along));
}
across.normalize();
const offset = across.clone().multiplyScalar(width / 2);
- const root = new THREE49.Object3D;
+ const root = new THREE50.Object3D;
root.name = name;
root.position.set(...bottom);
- const rotation = new THREE49.Quaternion().setFromRotationMatrix(new THREE49.Matrix4().makeBasis(across, along, across.clone().cross(along))).toArray();
+ const rotation = new THREE50.Quaternion().setFromRotationMatrix(new THREE50.Matrix4().makeBasis(across, along, across.clone().cross(along))).toArray();
stampSemanticMetadataV1(root, {
roles: ["ladder"],
frames: [
@@ -26848,7 +27063,7 @@ function wallWithOpening(name, material, options) {
if (opening && openings)
throw new TypeError("wallWithOpening: use opening or openings, not both.");
const built = buildWallPanels(length, height, thickness, openings ?? (opening ? [opening] : []));
- const group = new THREE49.Object3D;
+ const group = new THREE50.Object3D;
group.name = name;
const panel = (suffix, lenStart, lenEnd, yLo, yHi) => {
const segLen = lenEnd - lenStart;
@@ -26879,7 +27094,7 @@ function room(name, material, options = {}) {
parent
} = options;
const openings = options.openings ?? [{ wall: "front", kind: "door" }];
- const root = new THREE49.Object3D;
+ const root = new THREE50.Object3D;
root.name = name;
const wall = (suffix, len, axis, pos, which) => {
const w = wallWithOpening(`${name}_Wall${suffix}`, material, {
@@ -26933,7 +27148,7 @@ function createStairs(name, material, options) {
if (Math.abs(totalRise) < 0.0001 || Math.abs(totalRun) < 0.0001) {
throw new Error(`createStairs("${name}"): totalRise and totalRun must be non-zero (got rise=${totalRise}, run=${totalRun}).`);
}
- const root = new THREE49.Object3D;
+ const root = new THREE50.Object3D;
root.name = name;
const stepRise = totalRise / steps;
const stepRun = totalRun / steps;
@@ -26963,7 +27178,7 @@ function requireColor(color, fn) {
}
function gameMaterial(color, options = {}) {
requireColor(color, "gameMaterial");
- const material = new THREE49.MeshStandardMaterial({
+ const material = new THREE50.MeshStandardMaterial({
color,
metalness: options.metalness ?? 0,
roughness: options.roughness ?? 0.8,
@@ -26977,7 +27192,7 @@ function gameMaterial(color, options = {}) {
}
function basicMaterial(color, options = {}) {
requireColor(color, "basicMaterial");
- const material = new THREE49.MeshBasicMaterial({
+ const material = new THREE50.MeshBasicMaterial({
color,
transparent: options.transparent ?? false,
opacity: options.opacity ?? 1
@@ -26988,13 +27203,13 @@ function basicMaterial(color, options = {}) {
}
function glassMaterial(color, options = {}) {
requireColor(color, "glassMaterial");
- const material = new THREE49.MeshStandardMaterial({
+ const material = new THREE50.MeshStandardMaterial({
color,
transparent: true,
opacity: options.opacity ?? 0.35,
roughness: options.roughness ?? 0.1,
metalness: options.metalness ?? 0,
- side: THREE49.DoubleSide
+ side: THREE50.DoubleSide
});
if (options.name !== undefined)
material.name = assertMaterialName(options.name, "glassMaterial");
@@ -27002,7 +27217,7 @@ function glassMaterial(color, options = {}) {
}
function lambertMaterial(color, options = {}) {
requireColor(color, "lambertMaterial");
- const material = new THREE49.MeshLambertMaterial({
+ const material = new THREE50.MeshLambertMaterial({
color,
flatShading: options.flatShading ?? true,
emissive: options.emissive ?? 0
@@ -27015,12 +27230,12 @@ function threeInterpolation(mode) {
if (mode !== undefined && !TRACK_INTERPOLATIONS.includes(mode)) {
throw new Error(`Animation interpolation must be one of ${TRACK_INTERPOLATIONS.join(", ")}.`);
}
- return mode === "STEP" ? THREE49.InterpolateDiscrete : THREE49.InterpolateLinear;
+ return mode === "STEP" ? THREE50.InterpolateDiscrete : THREE50.InterpolateLinear;
}
function interpolatedTrack(Type, name, times, values, interpolation) {
if (!isCubicInterpolation(interpolation))
return new Type(name, times, values, threeInterpolation(interpolation));
- const quaternion = Type === THREE49.QuaternionKeyframeTrack;
+ const quaternion = Type === THREE50.QuaternionKeyframeTrack;
return useCubicSpline(new Type(name, times, cubicSplineValues(times, values, quaternion ? 4 : 3, interpolation, quaternion)));
}
function animationNumber(value, label) {
@@ -27074,15 +27289,15 @@ function rotationTrack(jointName, keyframes, interpolation) {
animationKeys(jointName, keyframes, "rotation", interpolation);
const times = [];
const values = [];
- const euler = new THREE49.Euler;
- const quat = new THREE49.Quaternion;
+ const euler = new THREE50.Euler;
+ const quat = new THREE50.Quaternion;
for (const kf of keyframes) {
times.push(kf.time);
- euler.set(THREE49.MathUtils.degToRad(kf.rotation[0]), THREE49.MathUtils.degToRad(kf.rotation[1]), THREE49.MathUtils.degToRad(kf.rotation[2]));
+ euler.set(THREE50.MathUtils.degToRad(kf.rotation[0]), THREE50.MathUtils.degToRad(kf.rotation[1]), THREE50.MathUtils.degToRad(kf.rotation[2]));
quat.setFromEuler(euler);
values.push(quat.x, quat.y, quat.z, quat.w);
}
- return interpolatedTrack(THREE49.QuaternionKeyframeTrack, `${jointName}.quaternion`, times, values, interpolation);
+ return interpolatedTrack(THREE50.QuaternionKeyframeTrack, `${jointName}.quaternion`, times, values, interpolation);
}
function positionTrack(jointName, keyframes, interpolation) {
animationKeys(jointName, keyframes, "position", interpolation);
@@ -27092,7 +27307,7 @@ function positionTrack(jointName, keyframes, interpolation) {
times.push(kf.time);
values.push(...kf.position);
}
- return interpolatedTrack(THREE49.VectorKeyframeTrack, `${jointName}.position`, times, values, interpolation);
+ return interpolatedTrack(THREE50.VectorKeyframeTrack, `${jointName}.position`, times, values, interpolation);
}
function scaleTrack(jointName, keyframes, interpolation) {
animationKeys(jointName, keyframes, "scale", interpolation);
@@ -27102,7 +27317,7 @@ function scaleTrack(jointName, keyframes, interpolation) {
times.push(kf.time);
values.push(...kf.scale);
}
- return interpolatedTrack(THREE49.VectorKeyframeTrack, `${jointName}.scale`, times, values, interpolation);
+ return interpolatedTrack(THREE50.VectorKeyframeTrack, `${jointName}.scale`, times, values, interpolation);
}
function createClip(name, duration, tracks, options) {
if (typeof name !== "string" || !name.trim())
@@ -27115,7 +27330,7 @@ function createClip(name, duration, tracks, options) {
const loop = clipLoopOption(options);
const names = new Set;
for (const track of tracks) {
- if (!(track instanceof THREE49.KeyframeTrack))
+ if (!(track instanceof THREE50.KeyframeTrack))
throw new Error("Animation clip tracks must be KeyframeTrack instances.");
if (typeof track.name !== "string")
throw new Error("Animation track target/channel must use a string name.");
@@ -27129,12 +27344,12 @@ function createClip(name, duration, tracks, options) {
throw new Error(`Duplicate animation target/channel: ${track.name}.`);
names.add(track.name);
const quaternion = channel === "quaternion";
- const Type = quaternion ? THREE49.QuaternionKeyframeTrack : THREE49.VectorKeyframeTrack;
+ const Type = quaternion ? THREE50.QuaternionKeyframeTrack : THREE50.VectorKeyframeTrack;
if (!(track instanceof Type))
throw new Error(`Animation channel ${channel} requires ${quaternion ? "QuaternionKeyframeTrack" : "VectorKeyframeTrack"}.`);
const cubic = isCubicSplineTrack(track);
const mode = track.getInterpolation();
- if (!cubic && mode !== THREE49.InterpolateLinear && mode !== THREE49.InterpolateDiscrete) {
+ if (!cubic && mode !== THREE50.InterpolateLinear && mode !== THREE50.InterpolateDiscrete) {
throw new Error("Animation interpolation must be LINEAR, STEP or CUBICSPLINE (the glTF sampler modes); three.js smooth and Bezier interpolants have no glTF form.");
}
animationTimes(track.times, track.name);
@@ -27157,7 +27372,7 @@ function createClip(name, duration, tracks, options) {
throw new Error(`Animation clip duration ${duration} does not include every key of ${track.name}.`);
}
}
- const clip = new THREE49.AnimationClip(name, duration, tracks);
+ const clip = new THREE50.AnimationClip(name, duration, tracks);
if (loop !== undefined)
clip.userData.kilnLoopIntent = loop ? "loop" : "once";
return clip;
@@ -27234,12 +27449,12 @@ function createInstance(name, source, options = {}) {
if (!sourceMesh) {
throw new Error(`createInstance("${name}"): source "${source.name}" has no Mesh to clone from`);
}
- const mesh = new THREE49.Mesh(sourceMesh.geometry, sourceMesh.material);
+ const mesh = new THREE50.Mesh(sourceMesh.geometry, sourceMesh.material);
mesh.name = `Mesh_${name}`;
if (options.position)
mesh.position.set(...options.position);
if (options.rotation)
- mesh.rotation.set(THREE49.MathUtils.degToRad(options.rotation[0]), THREE49.MathUtils.degToRad(options.rotation[1]), THREE49.MathUtils.degToRad(options.rotation[2]));
+ mesh.rotation.set(THREE50.MathUtils.degToRad(options.rotation[0]), THREE50.MathUtils.degToRad(options.rotation[1]), THREE50.MathUtils.degToRad(options.rotation[2]));
if (options.scale)
mesh.scale.set(...options.scale);
if (options.parent)
@@ -27532,7 +27747,7 @@ function buildSandboxGlobals(usage, options = {}) {
getJointNames: wrap("getJointNames", getJointNames),
materialBudgetAdvisory: wrap("materialBudgetAdvisory", materialBudgetAdvisory),
seededRandom: wrap("seededRandom", seededRandom),
- THREE: THREE49,
+ THREE: THREE50,
Math,
console: options.console ?? console
};
@@ -27675,7 +27890,7 @@ import {
PropertyType as PropertyType4
} from "@gltf-transform/core";
import { createTransform, dequantizePrimitive, joinPrimitives } from "@gltf-transform/functions";
-import * as THREE50 from "three";
+import * as THREE51 from "three";
function isSingular(matrix) {
const e = matrix.elements;
const scale = Math.hypot(e[0], e[1], e[2]) * Math.hypot(e[4], e[5], e[6]) * Math.hypot(e[8], e[9], e[10]);
@@ -27793,10 +28008,10 @@ function reverseWinding(prim) {
}
}
function bake(prim, matrix) {
- const linear = new THREE50.Matrix3().setFromMatrix4(matrix);
- const normalMatrix = new THREE50.Matrix3().getNormalMatrix(matrix);
+ const linear = new THREE51.Matrix3().setFromMatrix4(matrix);
+ const normalMatrix = new THREE51.Matrix3().getNormalMatrix(matrix);
const mirrored = matrix.determinant() < 0;
- const v = new THREE50.Vector3;
+ const v = new THREE51.Vector3;
const each = (semantic, apply) => {
const attribute = prim.getAttribute(semantic);
const element = [];
@@ -27820,7 +28035,7 @@ function destinationOf(entries) {
let best = Infinity;
let bestScale = Infinity;
for (const { node } of entries) {
- const linear = new THREE50.Matrix3().setFromMatrix4(worldOf(node));
+ const linear = new THREE51.Matrix3().setFromMatrix4(worldOf(node));
const norm = Math.hypot(...linear.elements);
const inverseNorm = Math.hypot(...linear.clone().invert().elements);
const condition = norm * inverseNorm;
@@ -27834,9 +28049,9 @@ function destinationOf(entries) {
return chosen;
}
function checkPositionPrecision(input, output, sourceWorld, destinationWorld, reversed) {
- const expected = new THREE50.Vector3;
- const actual = new THREE50.Vector3;
- const bounds = new THREE50.Box3;
+ const expected = new THREE51.Vector3;
+ const actual = new THREE51.Vector3;
+ const bounds = new THREE51.Box3;
const element = [];
let error = 0;
let magnitude = 0;
@@ -28157,7 +28372,7 @@ function rigidMerge(options = {}, onSummary) {
onSummary?.(summary);
});
}
-var JOINT_PIVOT, RESTART_MODES, BAKED, MAX_VERTICES = 65534, MAX_BYTES_PER_SAVED_DRAW = 4096, hasKeys = (value) => Object.keys(value).length > 0, worldOf = (node) => new THREE50.Matrix4().fromArray(node.getWorldMatrix()), nodeUsers = (mesh) => mesh.listParents().filter((parent) => parent.propertyType === PropertyType4.NODE).length, accessorsOf = (prim) => {
+var JOINT_PIVOT, RESTART_MODES, BAKED, MAX_VERTICES = 65534, MAX_BYTES_PER_SAVED_DRAW = 4096, hasKeys = (value) => Object.keys(value).length > 0, worldOf = (node) => new THREE51.Matrix4().fromArray(node.getWorldMatrix()), nodeUsers = (mesh) => mesh.listParents().filter((parent) => parent.propertyType === PropertyType4.NODE).length, accessorsOf = (prim) => {
const indices = prim.getIndices();
return indices ? [...prim.listAttributes(), indices] : prim.listAttributes();
}, primitiveBytes = (primitives) => [...new Set(primitives.flatMap(accessorsOf))].reduce((sum, a) => sum + (a.getArray()?.byteLength ?? 0), 0), countPrimitives = (nodes) => [...nodes].reduce((sum, node) => sum + (node.getMesh()?.listPrimitives().length ?? 0), 0);
@@ -29899,7 +30114,7 @@ var init_kit = __esm(() => {
// src/texture-bake.ts
import { createHash as createHash5 } from "node:crypto";
-import * as THREE51 from "three";
+import * as THREE52 from "three";
function readPixels(texture) {
const image = texture.image;
if (!image)
@@ -30026,7 +30241,7 @@ async function bakeSceneTextures(root, warnings) {
mime: "image/png",
bytes
};
- const colorSpace = entry.texture.colorSpace === THREE51.SRGBColorSpace ? "srgb" : "linear";
+ const colorSpace = entry.texture.colorSpace === THREE52.SRGBColorSpace ? "srgb" : "linear";
const recipe = entry.texture.userData["kilnProcedural"];
const primaryUsage = atlasRecord?.spec.usage ?? recipe?.usage ?? (entry.bindings.some(({ slot }) => slot === "roughnessMap") && entry.bindings.some(({ slot }) => slot === "metalnessMap") ? "metallicRoughness" : entry.bindings[0]?.usage ?? "albedo");
if (!encoded)
@@ -30109,10 +30324,10 @@ function computeTangentBasis(geometry) {
}
}
const out = new Float32Array(vertexCount * 4);
- const n = new THREE51.Vector3;
- const t = new THREE51.Vector3;
- const tmp = new THREE51.Vector3;
- const tmp2 = new THREE51.Vector3;
+ const n = new THREE52.Vector3;
+ const t = new THREE52.Vector3;
+ const tmp = new THREE52.Vector3;
+ const tmp2 = new THREE52.Vector3;
for (let v = 0;v < vertexCount; v++) {
n.set(normal.getX(v), normal.getY(v), normal.getZ(v));
t.set(tan1[v * 3], tan1[v * 3 + 1], tan1[v * 3 + 2]);
@@ -30132,7 +30347,7 @@ function computeTangentBasis(geometry) {
out[v * 4 + 2] = tmp.z;
out[v * 4 + 3] = w;
}
- geometry.setAttribute("tangent", new THREE51.BufferAttribute(out, 4));
+ geometry.setAttribute("tangent", new THREE52.BufferAttribute(out, 4));
}
function ensureNormalMapTangents(root, warnings) {
let count = 0;
@@ -30215,7 +30430,7 @@ import {
KHRTextureBasisu as KHRTextureBasisu2
} from "@gltf-transform/extensions";
import { cloneDocument, dedup, prune, quantize, reorder } from "@gltf-transform/functions";
-import * as THREE52 from "three";
+import * as THREE53 from "three";
function meshSignature(mesh, ids) {
const id = (property) => {
if (!property)
@@ -30377,13 +30592,13 @@ var init_exporter_node = __esm(() => {
});
// src/views/character.ts
-import * as THREE53 from "three";
-function rounded(value) {
+import * as THREE54 from "three";
+function rounded2(value) {
const result = Math.round(value * 1e9) / 1e9;
return Object.is(result, -0) ? 0 : result;
}
function tuple5(vector) {
- return [rounded(vector.x), rounded(vector.y), rounded(vector.z)];
+ return [rounded2(vector.x), rounded2(vector.y), rounded2(vector.z)];
}
function chainIdFor(descriptor, byRole) {
if (AXIAL_ROLES.has(descriptor.role))
@@ -30419,9 +30634,9 @@ function buildCharacterDiagnosticDescriptor(root, findings = []) {
const invalidPaths = new Set(invalidFindingNodePaths);
const joints = evidence.map((joint) => {
const relative = rootInverse.clone().multiply(joint.node.matrixWorld);
- const position = new THREE53.Vector3().setFromMatrixPosition(relative);
- const forward = new THREE53.Vector3(...joint.descriptor.localForwardAxis).transformDirection(relative).multiplyScalar(0.2).add(position);
- const bend = new THREE53.Vector3(...joint.descriptor.localBendAxis).transformDirection(relative).multiplyScalar(0.2).add(position);
+ const position = new THREE54.Vector3().setFromMatrixPosition(relative);
+ const forward = new THREE54.Vector3(...joint.descriptor.localForwardAxis).transformDirection(relative).multiplyScalar(0.2).add(position);
+ const bend = new THREE54.Vector3(...joint.descriptor.localBendAxis).transformDirection(relative).multiplyScalar(0.2).add(position);
const chainId = chainIdFor(joint.descriptor, descriptorByRole);
return {
role: joint.descriptor.role,
@@ -31684,7 +31899,7 @@ function prepareTriangleCoverage(ax, ay, bx, by, cx, cy, size) {
}
// src/views/raster.ts
-import { Vector3 as Vector339 } from "three";
+import { Vector3 as Vector340 } from "three";
function orbitDir(azimuthDeg, elevationDeg) {
const el = Math.min(MAX_ELEVATION_DEG, Math.max(MIN_ELEVATION_DEG, elevationDeg)) * Math.PI / 180;
const az = azimuthDeg * Math.PI / 180;
@@ -31708,7 +31923,7 @@ function updateSurfaceMatrices(root) {
function surfaceVertexReader(mesh, position) {
for (const bone of mesh.skeleton?.bones ?? [])
bone.updateWorldMatrix?.(true, false);
- const vertex = new Vector339;
+ const vertex = new Vector340;
if (mesh.getVertexPosition)
return (index) => mesh.getVertexPosition(index, vertex);
if (position.getX && position.getY && position.getZ)
@@ -31985,7 +32200,7 @@ import {
var init_scene_copy = () => {};
// src/views/camera.ts
-import { Vector3 as Vector340, Matrix4 as Matrix417, Euler as Euler5, Group as Group4 } from "three";
+import { Vector3 as Vector341, Matrix4 as Matrix417, Euler as Euler5, Group as Group4 } from "three";
function strict(value, keys, label) {
for (const key of Object.keys(value))
if (!keys.includes(key)) {
@@ -32079,14 +32294,14 @@ function cameraFromBounds(bounds, dir, padding = 1, up, sceneBounds = bounds) {
const z = vec(dir).normalize();
if (!z.length())
throw new Error("camera direction must be non-zero");
- const hint = up ? vec(up) : Math.abs(z.y) > 0.99 ? new Vector340(0, 0, -1) : new Vector340(0, 1, 0);
+ const hint = up ? vec(up) : Math.abs(z.y) > 0.99 ? new Vector341(0, 0, -1) : new Vector341(0, 1, 0);
const x = hint.clone().cross(z).normalize();
if (x.length() < 0.000000001)
throw new Error("camera up must not be collinear with view");
const y = z.clone().cross(x);
let extent = 0.000001;
for (let i = 0;i < 8; i++) {
- const p = new Vector340((i & 1 ? bounds.max : bounds.min)[0], (i & 2 ? bounds.max : bounds.min)[1], (i & 4 ? bounds.max : bounds.min)[2]).sub(target);
+ const p = new Vector341((i & 1 ? bounds.max : bounds.min)[0], (i & 2 ? bounds.max : bounds.min)[1], (i & 4 ? bounds.max : bounds.min)[2]).sub(target);
extent = Math.max(extent, Math.abs(p.dot(x)), Math.abs(p.dot(y)));
}
const depthMin = bounds.min.map((v, i) => Math.min(v, sceneBounds.min[i]));
@@ -32167,7 +32382,7 @@ function resolveAssetCamera(root, shot = {}) {
if (relative !== "world") {
const node = relative === "part" ? selected.node : rootNode;
dir.transformDirection(node.matrixWorld);
- up = tuple6(new Vector340(0, 1, 0).transformDirection(node.matrixWorld));
+ up = tuple6(new Vector341(0, 1, 0).transformDirection(node.matrixWorld));
}
camera = cameraFromBounds(bounds, tuple6(dir), request.padding ?? 1.2, up, measureBounds(root));
} else if (request.type === "explicit") {
@@ -32214,7 +32429,7 @@ function resolveAssetCamera(root, shot = {}) {
const position = vec(triple2(request.position, "position")).applyMatrix4(matrix);
const target = request.target ? vec(triple2(request.target, "target")).applyMatrix4(matrix) : vec(bounds.min).add(vec(bounds.max)).multiplyScalar(0.5);
const up = vec(triple2(request.up ?? [0, 1, 0], "up")).transformDirection(matrix);
- const offset = vec(triple2(request.targetOffset ?? [0, 0, 0], "targetOffset")).applyMatrix4(matrix).sub(new Vector340().setFromMatrixPosition(matrix));
+ const offset = vec(triple2(request.targetOffset ?? [0, 0, 0], "targetOffset")).applyMatrix4(matrix).sub(new Vector341().setFromMatrixPosition(matrix));
const radius = vec(bounds.max).sub(vec(bounds.min)).length();
camera = {
version: "kiln.camera.v1",
@@ -32327,11 +32542,11 @@ function rasterizeCamera(root, input, size = 384, backfaceCull = true, backdrop)
}
return result;
};
- const key = new Vector340(1.5, 2, 1).normalize();
+ const key = new Vector341(1.5, 2, 1).normalize();
const srgb = (n) => n <= 0.0031308 ? n * 12.92 : 1.055 * n ** (1 / 2.4) - 0.055;
const ordered = compositingOrder(collectTriangles(root).tris, (px, py, pz) => camera.projection === "perspective" ? Math.hypot(px - position.x, py - position.y, pz - position.z) : (position.x - px) * z.x + (position.y - py) * z.y + (position.z - pz) * z.z);
for (const tri of ordered) {
- const world = [0, 1, 2].map((i) => new Vector340(tri.v[i * 3], tri.v[i * 3 + 1], tri.v[i * 3 + 2]));
+ const world = [0, 1, 2].map((i) => new Vector341(tri.v[i * 3], tri.v[i * 3 + 1], tri.v[i * 3 + 2]));
const normal = world[1].clone().sub(world[0]).cross(world[2].clone().sub(world[0])).normalize().multiplyScalar(tri.windingParity);
const normalSign = visibleNormalSign(normal.dot(camera.projection === "perspective" ? position.clone().sub(world[0]) : z), tri.side, backfaceCull);
if (normalSign === 0)
@@ -32342,7 +32557,7 @@ function rasterizeCamera(root, input, size = 384, backfaceCull = true, backdrop)
const color = tri.color.map((c) => Math.round(srgb(c * light) * 255));
let polygon = world.map((p) => {
const d = p.clone().sub(position);
- return new Vector340(d.dot(x), d.dot(y), -d.dot(z));
+ return new Vector341(d.dot(x), d.dot(y), -d.dot(z));
});
polygon = clip(clip(polygon, camera.near, true), camera.far, false);
for (let t = 1;t < polygon.length - 1; t++) {
@@ -32374,7 +32589,7 @@ function rasterizeCamera(root, input, size = 384, backfaceCull = true, backdrop)
}
return out;
}
-var vec = (a) => new Vector340(...a), tuple6 = (v) => [v.x || 0, v.y || 0, v.z || 0], KEY_HINTS;
+var vec = (a) => new Vector341(...a), tuple6 = (v) => [v.x || 0, v.y || 0, v.z || 0], KEY_HINTS;
var init_camera = __esm(() => {
init_raster();
init_background();
@@ -32485,7 +32700,7 @@ import {
PropertyBinding as PropertyBinding3,
VectorKeyframeTrack as VectorKeyframeTrack2,
Quaternion as Quaternion20,
- Vector3 as Vector341,
+ Vector3 as Vector342,
InterpolateDiscrete as InterpolateDiscrete2,
InterpolateLinear as InterpolateLinear2
} from "three";
@@ -33282,7 +33497,7 @@ var init_cli_output = () => {};
// src/material-map-export-node.ts
import sharp from "sharp";
-import * as THREE54 from "three";
+import * as THREE55 from "three";
var MATERIAL_MAP_EXPORT_LIMITS, PREVIEW_CAMERA, SRGB_TO_LINEAR;
var init_material_map_export_node = __esm(() => {
init_cli_output();
@@ -34051,7 +34266,7 @@ var init_renderer_id = __esm(() => {
});
// src/views/scene-raster.ts
-import * as THREE55 from "three";
+import * as THREE56 from "three";
var DEG2;
var init_scene_raster = __esm(() => {
init_evaluator();
@@ -34063,18 +34278,18 @@ var init_scene_raster = __esm(() => {
});
// src/views/vehicle.ts
-import * as THREE56 from "three";
+import * as THREE57 from "three";
function hasRole2(node, prefix) {
return readSemanticMetadataV1(node)?.roles.some((role) => role === prefix || role.startsWith(`${prefix}.`)) ?? false;
}
function chassisBounds(root, inverse) {
- const bounds = new THREE56.Box3;
+ const bounds = new THREE57.Box3;
let found = false;
root.traverse((node) => {
if (!hasRole2(node, "chassis"))
return;
node.traverse((part) => {
- if (!(part instanceof THREE56.Mesh) || !(part.geometry instanceof THREE56.BufferGeometry))
+ if (!(part instanceof THREE57.Mesh) || !(part.geometry instanceof THREE57.BufferGeometry))
return;
part.geometry.computeBoundingBox();
const box = part.geometry.boundingBox;
@@ -34084,7 +34299,7 @@ function chassisBounds(root, inverse) {
for (const x of [box.min.x, box.max.x])
for (const y of [box.min.y, box.max.y])
for (const z of [box.min.z, box.max.z]) {
- bounds.expandByPoint(new THREE56.Vector3(x, y, z).applyMatrix4(matrix));
+ bounds.expandByPoint(new THREE57.Vector3(x, y, z).applyMatrix4(matrix));
found = true;
}
});
@@ -34152,33 +34367,33 @@ function tagDiagnostic(node, role) {
stampSemanticMetadataV1(node, { roles: [role] });
}
function rod(name, start, end, radius, color, role) {
- const from = new THREE56.Vector3(...start);
- const to = new THREE56.Vector3(...end);
+ const from = new THREE57.Vector3(...start);
+ const to = new THREE57.Vector3(...end);
const direction = to.clone().sub(from);
const length = direction.length();
- const geometry = length > 0.000000001 ? new THREE56.CylinderGeometry(radius, radius, length, 8) : new THREE56.SphereGeometry(radius, 8, 6);
- const result = new THREE56.Mesh(geometry, new THREE56.MeshBasicMaterial({ color }));
+ const geometry = length > 0.000000001 ? new THREE57.CylinderGeometry(radius, radius, length, 8) : new THREE57.SphereGeometry(radius, 8, 6);
+ const result = new THREE57.Mesh(geometry, new THREE57.MeshBasicMaterial({ color }));
result.name = name;
result.position.copy(from).add(to).multiplyScalar(0.5);
if (length > 0.000000001) {
- result.quaternion.setFromUnitVectors(new THREE56.Vector3(0, 1, 0), direction.multiplyScalar(1 / length));
+ result.quaternion.setFromUnitVectors(new THREE57.Vector3(0, 1, 0), direction.multiplyScalar(1 / length));
}
tagDiagnostic(result, role);
return result;
}
function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagnostics(root)) {
- const overlay = new THREE56.Group;
+ const overlay = new THREE57.Group;
overlay.name = "VehicleDiagnosticOverlay";
const chassisSpan = descriptor.chassisBox ? Math.max(descriptor.chassisBox.max[0] - descriptor.chassisBox.min[0], descriptor.chassisBox.max[1] - descriptor.chassisBox.min[1], descriptor.chassisBox.max[2] - descriptor.chassisBox.min[2]) : 1;
const thickness = Math.max(0.01, chassisSpan * 0.008);
- const arrow = new THREE56.Group;
+ const arrow = new THREE57.Group;
arrow.name = "Diagnostic_Forward_+X";
tagDiagnostic(arrow, "diagnostic.vehicle.forward");
arrow.add(rod("Diagnostic_Forward_Shaft", descriptor.forwardArrow.start, [descriptor.forwardArrow.end[0] - 0.12, 0, 0], thickness, 16724804, "diagnostic.vehicle.forward"));
- const arrowHead = new THREE56.Mesh(new THREE56.ConeGeometry(thickness * 3.2, 0.24, 10), new THREE56.MeshBasicMaterial({ color: 16724804 }));
+ const arrowHead = new THREE57.Mesh(new THREE57.ConeGeometry(thickness * 3.2, 0.24, 10), new THREE57.MeshBasicMaterial({ color: 16724804 }));
arrowHead.name = "Diagnostic_Forward_Head";
arrowHead.position.set(descriptor.forwardArrow.end[0] - 0.12, 0, 0);
- arrowHead.quaternion.setFromUnitVectors(new THREE56.Vector3(0, 1, 0), new THREE56.Vector3(1, 0, 0));
+ arrowHead.quaternion.setFromUnitVectors(new THREE57.Vector3(0, 1, 0), new THREE57.Vector3(1, 0, 0));
tagDiagnostic(arrowHead, "diagnostic.vehicle.forward");
arrow.add(arrowHead);
overlay.add(arrow);
@@ -34186,18 +34401,18 @@ function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagno
overlay.add(rod(`Diagnostic_Axle_${axle.id}`, axle.start, axle.end, thickness, 3386111, `diagnostic.vehicle.axle.${axle.id}`));
}
for (const wheel of descriptor.wheels) {
- const ring = new THREE56.Mesh(new THREE56.TorusGeometry(wheel.radius, Math.min(thickness, wheel.radius * 0.15), 6, 32), new THREE56.MeshBasicMaterial({ color: 16763955 }));
+ const ring = new THREE57.Mesh(new THREE57.TorusGeometry(wheel.radius, Math.min(thickness, wheel.radius * 0.15), 6, 32), new THREE57.MeshBasicMaterial({ color: 16763955 }));
ring.name = `Diagnostic_Wheel_${wheel.id}`;
ring.position.set(...wheel.center);
- const axle = new THREE56.Vector3(...wheel.axle);
+ const axle = new THREE57.Vector3(...wheel.axle);
if (axle.lengthSq() > 0.000000000001) {
- ring.quaternion.setFromUnitVectors(new THREE56.Vector3(0, 0, 1), axle.normalize());
+ ring.quaternion.setFromUnitVectors(new THREE57.Vector3(0, 0, 1), axle.normalize());
}
tagDiagnostic(ring, `diagnostic.vehicle.wheel.${wheel.id}`);
overlay.add(ring);
}
if (descriptor.chassisBox) {
- const chassis = new THREE56.Group;
+ const chassis = new THREE57.Group;
chassis.name = "Diagnostic_ChassisBox";
tagDiagnostic(chassis, "diagnostic.vehicle.chassis");
const { min, max } = descriptor.chassisBox;
@@ -34231,7 +34446,7 @@ function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagno
overlay.add(chassis);
}
if (descriptor.supportPlaneY !== undefined) {
- const plane = new THREE56.Group;
+ const plane = new THREE57.Group;
plane.name = "Diagnostic_SupportPlane";
tagDiagnostic(plane, "diagnostic.vehicle.support-plane");
const halfX = Math.max(1, ...descriptor.chassisBox ? [Math.abs(descriptor.chassisBox.min[0]), Math.abs(descriptor.chassisBox.max[0])] : [], ...descriptor.wheels.map((wheel) => Math.abs(wheel.center[0]) + wheel.radius)) + 0.2;
@@ -34560,7 +34775,7 @@ var init_views = __esm(() => {
});
// src/views/character-capture.ts
-import * as THREE57 from "three";
+import * as THREE58 from "three";
function drawLine2(rgb, width, height, from, to, color) {
let x0 = Math.round(from[0]);
let y0 = Math.round(from[1]);
@@ -34597,22 +34812,22 @@ function drawCross(rgb, width, height, point, color, radius = 3) {
}
function projector(root, cameraId, size) {
root.updateMatrixWorld(true);
- const bounds = new THREE57.Box3().setFromObject(root);
+ const bounds = new THREE58.Box3().setFromObject(root);
if (bounds.isEmpty())
- bounds.set(new THREE57.Vector3(-0.5, 0, -0.5), new THREE57.Vector3(0.5, 1, 0.5));
- const center = bounds.getCenter(new THREE57.Vector3);
- const camera = cameraId === "front" ? new THREE57.Vector3(1, 0, 0) : new THREE57.Vector3(0, 0, 1);
- const upHint = new THREE57.Vector3(0, 1, 0);
- const xAxis = new THREE57.Vector3().crossVectors(upHint, camera).normalize();
- const yAxis = new THREE57.Vector3().crossVectors(camera, xAxis).normalize();
+ bounds.set(new THREE58.Vector3(-0.5, 0, -0.5), new THREE58.Vector3(0.5, 1, 0.5));
+ const center = bounds.getCenter(new THREE58.Vector3);
+ const camera = cameraId === "front" ? new THREE58.Vector3(1, 0, 0) : new THREE58.Vector3(0, 0, 1);
+ const upHint = new THREE58.Vector3(0, 1, 0);
+ const xAxis = new THREE58.Vector3().crossVectors(upHint, camera).normalize();
+ const yAxis = new THREE58.Vector3().crossVectors(camera, xAxis).normalize();
let extent = 0.000001;
for (let corner = 0;corner < 8; corner++) {
- const point = new THREE57.Vector3(corner & 1 ? bounds.max.x : bounds.min.x, corner & 2 ? bounds.max.y : bounds.min.y, corner & 4 ? bounds.max.z : bounds.min.z).sub(center);
+ const point = new THREE58.Vector3(corner & 1 ? bounds.max.x : bounds.min.x, corner & 2 ? bounds.max.y : bounds.min.y, corner & 4 ? bounds.max.z : bounds.min.z).sub(center);
extent = Math.max(extent, Math.abs(point.dot(xAxis)), Math.abs(point.dot(yAxis)));
}
const scale = size * 0.45 / extent;
return (assetPoint) => {
- const world = new THREE57.Vector3(...assetPoint).applyMatrix4(root.matrixWorld).sub(center);
+ const world = new THREE58.Vector3(...assetPoint).applyMatrix4(root.matrixWorld).sub(center);
return [size / 2 + world.dot(xAxis) * scale, size / 2 - world.dot(yAxis) * scale];
};
}
@@ -34738,7 +34953,7 @@ var init_character_capture = __esm(() => {
});
// src/render.ts
-import * as THREE58 from "three";
+import * as THREE59 from "three";
import { Document, Logger as Logger2 } from "@gltf-transform/core";
import { KHRMaterialsEmissiveStrength } from "@gltf-transform/extensions";
import { dedup as dedup2, instance, palette, weld as weld2, prune as prune2, mergeDocuments } from "@gltf-transform/functions";
@@ -34968,7 +35183,7 @@ function bridgeMaterial(doc, threeMat, cache, textureCache, authorExtras, atlas)
} else if (stdMat.transparent) {
mat.setAlphaMode("BLEND");
}
- if (stdMat.side === THREE58.DoubleSide) {
+ if (stdMat.side === THREE59.DoubleSide) {
mat.setDoubleSided(true);
}
if (stdMat.map) {
@@ -35045,7 +35260,7 @@ function bridgeMaterial(doc, threeMat, cache, textureCache, authorExtras, atlas)
} else if (common.transparent || (common.opacity ?? 1) < 1) {
mat.setAlphaMode("BLEND");
}
- if (threeMat.side === THREE58.DoubleSide)
+ if (threeMat.side === THREE59.DoubleSide)
mat.setDoubleSided(true);
if (common.map && !mat.getBaseColorTexture()) {
const texture = bridgeTexture(doc, common.map, textureCache);
@@ -35208,7 +35423,7 @@ function bridgeNode(doc, buf, threeObj, matCache, nodeMap, meshCache, texCache,
const cacheKey = `kiln-sprite-quad:${centerX}:${centerY}:${rotation}__${threeMat.uuid}`;
let gtMesh = meshCache.get(cacheKey);
if (!gtMesh) {
- const geometry = new THREE58.PlaneGeometry(1, 1);
+ const geometry = new THREE59.PlaneGeometry(1, 1);
if (centerX !== 0.5 || centerY !== 0.5) {
geometry.translate(0.5 - centerX, 0.5 - centerY, 0);
}
@@ -35232,9 +35447,9 @@ function animationInterpolation(track) {
if (isCubicSplineTrack(track))
return "CUBICSPLINE";
const mode = track.getInterpolation();
- if (mode === THREE58.InterpolateDiscrete)
+ if (mode === THREE59.InterpolateDiscrete)
return "STEP";
- if (mode === THREE58.InterpolateLinear)
+ if (mode === THREE59.InterpolateLinear)
return "LINEAR";
throw new Error(`Unsupported animation interpolation on ${track.name}; use LINEAR, STEP or CUBICSPLINE.`);
}
@@ -35769,6 +35984,22 @@ function inspectGeneratedAnimation(root, clips) {
}
return warnings;
}
+function collapseWeldedFloaters(floaters, pieces) {
+ for (let i = 0;i < floaters.length; i++) {
+ const mesh = floaters[i].welded;
+ if (!mesh)
+ continue;
+ const detached = floaters.filter((floater) => floater.welded === mesh).length;
+ if (detached < 2)
+ continue;
+ const of = pieces.find((piece) => piece.welded?.mesh === mesh)?.welded?.of ?? detached;
+ floaters[i].name = `${mesh} (${detached} of its ${of} welded components)`;
+ for (let j = floaters.length - 1;j > i; j--)
+ if (floaters[j].welded === mesh)
+ floaters.splice(j, 1);
+ floaters[i].welded = undefined;
+ }
+}
function collectMeshStats(root) {
root.updateMatrixWorld(true);
const out = [];
@@ -35798,8 +36029,8 @@ function collectMeshStats(root) {
if (!Number.isFinite(box.min.x) || !Number.isFinite(box.max.x)) {
return;
}
- const center = new THREE58.Vector3;
- const size = new THREE58.Vector3;
+ const center = new THREE59.Vector3;
+ const size = new THREE59.Vector3;
box.getCenter(center);
box.getSize(size);
out.push({
@@ -35815,7 +36046,7 @@ function collectMeshStats(root) {
return out;
}
function minimalGapVector(a, b) {
- const v = new THREE58.Vector3;
+ const v = new THREE59.Vector3;
for (const axis of ["x", "y", "z"]) {
if (a.min[axis] > b.max[axis])
v[axis] = b.max[axis] - a.min[axis];
@@ -35833,10 +36064,10 @@ function inspectSceneStructure(root, opts = {}) {
return warnings;
const cat = opts.category?.toLowerCase();
if (cat === "vehicle" || cat === "weapon" || cat === "boat" || cat === "aircraft") {
- const all = new THREE58.Box3;
+ const all = new THREE59.Box3;
for (const m of meshes)
all.union(m.box);
- const size = new THREE58.Vector3;
+ const size = new THREE59.Vector3;
all.getSize(size);
if (cat === "aircraft") {
if (size.y > size.x * 1.2) {
@@ -35860,17 +36091,28 @@ function inspectSceneStructure(root, opts = {}) {
warnings.push(`Stray plane "${m.name}" at world origin (centroid ≈ [0,0,0]). Replace planeGeo with decalBox and position on a host surface, or move this mesh into place.`);
}
}
- if (meshes.length > 1) {
+ const budget = splitBudget();
+ const pieces = meshes.flatMap((mesh) => {
+ const boxes = meshComponentBoxes(mesh.object, budget);
+ if (!boxes || boxes.length < 2)
+ return [mesh];
+ return boxes.map((box, index) => ({
+ ...mesh,
+ box,
+ welded: { mesh: mesh.name, index: index + 1, of: boxes.length }
+ }));
+ });
+ if (pieces.length > 1) {
const floaters = [];
const supported = [];
- for (let i = 0;i < meshes.length; i++) {
- const a = meshes[i];
+ for (let i = 0;i < pieces.length; i++) {
+ const a = pieces[i];
const ax = a.box.clone().expandByScalar(FLOATING_EXPAND);
let overlapsAny = false;
- for (let j = 0;j < meshes.length; j++) {
+ for (let j = 0;j < pieces.length; j++) {
if (i === j)
continue;
- const b = meshes[j];
+ const b = pieces[j];
if (ax.intersectsBox(b.box)) {
overlapsAny = true;
break;
@@ -35886,19 +36128,25 @@ function inspectSceneStructure(root, opts = {}) {
const declared = declaredSupports(a.object, opts.externalSupport)[0];
let nearest;
let nearestGap;
- for (let j = 0;j < meshes.length; j++) {
+ for (let j = 0;j < pieces.length; j++) {
if (i === j)
continue;
- const gap = minimalGapVector(a.box, meshes[j].box);
+ const gap = minimalGapVector(a.box, pieces[j].box);
if (!nearestGap || gap.length() < nearestGap.length()) {
- nearest = meshes[j];
+ nearest = pieces[j];
nearestGap = gap;
}
}
- const fix = nearest && nearestGap ? ` Fix: shift "${a.name}" by [${nearestGap.x.toFixed(3)}, ${nearestGap.y.toFixed(3)}, ${nearestGap.z.toFixed(3)}] toward "${nearest.name}", or call snapTo(part, hostPart) to do it automatically.` : "";
+ const fix = a.welded ? ` Fix: one mesh moves and hides as one, so close the gap in the merged geometry, or author the component as its own part. It spans ${spanText(a.box)}.` : nearest && nearestGap ? ` Fix: shift "${a.name}" by [${nearestGap.x.toFixed(3)}, ${nearestGap.y.toFixed(3)}, ${nearestGap.z.toFixed(3)}] toward "${nearest.name}", or call snapTo(part, hostPart) to do it automatically.` : "";
const mismatch = declared ? ` It is named in a declared external support at Y=${declared.planeY.toFixed(3)}, but its bottom is at Y=${a.box.min.y.toFixed(3)}.` : "";
- floaters.push({ name: a.name, fix: fix + mismatch });
+ const name = a.welded ? `${a.welded.mesh} (welded component ${a.welded.index} of ${a.welded.of})` : a.name;
+ floaters.push({
+ name,
+ fix: fix + mismatch,
+ ...a.welded ? { welded: a.welded.mesh } : {}
+ });
}
+ collapseWeldedFloaters(floaters, pieces);
if (floaters.length > 0) {
const entries = floaters.slice(0, FLOATER_FIXES_SHOWN).map(({ name, fix }) => `${name}${fix ? ` —${fix}` : ""}`);
const rest = floaters.slice(FLOATER_FIXES_SHOWN);
@@ -35908,7 +36156,7 @@ function inspectSceneStructure(root, opts = {}) {
names.push(`+${rest.length - names.length} more`);
entries.push(`+${rest.length} more floating: ${names.join(", ")} — the same fix applies: shift each onto its nearest sibling, or call snapTo(part, hostPart).`);
}
- warnings.push(`Floating parts (no mesh overlap with any sibling, 2cm tol): ${entries.join(" | ")} — Coverage: drawn meshes only, at 2cm. A smaller gap reads as contact and a primitive welded into another mesh is never seen, so a silent pass is not a fit audit; measure contacts in the destination.`);
+ warnings.push(`Floating parts (no mesh overlap with any sibling, 2cm tol): ${entries.join(" | ")} — Coverage: drawn meshes only, at 2cm. Welded components inside one mesh are compared the same way, box to box. A smaller gap reads as contact, so a silent pass is not a fit audit; measure contacts in the destination.${budget.unsplit.length ? ` Over the split budget, so measured as one box: ${budget.unsplit.slice(0, FLOATER_NAMES_SHOWN).join(", ")}.` : ""}`);
}
if (supported.length > 0) {
const shown = supported.slice(0, FLOATER_NAMES_SHOWN);
@@ -35919,11 +36167,12 @@ function inspectSceneStructure(root, opts = {}) {
}
return warnings;
}
-var engineIO, TYPE_SCALAR = "SCALAR", TYPE_VEC2 = "VEC2", TYPE_VEC3 = "VEC3", TYPE_VEC4 = "VEC4", ACCESSOR_TYPES, GROUND_CONTACT_TOLERANCE = 0.02, GLTF_MIN_FILTER, GLTF_MAG_FILTER, GLTF_WRAP, REVIEW_CLIPS_EXTRAS_KEY = "kilnReviewClipsV1", REVIEW_CLIP_LIMITS, PALETTE_MIN = 4, INSTANCE_MIN = 5, FLOATER_FIXES_SHOWN = 6, FLOATER_NAMES_SHOWN = 24;
+var engineIO, TYPE_SCALAR = "SCALAR", TYPE_VEC2 = "VEC2", TYPE_VEC3 = "VEC3", TYPE_VEC4 = "VEC4", ACCESSOR_TYPES, GROUND_CONTACT_TOLERANCE = 0.02, GLTF_MIN_FILTER, GLTF_MAG_FILTER, GLTF_WRAP, REVIEW_CLIPS_EXTRAS_KEY = "kilnReviewClipsV1", REVIEW_CLIP_LIMITS, PALETTE_MIN = 4, INSTANCE_MIN = 5, spanText = (box) => `[${box.min.toArray().map((v) => v.toFixed(3)).join(", ")}] to [${box.max.toArray().map((v) => v.toFixed(3)).join(", ")}]`, FLOATER_FIXES_SHOWN = 6, FLOATER_NAMES_SHOWN = 24;
var init_render = __esm(() => {
init_requirements_context();
init_requirements_run();
init_requirements_report();
+ init_mesh_components();
init_skin_integrity();
init_authoring_diagnostic();
init_gltf_io();
@@ -35961,18 +36210,18 @@ var init_render = __esm(() => {
engineIO = createGltfIO;
ACCESSOR_TYPES = [TYPE_SCALAR, TYPE_VEC2, TYPE_VEC3, TYPE_VEC4];
GLTF_MIN_FILTER = {
- [THREE58.NearestFilter]: 9728,
- [THREE58.LinearFilter]: 9729,
- [THREE58.NearestMipmapNearestFilter]: 9984,
- [THREE58.LinearMipmapNearestFilter]: 9985,
- [THREE58.NearestMipmapLinearFilter]: 9986,
- [THREE58.LinearMipmapLinearFilter]: 9987
- };
- GLTF_MAG_FILTER = { [THREE58.NearestFilter]: 9728, [THREE58.LinearFilter]: 9729 };
+ [THREE59.NearestFilter]: 9728,
+ [THREE59.LinearFilter]: 9729,
+ [THREE59.NearestMipmapNearestFilter]: 9984,
+ [THREE59.LinearMipmapNearestFilter]: 9985,
+ [THREE59.NearestMipmapLinearFilter]: 9986,
+ [THREE59.LinearMipmapLinearFilter]: 9987
+ };
+ GLTF_MAG_FILTER = { [THREE59.NearestFilter]: 9728, [THREE59.LinearFilter]: 9729 };
GLTF_WRAP = {
- [THREE58.ClampToEdgeWrapping]: 33071,
- [THREE58.MirroredRepeatWrapping]: 33648,
- [THREE58.RepeatWrapping]: 10497
+ [THREE59.ClampToEdgeWrapping]: 33071,
+ [THREE59.MirroredRepeatWrapping]: 33648,
+ [THREE59.RepeatWrapping]: 10497
};
REVIEW_CLIP_LIMITS = {
clips: 32,
diff --git a/dist/mcp-engine.mjs b/dist/mcp-engine.mjs
index 7cec0453..6c9264eb 100644
--- a/dist/mcp-engine.mjs
+++ b/dist/mcp-engine.mjs
@@ -15350,9 +15350,135 @@ var init_lod2 = __esm(() => {
init_lod();
});
-// src/qa/part-connectivity.ts
+// src/qa/mesh-components.ts
import * as THREE16 from "three";
-function collectParts2(root, exempt, supports) {
+function find(parent, start) {
+ let root = start;
+ while (parent[root] !== root)
+ root = parent[root];
+ for (let at = start;parent[at] !== root; ) {
+ const next = parent[at];
+ parent[at] = root;
+ at = next;
+ }
+ return root;
+}
+function union(parent, a, b) {
+ const ra = find(parent, a);
+ const rb = find(parent, b);
+ if (ra < rb)
+ parent[rb] = ra;
+ else
+ parent[ra] = rb;
+}
+function walkComponents(geometry) {
+ const position = geometry.getAttribute("position");
+ const version = position?.version ?? 0;
+ const cached = cache.get(geometry);
+ if (cached && cached.version === version)
+ return cached;
+ const store = (result) => {
+ cache.set(geometry, result);
+ return result;
+ };
+ if (position?.itemSize !== 3 || position.count > MAX_SPLIT_VERTICES)
+ return store({ version, count: 0 });
+ const parent = new Int32Array(position.count);
+ const used = new Uint8Array(position.count);
+ for (let i = 0;i < parent.length; i++)
+ parent[i] = i;
+ const finite = new Uint8Array(position.count);
+ const bounds = new THREE16.Box3;
+ const point = new THREE16.Vector3;
+ for (let i = 0;i < position.count; i++) {
+ point.fromBufferAttribute(position, i);
+ if (Number.isFinite(point.x) && Number.isFinite(point.y) && Number.isFinite(point.z)) {
+ finite[i] = 1;
+ bounds.expandByPoint(point);
+ }
+ }
+ const index = geometry.getIndex();
+ const triangles = (index?.count ?? position.count) - (index?.count ?? position.count) % 3;
+ const corner = (at) => index ? index.getX(at) : at;
+ for (let at = 0;at < triangles; at += 3) {
+ const a = corner(at);
+ const b = corner(at + 1);
+ const c = corner(at + 2);
+ if (!finite[a] || !finite[b] || !finite[c])
+ continue;
+ used[a] = used[b] = used[c] = 1;
+ union(parent, a, b);
+ union(parent, b, c);
+ }
+ const size = bounds.isEmpty() ? new THREE16.Vector3 : bounds.getSize(new THREE16.Vector3);
+ const tolerance = Math.max(size.x, size.y, size.z) * 0.000001 || 1;
+ const seen = new Map;
+ for (let i = 0;i < position.count; i++) {
+ if (!used[i])
+ continue;
+ point.fromBufferAttribute(position, i).sub(bounds.min).divideScalar(tolerance);
+ const key = `${Math.round(point.x)},${Math.round(point.y)},${Math.round(point.z)}`;
+ const first = seen.get(key);
+ if (first === undefined)
+ seen.set(key, i);
+ else
+ union(parent, first, i);
+ }
+ const labels = new Int32Array(position.count).fill(-1);
+ const byRoot = new Map;
+ for (let i = 0;i < position.count; i++) {
+ if (!used[i])
+ continue;
+ const root = find(parent, i);
+ let label = byRoot.get(root);
+ if (label === undefined) {
+ label = byRoot.size;
+ byRoot.set(root, label);
+ if (byRoot.size > MAX_MESH_COMPONENTS)
+ return store({ version, count: byRoot.size });
+ }
+ labels[i] = label;
+ }
+ return store({ version, count: byRoot.size, labels });
+}
+function meshComponentBoxes(mesh, budget) {
+ const flagged = mesh;
+ if (flagged.isInstancedMesh || flagged.isSkinnedMesh || STANDS_APART_NAME.test(mesh.name) || (lodLevel(mesh) ?? 0) > 0)
+ return;
+ const geometry = mesh.geometry;
+ const position = geometry?.getAttribute("position");
+ if (!position)
+ return;
+ const walked = walkComponents(geometry);
+ if (!walked.labels || walked.count > 1 && budget.components + walked.count > MAX_SCENE_COMPONENTS) {
+ budget.unsplit.push(mesh.name || "(unnamed mesh)");
+ return;
+ }
+ if (walked.count < 1)
+ return;
+ if (walked.count > 1)
+ budget.components += walked.count;
+ const boxes = Array.from({ length: walked.count }, () => new THREE16.Box3);
+ const point = new THREE16.Vector3;
+ for (let i = 0;i < position.count; i++) {
+ const label = walked.labels[i];
+ if (label < 0)
+ continue;
+ point.fromBufferAttribute(position, i).applyMatrix4(mesh.matrixWorld);
+ boxes[label].expandByPoint(point);
+ }
+ return boxes;
+}
+var MAX_SPLIT_VERTICES = 262144, MAX_MESH_COMPONENTS = 256, MAX_SCENE_COMPONENTS = 4096, STANDS_APART_NAME, splitBudget = () => ({ components: 0, unsplit: [] }), cache;
+var init_mesh_components = __esm(() => {
+ init_lod2();
+ STANDS_APART_NAME = /(?:^|_)(?:leaf|leaves|foliage|frond|card|decal|billboard|petal)/i;
+ cache = new WeakMap;
+});
+
+// src/qa/part-connectivity.ts
+import * as THREE17 from "three";
+function collectParts2(root, exempt, budget, supports) {
const parts = [];
let lodExcluded = 0;
root.updateWorldMatrix(true, true);
@@ -15365,15 +15491,29 @@ function collectParts2(root, exempt, supports) {
lodExcluded++;
return;
}
- if (EXEMPT_NAME.test(name)) {
+ if (STANDS_APART_NAME.test(name)) {
exempt.push(name);
return;
}
- const box = new THREE16.Box3().setFromObject(mesh);
+ const box = new THREE17.Box3().setFromObject(mesh);
if (box.isEmpty())
return;
+ const components = meshComponentBoxes(mesh, budget);
+ if (components && components.length > 1) {
+ for (const [index, piece] of components.entries()) {
+ const support = restingSupport(mesh, piece.min.y, supports);
+ parts.push({
+ name: `${name} (welded component ${index + 1} of ${components.length})`,
+ node: name,
+ weldedOf: components.length,
+ box: piece,
+ ...support ? { support } : {}
+ });
+ }
+ return;
+ }
const support = restingSupport(mesh, box.min.y, supports);
- parts.push({ name, box, ...support ? { support } : {} });
+ parts.push({ name, node: name, box, ...support ? { support } : {} });
});
return { parts, lodExcluded };
}
@@ -15383,14 +15523,37 @@ function boxGap(a, b) {
const dz = Math.max(0, Math.max(a.min.z - b.max.z, b.min.z - a.max.z));
return Math.hypot(dx, dy, dz);
}
+function collapseWeldedGroups(groups) {
+ const byMesh = new Map;
+ const out = [];
+ for (const group of groups) {
+ const mesh = group.welded?.mesh;
+ const first = mesh === undefined ? undefined : byMesh.get(mesh);
+ if (mesh === undefined)
+ out.push(group);
+ else if (!first) {
+ byMesh.set(mesh, group);
+ out.push(group);
+ } else {
+ first.parts.push(...group.parts);
+ if (group.gap < first.gap) {
+ first.gap = group.gap;
+ first.welded = group.welded;
+ }
+ }
+ }
+ return out;
+}
function analyzePartConnectivity(root, supports) {
const exempt = [];
- const { parts, lodExcluded } = collectParts2(root, exempt, supports);
+ const budget = splitBudget();
+ const { parts, lodExcluded } = collectParts2(root, exempt, budget, supports);
const report = {
partsAnalyzed: parts.length,
mainComponentSize: parts.length,
exempt,
lodExcluded,
+ unsplit: budget.unsplit,
groups: []
};
if (parts.length < 2)
@@ -15441,15 +15604,25 @@ function analyzePartConnectivity(root, supports) {
if (index === mainIndex)
continue;
let gap = Number.POSITIVE_INFINITY;
+ let nearestMember = members[0];
+ let nearestMain = main[0];
for (const m of members) {
for (const b of main) {
- gap = Math.min(gap, boxGap(parts[m].box, parts[b].box));
+ const between = boxGap(parts[m].box, parts[b].box);
+ if (between < gap) {
+ gap = between;
+ nearestMember = m;
+ nearestMain = b;
+ }
}
}
+ const node = parts[members[0]].node;
+ const welded = members.every((m) => parts[m].weldedOf && parts[m].node === node);
const lowest = members.reduce((a, b) => parts[b].box.min.y < parts[a].box.min.y ? b : a);
const support = parts[lowest].support;
report.groups.push({
parts: members.map((m) => parts[m].name),
+ node,
gap: Math.round(gap * 1e6) / 1e6,
...support && members.every((m) => parts[m].support) ? {
externalSupport: {
@@ -15457,19 +15630,30 @@ function analyzePartConnectivity(root, supports) {
bottomY: Math.round(parts[lowest].box.min.y * 1e6) / 1e6,
tolerance: support.tolerance ?? CONNECTIVITY_TOLERANCE
}
+ } : welded ? {
+ welded: {
+ mesh: node,
+ components: parts[members[0]].weldedOf,
+ detached: locationOf(parts[nearestMember]),
+ nearest: locationOf(parts[nearestMain])
+ }
} : {}
});
}
+ report.groups = collapseWeldedGroups(report.groups);
report.groups.sort((a, b) => b.parts.length - a.parts.length || a.gap - b.gap);
return report;
}
function inspectPartConnectivity(scene, supports) {
- if (!(scene instanceof THREE16.Object3D))
+ if (!(scene instanceof THREE17.Object3D))
return [];
const report = analyzePartConnectivity(scene, supports);
const lodNote = report.lodExcluded === 1 ? " 1 part on an LOD level above 0 was not analyzed." : report.lodExcluded > 1 ? ` ${report.lodExcluded} parts on LOD levels above 0 were not analyzed.` : "";
+ const unsplitNote = report.unsplit.length ? ` Over the split budget, so measured as one box: ${report.unsplit.slice(0, 5).map((mesh) => JSON.stringify(mesh)).join(", ")}${report.unsplit.length > 5 ? ` and ${report.unsplit.length - 5} more` : ""}.` : "";
return report.groups.map((group) => {
- const listed = group.parts.map((p) => JSON.stringify(p)).join(", ");
+ const named = group.parts.slice(0, MAX_LISTED_PARTS).map((p) => JSON.stringify(p));
+ const unnamed = group.parts.length - named.length;
+ const listed = `${named.join(", ")}${unnamed > 0 ? `, +${unnamed} more` : ""}`;
const subject = group.parts.length === 1 ? `Part ${listed} is` : `A group of ${group.parts.length} parts (${listed}) is`;
const declared = group.externalSupport;
if (declared)
@@ -15479,7 +15663,7 @@ function inspectPartConnectivity(scene, supports) {
dimension: "visualQuality",
profile: "geometry.partConnectivity",
message: `${subject} separate from the largest component and rests on the support declared in requirements.externalSupport at Y=${declared.planeY.toFixed(3)} m (bottom at Y=${declared.bottomY.toFixed(3)} m). Information only: the support is composed outside this asset.${lodNote}`,
- affected: { node: group.parts[0] },
+ affected: { node: group.node },
measurement: {
name: "bottomToSupportPlane",
actual: declared.bottomY,
@@ -15488,13 +15672,36 @@ function inspectPartConnectivity(scene, supports) {
},
repairText: "No change is needed for a declared support. Remove the part from requirements.externalSupport if it should attach within this asset."
};
+ if (group.welded) {
+ const { mesh, components, detached, nearest } = group.welded;
+ const span = ({ min, max }) => `[${min.join(", ")}] to [${max.join(", ")}]`;
+ return {
+ code: "GEO_PART_CONNECTIVITY",
+ disposition: "observe",
+ dimension: "visualQuality",
+ profile: "geometry.partConnectivity",
+ message: `Mesh ${JSON.stringify(mesh)} is one drawn part, but ${group.parts.length} of its ${components} welded components ${group.parts.length === 1 ? "is" : "are"} separate from the largest component in the rest-pose bounding boxes of visible parts; the nearest box gap is ${group.gap.toFixed(3)} m. Nearest detached: ${span(detached)}. It is nearest to ${JSON.stringify(nearest.part)} at ${span(nearest)}. This may be intentional. Box adjacency is not physical attachment evidence: a gap under ${CONNECTIVITY_TOLERANCE} m reads as contact.${lodNote}${unsplitNote}`,
+ affected: { node: mesh },
+ measurement: {
+ name: "gapToMainComponent",
+ actual: group.gap,
+ expected: CONNECTIVITY_TOLERANCE,
+ breakdown: {
+ weldedComponents: components,
+ detachedComponents: group.parts.length,
+ ...report.lodExcluded ? { lodExcludedParts: report.lodExcluded } : {}
+ }
+ },
+ repairText: "Check whether the separation is intentional. One mesh moves and hides as one, so a component meant to attach needs its gap closed in the merged geometry; one meant to stand apart reads better as its own part."
+ };
+ }
return {
code: "GEO_PART_CONNECTIVITY",
disposition: "observe",
dimension: "visualQuality",
profile: "geometry.partConnectivity",
- message: `${subject} separate from the largest component in the rest-pose bounding boxes of visible parts; the nearest box gap is ${group.gap.toFixed(3)} m. This may be intentional. Box adjacency is not physical attachment evidence: a gap under ${CONNECTIVITY_TOLERANCE} m reads as contact, and primitives welded into one mesh form one box.${lodNote}`,
- affected: { node: group.parts[0] },
+ message: `${subject} separate from the largest component in the rest-pose bounding boxes of visible parts; the nearest box gap is ${group.gap.toFixed(3)} m. This may be intentional. Box adjacency is not physical attachment evidence: a gap under ${CONNECTIVITY_TOLERANCE} m reads as contact.${lodNote}${unsplitNote}`,
+ affected: { node: group.node },
measurement: {
name: "gapToMainComponent",
actual: group.gap,
@@ -15505,11 +15712,19 @@ function inspectPartConnectivity(scene, supports) {
};
});
}
-var CONNECTIVITY_TOLERANCE = 0.02, EXEMPT_NAME, PART_CONNECTIVITY_QA_RULE;
+var CONNECTIVITY_TOLERANCE = 0.02, MAX_LISTED_PARTS = 12, rounded = (v) => [
+ Math.round(v.x * 1e4) / 1e4,
+ Math.round(v.y * 1e4) / 1e4,
+ Math.round(v.z * 1e4) / 1e4
+], locationOf = (part) => ({
+ part: part.name,
+ min: rounded(part.box.min),
+ max: rounded(part.box.max)
+}), PART_CONNECTIVITY_QA_RULE;
var init_part_connectivity = __esm(() => {
init_lod2();
+ init_mesh_components();
init_registry();
- EXEMPT_NAME = /(?:^|_)(?:leaf|leaves|foliage|frond|card|decal|billboard|petal)/i;
PART_CONNECTIVITY_QA_RULE = Object.freeze({
id: "GEO_PART_CONNECTIVITY",
profile: "geometry.partConnectivity",
@@ -15524,7 +15739,7 @@ var init_part_connectivity = __esm(() => {
});
// src/geometry.ts
-import * as THREE17 from "three";
+import * as THREE18 from "three";
function finiteArray(values, label, length) {
const result = Array.from(values);
if (length !== undefined && result.length !== length)
@@ -15538,8 +15753,8 @@ function meshGeo(data) {
if (positions.length < 9 || positions.length % 3)
throw new Error("meshGeo positions: need at least three xyz vertices");
const count = positions.length / 3;
- const geometry = new THREE17.BufferGeometry;
- geometry.setAttribute("position", new THREE17.Float32BufferAttribute(positions, 3));
+ const geometry = new THREE18.BufferGeometry;
+ geometry.setAttribute("position", new THREE18.Float32BufferAttribute(positions, 3));
if (data.indices) {
const indices = Array.from(data.indices);
if (!indices.length || indices.length % 3)
@@ -15551,7 +15766,7 @@ function meshGeo(data) {
throw new Error("meshGeo: non-indexed positions must form complete triangles");
if (data.normals) {
const normals = finiteArray(data.normals, "meshGeo normals", count * 3);
- geometry.setAttribute("normal", new THREE17.Float32BufferAttribute(normals, 3));
+ geometry.setAttribute("normal", new THREE18.Float32BufferAttribute(normals, 3));
for (let i = 0;i < count; i++)
if (Math.hypot(normals[i * 3], normals[i * 3 + 1], normals[i * 3 + 2]) === 0)
throw new Error("meshGeo normals: zero-length normal");
@@ -15559,36 +15774,36 @@ function meshGeo(data) {
} else
geometry.computeVertexNormals();
if (data.uvs)
- geometry.setAttribute("uv", new THREE17.Float32BufferAttribute(finiteArray(data.uvs, "meshGeo uvs", count * 2), 2));
+ geometry.setAttribute("uv", new THREE18.Float32BufferAttribute(finiteArray(data.uvs, "meshGeo uvs", count * 2), 2));
if (data.tangents) {
const tangents = finiteArray(data.tangents, "meshGeo tangents", count * 4);
for (let i = 0;i < count; i++) {
if (Math.abs(Math.hypot(tangents[i * 4], tangents[i * 4 + 1], tangents[i * 4 + 2]) - 1) > 0.0001 || Math.abs(tangents[i * 4 + 3]) !== 1)
throw new Error("meshGeo tangents: expected unit xyz and handedness +1 or -1");
}
- geometry.setAttribute("tangent", new THREE17.Float32BufferAttribute(tangents, 4));
+ geometry.setAttribute("tangent", new THREE18.Float32BufferAttribute(tangents, 4));
}
geometry.computeBoundingBox();
geometry.computeBoundingSphere();
return geometry;
}
function boundsScale(bounds) {
- const size = bounds.getSize(new THREE17.Vector3);
+ const size = bounds.getSize(new THREE18.Vector3);
const scale = Math.hypot(size.x, size.y, size.z);
if (!Number.isFinite(scale))
throw new Error("Geometry position extent must be finite");
return scale;
}
function positionFrame(position) {
- const bounds = new THREE17.Box3;
- const point = new THREE17.Vector3;
+ const bounds = new THREE18.Box3;
+ const point = new THREE18.Vector3;
for (let i = 0;i < position.count; i++) {
point.fromBufferAttribute(position, i);
if ([point.x, point.y, point.z].every(Number.isFinite))
bounds.expandByPoint(point);
}
return {
- origin: bounds.isEmpty() ? new THREE17.Vector3 : bounds.min,
+ origin: bounds.isEmpty() ? new THREE18.Vector3 : bounds.min,
scale: boundsScale(bounds)
};
}
@@ -15628,11 +15843,11 @@ function geometryDiagnostics(geometry, tolerance) {
solid: { closed: false, manifold: true, orientation: "mixed", signedVolume: 0 }
};
let signedVolume = 0;
- const pa = new THREE17.Vector3, pb = new THREE17.Vector3, pc = new THREE17.Vector3;
+ const pa = new THREE18.Vector3, pb = new THREE18.Vector3, pc = new THREE18.Vector3;
const ids = [];
const points = new Map;
const finite = [];
- const point = new THREE17.Vector3;
+ const point = new THREE18.Vector3;
for (let i = 0;i < p.count; i++) {
point.fromBufferAttribute(p, i);
finite[i] = [point.x, point.y, point.z].every(Number.isFinite);
@@ -15645,7 +15860,7 @@ function geometryDiagnostics(geometry, tolerance) {
}
const indices = geometry.index ? Array.from(geometry.index.array) : Array.from({ length: p.count }, (_, i) => i);
const edges = new Map;
- const a = new THREE17.Vector3, b = new THREE17.Vector3, c = new THREE17.Vector3;
+ const a = new THREE18.Vector3, b = new THREE18.Vector3, c = new THREE18.Vector3;
for (let i = 0;i < indices.length; i += 3) {
result.triangles++;
const triangle = indices.slice(i, i + 3);
@@ -15730,8 +15945,8 @@ function parametricSurface(sample, options = {}) {
if (orientation !== "uv" && orientation !== "vu")
throw new Error("parametricSurface orientation must be uv or vu");
const positions = [], uvs = [], indices = [];
- const sampledBounds = new THREE17.Box3;
- const sampledPoint = new THREE17.Vector3;
+ const sampledBounds = new THREE18.Box3;
+ const sampledPoint = new THREE18.Vector3;
for (let j = 0;j <= nv; j++)
for (let i = 0;i <= nu; i++) {
const point = sample(u[0] + (u[1] - u[0]) * i / nu, v[0] + (v[1] - v[0]) * j / nv);
@@ -15773,8 +15988,8 @@ function parametricSurface(sample, options = {}) {
const sums = new Map;
for (let i = 0;i < normal.count; i++) {
const id = find(i);
- const sum = sums.get(id) ?? new THREE17.Vector3;
- sum.add(new THREE17.Vector3().fromBufferAttribute(normal, i));
+ const sum = sums.get(id) ?? new THREE18.Vector3;
+ sum.add(new THREE18.Vector3().fromBufferAttribute(normal, i));
sums.set(id, sum);
}
for (let i = 0;i < normal.count; i++) {
@@ -15799,13 +16014,13 @@ function creaseNormals(geometry, options = {}) {
const keys = [];
const faces = [];
for (let i = 0;i < position.count; i += 3) {
- const a = new THREE17.Vector3().fromBufferAttribute(position, i);
- const b = new THREE17.Vector3().fromBufferAttribute(position, i + 1);
- const c = new THREE17.Vector3().fromBufferAttribute(position, i + 2);
+ const a = new THREE18.Vector3().fromBufferAttribute(position, i);
+ const b = new THREE18.Vector3().fromBufferAttribute(position, i + 1);
+ const c = new THREE18.Vector3().fromBufferAttribute(position, i + 2);
const face = b.sub(a).divideScalar(scale).cross(c.sub(a).divideScalar(scale)).normalize();
faces.push(face);
for (let j = i;j < i + 3; j++) {
- const point = new THREE17.Vector3().fromBufferAttribute(position, j);
+ const point = new THREE18.Vector3().fromBufferAttribute(position, j);
if (![point.x, point.y, point.z].every(Number.isFinite))
throw new Error("creaseNormals positions must be finite");
const key = positionKey(point, frame.origin, tolerance);
@@ -15816,15 +16031,15 @@ function creaseNormals(geometry, options = {}) {
}
}
const normals = new Float32Array(position.count * 3);
- const threshold = Math.cos(THREE17.MathUtils.degToRad(angle));
+ const threshold = Math.cos(THREE18.MathUtils.degToRad(angle));
for (let i = 0;i < position.count; i++) {
- const face = faces[Math.floor(i / 3)], sum = new THREE17.Vector3;
+ const face = faces[Math.floor(i / 3)], sum = new THREE18.Vector3;
for (const other of adjacent.get(keys[i]))
if (face.dot(faces[other]) >= threshold - 0.000000000001)
sum.add(faces[other]);
sum.normalize().toArray(normals, i * 3);
}
- out.setAttribute("normal", new THREE17.BufferAttribute(normals, 3));
+ out.setAttribute("normal", new THREE18.BufferAttribute(normals, 3));
out.deleteAttribute("tangent");
out.computeBoundingBox();
out.computeBoundingSphere();
@@ -15836,14 +16051,14 @@ var init_geometry = __esm(() => {
});
// src/qa/open-surface-penetration.ts
-import * as THREE18 from "three";
+import * as THREE19 from "three";
function buildHierarchy(triangles) {
- const box = new THREE18.Box3;
+ const box = new THREE19.Box3;
for (const triangle of triangles)
box.union(triangle.box);
if (triangles.length <= 4)
return { box, triangles };
- const size = box.getSize(new THREE18.Vector3);
+ const size = box.getSize(new THREE19.Vector3);
const axis = size.x >= size.y && size.x >= size.z ? "x" : size.y >= size.z ? "y" : "z";
const center = (triangle) => triangle.box.min[axis] / 2 + triangle.box.max[axis] / 2;
const sorted = [...triangles].sort((a, b) => center(a) - center(b));
@@ -15867,15 +16082,15 @@ function worldTriangles(mesh) {
const id = index ? index.getX(at) : at;
if (!Number.isSafeInteger(id) || id < 0 || id >= position.count)
return null;
- const point = new THREE18.Vector3().fromBufferAttribute(position, id).applyMatrix4(mesh.matrixWorld);
+ const point = new THREE19.Vector3().fromBufferAttribute(position, id).applyMatrix4(mesh.matrixWorld);
return [point.x, point.y, point.z].every(Number.isFinite) ? point : null;
};
for (let i = 0;i < count; i += 3) {
const a = vertex(i), b = vertex(i + 1), c = vertex(i + 2);
if (!a || !b || !c)
return null;
- const triangle = new THREE18.Triangle(a, b, c);
- triangles.push({ triangle, box: new THREE18.Box3().setFromPoints([a, b, c]) });
+ const triangle = new THREE19.Triangle(a, b, c);
+ triangles.push({ triangle, box: new THREE19.Box3().setFromPoints([a, b, c]) });
}
return triangles.length ? triangles : null;
}
@@ -15976,7 +16191,7 @@ class Budget {
function nearestDistance(root, point, budget) {
let best = Infinity;
const stack = [root];
- const scratch = new THREE18.Vector3;
+ const scratch = new THREE19.Vector3;
while (stack.length) {
const node = stack.pop();
if (boxDistanceSquared(node.box, point) >= best)
@@ -15995,10 +16210,10 @@ function nearestDistance(root, point, budget) {
return Number.isFinite(best) ? Math.sqrt(best) : null;
}
function parity(root, point, direction, budget) {
- const ray = new THREE18.Ray(point, direction);
+ const ray = new THREE19.Ray(point, direction);
const stack = [root];
- const hit = new THREE18.Vector3;
- const barycentric = new THREE18.Vector3;
+ const hit = new THREE19.Vector3;
+ const barycentric = new THREE19.Vector3;
let crossings = 0;
while (stack.length) {
const node = stack.pop();
@@ -16046,7 +16261,7 @@ function analyzeOpenSurfacePenetration(root, contactTolerance = OPEN_SURFACE_CON
skipped: [],
penetrations: []
};
- if (!(root instanceof THREE18.Object3D))
+ if (!(root instanceof THREE19.Object3D))
return evidence;
const parts = collectParts3(root, evidence.skipped);
const open = parts.filter((part) => !part.closed);
@@ -16111,7 +16326,7 @@ function analyzeOpenSurfacePenetration(root, contactTolerance = OPEN_SURFACE_CON
}
const matrix = candidate.open.mesh.matrixWorld;
const limit = Math.min(position.count, MAX_SAMPLED_VERTICES);
- const vertex = new THREE18.Vector3;
+ const vertex = new THREE19.Vector3;
let depth = 0;
let penetrating = 0;
let tested = 0;
@@ -16241,9 +16456,9 @@ var init_open_surface_penetration = __esm(() => {
init_lod2();
init_registry();
PARITY_DIRECTIONS = Object.freeze([
- new THREE18.Vector3(1, 0, 0),
- new THREE18.Vector3(0.5773502691896258, 0.5773502691896258, 0.5773502691896258),
- new THREE18.Vector3(-0.2672612419124244, 0.5345224838248488, 0.8017837257372732)
+ new THREE19.Vector3(1, 0, 0),
+ new THREE19.Vector3(0.5773502691896258, 0.5773502691896258, 0.5773502691896258),
+ new THREE19.Vector3(-0.2672612419124244, 0.5345224838248488, 0.8017837257372732)
]);
OPEN_SURFACE_PENETRATION_QA_RULE = Object.freeze({
id: "GEO_OPEN_SURFACE_PENETRATION",
@@ -16259,9 +16474,9 @@ var init_open_surface_penetration = __esm(() => {
});
// src/sweep-analysis.ts
-import * as THREE19 from "three";
+import * as THREE20 from "three";
function segmentHitsTriangle(a, b, tri, epsilon) {
- const plane = new THREE19.Plane().setFromCoplanarPoints(tri.a, tri.b, tri.c);
+ const plane = new THREE20.Plane().setFromCoplanarPoints(tri.a, tri.b, tri.c);
if (plane.normal.lengthSq() === 0)
return false;
const da = plane.distanceToPoint(a), db = plane.distanceToPoint(b);
@@ -16299,7 +16514,7 @@ function recordSweepAnalysis(geometry, rings, profiles, closed) {
return result;
}
const unique = closed ? rings.length - 1 : rings.length;
- const centers = rings.map((ring) => ring.reduce((sum, p) => sum.add(p), new THREE19.Vector3).divideScalar(ring.length));
+ const centers = rings.map((ring) => ring.reduce((sum, p) => sum.add(p), new THREE20.Vector3).divideScalar(ring.length));
for (let i = closed ? 0 : 1;i < (closed ? unique : unique - 1); i++) {
const a = centers[(i - 1 + unique) % unique], b = centers[i], c = centers[(i + 1) % unique];
const u = b.clone().sub(a), v = c.clone().sub(b);
@@ -16313,17 +16528,17 @@ function recordSweepAnalysis(geometry, rings, profiles, closed) {
const triangles = new Map;
const faces = (index) => {
if (!triangles.has(index))
- triangles.set(index, THREE19.ShapeUtils.triangulateShape(profiles[index], []).map(([a, b, c]) => new THREE19.Triangle(rings[index][a], rings[index][b], rings[index][c])));
+ triangles.set(index, THREE20.ShapeUtils.triangulateShape(profiles[index], []).map(([a, b, c]) => new THREE20.Triangle(rings[index][a], rings[index][b], rings[index][c])));
return triangles.get(index);
};
for (let i = 1;i < rings.length; i++) {
- const boundsA = new THREE19.Box3().setFromPoints(rings[i - 1]);
- const boundsB = new THREE19.Box3().setFromPoints(rings[i]);
+ const boundsA = new THREE20.Box3().setFromPoints(rings[i - 1]);
+ const boundsB = new THREE20.Box3().setFromPoints(rings[i]);
if (!boundsA.intersectsBox(boundsB)) {
result.ringPairsChecked++;
continue;
}
- const epsilon = Math.max(boundsA.getSize(new THREE19.Vector3).length(), boundsB.getSize(new THREE19.Vector3).length()) * 0.0000000001;
+ const epsilon = Math.max(boundsA.getSize(new THREE20.Vector3).length(), boundsB.getSize(new THREE20.Vector3).length()) * 0.0000000001;
let hit = false;
pair:
for (const [a, b] of [
@@ -16478,7 +16693,7 @@ var init_open_shell = __esm(() => {
});
// src/qa/self-intersection.ts
-import * as THREE20 from "three";
+import * as THREE21 from "three";
function boxOverlapRatio2(a, b) {
const shared = Math.max(0, Math.min(a.max.x, b.max.x) - Math.max(a.min.x, b.min.x)) * Math.max(0, Math.min(a.max.y, b.max.y) - Math.max(a.min.y, b.min.y)) * Math.max(0, Math.min(a.max.z, b.max.z) - Math.max(a.min.z, b.min.z));
const ratio = shared / Math.min(boxVolume(a), boxVolume(b));
@@ -16529,8 +16744,8 @@ function collectParts4(root, skipped) {
const box = mesh.geometry.boundingBox.clone().applyMatrix4(mesh.matrixWorld);
if (box.isEmpty())
return;
- const center = box.getCenter(new THREE20.Vector3);
- const size = box.getSize(new THREE20.Vector3);
+ const center = box.getCenter(new THREE21.Vector3);
+ const size = box.getSize(new THREE21.Vector3);
const scale = Math.max(size.x, size.y, size.z);
if (![...box.min, ...box.max, scale].every(Number.isFinite) || !(scale > 0) || !Number.isFinite(mesh.matrixWorld.determinant()) || mesh.matrixWorld.determinant() === 0) {
skipped.push({
@@ -16562,7 +16777,7 @@ function meshToArrays(part) {
matrix.elements[12] -= center.x;
matrix.elements[13] -= center.y;
matrix.elements[14] -= center.z;
- const v = new THREE20.Vector3;
+ const v = new THREE21.Vector3;
const verts = new Float32Array(position.count * 3);
for (let i = 0;i < position.count; i++) {
v.set(position.getX(i), position.getY(i), position.getZ(i)).applyMatrix4(matrix).divideScalar(scale);
@@ -16910,7 +17125,7 @@ var init_self_intersection = __esm(() => {
});
// src/vehicle.ts
-import * as THREE21 from "three";
+import * as THREE22 from "three";
function assertId(value, name) {
if (!ID_PATTERN.test(value))
throw new TypeError(`${name} must be a stable identifier`);
@@ -16945,7 +17160,7 @@ function createTypedSocket(kind, input, parent) {
if (!input.position.every(Number.isFinite))
throw new TypeError(`${kind}.${id} position must be finite`);
const rotation = normalizedQuaternion(input.rotation);
- const node = new THREE21.Object3D;
+ const node = new THREE22.Object3D;
node.name = `Socket_${kind}_${id}`;
node.position.set(...input.position);
node.quaternion.set(...rotation);
@@ -16966,7 +17181,7 @@ function createTypedSocket(kind, input, parent) {
return node;
}
function createVehicleFrame(name, options = {}) {
- const root = new THREE21.Object3D;
+ const root = new THREE22.Object3D;
root.name = name;
stampSemanticMetadataV1(root, semantic2([KILN_SEMANTIC_ROLES.vehicleFrame, KILN_SEMANTIC_ROLES.vehicleForward], {
frames: [
@@ -16991,7 +17206,7 @@ function createVehicleFrame(name, options = {}) {
};
}
function cylinderZ(radius, width, segments = 16) {
- const geometry = new THREE21.CylinderGeometry(radius, radius, width, segments);
+ const geometry = new THREE22.CylinderGeometry(radius, radius, width, segments);
geometry.rotateX(Math.PI / 2);
return geometry;
}
@@ -17008,14 +17223,14 @@ function defaultTireGeometry(radius, width) {
if (width >= radius * 2)
throw new RangeError("default wheel tire width must be less than its diameter");
const tube = width / 2;
- return new THREE21.TorusGeometry(radius - tube, tube, 8, 20);
+ return new THREE22.TorusGeometry(radius - tube, tube, 8, 20);
}
function checkWheelGeometry(part, geometry, radius, width) {
const positions = geometry.getAttribute("position");
if (positions?.itemSize !== 3 || positions.count < 1 || positions.count > 2000000)
throw new RangeError(`wheel ${part} position must have 1..2000000 three-component samples.`);
- const bounds = new THREE21.Box3;
- const point = new THREE21.Vector3;
+ const bounds = new THREE22.Box3;
+ const point = new THREE22.Vector3;
let actualRadius = 0;
for (let i = 0;i < positions.count; i++) {
point.fromBufferAttribute(positions, i);
@@ -17025,7 +17240,7 @@ function checkWheelGeometry(part, geometry, radius, width) {
actualRadius = Math.max(actualRadius, Math.hypot(point.x, point.y));
}
const actualWidth = bounds.max.z - bounds.min.z;
- const center = bounds.getCenter(new THREE21.Vector3);
+ const center = bounds.getCenter(new THREE22.Vector3);
const tolerance = 0.00001 * Math.max(radius, width, actualRadius, actualWidth);
const differences = [];
if (Math.abs(actualRadius - radius) > tolerance)
@@ -17070,11 +17285,11 @@ function createWheelAssembly(name, materials, options) {
const index = assertId(String(options.index), "wheel index");
const key = `${options.side}.${index}`;
const parent = options.parent;
- const root = new THREE21.Object3D;
+ const root = new THREE22.Object3D;
root.name = `${name}_Assembly_${options.side}_${index}`;
let steeringPivot;
if (options.steering) {
- steeringPivot = new THREE21.Object3D;
+ steeringPivot = new THREE22.Object3D;
steeringPivot.name = `SteeringPivot_${options.side}_${index}`;
steeringPivot.position.set(...options.position ?? [0, 0, 0]);
stampSemanticMetadataV1(steeringPivot, semantic2([semanticRole(ROLE.steeringPivot, key)], {
@@ -17085,7 +17300,7 @@ function createWheelAssembly(name, materials, options) {
}));
root.add(steeringPivot);
}
- const spinPivot = new THREE21.Object3D;
+ const spinPivot = new THREE22.Object3D;
spinPivot.name = `WheelPivot_${options.side}_${index}`;
if (!steeringPivot)
spinPivot.position.set(...options.position ?? [0, 0, 0]);
@@ -17106,9 +17321,9 @@ function createWheelAssembly(name, materials, options) {
]
}));
(steeringPivot ?? root).add(spinPivot);
- const tire = new THREE21.Mesh(options.geometries?.tire ?? defaultTireGeometry(radius, width), materials.tire);
- const rim = new THREE21.Mesh(options.geometries?.rim ?? cylinderZ(rimRadius, rimWidth), materials.rim);
- const hub = new THREE21.Mesh(options.geometries?.hub ?? cylinderZ(hubRadius, hubWidth), materials.hub ?? materials.rim);
+ const tire = new THREE22.Mesh(options.geometries?.tire ?? defaultTireGeometry(radius, width), materials.tire);
+ const rim = new THREE22.Mesh(options.geometries?.rim ?? cylinderZ(rimRadius, rimWidth), materials.rim);
+ const hub = new THREE22.Mesh(options.geometries?.hub ?? cylinderZ(hubRadius, hubWidth), materials.hub ?? materials.rim);
tire.name = `Tire_${options.side}_${index}`;
rim.name = `Rim_${options.side}_${index}`;
hub.name = `Hub_${options.side}_${index}`;
@@ -17128,7 +17343,7 @@ function createWheelAssembly(name, materials, options) {
]
}));
spinPivot.add(tire, rim, hub);
- const contact = new THREE21.Object3D;
+ const contact = new THREE22.Object3D;
contact.name = `Contact_${options.side}_${index}`;
contact.position.y = -radius;
stampSemanticMetadataV1(contact, semantic2([semanticRole(ROLE.wheelContact, key), semanticRole(ROLE.contact, key)], {
@@ -17186,10 +17401,10 @@ function objectBoundsInFrame(object, frame) {
object.updateWorldMatrix(true, true);
frame.updateWorldMatrix(true, false);
const worldToFrame = frame.matrixWorld.clone().invert();
- const bounds = new THREE21.Box3;
+ const bounds = new THREE22.Box3;
let found = false;
object.traverse((node) => {
- if (!(node instanceof THREE21.Mesh) || !(node.geometry instanceof THREE21.BufferGeometry))
+ if (!(node instanceof THREE22.Mesh) || !(node.geometry instanceof THREE22.BufferGeometry))
return;
node.geometry.computeBoundingBox();
const local = node.geometry.boundingBox;
@@ -17199,7 +17414,7 @@ function objectBoundsInFrame(object, frame) {
for (const x of [local.min.x, local.max.x])
for (const y of [local.min.y, local.max.y])
for (const z of [local.min.z, local.max.z]) {
- bounds.expandByPoint(new THREE21.Vector3(x, y, z).applyMatrix4(matrix));
+ bounds.expandByPoint(new THREE22.Vector3(x, y, z).applyMatrix4(matrix));
found = true;
}
});
@@ -17211,9 +17426,9 @@ function dimensions(object, frame) {
const bounds = objectBoundsInFrame(object, frame);
if (!bounds)
return;
- const size = bounds.getSize(new THREE21.Vector3);
+ const size = bounds.getSize(new THREE22.Vector3);
return {
- center: bounds.getCenter(new THREE21.Vector3),
+ center: bounds.getCenter(new THREE22.Vector3),
radius: Math.max(size.x, size.y) / 2,
width: size.z
};
@@ -17223,7 +17438,7 @@ function resolved(source, id, root, pivot, parts) {
const tire = dimensions(parts.tire, pivot);
const rim = dimensions(parts.rim, pivot);
const hub = dimensions(parts.hub, pivot);
- const centerLocal = tire?.center ?? rim?.center ?? hub?.center ?? new THREE21.Vector3;
+ const centerLocal = tire?.center ?? rim?.center ?? hub?.center ?? new THREE22.Vector3;
const toWorld = (value) => value.clone().applyMatrix4(pivot.matrixWorld);
return {
id,
@@ -17238,11 +17453,11 @@ function resolved(source, id, root, pivot, parts) {
...parts.hub ? { hub: parts.hub } : {},
...parts.contact ? { contact: parts.contact } : {},
centerWorld: toWorld(centerLocal),
- pivotCenterWorld: new THREE21.Vector3().setFromMatrixPosition(pivot.matrixWorld),
+ pivotCenterWorld: new THREE22.Vector3().setFromMatrixPosition(pivot.matrixWorld),
...tire ? { tireCenterWorld: toWorld(tire.center) } : {},
...rim ? { rimCenterWorld: toWorld(rim.center) } : {},
...hub ? { hubCenterWorld: toWorld(hub.center) } : {},
- spinAxisWorld: new THREE21.Vector3(0, 0, 1).transformDirection(pivot.matrixWorld),
+ spinAxisWorld: new THREE22.Vector3(0, 0, 1).transformDirection(pivot.matrixWorld),
...tire ? { radius: tire.radius, width: tire.width } : {},
...rim ? { rimRadius: rim.radius, rimWidth: rim.width } : {},
...hub ? { hubRadius: hub.radius, hubWidth: hub.width } : {},
@@ -17579,7 +17794,7 @@ var EPSILON = 0.0000000001, DEFAULT_TOLERANCE = 0.000001, finiteVector = (value)
];
// src/qa/vehicle-advisory.ts
-import * as THREE22 from "three";
+import * as THREE23 from "three";
function advisory(context, value) {
return {
...value,
@@ -17653,7 +17868,7 @@ function isFender(node) {
return semanticRoles(node).some((role) => /(?:^|\.)(?:fender|wheel-arch)(?:\.|$)/i.test(role)) || /fender|wheel[ _.-]?arch/i.test(node.name);
}
function isChassisMesh(node) {
- if (!(node instanceof THREE22.Mesh) || isFender(node))
+ if (!(node instanceof THREE23.Mesh) || isFender(node))
return false;
return semanticRoles(node).some((role) => /^(?:vehicle\.)?(?:chassis|body|hull)(?:\.|$)/i.test(role)) || /chassis|vehicle[ _.-]?body|fuselage|hull/i.test(node.name);
}
@@ -17661,10 +17876,10 @@ function objectBoundsInFrame2(object, frame) {
object.updateWorldMatrix(true, true);
frame.updateWorldMatrix(true, false);
const worldToFrame = frame.matrixWorld.clone().invert();
- const bounds = new THREE22.Box3;
+ const bounds = new THREE23.Box3;
let found = false;
object.traverseVisible((part) => {
- if (!(part instanceof THREE22.Mesh) || !(part.geometry instanceof THREE22.BufferGeometry))
+ if (!(part instanceof THREE23.Mesh) || !(part.geometry instanceof THREE23.BufferGeometry))
return;
part.geometry.computeBoundingBox();
const box = part.geometry.boundingBox;
@@ -17674,7 +17889,7 @@ function objectBoundsInFrame2(object, frame) {
for (const x of [box.min.x, box.max.x])
for (const y of [box.min.y, box.max.y])
for (const z of [box.min.z, box.max.z]) {
- bounds.expandByPoint(new THREE22.Vector3(x, y, z).applyMatrix4(matrix));
+ bounds.expandByPoint(new THREE23.Vector3(x, y, z).applyMatrix4(matrix));
found = true;
}
});
@@ -17685,15 +17900,15 @@ function tuple2(value) {
}
function probeBox(id, root, bounds) {
root.updateWorldMatrix(true, false);
- const center = bounds.getCenter(new THREE22.Vector3).applyMatrix4(root.matrixWorld);
- const size = bounds.getSize(new THREE22.Vector3);
- const position = new THREE22.Vector3;
- const quaternion = new THREE22.Quaternion;
- const scale = new THREE22.Vector3;
+ const center = bounds.getCenter(new THREE23.Vector3).applyMatrix4(root.matrixWorld);
+ const size = bounds.getSize(new THREE23.Vector3);
+ const position = new THREE23.Vector3;
+ const quaternion = new THREE23.Quaternion;
+ const scale = new THREE23.Vector3;
root.matrixWorld.decompose(position, quaternion, scale);
- const xAxis = new THREE22.Vector3(1, 0, 0).applyQuaternion(quaternion).normalize();
- const yAxis = new THREE22.Vector3(0, 1, 0).applyQuaternion(quaternion).normalize();
- const zAxis = new THREE22.Vector3(0, 0, 1).applyQuaternion(quaternion).normalize();
+ const xAxis = new THREE23.Vector3(1, 0, 0).applyQuaternion(quaternion).normalize();
+ const yAxis = new THREE23.Vector3(0, 1, 0).applyQuaternion(quaternion).normalize();
+ const zAxis = new THREE23.Vector3(0, 0, 1).applyQuaternion(quaternion).normalize();
return createOrientedProbeBox3({
id,
frame: createProbeLocalFrame3({
@@ -17762,7 +17977,7 @@ function orientationFindings(context, root, intent) {
const bounds = wholeAssetBounds(root);
if (!bounds)
return [];
- const size = bounds.getSize(new THREE22.Vector3);
+ const size = bounds.getSize(new THREE23.Vector3);
const ratio = size.z / Math.max(size.x, 0.000000001);
if (ratio <= ORIENTATION_RATIO)
return [];
@@ -17806,13 +18021,13 @@ function weldedBoundaryEdges(root, loop) {
let triangleCount = 0;
const vertexKey = (point) => [point.x, point.y, point.z].map((value) => Math.round(value * 1e6)).join(",");
loop.traverseVisible((node) => {
- if (!(node instanceof THREE22.Mesh) || !(node.geometry instanceof THREE22.BufferGeometry))
+ if (!(node instanceof THREE23.Mesh) || !(node.geometry instanceof THREE23.BufferGeometry))
return;
const positions = node.geometry.getAttribute("position");
if (!positions)
return;
const matrix = inverse.clone().multiply(node.matrixWorld);
- const keys = Array.from({ length: positions.count }, (_, index) => vertexKey(new THREE22.Vector3().fromBufferAttribute(positions, index).applyMatrix4(matrix)));
+ const keys = Array.from({ length: positions.count }, (_, index) => vertexKey(new THREE23.Vector3().fromBufferAttribute(positions, index).applyMatrix4(matrix)));
const index = node.geometry.getIndex();
const indices = index ? Array.from(index.array, Number) : Array.from({ length: positions.count }, (_, value) => value);
for (let offset = 0;offset + 2 < indices.length; offset += 3) {
@@ -17882,7 +18097,7 @@ function trackProfileFindings(context, root, intent) {
const wheelBounds = objectBoundsInFrame2(roadWheel, root);
if (!wheelBounds)
continue;
- const center = wheelBounds.getCenter(new THREE22.Vector3);
+ const center = wheelBounds.getCenter(new THREE23.Vector3);
if (expanded.containsPoint(center))
continue;
const clamped = center.clone().clamp(expanded.min, expanded.max);
@@ -17908,7 +18123,7 @@ function trackProfileFindings(context, root, intent) {
return findings;
}
function inspectMobilityAdvisory(context) {
- if (!(context.scene instanceof THREE22.Object3D)) {
+ if (!(context.scene instanceof THREE23.Object3D)) {
return [];
}
const intent = context.mobility;
@@ -17955,7 +18170,7 @@ var init_vehicle_advisory = __esm(() => {
});
// src/qa/vehicle.ts
-import * as THREE23 from "three";
+import * as THREE24 from "three";
function finding3(context, value) {
return {
...value,
@@ -17972,7 +18187,7 @@ function rootAxis(root, axis) {
return axis.clone().transformDirection(root.matrixWorld);
}
function angleDegrees(a, b) {
- return THREE23.MathUtils.radToDeg(Math.acos(THREE23.MathUtils.clamp(a.clone().normalize().dot(b.clone().normalize()), -1, 1)));
+ return THREE24.MathUtils.radToDeg(Math.acos(THREE24.MathUtils.clamp(a.clone().normalize().dot(b.clone().normalize()), -1, 1)));
}
function isDescendant(node, ancestor) {
let current = node;
@@ -18020,7 +18235,7 @@ function wheelCountFindings(context, intent, wheels) {
}
function wheelGeometryFindings(context, root, wheels) {
const findings = [];
- const expectedAxle = rootAxis(root, new THREE23.Vector3(0, 0, 1));
+ const expectedAxle = rootAxis(root, new THREE24.Vector3(0, 0, 1));
for (const wheel of wheels) {
const disposition = componentDisposition(wheel);
const centerTolerance = Math.max(CENTER_MINIMUM, (wheel.radius ?? 0) * CENTER_RATIO);
@@ -18209,7 +18424,7 @@ function contactFindings(context, root, intent, wheels) {
function renderableMinYInRoot(rootInverse, node) {
let minimum = Infinity;
node.traverseVisible((part) => {
- if (!(part instanceof THREE23.Mesh) || !(part.geometry instanceof THREE23.BufferGeometry))
+ if (!(part instanceof THREE24.Mesh) || !(part.geometry instanceof THREE24.BufferGeometry))
return;
part.geometry.computeBoundingBox();
const bounds = part.geometry.boundingBox;
@@ -18219,7 +18434,7 @@ function renderableMinYInRoot(rootInverse, node) {
for (const x of [bounds.min.x, bounds.max.x]) {
for (const y of [bounds.min.y, bounds.max.y]) {
for (const z of [bounds.min.z, bounds.max.z]) {
- minimum = Math.min(minimum, new THREE23.Vector3(x, y, z).applyMatrix4(matrix).y);
+ minimum = Math.min(minimum, new THREE24.Vector3(x, y, z).applyMatrix4(matrix).y);
}
}
}
@@ -18237,7 +18452,7 @@ function supportContactFindings(context, root, intent) {
if (!isWheelContact && roles.some((role) => role.startsWith("contact."))) {
explicitContacts.push({
node,
- contactY: localPoint2(inverse, new THREE23.Vector3().setFromMatrixPosition(node.matrixWorld)).y,
+ contactY: localPoint2(inverse, new THREE24.Vector3().setFromMatrixPosition(node.matrixWorld)).y,
source: "contact"
});
}
@@ -18317,7 +18532,7 @@ function steeringFindings(context, root, intent, wheels) {
return [];
root.updateWorldMatrix(true, false);
const inverse = root.matrixWorld.clone().invert();
- const expectedAxis = rootAxis(root, new THREE23.Vector3(0, 1, 0));
+ const expectedAxis = rootAxis(root, new THREE24.Vector3(0, 1, 0));
const localCenters = wheels.map((wheel) => ({
wheel,
center: localPoint2(inverse, wheel.centerWorld)
@@ -18327,8 +18542,8 @@ function steeringFindings(context, root, intent, wheels) {
const findings = [];
for (const { wheel } of targets) {
const steering = wheel.steeringPivot;
- const centerDelta = steering ? localPoint2(inverse, new THREE23.Vector3().setFromMatrixPosition(steering.matrixWorld)).distanceTo(localPoint2(inverse, wheel.centerWorld)) : Infinity;
- const axisAngle = steering ? angleDegrees(new THREE23.Vector3(0, 1, 0).transformDirection(steering.matrixWorld), expectedAxis) : Infinity;
+ const centerDelta = steering ? localPoint2(inverse, new THREE24.Vector3().setFromMatrixPosition(steering.matrixWorld)).distanceTo(localPoint2(inverse, wheel.centerWorld)) : Infinity;
+ const axisAngle = steering ? angleDegrees(new THREE24.Vector3(0, 1, 0).transformDirection(steering.matrixWorld), expectedAxis) : Infinity;
if (!steering || !isDescendant(wheel.pivot, steering) || centerDelta > CENTER_MINIMUM || axisAngle > AXIS_TOLERANCE_DEGREES) {
const axisInvalid = axisAngle > AXIS_TOLERANCE_DEGREES;
findings.push(finding3(context, {
@@ -18383,14 +18598,14 @@ function propulsionFindings(context, root, intent) {
}
for (const component of candidates) {
const pivot = pivots.get(component.id);
- const box = new THREE23.Box3().setFromObject(component.node);
- const center = box.isEmpty() ? undefined : box.getCenter(new THREE23.Vector3);
- const pivotCenter = pivot ? new THREE23.Vector3().setFromMatrixPosition(pivot.matrixWorld) : undefined;
+ const box = new THREE24.Box3().setFromObject(component.node);
+ const center = box.isEmpty() ? undefined : box.getCenter(new THREE24.Vector3);
+ const pivotCenter = pivot ? new THREE24.Vector3().setFromMatrixPosition(pivot.matrixWorld) : undefined;
const delta = center && pivotCenter ? localPoint2(rootInverse, center).distanceTo(localPoint2(rootInverse, pivotCenter)) : Infinity;
const frameId = kind === "rotor" ? "propulsion-axis.+y" : "propulsion-axis.+x";
const axisFrame = readSemanticMetadataV1(pivot ?? component.node)?.frames.find((frame) => frame.id === frameId);
- const canonicalAxis = kind === "rotor" ? new THREE23.Vector3(0, 1, 0) : new THREE23.Vector3(1, 0, 0);
- const axisAngle = pivot && axisFrame ? angleDegrees(canonicalAxis.clone().applyQuaternion(new THREE23.Quaternion(...axisFrame.rotation)).transformDirection(pivot.matrixWorld), rootAxis(root, canonicalAxis)) : Infinity;
+ const canonicalAxis = kind === "rotor" ? new THREE24.Vector3(0, 1, 0) : new THREE24.Vector3(1, 0, 0);
+ const axisAngle = pivot && axisFrame ? angleDegrees(canonicalAxis.clone().applyQuaternion(new THREE24.Quaternion(...axisFrame.rotation)).transformDirection(pivot.matrixWorld), rootAxis(root, canonicalAxis)) : Infinity;
if (!pivot || !isDescendant(component.node, pivot) || delta > CENTER_MINIMUM || !axisFrame || axisAngle > AXIS_TOLERANCE_DEGREES) {
findings.push(finding3(context, {
code: "VEH_ROTOR_PIVOT",
@@ -18412,7 +18627,7 @@ function propulsionFindings(context, root, intent) {
return findings;
}
function inspectMobility(context) {
- if (!(context.scene instanceof THREE23.Object3D))
+ if (!(context.scene instanceof THREE24.Object3D))
return [];
const intent = context.mobility;
if (!intent)
@@ -18485,7 +18700,7 @@ var init_vehicle2 = __esm(() => {
});
// src/qa/vegetation.ts
-import * as THREE24 from "three";
+import * as THREE25 from "three";
function rolesOf3(node) {
return readSemanticMetadataV1(node)?.roles ?? [];
}
@@ -18501,22 +18716,22 @@ function pathOf(node, root) {
return names.reverse().join("/");
}
function localPoint3(rootInverse, node) {
- return node.getWorldPosition(new THREE24.Vector3).applyMatrix4(rootInverse);
+ return node.getWorldPosition(new THREE25.Vector3).applyMatrix4(rootInverse);
}
function meshLocalBox(mesh, rootInverse) {
- if (!(mesh.geometry instanceof THREE24.BufferGeometry))
+ if (!(mesh.geometry instanceof THREE25.BufferGeometry))
return;
mesh.geometry.computeBoundingBox();
const source = mesh.geometry.boundingBox;
if (!source || source.isEmpty())
return;
const base = rootInverse.clone().multiply(mesh.matrixWorld);
- const result = new THREE24.Box3;
- const count = mesh instanceof THREE24.InstancedMesh ? mesh.count : 1;
+ const result = new THREE25.Box3;
+ const count = mesh instanceof THREE25.InstancedMesh ? mesh.count : 1;
for (let index = 0;index < count; index++) {
const transform = base.clone();
- if (mesh instanceof THREE24.InstancedMesh) {
- const instance = new THREE24.Matrix4;
+ if (mesh instanceof THREE25.InstancedMesh) {
+ const instance = new THREE25.Matrix4;
mesh.getMatrixAt(index, instance);
transform.multiply(instance);
}
@@ -18529,7 +18744,7 @@ function collectRenderableBounds(root) {
const inverse = root.matrixWorld.clone().invert();
const values = [];
root.traverseVisible((node) => {
- if (!(node instanceof THREE24.Mesh))
+ if (!(node instanceof THREE25.Mesh))
return;
const box = meshLocalBox(node, inverse);
if (!box)
@@ -18547,7 +18762,7 @@ function vegetationIntent(intent) {
}
function inspectFoliageContact(context) {
const trusted = context.foliage;
- if (!trusted?.grounded || !(context.scene instanceof THREE24.Object3D))
+ if (!trusted?.grounded || !(context.scene instanceof THREE25.Object3D))
return [];
const planeY = context.groundPlaneY ?? 0;
const root = context.scene;
@@ -18585,7 +18800,7 @@ function inspectFoliageContact(context) {
}
const findings = [];
for (const contact of contacts) {
- const contactPoint = contact.frameTranslation ? new THREE24.Vector3(...contact.frameTranslation).applyMatrix4(contact.node.matrixWorld).applyMatrix4(inverse) : localPoint3(inverse, contact.node);
+ const contactPoint = contact.frameTranslation ? new THREE25.Vector3(...contact.frameTranslation).applyMatrix4(contact.node.matrixWorld).applyMatrix4(inverse) : localPoint3(inverse, contact.node);
const y = contactPoint.y;
const offset = y - planeY;
if (Math.abs(offset) <= VEGETATION_CONTACT_TOLERANCE_METERS)
@@ -18614,7 +18829,7 @@ function inspectFoliageContact(context) {
for (const support of semanticSupports) {
let minimumY = Infinity;
support.traverseVisible((node) => {
- if (!(node instanceof THREE24.Mesh))
+ if (!(node instanceof THREE25.Mesh))
return;
const box = meshLocalBox(node, inverse);
if (box)
@@ -18642,25 +18857,25 @@ function inspectFoliageContact(context) {
return findings;
}
function materialNames(node) {
- if (!(node instanceof THREE24.Mesh))
+ if (!(node instanceof THREE25.Mesh))
return [];
const materials = Array.isArray(node.material) ? node.material : [node.material];
return materials.filter(Boolean).map((material) => material.name ?? "");
}
function inspectFoliageScope(context) {
const trusted = context.foliage;
- if (!trusted?.standalone || !(context.scene instanceof THREE24.Object3D))
+ if (!trusted?.standalone || !(context.scene instanceof THREE25.Object3D))
return [];
const root = context.scene;
const renderables = collectRenderableBounds(root);
if (renderables.length === 0)
return [];
- const overall = renderables.reduce((box, value) => box.union(value.box), new THREE24.Box3);
- const overallSize = overall.getSize(new THREE24.Vector3);
+ const overall = renderables.reduce((box, value) => box.union(value.box), new THREE25.Box3);
+ const overallSize = overall.getSize(new THREE25.Vector3);
const findings = [];
for (const value of renderables) {
- const size = value.box.getSize(new THREE24.Vector3);
- const center = value.box.getCenter(new THREE24.Vector3);
+ const size = value.box.getSize(new THREE25.Vector3);
+ const center = value.box.getCenter(new THREE25.Vector3);
const names = [value.node.name, ...value.roles];
const nameEvidence = names.some((name) => CLUTTER_NAME.test(name));
const roleEvidence = value.roles.some((role) => /(?:terrain|soil|rock|pot|planter|base)/i.test(role));
@@ -18697,8 +18912,8 @@ function inspectFoliageScope(context) {
function unionVolume(boxes) {
if (boxes.length === 0)
return 0;
- const union = boxes.reduce((result, box) => result.union(box), new THREE24.Box3);
- const size = union.getSize(new THREE24.Vector3);
+ const union = boxes.reduce((result, box) => result.union(box), new THREE25.Box3);
+ const size = union.getSize(new THREE25.Vector3);
return size.x * size.y * size.z;
}
function projectedOccupancy(boxes, axes) {
@@ -18768,7 +18983,7 @@ function boxDistanceToPoint(box, point) {
function endpointRadius(position, axis, axisValue, tolerance, scale) {
const radialAxes = [0, 1, 2].filter((value) => value !== axis);
const points = [];
- const point = new THREE24.Vector3;
+ const point = new THREE25.Vector3;
for (let index = 0;index < position.count; index++) {
point.fromBufferAttribute(position, index);
if (Math.abs(point.getComponent(axis) - axisValue) <= tolerance)
@@ -18776,7 +18991,7 @@ function endpointRadius(position, axis, axisValue, tolerance, scale) {
}
if (points.length === 0)
return;
- const center = new THREE24.Vector3;
+ const center = new THREE25.Vector3;
center.setComponent(axis, axisValue);
for (const radialAxis of radialAxes) {
center.setComponent(radialAxis, points.reduce((sum, value) => sum + value.getComponent(radialAxis), 0) / points.length);
@@ -18790,7 +19005,7 @@ function endpointRadius(position, axis, axisValue, tolerance, scale) {
return { center, radius };
}
function growthNodeMeasurement(root, candidate, allCandidates, band) {
- if (!(candidate.node instanceof THREE24.Mesh))
+ if (!(candidate.node instanceof THREE25.Mesh))
return;
const geometry = candidate.node.geometry;
const position = geometry.getAttribute("position");
@@ -18802,9 +19017,9 @@ function growthNodeMeasurement(root, candidate, allCandidates, band) {
return;
root.updateWorldMatrix(true, true);
const relative = root.matrixWorld.clone().invert().multiply(candidate.node.matrixWorld);
- const relativeScale = new THREE24.Vector3;
- relative.decompose(new THREE24.Vector3, new THREE24.Quaternion, relativeScale);
- const size = geometryBox.getSize(new THREE24.Vector3);
+ const relativeScale = new THREE25.Vector3;
+ relative.decompose(new THREE25.Vector3, new THREE25.Quaternion, relativeScale);
+ const size = geometryBox.getSize(new THREE25.Vector3);
const scaledSizes = [
Math.abs(size.x * relativeScale.x),
Math.abs(size.y * relativeScale.y),
@@ -18871,7 +19086,7 @@ function measureFoliageGrowth(foliage, root) {
};
}
function inspectFoliageGrowth(context) {
- if (!context.foliage || !(context.scene instanceof THREE24.Object3D))
+ if (!context.foliage || !(context.scene instanceof THREE25.Object3D))
return [];
const measured = measureFoliageGrowth(context.foliage, context.scene);
const findings = [];
@@ -18922,7 +19137,7 @@ function measureVegetationFoliageAttachment(root) {
const support = renderables.filter((value) => roleOrNameSource(value, TRUNK_PATTERNS) || roleOrNameSource(value, BRANCH_PATTERNS));
const foliage = renderables.filter((value) => roleOrNameSource(value, CANOPY_PATTERNS));
const clusters = foliage.map((value) => {
- const size = value.box.getSize(new THREE24.Vector3);
+ const size = value.box.getSize(new THREE25.Vector3);
const threshold = stable7(Math.max(0.03, Math.min(0.18, size.length() * 0.12)));
const nearest = support.map((candidate) => ({ candidate, gap: distanceBetweenBoxes(value.box, candidate.box) })).sort((a, b) => a.gap - b.gap || (a.candidate.node.name || "").localeCompare(b.candidate.node.name || ""))[0];
const source = roleOrNameSource(value, CANOPY_PATTERNS) ?? "fallback";
@@ -18945,7 +19160,7 @@ function measureVegetationFoliageAttachment(root) {
};
}
function inspectFoliageAttachment(context) {
- if (!context.foliage || !(context.scene instanceof THREE24.Object3D))
+ if (!context.foliage || !(context.scene instanceof THREE25.Object3D))
return [];
return measureVegetationFoliageAttachment(context.scene).clusters.filter((cluster) => cluster.detached).map((cluster) => finding4(context, {
code: "VEG_FOLIAGE_DETACHED",
@@ -18965,9 +19180,9 @@ function inspectFoliageAttachment(context) {
}
function relativeTransformSignature(root, node) {
const matrix = root.matrixWorld.clone().invert().multiply(node.matrixWorld);
- const scale = new THREE24.Vector3;
- const quaternion = new THREE24.Quaternion;
- matrix.decompose(new THREE24.Vector3, quaternion, scale);
+ const scale = new THREE25.Vector3;
+ const quaternion = new THREE25.Quaternion;
+ matrix.decompose(new THREE25.Vector3, quaternion, scale);
if (quaternion.w < 0)
quaternion.set(-quaternion.x, -quaternion.y, -quaternion.z, -quaternion.w);
const values = [...scale.toArray(), ...quaternion.toArray()].map((value) => stable7(value));
@@ -18988,9 +19203,9 @@ function measureFoliageRepetition(requirements, root) {
nodes: values.map((value) => value.node.name || "foliage-cluster").sort()
})).sort((a, b) => a.signature.localeCompare(b.signature));
const supports = collectRenderableBounds(root).filter((value) => roleOrNameSource(value, TRUNK_PATTERNS));
- const centerBox = supports.reduce((box, value) => box.union(value.box), new THREE24.Box3);
- const centers = foliage.map((value) => value.box.getCenter(new THREE24.Vector3));
- const center = centerBox.isEmpty() ? centers.reduce((result, value) => result.add(value), new THREE24.Vector3).multiplyScalar(centers.length > 0 ? 1 / centers.length : 0) : centerBox.getCenter(new THREE24.Vector3);
+ const centerBox = supports.reduce((box, value) => box.union(value.box), new THREE25.Box3);
+ const centers = foliage.map((value) => value.box.getCenter(new THREE25.Vector3));
+ const center = centerBox.isEmpty() ? centers.reduce((result, value) => result.add(value), new THREE25.Vector3).multiplyScalar(centers.length > 0 ? 1 / centers.length : 0) : centerBox.getCenter(new THREE25.Vector3);
const radial = centers.map((value) => ({
angle: Math.atan2(value.z - center.z, value.x - center.x),
radius: Math.hypot(value.x - center.x, value.z - center.z)
@@ -19025,7 +19240,7 @@ function measureFoliageRepetition(requirements, root) {
};
}
function inspectFoliageRepetition(context) {
- if (!context.foliage || !(context.scene instanceof THREE24.Object3D))
+ if (!context.foliage || !(context.scene instanceof THREE25.Object3D))
return [];
const measured = measureFoliageRepetition(context.foliage, context.scene);
if (measured.suppressedForTopiary)
@@ -19083,7 +19298,7 @@ function measureFoliageCanopy(profile, root) {
}
function inspectFoliageCanopy(context) {
const trusted = context.foliage;
- if (!trusted?.canopyProfile || !(context.scene instanceof THREE24.Object3D))
+ if (!trusted?.canopyProfile || !(context.scene instanceof THREE25.Object3D))
return [];
const measurements = measureFoliageCanopy(trusted.canopyProfile, context.scene);
const bands = PROFILE_BANDS[measurements.profile];
@@ -19144,7 +19359,7 @@ function inspectFoliageCanopy(context) {
return findings;
}
function materialValue(material) {
- if (!(material instanceof THREE24.MeshStandardMaterial) && !(material instanceof THREE24.MeshBasicMaterial)) {
+ if (!(material instanceof THREE25.MeshStandardMaterial) && !(material instanceof THREE25.MeshBasicMaterial)) {
return;
}
const color = material.color;
@@ -19154,11 +19369,11 @@ function measureFoliageMaterials(mode, root) {
const values = [];
let foliageNodeCount = 0;
root.traverseVisible((node) => {
- if (!(node instanceof THREE24.Mesh))
+ if (!(node instanceof THREE25.Mesh))
return;
const bounds = {
node,
- box: new THREE24.Box3,
+ box: new THREE25.Box3,
roles: rolesOf3(node),
source: rolesOf3(node).length > 0 ? "semantic" : "fallback"
};
@@ -19185,7 +19400,7 @@ function measureFoliageMaterials(mode, root) {
};
}
function inspectFoliageMaterial(context) {
- if (!context.foliage || !(context.scene instanceof THREE24.Object3D))
+ if (!context.foliage || !(context.scene instanceof THREE25.Object3D))
return [];
if (!context.materialMode)
return [];
@@ -19341,7 +19556,7 @@ var init_vegetation = __esm(() => {
});
// src/skin-binding.ts
-import * as THREE25 from "three";
+import * as THREE26 from "three";
function topRoot(node) {
while (node.parent)
node = node.parent;
@@ -19361,7 +19576,7 @@ function createSkinnedPart(name, geometry, material, options) {
}
}
function buildSkinnedPart(name, geometry, material, options) {
- if (typeof name !== "string" || !name.trim() || THREE25.PropertyBinding.sanitizeNodeName(name) !== name)
+ if (typeof name !== "string" || !name.trim() || THREE26.PropertyBinding.sanitizeNodeName(name) !== name)
throw new TypeError("createSkinnedPart name must be nonempty and free of animation binding punctuation.");
if (!geometry?.isBufferGeometry)
throw new TypeError("createSkinnedPart requires BufferGeometry.");
@@ -19379,7 +19594,7 @@ function buildSkinnedPart(name, geometry, material, options) {
for (const bone of bones) {
if (!bone?.isBone || topRoot(bone) !== top || members.has(bone))
throw new TypeError("createSkinnedPart bones must be distinct Bones in the parent hierarchy.");
- if (!bone.name || THREE25.PropertyBinding.sanitizeNodeName(bone.name) !== bone.name || names.has(bone.name))
+ if (!bone.name || THREE26.PropertyBinding.sanitizeNodeName(bone.name) !== bone.name || names.has(bone.name))
throw new TypeError("createSkinnedPart bones need unique animation-safe names.");
members.add(bone);
names.add(bone.name);
@@ -19426,9 +19641,9 @@ function buildSkinnedPart(name, geometry, material, options) {
for (const key of ["position", "rotation", "scale"])
if (options[key] !== undefined)
assertFiniteTriple(`createSkinnedPart ${key}`, options[key]);
- const local = new THREE25.Matrix4().compose(new THREE25.Vector3(...options.position ?? [0, 0, 0]), new THREE25.Quaternion().setFromEuler(new THREE25.Euler(...(options.rotation ?? [0, 0, 0]).map(THREE25.MathUtils.degToRad))), new THREE25.Vector3(...options.scale ?? [1, 1, 1]));
+ const local = new THREE26.Matrix4().compose(new THREE26.Vector3(...options.position ?? [0, 0, 0]), new THREE26.Quaternion().setFromEuler(new THREE26.Euler(...(options.rotation ?? [0, 0, 0]).map(THREE26.MathUtils.degToRad))), new THREE26.Vector3(...options.scale ?? [1, 1, 1]));
top.updateWorldMatrix(true, true);
- const bind = new THREE25.Matrix4().multiplyMatrices(parent.matrixWorld, local);
+ const bind = new THREE26.Matrix4().multiplyMatrices(parent.matrixWorld, local);
assertMatrix(bind, "mesh");
for (const bone of bones) {
assertMatrix(bone.matrixWorld, `bone ${bone.name}`);
@@ -19443,19 +19658,19 @@ function buildSkinnedPart(name, geometry, material, options) {
}
}
const owned = geometry.clone();
- owned.setAttribute("skinIndex", new THREE25.BufferAttribute(skinIndices, 4));
- owned.setAttribute("skinWeight", new THREE25.BufferAttribute(skinWeights, 4));
- const mesh = new THREE25.SkinnedMesh(owned, Array.isArray(material) ? [...material] : material);
+ owned.setAttribute("skinIndex", new THREE26.BufferAttribute(skinIndices, 4));
+ owned.setAttribute("skinWeight", new THREE26.BufferAttribute(skinWeights, 4));
+ const mesh = new THREE26.SkinnedMesh(owned, Array.isArray(material) ? [...material] : material);
mesh.name = `Mesh_${name}`;
if (options.position)
mesh.position.fromArray(options.position);
if (options.rotation)
- mesh.rotation.set(...options.rotation.map(THREE25.MathUtils.degToRad));
+ mesh.rotation.set(...options.rotation.map(THREE26.MathUtils.degToRad));
if (options.scale)
mesh.scale.fromArray(options.scale);
if (options.semantic)
stampSemanticMetadataV1(mesh, options.semantic);
- const skeleton = new THREE25.Skeleton([...bones], bones.map((bone) => bone.matrixWorld.clone().invert()));
+ const skeleton = new THREE26.Skeleton([...bones], bones.map((bone) => bone.matrixWorld.clone().invert()));
mesh.bind(skeleton, bind);
parent.add(mesh);
mesh.updateWorldMatrix(true, false);
@@ -19468,7 +19683,7 @@ var init_skin_binding = __esm(() => {
});
// src/character.ts
-import * as THREE26 from "three";
+import * as THREE27 from "three";
function validRole(value) {
return typeof value === "string" && /^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)*$/.test(value);
}
@@ -19749,7 +19964,7 @@ function readCharacterRigGraphV1(target) {
return result.valid ? result.value : undefined;
}
function axisQuaternion(from, to) {
- const value = new THREE26.Quaternion().setFromUnitVectors(new THREE26.Vector3(...from), new THREE26.Vector3(...to));
+ const value = new THREE27.Quaternion().setFromUnitVectors(new THREE27.Vector3(...from), new THREE27.Vector3(...to));
return [value.x, value.y, value.z, value.w];
}
function stampCharacterJointDescriptorV1(target, input) {
@@ -19854,7 +20069,7 @@ function createJointChain(chainName, segments, options = {}) {
endEffector: segment.endEffector,
contact: segment.contact
});
- const node = new THREE26.Object3D;
+ const node = new THREE27.Object3D;
node.name = characterJointNodeName(chainName, segment.role);
node.position.fromArray(descriptor.rest.translation);
node.quaternion.fromArray(descriptor.rest.rotation);
@@ -19934,7 +20149,7 @@ function buildBoneChain(chainName, segments, options = {}) {
return descriptor;
});
const nodes = descriptors.map((descriptor) => {
- const node = new THREE26.Bone;
+ const node = new THREE27.Bone;
node.name = characterJointNodeName(chainName, descriptor.role);
node.position.fromArray(descriptor.rest.translation);
node.quaternion.fromArray(descriptor.rest.rotation);
@@ -20123,7 +20338,7 @@ var init_character_repairs = __esm(() => {
});
// src/qa/character.ts
-import * as THREE27 from "three";
+import * as THREE28 from "three";
function isClipLike(value) {
if (typeof value !== "object" || value === null)
return false;
@@ -20361,7 +20576,7 @@ function contactFindings2(input, root) {
const planeY = input.groundPlaneY ?? 0;
const findings = [];
for (const contact of contacts) {
- const point = contact.node.getWorldPosition(new THREE27.Vector3).applyMatrix4(rootInverse);
+ const point = contact.node.getWorldPosition(new THREE28.Vector3).applyMatrix4(rootInverse);
const offset = point.y - planeY;
if (offset > tolerance) {
findings.push(block(input, "CHAR_CONTACT_FLOATING", `Ground contact ${contact.descriptor.role} is ${offset.toFixed(6)} m above asset-local ground.`, {
@@ -20626,13 +20841,13 @@ function declaredHeldItem(nodes) {
function characterJointScale(root) {
root.updateMatrixWorld(true);
const inverse = root.matrixWorld.clone().invert();
- const bounds = new THREE27.Box3;
+ const bounds = new THREE28.Box3;
for (const joint of collectCharacterJointNodes(root)) {
- bounds.expandByPoint(joint.node.getWorldPosition(new THREE27.Vector3).applyMatrix4(inverse));
+ bounds.expandByPoint(joint.node.getWorldPosition(new THREE28.Vector3).applyMatrix4(inverse));
}
if (bounds.isEmpty())
return 1;
- const size = bounds.getSize(new THREE27.Vector3);
+ const size = bounds.getSize(new THREE28.Vector3);
return Math.max(size.x, size.y, size.z, 1);
}
function heldItemMotionFindings(input, root, clips) {
@@ -20668,8 +20883,8 @@ function heldItemMotionFindings(input, root, clips) {
if (!cloneItem || !cloneAttachment)
continue;
const inverse = clone.matrixWorld.clone().invert();
- const itemPoint = cloneItem.getWorldPosition(new THREE27.Vector3).applyMatrix4(inverse);
- const gripPoint = cloneAttachment.getWorldPosition(new THREE27.Vector3).applyMatrix4(inverse);
+ const itemPoint = cloneItem.getWorldPosition(new THREE28.Vector3).applyMatrix4(inverse);
+ const gripPoint = cloneAttachment.getWorldPosition(new THREE28.Vector3).applyMatrix4(inverse);
const distance = itemPoint.distanceTo(gripPoint);
baseline ??= distance;
const drift = Math.abs(distance - baseline);
@@ -20702,7 +20917,7 @@ function heldItemMotionFindings(input, root, clips) {
function inspectRig(context) {
if (!context.rig)
return [];
- const root = context.scene instanceof THREE27.Object3D ? context.scene : undefined;
+ const root = context.scene instanceof THREE28.Object3D ? context.scene : undefined;
const clips = (context.clips ?? []).filter(isClipLike);
const findings = [];
if (root) {
@@ -20752,7 +20967,7 @@ var init_character2 = __esm(() => {
});
// src/qa/character-advisory.ts
-import * as THREE28 from "three";
+import * as THREE29 from "three";
function isClipLike2(value) {
if (typeof value !== "object" || value === null)
return false;
@@ -20775,16 +20990,16 @@ function jointPoints(root) {
const inverse = rootInverse(root);
return collectCharacterJointNodes(root).map((evidence) => ({
evidence,
- local: evidence.node.getWorldPosition(new THREE28.Vector3).applyMatrix4(inverse)
+ local: evidence.node.getWorldPosition(new THREE29.Vector3).applyMatrix4(inverse)
}));
}
function characterScale(points) {
if (points.length === 0)
return 1;
- const bounds = new THREE28.Box3;
+ const bounds = new THREE29.Box3;
for (const point of points)
bounds.expandByPoint(point.local);
- const size = bounds.getSize(new THREE28.Vector3);
+ const size = bounds.getSize(new THREE29.Vector3);
return Math.max(size.x, size.y, size.z, 1);
}
function pairKey(descriptor) {
@@ -20883,12 +21098,12 @@ function restChainFindings(context, root) {
}
function forwardMarkerFindings(context, root) {
root.updateMatrixWorld(true);
- const expected = new THREE28.Vector3(1, 0, 0).transformDirection(root.matrixWorld);
+ const expected = new THREE29.Vector3(1, 0, 0).transformDirection(root.matrixWorld);
const markers = collectCharacterJointNodes(root).filter((joint) => /(?:^|[._-])(?:toe|muzzle|head)(?:$|[._-])/i.test(joint.descriptor.role));
return markers.flatMap((marker) => {
- const quaternion = marker.node.getWorldQuaternion(new THREE28.Quaternion);
- const actual = new THREE28.Vector3(...marker.descriptor.localForwardAxis).applyQuaternion(quaternion).normalize();
- const angle = THREE28.MathUtils.radToDeg(Math.acos(THREE28.MathUtils.clamp(actual.dot(expected), -1, 1)));
+ const quaternion = marker.node.getWorldQuaternion(new THREE29.Quaternion);
+ const actual = new THREE29.Vector3(...marker.descriptor.localForwardAxis).applyQuaternion(quaternion).normalize();
+ const angle = THREE29.MathUtils.radToDeg(Math.acos(THREE29.MathUtils.clamp(actual.dot(expected), -1, 1)));
if (angle <= FORWARD_ANGLE_DEGREES)
return [];
return [
@@ -20942,7 +21157,7 @@ function sampleClip(root, clip) {
byRole: new Map(collectCharacterJointNodes(clone).map((evidence) => [
evidence.descriptor.role,
{
- point: evidence.node.getWorldPosition(new THREE28.Vector3).applyMatrix4(inverse),
+ point: evidence.node.getWorldPosition(new THREE29.Vector3).applyMatrix4(inverse),
evidence
}
]))
@@ -21054,12 +21269,12 @@ function phaseOppositionFindings(context, root, clips) {
return findings;
}
function signedBendDegrees(descriptor, quaternion) {
- const rest = new THREE28.Quaternion(...descriptor.rest.rotation);
+ const rest = new THREE29.Quaternion(...descriptor.rest.rotation);
const delta = rest.invert().multiply(quaternion).normalize();
- const axis = new THREE28.Vector3(delta.x, delta.y, delta.z);
- const signedMagnitude = axis.dot(new THREE28.Vector3(...descriptor.localBendAxis));
+ const axis = new THREE29.Vector3(delta.x, delta.y, delta.z);
+ const signedMagnitude = axis.dot(new THREE29.Vector3(...descriptor.localBendAxis));
const angle = 2 * Math.atan2(signedMagnitude, delta.w);
- return THREE28.MathUtils.radToDeg(THREE28.MathUtils.euclideanModulo(angle + Math.PI, Math.PI * 2) - Math.PI);
+ return THREE29.MathUtils.radToDeg(THREE29.MathUtils.euclideanModulo(angle + Math.PI, Math.PI * 2) - Math.PI);
}
function bendDirectionFindings(context, root, clips) {
const joints = collectCharacterJointNodes(root).filter((joint) => /(?:^|[._-])(?:knee|elbow)(?:$|[._-])/i.test(joint.descriptor.role));
@@ -21073,7 +21288,7 @@ function bendDirectionFindings(context, root, clips) {
let maximumFraction = 0;
for (const fraction of SAMPLE_FRACTIONS) {
const value = track.createInterpolant().evaluate(fraction * clip.duration);
- const bend = signedBendDegrees(joint.descriptor, new THREE28.Quaternion().fromArray(value).normalize());
+ const bend = signedBendDegrees(joint.descriptor, new THREE29.Quaternion().fromArray(value).normalize());
if (Math.abs(bend) > Math.abs(maximum)) {
maximum = bend;
maximumFraction = fraction;
@@ -21156,7 +21371,7 @@ function footSlideFindings(context, root, clips) {
return findings;
}
function inspectRigAdvisory(context) {
- if (!context.rig || !(context.scene instanceof THREE28.Object3D)) {
+ if (!context.rig || !(context.scene instanceof THREE29.Object3D)) {
return [];
}
const root = context.scene;
@@ -21275,7 +21490,7 @@ var init_architecture_repairs = __esm(() => {
});
// src/qa/architecture.ts
-import * as THREE29 from "three";
+import * as THREE30 from "three";
function hasRoofDimensions(value) {
return value.footprint !== undefined && value.roof?.ridgeAxis !== undefined && value.roof.rise !== undefined && value.roof.overhang !== undefined;
}
@@ -21285,7 +21500,7 @@ function semanticMetadata(node) {
function markerBounds(matrix) {
const bounds = emptyBounds();
for (let corner = 0;corner < 8; corner++) {
- expandBounds(bounds, new THREE29.Vector3(corner & 1 ? 0.5 : -0.5, corner & 2 ? 0.5 : -0.5, corner & 4 ? 0.5 : -0.5).applyMatrix4(matrix));
+ expandBounds(bounds, new THREE30.Vector3(corner & 1 ? 0.5 : -0.5, corner & 2 ? 0.5 : -0.5, corner & 4 ? 0.5 : -0.5).applyMatrix4(matrix));
}
return bounds;
}
@@ -21294,7 +21509,7 @@ function geometryPlaneNormal(geometry, relativeMatrix) {
const local = geometry.boundingBox;
if (!local)
return;
- const size = local.getSize(new THREE29.Vector3);
+ const size = local.getSize(new THREE30.Vector3);
const dimensions = [
["x", size.x],
["y", size.y],
@@ -21304,7 +21519,7 @@ function geometryPlaneNormal(geometry, relativeMatrix) {
const axis = dimensions[0]?.[0];
if (!axis)
return;
- const normal = new THREE29.Vector3(axis === "x" ? 1 : 0, axis === "y" ? 1 : 0, axis === "z" ? 1 : 0).transformDirection(relativeMatrix);
+ const normal = new THREE30.Vector3(axis === "x" ? 1 : 0, axis === "y" ? 1 : 0, axis === "z" ? 1 : 0).transformDirection(relativeMatrix);
if (normal.y < 0)
normal.multiplyScalar(-1);
return normal.normalize();
@@ -21316,7 +21531,7 @@ function geometryEvidence(geometry, relativeMatrix) {
if (position?.itemSize !== 3)
return { bounds, vertices, triangles: [] };
for (let index = 0;index < position.count; index++) {
- const point = new THREE29.Vector3(position.getX(index), position.getY(index), position.getZ(index));
+ const point = new THREE30.Vector3(position.getX(index), position.getY(index), position.getZ(index));
point.applyMatrix4(relativeMatrix);
vertices.push(point);
expandBounds(bounds, point);
@@ -21343,7 +21558,7 @@ function geometryEvidence(geometry, relativeMatrix) {
return { bounds, vertices, triangles, ...planeNormal ? { planeNormal } : {} };
}
function collectArchitectureEvidence(scene) {
- if (!(scene instanceof THREE29.Object3D))
+ if (!(scene instanceof THREE30.Object3D))
return;
scene.updateMatrixWorld(true);
const rootInverse = scene.matrixWorld.clone().invert();
@@ -21363,7 +21578,7 @@ function collectArchitectureEvidence(scene) {
const nodePath = parentPath ? `${parentPath}/${segment}` : segment;
const relativeMatrix = rootInverse.clone().multiply(node.matrixWorld);
const mesh = node;
- const isMesh = mesh.isMesh === true && mesh.geometry instanceof THREE29.BufferGeometry;
+ const isMesh = mesh.isMesh === true && mesh.geometry instanceof THREE30.BufferGeometry;
const evidence = isMesh ? geometryEvidence(mesh.geometry, relativeMatrix) : {
bounds: markerBounds(relativeMatrix),
vertices: [],
@@ -21422,7 +21637,7 @@ function architectureFinding(context, value) {
function averageNormal(normals) {
if (normals.length === 0)
return;
- const result = normals.reduce((sum, normal) => sum.add(normal), new THREE29.Vector3);
+ const result = normals.reduce((sum, normal) => sum.add(normal), new THREE30.Vector3);
return result.lengthSq() > EPSILON2 ? result.normalize() : undefined;
}
function intervalCoverage(min, max, expectedMin, expectedMax) {
@@ -22133,8 +22348,8 @@ function evaluateArchitectureQa(context) {
});
}
var PROFILE_RULE_ID2 = "ARCHITECTURE_PROFILE", EPSILON2 = 0.000001, ARCHITECTURE_REALISTIC_SCALE_BANDS, emptyBounds = () => ({
- min: new THREE29.Vector3(Infinity, Infinity, Infinity),
- max: new THREE29.Vector3(-Infinity, -Infinity, -Infinity)
+ min: new THREE30.Vector3(Infinity, Infinity, Infinity),
+ max: new THREE30.Vector3(-Infinity, -Infinity, -Infinity)
}), expandBounds = (bounds, point) => {
bounds.min.min(point);
bounds.max.max(point);
@@ -22178,7 +22393,7 @@ var init_architecture = __esm(() => {
});
// src/qa/environment.ts
-import * as THREE30 from "three";
+import * as THREE31 from "three";
function finding5(context, value) {
return { ...value, profile: context.profile ?? "asset.requirements.v1" };
}
@@ -22197,11 +22412,11 @@ function nodePath4(root, node) {
return names.reverse().join("/");
}
function transformedBox2(source, transform) {
- const result = new THREE30.Box3;
+ const result = new THREE31.Box3;
for (const x of [source.min.x, source.max.x]) {
for (const y of [source.min.y, source.max.y]) {
for (const z of [source.min.z, source.max.z]) {
- result.expandByPoint(new THREE30.Vector3(x, y, z).applyMatrix4(transform));
+ result.expandByPoint(new THREE31.Vector3(x, y, z).applyMatrix4(transform));
}
}
}
@@ -22210,16 +22425,16 @@ function transformedBox2(source, transform) {
function orientedBoxFromLocalBounds(root, node, source, relative = root.matrixWorld.clone().invert().multiply(node.matrixWorld)) {
if (!relative.elements.every(Number.isFinite))
return;
- const position = new THREE30.Vector3;
- const rotation = new THREE30.Quaternion;
- const scale = new THREE30.Vector3;
+ const position = new THREE31.Vector3;
+ const rotation = new THREE31.Quaternion;
+ const scale = new THREE31.Vector3;
relative.decompose(position, rotation, scale);
- const recomposed = new THREE30.Matrix4().compose(position, rotation, scale);
+ const recomposed = new THREE31.Matrix4().compose(position, rotation, scale);
const residual = Math.max(...relative.elements.map((component, index) => Math.abs(component - (recomposed.elements[index] ?? component))));
if (residual > 0.00001)
return;
- const center = source.getCenter(new THREE30.Vector3).applyMatrix4(relative);
- const sourceHalf = source.getSize(new THREE30.Vector3).multiplyScalar(0.5);
+ const center = source.getCenter(new THREE31.Vector3).applyMatrix4(relative);
+ const sourceHalf = source.getSize(new THREE31.Vector3).multiplyScalar(0.5);
const halfExtents = [
Math.abs(sourceHalf.x * scale.x),
Math.abs(sourceHalf.y * scale.y),
@@ -22240,24 +22455,24 @@ function collectParts5(root) {
const result = [];
root.traverseVisible((node) => {
const roles = rolesOf4(node);
- const renderable = node instanceof THREE30.Mesh;
+ const renderable = node instanceof THREE31.Mesh;
let box;
let orientedBox;
let source;
- if (renderable && node.geometry instanceof THREE30.BufferGeometry) {
+ if (renderable && node.geometry instanceof THREE31.BufferGeometry) {
node.geometry.computeBoundingBox();
if (node.geometry.boundingBox) {
source = node.geometry.boundingBox;
}
} else if (roles.length > 0) {
- source = new THREE30.Box3(new THREE30.Vector3(-0.5, -0.5, -0.5), new THREE30.Vector3(0.5, 0.5, 0.5));
+ source = new THREE31.Box3(new THREE31.Vector3(-0.5, -0.5, -0.5), new THREE31.Vector3(0.5, 0.5, 0.5));
}
const relative = rootInverse.clone().multiply(node.matrixWorld);
- const count = node instanceof THREE30.InstancedMesh ? node.count : 1;
+ const count = node instanceof THREE31.InstancedMesh ? node.count : 1;
for (let index = 0;index < count; index++) {
const transform = relative.clone();
- if (node instanceof THREE30.InstancedMesh) {
- const instance = new THREE30.Matrix4;
+ if (node instanceof THREE31.InstancedMesh) {
+ const instance = new THREE31.Matrix4;
node.getMatrixAt(index, instance);
transform.multiply(instance);
}
@@ -22288,9 +22503,9 @@ function resolveSocket(root, node, socket) {
return;
root.updateWorldMatrix(true, true);
const rootInverse = root.matrixWorld.clone().invert();
- const point = new THREE30.Vector3(...frame.translation).applyMatrix4(node.matrixWorld).applyMatrix4(rootInverse);
- const rootInverseQuaternion = root.getWorldQuaternion(new THREE30.Quaternion).invert();
- const rotation = node.getWorldQuaternion(new THREE30.Quaternion).multiply(new THREE30.Quaternion(...frame.rotation)).premultiply(rootInverseQuaternion).normalize();
+ const point = new THREE31.Vector3(...frame.translation).applyMatrix4(node.matrixWorld).applyMatrix4(rootInverse);
+ const rootInverseQuaternion = root.getWorldQuaternion(new THREE31.Quaternion).invert();
+ const rotation = node.getWorldQuaternion(new THREE31.Quaternion).multiply(new THREE31.Quaternion(...frame.rotation)).premultiply(rootInverseQuaternion).normalize();
return {
id: socket.id,
type: socket.type,
@@ -22319,7 +22534,7 @@ function socketByType(sockets, type) {
return sockets.find((socket) => socket.type === type);
}
function inspectPlacementSockets(context) {
- if (!(context.scene instanceof THREE30.Object3D)) {
+ if (!(context.scene instanceof THREE31.Object3D)) {
return [];
}
const root = context.scene;
@@ -22383,7 +22598,7 @@ function materialSignature(material) {
function boundarySamples(root, axis, side, bins = 12) {
root.updateWorldMatrix(true, true);
const inverse = root.matrixWorld.clone().invert();
- const localBounds = new THREE30.Box3;
+ const localBounds = new THREE31.Box3;
for (const part of collectParts5(root))
if (part.renderable && part.box)
localBounds.union(part.box);
@@ -22397,30 +22612,30 @@ function boundarySamples(root, axis, side, bins = 12) {
const crossExtent = Math.max(0.000000001, localBounds.max[crossAxis] - crossMin);
const byBin = new Map;
root.traverseVisible((node) => {
- if (!(node instanceof THREE30.Mesh) || !(node.geometry instanceof THREE30.BufferGeometry))
+ if (!(node instanceof THREE31.Mesh) || !(node.geometry instanceof THREE31.BufferGeometry))
return;
const positions = node.geometry.getAttribute("position");
if (positions?.itemSize !== 3)
return;
const normals = node.geometry.getAttribute("normal");
const relative = inverse.clone().multiply(node.matrixWorld);
- const count = node instanceof THREE30.InstancedMesh ? node.count : 1;
+ const count = node instanceof THREE31.InstancedMesh ? node.count : 1;
for (let instanceIndex = 0;instanceIndex < count; instanceIndex++) {
const transform = relative.clone();
- if (node instanceof THREE30.InstancedMesh) {
- const instance = new THREE30.Matrix4;
+ if (node instanceof THREE31.InstancedMesh) {
+ const instance = new THREE31.Matrix4;
node.getMatrixAt(instanceIndex, instance);
transform.multiply(instance);
}
- const normalMatrix = new THREE30.Matrix3().getNormalMatrix(transform);
+ const normalMatrix = new THREE31.Matrix3().getNormalMatrix(transform);
const material = materialSignature(node.material);
for (let index = 0;index < positions.count; index++) {
- const point = new THREE30.Vector3(positions.getX(index), positions.getY(index), positions.getZ(index)).applyMatrix4(transform);
+ const point = new THREE31.Vector3(positions.getX(index), positions.getY(index), positions.getZ(index)).applyMatrix4(transform);
if (Math.abs(point[axis] - edge) > band)
continue;
- const t = THREE30.MathUtils.clamp((point[crossAxis] - crossMin) / crossExtent, 0, 1);
+ const t = THREE31.MathUtils.clamp((point[crossAxis] - crossMin) / crossExtent, 0, 1);
const bin = Math.min(bins - 1, Math.floor(t * bins));
- const normal = normals ? new THREE30.Vector3(normals.getX(index), normals.getY(index), normals.getZ(index)).applyMatrix3(normalMatrix).normalize() : new THREE30.Vector3(0, 1, 0);
+ const normal = normals ? new THREE31.Vector3(normals.getX(index), normals.getY(index), normals.getZ(index)).applyMatrix3(normalMatrix).normalize() : new THREE31.Vector3(0, 1, 0);
const current = byBin.get(bin);
if (!current || point.y > current.height || point.y === current.height && normal.y > current.normal.y) {
byBin.set(bin, { bin, height: point.y, normal, material });
@@ -22443,7 +22658,7 @@ function edgePairMeasurements(root, axis, sockets) {
...positive.map((sample) => sample.bin)
]);
const maximumHeightDelta = pairs.length ? Math.max(...pairs.map(([a, b]) => Math.abs(a.height - b.height))) : Number.POSITIVE_INFINITY;
- const maximumNormalDeltaDegrees = pairs.length ? Math.max(...pairs.map(([a, b]) => THREE30.MathUtils.radToDeg(Math.acos(THREE30.MathUtils.clamp(a.normal.dot(b.normal), -1, 1))))) : 180;
+ const maximumNormalDeltaDegrees = pairs.length ? Math.max(...pairs.map(([a, b]) => THREE31.MathUtils.radToDeg(Math.acos(THREE31.MathUtils.clamp(a.normal.dot(b.normal), -1, 1))))) : 180;
const materialMismatch = pairs.some(([a, b]) => a.material !== b.material);
const negativeSocket = socketByType(sockets, `environment.tile.${axis}-negative`);
const positiveSocket = socketByType(sockets, `environment.tile.${axis}-positive`);
@@ -22460,7 +22675,7 @@ function edgePairMeasurements(root, axis, sockets) {
};
}
function inspectTileEdges(context) {
- if (context.tileable !== true || !(context.scene instanceof THREE30.Object3D)) {
+ if (context.tileable !== true || !(context.scene instanceof THREE31.Object3D)) {
return [];
}
const root = context.scene;
@@ -22543,7 +22758,7 @@ function isCorridor(part) {
return part.roles.some((role) => /^environment\.(?:navigation\.)?corridor(?:\.|$)/.test(role));
}
function inspectNavigationClearance(context) {
- if (context.navigable !== true || !(context.scene instanceof THREE30.Object3D)) {
+ if (context.navigable !== true || !(context.scene instanceof THREE31.Object3D)) {
return [];
}
const root = context.scene;
@@ -22673,7 +22888,7 @@ function functionalLayer(part) {
return part.roles.some((role) => role.startsWith("environment.functional") || role.startsWith("environment.layer") || role.startsWith("environment.path") || role.startsWith("environment.road") || role.startsWith("environment.bridge") || role.startsWith("environment.gate"));
}
function inspectSpatialSupport(context) {
- if (context.groundPlaneY === undefined || !(context.scene instanceof THREE30.Object3D)) {
+ if (context.groundPlaneY === undefined || !(context.scene instanceof THREE31.Object3D)) {
return [];
}
const root = context.scene;
@@ -22720,7 +22935,7 @@ function inspectSpatialSupport(context) {
}));
}
}
- const size = box.getSize(new THREE30.Vector3);
+ const size = box.getSize(new THREE31.Vector3);
if (box.min.y < context.groundPlaneY - 0.05 && size.y <= Math.max(0.05, Math.min(size.x, size.z) * 0.03) && Math.max(size.x, size.z) >= 1) {
findings.push(finding5(context, {
code: "ENV_GROUND_UNDECLARED_SKIRT",
@@ -23685,7 +23900,7 @@ var init_requirements_run = __esm(() => {
});
// src/qa/skin-integrity.ts
-import * as THREE31 from "three";
+import * as THREE32 from "three";
function validAttribute(a, count, size) {
if (!a || a.itemSize !== size || a.count !== count || !Number.isSafeInteger(count) || count < 1)
return false;
@@ -23732,9 +23947,9 @@ function inspectSkinIntegrity(root) {
}
while (chain.length) {
const n = chain.pop();
- const local = n.matrixAutoUpdate ? new THREE31.Matrix4().compose(n.position, n.quaternion, n.scale) : n.matrix.clone();
+ const local = n.matrixAutoUpdate ? new THREE32.Matrix4().compose(n.position, n.quaternion, n.scale) : n.matrix.clone();
const parent = n.parent ? worlds.get(n.parent) : undefined;
- const value = n.matrixWorldAutoUpdate === false ? n.matrixWorld.clone() : parent ? new THREE31.Matrix4().multiplyMatrices(parent, local) : local;
+ const value = n.matrixWorldAutoUpdate === false ? n.matrixWorld.clone() : parent ? new THREE32.Matrix4().multiplyMatrices(parent, local) : local;
worlds.set(n, value);
}
return worlds.get(node);
@@ -23784,7 +23999,7 @@ function inspectSkinIntegrity(root) {
if (result.truncated)
break;
}
- if (!finiteAffine(mesh.bindMatrix) || !Number.isFinite(mesh.bindMatrix.determinant()) || mesh.bindMatrix.determinant() === 0 || ![THREE31.AttachedBindMode, THREE31.DetachedBindMode].includes(mesh.bindMode)) {
+ if (!finiteAffine(mesh.bindMatrix) || !Number.isFinite(mesh.bindMatrix.determinant()) || mesh.bindMatrix.determinant() === 0 || ![THREE32.AttachedBindMode, THREE32.DetachedBindMode].includes(mesh.bindMode)) {
add("SKIN_BIND_MATRIX", "Mesh requires a finite invertible affine bind matrix and an attached or detached bind mode.", "bindMatrix");
}
const position = mesh.geometry?.getAttribute("position"), count = position?.count ?? 0;
@@ -23833,7 +24048,7 @@ function inspectSkinIntegrity(root) {
add("SKIN_POSE_TRANSFORM", "Current mesh world transform must be finite and affine.");
continue;
}
- const inverse = mesh.bindMode === THREE31.AttachedBindMode ? meshWorld.clone().invert() : mesh.bindMatrix.clone().invert();
+ const inverse = mesh.bindMode === THREE32.AttachedBindMode ? meshWorld.clone().invert() : mesh.bindMatrix.clone().invert();
const matrices = [];
for (let joint = 0;joint < bones.length; joint++) {
const boneWorld = world(bones[joint]);
@@ -23841,13 +24056,13 @@ function inspectSkinIntegrity(root) {
add("SKIN_POSE_TRANSFORM", `Current transform for joint ${joint} must be finite and affine.`, `joints[${joint}]`);
break;
}
- matrices.push(new THREE31.Matrix4().multiplyMatrices(boneWorld, skeleton.boneInverses[joint]).multiply(mesh.bindMatrix));
+ matrices.push(new THREE32.Matrix4().multiplyMatrices(boneWorld, skeleton.boneInverses[joint]).multiply(mesh.bindMatrix));
}
if (result.findings.length !== start)
continue;
- const base = new THREE31.Vector3, posed = new THREE31.Vector3, temp = new THREE31.Vector3, box = new THREE31.Box3;
+ const base = new THREE32.Vector3, posed = new THREE32.Vector3, temp = new THREE32.Vector3, box = new THREE32.Box3;
for (let vertex = 0;vertex < count; vertex++) {
- THREE31.Mesh.prototype.getVertexPosition.call(mesh, vertex, base);
+ THREE32.Mesh.prototype.getVertexPosition.call(mesh, vertex, base);
posed.set(0, 0, 0);
for (let lane = 0;lane < 4; lane++) {
const weight = weights.getComponent(vertex, lane);
@@ -23912,7 +24127,7 @@ var init_material_export = __esm(() => {
});
// src/community-exporter.ts
-import * as THREE32 from "three";
+import * as THREE33 from "three";
import { GLTFExporter } from "three/addons/exporters/GLTFExporter.js";
import { GLB_BUFFER } from "@gltf-transform/core";
function resolveGltfExporter(value = typeof process !== "undefined" ? process.env["KILN_GLTF_EXPORTER"] : undefined) {
@@ -23942,7 +24157,7 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
return found;
const copy = cleanClone(source);
normalizeTextureTransform(copy);
- copy.source = new THREE32.TextureSource(source.image);
+ copy.source = new THREE33.TextureSource(source.image);
textures.set(source, copy);
const bytes = source.userData["encoded"];
if (bytes?.bytes) {
@@ -23951,8 +24166,8 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
encoded.push((async () => {
copy.image = await platform.decode(bytes.bytes);
Object.defineProperty(copy, "isDataTexture", { value: true });
- copy.format = THREE32.RGBAFormat;
- copy.type = THREE32.UnsignedByteType;
+ copy.format = THREE33.RGBAFormat;
+ copy.type = THREE33.UnsignedByteType;
})());
}
return copy;
@@ -23969,7 +24184,7 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
physical.sheen = 1;
}
for (const [key, value] of Object.entries(copy)) {
- if (value instanceof THREE32.Texture)
+ if (value instanceof THREE33.Texture)
copy[key] = texture(value);
}
materials.set(source, copy);
@@ -23985,15 +24200,15 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
if (!copy.matrixAutoUpdate)
copy.matrix.decompose(copy.position, copy.quaternion, copy.scale);
if (source.isScene) {
- copy = new THREE32.Group;
+ copy = new THREE33.Group;
copy.copy(shadow, false);
}
if (source.isSprite) {
const sprite = source;
- const geometry = new THREE32.PlaneGeometry(1, 1);
+ const geometry = new THREE33.PlaneGeometry(1, 1);
geometry.translate(0.5 - sprite.center.x, 0.5 - sprite.center.y, 0);
geometry.rotateZ(sprite.material.rotation);
- const spriteMaterial = new THREE32.MeshBasicMaterial({
+ const spriteMaterial = new THREE33.MeshBasicMaterial({
name: sprite.material.name,
color: sprite.material.color,
opacity: sprite.material.opacity,
@@ -24004,8 +24219,8 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
});
Object.assign(spriteMaterial.userData, authorExtras?.material(sprite.material));
originalMaterials.set(spriteMaterial, sprite.material);
- copy = new THREE32.Mesh(geometry, spriteMaterial);
- THREE32.Object3D.prototype.copy.call(copy, shadow, false);
+ copy = new THREE33.Mesh(geometry, spriteMaterial);
+ THREE33.Object3D.prototype.copy.call(copy, shadow, false);
}
Object.assign(copy.userData, authorExtras?.node(source), rigExtrasForExport(source), openShellExtras(source), kitExtras(source), repeatInstancesExtras(source));
const semantic = source.userData[KILN_SEMANTIC_EXTRAS_KEY];
@@ -24069,8 +24284,8 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
if (!context)
throw new Error("A 2D canvas is required to prepare export texture channels.");
context.putImageData(new ImageData(new Uint8ClampedArray(data), width, height), 0, 0);
- const adapted = new THREE32.Texture().copy(map);
- adapted.source = new THREE32.TextureSource(canvas);
+ const adapted = new THREE33.Texture().copy(map);
+ adapted.source = new THREE33.TextureSource(canvas);
canvasInputs.set(map, adapted);
const direct = directImages.get(map);
if (direct)
@@ -24079,7 +24294,7 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
};
for (const material of materials.values()) {
for (const [key, value] of Object.entries(material)) {
- if (value instanceof THREE32.Texture && value.flipY && value.image?.data)
+ if (value instanceof THREE33.Texture && value.flipY && value.image?.data)
material[key] = canvasInput(value);
}
const standard = material;
@@ -24101,8 +24316,8 @@ async function communitySceneDocument(root, clips, platform = browserPlatform, a
}
cloned.tracks = cloned.tracks.filter((track) => {
try {
- const binding = THREE32.PropertyBinding.parseTrackName(track.name);
- return ["position", "quaternion", "scale", "morphTargetInfluences"].includes(binding.propertyName) && THREE32.PropertyBinding.findNode(copy, binding.nodeName) !== null;
+ const binding = THREE33.PropertyBinding.parseTrackName(track.name);
+ return ["position", "quaternion", "scale", "morphTargetInfluences"].includes(binding.propertyName) && THREE33.PropertyBinding.findNode(copy, binding.nodeName) !== null;
} catch {
return false;
}
@@ -24297,7 +24512,7 @@ function applyIndexPolicy(doc, policy) {
var init_index_policy = () => {};
// src/surface-bake.ts
-import * as THREE33 from "three";
+import * as THREE34 from "three";
function settings(value, label) {
if (value === false)
return;
@@ -24339,13 +24554,13 @@ function drawnMeshes(root) {
function weld(mesh) {
const position = mesh.geometry.getAttribute("position");
const world = [];
- const box = new THREE33.Box3;
+ const box = new THREE34.Box3;
for (let i = 0;i < position.count; i++) {
- const point = new THREE33.Vector3().fromBufferAttribute(position, i).applyMatrix4(mesh.matrixWorld);
+ const point = new THREE34.Vector3().fromBufferAttribute(position, i).applyMatrix4(mesh.matrixWorld);
world.push(point);
box.expandByPoint(point);
}
- const size = box.isEmpty() ? 0 : box.getSize(new THREE33.Vector3).length();
+ const size = box.isEmpty() ? 0 : box.getSize(new THREE34.Vector3).length();
const tolerance = size > 0 ? size * 0.000001 : 0.000000001;
const keys = new Map;
const ids = new Int32Array(position.count);
@@ -24379,7 +24594,7 @@ function bakeEdge(topology, thresholdDegrees, smoothing) {
const a = points[triangles[t]];
const b = points[triangles[t + 1]];
const c = points[triangles[t + 2]];
- normals.push(new THREE33.Vector3().subVectors(b, a).cross(new THREE33.Vector3().subVectors(c, a)).normalize());
+ normals.push(new THREE34.Vector3().subVectors(b, a).cross(new THREE34.Vector3().subVectors(c, a)).normalize());
}
const edges = new Map;
const neighbours = points.map(() => new Set);
@@ -24398,7 +24613,7 @@ function bakeEdge(topology, thresholdDegrees, smoothing) {
edges.set(key, list);
}
}
- const threshold = THREE33.MathUtils.degToRad(thresholdDegrees);
+ const threshold = THREE34.MathUtils.degToRad(thresholdDegrees);
const weights = new Float64Array(points.length);
for (const [key, incidences] of edges) {
let weight;
@@ -24408,10 +24623,10 @@ function bakeEdge(topology, thresholdDegrees, smoothing) {
const [[f1], [f2, opposite2]] = incidences;
const n1 = normals[f1];
const n2 = normals[f2];
- const angle = Math.acos(THREE33.MathUtils.clamp(n1.dot(n2), -1, 1));
+ const angle = Math.acos(THREE34.MathUtils.clamp(n1.dot(n2), -1, 1));
const [u] = key.split(":").map(Number);
const scale = Math.max(points[u].distanceTo(points[opposite2]), 0.000000000001);
- const side = new THREE33.Vector3().subVectors(points[opposite2], points[u]).dot(n1) / scale;
+ const side = new THREE34.Vector3().subVectors(points[opposite2], points[u]).dot(n1) / scale;
weight = side < -0.000000001 ? smoothstep2(threshold / 2, threshold, angle) : 0;
}
for (const id of key.split(":").map(Number))
@@ -24573,12 +24788,12 @@ function hemisphereDirections(count) {
const phi = i * golden;
const x = r * Math.cos(phi);
const y = r * Math.sin(phi);
- return new THREE33.Vector3(x, y, Math.sqrt(Math.max(0, 1 - x * x - y * y)));
+ return new THREE34.Vector3(x, y, Math.sqrt(Math.max(0, 1 - x * x - y * y)));
});
}
function occluderTriangles(occluders, bakedTier) {
const values = [];
- const point = new THREE33.Vector3;
+ const point = new THREE34.Vector3;
for (const mesh of drawnMeshes(occluders)) {
if (!drawn(mesh, null))
continue;
@@ -24642,12 +24857,12 @@ function bakeSurfaceAttributes(target, options = {}) {
let entry = bvhs.get(key);
if (!entry) {
const triangles = occluderTriangles(occluders, tier);
- const box = new THREE33.Box3;
+ const box = new THREE34.Box3;
for (let i = 0;i < triangles.length; i += 3)
- box.expandByPoint(new THREE33.Vector3(triangles[i], triangles[i + 1], triangles[i + 2]));
+ box.expandByPoint(new THREE34.Vector3(triangles[i], triangles[i + 1], triangles[i + 2]));
entry = {
bvh: new TriangleBvh(triangles),
- diagonal: box.isEmpty() ? 0 : box.getSize(new THREE33.Vector3).length()
+ diagonal: box.isEmpty() ? 0 : box.getSize(new THREE34.Vector3).length()
};
bvhs.set(key, entry);
}
@@ -24664,27 +24879,27 @@ function bakeSurfaceAttributes(target, options = {}) {
const welded = bakeEdge(topology, thresholdDegrees, smoothing);
const values = new Float32Array(sourceCount);
for (let i = 0;i < sourceCount; i++)
- values[i] = THREE33.MathUtils.clamp(welded[topology.ids[i]], 0, 1);
- geometry.setAttribute("_edge", new THREE33.BufferAttribute(values, 1));
+ values[i] = THREE34.MathUtils.clamp(welded[topology.ids[i]], 0, 1);
+ geometry.setAttribute("_edge", new THREE34.BufferAttribute(values, 1));
record._EDGE = { thresholdDegrees, smoothing };
}
if (cavityOptions) {
const { bvh, diagonal } = occlusion(tierOf(mesh));
const radius = cavityOptions.radius ?? SURFACE_BAKE_DEFAULTS.cavity.radiusFactor * diagonal;
const epsilon = Math.max(diagonal * 0.00001, 0.0000001);
- const normals = topology.points.map(() => new THREE33.Vector3);
+ const normals = topology.points.map(() => new THREE34.Vector3);
const { points, triangles } = topology;
for (let t = 0;t < triangles.length; t += 3) {
const a = points[triangles[t]];
- const face = new THREE33.Vector3().subVectors(points[triangles[t + 1]], a).cross(new THREE33.Vector3().subVectors(points[triangles[t + 2]], a));
+ const face = new THREE34.Vector3().subVectors(points[triangles[t + 1]], a).cross(new THREE34.Vector3().subVectors(points[triangles[t + 2]], a));
for (let k = 0;k < 3; k++)
normals[triangles[t + k]].add(face);
}
const exposure = new Float64Array(points.length);
- const tangent = new THREE33.Vector3;
- const bitangent = new THREE33.Vector3;
- const origin = new THREE33.Vector3;
- const direction = new THREE33.Vector3;
+ const tangent = new THREE34.Vector3;
+ const bitangent = new THREE34.Vector3;
+ const origin = new THREE34.Vector3;
+ const direction = new THREE34.Vector3;
points.forEach((point, id) => {
const normal = normals[id];
if (normal.lengthSq() === 0) {
@@ -24706,8 +24921,8 @@ function bakeSurfaceAttributes(target, options = {}) {
});
const values = new Float32Array(sourceCount);
for (let i = 0;i < sourceCount; i++)
- values[i] = THREE33.MathUtils.clamp(exposure[topology.ids[i]], 0, 1);
- geometry.setAttribute("_cavity", new THREE33.BufferAttribute(values, 1));
+ values[i] = THREE34.MathUtils.clamp(exposure[topology.ids[i]], 0, 1);
+ geometry.setAttribute("_cavity", new THREE34.BufferAttribute(values, 1));
record._CAVITY = { rays, radius };
}
geometry.userData = { ...geometry.userData, [SURFACE_BAKE_KEY]: record };
@@ -24727,7 +24942,7 @@ function surfaceBakeRecord(geometry) {
return record;
}
var SURFACE_ATTRIBUTES, SURFACE_BAKE_KEY = "kilnSurfaceBakeV1", SURFACE_BAKE_DEFAULTS, isObject3D2 = (value) => value?.isObject3D === true, smoothstep2 = (edge0, edge1, x) => {
- const t = THREE33.MathUtils.clamp((x - edge0) / (edge1 - edge0), 0, 1);
+ const t = THREE34.MathUtils.clamp((x - edge0) / (edge1 - edge0), 0, 1);
return t * t * (3 - 2 * t);
};
var init_surface_bake = __esm(() => {
@@ -25327,16 +25542,16 @@ function buildWallPanels(length, height, thickness, apertures) {
}
// src/assembly-transform.ts
-import * as THREE34 from "three";
+import * as THREE35 from "three";
function checkedTrs(matrix, label) {
const e = matrix.elements;
if (!e.every(Number.isFinite) || e[3] !== 0 || e[7] !== 0 || e[11] !== 0 || Math.abs(e[15] - 1) > 16 * Number.EPSILON)
throw new Error(`${label}: finite affine TRS is required.`);
if (!Number.isFinite(matrix.determinant()) || matrix.determinant() === 0)
throw new Error(`${label}: singular/zero-scale transforms are unsupported.`);
- const position = new THREE34.Vector3, quaternion = new THREE34.Quaternion, scale = new THREE34.Vector3;
+ const position = new THREE35.Vector3, quaternion = new THREE35.Quaternion, scale = new THREE35.Vector3;
matrix.decompose(position, quaternion, scale);
- const rebuilt = new THREE34.Matrix4().compose(position, quaternion, scale);
+ const rebuilt = new THREE35.Matrix4().compose(position, quaternion, scale);
if (rebuilt.elements.some((value, i) => !Number.isFinite(value) || Math.abs(value - e[i]) > 0.00000001 * Math.max(1, Math.abs(e[i]))))
throw new Error(`${label}: local shear cannot be represented losslessly as TRS.`);
return { position, quaternion, scale };
@@ -25344,7 +25559,7 @@ function checkedTrs(matrix, label) {
var init_assembly_transform = () => {};
// src/assembly.ts
-import * as THREE35 from "three";
+import * as THREE36 from "three";
function jsonData(value, label, ancestors = new Set) {
if (value === null || typeof value === "string" || typeof value === "boolean")
return;
@@ -25391,7 +25606,7 @@ function knownMetadata(source, parsed, label) {
throw new Error(`${label}: unsupported fields in known metadata would be lost during remapping.`);
}
function localMatrix(node) {
- return node.matrixAutoUpdate ? new THREE35.Matrix4().compose(node.position, node.quaternion, node.scale) : node.matrix.clone();
+ return node.matrixAutoUpdate ? new THREE36.Matrix4().compose(node.position, node.quaternion, node.scale) : node.matrix.clone();
}
function worldMatrix2(node) {
const chain = [], seen = new Set;
@@ -25401,7 +25616,7 @@ function worldMatrix2(node) {
seen.add(cursor);
chain.push(cursor);
}
- const result = new THREE35.Matrix4;
+ const result = new THREE36.Matrix4;
for (const entry of chain.reverse())
result.multiply(localMatrix(entry));
return result;
@@ -25417,7 +25632,7 @@ function census(root) {
const stack = [root];
while (stack.length) {
const node = stack.pop();
- if (!(node instanceof THREE35.Object3D) || ![THREE35.Object3D, THREE35.Group, THREE35.Mesh].includes(node.constructor))
+ if (!(node instanceof THREE36.Object3D) || ![THREE36.Object3D, THREE36.Group, THREE36.Mesh].includes(node.constructor))
throw new Error("Unsupported assembly node: only ordinary Object3D, Group and Mesh hierarchies are qualified; no skins, instances or custom node classes.");
if (matrices.has(node))
throw new Error("Assembly must be a tree; duplicate/cyclic children are unsupported.");
@@ -25433,21 +25648,21 @@ function census(root) {
checkedTrs(matrix, node.name || "unnamed node");
nodes.push(node);
matrices.set(node, matrix);
- if (node.onBeforeRender !== THREE35.Object3D.prototype.onBeforeRender || node.onAfterRender !== THREE35.Object3D.prototype.onAfterRender || node.onBeforeShadow !== THREE35.Object3D.prototype.onBeforeShadow || node.onAfterShadow !== THREE35.Object3D.prototype.onAfterShadow)
+ if (node.onBeforeRender !== THREE36.Object3D.prototype.onBeforeRender || node.onAfterRender !== THREE36.Object3D.prototype.onAfterRender || node.onBeforeShadow !== THREE36.Object3D.prototype.onBeforeShadow || node.onAfterShadow !== THREE36.Object3D.prototype.onAfterShadow)
throw new Error("Custom node render callbacks are unsupported in assembly replication.");
- if (node instanceof THREE35.Mesh) {
- if (!(node.geometry instanceof THREE35.BufferGeometry) || node.geometry instanceof THREE35.InstancedBufferGeometry)
+ if (node instanceof THREE36.Mesh) {
+ if (!(node.geometry instanceof THREE36.BufferGeometry) || node.geometry instanceof THREE36.InstancedBufferGeometry)
throw new Error("Unsupported assembly geometry type.");
if (Object.values(node.geometry.morphAttributes).some((attributes) => attributes?.length) || node.morphTargetInfluences?.length)
throw new Error("Assembly morph target replication is unsupported.");
const materials = Array.isArray(node.material) ? node.material : [node.material];
- if (materials.length === 0 || materials.some((material) => !(material instanceof THREE35.Material)))
+ if (materials.length === 0 || materials.some((material) => !(material instanceof THREE36.Material)))
throw new Error("Assembly mesh materials must be Material instances.");
}
if (!object3(node.userData))
throw new Error("Assembly node metadata must be an object.");
jsonData(node.userData, node.name);
- if (!Array.isArray(node.animations) || node.animations.some((clip) => !(clip instanceof THREE35.AnimationClip)))
+ if (!Array.isArray(node.animations) || node.animations.some((clip) => !(clip instanceof THREE36.AnimationClip)))
throw new Error("Assembly node animations must contain AnimationClip instances.");
if (node.userData[KILN_SEMANTIC_EXTRAS_KEY] !== undefined) {
const metadata = readSemanticMetadataV1(node);
@@ -25488,11 +25703,11 @@ function describeAssembly(root, options = {}) {
const state = census(root), roles = new Map;
const frames = [], sockets = [], joints = [], materials = [];
const relative = new Map;
- const bounds = new THREE35.Box3, point = new THREE35.Vector3;
+ const bounds = new THREE36.Box3, point = new THREE36.Vector3;
let positionSamples = 0;
for (const [index, node] of state.nodes.entries()) {
const nodeId = `n${index}`;
- const matrix = node === root ? new THREE35.Matrix4 : relative.get(node.parent).clone().multiply(state.matrices.get(node));
+ const matrix = node === root ? new THREE36.Matrix4 : relative.get(node.parent).clone().multiply(state.matrices.get(node));
relative.set(node, matrix);
const metadata = state.semantics.get(node);
const descriptor = state.joints.get(node);
@@ -25514,7 +25729,7 @@ function describeAssembly(root, options = {}) {
for (const role of metadata?.roles ?? [])
addIndex(roles, role, node);
for (const frame of metadata?.frames ?? []) {
- const local = new THREE35.Matrix4().compose(new THREE35.Vector3(...frame.translation), new THREE35.Quaternion(...frame.rotation), new THREE35.Vector3(1, 1, 1));
+ const local = new THREE36.Matrix4().compose(new THREE36.Vector3(...frame.translation), new THREE36.Quaternion(...frame.rotation), new THREE36.Vector3(1, 1, 1));
frames.push({
node,
nodeId,
@@ -25524,7 +25739,7 @@ function describeAssembly(root, options = {}) {
}
for (const socket of metadata?.sockets ?? [])
sockets.push({ node, nodeId, socket: structuredClone(socket) });
- if (!(node instanceof THREE35.Mesh))
+ if (!(node instanceof THREE36.Mesh))
continue;
for (const [materialIndex, material] of (Array.isArray(node.material) ? node.material : [node.material]).entries())
materials.push({ node, nodeId, index: materialIndex, material });
@@ -25559,7 +25774,7 @@ function describeAssembly(root, options = {}) {
space: "root-local",
min: bounds.min.toArray(),
max: bounds.max.toArray(),
- size: bounds.getSize(new THREE35.Vector3).toArray()
+ size: bounds.getSize(new THREE36.Vector3).toArray()
},
clips,
ownership: {
@@ -25598,7 +25813,7 @@ function replicateAssembly(source, options) {
if (value !== undefined && !choices.includes(value))
throw new Error(`Unsupported assembly ${key} policy.`);
}
- if (options.parent !== undefined && !(options.parent instanceof THREE35.Object3D))
+ if (options.parent !== undefined && !(options.parent instanceof THREE36.Object3D))
throw new Error("Assembly parent must be an Object3D.");
const fresh = describeAssembly(source.root, { clips: source.clips }), state = census(source.root);
if (options.parent && state.nodes.includes(options.parent))
@@ -25631,16 +25846,16 @@ function replicateAssembly(source, options) {
throw new Error(`Unsupported custom metadata ${key} on ${node.name}; use copy-json only for inert data whose references you own.`);
}
jsonData(node.userData, node.name);
- if (node instanceof THREE35.Mesh) {
+ if (node instanceof THREE36.Mesh) {
if (options.geometry === "copy") {
jsonData(node.geometry.userData, `${node.name} geometry`);
- if (node.geometry.clone !== THREE35.BufferGeometry.prototype.clone || !threeConstructors.has(node.geometry.constructor))
+ if (node.geometry.clone !== THREE36.BufferGeometry.prototype.clone || !threeConstructors.has(node.geometry.constructor))
throw new Error("Copying custom geometry classes/clone implementations is unsupported; explicitly share the resource.");
}
if (options.materials === "copy")
for (const material of Array.isArray(node.material) ? node.material : [node.material]) {
jsonData(material.userData, `${node.name} material`);
- if (material.onBeforeCompile !== THREE35.Material.prototype.onBeforeCompile || material.onBeforeRender !== THREE35.Material.prototype.onBeforeRender || material.clone !== THREE35.Material.prototype.clone || !threeConstructors.has(material.constructor) || material.customProgramCacheKey !== THREE35.Material.prototype.customProgramCacheKey || material instanceof THREE35.ShaderMaterial)
+ if (material.onBeforeCompile !== THREE36.Material.prototype.onBeforeCompile || material.onBeforeRender !== THREE36.Material.prototype.onBeforeRender || material.clone !== THREE36.Material.prototype.clone || !threeConstructors.has(material.constructor) || material.customProgramCacheKey !== THREE36.Material.prototype.customProgramCacheKey || material instanceof THREE36.ShaderMaterial)
throw new Error("Copying custom/shader materials is unsupported; explicit sharing preserves their existing implementation.");
}
}
@@ -25728,9 +25943,9 @@ function replicateAssembly(source, options) {
const trackTargets = new Map;
const animatedNodes = new Set;
for (const clip of fresh.clips) {
- if (!(clip instanceof THREE35.AnimationClip))
+ if (!(clip instanceof THREE36.AnimationClip))
throw new Error("Assembly clips must be AnimationClip instances.");
- if (clip.blendMode !== THREE35.NormalAnimationBlendMode)
+ if (clip.blendMode !== THREE36.NormalAnimationBlendMode)
throw new Error("Additive/other animation blend modes are unsupported in assembly replication.");
jsonData(clip.userData, `Clip ${clip.name}`);
if (Object.keys(clip.userData).length && options.unknownMetadata !== "copy-json")
@@ -25757,7 +25972,7 @@ function replicateAssembly(source, options) {
if (options.space === "world") {
if (state.joints.has(source.root))
throw new Error("World placement of a declared joint root requires rest-transform rebasing; wrap it in an assembly root or use local placement.");
- const parentWorld = options.parent ? worldMatrix2(options.parent) : new THREE35.Matrix4;
+ const parentWorld = options.parent ? worldMatrix2(options.parent) : new THREE36.Matrix4;
if (!Number.isFinite(parentWorld.determinant()) || parentWorld.determinant() === 0)
throw new Error("World placement requires an invertible, nonsingular parent transform.");
rootMatrix = parentWorld.invert().multiply(worldMatrix2(source.root));
@@ -25798,7 +26013,7 @@ function replicateAssembly(source, options) {
return materials.get(material);
};
for (const node of state.nodes) {
- const copy = node instanceof THREE35.Mesh ? new THREE35.Mesh(node.geometry, node.material) : node instanceof THREE35.Group ? new THREE35.Group : new THREE35.Object3D;
+ const copy = node instanceof THREE36.Mesh ? new THREE36.Mesh(node.geometry, node.material) : node instanceof THREE36.Group ? new THREE36.Group : new THREE36.Object3D;
copy.copy(node, false);
copy.name = names.get(node);
copy.animations = [];
@@ -25811,7 +26026,7 @@ function replicateAssembly(source, options) {
}
copy.matrix.copy(matrix);
copy.matrixWorldNeedsUpdate = true;
- if (node instanceof THREE35.Mesh && copy instanceof THREE35.Mesh) {
+ if (node instanceof THREE36.Mesh && copy instanceof THREE36.Mesh) {
if (options.geometry === "copy") {
if (!geometries.has(node.geometry))
geometries.set(node.geometry, node.geometry.clone());
@@ -25876,7 +26091,7 @@ var init_assembly = __esm(() => {
KILN_CHARACTER_JOINT_EXTRAS_KEY,
KILN_CHARACTER_RIG_EXTRAS_KEY
]);
- threeConstructors = new Set(Object.values(THREE35));
+ threeConstructors = new Set(Object.values(THREE36));
});
// src/palette-check.ts
@@ -25999,7 +26214,7 @@ var init_palette_check = __esm(() => {
});
// src/animation-cubic.ts
-import * as THREE36 from "three";
+import * as THREE37 from "three";
function useCubicSpline(track) {
track.createInterpolant = cubicSplineFactory;
return track;
@@ -26007,7 +26222,7 @@ function useCubicSpline(track) {
var CubicSplineInterpolant, CubicSplineQuaternionInterpolant, cubicSplineFactory;
var init_animation_cubic = __esm(() => {
init_animation_spline();
- CubicSplineInterpolant = class CubicSplineInterpolant extends THREE36.Interpolant {
+ CubicSplineInterpolant = class CubicSplineInterpolant extends THREE37.Interpolant {
copySampleValue_(index) {
const result = this.resultBuffer;
const size = this.valueSize;
@@ -26035,7 +26250,7 @@ var init_animation_cubic = __esm(() => {
});
// src/architecture.ts
-import * as THREE37 from "three";
+import * as THREE38 from "three";
function positive4(value, name) {
if (!Number.isFinite(value) || value <= 0)
throw new RangeError(`${name} must be finite and > 0`);
@@ -26100,17 +26315,17 @@ function buildFace(roofRoot, profile, sideSign) {
const verticalRun = profile.ridgeY - profile.eaveY;
const downhillLength = Math.hypot(horizontalRun, verticalRun);
const alongRidge = (profile.ridgeAxis === "x" ? profile.spanX : profile.spanZ) + profile.overhang * 2;
- const downhill = profile.ridgeAxis === "x" ? new THREE37.Vector3(0, -verticalRun, sideSign * horizontalRun).normalize() : new THREE37.Vector3(sideSign * horizontalRun, -verticalRun, 0).normalize();
- const tangent = profile.ridgeAxis === "x" ? new THREE37.Vector3(sideSign, 0, 0) : new THREE37.Vector3(0, 0, -sideSign);
+ const downhill = profile.ridgeAxis === "x" ? new THREE38.Vector3(0, -verticalRun, sideSign * horizontalRun).normalize() : new THREE38.Vector3(sideSign * horizontalRun, -verticalRun, 0).normalize();
+ const tangent = profile.ridgeAxis === "x" ? new THREE38.Vector3(sideSign, 0, 0) : new THREE38.Vector3(0, 0, -sideSign);
const normal = downhill.clone().cross(tangent).normalize();
- const localToRoof = new THREE37.Matrix4().makeBasis(tangent, normal, downhill);
+ const localToRoof = new THREE38.Matrix4().makeBasis(tangent, normal, downhill);
localToRoof.setPosition(0, profile.ridgeY, 0);
const world = () => {
roofRoot.updateWorldMatrix(true, false);
return roofRoot.matrixWorld.clone().multiply(localToRoof);
};
const direction = (axis) => axis.clone().transformDirection(world());
- const point = (x, z) => new THREE37.Vector3(x, 0, z).applyMatrix4(world());
+ const point = (x, z) => new THREE38.Vector3(x, 0, z).applyMatrix4(world());
return {
side,
ridgeAxis: profile.ridgeAxis,
@@ -26120,13 +26335,13 @@ function buildFace(roofRoot, profile, sideSign) {
return world();
},
get ridgeTangent() {
- return direction(new THREE37.Vector3(1, 0, 0));
+ return direction(new THREE38.Vector3(1, 0, 0));
},
get downhillDirection() {
- return direction(new THREE37.Vector3(0, 0, 1));
+ return direction(new THREE38.Vector3(0, 0, 1));
},
get outwardNormal() {
- return direction(new THREE37.Vector3(0, 1, 0));
+ return direction(new THREE38.Vector3(0, 1, 0));
},
get ridgeStart() {
return point(-alongRidge / 2, 0);
@@ -26144,17 +26359,17 @@ function buildFace(roofRoot, profile, sideSign) {
};
}
function buildRoof(name, material, profile, parent) {
- const root = new THREE37.Object3D;
+ const root = new THREE38.Object3D;
root.name = name;
if (parent)
parent.add(root);
stampSemanticMetadataV1(root, roleMetadata([semanticRole(KILN_SEMANTIC_ROLES.roof, "assembly")], [relationship("separable-from", "architecture.shell.gable")]));
const faces = [buildFace(root, profile, 1), buildFace(root, profile, -1)];
const buildSlope = (face) => {
- const geometry = new THREE37.BoxGeometry(face.dimensions.alongRidge, profile.thickness, face.dimensions.downhill);
- const mesh = new THREE37.Mesh(geometry, material);
+ const geometry = new THREE38.BoxGeometry(face.dimensions.alongRidge, profile.thickness, face.dimensions.downhill);
+ const mesh = new THREE38.Mesh(geometry, material);
mesh.name = `Mesh_${name}_${face.side}`;
- const center = new THREE37.Matrix4().makeTranslation(0, -profile.thickness / 2, face.dimensions.downhill / 2);
+ const center = new THREE38.Matrix4().makeTranslation(0, -profile.thickness / 2, face.dimensions.downhill / 2);
setTransform(mesh, face.localToRoof.clone().multiply(center));
const coveredWall = profile.ridgeAxis === "x" ? face.side === "positive" ? "wall.right" : "wall.left" : face.side === "positive" ? "wall.front" : "wall.back";
stampSemanticMetadataV1(mesh, roleMetadata([semanticRole(KILN_SEMANTIC_ROLES.roof, "slope", face.side)], [
@@ -26224,7 +26439,7 @@ function createGableEndPanel(name, material, options) {
const ridgeAxis = options.ridgeAxis ?? "x";
const side = options.side ?? "positive";
const half = span / 2;
- const shape = new THREE37.Shape;
+ const shape = new THREE38.Shape;
shape.moveTo(-half, 0);
shape.lineTo(half, 0);
shape.lineTo(0, rise);
@@ -26243,7 +26458,7 @@ function createGableEndPanel(name, material, options) {
const right = opening.offset + opening.width / 2;
const bottom = opening.bottom;
const top = bottom + opening.height;
- const hole = new THREE37.Path;
+ const hole = new THREE38.Path;
hole.moveTo(left, bottom);
hole.lineTo(left, top);
hole.lineTo(right, top);
@@ -26251,7 +26466,7 @@ function createGableEndPanel(name, material, options) {
hole.closePath();
shape.holes.push(hole);
}
- const geometry = new THREE37.ExtrudeGeometry(shape, {
+ const geometry = new THREE38.ExtrudeGeometry(shape, {
depth: thickness,
bevelEnabled: false,
steps: 1
@@ -26260,7 +26475,7 @@ function createGableEndPanel(name, material, options) {
if (ridgeAxis === "x")
geometry.rotateY(-Math.PI / 2);
geometry.computeVertexNormals();
- const root = new THREE37.Mesh(geometry, material);
+ const root = new THREE38.Mesh(geometry, material);
root.name = `Mesh_${name}`;
stampSemanticMetadataV1(root, roleMetadata([`roof.gable.${side}`], [
relationship("adjacent-to", "roof.slope.positive"),
@@ -26276,7 +26491,7 @@ function createGableEndPanel(name, material, options) {
}
]));
const markers = normalized.map((opening, index) => {
- const marker = new THREE37.Object3D;
+ const marker = new THREE38.Object3D;
marker.name = `Opening_${name}_${opening.id ?? index + 1}`;
marker.position.set(ridgeAxis === "z" ? opening.offset : 0, opening.bottom + opening.height / 2, ridgeAxis === "x" ? opening.offset : 0);
marker.scale.set(ridgeAxis === "x" ? thickness : opening.width, opening.height, ridgeAxis === "x" ? opening.width : thickness);
@@ -26296,7 +26511,7 @@ function wallNeighbors(wall) {
}
function createShellWall(name, wall, material, length, height, thickness, openings) {
const axis = wallRunAxis(wall);
- const root = new THREE37.Object3D;
+ const root = new THREE38.Object3D;
root.name = `${name}_Wall_${wall}`;
const neighbors = wallNeighbors(wall);
stampSemanticMetadataV1(root, roleMetadata([`wall.${wall}`], [
@@ -26308,8 +26523,8 @@ function createShellWall(name, wall, material, length, height, thickness, openin
const panel = (suffix, lo, hi, y0, y1) => {
if (hi <= lo || y1 <= y0)
return;
- const geometry = axis === "x" ? new THREE37.BoxGeometry(hi - lo, y1 - y0, thickness) : new THREE37.BoxGeometry(thickness, y1 - y0, hi - lo);
- const mesh = new THREE37.Mesh(geometry, material);
+ const geometry = axis === "x" ? new THREE38.BoxGeometry(hi - lo, y1 - y0, thickness) : new THREE38.BoxGeometry(thickness, y1 - y0, hi - lo);
+ const mesh = new THREE38.Mesh(geometry, material);
mesh.name = `Mesh_${name}_${wall}_${suffix}`;
mesh.position.set(axis === "x" ? (lo + hi) / 2 : 0, (y0 + y1) / 2, axis === "z" ? (lo + hi) / 2 : 0);
root.add(mesh);
@@ -26326,7 +26541,7 @@ function createShellWall(name, wall, material, length, height, thickness, openin
panel(singleNames[segment.suffix] ?? segment.suffix.slice(1), segment.left, segment.right, segment.bottom, segment.top);
}
for (const opening of built.openings) {
- const marker = new THREE37.Object3D;
+ const marker = new THREE38.Object3D;
marker.name = `Opening_${wall}_${opening.id}`;
marker.position.set(axis === "x" ? opening.offset : 0, opening.sill + opening.height / 2, axis === "z" ? opening.offset : 0);
marker.scale.set(axis === "x" ? opening.width : opening.depth, opening.height, axis === "z" ? opening.width : opening.depth);
@@ -26349,7 +26564,7 @@ function createGableShell(name, materials, options) {
const closedEnds = options.closedEnds ?? true;
const enterable = options.enterable ?? true;
const shellOpenings = options.openings ?? (enterable ? [{ wall: "front", kind: "door" }] : []);
- const root = new THREE37.Object3D;
+ const root = new THREE38.Object3D;
root.name = name;
stampSemanticMetadataV1(root, roleMetadata(["architecture.shell.gable"], [relationship("contains", "floor"), relationship("contains", "roof.assembly")]));
const wallSpecs = {
@@ -26367,7 +26582,7 @@ function createGableShell(name, materials, options) {
walls[wall] = built.root;
openingMarkers.push(...built.openings);
}
- const floor = new THREE37.Mesh(new THREE37.BoxGeometry(spanX, floorThickness, spanZ), materials.floor ?? materials.wall);
+ const floor = new THREE38.Mesh(new THREE38.BoxGeometry(spanX, floorThickness, spanZ), materials.floor ?? materials.wall);
floor.name = `Mesh_${name}_Floor`;
floor.position.y = -floorThickness / 2;
stampSemanticMetadataV1(floor, roleMetadata(["floor"], ["front", "back", "left", "right"].map((wall) => relationship("adjacent-to", `wall.${wall}`))));
@@ -26482,13 +26697,13 @@ function createRoofSurfaceLayout(name, material, options) {
assertDimension("createRoofSurfaceLayout generated width", spec.width);
assertDimension("createRoofSurfaceLayout generated length", spec.length);
}
- const root = new THREE37.Object3D;
+ const root = new THREE38.Object3D;
root.name = name;
stampSemanticMetadataV1(root, roleMetadata([`roof.surface.${options.kind}`], [relationship("coverage-of", `roof.slope.${options.face.side}`)]));
const items = specs.map((spec, index) => {
- const mesh = new THREE37.Mesh(new THREE37.BoxGeometry(spec.width, thickness, spec.length), material);
+ const mesh = new THREE38.Mesh(new THREE38.BoxGeometry(spec.width, thickness, spec.length), material);
mesh.name = `Mesh_${name}_${index + 1}`;
- const local = new THREE37.Matrix4().makeTranslation(spec.x, thickness / 2 + 0.002, spec.z);
+ const local = new THREE38.Matrix4().makeTranslation(spec.x, thickness / 2 + 0.002, spec.z);
setTransform(mesh, faceToRoot.clone().multiply(local));
root.add(mesh);
return mesh;
@@ -26505,7 +26720,7 @@ var init_architecture2 = __esm(() => {
});
// src/gears.ts
-import * as THREE38 from "three";
+import * as THREE39 from "three";
function gearGeo(opts = {}) {
const {
teeth = 12,
@@ -26604,8 +26819,8 @@ function gearGeo(opts = {}) {
indices.push(tA, bA, bB);
indices.push(tA, bB, tB);
}
- const geo = new THREE38.BufferGeometry;
- geo.setAttribute("position", new THREE38.Float32BufferAttribute(positions, 3));
+ const geo = new THREE39.BufferGeometry;
+ geo.setAttribute("position", new THREE39.Float32BufferAttribute(positions, 3));
geo.setIndex(indices);
const nonIndexed = geo.toNonIndexed();
nonIndexed.computeVertexNormals();
@@ -26690,8 +26905,8 @@ function bladeGeo(opts = {}) {
indices.push(count + i, tip, count + j);
}
}
- const geo = new THREE38.BufferGeometry;
- geo.setAttribute("position", new THREE38.Float32BufferAttribute(positions, 3));
+ const geo = new THREE39.BufferGeometry;
+ geo.setAttribute("position", new THREE39.Float32BufferAttribute(positions, 3));
geo.setIndex(indices);
const nonIndexed = geo.toNonIndexed();
nonIndexed.computeVertexNormals();
@@ -26703,7 +26918,7 @@ var init_gears = __esm(() => {
});
// src/ops.ts
-import * as THREE39 from "three";
+import * as THREE40 from "three";
import { LoopSubdivision } from "three-subdivide/build/index.module.js";
import { mergeVertices as threeMergeVertices } from "three/examples/jsm/utils/BufferGeometryUtils.js";
function assertFiniteSourceFrame(name, source) {
@@ -26737,9 +26952,9 @@ function arrayLinear(namePrefix, source, count, offset, parent) {
}
function degreesOf(euler) {
return [
- THREE39.MathUtils.radToDeg(euler.x),
- THREE39.MathUtils.radToDeg(euler.y),
- THREE39.MathUtils.radToDeg(euler.z)
+ THREE40.MathUtils.radToDeg(euler.x),
+ THREE40.MathUtils.radToDeg(euler.y),
+ THREE40.MathUtils.radToDeg(euler.z)
];
}
function arrayRadial(namePrefix, source, count, axis = "y", parent, center, options = {}) {
@@ -26752,12 +26967,12 @@ function arrayRadial(namePrefix, source, count, axis = "y", parent, center, opti
if (center)
assertFiniteTriple("arrayRadial center", center);
const out = [];
- const pivot = center ? new THREE39.Vector3(...center) : new THREE39.Vector3;
+ const pivot = center ? new THREE40.Vector3(...center) : new THREE40.Vector3;
const basePos = source.position.clone().sub(pivot);
- const axisVec = axis === "x" ? new THREE39.Vector3(1, 0, 0) : axis === "z" ? new THREE39.Vector3(0, 0, 1) : new THREE39.Vector3(0, 1, 0);
+ const axisVec = axis === "x" ? new THREE40.Vector3(1, 0, 0) : axis === "z" ? new THREE40.Vector3(0, 0, 1) : new THREE40.Vector3(0, 1, 0);
const positions = [];
for (let i = 1;i < count; i++) {
- const position = basePos.clone().applyMatrix4(new THREE39.Matrix4().makeRotationAxis(axisVec, i / count * Math.PI * 2)).add(pivot);
+ const position = basePos.clone().applyMatrix4(new THREE40.Matrix4().makeRotationAxis(axisVec, i / count * Math.PI * 2)).add(pivot);
assertFiniteTriple("arrayRadial resulting position", position.toArray());
positions.push(position);
}
@@ -26796,7 +27011,7 @@ function repeatAlongCurve(source, points, options) {
assertFiniteTriple(`${name} points[${i}]`, point);
const up = options.up ?? [0, 1, 0];
assertFiniteTriple(`${name} up`, up);
- const upVector = new THREE39.Vector3(...up);
+ const upVector = new THREE40.Vector3(...up);
if (upVector.lengthSq() === 0)
throw new RangeError(`${name} up must not be zero.`);
upVector.normalize();
@@ -26835,13 +27050,13 @@ function repeatAlongCurve(source, points, options) {
segment++;
while (segment < points.length - 2 && cumulative[segment + 1] === cumulative[segment])
segment++;
- const a = new THREE39.Vector3(...points[segment]);
- const b = new THREE39.Vector3(...points[segment + 1]);
+ const a = new THREE40.Vector3(...points[segment]);
+ const b = new THREE40.Vector3(...points[segment + 1]);
const segmentLength = cumulative[segment + 1] - cumulative[segment];
const local = segmentLength > 0 ? (s - cumulative[segment]) / segmentLength : 0;
const position = a.clone().lerp(b, Math.min(Math.max(local, 0), 1));
- const k = THREE39.MathUtils.lerp(scale[0], scale[1], t);
- const rotation = new THREE39.Matrix4;
+ const k = THREE40.MathUtils.lerp(scale[0], scale[1], t);
+ const rotation = new THREE40.Matrix4;
let angle = 0;
if (align === "tangent") {
const tangent = b.clone().sub(a).normalize();
@@ -26849,17 +27064,17 @@ function repeatAlongCurve(source, points, options) {
if (side.lengthSq() < 0.000000000001)
side = previousUp.clone().sub(tangent.clone().multiplyScalar(previousUp.dot(tangent)));
if (side.lengthSq() < 0.000000000001)
- side = new THREE39.Vector3(Math.abs(tangent.x) < 0.9 ? 1 : 0, Math.abs(tangent.x) < 0.9 ? 0 : 1, 0).sub(tangent.clone().multiplyScalar(Math.abs(tangent.x) < 0.9 ? tangent.x : tangent.y));
+ side = new THREE40.Vector3(Math.abs(tangent.x) < 0.9 ? 1 : 0, Math.abs(tangent.x) < 0.9 ? 0 : 1, 0).sub(tangent.clone().multiplyScalar(Math.abs(tangent.x) < 0.9 ? tangent.x : tangent.y));
side.normalize();
previousUp = side;
- rotation.makeBasis(tangent, side, new THREE39.Vector3().crossVectors(tangent, side));
- angle = THREE39.MathUtils.degToRad(THREE39.MathUtils.lerp(twist[0], twist[1], t));
+ rotation.makeBasis(tangent, side, new THREE40.Vector3().crossVectors(tangent, side));
+ angle = THREE40.MathUtils.degToRad(THREE40.MathUtils.lerp(twist[0], twist[1], t));
}
for (const extra of opposite ? [0, Math.PI] : [0]) {
const turned = rotation.clone();
if (angle + extra)
- turned.multiply(new THREE39.Matrix4().makeRotationX(angle + extra));
- const matrix = new THREE39.Matrix4().makeTranslation(position.x, position.y, position.z).multiply(turned).multiply(new THREE39.Matrix4().makeScale(k, k, k));
+ turned.multiply(new THREE40.Matrix4().makeRotationX(angle + extra));
+ const matrix = new THREE40.Matrix4().makeTranslation(position.x, position.y, position.z).multiply(turned).multiply(new THREE40.Matrix4().makeScale(k, k, k));
if (!matrix.elements.every(Number.isFinite))
throw new RangeError(`${name} produced a non-finite copy transform.`);
frames.push({ matrix, t });
@@ -26891,9 +27106,9 @@ function repeatAlongCurve(source, points, options) {
const total = perCopy * copies;
if (total > GEOMETRY_ALLOCATION_LIMITS.curveRepeatVertices)
throw new RangeError(`${name} would produce ${total} vertices; the limit is ${GEOMETRY_ALLOCATION_LIMITS.curveRepeatVertices}. Reduce count, simplify the source, or use merge: false.`);
- const merged = new THREE39.BufferGeometry;
- const vector = new THREE39.Vector3;
- const normalMatrix = new THREE39.Matrix3;
+ const merged = new THREE40.BufferGeometry;
+ const vector = new THREE40.Vector3;
+ const normalMatrix = new THREE40.Matrix3;
for (const [key, attribute] of Object.entries(geometry.attributes)) {
const size = attribute.itemSize;
const transformed = key === "position" || key === "normal" || key === "tangent";
@@ -26917,13 +27132,13 @@ function repeatAlongCurve(source, points, options) {
}
}
}
- merged.setAttribute(key, new THREE39.BufferAttribute(out, size, transformed ? false : attribute.normalized));
+ merged.setAttribute(key, new THREE40.BufferAttribute(out, size, transformed ? false : attribute.normalized));
}
if (options.along) {
const along = new Float32Array(total);
for (let copy = 0;copy < copies; copy++)
along.fill(frames[copy].t, copy * perCopy, (copy + 1) * perCopy);
- merged.setAttribute("_along", new THREE39.BufferAttribute(along, 1));
+ merged.setAttribute("_along", new THREE40.BufferAttribute(along, 1));
}
const index = geometry.getIndex();
if (index) {
@@ -26931,7 +27146,7 @@ function repeatAlongCurve(source, points, options) {
for (let copy = 0;copy < copies; copy++)
for (let i = 0;i < index.count; i++)
indices[copy * index.count + i] = index.getX(i) + copy * perCopy;
- merged.setIndex(new THREE39.BufferAttribute(indices, 1));
+ merged.setIndex(new THREE40.BufferAttribute(indices, 1));
}
merged.computeBoundingBox();
merged.computeBoundingSphere();
@@ -26940,15 +27155,15 @@ function repeatAlongCurve(source, points, options) {
function mirror(name, source, axis, parent) {
if (source.matrixAutoUpdate)
source.updateMatrix();
- const reflected = new THREE39.Matrix4().makeScale(axis === "x" ? -1 : 1, axis === "y" ? -1 : 1, axis === "z" ? -1 : 1).multiply(source.matrix);
+ const reflected = new THREE40.Matrix4().makeScale(axis === "x" ? -1 : 1, axis === "y" ? -1 : 1, axis === "z" ? -1 : 1).multiply(source.matrix);
if (!reflected.elements.every(Number.isFinite) || reflected.determinant() === 0) {
throw new RangeError(`mirror("${name}"): source requires a finite, nonsingular local transform.`);
}
- const position = new THREE39.Vector3;
- const quaternion = new THREE39.Quaternion;
- const scale = new THREE39.Vector3;
+ const position = new THREE40.Vector3;
+ const quaternion = new THREE40.Quaternion;
+ const scale = new THREE40.Vector3;
reflected.decompose(position, quaternion, scale);
- const recomposed = new THREE39.Matrix4().compose(position, quaternion, scale);
+ const recomposed = new THREE40.Matrix4().compose(position, quaternion, scale);
if (reflected.elements.some((value, i) => Math.abs(value - recomposed.elements[i]) > 0.00000001 * Math.max(1, Math.abs(value)))) {
throw new RangeError(`mirror("${name}"): local shear cannot be represented by a reflected TRS.`);
}
@@ -26964,13 +27179,13 @@ function mergeVertices(geometry, opts = {}) {
const { tolerance = 0.0001, positionOnly = false } = typeof opts === "number" ? { tolerance: opts } : opts;
if (!positionOnly)
return threeMergeVertices(geometry, tolerance);
- const stripped = new THREE39.BufferGeometry;
+ const stripped = new THREE40.BufferGeometry;
const pos = geometry.getAttribute("position");
if (!pos)
return geometry;
- stripped.setAttribute("position", new THREE39.BufferAttribute(new Float32Array(pos.array), pos.itemSize, pos.normalized));
+ stripped.setAttribute("position", new THREE40.BufferAttribute(new Float32Array(pos.array), pos.itemSize, pos.normalized));
if (geometry.index) {
- stripped.setIndex(new THREE39.BufferAttribute(new Uint32Array(geometry.index.array), 1));
+ stripped.setIndex(new THREE40.BufferAttribute(new Uint32Array(geometry.index.array), 1));
}
return threeMergeVertices(stripped, tolerance);
}
@@ -27005,8 +27220,8 @@ function subdivide(geometry, iterations = 1, opts = {}) {
const { weld = true, preserveUV = false, ...subOpts } = opts;
const prepared = geometry.clone();
prepared.computeBoundingBox();
- const center = prepared.boundingBox.getCenter(new THREE39.Vector3);
- const extent = prepared.boundingBox.getSize(new THREE39.Vector3);
+ const center = prepared.boundingBox.getCenter(new THREE40.Vector3);
+ const extent = prepared.boundingBox.getSize(new THREE40.Vector3);
const size = Math.max(extent.x, extent.y, extent.z);
const normalizationScale = size > 0 ? 1e4 / size : 1;
if (!Number.isFinite(normalizationScale) || !center.toArray().every(Number.isFinite))
@@ -27036,13 +27251,13 @@ function subdivide(geometry, iterations = 1, opts = {}) {
const values = new Float32Array(attribute.count);
for (let i = 0;i < attribute.count; i++)
values[i] = decoded[i * 4 + component];
- input.setAttribute(lane, new THREE39.BufferAttribute(values, 1));
+ input.setAttribute(lane, new THREE40.BufferAttribute(values, 1));
lanes.push(lane);
}
input.deleteAttribute(name);
fourthComponents.push({ name, lanes });
} else
- input.setAttribute(name, new THREE39.BufferAttribute(decoded, components));
+ input.setAttribute(name, new THREE40.BufferAttribute(decoded, components));
}
for (const targets of Object.values(input.morphAttributes))
for (let target = 0;target < targets.length; target++) {
@@ -27051,7 +27266,7 @@ function subdivide(geometry, iterations = 1, opts = {}) {
for (let i = 0;i < attribute.count; i++)
for (let component = 0;component < 3; component++)
decoded[i * 3 + component] = attribute.getComponent(i, component);
- targets[target] = new THREE39.BufferAttribute(decoded, 3);
+ targets[target] = new THREE40.BufferAttribute(decoded, 3);
}
if (preserveUV)
subOpts.uvSmooth = false;
@@ -27065,7 +27280,7 @@ function subdivide(geometry, iterations = 1, opts = {}) {
values[i * 4 + component] = lane.getX(i);
output.deleteAttribute(lanes[component]);
}
- output.setAttribute(name, new THREE39.BufferAttribute(values, 4));
+ output.setAttribute(name, new THREE40.BufferAttribute(values, 4));
}
output.scale(1 / normalizationScale, 1 / normalizationScale, 1 / normalizationScale).translate(center.x, center.y, center.z);
output.userData = structuredClone(geometry.userData);
@@ -27130,9 +27345,9 @@ function assertTubeRadius(radius) {
}
function curveToMesh(points, radius, tubularSegments = 32, radialSegments = 8, closed = false) {
assertTubeRadius(radius);
- const vectors = points.map((p) => new THREE39.Vector3(p[0], p[1], p[2]));
- const curve = new THREE39.CatmullRomCurve3(vectors, closed);
- return new THREE39.TubeGeometry(curve, tubularSegments, radius, radialSegments, closed);
+ const vectors = points.map((p) => new THREE40.Vector3(p[0], p[1], p[2]));
+ const curve = new THREE40.CatmullRomCurve3(vectors, closed);
+ return new THREE40.TubeGeometry(curve, tubularSegments, radius, radialSegments, closed);
}
function normalizeSurfaceNormals(geo) {
const normal = geo.getAttribute("normal");
@@ -27163,15 +27378,15 @@ function lathe(profile, segments = 12) {
}
function revolveGeo(profile, options = {}) {
const { angle = Math.PI * 2, axis = [0, 1, 0], segments = 12 } = options;
- const points2d = profile.map((p) => new THREE39.Vector2(p[0], p[1]));
- const geo = normalizeSurfaceNormals(new THREE39.LatheGeometry(points2d, segments, 0, angle));
- const n = new THREE39.Vector3(axis[0], axis[1], axis[2]);
+ const points2d = profile.map((p) => new THREE40.Vector2(p[0], p[1]));
+ const geo = normalizeSurfaceNormals(new THREE40.LatheGeometry(points2d, segments, 0, angle));
+ const n = new THREE40.Vector3(axis[0], axis[1], axis[2]);
if (n.lengthSq() < 0.000000000001) {
throw new Error(`revolveGeo: axis must be a non-zero vector (got [${axis.join(",")}]).`);
}
n.normalize();
if (n.x !== 0 || n.y !== 1 || n.z !== 0) {
- const q = new THREE39.Quaternion().setFromUnitVectors(new THREE39.Vector3(0, 1, 0), n);
+ const q = new THREE40.Quaternion().setFromUnitVectors(new THREE40.Vector3(0, 1, 0), n);
geo.applyQuaternion(q);
}
return geo;
@@ -27187,9 +27402,9 @@ function pipeAlongPath(points, radius, options = {}) {
const smoothed = [];
smoothed.push(points[0]);
for (let i = 1;i < points.length - 1; i++) {
- const prev = new THREE39.Vector3(...points[i - 1]);
- const cur = new THREE39.Vector3(...points[i]);
- const next = new THREE39.Vector3(...points[i + 1]);
+ const prev = new THREE40.Vector3(...points[i - 1]);
+ const cur = new THREE40.Vector3(...points[i]);
+ const next = new THREE40.Vector3(...points[i + 1]);
const inDir = cur.clone().sub(prev);
const outDir = next.clone().sub(cur);
const inLen = inDir.length();
@@ -27207,12 +27422,12 @@ function pipeAlongPath(points, radius, options = {}) {
return curveToMesh(pathPoints, radius, tubularSegments, radialSegments, closed);
}
function bezierCurve(controlPoints, samples = 32) {
- const vecs = controlPoints.map((p) => new THREE39.Vector3(p[0], p[1], p[2]));
+ const vecs = controlPoints.map((p) => new THREE40.Vector3(p[0], p[1], p[2]));
let curve;
if (vecs.length === 3) {
- curve = new THREE39.QuadraticBezierCurve3(vecs[0], vecs[1], vecs[2]);
+ curve = new THREE40.QuadraticBezierCurve3(vecs[0], vecs[1], vecs[2]);
} else if (vecs.length === 4) {
- curve = new THREE39.CubicBezierCurve3(vecs[0], vecs[1], vecs[2], vecs[3]);
+ curve = new THREE40.CubicBezierCurve3(vecs[0], vecs[1], vecs[2], vecs[3]);
} else {
throw new Error(`bezierCurve: need 3 or 4 control points, got ${vecs.length}`);
}
@@ -27225,20 +27440,20 @@ var init_ops = __esm(() => {
});
// src/deformation-normals.ts
-import * as THREE40 from "three";
+import * as THREE41 from "three";
function recomputeDeformedNormals(source, output) {
const original = source.getAttribute("position");
const authored = source.getAttribute("normal");
const position = output.getAttribute("position");
const bounds = (attribute) => {
- const box = new THREE40.Box3().setFromBufferAttribute(attribute);
+ const box = new THREE41.Box3().setFromBufferAttribute(attribute);
return {
- center: box.getCenter(new THREE40.Vector3),
- size: box.getSize(new THREE40.Vector3).length() || 1
+ center: box.getCenter(new THREE41.Vector3),
+ size: box.getSize(new THREE41.Vector3).length() || 1
};
};
const before = bounds(original), after = bounds(position);
- const point = new THREE40.Vector3, normal = new THREE40.Vector3;
+ const point = new THREE41.Vector3, normal = new THREE41.Vector3;
const quantized = (attribute, index, frame) => {
point.fromBufferAttribute(attribute, index).sub(frame.center).divideScalar(frame.size);
return point.toArray().map((value) => Math.round(value * 1e7)).join(",");
@@ -27261,7 +27476,7 @@ function recomputeDeformedNormals(source, output) {
const sums = new Float64Array(classes.size * 3);
const index = output.index;
const corners = index?.count ?? position.count;
- const a = new THREE40.Vector3, b = new THREE40.Vector3, c = new THREE40.Vector3;
+ const a = new THREE41.Vector3, b = new THREE41.Vector3, c = new THREE41.Vector3;
for (let t = 0;t < corners; t += 3) {
const ia = index ? index.getX(t) : t;
const ib = index ? index.getX(t + 1) : t + 1;
@@ -27282,17 +27497,17 @@ function recomputeDeformedNormals(source, output) {
const offset = ids[i] * 3;
normal.set(sums[offset], sums[offset + 1], sums[offset + 2]).normalize().toArray(normals, i * 3);
}
- output.setAttribute("normal", new THREE40.BufferAttribute(normals, 3));
+ output.setAttribute("normal", new THREE41.BufferAttribute(normals, 3));
}
var init_deformation_normals = () => {};
// src/deform.ts
-import * as THREE41 from "three";
+import * as THREE42 from "three";
function geometryFrameMatrix(frame = {}) {
const origin = frame.origin ?? [0, 0, 0], rotation = frame.rotation ?? [0, 0, 0];
if (origin.length !== 3 || rotation.length !== 3 || ![...origin, ...rotation].every(Number.isFinite))
throw new Error("geometry frame requires finite xyz origin and rotation");
- return new THREE41.Matrix4().compose(new THREE41.Vector3(...origin), new THREE41.Quaternion().setFromEuler(new THREE41.Euler(...rotation.map(THREE41.MathUtils.degToRad), "XYZ")), new THREE41.Vector3(1, 1, 1));
+ return new THREE42.Matrix4().compose(new THREE42.Vector3(...origin), new THREE42.Quaternion().setFromEuler(new THREE42.Euler(...rotation.map(THREE42.MathUtils.degToRad), "XYZ")), new THREE42.Vector3(1, 1, 1));
}
function deform(geometry, options, map) {
const source = geometry.getAttribute("position");
@@ -27319,7 +27534,7 @@ function deform(geometry, options, map) {
throw new Error("deformation normals must be finite");
}
const matrix = geometryFrameMatrix(options.frame), inverse = matrix.clone().invert();
- const points = Array.from({ length: source.count }, (_, i) => new THREE41.Vector3().fromBufferAttribute(source, i).applyMatrix4(inverse));
+ const points = Array.from({ length: source.count }, (_, i) => new THREE42.Vector3().fromBufferAttribute(source, i).applyMatrix4(inverse));
if (points.some((p) => ![p.x, p.y, p.z].every(Number.isFinite)))
throw new Error("deformation positions must be finite");
let low = Infinity, high = -Infinity;
@@ -27342,7 +27557,7 @@ function deform(geometry, options, map) {
const point = points[i];
if (point.y < low - epsilon || point.y > high + epsilon)
continue;
- const t = length > 0 ? THREE41.MathUtils.clamp((point.y - low) / length, 0, 1) : 0;
+ const t = length > 0 ? THREE42.MathUtils.clamp((point.y - low) / length, 0, 1) : 0;
const weight = options.falloff?.(t) ?? 1;
if (!Number.isFinite(weight) || weight < 0 || weight > 1)
throw new Error("deformation falloff must return a finite weight between 0 and 1");
@@ -27376,31 +27591,31 @@ function deform(geometry, options, map) {
function twist(geometry, options) {
if (!Number.isFinite(options.angle))
throw new Error("twist angle must be finite degrees");
- return deform(geometry, options, (p, t) => p.applyAxisAngle(new THREE41.Vector3(0, 1, 0), THREE41.MathUtils.degToRad(options.angle) * t));
+ return deform(geometry, options, (p, t) => p.applyAxisAngle(new THREE42.Vector3(0, 1, 0), THREE42.MathUtils.degToRad(options.angle) * t));
}
function bend(geometry, options) {
if (!Number.isFinite(options.angle))
throw new Error("bend angle must be finite degrees");
- const angle = THREE41.MathUtils.degToRad(options.angle);
+ const angle = THREE42.MathUtils.degToRad(options.angle);
return deform(geometry, options, (p, t, low, length) => {
if (Math.abs(angle) < 0.0000000001 || length === 0)
return p;
const radius = length / angle, theta = angle * t;
- return new THREE41.Vector3(radius - (radius - p.x) * Math.cos(theta), low + (radius - p.x) * Math.sin(theta), p.z);
+ return new THREE42.Vector3(radius - (radius - p.x) * Math.cos(theta), low + (radius - p.x) * Math.sin(theta), p.z);
});
}
function taper(geometry, options) {
const start = options.startScale ?? [1, 1], end = options.endScale;
if (start.length !== 2 || end.length !== 2 || ![...start, ...end].every((n) => Number.isFinite(n) && n > 0))
throw new Error("taper scales must be two finite positive values");
- return deform(geometry, options, (p, t) => p.set(p.x * THREE41.MathUtils.lerp(start[0], end[0], t), p.y, p.z * THREE41.MathUtils.lerp(start[1], end[1], t)));
+ return deform(geometry, options, (p, t) => p.set(p.x * THREE42.MathUtils.lerp(start[0], end[0], t), p.y, p.z * THREE42.MathUtils.lerp(start[1], end[1], t)));
}
function displace(geometry, offset, options = {}) {
return deform(geometry, options, (p, t) => {
const delta = offset([p.x, p.y, p.z], t);
if (delta.length !== 3 || !delta.every(Number.isFinite))
throw new Error("displace callback must return three finite offsets");
- return p.add(new THREE41.Vector3(...delta));
+ return p.add(new THREE42.Vector3(...delta));
});
}
var init_deform = __esm(() => {
@@ -27408,7 +27623,7 @@ var init_deform = __esm(() => {
});
// src/sweep.ts
-import * as THREE42 from "three";
+import * as THREE43 from "three";
function rejectHoles(value, label) {
if ("holes" in value && value.holes !== undefined)
throw new AuthoringDiagnosticError("PROFILE_HOLES_UNSUPPORTED", `${label}: holes are unsupported. Use extrudeProfile for a holed cross-section with optional twist/taper; independently varying contours need explicit geometry or solid subtraction.`);
@@ -27416,9 +27631,9 @@ function rejectHoles(value, label) {
function profilePoints(profile) {
if (profile.length < 3 || profile.some((p) => p.length !== 2 || !p.every(Number.isFinite)))
throw new Error("profile requires at least three finite xy points");
- const points = profile.map((p) => new THREE42.Vector2(...p));
- const bounds = new THREE42.Box2().setFromPoints(points);
- const extent = bounds.getSize(new THREE42.Vector2).length();
+ const points = profile.map((p) => new THREE43.Vector2(...p));
+ const bounds = new THREE43.Box2().setFromPoints(points);
+ const extent = bounds.getSize(new THREE43.Vector2).length();
if (!(extent > 0) || !Number.isFinite(extent))
throw new Error("profile requires a finite nonzero extent");
const normalized = points.map((p) => p.clone().sub(bounds.min).divideScalar(extent));
@@ -27441,7 +27656,7 @@ function profilePoints(profile) {
throw new Error("profile self-intersects or touches itself");
}
}
- const area = THREE42.ShapeUtils.area(normalized);
+ const area = THREE43.ShapeUtils.area(normalized);
if (Math.abs(area) < 0.000000000001)
throw new Error("profile area must be nonzero");
if (area < 0)
@@ -27455,11 +27670,11 @@ function isCrease(first, second, creaseAngle) {
if (!(first.lengthSq() > 0 && second.lengthSq() > 0))
return false;
const angle = Math.atan2(first.clone().cross(second).length(), first.dot(second));
- return THREE42.MathUtils.radToDeg(angle) > creaseAngle + CREASE_TOLERANCE_DEGREES;
+ return THREE43.MathUtils.radToDeg(angle) > creaseAngle + CREASE_TOLERANCE_DEGREES;
}
function buildLoft(rings, profiles, closed, cap, firstFrameForward, creaseAngle) {
const n = rings[0].length, positions = [], uvs = [], indices = [];
- const centers = rings.map((r) => r.reduce((sum, p) => sum.add(p), new THREE42.Vector3).multiplyScalar(1 / n));
+ const centers = rings.map((r) => r.reduce((sum, p) => sum.add(p), new THREE43.Vector3).multiplyScalar(1 / n));
const lengths = [0];
for (let i = 1;i < centers.length; i++)
lengths.push(lengths[i - 1] + centers[i].distanceTo(centers[i - 1]));
@@ -27519,13 +27734,13 @@ function buildLoft(rings, profiles, closed, cap, firstFrameForward, creaseAngle)
continue;
const ring = rings[station], profile = profiles[station];
const start = positions.length / 3;
- const bounds = new THREE42.Box2().setFromPoints(profile);
- const size = bounds.getSize(new THREE42.Vector2);
+ const bounds = new THREE43.Box2().setFromPoints(profile);
+ const size = bounds.getSize(new THREE43.Vector2);
for (let j = 0;j < n; j++) {
positions.push(...ring[j].toArray());
uvs.push((profile[j].x - bounds.min.x) / (size.x || 1), (profile[j].y - bounds.min.y) / (size.y || 1));
}
- for (const tri of THREE42.ShapeUtils.triangulateShape(profile, [])) {
+ for (const tri of THREE43.ShapeUtils.triangulateShape(profile, [])) {
if (station === 0)
indices.push(...tri.map((j) => start + j));
else
@@ -27538,7 +27753,7 @@ function buildLoft(rings, profiles, closed, cap, firstFrameForward, creaseAngle)
const out = meshGeo({ positions, indices, uvs });
const normal = out.getAttribute("normal");
const share = (a, b) => {
- const sum = new THREE42.Vector3().fromBufferAttribute(normal, a).add(new THREE42.Vector3().fromBufferAttribute(normal, b)).normalize();
+ const sum = new THREE43.Vector3().fromBufferAttribute(normal, a).add(new THREE43.Vector3().fromBufferAttribute(normal, b)).normalize();
normal.setXYZ(a, sum.x, sum.y, sum.z);
normal.setXYZ(b, sum.x, sum.y, sum.z);
};
@@ -27576,8 +27791,8 @@ function loftProfiles(sections, options = {}) {
if (profiles.some((p) => p.length !== profiles[0].length))
throw new Error("loftProfiles sections must have the same point count and correspondence");
const frames = sections.map((section) => geometryFrameMatrix(section.frame));
- const rings = profiles.map((profile, i) => profile.map((p) => new THREE42.Vector3(p.x, 0, p.y).applyMatrix4(frames[i])));
- const out = buildLoft(rings, profiles, false, loftCapEnds(options.cap), new THREE42.Vector3(0, 1, 0).transformDirection(frames[0]));
+ const rings = profiles.map((profile, i) => profile.map((p) => new THREE43.Vector3(p.x, 0, p.y).applyMatrix4(frames[i])));
+ const out = buildLoft(rings, profiles, false, loftCapEnds(options.cap), new THREE43.Vector3(0, 1, 0).transformDirection(frames[0]));
const analysis = recordSweepAnalysis(out, rings, profiles, false);
out.userData.kilnGeometryWarnings = analysis.complete ? [] : [
{
@@ -27600,8 +27815,8 @@ function sweepProfile(profile, path, options = {}) {
const cap = sweepCapEnds(options.cap, closed);
if (path.length < (closed ? 3 : 2) || path.some((p) => p.length !== 3 || !p.every(Number.isFinite)))
throw new Error("sweepProfile requires finite path points (two open or three closed)");
- const stations = path.map((p) => new THREE42.Vector3(...p));
- const pathExtent = new THREE42.Box3().setFromPoints(stations).getSize(new THREE42.Vector3).length();
+ const stations = path.map((p) => new THREE43.Vector3(...p));
+ const pathExtent = new THREE43.Box3().setFromPoints(stations).getSize(new THREE43.Vector3).length();
if (!(pathExtent > 0) || !Number.isFinite(pathExtent))
throw new Error("sweepProfile path stations must be distinct with finite extent");
const pathTolerance = pathExtent * 0.0000000001;
@@ -27642,7 +27857,7 @@ function sweepProfile(profile, path, options = {}) {
});
return incoming.clone().add(outgoing).normalize();
});
- const up = options.up ? new THREE42.Vector3(...options.up) : Math.abs(tangents[0].z) < 0.9 ? new THREE42.Vector3(0, 0, 1) : new THREE42.Vector3(1, 0, 0);
+ const up = options.up ? new THREE43.Vector3(...options.up) : Math.abs(tangents[0].z) < 0.9 ? new THREE43.Vector3(0, 0, 1) : new THREE43.Vector3(1, 0, 0);
const upLength = Math.hypot(up.x, up.y, up.z);
if (!(upLength > 0) || !Number.isFinite(upLength))
throw new Error("sweepProfile up must be a finite nonzero vector");
@@ -27659,7 +27874,7 @@ function sweepProfile(profile, path, options = {}) {
}
const distances = [0];
for (let i = 1;i < stations.length; i++) {
- z = z.clone().applyQuaternion(new THREE42.Quaternion().setFromUnitVectors(tangents[i - 1], tangents[i]));
+ z = z.clone().applyQuaternion(new THREE43.Quaternion().setFromUnitVectors(tangents[i - 1], tangents[i]));
normals.push(z);
distances.push(distances[i - 1] + stations[i].distanceTo(stations[i - 1]));
}
@@ -27669,7 +27884,7 @@ function sweepProfile(profile, path, options = {}) {
correction = Math.atan2(tangents[0].dot(normals[normals.length - 1].clone().cross(normals[0])), normals[normals.length - 1].dot(normals[0]));
const rings = stations.map((station, i) => {
const tangent = tangents[i], t = distances[i] / total;
- const axisZ = normals[i].clone().applyAxisAngle(tangent, (correction + THREE42.MathUtils.degToRad(twist)) * t);
+ const axisZ = normals[i].clone().applyAxisAngle(tangent, (correction + THREE43.MathUtils.degToRad(twist)) * t);
const axisX = tangent.clone().cross(axisZ).normalize(), scale = scales[i];
return points.map((p) => station.clone().addScaledVector(axisX, p.x * scale[0]).addScaledVector(axisZ, p.y * scale[1]));
});
@@ -27694,7 +27909,7 @@ var init_sweep2 = __esm(() => {
});
// src/simplify.ts
-import * as THREE43 from "three";
+import * as THREE44 from "three";
function loadSimplifier() {
simplifierReady ??= import("meshoptimizer/simplifier").then(async ({ MeshoptSimplifier }) => {
await MeshoptSimplifier.ready;
@@ -27716,7 +27931,7 @@ function gather(attribute, vertices) {
for (let i = 0;i < vertices.length; i++)
for (let c = 0;c < attribute.itemSize; c++)
values[i * attribute.itemSize + c] = raw(attribute, vertices[i], c);
- const out = new THREE43.BufferAttribute(values, attribute.itemSize, attribute.normalized);
+ const out = new THREE44.BufferAttribute(values, attribute.itemSize, attribute.normalized);
out.name = attribute.name;
return out;
}
@@ -28001,14 +28216,14 @@ async function simplifyGeometry(geometry, options) {
indexValues[i] = remap[w];
}
const sources = Uint32Array.from(used, (w) => representative[w]);
- const out = new THREE43.BufferGeometry;
+ const out = new THREE44.BufferGeometry;
out.name = geometry.name;
const outPosition = new Float32Array(sources.length * 3);
for (let i = 0;i < used.length; i++)
outPosition.set(positions.subarray(used[i] * 3, used[i] * 3 + 3), i * 3);
for (const [name, attribute] of Object.entries(geometry.attributes)) {
if (name === "position") {
- const attr = new THREE43.BufferAttribute(outPosition, 3);
+ const attr = new THREE44.BufferAttribute(outPosition, 3);
attr.name = attribute.name;
out.setAttribute(name, attr);
} else
@@ -28017,7 +28232,7 @@ async function simplifyGeometry(geometry, options) {
for (const [name, targets] of Object.entries(geometry.morphAttributes))
out.morphAttributes[name] = targets.map((target) => gather(target, sources));
out.morphTargetsRelative = geometry.morphTargetsRelative;
- out.setIndex(new THREE43.BufferAttribute(indexValues, 1));
+ out.setIndex(new THREE44.BufferAttribute(indexValues, 1));
for (const group of outGroups)
out.addGroup(group.start, group.count, group.materialIndex);
out.computeBoundingBox();
@@ -28072,7 +28287,7 @@ var init_simplify = __esm(() => {
});
// src/solids.ts
-import * as THREE44 from "three";
+import * as THREE45 from "three";
async function getManifoldModule() {
if (_module)
return _module;
@@ -28102,10 +28317,10 @@ function computationFrame(parts) {
meshes.push(mesh);
});
}
- const origin = meshes.length ? new THREE44.Vector3().setFromMatrixPosition(meshes[0].matrixWorld) : new THREE44.Vector3;
+ const origin = meshes.length ? new THREE45.Vector3().setFromMatrixPosition(meshes[0].matrixWorld) : new THREE45.Vector3;
const matrices = new Map;
- const bounds = new THREE44.Box3;
- const point = new THREE44.Vector3;
+ const bounds = new THREE45.Box3;
+ const point = new THREE45.Vector3;
for (const mesh of meshes) {
const matrix = mesh.matrixWorld.clone();
matrix.elements[12] -= origin.x;
@@ -28122,11 +28337,11 @@ function computationFrame(parts) {
bounds.expandByPoint(point);
}
}
- const size = bounds.getSize(new THREE44.Vector3);
+ const size = bounds.getSize(new THREE45.Vector3);
const scale = Math.hypot(size.x, size.y, size.z);
if (!Number.isFinite(scale))
throw new Error("CSG: combined operand extent must be finite");
- return { origin, center: bounds.getCenter(new THREE44.Vector3), scale: scale || 1, matrices };
+ return { origin, center: bounds.getCenter(new THREE45.Vector3), scale: scale || 1, matrices };
}
function retainNotes(target, notes) {
if (!Array.isArray(notes))
@@ -28206,7 +28421,7 @@ function threeToManifold(src, mod, label, context) {
else
context.missingUV.add(mesh.name || label);
}
- const point = new THREE44.Vector3;
+ const point = new THREE45.Vector3;
for (let i = 0;i < position.count; i++) {
point.fromBufferAttribute(position, i).applyMatrix4(context.frame.matrices.get(mesh)).sub(context.frame.center).divideScalar(context.frame.scale);
if (![point.x, point.y, point.z].every((n) => Number.isFinite(Math.fround(n))))
@@ -28349,11 +28564,11 @@ function solidMeshToGeometry({ mesh, collapsed }, opts = {}) {
if (uvs)
uvs.set(mesh.vertProperties.subarray(i + 3, i + 5), v * 2);
}
- const geometry = new THREE44.BufferGeometry;
- geometry.setAttribute("position", new THREE44.BufferAttribute(positions, 3));
- geometry.setIndex(new THREE44.BufferAttribute(new Uint32Array(mesh.triVerts), 1));
+ const geometry = new THREE45.BufferGeometry;
+ geometry.setAttribute("position", new THREE45.BufferAttribute(positions, 3));
+ geometry.setIndex(new THREE45.BufferAttribute(new Uint32Array(mesh.triVerts), 1));
if (uvs)
- geometry.setAttribute("uv", new THREE44.BufferAttribute(uvs, 2));
+ geometry.setAttribute("uv", new THREE45.BufferAttribute(uvs, 2));
const out = opts.smooth ? geometry : geometry.toNonIndexed();
out.computeVertexNormals();
if (opts.smooth && uvs) {
@@ -28384,7 +28599,7 @@ function firstMaterial(src) {
if (!material && mesh.isMesh)
material = Array.isArray(mesh.material) ? mesh.material[0] : mesh.material;
});
- return material ?? new THREE44.MeshStandardMaterial;
+ return material ?? new THREE45.MeshStandardMaterial;
}
function outputMesh(result, name, parts, opts, context, isHull) {
const materialized = materializeSolid(result);
@@ -28443,7 +28658,7 @@ function outputMesh(result, name, parts, opts, context, isHull) {
retainNotes(context.geometryWarnings, geometry.userData.kilnGeometryWarnings);
if (context.geometryWarnings.size)
geometry.userData.kilnGeometryWarnings = [...context.geometryWarnings.values()];
- const output = new THREE44.Mesh(geometry, context.preserve && !isHull && materials.length ? materials : firstMaterial(parts[0]));
+ const output = new THREE45.Mesh(geometry, context.preserve && !isHull && materials.length ? materials : firstMaterial(parts[0]));
output.name = `Mesh_${name}`;
output.position.copy(context.frame.origin);
return output;
@@ -28852,7 +29067,7 @@ function smoothUnionSpheres(point, spheres, blend) {
}
// src/organic.ts
-import * as THREE45 from "three";
+import * as THREE46 from "three";
function assertSafePathCount(name, count) {
if (!Number.isSafeInteger(count))
throw new Error(`${name} derived sample count must be a safe integer; reduce sample counts.`);
@@ -28884,8 +29099,8 @@ function catmullRomPath(controlPoints, samplesPerSpan = 8, closed = false) {
assertSafePathCount("catmullRomPath", spans * samplesPerSpan + 1);
if (controlPoints.some((p) => p.length !== 3 || !p.every(Number.isFinite)))
throw new Error("catmullRomPath control points must be finite [x,y,z] triples");
- const vectors = controlPoints.map((p) => new THREE45.Vector3(p[0], p[1], p[2]));
- const curve = new THREE45.CatmullRomCurve3(vectors, closed);
+ const vectors = controlPoints.map((p) => new THREE46.Vector3(p[0], p[1], p[2]));
+ const curve = new THREE46.CatmullRomCurve3(vectors, closed);
const points = curve.getPoints(spans * samplesPerSpan);
if (closed)
points.pop();
@@ -28939,8 +29154,8 @@ function spiralPath(options) {
throw new Error("spiralPath center must be a finite [x,y,z] triple");
if (axis.length !== 3 || forward.length !== 3 || ![...axis, ...forward].every(Number.isFinite))
throw new Error("spiralPath axis and forward must be finite [x,y,z] triples");
- const up = new THREE45.Vector3(...axis);
- const fwd = new THREE45.Vector3(...forward);
+ const up = new THREE46.Vector3(...axis);
+ const fwd = new THREE46.Vector3(...forward);
if (up.lengthSq() < 0.000000000001 || fwd.lengthSq() < 0.000000000001)
throw new Error("spiralPath axis and forward must be nonzero");
up.normalize();
@@ -28948,7 +29163,7 @@ function spiralPath(options) {
if (horiz.lengthSq() < 0.000000000001)
throw new Error("spiralPath forward must not be parallel to axis");
horiz.normalize();
- const right = new THREE45.Vector3().crossVectors(up, horiz).normalize();
+ const right = new THREE46.Vector3().crossVectors(up, horiz).normalize();
const out = [];
for (let i = 0;i <= samples; i++) {
const u = i / samples;
@@ -29062,7 +29277,7 @@ var init_seeded_random = __esm(() => {
});
// src/uv-shapes.ts
-import * as THREE46 from "three";
+import * as THREE47 from "three";
function remapUV(geo, options = {}) {
if (!options || typeof options !== "object" || Array.isArray(options) || Object.keys(options).some((key) => !["scale", "offset"].includes(key))) {
throw new Error("remapUV: options may contain only scale and offset.");
@@ -29091,7 +29306,7 @@ function remapUV(geo, options = {}) {
}
const cloned = geo.clone();
cloned.userData = structuredClone(geo.userData);
- cloned.setAttribute("uv", new THREE46.Float32BufferAttribute(values, 2));
+ cloned.setAttribute("uv", new THREE47.Float32BufferAttribute(values, 2));
if ((scale[0] !== 1 || scale[1] !== 1) && cloned.hasAttribute("tangent")) {
cloned.deleteAttribute("tangent");
const previous = cloned.userData.kilnAttributeWarnings;
@@ -29108,13 +29323,13 @@ function remapUV(geo, options = {}) {
var init_uv_shapes = () => {};
// src/texture-atlas.ts
-import * as THREE47 from "three";
+import * as THREE48 from "three";
async function textureAtlas(input, options = {}) {
const compiled = await compileTextureAtlasSpecV1(input, options);
- const texture = new THREE47.DataTexture(compiled.pixels, compiled.spec.width, compiled.spec.height, THREE47.RGBAFormat, THREE47.UnsignedByteType);
+ const texture = new THREE48.DataTexture(compiled.pixels, compiled.spec.width, compiled.spec.height, THREE48.RGBAFormat, THREE48.UnsignedByteType);
texture.name = "Atlas";
texture.flipY = false;
- texture.colorSpace = compiled.spec.usage === "albedo" || compiled.spec.usage === "emissive" ? THREE47.SRGBColorSpace : THREE47.NoColorSpace;
+ texture.colorSpace = compiled.spec.usage === "albedo" || compiled.spec.usage === "emissive" ? THREE48.SRGBColorSpace : THREE48.NoColorSpace;
applyPortableSamplerV1(texture, compiled.spec.sampler);
texture.userData.kilnAtlas = { spec: compiled.spec, manifest: compiled.manifest };
texture.userData.kilnTexture = {
@@ -29172,7 +29387,7 @@ function remapUVToAtlas(geometry, atlas, name, options) {
bytes += buffer.byteLength;
}
} else {
- bytes += attribute.array.byteLength * (attribute.constructor === THREE47.BufferAttribute || attribute.constructor === THREE47.InstancedBufferAttribute ? 1 : 2);
+ bytes += attribute.array.byteLength * (attribute.constructor === THREE48.BufferAttribute || attribute.constructor === THREE48.InstancedBufferAttribute ? 1 : 2);
}
};
for (const attr of Object.values(geometry.attributes))
@@ -29397,7 +29612,7 @@ var init_portable_material_runtime = __esm(() => {
});
// src/uv-data.ts
-import * as THREE48 from "three";
+import * as THREE49 from "three";
function validateAtlasRemap(mesh, inputIndex, sourceCount) {
const count = mesh.vertexCount;
if (!Number.isSafeInteger(count) || count < 1 || count > GEOMETRY_ALLOCATION_LIMITS.unwrapVertices)
@@ -29432,7 +29647,7 @@ function remapUnwrapAttribute(attribute, oldIndexes) {
for (let c = 0;c < attribute.itemSize; c++)
array[i * attribute.itemSize + c] = attribute.array[oldIndexes[i] * stride + offset + c];
}
- const output = attribute.isFloat16BufferAttribute ? new THREE48.Float16BufferAttribute(array, attribute.itemSize, attribute.normalized) : new THREE48.BufferAttribute(array, attribute.itemSize, attribute.normalized);
+ const output = attribute.isFloat16BufferAttribute ? new THREE49.Float16BufferAttribute(array, attribute.itemSize, attribute.normalized) : new THREE49.BufferAttribute(array, attribute.itemSize, attribute.normalized);
output.name = attribute.name;
output.setUsage(interleaved(attribute) ? attribute.data.usage : attribute.usage);
if (!interleaved(attribute))
@@ -29544,7 +29759,7 @@ var init_uv_data = __esm(() => {
});
// src/uv.ts
-import * as THREE49 from "three";
+import * as THREE50 from "three";
async function getXatlas() {
if (!_xatlasReady) {
_xatlasReady = (async () => {
@@ -29576,7 +29791,7 @@ async function autoUnwrap(geometry, opts = {}) {
if (result.atlasCount !== 1 || !Number.isSafeInteger(result.width) || result.width <= 0 || !Number.isSafeInteger(result.height) || result.height <= 0)
throw new Error("autoUnwrap: xatlas must return one valid atlas; multiple atlas pages are unsupported.");
const remap = validateAtlasRemap(mesh, prepared.index, geometry.getAttribute("position").count);
- const out = new THREE49.BufferGeometry;
+ const out = new THREE50.BufferGeometry;
for (const [name, attribute] of Object.entries(geometry.attributes)) {
if (name === "uv" || name === "tangent" || name === "normal" && !prepared.useNormals)
continue;
@@ -29586,8 +29801,8 @@ async function autoUnwrap(geometry, opts = {}) {
out.morphAttributes[name] = targets.map((attribute) => remapUnwrapAttribute(attribute, remap.oldIndexes));
}
out.morphTargetsRelative = geometry.morphTargetsRelative;
- out.setIndex(new THREE49.BufferAttribute(new Uint32Array(remap.index), 1));
- out.setAttribute("uv", new THREE49.BufferAttribute(new Float32Array(remap.uv), 2));
+ out.setIndex(new THREE50.BufferAttribute(new Uint32Array(remap.index), 1));
+ out.setAttribute("uv", new THREE50.BufferAttribute(new Float32Array(remap.uv), 2));
out.name = geometry.name;
out.groups = geometry.groups.map((group) => ({ ...group }));
out.setDrawRange(geometry.drawRange.start, geometry.drawRange.count);
@@ -29622,11 +29837,11 @@ function repairZeroNormals(geo) {
if (broken.size === 0)
return;
const acc = new Float32Array(normal.count * 3);
- const a = new THREE49.Vector3;
- const b = new THREE49.Vector3;
- const c = new THREE49.Vector3;
- const face = new THREE49.Vector3;
- const edge = new THREE49.Vector3;
+ const a = new THREE50.Vector3;
+ const b = new THREE50.Vector3;
+ const c = new THREE50.Vector3;
+ const face = new THREE50.Vector3;
+ const edge = new THREE50.Vector3;
for (let t = 0;t + 2 < index.count; t += 3) {
const tri = [index.getX(t), index.getX(t + 1), index.getX(t + 2)];
if (!tri.some((i) => broken.has(i)))
@@ -29662,7 +29877,7 @@ var init_uv = __esm(() => {
});
// src/uv-project.ts
-import * as THREE50 from "three";
+import * as THREE51 from "three";
function projectUV(geometry, options) {
if (!options || typeof options !== "object" || Array.isArray(options) || !["planar", "box", "cylindrical"].includes(options.projection) || Object.keys(options).some((key) => !["projection", "frame", "seamDegrees", "angularRange", "caps", "metersPerUnit"].includes(key)))
throw new Error("projectUV: select an explicit planar, box or cylindrical projection with documented options.");
@@ -29703,15 +29918,15 @@ function projectUV(geometry, options) {
throw new Error("projectUV: index contains an invalid vertex reference.");
}
const points = [];
- const bounds = new THREE50.Box3;
+ const bounds = new THREE51.Box3;
for (let i = 0;i < positions.count; i++) {
- const point = new THREE50.Vector3().fromBufferAttribute(positions, i).applyMatrix4(inverse);
+ const point = new THREE51.Vector3().fromBufferAttribute(positions, i).applyMatrix4(inverse);
if (![point.x, point.y, point.z].every(Number.isFinite))
throw new Error("projectUV: frame-local positions must be finite.");
points.push(point);
bounds.expandByPoint(point);
}
- const extent = bounds.getSize(new THREE50.Vector3);
+ const extent = bounds.getSize(new THREE51.Vector3);
const fit = (point, axis) => metric !== undefined ? point[axis] / metric : extent[axis] > 0 ? (point[axis] - bounds.min[axis]) / extent[axis] : 0.5;
const flip = (point, axis) => metric !== undefined ? -point[axis] / metric : 1 - fit(point, axis);
const outputUVs = new Float32Array(corners * 2);
@@ -29726,8 +29941,8 @@ function projectUV(geometry, options) {
if (metric !== undefined) {
uScale = fullWrap ? Math.max(1, Math.round(2 * Math.PI * radius / metric)) : sweep * radius / metric;
}
- const normal = new THREE50.Vector3;
- const edge = new THREE50.Vector3;
+ const normal = new THREE51.Vector3;
+ const edge = new THREE51.Vector3;
for (let i = 0;i < corners; i += 3) {
const triangle = [0, 1, 2].map((offset) => points[index ? index.getX(i + offset) : i + offset]);
normal.subVectors(triangle[1], triangle[0]).cross(edge.subVectors(triangle[2], triangle[0])).normalize();
@@ -29783,7 +29998,7 @@ function projectUV(geometry, options) {
const out = geometry.index ? geometry.toNonIndexed() : geometry.clone();
out.userData = structuredClone(geometry.userData);
out.setDrawRange(geometry.drawRange.start, geometry.drawRange.count);
- out.setAttribute("uv", new THREE50.Float32BufferAttribute(outputUVs, 2));
+ out.setAttribute("uv", new THREE51.Float32BufferAttribute(outputUVs, 2));
if (out.hasAttribute("tangent")) {
out.deleteAttribute("tangent");
const previous = out.userData.kilnAttributeWarnings;
@@ -29804,17 +30019,17 @@ var init_uv_project = __esm(() => {
});
// src/primitives.ts
-import * as THREE51 from "three";
+import * as THREE52 from "three";
function vectorToTuple(v) {
return [v.x, v.y, v.z];
}
function createRoot(name) {
- const root = new THREE51.Object3D;
+ const root = new THREE52.Object3D;
root.name = name;
return root;
}
function createPivot(name, position = [0, 0, 0], parent) {
- const pivot = new THREE51.Object3D;
+ const pivot = new THREE52.Object3D;
pivot.name = `Joint_${name}`;
pivot.position.set(...position);
if (parent)
@@ -29846,16 +30061,16 @@ function assertPartArgs(name, geometry2, material) {
}
function createPart(name, geometry2, material, options = {}) {
assertPartArgs(name, geometry2, material);
- const mesh = new THREE51.Mesh(geometry2, material);
+ const mesh = new THREE52.Mesh(geometry2, material);
mesh.name = `Mesh_${name}`;
if (options.position)
mesh.position.set(...options.position);
if (options.rotation)
- mesh.rotation.set(THREE51.MathUtils.degToRad(options.rotation[0]), THREE51.MathUtils.degToRad(options.rotation[1]), THREE51.MathUtils.degToRad(options.rotation[2]));
+ mesh.rotation.set(THREE52.MathUtils.degToRad(options.rotation[0]), THREE52.MathUtils.degToRad(options.rotation[1]), THREE52.MathUtils.degToRad(options.rotation[2]));
if (options.scale)
mesh.scale.set(...options.scale);
if (options.pivot) {
- const pivot = new THREE51.Object3D;
+ const pivot = new THREE52.Object3D;
pivot.name = `Joint_${name}`;
pivot.add(mesh);
mesh.position.set(0, 0, 0);
@@ -29878,7 +30093,7 @@ function capsuleGeo(radius, height, segments = 6) {
assertDimension("capsuleGeo height (straight middle length)", height, true);
assertDimension("capsuleGeo outer half-length", height / 2 + radius);
assertPrimitiveSegments("capsuleGeo segments", segments, 3);
- return new THREE51.CapsuleGeometry(radius, height, 2, segments);
+ return new THREE52.CapsuleGeometry(radius, height, 2, segments);
}
function capsuleXGeo(radius, length, segments = 6) {
const geo = capsuleGeo(radius, length, segments);
@@ -29897,7 +30112,7 @@ function cylinderGeo(radiusTop, radiusBottom, height, segments = 8) {
throw new RangeError("cylinderGeo requires at least one positive radius.");
assertDimension("cylinderGeo height", height);
assertPrimitiveSegments("cylinderGeo segments", segments, 3);
- return new THREE51.CylinderGeometry(radiusTop, radiusBottom, height, segments);
+ return new THREE52.CylinderGeometry(radiusTop, radiusBottom, height, segments);
}
function cylinderXGeo(radiusTop, radiusBottom, length, segments = 8) {
const geo = cylinderGeo(radiusTop, radiusBottom, length, segments);
@@ -29912,20 +30127,20 @@ function cylinderZGeo(radiusTop, radiusBottom, length, segments = 8) {
function boxGeo(width, height, depth) {
for (const [name, value] of Object.entries({ width, height, depth }))
assertDimension(`boxGeo ${name} (use planeGeo for a sheet)`, value);
- return new THREE51.BoxGeometry(width, height, depth);
+ return new THREE52.BoxGeometry(width, height, depth);
}
function sphereGeo(radius, widthSegments = 8, heightSegments = 6) {
assertDimension("sphereGeo radius", radius);
assertPrimitiveSegments("sphereGeo widthSegments", widthSegments, 3);
assertPrimitiveSegments("sphereGeo heightSegments", heightSegments, 2);
assertPrimitiveGrid("sphereGeo", widthSegments, heightSegments);
- return new THREE51.SphereGeometry(radius, widthSegments, heightSegments);
+ return new THREE52.SphereGeometry(radius, widthSegments, heightSegments);
}
function coneGeo(radius, height, segments = 8) {
assertDimension("coneGeo radius", radius);
assertDimension("coneGeo height", height);
assertPrimitiveSegments("coneGeo segments", segments, 3);
- return new THREE51.ConeGeometry(radius, height, segments);
+ return new THREE52.ConeGeometry(radius, height, segments);
}
function coneXGeo(radius, length, segments = 8) {
const geo = coneGeo(radius, length, segments);
@@ -29942,7 +30157,7 @@ function cylinderOnAxis(center, normal, radiusBottom, height, options = {}) {
const segments = options.segments ?? 8;
assertFiniteTriple("cylinderOnAxis center", center);
assertFiniteTriple("cylinderOnAxis normal", normal);
- const n = new THREE51.Vector3(normal[0], normal[1], normal[2]);
+ const n = new THREE52.Vector3(normal[0], normal[1], normal[2]);
const len = Math.hypot(...normal);
if (len < 0.000001) {
throw new Error(`cylinderOnAxis: normal must be a non-zero vector (got [${normal.join(",")}]).`);
@@ -29950,7 +30165,7 @@ function cylinderOnAxis(center, normal, radiusBottom, height, options = {}) {
const magnitude = Math.max(...normal.map(Math.abs));
n.set(normal[0] / magnitude, normal[1] / magnitude, normal[2] / magnitude).normalize();
const geo = cylinderGeo(radiusTop, radiusBottom, height, segments);
- const q = new THREE51.Quaternion().setFromUnitVectors(new THREE51.Vector3(0, 1, 0), n);
+ const q = new THREE52.Quaternion().setFromUnitVectors(new THREE52.Vector3(0, 1, 0), n);
geo.applyQuaternion(q);
geo.translate(center[0], center[1], center[2]);
return geo;
@@ -29972,7 +30187,7 @@ function torusGeo(radius, tube, radialSegments = 8, tubularSegments = 12) {
assertPrimitiveSegments("torusGeo radialSegments", radialSegments, 3);
assertPrimitiveSegments("torusGeo tubularSegments", tubularSegments, 3);
assertPrimitiveGrid("torusGeo", radialSegments, tubularSegments);
- return new THREE51.TorusGeometry(radius, tube, radialSegments, tubularSegments);
+ return new THREE52.TorusGeometry(radius, tube, radialSegments, tubularSegments);
}
function planeGeo(width, height, widthSegments = 1, heightSegments = 1) {
assertDimension("planeGeo width", width);
@@ -29980,14 +30195,14 @@ function planeGeo(width, height, widthSegments = 1, heightSegments = 1) {
assertPrimitiveSegments("planeGeo widthSegments", widthSegments, 1);
assertPrimitiveSegments("planeGeo heightSegments", heightSegments, 1);
assertPrimitiveGrid("planeGeo", widthSegments, heightSegments);
- return new THREE51.PlaneGeometry(width, height, widthSegments, heightSegments);
+ return new THREE52.PlaneGeometry(width, height, widthSegments, heightSegments);
}
function decalBox(width, height, depth = 0.01) {
assertDimension("decalBox width", width);
assertDimension("decalBox height", height);
assertDimension("decalBox depth", depth, true);
const d = Math.max(depth, 0.002);
- return new THREE51.BoxGeometry(width, height, d);
+ return new THREE52.BoxGeometry(width, height, d);
}
function validateCardFrame(name, width, height, yPivot) {
assertDimension(`${name} width`, width);
@@ -30001,7 +30216,7 @@ function foliageCardGeo(opts = {}) {
const h = opts.height ?? 1;
const yPivot = opts.yPivot ?? 0;
validateCardFrame("foliageCardGeo", w, h, yPivot);
- const geom = new THREE51.PlaneGeometry(w, h);
+ const geom = new THREE52.PlaneGeometry(w, h);
geom.translate(0, h * (0.5 - yPivot), 0);
geom.userData["kilnGeometryRole"] = "foliageCard";
return geom;
@@ -30017,12 +30232,12 @@ function crossedQuadsGeo(opts = {}) {
const geometries = [];
for (let i = 0;i < planes; i++) {
const angle = i / planes * Math.PI;
- const quad = new THREE51.PlaneGeometry(w, h);
+ const quad = new THREE52.PlaneGeometry(w, h);
quad.translate(0, h * (0.5 - yPivot), 0);
quad.rotateY(angle);
geometries.push(quad);
}
- const out = new THREE51.BufferGeometry;
+ const out = new THREE52.BufferGeometry;
const posCount = geometries.reduce((sum, g) => sum + (g.attributes.position?.count ?? 0), 0);
const positions = new Float32Array(posCount * 3);
const normals = new Float32Array(posCount * 3);
@@ -30049,9 +30264,9 @@ function crossedQuadsGeo(opts = {}) {
}
vOffset += p.count;
}
- out.setAttribute("position", new THREE51.BufferAttribute(positions, 3));
- out.setAttribute("normal", new THREE51.BufferAttribute(normals, 3));
- out.setAttribute("uv", new THREE51.BufferAttribute(uvs, 2));
+ out.setAttribute("position", new THREE52.BufferAttribute(positions, 3));
+ out.setAttribute("normal", new THREE52.BufferAttribute(normals, 3));
+ out.setAttribute("uv", new THREE52.BufferAttribute(uvs, 2));
out.setIndex(indices);
out.userData["kilnGeometryRole"] = "foliageCard";
return out;
@@ -30066,7 +30281,7 @@ function octaGridPlane(opts) {
const h = opts.height ?? 1;
const yPivot = opts.yPivot ?? 0;
validateCardFrame("octaGridPlane", w, h, yPivot);
- const geom = new THREE51.PlaneGeometry(w, h);
+ const geom = new THREE52.PlaneGeometry(w, h);
geom.translate(0, h * (0.5 - yPivot), 0);
const uv = geom.attributes.uv;
const du = 1 / opts.tilesX;
@@ -30162,8 +30377,8 @@ function wingGeo(options = {}) {
7,
6
];
- const geo = new THREE51.BufferGeometry;
- geo.setAttribute("position", new THREE51.BufferAttribute(vertices, 3));
+ const geo = new THREE52.BufferGeometry;
+ geo.setAttribute("position", new THREE52.BufferAttribute(vertices, 3));
geo.setIndex(tipChord === 0 ? [0, 1, 3, 4, 7, 5, 0, 2, 6, 0, 6, 4, 1, 5, 7, 1, 7, 3, 0, 4, 5, 0, 5, 1] : indices);
geo.computeVertexNormals();
return geo;
@@ -30194,17 +30409,17 @@ function createWingPair(name, material, options) {
};
}
function beamBetween(name, start, end, radius, material, options = {}) {
- const a = new THREE51.Vector3(...start);
- const b = new THREE51.Vector3(...end);
+ const a = new THREE52.Vector3(...start);
+ const b = new THREE52.Vector3(...end);
const direction = b.clone().sub(a);
const length = direction.length();
if (length <= 0.0001) {
throw new Error(`beamBetween("${name}"): start and end must be different points (got start=[${start.join(",")}], end=[${end.join(",")}], delta=${length.toExponential(2)}). Pick two distinct endpoints or switch to cylinderGeo with an explicit length + position.`);
}
- const mesh = new THREE51.Mesh(cylinderGeo(radius, radius, length, options.segments ?? 8), material);
+ const mesh = new THREE52.Mesh(cylinderGeo(radius, radius, length, options.segments ?? 8), material);
mesh.name = `Mesh_${name}`;
mesh.position.copy(a.add(b).multiplyScalar(0.5));
- mesh.quaternion.setFromUnitVectors(new THREE51.Vector3(0, 1, 0), direction.normalize());
+ mesh.quaternion.setFromUnitVectors(new THREE52.Vector3(0, 1, 0), direction.normalize());
if (options.parent)
options.parent.add(mesh);
return mesh;
@@ -30213,11 +30428,11 @@ function snapTo(part, host, options = {}) {
const overlap = options.overlap ?? 0.02;
part.updateWorldMatrix(true, true);
host.updateWorldMatrix(true, true);
- const a = new THREE51.Box3().setFromObject(part);
- const b = new THREE51.Box3().setFromObject(host);
+ const a = new THREE52.Box3().setFromObject(part);
+ const b = new THREE52.Box3().setFromObject(host);
if (a.isEmpty() || b.isEmpty())
return part;
- const delta = new THREE51.Vector3;
+ const delta = new THREE52.Vector3;
for (const axis of ["x", "y", "z"]) {
if (a.min[axis] > b.max[axis])
delta[axis] = b.max[axis] - a.min[axis];
@@ -30233,7 +30448,7 @@ function snapTo(part, host, options = {}) {
delta[dominant] = -overlap;
const parent = part.parent;
if (parent) {
- const p0 = new THREE51.Vector3;
+ const p0 = new THREE52.Vector3;
part.getWorldPosition(p0);
const p1 = p0.clone().add(delta);
const l0 = parent.worldToLocal(p0.clone());
@@ -30268,8 +30483,8 @@ function createLadder(name, options) {
throw new RangeError("createLadder rungCount must be an integer from 0 to 10000.");
if (widthAxis !== "x" && widthAxis !== "z")
throw new RangeError("createLadder widthAxis must be x or z.");
- const bottomVec = new THREE51.Vector3;
- const topVec = new THREE51.Vector3(...top).sub(new THREE51.Vector3(...bottom));
+ const bottomVec = new THREE52.Vector3;
+ const topVec = new THREE52.Vector3(...top).sub(new THREE52.Vector3(...bottom));
const length = Math.hypot(topVec.x, topVec.y, topVec.z);
assertDimension("createLadder endpoint distance", length);
if (length <= 0.0001)
@@ -30277,7 +30492,7 @@ function createLadder(name, options) {
const along = topVec.clone().divideScalar(length);
if (widthDirection !== undefined)
assertFiniteTriple("createLadder widthDirection", widthDirection);
- let across = widthDirection ? new THREE51.Vector3(...widthDirection) : widthAxis === "x" ? new THREE51.Vector3(1, 0, 0) : new THREE51.Vector3(0, 0, 1);
+ let across = widthDirection ? new THREE52.Vector3(...widthDirection) : widthAxis === "x" ? new THREE52.Vector3(1, 0, 0) : new THREE52.Vector3(0, 0, 1);
const largest = Math.max(Math.abs(across.x), Math.abs(across.y), Math.abs(across.z));
if (!largest)
throw new RangeError("createLadder widthDirection must be nonzero.");
@@ -30287,19 +30502,19 @@ function createLadder(name, options) {
if (widthDirection)
throw new RangeError("createLadder widthDirection must not be parallel to the endpoints.");
const axes = [
- new THREE51.Vector3(1, 0, 0),
- new THREE51.Vector3(0, 1, 0),
- new THREE51.Vector3(0, 0, 1)
+ new THREE52.Vector3(1, 0, 0),
+ new THREE52.Vector3(0, 1, 0),
+ new THREE52.Vector3(0, 0, 1)
];
across = axes.reduce((best, axis) => Math.abs(axis.dot(along)) < Math.abs(best.dot(along)) ? axis : best);
across.addScaledVector(along, -across.dot(along));
}
across.normalize();
const offset = across.clone().multiplyScalar(width / 2);
- const root = new THREE51.Object3D;
+ const root = new THREE52.Object3D;
root.name = name;
root.position.set(...bottom);
- const rotation = new THREE51.Quaternion().setFromRotationMatrix(new THREE51.Matrix4().makeBasis(across, along, across.clone().cross(along))).toArray();
+ const rotation = new THREE52.Quaternion().setFromRotationMatrix(new THREE52.Matrix4().makeBasis(across, along, across.clone().cross(along))).toArray();
stampSemanticMetadataV1(root, {
roles: ["ladder"],
frames: [
@@ -30339,7 +30554,7 @@ function wallWithOpening(name, material, options) {
if (opening && openings)
throw new TypeError("wallWithOpening: use opening or openings, not both.");
const built = buildWallPanels(length, height, thickness, openings ?? (opening ? [opening] : []));
- const group = new THREE51.Object3D;
+ const group = new THREE52.Object3D;
group.name = name;
const panel = (suffix, lenStart, lenEnd, yLo, yHi) => {
const segLen = lenEnd - lenStart;
@@ -30370,7 +30585,7 @@ function room(name, material, options = {}) {
parent
} = options;
const openings = options.openings ?? [{ wall: "front", kind: "door" }];
- const root = new THREE51.Object3D;
+ const root = new THREE52.Object3D;
root.name = name;
const wall = (suffix, len, axis, pos, which) => {
const w = wallWithOpening(`${name}_Wall${suffix}`, material, {
@@ -30424,7 +30639,7 @@ function createStairs(name, material, options) {
if (Math.abs(totalRise) < 0.0001 || Math.abs(totalRun) < 0.0001) {
throw new Error(`createStairs("${name}"): totalRise and totalRun must be non-zero (got rise=${totalRise}, run=${totalRun}).`);
}
- const root = new THREE51.Object3D;
+ const root = new THREE52.Object3D;
root.name = name;
const stepRise = totalRise / steps;
const stepRun = totalRun / steps;
@@ -30454,7 +30669,7 @@ function requireColor(color, fn) {
}
function gameMaterial(color, options = {}) {
requireColor(color, "gameMaterial");
- const material = new THREE51.MeshStandardMaterial({
+ const material = new THREE52.MeshStandardMaterial({
color,
metalness: options.metalness ?? 0,
roughness: options.roughness ?? 0.8,
@@ -30468,7 +30683,7 @@ function gameMaterial(color, options = {}) {
}
function basicMaterial(color, options = {}) {
requireColor(color, "basicMaterial");
- const material = new THREE51.MeshBasicMaterial({
+ const material = new THREE52.MeshBasicMaterial({
color,
transparent: options.transparent ?? false,
opacity: options.opacity ?? 1
@@ -30479,13 +30694,13 @@ function basicMaterial(color, options = {}) {
}
function glassMaterial(color, options = {}) {
requireColor(color, "glassMaterial");
- const material = new THREE51.MeshStandardMaterial({
+ const material = new THREE52.MeshStandardMaterial({
color,
transparent: true,
opacity: options.opacity ?? 0.35,
roughness: options.roughness ?? 0.1,
metalness: options.metalness ?? 0,
- side: THREE51.DoubleSide
+ side: THREE52.DoubleSide
});
if (options.name !== undefined)
material.name = assertMaterialName(options.name, "glassMaterial");
@@ -30493,7 +30708,7 @@ function glassMaterial(color, options = {}) {
}
function lambertMaterial(color, options = {}) {
requireColor(color, "lambertMaterial");
- const material = new THREE51.MeshLambertMaterial({
+ const material = new THREE52.MeshLambertMaterial({
color,
flatShading: options.flatShading ?? true,
emissive: options.emissive ?? 0
@@ -30506,12 +30721,12 @@ function threeInterpolation(mode) {
if (mode !== undefined && !TRACK_INTERPOLATIONS.includes(mode)) {
throw new Error(`Animation interpolation must be one of ${TRACK_INTERPOLATIONS.join(", ")}.`);
}
- return mode === "STEP" ? THREE51.InterpolateDiscrete : THREE51.InterpolateLinear;
+ return mode === "STEP" ? THREE52.InterpolateDiscrete : THREE52.InterpolateLinear;
}
function interpolatedTrack(Type, name, times, values, interpolation) {
if (!isCubicInterpolation(interpolation))
return new Type(name, times, values, threeInterpolation(interpolation));
- const quaternion = Type === THREE51.QuaternionKeyframeTrack;
+ const quaternion = Type === THREE52.QuaternionKeyframeTrack;
return useCubicSpline(new Type(name, times, cubicSplineValues(times, values, quaternion ? 4 : 3, interpolation, quaternion)));
}
function animationNumber(value, label) {
@@ -30565,15 +30780,15 @@ function rotationTrack(jointName, keyframes, interpolation) {
animationKeys(jointName, keyframes, "rotation", interpolation);
const times = [];
const values = [];
- const euler = new THREE51.Euler;
- const quat = new THREE51.Quaternion;
+ const euler = new THREE52.Euler;
+ const quat = new THREE52.Quaternion;
for (const kf of keyframes) {
times.push(kf.time);
- euler.set(THREE51.MathUtils.degToRad(kf.rotation[0]), THREE51.MathUtils.degToRad(kf.rotation[1]), THREE51.MathUtils.degToRad(kf.rotation[2]));
+ euler.set(THREE52.MathUtils.degToRad(kf.rotation[0]), THREE52.MathUtils.degToRad(kf.rotation[1]), THREE52.MathUtils.degToRad(kf.rotation[2]));
quat.setFromEuler(euler);
values.push(quat.x, quat.y, quat.z, quat.w);
}
- return interpolatedTrack(THREE51.QuaternionKeyframeTrack, `${jointName}.quaternion`, times, values, interpolation);
+ return interpolatedTrack(THREE52.QuaternionKeyframeTrack, `${jointName}.quaternion`, times, values, interpolation);
}
function positionTrack(jointName, keyframes, interpolation) {
animationKeys(jointName, keyframes, "position", interpolation);
@@ -30583,7 +30798,7 @@ function positionTrack(jointName, keyframes, interpolation) {
times.push(kf.time);
values.push(...kf.position);
}
- return interpolatedTrack(THREE51.VectorKeyframeTrack, `${jointName}.position`, times, values, interpolation);
+ return interpolatedTrack(THREE52.VectorKeyframeTrack, `${jointName}.position`, times, values, interpolation);
}
function scaleTrack(jointName, keyframes, interpolation) {
animationKeys(jointName, keyframes, "scale", interpolation);
@@ -30593,7 +30808,7 @@ function scaleTrack(jointName, keyframes, interpolation) {
times.push(kf.time);
values.push(...kf.scale);
}
- return interpolatedTrack(THREE51.VectorKeyframeTrack, `${jointName}.scale`, times, values, interpolation);
+ return interpolatedTrack(THREE52.VectorKeyframeTrack, `${jointName}.scale`, times, values, interpolation);
}
function createClip(name, duration, tracks, options) {
if (typeof name !== "string" || !name.trim())
@@ -30606,7 +30821,7 @@ function createClip(name, duration, tracks, options) {
const loop = clipLoopOption(options);
const names = new Set;
for (const track of tracks) {
- if (!(track instanceof THREE51.KeyframeTrack))
+ if (!(track instanceof THREE52.KeyframeTrack))
throw new Error("Animation clip tracks must be KeyframeTrack instances.");
if (typeof track.name !== "string")
throw new Error("Animation track target/channel must use a string name.");
@@ -30620,12 +30835,12 @@ function createClip(name, duration, tracks, options) {
throw new Error(`Duplicate animation target/channel: ${track.name}.`);
names.add(track.name);
const quaternion = channel === "quaternion";
- const Type = quaternion ? THREE51.QuaternionKeyframeTrack : THREE51.VectorKeyframeTrack;
+ const Type = quaternion ? THREE52.QuaternionKeyframeTrack : THREE52.VectorKeyframeTrack;
if (!(track instanceof Type))
throw new Error(`Animation channel ${channel} requires ${quaternion ? "QuaternionKeyframeTrack" : "VectorKeyframeTrack"}.`);
const cubic = isCubicSplineTrack(track);
const mode = track.getInterpolation();
- if (!cubic && mode !== THREE51.InterpolateLinear && mode !== THREE51.InterpolateDiscrete) {
+ if (!cubic && mode !== THREE52.InterpolateLinear && mode !== THREE52.InterpolateDiscrete) {
throw new Error("Animation interpolation must be LINEAR, STEP or CUBICSPLINE (the glTF sampler modes); three.js smooth and Bezier interpolants have no glTF form.");
}
animationTimes(track.times, track.name);
@@ -30648,7 +30863,7 @@ function createClip(name, duration, tracks, options) {
throw new Error(`Animation clip duration ${duration} does not include every key of ${track.name}.`);
}
}
- const clip = new THREE51.AnimationClip(name, duration, tracks);
+ const clip = new THREE52.AnimationClip(name, duration, tracks);
if (loop !== undefined)
clip.userData.kilnLoopIntent = loop ? "loop" : "once";
return clip;
@@ -30725,12 +30940,12 @@ function createInstance(name, source, options = {}) {
if (!sourceMesh) {
throw new Error(`createInstance("${name}"): source "${source.name}" has no Mesh to clone from`);
}
- const mesh = new THREE51.Mesh(sourceMesh.geometry, sourceMesh.material);
+ const mesh = new THREE52.Mesh(sourceMesh.geometry, sourceMesh.material);
mesh.name = `Mesh_${name}`;
if (options.position)
mesh.position.set(...options.position);
if (options.rotation)
- mesh.rotation.set(THREE51.MathUtils.degToRad(options.rotation[0]), THREE51.MathUtils.degToRad(options.rotation[1]), THREE51.MathUtils.degToRad(options.rotation[2]));
+ mesh.rotation.set(THREE52.MathUtils.degToRad(options.rotation[0]), THREE52.MathUtils.degToRad(options.rotation[1]), THREE52.MathUtils.degToRad(options.rotation[2]));
if (options.scale)
mesh.scale.set(...options.scale);
if (options.parent)
@@ -31023,7 +31238,7 @@ function buildSandboxGlobals(usage, options = {}) {
getJointNames: wrap("getJointNames", getJointNames),
materialBudgetAdvisory: wrap("materialBudgetAdvisory", materialBudgetAdvisory),
seededRandom: wrap("seededRandom", seededRandom),
- THREE: THREE51,
+ THREE: THREE52,
Math,
console: options.console ?? console
};
@@ -31152,7 +31367,7 @@ import {
PropertyType as PropertyType5
} from "@gltf-transform/core";
import { createTransform, dequantizePrimitive, joinPrimitives } from "@gltf-transform/functions";
-import * as THREE52 from "three";
+import * as THREE53 from "three";
function isSingular(matrix) {
const e = matrix.elements;
const scale = Math.hypot(e[0], e[1], e[2]) * Math.hypot(e[4], e[5], e[6]) * Math.hypot(e[8], e[9], e[10]);
@@ -31270,10 +31485,10 @@ function reverseWinding(prim) {
}
}
function bake(prim, matrix) {
- const linear = new THREE52.Matrix3().setFromMatrix4(matrix);
- const normalMatrix = new THREE52.Matrix3().getNormalMatrix(matrix);
+ const linear = new THREE53.Matrix3().setFromMatrix4(matrix);
+ const normalMatrix = new THREE53.Matrix3().getNormalMatrix(matrix);
const mirrored = matrix.determinant() < 0;
- const v = new THREE52.Vector3;
+ const v = new THREE53.Vector3;
const each = (semantic, apply) => {
const attribute = prim.getAttribute(semantic);
const element = [];
@@ -31297,7 +31512,7 @@ function destinationOf(entries) {
let best = Infinity;
let bestScale = Infinity;
for (const { node } of entries) {
- const linear = new THREE52.Matrix3().setFromMatrix4(worldOf(node));
+ const linear = new THREE53.Matrix3().setFromMatrix4(worldOf(node));
const norm = Math.hypot(...linear.elements);
const inverseNorm = Math.hypot(...linear.clone().invert().elements);
const condition = norm * inverseNorm;
@@ -31311,9 +31526,9 @@ function destinationOf(entries) {
return chosen;
}
function checkPositionPrecision(input, output, sourceWorld, destinationWorld, reversed) {
- const expected = new THREE52.Vector3;
- const actual = new THREE52.Vector3;
- const bounds = new THREE52.Box3;
+ const expected = new THREE53.Vector3;
+ const actual = new THREE53.Vector3;
+ const bounds = new THREE53.Box3;
const element = [];
let error = 0;
let magnitude = 0;
@@ -31634,7 +31849,7 @@ function rigidMerge(options = {}, onSummary) {
onSummary?.(summary);
});
}
-var JOINT_PIVOT, RESTART_MODES, BAKED, MAX_VERTICES = 65534, MAX_BYTES_PER_SAVED_DRAW = 4096, hasKeys = (value) => Object.keys(value).length > 0, worldOf = (node) => new THREE52.Matrix4().fromArray(node.getWorldMatrix()), nodeUsers = (mesh) => mesh.listParents().filter((parent) => parent.propertyType === PropertyType5.NODE).length, accessorsOf = (prim) => {
+var JOINT_PIVOT, RESTART_MODES, BAKED, MAX_VERTICES = 65534, MAX_BYTES_PER_SAVED_DRAW = 4096, hasKeys = (value) => Object.keys(value).length > 0, worldOf = (node) => new THREE53.Matrix4().fromArray(node.getWorldMatrix()), nodeUsers = (mesh) => mesh.listParents().filter((parent) => parent.propertyType === PropertyType5.NODE).length, accessorsOf = (prim) => {
const indices = prim.getIndices();
return indices ? [...prim.listAttributes(), indices] : prim.listAttributes();
}, primitiveBytes = (primitives) => [...new Set(primitives.flatMap(accessorsOf))].reduce((sum, a) => sum + (a.getArray()?.byteLength ?? 0), 0), countPrimitives = (nodes) => [...nodes].reduce((sum, node) => sum + (node.getMesh()?.listPrimitives().length ?? 0), 0);
@@ -34174,7 +34389,7 @@ var init_kit = __esm(() => {
// src/texture-bake.ts
import { createHash as createHash12 } from "node:crypto";
-import * as THREE53 from "three";
+import * as THREE54 from "three";
function readPixels(texture) {
const image = texture.image;
if (!image)
@@ -34301,7 +34516,7 @@ async function bakeSceneTextures(root, warnings) {
mime: "image/png",
bytes
};
- const colorSpace = entry.texture.colorSpace === THREE53.SRGBColorSpace ? "srgb" : "linear";
+ const colorSpace = entry.texture.colorSpace === THREE54.SRGBColorSpace ? "srgb" : "linear";
const recipe = entry.texture.userData["kilnProcedural"];
const primaryUsage = atlasRecord?.spec.usage ?? recipe?.usage ?? (entry.bindings.some(({ slot }) => slot === "roughnessMap") && entry.bindings.some(({ slot }) => slot === "metalnessMap") ? "metallicRoughness" : entry.bindings[0]?.usage ?? "albedo");
if (!encoded)
@@ -34384,10 +34599,10 @@ function computeTangentBasis(geometry) {
}
}
const out = new Float32Array(vertexCount * 4);
- const n = new THREE53.Vector3;
- const t = new THREE53.Vector3;
- const tmp = new THREE53.Vector3;
- const tmp2 = new THREE53.Vector3;
+ const n = new THREE54.Vector3;
+ const t = new THREE54.Vector3;
+ const tmp = new THREE54.Vector3;
+ const tmp2 = new THREE54.Vector3;
for (let v = 0;v < vertexCount; v++) {
n.set(normal.getX(v), normal.getY(v), normal.getZ(v));
t.set(tan1[v * 3], tan1[v * 3 + 1], tan1[v * 3 + 2]);
@@ -34407,7 +34622,7 @@ function computeTangentBasis(geometry) {
out[v * 4 + 2] = tmp.z;
out[v * 4 + 3] = w;
}
- geometry.setAttribute("tangent", new THREE53.BufferAttribute(out, 4));
+ geometry.setAttribute("tangent", new THREE54.BufferAttribute(out, 4));
}
function ensureNormalMapTangents(root, warnings) {
let count = 0;
@@ -34525,13 +34740,13 @@ var init_exporter_node = __esm(() => {
});
// src/views/character.ts
-import * as THREE54 from "three";
-function rounded(value) {
+import * as THREE55 from "three";
+function rounded2(value) {
const result = Math.round(value * 1e9) / 1e9;
return Object.is(result, -0) ? 0 : result;
}
function tuple5(vector) {
- return [rounded(vector.x), rounded(vector.y), rounded(vector.z)];
+ return [rounded2(vector.x), rounded2(vector.y), rounded2(vector.z)];
}
function chainIdFor(descriptor, byRole) {
if (AXIAL_ROLES.has(descriptor.role))
@@ -34567,9 +34782,9 @@ function buildCharacterDiagnosticDescriptor(root, findings = []) {
const invalidPaths = new Set(invalidFindingNodePaths);
const joints = evidence.map((joint) => {
const relative = rootInverse.clone().multiply(joint.node.matrixWorld);
- const position = new THREE54.Vector3().setFromMatrixPosition(relative);
- const forward = new THREE54.Vector3(...joint.descriptor.localForwardAxis).transformDirection(relative).multiplyScalar(0.2).add(position);
- const bend = new THREE54.Vector3(...joint.descriptor.localBendAxis).transformDirection(relative).multiplyScalar(0.2).add(position);
+ const position = new THREE55.Vector3().setFromMatrixPosition(relative);
+ const forward = new THREE55.Vector3(...joint.descriptor.localForwardAxis).transformDirection(relative).multiplyScalar(0.2).add(position);
+ const bend = new THREE55.Vector3(...joint.descriptor.localBendAxis).transformDirection(relative).multiplyScalar(0.2).add(position);
const chainId = chainIdFor(joint.descriptor, descriptorByRole);
return {
role: joint.descriptor.role,
@@ -35954,7 +36169,7 @@ function prepareTriangleCoverage(ax, ay, bx, by, cx, cy, size) {
}
// src/views/raster.ts
-import { Vector3 as Vector339 } from "three";
+import { Vector3 as Vector340 } from "three";
function orbitDir(azimuthDeg, elevationDeg) {
const el = Math.min(MAX_ELEVATION_DEG, Math.max(MIN_ELEVATION_DEG, elevationDeg)) * Math.PI / 180;
const az = azimuthDeg * Math.PI / 180;
@@ -35989,7 +36204,7 @@ function updateSurfaceMatrices(root) {
function surfaceVertexReader(mesh, position) {
for (const bone of mesh.skeleton?.bones ?? [])
bone.updateWorldMatrix?.(true, false);
- const vertex = new Vector339;
+ const vertex = new Vector340;
if (mesh.getVertexPosition)
return (index) => mesh.getVertexPosition(index, vertex);
if (position.getX && position.getY && position.getZ)
@@ -36399,7 +36614,7 @@ function cloneReviewScene(root, options = {}) {
var init_scene_copy = () => {};
// src/views/camera.ts
-import { Vector3 as Vector340, Matrix4 as Matrix417, Euler as Euler5, Group as Group5 } from "three";
+import { Vector3 as Vector341, Matrix4 as Matrix417, Euler as Euler5, Group as Group5 } from "three";
function strict(value, keys, label) {
for (const key of Object.keys(value))
if (!keys.includes(key)) {
@@ -36493,14 +36708,14 @@ function cameraFromBounds(bounds, dir, padding = 1, up, sceneBounds = bounds) {
const z = vec(dir).normalize();
if (!z.length())
throw new Error("camera direction must be non-zero");
- const hint = up ? vec(up) : Math.abs(z.y) > 0.99 ? new Vector340(0, 0, -1) : new Vector340(0, 1, 0);
+ const hint = up ? vec(up) : Math.abs(z.y) > 0.99 ? new Vector341(0, 0, -1) : new Vector341(0, 1, 0);
const x = hint.clone().cross(z).normalize();
if (x.length() < 0.000000001)
throw new Error("camera up must not be collinear with view");
const y = z.clone().cross(x);
let extent = 0.000001;
for (let i = 0;i < 8; i++) {
- const p = new Vector340((i & 1 ? bounds.max : bounds.min)[0], (i & 2 ? bounds.max : bounds.min)[1], (i & 4 ? bounds.max : bounds.min)[2]).sub(target);
+ const p = new Vector341((i & 1 ? bounds.max : bounds.min)[0], (i & 2 ? bounds.max : bounds.min)[1], (i & 4 ? bounds.max : bounds.min)[2]).sub(target);
extent = Math.max(extent, Math.abs(p.dot(x)), Math.abs(p.dot(y)));
}
const depthMin = bounds.min.map((v, i) => Math.min(v, sceneBounds.min[i]));
@@ -36581,7 +36796,7 @@ function resolveAssetCamera(root, shot = {}) {
if (relative !== "world") {
const node = relative === "part" ? selected.node : rootNode;
dir.transformDirection(node.matrixWorld);
- up = tuple6(new Vector340(0, 1, 0).transformDirection(node.matrixWorld));
+ up = tuple6(new Vector341(0, 1, 0).transformDirection(node.matrixWorld));
}
camera = cameraFromBounds(bounds, tuple6(dir), request.padding ?? 1.2, up, measureBounds(root));
} else if (request.type === "explicit") {
@@ -36628,7 +36843,7 @@ function resolveAssetCamera(root, shot = {}) {
const position = vec(triple2(request.position, "position")).applyMatrix4(matrix);
const target = request.target ? vec(triple2(request.target, "target")).applyMatrix4(matrix) : vec(bounds.min).add(vec(bounds.max)).multiplyScalar(0.5);
const up = vec(triple2(request.up ?? [0, 1, 0], "up")).transformDirection(matrix);
- const offset = vec(triple2(request.targetOffset ?? [0, 0, 0], "targetOffset")).applyMatrix4(matrix).sub(new Vector340().setFromMatrixPosition(matrix));
+ const offset = vec(triple2(request.targetOffset ?? [0, 0, 0], "targetOffset")).applyMatrix4(matrix).sub(new Vector341().setFromMatrixPosition(matrix));
const radius = vec(bounds.max).sub(vec(bounds.min)).length();
camera = {
version: "kiln.camera.v1",
@@ -36757,11 +36972,11 @@ function rasterizeCamera(root, input, size = 384, backfaceCull = true, backdrop)
}
return result;
};
- const key = new Vector340(1.5, 2, 1).normalize();
+ const key = new Vector341(1.5, 2, 1).normalize();
const srgb = (n) => n <= 0.0031308 ? n * 12.92 : 1.055 * n ** (1 / 2.4) - 0.055;
const ordered = compositingOrder(collectTriangles(root).tris, (px, py, pz) => camera.projection === "perspective" ? Math.hypot(px - position.x, py - position.y, pz - position.z) : (position.x - px) * z.x + (position.y - py) * z.y + (position.z - pz) * z.z);
for (const tri of ordered) {
- const world = [0, 1, 2].map((i) => new Vector340(tri.v[i * 3], tri.v[i * 3 + 1], tri.v[i * 3 + 2]));
+ const world = [0, 1, 2].map((i) => new Vector341(tri.v[i * 3], tri.v[i * 3 + 1], tri.v[i * 3 + 2]));
const normal = world[1].clone().sub(world[0]).cross(world[2].clone().sub(world[0])).normalize().multiplyScalar(tri.windingParity);
const normalSign = visibleNormalSign(normal.dot(camera.projection === "perspective" ? position.clone().sub(world[0]) : z), tri.side, backfaceCull);
if (normalSign === 0)
@@ -36772,7 +36987,7 @@ function rasterizeCamera(root, input, size = 384, backfaceCull = true, backdrop)
const color = tri.color.map((c) => Math.round(srgb(c * light) * 255));
let polygon = world.map((p) => {
const d = p.clone().sub(position);
- return new Vector340(d.dot(x), d.dot(y), -d.dot(z));
+ return new Vector341(d.dot(x), d.dot(y), -d.dot(z));
});
polygon = clip(clip(polygon, camera.near, true), camera.far, false);
for (let t = 1;t < polygon.length - 1; t++) {
@@ -36804,7 +37019,7 @@ function rasterizeCamera(root, input, size = 384, backfaceCull = true, backdrop)
}
return out;
}
-var vec = (a) => new Vector340(...a), tuple6 = (v) => [v.x || 0, v.y || 0, v.z || 0], KEY_HINTS;
+var vec = (a) => new Vector341(...a), tuple6 = (v) => [v.x || 0, v.y || 0, v.z || 0], KEY_HINTS;
var init_camera = __esm(() => {
init_raster();
init_background();
@@ -37575,7 +37790,7 @@ import {
PropertyBinding as PropertyBinding3,
VectorKeyframeTrack as VectorKeyframeTrack2,
Quaternion as Quaternion20,
- Vector3 as Vector341,
+ Vector3 as Vector342,
InterpolateDiscrete as InterpolateDiscrete2,
InterpolateLinear as InterpolateLinear2
} from "three";
@@ -37759,7 +37974,7 @@ function instanceMatrices(node) {
translations?.getElement(index, translation);
rotations?.getElement(index, rotation);
scales?.getElement(index, scale);
- const local = new Matrix418().compose(new Vector341(translations ? translation[0] : 0, translations ? translation[1] : 0, translations ? translation[2] : 0), new Quaternion20(rotations ? rotation[0] : 0, rotations ? rotation[1] : 0, rotations ? rotation[2] : 0, rotations ? rotation[3] : 1).normalize(), new Vector341(scales ? scale[0] : 1, scales ? scale[1] : 1, scales ? scale[2] : 1));
+ const local = new Matrix418().compose(new Vector342(translations ? translation[0] : 0, translations ? translation[1] : 0, translations ? translation[2] : 0), new Quaternion20(rotations ? rotation[0] : 0, rotations ? rotation[1] : 0, rotations ? rotation[2] : 0, rotations ? rotation[3] : 1).normalize(), new Vector342(scales ? scale[0] : 1, scales ? scale[1] : 1, scales ? scale[2] : 1));
matrices.push(world.clone().multiply(local));
}
return { matrices, count };
@@ -37866,7 +38081,7 @@ function localInstanceMatrices(node) {
translations?.getElement(index, translation);
rotations?.getElement(index, rotation);
scales?.getElement(index, scale);
- return new Matrix418().compose(new Vector341(...translations ? translation.slice(0, 3) : [0, 0, 0]), new Quaternion20(...rotations ? rotation.slice(0, 4) : [0, 0, 0, 1]).normalize(), new Vector341(...scales ? scale.slice(0, 3) : [1, 1, 1]));
+ return new Matrix418().compose(new Vector342(...translations ? translation.slice(0, 3) : [0, 0, 0]), new Quaternion20(...rotations ? rotation.slice(0, 4) : [0, 0, 0, 1]).normalize(), new Vector342(...scales ? scale.slice(0, 3) : [1, 1, 1]));
});
}
async function loadGlbReviewScene(bytes) {
@@ -38671,7 +38886,7 @@ var init_renderer_id = __esm(() => {
});
// src/views/scene-raster.ts
-import * as THREE55 from "three";
+import * as THREE56 from "three";
var DEG2;
var init_scene_raster = __esm(() => {
init_evaluator();
@@ -38683,18 +38898,18 @@ var init_scene_raster = __esm(() => {
});
// src/views/vehicle.ts
-import * as THREE56 from "three";
+import * as THREE57 from "three";
function hasRole2(node, prefix) {
return readSemanticMetadataV1(node)?.roles.some((role) => role === prefix || role.startsWith(`${prefix}.`)) ?? false;
}
function chassisBounds(root, inverse) {
- const bounds = new THREE56.Box3;
+ const bounds = new THREE57.Box3;
let found = false;
root.traverse((node) => {
if (!hasRole2(node, "chassis"))
return;
node.traverse((part) => {
- if (!(part instanceof THREE56.Mesh) || !(part.geometry instanceof THREE56.BufferGeometry))
+ if (!(part instanceof THREE57.Mesh) || !(part.geometry instanceof THREE57.BufferGeometry))
return;
part.geometry.computeBoundingBox();
const box = part.geometry.boundingBox;
@@ -38704,7 +38919,7 @@ function chassisBounds(root, inverse) {
for (const x of [box.min.x, box.max.x])
for (const y of [box.min.y, box.max.y])
for (const z of [box.min.z, box.max.z]) {
- bounds.expandByPoint(new THREE56.Vector3(x, y, z).applyMatrix4(matrix));
+ bounds.expandByPoint(new THREE57.Vector3(x, y, z).applyMatrix4(matrix));
found = true;
}
});
@@ -38772,33 +38987,33 @@ function tagDiagnostic(node, role) {
stampSemanticMetadataV1(node, { roles: [role] });
}
function rod(name, start, end, radius, color, role) {
- const from = new THREE56.Vector3(...start);
- const to = new THREE56.Vector3(...end);
+ const from = new THREE57.Vector3(...start);
+ const to = new THREE57.Vector3(...end);
const direction = to.clone().sub(from);
const length = direction.length();
- const geometry = length > 0.000000001 ? new THREE56.CylinderGeometry(radius, radius, length, 8) : new THREE56.SphereGeometry(radius, 8, 6);
- const result = new THREE56.Mesh(geometry, new THREE56.MeshBasicMaterial({ color }));
+ const geometry = length > 0.000000001 ? new THREE57.CylinderGeometry(radius, radius, length, 8) : new THREE57.SphereGeometry(radius, 8, 6);
+ const result = new THREE57.Mesh(geometry, new THREE57.MeshBasicMaterial({ color }));
result.name = name;
result.position.copy(from).add(to).multiplyScalar(0.5);
if (length > 0.000000001) {
- result.quaternion.setFromUnitVectors(new THREE56.Vector3(0, 1, 0), direction.multiplyScalar(1 / length));
+ result.quaternion.setFromUnitVectors(new THREE57.Vector3(0, 1, 0), direction.multiplyScalar(1 / length));
}
tagDiagnostic(result, role);
return result;
}
function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagnostics(root)) {
- const overlay = new THREE56.Group;
+ const overlay = new THREE57.Group;
overlay.name = "VehicleDiagnosticOverlay";
const chassisSpan = descriptor.chassisBox ? Math.max(descriptor.chassisBox.max[0] - descriptor.chassisBox.min[0], descriptor.chassisBox.max[1] - descriptor.chassisBox.min[1], descriptor.chassisBox.max[2] - descriptor.chassisBox.min[2]) : 1;
const thickness = Math.max(0.01, chassisSpan * 0.008);
- const arrow = new THREE56.Group;
+ const arrow = new THREE57.Group;
arrow.name = "Diagnostic_Forward_+X";
tagDiagnostic(arrow, "diagnostic.vehicle.forward");
arrow.add(rod("Diagnostic_Forward_Shaft", descriptor.forwardArrow.start, [descriptor.forwardArrow.end[0] - 0.12, 0, 0], thickness, 16724804, "diagnostic.vehicle.forward"));
- const arrowHead = new THREE56.Mesh(new THREE56.ConeGeometry(thickness * 3.2, 0.24, 10), new THREE56.MeshBasicMaterial({ color: 16724804 }));
+ const arrowHead = new THREE57.Mesh(new THREE57.ConeGeometry(thickness * 3.2, 0.24, 10), new THREE57.MeshBasicMaterial({ color: 16724804 }));
arrowHead.name = "Diagnostic_Forward_Head";
arrowHead.position.set(descriptor.forwardArrow.end[0] - 0.12, 0, 0);
- arrowHead.quaternion.setFromUnitVectors(new THREE56.Vector3(0, 1, 0), new THREE56.Vector3(1, 0, 0));
+ arrowHead.quaternion.setFromUnitVectors(new THREE57.Vector3(0, 1, 0), new THREE57.Vector3(1, 0, 0));
tagDiagnostic(arrowHead, "diagnostic.vehicle.forward");
arrow.add(arrowHead);
overlay.add(arrow);
@@ -38806,18 +39021,18 @@ function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagno
overlay.add(rod(`Diagnostic_Axle_${axle.id}`, axle.start, axle.end, thickness, 3386111, `diagnostic.vehicle.axle.${axle.id}`));
}
for (const wheel of descriptor.wheels) {
- const ring = new THREE56.Mesh(new THREE56.TorusGeometry(wheel.radius, Math.min(thickness, wheel.radius * 0.15), 6, 32), new THREE56.MeshBasicMaterial({ color: 16763955 }));
+ const ring = new THREE57.Mesh(new THREE57.TorusGeometry(wheel.radius, Math.min(thickness, wheel.radius * 0.15), 6, 32), new THREE57.MeshBasicMaterial({ color: 16763955 }));
ring.name = `Diagnostic_Wheel_${wheel.id}`;
ring.position.set(...wheel.center);
- const axle = new THREE56.Vector3(...wheel.axle);
+ const axle = new THREE57.Vector3(...wheel.axle);
if (axle.lengthSq() > 0.000000000001) {
- ring.quaternion.setFromUnitVectors(new THREE56.Vector3(0, 0, 1), axle.normalize());
+ ring.quaternion.setFromUnitVectors(new THREE57.Vector3(0, 0, 1), axle.normalize());
}
tagDiagnostic(ring, `diagnostic.vehicle.wheel.${wheel.id}`);
overlay.add(ring);
}
if (descriptor.chassisBox) {
- const chassis = new THREE56.Group;
+ const chassis = new THREE57.Group;
chassis.name = "Diagnostic_ChassisBox";
tagDiagnostic(chassis, "diagnostic.vehicle.chassis");
const { min, max } = descriptor.chassisBox;
@@ -38851,7 +39066,7 @@ function createVehicleDiagnosticOverlay(root, descriptor = describeVehicleDiagno
overlay.add(chassis);
}
if (descriptor.supportPlaneY !== undefined) {
- const plane = new THREE56.Group;
+ const plane = new THREE57.Group;
plane.name = "Diagnostic_SupportPlane";
tagDiagnostic(plane, "diagnostic.vehicle.support-plane");
const halfX = Math.max(1, ...descriptor.chassisBox ? [Math.abs(descriptor.chassisBox.min[0]), Math.abs(descriptor.chassisBox.max[0])] : [], ...descriptor.wheels.map((wheel) => Math.abs(wheel.center[0]) + wheel.radius)) + 0.2;
@@ -39449,7 +39664,7 @@ var init_views = __esm(() => {
});
// src/views/character-capture.ts
-import * as THREE57 from "three";
+import * as THREE58 from "three";
function drawLine2(rgb, width, height, from, to, color) {
let x0 = Math.round(from[0]);
let y0 = Math.round(from[1]);
@@ -39486,22 +39701,22 @@ function drawCross(rgb, width, height, point, color, radius = 3) {
}
function projector(root, cameraId, size) {
root.updateMatrixWorld(true);
- const bounds = new THREE57.Box3().setFromObject(root);
+ const bounds = new THREE58.Box3().setFromObject(root);
if (bounds.isEmpty())
- bounds.set(new THREE57.Vector3(-0.5, 0, -0.5), new THREE57.Vector3(0.5, 1, 0.5));
- const center = bounds.getCenter(new THREE57.Vector3);
- const camera = cameraId === "front" ? new THREE57.Vector3(1, 0, 0) : new THREE57.Vector3(0, 0, 1);
- const upHint = new THREE57.Vector3(0, 1, 0);
- const xAxis = new THREE57.Vector3().crossVectors(upHint, camera).normalize();
- const yAxis = new THREE57.Vector3().crossVectors(camera, xAxis).normalize();
+ bounds.set(new THREE58.Vector3(-0.5, 0, -0.5), new THREE58.Vector3(0.5, 1, 0.5));
+ const center = bounds.getCenter(new THREE58.Vector3);
+ const camera = cameraId === "front" ? new THREE58.Vector3(1, 0, 0) : new THREE58.Vector3(0, 0, 1);
+ const upHint = new THREE58.Vector3(0, 1, 0);
+ const xAxis = new THREE58.Vector3().crossVectors(upHint, camera).normalize();
+ const yAxis = new THREE58.Vector3().crossVectors(camera, xAxis).normalize();
let extent = 0.000001;
for (let corner = 0;corner < 8; corner++) {
- const point = new THREE57.Vector3(corner & 1 ? bounds.max.x : bounds.min.x, corner & 2 ? bounds.max.y : bounds.min.y, corner & 4 ? bounds.max.z : bounds.min.z).sub(center);
+ const point = new THREE58.Vector3(corner & 1 ? bounds.max.x : bounds.min.x, corner & 2 ? bounds.max.y : bounds.min.y, corner & 4 ? bounds.max.z : bounds.min.z).sub(center);
extent = Math.max(extent, Math.abs(point.dot(xAxis)), Math.abs(point.dot(yAxis)));
}
const scale = size * 0.45 / extent;
return (assetPoint) => {
- const world = new THREE57.Vector3(...assetPoint).applyMatrix4(root.matrixWorld).sub(center);
+ const world = new THREE58.Vector3(...assetPoint).applyMatrix4(root.matrixWorld).sub(center);
return [size / 2 + world.dot(xAxis) * scale, size / 2 - world.dot(yAxis) * scale];
};
}
@@ -39627,7 +39842,7 @@ var init_character_capture = __esm(() => {
});
// src/render.ts
-import * as THREE58 from "three";
+import * as THREE59 from "three";
import { Document, Logger as Logger2 } from "@gltf-transform/core";
import { KHRMaterialsEmissiveStrength } from "@gltf-transform/extensions";
import { dedup as dedup2, instance, palette, weld as weld2, prune as prune2, mergeDocuments } from "@gltf-transform/functions";
@@ -39857,7 +40072,7 @@ function bridgeMaterial(doc, threeMat, cache, textureCache, authorExtras, atlas)
} else if (stdMat.transparent) {
mat.setAlphaMode("BLEND");
}
- if (stdMat.side === THREE58.DoubleSide) {
+ if (stdMat.side === THREE59.DoubleSide) {
mat.setDoubleSided(true);
}
if (stdMat.map) {
@@ -39934,7 +40149,7 @@ function bridgeMaterial(doc, threeMat, cache, textureCache, authorExtras, atlas)
} else if (common.transparent || (common.opacity ?? 1) < 1) {
mat.setAlphaMode("BLEND");
}
- if (threeMat.side === THREE58.DoubleSide)
+ if (threeMat.side === THREE59.DoubleSide)
mat.setDoubleSided(true);
if (common.map && !mat.getBaseColorTexture()) {
const texture = bridgeTexture(doc, common.map, textureCache);
@@ -40097,7 +40312,7 @@ function bridgeNode(doc, buf, threeObj, matCache, nodeMap, meshCache, texCache,
const cacheKey = `kiln-sprite-quad:${centerX}:${centerY}:${rotation}__${threeMat.uuid}`;
let gtMesh = meshCache.get(cacheKey);
if (!gtMesh) {
- const geometry = new THREE58.PlaneGeometry(1, 1);
+ const geometry = new THREE59.PlaneGeometry(1, 1);
if (centerX !== 0.5 || centerY !== 0.5) {
geometry.translate(0.5 - centerX, 0.5 - centerY, 0);
}
@@ -40121,9 +40336,9 @@ function animationInterpolation(track) {
if (isCubicSplineTrack(track))
return "CUBICSPLINE";
const mode = track.getInterpolation();
- if (mode === THREE58.InterpolateDiscrete)
+ if (mode === THREE59.InterpolateDiscrete)
return "STEP";
- if (mode === THREE58.InterpolateLinear)
+ if (mode === THREE59.InterpolateLinear)
return "LINEAR";
throw new Error(`Unsupported animation interpolation on ${track.name}; use LINEAR, STEP or CUBICSPLINE.`);
}
@@ -40668,6 +40883,22 @@ function inspectGeneratedAnimation(root, clips) {
}
return warnings;
}
+function collapseWeldedFloaters(floaters, pieces) {
+ for (let i = 0;i < floaters.length; i++) {
+ const mesh = floaters[i].welded;
+ if (!mesh)
+ continue;
+ const detached = floaters.filter((floater) => floater.welded === mesh).length;
+ if (detached < 2)
+ continue;
+ const of = pieces.find((piece) => piece.welded?.mesh === mesh)?.welded?.of ?? detached;
+ floaters[i].name = `${mesh} (${detached} of its ${of} welded components)`;
+ for (let j = floaters.length - 1;j > i; j--)
+ if (floaters[j].welded === mesh)
+ floaters.splice(j, 1);
+ floaters[i].welded = undefined;
+ }
+}
function collectMeshStats(root) {
root.updateMatrixWorld(true);
const out = [];
@@ -40697,8 +40928,8 @@ function collectMeshStats(root) {
if (!Number.isFinite(box.min.x) || !Number.isFinite(box.max.x)) {
return;
}
- const center = new THREE58.Vector3;
- const size = new THREE58.Vector3;
+ const center = new THREE59.Vector3;
+ const size = new THREE59.Vector3;
box.getCenter(center);
box.getSize(size);
out.push({
@@ -40714,7 +40945,7 @@ function collectMeshStats(root) {
return out;
}
function minimalGapVector(a, b) {
- const v = new THREE58.Vector3;
+ const v = new THREE59.Vector3;
for (const axis of ["x", "y", "z"]) {
if (a.min[axis] > b.max[axis])
v[axis] = b.max[axis] - a.min[axis];
@@ -40732,10 +40963,10 @@ function inspectSceneStructure(root, opts = {}) {
return warnings;
const cat = opts.category?.toLowerCase();
if (cat === "vehicle" || cat === "weapon" || cat === "boat" || cat === "aircraft") {
- const all = new THREE58.Box3;
+ const all = new THREE59.Box3;
for (const m of meshes)
all.union(m.box);
- const size = new THREE58.Vector3;
+ const size = new THREE59.Vector3;
all.getSize(size);
if (cat === "aircraft") {
if (size.y > size.x * 1.2) {
@@ -40759,17 +40990,28 @@ function inspectSceneStructure(root, opts = {}) {
warnings.push(`Stray plane "${m.name}" at world origin (centroid ≈ [0,0,0]). Replace planeGeo with decalBox and position on a host surface, or move this mesh into place.`);
}
}
- if (meshes.length > 1) {
+ const budget = splitBudget();
+ const pieces = meshes.flatMap((mesh) => {
+ const boxes = meshComponentBoxes(mesh.object, budget);
+ if (!boxes || boxes.length < 2)
+ return [mesh];
+ return boxes.map((box, index) => ({
+ ...mesh,
+ box,
+ welded: { mesh: mesh.name, index: index + 1, of: boxes.length }
+ }));
+ });
+ if (pieces.length > 1) {
const floaters = [];
const supported = [];
- for (let i = 0;i < meshes.length; i++) {
- const a = meshes[i];
+ for (let i = 0;i < pieces.length; i++) {
+ const a = pieces[i];
const ax = a.box.clone().expandByScalar(FLOATING_EXPAND);
let overlapsAny = false;
- for (let j = 0;j < meshes.length; j++) {
+ for (let j = 0;j < pieces.length; j++) {
if (i === j)
continue;
- const b = meshes[j];
+ const b = pieces[j];
if (ax.intersectsBox(b.box)) {
overlapsAny = true;
break;
@@ -40785,19 +41027,25 @@ function inspectSceneStructure(root, opts = {}) {
const declared = declaredSupports(a.object, opts.externalSupport)[0];
let nearest;
let nearestGap;
- for (let j = 0;j < meshes.length; j++) {
+ for (let j = 0;j < pieces.length; j++) {
if (i === j)
continue;
- const gap = minimalGapVector(a.box, meshes[j].box);
+ const gap = minimalGapVector(a.box, pieces[j].box);
if (!nearestGap || gap.length() < nearestGap.length()) {
- nearest = meshes[j];
+ nearest = pieces[j];
nearestGap = gap;
}
}
- const fix = nearest && nearestGap ? ` Fix: shift "${a.name}" by [${nearestGap.x.toFixed(3)}, ${nearestGap.y.toFixed(3)}, ${nearestGap.z.toFixed(3)}] toward "${nearest.name}", or call snapTo(part, hostPart) to do it automatically.` : "";
+ const fix = a.welded ? ` Fix: one mesh moves and hides as one, so close the gap in the merged geometry, or author the component as its own part. It spans ${spanText(a.box)}.` : nearest && nearestGap ? ` Fix: shift "${a.name}" by [${nearestGap.x.toFixed(3)}, ${nearestGap.y.toFixed(3)}, ${nearestGap.z.toFixed(3)}] toward "${nearest.name}", or call snapTo(part, hostPart) to do it automatically.` : "";
const mismatch = declared ? ` It is named in a declared external support at Y=${declared.planeY.toFixed(3)}, but its bottom is at Y=${a.box.min.y.toFixed(3)}.` : "";
- floaters.push({ name: a.name, fix: fix + mismatch });
+ const name = a.welded ? `${a.welded.mesh} (welded component ${a.welded.index} of ${a.welded.of})` : a.name;
+ floaters.push({
+ name,
+ fix: fix + mismatch,
+ ...a.welded ? { welded: a.welded.mesh } : {}
+ });
}
+ collapseWeldedFloaters(floaters, pieces);
if (floaters.length > 0) {
const entries = floaters.slice(0, FLOATER_FIXES_SHOWN).map(({ name, fix }) => `${name}${fix ? ` —${fix}` : ""}`);
const rest = floaters.slice(FLOATER_FIXES_SHOWN);
@@ -40807,7 +41055,7 @@ function inspectSceneStructure(root, opts = {}) {
names.push(`+${rest.length - names.length} more`);
entries.push(`+${rest.length} more floating: ${names.join(", ")} — the same fix applies: shift each onto its nearest sibling, or call snapTo(part, hostPart).`);
}
- warnings.push(`Floating parts (no mesh overlap with any sibling, 2cm tol): ${entries.join(" | ")} — Coverage: drawn meshes only, at 2cm. A smaller gap reads as contact and a primitive welded into another mesh is never seen, so a silent pass is not a fit audit; measure contacts in the destination.`);
+ warnings.push(`Floating parts (no mesh overlap with any sibling, 2cm tol): ${entries.join(" | ")} — Coverage: drawn meshes only, at 2cm. Welded components inside one mesh are compared the same way, box to box. A smaller gap reads as contact, so a silent pass is not a fit audit; measure contacts in the destination.${budget.unsplit.length ? ` Over the split budget, so measured as one box: ${budget.unsplit.slice(0, FLOATER_NAMES_SHOWN).join(", ")}.` : ""}`);
}
if (supported.length > 0) {
const shown = supported.slice(0, FLOATER_NAMES_SHOWN);
@@ -40818,11 +41066,12 @@ function inspectSceneStructure(root, opts = {}) {
}
return warnings;
}
-var engineIO, TYPE_SCALAR = "SCALAR", TYPE_VEC2 = "VEC2", TYPE_VEC3 = "VEC3", TYPE_VEC4 = "VEC4", ACCESSOR_TYPES, GROUND_CONTACT_TOLERANCE = 0.02, GLTF_MIN_FILTER, GLTF_MAG_FILTER, GLTF_WRAP, REVIEW_CLIPS_EXTRAS_KEY2 = "kilnReviewClipsV1", REVIEW_CLIP_LIMITS2, PALETTE_MIN = 4, INSTANCE_MIN = 5, FLOATER_FIXES_SHOWN = 6, FLOATER_NAMES_SHOWN = 24;
+var engineIO, TYPE_SCALAR = "SCALAR", TYPE_VEC2 = "VEC2", TYPE_VEC3 = "VEC3", TYPE_VEC4 = "VEC4", ACCESSOR_TYPES, GROUND_CONTACT_TOLERANCE = 0.02, GLTF_MIN_FILTER, GLTF_MAG_FILTER, GLTF_WRAP, REVIEW_CLIPS_EXTRAS_KEY2 = "kilnReviewClipsV1", REVIEW_CLIP_LIMITS2, PALETTE_MIN = 4, INSTANCE_MIN = 5, spanText = (box) => `[${box.min.toArray().map((v) => v.toFixed(3)).join(", ")}] to [${box.max.toArray().map((v) => v.toFixed(3)).join(", ")}]`, FLOATER_FIXES_SHOWN = 6, FLOATER_NAMES_SHOWN = 24;
var init_render = __esm(() => {
init_requirements_context();
init_requirements_run();
init_requirements_report();
+ init_mesh_components();
init_skin_integrity();
init_authoring_diagnostic();
init_gltf_io();
@@ -40860,18 +41109,18 @@ var init_render = __esm(() => {
engineIO = createGltfIO;
ACCESSOR_TYPES = [TYPE_SCALAR, TYPE_VEC2, TYPE_VEC3, TYPE_VEC4];
GLTF_MIN_FILTER = {
- [THREE58.NearestFilter]: 9728,
- [THREE58.LinearFilter]: 9729,
- [THREE58.NearestMipmapNearestFilter]: 9984,
- [THREE58.LinearMipmapNearestFilter]: 9985,
- [THREE58.NearestMipmapLinearFilter]: 9986,
- [THREE58.LinearMipmapLinearFilter]: 9987
- };
- GLTF_MAG_FILTER = { [THREE58.NearestFilter]: 9728, [THREE58.LinearFilter]: 9729 };
+ [THREE59.NearestFilter]: 9728,
+ [THREE59.LinearFilter]: 9729,
+ [THREE59.NearestMipmapNearestFilter]: 9984,
+ [THREE59.LinearMipmapNearestFilter]: 9985,
+ [THREE59.NearestMipmapLinearFilter]: 9986,
+ [THREE59.LinearMipmapLinearFilter]: 9987
+ };
+ GLTF_MAG_FILTER = { [THREE59.NearestFilter]: 9728, [THREE59.LinearFilter]: 9729 };
GLTF_WRAP = {
- [THREE58.ClampToEdgeWrapping]: 33071,
- [THREE58.MirroredRepeatWrapping]: 33648,
- [THREE58.RepeatWrapping]: 10497
+ [THREE59.ClampToEdgeWrapping]: 33071,
+ [THREE59.MirroredRepeatWrapping]: 33648,
+ [THREE59.RepeatWrapping]: 10497
};
REVIEW_CLIP_LIMITS2 = {
clips: 32,
@@ -41787,28 +42036,28 @@ var exports_part_placement = {};
__export(exports_part_placement, {
createPartPlacementReader: () => createPartPlacementReader
});
-import * as THREE59 from "three";
+import * as THREE60 from "three";
function createPartPlacementReader(root) {
const bounds = createPartBoundsReader(root);
- const position = new THREE59.Vector3;
- const quaternion = new THREE59.Quaternion;
- const scale = new THREE59.Vector3;
+ const position = new THREE60.Vector3;
+ const quaternion = new THREE60.Quaternion;
+ const scale = new THREE60.Vector3;
return (node) => {
node.matrixWorld.decompose(position, quaternion, scale);
const box = bounds(node);
return {
- position: rounded2(position.toArray()),
- quaternion: rounded2(quaternion.toArray()),
- scale: rounded2(scale.toArray()),
+ position: rounded3(position.toArray()),
+ quaternion: rounded3(quaternion.toArray()),
+ scale: rounded3(scale.toArray()),
mirrored: node.matrixWorld.determinant() < 0,
- bounds: box ? { min: rounded2(box.min), max: rounded2(box.max) } : null
+ bounds: box ? { min: rounded3(box.min), max: rounded3(box.max) } : null
};
};
}
var round4 = (value) => {
const rounded = Math.round(value * 1e6) / 1e6;
return rounded === 0 ? 0 : rounded;
-}, rounded2 = (values) => values.map(round4);
+}, rounded3 = (values) => values.map(round4);
var init_part_placement = __esm(() => {
init_raster();
});
@@ -41943,13 +42192,13 @@ var init_inspect = __esm(() => {
});
// src/views/measurement.ts
-import { Box3 as Box327, Vector3 as Vector346 } from "three";
+import { Box3 as Box328, Vector3 as Vector347 } from "three";
function describeSubjectFrame(root, subject) {
const selected = selectCameraSubject(root, subject);
selected.node.updateWorldMatrix(true, true);
const matrix = selected.node.matrixWorld;
- const bounds = new Box327().setFromObject(selected.node);
- const local = new Box327;
+ const bounds = new Box328().setFromObject(selected.node);
+ const local = new Box328;
const invertible = matrix.determinant() !== 0;
const inverse = matrix.clone().invert();
selected.node.traverse((node) => {
@@ -41960,10 +42209,10 @@ function describeSubjectFrame(root, subject) {
if (!attr)
return;
for (let i = 0;i < attr.count; i++)
- local.expandByPoint(new Vector346().fromBufferAttribute(attr, i).applyMatrix4(mesh.matrixWorld).applyMatrix4(inverse));
+ local.expandByPoint(new Vector347().fromBufferAttribute(attr, i).applyMatrix4(mesh.matrixWorld).applyMatrix4(inverse));
});
const box = (b) => b.isEmpty() ? null : { min: b.min.toArray(), max: b.max.toArray() };
- const axis = (i) => new Vector346().setFromMatrixColumn(matrix, i).normalize().toArray();
+ const axis = (i) => new Vector347().setFromMatrixColumn(matrix, i).normalize().toArray();
return {
path: selected.path,
name: selected.name,
@@ -41973,7 +42222,7 @@ function describeSubjectFrame(root, subject) {
invertible,
worldMatrix: matrix.toArray(),
axes: { frame: "world", x: axis(0), y: axis(1), z: axis(2) },
- origin: new Vector346().setFromMatrixPosition(matrix).toArray()
+ origin: new Vector347().setFromMatrixPosition(matrix).toArray()
};
}
function measureAttachment(root, input) {
@@ -41986,7 +42235,7 @@ function measureAttachment(root, input) {
return {
path: selected.path,
local: [...local],
- world: new Vector346(...local).applyMatrix4(selected.node.matrixWorld).toArray()
+ world: new Vector347(...local).applyMatrix4(selected.node.matrixWorld).toArray()
};
};
const from = endpoint(input.from), to = endpoint(input.to);
@@ -41996,7 +42245,7 @@ function measureAttachment(root, input) {
method: "straight-line anchor distance",
from,
to,
- distance: new Vector346(...from.world).distanceTo(new Vector346(...to.world))
+ distance: new Vector347(...from.world).distanceTo(new Vector347(...to.world))
};
}
var init_measurement = __esm(() => {
@@ -42008,7 +42257,7 @@ import {
PropertyType as PropertyType6
} from "@gltf-transform/core";
import { ALL_EXTENSIONS as ALL_EXTENSIONS2 } from "@gltf-transform/extensions";
-import { Box3 as Box328, Matrix4 as Matrix419, Quaternion as Quaternion23, Vector3 as Vector347 } from "three";
+import { Box3 as Box329, Matrix4 as Matrix419, Quaternion as Quaternion23, Vector3 as Vector348 } from "three";
async function accessorFingerprint(accessor) {
const array = accessor?.getArray();
if (!accessor || !array)
@@ -42027,7 +42276,7 @@ function bounds(box) {
return box.isEmpty() ? null : {
min: box.min.toArray(),
max: box.max.toArray(),
- size: box.getSize(new Vector347).toArray()
+ size: box.getSize(new Vector348).toArray()
};
}
async function digest8(bytes) {
@@ -42043,7 +42292,7 @@ function placements(node) {
const rotation = instances.getAttribute("ROTATION");
const scale = instances.getAttribute("SCALE");
const count = translation?.getCount() ?? rotation?.getCount() ?? scale?.getCount() ?? 1;
- return Array.from({ length: count }, (_, i) => world.clone().multiply(new Matrix419().compose(new Vector347().fromArray(translation?.getElement(i, []) ?? [0, 0, 0]), new Quaternion23().fromArray(rotation?.getElement(i, []) ?? [0, 0, 0, 1]), new Vector347().fromArray(scale?.getElement(i, []) ?? [1, 1, 1]))));
+ return Array.from({ length: count }, (_, i) => world.clone().multiply(new Matrix419().compose(new Vector348().fromArray(translation?.getElement(i, []) ?? [0, 0, 0]), new Quaternion23().fromArray(rotation?.getElement(i, []) ?? [0, 0, 0, 1]), new Vector348().fromArray(scale?.getElement(i, []) ?? [1, 1, 1]))));
}
function triangleCorners(mode, count) {
const corners = [];
@@ -42110,7 +42359,7 @@ async function drawnGeometryDigests(doc) {
}
const data = new Float32Array(triangles * RECORD);
const others = [];
- const point = new Vector347;
+ const point = new Vector348;
const element = [0, 0, 0];
const texcoord = [0, 0];
const corner = new Float32Array(15);
@@ -42193,7 +42442,7 @@ async function revisionTotals(doc) {
const { vertices, geometry, uv } = await drawnGeometryDigests(doc);
const scene = doc.getRoot().getDefaultScene() ?? doc.getRoot().listScenes()[0];
const drawnBounds = scene ? drawnSceneBounds(scene) : null;
- const box = drawnBounds && [...drawnBounds.min, ...drawnBounds.max].every(Number.isFinite) ? new Box328(new Vector347(...drawnBounds.min), new Vector347(...drawnBounds.max)) : new Box328;
+ const box = drawnBounds && [...drawnBounds.min, ...drawnBounds.max].every(Number.isFinite) ? new Box329(new Vector348(...drawnBounds.min), new Vector348(...drawnBounds.max)) : new Box329;
return {
triangles: metrics.triangles,
vertices,
@@ -42268,7 +42517,7 @@ async function snapshot3(bytes) {
if (depth > 128)
throw new Error("Revision comparison hierarchy exceeds 128 levels.");
const names = new Set;
- const combined = new Box328;
+ const combined = new Box329;
const placed = siblings.flatMap((node) => [
{ node, drawn: true },
...lowerLevels(node).map((level) => ({ node: level, drawn: false }))
@@ -42285,7 +42534,7 @@ async function snapshot3(bytes) {
if (node.listExtensions().some((extension) => extension.extensionName !== MSFT_LOD && extension.extensionName !== "KHR_node_visibility") || mesh?.listExtensions().length)
throw new Error("Revision comparison does not support node/mesh extensions (including instancing).");
const primitives = mesh?.listPrimitives() ?? [];
- const own = new Box328;
+ const own = new Box329;
const matrix = parentWorld.clone().multiply(new Matrix419().fromArray(node.getMatrix()));
if (matrix.elements.some((value) => !Number.isFinite(value)))
throw new Error("Revision comparison requires finite transforms.");
@@ -42306,7 +42555,7 @@ async function snapshot3(bytes) {
if (!Number.isInteger(vertex) || vertex < 0 || vertex >= position.getCount())
throw new Error("Revision comparison found an invalid vertex index.");
position.getElement(vertex, element);
- const point = new Vector347(...element).applyMatrix4(matrix);
+ const point = new Vector348(...element).applyMatrix4(matrix);
if (point.toArray().some((value) => !Number.isFinite(value)))
throw new Error("Revision comparison requires finite positions.");
own.expandByPoint(point);
@@ -42506,20 +42755,20 @@ var init_revision_comparison = __esm(() => {
// src/views/surface-distance.ts
import {
- Box3 as Box329,
+ Box3 as Box330,
Matrix4 as Matrix420,
Ray as Ray3,
Triangle as Triangle3,
- Vector3 as Vector348
+ Vector3 as Vector349
} from "three";
function hierarchy(triangles) {
- const box = new Box329;
+ const box = new Box330;
for (const triangle of triangles)
box.union(triangle.box);
const count = triangles.length;
if (count <= 4)
return { box, count, triangles };
- const size = box.getSize(new Vector348);
+ const size = box.getSize(new Vector349);
const axis = size.x >= size.y && size.x >= size.z ? "x" : size.y >= size.z ? "y" : "z";
const center = (triangle) => triangle.box.min[axis] / 2 + triangle.box.max[axis] / 2;
triangles.sort((a, b) => center(a) - center(b));
@@ -42538,7 +42787,7 @@ function boxDistanceSquared2(a, b) {
}
function collect(node, paths) {
const triangles = [];
- const bounds = new Box329;
+ const bounds = new Box330;
node.updateWorldMatrix(true, true);
node.traverseVisible((child) => {
const mesh = child;
@@ -42571,13 +42820,13 @@ function collect(node, paths) {
const id = index ? index.getX(i + offset) : i + offset;
if (!Number.isSafeInteger(id) || id < 0 || id >= position.count)
throw new Error("Surface distance encountered an invalid triangle index.");
- const point = new Vector348().fromBufferAttribute(position, id).applyMatrix4(matrix);
+ const point = new Vector349().fromBufferAttribute(position, id).applyMatrix4(matrix);
if (![point.x, point.y, point.z].every(Number.isFinite))
throw new Error("Surface distance encountered a non-finite world position.");
return point;
};
const triangle = new Triangle3(vertex(0), vertex(1), vertex(2));
- const box = new Box329().setFromPoints([triangle.a, triangle.b, triangle.c]);
+ const box = new Box330().setFromPoints([triangle.a, triangle.b, triangle.c]);
bounds.union(box);
triangles.push({
triangle,
@@ -42630,10 +42879,10 @@ function trianglePair(a, b) {
const av = [a.a, a.b, a.c], bv = [b.a, b.b, b.c];
if (b.getArea() > 0)
for (const p of av)
- record(p, b.closestPointToPoint(p, new Vector348));
+ record(p, b.closestPointToPoint(p, new Vector349));
if (a.getArea() > 0)
for (const q of bv)
- record(a.closestPointToPoint(q, new Vector348), q);
+ record(a.closestPointToPoint(q, new Vector349), q);
for (let i = 0;i < 3; i++) {
const p = av[i], q = av[(i + 1) % 3];
for (let j = 0;j < 3; j++)
@@ -42646,9 +42895,9 @@ function trianglePair(a, b) {
const length = delta.length();
if (length === 0)
continue;
- const hit = new Ray3(origin, delta.divideScalar(length)).intersectTriangle(target.a, target.b, target.c, false, new Vector348);
+ const hit = new Ray3(origin, delta.divideScalar(length)).intersectTriangle(target.a, target.b, target.c, false, new Vector349);
if (hit && origin.distanceTo(hit) <= length) {
- const onFace = target.closestPointToPoint(hit, new Vector348);
+ const onFace = target.closestPointToPoint(hit, new Vector349);
if (vertices === av)
record(hit, onFace);
else
@@ -42814,7 +43063,7 @@ __export(exports_draw_diagnostics, {
});
import { Primitive as Primitive3 } from "@gltf-transform/core";
import { cloneDocument as cloneDocument2 } from "@gltf-transform/functions";
-import * as THREE60 from "three";
+import * as THREE61 from "three";
function withinLimits(doc) {
const root = doc.getRoot();
if (root.listNodes().length > MAX_NODES2 || root.listAccessors().length > 4096 || root.listMaterials().length > 2048 || root.listTextures().length > 256 || root.listScenes().length > 32 || doc.getGraph().listEdges().length > 32768)
@@ -42867,7 +43116,7 @@ function collect2(doc, keep) {
function overlaps(a, b) {
if (Math.abs(a.normal.dot(b.normal)) < 1 - 0.00000001 || !a.bounds.intersectsBox(b.bounds))
return false;
- const tolerance = Math.max(a.bounds.getSize(new THREE60.Vector3).length(), b.bounds.getSize(new THREE60.Vector3).length(), 0.000000000001) * 0.000001;
+ const tolerance = Math.max(a.bounds.getSize(new THREE61.Vector3).length(), b.bounds.getSize(new THREE61.Vector3).length(), 0.000000000001) * 0.000001;
if (b.points.some((p) => Math.abs(a.normal.dot(p.clone().sub(a.points[0]))) > tolerance))
return false;
const normal = a.normal.toArray().map(Math.abs);
@@ -42909,7 +43158,7 @@ function observe(uses) {
unexaminedPrimitiveUses++;
continue;
}
- const matrix = new THREE60.Matrix4().fromArray(node.getWorldMatrix());
+ const matrix = new THREE61.Matrix4().fromArray(node.getWorldMatrix());
if (primitive.getAttribute("TANGENT") && matrix.determinant() < 0)
mirrored.set(part.id, part);
const position = primitive.getAttribute("POSITION");
@@ -42923,14 +43172,14 @@ function observe(uses) {
const amount = Math.min(count, 8, MAX_SAMPLES - samples.length);
for (let i = 0;i < amount; i++) {
const start = Math.floor(i * count / amount) * 3;
- const points = [0, 1, 2].map((j) => new THREE60.Vector3().fromArray(position.getElement(indices ? indices.getScalar(start + j) : start + j, [])).applyMatrix4(matrix));
+ const points = [0, 1, 2].map((j) => new THREE61.Vector3().fromArray(position.getElement(indices ? indices.getScalar(start + j) : start + j, [])).applyMatrix4(matrix));
const normal = points[1].clone().sub(points[0]).cross(points[2].clone().sub(points[0]));
if (!Number.isFinite(normal.lengthSq()) || normal.lengthSq() === 0)
continue;
samples.push({
points,
normal: normal.normalize(),
- bounds: new THREE60.Box3().setFromPoints(points),
+ bounds: new THREE61.Box3().setFromPoints(points),
part
});
}
@@ -53130,7 +53379,7 @@ init_render();
init_requirements_context();
init_evaluator();
init_material_resources();
-import * as THREE61 from "three";
+import * as THREE62 from "three";
// src/render-route.ts
var GPU_SERVES = new Set([
@@ -53731,8 +53980,8 @@ function collectSceneMetrics(root) {
let meshes = 0;
const materialSet = new Set;
let lowestPart;
- const box = new THREE61.Box3;
- const point = new THREE61.Vector3;
+ const box = new THREE62.Box3;
+ const point = new THREE62.Vector3;
root.updateWorldMatrix(true, true);
root.traverseVisible((node) => {
const n = node;
@@ -53748,7 +53997,7 @@ function collectSceneMetrics(root) {
const mesh = node;
const position = mesh.geometry.getAttribute("position");
const index = mesh.geometry.index;
- const mb = new THREE61.Box3;
+ const mb = new THREE62.Box3;
if (position) {
for (let i = 0;i < (index?.count ?? position.count); i++) {
point.fromBufferAttribute(position, index ? index.getX(i) : i);
@@ -53763,7 +54012,7 @@ function collectSceneMetrics(root) {
});
let bbox;
if (!box.isEmpty()) {
- const size = new THREE61.Vector3;
+ const size = new THREE62.Vector3;
box.getSize(size);
bbox = {
min: [box.min.x, box.min.y, box.min.z],
diff --git a/skills/kiln-qa-asset/references/integration-checks.md b/skills/kiln-qa-asset/references/integration-checks.md
index 857a2535..fb3c9c23 100644
--- a/skills/kiln-qa-asset/references/integration-checks.md
+++ b/skills/kiln-qa-asset/references/integration-checks.md
@@ -83,14 +83,21 @@ Do not invent a universal performance cap. State the destination, tested conditi
Kiln's own structural checks — the floating-parts warning and the part-connectivity
observation — read the bounding boxes of drawn meshes with a 2 cm adjacency
tolerance. They report a part or subassembly detached from the body; they are not a
-fit audit. Two consequences bound what a clean pass means. A separation under the
-tolerance reads as contact, so a part standing a millimetre or two off its host is
-not reported. And one mesh is one box, so primitives merged into a single mesh —
-what per-material welding for draw-call reduction produces — are not compared with
-each other at any separation. Where millimetre contact is a requirement, measure it
-in the destination against the exported file, and run that audit before saving the
+fit audit. A mesh holding several welded components is compared once per component,
+so a primitive merged into another is seen, but the same limits bound what a clean
+pass means. A separation under the tolerance reads as contact, so a part standing a
+millimetre or two off its host is not reported. Boxes are not surfaces: components
+of a diagonal or wrapped shape can read as touching when they are not. And foliage
+and decal names, instanced and skinned meshes, LOD alternates and meshes over the
+split budget stay one box. Where millimetre contact is a requirement, measure it in
+the destination against the exported file, and run that audit before saving the
revision rather than after.
+A welded finding can also reveal more than the mesh it names. A merged mesh spread
+across an asset used to be one large box that touched everything near it, so splitting
+one can report other parts as detached for the first time. That is the box no longer
+bridging them, not a change in the geometry.
+
For an enterable building or gate, test the intended actor through the exported
opening with collision enabled. Include thresholds, plinths, lintels, trim and
hinge travel. The open leaf and nominal wall dimensions do not prove passage.
diff --git a/src/__tests__/examples.test.ts b/src/__tests__/examples.test.ts
index 94bb7a03..d0e9a491 100644
--- a/src/__tests__/examples.test.ts
+++ b/src/__tests__/examples.test.ts
@@ -57,8 +57,12 @@ const outcomes = new Map<string, Outcome>(
// Completed local sweep/loft checks no longer emit unconditional unchecked warnings.
// Exact remaining advisory groups are still asserted, without a blanket filter.
const documentedAdvisories: Record<string, string[]> = {
+ // Its deck markings were one box across the whole deck until #304 split welded meshes.
+ 'demo-dauntless-cv-08': [
+ 'Floating parts (no mesh overlap with any sibling, 2cm tol): Mesh_Deck_Markings_ivory (4 of its 50 welded components) — Fix: one mesh moves and hides as one, so close the gap in the merged geometry, or author the component as its own part. It spans [-22.075, 12.392, -4.854] to [-19.066, 12.417, -4.417]. — Coverage: drawn meshes only, at 2cm. Welded components inside one mesh are compared the same way, box to box. A smaller gap reads as contact, so a silent pass is not a fit audit; measure contacts in the destination.',
+ ],
'demo-floating-observatory': [
- 'Floating parts (no mesh overlap with any sibling, 2cm tol): Mesh_WaterfallSprayDroplet_3 — Fix: shift "Mesh_WaterfallSprayDroplet_3" by [0.000, 0.000, -0.024] toward "Mesh_ContinuousWaterCurtain", or call snapTo(part, hostPart) to do it automatically. | Mesh_WaterfallSprayDroplet_5 — Fix: shift "Mesh_WaterfallSprayDroplet_5" by [0.000, 0.000, -0.026] toward "Mesh_ContinuousWaterCurtain", or call snapTo(part, hostPart) to do it automatically. | Mesh_WaterfallSprayDroplet_9 — Fix: shift "Mesh_WaterfallSprayDroplet_9" by [0.000, 0.000, -0.046] toward "Mesh_ContinuousWaterCurtain", or call snapTo(part, hostPart) to do it automatically. | Mesh_WaterfallSprayDroplet_11 — Fix: shift "Mesh_WaterfallSprayDroplet_11" by [0.000, 0.000, -0.059] toward "Mesh_ContinuousWaterCurtain", or call snapTo(part, hostPart) to do it automatically. — Coverage: drawn meshes only, at 2cm. A smaller gap reads as contact and a primitive welded into another mesh is never seen, so a silent pass is not a fit audit; measure contacts in the destination.',
+ 'Floating parts (no mesh overlap with any sibling, 2cm tol): Mesh_WaterfallSprayDroplet_3 — Fix: shift "Mesh_WaterfallSprayDroplet_3" by [0.000, 0.000, -0.024] toward "Mesh_ContinuousWaterCurtain", or call snapTo(part, hostPart) to do it automatically. | Mesh_WaterfallSprayDroplet_5 — Fix: shift "Mesh_WaterfallSprayDroplet_5" by [0.000, 0.000, -0.026] toward "Mesh_ContinuousWaterCurtain", or call snapTo(part, hostPart) to do it automatically. | Mesh_WaterfallSprayDroplet_9 — Fix: shift "Mesh_WaterfallSprayDroplet_9" by [0.000, 0.000, -0.046] toward "Mesh_ContinuousWaterCurtain", or call snapTo(part, hostPart) to do it automatically. | Mesh_WaterfallSprayDroplet_11 — Fix: shift "Mesh_WaterfallSprayDroplet_11" by [0.000, 0.000, -0.059] toward "Mesh_ContinuousWaterCurtain", or call snapTo(part, hostPart) to do it automatically. — Coverage: drawn meshes only, at 2cm. Welded components inside one mesh are compared the same way, box to box. A smaller gap reads as contact, so a silent pass is not a fit audit; measure contacts in the destination.',
],
};
diff --git a/src/qa/mesh-components.ts b/src/qa/mesh-components.ts
new file mode 100644
index 00000000..70fb087e
--- /dev/null
+++ b/src/qa/mesh-components.ts
@@ -0,0 +1,183 @@
+/**
+ * Split one drawn mesh into its connected components, in world space (#304).
+ *
+ * Both structural checks compare bounding boxes, and one mesh is one box, so two
+ * primitives merged into one geometry were never compared with each other. This is
+ * the walk that gives each its own box.
+ *
+ * Vertices join through triangles and through shared positions on the same relative
+ * grid `geometryDiagnostics` uses, because a box's faces own separate vertices. Only
+ * vertices a triangle uses count. That is topology, not attachment: primitives that
+ * overlap without sharing a vertex are two components, and the callers' box adjacency
+ * decides whether those two touch.
+ *
+ * ## What stays one box
+ *
+ * Instanced and skinned meshes carry their own bounds and have no single rest
+ * arrangement to split. LOD alternates are not parts shown with level 0. Names the
+ * connectivity rule exempts stay whole: a merged frond is one part by the helper contract,
+ * and its leaflets are meant to stand apart. A mesh over a budget stays whole and is named
+ * in `budget.unsplit`.
+ */
+
+import * as THREE from 'three';
+import { lodLevel } from './lod';
+
+/** The most welded vertices a Kiln merge helper produces, so an authored merge is walked. */
+export const MAX_SPLIT_VERTICES = 262_144;
+/** Past this a mesh is a scatter rather than parts, and comparing every pair stops paying. */
+export const MAX_MESH_COMPONENTS = 256;
+/** Both callers compare every pair of boxes, so the whole scene is bounded too. */
+export const MAX_SCENE_COMPONENTS = 4096;
+
+/**
+ * Names expected to stand apart from the body. Matched against the mesh name, which
+ * Kiln's own helpers control, so this keys off declared structure rather than shape.
+ */
+export const STANDS_APART_NAME = /(?:^|_)(?:leaf|leaves|foliage|frond|card|decal|billboard|petal)/i;
+
+export interface SplitBudget {
+ components: number;
+ /** Meshes left as one box because they went over a budget, in traversal order. */
+ unsplit: string[];
+}
+
+export const splitBudget = (): SplitBudget => ({ components: 0, unsplit: [] });
+
+/** Vertex labels by component, or the budget that stopped the walk. */
+interface GeometryComponents {
+ version: number;
+ count: number;
+ /** Component of each vertex; -1 for one no triangle uses or that is not finite. */
+ labels?: Int32Array;
+}
+const cache = new WeakMap<THREE.BufferGeometry, GeometryComponents>();
+
+function find(parent: Int32Array, start: number): number {
+ let root = start;
+ while (parent[root] !== root) root = parent[root]!;
+ for (let at = start; parent[at] !== root; ) {
+ const next = parent[at]!;
+ parent[at] = root;
+ at = next;
+ }
+ return root;
+}
+
+function union(parent: Int32Array, a: number, b: number): void {
+ const ra = find(parent, a);
+ const rb = find(parent, b);
+ // The smaller index stays the root, so labels follow vertex order.
+ if (ra < rb) parent[rb] = ra;
+ else parent[ra] = rb;
+}
+
+function walkComponents(geometry: THREE.BufferGeometry): GeometryComponents {
+ const position = geometry.getAttribute('position');
+ const version = (position as { version?: number } | undefined)?.version ?? 0;
+ const cached = cache.get(geometry);
+ if (cached && cached.version === version) return cached;
+ const store = (result: GeometryComponents) => {
+ cache.set(geometry, result);
+ return result;
+ };
+ if (position?.itemSize !== 3 || position.count > MAX_SPLIT_VERTICES)
+ return store({ version, count: 0 });
+
+ const parent = new Int32Array(position.count);
+ const used = new Uint8Array(position.count);
+ for (let i = 0; i < parent.length; i++) parent[i] = i;
+
+ const finite = new Uint8Array(position.count);
+ const bounds = new THREE.Box3();
+ const point = new THREE.Vector3();
+ for (let i = 0; i < position.count; i++) {
+ point.fromBufferAttribute(position, i);
+ if (Number.isFinite(point.x) && Number.isFinite(point.y) && Number.isFinite(point.z)) {
+ finite[i] = 1;
+ bounds.expandByPoint(point);
+ }
+ }
+ const index = geometry.getIndex();
+ const triangles = (index?.count ?? position.count) - ((index?.count ?? position.count) % 3);
+ const corner = (at: number) => (index ? index.getX(at) : at);
+ for (let at = 0; at < triangles; at += 3) {
+ const a = corner(at);
+ const b = corner(at + 1);
+ const c = corner(at + 2);
+ if (!finite[a] || !finite[b] || !finite[c]) continue;
+ used[a] = used[b] = used[c] = 1;
+ union(parent, a, b);
+ union(parent, b, c);
+ }
+
+ const size = bounds.isEmpty() ? new THREE.Vector3() : bounds.getSize(new THREE.Vector3());
+ const tolerance = Math.max(size.x, size.y, size.z) * 1e-6 || 1;
+ const seen = new Map<string, number>();
+ for (let i = 0; i < position.count; i++) {
+ if (!used[i]) continue;
+ point.fromBufferAttribute(position, i).sub(bounds.min).divideScalar(tolerance);
+ const key = `${Math.round(point.x)},${Math.round(point.y)},${Math.round(point.z)}`;
+ const first = seen.get(key);
+ if (first === undefined) seen.set(key, i);
+ else union(parent, first, i);
+ }
+
+ const labels = new Int32Array(position.count).fill(-1);
+ const byRoot = new Map<number, number>();
+ for (let i = 0; i < position.count; i++) {
+ if (!used[i]) continue;
+ const root = find(parent, i);
+ let label = byRoot.get(root);
+ if (label === undefined) {
+ label = byRoot.size;
+ byRoot.set(root, label);
+ if (byRoot.size > MAX_MESH_COMPONENTS) return store({ version, count: byRoot.size });
+ }
+ labels[i] = label;
+ }
+ return store({ version, count: byRoot.size, labels });
+}
+
+/**
+ * World-space boxes of a mesh's components, in order of each one's first vertex.
+ *
+ * Returns undefined for a mesh that is not split (see the module header), and the mesh's
+ * world matrix must be current. A mesh with one component returns one box, which callers
+ * ignore in favour of the bounds they already measure, so nothing moves for it.
+ */
+export function meshComponentBoxes(
+ mesh: THREE.Mesh,
+ budget: SplitBudget,
+): THREE.Box3[] | undefined {
+ const flagged = mesh as THREE.Mesh & { isInstancedMesh?: boolean; isSkinnedMesh?: boolean };
+ if (
+ flagged.isInstancedMesh ||
+ flagged.isSkinnedMesh ||
+ STANDS_APART_NAME.test(mesh.name) ||
+ (lodLevel(mesh) ?? 0) > 0
+ )
+ return undefined;
+ const geometry = mesh.geometry;
+ const position = geometry?.getAttribute('position');
+ if (!position) return undefined;
+ const walked = walkComponents(geometry);
+ if (
+ !walked.labels ||
+ (walked.count > 1 && budget.components + walked.count > MAX_SCENE_COMPONENTS)
+ ) {
+ budget.unsplit.push(mesh.name || '(unnamed mesh)');
+ return undefined;
+ }
+ if (walked.count < 1) return undefined;
+ if (walked.count > 1) budget.components += walked.count;
+ const boxes = Array.from({ length: walked.count }, () => new THREE.Box3());
+ const point = new THREE.Vector3();
+ for (let i = 0; i < position.count; i++) {
+ const label = walked.labels[i]!;
+ if (label < 0) continue;
+ point.fromBufferAttribute(position, i).applyMatrix4(mesh.matrixWorld);
+ boxes[label]!.expandByPoint(point);
+ }
+ return boxes;
+}
diff --git a/src/qa/part-connectivity.ts b/src/qa/part-connectivity.ts
index 932f590e..35c26187 100644
--- a/src/qa/part-connectivity.ts
+++ b/src/qa/part-connectivity.ts
@@ -15,6 +15,10 @@
* adjacent to. These are bounding-box components, not proof that every part
* should be attached or that overlapping boxes establish physical contact.
*
+ * A mesh holding several welded components enters the graph once per component
+ * (`mesh-components.ts`, #304), so a primitive merged into another is compared
+ * with the rest rather than hidden inside one box.
+ *
* ## Exemptions
*
* Some parts are legitimately separate and always will be:
@@ -28,14 +32,21 @@
*
* ## Cost
*
- * Pure AABB work: O(n²) box comparisons to build the graph, then a linear
- * flood fill. No booleans, no WASM, so unlike T4.1 this runs inside the
- * synchronous rule with no pre-pass.
+ * AABB work: O(n²) box comparisons to build the graph, then a linear flood
+ * fill, after one bounded vertex walk per geometry to split welded components.
+ * No booleans, no WASM, so unlike T4.1 this runs inside the synchronous rule
+ * with no pre-pass.
*/
import * as THREE from 'three';
import { type ExternalSupportV1, restingSupport } from '../external-support';
import { lodLevel } from './lod';
+import {
+ meshComponentBoxes,
+ type SplitBudget,
+ splitBudget,
+ STANDS_APART_NAME,
+} from './mesh-components';
import { KILN_ENGINE_QA_OWNER, type QaRule } from './registry';
import type { QaContext, QaFinding } from './types';
@@ -45,17 +56,14 @@ import type { QaContext, QaFinding } from './types';
*/
export const CONNECTIVITY_TOLERANCE = 0.02;
-/**
- * Names that are expected to stand apart from the body.
- *
- * Matched against the mesh name, which Kiln's own helpers control (`createPart`
- * prefixes `Mesh_`, `createPivot` prefixes `Joint_`), so this keys off declared
- * structure rather than inferred shape.
- */
-const EXEMPT_NAME = /(?:^|_)(?:leaf|leaves|foliage|frond|card|decal|billboard|petal)/i;
+const MAX_LISTED_PARTS = 12;
interface ConnectivityPart {
name: string;
+ /** The scene node: `name` itself, unless this is one welded component of it. */
+ node: string;
+ /** Component count of the mesh, for a welded component. */
+ weldedOf?: number;
box: THREE.Box3;
/** The requirements-declared external support this part's bottom meets, if any. */
support?: ExternalSupportV1;
@@ -64,10 +72,27 @@ interface ConnectivityPart {
export interface DisconnectedGroupV1 {
/** Parts in this component, in traversal order. */
parts: string[];
+ /** The scene node of the first part; a welded component's name is not a node. */
+ node: string;
/** Shortest distance from this component to the main one, in meters. */
gap: number;
/** Present when every part rests on a requirements-declared external support. */
externalSupport?: { planeY: number; bottomY: number; tolerance: number };
+ /** Present when every part is a welded component of one mesh; these collapse to one group. */
+ welded?: {
+ mesh: string;
+ /** How many components the mesh holds; `parts.length` of them are detached. */
+ components: number;
+ detached: ComponentLocationV1;
+ nearest: ComponentLocationV1;
+ };
+}
+
+/** Where a part sits, so a component inside one node can be found without selecting it. */
+export interface ComponentLocationV1 {
+ part: string;
+ min: [number, number, number];
+ max: [number, number, number];
}
export interface PartConnectivityReportV1 {
@@ -77,6 +102,8 @@ export interface PartConnectivityReportV1 {
exempt: string[];
/** Visible meshes on LOD levels above 0: alternates of the analyzed parts, left out. */
lodExcluded: number;
+ /** Meshes over a split budget, measured as one box; welded parts in them stay unseen. */
+ unsplit: string[];
groups: DisconnectedGroupV1[];
}
@@ -88,6 +115,7 @@ export interface PartConnectivityReportV1 {
function collectParts(
root: THREE.Object3D,
exempt: string[],
+ budget: SplitBudget,
supports?: readonly ExternalSupportV1[],
): { parts: ConnectivityPart[]; lodExcluded: number } {
const parts: ConnectivityPart[] = [];
@@ -101,14 +129,28 @@ function collectParts(
lodExcluded++;
return;
}
- if (EXEMPT_NAME.test(name)) {
+ if (STANDS_APART_NAME.test(name)) {
exempt.push(name);
return;
}
const box = new THREE.Box3().setFromObject(mesh);
if (box.isEmpty()) return;
+ const components = meshComponentBoxes(mesh, budget);
+ if (components && components.length > 1) {
+ for (const [index, piece] of components.entries()) {
+ const support = restingSupport(mesh, piece.min.y, supports);
+ parts.push({
+ name: `${name} (welded component ${index + 1} of ${components.length})`,
+ node: name,
+ weldedOf: components.length,
+ box: piece,
+ ...(support ? { support } : {}),
+ });
+ }
+ return;
+ }
const support = restingSupport(mesh, box.min.y, supports);
- parts.push({ name, box, ...(support ? { support } : {}) });
+ parts.push({ name, node: name, box, ...(support ? { support } : {}) });
});
return { parts, lodExcluded };
}
@@ -121,6 +163,42 @@ function boxGap(a: THREE.Box3, b: THREE.Box3): number {
return Math.hypot(dx, dy, dz);
}
+const rounded = (v: THREE.Vector3): [number, number, number] => [
+ Math.round(v.x * 1e4) / 1e4,
+ Math.round(v.y * 1e4) / 1e4,
+ Math.round(v.z * 1e4) / 1e4,
+];
+const locationOf = (part: ConnectivityPart): ComponentLocationV1 => ({
+ part: part.name,
+ min: rounded(part.box.min),
+ max: rounded(part.box.max),
+});
+
+/**
+ * One mesh with forty loose components is one thing to look at, not forty findings. Its
+ * groups become one, keeping the location of the component nearest the body.
+ */
+function collapseWeldedGroups(groups: DisconnectedGroupV1[]): DisconnectedGroupV1[] {
+ const byMesh = new Map<string, DisconnectedGroupV1>();
+ const out: DisconnectedGroupV1[] = [];
+ for (const group of groups) {
+ const mesh = group.welded?.mesh;
+ const first = mesh === undefined ? undefined : byMesh.get(mesh);
+ if (mesh === undefined) out.push(group);
+ else if (!first) {
+ byMesh.set(mesh, group);
+ out.push(group);
+ } else {
+ first.parts.push(...group.parts);
+ if (group.gap < first.gap) {
+ first.gap = group.gap;
+ first.welded = group.welded;
+ }
+ }
+ }
+ return out;
+}
+
/**
* Group parts into connected components by box adjacency.
*
@@ -132,12 +210,14 @@ export function analyzePartConnectivity(
supports?: readonly ExternalSupportV1[],
): PartConnectivityReportV1 {
const exempt: string[] = [];
- const { parts, lodExcluded } = collectParts(root, exempt, supports);
+ const budget = splitBudget();
+ const { parts, lodExcluded } = collectParts(root, exempt, budget, supports);
const report: PartConnectivityReportV1 = {
partsAnalyzed: parts.length,
mainComponentSize: parts.length,
exempt,
lodExcluded,
+ unsplit: budget.unsplit,
groups: [],
};
if (parts.length < 2) return report;
@@ -192,16 +272,26 @@ export function analyzePartConnectivity(
for (const [index, members] of components.entries()) {
if (index === mainIndex) continue;
let gap = Number.POSITIVE_INFINITY;
+ let nearestMember = members[0]!;
+ let nearestMain = main[0]!;
for (const m of members) {
for (const b of main) {
- gap = Math.min(gap, boxGap(parts[m]!.box, parts[b]!.box));
+ const between = boxGap(parts[m]!.box, parts[b]!.box);
+ if (between < gap) {
+ gap = between;
+ nearestMember = m;
+ nearestMain = b;
+ }
}
}
+ const node = parts[members[0]!]!.node;
+ const welded = members.every((m) => parts[m]!.weldedOf && parts[m]!.node === node);
// The lowest part names the plane the group rests on when all of it is declared.
const lowest = members.reduce((a, b) => (parts[b]!.box.min.y < parts[a]!.box.min.y ? b : a));
const support = parts[lowest]!.support;
report.groups.push({
parts: members.map((m) => parts[m]!.name),
+ node,
gap: Math.round(gap * 1e6) / 1e6,
...(support && members.every((m) => parts[m]!.support)
? {
@@ -211,9 +301,19 @@ export function analyzePartConnectivity(
tolerance: support.tolerance ?? CONNECTIVITY_TOLERANCE,
},
}
- : {}),
+ : welded
+ ? {
+ welded: {
+ mesh: node,
+ components: parts[members[0]!]!.weldedOf!,
+ detached: locationOf(parts[nearestMember]!),
+ nearest: locationOf(parts[nearestMain]!),
+ },
+ }
+ : {}),
});
}
+ report.groups = collapseWeldedGroups(report.groups);
// Largest detached group first — the biggest missing join is the one to fix.
report.groups.sort((a, b) => b.parts.length - a.parts.length || a.gap - b.gap);
@@ -239,8 +339,17 @@ export function inspectPartConnectivity(
: report.lodExcluded > 1
? ` ${report.lodExcluded} parts on LOD levels above 0 were not analyzed.`
: '';
+ const unsplitNote = report.unsplit.length
+ ? ` Over the split budget, so measured as one box: ${report.unsplit
+ .slice(0, 5)
+ .map((mesh) => JSON.stringify(mesh))
+ .join(', ')}${report.unsplit.length > 5 ? ` and ${report.unsplit.length - 5} more` : ''}.`
+ : '';
return report.groups.map((group) => {
- const listed = group.parts.map((p) => JSON.stringify(p)).join(', ');
+ // Splitting welded meshes makes groups of a hundred parts ordinary; the count says the rest.
+ const named = group.parts.slice(0, MAX_LISTED_PARTS).map((p) => JSON.stringify(p));
+ const unnamed = group.parts.length - named.length;
+ const listed = `${named.join(', ')}${unnamed > 0 ? `, +${unnamed} more` : ''}`;
const subject =
group.parts.length === 1
? `Part ${listed} is`
@@ -253,7 +362,7 @@ export function inspectPartConnectivity(
dimension: 'visualQuality' as const,
profile: 'geometry.partConnectivity',
message: `${subject} separate from the largest component and rests on the support declared in requirements.externalSupport at Y=${declared.planeY.toFixed(3)} m (bottom at Y=${declared.bottomY.toFixed(3)} m). Information only: the support is composed outside this asset.${lodNote}`,
- affected: { node: group.parts[0]! },
+ affected: { node: group.node },
measurement: {
name: 'bottomToSupportPlane',
actual: declared.bottomY,
@@ -263,13 +372,38 @@ export function inspectPartConnectivity(
repairText:
'No change is needed for a declared support. Remove the part from requirements.externalSupport if it should attach within this asset.',
};
+ if (group.welded) {
+ const { mesh, components, detached, nearest } = group.welded;
+ const span = ({ min, max }: ComponentLocationV1) =>
+ `[${min.join(', ')}] to [${max.join(', ')}]`;
+ return {
+ code: 'GEO_PART_CONNECTIVITY',
+ disposition: 'observe' as const,
+ dimension: 'visualQuality' as const,
+ profile: 'geometry.partConnectivity',
+ message: `Mesh ${JSON.stringify(mesh)} is one drawn part, but ${group.parts.length} of its ${components} welded components ${group.parts.length === 1 ? 'is' : 'are'} separate from the largest component in the rest-pose bounding boxes of visible parts; the nearest box gap is ${group.gap.toFixed(3)} m. Nearest detached: ${span(detached)}. It is nearest to ${JSON.stringify(nearest.part)} at ${span(nearest)}. This may be intentional. Box adjacency is not physical attachment evidence: a gap under ${CONNECTIVITY_TOLERANCE} m reads as contact.${lodNote}${unsplitNote}`,
+ affected: { node: mesh },
+ measurement: {
+ name: 'gapToMainComponent',
+ actual: group.gap,
+ expected: CONNECTIVITY_TOLERANCE,
+ breakdown: {
+ weldedComponents: components,
+ detachedComponents: group.parts.length,
+ ...(report.lodExcluded ? { lodExcludedParts: report.lodExcluded } : {}),
+ },
+ },
+ repairText:
+ 'Check whether the separation is intentional. One mesh moves and hides as one, so a component meant to attach needs its gap closed in the merged geometry; one meant to stand apart reads better as its own part.',
+ };
+ }
return {
code: 'GEO_PART_CONNECTIVITY',
disposition: 'observe' as const,
dimension: 'visualQuality' as const,
profile: 'geometry.partConnectivity',
- message: `${subject} separate from the largest component in the rest-pose bounding boxes of visible parts; the nearest box gap is ${group.gap.toFixed(3)} m. This may be intentional. Box adjacency is not physical attachment evidence: a gap under ${CONNECTIVITY_TOLERANCE} m reads as contact, and primitives welded into one mesh form one box.${lodNote}`,
- affected: { node: group.parts[0]! },
+ message: `${subject} separate from the largest component in the rest-pose bounding boxes of visible parts; the nearest box gap is ${group.gap.toFixed(3)} m. This may be intentional. Box adjacency is not physical attachment evidence: a gap under ${CONNECTIVITY_TOLERANCE} m reads as contact.${lodNote}${unsplitNote}`,
+ affected: { node: group.node },
measurement: {
name: 'gapToMainComponent',
actual: group.gap,
diff --git a/src/qa/structural-coverage.test.ts b/src/qa/structural-coverage.test.ts
index f0e4465e..8c80346b 100644
--- a/src/qa/structural-coverage.test.ts
+++ b/src/qa/structural-coverage.test.ts
@@ -6,11 +6,11 @@
* audit caught both. The reported suspicion was that per-material welding hid
* the detached primitive inside a mesh the checks treat as one part.
*
- * Welding does hide a primitive, but it is not what hid these two. Both checks
+ * Welding did hide a primitive, but it is not what hid these two. Both checks
* read bounding boxes with a 2 cm adjacency tolerance, so a sub-centimetre gap
- * reads as contact whether or not the parts are welded. These tests pin both
- * limits with the reported measurements, so neither can drift silently and
- * neither gets mistaken for the other again.
+ * reads as contact whether or not the parts are welded. That limit still stands
+ * and these tests pin it with the reported measurements. The welding limit is gone:
+ * #304 compares a mesh's components with each other (`welded-components.test.ts`).
*/
import { expect, test } from 'bun:test';
@@ -85,23 +85,27 @@ test('the warning fires once the gap clears the tolerance it states', () => {
});
// -----------------------------------------------------------------------------
-// Limit 2 — mesh granularity, real but not the cause here
+// The welded case: closed by #304, with the same floor
// -----------------------------------------------------------------------------
-test('a primitive welded into another mesh is invisible at any separation', () => {
- // 20 cm is ten times the tolerance and still silent: one mesh is one box.
- for (const gap of [0.002, 0.05, 0.2]) {
+test('a primitive welded into another mesh is seen once it clears the same tolerance', () => {
+ // The gaps #289 reported still read as contact, welded or not.
+ for (const gap of [0.002, 0.00085]) {
expect(floatingWarnings(weldedSightPost(gap))).toEqual([]);
expect(analyzePartConnectivity(weldedSightPost(gap)).groups).toEqual([]);
}
- // Unwelded, the same 20 cm separation is reported.
+ // 5 cm and 20 cm were silent before the split; both now report, as the unwelded parts do.
+ for (const gap of [0.05, 0.2]) {
+ expect(floatingWarnings(weldedSightPost(gap))).toHaveLength(1);
+ expect(analyzePartConnectivity(weldedSightPost(gap)).groups).toHaveLength(1);
+ }
expect(floatingWarnings(sightPost(0.2))).toHaveLength(1);
});
-test('the connectivity report counts welded primitives as one analyzed part', () => {
+test('the connectivity report counts each welded component as an analyzed part', () => {
const report = analyzePartConnectivity(weldedSightPost(0.2));
- expect(report.partsAnalyzed).toBe(2);
- expect(report.mainComponentSize).toBe(2);
+ expect(report.partsAnalyzed).toBe(3);
+ expect(report.groups[0]!.welded?.mesh).toBe('Mesh_receiver');
});
// -----------------------------------------------------------------------------
@@ -111,5 +115,6 @@ test('the connectivity report counts welded primitives as one analyzed part', ()
test('the floating-parts warning states what it does not cover', () => {
const warning = floatingWarnings(sightPost(0.05))[0]!;
expect(warning).toContain('2cm');
- expect(warning).toMatch(/welded|within a mesh|one mesh/i);
+ expect(warning).toContain('Welded components');
+ expect(warning).toContain('A smaller gap reads as contact');
});
diff --git a/src/qa/welded-components.test.ts b/src/qa/welded-components.test.ts
new file mode 100644
index 00000000..2bf3054d
--- /dev/null
+++ b/src/qa/welded-components.test.ts
@@ -0,0 +1,222 @@
+/**
+ * Primitives merged into one mesh are compared with each other (#304).
+ *
+ * One mesh used to be one box, so a part welded into another mesh was invisible
+ * at any distance. These pin the split: what it reports, what it must keep silent,
+ * and that the 2 cm floor #289 closed on did not move.
+ */
+
+import { describe, expect, test } from 'bun:test';
+import * as THREE from 'three';
+import { inspectSceneStructure } from '../render';
+import { analyzePartConnectivity, inspectPartConnectivity } from './part-connectivity';
+import {
+ MAX_MESH_COMPONENTS,
+ MAX_SPLIT_VERTICES,
+ meshComponentBoxes,
+ splitBudget,
+} from './mesh-components';
+
+function merged(...parts: THREE.BufferGeometry[]): THREE.BufferGeometry {
+ const flat = parts.map((part) => part.toNonIndexed());
+ const out = new THREE.BufferGeometry();
+ const count = flat.reduce((sum, part) => sum + part.getAttribute('position').count, 0);
+ const positions = new Float32Array(count * 3);
+ let offset = 0;
+ for (const part of flat) {
+ positions.set(part.getAttribute('position').array as Float32Array, offset);
+ offset += part.getAttribute('position').array.length;
+ }
+ out.setAttribute('position', new THREE.BufferAttribute(positions, 3));
+ return out;
+}
+const box = (size: number, at: [number, number, number] = [0, 0, 0]) =>
+ new THREE.BoxGeometry(size, size, size).translate(...at);
+function mesh(geometry: THREE.BufferGeometry, name = 'Mesh_receiver') {
+ const out = new THREE.Mesh(geometry);
+ out.name = name;
+ return out;
+}
+function sceneOf(...meshes: THREE.Object3D[]) {
+ const root = new THREE.Object3D();
+ root.name = 'Asset';
+ root.add(...meshes);
+ return root;
+}
+const twoAt = (gap: number) => merged(box(0.1), box(0.1, [0.1 + gap, 0, 0]));
+const floating = (root: THREE.Object3D) =>
+ inspectSceneStructure(root).filter((warning) => warning.startsWith('Floating parts'));
+
+describe('a welded mesh is split into its components', () => {
+ test('two components 200 mm apart are reported by both checks, each located', () => {
+ const root = sceneOf(mesh(twoAt(0.2)));
+ const warnings = floating(root);
+ expect(warnings).toHaveLength(1);
+ expect(warnings[0]).toContain('Mesh_receiver');
+ expect(warnings[0]).toContain('welded');
+
+ const report = analyzePartConnectivity(root);
+ expect(report.partsAnalyzed).toBe(2);
+ expect(report.groups).toHaveLength(1);
+ expect(report.groups[0]!.gap).toBeCloseTo(0.2, 5);
+ const findings = inspectPartConnectivity(root);
+ expect(findings).toHaveLength(1);
+ expect(findings[0]!.code).toBe('GEO_PART_CONNECTIVITY');
+ // A real node, so a tool can resolve it; the component is named in the text.
+ expect(findings[0]!.affected).toEqual({ node: 'Mesh_receiver' });
+ // Both components located: the detached one and what it is detached from.
+ expect(findings[0]!.message).toContain('[0.25');
+ expect(findings[0]!.message).toContain('[-0.05');
+ });
+
+ test('a single-mesh scene is reached: no sibling mesh is needed', () => {
+ expect(floating(sceneOf(mesh(twoAt(0.2))))).toHaveLength(1);
+ expect(analyzePartConnectivity(sceneOf(mesh(twoAt(0.2)))).groups).toHaveLength(1);
+ });
+
+ test('primitives that share vertices are one component', () => {
+ // Each face of a non-indexed box owns its vertices; only their positions join them.
+ expect(meshComponentBoxes(mesh(box(1).toNonIndexed()), splitBudget())).toHaveLength(1);
+ expect(meshComponentBoxes(mesh(box(1)), splitBudget())).toHaveLength(1);
+ const sharedCorner = merged(box(1), box(1, [1, 1, 1]));
+ expect(meshComponentBoxes(mesh(sharedCorner), splitBudget())).toHaveLength(1);
+ expect(floating(sceneOf(mesh(sharedCorner)))).toEqual([]);
+ expect(analyzePartConnectivity(sceneOf(mesh(sharedCorner))).groups).toEqual([]);
+ });
+
+ test('separate components that overlap or touch stay silent', () => {
+ const overlapping = merged(box(1), box(1, [0.5, 0, 0]));
+ expect(meshComponentBoxes(mesh(overlapping), splitBudget())).toHaveLength(2);
+ expect(floating(sceneOf(mesh(overlapping)))).toEqual([]);
+ expect(analyzePartConnectivity(sceneOf(mesh(overlapping))).groups).toEqual([]);
+ });
+
+ test('the 2 cm floor is unchanged inside a welded mesh', () => {
+ for (const gap of [0.002, 0.00085, 0.019]) {
+ expect(floating(sceneOf(mesh(twoAt(gap))))).toEqual([]);
+ expect(analyzePartConnectivity(sceneOf(mesh(twoAt(gap)))).groups).toEqual([]);
+ }
+ expect(floating(sceneOf(mesh(twoAt(0.025))))).toHaveLength(1);
+ expect(analyzePartConnectivity(sceneOf(mesh(twoAt(0.025)))).groups).toHaveLength(1);
+ });
+
+ test('distances are in world space', () => {
+ const scaled = mesh(twoAt(0.005));
+ scaled.scale.setScalar(10);
+ expect(floating(sceneOf(scaled))).toHaveLength(1);
+ expect(analyzePartConnectivity(sceneOf(scaled)).groups[0]!.gap).toBeCloseTo(0.05, 5);
+
+ // Each box comes from its own vertices, through the rotation.
+ const rotated = mesh(twoAt(0.2));
+ rotated.rotation.set(0, Math.PI / 2, 0);
+ rotated.updateWorldMatrix(true, false);
+ const boxes = meshComponentBoxes(rotated, splitBudget());
+ expect(boxes).toHaveLength(2);
+ expect(boxes![1]!.min.z).toBeCloseTo(-0.35, 5);
+ });
+
+ test('one shared geometry is measured through each mesh that draws it', () => {
+ const shared = twoAt(0.2);
+ const near = mesh(shared, 'Mesh_a');
+ const far = mesh(shared, 'Mesh_b');
+ far.position.set(0, 10, 0);
+ const root = sceneOf(near, far);
+ root.updateWorldMatrix(true, true);
+ const [a, b] = [near, far].map((each) => meshComponentBoxes(each, splitBudget())!);
+ expect(a![0]!.max.y).toBeCloseTo(0.05, 5);
+ expect(b![0]!.max.y).toBeCloseTo(10.05, 5);
+ });
+
+ test('a vertex no triangle uses, or a non-finite one, makes no component', () => {
+ const geometry = box(1);
+ const position = geometry.getAttribute('position') as THREE.BufferAttribute;
+ const grown = new Float32Array(position.count * 3 + 6);
+ grown.set(position.array as Float32Array);
+ grown.set([100, 100, 100, Number.NaN, 0, 0], position.count * 3);
+ geometry.setAttribute('position', new THREE.BufferAttribute(grown, 3));
+ expect(meshComponentBoxes(mesh(geometry), splitBudget())).toHaveLength(1);
+ });
+
+ test('many detached components of one mesh are one finding and one warning entry', () => {
+ const scatter = merged(...Array.from({ length: 40 }, (_, i) => box(0.1, [i * 0.5, 0, 0])));
+ const root = sceneOf(mesh(scatter));
+ const findings = inspectPartConnectivity(root);
+ expect(findings).toHaveLength(1);
+ expect(findings[0]!.message).toContain('39 of its 40');
+ expect(findings[0]!.message.length).toBeLessThan(1000);
+ const [warning] = floating(root);
+ expect(warning!.match(/Mesh_receiver/g)!.length).toBeLessThan(4);
+ });
+
+ test('a group mixing two meshes names a real node and stays bounded', () => {
+ // Forty components of two meshes that touch each other, clear of the larger body.
+ const cluster = (x: number) =>
+ merged(...Array.from({ length: 40 }, (_, i) => box(0.1, [x + i * 0.095, 50, 0])));
+ const body = merged(...Array.from({ length: 100 }, (_, i) => box(1, [i * 0.9, 0, 0])));
+ const root = sceneOf(
+ mesh(body, 'Mesh_body'),
+ mesh(cluster(0), 'Mesh_a'),
+ mesh(cluster(3.75), 'Mesh_b'),
+ );
+ const findings = inspectPartConnectivity(root);
+ const group = findings.find((finding) => finding.affected?.node === 'Mesh_a');
+ expect(findings.map((finding) => finding.affected?.node)).not.toContainEqual(
+ expect.stringContaining('welded component'),
+ );
+ expect(group).toBeDefined();
+ expect(group!.message.length).toBeLessThan(1200);
+ expect(group!.message).toContain('more');
+ });
+
+ test('the same scene gives the same report', () => {
+ const report = () => analyzePartConnectivity(sceneOf(mesh(twoAt(0.2)), mesh(twoAt(0.3), 'B')));
+ expect(report()).toEqual(report());
+ });
+});
+
+describe('what is deliberately not split', () => {
+ test('foliage and decal names keep their exemption', () => {
+ const root = sceneOf(mesh(twoAt(0.2), 'Mesh_leaf_cluster'));
+ expect(floating(root)).toEqual([]);
+ expect(analyzePartConnectivity(root).groups).toEqual([]);
+ });
+
+ test('instanced and skinned meshes stay one part', () => {
+ const instanced = new THREE.InstancedMesh(twoAt(0.2), undefined, 1);
+ instanced.setMatrixAt(0, new THREE.Matrix4());
+ instanced.name = 'Mesh_instanced';
+ expect(meshComponentBoxes(instanced, splitBudget())).toBeUndefined();
+ const skinned = new THREE.SkinnedMesh(twoAt(0.2));
+ expect(meshComponentBoxes(skinned, splitBudget())).toBeUndefined();
+ });
+
+ test('an LOD alternate is not split', () => {
+ const alternate = mesh(twoAt(0.2), 'Mesh_body_LOD1');
+ const body = mesh(box(1), 'Mesh_body');
+ const report = analyzePartConnectivity(sceneOf(body, alternate));
+ expect(report.groups.filter((group) => group.parts.join().includes('welded'))).toEqual([]);
+ });
+
+ test('over the component budget a mesh stays one box and the report says so', () => {
+ const scatter = merged(
+ ...Array.from({ length: MAX_MESH_COMPONENTS + 1 }, (_, i) => box(0.1, [i, 0, 0])),
+ );
+ const root = sceneOf(mesh(scatter), mesh(box(1, [0, -5, 0]), 'Mesh_base'));
+ const report = analyzePartConnectivity(root);
+ expect(report.unsplit).toEqual(['Mesh_receiver']);
+ expect(report.partsAnalyzed).toBe(2);
+ const findings = inspectPartConnectivity(root);
+ expect(findings.map((finding) => finding.message).join()).toContain('Mesh_receiver');
+ });
+
+ test('over the vertex budget a mesh stays one box without walking it', () => {
+ const big = new THREE.BufferGeometry();
+ big.setAttribute(
+ 'position',
+ new THREE.BufferAttribute(new Float32Array((MAX_SPLIT_VERTICES + 1) * 3), 3),
+ );
+ const budget = splitBudget();
+ expect(meshComponentBoxes(mesh(big), budget)).toBeUndefined();
+ expect(budget.unsplit).toEqual(['Mesh_receiver']);
+ });
+});
diff --git a/src/render.ts b/src/render.ts
index f6695bf0..9a667478 100644
--- a/src/render.ts
+++ b/src/render.ts
@@ -13,6 +13,7 @@ import {
} from './qa/requirements-run';
import type { AssetRequirementsQaReportV2 } from './qa/requirements-report';
import { createRequirementsQaReport } from './qa/requirements-report';
+import { meshComponentBoxes, splitBudget } from './qa/mesh-components';
import { inspectSkinIntegrity } from './qa/skin-integrity';
import { AuthoringDiagnosticError, rethrowAuthoringError } from './evaluator/authoring-diagnostic';
/**
@@ -2797,6 +2798,37 @@ interface MeshStats {
box: THREE.Box3;
}
+interface FloatingPiece extends MeshStats {
+ welded?: { mesh: string; index: number; of: number };
+}
+
+const spanText = (box: THREE.Box3): string =>
+ `[${box.min
+ .toArray()
+ .map((v) => v.toFixed(3))
+ .join(', ')}] to [${box.max
+ .toArray()
+ .map((v) => v.toFixed(3))
+ .join(', ')}]`;
+
+/** One mesh with forty loose components is one entry naming the count and its first one. */
+function collapseWeldedFloaters(
+ floaters: { name: string; fix: string; welded?: string }[],
+ pieces: readonly FloatingPiece[],
+): void {
+ for (let i = 0; i < floaters.length; i++) {
+ const mesh = floaters[i]!.welded;
+ if (!mesh) continue;
+ const detached = floaters.filter((floater) => floater.welded === mesh).length;
+ if (detached < 2) continue;
+ const of = pieces.find((piece) => piece.welded?.mesh === mesh)?.welded?.of ?? detached;
+ floaters[i]!.name = `${mesh} (${detached} of its ${of} welded components)`;
+ for (let j = floaters.length - 1; j > i; j--)
+ if (floaters[j]!.welded === mesh) floaters.splice(j, 1);
+ floaters[i]!.welded = undefined;
+ }
+}
+
function collectMeshStats(root: THREE.Object3D): MeshStats[] {
root.updateMatrixWorld(true);
const out: MeshStats[] = [];
@@ -2938,16 +2970,27 @@ export function inspectSceneStructure(
}
}
- if (meshes.length > 1) {
- const floaters: { name: string; fix: string }[] = [];
+ // A mesh holding several welded components is compared once per component (#304).
+ const budget = splitBudget();
+ const pieces = meshes.flatMap((mesh): FloatingPiece[] => {
+ const boxes = meshComponentBoxes(mesh.object as THREE.Mesh, budget);
+ if (!boxes || boxes.length < 2) return [mesh];
+ return boxes.map((box, index) => ({
+ ...mesh,
+ box,
+ welded: { mesh: mesh.name, index: index + 1, of: boxes.length },
+ }));
+ });
+ if (pieces.length > 1) {
+ const floaters: { name: string; fix: string; welded?: string }[] = [];
const supported: string[] = [];
- for (let i = 0; i < meshes.length; i++) {
- const a = meshes[i]!;
+ for (let i = 0; i < pieces.length; i++) {
+ const a = pieces[i]!;
const ax = a.box.clone().expandByScalar(FLOATING_EXPAND);
let overlapsAny = false;
- for (let j = 0; j < meshes.length; j++) {
+ for (let j = 0; j < pieces.length; j++) {
if (i === j) continue;
- const b = meshes[j]!;
+ const b = pieces[j]!;
if (ax.intersectsBox(b.box)) {
overlapsAny = true;
break;
@@ -2964,25 +3007,34 @@ export function inspectSceneStructure(
// Actionable fix: the minimal shift to the NEAREST sibling, plus the
// snapTo call that applies it.
- let nearest: MeshStats | undefined;
+ let nearest: FloatingPiece | undefined;
let nearestGap: THREE.Vector3 | undefined;
- for (let j = 0; j < meshes.length; j++) {
+ for (let j = 0; j < pieces.length; j++) {
if (i === j) continue;
- const gap = minimalGapVector(a.box, meshes[j]!.box);
+ const gap = minimalGapVector(a.box, pieces[j]!.box);
if (!nearestGap || gap.length() < nearestGap.length()) {
- nearest = meshes[j]!;
+ nearest = pieces[j]!;
nearestGap = gap;
}
}
- const fix =
- nearest && nearestGap
+ const fix = a.welded
+ ? ` Fix: one mesh moves and hides as one, so close the gap in the merged geometry, or author the component as its own part. It spans ${spanText(a.box)}.`
+ : nearest && nearestGap
? ` Fix: shift "${a.name}" by [${nearestGap.x.toFixed(3)}, ${nearestGap.y.toFixed(3)}, ${nearestGap.z.toFixed(3)}] toward "${nearest.name}", or call snapTo(part, hostPart) to do it automatically.`
: '';
const mismatch = declared
? ` It is named in a declared external support at Y=${declared.planeY.toFixed(3)}, but its bottom is at Y=${a.box.min.y.toFixed(3)}.`
: '';
- floaters.push({ name: a.name, fix: fix + mismatch });
+ const name = a.welded
+ ? `${a.welded.mesh} (welded component ${a.welded.index} of ${a.welded.of})`
+ : a.name;
+ floaters.push({
+ name,
+ fix: fix + mismatch,
+ ...(a.welded ? { welded: a.welded.mesh } : {}),
+ });
}
+ collapseWeldedFloaters(floaters, pieces);
if (floaters.length > 0) {
// The per-part fix text is 170 characters; a scattered asset repeated it
// for every part. The first few floaters keep their fix, the rest are
@@ -2999,7 +3051,7 @@ export function inspectSceneStructure(
);
}
warnings.push(
- `Floating parts (no mesh overlap with any sibling, 2cm tol): ${entries.join(' | ')} — Coverage: drawn meshes only, at 2cm. A smaller gap reads as contact and a primitive welded into another mesh is never seen, so a silent pass is not a fit audit; measure contacts in the destination.`,
+ `Floating parts (no mesh overlap with any sibling, 2cm tol): ${entries.join(' | ')} — Coverage: drawn meshes only, at 2cm. Welded components inside one mesh are compared the same way, box to box. A smaller gap reads as contact, so a silent pass is not a fit audit; measure contacts in the destination.${budget.unsplit.length ? ` Over the split budget, so measured as one box: ${budget.unsplit.slice(0, FLOATER_NAMES_SHOWN).join(', ')}.` : ''}`,
);
}
if (supported.length > 0) {