@forgeax/engine-scene 0.0.0-dev.8d955ade1c79
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/LICENSE +202 -0
- package/README.md +55 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/__tests__/asset-owner.integration.test.d.ts +2 -0
- package/dist/__tests__/asset-owner.integration.test.d.ts.map +1 -0
- package/dist/__tests__/components.unit.test.d.ts +2 -0
- package/dist/__tests__/components.unit.test.d.ts.map +1 -0
- package/dist/__tests__/diagnostic-type-surface.test-d.d.ts +3 -0
- package/dist/__tests__/diagnostic-type-surface.test-d.d.ts.map +1 -0
- package/dist/__tests__/direct-child-of-import.unit.test.d.ts +2 -0
- package/dist/__tests__/direct-child-of-import.unit.test.d.ts.map +1 -0
- package/dist/__tests__/fixtures/malformed-hierarchy-edge.d.ts +8 -0
- package/dist/__tests__/fixtures/malformed-hierarchy-edge.d.ts.map +1 -0
- package/dist/__tests__/hierarchy-projection-contract.unit.test.d.ts +2 -0
- package/dist/__tests__/hierarchy-projection-contract.unit.test.d.ts.map +1 -0
- package/dist/__tests__/hierarchy-projection.unit.test.d.ts +2 -0
- package/dist/__tests__/hierarchy-projection.unit.test.d.ts.map +1 -0
- package/dist/__tests__/plugin.integration.test.d.ts +2 -0
- package/dist/__tests__/plugin.integration.test.d.ts.map +1 -0
- package/dist/__tests__/propagation.unit.test.d.ts +2 -0
- package/dist/__tests__/propagation.unit.test.d.ts.map +1 -0
- package/dist/__tests__/transform-change-journal.unit.test.d.ts +2 -0
- package/dist/__tests__/transform-change-journal.unit.test.d.ts.map +1 -0
- package/dist/assets/scene-decoder.d.ts +8 -0
- package/dist/assets/scene-decoder.d.ts.map +1 -0
- package/dist/collect-subtree.d.ts +4 -0
- package/dist/collect-subtree.d.ts.map +1 -0
- package/dist/components/child-of.d.ts +31 -0
- package/dist/components/child-of.d.ts.map +1 -0
- package/dist/components/children.d.ts +48 -0
- package/dist/components/children.d.ts.map +1 -0
- package/dist/components/morph-weights.d.ts +5 -0
- package/dist/components/morph-weights.d.ts.map +1 -0
- package/dist/components/name.d.ts +4 -0
- package/dist/components/name.d.ts.map +1 -0
- package/dist/components/transform.d.ts +52 -0
- package/dist/components/transform.d.ts.map +1 -0
- package/dist/errors.d.ts +22 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +1731 -0
- package/dist/index.mjs.map +1 -0
- package/dist/instances/collect-profile.d.ts +7 -0
- package/dist/instances/collect-profile.d.ts.map +1 -0
- package/dist/instances/externalization.d.ts +14 -0
- package/dist/instances/externalization.d.ts.map +1 -0
- package/dist/instances/scene-instances.d.ts +350 -0
- package/dist/instances/scene-instances.d.ts.map +1 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/systems/hierarchy-projection.d.ts +16 -0
- package/dist/systems/hierarchy-projection.d.ts.map +1 -0
- package/dist/systems/index.d.ts +3 -0
- package/dist/systems/index.d.ts.map +1 -0
- package/dist/systems/propagate-transforms.d.ts +15 -0
- package/dist/systems/propagate-transforms.d.ts.map +1 -0
- package/package.json +58 -0
- package/src/__tests__/asset-owner.integration.test.ts +57 -0
- package/src/__tests__/components.unit.test.ts +26 -0
- package/src/__tests__/diagnostic-type-surface.test-d.ts +11 -0
- package/src/__tests__/direct-child-of-import.unit.test.ts +13 -0
- package/src/__tests__/fixtures/malformed-hierarchy-edge.ts +15 -0
- package/src/__tests__/hierarchy-projection-contract.unit.test.ts +45 -0
- package/src/__tests__/hierarchy-projection.unit.test.ts +92 -0
- package/src/__tests__/plugin.integration.test.ts +23 -0
- package/src/__tests__/propagation.unit.test.ts +163 -0
- package/src/__tests__/transform-change-journal.unit.test.ts +105 -0
- package/src/assets/scene-decoder.ts +153 -0
- package/src/collect-subtree.ts +30 -0
- package/src/components/child-of.ts +90 -0
- package/src/components/children.ts +113 -0
- package/src/components/morph-weights.ts +6 -0
- package/src/components/name.ts +22 -0
- package/src/components/transform.ts +89 -0
- package/src/errors.ts +34 -0
- package/src/index.ts +65 -0
- package/src/instances/collect-profile.ts +10 -0
- package/src/instances/externalization.ts +137 -0
- package/src/instances/scene-instances.ts +1564 -0
- package/src/plugin.ts +28 -0
- package/src/systems/hierarchy-projection.ts +134 -0
- package/src/systems/index.ts +11 -0
- package/src/systems/propagate-transforms.ts +376 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"name.d.ts","sourceRoot":"","sources":["../../src/components/name.ts"],"names":[],"mappings":"AAqBA,eAAO,MAAM,IAAI;;EAAyD,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transform: local position `pos` (xyz), rotation `quat` (quaternion,
|
|
3
|
+
* component order [x, y, z, w]), scale `scale` (xyz), plus the resolved
|
|
4
|
+
* `world` mat4 (column-major 16 floats).
|
|
5
|
+
*
|
|
6
|
+
* Local TRS is stored as three inline stride-N array<f32, N> columns. The
|
|
7
|
+
* propagate kernel composes each entity's local TRS into a mat4 and writes it
|
|
8
|
+
* into the `world` column (root: world = local; child: world = parent.world x
|
|
9
|
+
* local) using `@forgeax/engine-math` mat4 / vec3 / quat APIs (charter P4: do
|
|
10
|
+
* not reinvent math). MVP recomposes every frame; dirty-flag optimization is
|
|
11
|
+
* owned by feat-future-render-world.
|
|
12
|
+
*
|
|
13
|
+
* The `world` column is a fixed-capacity `array<f32, 16>` (feat-20260602):
|
|
14
|
+
* the 16 contiguous floats live inline in a stride-16 column -- no BufferPool
|
|
15
|
+
* slot. Read it via `world.get(e, Transform).world` which returns a live
|
|
16
|
+
* `Float32Array` aliasing the column buffer. The view is transient: it aliases
|
|
17
|
+
* the archetype column buffer and is valid only until the next structural
|
|
18
|
+
* change (spawn / despawn / addComponent / removeComponent). Re-fetch the view
|
|
19
|
+
* on every access; holding a view across a structural change is undefined
|
|
20
|
+
* behaviour (the backing `ArrayBuffer` is detached on column growth, and
|
|
21
|
+
* swap-remove at the same row index points to the wrong entity). All existing
|
|
22
|
+
* hot paths (propagate / render-extract / pick) already comply -- see
|
|
23
|
+
* `packages/ecs/README.md` Transient view contract section.
|
|
24
|
+
*
|
|
25
|
+
* All three local columns carry explicit layer-2 defaults (identity
|
|
26
|
+
* transform): `pos: [0, 0, 0]`, `quat: [0, 0, 0, 1]` (identity quaternion,
|
|
27
|
+
* [x, y, z, w]), `scale: [1, 1, 1]`. quat and scale MUST stay explicit: the
|
|
28
|
+
* layer-3 fallback for array<f32, N> is all-zero, which would land an invalid
|
|
29
|
+
* zero quaternion / zero scale. The `world` field defaults to the identity
|
|
30
|
+
* mat4. AI users spawn with `data: {}` or with only the fields they need to
|
|
31
|
+
* override.
|
|
32
|
+
*
|
|
33
|
+
* @example Minimal spawn (local defaulted to identity, world = identity mat4):
|
|
34
|
+
* world.spawn({ component: Transform, data: {} });
|
|
35
|
+
*
|
|
36
|
+
* @example Override only the position, leaving rotation/scale at identity:
|
|
37
|
+
* world.spawn({ component: Transform, data: { pos: [0, 6, 0] } });
|
|
38
|
+
*
|
|
39
|
+
* @example Full explicit local form (defaults are opt-in):
|
|
40
|
+
* world.spawn({ component: Transform, data: {
|
|
41
|
+
* pos: [1, 2, 3],
|
|
42
|
+
* quat: [0, 0, 0, 1], // [x, y, z, w]
|
|
43
|
+
* scale: [1, 1, 1],
|
|
44
|
+
* } });
|
|
45
|
+
*/
|
|
46
|
+
export declare const Transform: import("@forgeax/engine-ecs").Component<"Transform", {
|
|
47
|
+
readonly pos: "array<f32, 3>";
|
|
48
|
+
readonly quat: "array<f32, 4>";
|
|
49
|
+
readonly scale: "array<f32, 3>";
|
|
50
|
+
readonly world: "array<f32, 16>";
|
|
51
|
+
}>;
|
|
52
|
+
//# sourceMappingURL=transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/components/transform.ts"],"names":[],"mappings":"AAiCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,eAAO,MAAM,SAAS;;;;;EAUpB,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { EntityHandle } from '@forgeax/engine-ecs';
|
|
2
|
+
export type SceneErrorCode = 'hierarchy-broken' | 'hierarchy-cycle';
|
|
3
|
+
/** Scene-instantiation failures owned by the scene package. */
|
|
4
|
+
export type SceneInstanceErrorCode = 'component-not-defined' | 'scene-override-type-mismatch';
|
|
5
|
+
export { ComponentNotDefinedError } from '@forgeax/engine-ecs/projection';
|
|
6
|
+
export interface SceneErrorDetail {
|
|
7
|
+
readonly entity: EntityHandle;
|
|
8
|
+
readonly parent: EntityHandle;
|
|
9
|
+
}
|
|
10
|
+
export declare class SceneError extends Error {
|
|
11
|
+
readonly code: SceneErrorCode;
|
|
12
|
+
readonly expected: string;
|
|
13
|
+
readonly hint: string;
|
|
14
|
+
readonly detail: SceneErrorDetail | undefined;
|
|
15
|
+
constructor(args: {
|
|
16
|
+
code: SceneErrorCode;
|
|
17
|
+
expected: string;
|
|
18
|
+
hint: string;
|
|
19
|
+
detail?: SceneErrorDetail;
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,iBAAiB,CAAC;AAEpE,+DAA+D;AAC/D,MAAM,MAAM,sBAAsB,GAAG,uBAAuB,GAAG,8BAA8B,CAAC;AAE9F,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAE1E,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,YAAY,CAAC;CAC/B;AAED,qBAAa,UAAW,SAAQ,KAAK;IACnC,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAAC;gBAElC,IAAI,EAAE;QAChB,IAAI,EAAE,cAAc,CAAC;QACrB,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,gBAAgB,CAAC;KAC3B;CAQF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { sceneAssetContribution } from './assets/scene-decoder';
|
|
2
|
+
export { collectSubtree } from './collect-subtree';
|
|
3
|
+
export { ChildOf } from './components/child-of';
|
|
4
|
+
export { Children } from './components/children';
|
|
5
|
+
export { MorphWeights } from './components/morph-weights';
|
|
6
|
+
export { Name } from './components/name';
|
|
7
|
+
export { Transform } from './components/transform';
|
|
8
|
+
export { ComponentNotDefinedError, SceneError, type SceneErrorCode, type SceneInstanceErrorCode, } from './errors';
|
|
9
|
+
export { SCENE_COLLECT_PROFILE, type SceneCollectProfile } from './instances/collect-profile';
|
|
10
|
+
export { type ExternalizedSceneAsset, externalizeSceneAsset, type SceneComponentSchemaResolver, type SceneExternalizationError, } from './instances/externalization';
|
|
11
|
+
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, worldResolveSceneInstanceStatePayload, worldSetSceneAssetResolver, worldSetSceneOverride, worldSpawnMountEntity, worldSpawnSceneMembers, worldValidateMountOverrides, } from './instances/scene-instances';
|
|
12
|
+
export { scenePlugin } from './plugin';
|
|
13
|
+
export { projectHierarchy, type SceneHierarchyDiagnostic, type SceneHierarchySnapshot, } from './systems/hierarchy-projection';
|
|
14
|
+
export { PROPAGATE_TRANSFORMS_SYSTEM, propagateTransforms, registerPropagateTransforms, TransformSet, } from './systems/propagate-transforms';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EACL,wBAAwB,EACxB,UAAU,EACV,KAAK,cAAc,EACnB,KAAK,sBAAsB,GAC5B,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,qBAAqB,EAAE,KAAK,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAC9F,OAAO,EACL,KAAK,sBAAsB,EAC3B,qBAAqB,EACrB,KAAK,4BAA4B,EACjC,KAAK,yBAAyB,GAC/B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,uBAAuB,EACvB,mCAAmC,EACnC,uBAAuB,EACvB,iBAAiB,EACjB,sBAAsB,EACtB,6BAA6B,EAC7B,0BAA0B,EAC1B,0BAA0B,EAC1B,qBAAqB,EACrB,0BAA0B,EAC1B,8BAA8B,EAC9B,yBAAyB,EACzB,4BAA4B,EAC5B,wBAAwB,EACxB,6BAA6B,EAC7B,wBAAwB,EACxB,wBAAwB,EACxB,uBAAuB,EACvB,sBAAsB,EACtB,qCAAqC,EACrC,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EACL,gBAAgB,EAChB,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,GAC5B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,2BAA2B,EAC3B,YAAY,GACb,MAAM,gCAAgC,CAAC"}
|