@threenative/core 0.3.15 → 0.3.17
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/capabilities.json +652 -16
- package/dist/{chunk-GEMQJBY4.js → chunk-FQURMC2F.js} +53 -1
- package/dist/{chunk-VBBYWGAT.js → chunk-MEAZRNOB.js} +1 -1
- package/dist/{chunk-QAMSM3Z5.js → chunk-OMGIYWW7.js} +47 -2
- package/dist/hot.js +10 -2
- package/dist/index.d.ts +4 -10
- package/dist/index.js +70 -30
- package/dist/{model-lod-DPTzeCcD.d.ts → model-lod-B921F6kQ.d.ts} +0 -10
- package/dist/playtest.js +2 -2
- package/dist/world.d.ts +1 -1
- package/dist/world.js +2 -2
- package/mcp/animation-server.mjs +1 -1
- package/mcp/engine-server.mjs +85 -33
- package/mcp/servers.mjs +4 -4
- package/package.json +6 -6
- package/patches/three@0.187.0-prd269-upgrade.patch +126 -2
- package/patches/three@0.187.0.patch +108 -21
- package/src/engine-hooks.ts +29 -0
- package/src/grounding.ts +19 -10
- package/src/hot.ts +18 -2
- package/src/index.ts +1 -1
- package/src/instanced-batch-lod.ts +54 -0
- package/src/model-lod.ts +77 -1
- package/src/pose-measure.ts +27 -2
- package/src/scatter-field.ts +1 -0
- package/src/static-transform.ts +34 -0
- package/src/version.ts +1 -1
package/src/static-transform.ts
CHANGED
|
@@ -198,6 +198,10 @@ function freezeRoot(root: Object3D, engine: boolean): number {
|
|
|
198
198
|
const snapshot = existing?.snapshot ?? new Float64Array(SNAPSHOT_LENGTH);
|
|
199
199
|
writeSnapshot(root, snapshot);
|
|
200
200
|
const version = (existing?.version ?? 0) + 1;
|
|
201
|
+
// PRD-898 J1: on the owned engine the engine keeps its own record for the one-call check.
|
|
202
|
+
const watch = (root as Object3D & Partial<IStaticEngineRoot>).__tnStaticWatch;
|
|
203
|
+
if (typeof watch === "function") watch.call(root);
|
|
204
|
+
if (existing === undefined) engineRoots = undefined;
|
|
201
205
|
frozen.set(
|
|
202
206
|
root,
|
|
203
207
|
engine
|
|
@@ -216,6 +220,7 @@ function freezeRoot(root: Object3D, engine: boolean): number {
|
|
|
216
220
|
*/
|
|
217
221
|
export function unmarkStatic(root: Object3D): void {
|
|
218
222
|
if (!frozen.delete(root)) return;
|
|
223
|
+
engineRoots = undefined;
|
|
219
224
|
if (worldSilenced.delete(root)) root.matrixWorldAutoUpdate = true;
|
|
220
225
|
root.traverse((object) => {
|
|
221
226
|
if (composeSilenced.delete(object)) object.matrixAutoUpdate = true;
|
|
@@ -271,6 +276,17 @@ export interface IStaticTransformCensus {
|
|
|
271
276
|
|
|
272
277
|
let rearmedSinceCensus = 0;
|
|
273
278
|
|
|
279
|
+
/** The owned engine's frozen-root calls (abi/bindings_scene.cpp), absent on plain three.js. */
|
|
280
|
+
interface IStaticEngineRoot {
|
|
281
|
+
__tnStaticWatch(): void;
|
|
282
|
+
/** Hands over the frozen set, in map order; sent only when a root is added or removed. */
|
|
283
|
+
__tnStaticRoots(roots: readonly Object3D[]): void;
|
|
284
|
+
__tnStaticChanged(): readonly number[];
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/** Frozen roots in map order for the engine check, rebuilt only when a root is added or removed. */
|
|
288
|
+
let engineRoots: Object3D[] | undefined;
|
|
289
|
+
|
|
274
290
|
/**
|
|
275
291
|
* Re-arms any frozen root whose authored transform has changed since it was frozen.
|
|
276
292
|
*
|
|
@@ -281,6 +297,23 @@ let rearmedSinceCensus = 0;
|
|
|
281
297
|
*/
|
|
282
298
|
export function refreshStaticTransforms(): void {
|
|
283
299
|
if (frozen.size === 0) return;
|
|
300
|
+
const first = frozen.keys().next().value as Object3D & Partial<IStaticEngineRoot>;
|
|
301
|
+
const changed = first.__tnStaticChanged;
|
|
302
|
+
if (typeof changed === "function") {
|
|
303
|
+
// PRD-898 J1: one engine call compares every root with the record it took at freeze; JavaScript
|
|
304
|
+
// visits only the roots that moved.
|
|
305
|
+
if (engineRoots === undefined) {
|
|
306
|
+
engineRoots = [...frozen.keys()];
|
|
307
|
+
(first.__tnStaticRoots as IStaticEngineRoot["__tnStaticRoots"]).call(first, engineRoots);
|
|
308
|
+
}
|
|
309
|
+
const roots = engineRoots;
|
|
310
|
+
for (const index of changed.call(first)) {
|
|
311
|
+
const root = roots[index] as Object3D;
|
|
312
|
+
freezeRoot(root, frozen.get(root)?.parent !== undefined);
|
|
313
|
+
rearmedSinceCensus += 1;
|
|
314
|
+
}
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
284
317
|
parentMovedThisFrame.clear();
|
|
285
318
|
for (const entry of frozen.values()) {
|
|
286
319
|
const engine = entry.parent !== undefined;
|
|
@@ -344,6 +377,7 @@ export function staticTransformCensus(): IStaticTransformCensus {
|
|
|
344
377
|
/** Drops every registration. A game that tore down its scene must not keep its roots alive. */
|
|
345
378
|
export function resetStaticTransforms(): void {
|
|
346
379
|
frozen.clear();
|
|
380
|
+
engineRoots = undefined;
|
|
347
381
|
parentMovedThisFrame.clear();
|
|
348
382
|
rearmedSinceCensus = 0;
|
|
349
383
|
}
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by scripts/generate-version.mjs - do not edit. Source: package.json.
|
|
2
|
-
export const CORE_VERSION = "0.3.
|
|
2
|
+
export const CORE_VERSION = "0.3.17";
|