loomlarge 0.2.1 → 1.0.1
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 +126 -20
- package/dist/index.cjs +227 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +84 -22
- package/dist/index.d.ts +84 -22
- package/dist/index.js +227 -50
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -35,7 +35,39 @@ interface AUMappingConfig {
|
|
|
35
35
|
/**
|
|
36
36
|
* Helper type for mesh categories in morphToMesh
|
|
37
37
|
*/
|
|
38
|
-
type MorphCategory
|
|
38
|
+
type MorphCategory = 'face' | 'viseme' | 'eye' | 'tearLine' | 'tongue' | 'hair';
|
|
39
|
+
/**
|
|
40
|
+
* Mesh category types for character mesh classification
|
|
41
|
+
*/
|
|
42
|
+
type MeshCategory = 'body' | 'eye' | 'eyeOcclusion' | 'tearLine' | 'teeth' | 'tongue' | 'hair' | 'eyebrow' | 'cornea' | 'eyelash';
|
|
43
|
+
/**
|
|
44
|
+
* Blending mode names (matches Three.js constants)
|
|
45
|
+
*/
|
|
46
|
+
type BlendingMode = 'Normal' | 'Additive' | 'Subtractive' | 'Multiply' | 'None';
|
|
47
|
+
/**
|
|
48
|
+
* Blending mode options for Three.js materials
|
|
49
|
+
* Maps mode name to Three.js blending constant value
|
|
50
|
+
*/
|
|
51
|
+
declare const BLENDING_MODES: Record<BlendingMode, number>;
|
|
52
|
+
/**
|
|
53
|
+
* Material settings for mesh rendering
|
|
54
|
+
*/
|
|
55
|
+
interface MeshMaterialSettings {
|
|
56
|
+
renderOrder?: number;
|
|
57
|
+
transparent?: boolean;
|
|
58
|
+
opacity?: number;
|
|
59
|
+
depthWrite?: boolean;
|
|
60
|
+
depthTest?: boolean;
|
|
61
|
+
blending?: BlendingMode;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Mesh info including category, morph count, and optional material settings
|
|
65
|
+
*/
|
|
66
|
+
interface MeshInfo$1 {
|
|
67
|
+
category: MeshCategory;
|
|
68
|
+
morphCount: number;
|
|
69
|
+
material?: MeshMaterialSettings;
|
|
70
|
+
}
|
|
39
71
|
|
|
40
72
|
/**
|
|
41
73
|
* LoomLarge - Core Type Definitions
|
|
@@ -68,6 +100,8 @@ interface BoneBinding {
|
|
|
68
100
|
scale: -1 | 1;
|
|
69
101
|
maxDegrees?: number;
|
|
70
102
|
maxUnits?: number;
|
|
103
|
+
/** Rotation axis this binding affects (pitch/yaw/roll). Required for rotation channels. */
|
|
104
|
+
axis?: 'pitch' | 'yaw' | 'roll';
|
|
71
105
|
}
|
|
72
106
|
/**
|
|
73
107
|
* RotationAxis - Defines which AUs control a specific rotation axis
|
|
@@ -396,7 +430,27 @@ declare class LoomLargeThree implements LoomLarge {
|
|
|
396
430
|
setAU(id: number | string, v: number, balance?: number): void;
|
|
397
431
|
transitionAU(id: number | string, to: number, durationMs?: number, balance?: number): TransitionHandle;
|
|
398
432
|
getAU(id: number): number;
|
|
433
|
+
/**
|
|
434
|
+
* Set a morph target value.
|
|
435
|
+
*
|
|
436
|
+
* Fast paths (in order of speed):
|
|
437
|
+
* 1. Pass pre-resolved { infl, idx } array directly - zero lookups
|
|
438
|
+
* 2. String key with cache hit - one Map lookup
|
|
439
|
+
* 3. String key cache miss - dictionary lookup, then cached for next time
|
|
440
|
+
*/
|
|
399
441
|
setMorph(key: string, v: number, meshNames?: string[]): void;
|
|
442
|
+
setMorph(key: string, v: number, targets: {
|
|
443
|
+
infl: number[];
|
|
444
|
+
idx: number;
|
|
445
|
+
}[]): void;
|
|
446
|
+
/**
|
|
447
|
+
* Resolve morph key to direct targets for ultra-fast repeated access.
|
|
448
|
+
* Use this when you need to set the same morph many times (e.g., in animation loops).
|
|
449
|
+
*/
|
|
450
|
+
resolveMorphTargets(key: string, meshNames?: string[]): {
|
|
451
|
+
infl: number[];
|
|
452
|
+
idx: number;
|
|
453
|
+
}[];
|
|
400
454
|
transitionMorph(key: string, to: number, durationMs?: number, meshNames?: string[]): TransitionHandle;
|
|
401
455
|
setViseme(visemeIndex: number, value: number, jawScale?: number): void;
|
|
402
456
|
transitionViseme(visemeIndex: number, to: number, durationMs?: number, jawScale?: number): TransitionHandle;
|
|
@@ -409,7 +463,34 @@ declare class LoomLargeThree implements LoomLarge {
|
|
|
409
463
|
getActiveTransitionCount(): number;
|
|
410
464
|
resetToNeutral(): void;
|
|
411
465
|
getMeshList(): MeshInfo[];
|
|
466
|
+
/** Get all morph targets grouped by mesh name */
|
|
467
|
+
getMorphTargets(): Record<string, string[]>;
|
|
468
|
+
/** Get all resolved bone names and their current transforms */
|
|
469
|
+
getBones(): Record<string, {
|
|
470
|
+
position: [number, number, number];
|
|
471
|
+
rotation: [number, number, number];
|
|
472
|
+
}>;
|
|
412
473
|
setMeshVisible(meshName: string, visible: boolean): void;
|
|
474
|
+
/** Blending mode options for Three.js materials */
|
|
475
|
+
private static readonly BLENDING_MODES;
|
|
476
|
+
/** Get material config for a mesh */
|
|
477
|
+
getMeshMaterialConfig(meshName: string): {
|
|
478
|
+
renderOrder: number;
|
|
479
|
+
transparent: boolean;
|
|
480
|
+
opacity: number;
|
|
481
|
+
depthWrite: boolean;
|
|
482
|
+
depthTest: boolean;
|
|
483
|
+
blending: string;
|
|
484
|
+
} | null;
|
|
485
|
+
/** Set material config for a mesh */
|
|
486
|
+
setMeshMaterialConfig(meshName: string, config: {
|
|
487
|
+
renderOrder?: number;
|
|
488
|
+
transparent?: boolean;
|
|
489
|
+
opacity?: number;
|
|
490
|
+
depthWrite?: boolean;
|
|
491
|
+
depthTest?: boolean;
|
|
492
|
+
blending?: string;
|
|
493
|
+
}): void;
|
|
413
494
|
setAUMappings(mappings: AUMappingConfig): void;
|
|
414
495
|
getAUMappings(): AUMappingConfig;
|
|
415
496
|
private computeSideValues;
|
|
@@ -603,27 +684,8 @@ declare const CC4_EYE_MESH_NODES: {
|
|
|
603
684
|
declare const AU_INFO: Record<string, AUInfo>;
|
|
604
685
|
/** Default mix weights (0 = morph only, 1 = bone only) */
|
|
605
686
|
declare const AU_MIX_DEFAULTS: Record<number, number>;
|
|
606
|
-
type MeshCategory = 'body' | 'eye' | 'eyeOcclusion' | 'tearLine' | 'teeth' | 'tongue' | 'hair' | 'eyebrow' | 'cornea' | 'eyelash';
|
|
607
|
-
/** Blending mode names (matches Three.js constants) */
|
|
608
|
-
type BlendingMode = 'Normal' | 'Additive' | 'Subtractive' | 'Multiply' | 'None';
|
|
609
|
-
/** Material settings for mesh rendering */
|
|
610
|
-
interface MeshMaterialSettings {
|
|
611
|
-
renderOrder?: number;
|
|
612
|
-
transparent?: boolean;
|
|
613
|
-
opacity?: number;
|
|
614
|
-
depthWrite?: boolean;
|
|
615
|
-
depthTest?: boolean;
|
|
616
|
-
blending?: BlendingMode;
|
|
617
|
-
}
|
|
618
|
-
/** Mesh info including category, morph count, and optional material settings */
|
|
619
|
-
interface CC4MeshInfo {
|
|
620
|
-
category: MeshCategory;
|
|
621
|
-
morphCount: number;
|
|
622
|
-
material?: MeshMaterialSettings;
|
|
623
|
-
}
|
|
624
687
|
/** Exact mesh name -> category mapping from the character GLB */
|
|
625
|
-
declare const CC4_MESHES: Record<string,
|
|
626
|
-
type MorphCategory = 'face' | 'viseme' | 'eye' | 'tearLine' | 'tongue' | 'hair';
|
|
688
|
+
declare const CC4_MESHES: Record<string, MeshInfo$1>;
|
|
627
689
|
/** Which mesh each morph category applies to */
|
|
628
690
|
declare const MORPH_TO_MESH: Record<MorphCategory, string[]>;
|
|
629
691
|
declare const CC4_PRESET: AUMappingConfig;
|
|
@@ -715,4 +777,4 @@ declare class HairPhysics {
|
|
|
715
777
|
reset(): void;
|
|
716
778
|
}
|
|
717
779
|
|
|
718
|
-
export { type AUInfo, type AUMappingConfig, AU_INFO, AU_MIX_DEFAULTS, AU_TO_MORPHS, type Animation, AnimationThree, BONE_AU_TO_BINDINGS, type BoneBinding, type BoneKey, CC4_BONE_NODES, CC4_EYE_MESH_NODES, CC4_MESHES, CC4_PRESET, COMPOSITE_ROTATIONS, CONTINUUM_LABELS, CONTINUUM_PAIRS_MAP, type CompositeRotation, type CompositeRotationState, DEFAULT_HAIR_PHYSICS_CONFIG, type HairMorphOutput$1 as HairMorphOutput, HairPhysics, type HairPhysicsConfig$1 as HairPhysicsConfig, type HairPhysics$1 as HairPhysicsInterface, type HairMorphOutput as HairPhysicsMorphOutput, type HairPhysicsState, type HairState, type HairStrand, type HeadState$1 as HeadState, type LoomEuler, type LoomLarge, type LoomLargeConfig, LoomLargeThree, type LoomMesh, type LoomObject3D, type LoomQuaternion, type LoomVector3, MORPH_TO_MESH, type MeshInfo, type
|
|
780
|
+
export { type AUInfo, type AUMappingConfig, AU_INFO, AU_MIX_DEFAULTS, AU_TO_MORPHS, type Animation, AnimationThree, BLENDING_MODES, BONE_AU_TO_BINDINGS, type BlendingMode, type BoneBinding, type BoneKey, CC4_BONE_NODES, CC4_EYE_MESH_NODES, CC4_MESHES, CC4_PRESET, COMPOSITE_ROTATIONS, CONTINUUM_LABELS, CONTINUUM_PAIRS_MAP, type CompositeRotation, type CompositeRotationState, DEFAULT_HAIR_PHYSICS_CONFIG, type HairMorphOutput$1 as HairMorphOutput, HairPhysics, type HairPhysicsConfig$1 as HairPhysicsConfig, type HairPhysics$1 as HairPhysicsInterface, type HairMorphOutput as HairPhysicsMorphOutput, type HairPhysicsState, type HairState, type HairStrand, type HeadState$1 as HeadState, type LoomEuler, type LoomLarge, type LoomLargeConfig, LoomLargeThree, type LoomMesh, type LoomObject3D, type LoomQuaternion, type LoomVector3, MORPH_TO_MESH, type MeshCategory, type MeshInfo, type MeshInfo$1 as MeshMaterialInfo, type MeshMaterialSettings, type MorphCategory, type ReadyPayload, type RotationAxis, type RotationAxisState, type RotationsState, type TransitionHandle, VISEME_KEYS, collectMorphMeshes, LoomLargeThree as default, hasLeftRightMorphs, isMixedAU };
|
package/dist/index.d.ts
CHANGED
|
@@ -35,7 +35,39 @@ interface AUMappingConfig {
|
|
|
35
35
|
/**
|
|
36
36
|
* Helper type for mesh categories in morphToMesh
|
|
37
37
|
*/
|
|
38
|
-
type MorphCategory
|
|
38
|
+
type MorphCategory = 'face' | 'viseme' | 'eye' | 'tearLine' | 'tongue' | 'hair';
|
|
39
|
+
/**
|
|
40
|
+
* Mesh category types for character mesh classification
|
|
41
|
+
*/
|
|
42
|
+
type MeshCategory = 'body' | 'eye' | 'eyeOcclusion' | 'tearLine' | 'teeth' | 'tongue' | 'hair' | 'eyebrow' | 'cornea' | 'eyelash';
|
|
43
|
+
/**
|
|
44
|
+
* Blending mode names (matches Three.js constants)
|
|
45
|
+
*/
|
|
46
|
+
type BlendingMode = 'Normal' | 'Additive' | 'Subtractive' | 'Multiply' | 'None';
|
|
47
|
+
/**
|
|
48
|
+
* Blending mode options for Three.js materials
|
|
49
|
+
* Maps mode name to Three.js blending constant value
|
|
50
|
+
*/
|
|
51
|
+
declare const BLENDING_MODES: Record<BlendingMode, number>;
|
|
52
|
+
/**
|
|
53
|
+
* Material settings for mesh rendering
|
|
54
|
+
*/
|
|
55
|
+
interface MeshMaterialSettings {
|
|
56
|
+
renderOrder?: number;
|
|
57
|
+
transparent?: boolean;
|
|
58
|
+
opacity?: number;
|
|
59
|
+
depthWrite?: boolean;
|
|
60
|
+
depthTest?: boolean;
|
|
61
|
+
blending?: BlendingMode;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Mesh info including category, morph count, and optional material settings
|
|
65
|
+
*/
|
|
66
|
+
interface MeshInfo$1 {
|
|
67
|
+
category: MeshCategory;
|
|
68
|
+
morphCount: number;
|
|
69
|
+
material?: MeshMaterialSettings;
|
|
70
|
+
}
|
|
39
71
|
|
|
40
72
|
/**
|
|
41
73
|
* LoomLarge - Core Type Definitions
|
|
@@ -68,6 +100,8 @@ interface BoneBinding {
|
|
|
68
100
|
scale: -1 | 1;
|
|
69
101
|
maxDegrees?: number;
|
|
70
102
|
maxUnits?: number;
|
|
103
|
+
/** Rotation axis this binding affects (pitch/yaw/roll). Required for rotation channels. */
|
|
104
|
+
axis?: 'pitch' | 'yaw' | 'roll';
|
|
71
105
|
}
|
|
72
106
|
/**
|
|
73
107
|
* RotationAxis - Defines which AUs control a specific rotation axis
|
|
@@ -396,7 +430,27 @@ declare class LoomLargeThree implements LoomLarge {
|
|
|
396
430
|
setAU(id: number | string, v: number, balance?: number): void;
|
|
397
431
|
transitionAU(id: number | string, to: number, durationMs?: number, balance?: number): TransitionHandle;
|
|
398
432
|
getAU(id: number): number;
|
|
433
|
+
/**
|
|
434
|
+
* Set a morph target value.
|
|
435
|
+
*
|
|
436
|
+
* Fast paths (in order of speed):
|
|
437
|
+
* 1. Pass pre-resolved { infl, idx } array directly - zero lookups
|
|
438
|
+
* 2. String key with cache hit - one Map lookup
|
|
439
|
+
* 3. String key cache miss - dictionary lookup, then cached for next time
|
|
440
|
+
*/
|
|
399
441
|
setMorph(key: string, v: number, meshNames?: string[]): void;
|
|
442
|
+
setMorph(key: string, v: number, targets: {
|
|
443
|
+
infl: number[];
|
|
444
|
+
idx: number;
|
|
445
|
+
}[]): void;
|
|
446
|
+
/**
|
|
447
|
+
* Resolve morph key to direct targets for ultra-fast repeated access.
|
|
448
|
+
* Use this when you need to set the same morph many times (e.g., in animation loops).
|
|
449
|
+
*/
|
|
450
|
+
resolveMorphTargets(key: string, meshNames?: string[]): {
|
|
451
|
+
infl: number[];
|
|
452
|
+
idx: number;
|
|
453
|
+
}[];
|
|
400
454
|
transitionMorph(key: string, to: number, durationMs?: number, meshNames?: string[]): TransitionHandle;
|
|
401
455
|
setViseme(visemeIndex: number, value: number, jawScale?: number): void;
|
|
402
456
|
transitionViseme(visemeIndex: number, to: number, durationMs?: number, jawScale?: number): TransitionHandle;
|
|
@@ -409,7 +463,34 @@ declare class LoomLargeThree implements LoomLarge {
|
|
|
409
463
|
getActiveTransitionCount(): number;
|
|
410
464
|
resetToNeutral(): void;
|
|
411
465
|
getMeshList(): MeshInfo[];
|
|
466
|
+
/** Get all morph targets grouped by mesh name */
|
|
467
|
+
getMorphTargets(): Record<string, string[]>;
|
|
468
|
+
/** Get all resolved bone names and their current transforms */
|
|
469
|
+
getBones(): Record<string, {
|
|
470
|
+
position: [number, number, number];
|
|
471
|
+
rotation: [number, number, number];
|
|
472
|
+
}>;
|
|
412
473
|
setMeshVisible(meshName: string, visible: boolean): void;
|
|
474
|
+
/** Blending mode options for Three.js materials */
|
|
475
|
+
private static readonly BLENDING_MODES;
|
|
476
|
+
/** Get material config for a mesh */
|
|
477
|
+
getMeshMaterialConfig(meshName: string): {
|
|
478
|
+
renderOrder: number;
|
|
479
|
+
transparent: boolean;
|
|
480
|
+
opacity: number;
|
|
481
|
+
depthWrite: boolean;
|
|
482
|
+
depthTest: boolean;
|
|
483
|
+
blending: string;
|
|
484
|
+
} | null;
|
|
485
|
+
/** Set material config for a mesh */
|
|
486
|
+
setMeshMaterialConfig(meshName: string, config: {
|
|
487
|
+
renderOrder?: number;
|
|
488
|
+
transparent?: boolean;
|
|
489
|
+
opacity?: number;
|
|
490
|
+
depthWrite?: boolean;
|
|
491
|
+
depthTest?: boolean;
|
|
492
|
+
blending?: string;
|
|
493
|
+
}): void;
|
|
413
494
|
setAUMappings(mappings: AUMappingConfig): void;
|
|
414
495
|
getAUMappings(): AUMappingConfig;
|
|
415
496
|
private computeSideValues;
|
|
@@ -603,27 +684,8 @@ declare const CC4_EYE_MESH_NODES: {
|
|
|
603
684
|
declare const AU_INFO: Record<string, AUInfo>;
|
|
604
685
|
/** Default mix weights (0 = morph only, 1 = bone only) */
|
|
605
686
|
declare const AU_MIX_DEFAULTS: Record<number, number>;
|
|
606
|
-
type MeshCategory = 'body' | 'eye' | 'eyeOcclusion' | 'tearLine' | 'teeth' | 'tongue' | 'hair' | 'eyebrow' | 'cornea' | 'eyelash';
|
|
607
|
-
/** Blending mode names (matches Three.js constants) */
|
|
608
|
-
type BlendingMode = 'Normal' | 'Additive' | 'Subtractive' | 'Multiply' | 'None';
|
|
609
|
-
/** Material settings for mesh rendering */
|
|
610
|
-
interface MeshMaterialSettings {
|
|
611
|
-
renderOrder?: number;
|
|
612
|
-
transparent?: boolean;
|
|
613
|
-
opacity?: number;
|
|
614
|
-
depthWrite?: boolean;
|
|
615
|
-
depthTest?: boolean;
|
|
616
|
-
blending?: BlendingMode;
|
|
617
|
-
}
|
|
618
|
-
/** Mesh info including category, morph count, and optional material settings */
|
|
619
|
-
interface CC4MeshInfo {
|
|
620
|
-
category: MeshCategory;
|
|
621
|
-
morphCount: number;
|
|
622
|
-
material?: MeshMaterialSettings;
|
|
623
|
-
}
|
|
624
687
|
/** Exact mesh name -> category mapping from the character GLB */
|
|
625
|
-
declare const CC4_MESHES: Record<string,
|
|
626
|
-
type MorphCategory = 'face' | 'viseme' | 'eye' | 'tearLine' | 'tongue' | 'hair';
|
|
688
|
+
declare const CC4_MESHES: Record<string, MeshInfo$1>;
|
|
627
689
|
/** Which mesh each morph category applies to */
|
|
628
690
|
declare const MORPH_TO_MESH: Record<MorphCategory, string[]>;
|
|
629
691
|
declare const CC4_PRESET: AUMappingConfig;
|
|
@@ -715,4 +777,4 @@ declare class HairPhysics {
|
|
|
715
777
|
reset(): void;
|
|
716
778
|
}
|
|
717
779
|
|
|
718
|
-
export { type AUInfo, type AUMappingConfig, AU_INFO, AU_MIX_DEFAULTS, AU_TO_MORPHS, type Animation, AnimationThree, BONE_AU_TO_BINDINGS, type BoneBinding, type BoneKey, CC4_BONE_NODES, CC4_EYE_MESH_NODES, CC4_MESHES, CC4_PRESET, COMPOSITE_ROTATIONS, CONTINUUM_LABELS, CONTINUUM_PAIRS_MAP, type CompositeRotation, type CompositeRotationState, DEFAULT_HAIR_PHYSICS_CONFIG, type HairMorphOutput$1 as HairMorphOutput, HairPhysics, type HairPhysicsConfig$1 as HairPhysicsConfig, type HairPhysics$1 as HairPhysicsInterface, type HairMorphOutput as HairPhysicsMorphOutput, type HairPhysicsState, type HairState, type HairStrand, type HeadState$1 as HeadState, type LoomEuler, type LoomLarge, type LoomLargeConfig, LoomLargeThree, type LoomMesh, type LoomObject3D, type LoomQuaternion, type LoomVector3, MORPH_TO_MESH, type MeshInfo, type
|
|
780
|
+
export { type AUInfo, type AUMappingConfig, AU_INFO, AU_MIX_DEFAULTS, AU_TO_MORPHS, type Animation, AnimationThree, BLENDING_MODES, BONE_AU_TO_BINDINGS, type BlendingMode, type BoneBinding, type BoneKey, CC4_BONE_NODES, CC4_EYE_MESH_NODES, CC4_MESHES, CC4_PRESET, COMPOSITE_ROTATIONS, CONTINUUM_LABELS, CONTINUUM_PAIRS_MAP, type CompositeRotation, type CompositeRotationState, DEFAULT_HAIR_PHYSICS_CONFIG, type HairMorphOutput$1 as HairMorphOutput, HairPhysics, type HairPhysicsConfig$1 as HairPhysicsConfig, type HairPhysics$1 as HairPhysicsInterface, type HairMorphOutput as HairPhysicsMorphOutput, type HairPhysicsState, type HairState, type HairStrand, type HeadState$1 as HeadState, type LoomEuler, type LoomLarge, type LoomLargeConfig, LoomLargeThree, type LoomMesh, type LoomObject3D, type LoomQuaternion, type LoomVector3, MORPH_TO_MESH, type MeshCategory, type MeshInfo, type MeshInfo$1 as MeshMaterialInfo, type MeshMaterialSettings, type MorphCategory, type ReadyPayload, type RotationAxis, type RotationAxisState, type RotationsState, type TransitionHandle, VISEME_KEYS, collectMorphMeshes, LoomLargeThree as default, hasLeftRightMorphs, isMixedAU };
|