@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/index.mjs CHANGED
@@ -810,10 +810,7 @@ function gltfDocToSceneAsset(doc, ctx) {
810
810
  components.MeshRenderer = { materials: [] };
811
811
  }
812
812
  if (ir.instancing !== void 0) {
813
- const collectionId = ctx.instanceCollectionIdsByNodeIndex?.get(gltfNodeIdx);
814
- if (collectionId !== void 0) {
815
- components.Instances = { collectionId };
816
- }
813
+ components.Instances = { transforms: ir.instancing.transforms };
817
814
  }
818
815
  if (isCamera) {
819
816
  components.Camera = {
@@ -3695,6 +3692,10 @@ function toAssetPack(doc, existingMeta, source) {
3695
3692
  function isGlbBytes(source) {
3696
3693
  return source.toLowerCase().endsWith(".glb");
3697
3694
  }
3695
+ function parseFailureMessage(prefix, error) {
3696
+ const detail = error.detail === void 0 ? "" : ` detail=${JSON.stringify(error.detail)}`;
3697
+ return `${prefix}: ${error.code} ${error.expected}${detail}`;
3698
+ }
3698
3699
  function publishesCatalogProduct(input) {
3699
3700
  return input.importSettings.geometry !== "procedural";
3700
3701
  }
@@ -3830,7 +3831,7 @@ async function parseDoc(source, bytes, ctx, meshopt) {
3830
3831
  const res2 = await parseGlbForImporter(ab, source, {} );
3831
3832
  if (!res2.ok) {
3832
3833
  if (res2.error instanceof ImportError) return { ok: false, error: res2.error };
3833
- throw new Error(`parseGlb failed: ${res2.error.code} ${res2.error.expected}`);
3834
+ throw new Error(parseFailureMessage("parseGlb failed", res2.error));
3834
3835
  }
3835
3836
  return { ok: true, value: res2.value };
3836
3837
  }
@@ -3858,7 +3859,7 @@ async function parseDoc(source, bytes, ctx, meshopt) {
3858
3859
  );
3859
3860
  if (!res.ok) {
3860
3861
  if (res.error instanceof ImportError) return { ok: false, error: res.error };
3861
- throw new Error(`parseGltf failed: ${res.error.code} ${res.error.expected}`);
3862
+ throw new Error(parseFailureMessage("parseGltf failed", res.error));
3862
3863
  }
3863
3864
  return { ok: true, value: res.value };
3864
3865
  }