Skip to content

Commit d78f4d9

Browse files
committed
Refactorings, tidy ups
1 parent d439927 commit d78f4d9

227 files changed

Lines changed: 16172 additions & 1394 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/sdk/src/convert/xeoconvert/xeoconvert_core.cjs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175585,7 +175585,7 @@ var FixRegistry = class {
175585175585
};
175586175586
_byCode = new WeakMap();
175587175587

175588-
// src/demo/synthesizeGeometryAttribs.ts
175588+
// src/studio/synthesizeGeometryAttribs.ts
175589175589
function generateSmoothNormals(positionsCompressed, indices, aabb) {
175590175590
const vertCount = positionsCompressed.length / 3 | 0;
175591175591
const triCount = indices.length / 3 | 0;
@@ -176459,7 +176459,7 @@ function aabbDiagonal(aabb) {
176459176459
return Math.sqrt(dx * dx + dy * dy + dz * dz);
176460176460
}
176461176461

176462-
// src/demo/splitSceneGeometry.ts
176462+
// src/studio/splitSceneGeometry.ts
176463176463
function splitSceneGeometry(params) {
176464176464
var _a2, _b;
176465176465
const src = params.sceneGeometry;

packages/sdk/src/model/data/DataTraversalQuery.ts

Lines changed: 0 additions & 96 deletions
This file was deleted.

packages/sdk/src/model/index.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
// model/ — auto-generated bucket index.
1+
/**
2+
* The **scene graph** (3D geometry, materials, objects) and the **data graph** (semantic entities, relationships,
3+
* property sets). Both are renderer-agnostic and run identically in the browser and Node. Streaming and procedural
4+
* authoring live here too.
5+
*
6+
* @submodule model
7+
*/
28
export * as data from "./data";
39
export * as procgen from "./procgen";
410
export * as scene from "./scene";

packages/sdk/src/model/procgen/paintEnvironments/paintStudio.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,6 @@ export function paintStudio(
8282
if (drawSun) {
8383
const sx = width * 0.18, sy = height * 0.20;
8484
const sRadius = Math.min(width, height) * 0.04;
85-
const glowRadius = sRadius * 4.0;
86-
const glow = ctx.createRadialGradient(sx, sy, 0, sx, sy, glowRadius);
87-
glow.addColorStop(0, "rgba(255,245,210,0.85)");
88-
glow.addColorStop(0.4, "rgba(255,235,180,0.30)");
89-
glow.addColorStop(1, "rgba(255,235,180,0.00)");
90-
ctx.fillStyle = glow;
91-
ctx.beginPath(); ctx.arc(sx, sy, glowRadius, 0, Math.PI * 2); ctx.fill();
9285
ctx.fillStyle = "rgb(255,250,235)";
9386
ctx.beginPath(); ctx.arc(sx, sy, sRadius, 0, Math.PI * 2); ctx.fill();
9487
}
@@ -105,12 +98,6 @@ export function paintStudio(
10598
for (const sb of softboxes) {
10699
const x = sb.u * width, y = sb.v * height;
107100
const w = sb.w * width, h = sb.h * height;
108-
const halo = ctx.createRadialGradient(x + w * 0.5, y + h * 0.5, 0,
109-
x + w * 0.5, y + h * 0.5, w * 0.85);
110-
halo.addColorStop(0, sb.tint.replace("rgb", "rgba").replace(")", ",0.55)"));
111-
halo.addColorStop(1, sb.tint.replace("rgb", "rgba").replace(")", ",0.00)"));
112-
ctx.fillStyle = halo;
113-
ctx.fillRect(x - w * 0.4, y - h * 1.5, w * 1.8, h * 4.0);
114101
ctx.fillStyle = sb.tint;
115102
ctx.fillRect(x, y, w, h);
116103
}

packages/sdk/src/model/procgen/paintMaterials/paintWoodPlank.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export interface PaintWoodPlankOptions {
5555
*
5656
* Orientation on rendered surfaces depends on how the surface's UVs
5757
* were generated. The planar projection used by
58-
* {@link demo!attachSceneModelMaterials | attachSceneModelMaterials}
58+
* {@link studio!attachSceneModelMaterials | attachSceneModelMaterials}
5959
* aligns V with world vertical on wall-like geometries, so this
6060
* painter renders vertical planks on every wall. Non-metal.
6161
*/

packages/sdk/src/model/scene/SceneTransform.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -579,8 +579,12 @@ export class SceneTransform {
579579
this._parentTransform._updateGlobal(force);
580580
mulMat4(this._parentTransform._worldMatrix, this._localMatrix, this._worldMatrix);
581581
} else {
582-
// @ts-ignore
583-
this._worldMatrix.set(this._localMatrix);
582+
// Root transform — apply the SceneModel's coord-system pre-multiply,
583+
// same as the `get worldMatrix()` getter. Previously this branch
584+
// copied the local matrix directly, which produced a wrong world
585+
// matrix for any reparenting/preserveWorld path on a model whose
586+
// basis differed from the scene's.
587+
mulMat4(this.model.coordinateSystemMatrix, this._localMatrix, this._worldMatrix);
584588
}
585589
this._worldMatrixDirty = false;
586590

packages/sdk/src/model/scene/compressGeometryParams.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,22 @@ export function compressGeometryParams(geometryParams: SceneGeometryParams): Sce
4848
origin: rtcNeeded ? rtcCenter : null
4949
};
5050
} else {
51-
const edgeIndices = (geometryParams.primitive === SolidPrimitive
51+
// For triangle-family geometries, auto-build feature edges. The
52+
// builder returns an EMPTY typed array when every interior edge
53+
// is too smooth to count (typical of a single fully-coplanar
54+
// tessellation — e.g. an earcut'd 2D polygon at z=0, which is
55+
// common in drawing/SVG/PDF imports) AND every triangle's edge
56+
// is shared with a neighbour. Collapse that to `null` so
57+
// downstream consumers (specifically the WebGLRenderer's edge
58+
// portion allocator, which rejects size=0) see "no edges" as a
59+
// first-class state rather than an empty buffer to upload.
60+
let edgeIndices: ReturnType<typeof buildEdgeIndices> | null = null;
61+
if ((geometryParams.primitive === SolidPrimitive
5262
|| geometryParams.primitive === SurfacePrimitive
53-
|| geometryParams.primitive === TrianglesPrimitive) && geometryParams.indices
54-
? buildEdgeIndices(positionsCompressed, geometryParams.indices, aabb, 10)
55-
: null;
63+
|| geometryParams.primitive === TrianglesPrimitive) && geometryParams.indices) {
64+
const built = buildEdgeIndices(positionsCompressed, geometryParams.indices, aabb, 10);
65+
if (built && built.length > 0) edgeIndices = built;
66+
}
5667
// Encode normals only when supplied and length-matched against positions.
5768
const normalsCompressed =
5869
geometryParams.normals && geometryParams.normals.length === geometryParams.positions.length

packages/sdk/src/model/scene/isDefaultLayer.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ import type {SceneObject} from "./SceneObject";
1111
* proxies, NavCube), user annotations, comparison snapshots,
1212
* etc.
1313
*
14-
* Studio panels that list "the SceneModels the user authored"
15-
* — SceneHealthPanel's tab strip, SchemaMaterialsPanel's tab
16-
* strip, DrawingsPanel's source-model picker, and any other
17-
* user-facing enumerator — call {@link isDefaultLayerModel} to
18-
* whitelist the default layer. Anything in a named layer is
19-
* skipped, regardless of name.
14+
* Enumerators that list "the SceneModels the user authored" —
15+
* user-facing tab strips, source-model pickers, inspection
16+
* walkers — call {@link isDefaultLayerModel} to whitelist the
17+
* default layer. Anything in a named layer is skipped, regardless
18+
* of name.
2019
*
2120
* Consumption-side only — the renderer's draw, pick, and clip
2221
* paths see every layer normally.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import type {CameraTourPlanOptions} from "../plan/CameraTourPlanOptions";
2+
import type {SpaceGraph} from "../graph/SpaceGraph";
3+
import type {ViewpointGraph} from "../graph/ViewpointGraph";
4+
import type {TourStop} from "../planners/TourPlanner";
5+
6+
7+
/**
8+
* Inputs to {@link buildTourWaypoints}.
9+
*
10+
* @internal
11+
*/
12+
export interface BuildTourWaypointsInput {
13+
stops: ReadonlyArray<TourStop>;
14+
spaceGraph: SpaceGraph;
15+
viewpointGraph: ViewpointGraph;
16+
/** Resolved options — every field used here is required. */
17+
options: Required<Pick<CameraTourPlanOptions,
18+
"eyeHeight" | "dwellMs" | "flightDurationMs">>;
19+
/** World up — looked up from the source scene when not overridden. */
20+
up: [number, number, number];
21+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type {CameraTourWaypoint} from "../plan/CameraTourWaypoint";
2+
3+
4+
/**
5+
* Output of {@link buildTourWaypoints}.
6+
*
7+
* @internal
8+
*/
9+
export interface BuildTourWaypointsResult {
10+
waypoints: ReadonlyArray<CameraTourWaypoint>;
11+
/** Sum of all dwellMs + flightDurationMs across consecutive waypoints. */
12+
estimatedDurationMs: number;
13+
}

0 commit comments

Comments
 (0)