@lovelace_lol/embody 0.0.7 → 0.0.8
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 +541 -2394
- package/dist/index.d.ts +2 -100
- package/dist/index.js +7714 -12951
- package/dist/index.js.map +1 -1
- package/dist/three/annotations/DOMControls.d.ts +73 -0
- package/dist/three/annotations/DPthree.d.ts +113 -0
- package/dist/three/annotations/DPthree3DMarkers.d.ts +319 -0
- package/dist/three/annotations/DPthreeCameraController.d.ts +414 -0
- package/dist/three/annotations/DPthreeHTMLMarkers.d.ts +131 -0
- package/dist/three/annotations/DPthreeMarkers.d.ts +52 -0
- package/dist/three/annotations/adapter.d.ts +157 -0
- package/dist/three/annotations/animationFrameTaskScheduler.d.ts +18 -0
- package/dist/three/annotations/annotationAnchorModel.d.ts +16 -0
- package/dist/three/annotations/annotationCameraCore.d.ts +5 -0
- package/dist/three/annotations/boneResolutionProfile.d.ts +7 -0
- package/dist/three/annotations/index.d.ts +20 -0
- package/dist/three/annotations/loadFrame.d.ts +2 -0
- package/dist/three/annotations/markerSurfaceRaycast.d.ts +11 -0
- package/dist/three/annotations/markerVisibilityLifecycle.d.ts +21 -0
- package/dist/three/annotations/modelRenderPreparation.d.ts +6 -0
- package/dist/three/annotations/runtimeAnnotationPreview.d.ts +15 -0
- package/dist/three/annotations/runtimeAnnotationPreviewSide.d.ts +10 -0
- package/dist/three/annotations/runtimeAnnotationSidePreview.d.ts +5 -0
- package/dist/three/annotations/types.d.ts +262 -0
- package/dist/three/gaze.d.ts +122 -0
- package/dist/three/index.d.ts +147 -0
- package/dist/three/model.d.ts +31 -0
- package/dist/three/modelSkinning.d.ts +3 -0
- package/dist/three/reference-pose.d.ts +73 -0
- package/dist/three/scene.d.ts +253 -0
- package/dist/three/sceneRenderingBinding.d.ts +22 -0
- package/dist/three.js +7696 -8936
- package/dist/three.js.map +1 -1
- package/dist/wasm/README.md +551 -62
- package/dist/wasm/auto.d.ts +1 -0
- package/dist/wasm/embody_wasm.d.ts +388 -52
- package/dist/wasm/embody_wasm.js +1514 -119
- package/dist/wasm/embody_wasm_bg.wasm +0 -0
- package/dist/wasm/embody_wasm_bg.wasm.d.ts +115 -40
- package/dist/wasm/index.d.ts +126 -0
- package/dist/wasm.d.ts +1 -43
- package/dist/wasm.js +1043 -239
- package/dist/wasm.js.map +1 -1
- package/package.json +34 -39
- package/service-worker/character-asset-service-worker.js +295 -0
- package/dist/authoring/boneAuthoring.d.ts +0 -132
- package/dist/camera/annotationCameraAngles.d.ts +0 -28
- package/dist/camera/cameraRelativeGaze.d.ts +0 -15
- package/dist/camera/rustAnnotationCameraCore.d.ts +0 -136
- package/dist/cljs.cjs +0 -362
- package/dist/cljs.cjs.map +0 -1
- package/dist/cljs.d.ts +0 -5
- package/dist/cljs.js +0 -359
- package/dist/cljs.js.map +0 -1
- package/dist/core/TsClipCompiler.d.ts +0 -51
- package/dist/core/WasmRuntimeCore.d.ts +0 -41
- package/dist/core/compositeAxis.d.ts +0 -4
- package/dist/core/contracts/abi.d.ts +0 -70
- package/dist/core/contracts/clip.d.ts +0 -44
- package/dist/core/contracts/frame.d.ts +0 -27
- package/dist/core/contracts/host.d.ts +0 -28
- package/dist/core/contracts/ids.d.ts +0 -15
- package/dist/core/contracts/index.d.ts +0 -10
- package/dist/core/contracts/model.d.ts +0 -31
- package/dist/core/contracts/primitives.d.ts +0 -17
- package/dist/core/contracts/skeletonFit.d.ts +0 -41
- package/dist/core/index.d.ts +0 -6
- package/dist/core/types.d.ts +0 -472
- package/dist/core.cjs +0 -343
- package/dist/core.cjs.map +0 -1
- package/dist/core.js +0 -323
- package/dist/core.js.map +0 -1
- package/dist/engines/three/Embody.d.ts +0 -372
- package/dist/engines/three/ThreeAnimationRuntime.d.ts +0 -203
- package/dist/engines/three/ThreeClipAdapter.d.ts +0 -24
- package/dist/engines/three/ThreeFrameApplier.d.ts +0 -68
- package/dist/engines/three/ThreeModelInspector.d.ts +0 -54
- package/dist/engines/three/bakedClipPartitioning.d.ts +0 -16
- package/dist/engines/three/balanceUtils.d.ts +0 -3
- package/dist/engines/three/characterHost.d.ts +0 -80
- package/dist/engines/three/characterScene.d.ts +0 -98
- package/dist/engines/three/hair/HairPhysicsController.d.ts +0 -124
- package/dist/engines/three/index.d.ts +0 -20
- package/dist/engines/three/modelLoader.d.ts +0 -61
- package/dist/engines/three/profileTestScene.d.ts +0 -52
- package/dist/engines/three/types.d.ts +0 -20
- package/dist/hair/appearance.d.ts +0 -29
- package/dist/index.cjs +0 -14871
- package/dist/index.cjs.map +0 -1
- package/dist/interfaces/Animation.d.ts +0 -315
- package/dist/interfaces/EmbodyRuntime.d.ts +0 -90
- package/dist/interfaces/Hair.d.ts +0 -181
- package/dist/interfaces/HairPhysics.d.ts +0 -90
- package/dist/interfaces/index.d.ts +0 -11
- package/dist/mappings/extendPresetWithProfile.d.ts +0 -17
- package/dist/mappings/types.d.ts +0 -309
- package/dist/mappings/visemeSystem.d.ts +0 -26
- package/dist/physics/HairPhysics.d.ts +0 -86
- package/dist/physics/RustHairPhysics.d.ts +0 -18
- package/dist/physics/index.d.ts +0 -6
- package/dist/preset.cjs +0 -2005
- package/dist/preset.cjs.map +0 -1
- package/dist/preset.js +0 -2003
- package/dist/preset.js.map +0 -1
- package/dist/presets/bettaFish.d.ts +0 -328
- package/dist/presets/cc4.d.ts +0 -145
- package/dist/presets/index.d.ts +0 -30
- package/dist/presets/registry.d.ts +0 -57
- package/dist/profiles/resolveProfileConfig.d.ts +0 -36
- package/dist/profiles/rustResolvedProfile.d.ts +0 -31
- package/dist/profiles/types.d.ts +0 -118
- package/dist/regions/normalizeRegionTree.d.ts +0 -6
- package/dist/regions/regionMapping.d.ts +0 -17
- package/dist/regions/types.d.ts +0 -122
- package/dist/skeletonTemplates/humanoidSkeletonTemplates.d.ts +0 -32
- package/dist/test/setupWasm.d.ts +0 -1
- package/dist/three.cjs +0 -9550
- package/dist/three.cjs.map +0 -1
- package/dist/validation/analyzeModel.d.ts +0 -68
- package/dist/validation/extractModelData.d.ts +0 -90
- package/dist/validation/generateMappingCorrections.d.ts +0 -32
- package/dist/validation/geometryHelpers.d.ts +0 -66
- package/dist/validation/types.d.ts +0 -10
- package/dist/validation/validateMappings.d.ts +0 -77
- package/dist/wasm.cjs +0 -302
- package/dist/wasm.cjs.map +0 -1
- package/dist/wasmTypes.d.ts +0 -123
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { Vector3, type Object3D } from 'three';
|
|
2
|
+
import { type EmbodyCore } from '@lovelace_lol/embody/wasm';
|
|
3
|
+
import type { AnnotationCharacterConfig, AnnotationLaterality, BoneResolutionProfile, Region } from './types';
|
|
4
|
+
export { initEmbodyCore } from '@lovelace_lol/embody/wasm';
|
|
5
|
+
export type { AnnotationLaterality, BoneResolutionProfile } from './types';
|
|
6
|
+
type Point = {
|
|
7
|
+
x: number;
|
|
8
|
+
y: number;
|
|
9
|
+
z: number;
|
|
10
|
+
};
|
|
11
|
+
type Rotation = Point & {
|
|
12
|
+
w: number;
|
|
13
|
+
};
|
|
14
|
+
type Bounds = {
|
|
15
|
+
center: Point;
|
|
16
|
+
size: Point;
|
|
17
|
+
};
|
|
18
|
+
/** Typed, allocation-only bridge to the canonical Rust camera and marker algorithms. */
|
|
19
|
+
export declare class RustAnnotationCameraCore {
|
|
20
|
+
private readonly core;
|
|
21
|
+
constructor(core: EmbodyCore);
|
|
22
|
+
static create(): Promise<RustAnnotationCameraCore>;
|
|
23
|
+
normalizeCameraAngle(angle: number): number;
|
|
24
|
+
worldDirectionForCameraAngle(q: Rotation | undefined, angle: number): Point;
|
|
25
|
+
resolveFocusCameraDirection(q: Rotation | undefined, effectiveAngle: number, cameraAngle?: number, angleSpace?: string): Point;
|
|
26
|
+
resolveAutoCloseupAngle(offset: number, focusSize: Point, modelSize: Point): number | undefined;
|
|
27
|
+
focusPaddingFactor(size: number, closeUp: number, zoom: number, fullBody: number): number;
|
|
28
|
+
solveFocusFraming(o: {
|
|
29
|
+
focusBounds?: Bounds;
|
|
30
|
+
modelBounds?: Bounds | null;
|
|
31
|
+
modelQuaternion?: Rotation;
|
|
32
|
+
fovDegrees: number;
|
|
33
|
+
aspect: number;
|
|
34
|
+
minDistance: number;
|
|
35
|
+
closeUpPaddingFactor: number;
|
|
36
|
+
zoomPaddingFactor: number;
|
|
37
|
+
fullBodyPaddingFactor: number;
|
|
38
|
+
overridePadding?: number;
|
|
39
|
+
cameraAngle?: number;
|
|
40
|
+
angleSpace?: string;
|
|
41
|
+
}): {
|
|
42
|
+
position: Point;
|
|
43
|
+
target: Point;
|
|
44
|
+
distance: number;
|
|
45
|
+
};
|
|
46
|
+
solveFullBodyFraming(o: {
|
|
47
|
+
boxMin: Point;
|
|
48
|
+
boxMax: Point;
|
|
49
|
+
modelQuaternion?: Rotation;
|
|
50
|
+
fovDegrees: number;
|
|
51
|
+
aspect: number;
|
|
52
|
+
minDistance: number;
|
|
53
|
+
fullBodyPaddingFactor: number;
|
|
54
|
+
overridePadding?: number;
|
|
55
|
+
cameraAngle?: number;
|
|
56
|
+
angleSpace?: string;
|
|
57
|
+
}): {
|
|
58
|
+
position: Point;
|
|
59
|
+
target: Point;
|
|
60
|
+
distance: number;
|
|
61
|
+
};
|
|
62
|
+
passesMarkerCameraAngleGate(o: {
|
|
63
|
+
markerAngle?: number;
|
|
64
|
+
currentCameraAngle?: number;
|
|
65
|
+
rangeDegrees?: number;
|
|
66
|
+
}): boolean;
|
|
67
|
+
shouldShowMarker(o: {
|
|
68
|
+
hiddenChild: boolean;
|
|
69
|
+
solo: 'none' | 'soloed' | 'other-soloed';
|
|
70
|
+
markerAngle?: number;
|
|
71
|
+
currentCameraAngle?: number;
|
|
72
|
+
}): boolean;
|
|
73
|
+
resolveViewportConstrainedLineScale(o: {
|
|
74
|
+
startClip: ArrayLike<number>;
|
|
75
|
+
endClip: ArrayLike<number>;
|
|
76
|
+
safeX: number;
|
|
77
|
+
safeY: number;
|
|
78
|
+
minLengthRatio?: number;
|
|
79
|
+
}): {
|
|
80
|
+
visible: boolean;
|
|
81
|
+
lineScale: number;
|
|
82
|
+
};
|
|
83
|
+
resolveViewportSafeBounds(o: {
|
|
84
|
+
labelScaleX: number;
|
|
85
|
+
labelScaleY: number;
|
|
86
|
+
projectionXScale: number;
|
|
87
|
+
projectionYScale: number;
|
|
88
|
+
viewportWidth: number;
|
|
89
|
+
viewportHeight: number;
|
|
90
|
+
edgePaddingPx?: number;
|
|
91
|
+
}): {
|
|
92
|
+
safeX: number;
|
|
93
|
+
safeY: number;
|
|
94
|
+
};
|
|
95
|
+
sampleMarkerBezierCurve(start: Point, end: Point, segments?: number): Float32Array<ArrayBufferLike>;
|
|
96
|
+
sampleMarkerArcCurve(start: Point, end: Point, segments?: number): Float32Array<ArrayBufferLike>;
|
|
97
|
+
markerVisibilityAnimationFactors(visible: boolean, t: number): {
|
|
98
|
+
itemOpacityFactor: number;
|
|
99
|
+
labelScaleFactor: number;
|
|
100
|
+
lineOpacityFactor: number;
|
|
101
|
+
};
|
|
102
|
+
separateOverlappingMarkerEndpoints(o: {
|
|
103
|
+
starts: ArrayLike<number>;
|
|
104
|
+
ends: ArrayLike<number>;
|
|
105
|
+
modelCenter: Point;
|
|
106
|
+
modelHeight: number;
|
|
107
|
+
}): Float32Array<ArrayBufferLike>;
|
|
108
|
+
createCameraFlight(start: Point, startTarget: Point, end: Point, endTarget: Point, duration: number): {
|
|
109
|
+
sample(elapsed: number): {
|
|
110
|
+
position: Point;
|
|
111
|
+
target: Point;
|
|
112
|
+
done: boolean;
|
|
113
|
+
};
|
|
114
|
+
readonly durationMs: number;
|
|
115
|
+
dispose(): void;
|
|
116
|
+
};
|
|
117
|
+
createCameraOrbit(center: Point, radius: number, height: number, duration: number): {
|
|
118
|
+
sample(elapsed: number): {
|
|
119
|
+
position: Point;
|
|
120
|
+
target: Point;
|
|
121
|
+
done: boolean;
|
|
122
|
+
};
|
|
123
|
+
readonly durationMs: number;
|
|
124
|
+
dispose(): void;
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
export declare const createRustAnnotationCameraCore: () => Promise<RustAnnotationCameraCore>;
|
|
128
|
+
/** Resolve only annotation/profile inputs, preserving host-only data by reference. */
|
|
129
|
+
export declare function resolveAnnotationCharacterConfig<T extends AnnotationCharacterConfig>(config: T): Promise<T>;
|
|
130
|
+
export declare function resolveBoneNames(names: string[] | undefined, profile?: BoneResolutionProfile | null): string[];
|
|
131
|
+
export declare function fuzzyNameMatch(objectName: string, targetName: string, suffixPattern?: string): boolean;
|
|
132
|
+
export declare function getDefaultAnnotationLaterality(): AnnotationLaterality;
|
|
133
|
+
export declare function getSemanticHorizontalSignForSide(side: 'left' | 'right', laterality: AnnotationLaterality): 1 | -1;
|
|
134
|
+
export declare function getSemanticHorizontalSign(name: string, laterality: AnnotationLaterality): 1 | -1 | null;
|
|
135
|
+
export declare function resolveRegionCameraAngle(region: Region, laterality: AnnotationLaterality): number | undefined;
|
|
136
|
+
export declare function resolveRegionVisibilityCameraAngle(region: Region, laterality: AnnotationLaterality): number | undefined;
|
|
137
|
+
export declare function toWorldDirection(model: Object3D | null, local: Vector3): Vector3;
|
|
138
|
+
export declare function getWorldDirectionForCameraAngle(model: Object3D | null, angle: number): Vector3;
|
|
139
|
+
export declare function getModelLocalOrbitAngle(model: Object3D | null, center: Vector3, position: Vector3): number;
|
|
140
|
+
export declare function passesMarkerCameraAngleGate(o: {
|
|
141
|
+
markerAngle?: number;
|
|
142
|
+
currentCameraAngle?: number;
|
|
143
|
+
rangeDegrees?: number;
|
|
144
|
+
}): boolean;
|
|
145
|
+
/** Reduce scene objects to a world-space annotation anchor; numeric camera math stays in Rust. */
|
|
146
|
+
export declare function resolveFaceCenter(model: Object3D, region: Region, profile?: BoneResolutionProfile | null): {
|
|
147
|
+
center: Vector3;
|
|
148
|
+
method: string;
|
|
149
|
+
debugInfo: string[];
|
|
150
|
+
headBonePosition?: undefined;
|
|
151
|
+
} | {
|
|
152
|
+
center: Vector3;
|
|
153
|
+
headBonePosition: Vector3 | undefined;
|
|
154
|
+
method: string;
|
|
155
|
+
debugInfo: string[];
|
|
156
|
+
};
|
|
157
|
+
export declare function detectAnnotationLaterality(model: Object3D | null, regions: Region[], profile: BoneResolutionProfile | null): AnnotationLaterality;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export type AnimationFrameTask = (now: number) => boolean;
|
|
2
|
+
/**
|
|
3
|
+
* Runs multiple short UI animation tasks from one requestAnimationFrame loop.
|
|
4
|
+
*
|
|
5
|
+
* Tasks return true while they need another frame and false when complete.
|
|
6
|
+
*/
|
|
7
|
+
export declare class AnimationFrameTaskScheduler {
|
|
8
|
+
private frameId;
|
|
9
|
+
private readonly tasks;
|
|
10
|
+
get size(): number;
|
|
11
|
+
has(key: string): boolean;
|
|
12
|
+
schedule(key: string, task: AnimationFrameTask, runImmediately?: boolean): void;
|
|
13
|
+
cancel(key: string): void;
|
|
14
|
+
cancelAll(): void;
|
|
15
|
+
private requestFrame;
|
|
16
|
+
private readonly tick;
|
|
17
|
+
private cancelFrameIfIdle;
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { AnnotationAnchoredRegion, AnnotationMarkerAnchor, Region } from './types';
|
|
2
|
+
export type MarkerAnchorProjectionMode = 'legacy' | 'project' | 'skip';
|
|
3
|
+
export interface ResolvedMarkerAnchorRegion {
|
|
4
|
+
region: AnnotationAnchoredRegion;
|
|
5
|
+
anchor: AnnotationMarkerAnchor | null;
|
|
6
|
+
source: 'legacy-region' | 'marker-anchor';
|
|
7
|
+
projection: MarkerAnchorProjectionMode;
|
|
8
|
+
useLegacyRegionSemantics: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Convert explicit marker-anchor intent into the legacy region target fields
|
|
12
|
+
* that the current marker renderers understand.
|
|
13
|
+
*/
|
|
14
|
+
export declare function resolveMarkerAnchorRegion(region: Region): ResolvedMarkerAnchorRegion;
|
|
15
|
+
export declare function shouldUseFaceCenterForMarkerAnchor(resolved: ResolvedMarkerAnchorRegion): boolean;
|
|
16
|
+
export declare function shouldProjectMarkerAnchorToSurface(resolved: ResolvedMarkerAnchorRegion, legacyDefault: boolean): boolean;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type RustAnnotationCameraCore } from './adapter';
|
|
2
|
+
/** Share the stateless Rust math adapter across cameras and markers. */
|
|
3
|
+
export declare function getAnnotationCameraCore(): Promise<RustAnnotationCameraCore>;
|
|
4
|
+
/** Synchronous render-loop math is available after the owning load awaits initialization. */
|
|
5
|
+
export declare function requireAnnotationCameraCore(): RustAnnotationCameraCore;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { BoneResolutionProfile } from './adapter';
|
|
2
|
+
/**
|
|
3
|
+
* Embody serializes bone-resolution inputs into Wasm. Passing a complete
|
|
4
|
+
* character profile also serializes authored vertex deltas and saved clips
|
|
5
|
+
* for every annotation lookup, even though the resolver cannot use them.
|
|
6
|
+
*/
|
|
7
|
+
export declare function boneResolutionProfile(profile: BoneResolutionProfile | null | undefined): BoneResolutionProfile | null;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { DPthree, CameraController, Markers3D, MarkersHTML, Controls } from './DPthree';
|
|
2
|
+
export type { DPthreeConfig, CharacterValidationResult, ValidationCategory, ValidationItem } from './DPthree';
|
|
3
|
+
export { DPthreeCameraController } from './DPthreeCameraController';
|
|
4
|
+
export type { MarkerStateSnapshot } from './DPthreeCameraController';
|
|
5
|
+
export { DPthree3DMarkers } from './DPthree3DMarkers';
|
|
6
|
+
export { DPthreeHTMLMarkers } from './DPthreeHTMLMarkers';
|
|
7
|
+
export { DPthreeMarkers } from './DPthreeMarkers';
|
|
8
|
+
export { CameraDOMControls, RUNTIME_ANNOTATION_REGION_PREFIX, filterCameraViewRegions, isRuntimeAnnotationRegionName, buildRegionDisplayOptions } from './DOMControls';
|
|
9
|
+
export type { DOMControlRegion, DOMControlsConfig } from './DOMControls';
|
|
10
|
+
export { resolveMarkerAnchorRegion, shouldProjectMarkerAnchorToSurface, shouldUseFaceCenterForMarkerAnchor } from './annotationAnchorModel';
|
|
11
|
+
export type { MarkerAnchorProjectionMode, ResolvedMarkerAnchorRegion } from './annotationAnchorModel';
|
|
12
|
+
export { getRuntimeAnnotationSide, getRuntimeAUMorphAnchorPoint, getRuntimeAUMeshSideOffset } from './runtimeAnnotationSidePreview';
|
|
13
|
+
export { createMarkerVisibilityLifecycle, createMarkerLifecycleRevealOptions, DEFAULT_MARKER_AUTO_HIDE_MS } from './markerVisibilityLifecycle';
|
|
14
|
+
export type { MarkerLifecycleRevealOptions, MarkerLifecycleRevealSource } from './markerVisibilityLifecycle';
|
|
15
|
+
export { createRuntimeAnnotationPreviewLifecycle, DEFAULT_PREVIEW_AUTO_CLEAR_MS } from './runtimeAnnotationPreview';
|
|
16
|
+
export type { RuntimeAnnotationPreviewLifecycleOptions } from './runtimeAnnotationPreview';
|
|
17
|
+
export { inferRuntimeAnnotationPreviewSide, pickContinuumAnnotationAuId } from './runtimeAnnotationPreviewSide';
|
|
18
|
+
export { boneResolutionProfile } from './boneResolutionProfile';
|
|
19
|
+
export { resolveAnnotationCharacterConfig, RustAnnotationCameraCore, createRustAnnotationCameraCore, getDefaultAnnotationLaterality, getSemanticHorizontalSignForSide, getSemanticHorizontalSign, resolveRegionCameraAngle, resolveRegionVisibilityCameraAngle, toWorldDirection, getWorldDirectionForCameraAngle, getModelLocalOrbitAngle, passesMarkerCameraAngleGate, resolveFaceCenter, detectAnnotationLaterality, } from './adapter';
|
|
20
|
+
export type { AnnotationCharacterConfig, AnnotationAnchorPoint, AnnotationMarkerAnchor, AnnotationMarkerAnchorType, AnnotationFocusTarget, AnnotationAnchoredRegion, RuntimeAnnotationMetadata, RuntimeAnnotationOptions, RuntimeAnnotationRegionSummary, RuntimeAnnotationSide, RuntimeAnnotationTargetType, CameraState, FocusPosition, DPthreeCameraControllerConfig, RegionChangeCallback, CharacterChangeCallback, DPthreeRegion, DPthreeCharacterConfig, DPthreeRegistry, DPthreeRegionChangeCallback, DPthreeCharacterChangeCallback, LineStyle, LineCurve, NamedDirection, LineConfig, MarkerStyleOverrides, ExpandAnimation, ExpandedRegionState, FallbackConfig, MarkerGroup, Region, MarkerStyle, BoneResolutionProfile, AnnotationLaterality, } from './types';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as THREE from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* Keep Three's native per-mesh raycast, including skinning, morphs and material
|
|
4
|
+
* sides. Yield between meshes once a slice is spent; one mesh is indivisible.
|
|
5
|
+
* A null result means the owning model/region load was replaced or disposed.
|
|
6
|
+
*/
|
|
7
|
+
export declare function intersectMeshesInSlices(raycaster: THREE.Raycaster, meshes: readonly THREE.Mesh[], options: {
|
|
8
|
+
isCurrent: () => boolean;
|
|
9
|
+
yieldToPaint: () => Promise<void>;
|
|
10
|
+
now?: () => number;
|
|
11
|
+
}): Promise<THREE.Intersection[] | null>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { DPthreeCameraController } from './DPthreeCameraController';
|
|
2
|
+
import type { MarkerStyle } from './types';
|
|
3
|
+
export declare const DEFAULT_MARKER_AUTO_HIDE_MS = 5000;
|
|
4
|
+
export type MarkerLifecycleRevealOptions = {
|
|
5
|
+
durationMs?: number;
|
|
6
|
+
markerStyle?: MarkerStyle;
|
|
7
|
+
revealDelayMs?: number;
|
|
8
|
+
};
|
|
9
|
+
export type MarkerLifecycleRevealSource = {
|
|
10
|
+
markerStyle?: MarkerStyle;
|
|
11
|
+
playIntroOnLoad?: boolean;
|
|
12
|
+
};
|
|
13
|
+
type MarkerLifecycleController = Pick<DPthreeCameraController, 'setMarkersVisible' | 'setMarkerStyle'>;
|
|
14
|
+
export declare function createMarkerLifecycleRevealOptions(config: MarkerLifecycleRevealSource | null | undefined): MarkerLifecycleRevealOptions;
|
|
15
|
+
export declare function createMarkerVisibilityLifecycle(getController: () => MarkerLifecycleController | null, defaultDurationMs?: number): {
|
|
16
|
+
setManualVisibility(visible: boolean): void;
|
|
17
|
+
prepareForCharacterLoad(): void;
|
|
18
|
+
showForCharacterLoad(options?: MarkerLifecycleRevealOptions): void;
|
|
19
|
+
dispose(): void;
|
|
20
|
+
};
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import type { CharacterSceneRenderer } from '../scene';
|
|
3
|
+
/** Three collects visible surfaces before yielding; no shared mutations span the await. */
|
|
4
|
+
export declare function compileModelForRender(renderer: CharacterSceneRenderer, scene: THREE.Scene, camera: THREE.Camera, model: THREE.Object3D): Promise<unknown>;
|
|
5
|
+
/** One complete scene draw initializes native geometry/textures and real shadow variants. */
|
|
6
|
+
export declare function drawModelForRender(renderer: CharacterSceneRenderer, scene: THREE.Scene, camera: THREE.Camera, model: THREE.Object3D): () => void;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const DEFAULT_PREVIEW_AUTO_CLEAR_MS = 1200;
|
|
2
|
+
export interface RuntimeAnnotationPreviewLifecycleOptions {
|
|
3
|
+
getDisabled?: () => boolean;
|
|
4
|
+
getAutoClearMs?: () => number | undefined;
|
|
5
|
+
onPreviewStart?: () => void;
|
|
6
|
+
onPreviewEnd?: () => void;
|
|
7
|
+
}
|
|
8
|
+
/** Framework-independent annotation preview lifetime; hosts supply input events. */
|
|
9
|
+
export declare function createRuntimeAnnotationPreviewLifecycle(options: RuntimeAnnotationPreviewLifecycleOptions): {
|
|
10
|
+
start(forceRefresh?: boolean): void;
|
|
11
|
+
end: () => void;
|
|
12
|
+
scheduleEnd: () => void;
|
|
13
|
+
isActive: () => boolean;
|
|
14
|
+
dispose: () => void;
|
|
15
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RuntimeAnnotationSide } from './types';
|
|
2
|
+
export declare function inferRuntimeAnnotationPreviewSide(auId: number, profile: {
|
|
3
|
+
auToMorphs?: unknown;
|
|
4
|
+
auToBones?: unknown;
|
|
5
|
+
} | null | undefined): RuntimeAnnotationSide | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* Pick which continuum AU to annotate. While a drag gesture is sticky, keep
|
|
8
|
+
* the original side so crossing 0 does not rebuild runtime markers mid-drag.
|
|
9
|
+
*/
|
|
10
|
+
export declare function pickContinuumAnnotationAuId(value: number, negId: number, posId: number, stickyId: number | null): number;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import type { AnnotationAnchoredRegion, RuntimeAnnotationSide } from './types';
|
|
3
|
+
export declare function getRuntimeAnnotationSide(region: AnnotationAnchoredRegion): RuntimeAnnotationSide | null;
|
|
4
|
+
export declare function getRuntimeAUMorphAnchorPoint(region: AnnotationAnchoredRegion, mesh: THREE.Mesh): THREE.Vector3 | null;
|
|
5
|
+
export declare function getRuntimeAUMeshSideOffset(region: AnnotationAnchoredRegion, sideSign: number, modelSize: THREE.Vector3): THREE.Vector3 | null;
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import type * as THREE from 'three';
|
|
2
|
+
import type { CharacterSceneRenderer, CharacterSceneRenderingController } from '../scene';
|
|
3
|
+
export type LineStyle = 'solid' | 'dashed' | 'dotted';
|
|
4
|
+
export type LineCurve = 'straight' | 'bezier' | 'arc';
|
|
5
|
+
export type NamedDirection = 'radial' | 'camera' | 'up' | 'down' | 'left' | 'right' | 'forward' | 'backward';
|
|
6
|
+
export interface LineConfig {
|
|
7
|
+
style?: LineStyle;
|
|
8
|
+
curve?: LineCurve;
|
|
9
|
+
arrowHead?: boolean;
|
|
10
|
+
thickness?: number;
|
|
11
|
+
length?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface MarkerStyleOverrides {
|
|
14
|
+
markerColor?: number;
|
|
15
|
+
markerRadius?: number;
|
|
16
|
+
lineColor?: number;
|
|
17
|
+
labelColor?: string;
|
|
18
|
+
labelBackground?: string;
|
|
19
|
+
labelFontSize?: number;
|
|
20
|
+
opacity?: number;
|
|
21
|
+
lineDirection?: NamedDirection | {
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
z: number;
|
|
25
|
+
};
|
|
26
|
+
line?: LineConfig;
|
|
27
|
+
}
|
|
28
|
+
export type ExpandAnimation = 'outward' | 'staggered';
|
|
29
|
+
export interface ExpandedRegionState {
|
|
30
|
+
regionName: string;
|
|
31
|
+
isExpanded: boolean;
|
|
32
|
+
children: string[];
|
|
33
|
+
}
|
|
34
|
+
export interface FallbackConfig {
|
|
35
|
+
fallbackMarker?: string;
|
|
36
|
+
clickBehavior?: 'fit-all' | 'rotate';
|
|
37
|
+
}
|
|
38
|
+
export interface MarkerGroup {
|
|
39
|
+
groupId: string;
|
|
40
|
+
regions: string[];
|
|
41
|
+
fallback?: FallbackConfig;
|
|
42
|
+
}
|
|
43
|
+
export interface Region {
|
|
44
|
+
name: string;
|
|
45
|
+
bones?: string[];
|
|
46
|
+
meshes?: string[];
|
|
47
|
+
objects?: string[];
|
|
48
|
+
paddingFactor?: number;
|
|
49
|
+
cameraAngle?: number;
|
|
50
|
+
cameraOffset?: {
|
|
51
|
+
x?: number;
|
|
52
|
+
y?: number;
|
|
53
|
+
z?: number;
|
|
54
|
+
};
|
|
55
|
+
parent?: string;
|
|
56
|
+
children?: string[];
|
|
57
|
+
expandAnimation?: ExpandAnimation;
|
|
58
|
+
style?: MarkerStyleOverrides;
|
|
59
|
+
groupId?: string;
|
|
60
|
+
isFallback?: boolean;
|
|
61
|
+
customPosition?: {
|
|
62
|
+
x: number;
|
|
63
|
+
y: number;
|
|
64
|
+
z: number;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export type MarkerStyle = 'html' | '3d';
|
|
68
|
+
export interface AnnotationAnchorPoint {
|
|
69
|
+
x: number;
|
|
70
|
+
y: number;
|
|
71
|
+
z: number;
|
|
72
|
+
}
|
|
73
|
+
export type AnnotationMarkerAnchorType = 'region' | 'point' | 'bone' | 'mesh' | 'object' | 'face-center';
|
|
74
|
+
/**
|
|
75
|
+
* Explicit marker-anchor intent for annotation regions.
|
|
76
|
+
*
|
|
77
|
+
* Shared renderer-adapter contract for authored and runtime annotation regions.
|
|
78
|
+
*/
|
|
79
|
+
export interface AnnotationMarkerAnchor {
|
|
80
|
+
type: AnnotationMarkerAnchorType;
|
|
81
|
+
bones?: string[];
|
|
82
|
+
meshes?: string[];
|
|
83
|
+
objects?: string[];
|
|
84
|
+
position?: AnnotationAnchorPoint;
|
|
85
|
+
/**
|
|
86
|
+
* Whether 3D markers should raycast from the resolved anchor toward the
|
|
87
|
+
* visible model surface before drawing the marker sphere.
|
|
88
|
+
*/
|
|
89
|
+
projectToSurface?: boolean;
|
|
90
|
+
}
|
|
91
|
+
export interface AnnotationFocusTarget {
|
|
92
|
+
type: 'region' | 'point' | 'bone' | 'mesh' | 'object' | 'face-center';
|
|
93
|
+
bones?: string[];
|
|
94
|
+
meshes?: string[];
|
|
95
|
+
objects?: string[];
|
|
96
|
+
position?: AnnotationAnchorPoint;
|
|
97
|
+
paddingFactor?: number;
|
|
98
|
+
cameraAngle?: number;
|
|
99
|
+
}
|
|
100
|
+
export type RuntimeAnnotationTargetType = 'bone' | 'au';
|
|
101
|
+
export type RuntimeAnnotationSide = 'left' | 'right' | 'center';
|
|
102
|
+
export interface RuntimeAnnotationMetadata {
|
|
103
|
+
targetType: RuntimeAnnotationTargetType;
|
|
104
|
+
target: string;
|
|
105
|
+
boneName?: string;
|
|
106
|
+
meshName?: string;
|
|
107
|
+
morphNames?: string[];
|
|
108
|
+
side?: RuntimeAnnotationSide;
|
|
109
|
+
}
|
|
110
|
+
export interface RuntimeAnnotationOptions {
|
|
111
|
+
label?: string;
|
|
112
|
+
markerColor?: number;
|
|
113
|
+
lineColor?: number;
|
|
114
|
+
markerRadius?: number;
|
|
115
|
+
labelColor?: string;
|
|
116
|
+
labelBackground?: string;
|
|
117
|
+
labelFontSize?: number;
|
|
118
|
+
opacity?: number;
|
|
119
|
+
paddingFactor?: number;
|
|
120
|
+
cameraAngle?: number;
|
|
121
|
+
projectToSurface?: boolean;
|
|
122
|
+
maxTargets?: number;
|
|
123
|
+
targetPreference?: 'bone' | 'mesh';
|
|
124
|
+
targetSide?: RuntimeAnnotationSide;
|
|
125
|
+
replaceExisting?: boolean;
|
|
126
|
+
}
|
|
127
|
+
export interface RuntimeAnnotationRegionSummary {
|
|
128
|
+
name: string;
|
|
129
|
+
label: string;
|
|
130
|
+
targetType: RuntimeAnnotationTargetType;
|
|
131
|
+
target: string;
|
|
132
|
+
bones: string[];
|
|
133
|
+
meshes?: string[];
|
|
134
|
+
morphs?: string[];
|
|
135
|
+
side?: RuntimeAnnotationSide;
|
|
136
|
+
}
|
|
137
|
+
export type AnnotationAnchoredRegion = Region & {
|
|
138
|
+
label?: string;
|
|
139
|
+
markerAnchor?: AnnotationMarkerAnchor;
|
|
140
|
+
focusTarget?: AnnotationFocusTarget;
|
|
141
|
+
runtimeAnnotation?: RuntimeAnnotationMetadata;
|
|
142
|
+
};
|
|
143
|
+
export interface BoneResolutionProfile {
|
|
144
|
+
bonePrefix?: string;
|
|
145
|
+
boneSuffix?: string;
|
|
146
|
+
boneNodes?: Record<string, string>;
|
|
147
|
+
suffixPattern?: string;
|
|
148
|
+
}
|
|
149
|
+
export interface AnnotationLaterality {
|
|
150
|
+
leftSideX: 1 | -1;
|
|
151
|
+
confidence: number;
|
|
152
|
+
evidence: string[];
|
|
153
|
+
}
|
|
154
|
+
/** Structural runtime input; host storage, authoring and agency fields are not owned here. */
|
|
155
|
+
export interface AnnotationCharacterConfig extends BoneResolutionProfile {
|
|
156
|
+
characterId: string;
|
|
157
|
+
characterName?: string;
|
|
158
|
+
modelPath?: string;
|
|
159
|
+
regions?: AnnotationAnchoredRegion[];
|
|
160
|
+
annotationRegions?: AnnotationAnchoredRegion[];
|
|
161
|
+
markerStyle?: MarkerStyle;
|
|
162
|
+
playIntroOnLoad?: boolean;
|
|
163
|
+
defaultRegion?: string;
|
|
164
|
+
disabledRegions?: string[];
|
|
165
|
+
profilePresetId?: string;
|
|
166
|
+
presetId?: string;
|
|
167
|
+
baseProfileId?: string;
|
|
168
|
+
auPresetType?: string;
|
|
169
|
+
profile?: Record<string, unknown>;
|
|
170
|
+
auToMorphs?: Record<string, unknown>;
|
|
171
|
+
auToBones?: Record<string, unknown>;
|
|
172
|
+
morphToMesh?: Record<string, string[]>;
|
|
173
|
+
markerGroups?: MarkerGroup[];
|
|
174
|
+
lineDefaults?: LineConfig;
|
|
175
|
+
markerDefaults?: Partial<MarkerStyleOverrides>;
|
|
176
|
+
}
|
|
177
|
+
export type CharacterConfig = AnnotationCharacterConfig;
|
|
178
|
+
export interface CharacterRegistry {
|
|
179
|
+
characters: AnnotationCharacterConfig[];
|
|
180
|
+
defaultCharacter?: string;
|
|
181
|
+
}
|
|
182
|
+
export type AUPresetType = string;
|
|
183
|
+
export type DPthreeRegion = AnnotationAnchoredRegion;
|
|
184
|
+
export type DPthreeCharacterConfig = AnnotationCharacterConfig;
|
|
185
|
+
export type DPthreeRegistry = CharacterRegistry;
|
|
186
|
+
/**
|
|
187
|
+
* Camera state for save/restore
|
|
188
|
+
*/
|
|
189
|
+
export interface CameraState {
|
|
190
|
+
position: [number, number, number];
|
|
191
|
+
target: [number, number, number];
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Configuration for DPthreeCameraController
|
|
195
|
+
*/
|
|
196
|
+
export interface DPthreeCameraControllerConfig {
|
|
197
|
+
/** Optional selection override; otherwise selecting a region focuses the camera. */
|
|
198
|
+
onRegionSelect?: (name: string) => void;
|
|
199
|
+
/** Optional host profile intake; defaults to Embody preset resolution. */
|
|
200
|
+
resolveCharacterConfig?: (config: AnnotationCharacterConfig) => AnnotationCharacterConfig | Promise<AnnotationCharacterConfig>;
|
|
201
|
+
/** The Three.js camera to control */
|
|
202
|
+
camera: THREE.PerspectiveCamera;
|
|
203
|
+
/** DOM element for OrbitControls (usually the canvas or its container) */
|
|
204
|
+
domElement: HTMLElement;
|
|
205
|
+
/** The Three.js scene */
|
|
206
|
+
scene: THREE.Scene;
|
|
207
|
+
/** The Three.js renderer - if provided, camera controller manages the render loop */
|
|
208
|
+
renderer?: CharacterSceneRenderer;
|
|
209
|
+
/** Owns live backend replacement; pass the matching scene/camera and stable container. */
|
|
210
|
+
rendering?: CharacterSceneRenderingController;
|
|
211
|
+
/**
|
|
212
|
+
* Optional render callback used when the controller owns the render loop.
|
|
213
|
+
* Allows overlay passes to render after the main character scene. Pending
|
|
214
|
+
* asynchronous callbacks skip subsequent frames instead of overlapping.
|
|
215
|
+
*/
|
|
216
|
+
renderFrame?: (renderer: CharacterSceneRenderer, scene: THREE.Scene, camera: THREE.PerspectiveCamera) => void | Promise<void>;
|
|
217
|
+
/** Rendering failure stops this controller's loop; the host owns recovery. */
|
|
218
|
+
onRenderError?: (error: Error) => void;
|
|
219
|
+
/**
|
|
220
|
+
* Optional resize callback used when renderer sizing is owned by a higher-level
|
|
221
|
+
* scene manager with its own pixel-ratio policy.
|
|
222
|
+
*/
|
|
223
|
+
resizeRenderer?: (renderer: CharacterSceneRenderer, width: number, height: number) => void;
|
|
224
|
+
/** Enable damping/inertia. Default: true */
|
|
225
|
+
enableDamping?: boolean;
|
|
226
|
+
/** Damping factor. Default: 0.05 */
|
|
227
|
+
dampingFactor?: number;
|
|
228
|
+
/** Minimum zoom distance. Default: 0.5 */
|
|
229
|
+
minDistance?: number;
|
|
230
|
+
/** Maximum zoom distance. Default: 10 */
|
|
231
|
+
maxDistance?: number;
|
|
232
|
+
/** Default transition duration in ms. Default: 800 */
|
|
233
|
+
transitionDuration?: number;
|
|
234
|
+
/** Default padding factor. Default: 1.5 */
|
|
235
|
+
zoomPaddingFactor?: number;
|
|
236
|
+
/** Padding for small targets (eyes, mouth). Default: 1.2 */
|
|
237
|
+
closeUpPaddingFactor?: number;
|
|
238
|
+
/** Padding for full body view. Default: 2.0 */
|
|
239
|
+
fullBodyPaddingFactor?: number;
|
|
240
|
+
/** Show built-in annotation selector. Default: true */
|
|
241
|
+
showDOMControls?: boolean;
|
|
242
|
+
/** Container for DOM controls. Default: domElement */
|
|
243
|
+
controlsContainer?: HTMLElement;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Calculated focus position for camera animation
|
|
247
|
+
*/
|
|
248
|
+
export interface FocusPosition {
|
|
249
|
+
position: THREE.Vector3;
|
|
250
|
+
target: THREE.Vector3;
|
|
251
|
+
distance: number;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Callback for region change events
|
|
255
|
+
*/
|
|
256
|
+
export type RegionChangeCallback = (regionName: string) => void;
|
|
257
|
+
/**
|
|
258
|
+
* Callback for character change events
|
|
259
|
+
*/
|
|
260
|
+
export type CharacterChangeCallback = (config: CharacterConfig) => void;
|
|
261
|
+
export type DPthreeRegionChangeCallback = RegionChangeCallback;
|
|
262
|
+
export type DPthreeCharacterChangeCallback = CharacterChangeCallback;
|