@lovelace_lol/embody 0.0.11 → 0.0.13
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 +37 -40
- package/dist/index.js +1760 -118
- package/dist/index.js.map +1 -1
- package/dist/three/authoring.d.ts +3 -3
- package/dist/three/authoringTypes.d.ts +0 -91
- package/dist/three/character.d.ts +2 -8
- package/dist/three/characterHost.d.ts +33 -5
- package/dist/three/characterTexturePalette.d.ts +6 -0
- package/dist/three/editor/SkeletonOverlay.d.ts +128 -0
- package/dist/three/editor/morphVertexPreview.d.ts +35 -0
- package/dist/three/index.d.ts +2 -0
- package/dist/three/modelMorphLayout.d.ts +13 -0
- package/dist/three/scene.d.ts +5 -0
- package/dist/three/sceneInkBackground.d.ts +11 -0
- package/dist/three/sceneInkBackgroundStyle.d.ts +5 -0
- package/dist/three.js +1760 -118
- package/dist/three.js.map +1 -1
- package/dist/wasm/README.md +37 -40
- package/dist/wasm/auDescriptors.d.ts +35 -0
- package/dist/wasm/embody_wasm.d.ts +52 -96
- package/dist/wasm/embody_wasm.js +12 -147
- package/dist/wasm/embody_wasm_bg.wasm +0 -0
- package/dist/wasm/embody_wasm_bg.wasm.d.ts +48 -56
- package/dist/wasm/index.d.ts +2 -0
- package/dist/wasm.js +288 -1
- package/dist/wasm.js.map +1 -1
- package/package.json +2 -2
|
@@ -4,7 +4,7 @@ import type { Region } from './annotations/types';
|
|
|
4
4
|
import type * as Types from './authoringTypes';
|
|
5
5
|
export * from './authoringTypes';
|
|
6
6
|
export { resolveBoneNames, fuzzyNameMatch } from './annotations/adapter';
|
|
7
|
-
export { DEFAULT_AXIS_TO_CHANNEL, DEFAULT_BONE_MAX_DEGREES, JOINT_CONTROL_SECTION, VISEME_KEYS, HAIR_COLOR_PRESETS, DEFAULT_HAIR_COLOR_APPEARANCE, HUMANOID_SKELETON_TEMPLATES, CC4_HUMANOID_SKELETON_TEMPLATE, } from '@lovelace_lol/embody/wasm';
|
|
7
|
+
export { DEFAULT_AXIS_TO_CHANNEL, DEFAULT_BONE_MAX_DEGREES, JOINT_CONTROL_SECTION, VISEME_KEYS, HAIR_COLOR_PRESETS, DEFAULT_HAIR_COLOR_APPEARANCE, getAUDescriptors, LEGACY_BODY_CONTROL_AUS, HUMANOID_SKELETON_TEMPLATES, CC4_HUMANOID_SKELETON_TEMPLATE, } from '@lovelace_lol/embody/wasm';
|
|
8
8
|
export declare const getPreset: (id: Types.PresetType) => Types.Profile;
|
|
9
9
|
export declare const extendCharacterConfigWithPreset: <T extends Types.ProfileRuntimeConfig>(config: T) => T;
|
|
10
10
|
export declare const extractProfileOverrides: (config: Types.ProfileRuntimeConfig) => Partial<Types.Profile>;
|
|
@@ -61,7 +61,6 @@ export declare const classifyAuAsJointControl: (profile: Types.Profile, auId: nu
|
|
|
61
61
|
nodeKey?: string | null;
|
|
62
62
|
}) => Types.Profile;
|
|
63
63
|
export declare const resolveContinuumDisplayLabel: (profile: Pick<Types.Profile, "continuumPairs" | "continuumLabels" | "auInfo" | "boneNodes" | "bonePrefix" | "boneSuffix">, negativeAuId: number, positiveAuId: number) => string;
|
|
64
|
-
export declare function getBodyControls(profile: Types.Profile, model?: Object3D): Types.BodyControlDescriptor[];
|
|
65
64
|
export declare function extractModelData(model: Object3D, meshes?: Mesh[], animations?: AnimationClip[]): Types.ModelData;
|
|
66
65
|
export declare function analyzeModel(options: {
|
|
67
66
|
source: {
|
|
@@ -76,7 +75,7 @@ export declare function analyzeModel(options: {
|
|
|
76
75
|
preset?: Types.Profile;
|
|
77
76
|
suggestCorrections?: boolean;
|
|
78
77
|
}): Promise<Types.ModelAnalysisReport>;
|
|
79
|
-
export declare function validateMappings(meshes: unknown[], skeleton: unknown, profile: Types.Profile
|
|
78
|
+
export declare function validateMappings(meshes: unknown[], skeleton: unknown, profile: Partial<Types.Profile>, options?: Record<string, unknown>): Types.ValidationResult;
|
|
80
79
|
export declare function validateHumanoidCharacterization(model: Object3D, profile: Types.Profile): Types.HumanoidCharacterizationResolution;
|
|
81
80
|
export declare function normalizeHairColorAppearance(value: Types.HairColorAppearance | string, fallback?: Types.HairColorAppearance): Types.HairColorAppearance;
|
|
82
81
|
export declare const getHumanoidSkeletonTemplate: (id: string) => Types.HumanoidSkeletonTemplate | null;
|
|
@@ -93,3 +92,4 @@ export declare function extractHumanoidSkeletonTemplateFromModel(model: Object3D
|
|
|
93
92
|
sourceAsset?: string;
|
|
94
93
|
sourceSkinName?: string;
|
|
95
94
|
}): Types.HumanoidSkeletonTemplate;
|
|
95
|
+
export type { AUDescriptor } from '@lovelace_lol/embody/wasm';
|
|
@@ -207,95 +207,6 @@ export interface HumanoidCharacterizationResolution {
|
|
|
207
207
|
warnings: string[];
|
|
208
208
|
valid: boolean;
|
|
209
209
|
}
|
|
210
|
-
/** Semantic body actions reuse the AU bone/morph evaluator. VRM names identify targets. */
|
|
211
|
-
export interface BodyControlDefinition {
|
|
212
|
-
label: string;
|
|
213
|
-
section: string;
|
|
214
|
-
auId: number;
|
|
215
|
-
negativeAuId?: number | null;
|
|
216
|
-
bilateral: boolean;
|
|
217
|
-
roles: VRMHumanoidRole[];
|
|
218
|
-
order?: number;
|
|
219
|
-
}
|
|
220
|
-
export interface BodyControlDescriptor {
|
|
221
|
-
id: string;
|
|
222
|
-
label: string;
|
|
223
|
-
section: string;
|
|
224
|
-
auId: number;
|
|
225
|
-
negativeAuId: number | null;
|
|
226
|
-
auIds: number[];
|
|
227
|
-
bilateral: boolean;
|
|
228
|
-
roles: VRMHumanoidRole[];
|
|
229
|
-
order: number;
|
|
230
|
-
boneBindings: Array<BoneBinding & {
|
|
231
|
-
auId: number;
|
|
232
|
-
boneName: string;
|
|
233
|
-
}>;
|
|
234
|
-
morphBindings: MorphTargetsBySide;
|
|
235
|
-
meshNames: string[];
|
|
236
|
-
hasBones: boolean;
|
|
237
|
-
hasMorphs: boolean;
|
|
238
|
-
isMixed: boolean;
|
|
239
|
-
available: boolean;
|
|
240
|
-
diagnostics: string[];
|
|
241
|
-
}
|
|
242
|
-
/** Pose values are normalized authored action amounts, never world Euler angles. */
|
|
243
|
-
export interface SemanticPoseChannel {
|
|
244
|
-
intensity: number;
|
|
245
|
-
/** -1 = character's left, 0 = both, +1 = character's right. */
|
|
246
|
-
balance?: number;
|
|
247
|
-
/** Morph contribution only; bone activation remains intensity. Defaults to profile. */
|
|
248
|
-
morphStrength?: number;
|
|
249
|
-
}
|
|
250
|
-
export interface SemanticPose {
|
|
251
|
-
version: 1;
|
|
252
|
-
controls: Array<{
|
|
253
|
-
controlId: string;
|
|
254
|
-
positive?: SemanticPoseChannel;
|
|
255
|
-
negative?: SemanticPoseChannel;
|
|
256
|
-
}>;
|
|
257
|
-
}
|
|
258
|
-
export interface SemanticPoseDirection {
|
|
259
|
-
auId: number;
|
|
260
|
-
label: string;
|
|
261
|
-
available: boolean;
|
|
262
|
-
availableSides?: Array<'left' | 'right' | 'center'>;
|
|
263
|
-
hasBones: boolean;
|
|
264
|
-
hasMorphs: boolean;
|
|
265
|
-
morphStrength: number;
|
|
266
|
-
}
|
|
267
|
-
export interface SemanticPoseControl {
|
|
268
|
-
id: string;
|
|
269
|
-
label: string;
|
|
270
|
-
section: string;
|
|
271
|
-
roles: string[];
|
|
272
|
-
bilateral: boolean;
|
|
273
|
-
boneNames: string[];
|
|
274
|
-
morphNames: string[];
|
|
275
|
-
positive: SemanticPoseDirection;
|
|
276
|
-
negative?: SemanticPoseDirection;
|
|
277
|
-
}
|
|
278
|
-
export interface SemanticAnimation {
|
|
279
|
-
version: 1;
|
|
280
|
-
durationSeconds: number;
|
|
281
|
-
tracks: Array<{
|
|
282
|
-
controlId: string;
|
|
283
|
-
direction: 'positive' | 'negative';
|
|
284
|
-
balance?: number;
|
|
285
|
-
morphStrength?: number;
|
|
286
|
-
keyframes: Array<{
|
|
287
|
-
time: number;
|
|
288
|
-
intensity: number;
|
|
289
|
-
}>;
|
|
290
|
-
}>;
|
|
291
|
-
}
|
|
292
|
-
export interface SemanticAnimationOptions extends Record<string, unknown> {
|
|
293
|
-
faceCurves?: Record<string, Array<{
|
|
294
|
-
time: number;
|
|
295
|
-
intensity: number;
|
|
296
|
-
inherit?: boolean;
|
|
297
|
-
}>>;
|
|
298
|
-
}
|
|
299
210
|
export interface Profile {
|
|
300
211
|
name?: string;
|
|
301
212
|
animalType?: string;
|
|
@@ -340,8 +251,6 @@ export interface Profile {
|
|
|
340
251
|
disabledRegions?: string[];
|
|
341
252
|
hairPhysics?: HairPhysicsProfileConfig;
|
|
342
253
|
humanoidCharacterization?: HumanoidCharacterization;
|
|
343
|
-
/** Authored overrides may patch individual fields; null removes a preset control. */
|
|
344
|
-
bodyControls?: Record<string, Partial<BodyControlDefinition> | null>;
|
|
345
254
|
}
|
|
346
255
|
export interface ProfileRuntimeConfig extends Partial<Profile> {
|
|
347
256
|
profilePresetId?: PresetType;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { AnimationClip } from 'three';
|
|
2
2
|
import type { Mesh, Object3D } from 'three';
|
|
3
|
+
import type { AUDescriptor } from '@lovelace_lol/embody/wasm';
|
|
3
4
|
import { ThreeFrameApplier } from './index';
|
|
4
5
|
import type { ThreeModelInspection } from './index';
|
|
5
6
|
import type { ThreeModelReferencePose } from './reference-pose';
|
|
@@ -122,7 +123,6 @@ export declare class Embody {
|
|
|
122
123
|
snippetToClip(name: string, curves: JsonObject, options?: CharacterPlaybackOptions): CharacterPlaybackHandle;
|
|
123
124
|
buildTypedClip(name: string, channels: any[], options?: CharacterPlaybackOptions): CharacterPlaybackHandle;
|
|
124
125
|
typedSnippetToClip(name: string, channels: any[], options?: CharacterPlaybackOptions): CharacterPlaybackHandle;
|
|
125
|
-
semanticAnimationToClip(name: string, animation: JsonObject, options?: CharacterPlaybackOptions): CharacterPlaybackHandle;
|
|
126
126
|
playSnippet(snippet: string | {
|
|
127
127
|
name: string;
|
|
128
128
|
curves: JsonObject;
|
|
@@ -164,13 +164,7 @@ export declare class Embody {
|
|
|
164
164
|
setAU(id: number, value: number, balance?: number): void;
|
|
165
165
|
getAU(id: number): number;
|
|
166
166
|
getAUBalance(id: number): number;
|
|
167
|
-
|
|
168
|
-
getSemanticPoseCatalog(): any[];
|
|
169
|
-
captureSemanticPose(): JsonObject;
|
|
170
|
-
validateSemanticPose(pose: JsonObject): JsonObject;
|
|
171
|
-
applySemanticPose(pose: JsonObject): void;
|
|
172
|
-
validateSemanticAnimation(animation: JsonObject, options?: JsonObject): void;
|
|
173
|
-
resetBodyControls(): void;
|
|
167
|
+
getAUDescriptors(): AUDescriptor[];
|
|
174
168
|
setContinuum(negative: number, positive: number, value: number, balance?: number): void;
|
|
175
169
|
getContinuum(negative: number, positive: number): number;
|
|
176
170
|
transitionAU(id: number, value: number, durationMs?: number, balance?: number): CharacterTransitionHandle;
|
|
@@ -2,12 +2,16 @@ import type { Camera, Scene } from 'three';
|
|
|
2
2
|
import { Embody } from './character';
|
|
3
3
|
import type { RustEmbodyHostConfig } from './character';
|
|
4
4
|
import type { CharacterModelLoadOptions, CharacterModelLoadResult, CharacterModelTransform } from './model';
|
|
5
|
-
import type { CharacterSceneBackend, CharacterSceneRenderer, CharacterSceneRenderingController, DefaultCharacterSceneAsyncOptions, ReadyDefaultCharacterScene } from './scene';
|
|
5
|
+
import type { CharacterSceneBackend, CharacterSceneConfiguration, CharacterSceneRenderer, CharacterSceneRenderingController, DefaultCharacterSceneAsyncOptions, ReadyDefaultCharacterScene } from './scene';
|
|
6
|
+
import { DPthreeCameraController } from './annotations/DPthreeCameraController';
|
|
7
|
+
import type { AnnotationCharacterConfig, DPthreeCameraControllerConfig } from './annotations/types';
|
|
6
8
|
import type { Profile } from './authoringTypes';
|
|
7
9
|
export interface CharacterHostCharacterOptions extends CharacterModelTransform {
|
|
8
10
|
modelUrl: string;
|
|
9
11
|
presetType?: string;
|
|
10
|
-
profile?: Profile
|
|
12
|
+
profile?: Partial<Profile>;
|
|
13
|
+
annotationConfig?: AnnotationCharacterConfig;
|
|
14
|
+
scene?: CharacterSceneConfiguration;
|
|
11
15
|
}
|
|
12
16
|
export interface CharacterHostExternalScene {
|
|
13
17
|
scene: Scene;
|
|
@@ -17,7 +21,22 @@ export interface CharacterHostExternalScene {
|
|
|
17
21
|
camera: Camera;
|
|
18
22
|
mountCanvas?: boolean;
|
|
19
23
|
manageResize?: boolean;
|
|
24
|
+
setSceneSettings?: (settings: CharacterSceneConfiguration) => void;
|
|
20
25
|
}
|
|
26
|
+
export type CharacterHostModelLoader = (modelUrl: string, options: CharacterModelLoadOptions & {
|
|
27
|
+
signal: AbortSignal;
|
|
28
|
+
}) => Promise<CharacterModelLoadResult>;
|
|
29
|
+
export type CharacterHostPreparation = CharacterModelLoadResult & {
|
|
30
|
+
engine: Embody;
|
|
31
|
+
character: CharacterHostCharacterOptions;
|
|
32
|
+
signal: AbortSignal;
|
|
33
|
+
};
|
|
34
|
+
export type CharacterHostReady = CharacterHostPreparation & {
|
|
35
|
+
scene: Scene;
|
|
36
|
+
camera: Camera;
|
|
37
|
+
cameraController: DPthreeCameraController | null;
|
|
38
|
+
rendering: CharacterSceneRenderingController | null;
|
|
39
|
+
};
|
|
21
40
|
export interface CharacterHostOptions {
|
|
22
41
|
signal?: AbortSignal;
|
|
23
42
|
container: HTMLElement;
|
|
@@ -26,23 +45,32 @@ export interface CharacterHostOptions {
|
|
|
26
45
|
scene?: Omit<DefaultCharacterSceneAsyncOptions, 'signal'>;
|
|
27
46
|
external?: CharacterHostExternalScene;
|
|
28
47
|
loader?: CharacterModelLoadOptions;
|
|
48
|
+
/** Storage authorization and byte caching remain with the application. */
|
|
49
|
+
loadModel?: CharacterHostModelLoader;
|
|
50
|
+
/** Replays authored mesh edits through the bound engine before GPU preparation. */
|
|
51
|
+
prepareCharacter?: (context: CharacterHostPreparation) => void | Promise<void>;
|
|
52
|
+
onCharacterReady?: (context: CharacterHostReady) => void | Promise<void>;
|
|
53
|
+
/** Default true for compatibility. Editors can retain clips in a lazy catalog. */
|
|
54
|
+
registerEmbeddedAnimations?: boolean;
|
|
55
|
+
camera?: Omit<Partial<DPthreeCameraControllerConfig>, 'scene' | 'camera' | 'renderer' | 'rendering' | 'domElement'>;
|
|
29
56
|
autoStart?: boolean;
|
|
30
57
|
renderLoop?: boolean;
|
|
31
58
|
autoFrame?: boolean;
|
|
32
59
|
}
|
|
33
|
-
export interface CharacterHost extends
|
|
60
|
+
export interface CharacterHost extends CharacterModelLoadResult {
|
|
34
61
|
engine: Embody;
|
|
35
62
|
scene: Scene;
|
|
36
63
|
readonly renderer: CharacterSceneRenderer | null;
|
|
37
64
|
readonly backend: CharacterSceneBackend | null;
|
|
38
65
|
readonly rendering: CharacterSceneRenderingController | null;
|
|
39
66
|
camera: Camera;
|
|
67
|
+
cameraController: DPthreeCameraController | null;
|
|
40
68
|
lighting: ReadyDefaultCharacterScene['lighting'] | null;
|
|
41
69
|
ownsScene: boolean;
|
|
42
70
|
container: HTMLElement;
|
|
43
|
-
setCharacter(character: CharacterHostCharacterOptions, loader?: CharacterModelLoadOptions): Promise<void>;
|
|
71
|
+
setCharacter(character: CharacterHostCharacterOptions, loader?: CharacterModelLoadOptions, signal?: AbortSignal): Promise<void>;
|
|
44
72
|
resize(): void;
|
|
45
73
|
dispose(): Promise<void>;
|
|
46
74
|
}
|
|
47
|
-
/** Acquire
|
|
75
|
+
/** Acquire, prepare and reveal a character using the existing native render owner. */
|
|
48
76
|
export declare function createCharacterHost(options: CharacterHostOptions): Promise<CharacterHost>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import type { SceneInkBackgroundPalette } from './sceneInkBackground';
|
|
3
|
+
/** Reuse the finished palette on character switches without resampling textures. */
|
|
4
|
+
export declare function readCachedCharacterPalette(cacheKey: string): SceneInkBackgroundPalette | null;
|
|
5
|
+
export declare function resolveCharacterMaterialPalette(model: THREE.Object3D, cacheKey: string): SceneInkBackgroundPalette | null;
|
|
6
|
+
export declare function resolveCharacterTexturePalette(model: THREE.Object3D, cacheKey: string): Promise<SceneInkBackgroundPalette | null>;
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export interface BoneTreeNode {
|
|
3
|
+
name: string;
|
|
4
|
+
depth: number;
|
|
5
|
+
parent: string | null;
|
|
6
|
+
children: string[];
|
|
7
|
+
isMapped: boolean;
|
|
8
|
+
/** Semantic key if this bone is mapped (e.g., 'HEAD', 'JAW') */
|
|
9
|
+
semanticKey: string | null;
|
|
10
|
+
/** Full semantic-key set for tree badge rendering when a row resolves multiple mappings */
|
|
11
|
+
semanticKeys?: string[];
|
|
12
|
+
/** Live reference to the Three.js bone object */
|
|
13
|
+
boneObject: THREE.Bone;
|
|
14
|
+
}
|
|
15
|
+
export interface SkeletonOverlayOptions {
|
|
16
|
+
opacityScale?: number;
|
|
17
|
+
focusSelectedBone?: boolean;
|
|
18
|
+
}
|
|
19
|
+
type OverlayAxisKey = 'pitch' | 'yaw' | 'roll';
|
|
20
|
+
export type SkeletonOverlayAxisKey = OverlayAxisKey;
|
|
21
|
+
type SkeletonOverlayRotationChannel = 'rx' | 'ry' | 'rz';
|
|
22
|
+
export interface AxisGizmoPointerData {
|
|
23
|
+
axis: SkeletonOverlayAxisKey;
|
|
24
|
+
channel: SkeletonOverlayRotationChannel;
|
|
25
|
+
boneName: string;
|
|
26
|
+
point: THREE.Vector3;
|
|
27
|
+
origin: THREE.Vector3;
|
|
28
|
+
quaternion: THREE.Quaternion;
|
|
29
|
+
}
|
|
30
|
+
export declare function resolveSkeletonOverlayStartBoneName(root: THREE.Object3D): string | null;
|
|
31
|
+
export declare class SkeletonOverlay {
|
|
32
|
+
private scene;
|
|
33
|
+
private group;
|
|
34
|
+
private visualizations;
|
|
35
|
+
private boneTree;
|
|
36
|
+
private mappedBoneNames;
|
|
37
|
+
private semanticKeyMap;
|
|
38
|
+
private boneLookup;
|
|
39
|
+
private sharedGeometry;
|
|
40
|
+
private mappedMaterial;
|
|
41
|
+
private unmappedMaterial;
|
|
42
|
+
private highlightMaterial;
|
|
43
|
+
private selectedMaterial;
|
|
44
|
+
private contextMaterial;
|
|
45
|
+
private mutedMaterial;
|
|
46
|
+
private axisRingGeometry;
|
|
47
|
+
private axisRingHitGeometry;
|
|
48
|
+
private axisCenterGeometry;
|
|
49
|
+
private pitchRingMaterial;
|
|
50
|
+
private yawRingMaterial;
|
|
51
|
+
private rollRingMaterial;
|
|
52
|
+
private axisHitMaterial;
|
|
53
|
+
private axisCenterMaterial;
|
|
54
|
+
private axisGizmoGroup;
|
|
55
|
+
private axisGizmoMeshes;
|
|
56
|
+
private axisGizmoHitMeshes;
|
|
57
|
+
private sentinelMesh;
|
|
58
|
+
private highlightedBone;
|
|
59
|
+
private selectedBone;
|
|
60
|
+
private activeAxis;
|
|
61
|
+
private opacityScale;
|
|
62
|
+
private focusSelectedBone;
|
|
63
|
+
private visibilityAlpha;
|
|
64
|
+
private visibilityTarget;
|
|
65
|
+
private visibilityLastFrameAt;
|
|
66
|
+
constructor(scene: THREE.Scene, mappedBoneNames: Set<string>, semanticKeyMap: Map<string, string>, options?: SkeletonOverlayOptions);
|
|
67
|
+
/**
|
|
68
|
+
* Build the skeleton visualization from a scene root.
|
|
69
|
+
* Traverses to find all THREE.Bone instances and creates octahedral meshes.
|
|
70
|
+
*/
|
|
71
|
+
loadSkeleton(root: THREE.Object3D): void;
|
|
72
|
+
private createBoneMesh;
|
|
73
|
+
/** Called each frame via onBeforeRender. Updates all bone mesh transforms. */
|
|
74
|
+
private update;
|
|
75
|
+
private syncVisibilityOpacity;
|
|
76
|
+
private syncGroupVisibility;
|
|
77
|
+
private advanceVisibility;
|
|
78
|
+
private resolveSelectedBoneObject;
|
|
79
|
+
private resolveBoneRelativeAxisGizmoRadius;
|
|
80
|
+
private resolveScreenSpaceAxisGizmoRadius;
|
|
81
|
+
private resolveAxisGizmoRadius;
|
|
82
|
+
private updateAxisGizmoAppearance;
|
|
83
|
+
private updateAxisGizmo;
|
|
84
|
+
private applyAxisRingChannel;
|
|
85
|
+
private syncAxisGizmoChannels;
|
|
86
|
+
private getSelectedBonePointerData;
|
|
87
|
+
private getAxisPlaneNormal;
|
|
88
|
+
getBoneTree(): BoneTreeNode[];
|
|
89
|
+
setVisible(visible: boolean): void;
|
|
90
|
+
isVisible(): boolean;
|
|
91
|
+
setHighlighted(boneName: string | null): void;
|
|
92
|
+
setSelected(boneName: string | null): void;
|
|
93
|
+
setActiveAxis(axis: OverlayAxisKey | null): void;
|
|
94
|
+
/** Get world position and rotation for a bone by name */
|
|
95
|
+
getBoneTransform(boneName: string): {
|
|
96
|
+
position: [number, number, number];
|
|
97
|
+
rotation: [number, number, number];
|
|
98
|
+
} | null;
|
|
99
|
+
pickBone(clientX: number, clientY: number, camera: THREE.Camera, domElement: HTMLElement): string | null;
|
|
100
|
+
pickAxisGizmo(clientX: number, clientY: number, camera: THREE.Camera, domElement: HTMLElement): AxisGizmoPointerData | null;
|
|
101
|
+
projectPointerToAxisPlane(clientX: number, clientY: number, camera: THREE.Camera, domElement: HTMLElement, axis: SkeletonOverlayAxisKey): AxisGizmoPointerData | null;
|
|
102
|
+
private isSelectedContextBone;
|
|
103
|
+
private resolveBoneMaterial;
|
|
104
|
+
private refreshBoneMaterials;
|
|
105
|
+
private clear;
|
|
106
|
+
dispose(): void;
|
|
107
|
+
}
|
|
108
|
+
export declare function collectSkeletonBones(root: THREE.Object3D): THREE.Bone[];
|
|
109
|
+
/**
|
|
110
|
+
* Find the model root from a scene by locating the first bone
|
|
111
|
+
* and walking up to the top-level scene child.
|
|
112
|
+
*/
|
|
113
|
+
export declare function findModelRoot(scene: THREE.Scene): THREE.Object3D | null;
|
|
114
|
+
/**
|
|
115
|
+
* Build a set of mapped bone names and a semantic key lookup
|
|
116
|
+
* from an engine's profile configuration.
|
|
117
|
+
*/
|
|
118
|
+
export declare function buildMappedBoneInfo(profile: {
|
|
119
|
+
boneNodes?: Record<string, string>;
|
|
120
|
+
bonePrefix?: string;
|
|
121
|
+
boneSuffix?: string;
|
|
122
|
+
suffixPattern?: string;
|
|
123
|
+
}, actualBoneNames?: Iterable<string>): {
|
|
124
|
+
mappedNames: Set<string>;
|
|
125
|
+
semanticKeyMap: Map<string, string>;
|
|
126
|
+
semanticKeysMap: Map<string, string[]>;
|
|
127
|
+
};
|
|
128
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export interface MorphVertexPreviewOptions {
|
|
3
|
+
threshold?: number;
|
|
4
|
+
maxPoints?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface MorphVertexPreviewSample {
|
|
7
|
+
indices: Uint32Array;
|
|
8
|
+
intensities: Float32Array;
|
|
9
|
+
}
|
|
10
|
+
export interface MorphVertexPreviewRenderData {
|
|
11
|
+
positions: Float32Array;
|
|
12
|
+
colors: Float32Array;
|
|
13
|
+
pointCount: number;
|
|
14
|
+
meshCount: number;
|
|
15
|
+
}
|
|
16
|
+
export declare function resolveMorphPreviewMeshes(root: THREE.Object3D, morphName: string, meshNames?: string[]): THREE.Mesh[];
|
|
17
|
+
export declare function buildMorphVertexPreviewSample(mesh: THREE.Mesh, morphName: string, options?: MorphVertexPreviewOptions): MorphVertexPreviewSample | null;
|
|
18
|
+
export declare function buildMorphVertexPreviewRenderData(meshes: THREE.Mesh[], morphName: string, cache: Map<string, MorphVertexPreviewSample>, options?: MorphVertexPreviewOptions): MorphVertexPreviewRenderData | null;
|
|
19
|
+
/** Editor overlay sampled by the existing Three render loop, without a separate frame timer. */
|
|
20
|
+
export declare class MorphVertexPreview {
|
|
21
|
+
private readonly scene;
|
|
22
|
+
private readonly options;
|
|
23
|
+
private readonly cache;
|
|
24
|
+
private points;
|
|
25
|
+
private active;
|
|
26
|
+
private disposed;
|
|
27
|
+
private unbindRender;
|
|
28
|
+
constructor(scene: THREE.Scene, options?: MorphVertexPreviewOptions);
|
|
29
|
+
show(morphName: string, meshNames?: string[]): void;
|
|
30
|
+
hide(): void;
|
|
31
|
+
dispose(): void;
|
|
32
|
+
private createPoints;
|
|
33
|
+
private update;
|
|
34
|
+
private updateAttribute;
|
|
35
|
+
}
|
package/dist/three/index.d.ts
CHANGED
|
@@ -169,3 +169,5 @@ export declare class ThreeFrameApplier {
|
|
|
169
169
|
export declare const collectMorphMeshes: (root: Object3D) => Mesh<import("three").BufferGeometry<import("three").NormalBufferAttributes, import("three").BufferGeometryEventMap>, Material<import("three").MaterialEventMap> | Material<import("three").MaterialEventMap>[], import("three").Object3DEventMap>[];
|
|
170
170
|
export * from './model';
|
|
171
171
|
export * from './scene';
|
|
172
|
+
export * from './editor/SkeletonOverlay';
|
|
173
|
+
export * from './editor/morphVertexPreview';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
declare const THREE_RENDERED_MORPH_SEMANTICS: readonly ["position", "normal", "color"];
|
|
3
|
+
type ThreeRenderedMorphSemantic = typeof THREE_RENDERED_MORPH_SEMANTICS[number];
|
|
4
|
+
export interface CharacterMorphLayoutRepair {
|
|
5
|
+
meshName: string;
|
|
6
|
+
paddedChannels: Partial<Record<ThreeRenderedMorphSemantic, number>>;
|
|
7
|
+
removedEmptyChannels: ThreeRenderedMorphSemantic[];
|
|
8
|
+
paddedInfluences: number;
|
|
9
|
+
}
|
|
10
|
+
/** Repair recoverable channel holes before Three.js builds its morph texture. */
|
|
11
|
+
export declare function normalizeRenderableCharacterMorphAttributes(model: THREE.Object3D): CharacterMorphLayoutRepair[];
|
|
12
|
+
export declare function assertRenderableCharacterMorphAttributes(model: THREE.Object3D): void;
|
|
13
|
+
export {};
|
package/dist/three/scene.d.ts
CHANGED
|
@@ -126,6 +126,10 @@ export type DefaultCharacterSceneOptions = {
|
|
|
126
126
|
shadowPlane?: boolean;
|
|
127
127
|
manageResize?: boolean;
|
|
128
128
|
};
|
|
129
|
+
/** Saved per-character appearance; renderer preference and DOM ownership stay separate. */
|
|
130
|
+
export type CharacterSceneConfiguration = Pick<DefaultCharacterSceneOptions, 'type' | 'cameraFov' | 'shadows' | 'lightingPreset' | 'lighting' | 'shadowPlane'> & {
|
|
131
|
+
background?: string | number | null;
|
|
132
|
+
};
|
|
129
133
|
export type DefaultCharacterSceneAsyncOptions = DefaultCharacterSceneOptions & {
|
|
130
134
|
/** Auto (default) tries native WebGPU initialization, then falls back to WebGL. */
|
|
131
135
|
renderer?: CharacterSceneRendererPreference;
|
|
@@ -149,6 +153,7 @@ type CharacterScene<R extends CharacterSceneRenderer> = {
|
|
|
149
153
|
sceneType: CharacterSceneTypeId;
|
|
150
154
|
ownsScene: true;
|
|
151
155
|
resize: () => void;
|
|
156
|
+
setSceneSettings: (settings: CharacterSceneConfiguration) => void;
|
|
152
157
|
dispose: () => void;
|
|
153
158
|
};
|
|
154
159
|
export type DefaultCharacterScene = CharacterScene<WebGLRenderer>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export type SceneInkBackgroundPalette = readonly [
|
|
3
|
+
THREE.ColorRepresentation,
|
|
4
|
+
THREE.ColorRepresentation,
|
|
5
|
+
THREE.ColorRepresentation
|
|
6
|
+
];
|
|
7
|
+
export type SceneInkBackground = {
|
|
8
|
+
setPalette: (palette?: SceneInkBackgroundPalette | null) => void;
|
|
9
|
+
dispose: () => void;
|
|
10
|
+
};
|
|
11
|
+
export declare function createSceneInkBackground(onBackgroundChange?: (background: string) => void): SceneInkBackground;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const SCENE_INK_BASE_COLOR = "#29333b";
|
|
2
|
+
export declare const SCENE_INK_BASE_GRADIENT = "radial-gradient(ellipse at 50% 42%, #46535c 0%, #35414a 42%, #29333b 76%, #252e35 100%)";
|
|
3
|
+
export type SceneInkCssPalette = readonly [string, string, string];
|
|
4
|
+
export declare function createSceneInkBackgroundCss(palette?: SceneInkCssPalette): string;
|
|
5
|
+
export declare const DEFAULT_SCENE_INK_BACKGROUND: string;
|