@forgeax/engine-gltf 0.1.32 → 0.1.34
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/bridge.d.ts +0 -7
- package/dist/bridge.d.ts.map +1 -1
- package/dist/gltf-importer.d.ts.map +1 -1
- package/dist/importer-entry.mjs +7 -6
- package/dist/importer-entry.mjs.map +1 -1
- package/dist/index.mjs +7 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
- package/src/__tests__/bridge.unit.test.ts +12 -8
- package/src/bridge.ts +2 -16
- package/src/gltf-importer.ts +10 -2
package/dist/bridge.d.ts
CHANGED
|
@@ -53,13 +53,6 @@ export interface GltfBridgeContext {
|
|
|
53
53
|
* matching SkinAsset.jointPaths against the spawn subtree to fill Skin.joints[].
|
|
54
54
|
*/
|
|
55
55
|
readonly skeletonGuidBySkinIndex?: ReadonlyMap<number, string>;
|
|
56
|
-
/**
|
|
57
|
-
* glTF node index -> a live renderer-owned instance collection identity.
|
|
58
|
-
* The bridge is intentionally pure and cannot mint collection ids or copy
|
|
59
|
-
* matrix bytes into ECS. Runtime consumers create collections through their
|
|
60
|
-
* Renderer first, then provide this map when lowering the SceneAsset.
|
|
61
|
-
*/
|
|
62
|
-
readonly instanceCollectionIdsByNodeIndex?: ReadonlyMap<number, number>;
|
|
63
56
|
}
|
|
64
57
|
/**
|
|
65
58
|
* Convert a parsed GltfDoc into a SceneAsset POD. Caller supplies registry
|
package/dist/bridge.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EACV,SAAS,EACT,MAAM,EAEN,aAAa,EACb,aAAa,EAEb,SAAS,EAIT,MAAM,EACN,UAAU,EAGX,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,EAA4B,KAAK,SAAS,EAAe,MAAM,aAAa,CAAC;AACpF,OAAO,K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AAC,CAAC;IAChF,8EAA8E;IAC9E,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,CAAC;IACtC;;;;;;;;OAQG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B;AAuKD,wBAAgB,sBAAsB,CACpC,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,SAAS,MAAM,EAAE,GAC/B,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC,CAsC7B;AAED,wBAAgB,6BAA6B,CAC3C,GAAG,EAAE,cAAc,EACnB,IAAI,EAAE,UAAU,EAChB,KAAK,SAAc,GAClB,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC,CAoD7B;AAED,kFAAkF;AAClF,wBAAgB,eAAe,CAAC,GAAG,EAAE,cAAc,EAAE,GAAG,CAAC,EAAE,qBAAqB,GAAG,aAAa,CA2H/F"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gltf-importer.d.ts","sourceRoot":"","sources":["../src/gltf-importer.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAEV,QAAQ,EAIR,QAAQ,EAMT,MAAM,uBAAuB,CAAC;AAoB/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":"AAqCA,OAAO,KAAK,EAEV,QAAQ,EAIR,QAAQ,EAMT,MAAM,uBAAuB,CAAC;AAoB/B,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAqB,MAAM,iBAAiB,CAAC;AAgVlF,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,CA2CrB;AA6oBD;;;;;;;;;;;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
|
@@ -649,10 +649,7 @@ function gltfDocToSceneAsset(doc, ctx) {
|
|
|
649
649
|
components.MeshRenderer = { materials: [] };
|
|
650
650
|
}
|
|
651
651
|
if (ir.instancing !== void 0) {
|
|
652
|
-
|
|
653
|
-
if (collectionId !== void 0) {
|
|
654
|
-
components.Instances = { collectionId };
|
|
655
|
-
}
|
|
652
|
+
components.Instances = { transforms: ir.instancing.transforms };
|
|
656
653
|
}
|
|
657
654
|
if (isCamera) {
|
|
658
655
|
components.Camera = {
|
|
@@ -3316,6 +3313,10 @@ async function parseGlbForImporter(buffer, filePath, options = {}) {
|
|
|
3316
3313
|
function isGlbBytes(source) {
|
|
3317
3314
|
return source.toLowerCase().endsWith(".glb");
|
|
3318
3315
|
}
|
|
3316
|
+
function parseFailureMessage(prefix, error) {
|
|
3317
|
+
const detail = error.detail === void 0 ? "" : ` detail=${JSON.stringify(error.detail)}`;
|
|
3318
|
+
return `${prefix}: ${error.code} ${error.expected}${detail}`;
|
|
3319
|
+
}
|
|
3319
3320
|
function publishesCatalogProduct(input) {
|
|
3320
3321
|
return input.importSettings.geometry !== "procedural";
|
|
3321
3322
|
}
|
|
@@ -3451,7 +3452,7 @@ async function parseDoc(source, bytes, ctx, meshopt) {
|
|
|
3451
3452
|
const res2 = await parseGlbForImporter(ab, source, meshopt === void 0 ? {} : { meshopt });
|
|
3452
3453
|
if (!res2.ok) {
|
|
3453
3454
|
if (res2.error instanceof ImportError) return { ok: false, error: res2.error };
|
|
3454
|
-
throw new Error(
|
|
3455
|
+
throw new Error(parseFailureMessage("parseGlb failed", res2.error));
|
|
3455
3456
|
}
|
|
3456
3457
|
return { ok: true, value: res2.value };
|
|
3457
3458
|
}
|
|
@@ -3479,7 +3480,7 @@ async function parseDoc(source, bytes, ctx, meshopt) {
|
|
|
3479
3480
|
);
|
|
3480
3481
|
if (!res.ok) {
|
|
3481
3482
|
if (res.error instanceof ImportError) return { ok: false, error: res.error };
|
|
3482
|
-
throw new Error(
|
|
3483
|
+
throw new Error(parseFailureMessage("parseGltf failed", res.error));
|
|
3483
3484
|
}
|
|
3484
3485
|
return { ok: true, value: res.value };
|
|
3485
3486
|
}
|