@forgeax/engine-gltf 0.1.28 → 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 CHANGED
@@ -228,7 +228,7 @@ When `ImporterRegistry` + `runImport` consumes a glTF source, malformed base64 i
228
228
  > Two submodules: `parse-skin.ts` (skin index dedupe via UUIDv5 + IBM decoding + jointPath derivation) + `parse-animation.ts` (LINEAR/STEP samplers, CUBICSPLINE/morph fail-fast). Called inside `parseGltfWithBin` -> `toAssetPack` which extends sub-asset output from 3 kinds (mesh/material/scene) to 6 (+ skeleton + skin + animation-clip).
229
229
 
230
230
  - **Limitations**: CUBICSPLINE interpolation not supported; morph weight animation not supported; jointPath resolution uses leaf-name first-match (same-name sibling is warn-only).
231
- - **BindPose AABB** derived at importer time (per skinned mesh-primitive, static BindPose) and written to mesh asset metadata for frustum cull; dynamic AABB deferred to OOS-skin-dyn-bounds.
231
+ - **Animated skin bounds** are producer-authored facts. The primary source is `skins[].extras.forgeax.conservativeAnimatedBounds`; `importSettings.conservativeAnimatedBounds[sourceIndex]` is accepted only when source extras do not provide bounds. The importer publishes the six-float bounds on `SkeletonAsset`. If both sources are absent, bounds remain absent and Render keeps the skin on the `cpu-deformation` lane; no BindPose AABB is derived as an animation-bound fallback.
232
232
 
233
233
  ## 4-step runtime recipe (apps/hello/gltf, M5)
234
234
 
package/dist/bridge.d.ts CHANGED
@@ -53,6 +53,13 @@ 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>;
56
63
  }
57
64
  /**
58
65
  * Convert a parsed GltfDoc into a SceneAsset POD. Caller supplies registry
@@ -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,EAIX,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,EAA4B,KAAK,SAAS,EAAe,MAAM,aAAa,CAAC;AACpF,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,UAAU,EACV,UAAU,EAGX,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,SAAS,GAAE;IACT,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnD,QAAQ,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACpD,GACL,MAAM,CAAC,SAAS,EAAE,SAAS,CAAC,CA0V9B;AAED,MAAM,WAAW,iBAAiB;IAChC,oEAAoE;IACpE,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;IACzE,4DAA4D;IAC5D,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAC,CAAC;IACjF;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,uBAAuB,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChE;AA+DD;;;;;;;;;;;;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;IAC1D,QAAQ,CAAC,cAAc,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC;IAChF,0DAA0D;IAC1D,QAAQ,CAAC,cAAc,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC,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"}
package/dist/cli-gltf.mjs CHANGED
@@ -3,7 +3,7 @@ import { realpath, stat, readFile, writeFile, readdir } from 'fs/promises';
3
3
  import { resolve, dirname, join } from 'path';
4
4
  import { fileURLToPath } from 'url';
5
5
  import { parseArgs } from 'util';
6
- import { err, reconcileMeshMaterialSlotTopology, MESH_MATERIAL_SLOT_SOURCE_OVERRIDE_PAYLOAD_SCHEMA, ok, ImportError, IMPORT_ERROR_HINTS } from '@forgeax/engine-types';
6
+ import { err, reconcileMeshMaterialSlotTopology, MESH_MATERIAL_SLOT_SOURCE_OVERRIDE_PAYLOAD_SCHEMA, ok, ImportError, IMPORT_ERROR_HINTS, parseConservativeAnimatedBounds } from '@forgeax/engine-types';
7
7
  import { vec3, quat, mat4 } from '@forgeax/engine-math';
8
8
  import { deriveDefaultLodScreenCoverages, reconcileMeshLodMeta } from '@forgeax/engine-import';
9
9
  import { deriveAnimationTargetId } from '@forgeax/engine-animation/target-id';
@@ -1320,8 +1320,6 @@ function parseGlbChunks(buffer, filePath) {
1320
1320
  ...binChunk === void 0 ? {} : { binChunk }
1321
1321
  });
1322
1322
  }
1323
-
1324
- // src/parse-skin.ts
1325
1323
  var MAX_JOINTS = 256;
1326
1324
  var SKIN_ACCESSOR_TYPES = ["MAT4"];
1327
1325
  function identityMat4() {
@@ -1402,10 +1400,14 @@ function parseSkin(skinsJson, nodesJson, accessors, bufferViews, buffers) {
1402
1400
  if (!pathResult.ok) return err(pathResult.error);
1403
1401
  jointPaths.push(pathResult.value.join("/"));
1404
1402
  }
1403
+ const bounds = parseConservativeAnimatedBounds(
1404
+ skin.extras?.forgeax?.conservativeAnimatedBounds
1405
+ );
1405
1406
  records.push({
1406
1407
  jointCount: joints.length,
1407
1408
  inverseBindMatrices: ibm,
1408
- jointPaths
1409
+ jointPaths,
1410
+ ...bounds === void 0 ? {} : { bounds }
1409
1411
  });
1410
1412
  }
1411
1413
  return ok(records);