@volter/editor-threejs 0.5.129 → 0.5.130
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volter/editor-threejs",
|
|
3
3
|
"author": "Volter AI, Inc.",
|
|
4
|
-
"version": "0.5.
|
|
4
|
+
"version": "0.5.130",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -135,12 +135,12 @@
|
|
|
135
135
|
"serving": "./dist-node/serving.mjs"
|
|
136
136
|
},
|
|
137
137
|
"dependencies": {
|
|
138
|
-
"@volter/editor-project": "0.5.
|
|
138
|
+
"@volter/editor-project": "0.5.130",
|
|
139
139
|
"@sparkjsdev/spark": "^2.1.0",
|
|
140
140
|
"three.quarks": "^0.16.0",
|
|
141
141
|
"zod": "^4.3.6",
|
|
142
142
|
"typescript": "5.9.3",
|
|
143
|
-
"@volter/editor-sdk": "0.5.
|
|
143
|
+
"@volter/editor-sdk": "0.5.130",
|
|
144
144
|
"postprocessing": "6.38.3",
|
|
145
145
|
"quarks.core": "0.16.0",
|
|
146
146
|
"@fortawesome/free-solid-svg-icons": "^7.2.0"
|
|
@@ -174,7 +174,7 @@ export class Object3DDocumentSession {
|
|
|
174
174
|
private readonly throughOrthographic = new THREE.OrthographicCamera();
|
|
175
175
|
/** The host's mirror of the document scene onto the rendered scene — see
|
|
176
176
|
* {@link Object3DDocumentSession.setBeforeRender}. */
|
|
177
|
-
private beforeRender: (() => void) | null = null;
|
|
177
|
+
private beforeRender: (() => void | (() => void)) | null = null;
|
|
178
178
|
private state = INITIAL_PRESENTATION;
|
|
179
179
|
private version = 0;
|
|
180
180
|
private readonly listeners = new Set<() => void>();
|
|
@@ -1253,7 +1253,7 @@ export class Object3DDocumentSession {
|
|
|
1253
1253
|
* The host owns the step and clears it in its own teardown; the session only
|
|
1254
1254
|
* holds the reference.
|
|
1255
1255
|
*/
|
|
1256
|
-
setBeforeRender(step: (() => void) | null): void {
|
|
1256
|
+
setBeforeRender(step: (() => void | (() => void)) | null): void {
|
|
1257
1257
|
this.beforeRender = step;
|
|
1258
1258
|
}
|
|
1259
1259
|
|
|
@@ -1339,51 +1339,55 @@ export class Object3DDocumentSession {
|
|
|
1339
1339
|
}
|
|
1340
1340
|
|
|
1341
1341
|
render(renderSolid: (camera: THREE.Camera) => void): void {
|
|
1342
|
-
this.beforeRender?.();
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
this.
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
material
|
|
1365
|
-
|
|
1342
|
+
const finishDraw = this.beforeRender?.();
|
|
1343
|
+
try {
|
|
1344
|
+
this.boneSelectionHighlight?.update();
|
|
1345
|
+
const camera = this.camera();
|
|
1346
|
+
const mode = this.state.mode;
|
|
1347
|
+
this.boundsHelper?.update();
|
|
1348
|
+
this.selectionOrigins?.place();
|
|
1349
|
+
if (mode === 'uv' || mode === 'vertex-colors') {
|
|
1350
|
+
renderSolid(camera);
|
|
1351
|
+
return;
|
|
1352
|
+
}
|
|
1353
|
+
if (mode === 'wireframe' && this.topologyOverlay) {
|
|
1354
|
+
this.syncTopologyOverlay();
|
|
1355
|
+
if (this.xray.enabled && this.xray.alpha <= 0) {
|
|
1356
|
+
// X-RAY AT NO ALPHA: the wires alone, every surface left out of the draw. The surfaces'
|
|
1357
|
+
// MATERIALS stand down, not the meshes, whose children (lines, points, other objects)
|
|
1358
|
+
// still draw, as every wire does in Blender's.
|
|
1359
|
+
const hidden = new Set<THREE.Material>();
|
|
1360
|
+
this.root.traverse((object) => {
|
|
1361
|
+
const mesh = object as THREE.Mesh;
|
|
1362
|
+
if (!mesh.isMesh) return;
|
|
1363
|
+
for (const material of Array.isArray(mesh.material) ? mesh.material : [mesh.material]) {
|
|
1364
|
+
if (material?.visible) {
|
|
1365
|
+
material.visible = false;
|
|
1366
|
+
hidden.add(material);
|
|
1367
|
+
}
|
|
1366
1368
|
}
|
|
1369
|
+
});
|
|
1370
|
+
try {
|
|
1371
|
+
renderSolid(camera);
|
|
1372
|
+
} finally {
|
|
1373
|
+
for (const material of hidden) material.visible = true;
|
|
1367
1374
|
}
|
|
1368
|
-
|
|
1369
|
-
try {
|
|
1370
|
-
renderSolid(camera);
|
|
1371
|
-
} finally {
|
|
1372
|
-
for (const material of hidden) material.visible = true;
|
|
1375
|
+
return;
|
|
1373
1376
|
}
|
|
1377
|
+
// Clay bodies, not the triangle-wireframe swap: the overlay IS the wire,
|
|
1378
|
+
// and the solid form behind it is what occludes the far side.
|
|
1379
|
+
this.shading.render(
|
|
1380
|
+
this.scene,
|
|
1381
|
+
'clay',
|
|
1382
|
+
() => renderSolid(camera),
|
|
1383
|
+
isEditorViewportShadingTarget,
|
|
1384
|
+
);
|
|
1374
1385
|
return;
|
|
1375
1386
|
}
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
this.scene,
|
|
1380
|
-
'clay',
|
|
1381
|
-
() => renderSolid(camera),
|
|
1382
|
-
isEditorViewportShadingTarget,
|
|
1383
|
-
);
|
|
1384
|
-
return;
|
|
1387
|
+
this.shading.render(this.scene, mode, () => renderSolid(camera), isEditorViewportShadingTarget);
|
|
1388
|
+
} finally {
|
|
1389
|
+
finishDraw?.();
|
|
1385
1390
|
}
|
|
1386
|
-
this.shading.render(this.scene, mode, () => renderSolid(camera), isEditorViewportShadingTarget);
|
|
1387
1391
|
}
|
|
1388
1392
|
|
|
1389
1393
|
/** Visible authoring draw with the editor-only native selection silhouette. */
|
|
@@ -1904,7 +1904,10 @@ export function Object3DDocumentViewport({
|
|
|
1904
1904
|
}
|
|
1905
1905
|
};
|
|
1906
1906
|
host.syncHostScene = syncHostScene;
|
|
1907
|
-
documentSession.setBeforeRender(() =>
|
|
1907
|
+
documentSession.setBeforeRender(() => {
|
|
1908
|
+
host.syncHostScene?.();
|
|
1909
|
+
return source.prepareDraw?.(documentSession.camera());
|
|
1910
|
+
});
|
|
1908
1911
|
// This loop draws the compass and every other overlay pass over the
|
|
1909
1912
|
// document's own render, so it — and only it — can serve the chrome
|
|
1910
1913
|
// door a frame that matches the screen.
|
|
@@ -52,6 +52,10 @@ export interface ToolObject3DPreviewSource {
|
|
|
52
52
|
* where a world runs.
|
|
53
53
|
*/
|
|
54
54
|
update?(deltaSeconds: number): void;
|
|
55
|
+
/** Prepare camera-dependent draw buffers immediately before rendering.
|
|
56
|
+
* Does not advance content time or mutate the authored document. An optional
|
|
57
|
+
* returned function restores temporary draw state, including after errors. */
|
|
58
|
+
prepareDraw?(camera: Camera): void | (() => void);
|
|
55
59
|
/**
|
|
56
60
|
* EVERY CHANGE TO WHAT THE SOURCE DRAWS, announced: the host calls
|
|
57
61
|
* `listener` whenever the source's graph, materials, textures or poses may
|