@automovie/ingest 0.0.0-stage → 0.0.0
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/LICENSE +21 -0
- package/README.md +37 -2
- package/lib/AUTOMOVIE_GLTF_MOTION_INTERPRETATION_PROFILE.d.ts +5 -0
- package/lib/AUTOMOVIE_GLTF_MOTION_INTERPRETATION_PROFILE.js +8 -0
- package/lib/AUTOMOVIE_GLTF_MOTION_INTERPRETATION_PROFILE.js.map +1 -0
- package/lib/AUTO_MOVIE_EXTERNAL_MODEL_INGEST_PROFILES.d.ts +5 -0
- package/lib/AUTO_MOVIE_EXTERNAL_MODEL_INGEST_PROFILES.js +15 -0
- package/lib/AUTO_MOVIE_EXTERNAL_MODEL_INGEST_PROFILES.js.map +1 -0
- package/lib/AutoMovieExternalModelIngestProfile.d.ts +11 -0
- package/lib/AutoMovieExternalModelIngestProfile.js +3 -0
- package/lib/AutoMovieExternalModelIngestProfile.js.map +1 -0
- package/lib/AutoMovieExternalMotionAdoptionDecision.d.ts +11 -0
- package/lib/AutoMovieExternalMotionAdoptionDecision.js +3 -0
- package/lib/AutoMovieExternalMotionAdoptionDecision.js.map +1 -0
- package/lib/AutoMovieGltfMotionInterpretationProfile.d.ts +9 -0
- package/lib/AutoMovieGltfMotionInterpretationProfile.js +3 -0
- package/lib/AutoMovieGltfMotionInterpretationProfile.js.map +1 -0
- package/lib/IAutoMovieExternalModelInspection.d.ts +48 -0
- package/lib/IAutoMovieExternalModelInspection.js +3 -0
- package/lib/IAutoMovieExternalModelInspection.js.map +1 -0
- package/lib/IAutoMovieExternalModelResource.d.ts +18 -0
- package/lib/IAutoMovieExternalModelResource.js +3 -0
- package/lib/IAutoMovieExternalModelResource.js.map +1 -0
- package/lib/IAutoMovieExternalMotionAdoption.d.ts +23 -0
- package/lib/IAutoMovieExternalMotionAdoption.js +3 -0
- package/lib/IAutoMovieExternalMotionAdoption.js.map +1 -0
- package/lib/IAutoMovieExternalMotionBoneMapping.d.ts +15 -0
- package/lib/IAutoMovieExternalMotionBoneMapping.js +3 -0
- package/lib/IAutoMovieExternalMotionBoneMapping.js.map +1 -0
- package/lib/IAutoMovieExternalMotionInspection.d.ts +25 -0
- package/lib/IAutoMovieExternalMotionInspection.js +3 -0
- package/lib/IAutoMovieExternalMotionInspection.js.map +1 -0
- package/lib/IAutoMovieExternalMotionNativeDecision.d.ts +20 -0
- package/lib/IAutoMovieExternalMotionNativeDecision.js +3 -0
- package/lib/IAutoMovieExternalMotionNativeDecision.js.map +1 -0
- package/lib/IAutoMovieExternalMotionNativeHandoff.d.ts +18 -0
- package/lib/IAutoMovieExternalMotionNativeHandoff.js +3 -0
- package/lib/IAutoMovieExternalMotionNativeHandoff.js.map +1 -0
- package/lib/IAutoMovieExternalMotionNodeInspection.d.ts +21 -0
- package/lib/IAutoMovieExternalMotionNodeInspection.js +3 -0
- package/lib/IAutoMovieExternalMotionNodeInspection.js.map +1 -0
- package/lib/IAutoMovieExternalMotionRetargetDecision.d.ts +24 -0
- package/lib/IAutoMovieExternalMotionRetargetDecision.js +3 -0
- package/lib/IAutoMovieExternalMotionRetargetDecision.js.map +1 -0
- package/lib/IAutoMovieExternalMotionRetargetHandoff.d.ts +22 -0
- package/lib/IAutoMovieExternalMotionRetargetHandoff.js +3 -0
- package/lib/IAutoMovieExternalMotionRetargetHandoff.js.map +1 -0
- package/lib/IAutoMovieExternalMotionSource.d.ts +18 -0
- package/lib/IAutoMovieExternalMotionSource.js +3 -0
- package/lib/IAutoMovieExternalMotionSource.js.map +1 -0
- package/lib/IAutoMovieIngestResult.d.ts +17 -0
- package/lib/IAutoMovieIngestResult.js +3 -0
- package/lib/IAutoMovieIngestResult.js.map +1 -0
- package/lib/adoptAutoMovieExternalMotion.d.ts +32 -0
- package/lib/adoptAutoMovieExternalMotion.js +215 -0
- package/lib/adoptAutoMovieExternalMotion.js.map +1 -0
- package/lib/audio/IAutoMovieDecodedProductionAudioAsset.d.ts +28 -0
- package/lib/audio/IAutoMovieDecodedProductionAudioAsset.js +3 -0
- package/lib/audio/IAutoMovieDecodedProductionAudioAsset.js.map +1 -0
- package/lib/audio/IAutoMovieProductionAudioProcessing.d.ts +18 -0
- package/lib/audio/IAutoMovieProductionAudioProcessing.js +3 -0
- package/lib/audio/IAutoMovieProductionAudioProcessing.js.map +1 -0
- package/lib/audio/IAutoMovieProductionWaveSourceFormat.d.ts +39 -0
- package/lib/audio/IAutoMovieProductionWaveSourceFormat.js +3 -0
- package/lib/audio/IAutoMovieProductionWaveSourceFormat.js.map +1 -0
- package/lib/audio/decodeProductionAudioAsset.d.ts +33 -0
- package/lib/audio/decodeProductionAudioAsset.js +257 -0
- package/lib/audio/decodeProductionAudioAsset.js.map +1 -0
- package/lib/audio/index.d.ts +4 -0
- package/lib/audio/index.js +21 -0
- package/lib/audio/index.js.map +1 -0
- package/lib/decodeAutoMoviePpmImage.d.ts +30 -0
- package/lib/decodeAutoMoviePpmImage.js +84 -0
- package/lib/decodeAutoMoviePpmImage.js.map +1 -0
- package/lib/humanoidSkeleton.d.ts +24 -0
- package/lib/humanoidSkeleton.js +80 -0
- package/lib/humanoidSkeleton.js.map +1 -0
- package/lib/index.d.ts +23 -0
- package/lib/index.js +40 -0
- package/lib/index.js.map +1 -0
- package/lib/ingestDocument.d.ts +23 -0
- package/lib/ingestDocument.js +173 -0
- package/lib/ingestDocument.js.map +1 -0
- package/lib/inspectAutoMovieExternalModelBytes.d.ts +32 -0
- package/lib/inspectAutoMovieExternalModelBytes.js +219 -0
- package/lib/inspectAutoMovieExternalModelBytes.js.map +1 -0
- package/lib/internal/COMPONENT_BYTES.d.ts +2 -0
- package/lib/internal/COMPONENT_BYTES.js +13 -0
- package/lib/internal/COMPONENT_BYTES.js.map +1 -0
- package/lib/internal/IAccessorSource.d.ts +16 -0
- package/lib/internal/IAccessorSource.js +3 -0
- package/lib/internal/IAccessorSource.js.map +1 -0
- package/lib/internal/IExternalModelAccessorReader.d.ts +9 -0
- package/lib/internal/IExternalModelAccessorReader.js +3 -0
- package/lib/internal/IExternalModelAccessorReader.js.map +1 -0
- package/lib/internal/IHumanoidSlot.d.ts +15 -0
- package/lib/internal/IHumanoidSlot.js +3 -0
- package/lib/internal/IHumanoidSlot.js.map +1 -0
- package/lib/internal/IParsedContainer.d.ts +16 -0
- package/lib/internal/IParsedContainer.js +3 -0
- package/lib/internal/IParsedContainer.js.map +1 -0
- package/lib/internal/SHAPE_COMPONENTS.d.ts +6 -0
- package/lib/internal/SHAPE_COMPONENTS.js +25 -0
- package/lib/internal/SHAPE_COMPONENTS.js.map +1 -0
- package/lib/internal/accessorElementByteLength.d.ts +12 -0
- package/lib/internal/accessorElementByteLength.js +28 -0
- package/lib/internal/accessorElementByteLength.js.map +1 -0
- package/lib/internal/accessorReader.d.ts +16 -0
- package/lib/internal/accessorReader.js +52 -0
- package/lib/internal/accessorReader.js.map +1 -0
- package/lib/internal/accessorValues.d.ts +18 -0
- package/lib/internal/accessorValues.js +38 -0
- package/lib/internal/accessorValues.js.map +1 -0
- package/lib/internal/collectExternalResources.d.ts +13 -0
- package/lib/internal/collectExternalResources.js +51 -0
- package/lib/internal/collectExternalResources.js.map +1 -0
- package/lib/internal/compareCodeUnits.d.ts +12 -0
- package/lib/internal/compareCodeUnits.js +17 -0
- package/lib/internal/compareCodeUnits.js.map +1 -0
- package/lib/internal/composeLocalTransform.d.ts +21 -0
- package/lib/internal/composeLocalTransform.js +53 -0
- package/lib/internal/composeLocalTransform.js.map +1 -0
- package/lib/internal/decodeDataUri.d.ts +14 -0
- package/lib/internal/decodeDataUri.js +61 -0
- package/lib/internal/decodeDataUri.js.map +1 -0
- package/lib/internal/decodeGlb.d.ts +13 -0
- package/lib/internal/decodeGlb.js +56 -0
- package/lib/internal/decodeGlb.js.map +1 -0
- package/lib/internal/decodeJson.d.ts +12 -0
- package/lib/internal/decodeJson.js +77 -0
- package/lib/internal/decodeJson.js.map +1 -0
- package/lib/internal/fileExtension.d.ts +12 -0
- package/lib/internal/fileExtension.js +21 -0
- package/lib/internal/fileExtension.js.map +1 -0
- package/lib/internal/finiteTuple.d.ts +14 -0
- package/lib/internal/finiteTuple.js +29 -0
- package/lib/internal/finiteTuple.js.map +1 -0
- package/lib/internal/gltfHumanoidBones.d.ts +15 -0
- package/lib/internal/gltfHumanoidBones.js +39 -0
- package/lib/internal/gltfHumanoidBones.js.map +1 -0
- package/lib/internal/humanoidBoneOfName.d.ts +18 -0
- package/lib/internal/humanoidBoneOfName.js +67 -0
- package/lib/internal/humanoidBoneOfName.js.map +1 -0
- package/lib/internal/inspectExternalModelHierarchy.d.ts +12 -0
- package/lib/internal/inspectExternalModelHierarchy.js +51 -0
- package/lib/internal/inspectExternalModelHierarchy.js.map +1 -0
- package/lib/internal/inspectExternalMotion.d.ts +23 -0
- package/lib/internal/inspectExternalMotion.js +152 -0
- package/lib/internal/inspectExternalMotion.js.map +1 -0
- package/lib/internal/inspectExternalMotionNodes.d.ts +15 -0
- package/lib/internal/inspectExternalMotionNodes.js +58 -0
- package/lib/internal/inspectExternalMotionNodes.js.map +1 -0
- package/lib/internal/integerIndex.d.ts +12 -0
- package/lib/internal/integerIndex.js +23 -0
- package/lib/internal/integerIndex.js.map +1 -0
- package/lib/internal/integerIndices.d.ts +12 -0
- package/lib/internal/integerIndices.js +23 -0
- package/lib/internal/integerIndices.js.map +1 -0
- package/lib/internal/nonNegativeInteger.d.ts +12 -0
- package/lib/internal/nonNegativeInteger.js +22 -0
- package/lib/internal/nonNegativeInteger.js.map +1 -0
- package/lib/internal/object.d.ts +12 -0
- package/lib/internal/object.js +21 -0
- package/lib/internal/object.js.map +1 -0
- package/lib/internal/optionalArray.d.ts +12 -0
- package/lib/internal/optionalArray.js +18 -0
- package/lib/internal/optionalArray.js.map +1 -0
- package/lib/internal/optionalObject.d.ts +12 -0
- package/lib/internal/optionalObject.js +18 -0
- package/lib/internal/optionalObject.js.map +1 -0
- package/lib/internal/optionalStringArray.d.ts +12 -0
- package/lib/internal/optionalStringArray.js +22 -0
- package/lib/internal/optionalStringArray.js.map +1 -0
- package/lib/internal/positiveInteger.d.ts +12 -0
- package/lib/internal/positiveInteger.js +22 -0
- package/lib/internal/positiveInteger.js.map +1 -0
- package/lib/internal/readMotionAccessor.d.ts +15 -0
- package/lib/internal/readMotionAccessor.js +41 -0
- package/lib/internal/readMotionAccessor.js.map +1 -0
- package/lib/internal/requiredArray.d.ts +12 -0
- package/lib/internal/requiredArray.js +21 -0
- package/lib/internal/requiredArray.js.map +1 -0
- package/lib/internal/uniqueStrings.d.ts +12 -0
- package/lib/internal/uniqueStrings.js +18 -0
- package/lib/internal/uniqueStrings.js.map +1 -0
- package/lib/internal/validNodeIndex.d.ts +12 -0
- package/lib/internal/validNodeIndex.js +20 -0
- package/lib/internal/validNodeIndex.js.map +1 -0
- package/lib/internal/validateAccessorRange.d.ts +14 -0
- package/lib/internal/validateAccessorRange.js +37 -0
- package/lib/internal/validateAccessorRange.js.map +1 -0
- package/lib/internal/validateHumanoidSkinning.d.ts +20 -0
- package/lib/internal/validateHumanoidSkinning.js +91 -0
- package/lib/internal/validateHumanoidSkinning.js.map +1 -0
- package/lib/internal/validatePayloadClosure.d.ts +21 -0
- package/lib/internal/validatePayloadClosure.js +74 -0
- package/lib/internal/validatePayloadClosure.js.map +1 -0
- package/lib/internal/validateSparseAccessor.d.ts +14 -0
- package/lib/internal/validateSparseAccessor.js +50 -0
- package/lib/internal/validateSparseAccessor.js.map +1 -0
- package/lib/internal/vrmHumanoidBones.d.ts +15 -0
- package/lib/internal/vrmHumanoidBones.js +132 -0
- package/lib/internal/vrmHumanoidBones.js.map +1 -0
- package/lib/isAutoMovieExternalModelIngestProfile.d.ts +18 -0
- package/lib/isAutoMovieExternalModelIngestProfile.js +24 -0
- package/lib/isAutoMovieExternalModelIngestProfile.js.map +1 -0
- package/package.json +45 -3
- package/src/AUTOMOVIE_GLTF_MOTION_INTERPRETATION_PROFILE.ts +7 -0
- package/src/AUTO_MOVIE_EXTERNAL_MODEL_INGEST_PROFILES.ts +21 -0
- package/src/AutoMovieExternalModelIngestProfile.ts +15 -0
- package/src/AutoMovieExternalMotionAdoptionDecision.ts +14 -0
- package/src/AutoMovieGltfMotionInterpretationProfile.ts +10 -0
- package/src/IAutoMovieExternalModelInspection.ts +62 -0
- package/src/IAutoMovieExternalModelResource.ts +20 -0
- package/src/IAutoMovieExternalMotionAdoption.ts +30 -0
- package/src/IAutoMovieExternalMotionBoneMapping.ts +17 -0
- package/src/IAutoMovieExternalMotionInspection.ts +32 -0
- package/src/IAutoMovieExternalMotionNativeDecision.ts +25 -0
- package/src/IAutoMovieExternalMotionNativeHandoff.ts +22 -0
- package/src/IAutoMovieExternalMotionNodeInspection.ts +26 -0
- package/src/IAutoMovieExternalMotionRetargetDecision.ts +31 -0
- package/src/IAutoMovieExternalMotionRetargetHandoff.ts +28 -0
- package/src/IAutoMovieExternalMotionSource.ts +20 -0
- package/src/IAutoMovieIngestResult.ts +19 -0
- package/src/adoptAutoMovieExternalMotion.ts +387 -0
- package/src/audio/IAutoMovieDecodedProductionAudioAsset.ts +35 -0
- package/src/audio/IAutoMovieProductionAudioProcessing.ts +21 -0
- package/src/audio/IAutoMovieProductionWaveSourceFormat.ts +50 -0
- package/src/audio/decodeProductionAudioAsset.ts +451 -0
- package/src/audio/index.ts +4 -0
- package/src/decodeAutoMoviePpmImage.ts +103 -0
- package/src/humanoidSkeleton.ts +105 -0
- package/src/index.ts +23 -0
- package/src/ingestDocument.ts +242 -0
- package/src/inspectAutoMovieExternalModelBytes.ts +346 -0
- package/src/internal/COMPONENT_BYTES.ts +12 -0
- package/src/internal/IAccessorSource.ts +18 -0
- package/src/internal/IExternalModelAccessorReader.ts +12 -0
- package/src/internal/IHumanoidSlot.ts +17 -0
- package/src/internal/IParsedContainer.ts +18 -0
- package/src/internal/SHAPE_COMPONENTS.ts +27 -0
- package/src/internal/accessorElementByteLength.ts +24 -0
- package/src/internal/accessorReader.ts +76 -0
- package/src/internal/accessorValues.ts +35 -0
- package/src/internal/collectExternalResources.ts +69 -0
- package/src/internal/compareCodeUnits.ts +15 -0
- package/src/internal/composeLocalTransform.ts +56 -0
- package/src/internal/decodeDataUri.ts +70 -0
- package/src/internal/decodeGlb.ts +70 -0
- package/src/internal/decodeJson.ts +76 -0
- package/src/internal/fileExtension.ts +18 -0
- package/src/internal/finiteTuple.ts +33 -0
- package/src/internal/gltfHumanoidBones.ts +48 -0
- package/src/internal/humanoidBoneOfName.ts +75 -0
- package/src/internal/inspectExternalModelHierarchy.ts +61 -0
- package/src/internal/inspectExternalMotion.ts +292 -0
- package/src/internal/inspectExternalMotionNodes.ts +81 -0
- package/src/internal/integerIndex.ts +28 -0
- package/src/internal/integerIndices.ts +24 -0
- package/src/internal/nonNegativeInteger.ts +22 -0
- package/src/internal/object.ts +22 -0
- package/src/internal/optionalArray.ts +17 -0
- package/src/internal/optionalObject.ts +20 -0
- package/src/internal/optionalStringArray.ts +22 -0
- package/src/internal/positiveInteger.ts +22 -0
- package/src/internal/readMotionAccessor.ts +60 -0
- package/src/internal/requiredArray.ts +19 -0
- package/src/internal/uniqueStrings.ts +16 -0
- package/src/internal/validNodeIndex.ts +19 -0
- package/src/internal/validateAccessorRange.ts +53 -0
- package/src/internal/validateHumanoidSkinning.ts +152 -0
- package/src/internal/validatePayloadClosure.ts +116 -0
- package/src/internal/validateSparseAccessor.ts +109 -0
- package/src/internal/vrmHumanoidBones.ts +176 -0
- package/src/isAutoMovieExternalModelIngestProfile.ts +28 -0
package/lib/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./audio"), exports);
|
|
18
|
+
__exportStar(require("./ingestDocument"), exports);
|
|
19
|
+
__exportStar(require("./humanoidSkeleton"), exports);
|
|
20
|
+
__exportStar(require("./IAutoMovieExternalModelResource"), exports);
|
|
21
|
+
__exportStar(require("./IAutoMovieExternalModelInspection"), exports);
|
|
22
|
+
__exportStar(require("./AUTOMOVIE_GLTF_MOTION_INTERPRETATION_PROFILE"), exports);
|
|
23
|
+
__exportStar(require("./IAutoMovieExternalMotionNodeInspection"), exports);
|
|
24
|
+
__exportStar(require("./IAutoMovieExternalMotionInspection"), exports);
|
|
25
|
+
__exportStar(require("./AutoMovieExternalModelIngestProfile"), exports);
|
|
26
|
+
__exportStar(require("./AUTO_MOVIE_EXTERNAL_MODEL_INGEST_PROFILES"), exports);
|
|
27
|
+
__exportStar(require("./isAutoMovieExternalModelIngestProfile"), exports);
|
|
28
|
+
__exportStar(require("./inspectAutoMovieExternalModelBytes"), exports);
|
|
29
|
+
__exportStar(require("./IAutoMovieExternalMotionSource"), exports);
|
|
30
|
+
__exportStar(require("./IAutoMovieExternalMotionBoneMapping"), exports);
|
|
31
|
+
__exportStar(require("./AutoMovieExternalMotionAdoptionDecision"), exports);
|
|
32
|
+
__exportStar(require("./IAutoMovieExternalMotionNativeDecision"), exports);
|
|
33
|
+
__exportStar(require("./IAutoMovieExternalMotionRetargetDecision"), exports);
|
|
34
|
+
__exportStar(require("./IAutoMovieExternalMotionNativeHandoff"), exports);
|
|
35
|
+
__exportStar(require("./IAutoMovieExternalMotionRetargetHandoff"), exports);
|
|
36
|
+
__exportStar(require("./IAutoMovieExternalMotionAdoption"), exports);
|
|
37
|
+
__exportStar(require("./adoptAutoMovieExternalMotion"), exports);
|
|
38
|
+
__exportStar(require("./IAutoMovieIngestResult"), exports);
|
|
39
|
+
__exportStar(require("./decodeAutoMoviePpmImage"), exports);
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,mDAAiC;AACjC,qDAAmC;AACnC,oEAAkD;AAClD,sEAAoD;AACpD,iFAA+D;AAC/D,2EAAyD;AACzD,uEAAqD;AACrD,wEAAsD;AACtD,8EAA4D;AAC5D,0EAAwD;AACxD,uEAAqD;AACrD,mEAAiD;AACjD,wEAAsD;AACtD,4EAA0D;AAC1D,2EAAyD;AACzD,6EAA2D;AAC3D,0EAAwD;AACxD,4EAA0D;AAC1D,qEAAmD;AACnD,iEAA+C;AAC/C,2DAAyC;AACzC,4DAA0C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Document } from "@gltf-transform/core";
|
|
2
|
+
import type { IAutoMovieIngestResult } from "./IAutoMovieIngestResult";
|
|
3
|
+
/**
|
|
4
|
+
* Map a parsed glTF/GLB {@link Document} onto automovie's core node graph and animation clips, with no three.js and no humanoid assumptions.
|
|
5
|
+
*
|
|
6
|
+
* Current repository callers exercise this parsed-document mapper through tests. The production asset inventory uses the separate byte inspector and host loaders; this export does not establish a wired parsed-document runtime import flow.
|
|
7
|
+
*
|
|
8
|
+
* `@gltf-transform/core` parses the bytes headlessly, and this mapper rewrites its structures structurally so props, cameras and characters import the same way. Every node keeps its local TRS, its parent, and the mesh, camera and skin it carries; a skin joint is a `bone` even when it also carries a mesh, then a mesh node is `mesh`, a camera node `camera`, and anything else `group`. Lights are not read. Every animation channel becomes a node track with the glTF sampler's keyframes, its interpolation mapped LINEAR, STEP and CUBICSPLINE to `linear`, `step` and `cubicspline` with an absent one read as LINEAR as glTF specifies, and its values decoded from normalized integers where the accessor declares them. Naming-based humanoid skeleton mapping is the separate {@link humanoidSkeleton} stage.
|
|
9
|
+
*
|
|
10
|
+
* Channel checks refuse no target node, no or unknown target path, no sampler, no input or output data, an unknown interpolation, keyframe times that are not finite, non-negative and strictly increasing, non-finite output values, or an output length that disagrees with the keyframe count, the path's component count and the cubic-spline tangent triple. This is not complete model admission: node TRS, graph/resource membership, duplicate target channels, rotation magnitude and weights against the target morph count are caller premises rather than checks performed here.
|
|
11
|
+
*
|
|
12
|
+
* @param doc Parsed document; it is only read.
|
|
13
|
+
* @returns New arrays the caller owns, sharing no storage with the document.
|
|
14
|
+
*
|
|
15
|
+
* @evidence contracts/development/implementation.md#principled-implementation Node and clip structure is mapped one to one with index ids, kinds follow a fixed precedence of joint, mesh, camera, then group, and each channel is checked against glTF's own sampler rules: an allowed path and interpolation, strictly increasing times, finite values, and output arity of keyframes times components times three for cubic splines; normalized accessors decode through `accessorValues`.
|
|
16
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure The function builds the id, parent, joint and resource-index maps once and maps nodes and animations; `toTrack` owns all channel validation, and the path and interpolation tables enumerate supported sampler vocabulary.
|
|
17
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts An unknown interpolation or target path throws rather than receiving a fallback interpretation, and no fixture-specific node, path or value is special-cased; lights are documented as not read.
|
|
18
|
+
* @evidence contracts/development/common.md#meaningful-documentation The documentation states what each node keeps, the kind precedence, the interpolation mapping, normalized decoding, every refusal, and that the returned arrays share no storage with the document.
|
|
19
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Work follows nodes and child links, meshes, cameras, skins and joints, animations and channels, and all per-track copied keyframe components; resource-index maps are built once and lookups use expected constant-time hash operations.
|
|
20
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Maps are reused within one call over a mutable Document; a sampler shared by channels is copied per track so each track owns its arrays, and no cache coordinates separate calls.
|
|
21
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The lookup maps are local and released on return or throw; the result retains new node records and per-track copies of keyframe data proportional to the document's animation size, owned by the caller, and no handle or task.
|
|
22
|
+
*/
|
|
23
|
+
export declare const ingestDocument: (doc: Document) => IAutoMovieIngestResult;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ingestDocument = void 0;
|
|
4
|
+
const accessorValues_1 = require("./internal/accessorValues");
|
|
5
|
+
/**
|
|
6
|
+
* Map a parsed glTF/GLB {@link Document} onto automovie's core node graph and animation clips, with no three.js and no humanoid assumptions.
|
|
7
|
+
*
|
|
8
|
+
* Current repository callers exercise this parsed-document mapper through tests. The production asset inventory uses the separate byte inspector and host loaders; this export does not establish a wired parsed-document runtime import flow.
|
|
9
|
+
*
|
|
10
|
+
* `@gltf-transform/core` parses the bytes headlessly, and this mapper rewrites its structures structurally so props, cameras and characters import the same way. Every node keeps its local TRS, its parent, and the mesh, camera and skin it carries; a skin joint is a `bone` even when it also carries a mesh, then a mesh node is `mesh`, a camera node `camera`, and anything else `group`. Lights are not read. Every animation channel becomes a node track with the glTF sampler's keyframes, its interpolation mapped LINEAR, STEP and CUBICSPLINE to `linear`, `step` and `cubicspline` with an absent one read as LINEAR as glTF specifies, and its values decoded from normalized integers where the accessor declares them. Naming-based humanoid skeleton mapping is the separate {@link humanoidSkeleton} stage.
|
|
11
|
+
*
|
|
12
|
+
* Channel checks refuse no target node, no or unknown target path, no sampler, no input or output data, an unknown interpolation, keyframe times that are not finite, non-negative and strictly increasing, non-finite output values, or an output length that disagrees with the keyframe count, the path's component count and the cubic-spline tangent triple. This is not complete model admission: node TRS, graph/resource membership, duplicate target channels, rotation magnitude and weights against the target morph count are caller premises rather than checks performed here.
|
|
13
|
+
*
|
|
14
|
+
* @param doc Parsed document; it is only read.
|
|
15
|
+
* @returns New arrays the caller owns, sharing no storage with the document.
|
|
16
|
+
*
|
|
17
|
+
* @evidence contracts/development/implementation.md#principled-implementation Node and clip structure is mapped one to one with index ids, kinds follow a fixed precedence of joint, mesh, camera, then group, and each channel is checked against glTF's own sampler rules: an allowed path and interpolation, strictly increasing times, finite values, and output arity of keyframes times components times three for cubic splines; normalized accessors decode through `accessorValues`.
|
|
18
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure The function builds the id, parent, joint and resource-index maps once and maps nodes and animations; `toTrack` owns all channel validation, and the path and interpolation tables enumerate supported sampler vocabulary.
|
|
19
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts An unknown interpolation or target path throws rather than receiving a fallback interpretation, and no fixture-specific node, path or value is special-cased; lights are documented as not read.
|
|
20
|
+
* @evidence contracts/development/common.md#meaningful-documentation The documentation states what each node keeps, the kind precedence, the interpolation mapping, normalized decoding, every refusal, and that the returned arrays share no storage with the document.
|
|
21
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Work follows nodes and child links, meshes, cameras, skins and joints, animations and channels, and all per-track copied keyframe components; resource-index maps are built once and lookups use expected constant-time hash operations.
|
|
22
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Maps are reused within one call over a mutable Document; a sampler shared by channels is copied per track so each track owns its arrays, and no cache coordinates separate calls.
|
|
23
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The lookup maps are local and released on return or throw; the result retains new node records and per-track copies of keyframe data proportional to the document's animation size, owned by the caller, and no handle or task.
|
|
24
|
+
*/
|
|
25
|
+
const ingestDocument = (doc) => {
|
|
26
|
+
const root = doc.getRoot();
|
|
27
|
+
const gltfNodes = root.listNodes();
|
|
28
|
+
const idByNode = new Map();
|
|
29
|
+
gltfNodes.forEach((node, i) => {
|
|
30
|
+
idByNode.set(node, `node_${i}`);
|
|
31
|
+
});
|
|
32
|
+
const parentByNode = new Map();
|
|
33
|
+
for (const node of gltfNodes)
|
|
34
|
+
for (const child of node.listChildren())
|
|
35
|
+
parentByNode.set(child, node);
|
|
36
|
+
const jointSet = new Set();
|
|
37
|
+
for (const skin of root.listSkins())
|
|
38
|
+
for (const joint of skin.listJoints())
|
|
39
|
+
jointSet.add(joint);
|
|
40
|
+
const meshIds = indexIds(root.listMeshes());
|
|
41
|
+
const cameraIds = indexIds(root.listCameras());
|
|
42
|
+
const skinIds = indexIds(root.listSkins());
|
|
43
|
+
const nodes = gltfNodes.map((node) => {
|
|
44
|
+
const parent = parentByNode.get(node);
|
|
45
|
+
const t = node.getTranslation();
|
|
46
|
+
const r = node.getRotation();
|
|
47
|
+
const s = node.getScale();
|
|
48
|
+
const mesh = node.getMesh();
|
|
49
|
+
const camera = node.getCamera();
|
|
50
|
+
const skin = node.getSkin();
|
|
51
|
+
return {
|
|
52
|
+
id: idByNode.get(node),
|
|
53
|
+
name: node.getName() === "" ? null : node.getName(),
|
|
54
|
+
parent: parent !== undefined ? idByNode.get(parent) : null,
|
|
55
|
+
kind: kindOf(node, jointSet),
|
|
56
|
+
transform: {
|
|
57
|
+
translation: { x: t[0], y: t[1], z: t[2] },
|
|
58
|
+
rotation: { x: r[0], y: r[1], z: r[2], w: r[3] },
|
|
59
|
+
scale: { x: s[0], y: s[1], z: s[2] },
|
|
60
|
+
},
|
|
61
|
+
mesh: mesh !== null ? meshIds.get(mesh) : null,
|
|
62
|
+
camera: camera !== null ? cameraIds.get(camera) : null,
|
|
63
|
+
light: null,
|
|
64
|
+
skin: skin !== null ? skinIds.get(skin) : null,
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
const clips = root
|
|
68
|
+
.listAnimations()
|
|
69
|
+
.map((anim, i) => {
|
|
70
|
+
const tracks = anim
|
|
71
|
+
.listChannels()
|
|
72
|
+
.map((channel) => toTrack(channel, idByNode));
|
|
73
|
+
return {
|
|
74
|
+
id: `clip_${i}`,
|
|
75
|
+
name: anim.getName() === "" ? null : anim.getName(),
|
|
76
|
+
duration: tracks.reduce((max, track) => Math.max(max, track.times[track.times.length - 1]), 0),
|
|
77
|
+
loop: false,
|
|
78
|
+
tracks,
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
return { nodes, clips };
|
|
82
|
+
};
|
|
83
|
+
exports.ingestDocument = ingestDocument;
|
|
84
|
+
/** Components per keyframe for each fixed-width path; `weights` varies. */
|
|
85
|
+
const COMPONENTS = {
|
|
86
|
+
translation: 3,
|
|
87
|
+
rotation: 4,
|
|
88
|
+
scale: 3,
|
|
89
|
+
weights: null,
|
|
90
|
+
};
|
|
91
|
+
const INTERPOLATIONS = {
|
|
92
|
+
LINEAR: "linear",
|
|
93
|
+
STEP: "step",
|
|
94
|
+
CUBICSPLINE: "cubicspline",
|
|
95
|
+
};
|
|
96
|
+
/** Map each item to its decimal list index. */
|
|
97
|
+
const indexIds = (items) => {
|
|
98
|
+
const map = new Map();
|
|
99
|
+
items.forEach((item, i) => {
|
|
100
|
+
map.set(item, `${i}`);
|
|
101
|
+
});
|
|
102
|
+
return map;
|
|
103
|
+
};
|
|
104
|
+
const kindOf = (node, joints) => joints.has(node)
|
|
105
|
+
? "bone"
|
|
106
|
+
: node.getMesh() !== null
|
|
107
|
+
? "mesh"
|
|
108
|
+
: node.getCamera() !== null
|
|
109
|
+
? "camera"
|
|
110
|
+
: "group";
|
|
111
|
+
const toTrack = (channel, idByNode) => {
|
|
112
|
+
const target = channel.getTargetNode();
|
|
113
|
+
if (target === null)
|
|
114
|
+
throw new Error("animation channel must target a node");
|
|
115
|
+
const targetId = idByNode.get(target);
|
|
116
|
+
const fail = (message) => {
|
|
117
|
+
throw new Error(`animation channel for node "${targetId}" ${message}`);
|
|
118
|
+
};
|
|
119
|
+
const targetPath = channel.getTargetPath();
|
|
120
|
+
if (targetPath === null || Object.hasOwn(COMPONENTS, targetPath) === false)
|
|
121
|
+
return fail(`target path must be translation, rotation, scale, or weights, but was ${JSON.stringify(targetPath)}`);
|
|
122
|
+
const path = targetPath;
|
|
123
|
+
const sampler = channel.getSampler();
|
|
124
|
+
if (sampler === null)
|
|
125
|
+
return fail("must have a sampler");
|
|
126
|
+
const input = sampler.getInput();
|
|
127
|
+
if (input === null)
|
|
128
|
+
return fail("must have input times");
|
|
129
|
+
const output = sampler.getOutput();
|
|
130
|
+
if (output === null)
|
|
131
|
+
return fail("must have output values");
|
|
132
|
+
const times = (0, accessorValues_1.accessorValues)(input);
|
|
133
|
+
if (times === null)
|
|
134
|
+
return fail("input times must have data");
|
|
135
|
+
if (times.length === 0)
|
|
136
|
+
return fail("input times must not be empty");
|
|
137
|
+
const values = (0, accessorValues_1.accessorValues)(output);
|
|
138
|
+
if (values === null)
|
|
139
|
+
return fail("output values must have data");
|
|
140
|
+
if (values.length === 0)
|
|
141
|
+
return fail("output values must not be empty");
|
|
142
|
+
// glTF reads an absent interpolation as LINEAR; a sampler built in code
|
|
143
|
+
// without one reports `undefined` despite the declared string type.
|
|
144
|
+
const rawInterpolation = sampler.getInterpolation() ?? "LINEAR";
|
|
145
|
+
const interpolation = Object.hasOwn(INTERPOLATIONS, rawInterpolation)
|
|
146
|
+
? INTERPOLATIONS[rawInterpolation]
|
|
147
|
+
: undefined;
|
|
148
|
+
if (interpolation === undefined)
|
|
149
|
+
return fail(`interpolation must be LINEAR, STEP, or CUBICSPLINE, but was ${JSON.stringify(rawInterpolation)}`);
|
|
150
|
+
for (let i = 0; i < times.length; ++i)
|
|
151
|
+
if (Number.isFinite(times[i]) === false ||
|
|
152
|
+
times[i] < 0 ||
|
|
153
|
+
(i > 0 && times[i] <= times[i - 1]))
|
|
154
|
+
return fail(`input times must be finite, non-negative and strictly increasing, but key ${i} is ${times[i]}`);
|
|
155
|
+
if (values.every(Number.isFinite) === false)
|
|
156
|
+
return fail("output values must be finite");
|
|
157
|
+
const perKeyframeGroup = times.length * (interpolation === "cubicspline" ? 3 : 1);
|
|
158
|
+
const fixed = COMPONENTS[path];
|
|
159
|
+
if (fixed !== null) {
|
|
160
|
+
const expected = perKeyframeGroup * fixed;
|
|
161
|
+
if (values.length !== expected)
|
|
162
|
+
return fail(`${path} output values length must be ${expected}, but was ${values.length}`);
|
|
163
|
+
}
|
|
164
|
+
else if (values.length % perKeyframeGroup !== 0)
|
|
165
|
+
return fail(`weights output values length must be a multiple of ${perKeyframeGroup}, but was ${values.length}`);
|
|
166
|
+
return {
|
|
167
|
+
channel: { kind: "node", node: targetId, path },
|
|
168
|
+
times,
|
|
169
|
+
values,
|
|
170
|
+
interpolation,
|
|
171
|
+
};
|
|
172
|
+
};
|
|
173
|
+
//# sourceMappingURL=ingestDocument.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ingestDocument.js","sourceRoot":"","sources":["../src/ingestDocument.ts"],"names":[],"mappings":";;;AAuBA,8DAA2D;AAE3D;;;;;;;;;;;;;;;;;;;GAmBG;AACI,MAAM,cAAc,GAA8C,CACvE,GAAa,EACW,EAAE;IAC1B,MAAM,IAAI,GAAS,GAAG,CAAC,OAAO,EAAE,CAAC;IACjC,MAAM,SAAS,GAAe,IAAI,CAAC,SAAS,EAAE,CAAC;IAE/C,MAAM,QAAQ,GAA0B,IAAI,GAAG,EAAoB,CAAC;IACpE,SAAS,CAAC,OAAO,CAAC,CAAC,IAAc,EAAE,CAAS,EAAQ,EAAE;QACpD,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;IAClC,CAAC,CAAC,CAAC;IAEH,MAAM,YAAY,GAA4B,IAAI,GAAG,EAAsB,CAAC;IAC5E,KAAK,MAAM,IAAI,IAAI,SAAS;QAC1B,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,YAAY,EAAE;YAAE,YAAY,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAEzE,MAAM,QAAQ,GAAkB,IAAI,GAAG,EAAY,CAAC;IACpD,KAAK,MAAM,I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CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,KAAK;QACzC,OAAO,IAAI,CAAC,8BAA8B,CAAC,CAAC;IAE9C,MAAM,gBAAgB,GACpB,KAAK,CAAC,MAAM,GAAG,CAAC,aAAa,KAAK,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3D,MAAM,KAAK,GAAkB,UAAU,CAAC,IAAI,CAAC,CAAC;IAC9C,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,MAAM,QAAQ,GAAW,gBAAgB,GAAG,KAAK,CAAC;QAClD,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ;YAC5B,OAAO,IAAI,CACT,GAAG,IAAI,iCAAiC,QAAQ,aAAa,MAAM,CAAC,MAAM,EAAE,CAC7E,CAAC;IACN,CAAC;SAAM,IAAI,MAAM,CAAC,MAAM,GAAG,gBAAgB,KAAK,CAAC;QAC/C,OAAO,IAAI,CACT,sDAAsD,gBAAgB,aAAa,MAAM,CAAC,MAAM,EAAE,CACnG,CAAC;IAEJ,OAAO;QACL,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE;QAC/C,KAAK;QACL,MAAM;QACN,aAAa;KACd,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { IAutoMovieExternalModelInspection } from "./IAutoMovieExternalModelInspection";
|
|
2
|
+
/**
|
|
3
|
+
* Parse and validate exact external model bytes before compilation.
|
|
4
|
+
*
|
|
5
|
+
* The container is chosen by the path suffix: `.gltf` is UTF-8 JSON, `.glb` and `.vrm` are GLB 2.0 with one JSON chunk and at most one BIN chunk. JSON that is not strict UTF-8, does not parse, or repeats a member name after escape decoding is refused, because a last-wins duplicate could hide the value another loader reads. The document must declare asset version 2.0 and a forest of nodes; node mesh/skin/child links, scene roots, skin joints, primitive POSITION/indices and buffer/accessor references read here must resolve; buffers, buffer views, accessors, sparse ranges and images must fit their declared and resident bytes; and every non-data buffer sidecar must come back from `resolveResource` with the declared length, while URI images require nonempty bytes. The selected profile then adds its own requirements, as {@link AutoMovieExternalModelIngestProfile} lists. This is a fixed-profile admission gate, not a complete glTF validator: material/texture links and unconsumed attributes are left to host loaders, sparse payload contents and image media formats are not decoded here, and the skin/motion owners state their additional restrictions. The inspector never guesses a profile or repairs input: the first violation throws with the JSON path it concerns.
|
|
6
|
+
*
|
|
7
|
+
* Under `vrm-humanoid-v1`, `VRMC_vrm` is read with VRM 1.0 bone names, so a 1.0-beta file that still writes thumbs the VRM 0.x way is read as 1.0.
|
|
8
|
+
*
|
|
9
|
+
* @param props.path Project-relative source path; its suffix selects the container.
|
|
10
|
+
* @param props.bytes Resident container bytes; they are only read.
|
|
11
|
+
* @param props.profile Caller-selected profile, refused unless supported.
|
|
12
|
+
* @param props.resolveResource Returns a sidecar's bytes for a URI, or `null` when unavailable; it is called once per external buffer and image URI entry, with caller-owned cost and effects.
|
|
13
|
+
* @returns New facts that hold no reference to the input bytes.
|
|
14
|
+
*
|
|
15
|
+
* @evidence contracts/development/implementation.md#principled-implementation The inspector follows the glTF 2.0 and GLB container rules: strict UTF-8 JSON with duplicate members refused by an iterative scan, index validation for the structural and profile fields it reads, forest and cycle checks by iterative parent walks, accessor and sparse ranges from component sizes with matrix column padding, payload lengths against declared buffers, and VRM 0.x thumbs migrated to VRM 1.0 slots by the published rename; the selected profile does not prove complete glTF validity, normalized complete skinning or anatomical correctness, and `VRMC_vrm` 1.0-beta thumb names are read as 1.0.
|
|
16
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure The exported orchestrator sequences structural, payload and profile owners; source-preserving internal splits keep each concern within the file/export limits, while public result types have independent file-named owners.
|
|
17
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Profiles and container suffixes are contract constants, no model or path is special-cased, the alias table is a `Map` so inherited names never resolve, and every refusal is the first violation found rather than a repaired value.
|
|
18
|
+
* @evidence contracts/development/common.md#meaningful-documentation The documentation states how the container is chosen, every structural requirement, the duplicate-member reason, the no-guess no-repair rule, the VRM 1.0-beta limitation, each parameter's role and call frequency, and that the result holds no byte reference.
|
|
19
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Work follows container bytes for UTF-8/JSON and duplicate scanning, declared entries and name text, skinned components, motion values and encoded data URIs, plus full caller resolver work per external URI entry; resource/extension sorting uses O(U log U) and O(X log X) prefix-scanning comparisons. Per-accessor readers resolve views/strides once, and the BIN slice borrows container storage.
|
|
20
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work Within one inspection, a motion accessor is decoded once per accessor and type and shared by every channel that cites it, each track receiving its own copy, and a mesh and skin pair bound on several nodes is weight-checked once; the key is the accessor index or pair, which is valid because the document is immutable during the synchronous call.
|
|
21
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The decoded JSON, payload list, readers and caches live only for the call and are released on return or throw; the result retains copies proportional to resources, slots and motion data, and keeps neither the container nor sidecar bytes.
|
|
22
|
+
*/
|
|
23
|
+
export declare const inspectAutoMovieExternalModelBytes: (props: {
|
|
24
|
+
/** Exact project-relative source path. */
|
|
25
|
+
path: string;
|
|
26
|
+
/** Exact resident container bytes. */
|
|
27
|
+
bytes: Uint8Array;
|
|
28
|
+
/** Caller-selected fixed interpretation profile. */
|
|
29
|
+
profile: string;
|
|
30
|
+
/** Exact sidecar bytes, resolved inside the builder-owned asset namespace. */
|
|
31
|
+
resolveResource?: (uri: string) => Uint8Array | null;
|
|
32
|
+
}) => IAutoMovieExternalModelInspection;
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.inspectAutoMovieExternalModelBytes = void 0;
|
|
4
|
+
const COMPONENT_BYTES_1 = require("./internal/COMPONENT_BYTES");
|
|
5
|
+
const SHAPE_COMPONENTS_1 = require("./internal/SHAPE_COMPONENTS");
|
|
6
|
+
const collectExternalResources_1 = require("./internal/collectExternalResources");
|
|
7
|
+
const decodeGlb_1 = require("./internal/decodeGlb");
|
|
8
|
+
const decodeJson_1 = require("./internal/decodeJson");
|
|
9
|
+
const fileExtension_1 = require("./internal/fileExtension");
|
|
10
|
+
const gltfHumanoidBones_1 = require("./internal/gltfHumanoidBones");
|
|
11
|
+
const inspectExternalModelHierarchy_1 = require("./internal/inspectExternalModelHierarchy");
|
|
12
|
+
const inspectExternalMotion_1 = require("./internal/inspectExternalMotion");
|
|
13
|
+
const integerIndex_1 = require("./internal/integerIndex");
|
|
14
|
+
const integerIndices_1 = require("./internal/integerIndices");
|
|
15
|
+
const nonNegativeInteger_1 = require("./internal/nonNegativeInteger");
|
|
16
|
+
const object_1 = require("./internal/object");
|
|
17
|
+
const optionalArray_1 = require("./internal/optionalArray");
|
|
18
|
+
const optionalObject_1 = require("./internal/optionalObject");
|
|
19
|
+
const optionalStringArray_1 = require("./internal/optionalStringArray");
|
|
20
|
+
const positiveInteger_1 = require("./internal/positiveInteger");
|
|
21
|
+
const requiredArray_1 = require("./internal/requiredArray");
|
|
22
|
+
const uniqueStrings_1 = require("./internal/uniqueStrings");
|
|
23
|
+
const validateAccessorRange_1 = require("./internal/validateAccessorRange");
|
|
24
|
+
const validateHumanoidSkinning_1 = require("./internal/validateHumanoidSkinning");
|
|
25
|
+
const validatePayloadClosure_1 = require("./internal/validatePayloadClosure");
|
|
26
|
+
const validateSparseAccessor_1 = require("./internal/validateSparseAccessor");
|
|
27
|
+
const vrmHumanoidBones_1 = require("./internal/vrmHumanoidBones");
|
|
28
|
+
const isAutoMovieExternalModelIngestProfile_1 = require("./isAutoMovieExternalModelIngestProfile");
|
|
29
|
+
/**
|
|
30
|
+
* Parse and validate exact external model bytes before compilation.
|
|
31
|
+
*
|
|
32
|
+
* The container is chosen by the path suffix: `.gltf` is UTF-8 JSON, `.glb` and `.vrm` are GLB 2.0 with one JSON chunk and at most one BIN chunk. JSON that is not strict UTF-8, does not parse, or repeats a member name after escape decoding is refused, because a last-wins duplicate could hide the value another loader reads. The document must declare asset version 2.0 and a forest of nodes; node mesh/skin/child links, scene roots, skin joints, primitive POSITION/indices and buffer/accessor references read here must resolve; buffers, buffer views, accessors, sparse ranges and images must fit their declared and resident bytes; and every non-data buffer sidecar must come back from `resolveResource` with the declared length, while URI images require nonempty bytes. The selected profile then adds its own requirements, as {@link AutoMovieExternalModelIngestProfile} lists. This is a fixed-profile admission gate, not a complete glTF validator: material/texture links and unconsumed attributes are left to host loaders, sparse payload contents and image media formats are not decoded here, and the skin/motion owners state their additional restrictions. The inspector never guesses a profile or repairs input: the first violation throws with the JSON path it concerns.
|
|
33
|
+
*
|
|
34
|
+
* Under `vrm-humanoid-v1`, `VRMC_vrm` is read with VRM 1.0 bone names, so a 1.0-beta file that still writes thumbs the VRM 0.x way is read as 1.0.
|
|
35
|
+
*
|
|
36
|
+
* @param props.path Project-relative source path; its suffix selects the container.
|
|
37
|
+
* @param props.bytes Resident container bytes; they are only read.
|
|
38
|
+
* @param props.profile Caller-selected profile, refused unless supported.
|
|
39
|
+
* @param props.resolveResource Returns a sidecar's bytes for a URI, or `null` when unavailable; it is called once per external buffer and image URI entry, with caller-owned cost and effects.
|
|
40
|
+
* @returns New facts that hold no reference to the input bytes.
|
|
41
|
+
*
|
|
42
|
+
* @evidence contracts/development/implementation.md#principled-implementation The inspector follows the glTF 2.0 and GLB container rules: strict UTF-8 JSON with duplicate members refused by an iterative scan, index validation for the structural and profile fields it reads, forest and cycle checks by iterative parent walks, accessor and sparse ranges from component sizes with matrix column padding, payload lengths against declared buffers, and VRM 0.x thumbs migrated to VRM 1.0 slots by the published rename; the selected profile does not prove complete glTF validity, normalized complete skinning or anatomical correctness, and `VRMC_vrm` 1.0-beta thumb names are read as 1.0.
|
|
43
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure The exported orchestrator sequences structural, payload and profile owners; source-preserving internal splits keep each concern within the file/export limits, while public result types have independent file-named owners.
|
|
44
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Profiles and container suffixes are contract constants, no model or path is special-cased, the alias table is a `Map` so inherited names never resolve, and every refusal is the first violation found rather than a repaired value.
|
|
45
|
+
* @evidence contracts/development/common.md#meaningful-documentation The documentation states how the container is chosen, every structural requirement, the duplicate-member reason, the no-guess no-repair rule, the VRM 1.0-beta limitation, each parameter's role and call frequency, and that the result holds no byte reference.
|
|
46
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Work follows container bytes for UTF-8/JSON and duplicate scanning, declared entries and name text, skinned components, motion values and encoded data URIs, plus full caller resolver work per external URI entry; resource/extension sorting uses O(U log U) and O(X log X) prefix-scanning comparisons. Per-accessor readers resolve views/strides once, and the BIN slice borrows container storage.
|
|
47
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work Within one inspection, a motion accessor is decoded once per accessor and type and shared by every channel that cites it, each track receiving its own copy, and a mesh and skin pair bound on several nodes is weight-checked once; the key is the accessor index or pair, which is valid because the document is immutable during the synchronous call.
|
|
48
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The decoded JSON, payload list, readers and caches live only for the call and are released on return or throw; the result retains copies proportional to resources, slots and motion data, and keeps neither the container nor sidecar bytes.
|
|
49
|
+
*/
|
|
50
|
+
const inspectAutoMovieExternalModelBytes = (props) => {
|
|
51
|
+
if ((0, isAutoMovieExternalModelIngestProfile_1.isAutoMovieExternalModelIngestProfile)(props.profile) === false)
|
|
52
|
+
throw new Error(`Unsupported external-model ingest profile "${props.profile}".`);
|
|
53
|
+
const profile = props.profile;
|
|
54
|
+
const extension = (0, fileExtension_1.fileExtension)(props.path);
|
|
55
|
+
if (extension !== ".gltf" && extension !== ".glb" && extension !== ".vrm")
|
|
56
|
+
throw new Error(`External model "${props.path}" must end in .gltf, .glb, or .vrm.`);
|
|
57
|
+
const parsed = extension === ".gltf"
|
|
58
|
+
? { json: (0, decodeJson_1.decodeJson)(props.bytes), format: "gltf", bin: null }
|
|
59
|
+
: (0, decodeGlb_1.decodeGlb)(props.bytes, extension === ".vrm");
|
|
60
|
+
const document = (0, object_1.object)(parsed.json, "glTF root");
|
|
61
|
+
const asset = (0, object_1.object)(document.asset, "glTF asset");
|
|
62
|
+
if (asset.version !== "2.0")
|
|
63
|
+
throw new Error('External models must declare glTF asset.version "2.0".');
|
|
64
|
+
const nodes = (0, optionalArray_1.optionalArray)(document.nodes, "nodes");
|
|
65
|
+
const meshes = (0, optionalArray_1.optionalArray)(document.meshes, "meshes");
|
|
66
|
+
const skins = (0, optionalArray_1.optionalArray)(document.skins, "skins");
|
|
67
|
+
const animations = (0, optionalArray_1.optionalArray)(document.animations, "animations");
|
|
68
|
+
const scenes = (0, optionalArray_1.optionalArray)(document.scenes, "scenes");
|
|
69
|
+
const buffers = (0, optionalArray_1.optionalArray)(document.buffers, "buffers");
|
|
70
|
+
const bufferViews = (0, optionalArray_1.optionalArray)(document.bufferViews, "bufferViews");
|
|
71
|
+
const accessors = (0, optionalArray_1.optionalArray)(document.accessors, "accessors");
|
|
72
|
+
const images = (0, optionalArray_1.optionalArray)(document.images, "images");
|
|
73
|
+
nodes.forEach((value, index) => {
|
|
74
|
+
const node = (0, object_1.object)(value, `nodes[${index}]`);
|
|
75
|
+
(0, integerIndex_1.integerIndex)(node.mesh, meshes.length, `nodes[${index}].mesh`);
|
|
76
|
+
(0, integerIndex_1.integerIndex)(node.skin, skins.length, `nodes[${index}].skin`);
|
|
77
|
+
(0, integerIndices_1.integerIndices)(node.children, nodes.length, `nodes[${index}].children`);
|
|
78
|
+
});
|
|
79
|
+
const parentByIndex = (0, inspectExternalModelHierarchy_1.inspectExternalModelHierarchy)(nodes);
|
|
80
|
+
scenes.forEach((value, index) => {
|
|
81
|
+
const path = `scenes[${index}].nodes`;
|
|
82
|
+
const roots = (0, object_1.object)(value, `scenes[${index}]`).nodes;
|
|
83
|
+
(0, integerIndices_1.integerIndices)(roots, nodes.length, path);
|
|
84
|
+
const seen = new Set();
|
|
85
|
+
(0, optionalArray_1.optionalArray)(roots, path).forEach((entry, rootIndex) => {
|
|
86
|
+
const nodeIndex = entry;
|
|
87
|
+
if (seen.has(nodeIndex))
|
|
88
|
+
throw new Error(`${path}[${rootIndex}] repeats root node ${nodeIndex}.`);
|
|
89
|
+
if (parentByIndex[nodeIndex] !== undefined)
|
|
90
|
+
throw new Error(`${path}[${rootIndex}] references non-root node ${nodeIndex}.`);
|
|
91
|
+
seen.add(nodeIndex);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
(0, integerIndex_1.integerIndex)(document.scene, scenes.length, "scene");
|
|
95
|
+
buffers.forEach((value, index) => {
|
|
96
|
+
const buffer = (0, object_1.object)(value, `buffers[${index}]`);
|
|
97
|
+
(0, positiveInteger_1.positiveInteger)(buffer.byteLength, `buffers[${index}].byteLength`);
|
|
98
|
+
if (parsed.format === "gltf" && buffer.uri === undefined)
|
|
99
|
+
throw new Error(`buffers[${index}].uri is required by a JSON glTF container.`);
|
|
100
|
+
});
|
|
101
|
+
meshes.forEach((value, meshIndex) => {
|
|
102
|
+
const mesh = (0, object_1.object)(value, `meshes[${meshIndex}]`);
|
|
103
|
+
const primitives = (0, requiredArray_1.requiredArray)(mesh.primitives, `meshes[${meshIndex}].primitives`);
|
|
104
|
+
if (primitives.length === 0)
|
|
105
|
+
throw new Error(`meshes[${meshIndex}] has no render primitive.`);
|
|
106
|
+
primitives.forEach((primitiveValue, primitiveIndex) => {
|
|
107
|
+
const path = `meshes[${meshIndex}].primitives[${primitiveIndex}]`;
|
|
108
|
+
const primitive = (0, object_1.object)(primitiveValue, path);
|
|
109
|
+
const attributes = (0, object_1.object)(primitive.attributes, `${path}.attributes`);
|
|
110
|
+
(0, integerIndex_1.integerIndex)(attributes.POSITION, accessors.length, `${path}.attributes.POSITION`, true);
|
|
111
|
+
(0, integerIndex_1.integerIndex)(primitive.indices, accessors.length, `${path}.indices`);
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
skins.forEach((value, index) => {
|
|
115
|
+
const skin = (0, object_1.object)(value, `skins[${index}]`);
|
|
116
|
+
const joints = (0, requiredArray_1.requiredArray)(skin.joints, `skins[${index}].joints`);
|
|
117
|
+
if (joints.length === 0)
|
|
118
|
+
throw new Error(`skins[${index}] has no joints.`);
|
|
119
|
+
(0, integerIndices_1.integerIndices)(joints, nodes.length, `skins[${index}].joints`);
|
|
120
|
+
});
|
|
121
|
+
bufferViews.forEach((value, index) => {
|
|
122
|
+
const view = (0, object_1.object)(value, `bufferViews[${index}]`);
|
|
123
|
+
(0, integerIndex_1.integerIndex)(view.buffer, buffers.length, `bufferViews[${index}].buffer`, true);
|
|
124
|
+
(0, positiveInteger_1.positiveInteger)(view.byteLength, `bufferViews[${index}].byteLength`);
|
|
125
|
+
(0, nonNegativeInteger_1.nonNegativeInteger)(view.byteOffset ?? 0, `bufferViews[${index}].byteOffset`);
|
|
126
|
+
if (view.byteStride !== undefined &&
|
|
127
|
+
(typeof view.byteStride !== "number" ||
|
|
128
|
+
Number.isSafeInteger(view.byteStride) === false ||
|
|
129
|
+
view.byteStride < 4 ||
|
|
130
|
+
view.byteStride > 252 ||
|
|
131
|
+
view.byteStride % 4 !== 0))
|
|
132
|
+
throw new Error(`bufferViews[${index}].byteStride must be a 4-byte-aligned integer from 4 through 252.`);
|
|
133
|
+
});
|
|
134
|
+
accessors.forEach((value, index) => {
|
|
135
|
+
const accessor = (0, object_1.object)(value, `accessors[${index}]`);
|
|
136
|
+
(0, integerIndex_1.integerIndex)(accessor.bufferView, bufferViews.length, `accessors[${index}].bufferView`);
|
|
137
|
+
(0, positiveInteger_1.positiveInteger)(accessor.count, `accessors[${index}].count`);
|
|
138
|
+
(0, nonNegativeInteger_1.nonNegativeInteger)(accessor.byteOffset ?? 0, `accessors[${index}].byteOffset`);
|
|
139
|
+
if (typeof accessor.componentType !== "number" ||
|
|
140
|
+
COMPONENT_BYTES_1.COMPONENT_BYTES.has(accessor.componentType) === false ||
|
|
141
|
+
typeof accessor.type !== "string" ||
|
|
142
|
+
Object.hasOwn(SHAPE_COMPONENTS_1.SHAPE_COMPONENTS, accessor.type) === false)
|
|
143
|
+
throw new Error(`accessors[${index}] has an unsupported componentType or shape.`);
|
|
144
|
+
(0, validateAccessorRange_1.validateAccessorRange)(accessor, index, bufferViews);
|
|
145
|
+
(0, validateSparseAccessor_1.validateSparseAccessor)(accessor, index, bufferViews);
|
|
146
|
+
});
|
|
147
|
+
images.forEach((value, index) => {
|
|
148
|
+
const image = (0, object_1.object)(value, `images[${index}]`);
|
|
149
|
+
if (image.uri === undefined)
|
|
150
|
+
(0, integerIndex_1.integerIndex)(image.bufferView, bufferViews.length, `images[${index}].bufferView`, true);
|
|
151
|
+
});
|
|
152
|
+
const extensions = (0, uniqueStrings_1.uniqueStrings)([
|
|
153
|
+
...(0, optionalStringArray_1.optionalStringArray)(document.extensionsUsed, "extensionsUsed"),
|
|
154
|
+
...Object.keys((0, optionalObject_1.optionalObject)(document.extensions, "extensions")),
|
|
155
|
+
]);
|
|
156
|
+
const resources = (0, collectExternalResources_1.collectExternalResources)(buffers, images);
|
|
157
|
+
const payloads = (0, validatePayloadClosure_1.validatePayloadClosure)({
|
|
158
|
+
format: parsed.format,
|
|
159
|
+
bin: parsed.bin,
|
|
160
|
+
buffers,
|
|
161
|
+
bufferViews,
|
|
162
|
+
images,
|
|
163
|
+
resolveResource: props.resolveResource,
|
|
164
|
+
});
|
|
165
|
+
const source = { accessors, bufferViews, payloads };
|
|
166
|
+
const motion = profile === "gltf-motion-v1"
|
|
167
|
+
? (0, inspectExternalMotion_1.inspectExternalMotion)({
|
|
168
|
+
path: props.path,
|
|
169
|
+
byteLength: props.bytes.byteLength,
|
|
170
|
+
animations,
|
|
171
|
+
nodes,
|
|
172
|
+
parentByIndex,
|
|
173
|
+
source,
|
|
174
|
+
})
|
|
175
|
+
: undefined;
|
|
176
|
+
if (profile === "gltf-motion-v1" && motion === undefined)
|
|
177
|
+
throw new Error('Profile "gltf-motion-v1" requires at least one animation.');
|
|
178
|
+
if (profile !== "gltf-motion-v1" && meshes.length === 0)
|
|
179
|
+
throw new Error("External model has no mesh to render or review.");
|
|
180
|
+
const humanoidMapping = profile === "gltf-humanoid-v1"
|
|
181
|
+
? (0, gltfHumanoidBones_1.gltfHumanoidBones)(nodes, skins)
|
|
182
|
+
: profile === "vrm-humanoid-v1"
|
|
183
|
+
? (0, vrmHumanoidBones_1.vrmHumanoidBones)(document, nodes)
|
|
184
|
+
: [];
|
|
185
|
+
if (profile === "gltf-humanoid-v1" &&
|
|
186
|
+
(skins.length === 0 ||
|
|
187
|
+
humanoidMapping.some((slot) => slot.bone === "hips") === false))
|
|
188
|
+
throw new Error('Profile "gltf-humanoid-v1" requires a skin and a normalized hips/pelvis joint.');
|
|
189
|
+
const weightedNodes = profile === "gltf-static-v1" || profile === "gltf-motion-v1"
|
|
190
|
+
? new Set()
|
|
191
|
+
: (0, validateHumanoidSkinning_1.validateHumanoidSkinning)({ nodes, meshes, skins, source });
|
|
192
|
+
const vrm = extensions.some((name) => name === "VRM" || name === "VRMC_vrm");
|
|
193
|
+
if (profile === "vrm-humanoid-v1" &&
|
|
194
|
+
(parsed.format === "gltf" ||
|
|
195
|
+
vrm === false ||
|
|
196
|
+
skins.length === 0 ||
|
|
197
|
+
humanoidMapping.some((slot) => slot.bone === "hips") === false))
|
|
198
|
+
throw new Error('Profile "vrm-humanoid-v1" requires a GLB/VRM container with VRM or VRMC_vrm metadata.');
|
|
199
|
+
return {
|
|
200
|
+
profile,
|
|
201
|
+
format: vrm ? "vrm" : parsed.format,
|
|
202
|
+
version: "2.0",
|
|
203
|
+
counts: {
|
|
204
|
+
nodes: nodes.length,
|
|
205
|
+
meshes: meshes.length,
|
|
206
|
+
skins: skins.length,
|
|
207
|
+
animations: animations.length,
|
|
208
|
+
},
|
|
209
|
+
extensions,
|
|
210
|
+
resources,
|
|
211
|
+
humanoidBones: humanoidMapping.map((slot) => ({
|
|
212
|
+
...slot,
|
|
213
|
+
weighted: weightedNodes.has(slot.node),
|
|
214
|
+
})),
|
|
215
|
+
...(motion === undefined ? {} : { motion }),
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
exports.inspectAutoMovieExternalModelBytes = inspectAutoMovieExternalModelBytes;
|
|
219
|
+
//# sourceMappingURL=inspectAutoMovieExternalModelBytes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inspectAutoMovieExternalModelBytes.js","sourceRoot":"","sources":["../src/inspectAutoMovieExternalModelBytes.ts"],"names":[],"mappings":";;;AAIA,gEAA6D;AAI7D,kEAA+D;AAC/D,kFAA+E;AAC/E,oDAAiD;AACjD,sDAAmD;AACnD,4DAAyD;AACzD,oEAAiE;AACjE,4FAAyF;AACzF,4EAAyE;AACzE,0DAAuD;AACvD,8DAA2D;AAC3D,sEAAmE;AACnE,8CAA2C;AAC3C,4DAAyD;AACzD,8DAA2D;AAC3D,wEAAqE;AACrE,gEAA6D;AAC7D,4DAAyD;AACzD,4DAAyD;AACzD,4EAAyE;AACzE,kFAA+E;AAC/E,8EAA2E;AAC3E,8EAA2E;AAC3E,kEAA+D;AAC/D,mGAAgG;AAEhG;;;;;;;;;;;;;;;;;;;;GAoBG;AACI,MAAM,kCAAkC,GAYL,CAAC,KAY1C,EAAqC,EAAE;IACtC,IAAI,IAAA,6EAAqC,EAAC,KAAK,CAAC,OAAO,CAAC,KAAK,KAAK;QAChE,MAAM,IAAI,KAAK,CACb,8CAA8C,KAAK,CAAC,OAAO,IAAI,CAChE,CAAC;IACJ,MAAM,OAAO,GACX,KAAK,CAAC,OAA8C,CAAC;IACvD,MAAM,SAAS,GAAW,IAAA,6BAAa,EAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACpD,IAAI,SAAS,KAAK,OAAO,IAAI,SAAS,KAAK,MAAM,IAAI,SAAS,KAAK,MAAM;QACvE,MAAM,IAAI,KAAK,CACb,mBAAmB,KAAK,CAAC,IAAI,qCAAqC,CACnE,CAAC;IACJ,MAAM,MAAM,GACV,SAAS,KAA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AAK,CAAC;YAClB,eAAe,CAAC,IAAI,CAClB,CAAC,IAAmB,EAAW,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CACvD,KAAK,KAAK,CAAC;QAEd,MAAM,IAAI,KAAK,CACb,uFAAuF,CACxF,CAAC;IAEJ,OAAO;QACL,OAAO;QACP,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM;QACnC,OAAO,EAAE,KAAK;QACd,MAAM,EAAE;YACN,KAAK,EAAE,KAAK,CAAC,MAAM;YACnB,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,KAAK,EAAE,KAAK,CAAC,MAAM;YACnB,UAAU,EAAE,UAAU,CAAC,MAAM;SAC9B;QACD,UAAU;QACV,SAAS;QACT,aAAa,EAAE,eAAe,CAAC,GAAG,CAChC,CACE,IAAmB,EACyC,EAAE,CAAC,CAAC;YAChE,GAAG,IAAI;YACP,QAAQ,EAAE,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;SACvC,CAAC,CACH;QACD,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;KAC5C,CAAC;AACJ,CAAC,CAAC;AAnSW,QAAA,kCAAkC,GAAlC,kCAAkC,CAmS7C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.COMPONENT_BYTES = void 0;
|
|
4
|
+
/** Bytes per component for each glTF component type. */
|
|
5
|
+
exports.COMPONENT_BYTES = new Map([
|
|
6
|
+
[5120, 1],
|
|
7
|
+
[5121, 1],
|
|
8
|
+
[5122, 2],
|
|
9
|
+
[5123, 2],
|
|
10
|
+
[5125, 4],
|
|
11
|
+
[5126, 4],
|
|
12
|
+
]);
|
|
13
|
+
//# sourceMappingURL=COMPONENT_BYTES.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"COMPONENT_BYTES.js","sourceRoot":"","sources":["../../src/internal/COMPONENT_BYTES.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AAC3C,QAAA,eAAe,GAAgC,IAAI,GAAG,CAGjE;IACA,CAAC,IAAI,EAAE,CAAC,CAAC;IACT,CAAC,IAAI,EAAE,CAAC,CAAC;IACT,CAAC,IAAI,EAAE,CAAC,CAAC;IACT,CAAC,IAAI,EAAE,CAAC,CAAC;IACT,CAAC,IAAI,EAAE,CAAC,CAAC;IACT,CAAC,IAAI,EAAE,CAAC,CAAC;CACV,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One inspector call's admitted accessor metadata and borrowed resident buffers.
|
|
3
|
+
*
|
|
4
|
+
* @evidence contracts/development/design.md#principled-representation Three aligned inventories preserve glTF index references after structure and payload closure checks.
|
|
5
|
+
* @evidence contracts/development/design.md#minimal-and-owned-surface Accessor metadata, views and payload references share one call-local reader input instead of unrelated argument arrays.
|
|
6
|
+
* @evidence contracts/development/design.md#prohibited-design-shortcuts Resident buffers are borrowed rather than copied, and callers must not mutate them during synchronous inspection.
|
|
7
|
+
* @evidence contracts/development/common.md#meaningful-documentation Member comments identify index ordering, admitted offsets and borrowed payload lifetime.
|
|
8
|
+
*/
|
|
9
|
+
export interface IAccessorSource {
|
|
10
|
+
/** Admitted glTF accessor records in source index order. */
|
|
11
|
+
accessors: unknown[];
|
|
12
|
+
/** Admitted byte-view records whose indices resolve inside the payload inventory. */
|
|
13
|
+
bufferViews: unknown[];
|
|
14
|
+
/** Buffers borrowed by readers from the inspector, indexed by declared glTF buffers; data-URI arrays belong to that call and sidecar/BIN bytes remain borrowed from its caller. */
|
|
15
|
+
payloads: Uint8Array[];
|
|
16
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IAccessorSource.js","sourceRoot":"","sources":["../../src/internal/IAccessorSource.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Read one admitted accessor element/component as its decoded numeric value.
|
|
3
|
+
*
|
|
4
|
+
* @evidence contracts/development/design.md#principled-representation The function type fixes numeric indices and output while the creating owner supplies admitted view and format premises.
|
|
5
|
+
* @evidence contracts/development/design.md#minimal-and-owned-surface One reader contract is shared by skin coverage and FLOAT motion copying.
|
|
6
|
+
* @evidence contracts/development/design.md#prohibited-design-shortcuts The callable type does not imply arbitrary component formats or sparse support; the owning factory admits those.
|
|
7
|
+
* @evidence contracts/development/common.md#meaningful-documentation Parameter prose names element/component order and states factory-owned payload/stride constraints.
|
|
8
|
+
*/
|
|
9
|
+
export type IExternalModelAccessorReader = (element: number, component: number) => number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IExternalModelAccessorReader.js","sourceRoot":"","sources":["../../src/internal/IExternalModelAccessorReader.ts"],"names":[],"mappings":""}
|