@forgeax/engine-gltf 0.1.27 → 0.1.29
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 +13 -11
- package/dist/bridge.d.ts +7 -0
- package/dist/bridge.d.ts.map +1 -1
- package/dist/cli-gltf.d.ts.map +1 -1
- package/dist/cli-gltf.mjs +19 -17
- package/dist/cli-gltf.mjs.map +1 -1
- package/dist/gltf-importer.d.ts.map +1 -1
- package/dist/importer-entry.mjs +47 -21
- package/dist/importer-entry.mjs.map +1 -1
- package/dist/index.mjs +47 -21
- package/dist/index.mjs.map +1 -1
- package/dist/node-file-entry.mjs +9 -7
- package/dist/node-file-entry.mjs.map +1 -1
- package/dist/parse-gltf.d.ts.map +1 -1
- package/dist/parse-skin.d.ts +8 -16
- package/dist/parse-skin.d.ts.map +1 -1
- package/package.json +13 -16
- package/src/__tests__/bridge.unit.test.ts +70 -51
- package/src/__tests__/cli-gltf.integration.test.ts +1 -1
- package/src/__tests__/gltf.unit.test.ts +96 -16
- package/src/__tests__/morph-import.integration.test.ts +1 -1
- package/src/bridge.ts +34 -10
- package/src/cli-gltf.ts +16 -18
- package/src/errors.ts +3 -3
- package/src/gltf-importer.ts +29 -11
- package/src/parse-gltf.ts +5 -0
- package/src/parse-skin.ts +14 -41
package/dist/parse-gltf.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-gltf.d.ts","sourceRoot":"","sources":["../src/parse-gltf.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,WAAW,EAIZ,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAGL,cAAc,EAEf,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EAAO,KAAK,SAAS,EAAe,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,KAAK,eAAe,EAAyB,MAAM,oBAAoB,CAAC;AAEjF,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,cAA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OAAO,EACb,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAGrC;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CA+B1C;AAED,wBAAsB,QAAQ,CAC5B,MAAM,EAAE,WAAW,EACnB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,gBAAqB,GAC7B,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAGrC;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,SAAS,EAAE,SAAS,iBAAiB,EAAE,CAAC;CAClD;AAED,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC,aAAa,EAAE,kBAAkB,GAAG,SAAS,CAAC,CAAC;AAExF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,OAAO,EACZ,YAAY,EAAE,YAAY,GAAG,SAAS,EACtC,MAAM,EAAE,MAAM,GACb,mBAAmB,CA+QrB;AAGD,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
package/dist/parse-skin.d.ts
CHANGED
|
@@ -15,11 +15,19 @@ export interface GltfSkeletonRecord {
|
|
|
15
15
|
readonly inverseBindMatrices: Float32Array;
|
|
16
16
|
/** Per-joint Name path from scene root (parallel to joints array). */
|
|
17
17
|
readonly jointPaths: readonly string[];
|
|
18
|
+
/** Producer-authored conservative animated local bounds when supplied. */
|
|
19
|
+
readonly bounds?: Float32Array;
|
|
18
20
|
}
|
|
19
21
|
interface SkinJson {
|
|
20
22
|
readonly name?: string;
|
|
21
23
|
readonly joints: readonly number[];
|
|
22
24
|
readonly inverseBindMatrices?: number;
|
|
25
|
+
/** glTF source metadata authored by the ForgeaX asset producer. */
|
|
26
|
+
readonly extras?: {
|
|
27
|
+
readonly forgeax?: {
|
|
28
|
+
readonly conservativeAnimatedBounds?: unknown;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
23
31
|
}
|
|
24
32
|
interface NodeJson {
|
|
25
33
|
readonly name?: string;
|
|
@@ -49,22 +57,6 @@ interface BufferViewJson {
|
|
|
49
57
|
* 3. Fail-fast on joint count > MAX_JOINTS or missing joint names
|
|
50
58
|
*/
|
|
51
59
|
export declare function parseSkin(skinsJson: readonly SkinJson[] | undefined, nodesJson: readonly NodeJson[], accessors: readonly AccessorJson[], bufferViews: readonly BufferViewJson[], buffers: readonly Uint8Array[]): Result<readonly GltfSkeletonRecord[], GltfError>;
|
|
52
|
-
/**
|
|
53
|
-
* Compute the BindPose static AABB for a skinned mesh's vertex positions.
|
|
54
|
-
*
|
|
55
|
-
* At bind pose, joint_bind = IBM^{-1}, so skinning collapses:
|
|
56
|
-
* world_pos = Sum(w_i * joint_bind_i * IBM_i * local_pos) = local_pos
|
|
57
|
-
* Therefore the BindPose AABB is simply the local position bounds.
|
|
58
|
-
*
|
|
59
|
-
* Per-frame zero cost: stored in mesh asset metadata at importer time.
|
|
60
|
-
* Dynamic AABB for animated poses is deferred to OOS-skin-dyn-bounds.
|
|
61
|
-
*
|
|
62
|
-
* Returns { min: [x,y,z], max: [x,y,z] } or undefined if positions is empty.
|
|
63
|
-
*/
|
|
64
|
-
export declare function computeBindPoseAABB(positions: Float32Array): {
|
|
65
|
-
readonly min: readonly [number, number, number];
|
|
66
|
-
readonly max: readonly [number, number, number];
|
|
67
|
-
} | undefined;
|
|
68
60
|
/** Re-export MAX_JOINTS for use by downstream modules. */
|
|
69
61
|
export { MAX_JOINTS };
|
|
70
62
|
//# sourceMappingURL=parse-skin.d.ts.map
|
package/dist/parse-skin.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse-skin.d.ts","sourceRoot":"","sources":["../src/parse-skin.ts"],"names":[],"mappings":"AAeA,OAAO,EAAO,KAAK,SAAS,EAAe,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAG5E,2DAA2D;AAC3D,QAAA,MAAM,UAAU,MAAM,CAAC;AAEvB;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,6DAA6D;IAC7D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,qEAAqE;IACrE,QAAQ,CAAC,mBAAmB,EAAE,YAAY,CAAC;IAC3C,sEAAsE;IACtE,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"parse-skin.d.ts","sourceRoot":"","sources":["../src/parse-skin.ts"],"names":[],"mappings":"AAeA,OAAO,EAAO,KAAK,SAAS,EAAe,KAAK,MAAM,EAAE,MAAM,aAAa,CAAC;AAG5E,2DAA2D;AAC3D,QAAA,MAAM,UAAU,MAAM,CAAC;AAEvB;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IACjC,6DAA6D;IAC7D,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,qEAAqE;IACrE,QAAQ,CAAC,mBAAmB,EAAE,YAAY,CAAC;IAC3C,sEAAsE;IACtE,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,0EAA0E;IAC1E,QAAQ,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;CAChC;AAED,UAAU,QAAQ;IAChB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IACtC,mEAAmE;IACnE,QAAQ,CAAC,MAAM,CAAC,EAAE;QAChB,QAAQ,CAAC,OAAO,CAAC,E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|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.29",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"sideEffects": false,
|
|
8
|
-
"description": "Runtime glTF 2.0 importer
|
|
9
|
-
"bin": {
|
|
10
|
-
"forgeax-engine-remote-gltf": "./dist/cli-gltf.mjs"
|
|
11
|
-
},
|
|
8
|
+
"description": "Runtime glTF 2.0 importer and build-time producer. Pure-function parseGlb / parseGltf / toAssetPack is invoked by the unified ForgeaX asset command and writes <source>.meta.json for runtime loadByGuid<SceneAsset>.",
|
|
12
9
|
"exports": {
|
|
13
10
|
".": {
|
|
14
11
|
"types": "./dist/index.d.ts",
|
|
@@ -38,21 +35,21 @@
|
|
|
38
35
|
"LICENSE"
|
|
39
36
|
],
|
|
40
37
|
"dependencies": {
|
|
41
|
-
"@forgeax/engine-animation": "0.1.
|
|
42
|
-
"@forgeax/engine-geometry": "0.1.
|
|
43
|
-
"@forgeax/engine-import": "0.1.
|
|
44
|
-
"@forgeax/engine-math": "0.1.
|
|
45
|
-
"@forgeax/engine-pack": "0.1.
|
|
46
|
-
"@forgeax/engine-scene": "0.1.
|
|
47
|
-
"@forgeax/engine-types": "0.1.
|
|
38
|
+
"@forgeax/engine-animation": "0.1.29",
|
|
39
|
+
"@forgeax/engine-geometry": "0.1.29",
|
|
40
|
+
"@forgeax/engine-import": "0.1.29",
|
|
41
|
+
"@forgeax/engine-math": "0.1.29",
|
|
42
|
+
"@forgeax/engine-pack": "0.1.29",
|
|
43
|
+
"@forgeax/engine-scene": "0.1.29",
|
|
44
|
+
"@forgeax/engine-types": "0.1.29",
|
|
48
45
|
"@webgpu/types": "^0.1.71",
|
|
49
46
|
"meshoptimizer": "^0.20.0"
|
|
50
47
|
},
|
|
51
48
|
"devDependencies": {
|
|
52
|
-
"@forgeax/engine-assets-runtime": "0.1.
|
|
53
|
-
"@forgeax/engine-picking": "0.1.
|
|
54
|
-
"@forgeax/engine-render": "0.1.
|
|
55
|
-
"@forgeax/engine-runtime": "0.1.
|
|
49
|
+
"@forgeax/engine-assets-runtime": "0.1.29",
|
|
50
|
+
"@forgeax/engine-picking": "0.1.29",
|
|
51
|
+
"@forgeax/engine-render": "0.1.29",
|
|
52
|
+
"@forgeax/engine-runtime": "0.1.29",
|
|
56
53
|
"@types/node": "^20.14.0"
|
|
57
54
|
},
|
|
58
55
|
"forgeax": {
|
|
@@ -133,13 +133,14 @@ const STANDARD_MATERIAL: GltfMaterialIr = {
|
|
|
133
133
|
const ctx = {
|
|
134
134
|
meshHandles: new Map([[0, fakeMeshHandle(1)]]),
|
|
135
135
|
materialHandles: new Map([[0, fakeMaterialHandle(7)]]),
|
|
136
|
+
instanceCollectionIdsByNodeIndex: new Map([[0, 41]]),
|
|
136
137
|
};
|
|
137
138
|
|
|
138
139
|
describe('bridge-name-instances.test.ts', () => {
|
|
139
140
|
describe('bridge.ts Name attachment (M4 w11/w12)', () => {
|
|
140
141
|
it('AC-06 attaches Name component when node.name is non-empty', () => {
|
|
141
142
|
const scene = gltfDocToSceneAsset(baseDoc(), ctx);
|
|
142
|
-
const node = scene.entities[0];
|
|
143
|
+
const node = scene.entities['node-0'];
|
|
143
144
|
expect(node?.components.Name).toEqual({ value: 'InstancedBox' });
|
|
144
145
|
});
|
|
145
146
|
|
|
@@ -149,7 +150,7 @@ const STANDARD_MATERIAL: GltfMaterialIr = {
|
|
|
149
150
|
nodes: [{ ...baseDoc().nodes[0], name: undefined } as never],
|
|
150
151
|
};
|
|
151
152
|
const scene = gltfDocToSceneAsset(doc, ctx);
|
|
152
|
-
const node = scene.entities[0];
|
|
153
|
+
const node = scene.entities['node-0'];
|
|
153
154
|
expect(node?.components.Name).toBeUndefined();
|
|
154
155
|
});
|
|
155
156
|
|
|
@@ -159,13 +160,13 @@ const STANDARD_MATERIAL: GltfMaterialIr = {
|
|
|
159
160
|
nodes: [{ ...baseDoc().nodes[0], name: '' } as never],
|
|
160
161
|
};
|
|
161
162
|
const scene = gltfDocToSceneAsset(doc, ctx);
|
|
162
|
-
const node = scene.entities[0];
|
|
163
|
+
const node = scene.entities['node-0'];
|
|
163
164
|
expect(node?.components.Name).toBeUndefined();
|
|
164
165
|
});
|
|
165
166
|
|
|
166
167
|
it('AC-08 mesh / material / scene names do NOT route into Name on the node', () => {
|
|
167
168
|
const scene = gltfDocToSceneAsset(baseDoc(), ctx);
|
|
168
|
-
for (const node of scene.entities) {
|
|
169
|
+
for (const node of Object.values(scene.entities)) {
|
|
169
170
|
const name = node.components.Name;
|
|
170
171
|
if (name !== undefined) {
|
|
171
172
|
expect(name.value).not.toBe('MeshFoo');
|
|
@@ -176,19 +177,16 @@ const STANDARD_MATERIAL: GltfMaterialIr = {
|
|
|
176
177
|
});
|
|
177
178
|
});
|
|
178
179
|
|
|
179
|
-
describe('bridge.ts Instances
|
|
180
|
-
it('
|
|
180
|
+
describe('bridge.ts Instances association', () => {
|
|
181
|
+
it('attaches the renderer-owned collection identity without copying transforms', () => {
|
|
181
182
|
const scene = gltfDocToSceneAsset(baseDoc(), ctx);
|
|
182
|
-
const node = scene.entities[0];
|
|
183
|
+
const node = scene.entities['node-0'];
|
|
183
184
|
expect(node?.components.Instances).toBeDefined();
|
|
184
185
|
const inst = node?.components.Instances;
|
|
185
|
-
|
|
186
|
-
const transforms = inst.transforms as Float32Array;
|
|
187
|
-
expect(transforms.length).toBe(4 * 16);
|
|
188
|
-
}
|
|
186
|
+
expect(inst).toEqual({ collectionId: 41 });
|
|
189
187
|
});
|
|
190
188
|
|
|
191
|
-
it('
|
|
189
|
+
it('preserves the caller-owned identity when the IR matrix payload changes', () => {
|
|
192
190
|
const seed = new Float32Array(4 * 16);
|
|
193
191
|
for (let i = 0; i < seed.length; i++) seed[i] = i;
|
|
194
192
|
const doc: GltfDoc = {
|
|
@@ -201,15 +199,12 @@ const STANDARD_MATERIAL: GltfMaterialIr = {
|
|
|
201
199
|
],
|
|
202
200
|
};
|
|
203
201
|
const scene = gltfDocToSceneAsset(doc, ctx);
|
|
204
|
-
|
|
205
|
-
for (let i = 0; i < seed.length; i++) {
|
|
206
|
-
expect(transforms[i]).toBe(seed[i]);
|
|
207
|
-
}
|
|
202
|
+
expect(scene.entities['node-0']?.components.Instances).toEqual({ collectionId: 41 });
|
|
208
203
|
});
|
|
209
204
|
|
|
210
205
|
it('AC-11 1 entity carries MeshFilter+MeshRenderer+Instances (no flatten)', () => {
|
|
211
206
|
const scene = gltfDocToSceneAsset(baseDoc(), ctx);
|
|
212
|
-
const candidates = scene.entities.filter(
|
|
207
|
+
const candidates = Object.values(scene.entities).filter(
|
|
213
208
|
(n) =>
|
|
214
209
|
n.components.MeshFilter !== undefined &&
|
|
215
210
|
n.components.MeshRenderer !== undefined &&
|
|
@@ -224,7 +219,15 @@ const STANDARD_MATERIAL: GltfMaterialIr = {
|
|
|
224
219
|
nodes: [{ ...baseDoc().nodes[0], instancing: undefined } as never],
|
|
225
220
|
};
|
|
226
221
|
const scene = gltfDocToSceneAsset(doc, ctx);
|
|
227
|
-
expect(scene.entities[0]?.components.Instances).toBeUndefined();
|
|
222
|
+
expect(scene.entities['node-0']?.components.Instances).toBeUndefined();
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it('omits an instancing association when no renderer collection is supplied', () => {
|
|
226
|
+
const scene = gltfDocToSceneAsset(baseDoc(), {
|
|
227
|
+
meshHandles: ctx.meshHandles,
|
|
228
|
+
materialHandles: ctx.materialHandles,
|
|
229
|
+
});
|
|
230
|
+
expect(scene.entities['node-0']?.components.Instances).toBeUndefined();
|
|
228
231
|
});
|
|
229
232
|
});
|
|
230
233
|
});
|
|
@@ -341,11 +344,11 @@ const STANDARD_MATERIAL: GltfMaterialIr = {
|
|
|
341
344
|
materialHandles: new Map([[0, fakeMaterialHandle(20)]]),
|
|
342
345
|
};
|
|
343
346
|
const scene: SceneAsset = gltfDocToSceneAsset(twoLevelDoc, ctx);
|
|
344
|
-
expect(scene.entities.length).toBe(2);
|
|
345
|
-
expect(scene.entities[0]?.components.MeshFilter?.assetHandle).toBe(10);
|
|
346
|
-
expect(scene.entities[1]?.components.MeshFilter?.assetHandle).toBe(11);
|
|
347
|
-
expect(scene.entities[0]
|
|
348
|
-
expect(scene.entities[1]
|
|
347
|
+
expect(Object.keys(scene.entities).length).toBe(2);
|
|
348
|
+
expect(scene.entities['node-0']?.components.MeshFilter?.assetHandle).toBe(10);
|
|
349
|
+
expect(scene.entities['node-1']?.components.MeshFilter?.assetHandle).toBe(11);
|
|
350
|
+
expect(scene.entities['node-0']).toBeDefined();
|
|
351
|
+
expect(scene.entities['node-1']).toBeDefined();
|
|
349
352
|
});
|
|
350
353
|
|
|
351
354
|
it('visits full three-level hierarchy in DFS order', () => {
|
|
@@ -358,10 +361,10 @@ const STANDARD_MATERIAL: GltfMaterialIr = {
|
|
|
358
361
|
materialHandles: new Map([[0, fakeMaterialHandle(20)]]),
|
|
359
362
|
};
|
|
360
363
|
const scene: SceneAsset = gltfDocToSceneAsset(threeLevelDoc, ctx);
|
|
361
|
-
expect(scene.entities.length).toBe(3);
|
|
362
|
-
expect(scene.entities[0]
|
|
363
|
-
expect(scene.entities[1]
|
|
364
|
-
expect(scene.entities[2]
|
|
364
|
+
expect(Object.keys(scene.entities).length).toBe(3);
|
|
365
|
+
expect(scene.entities['node-0']).toBeDefined();
|
|
366
|
+
expect(scene.entities['node-1']).toBeDefined();
|
|
367
|
+
expect(scene.entities['node-2']).toBeDefined();
|
|
365
368
|
});
|
|
366
369
|
|
|
367
370
|
it('includes child entities with Name components from node.name', () => {
|
|
@@ -373,8 +376,8 @@ const STANDARD_MATERIAL: GltfMaterialIr = {
|
|
|
373
376
|
materialHandles: new Map([[0, fakeMaterialHandle(20)]]),
|
|
374
377
|
};
|
|
375
378
|
const scene: SceneAsset = gltfDocToSceneAsset(twoLevelDoc, ctx);
|
|
376
|
-
expect(scene.entities[0]?.components.Name?.value).toBe('root');
|
|
377
|
-
expect(scene.entities[1]?.components.Name?.value).toBe('child');
|
|
379
|
+
expect(scene.entities['node-0']?.components.Name?.value).toBe('root');
|
|
380
|
+
expect(scene.entities['node-1']?.components.Name?.value).toBe('child');
|
|
378
381
|
});
|
|
379
382
|
});
|
|
380
383
|
});
|
|
@@ -623,8 +626,8 @@ const STANDARD_MATERIAL: GltfMaterialIr = {
|
|
|
623
626
|
};
|
|
624
627
|
const scene: SceneAsset = gltfDocToSceneAsset(helloGltfDoc, ctx);
|
|
625
628
|
expect(scene.kind).toBe('scene');
|
|
626
|
-
expect(scene.entities.length).toBeGreaterThanOrEqual(1);
|
|
627
|
-
const meshNode = scene.entities[0];
|
|
629
|
+
expect(Object.keys(scene.entities).length).toBeGreaterThanOrEqual(1);
|
|
630
|
+
const meshNode = scene.entities['node-0'];
|
|
628
631
|
expect(meshNode?.components.MeshFilter?.assetHandle).toBe(1);
|
|
629
632
|
const renderer = meshNode?.components.MeshRenderer;
|
|
630
633
|
expect(renderer).toBeDefined();
|
|
@@ -642,7 +645,9 @@ const STANDARD_MATERIAL: GltfMaterialIr = {
|
|
|
642
645
|
materialHandles: new Map([[0, fakeMaterialHandle(7)]]),
|
|
643
646
|
};
|
|
644
647
|
const scene = gltfDocToSceneAsset(helloGltfDoc, ctx);
|
|
645
|
-
const cameraNode = scene.entities.find(
|
|
648
|
+
const cameraNode = Object.values(scene.entities).find(
|
|
649
|
+
(n) => n.components.Camera !== undefined,
|
|
650
|
+
);
|
|
646
651
|
expect(cameraNode).toBeDefined();
|
|
647
652
|
});
|
|
648
653
|
});
|
|
@@ -704,9 +709,9 @@ const STANDARD_MATERIAL: GltfMaterialIr = {
|
|
|
704
709
|
]),
|
|
705
710
|
};
|
|
706
711
|
const scene = gltfDocToSceneAsset(doc, ctx);
|
|
707
|
-
expect(scene.entities.length).toBe(1);
|
|
712
|
+
expect(Object.keys(scene.entities).length).toBe(1);
|
|
708
713
|
|
|
709
|
-
const entityNode = scene.entities[0];
|
|
714
|
+
const entityNode = scene.entities['node-0'];
|
|
710
715
|
expect(entityNode).toBeDefined();
|
|
711
716
|
expect(entityNode?.components.MeshFilter?.assetHandle).toBe(10);
|
|
712
717
|
expect(entityNode?.components.MeshRenderer).toBeDefined();
|
|
@@ -752,8 +757,8 @@ const STANDARD_MATERIAL: GltfMaterialIr = {
|
|
|
752
757
|
materialHandles: new Map([[0, fakeMaterialHandle(7)]]),
|
|
753
758
|
};
|
|
754
759
|
const scene = gltfDocToSceneAsset(doc, ctx);
|
|
755
|
-
expect(scene.entities.length).toBe(1);
|
|
756
|
-
const node = scene.entities[0];
|
|
760
|
+
expect(Object.keys(scene.entities).length).toBe(1);
|
|
761
|
+
const node = scene.entities['node-0'];
|
|
757
762
|
expect(node?.components.MeshFilter?.assetHandle).toBe(1);
|
|
758
763
|
expect(node?.components.MeshRenderer).toBeDefined();
|
|
759
764
|
});
|
|
@@ -797,8 +802,8 @@ const STANDARD_MATERIAL: GltfMaterialIr = {
|
|
|
797
802
|
materialHandles: new Map(),
|
|
798
803
|
};
|
|
799
804
|
const scene = gltfDocToSceneAsset(doc, ctx);
|
|
800
|
-
expect(scene.entities.length).toBe(1);
|
|
801
|
-
const node = scene.entities[0];
|
|
805
|
+
expect(Object.keys(scene.entities).length).toBe(1);
|
|
806
|
+
const node = scene.entities['node-0'];
|
|
802
807
|
expect(node?.components.Transform).toBeDefined();
|
|
803
808
|
expect(node?.components.MeshFilter).toBeUndefined();
|
|
804
809
|
expect(node?.components.MeshRenderer).toBeUndefined();
|
|
@@ -873,9 +878,13 @@ const STANDARD_MATERIAL: GltfMaterialIr = {
|
|
|
873
878
|
]),
|
|
874
879
|
};
|
|
875
880
|
const scene = gltfDocToSceneAsset(doc, ctx);
|
|
876
|
-
expect(scene.entities.length).toBe(2);
|
|
877
|
-
const nodeA = scene.entities.find(
|
|
878
|
-
|
|
881
|
+
expect(Object.keys(scene.entities).length).toBe(2);
|
|
882
|
+
const nodeA = Object.values(scene.entities).find(
|
|
883
|
+
(n) => n.components.Name?.value === 'NodeA',
|
|
884
|
+
);
|
|
885
|
+
const nodeB = Object.values(scene.entities).find(
|
|
886
|
+
(n) => n.components.Name?.value === 'NodeB',
|
|
887
|
+
);
|
|
879
888
|
expect(nodeA?.components.MeshRenderer?.materials).toEqual([]);
|
|
880
889
|
expect(nodeB?.components.MeshRenderer?.materials).toEqual([]);
|
|
881
890
|
});
|
|
@@ -943,11 +952,15 @@ const STANDARD_MATERIAL: GltfMaterialIr = {
|
|
|
943
952
|
materialHandles: new Map([[0, fakeMaterialHandle(7)]]),
|
|
944
953
|
};
|
|
945
954
|
const scene = gltfDocToSceneAsset(doc, ctx);
|
|
946
|
-
expect(scene.entities.length).toBe(3);
|
|
955
|
+
expect(Object.keys(scene.entities).length).toBe(3);
|
|
947
956
|
|
|
948
|
-
const rootNode = scene.entities.find(
|
|
949
|
-
|
|
950
|
-
|
|
957
|
+
const rootNode = Object.values(scene.entities).find(
|
|
958
|
+
(n) => n.components.Name?.value === 'Root',
|
|
959
|
+
);
|
|
960
|
+
const childNode = Object.values(scene.entities).find(
|
|
961
|
+
(n) => n.components.Name?.value === 'Child',
|
|
962
|
+
);
|
|
963
|
+
const grandchildNode = Object.values(scene.entities).find(
|
|
951
964
|
(n) => n.components.Name?.value === 'Grandchild',
|
|
952
965
|
);
|
|
953
966
|
expect(rootNode).toBeDefined();
|
|
@@ -958,8 +971,8 @@ const STANDARD_MATERIAL: GltfMaterialIr = {
|
|
|
958
971
|
expect(childNode?.components.MeshFilter).toBeUndefined();
|
|
959
972
|
expect(grandchildNode?.components.MeshFilter).toBeDefined();
|
|
960
973
|
|
|
961
|
-
expect(childNode?.components.ChildOf?.parent).toBe(
|
|
962
|
-
expect(grandchildNode?.components.ChildOf?.parent).toBe(
|
|
974
|
+
expect(childNode?.components.ChildOf?.parent).toBe('node-0');
|
|
975
|
+
expect(grandchildNode?.components.ChildOf?.parent).toBe('node-1');
|
|
963
976
|
});
|
|
964
977
|
});
|
|
965
978
|
|
|
@@ -1014,9 +1027,11 @@ const STANDARD_MATERIAL: GltfMaterialIr = {
|
|
|
1014
1027
|
materialHandles: new Map([[0, fakeMaterialHandle(7)]]),
|
|
1015
1028
|
};
|
|
1016
1029
|
const scene = gltfDocToSceneAsset(doc, ctx);
|
|
1017
|
-
expect(scene.entities.length).toBe(2);
|
|
1030
|
+
expect(Object.keys(scene.entities).length).toBe(2);
|
|
1018
1031
|
|
|
1019
|
-
const childNode = scene.entities.find(
|
|
1032
|
+
const childNode = Object.values(scene.entities).find(
|
|
1033
|
+
(n) => n.components.Name?.value === 'Child',
|
|
1034
|
+
);
|
|
1020
1035
|
expect(childNode?.components.Transform).toBeDefined();
|
|
1021
1036
|
const t = childNode?.components.Transform;
|
|
1022
1037
|
// Local TRS: child node carries its own [2, 0, 0]; parent's [5, 0, 0]
|
|
@@ -1076,12 +1091,16 @@ const STANDARD_MATERIAL: GltfMaterialIr = {
|
|
|
1076
1091
|
};
|
|
1077
1092
|
const scene = gltfDocToSceneAsset(doc as unknown as GltfDoc, ctx);
|
|
1078
1093
|
|
|
1079
|
-
const cameraNode = scene.entities.find(
|
|
1094
|
+
const cameraNode = Object.values(scene.entities).find(
|
|
1095
|
+
(n) => n.components.Name?.value === 'CameraNode',
|
|
1096
|
+
);
|
|
1080
1097
|
expect(cameraNode).toBeDefined();
|
|
1081
1098
|
expect(cameraNode?.components.Camera).toBeDefined();
|
|
1082
1099
|
expect(cameraNode?.components.Camera?.fov).toBe(0.7853981633974483);
|
|
1083
1100
|
|
|
1084
|
-
const boxNode = scene.entities.find(
|
|
1101
|
+
const boxNode = Object.values(scene.entities).find(
|
|
1102
|
+
(n) => n.components.Name?.value === 'BoxNode',
|
|
1103
|
+
);
|
|
1085
1104
|
expect(boxNode?.components.Camera).toBeUndefined();
|
|
1086
1105
|
});
|
|
1087
1106
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// packages/gltf/src/__tests__/cli-gltf.integration.test.ts
|
|
2
2
|
//
|
|
3
|
-
// Integration test: run `forgeax
|
|
3
|
+
// Integration test: run `forgeax asset import import` against real
|
|
4
4
|
// glTF files and verify the written .meta.json sidecar contains texture
|
|
5
5
|
// sub-assets (feat-20260608 M6 w29 AC-18).
|
|
6
6
|
//
|
|
@@ -189,7 +189,7 @@ function unwrapReimport(result: ReturnType<typeof reimportReuseMeta>) {
|
|
|
189
189
|
await rm(tempDir, { recursive: true, force: true });
|
|
190
190
|
});
|
|
191
191
|
|
|
192
|
-
describe('cli-gltf (forgeax
|
|
192
|
+
describe('cli-gltf (forgeax asset import plugin bin)', () => {
|
|
193
193
|
describe('subcommand routing (a)', () => {
|
|
194
194
|
it('prints help on --help and exits 0', async () => {
|
|
195
195
|
const io = makeIO();
|
|
@@ -1323,6 +1323,7 @@ function unwrapReimport(result: ReturnType<typeof reimportReuseMeta>) {
|
|
|
1323
1323
|
bytes: Uint8Array;
|
|
1324
1324
|
subAssets: readonly ImportSubAsset[];
|
|
1325
1325
|
decodeCalls: DecodeCall[];
|
|
1326
|
+
importSettings?: Readonly<Record<string, unknown>>;
|
|
1326
1327
|
}): ImportContext {
|
|
1327
1328
|
return {
|
|
1328
1329
|
source: 'inline.gltf',
|
|
@@ -1346,10 +1347,22 @@ function unwrapReimport(result: ReturnType<typeof reimportReuseMeta>) {
|
|
|
1346
1347
|
};
|
|
1347
1348
|
},
|
|
1348
1349
|
subAssets: opts.subAssets,
|
|
1349
|
-
importSettings: {},
|
|
1350
|
+
importSettings: opts.importSettings ?? {},
|
|
1350
1351
|
};
|
|
1351
1352
|
}
|
|
1352
1353
|
|
|
1354
|
+
function buildSkinOnlyGltf(): Uint8Array {
|
|
1355
|
+
return new TextEncoder().encode(
|
|
1356
|
+
JSON.stringify({
|
|
1357
|
+
asset: { version: '2.0' },
|
|
1358
|
+
scene: 0,
|
|
1359
|
+
scenes: [{ nodes: [0] }],
|
|
1360
|
+
nodes: [{ name: 'root', children: [1] }, { name: 'joint' }],
|
|
1361
|
+
skins: [{ joints: [1] }],
|
|
1362
|
+
}),
|
|
1363
|
+
);
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1353
1366
|
describe('gltf-importer-texture-data-uri.test.ts', () => {
|
|
1354
1367
|
describe('gltfImporter texture extraction (c) data URI / .gltf / AC-10', () => {
|
|
1355
1368
|
it('decodes the data: URI inline (no readSibling) and funnels through ctx.decodeImage', async () => {
|
|
@@ -1385,6 +1398,83 @@ function unwrapReimport(result: ReturnType<typeof reimportReuseMeta>) {
|
|
|
1385
1398
|
expect(materialPayload.values?.emissiveTexture).toMatchObject({ texture: 1 });
|
|
1386
1399
|
});
|
|
1387
1400
|
});
|
|
1401
|
+
|
|
1402
|
+
it('imports producer-authored animated skin bounds from importSettings with the SkinAsset', async () => {
|
|
1403
|
+
const skeletonGuid = '019e2cc6-0c86-79da-aa76-b0984c86d490';
|
|
1404
|
+
const skinGuid = '019e2cc6-0c86-79da-aa76-b0984c86d491';
|
|
1405
|
+
const sceneGuid = '019e2cc6-0c86-79da-aa76-b0984c86d492';
|
|
1406
|
+
const produced = unwrap(
|
|
1407
|
+
await gltfImporter.import(
|
|
1408
|
+
makeDataUriCtx({
|
|
1409
|
+
bytes: buildSkinOnlyGltf(),
|
|
1410
|
+
subAssets: [
|
|
1411
|
+
{ guid: skeletonGuid, sourceIndex: 0, kind: 'skeleton' },
|
|
1412
|
+
{ guid: skinGuid, sourceIndex: 0, kind: 'skin' },
|
|
1413
|
+
{ guid: sceneGuid, sourceIndex: 0, kind: 'scene' },
|
|
1414
|
+
],
|
|
1415
|
+
decodeCalls: [],
|
|
1416
|
+
importSettings: {
|
|
1417
|
+
conservativeAnimatedBounds: [[-2, -3, -4, 2, 3, 4]],
|
|
1418
|
+
},
|
|
1419
|
+
}),
|
|
1420
|
+
),
|
|
1421
|
+
);
|
|
1422
|
+
const skeleton = produced.find((asset) => asset.guid === skeletonGuid);
|
|
1423
|
+
expect(skeleton?.payload).toMatchObject({ kind: 'skeleton', jointCount: 1 });
|
|
1424
|
+
if (skeleton?.payload.kind !== 'skeleton') throw new Error('expected SkeletonAsset');
|
|
1425
|
+
expect(skeleton.payload.bounds).toEqual(new Float32Array([-2, -3, -4, 2, 3, 4]));
|
|
1426
|
+
|
|
1427
|
+
const skin = produced.find((asset) => asset.guid === skinGuid);
|
|
1428
|
+
expect(skin?.payload).toEqual({
|
|
1429
|
+
kind: 'skin',
|
|
1430
|
+
skeletonGuid,
|
|
1431
|
+
jointPaths: ['root/joint'],
|
|
1432
|
+
});
|
|
1433
|
+
});
|
|
1434
|
+
|
|
1435
|
+
it('reads glTF ForgeaX extras as producer-authored bounds without bind-pose derivation', async () => {
|
|
1436
|
+
const parsed = await parseGltf(
|
|
1437
|
+
{
|
|
1438
|
+
asset: { version: '2.0' },
|
|
1439
|
+
nodes: [{ name: 'root', children: [1] }, { name: 'joint' }],
|
|
1440
|
+
scenes: [{ nodes: [0] }],
|
|
1441
|
+
skins: [
|
|
1442
|
+
{
|
|
1443
|
+
joints: [1],
|
|
1444
|
+
extras: { forgeax: { conservativeAnimatedBounds: [-1, -2, -3, 1, 2, 3] } },
|
|
1445
|
+
},
|
|
1446
|
+
],
|
|
1447
|
+
},
|
|
1448
|
+
async () => new ArrayBuffer(0),
|
|
1449
|
+
'extras.gltf',
|
|
1450
|
+
);
|
|
1451
|
+
expect(parsed.ok).toBe(true);
|
|
1452
|
+
if (!parsed.ok) return;
|
|
1453
|
+
expect(parsed.value.skeletons[0]?.bounds).toEqual(new Float32Array([-1, -2, -3, 1, 2, 3]));
|
|
1454
|
+
});
|
|
1455
|
+
|
|
1456
|
+
it('leaves animated bounds absent when skinned positions have no producer metadata', async () => {
|
|
1457
|
+
const positions = [0, 0, 0, 1, 0, 0, 0, 1, 0];
|
|
1458
|
+
const parsed = await parseGltf(
|
|
1459
|
+
{
|
|
1460
|
+
asset: { version: '2.0' },
|
|
1461
|
+
buffers: [{ byteLength: positions.length * 4, uri: buildBase64Buffer(positions) }],
|
|
1462
|
+
bufferViews: [{ buffer: 0, byteOffset: 0, byteLength: positions.length * 4 }],
|
|
1463
|
+
accessors: [{ bufferView: 0, componentType: 5126, count: 3, type: 'VEC3' }],
|
|
1464
|
+
meshes: [{ primitives: [{ attributes: { POSITION: 0 } }] }],
|
|
1465
|
+
nodes: [{ name: 'root', mesh: 0, skin: 0, children: [1] }, { name: 'joint' }],
|
|
1466
|
+
scenes: [{ nodes: [0] }],
|
|
1467
|
+
scene: 0,
|
|
1468
|
+
skins: [{ joints: [1] }],
|
|
1469
|
+
},
|
|
1470
|
+
noopLoader,
|
|
1471
|
+
'no-animated-bounds.gltf',
|
|
1472
|
+
);
|
|
1473
|
+
expect(parsed.ok).toBe(true);
|
|
1474
|
+
if (!parsed.ok) return;
|
|
1475
|
+
expect(parsed.value.meshes[0]?.positions).toEqual(new Float32Array(positions));
|
|
1476
|
+
expect(parsed.value.skeletons[0]?.bounds).toBeUndefined();
|
|
1477
|
+
});
|
|
1388
1478
|
});
|
|
1389
1479
|
}
|
|
1390
1480
|
|
|
@@ -1766,11 +1856,11 @@ function unwrapReimport(result: ReturnType<typeof reimportReuseMeta>) {
|
|
|
1766
1856
|
const meshRef = meshRefs?.[0];
|
|
1767
1857
|
expect(meshRef?.sourceField?.componentName).toBe('MeshFilter');
|
|
1768
1858
|
expect(meshRef?.sourceField?.fieldName).toBe('assetHandle');
|
|
1769
|
-
expect(meshRef?.
|
|
1859
|
+
expect(meshRef?.sceneEntityKey).toMatch(/^node-\d+$/);
|
|
1770
1860
|
expect(scene?.refs.some((ref) => ref.guid === MAT_GUID)).toBe(false);
|
|
1771
1861
|
});
|
|
1772
1862
|
|
|
1773
|
-
it('(b)
|
|
1863
|
+
it('(b) sceneEntityKey identifies the keyed entity for handle-field refs', async () => {
|
|
1774
1864
|
const bytes = new Uint8Array(await readFile(FIXTURE_GLB));
|
|
1775
1865
|
const TEX_GUID = '019e2cc6-0c86-79da-aa76-b0984c86d460';
|
|
1776
1866
|
const MAT_GUID = '019e2cc6-0c86-79da-aa76-b0984c86d461';
|
|
@@ -1791,7 +1881,7 @@ function unwrapReimport(result: ReturnType<typeof reimportReuseMeta>) {
|
|
|
1791
1881
|
const scene = produced.find((p) => p.guid === SCENE_GUID);
|
|
1792
1882
|
expect(scene).toBeDefined();
|
|
1793
1883
|
const meshRef = scene?.refs.find((r) => r.guid === MESH_GUID);
|
|
1794
|
-
expect(meshRef?.
|
|
1884
|
+
expect(meshRef?.sceneEntityKey).toMatch(/^node-\d+$/);
|
|
1795
1885
|
});
|
|
1796
1886
|
|
|
1797
1887
|
it('(c) transitive texture edges live on MaterialAsset, not SceneAsset', async () => {
|
|
@@ -1875,7 +1965,7 @@ function unwrapReimport(result: ReturnType<typeof reimportReuseMeta>) {
|
|
|
1875
1965
|
expect(texRef).toBeDefined();
|
|
1876
1966
|
expect(texRef?.sourceField?.componentName).toBe('<material>');
|
|
1877
1967
|
expect(texRef?.sourceField?.fieldName).toBe('baseColorTexture');
|
|
1878
|
-
expect(texRef?.
|
|
1968
|
+
expect(texRef?.sceneEntityKey).toBeUndefined();
|
|
1879
1969
|
});
|
|
1880
1970
|
|
|
1881
1971
|
it('(f) all scene refs AssetRef entries have valid shape', async () => {
|
|
@@ -2753,16 +2843,6 @@ function unwrapReimport(result: ReturnType<typeof reimportReuseMeta>) {
|
|
|
2753
2843
|
expect(second.subAssets[i]?.guid).toBe(first.subAssets[i]?.guid);
|
|
2754
2844
|
}
|
|
2755
2845
|
});
|
|
2756
|
-
|
|
2757
|
-
it('BindPose AABB exported from parse-skin computes correctly', async () => {
|
|
2758
|
-
const { computeBindPoseAABB } = await import('../parse-skin.js');
|
|
2759
|
-
const pos = new Float32Array([-1, -2, -3, 1, 2, 3, 0, 0, 0]);
|
|
2760
|
-
const aabb = computeBindPoseAABB(pos);
|
|
2761
|
-
expect(aabb).toBeDefined();
|
|
2762
|
-
if (!aabb) return;
|
|
2763
|
-
expect(aabb.min).toEqual([-1, -2, -3]);
|
|
2764
|
-
expect(aabb.max).toEqual([1, 2, 3]);
|
|
2765
|
-
});
|
|
2766
2846
|
});
|
|
2767
2847
|
});
|
|
2768
2848
|
}
|
|
@@ -105,7 +105,7 @@ describe('real glTF morph import through Pack and AssetRegistry', () => {
|
|
|
105
105
|
expect(loadedAnimation.ok).toBe(true);
|
|
106
106
|
if (!loadedMesh.ok || !loadedScene.ok || !loadedAnimation.ok) return;
|
|
107
107
|
expect(Array.from(loadedMesh.value.morphWeights ?? [])).toEqual([0, 0]);
|
|
108
|
-
const sceneEntity = loadedScene.value.entities[0];
|
|
108
|
+
const sceneEntity = Object.values(loadedScene.value.entities)[0];
|
|
109
109
|
expect(sceneEntity?.components.MorphWeights?.weights).toEqual([0, 0]);
|
|
110
110
|
expect(loadedAnimation.value.channels[0]?.property).toBe('weights');
|
|
111
111
|
expect(Array.from(loadedAnimation.value.channels[0]?.sampler.output ?? [])).toEqual([
|