@laplace.live/persona-sdk 1.3.0 → 1.5.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/dist/client/client.d.ts +1 -0
- package/dist/client/client.js +3 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/values/controller.d.ts +11 -11
- package/dist/values/controller.js +24 -44
- package/dist/values/curve.d.ts +4 -4
- package/dist/values/effect-schema.d.ts +4 -0
- package/dist/values/effect-schema.js +76 -30
- package/dist/values/guards.d.ts +12 -0
- package/dist/values/guards.js +16 -0
- package/dist/values/hands.d.ts +22 -22
- package/dist/values/hands.js +30 -58
- package/dist/values/hotkeys.d.ts +14 -0
- package/dist/values/hotkeys.js +13 -1
- package/dist/values/labels.d.ts +10 -5
- package/dist/values/labels.js +20 -9
- package/dist/values/lipsync.d.ts +2 -2
- package/dist/values/lipsync.js +2 -15
- package/dist/values/locale.d.ts +9 -4
- package/dist/values/locale.js +4 -3
- package/dist/values/scene-transition.d.ts +14 -0
- package/dist/values/scene-transition.js +36 -0
- package/dist/wire/errors.js +3 -2
- package/dist/wire/events.d.ts +4 -4
- package/dist/wire/events.js +3 -2
- package/dist/wire/methods.d.ts +13 -13
- package/dist/wire/protocol.d.ts +3 -1
- package/dist/wire/protocol.js +3 -1
- package/dist/wire/schemas.d.ts +18 -2
- package/dist/wire/schemas.js +17 -7
- package/dist/wire/types.d.ts +123 -22
- package/dist/wire/types.js +60 -66
- package/package.json +1 -1
package/dist/wire/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ControllerConfig } from '../values/controller.ts';
|
|
2
|
-
import type { EFFECT_SCOPES } from '../values/effect-schema.ts';
|
|
2
|
+
import type { EFFECT_BLEND_MODES, EFFECT_SCOPES } from '../values/effect-schema.ts';
|
|
3
|
+
import type { SCENE_TRANSITION_TYPES } from '../values/scene-transition.ts';
|
|
3
4
|
import { type ArkitInputName } from '../values/arkit.ts';
|
|
4
5
|
import { type BaseControllerInputName, type ControllerInputName, type ControllerMovementConfig } from '../values/controller.ts';
|
|
5
6
|
import { type HandInputName } from '../values/hands.ts';
|
|
@@ -175,7 +176,8 @@ export interface SceneModelItem {
|
|
|
175
176
|
/** MToon material fine-tuning, VRM only. */
|
|
176
177
|
mtoon: MToonTuning;
|
|
177
178
|
}
|
|
178
|
-
export
|
|
179
|
+
export declare const OBJECT_SPACES: readonly ["2d", "3d"];
|
|
180
|
+
export type ObjectSpace = (typeof OBJECT_SPACES)[number];
|
|
179
181
|
/** Where a webpage overlay renders relative to the stage. */
|
|
180
182
|
export type WebLayer = 'behind' | 'front';
|
|
181
183
|
export type CaptureKind = 'display' | 'window';
|
|
@@ -607,8 +609,50 @@ export interface SceneDroplets {
|
|
|
607
609
|
/** Specular glint on drops where the frame is transparent, so rain reads over the desktop (0 to 1). */
|
|
608
610
|
glints: number;
|
|
609
611
|
}
|
|
610
|
-
/** Blend modes shared
|
|
611
|
-
export type EffectBlendMode =
|
|
612
|
+
/** Blend modes shared by Shoost's rim light and gradient. */
|
|
613
|
+
export type EffectBlendMode = (typeof EFFECT_BLEND_MODES)[number];
|
|
614
|
+
/** Solid, linear, or radial color overlay in scene or source coordinates. */
|
|
615
|
+
export interface EffectGradient {
|
|
616
|
+
enabled: boolean;
|
|
617
|
+
type: 'solid' | 'linear' | 'circle' | 'ellipse';
|
|
618
|
+
blendMode: EffectBlendMode;
|
|
619
|
+
/** Foreground color (hex). */
|
|
620
|
+
color: string;
|
|
621
|
+
/** Outer or background color (hex). */
|
|
622
|
+
backgroundColor: string;
|
|
623
|
+
invert: boolean;
|
|
624
|
+
transparentBackground: boolean;
|
|
625
|
+
radius: number;
|
|
626
|
+
smoothness: number;
|
|
627
|
+
/** Horizontal center offset in normalized coordinates, -1..1. */
|
|
628
|
+
centerX: number;
|
|
629
|
+
/** Vertical center offset in normalized coordinates, -1..1. */
|
|
630
|
+
centerY: number;
|
|
631
|
+
/** Gradient rotation in degrees, -180..180. */
|
|
632
|
+
angle: number;
|
|
633
|
+
scaleX: number;
|
|
634
|
+
scaleY: number;
|
|
635
|
+
opacity: number;
|
|
636
|
+
}
|
|
637
|
+
/** Directional screen-space light with an independent monitor glow. */
|
|
638
|
+
export interface SceneFlare {
|
|
639
|
+
enabled: boolean;
|
|
640
|
+
mode: 'add' | 'screen' | 'colorDodge';
|
|
641
|
+
/** Light color (hex). */
|
|
642
|
+
color: string;
|
|
643
|
+
intensity: number;
|
|
644
|
+
size: number;
|
|
645
|
+
/** Light direction in degrees, -180..180. */
|
|
646
|
+
angle: number;
|
|
647
|
+
glowOpacity: number;
|
|
648
|
+
rays: boolean;
|
|
649
|
+
raysMode: 'sun' | 'shine' | 'god';
|
|
650
|
+
/** Particle-ray color (hex). */
|
|
651
|
+
raysColor: string;
|
|
652
|
+
raysScale: number;
|
|
653
|
+
raysIntensity: number;
|
|
654
|
+
raysOpacity: number;
|
|
655
|
+
}
|
|
612
656
|
/** Directional silhouette lighting, optionally sharpened or applied to both sides. */
|
|
613
657
|
export interface SceneRim {
|
|
614
658
|
enabled: boolean;
|
|
@@ -698,6 +742,8 @@ export interface EffectValues {
|
|
|
698
742
|
colorWheels: EffectColorWheels;
|
|
699
743
|
colorShift: EffectColorShift;
|
|
700
744
|
selectColors: EffectSelectColors;
|
|
745
|
+
gradient: EffectGradient;
|
|
746
|
+
flare: SceneFlare;
|
|
701
747
|
blur: EffectBlur;
|
|
702
748
|
chromaticAberration: SceneChromaticAberration;
|
|
703
749
|
grain: SceneFilmGrain;
|
|
@@ -796,6 +842,19 @@ export interface SceneEnvironment {
|
|
|
796
842
|
*/
|
|
797
843
|
effectLayers: ToggleEffectKey[];
|
|
798
844
|
}
|
|
845
|
+
/** An effect played when this destination scene becomes active. */
|
|
846
|
+
export interface SceneTransition {
|
|
847
|
+
type: (typeof SCENE_TRANSITION_TYPES)[number];
|
|
848
|
+
/** Total animation time in milliseconds, 100–10,000; cuts are immediate. */
|
|
849
|
+
durationMs: number;
|
|
850
|
+
color: string;
|
|
851
|
+
/** A registered image/video id; filesystem paths never cross the wire. */
|
|
852
|
+
assetId: string | null;
|
|
853
|
+
/** Fraction of the animation where the scene changes, 0.05–0.95. */
|
|
854
|
+
switchPoint: number;
|
|
855
|
+
/** Fade a video's opacity at its start and end; false preserves the clip's authored alpha. */
|
|
856
|
+
autoFade: boolean;
|
|
857
|
+
}
|
|
799
858
|
export interface Scene {
|
|
800
859
|
id: string;
|
|
801
860
|
name: string;
|
|
@@ -808,6 +867,8 @@ export interface Scene {
|
|
|
808
867
|
/** Array order is display order only; live lights are keyed by id. */
|
|
809
868
|
lights: SceneLight[];
|
|
810
869
|
environment: SceneEnvironment;
|
|
870
|
+
/** Absent on older hosts; gate editing on the `scene-transitions` capability. */
|
|
871
|
+
transition?: SceneTransition;
|
|
811
872
|
/** Electron accelerator that applies this scene, or null. */
|
|
812
873
|
shortcut: string | null;
|
|
813
874
|
}
|
|
@@ -827,12 +888,13 @@ export interface ScenePatch {
|
|
|
827
888
|
vrmCamera?: SceneCamera;
|
|
828
889
|
lights?: SceneLight[];
|
|
829
890
|
environment?: SceneEnvironment;
|
|
891
|
+
transition?: SceneTransition;
|
|
830
892
|
}
|
|
831
893
|
/**
|
|
832
894
|
* App-level features a client gates on (never version-sniff): `hello` and
|
|
833
895
|
* `app.info` report them — the per-app mirror of {@link InstanceRuntime.capabilities}.
|
|
834
896
|
*/
|
|
835
|
-
export declare const APP_CAPABILITIES: readonly ["storage", "speech", "
|
|
897
|
+
export declare const APP_CAPABILITIES: readonly ["storage", "speech", "automations", "controllers", "model-editing", "asset-inspection", "layer-effects", "scene-transitions"];
|
|
836
898
|
export type AppCapability = (typeof APP_CAPABILITIES)[number];
|
|
837
899
|
export declare function isAppCapability(v: unknown): v is AppCapability;
|
|
838
900
|
/** What a loaded model instance can do; absent capabilities answer `unsupported-for-format`. */
|
|
@@ -904,23 +966,27 @@ export interface HotkeyState extends HotkeyConfig {
|
|
|
904
966
|
/** Hotkey ids currently registered with the OS (active model only). */
|
|
905
967
|
registered: string[];
|
|
906
968
|
}
|
|
907
|
-
/** Action kinds an app
|
|
908
|
-
export declare const
|
|
909
|
-
export type
|
|
969
|
+
/** Action kinds an app automation can carry today; servers may send kinds newer than this list. */
|
|
970
|
+
export declare const AUTOMATION_ACTION_KINDS: readonly ["effect-toggle", "effect-params", "camera-pose", "reset-camera", "layer-visibility", "stream-mode", "delay"];
|
|
971
|
+
export type AutomationActionKind = (typeof AUTOMATION_ACTION_KINDS)[number];
|
|
910
972
|
/**
|
|
911
|
-
* One app
|
|
912
|
-
*
|
|
973
|
+
* One app automation as clients see it. Action payloads stay app-side — `actionKinds`
|
|
974
|
+
* drives derived labels.
|
|
913
975
|
*/
|
|
914
|
-
export interface
|
|
976
|
+
export interface AutomationInfo {
|
|
915
977
|
id: string;
|
|
916
|
-
/** User-given name, or null — derive a label from `actionKinds` (see `
|
|
978
|
+
/** User-given name, or null — derive a label from `actionKinds` (see `automationLabel`). */
|
|
917
979
|
title: string | null;
|
|
918
|
-
/** Bound key combo, or null
|
|
980
|
+
/** Bound key combo, or null when the automation has no keyboard/controller trigger. */
|
|
919
981
|
accelerator: string | null;
|
|
920
982
|
/** May include kinds newer than this SDK; label those generically. */
|
|
921
983
|
actionKinds: string[];
|
|
922
984
|
/** Whether the combo is currently registered with the OS. */
|
|
923
985
|
registered: boolean;
|
|
986
|
+
/** Whether this automation can run. */
|
|
987
|
+
enabled: boolean;
|
|
988
|
+
/** Additional event trigger kinds. Trigger settings stay desktop-side. */
|
|
989
|
+
triggerKinds: string[];
|
|
924
990
|
}
|
|
925
991
|
export interface ExpressionPersistence {
|
|
926
992
|
supported: boolean;
|
|
@@ -931,6 +997,8 @@ export interface ExpressionPersistence {
|
|
|
931
997
|
export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
932
998
|
[key: string]: JsonValue;
|
|
933
999
|
};
|
|
1000
|
+
export declare const LIVE2D_ENGINES: readonly ["pixi", "three"];
|
|
1001
|
+
export type Live2DEngine = (typeof LIVE2D_ENGINES)[number];
|
|
934
1002
|
export declare const TRACKING_SOURCE_IDS: readonly ["persona-ios", "ifacialmocap", "vts-ios"];
|
|
935
1003
|
export type TrackingSourceId = (typeof TRACKING_SOURCE_IDS)[number];
|
|
936
1004
|
/** Body-pose protocols. Every one so far is UDP with a configurable port. */
|
|
@@ -941,17 +1009,18 @@ export type PoseStatus = 'off' | 'waiting' | 'tracking';
|
|
|
941
1009
|
/** Every protocol a tracking source instance can speak; face and body kinds. */
|
|
942
1010
|
export declare const TRACKING_SOURCE_KINDS: readonly ["persona-ios", "ifacialmocap", "vts-ios", "vmc", "mocopi", "mediapipe"];
|
|
943
1011
|
export type TrackingSourceKind = (typeof TRACKING_SOURCE_KINDS)[number];
|
|
944
|
-
export
|
|
945
|
-
export type TrackingChannel = (typeof TRACKING_CHANNELS)[number];
|
|
1012
|
+
export type TrackingChannel = keyof typeof TRACKING_CHANNEL_FIELDS;
|
|
946
1013
|
/** The scene-item binding each channel reads and writes. */
|
|
947
1014
|
export declare const TRACKING_CHANNEL_FIELDS: {
|
|
948
1015
|
readonly face: "faceSourceId";
|
|
949
1016
|
readonly pose: "poseSourceId";
|
|
950
1017
|
readonly hands: "handSourceId";
|
|
951
1018
|
};
|
|
1019
|
+
export declare const TRACKING_CHANNELS: readonly TrackingChannel[];
|
|
952
1020
|
export declare const HAND_TRACKING_MODES: readonly ["arms", "fingers"];
|
|
953
1021
|
export type HandTrackingMode = (typeof HAND_TRACKING_MODES)[number];
|
|
954
1022
|
export declare function isHandTrackingMode(v: unknown): v is HandTrackingMode;
|
|
1023
|
+
export declare const MEDIAPIPE_DELEGATES: readonly ["CPU", "GPU"];
|
|
955
1024
|
/** The shared webcam source's enabled inference tasks and camera configuration. */
|
|
956
1025
|
export interface MediaPipeConfig {
|
|
957
1026
|
deviceId: string;
|
|
@@ -959,7 +1028,7 @@ export interface MediaPipeConfig {
|
|
|
959
1028
|
face: boolean;
|
|
960
1029
|
hands: boolean;
|
|
961
1030
|
body: boolean;
|
|
962
|
-
delegate:
|
|
1031
|
+
delegate: (typeof MEDIAPIPE_DELEGATES)[number];
|
|
963
1032
|
}
|
|
964
1033
|
export declare const DEFAULT_MEDIAPIPE_CONFIG: Readonly<MediaPipeConfig>;
|
|
965
1034
|
/** Whether a source kind uses a network face receiver. */
|
|
@@ -1044,7 +1113,7 @@ export interface Settings {
|
|
|
1044
1113
|
effectsQuality: EffectsQuality;
|
|
1045
1114
|
/** Absent on older hosts. */
|
|
1046
1115
|
renderScale?: number;
|
|
1047
|
-
live2dEngine?:
|
|
1116
|
+
live2dEngine?: Live2DEngine;
|
|
1048
1117
|
};
|
|
1049
1118
|
/** `enabled` gates network face sources; `source` mirrors the first one's kind for old clients. */
|
|
1050
1119
|
tracking: {
|
|
@@ -1074,12 +1143,43 @@ export interface SettingsPatch {
|
|
|
1074
1143
|
selectionOutline?: boolean;
|
|
1075
1144
|
effectsQuality?: EffectsQuality;
|
|
1076
1145
|
renderScale?: number;
|
|
1077
|
-
live2dEngine?:
|
|
1146
|
+
live2dEngine?: Live2DEngine;
|
|
1078
1147
|
};
|
|
1079
1148
|
}
|
|
1080
|
-
/**
|
|
1081
|
-
|
|
1082
|
-
|
|
1149
|
+
/**
|
|
1150
|
+
* From VTS's own registry (`FaceTrackingParamInfo.paramNameDictionary`), which is both the
|
|
1151
|
+
* range its editor seeds a new parameter with and what every `.vtube.json` was authored
|
|
1152
|
+
* against. Two families differ deliberately:
|
|
1153
|
+
*
|
|
1154
|
+
* - **the brow inputs** are signed here. VTS lists them `0..1`; we derive them as
|
|
1155
|
+
* `brow-up − brow-down`, so a frown needs the lower half.
|
|
1156
|
+
* - **`JawOpen`** is absent from VTS's registry — it exists there only as a plugin-created
|
|
1157
|
+
* parameter, which VTS then special-cases — so its span is the ARKit channel's.
|
|
1158
|
+
*/
|
|
1159
|
+
declare const VTS_INPUT_RANGES: {
|
|
1160
|
+
readonly FaceAngleX: readonly [-30, 30];
|
|
1161
|
+
readonly FaceAngleY: readonly [-30, 30];
|
|
1162
|
+
readonly FaceAngleZ: readonly [-90, 90];
|
|
1163
|
+
readonly FacePositionX: readonly [-15, 15];
|
|
1164
|
+
readonly FacePositionY: readonly [-15, 15];
|
|
1165
|
+
readonly FacePositionZ: readonly [-10, 10];
|
|
1166
|
+
readonly EyeOpenLeft: readonly [0, 1];
|
|
1167
|
+
readonly EyeOpenRight: readonly [0, 1];
|
|
1168
|
+
readonly EyeLeftX: readonly [-1, 1];
|
|
1169
|
+
readonly EyeLeftY: readonly [-1, 1];
|
|
1170
|
+
readonly EyeRightX: readonly [-1, 1];
|
|
1171
|
+
readonly EyeRightY: readonly [-1, 1];
|
|
1172
|
+
readonly Brows: readonly [-1, 1];
|
|
1173
|
+
readonly BrowLeftY: readonly [-1, 1];
|
|
1174
|
+
readonly BrowRightY: readonly [-1, 1];
|
|
1175
|
+
readonly MouthSmile: readonly [0, 1];
|
|
1176
|
+
readonly MouthOpen: readonly [0, 1];
|
|
1177
|
+
readonly MouthX: readonly [-1, 1];
|
|
1178
|
+
readonly CheekPuff: readonly [0, 1];
|
|
1179
|
+
readonly JawOpen: readonly [0, 1];
|
|
1180
|
+
readonly TongueOut: readonly [0, 1];
|
|
1181
|
+
};
|
|
1182
|
+
type VtsInputName = keyof typeof VTS_INPUT_RANGES;
|
|
1083
1183
|
/**
|
|
1084
1184
|
* Default input vocabulary: face and hand inputs, raw ARKit channels and controller profile 1.
|
|
1085
1185
|
* Additional controller profile ids are accepted by isInputName without appearing in this list.
|
|
@@ -1124,7 +1224,8 @@ export declare function getInputRange(name: InputName): readonly [number, number
|
|
|
1124
1224
|
* - `vrm-expression` — reserved, not implemented yet; the server answers
|
|
1125
1225
|
* `unsupported-for-format`.
|
|
1126
1226
|
*/
|
|
1127
|
-
export
|
|
1227
|
+
export declare const INJECT_TARGET_TYPES: readonly ["input", "live2d-param", "vrm-expression"];
|
|
1228
|
+
export type InjectTargetType = (typeof INJECT_TARGET_TYPES)[number];
|
|
1128
1229
|
export interface InjectTarget {
|
|
1129
1230
|
type: InjectTargetType;
|
|
1130
1231
|
id: string;
|
package/dist/wire/types.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// filesystem-shaped — model refs are sanitized to ids, never directories.
|
|
4
4
|
import { ARKIT_INPUT_NAMES } from "../values/arkit.js";
|
|
5
5
|
import { BASE_CONTROLLER_INPUT_NAMES, BASE_CONTROLLER_INPUT_RANGES, controllerInputRange, isControllerInputName, } from "../values/controller.js";
|
|
6
|
+
import { isOneOf, keysOf } from "../values/guards.js";
|
|
6
7
|
import { HAND_INPUT_NAMES, HAND_INPUT_RANGES } from "../values/hands.js";
|
|
7
8
|
import { VOICE_INPUT_NAMES, VOICE_INPUT_RANGES, } from "../values/lipsync.js";
|
|
8
9
|
/**
|
|
@@ -13,8 +14,10 @@ import { VOICE_INPUT_NAMES, VOICE_INPUT_RANGES, } from "../values/lipsync.js";
|
|
|
13
14
|
export const ASSET_KINDS = ['image', 'video', 'prop', 'ibl', 'lut', 'animation', 'cameraMotion'];
|
|
14
15
|
/** Narrow a kind string to the set the asset registry owns — models and effects have their own. */
|
|
15
16
|
export function isAssetKind(v) {
|
|
16
|
-
return
|
|
17
|
+
return isOneOf(v, ASSET_KINDS);
|
|
17
18
|
}
|
|
19
|
+
// ---- Objects -------------------------------------------------------------------
|
|
20
|
+
export const OBJECT_SPACES = ['2d', '3d'];
|
|
18
21
|
/**
|
|
19
22
|
* Per-light shadow tier. `off` is the old `castShadow: false`; the rest raise
|
|
20
23
|
* shadow-map resolution. A point light pays 6 cube faces for the same tier a
|
|
@@ -29,42 +32,46 @@ export const SHADOW_QUALITY_LEVELS = ['off', 'low', 'medium', 'high', 'ultra'];
|
|
|
29
32
|
export const APP_CAPABILITIES = [
|
|
30
33
|
'storage',
|
|
31
34
|
'speech',
|
|
32
|
-
'
|
|
35
|
+
'automations',
|
|
33
36
|
'controllers',
|
|
34
37
|
'model-editing',
|
|
35
38
|
'asset-inspection',
|
|
36
39
|
'layer-effects',
|
|
40
|
+
'scene-transitions',
|
|
37
41
|
];
|
|
38
42
|
export function isAppCapability(v) {
|
|
39
|
-
return
|
|
43
|
+
return isOneOf(v, APP_CAPABILITIES);
|
|
40
44
|
}
|
|
41
|
-
// ---- App
|
|
42
|
-
/** Action kinds an app
|
|
43
|
-
export const
|
|
45
|
+
// ---- App automations --------------------------------------------------------------
|
|
46
|
+
/** Action kinds an app automation can carry today; servers may send kinds newer than this list. */
|
|
47
|
+
export const AUTOMATION_ACTION_KINDS = [
|
|
44
48
|
'effect-toggle',
|
|
45
49
|
'effect-params',
|
|
46
50
|
'camera-pose',
|
|
47
51
|
'reset-camera',
|
|
48
52
|
'layer-visibility',
|
|
49
53
|
'stream-mode',
|
|
54
|
+
'delay',
|
|
50
55
|
];
|
|
51
56
|
// ---- Settings ------------------------------------------------------------------
|
|
57
|
+
export const LIVE2D_ENGINES = ['pixi', 'three'];
|
|
52
58
|
export const TRACKING_SOURCE_IDS = ['persona-ios', 'ifacialmocap', 'vts-ios'];
|
|
53
59
|
/** Body-pose protocols. Every one so far is UDP with a configurable port. */
|
|
54
60
|
export const POSE_SOURCE_IDS = ['vmc', 'mocopi'];
|
|
55
61
|
/** Every protocol a tracking source instance can speak; face and body kinds. */
|
|
56
62
|
export const TRACKING_SOURCE_KINDS = [...TRACKING_SOURCE_IDS, ...POSE_SOURCE_IDS, 'mediapipe'];
|
|
57
|
-
export const TRACKING_CHANNELS = ['face', 'pose', 'hands'];
|
|
58
63
|
/** The scene-item binding each channel reads and writes. */
|
|
59
64
|
export const TRACKING_CHANNEL_FIELDS = {
|
|
60
65
|
face: 'faceSourceId',
|
|
61
66
|
pose: 'poseSourceId',
|
|
62
67
|
hands: 'handSourceId',
|
|
63
68
|
};
|
|
69
|
+
export const TRACKING_CHANNELS = keysOf(TRACKING_CHANNEL_FIELDS);
|
|
64
70
|
export const HAND_TRACKING_MODES = ['arms', 'fingers'];
|
|
65
71
|
export function isHandTrackingMode(v) {
|
|
66
|
-
return
|
|
72
|
+
return isOneOf(v, HAND_TRACKING_MODES);
|
|
67
73
|
}
|
|
74
|
+
export const MEDIAPIPE_DELEGATES = ['CPU', 'GPU'];
|
|
68
75
|
export const DEFAULT_MEDIAPIPE_CONFIG = {
|
|
69
76
|
deviceId: '',
|
|
70
77
|
mirror: true,
|
|
@@ -75,11 +82,11 @@ export const DEFAULT_MEDIAPIPE_CONFIG = {
|
|
|
75
82
|
};
|
|
76
83
|
/** Whether a source kind uses a network face receiver. */
|
|
77
84
|
export function isFaceSourceKind(kind) {
|
|
78
|
-
return
|
|
85
|
+
return isOneOf(kind, TRACKING_SOURCE_IDS);
|
|
79
86
|
}
|
|
80
87
|
/** Whether a source uses a network body receiver. */
|
|
81
88
|
export function isPoseSource(source) {
|
|
82
|
-
return
|
|
89
|
+
return isOneOf(source.kind, POSE_SOURCE_IDS);
|
|
83
90
|
}
|
|
84
91
|
const FACE_ONLY = ['face'];
|
|
85
92
|
const POSE_ONLY = ['pose'];
|
|
@@ -119,30 +126,41 @@ export const EFFECTS_QUALITY_LEVELS = ['low', 'medium', 'high'];
|
|
|
119
126
|
*/
|
|
120
127
|
export const FPS_LIMIT_PRESETS = [0, 15, 30, 60, 90];
|
|
121
128
|
// ---- Injection -----------------------------------------------------------------
|
|
129
|
+
/**
|
|
130
|
+
* From VTS's own registry (`FaceTrackingParamInfo.paramNameDictionary`), which is both the
|
|
131
|
+
* range its editor seeds a new parameter with and what every `.vtube.json` was authored
|
|
132
|
+
* against. Two families differ deliberately:
|
|
133
|
+
*
|
|
134
|
+
* - **the brow inputs** are signed here. VTS lists them `0..1`; we derive them as
|
|
135
|
+
* `brow-up − brow-down`, so a frown needs the lower half.
|
|
136
|
+
* - **`JawOpen`** is absent from VTS's registry — it exists there only as a plugin-created
|
|
137
|
+
* parameter, which VTS then special-cases — so its span is the ARKit channel's.
|
|
138
|
+
*/
|
|
139
|
+
const VTS_INPUT_RANGES = {
|
|
140
|
+
FaceAngleX: [-30, 30],
|
|
141
|
+
FaceAngleY: [-30, 30],
|
|
142
|
+
FaceAngleZ: [-90, 90],
|
|
143
|
+
FacePositionX: [-15, 15],
|
|
144
|
+
FacePositionY: [-15, 15],
|
|
145
|
+
FacePositionZ: [-10, 10],
|
|
146
|
+
EyeOpenLeft: [0, 1],
|
|
147
|
+
EyeOpenRight: [0, 1],
|
|
148
|
+
EyeLeftX: [-1, 1],
|
|
149
|
+
EyeLeftY: [-1, 1],
|
|
150
|
+
EyeRightX: [-1, 1],
|
|
151
|
+
EyeRightY: [-1, 1],
|
|
152
|
+
Brows: [-1, 1],
|
|
153
|
+
BrowLeftY: [-1, 1],
|
|
154
|
+
BrowRightY: [-1, 1],
|
|
155
|
+
MouthSmile: [0, 1],
|
|
156
|
+
MouthOpen: [0, 1],
|
|
157
|
+
MouthX: [-1, 1],
|
|
158
|
+
CheekPuff: [0, 1],
|
|
159
|
+
JawOpen: [0, 1],
|
|
160
|
+
TongueOut: [0, 1],
|
|
161
|
+
};
|
|
122
162
|
/** VTS's input vocabulary, plus `JawOpen` — the derived half of {@link INPUT_NAMES}. */
|
|
123
|
-
const VTS_INPUT_NAMES =
|
|
124
|
-
'FaceAngleX',
|
|
125
|
-
'FaceAngleY',
|
|
126
|
-
'FaceAngleZ',
|
|
127
|
-
'FacePositionX',
|
|
128
|
-
'FacePositionY',
|
|
129
|
-
'FacePositionZ',
|
|
130
|
-
'EyeOpenLeft',
|
|
131
|
-
'EyeOpenRight',
|
|
132
|
-
'EyeLeftX',
|
|
133
|
-
'EyeLeftY',
|
|
134
|
-
'EyeRightX',
|
|
135
|
-
'EyeRightY',
|
|
136
|
-
'Brows',
|
|
137
|
-
'BrowLeftY',
|
|
138
|
-
'BrowRightY',
|
|
139
|
-
'MouthSmile',
|
|
140
|
-
'MouthOpen',
|
|
141
|
-
'MouthX',
|
|
142
|
-
'CheekPuff',
|
|
143
|
-
'JawOpen',
|
|
144
|
-
'TongueOut',
|
|
145
|
-
];
|
|
163
|
+
const VTS_INPUT_NAMES = keysOf(VTS_INPUT_RANGES);
|
|
146
164
|
/**
|
|
147
165
|
* Default input vocabulary: face and hand inputs, raw ARKit channels and controller profile 1.
|
|
148
166
|
* Additional controller profile ids are accepted by isInputName without appearing in this list.
|
|
@@ -180,39 +198,6 @@ export const BINDING_INPUT_NAMES = INPUT_NAMES.filter(n => !isArkitTwinAlias(n))
|
|
|
180
198
|
export function arkitTwinOf(input) {
|
|
181
199
|
return isArkitTwinAlias(input) ? ARKIT_TWINS[input] : input;
|
|
182
200
|
}
|
|
183
|
-
/**
|
|
184
|
-
* From VTS's own registry (`FaceTrackingParamInfo.paramNameDictionary`), which is both the
|
|
185
|
-
* range its editor seeds a new parameter with and what every `.vtube.json` was authored
|
|
186
|
-
* against. Two families differ deliberately:
|
|
187
|
-
*
|
|
188
|
-
* - **the brow inputs** are signed here. VTS lists them `0..1`; we derive them as
|
|
189
|
-
* `brow-up − brow-down`, so a frown needs the lower half.
|
|
190
|
-
* - **`JawOpen`** is absent from VTS's registry — it exists there only as a plugin-created
|
|
191
|
-
* parameter, which VTS then special-cases — so its span is the ARKit channel's.
|
|
192
|
-
*/
|
|
193
|
-
const VTS_INPUT_RANGES = {
|
|
194
|
-
FaceAngleX: [-30, 30],
|
|
195
|
-
FaceAngleY: [-30, 30],
|
|
196
|
-
FaceAngleZ: [-90, 90],
|
|
197
|
-
FacePositionX: [-15, 15],
|
|
198
|
-
FacePositionY: [-15, 15],
|
|
199
|
-
FacePositionZ: [-10, 10],
|
|
200
|
-
EyeOpenLeft: [0, 1],
|
|
201
|
-
EyeOpenRight: [0, 1],
|
|
202
|
-
EyeLeftX: [-1, 1],
|
|
203
|
-
EyeLeftY: [-1, 1],
|
|
204
|
-
EyeRightX: [-1, 1],
|
|
205
|
-
EyeRightY: [-1, 1],
|
|
206
|
-
Brows: [-1, 1],
|
|
207
|
-
BrowLeftY: [-1, 1],
|
|
208
|
-
BrowRightY: [-1, 1],
|
|
209
|
-
MouthSmile: [0, 1],
|
|
210
|
-
MouthOpen: [0, 1],
|
|
211
|
-
MouthX: [-1, 1],
|
|
212
|
-
CheekPuff: [0, 1],
|
|
213
|
-
JawOpen: [0, 1],
|
|
214
|
-
TongueOut: [0, 1],
|
|
215
|
-
};
|
|
216
201
|
/** ARKit blendshapes are unit-scale by definition, so every raw channel shares one span. */
|
|
217
202
|
const ARKIT_RANGE = [0, 1];
|
|
218
203
|
/**
|
|
@@ -232,3 +217,12 @@ export const INPUT_RANGES = {
|
|
|
232
217
|
export function getInputRange(name) {
|
|
233
218
|
return isControllerInputName(name) ? controllerInputRange(name) : INPUT_RANGES[name];
|
|
234
219
|
}
|
|
220
|
+
/**
|
|
221
|
+
* What an injected value drives:
|
|
222
|
+
* - `input` — a VTS-vocabulary tracking input (`MouthOpen`, `FaceAngleX`, …), mapped
|
|
223
|
+
* through the model's own tracking rules. Live2D only.
|
|
224
|
+
* - `live2d-param` — a Cubism parameter id, written directly.
|
|
225
|
+
* - `vrm-expression` — reserved, not implemented yet; the server answers
|
|
226
|
+
* `unsupported-for-format`.
|
|
227
|
+
*/
|
|
228
|
+
export const INJECT_TARGET_TYPES = ['input', 'live2d-param', 'vrm-expression'];
|