@forgeax/engine-gltf 0.1.3 → 0.1.4
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/dist/.tsbuildinfo +1 -1
- package/dist/gltf-importer.d.ts.map +1 -1
- package/dist/importer-entry.mjs +9 -2
- package/dist/importer-entry.mjs.map +1 -1
- package/dist/index.mjs +9 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -14
- package/src/__tests__/source-key-producer.integration.test.ts +8 -0
- package/src/gltf-importer.ts +12 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forgeax/engine-gltf",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,23 +38,23 @@
|
|
|
38
38
|
"LICENSE"
|
|
39
39
|
],
|
|
40
40
|
"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.
|
|
41
|
+
"@forgeax/engine-animation": "0.1.4",
|
|
42
|
+
"@forgeax/engine-geometry": "0.1.4",
|
|
43
|
+
"@forgeax/engine-import": "0.1.4",
|
|
44
|
+
"@forgeax/engine-math": "0.1.4",
|
|
45
|
+
"@forgeax/engine-pack": "0.1.4",
|
|
46
|
+
"@forgeax/engine-scene": "0.1.4",
|
|
47
|
+
"@forgeax/engine-types": "0.1.4",
|
|
48
48
|
"@webgpu/types": "^0.1.71",
|
|
49
49
|
"meshoptimizer": "^0.20.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@forgeax/engine-assets-runtime": "0.1.
|
|
53
|
-
"@forgeax/engine-ecs": "0.1.
|
|
54
|
-
"@forgeax/engine-geometry": "0.1.
|
|
55
|
-
"@forgeax/engine-picking": "0.1.
|
|
56
|
-
"@forgeax/engine-render": "0.1.
|
|
57
|
-
"@forgeax/engine-runtime": "0.1.
|
|
52
|
+
"@forgeax/engine-assets-runtime": "0.1.4",
|
|
53
|
+
"@forgeax/engine-ecs": "0.1.4",
|
|
54
|
+
"@forgeax/engine-geometry": "0.1.4",
|
|
55
|
+
"@forgeax/engine-picking": "0.1.4",
|
|
56
|
+
"@forgeax/engine-render": "0.1.4",
|
|
57
|
+
"@forgeax/engine-runtime": "0.1.4",
|
|
58
58
|
"@types/node": "^20.14.0"
|
|
59
59
|
},
|
|
60
60
|
"forgeax": {
|
|
@@ -5,6 +5,7 @@ import { validateProducerOutputs } from '@forgeax/engine-pack';
|
|
|
5
5
|
import { scan } from '@forgeax/engine-pack/scanner';
|
|
6
6
|
import { describe, expect, it } from 'vitest';
|
|
7
7
|
import { runCliGltf } from '../cli-gltf.js';
|
|
8
|
+
import { createGltfImporter } from '../gltf-importer.js';
|
|
8
9
|
import type { GltfDoc } from '../parse-gltf.js';
|
|
9
10
|
import { toAssetPack } from '../parse-gltf.js';
|
|
10
11
|
import { serializeMetaJson } from '../serialize-meta.js';
|
|
@@ -72,6 +73,13 @@ function duplicateNamedMeshGltfJson(): Record<string, unknown> {
|
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
describe('glTF producer source-key boundary', () => {
|
|
76
|
+
it('keeps procedural runtime stubs out of the Catalog projection', () => {
|
|
77
|
+
const publish = createGltfImporter().capabilities?.catalog?.publish;
|
|
78
|
+
expect(publish).toBeTypeOf('function');
|
|
79
|
+
expect(publish?.({ importSettings: { geometry: 'procedural' }, subAssets: [] })).toBe(false);
|
|
80
|
+
expect(publish?.({ importSettings: {}, subAssets: [] })).toBe(true);
|
|
81
|
+
});
|
|
82
|
+
|
|
75
83
|
it('returns a structured conflict before publishing duplicate semantic names', () => {
|
|
76
84
|
const result = toAssetPack(duplicateNamedMeshDoc(), undefined, 'duplicate.gltf');
|
|
77
85
|
|
package/src/gltf-importer.ts
CHANGED
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
// gap as `import-produced-no-assets`. A texture sub-asset that fails byte
|
|
33
33
|
// extraction surfaces as `gltf-image-extract-failed` (D-6).
|
|
34
34
|
|
|
35
|
-
import { packMeshBinV4 } from '@forgeax/engine-import';
|
|
35
|
+
import { packMeshBinV4 } from '@forgeax/engine-import/mesh-bin';
|
|
36
36
|
import { AssetGuid as AssetGuidCodec } from '@forgeax/engine-pack/guid';
|
|
37
37
|
import type {
|
|
38
38
|
AssetGuid,
|
|
@@ -75,6 +75,12 @@ function isGlbBytes(source: string): boolean {
|
|
|
75
75
|
return source.toLowerCase().endsWith('.glb');
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
+
function publishesCatalogProduct(input: {
|
|
79
|
+
readonly importSettings: Readonly<Record<string, unknown>>;
|
|
80
|
+
}): boolean {
|
|
81
|
+
return input.importSettings.geometry !== 'procedural';
|
|
82
|
+
}
|
|
83
|
+
|
|
78
84
|
function previousMaterialSlotTopology(
|
|
79
85
|
ctx: ImportContext,
|
|
80
86
|
meshSourceKey: string | undefined,
|
|
@@ -960,7 +966,11 @@ async function importGltf(
|
|
|
960
966
|
* ```
|
|
961
967
|
*/
|
|
962
968
|
export function createGltfImporter(meshopt?: GltfBufferViewDecodeCapability): Importer {
|
|
963
|
-
return {
|
|
969
|
+
return {
|
|
970
|
+
key: 'gltf',
|
|
971
|
+
import: (ctx) => importGltf(ctx, meshopt),
|
|
972
|
+
capabilities: { catalog: { publish: publishesCatalogProduct } },
|
|
973
|
+
};
|
|
964
974
|
}
|
|
965
975
|
|
|
966
976
|
/** Importer for hosts that provide an optional build-only Meshopt decoder. */
|