@forgeax/engine-scene 0.1.28 → 0.1.30
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/README.md +50 -0
- package/dist/__tests__/keyed-scene.integration.test.d.ts +2 -0
- package/dist/__tests__/keyed-scene.integration.test.d.ts.map +1 -0
- package/dist/assets/scene-decoder.d.ts.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +848 -229
- package/dist/index.mjs.map +1 -1
- package/dist/instances/binding.d.ts +7 -5
- package/dist/instances/binding.d.ts.map +1 -1
- package/dist/instances/externalization.d.ts +1 -1
- package/dist/instances/externalization.d.ts.map +1 -1
- package/dist/instances/keyed.d.ts +38 -0
- package/dist/instances/keyed.d.ts.map +1 -0
- package/dist/instances/legacy.d.ts +20 -0
- package/dist/instances/legacy.d.ts.map +1 -0
- package/dist/instances/runtime-types.d.ts +20 -0
- package/dist/instances/runtime-types.d.ts.map +1 -0
- package/dist/instances/scene-instances.d.ts +27 -37
- package/dist/instances/scene-instances.d.ts.map +1 -1
- package/dist/instances/state.d.ts +6 -1
- package/dist/instances/state.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/__tests__/asset-owner.integration.test.ts +4 -7
- package/src/__tests__/flat-propagation.perf.test.ts +18 -17
- package/src/__tests__/keyed-scene.integration.test.ts +269 -0
- package/src/__tests__/scene-binding.integration.test.ts +141 -32
- package/src/__tests__/structural.test.ts +4 -1
- package/src/assets/scene-decoder.ts +123 -33
- package/src/collect-subtree.ts +2 -2
- package/src/index.ts +10 -1
- package/src/instances/binding.ts +26 -19
- package/src/instances/externalization.ts +115 -97
- package/src/instances/keyed.ts +505 -0
- package/src/instances/legacy.ts +108 -0
- package/src/instances/runtime-types.ts +21 -0
- package/src/instances/scene-instances.ts +220 -83
- package/src/instances/state.ts +6 -1
package/README.md
CHANGED
|
@@ -25,6 +25,56 @@ branch on `error.code` and repair a diagnosable stale edge, mirror mismatch, or
|
|
|
25
25
|
cycle through `World.set`/`World.removeComponent` (or the owning structural
|
|
26
26
|
command) before retrying while the World is healthy.
|
|
27
27
|
|
|
28
|
+
## Keyed SceneAsset authoring
|
|
29
|
+
|
|
30
|
+
`SceneAsset` is authored as ordinary data. The key in `entities` is the only
|
|
31
|
+
persistent local identity; runtime numeric slots and mount windows are derived
|
|
32
|
+
inside this package and never belong in source files.
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
const level: SceneAsset = {
|
|
36
|
+
kind: 'scene',
|
|
37
|
+
entities: {
|
|
38
|
+
root: { components: { Transform: {} } },
|
|
39
|
+
house: {
|
|
40
|
+
components: { ChildOf: { parent: 'root' } },
|
|
41
|
+
instance: {
|
|
42
|
+
source: houseSceneGuid,
|
|
43
|
+
overrides: [{ target: ['door'], components: { Name: { value: 'front-door' } } }],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
| Source value | Meaning |
|
|
51
|
+
|:--|:--|
|
|
52
|
+
| `'root'` | Entity in the current scene |
|
|
53
|
+
| `['house', 'door']` | Entity `door` inside instance `house`; every segment is a key |
|
|
54
|
+
| `sceneEntity(guid, address)` | Reference bound to one catalog identity and address |
|
|
55
|
+
| `sceneEntity('', address)` | Reference to an anonymous direct POD scene |
|
|
56
|
+
|
|
57
|
+
> [!IMPORTANT]
|
|
58
|
+
> Unknown components, unknown fields, missing targets, hierarchy cycles, and
|
|
59
|
+
> recursive instance graphs fail before entity creation. A direct POD scene has
|
|
60
|
+
> no persistent source identity; choose a Pack output key before saving it.
|
|
61
|
+
|
|
62
|
+
### Publication fence for loaded scenes
|
|
63
|
+
|
|
64
|
+
Catalog-loaded scenes carry their publication evidence in the producer/loading
|
|
65
|
+
context, not in the authored `instance` declaration. Acquire the current fence
|
|
66
|
+
from that context, then pass it to
|
|
67
|
+
`AssetRegistry.instantiateWithPublicationFence` or
|
|
68
|
+
`instantiateFlatWithPublicationFence`; the call compares the complete tuple:
|
|
69
|
+
source path and revision, generation, package digest, output-set digest, and
|
|
70
|
+
receipt identity. Ordinary `instantiate`/`instantiateFlat` still validate every
|
|
71
|
+
nested scene output against the parent publication before spawning. A missing or
|
|
72
|
+
mismatched tuple returns `asset-generation-fence-mismatch` with `expected`,
|
|
73
|
+
`actual`, `currentGeneration`, `lastKnownGood`, and recovery actions; repair or
|
|
74
|
+
recook the producer, then open the current publication and retry. Direct
|
|
75
|
+
anonymous POD scenes have no Catalog fence and remain addressable only for their
|
|
76
|
+
current in-memory instance; saving one requires an explicit Pack/output key.
|
|
77
|
+
|
|
28
78
|
When the plugin runs from the scheduled path, `world.update(deltaSeconds)`
|
|
29
79
|
wraps a thrown Scene failure as `system-failed`; the wrapper's
|
|
30
80
|
`error.detail.cause` is the original `SceneError` (including its structured
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyed-scene.integration.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/keyed-scene.integration.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scene-decoder.d.ts","sourceRoot":"","sources":["../../src/assets/scene-decoder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,SAAS,EAKd,KAAK,UAAU,EAGhB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"scene-decoder.d.ts","sourceRoot":"","sources":["../../src/assets/scene-decoder.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,wBAAwB,EAC7B,KAAK,SAAS,EAKd,KAAK,UAAU,EAGhB,MAAM,uBAAuB,CAAC;AAG/B,eAAO,MAAM,cAAc,EAAE,SAAS,CAAC,UAAU,EAAE,OAAO,CAEvB,CAAC;AAqBpC,gFAAgF;AAChF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,SAAS,MAAM,EAAE,GAAG,SAAS,CAEnF;AAyLD,qFAAqF;AACrF,eAAO,MAAM,iBAAiB,EAAE,YAAY,CAAC,UAAU,CAetD,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,wBAAwB,CAAC,UAAU,EAAE,OAAO,CAIhF,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -6,9 +6,11 @@ export { MorphWeights } from './components/morph-weights';
|
|
|
6
6
|
export { Name } from './components/name';
|
|
7
7
|
export { GlobalTransform, Transform } from './components/transform';
|
|
8
8
|
export { ComponentNotDefinedError, SceneError, type SceneErrorCode, type SceneInstanceErrorCode, } from './errors';
|
|
9
|
-
export { resolveSceneEntity, type SceneBindingDeclarationError, type SceneBindingError, type SceneEntityRef, sceneEntity,
|
|
9
|
+
export { resolveSceneEntity, type SceneBindingDeclarationError, type SceneBindingError, type SceneEntityRef, sceneEntity, sceneEntityAddressKey, validateSceneEntityKeys, } from './instances/binding';
|
|
10
10
|
export { SCENE_COLLECT_PROFILE, type SceneCollectProfile } from './instances/collect-profile';
|
|
11
11
|
export { type ExternalizedSceneAsset, externalizeSceneAsset, type SceneComponentSchemaResolver, type SceneExternalizationError, } from './instances/externalization';
|
|
12
|
+
export { type CompiledSceneAsset, type CompiledSceneEntity, type CompiledSceneResult, compileKeyedSceneAsset, type KeyedSceneCompileContext, } from './instances/keyed';
|
|
13
|
+
export type { MountOverride, SceneInstanceMount } from './instances/runtime-types';
|
|
12
14
|
export { type SceneAssetResolver, type SceneInstanceStatePayload, type SceneInstantiateDiagnostic, type SceneInstantiateFlatOk, type SceneInstantiateOk, type SceneMembersSpawn, worldApplyMountOverride, worldBuildSceneEntityComponentDatas, worldDespawnDescendants, worldDespawnScene, worldDetachSceneMember, worldGetSceneAssetForInstance, worldGetSceneAssetResolver, worldGetSceneInstanceState, worldInstantiateScene, worldInstantiateSceneAsset, worldInstantiateSceneAssetFlat, worldInstantiateSceneFlat, worldInstantiateScenePayload, worldInstantiateSceneRec, worldMountOverridesToStateMap, worldReattachSceneMember, worldRemoveSceneOverride, worldResolveMountSource, worldResolveSceneAsset, worldResolveSceneEntity, worldResolveSceneInstanceStatePayload, worldSetSceneAssetResolver, worldSetSceneOverride, worldSpawnMountEntity, worldSpawnSceneMembers, worldValidateMountOverrides, } from './instances/scene-instances';
|
|
13
15
|
export { scenePlugin } from './plugin';
|
|
14
16
|
export { projectHierarchy, type SceneHierarchyDiagnostic, type SceneHierarchySnapshot, } from './systems/hierarchy-projection';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,EACL,wBAAwB,EACxB,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,sBAAsB,GAC5B,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,kBAAkB,EAClB,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,EACtB,KAAK,cAAc,EACnB,WAAW,EACX,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAA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