@automovie/ingest 0.3.4 → 0.4.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/README.md +9 -29
- package/lib/AUTOMOVIE_GLTF_MOTION_INTERPRETATION_PROFILE.d.ts +4 -1
- package/lib/AUTOMOVIE_GLTF_MOTION_INTERPRETATION_PROFILE.js +4 -1
- package/lib/AUTOMOVIE_GLTF_MOTION_INTERPRETATION_PROFILE.js.map +1 -1
- package/lib/AUTO_MOVIE_EXTERNAL_MODEL_INGEST_PROFILES.d.ts +4 -1
- package/lib/AUTO_MOVIE_EXTERNAL_MODEL_INGEST_PROFILES.js +4 -1
- package/lib/AUTO_MOVIE_EXTERNAL_MODEL_INGEST_PROFILES.js.map +1 -1
- package/lib/adoptAutoMovieExternalMotion.d.ts +21 -11
- package/lib/adoptAutoMovieExternalMotion.js +26 -12
- package/lib/adoptAutoMovieExternalMotion.js.map +1 -1
- package/lib/audio/admitProductionTtsReceipt.d.ts +25 -0
- package/lib/audio/admitProductionTtsReceipt.js +166 -0
- package/lib/audio/admitProductionTtsReceipt.js.map +1 -0
- package/lib/audio/decodeProductionAudioAsset.d.ts +42 -14
- package/lib/audio/decodeProductionAudioAsset.js +53 -30
- package/lib/audio/decodeProductionAudioAsset.js.map +1 -1
- package/lib/audio/index.d.ts +1 -0
- package/lib/audio/index.js +1 -0
- package/lib/audio/index.js.map +1 -1
- package/lib/audio/resampleProductionAudio.d.ts +22 -0
- package/lib/audio/resampleProductionAudio.js +103 -0
- package/lib/audio/resampleProductionAudio.js.map +1 -0
- package/lib/decodeAutoMoviePpmImage.d.ts +10 -18
- package/lib/decodeAutoMoviePpmImage.js +10 -18
- package/lib/decodeAutoMoviePpmImage.js.map +1 -1
- package/lib/font/TrueTypeByteReader.d.ts +34 -0
- package/lib/font/TrueTypeByteReader.js +67 -0
- package/lib/font/TrueTypeByteReader.js.map +1 -0
- package/lib/font/decodeAutoMovieTrueTypeFont.d.ts +31 -0
- package/lib/font/decodeAutoMovieTrueTypeFont.js +168 -0
- package/lib/font/decodeAutoMovieTrueTypeFont.js.map +1 -0
- package/lib/font/index.d.ts +1 -0
- package/lib/font/index.js +18 -0
- package/lib/font/index.js.map +1 -0
- package/lib/font/readTrueTypeCharacterMap.d.ts +23 -0
- package/lib/font/readTrueTypeCharacterMap.js +98 -0
- package/lib/font/readTrueTypeCharacterMap.js.map +1 -0
- package/lib/font/readTrueTypeGlyphOutline.d.ts +45 -0
- package/lib/font/readTrueTypeGlyphOutline.js +275 -0
- package/lib/font/readTrueTypeGlyphOutline.js.map +1 -0
- package/lib/font/readTrueTypeKerning.d.ts +19 -0
- package/lib/font/readTrueTypeKerning.js +63 -0
- package/lib/font/readTrueTypeKerning.js.map +1 -0
- package/lib/font/readTrueTypeNames.d.ts +20 -0
- package/lib/font/readTrueTypeNames.js +75 -0
- package/lib/font/readTrueTypeNames.js.map +1 -0
- package/lib/humanoidSkeleton.d.ts +28 -15
- package/lib/humanoidSkeleton.js +28 -15
- package/lib/humanoidSkeleton.js.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/ingestDocument.d.ts +25 -12
- package/lib/ingestDocument.js +25 -12
- package/lib/ingestDocument.js.map +1 -1
- package/lib/inspectAutoMovieExternalModelBytes.d.ts +24 -12
- package/lib/inspectAutoMovieExternalModelBytes.js +24 -12
- package/lib/inspectAutoMovieExternalModelBytes.js.map +1 -1
- package/lib/internal/IAccessorSource.d.ts +11 -8
- package/lib/internal/IExternalModelAccessorReader.d.ts +1 -8
- package/lib/internal/IHumanoidSlot.d.ts +9 -10
- package/lib/internal/IParsedContainer.d.ts +10 -8
- package/lib/internal/SHAPE_COMPONENTS.d.ts +4 -1
- package/lib/internal/SHAPE_COMPONENTS.js +4 -1
- package/lib/internal/SHAPE_COMPONENTS.js.map +1 -1
- package/lib/internal/accessorElementByteLength.d.ts +1 -11
- package/lib/internal/accessorElementByteLength.js +1 -11
- package/lib/internal/accessorElementByteLength.js.map +1 -1
- package/lib/internal/accessorReader.d.ts +5 -9
- package/lib/internal/accessorReader.js +5 -9
- package/lib/internal/accessorReader.js.map +1 -1
- package/lib/internal/accessorValues.d.ts +10 -10
- package/lib/internal/accessorValues.js +10 -10
- package/lib/internal/collectExternalResources.d.ts +1 -11
- package/lib/internal/collectExternalResources.js +1 -11
- package/lib/internal/collectExternalResources.js.map +1 -1
- package/lib/internal/compareCodeUnits.d.ts +1 -11
- package/lib/internal/compareCodeUnits.js +1 -11
- package/lib/internal/compareCodeUnits.js.map +1 -1
- package/lib/internal/composeLocalTransform.d.ts +13 -10
- package/lib/internal/composeLocalTransform.js +13 -10
- package/lib/internal/composeLocalTransform.js.map +1 -1
- package/lib/internal/decodeDataUri.d.ts +4 -9
- package/lib/internal/decodeDataUri.js +4 -9
- package/lib/internal/decodeDataUri.js.map +1 -1
- package/lib/internal/decodeGlb.d.ts +1 -11
- package/lib/internal/decodeGlb.js +1 -11
- package/lib/internal/decodeGlb.js.map +1 -1
- package/lib/internal/decodeJson.d.ts +1 -11
- package/lib/internal/decodeJson.js +10 -12
- package/lib/internal/decodeJson.js.map +1 -1
- package/lib/internal/fileExtension.d.ts +2 -9
- package/lib/internal/fileExtension.js +2 -9
- package/lib/internal/fileExtension.js.map +1 -1
- package/lib/internal/finiteTuple.d.ts +4 -9
- package/lib/internal/finiteTuple.js +4 -9
- package/lib/internal/finiteTuple.js.map +1 -1
- package/lib/internal/gltfHumanoidBones.d.ts +5 -9
- package/lib/internal/gltfHumanoidBones.js +5 -9
- package/lib/internal/gltfHumanoidBones.js.map +1 -1
- package/lib/internal/humanoidBoneOfName.d.ts +7 -9
- package/lib/internal/humanoidBoneOfName.js +7 -9
- package/lib/internal/humanoidBoneOfName.js.map +1 -1
- package/lib/internal/inspectExternalModelHierarchy.d.ts +1 -11
- package/lib/internal/inspectExternalModelHierarchy.js +1 -11
- package/lib/internal/inspectExternalModelHierarchy.js.map +1 -1
- package/lib/internal/inspectExternalMotion.d.ts +8 -9
- package/lib/internal/inspectExternalMotion.js +8 -9
- package/lib/internal/inspectExternalMotion.js.map +1 -1
- package/lib/internal/inspectExternalMotionNodes.d.ts +6 -9
- package/lib/internal/inspectExternalMotionNodes.js +6 -9
- package/lib/internal/inspectExternalMotionNodes.js.map +1 -1
- package/lib/internal/integerIndex.d.ts +1 -11
- package/lib/internal/integerIndex.js +1 -11
- package/lib/internal/integerIndex.js.map +1 -1
- package/lib/internal/integerIndices.d.ts +1 -11
- package/lib/internal/integerIndices.js +1 -11
- package/lib/internal/integerIndices.js.map +1 -1
- package/lib/internal/nonNegativeInteger.d.ts +1 -11
- package/lib/internal/nonNegativeInteger.js +1 -11
- package/lib/internal/nonNegativeInteger.js.map +1 -1
- package/lib/internal/object.d.ts +1 -11
- package/lib/internal/object.js +1 -11
- package/lib/internal/object.js.map +1 -1
- package/lib/internal/optionalArray.d.ts +1 -11
- package/lib/internal/optionalArray.js +1 -11
- package/lib/internal/optionalArray.js.map +1 -1
- package/lib/internal/optionalObject.d.ts +1 -11
- package/lib/internal/optionalObject.js +1 -11
- package/lib/internal/optionalObject.js.map +1 -1
- package/lib/internal/optionalStringArray.d.ts +1 -11
- package/lib/internal/optionalStringArray.js +1 -11
- package/lib/internal/optionalStringArray.js.map +1 -1
- package/lib/internal/positiveInteger.d.ts +1 -11
- package/lib/internal/positiveInteger.js +1 -11
- package/lib/internal/positiveInteger.js.map +1 -1
- package/lib/internal/readMotionAccessor.d.ts +5 -9
- package/lib/internal/readMotionAccessor.js +5 -9
- package/lib/internal/readMotionAccessor.js.map +1 -1
- package/lib/internal/requiredArray.d.ts +1 -11
- package/lib/internal/requiredArray.js +1 -11
- package/lib/internal/requiredArray.js.map +1 -1
- package/lib/internal/uniqueStrings.d.ts +1 -11
- package/lib/internal/uniqueStrings.js +1 -11
- package/lib/internal/uniqueStrings.js.map +1 -1
- package/lib/internal/validNodeIndex.d.ts +1 -11
- package/lib/internal/validNodeIndex.js +1 -11
- package/lib/internal/validNodeIndex.js.map +1 -1
- package/lib/internal/validateAccessorRange.d.ts +6 -9
- package/lib/internal/validateAccessorRange.js +6 -9
- package/lib/internal/validateAccessorRange.js.map +1 -1
- package/lib/internal/validateHumanoidSkinning.d.ts +8 -10
- package/lib/internal/validateHumanoidSkinning.js +8 -10
- package/lib/internal/validateHumanoidSkinning.js.map +1 -1
- package/lib/internal/validatePayloadClosure.d.ts +8 -9
- package/lib/internal/validatePayloadClosure.js +8 -9
- package/lib/internal/validatePayloadClosure.js.map +1 -1
- package/lib/internal/validateSparseAccessor.d.ts +6 -9
- package/lib/internal/validateSparseAccessor.js +6 -9
- package/lib/internal/validateSparseAccessor.js.map +1 -1
- package/lib/internal/vrmHumanoidBones.d.ts +7 -9
- package/lib/internal/vrmHumanoidBones.js +12 -10
- package/lib/internal/vrmHumanoidBones.js.map +1 -1
- package/lib/isAutoMovieExternalModelIngestProfile.d.ts +4 -10
- package/lib/isAutoMovieExternalModelIngestProfile.js +4 -10
- package/lib/isAutoMovieExternalModelIngestProfile.js.map +1 -1
- package/package.json +7 -7
- package/src/AUTOMOVIE_GLTF_MOTION_INTERPRETATION_PROFILE.ts +4 -1
- package/src/AUTO_MOVIE_EXTERNAL_MODEL_INGEST_PROFILES.ts +4 -1
- package/src/adoptAutoMovieExternalMotion.ts +26 -12
- package/src/audio/admitProductionTtsReceipt.ts +262 -0
- package/src/audio/decodeProductionAudioAsset.ts +54 -39
- package/src/audio/index.ts +1 -0
- package/src/audio/resampleProductionAudio.ts +114 -0
- package/src/decodeAutoMoviePpmImage.ts +10 -18
- package/src/font/TrueTypeByteReader.ts +80 -0
- package/src/font/decodeAutoMovieTrueTypeFont.ts +217 -0
- package/src/font/index.ts +1 -0
- package/src/font/readTrueTypeCharacterMap.ts +115 -0
- package/src/font/readTrueTypeGlyphOutline.ts +375 -0
- package/src/font/readTrueTypeKerning.ts +73 -0
- package/src/font/readTrueTypeNames.ts +74 -0
- package/src/humanoidSkeleton.ts +28 -15
- package/src/index.ts +1 -0
- package/src/ingestDocument.ts +25 -12
- package/src/inspectAutoMovieExternalModelBytes.ts +24 -12
- package/src/internal/IAccessorSource.ts +11 -8
- package/src/internal/IExternalModelAccessorReader.ts +1 -8
- package/src/internal/IHumanoidSlot.ts +9 -10
- package/src/internal/IParsedContainer.ts +10 -8
- package/src/internal/SHAPE_COMPONENTS.ts +4 -1
- package/src/internal/accessorElementByteLength.ts +1 -11
- package/src/internal/accessorReader.ts +5 -9
- package/src/internal/accessorValues.ts +10 -10
- package/src/internal/collectExternalResources.ts +1 -11
- package/src/internal/compareCodeUnits.ts +1 -11
- package/src/internal/composeLocalTransform.ts +13 -10
- package/src/internal/decodeDataUri.ts +4 -9
- package/src/internal/decodeGlb.ts +1 -11
- package/src/internal/decodeJson.ts +10 -12
- package/src/internal/fileExtension.ts +2 -9
- package/src/internal/finiteTuple.ts +4 -9
- package/src/internal/gltfHumanoidBones.ts +5 -9
- package/src/internal/humanoidBoneOfName.ts +7 -9
- package/src/internal/inspectExternalModelHierarchy.ts +1 -11
- package/src/internal/inspectExternalMotion.ts +8 -9
- package/src/internal/inspectExternalMotionNodes.ts +6 -9
- package/src/internal/integerIndex.ts +1 -11
- package/src/internal/integerIndices.ts +1 -11
- package/src/internal/nonNegativeInteger.ts +1 -11
- package/src/internal/object.ts +1 -11
- package/src/internal/optionalArray.ts +1 -11
- package/src/internal/optionalObject.ts +1 -11
- package/src/internal/optionalStringArray.ts +1 -11
- package/src/internal/positiveInteger.ts +1 -11
- package/src/internal/readMotionAccessor.ts +5 -9
- package/src/internal/requiredArray.ts +1 -11
- package/src/internal/uniqueStrings.ts +1 -11
- package/src/internal/validNodeIndex.ts +1 -11
- package/src/internal/validateAccessorRange.ts +6 -9
- package/src/internal/validateHumanoidSkinning.ts +8 -10
- package/src/internal/validatePayloadClosure.ts +8 -9
- package/src/internal/validateSparseAccessor.ts +6 -9
- package/src/internal/vrmHumanoidBones.ts +12 -10
- package/src/isAutoMovieExternalModelIngestProfile.ts +4 -10
|
@@ -37,23 +37,35 @@ import { isAutoMovieExternalModelIngestProfile } from "./isAutoMovieExternalMode
|
|
|
37
37
|
/**
|
|
38
38
|
* Parse and validate exact external model bytes before compilation.
|
|
39
39
|
*
|
|
40
|
-
* The container is chosen by the path suffix: `.gltf` is UTF-8 JSON, `.glb` and
|
|
40
|
+
* The container is chosen by the path suffix: `.gltf` is UTF-8 JSON, `.glb` and
|
|
41
|
+
* `.vrm` are GLB 2.0 with one JSON chunk and at most one BIN chunk. JSON that
|
|
42
|
+
* is not strict UTF-8, does not parse, or repeats a member name after escape
|
|
43
|
+
* decoding is refused, because a last-wins duplicate could hide the value
|
|
44
|
+
* another loader reads. The document must declare asset version 2.0 and a
|
|
45
|
+
* forest of nodes; node mesh/skin/child links, scene roots, skin joints,
|
|
46
|
+
* primitive POSITION/indices and buffer/accessor references read here must
|
|
47
|
+
* resolve; buffers, buffer views, accessors, sparse ranges and images must fit
|
|
48
|
+
* their declared and resident bytes; and every non-data buffer sidecar must
|
|
49
|
+
* come back from `resolveResource` with the declared length, while URI images
|
|
50
|
+
* require nonempty bytes. The selected profile then adds its own requirements,
|
|
51
|
+
* as {@link AutoMovieExternalModelIngestProfile} lists. This is a fixed-profile
|
|
52
|
+
* admission gate, not a complete glTF validator: material/texture links and
|
|
53
|
+
* unconsumed attributes are left to host loaders, sparse payload contents and
|
|
54
|
+
* image media formats are not decoded here, and the skin/motion owners state
|
|
55
|
+
* their additional restrictions. The inspector never guesses a profile or
|
|
56
|
+
* repairs input: the first violation throws with the JSON path it concerns.
|
|
41
57
|
*
|
|
42
|
-
* Under `vrm-humanoid-v1`, `VRMC_vrm` is read with VRM 1.0 bone names, so a
|
|
58
|
+
* Under `vrm-humanoid-v1`, `VRMC_vrm` is read with VRM 1.0 bone names, so a
|
|
59
|
+
* 1.0-beta file that still writes thumbs the VRM 0.x way is read as 1.0.
|
|
43
60
|
*
|
|
44
|
-
* @param props.path Project-relative source path; its suffix selects the
|
|
61
|
+
* @param props.path Project-relative source path; its suffix selects the
|
|
62
|
+
* container.
|
|
45
63
|
* @param props.bytes Resident container bytes; they are only read.
|
|
46
64
|
* @param props.profile Caller-selected profile, refused unless supported.
|
|
47
|
-
* @param props.resolveResource Returns a sidecar's bytes for a URI, or `null`
|
|
65
|
+
* @param props.resolveResource Returns a sidecar's bytes for a URI, or `null`
|
|
66
|
+
* when unavailable; it is called once per external buffer and image URI
|
|
67
|
+
* entry, with caller-owned cost and effects.
|
|
48
68
|
* @returns New facts that hold no reference to the input bytes.
|
|
49
|
-
*
|
|
50
|
-
* @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.
|
|
51
|
-
* @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.
|
|
52
|
-
* @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.
|
|
53
|
-
* @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.
|
|
54
|
-
* @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.
|
|
55
|
-
* @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.
|
|
56
|
-
* @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.
|
|
57
69
|
*/
|
|
58
70
|
export const inspectAutoMovieExternalModelBytes: (
|
|
59
71
|
props: IAutoMovieExternalModelInspection.IProps,
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* One inspector call's admitted accessor metadata and borrowed resident
|
|
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.
|
|
2
|
+
* One inspector call's admitted accessor metadata and borrowed resident
|
|
3
|
+
* buffers.
|
|
8
4
|
*/
|
|
9
5
|
export interface IAccessorSource {
|
|
10
6
|
/** Admitted glTF accessor records in source index order. */
|
|
11
7
|
accessors: unknown[];
|
|
12
8
|
|
|
13
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Admitted byte-view records whose indices resolve inside the payload
|
|
11
|
+
* inventory.
|
|
12
|
+
*/
|
|
14
13
|
bufferViews: unknown[];
|
|
15
14
|
|
|
16
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Buffers borrowed by readers from the inspector, indexed by declared glTF
|
|
17
|
+
* buffers; data-URI arrays belong to that call and sidecar/BIN bytes remain
|
|
18
|
+
* borrowed from its caller.
|
|
19
|
+
*/
|
|
17
20
|
payloads: Uint8Array[];
|
|
18
21
|
}
|
|
@@ -1,11 +1,4 @@
|
|
|
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
|
-
*/
|
|
1
|
+
/** Read one admitted accessor element/component as its decoded numeric value. */
|
|
9
2
|
export type IExternalModelAccessorReader = (
|
|
10
3
|
element: number,
|
|
11
4
|
component: number,
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import type { AutoMovieHumanoidBone } from "@automovie/interface";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* One normalized humanoid slot referencing an inspected glTF node index.
|
|
5
|
-
*
|
|
6
|
-
* @evidence contracts/development/design.md#principled-representation The semantic slot union and zero-based node index join metadata conventions to the same admitted node inventory.
|
|
7
|
-
* @evidence contracts/development/design.md#minimal-and-owned-surface One compact relation is shared by glTF name mapping and explicit VRM declarations.
|
|
8
|
-
* @evidence contracts/development/design.md#prohibited-design-shortcuts A slot declaration does not establish positive skin weight; the separate coverage pass supplies that fact.
|
|
9
|
-
* @evidence contracts/development/common.md#meaningful-documentation Member comments identify normalized semantic meaning and index provenance, excluding weight certification.
|
|
10
|
-
*/
|
|
3
|
+
/** One normalized humanoid slot referencing an inspected glTF node index. */
|
|
11
4
|
export interface IHumanoidSlot {
|
|
12
|
-
/**
|
|
5
|
+
/**
|
|
6
|
+
* Normalized humanoid semantic slot declared or resolved by the current
|
|
7
|
+
* profile.
|
|
8
|
+
*/
|
|
13
9
|
bone: AutoMovieHumanoidBone;
|
|
14
10
|
|
|
15
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Zero-based node index admitted against the current source document
|
|
13
|
+
* inventory.
|
|
14
|
+
*/
|
|
16
15
|
node: number;
|
|
17
16
|
}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* One decoded glTF/GLB container with parsed JSON and optional borrowed BIN
|
|
3
|
-
*
|
|
4
|
-
* @evidence contracts/development/design.md#principled-representation JSON owns parsed values while the optional BIN aliases the validated resident GLB chunk.
|
|
5
|
-
* @evidence contracts/development/design.md#minimal-and-owned-surface One framing result separates logical document facts from binary bytes before structural admission.
|
|
6
|
-
* @evidence contracts/development/design.md#prohibited-design-shortcuts A suffix-provided VRM label does not certify VRM metadata; the humanoid profile checks it separately.
|
|
7
|
-
* @evidence contracts/development/common.md#meaningful-documentation Members describe parsed JSON, container family and read-only optional BIN aliasing.
|
|
2
|
+
* One decoded glTF/GLB container with parsed JSON and optional borrowed BIN
|
|
3
|
+
* view.
|
|
8
4
|
*/
|
|
9
5
|
export interface IParsedContainer {
|
|
10
6
|
/** Strictly parsed JSON document awaiting structural/profile admission. */
|
|
11
7
|
json: unknown;
|
|
12
8
|
|
|
13
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Container family selected from the supported path suffix; metadata is
|
|
11
|
+
* checked separately.
|
|
12
|
+
*/
|
|
14
13
|
format: "gltf" | "glb" | "vrm";
|
|
15
14
|
|
|
16
|
-
/**
|
|
15
|
+
/**
|
|
16
|
+
* Read-only view of the optional validated GLB BIN chunk, or null for absent
|
|
17
|
+
* binary payload.
|
|
18
|
+
*/
|
|
17
19
|
bin: Uint8Array | null;
|
|
18
20
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Component counts of glTF scalar, vector and matrix accessor shapes.
|
|
3
3
|
*
|
|
4
|
-
* The fixed glTF shape vocabulary defines scalar/vector width and square-matrix
|
|
4
|
+
* The fixed glTF shape vocabulary defines scalar/vector width and square-matrix
|
|
5
|
+
* component counts used after shape admission. Dense ranges, motion arity and
|
|
6
|
+
* element sizing share this fixed seven-entry table; logical matrix counts do
|
|
7
|
+
* not replace physical column-padding rules.
|
|
5
8
|
*/
|
|
6
9
|
export const SHAPE_COMPONENTS: Readonly<Record<string, number>> = {
|
|
7
10
|
/** One logical scalar component. */
|
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
import { COMPONENT_BYTES } from "./COMPONENT_BYTES";
|
|
2
2
|
import { SHAPE_COMPONENTS } from "./SHAPE_COMPONENTS";
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Compute glTF accessor element storage including matrix-column padding.
|
|
6
|
-
*
|
|
7
|
-
* @evidence contracts/development/implementation.md#principled-implementation Component byte width and logical shape count define dense size; MAT2/MAT3 narrow components pad each column to four bytes.
|
|
8
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure One sizing owner serves dense, sparse and reader stride defaults so storage alignment rules have one representation.
|
|
9
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Padded matrix cases are glTF layout contracts rather than fixture corrections; shape/type admission is a required caller premise.
|
|
10
|
-
* @evidence contracts/development/common.md#meaningful-documentation Prose distinguishes logical component count from physical bytes and names the column-alignment cases.
|
|
11
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms Fixed shape lookup and at most three padding branches require constant time without reading elements.
|
|
12
|
-
* @evidence contracts/development/implementation.md#reuse-equivalent-work All accessor consumers reuse equivalent storage sizing from the same two fixed vocabulary tables.
|
|
13
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The function owns no arrays, byte views or retained state and returns one scalar size.
|
|
14
|
-
*/
|
|
4
|
+
/** Compute glTF accessor element storage including matrix-column padding. */
|
|
15
5
|
export const accessorElementByteLength: (
|
|
16
6
|
componentType: number,
|
|
17
7
|
shape: string,
|
|
@@ -7,15 +7,11 @@ import { object } from "./object";
|
|
|
7
7
|
/**
|
|
8
8
|
* Resolve one admitted accessor's resident component reader.
|
|
9
9
|
*
|
|
10
|
-
* The caller has already checked buffer indices, dense ranges and vector/scalar
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* @evidence contracts/development/common.md#meaningful-documentation Comments give admitted formats, normalized scaling, element/component arguments and borrowed payload lifetime.
|
|
16
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms Reader setup is constant time; each requested component costs one address calculation and one scalar DataView read.
|
|
17
|
-
* @evidence contracts/development/implementation.md#reuse-equivalent-work One resolved view/stride/DataView serves every component of this accessor, avoiding repeated metadata resolution.
|
|
18
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The returned closure borrows one payload until its owning profile finishes; it retains no global reader cache or handle.
|
|
10
|
+
* The caller has already checked buffer indices, dense ranges and vector/scalar
|
|
11
|
+
* layout. Sparse storage and formats other than unsigned byte, unsigned short
|
|
12
|
+
* or FLOAT throw with the supplied role. Element and component indices are
|
|
13
|
+
* caller-owned bounds; the closure borrows the payload and decodes
|
|
14
|
+
* little-endian components, scaling normalized integers by 255 or 65535.
|
|
19
15
|
*/
|
|
20
16
|
export const accessorReader: (
|
|
21
17
|
source: IAccessorSource,
|
|
@@ -3,18 +3,18 @@ import type { Accessor } from "@gltf-transform/core";
|
|
|
3
3
|
/**
|
|
4
4
|
* Read a parsed glTF accessor as plain numbers in the values it means.
|
|
5
5
|
*
|
|
6
|
-
* A normalized integer accessor stores `round(value * max)`, which glTF allows
|
|
6
|
+
* A normalized integer accessor stores `round(value * max)`, which glTF allows
|
|
7
|
+
* for animation outputs (rotation and weights) and, under
|
|
8
|
+
* `KHR_mesh_quantization`, for positions and morph deltas. Copying its raw
|
|
9
|
+
* array would hand consumers 32767 where the file means 1, so such an accessor
|
|
10
|
+
* is decoded element by element through `Accessor.getElement`, which applies
|
|
11
|
+
* glTF's decoding (`max(c / max, -1)` for signed and `c / max` for unsigned
|
|
12
|
+
* components). Every other accessor, including non-normalized quantized
|
|
13
|
+
* integers whose scale lives in the node transform, is copied verbatim.
|
|
7
14
|
*
|
|
8
15
|
* @param accessor Accessor whose data is resident in the parsed document.
|
|
9
|
-
* @returns A new flat array in element order, or `null` when the accessor holds
|
|
10
|
-
*
|
|
11
|
-
* @evidence contracts/development/implementation.md#principled-implementation glTF defines normalized integer decoding per component type, and `Accessor.getElement` applies exactly that, so the helper delegates normalized accessors to it and copies any other accessor verbatim with `Array.from`.
|
|
12
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure One helper serves node animation import and face template import, the two places that copy accessor data into plain number arrays.
|
|
13
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Non-normalized quantized integers are deliberately copied raw because their scale lives in the node transform, and no component type is special-cased beyond glTF's own normalization flag.
|
|
14
|
-
* @evidence contracts/development/common.md#meaningful-documentation The documentation states which accessors glTF lets be normalized, the decoding formulas, the raw-copy case and its reason, the result layout, and what `null` means.
|
|
15
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms Linear in count times element size, with one plain-number result array and one reused element buffer for normalized data; Array.from copies the resident typed array into plain numbers for the non-normalized path.
|
|
16
|
-
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each call creates an independent array; shared animation samplers are deliberately read again per track, and mutable Document data prevents a retained cache without a caller-owned invalidation contract.
|
|
17
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The element buffer is released on return; the result array, proportional to the accessor's component count, is owned by the caller and nothing is retained by the helper.
|
|
16
|
+
* @returns A new flat array in element order, or `null` when the accessor holds
|
|
17
|
+
* no array data; the caller supplies a valid accessor layout.
|
|
18
18
|
*/
|
|
19
19
|
export const accessorValues: (accessor: Accessor) => number[] | null = (
|
|
20
20
|
accessor: Accessor,
|
|
@@ -13,17 +13,7 @@ const externalUri: (value: unknown, path: string) => string | null = (
|
|
|
13
13
|
return value.startsWith("data:") ? null : value;
|
|
14
14
|
};
|
|
15
15
|
|
|
16
|
-
/**
|
|
17
|
-
* Collect exact sidecar URI identities without decoding their payloads.
|
|
18
|
-
*
|
|
19
|
-
* @evidence contracts/development/implementation.md#principled-implementation Buffers preserve declared byte lengths; images carry null lengths, while repeated URIs must agree on role and buffer extent.
|
|
20
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure One URI-keyed map owns conflict detection and deterministic resource ordering shared by every ingest profile.
|
|
21
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Data URIs are excluded, conflicting roles/lengths throw, and URI spelling is preserved rather than normalized into aliases.
|
|
22
|
-
* @evidence contracts/development/common.md#meaningful-documentation Prose identifies exact URI ownership, buffer/image length meaning, conflict behavior and code-unit ordering.
|
|
23
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms B buffers and I images cause B+I expected map operations over exact URI strings; U distinct resources require O(U log U) comparisons, each scanning at most the compared shared prefix, with string identity/hash work dependent on URI text.
|
|
24
|
-
* @evidence contracts/development/implementation.md#reuse-equivalent-work One map coordinates exact URI conflict checks and the final unique inventory; repeated declarations replace their scalar row, while byte resolution remains a separate effectful payload owner.
|
|
25
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Only U scalar resource records survive in the result; the temporary map retains no resident sidecar bytes.
|
|
26
|
-
*/
|
|
16
|
+
/** Collect exact sidecar URI identities without decoding their payloads. */
|
|
27
17
|
export const collectExternalResources: (
|
|
28
18
|
buffers: unknown[],
|
|
29
19
|
images: unknown[],
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compare two exact strings in deterministic JavaScript code-unit order.
|
|
3
|
-
*
|
|
4
|
-
* @evidence contracts/development/implementation.md#principled-implementation Relational string comparison produces negative, zero or positive ordering without locale-dependent collation.
|
|
5
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure One shared comparator serves canonical resource, extension and semantic-mapping inventories.
|
|
6
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No locale, case folding or numeric-suffix convention changes identifier identity.
|
|
7
|
-
* @evidence contracts/development/common.md#meaningful-documentation The description defines exact code-unit order and equality semantics for canonical sorting.
|
|
8
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms Comparison scans at most the shared prefix length with constant extra space.
|
|
9
|
-
* @evidence contracts/development/implementation.md#reuse-equivalent-work All ingest inventory sorts reuse the same ordering rule rather than different locale comparators.
|
|
10
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The comparator allocates no retained arrays, collation handles or comparison cache.
|
|
11
|
-
*/
|
|
1
|
+
/** Compare two exact strings in deterministic JavaScript code-unit order. */
|
|
12
2
|
export const compareCodeUnits: (left: string, right: string) => number = (
|
|
13
3
|
left: string,
|
|
14
4
|
right: string,
|
|
@@ -3,21 +3,24 @@ import type { IAutoMovieTransform } from "@automovie/interface";
|
|
|
3
3
|
/**
|
|
4
4
|
* Compose a parent-local TRS over a child-local TRS into one local transform.
|
|
5
5
|
*
|
|
6
|
-
* Folding a skipped helper node into the bone beneath it needs this, so the
|
|
6
|
+
* Folding a skipped helper node into the bone beneath it needs this, so the
|
|
7
|
+
* emitted rest stays relative to the nearest kept ancestor. The result is the
|
|
8
|
+
* standard rig decomposition `t = t_p + R_p (s_p * t_c)`, `r = r_p r_c`, `s =
|
|
9
|
+
* s_p * s_c` with component-wise scale products. With unit quaternions,
|
|
10
|
+
* translation follows affine composition and rotation and scale match its TRS
|
|
11
|
+
* representation when the parent scale commutes with the child rotation, as a
|
|
12
|
+
* uniform parent scale or an identity child rotation does. Otherwise the
|
|
13
|
+
* product contains shear that this TRS representation drops. Floating-point
|
|
14
|
+
* rounding remains, and a non-unit parent quaternion invalidates the rotation
|
|
15
|
+
* formula rather than applying a uniform scale.
|
|
7
16
|
*
|
|
8
|
-
* The arithmetic order is fixed, so the same inputs produce bit-identical
|
|
17
|
+
* The arithmetic order is fixed, so the same inputs produce bit-identical
|
|
18
|
+
* output, which lets an external-motion source rig be compared with exact
|
|
19
|
+
* equality against the inspected basis.
|
|
9
20
|
*
|
|
10
21
|
* @param parent Transform of the node nearer the root.
|
|
11
22
|
* @param child Transform expressed in `parent`'s space.
|
|
12
23
|
* @returns A new transform expressing `child` in the space `parent` lives in.
|
|
13
|
-
*
|
|
14
|
-
* @evidence contracts/development/implementation.md#principled-implementation Translation applies parent scale, unit-quaternion rotation through `v + w t + q x t` with `t = 2 q x v`, then offset; rotation uses the Hamilton product and scale is component-wise. In real arithmetic this represents the affine product when parent scale commutes with child rotation; binary64 rounding remains, and other products discard shear.
|
|
15
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure Humanoid import and motion adoption share one composition function, with callers responsible for the unit-quaternion premise.
|
|
16
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The fixed scalar arithmetic permits exact recomputation of an inspected basis within this pipeline; it neither normalizes quaternions nor repairs shear or non-finite inputs.
|
|
17
|
-
* @evidence contracts/development/common.md#meaningful-documentation The documentation states why helpers are folded, the formula, when it is exact and what it drops, the unit-rotation premise, and that fixed arithmetic order makes exact comparison reproducible.
|
|
18
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms Fixed scalar arithmetic allocates one transform with three component records and no intermediate vectors, independent of rig size.
|
|
19
|
-
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work A constant-time pure function has nothing worth caching; callers fold each helper once per bone.
|
|
20
|
-
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources The function retains nothing; its single result object belongs to the caller.
|
|
21
24
|
*/
|
|
22
25
|
export const composeLocalTransform: (
|
|
23
26
|
parent: IAutoMovieTransform,
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Decode an RFC 2397 data URI into exact payload octets.
|
|
3
3
|
*
|
|
4
|
-
* Canonical base64 spelling includes zero unused padding bits under RFC 4648
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Malformed base64 and incomplete escapes throw with the field path instead of permissive byte repair.
|
|
9
|
-
* @evidence contracts/development/common.md#meaningful-documentation Prose explains metadata/base64 selection, percent octets, Unicode literals and caller-owned output.
|
|
10
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms Metadata and payload text drive O(N) work over URI length; percent chunks plus final concatenation retain O(N) temporary bytes, while base64 also creates an intermediate binary string.
|
|
11
|
-
* @evidence contracts/development/implementation.md#reuse-equivalent-work Each declared data URI is decoded during its own payload admission; resolver effects and mutable sources are not cached.
|
|
12
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Decoded arrays transfer to the inspector's call-local payload owner; chunk arrays and encoded literals die on return.
|
|
4
|
+
* Canonical base64 spelling includes zero unused padding bits under RFC 4648
|
|
5
|
+
* section 3.5 (https://www.rfc-editor.org/rfc/rfc4648.html#section-3.5);
|
|
6
|
+
* complete percent-octet escapes determine bytes, and literal Unicode chunks
|
|
7
|
+
* are encoded as UTF-8.
|
|
13
8
|
*/
|
|
14
9
|
export const decodeDataUri: (uri: string, path: string) => Uint8Array = (
|
|
15
10
|
uri: string,
|
|
@@ -7,17 +7,7 @@ const GLB_JSON_CHUNK: number = 0x4e4f534a;
|
|
|
7
7
|
|
|
8
8
|
const GLB_BIN_CHUNK: number = 0x004e4942;
|
|
9
9
|
|
|
10
|
-
/**
|
|
11
|
-
* Decode one GLB 2.0 container's mandatory JSON and optional BIN chunk.
|
|
12
|
-
*
|
|
13
|
-
* @evidence contracts/development/implementation.md#principled-implementation Magic, version, exact length, four-byte chunk alignment and JSON-first ordering establish the container; BIN remains a read-only input view.
|
|
14
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure Container framing belongs here while strict JSON and duplicate-member checks belong to the shared JSON decoder.
|
|
15
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Unexpected or repeated trailing chunks and invalid extents throw rather than truncating or guessing a payload.
|
|
16
|
-
* @evidence contracts/development/common.md#meaningful-documentation Comments give version/alignment rules, optional BIN aliasing and suffix-provided VRM container identity.
|
|
17
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms Header/chunk scanning is O(chunk count); JSON decoding is O(JSON bytes), and BIN bytes are not copied.
|
|
18
|
-
* @evidence contracts/development/implementation.md#reuse-equivalent-work The same decoded JSON owner serves both GLB and plain glTF; one BIN view is reused by downstream payload readers.
|
|
19
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The parsed result borrows BIN bytes only during synchronous inspection; JSON objects and view references are call-local.
|
|
20
|
-
*/
|
|
10
|
+
/** Decode one GLB 2.0 container's mandatory JSON and optional BIN chunk. */
|
|
21
11
|
export const decodeGlb: (
|
|
22
12
|
bytes: Uint8Array,
|
|
23
13
|
vrmExtension: boolean,
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Decode strict UTF-8 JSON and refuse duplicate decoded member names.
|
|
3
|
-
*
|
|
4
|
-
* @evidence contracts/development/implementation.md#principled-implementation JSON.parse admits syntax before an iterative container/name scan rejects escaped-equivalent duplicates without recursion depth limits.
|
|
5
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure UTF-8, syntax and duplicate-member admission form one byte ingress shared by glTF and GLB.
|
|
6
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Last-wins duplicate keys cannot hide a competing loader interpretation, and invalid UTF-8 is not repaired.
|
|
7
|
-
* @evidence contracts/development/common.md#meaningful-documentation Prose names strict decoding, escape-equivalent duplication, iterative depth behavior and diagnostic wrapping.
|
|
8
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms Text length drives O(N) parsing and duplicate scan; object name sets and scope stack scale with input members and depth.
|
|
9
|
-
* @evidence contracts/development/implementation.md#reuse-equivalent-work Syntax is parsed once and reused by the duplicate scan's valid-text premise; escaped names alone require local JSON string decoding.
|
|
10
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Text, scope stack and key sets are temporary; only the caller-owned parsed JSON tree survives return.
|
|
11
|
-
*/
|
|
1
|
+
/** Decode strict UTF-8 JSON and refuse duplicate decoded member names. */
|
|
12
2
|
export const decodeJson: (bytes: Uint8Array) => unknown = (
|
|
13
3
|
bytes: Uint8Array,
|
|
14
4
|
): unknown => {
|
|
@@ -29,7 +19,15 @@ export const decodeJson: (bytes: Uint8Array) => unknown = (
|
|
|
29
19
|
/**
|
|
30
20
|
* Refuse decoded-equivalent member names before last-wins JSON can hide one.
|
|
31
21
|
*
|
|
32
|
-
* The scan runs only over text `JSON.parse` has already accepted, so it needs
|
|
22
|
+
* The scan runs only over text `JSON.parse` has already accepted, so it needs
|
|
23
|
+
* no syntax checks: one pass keeps a stack of open containers, with a name set
|
|
24
|
+
* for each object, and treats the string after `{` or after `,` inside an
|
|
25
|
+
* object as a member name. A name containing an escape is decoded through
|
|
26
|
+
* `JSON.parse`, so an escaped spelling collides with its plain spelling. The
|
|
27
|
+
* stack replaces recursion, so nesting depth never becomes call-stack depth. It
|
|
28
|
+
* lives here rather than reusing the production package's structured JSON
|
|
29
|
+
* ingress because production sits above ingest in the dependency graph;
|
|
30
|
+
* importing its ingress would reverse that package dependency.
|
|
33
31
|
*/
|
|
34
32
|
const assertUniqueJsonObjectMembers: (text: string) => void = (
|
|
35
33
|
text: string,
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Read the case-insensitive suffix of the final project-relative path
|
|
3
|
-
*
|
|
4
|
-
* @evidence contracts/development/implementation.md#principled-implementation The last forward slash selects the contract's project-path basename and the last dot selects its extension.
|
|
5
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure Suffix interpretation stays separate from container decoding and profile selection.
|
|
6
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No suffix is inferred from byte content and a basename without a dot stays extensionless.
|
|
7
|
-
* @evidence contracts/development/common.md#meaningful-documentation Documentation identifies project-relative slash convention, case folding and the empty-suffix result.
|
|
8
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms Two last-index searches and one suffix lowercase copy cost O(path length) without filesystem access.
|
|
9
|
-
* @evidence contracts/development/implementation.md#reuse-equivalent-work Each inspection derives its suffix once before selecting the container parser.
|
|
10
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Only temporary substrings are allocated; paths, file handles and container bytes are not retained.
|
|
2
|
+
* Read the case-insensitive suffix of the final project-relative path
|
|
3
|
+
* component.
|
|
11
4
|
*/
|
|
12
5
|
export const fileExtension: (value: string) => string = (
|
|
13
6
|
value: string,
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Read a finite numeric tuple with a glTF default when omitted.
|
|
3
3
|
*
|
|
4
|
-
* Undefined copies the caller's fallback without validating it; motion-node
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Wrong lengths and nonfinite values throw; supplied tuples are not normalized or padded to hide defects.
|
|
9
|
-
* @evidence contracts/development/common.md#meaningful-documentation Comments identify omission, caller-owned copied output and indexed finite-value errors.
|
|
10
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms Tuple length K drives O(K) time and result space; current callers use only three or four components.
|
|
11
|
-
* @evidence contracts/development/implementation.md#reuse-equivalent-work The same tuple admission serves translation, rotation and scale without cross-call caching of mutable inputs.
|
|
12
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The returned K-number array belongs to its caller and retains no reference to the source or fallback array.
|
|
4
|
+
* Undefined copies the caller's fallback without validating it; motion-node
|
|
5
|
+
* callers supply finite three- or four-component glTF defaults. Present arrays
|
|
6
|
+
* must have the same length and finite numeric entries, or throw with the
|
|
7
|
+
* field/index path. Both branches return a fresh array.
|
|
13
8
|
*/
|
|
14
9
|
export const finiteTuple: (
|
|
15
10
|
value: unknown,
|
|
@@ -8,15 +8,11 @@ import { requiredArray } from "./requiredArray";
|
|
|
8
8
|
/**
|
|
9
9
|
* Resolve first-claim glTF skin joints to recognized humanoid naming slots.
|
|
10
10
|
*
|
|
11
|
-
* The caller has admitted skin joint indices. Nodes are visited in source
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* @evidence contracts/development/common.md#meaningful-documentation Comments state node-order first claim, skin-only eligibility and the distinction from actual weight coverage.
|
|
17
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms Work follows skins, their joint entries, nodes and eligible node-name text, with expected constant-time membership and slot lookups.
|
|
18
|
-
* @evidence contracts/development/implementation.md#reuse-equivalent-work Each eligible node name is resolved once; the inspector separately shares mesh/skin weight checks.
|
|
19
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Temporary membership sets die with the call; returned slot records are bounded by the recognized humanoid vocabulary.
|
|
11
|
+
* The caller has admitted skin joint indices. Nodes are visited in source
|
|
12
|
+
* order, eligible only when listed in a skin, with the first recognized name
|
|
13
|
+
* per slot retained; unrecognized names and later duplicate slots are ignored.
|
|
14
|
+
* Returned slots describe naming correspondence rather than anatomy or positive
|
|
15
|
+
* skin-weight coverage.
|
|
20
16
|
*/
|
|
21
17
|
export const gltfHumanoidBones: (
|
|
22
18
|
nodes: unknown[],
|
|
@@ -3,18 +3,16 @@ import type { AutoMovieHumanoidBone } from "@automovie/interface";
|
|
|
3
3
|
/**
|
|
4
4
|
* Resolve an imported joint name to the humanoid slot its rig convention means.
|
|
5
5
|
*
|
|
6
|
-
* The name is lowercased, a leading `mixamorig` prefix (with or without its
|
|
6
|
+
* The name is lowercased, a leading `mixamorig` prefix (with or without its
|
|
7
|
+
* colon) is removed, and whitespace, `_`, `.`, `:`, `|` and `-` are dropped, so
|
|
8
|
+
* `mixamorig:LeftUpLeg`, `Left_UpLeg` and `leftUpLeg` all read as `leftupleg`.
|
|
9
|
+
* The table covers the supported Blender-style names (`Spine`, `LeftUpLeg`),
|
|
10
|
+
* Mixamo, VRM-style slot names (`leftUpperArm`), and Unreal mannequin spine
|
|
11
|
+
* chains (`spine_01` to `spine_03`). Fingers, eyes and jaw have no alias, so a
|
|
12
|
+
* hand rig maps only to its hand slot.
|
|
7
13
|
*
|
|
8
14
|
* @param name Joint node name exactly as the source declares it.
|
|
9
15
|
* @returns The slot, or `undefined` when no convention in the table names it.
|
|
10
|
-
*
|
|
11
|
-
* @evidence contracts/development/implementation.md#principled-implementation Lowercasing, removing a leading `mixamorig` prefix and dropping separator characters reduces each convention's spelling to one key, and an exact `Map` lookup resolves it, so inherited object keys can never match.
|
|
12
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure The table and the normalization live in one module that the skeleton importer and the byte inspector both call, replacing two copies that had to be kept in step.
|
|
13
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts The closed alias vocabulary is a naming convention supported by this mapper rather than an anatomical inference, and both callers keep their own first-claim rule instead of the helper guessing between duplicates.
|
|
14
|
-
* @evidence contracts/development/common.md#meaningful-documentation The documentation states the normalization steps with an example, the covered conventions, the unmapped finger, eye and jaw slots, and what `undefined` means.
|
|
15
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms Cost is linear in the name length for two regular-expression passes and one lowercase copy, then one hash lookup.
|
|
16
|
-
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each invocation normalizes its supplied name; a joint shared by several skins may be revisited, and this helper retains no cache over mutable source revisions.
|
|
17
|
-
* @evidenceExclude contracts/development/implementation.md#bound-retention-and-release-resources The module-level table is a fixed forty-entry constant; a call retains nothing.
|
|
18
16
|
*/
|
|
19
17
|
export const humanoidBoneOfName: (
|
|
20
18
|
name: string,
|
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
import { object } from "./object";
|
|
2
2
|
import { optionalArray } from "./optionalArray";
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Establish a unique-parent acyclic glTF node forest.
|
|
6
|
-
*
|
|
7
|
-
* @evidence contracts/development/implementation.md#principled-implementation Index-validated child edges fill one parent table; iterative three-state walks detect cycles and mark completed root paths.
|
|
8
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure Hierarchy admission runs before profile dispatch so static, humanoid and motion consumers share one forest contract.
|
|
9
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Duplicate children, multiple parents and parent cycles throw without rewriting the graph or dropping links.
|
|
10
|
-
* @evidence contracts/development/common.md#meaningful-documentation Comments explain index-validation prerequisite, unique parent semantics and depth-safe iterative traversal.
|
|
11
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms N nodes and E child links cost O(N+E), since completed parent walks are marked and each node enters one unfinished path.
|
|
12
|
-
* @evidence contracts/development/implementation.md#reuse-equivalent-work The returned parent table is reused by scene-root admission and motion-node interpretation in the same inspector call.
|
|
13
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Parent/state/path arrays are bounded by node count; only the returned table remains with its synchronous caller.
|
|
14
|
-
*/
|
|
4
|
+
/** Establish a unique-parent acyclic glTF node forest. */
|
|
15
5
|
export const inspectExternalModelHierarchy: (
|
|
16
6
|
values: unknown[],
|
|
17
7
|
) => Array<number | undefined> = (
|
|
@@ -33,15 +33,14 @@ const MOTION_OUTPUT_TYPES: Readonly<
|
|
|
33
33
|
/**
|
|
34
34
|
* Normalize glTF animation samplers into deterministic node tracks.
|
|
35
35
|
*
|
|
36
|
-
* Empty animation inventories return undefined. Otherwise source-order clips
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The decode cache lives only for one inspection; returned clips retain arrays proportional to keyframe counts without raw payload bytes.
|
|
36
|
+
* Empty animation inventories return undefined. Otherwise source-order clips
|
|
37
|
+
* and channel-order tracks own independent FLOAT keyframe copies, even when
|
|
38
|
+
* samplers share accessors. Times must be nonnegative and strictly increasing;
|
|
39
|
+
* output arity follows path and interpolation, with only quaternion value
|
|
40
|
+
* groups checked within 1e-4 of unit magnitude. Cubic tangents remain unchanged
|
|
41
|
+
* and weight arity is not checked against the target mesh's morph count.
|
|
42
|
+
* Missing interpolation means LINEAR; unknown interpolation, duplicate
|
|
43
|
+
* node/path channels and malformed data throw with the field path.
|
|
45
44
|
*/
|
|
46
45
|
export const inspectExternalMotion: (props: {
|
|
47
46
|
path: string;
|
|
@@ -6,15 +6,12 @@ import { object } from "./object";
|
|
|
6
6
|
/**
|
|
7
7
|
* Read glTF motion nodes as finite canonical local TRS records.
|
|
8
8
|
*
|
|
9
|
-
* The caller supplies a validated acyclic parent table. Omitted translation,
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms N nodes require O(N) time and output records, with fixed-size tuple work per node.
|
|
16
|
-
* @evidence contracts/development/implementation.md#reuse-equivalent-work The admitted parent table is reused from structural hierarchy checks; each node transform is interpreted once per inspection.
|
|
17
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The returned node records own new fixed-size transforms; source JSON arrays and tuple temporaries are not retained.
|
|
9
|
+
* The caller supplies a validated acyclic parent table. Omitted translation,
|
|
10
|
+
* rotation and scale use glTF defaults; present tuples must be finite, scales
|
|
11
|
+
* positive and quaternion magnitude within 1e-4 of one before normalization.
|
|
12
|
+
* Matrix transforms throw instead of being decomposed. Records use source-index
|
|
13
|
+
* ids, null for absent/empty names or root parents, and fresh transform
|
|
14
|
+
* objects.
|
|
18
15
|
*/
|
|
19
16
|
export const inspectExternalMotionNodes: (
|
|
20
17
|
values: unknown[],
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import { validNodeIndex } from "./validNodeIndex";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Admit an optional or required index into an already declared inventory.
|
|
5
|
-
*
|
|
6
|
-
* @evidence contracts/development/implementation.md#principled-implementation Safe integer identity and the half-open zero-to-length range establish resolvable references; omission is accepted only when optional.
|
|
7
|
-
* @evidence contracts/development/implementation.md#clear-and-simple-structure One gate owns reference existence semantics while callers supply the appropriate inventory and field path.
|
|
8
|
-
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Undefined required values, negatives, fractions and out-of-range indices throw instead of selecting a nearby element.
|
|
9
|
-
* @evidence contracts/development/common.md#meaningful-documentation Prose defines required omission, zero-based range, safe precision and path-named failure.
|
|
10
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms The helper performs constant-time predicates independent of the inventory population.
|
|
11
|
-
* @evidence contracts/development/implementation.md#reuse-equivalent-work All reference-array validation delegates this same gate without a separate range implementation.
|
|
12
|
-
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources No inventory is copied or retained, and no resource is acquired by index admission.
|
|
13
|
-
*/
|
|
3
|
+
/** Admit an optional or required index into an already declared inventory. */
|
|
14
4
|
export const integerIndex: (
|
|
15
5
|
value: unknown,
|
|
16
6
|
length: number,
|