@forgeax/engine-gltf 0.1.3 → 0.1.6
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 +18 -11
- package/dist/.tsbuildinfo +1 -1
- package/dist/__tests__/extension-admission.unit.test.d.ts +2 -0
- package/dist/__tests__/extension-admission.unit.test.d.ts.map +1 -0
- package/dist/__tests__/source-key-diagnostics.integration.test.d.ts +2 -0
- package/dist/__tests__/source-key-diagnostics.integration.test.d.ts.map +1 -0
- package/dist/bridge.d.ts +5 -6
- package/dist/bridge.d.ts.map +1 -1
- package/dist/check-extensions.d.ts.map +1 -1
- package/dist/cli-gltf.mjs +32 -16
- package/dist/cli-gltf.mjs.map +1 -1
- package/dist/gltf-importer.d.ts.map +1 -1
- package/dist/importer-entry.mjs +14 -3
- package/dist/importer-entry.mjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +40 -12
- package/dist/index.mjs.map +1 -1
- package/dist/node-file-entry.mjs +5 -1
- package/dist/node-file-entry.mjs.map +1 -1
- package/dist/parse-gltf.d.ts.map +1 -1
- package/dist/source-key.d.ts +26 -4
- package/dist/source-key.d.ts.map +1 -1
- package/package.json +13 -15
- package/src/__tests__/extension-admission.unit.test.ts +19 -0
- package/src/__tests__/gltf.unit.test.ts +1 -1
- package/src/__tests__/material-texture-transform.unit.test.ts +30 -0
- package/src/__tests__/meshopt-real-matrix.integration.test.ts +108 -24
- package/src/__tests__/morph-import.integration.test.ts +31 -44
- package/src/__tests__/source-key-diagnostics.integration.test.ts +140 -0
- package/src/__tests__/source-key-producer.integration.test.ts +10 -2
- package/src/bridge.ts +9 -10
- package/src/check-extensions.ts +8 -4
- package/src/cli-gltf.ts +1 -6
- package/src/gltf-importer.ts +13 -4
- package/src/index.ts +1 -0
- package/src/parse-gltf.ts +7 -5
- package/src/source-key.ts +51 -17
- package/dist/__tests__/asset-runtime-fixture.d.ts +0 -14
- package/dist/__tests__/asset-runtime-fixture.d.ts.map +0 -1
- package/src/__tests__/asset-runtime-fixture.ts +0 -278
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf-importer.d.ts","sourceRoot":"","sources":["../src/gltf-importer.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAEV,QAAQ,EAIR,QAAQ,EAMT,MAAM,uBAAuB,CAAC;AAiB/B,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAqB,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"gltf-importer.d.ts","sourceRoot":"","sources":["../src/gltf-importer.ts"],"names":[],"mappings":"AAoCA,OAAO,KAAK,EAEV,QAAQ,EAIR,QAAQ,EAMT,MAAM,uBAAuB,CAAC;AAiB/B,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAqB,MAAM,iBAAiB,CAAC;AAwTlF,iFAAiF;AACjF,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,cAAc,EACnB,GAAG,EAAE,OAAO,EACZ,kBAAkB,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAC/C,kBAAkB,GAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAa,GAC1D,SAAS,QAAQ,EAAE,CA+BrB;AA2hBD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,8BAA8B,GAAG,QAAQ,CAMrF;AAED,8EAA8E;AAC9E,eAAO,MAAM,YAAY,EAAE,QAA+B,CAAC"}
|
package/dist/importer-entry.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MeshoptDecoder } from 'meshoptimizer';
|
|
2
|
-
import { packMeshBinV4 } from '@forgeax/engine-import';
|
|
2
|
+
import { packMeshBinV4 } from '@forgeax/engine-import/mesh-bin';
|
|
3
3
|
import { AssetGuid } from '@forgeax/engine-pack/guid';
|
|
4
4
|
import { ImportError, toShared, err, ok, reconcileMeshMaterialSlotTopology, IMPORT_ERROR_HINTS, resolveMeshMaterialSlotDefaultGuid, createMaterialError } from '@forgeax/engine-types';
|
|
5
5
|
import { packInterleavedVertexAttributes } from '@forgeax/engine-geometry';
|
|
@@ -1383,7 +1383,11 @@ var EXTENSION_ALLOWLIST = [
|
|
|
1383
1383
|
"EXT_mesh_gpu_instancing",
|
|
1384
1384
|
"EXT_meshopt_compression"
|
|
1385
1385
|
];
|
|
1386
|
-
var SUPPORTED_EXTENSIONS = [
|
|
1386
|
+
var SUPPORTED_EXTENSIONS = [
|
|
1387
|
+
...EXTENSION_ALLOWLIST,
|
|
1388
|
+
"KHR_lights_punctual",
|
|
1389
|
+
"KHR_texture_transform"
|
|
1390
|
+
];
|
|
1387
1391
|
function checkExtensions(json) {
|
|
1388
1392
|
const required = json.extensionsRequired ?? [];
|
|
1389
1393
|
for (const ext of required) {
|
|
@@ -2700,6 +2704,9 @@ async function parseGlbForImporter(buffer, filePath, options = {}) {
|
|
|
2700
2704
|
function isGlbBytes(source) {
|
|
2701
2705
|
return source.toLowerCase().endsWith(".glb");
|
|
2702
2706
|
}
|
|
2707
|
+
function publishesCatalogProduct(input) {
|
|
2708
|
+
return input.importSettings.geometry !== "procedural";
|
|
2709
|
+
}
|
|
2703
2710
|
function previousMaterialSlotTopology(ctx, meshSourceKey) {
|
|
2704
2711
|
if (meshSourceKey === void 0) return void 0;
|
|
2705
2712
|
const value = ctx.sourceOverrides?.[meshSourceKey]?.materialSlots;
|
|
@@ -3346,7 +3353,11 @@ async function importGltf(ctx, meshopt) {
|
|
|
3346
3353
|
return { ok: true, value: { assets: out, sourceDependencies: [] } };
|
|
3347
3354
|
}
|
|
3348
3355
|
function createGltfImporter(meshopt) {
|
|
3349
|
-
return {
|
|
3356
|
+
return {
|
|
3357
|
+
key: "gltf",
|
|
3358
|
+
import: (ctx) => importGltf(ctx, meshopt),
|
|
3359
|
+
capabilities: { catalog: { publish: publishesCatalogProduct } }
|
|
3360
|
+
};
|
|
3350
3361
|
}
|
|
3351
3362
|
|
|
3352
3363
|
// src/importer-entry.ts
|