@davi-ai/react-bodyengine-three 1.0.26 → 1.0.27
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/components/AdaptiveDpr.d.ts +3 -0
- package/dist/index.js +424 -406
- package/dist/stats.html +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,37 +1,38 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as we from "react";
|
|
2
|
+
import v, { useState as D, useMemo as ye, useEffect as V, useRef as se, useCallback as $e, Suspense as et } from "react";
|
|
2
3
|
import * as A from "three/webgpu";
|
|
3
|
-
import { Vector3 as
|
|
4
|
-
import { Object3D as
|
|
5
|
-
import { CharacterState as J, CreationTool as ee, AvaturnLoader as
|
|
6
|
-
import { CharacterState as
|
|
7
|
-
import { useDetectGPU as
|
|
8
|
-
import { convertToTexture as
|
|
9
|
-
import { ssgi as
|
|
10
|
-
import {
|
|
11
|
-
import { createSpeechSynthesisPonyfill as
|
|
4
|
+
import { Vector3 as tt, TempNode as st, NodeUpdateType as rt, Matrix4 as X, Vector2 as pe, RenderTarget as be, DepthTexture as Me, HalfFloatType as Te, NodeMaterial as nt, RendererUtils as Ae, Color as at, QuadMesh as ot, FloatType as it } from "three/webgpu";
|
|
5
|
+
import { Object3D as sr } from "three/webgpu";
|
|
6
|
+
import { CharacterState as J, CreationTool as ee, AvaturnLoader as ct, AvatarSDKLoader as lt, CC3Loader as ht, Character as he } from "@davi-ai/bodyengine-three";
|
|
7
|
+
import { CharacterState as nr, CreationTool as ar, bmlTags as or, emotionList as ir } from "@davi-ai/bodyengine-three";
|
|
8
|
+
import { usePerformanceMonitor as dt, useDetectGPU as ut, PerformanceMonitor as mt, PerspectiveCamera as gt, CameraControls as pt, Environment as ft } from "@react-three/drei";
|
|
9
|
+
import { convertToTexture as yt, uniform as Q, passTexture as St, texture as ke, velocity as fe, struct as xt, Fn as te, float as Y, vec2 as de, If as Pe, vec4 as $, max as oe, ivec2 as vt, luminance as Ce, add as He, uv as wt, mix as _e, logarithmicDepthToViewZ as bt, viewZToPerspectiveDepth as Ve, getViewPosition as Mt, viewZToOrthographicDepth as Tt, pass as At, mrt as Ne, diffuseColor as kt, output as Re, directionToColor as Pt, normalView as Ct, sample as _t, colorToDirection as Vt } from "three/tsl";
|
|
10
|
+
import { ssgi as Nt } from "three/addons/tsl/display/SSGINode.js";
|
|
11
|
+
import { useThree as We, Canvas as Rt, useFrame as qe } from "@react-three/fiber";
|
|
12
|
+
import { createSpeechSynthesisPonyfill as It, SpeechSynthesisUtterance as Ft } from "@davi-ai/web-speech-cognitive-services-davi";
|
|
12
13
|
const Ie = (e) => {
|
|
13
14
|
let t;
|
|
14
|
-
const s = /* @__PURE__ */ new Set(), r = (h,
|
|
15
|
-
const
|
|
16
|
-
if (!Object.is(
|
|
15
|
+
const s = /* @__PURE__ */ new Set(), r = (h, g) => {
|
|
16
|
+
const p = typeof h == "function" ? h(t) : h;
|
|
17
|
+
if (!Object.is(p, t)) {
|
|
17
18
|
const b = t;
|
|
18
|
-
t =
|
|
19
|
+
t = g ?? (typeof p != "object" || p === null) ? p : Object.assign({}, t, p), s.forEach((i) => i(t, b));
|
|
19
20
|
}
|
|
20
|
-
}, o = () => t,
|
|
21
|
-
return
|
|
22
|
-
},
|
|
23
|
-
function
|
|
24
|
-
const s =
|
|
21
|
+
}, o = () => t, w = { setState: r, getState: o, getInitialState: () => x, subscribe: (h) => (s.add(h), () => s.delete(h)) }, x = t = e(r, o, w);
|
|
22
|
+
return w;
|
|
23
|
+
}, Bt = (e) => e ? Ie(e) : Ie, zt = (e) => e;
|
|
24
|
+
function Dt(e, t = zt) {
|
|
25
|
+
const s = v.useSyncExternalStore(
|
|
25
26
|
e.subscribe,
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
v.useCallback(() => t(e.getState()), [e, t]),
|
|
28
|
+
v.useCallback(() => t(e.getInitialState()), [e, t])
|
|
28
29
|
);
|
|
29
|
-
return
|
|
30
|
+
return v.useDebugValue(s), s;
|
|
30
31
|
}
|
|
31
|
-
const
|
|
32
|
-
const t =
|
|
32
|
+
const Et = (e) => {
|
|
33
|
+
const t = Bt(e), s = (r) => Dt(t, r);
|
|
33
34
|
return Object.assign(s, t), s;
|
|
34
|
-
},
|
|
35
|
+
}, ne = (e) => Et, k = ne()(() => ({
|
|
35
36
|
character: null,
|
|
36
37
|
managers: [],
|
|
37
38
|
globalManager: null,
|
|
@@ -48,7 +49,7 @@ const zt = (e) => {
|
|
|
48
49
|
characterHeight: 0,
|
|
49
50
|
characterDepth: 0,
|
|
50
51
|
characterState: J.idle
|
|
51
|
-
})),
|
|
52
|
+
})), jt = (e) => {
|
|
52
53
|
k.setState({ character: e }), k.setState({ managers: {
|
|
53
54
|
lipSyncManager: (e == null ? void 0 : e.lipSyncManager) || null,
|
|
54
55
|
blendshapeManager: (e == null ? void 0 : e.blendshapeManager) || null,
|
|
@@ -57,58 +58,58 @@ const zt = (e) => {
|
|
|
57
58
|
} }), k.setState({ globalManager: (e == null ? void 0 : e.globalManager) || null }), k.setState({ lipSyncManager: (e == null ? void 0 : e.lipSyncManager) || null }), k.setState({ blendshapeManager: (e == null ? void 0 : e.blendshapeManager) || null }), k.setState({ eyeBlinkManager: (e == null ? void 0 : e.eyeBlinkManager) || null }), k.setState({ animationManager: (e == null ? void 0 : e.animationManager) || null }), k.setState({ FACSManager: (e == null ? void 0 : e.FACSManager) || null }), k.setState({ headPoseManager: (e == null ? void 0 : e.headPoseManager) || null }), k.setState({ gazeManager: (e == null ? void 0 : e.gazeManager) || null }), k.setState({ bmlManager: (e == null ? void 0 : e.bmlManager) || null });
|
|
58
59
|
}, Fe = (e) => {
|
|
59
60
|
k.setState({ animationsLoaded: e });
|
|
60
|
-
},
|
|
61
|
+
}, Ut = (e) => {
|
|
61
62
|
k.setState({ characterWidth: e.x }), k.setState({ characterHeight: e.y }), k.setState({ characterDepth: e.z });
|
|
62
|
-
},
|
|
63
|
+
}, Vs = () => k.getState().characterHeight, Be = (e) => {
|
|
63
64
|
k.setState({ characterState: e });
|
|
64
|
-
}, z =
|
|
65
|
+
}, z = ne()(() => ({
|
|
65
66
|
cameraRef: null,
|
|
66
|
-
cameraPosition: new
|
|
67
|
+
cameraPosition: new tt(0, 0, 5),
|
|
67
68
|
bodyCenter: null,
|
|
68
69
|
defaultPositions: null,
|
|
69
70
|
defaultDistances: null,
|
|
70
71
|
lookAt: null,
|
|
71
72
|
movable: !0
|
|
72
|
-
})),
|
|
73
|
+
})), Lt = (e) => {
|
|
73
74
|
z.setState({ cameraRef: e });
|
|
74
|
-
},
|
|
75
|
+
}, ze = (e) => {
|
|
75
76
|
z.setState({ cameraPosition: e });
|
|
76
|
-
},
|
|
77
|
+
}, Ns = () => z.getState().cameraPosition, Ot = (e) => {
|
|
77
78
|
z.setState({ bodyCenter: e });
|
|
78
|
-
},
|
|
79
|
+
}, Ht = (e) => {
|
|
79
80
|
z.setState({ defaultPositions: e });
|
|
80
|
-
},
|
|
81
|
+
}, Wt = (e) => {
|
|
81
82
|
z.setState({ defaultDistances: e });
|
|
82
|
-
},
|
|
83
|
+
}, De = (e) => {
|
|
83
84
|
z.setState({ lookAt: e });
|
|
84
|
-
},
|
|
85
|
+
}, Rs = () => z.getState().lookAt, qt = (e) => {
|
|
85
86
|
z.setState({ movable: e });
|
|
86
|
-
},
|
|
87
|
+
}, j = ne()(() => ({
|
|
87
88
|
currentAUs: null,
|
|
88
89
|
currentGaze: null,
|
|
89
90
|
currentHeadPose: null,
|
|
90
91
|
lookAtCamera: !1,
|
|
91
92
|
targets: [],
|
|
92
93
|
showFirstTarget: !1
|
|
93
|
-
})),
|
|
94
|
-
|
|
95
|
-
}, Vs = (e) => {
|
|
96
|
-
E.setState({ currentAUs: e });
|
|
97
|
-
}, Ns = (e) => {
|
|
98
|
-
E.setState({ currentGaze: e });
|
|
94
|
+
})), Gt = (e) => {
|
|
95
|
+
j.setState({ targets: e });
|
|
99
96
|
}, Is = (e) => {
|
|
100
|
-
|
|
101
|
-
}, ue = (e) => {
|
|
102
|
-
E.setState({ lookAtCamera: e }), e ? qt() : Gt();
|
|
97
|
+
j.setState({ currentAUs: e });
|
|
103
98
|
}, Fs = (e) => {
|
|
104
|
-
|
|
99
|
+
j.setState({ currentGaze: e });
|
|
100
|
+
}, Bs = (e) => {
|
|
101
|
+
j.setState({ currentHeadPose: e });
|
|
102
|
+
}, ue = (e) => {
|
|
103
|
+
j.setState({ lookAtCamera: e }), e ? Jt() : Kt();
|
|
104
|
+
}, zs = (e) => {
|
|
105
|
+
j.setState({ lookAtCamera: e });
|
|
105
106
|
const t = k.getState().globalManager;
|
|
106
107
|
if (e) {
|
|
107
108
|
const s = z.getState().cameraRef;
|
|
108
109
|
t == null || t.lookAtAndSteady(s);
|
|
109
110
|
} else
|
|
110
111
|
t == null || t.releaseLookAt();
|
|
111
|
-
},
|
|
112
|
+
}, Jt = (e) => {
|
|
112
113
|
const t = k.getState().globalManager;
|
|
113
114
|
if (e)
|
|
114
115
|
t == null || t.lookAtAndKeep(e);
|
|
@@ -116,30 +117,30 @@ const zt = (e) => {
|
|
|
116
117
|
const s = z.getState().cameraRef;
|
|
117
118
|
t == null || t.lookAtAndKeep(s);
|
|
118
119
|
}
|
|
119
|
-
},
|
|
120
|
+
}, Kt = () => {
|
|
120
121
|
var e;
|
|
121
122
|
(e = k.getState().globalManager) == null || e.releaseLookAt();
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
}, re =
|
|
123
|
+
}, Ds = (e) => {
|
|
124
|
+
j.setState({ showFirstTarget: e });
|
|
125
|
+
}, re = ne()(() => ({
|
|
125
126
|
animationsNames: [],
|
|
126
127
|
animations: /* @__PURE__ */ new Map(),
|
|
127
128
|
currentAnimation: null,
|
|
128
129
|
autoPlay: !0
|
|
129
|
-
})),
|
|
130
|
+
})), Zt = (e) => {
|
|
130
131
|
re.setState({ animationsNames: e });
|
|
131
|
-
},
|
|
132
|
+
}, Qt = (e) => {
|
|
132
133
|
re.setState({ animations: e });
|
|
133
|
-
},
|
|
134
|
+
}, Es = () => re.getState().animations, js = (e) => {
|
|
134
135
|
re.setState({ autoPlay: e });
|
|
135
|
-
},
|
|
136
|
+
}, Us = (e) => {
|
|
136
137
|
if (re.setState({ autoPlay: !1 }), re.getState().animationsNames.includes(e)) {
|
|
137
138
|
const s = k.getState().animationManager;
|
|
138
139
|
s == null || s.playAnimation(e);
|
|
139
140
|
}
|
|
140
141
|
};
|
|
141
|
-
var
|
|
142
|
-
const
|
|
142
|
+
var I = /* @__PURE__ */ ((e) => (e.eye = "eye", e.mouth = "mouth", e.neck = "neck", e.clavicle = "clavicle", e.torso = "torso", e.belly = "belly", e.lowerbelly = "lowerbelly", e.hips = "hips", e.higherthigh = "higherthigh", e.thigh = "thigh", e.knee = "knee", e.leg = "leg", e.feet = "feet", e))(I || {}), G = /* @__PURE__ */ ((e) => (e[e.face = 1] = "face", e[e.eighthleft = 2] = "eighthleft", e[e.thirdleft = 3] = "thirdleft", e[e.quarterleft = 4] = "quarterleft", e[e.halfleft = 5] = "halfleft", e[e.eighthright = 6] = "eighthright", e[e.thirdright = 7] = "thirdright", e[e.quarterright = 8] = "quarterright", e[e.halfright = 9] = "halfright", e))(G || {}), F = /* @__PURE__ */ ((e) => (e[e.veryclose = 1] = "veryclose", e[e.closer = 2] = "closer", e[e.close = 3] = "close", e[e.midclose = 4] = "midclose", e[e.medium = 5] = "medium", e[e.midfar = 6] = "midfar", e[e.far = 7] = "far", e[e.farther = 8] = "farther", e[e.veryfar = 9] = "veryfar", e))(F || {}), le = /* @__PURE__ */ ((e) => (e.cc3 = "CC_Base_Body", e.avatarsdk = "AvatarBody", e.avaturn = "Body_Mesh", e))(le || {}), Se = /* @__PURE__ */ ((e) => (e.Jay = "joy", e.Anger = "anger", e.Contempt = "contempt", e.Disgust = "disgust", e.Dislike = "dislike", e.Distress = "distress", e.Fear = "fear", e.Frustration = "frustration", e.Guilt = "guilt", e.Hope = "hope", e.Love = "love", e.Pride = "pride", e.Regret = "regret", e.Relief = "relief", e.Sadness = "sadness", e.Shame = "shame", e.Smile = "smile", e.Surprise = "surprise", e.Neutral = "neutral", e))(Se || {});
|
|
143
|
+
const Ee = /* @__PURE__ */ new Map([
|
|
143
144
|
[0, "sil"],
|
|
144
145
|
[1, "aa"],
|
|
145
146
|
[2, "aa"],
|
|
@@ -162,7 +163,7 @@ const De = /* @__PURE__ */ new Map([
|
|
|
162
163
|
[19, "DD"],
|
|
163
164
|
[20, "kk"],
|
|
164
165
|
[21, "PP"]
|
|
165
|
-
]),
|
|
166
|
+
]), Yt = /* @__PURE__ */ new Map([
|
|
166
167
|
["#", "#"],
|
|
167
168
|
["p", "p"],
|
|
168
169
|
["b", "b"],
|
|
@@ -211,7 +212,7 @@ const De = /* @__PURE__ */ new Map([
|
|
|
211
212
|
["9~", "oẽ"],
|
|
212
213
|
["N", "ŋ"],
|
|
213
214
|
["J", "ɲ"]
|
|
214
|
-
]),
|
|
215
|
+
]), Xt = /* @__PURE__ */ new Map([
|
|
215
216
|
["#", 0],
|
|
216
217
|
["æ", 1],
|
|
217
218
|
["ə", 1],
|
|
@@ -252,48 +253,48 @@ const De = /* @__PURE__ */ new Map([
|
|
|
252
253
|
["p", 21],
|
|
253
254
|
["b", 21],
|
|
254
255
|
["m", 21]
|
|
255
|
-
]),
|
|
256
|
-
position:
|
|
257
|
-
distance:
|
|
258
|
-
lookAt:
|
|
259
|
-
}, Xt = {
|
|
260
|
-
position: F.mouth,
|
|
261
|
-
distance: R.close,
|
|
262
|
-
lookAt: F.mouth
|
|
263
|
-
}, $t = {
|
|
264
|
-
position: F.mouth,
|
|
265
|
-
distance: R.midclose,
|
|
266
|
-
lookAt: F.mouth
|
|
256
|
+
]), $t = {
|
|
257
|
+
position: I.mouth,
|
|
258
|
+
distance: F.farther,
|
|
259
|
+
lookAt: I.lowerbelly
|
|
267
260
|
}, es = {
|
|
268
|
-
position:
|
|
269
|
-
distance:
|
|
270
|
-
lookAt:
|
|
261
|
+
position: I.mouth,
|
|
262
|
+
distance: F.close,
|
|
263
|
+
lookAt: I.mouth
|
|
271
264
|
}, ts = {
|
|
272
|
-
position:
|
|
273
|
-
distance:
|
|
274
|
-
lookAt:
|
|
265
|
+
position: I.mouth,
|
|
266
|
+
distance: F.midclose,
|
|
267
|
+
lookAt: I.mouth
|
|
275
268
|
}, ss = {
|
|
276
|
-
position:
|
|
277
|
-
distance:
|
|
278
|
-
lookAt:
|
|
269
|
+
position: I.neck,
|
|
270
|
+
distance: F.close,
|
|
271
|
+
lookAt: I.neck
|
|
279
272
|
}, rs = {
|
|
280
|
-
position:
|
|
281
|
-
distance:
|
|
282
|
-
lookAt:
|
|
273
|
+
position: I.eye,
|
|
274
|
+
distance: F.medium,
|
|
275
|
+
lookAt: I.neck
|
|
276
|
+
}, ns = {
|
|
277
|
+
position: I.eye,
|
|
278
|
+
distance: F.medium,
|
|
279
|
+
lookAt: I.clavicle
|
|
283
280
|
}, as = {
|
|
284
|
-
position:
|
|
285
|
-
distance:
|
|
286
|
-
lookAt:
|
|
287
|
-
},
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
281
|
+
position: I.eye,
|
|
282
|
+
distance: F.midfar,
|
|
283
|
+
lookAt: I.belly
|
|
284
|
+
}, os = {
|
|
285
|
+
position: I.eye,
|
|
286
|
+
distance: F.far,
|
|
287
|
+
lookAt: I.lowerbelly
|
|
288
|
+
}, Ls = {
|
|
289
|
+
default: $t,
|
|
290
|
+
head: es,
|
|
291
|
+
neck: ts,
|
|
292
|
+
shoulders: ss,
|
|
293
|
+
chest: rs,
|
|
294
|
+
belly: ns,
|
|
295
|
+
knees: as,
|
|
296
|
+
feet: os
|
|
297
|
+
}, P = ne()(() => ({
|
|
297
298
|
credentials: void 0,
|
|
298
299
|
currentUtterance: null,
|
|
299
300
|
boundaries: [],
|
|
@@ -306,153 +307,153 @@ const De = /* @__PURE__ */ new Map([
|
|
|
306
307
|
textToSpeak: null,
|
|
307
308
|
visemeIntensity: 1,
|
|
308
309
|
useBlendshapeManager: !1
|
|
309
|
-
})),
|
|
310
|
-
|
|
311
|
-
},
|
|
310
|
+
})), is = (e) => {
|
|
311
|
+
P.setState({ credentials: e });
|
|
312
|
+
}, cs = (e) => {
|
|
312
313
|
if (e) {
|
|
313
|
-
const t =
|
|
314
|
+
const t = P.getState().voice;
|
|
314
315
|
t && (e.voice = t);
|
|
315
316
|
}
|
|
316
|
-
|
|
317
|
-
},
|
|
318
|
-
|
|
319
|
-
},
|
|
320
|
-
|
|
321
|
-
},
|
|
322
|
-
|
|
323
|
-
},
|
|
324
|
-
|
|
325
|
-
},
|
|
326
|
-
const s =
|
|
317
|
+
P.setState({ currentUtterance: e }), P.setState({ textToSpeak: null });
|
|
318
|
+
}, Os = (e) => {
|
|
319
|
+
P.setState({ visemes: e });
|
|
320
|
+
}, Hs = (e) => {
|
|
321
|
+
P.setState({ blendshapes: e });
|
|
322
|
+
}, Ge = (e) => {
|
|
323
|
+
P.setState({ visemes: [...P.getState().visemes, e] });
|
|
324
|
+
}, Ws = (e) => {
|
|
325
|
+
P.setState({ blendshapes: [...P.getState().blendshapes, e] });
|
|
326
|
+
}, qs = (e, t) => {
|
|
327
|
+
const s = Yt.get(e.name);
|
|
327
328
|
if (s) {
|
|
328
|
-
const r =
|
|
329
|
-
r !== void 0 &&
|
|
329
|
+
const r = Xt.get(s);
|
|
330
|
+
r !== void 0 && Ge({ ...e, name: `${r}`, elapsedTime: e.elapsedTime * (t || 1e7) });
|
|
330
331
|
}
|
|
331
|
-
},
|
|
332
|
-
|
|
333
|
-
},
|
|
334
|
-
|
|
335
|
-
},
|
|
332
|
+
}, ls = (e) => {
|
|
333
|
+
P.setState({ currentVisemeIndex: e });
|
|
334
|
+
}, hs = (e) => {
|
|
335
|
+
P.setState({ currentBlendshapeIndex: e });
|
|
336
|
+
}, Je = () => {
|
|
336
337
|
var e;
|
|
337
|
-
|
|
338
|
+
P.setState({
|
|
338
339
|
visemes: [],
|
|
339
340
|
currentVisemeIndex: 0
|
|
340
341
|
}), (e = k.getState().lipSyncManager) == null || e.stop();
|
|
341
|
-
},
|
|
342
|
+
}, Ke = () => {
|
|
342
343
|
var e;
|
|
343
|
-
|
|
344
|
+
P.setState({
|
|
344
345
|
blendshapes: [],
|
|
345
346
|
currentBlendshapeIndex: 0
|
|
346
347
|
}), (e = k.getState().blendshapeManager) == null || e.stop();
|
|
347
|
-
},
|
|
348
|
-
|
|
348
|
+
}, ds = (e) => {
|
|
349
|
+
P.setState({ voice: e });
|
|
349
350
|
}, je = (e) => {
|
|
350
|
-
|
|
351
|
-
},
|
|
352
|
-
|
|
353
|
-
},
|
|
354
|
-
|
|
355
|
-
},
|
|
356
|
-
e !==
|
|
357
|
-
},
|
|
358
|
-
let r = s[e.position ||
|
|
359
|
-
const o = s[e.position ||
|
|
360
|
-
let
|
|
361
|
-
const f = typeof e.distance == "string" ? parseInt(e.distance) : e.distance,
|
|
351
|
+
P.setState({ voices: e });
|
|
352
|
+
}, Gs = (e) => {
|
|
353
|
+
P.setState({ textToSpeak: e });
|
|
354
|
+
}, Js = () => P.getState().voices, Ks = (e) => {
|
|
355
|
+
P.setState({ visemeIntensity: e });
|
|
356
|
+
}, us = (e) => {
|
|
357
|
+
e !== P.getState().useBlendshapeManager && (Je(), Ke(), P.setState({ useBlendshapeManager: e }));
|
|
358
|
+
}, ms = (e, t, s) => {
|
|
359
|
+
let r = s[e.position || I.eye].getComponent(0);
|
|
360
|
+
const o = s[e.position || I.mouth].getComponent(1);
|
|
361
|
+
let a = 0;
|
|
362
|
+
const f = typeof e.distance == "string" ? parseInt(e.distance) : e.distance, w = typeof e.rotation == "string" ? parseInt(e.rotation) : e.rotation;
|
|
362
363
|
switch (f) {
|
|
363
|
-
case
|
|
364
|
-
|
|
364
|
+
case F.veryclose:
|
|
365
|
+
a = t.veryclose;
|
|
365
366
|
break;
|
|
366
|
-
case
|
|
367
|
-
|
|
367
|
+
case F.closer:
|
|
368
|
+
a = t.closer;
|
|
368
369
|
break;
|
|
369
|
-
case
|
|
370
|
-
|
|
370
|
+
case F.close:
|
|
371
|
+
a = t.close;
|
|
371
372
|
break;
|
|
372
|
-
case
|
|
373
|
-
|
|
373
|
+
case F.midclose:
|
|
374
|
+
a = t.midclose;
|
|
374
375
|
break;
|
|
375
|
-
case
|
|
376
|
-
|
|
376
|
+
case F.medium:
|
|
377
|
+
a = t.medium;
|
|
377
378
|
break;
|
|
378
|
-
case
|
|
379
|
-
|
|
379
|
+
case F.midfar:
|
|
380
|
+
a = t.midfar;
|
|
380
381
|
break;
|
|
381
|
-
case
|
|
382
|
-
|
|
382
|
+
case F.far:
|
|
383
|
+
a = t.far;
|
|
383
384
|
break;
|
|
384
|
-
case
|
|
385
|
+
case F.farther:
|
|
385
386
|
case void 0:
|
|
386
387
|
default:
|
|
387
|
-
|
|
388
|
+
a = t.farther;
|
|
388
389
|
break;
|
|
389
|
-
case
|
|
390
|
-
|
|
390
|
+
case F.veryfar:
|
|
391
|
+
a = t.veryfar;
|
|
391
392
|
break;
|
|
392
393
|
}
|
|
393
|
-
if (
|
|
394
|
-
switch (
|
|
394
|
+
if (w && w !== G.face)
|
|
395
|
+
switch (w) {
|
|
395
396
|
case G.eighthleft: {
|
|
396
397
|
const x = 0.2588190451;
|
|
397
|
-
r = r -
|
|
398
|
+
r = r - a * x, a = a * Math.sqrt(1 - Math.pow(x, 2));
|
|
398
399
|
break;
|
|
399
400
|
}
|
|
400
401
|
case G.thirdleft:
|
|
401
|
-
r = r -
|
|
402
|
+
r = r - a * (1 / 2), a = a * (Math.sqrt(3) / 2);
|
|
402
403
|
break;
|
|
403
404
|
case G.quarterleft:
|
|
404
|
-
r = r -
|
|
405
|
+
r = r - a * (Math.SQRT2 / 2), a = a * (Math.SQRT2 / 2);
|
|
405
406
|
break;
|
|
406
407
|
case G.halfleft:
|
|
407
|
-
r = r -
|
|
408
|
+
r = r - a, a = s.eye.getComponent(2);
|
|
408
409
|
break;
|
|
409
410
|
case G.eighthright: {
|
|
410
411
|
const x = 0.2588190451;
|
|
411
|
-
r = r +
|
|
412
|
+
r = r + a * x, a = a * Math.sqrt(1 - Math.pow(x, 2));
|
|
412
413
|
break;
|
|
413
414
|
}
|
|
414
415
|
case G.thirdright:
|
|
415
|
-
r = r +
|
|
416
|
+
r = r + a * (1 / 2), a = a * (Math.sqrt(3) / 2);
|
|
416
417
|
break;
|
|
417
418
|
case G.quarterright:
|
|
418
|
-
r = r +
|
|
419
|
+
r = r + a * (Math.SQRT2 / 2), a = a * (Math.SQRT2 / 2);
|
|
419
420
|
break;
|
|
420
421
|
case G.halfright:
|
|
421
|
-
r = r +
|
|
422
|
+
r = r + a, a = s.eye.getComponent(2);
|
|
422
423
|
break;
|
|
423
424
|
}
|
|
424
|
-
return new A.Vector3(r, o,
|
|
425
|
-
}, me = /* @__PURE__ */ new
|
|
426
|
-
let
|
|
427
|
-
function
|
|
425
|
+
return new A.Vector3(r, o, a);
|
|
426
|
+
}, me = /* @__PURE__ */ new ot(), Ue = /* @__PURE__ */ new pe();
|
|
427
|
+
let ge;
|
|
428
|
+
function Ze(e) {
|
|
428
429
|
const t = [];
|
|
429
430
|
let s, r;
|
|
430
431
|
function o(h) {
|
|
431
432
|
s = new Array(h).fill(!1), r = new Array(h).fill(!1);
|
|
432
433
|
}
|
|
433
|
-
let
|
|
434
|
+
let a = 12345;
|
|
434
435
|
function f() {
|
|
435
|
-
return
|
|
436
|
+
return a = a * 1664525 + 1013904223 & 4294967295, (a >>> 0) / 4294967296;
|
|
436
437
|
}
|
|
437
|
-
function
|
|
438
|
-
const
|
|
438
|
+
function w(h, g) {
|
|
439
|
+
const p = g;
|
|
439
440
|
let b;
|
|
440
|
-
if (
|
|
441
|
+
if (p <= s.length) {
|
|
441
442
|
const d = [];
|
|
442
|
-
for (let c = 0; c <
|
|
443
|
+
for (let c = 0; c < p; c++)
|
|
443
444
|
s[c] || d.push(c);
|
|
444
445
|
b = d[Math.floor(f() * d.length)];
|
|
445
446
|
} else
|
|
446
|
-
b = Math.floor(f() *
|
|
447
|
+
b = Math.floor(f() * p);
|
|
447
448
|
let i;
|
|
448
|
-
if (
|
|
449
|
+
if (p <= r.length) {
|
|
449
450
|
const d = [];
|
|
450
|
-
for (let c = 0; c <
|
|
451
|
+
for (let c = 0; c < p; c++)
|
|
451
452
|
r[c] || d.push(c);
|
|
452
453
|
i = d[Math.floor(f() * d.length)];
|
|
453
454
|
} else
|
|
454
|
-
i = Math.floor(f() *
|
|
455
|
-
const l = (b + f()) /
|
|
455
|
+
i = Math.floor(f() * p);
|
|
456
|
+
const l = (b + f()) / p, y = (i + f()) / p;
|
|
456
457
|
return b < s.length && (s[b] = !0), i < r.length && (r[i] = !0), [l, y];
|
|
457
458
|
}
|
|
458
459
|
o(1), t.push([f(), f()]), s[0] = !0, r[0] = !0;
|
|
@@ -460,25 +461,25 @@ function Je(e) {
|
|
|
460
461
|
for (; x < e; ) {
|
|
461
462
|
const h = x * 2;
|
|
462
463
|
o(h);
|
|
463
|
-
for (let
|
|
464
|
-
const [
|
|
464
|
+
for (let g = 0; g < x; g++) {
|
|
465
|
+
const [p, b] = t[g], i = Math.min(Math.floor(p * h), h - 1), l = Math.min(Math.floor(b * h), h - 1);
|
|
465
466
|
i < s.length && (s[i] = !0), l < r.length && (r[l] = !0);
|
|
466
467
|
}
|
|
467
|
-
for (let
|
|
468
|
-
const
|
|
469
|
-
t.push(
|
|
468
|
+
for (let g = 0; g < x; g++) {
|
|
469
|
+
const p = w(g, h);
|
|
470
|
+
t.push(p);
|
|
470
471
|
}
|
|
471
472
|
x = h;
|
|
472
473
|
}
|
|
473
474
|
return t.slice(0, e);
|
|
474
475
|
}
|
|
475
|
-
const
|
|
476
|
-
class
|
|
476
|
+
const Le = /* @__PURE__ */ Ze(64);
|
|
477
|
+
class gs extends st {
|
|
477
478
|
static get type() {
|
|
478
479
|
return "PMJTAANode";
|
|
479
480
|
}
|
|
480
481
|
constructor(t, s, r, o) {
|
|
481
|
-
super("vec4"), this.isPMJTAANode = !0, this.updateBeforeType =
|
|
482
|
+
super("vec4"), this.isPMJTAANode = !0, this.updateBeforeType = rt.FRAME, this.beautyNode = t, this.depthNode = s, this.velocityNode = r, this.camera = o, this.depthThreshold = 5e-4, this.edgeDepthDiff = 1e-3, this.maxVelocityLength = 128, this.useSubpixelCorrection = !0, this.jitterIntensity = 1, this.useProgressiveAccumulation = !1, this._accumulatedFrames = 0, this.maxAccumulationFrames = 256, this._prevCameraMatrix = new X(), this._progressiveWeight = Q(0), this._jitterIndex = 0, this._sampleCount = 64, this._sequenceLength = Le.length, this._sequence = Le, this._invSize = Q(new pe()), this._historyRenderTarget = new be(1, 1, { depthBuffer: !1, type: Te, depthTexture: new Me() }), this._historyRenderTarget.texture.name = "PMJTAANode.history", this._resolveRenderTarget = new be(1, 1, { depthBuffer: !1, type: Te }), this._resolveRenderTarget.texture.name = "PMJTAANode.resolve", this._resolveMaterial = new nt(), this._resolveMaterial.name = "PMJTAA.resolve", this._textureNode = St(this, this._resolveRenderTarget.texture), this._originalProjectionMatrix = new X(), this._cameraNearFar = Q(new pe()), this._cameraWorldMatrix = Q(new X()), this._cameraWorldMatrixInverse = Q(new X()), this._cameraProjectionMatrixInverse = Q(new X()), this._previousCameraWorldMatrix = Q(new X()), this._previousCameraProjectionMatrixInverse = Q(new X()), this._previousDepthNode = ke(new Me(1, 1)), this._needsPostProcessingSync = !1, this._velocityNode = null;
|
|
482
483
|
}
|
|
483
484
|
getTextureNode() {
|
|
484
485
|
return this._textureNode;
|
|
@@ -518,7 +519,7 @@ class us extends et {
|
|
|
518
519
|
* @param {number} count - The number of samples (power of 2).
|
|
519
520
|
*/
|
|
520
521
|
setSampleCount(t) {
|
|
521
|
-
t = Math.max(2, Math.min(256, t)), t = Math.pow(2, Math.round(Math.log2(t))), t !== this._sampleCount && (this._sampleCount = t, this._sequence =
|
|
522
|
+
t = Math.max(2, Math.min(256, t)), t = Math.pow(2, Math.round(Math.log2(t))), t !== this._sampleCount && (this._sampleCount = t, this._sequence = Ze(t), this._jitterIndex = 0);
|
|
522
523
|
}
|
|
523
524
|
/**
|
|
524
525
|
* Returns the current sample count.
|
|
@@ -534,9 +535,9 @@ class us extends et {
|
|
|
534
535
|
const { renderer: s } = t, r = this.camera.matrixWorld;
|
|
535
536
|
let o = !1;
|
|
536
537
|
if (this.useProgressiveAccumulation) {
|
|
537
|
-
const
|
|
538
|
+
const g = r.elements, p = this._prevCameraMatrix.elements;
|
|
538
539
|
for (let i = 0; i < 16; i++)
|
|
539
|
-
if (Math.abs(
|
|
540
|
+
if (Math.abs(g[i] - p[i]) > 1e-6) {
|
|
540
541
|
o = !0;
|
|
541
542
|
break;
|
|
542
543
|
}
|
|
@@ -546,41 +547,41 @@ class us extends et {
|
|
|
546
547
|
} else
|
|
547
548
|
this._progressiveWeight.value = 0, this._accumulatedFrames = 0;
|
|
548
549
|
this._previousCameraWorldMatrix.value.copy(this._cameraWorldMatrix.value), this._previousCameraProjectionMatrixInverse.value.copy(this._cameraProjectionMatrixInverse.value), this._cameraNearFar.value.set(this.camera.near, this.camera.far), this._cameraWorldMatrix.value.copy(this.camera.matrixWorld), this._cameraWorldMatrixInverse.value.copy(this.camera.matrixWorldInverse), this._cameraProjectionMatrixInverse.value.copy(this.camera.projectionMatrixInverse);
|
|
549
|
-
const
|
|
550
|
-
this._needsPostProcessingSync === !0 && (this.setViewOffset(f,
|
|
551
|
-
const x = this._historyRenderTarget.width !== f || this._historyRenderTarget.height !==
|
|
552
|
-
this.setSize(f,
|
|
553
|
-
const h = s.getDrawingBufferSize(
|
|
550
|
+
const a = this.beautyNode.isRTTNode ? this.beautyNode.renderTarget : this.beautyNode.passNode.renderTarget, f = a.texture.width, w = a.texture.height;
|
|
551
|
+
this._needsPostProcessingSync === !0 && (this.setViewOffset(f, w), this._needsPostProcessingSync = !1), ge = Ae.resetRendererState(s, ge), s.setClearColor(new at(0), 0);
|
|
552
|
+
const x = this._historyRenderTarget.width !== f || this._historyRenderTarget.height !== w;
|
|
553
|
+
this.setSize(f, w), x === !0 && (s.initRenderTarget(this._historyRenderTarget), s.initRenderTarget(this._resolveRenderTarget), s.copyTextureToTexture(a.texture, this._historyRenderTarget.texture)), s.setRenderTarget(this._resolveRenderTarget), me.material = this._resolveMaterial, me.name = "PMJTAA", me.render(s), s.setRenderTarget(null), s.copyTextureToTexture(this._resolveRenderTarget.texture, this._historyRenderTarget.texture);
|
|
554
|
+
const h = s.getDrawingBufferSize(Ue);
|
|
554
555
|
if (this._historyRenderTarget.height === h.height && this._historyRenderTarget.width === h.width) {
|
|
555
|
-
const
|
|
556
|
-
s.copyTextureToTexture(
|
|
556
|
+
const g = this.depthNode.value;
|
|
557
|
+
s.copyTextureToTexture(g, this._historyRenderTarget.depthTexture), this._previousDepthNode.value = this._historyRenderTarget.depthTexture;
|
|
557
558
|
}
|
|
558
|
-
|
|
559
|
+
Ae.restoreRendererState(s, ge);
|
|
559
560
|
}
|
|
560
561
|
setup(t) {
|
|
561
562
|
const s = t.context.renderPipeline;
|
|
562
563
|
s && (this._needsPostProcessingSync = !0, s.context.onBeforeRenderPipeline = () => {
|
|
563
|
-
const i = t.renderer.getDrawingBufferSize(
|
|
564
|
+
const i = t.renderer.getDrawingBufferSize(Ue);
|
|
564
565
|
this.setViewOffset(i.width, i.height);
|
|
565
566
|
}, s.context.onAfterRenderPipeline = () => {
|
|
566
567
|
this.clearViewOffset();
|
|
567
|
-
}), t.renderer.reversedDepthBuffer === !0 && (this._historyRenderTarget.depthTexture.type =
|
|
568
|
+
}), t.renderer.reversedDepthBuffer === !0 && (this._historyRenderTarget.depthTexture.type = it), t.context.velocity !== void 0 ? this._velocityNode = t.context.velocity : this._velocityNode = fe;
|
|
568
569
|
const r = (i) => {
|
|
569
|
-
const { x: l, y } = this._cameraNearFar, d =
|
|
570
|
-
return
|
|
571
|
-
}, o =
|
|
570
|
+
const { x: l, y } = this._cameraNearFar, d = bt(i, l, y);
|
|
571
|
+
return Ve(d, l, y);
|
|
572
|
+
}, o = xt({
|
|
572
573
|
closestDepth: "float",
|
|
573
574
|
closestPositionTexel: "vec2",
|
|
574
575
|
farthestDepth: "float"
|
|
575
|
-
}),
|
|
576
|
+
}), a = te(([i]) => {
|
|
576
577
|
const l = Y(2).toVar(), y = de(0).toVar(), d = Y(-1).toVar();
|
|
577
578
|
for (let c = -1; c <= 1; ++c)
|
|
578
|
-
for (let
|
|
579
|
-
const S = i.add(de(c,
|
|
579
|
+
for (let n = -1; n <= 1; ++n) {
|
|
580
|
+
const S = i.add(de(c, n)).toVar();
|
|
580
581
|
let m = this.depthNode.load(S).r;
|
|
581
|
-
t.renderer.reversedDepthBuffer && (m = m.oneMinus()), t.renderer.logarithmicDepthBuffer && (m = r(m)), m = m.toVar(),
|
|
582
|
+
t.renderer.reversedDepthBuffer && (m = m.oneMinus()), t.renderer.logarithmicDepthBuffer && (m = r(m)), m = m.toVar(), Pe(m.lessThan(l), () => {
|
|
582
583
|
l.assign(m), y.assign(S);
|
|
583
|
-
}),
|
|
584
|
+
}), Pe(m.greaterThan(d), () => {
|
|
584
585
|
d.assign(m);
|
|
585
586
|
});
|
|
586
587
|
}
|
|
@@ -588,10 +589,10 @@ class us extends et {
|
|
|
588
589
|
}), f = (i) => {
|
|
589
590
|
let l = this._previousDepthNode.sample(i).r;
|
|
590
591
|
t.renderer.logarithmicDepthBuffer && (l = r(l));
|
|
591
|
-
const y =
|
|
592
|
-
return this.camera.isOrthographicCamera ?
|
|
593
|
-
},
|
|
594
|
-
const c = d.rgb.add(y.rgb).mul(0.5),
|
|
592
|
+
const y = Mt(i, l, this._previousCameraProjectionMatrixInverse), d = this._previousCameraWorldMatrix.mul($(y, 1)).xyz, c = this._cameraWorldMatrixInverse.mul($(d, 1)).z;
|
|
593
|
+
return this.camera.isOrthographicCamera ? Tt(c, this._cameraNearFar.x, this._cameraNearFar.y) : Ve(c, this._cameraNearFar.x, this._cameraNearFar.y);
|
|
594
|
+
}, w = te(([i, l, y, d]) => {
|
|
595
|
+
const c = d.rgb.add(y.rgb).mul(0.5), n = d.rgb.sub(y.rgb).mul(0.5).add(1e-7), S = l.sub($(c, i.a)), _ = S.xyz.div(n).abs(), B = oe(_.x, _.y, _.z);
|
|
595
596
|
return B.greaterThan(1).select(
|
|
596
597
|
$(c, i.a).add(S.div(B)),
|
|
597
598
|
l
|
|
@@ -615,13 +616,13 @@ class us extends et {
|
|
|
615
616
|
[0, -1],
|
|
616
617
|
[0, 1],
|
|
617
618
|
[-1, 0]
|
|
618
|
-
],
|
|
619
|
+
], n = l.toVar(), S = l.pow2().toVar();
|
|
619
620
|
for (const [U, q] of c) {
|
|
620
|
-
const
|
|
621
|
-
|
|
621
|
+
const R = this.beautyNode.offset(vt(U, q)).load(i).max(0), L = $(R.rgb.mul(R.a), R.a);
|
|
622
|
+
n.addAssign(L), S.addAssign(L.pow2());
|
|
622
623
|
}
|
|
623
|
-
const m = Y(c.length + 1),
|
|
624
|
-
return
|
|
624
|
+
const m = Y(c.length + 1), _ = n.div(m), B = S.div(m).sub(_.pow2()).max(0).sqrt().mul(d), u = _.sub(B), M = _.add(B);
|
|
625
|
+
return w(_.clamp(u, M), y, u, M);
|
|
625
626
|
}), h = te(([i, l]) => {
|
|
626
627
|
const d = i.mul(l).fract().abs(), c = oe(d, d.oneMinus());
|
|
627
628
|
return c.x.mul(c.y).oneMinus().div(0.75);
|
|
@@ -632,21 +633,21 @@ class us extends et {
|
|
|
632
633
|
{ name: "velocityUV", type: "vec2" },
|
|
633
634
|
{ name: "textureSize", type: "ivec2" }
|
|
634
635
|
]
|
|
635
|
-
}),
|
|
636
|
-
const d = y.oneMinus(), c = i.mul(Y(1).div(oe(i.r, i.g, i.b).add(1))),
|
|
637
|
-
return y.mulAssign(Y(1).div(S.add(1))), d.mulAssign(Y(1).div(m.add(1))),
|
|
638
|
-
}),
|
|
639
|
-
const i =
|
|
636
|
+
}), g = te(([i, l, y]) => {
|
|
637
|
+
const d = y.oneMinus(), c = i.mul(Y(1).div(oe(i.r, i.g, i.b).add(1))), n = l.mul(Y(1).div(oe(l.r, l.g, l.b).add(1))), S = Ce(c.rgb), m = Ce(n.rgb);
|
|
638
|
+
return y.mulAssign(Y(1).div(S.add(1))), d.mulAssign(Y(1).div(m.add(1))), He(i.mul(y), l.mul(d)).div(oe(y.add(d), 1e-5)).toVar();
|
|
639
|
+
}), p = ke(this._historyRenderTarget.texture), b = te(() => {
|
|
640
|
+
const i = wt(), l = this.beautyNode.size(), y = i.mul(l), d = a(y), c = d.get("closestDepth"), n = d.get("closestPositionTexel"), S = d.get("farthestDepth"), m = this.velocityNode.load(n).xy.mul(de(0.5, -0.5)), _ = i.sub(m), B = f(_), u = _.greaterThanEqual(0).all().and(_.lessThanEqual(1).all()), M = S.sub(c).greaterThan(this.edgeDepthDiff), U = c.sub(B).greaterThan(this.depthThreshold), q = u.and(M.or(U.not())), R = this.beautyNode.sample(i), L = p.sample(i.sub(m)), ae = $(R.rgb.mul(R.a), R.a).toVar(), ce = i.sub(_).mul(l).length().div(this.maxVelocityLength).saturate().sqrt(), T = Y(0.05).toVar();
|
|
640
641
|
this.useSubpixelCorrection && T.addAssign(h(m, l).mul(0.5)), T.assign(q.select(T.add(ce.mul(0.6)).saturate(), 1));
|
|
641
|
-
const
|
|
642
|
-
T.assign(N.select(
|
|
642
|
+
const C = this._progressiveWeight, N = C.greaterThan(0).and(q);
|
|
643
|
+
T.assign(N.select(C, T));
|
|
643
644
|
const O = _e(0.25, 1.25, ce.oneMinus().pow2()), Z = N.select(
|
|
644
645
|
L,
|
|
645
|
-
x(y,
|
|
646
|
+
x(y, ae, L, O)
|
|
646
647
|
);
|
|
647
648
|
return N.select(
|
|
648
|
-
_e(Z,
|
|
649
|
-
|
|
649
|
+
_e(Z, ae, T),
|
|
650
|
+
g(ae, Z, T)
|
|
650
651
|
);
|
|
651
652
|
});
|
|
652
653
|
return this._resolveMaterial.fragmentNode = b(), this._textureNode;
|
|
@@ -655,8 +656,25 @@ class us extends et {
|
|
|
655
656
|
this._historyRenderTarget.dispose(), this._resolveRenderTarget.dispose(), this._resolveMaterial.dispose();
|
|
656
657
|
}
|
|
657
658
|
}
|
|
658
|
-
const
|
|
659
|
-
|
|
659
|
+
const Oe = (e, t, s, r) => new gs(yt(e), t, s, r);
|
|
660
|
+
function ps({ pixelated: e }) {
|
|
661
|
+
const t = We((r) => r.gl), s = we.useRef(1);
|
|
662
|
+
return we.useEffect(() => {
|
|
663
|
+
const r = t.domElement;
|
|
664
|
+
return () => {
|
|
665
|
+
t.setPixelRatio(window.devicePixelRatio), e && r && (r.style.imageRendering = "auto");
|
|
666
|
+
};
|
|
667
|
+
}, []), dt({
|
|
668
|
+
onDecline: (r) => {
|
|
669
|
+
s.current = Math.max(0.33, s.current * 0.66), t.setPixelRatio(s.current * window.devicePixelRatio), e && t.domElement && (t.domElement.style.imageRendering = "pixelated");
|
|
670
|
+
},
|
|
671
|
+
onIncline: (r) => {
|
|
672
|
+
s.current = Math.min(1, s.current * 1.25), t.setPixelRatio(s.current * window.devicePixelRatio), e && t.domElement && (t.domElement.style.imageRendering = s.current === 1 ? "auto" : "pixelated");
|
|
673
|
+
}
|
|
674
|
+
}), null;
|
|
675
|
+
}
|
|
676
|
+
const fs = () => {
|
|
677
|
+
const e = k((n) => n.animationsLoaded), t = k((n) => n.characterState), s = k((n) => n.lipSyncManager), r = k((n) => n.blendshapeManager), o = P((n) => n.credentials), a = P((n) => n.currentUtterance), f = P((n) => n.textToSpeak), w = P((n) => n.visemes), x = P((n) => n.blendshapes), h = P((n) => n.visemeIntensity), g = P((n) => n.currentVisemeIndex), p = P((n) => n.currentBlendshapeIndex), b = P((n) => n.useBlendshapeManager), [i, l] = D(!1), [y, d] = D(!1), c = ye(() => o != null && o.region && (o.subscriptionKey || o.token) ? It({
|
|
660
678
|
credentials: {
|
|
661
679
|
region: o.region,
|
|
662
680
|
authorizationToken: o.token,
|
|
@@ -665,8 +683,8 @@ const Le = (e, t, s, r) => new us(pt(e), t, s, r), ms = () => {
|
|
|
665
683
|
}) : null, [o]);
|
|
666
684
|
return V(() => {
|
|
667
685
|
if (c) {
|
|
668
|
-
const
|
|
669
|
-
|
|
686
|
+
const n = c.speechSynthesis.getVoices();
|
|
687
|
+
n && Array.isArray(n) && n.length ? (je(n), l(!0)) : c.speechSynthesis.onvoiceschanged = () => {
|
|
670
688
|
je(c.speechSynthesis.getVoices()), l(!0);
|
|
671
689
|
};
|
|
672
690
|
}
|
|
@@ -674,83 +692,83 @@ const Le = (e, t, s, r) => new us(pt(e), t, s, r), ms = () => {
|
|
|
674
692
|
i && (b ? !!r : !!s) && e && d(!0);
|
|
675
693
|
}, [i, s, r, e, b]), V(() => {
|
|
676
694
|
if (f) {
|
|
677
|
-
const
|
|
678
|
-
|
|
695
|
+
const n = new Ft(f);
|
|
696
|
+
cs(n);
|
|
679
697
|
}
|
|
680
698
|
}, [f]), V(() => {
|
|
681
|
-
var
|
|
682
|
-
|
|
683
|
-
console.log("Start"),
|
|
684
|
-
},
|
|
685
|
-
console.log("End"),
|
|
686
|
-
},
|
|
687
|
-
},
|
|
688
|
-
|
|
689
|
-
}, (
|
|
690
|
-
}, [
|
|
699
|
+
var n, S;
|
|
700
|
+
a && y ? (a.onstart = () => {
|
|
701
|
+
console.log("Start"), Be(J.speaking);
|
|
702
|
+
}, a.onend = () => {
|
|
703
|
+
console.log("End"), Be(J.idle);
|
|
704
|
+
}, a.onboundary = () => {
|
|
705
|
+
}, a.onviseme = (m) => {
|
|
706
|
+
Ge(m);
|
|
707
|
+
}, (n = c == null ? void 0 : c.speechSynthesis) == null || n.speak(a, null)) : (S = c == null ? void 0 : c.speechSynthesis) == null || S.cancel();
|
|
708
|
+
}, [a]), V(() => {
|
|
691
709
|
s && (s.visemeIntensity = h);
|
|
692
710
|
}, [h]), V(() => {
|
|
693
711
|
if (!b && s && t === J.speaking) {
|
|
694
|
-
if (!s.isStarted && s.start(),
|
|
695
|
-
|
|
696
|
-
const S = parseInt(
|
|
712
|
+
if (!s.isStarted && s.start(), w.length > 1 && g === 0)
|
|
713
|
+
w.forEach((n) => {
|
|
714
|
+
const S = parseInt(n.name);
|
|
697
715
|
if (!isNaN(S)) {
|
|
698
|
-
const m =
|
|
699
|
-
m && s.PlayVisemeAsync(m,
|
|
716
|
+
const m = Ee.get(S);
|
|
717
|
+
m && s.PlayVisemeAsync(m, n.elapsedTime / 1e4);
|
|
700
718
|
}
|
|
701
719
|
});
|
|
702
720
|
else
|
|
703
|
-
for (let
|
|
704
|
-
const S =
|
|
721
|
+
for (let n = g + 1; n < w.length; n++) {
|
|
722
|
+
const S = w[n], m = parseInt(S.name);
|
|
705
723
|
if (!isNaN(m)) {
|
|
706
|
-
const
|
|
707
|
-
|
|
724
|
+
const _ = Ee.get(m);
|
|
725
|
+
_ && s.PlayVisemeAsync(_, S.elapsedTime / 1e4);
|
|
708
726
|
}
|
|
709
727
|
}
|
|
710
|
-
|
|
728
|
+
ls(w.length - 1);
|
|
711
729
|
}
|
|
712
|
-
}, [t,
|
|
730
|
+
}, [t, w, s, b]), V(() => {
|
|
713
731
|
if (b && r && t === J.speaking) {
|
|
714
|
-
if (!r.isStarted && r.start(), x.length > 1 &&
|
|
715
|
-
x.forEach((
|
|
716
|
-
r.PlayBlendShapeAsync(
|
|
732
|
+
if (!r.isStarted && r.start(), x.length > 1 && p === 0)
|
|
733
|
+
x.forEach((n) => {
|
|
734
|
+
r.PlayBlendShapeAsync(n);
|
|
717
735
|
});
|
|
718
736
|
else
|
|
719
|
-
for (let
|
|
720
|
-
const S = x[
|
|
737
|
+
for (let n = p + 1; n < x.length; n++) {
|
|
738
|
+
const S = x[n];
|
|
721
739
|
r.PlayBlendShapeAsync(S);
|
|
722
740
|
}
|
|
723
|
-
|
|
741
|
+
hs(x.length - 1);
|
|
724
742
|
}
|
|
725
743
|
}, [t, x, r, b]), V(() => {
|
|
726
|
-
t !== J.speaking && (
|
|
744
|
+
t !== J.speaking && (Je(), Ke());
|
|
727
745
|
}, [t]), null;
|
|
728
|
-
},
|
|
746
|
+
}, ys = ({ points: e, color: t = "red" }) => {
|
|
729
747
|
const s = ye(() => {
|
|
730
748
|
const r = new A.BufferGeometry().setFromPoints(e), o = new A.LineBasicMaterial({ color: t, toneMapped: !1 });
|
|
731
749
|
return new A.Line(r, o);
|
|
732
750
|
}, [e, t]);
|
|
733
|
-
return /* @__PURE__ */
|
|
734
|
-
},
|
|
735
|
-
const o = z((u) => u.cameraPosition),
|
|
751
|
+
return /* @__PURE__ */ v.createElement("primitive", { object: s });
|
|
752
|
+
}, Ss = ({ parentGpuTier: e, setIsGpuAvailable: t, children: s, tonemapping: r }) => {
|
|
753
|
+
const o = z((u) => u.cameraPosition), a = z((u) => u.lookAt), f = z((u) => u.movable), w = j((u) => u.targets), x = j((u) => u.showFirstTarget), [h] = D(e || ut()), [g, p] = D(), [b, i] = D(null), [l, y] = D(void 0), d = se(null), c = se(null), n = se(null), S = (u) => {
|
|
736
754
|
u.preventDefault(), u.stopPropagation();
|
|
737
755
|
};
|
|
738
756
|
V(() => {
|
|
739
|
-
|
|
757
|
+
Lt(c.current);
|
|
740
758
|
}, [c.current]), V(() => {
|
|
741
|
-
var u,
|
|
759
|
+
var u, M, U, q;
|
|
742
760
|
if (f)
|
|
743
761
|
b == null || b.abort(), i(null);
|
|
744
762
|
else {
|
|
745
|
-
const
|
|
746
|
-
i(
|
|
763
|
+
const R = new AbortController();
|
|
764
|
+
i(R), (u = d.current) == null || u.addEventListener("wheel", S, { passive: !1, signal: R.signal }), (M = d.current) == null || M.addEventListener("pointerdown", S, { passive: !1, signal: R.signal }), (U = d.current) == null || U.addEventListener("pointermove", S, { passive: !1, signal: R.signal }), (q = d.current) == null || q.addEventListener("click", S, { passive: !1, signal: R.signal });
|
|
747
765
|
}
|
|
748
766
|
}, [f]), V(() => {
|
|
749
|
-
|
|
750
|
-
}, [o,
|
|
767
|
+
n != null && n.current && a && o && n.current.setLookAt(o.x, o.y, o.z, a.x, a.y, a.z, !0);
|
|
768
|
+
}, [o, a]), V(() => {
|
|
751
769
|
if (h)
|
|
752
770
|
if (h.type === "FALLBACK")
|
|
753
|
-
|
|
771
|
+
p(
|
|
754
772
|
"medium"
|
|
755
773
|
/* medium */
|
|
756
774
|
);
|
|
@@ -758,83 +776,83 @@ const Le = (e, t, s, r) => new us(pt(e), t, s, r), ms = () => {
|
|
|
758
776
|
switch (h.tier) {
|
|
759
777
|
case 0:
|
|
760
778
|
case 1:
|
|
761
|
-
|
|
779
|
+
p(
|
|
762
780
|
"low"
|
|
763
781
|
/* low */
|
|
764
782
|
);
|
|
765
783
|
break;
|
|
766
784
|
case 2:
|
|
767
|
-
|
|
785
|
+
p(
|
|
768
786
|
"medium"
|
|
769
787
|
/* medium */
|
|
770
788
|
);
|
|
771
789
|
break;
|
|
772
790
|
case 3:
|
|
773
|
-
|
|
791
|
+
p(
|
|
774
792
|
"high"
|
|
775
793
|
/* high */
|
|
776
794
|
);
|
|
777
795
|
break;
|
|
778
796
|
default:
|
|
779
|
-
|
|
797
|
+
p(
|
|
780
798
|
"low"
|
|
781
799
|
/* low */
|
|
782
800
|
);
|
|
783
801
|
break;
|
|
784
802
|
}
|
|
785
803
|
}, [h]), V(() => {
|
|
786
|
-
switch (
|
|
804
|
+
switch (g && (m.current = g), g) {
|
|
787
805
|
case "low":
|
|
788
806
|
console.warn("Retorik React-Bodyengine-Three > GPU tier too low, no rendering available"), t(!1);
|
|
789
807
|
break;
|
|
790
808
|
case "medium":
|
|
791
|
-
y([
|
|
809
|
+
y([1, 1.5]), console.log(`Retorik React-Bodyengine-Three > GPU tier detected : ${g}`), t(!0);
|
|
792
810
|
break;
|
|
793
811
|
case "high":
|
|
794
|
-
y([1, 2]), console.log(`Retorik React-Bodyengine-Three > GPU tier detected : ${
|
|
812
|
+
y([1, 2]), console.log(`Retorik React-Bodyengine-Three > GPU tier detected : ${g}`), t(!0);
|
|
795
813
|
break;
|
|
796
814
|
}
|
|
797
|
-
}, [
|
|
798
|
-
const m = se(void 0),
|
|
799
|
-
const
|
|
815
|
+
}, [g]);
|
|
816
|
+
const m = se(void 0), _ = $e(async (u) => {
|
|
817
|
+
const M = new A.WebGPURenderer({
|
|
800
818
|
canvas: u.canvas,
|
|
801
819
|
antialias: !1,
|
|
802
820
|
alpha: !0,
|
|
803
821
|
powerPreference: "high-performance"
|
|
804
822
|
});
|
|
805
|
-
return
|
|
823
|
+
return M.setClearColor(new A.Color("#000000"), 0), M.setPixelRatio(devicePixelRatio), M.shadowMap.type = A.PCFSoftShadowMap, await M.init(), M;
|
|
806
824
|
}, []), B = ye(() => {
|
|
807
|
-
if (
|
|
808
|
-
const u =
|
|
809
|
-
return [
|
|
825
|
+
if (w.length) {
|
|
826
|
+
const u = w[0], M = new A.Vector3(u.position.x - 0.5, u.position.y, u.position.z - 0.1), U = new A.Vector3(u.position.x + 0.5, u.position.y, u.position.z - 0.1);
|
|
827
|
+
return [M, U];
|
|
810
828
|
} else if (o) {
|
|
811
|
-
const u = new A.Vector3(o.x - 0.5, o.y, o.z - 0.1),
|
|
812
|
-
return [u,
|
|
829
|
+
const u = new A.Vector3(o.x - 0.5, o.y, o.z - 0.1), M = new A.Vector3(o.x + 0.5, o.y, o.z - 0.1);
|
|
830
|
+
return [u, M];
|
|
813
831
|
}
|
|
814
832
|
return [];
|
|
815
|
-
}, [
|
|
816
|
-
return l ? /* @__PURE__ */
|
|
817
|
-
},
|
|
818
|
-
const { gl: s, scene: r, camera: o, size:
|
|
833
|
+
}, [w, o]);
|
|
834
|
+
return l ? /* @__PURE__ */ v.createElement(Rt, { gl: _, dpr: l, ref: d, shadows: !0 }, /* @__PURE__ */ v.createElement(mt, { iterations: 5, ms: 100, threshold: 0.75 }, /* @__PURE__ */ v.createElement(xs, { tonemapping: r, processedTier: g }), /* @__PURE__ */ v.createElement(fs, null), /* @__PURE__ */ v.createElement(gt, { ref: c, makeDefault: !0, fov: 28 }), /* @__PURE__ */ v.createElement(pt, { ref: n }), x && B.length && /* @__PURE__ */ v.createElement(ys, { points: B, color: "red" }), /* @__PURE__ */ v.createElement(et, { fallback: null }, s, /* @__PURE__ */ v.createElement(ps, { pixelated: !0 })))) : /* @__PURE__ */ v.createElement(v.Fragment, null);
|
|
835
|
+
}, xs = ({ tonemapping: e, processedTier: t }) => {
|
|
836
|
+
const { gl: s, scene: r, camera: o, size: a } = We(), [f] = D(new A.Vector3(-3, 2, 2)), [w] = D(new A.Vector3(0, 1, 0)), [x] = D(2), [h] = D(-3e-3), [g] = D(0.6), p = se(null), b = se(null);
|
|
819
837
|
return V(() => {
|
|
820
|
-
s && (s.shadowMap.type = A.PCFSoftShadowMap, s.toneMapping = e, t !== "low" ? r.environmentIntensity =
|
|
838
|
+
s && (s.shadowMap.type = A.PCFSoftShadowMap, s.toneMapping = e, t !== "low" ? r.environmentIntensity = g : r.environmentIntensity = 1);
|
|
821
839
|
}, [s, e]), V(() => {
|
|
822
|
-
r.environmentIntensity =
|
|
823
|
-
}, [
|
|
840
|
+
r.environmentIntensity = g;
|
|
841
|
+
}, [g]), V(() => {
|
|
824
842
|
if (!s || !r || !o || !t) return;
|
|
825
843
|
r.background = null;
|
|
826
|
-
const i = t === "high", l =
|
|
844
|
+
const i = t === "high", l = At(r, o);
|
|
827
845
|
l.setMRT(
|
|
828
|
-
i ?
|
|
846
|
+
i ? Ne({ output: Re, diffuseColor: kt, normal: Pt(Ct), velocity: fe }) : Ne({ output: Re, velocity: fe })
|
|
829
847
|
);
|
|
830
848
|
let y;
|
|
831
849
|
if (i) {
|
|
832
|
-
const c = l.getTextureNode("output"),
|
|
850
|
+
const c = l.getTextureNode("output"), n = l.getTextureNode("diffuseColor"), S = l.getTextureNode("depth"), m = l.getTextureNode("velocity"), _ = l.getTextureNode("normal"), B = _t((L) => Vt(_.sample(L))), u = Nt(c, S, B, o);
|
|
833
851
|
u.aoIntensity.value = 1, u.giIntensity.value = 5, u.sliceCount.value = 2, u.stepCount.value = 8, u.thickness.value = 0.03, u.radius.value = 0.5, u.expFactor.value = 0.1, u.backfaceLighting.value = 0.1;
|
|
834
|
-
const
|
|
835
|
-
|
|
852
|
+
const M = u.rgb, U = u.a, q = $(He(c.rgb.mul(U), n.rgb.mul(M)), c.a), R = Oe(q, S, m, o);
|
|
853
|
+
R.jitterIntensity = 0.25, y = R;
|
|
836
854
|
} else {
|
|
837
|
-
const c =
|
|
855
|
+
const c = Oe(
|
|
838
856
|
l,
|
|
839
857
|
l.getTextureNode("depth"),
|
|
840
858
|
l.getTextureNode("velocity"),
|
|
@@ -847,24 +865,24 @@ const Le = (e, t, s, r) => new us(pt(e), t, s, r), ms = () => {
|
|
|
847
865
|
d.dispose(), b.current = null;
|
|
848
866
|
};
|
|
849
867
|
}, [s, r, o, t]), V(() => {
|
|
850
|
-
!s || !
|
|
851
|
-
}, [
|
|
868
|
+
!s || !a || s.setSize(a.width, a.height);
|
|
869
|
+
}, [a]), qe(({ gl: i, scene: l, camera: y }) => {
|
|
852
870
|
b.current && b.current.render();
|
|
853
|
-
}, 1), /* @__PURE__ */
|
|
854
|
-
},
|
|
855
|
-
const s = k((h) => h.characterState), r =
|
|
856
|
-
return
|
|
857
|
-
const
|
|
858
|
-
deltaTime:
|
|
871
|
+
}, 1), /* @__PURE__ */ v.createElement(v.Fragment, null, t !== "low" && s && /* @__PURE__ */ v.createElement(v.Fragment, null, /* @__PURE__ */ v.createElement("directionalLight", { ref: p, color: "white", position: f.toArray(), "target-position": w.toArray(), intensity: x, castShadow: !0, "shadow-mapSize-width": 512, "shadow-mapSize-height": 512, "shadow-bias": h, "shadow-intensity": 0.7, "shadow-radius": 1.5 }, /* @__PURE__ */ v.createElement("orthographicCamera", { attach: "shadow-camera", args: [-1, 1, 2, -0.5, 2, 8] }))));
|
|
872
|
+
}, vs = ({ character: e, autoLookAt: t }) => {
|
|
873
|
+
const s = k((h) => h.characterState), r = j((h) => h.currentAUs), o = j((h) => h.currentGaze), a = j((h) => h.currentHeadPose), f = j((h) => h.lookAtCamera), w = z((h) => h.cameraPosition), x = j((h) => h.targets);
|
|
874
|
+
return qe((h, g) => {
|
|
875
|
+
const p = {
|
|
876
|
+
deltaTime: g,
|
|
859
877
|
timestamp: h.clock.oldTime,
|
|
860
878
|
AU: r,
|
|
861
879
|
gaze: o,
|
|
862
|
-
headPose:
|
|
880
|
+
headPose: a,
|
|
863
881
|
characterState: s,
|
|
864
|
-
lookAt: f ?
|
|
882
|
+
lookAt: f ? w : void 0,
|
|
865
883
|
targets: x
|
|
866
884
|
};
|
|
867
|
-
e.update(
|
|
885
|
+
e.update(p);
|
|
868
886
|
}), V(() => {
|
|
869
887
|
if (t)
|
|
870
888
|
switch (s) {
|
|
@@ -880,23 +898,23 @@ const Le = (e, t, s, r) => new us(pt(e), t, s, r), ms = () => {
|
|
|
880
898
|
else
|
|
881
899
|
ue(!1);
|
|
882
900
|
}, [s, t]), V(() => {
|
|
883
|
-
|
|
901
|
+
jt(e);
|
|
884
902
|
}, [e]), null;
|
|
885
|
-
},
|
|
886
|
-
const S = k((T) => T.animationsLoaded), m = z((T) => T.defaultPositions),
|
|
887
|
-
let
|
|
903
|
+
}, Zs = ({ url: e, type: t, animationsUrl: s, gender: r, speechSynthesis: o, camera: a, onLoadingCompleted: f, autoLookAt: w, breathing: x, disableAnimations: h, debug: g, enableBml: p, animationWeights: b, license: i, detectGpuData: l, environmentPreset: y = "apartment", tonemapping: d = A.NeutralToneMapping, targets: c, useBlendshapeManager: n = !1 }) => {
|
|
904
|
+
const S = k((T) => T.animationsLoaded), m = z((T) => T.defaultPositions), _ = z((T) => T.defaultDistances), [B, u] = D(), [M, U] = D(null), [q, R] = D(), [L, ae] = D(!1), xe = async (T) => {
|
|
905
|
+
let C = null;
|
|
888
906
|
switch (t) {
|
|
889
907
|
case ee.cc3:
|
|
890
|
-
|
|
908
|
+
C = new ht(), R(le.cc3);
|
|
891
909
|
break;
|
|
892
910
|
case ee.avatarsdk:
|
|
893
|
-
|
|
911
|
+
C = new lt(), R(le.avatarsdk);
|
|
894
912
|
break;
|
|
895
913
|
case ee.avaturn:
|
|
896
|
-
|
|
914
|
+
C = new ct(), R(le.avaturn);
|
|
897
915
|
break;
|
|
898
916
|
}
|
|
899
|
-
const N = await
|
|
917
|
+
const N = await C.loadAsync(T).catch((O) => console.warn("Error loading character : ", O));
|
|
900
918
|
if (N) {
|
|
901
919
|
let O = null;
|
|
902
920
|
const Z = {
|
|
@@ -905,10 +923,10 @@ const Le = (e, t, s, r) => new us(pt(e), t, s, r), ms = () => {
|
|
|
905
923
|
animationsUrl: s,
|
|
906
924
|
gender: r || "male",
|
|
907
925
|
type: t,
|
|
908
|
-
debug:
|
|
909
|
-
enableBmlManager: !!
|
|
926
|
+
debug: g,
|
|
927
|
+
enableBmlManager: !!p,
|
|
910
928
|
animationWeights: b,
|
|
911
|
-
useBlendshapeManager:
|
|
929
|
+
useBlendshapeManager: n,
|
|
912
930
|
license: i
|
|
913
931
|
};
|
|
914
932
|
switch (t) {
|
|
@@ -928,54 +946,54 @@ const Le = (e, t, s, r) => new us(pt(e), t, s, r), ms = () => {
|
|
|
928
946
|
Fe(!0);
|
|
929
947
|
};
|
|
930
948
|
V(() => {
|
|
931
|
-
var T,
|
|
932
|
-
|
|
949
|
+
var T, C;
|
|
950
|
+
M && S && (x === !1 && ((C = (T = M.animationManager) == null ? void 0 : T.disableBreathing) == null || C.call(T)), L ? (Zt(M.getAllAnimationNames()), Qt(M.getAllAnimations()), setTimeout(() => {
|
|
933
951
|
f == null || f();
|
|
934
952
|
}, 1e3)) : ce());
|
|
935
|
-
}, [
|
|
936
|
-
|
|
953
|
+
}, [M, S, L]), V(() => {
|
|
954
|
+
Gt(c || []);
|
|
937
955
|
}, [c]), V(() => {
|
|
938
956
|
Fe(!1), B !== void 0 && (B ? xe(e) : f == null || f());
|
|
939
957
|
}, [e, B]), V(() => {
|
|
940
|
-
if (L &&
|
|
941
|
-
if (
|
|
942
|
-
const T =
|
|
943
|
-
|
|
958
|
+
if (L && _ && m)
|
|
959
|
+
if (a) {
|
|
960
|
+
const T = ms(a, _, m);
|
|
961
|
+
ze(T), De(a.lookAt ? m[a.lookAt] : m.lowerbelly), qt(!!a.movable);
|
|
944
962
|
} else {
|
|
945
963
|
const T = m.mouth.clone();
|
|
946
|
-
T.setComponent(2,
|
|
964
|
+
T.setComponent(2, _.farther), ze(T), De(m.lowerbelly);
|
|
947
965
|
}
|
|
948
|
-
}, [L,
|
|
949
|
-
o && (o.credentials &&
|
|
966
|
+
}, [L, a, _, m]), V(() => {
|
|
967
|
+
o && (o.credentials && is(o.credentials), o.voice && ds(o.voice));
|
|
950
968
|
}, [o]), V(() => {
|
|
951
|
-
|
|
952
|
-
}, [
|
|
969
|
+
us(n);
|
|
970
|
+
}, [n]);
|
|
953
971
|
const ce = () => {
|
|
954
|
-
if (
|
|
972
|
+
if (M && q) {
|
|
955
973
|
try {
|
|
956
|
-
const T = new A.Box3().setFromObject(
|
|
957
|
-
|
|
958
|
-
const Z = Math.abs(
|
|
959
|
-
|
|
974
|
+
const T = new A.Box3().setFromObject(M), C = T.max, N = T.min, O = new A.Vector3((C.x + N.x) / 2, (C.y + N.y) / 2, (C.z + N.z) / 2);
|
|
975
|
+
Ot(O);
|
|
976
|
+
const Z = Math.abs(C.x - N.x), E = Math.abs(C.y - N.y), Qe = Math.abs(C.z - N.z);
|
|
977
|
+
Ut({
|
|
960
978
|
x: Z,
|
|
961
|
-
y:
|
|
962
|
-
z:
|
|
979
|
+
y: E,
|
|
980
|
+
z: Qe
|
|
963
981
|
});
|
|
964
|
-
const H = (
|
|
965
|
-
eye: new A.Vector3(H,
|
|
966
|
-
mouth: new A.Vector3(H,
|
|
967
|
-
neck: new A.Vector3(H,
|
|
968
|
-
clavicle: new A.Vector3(H,
|
|
969
|
-
torso: new A.Vector3(H,
|
|
970
|
-
belly: new A.Vector3(H,
|
|
971
|
-
lowerbelly: new A.Vector3(H,
|
|
982
|
+
const H = (C.x + N.x) / 2, W = (C.z + N.z) / 2, Ye = {
|
|
983
|
+
eye: new A.Vector3(H, C.y - E / 16, W),
|
|
984
|
+
mouth: new A.Vector3(H, C.y - E / 12, W),
|
|
985
|
+
neck: new A.Vector3(H, C.y - E / 8, W),
|
|
986
|
+
clavicle: new A.Vector3(H, C.y - E / 6, W),
|
|
987
|
+
torso: new A.Vector3(H, C.y - E / 4, W),
|
|
988
|
+
belly: new A.Vector3(H, C.y - E / 8 * 3, W),
|
|
989
|
+
lowerbelly: new A.Vector3(H, C.y - E / 32 * 15, W),
|
|
972
990
|
hips: O,
|
|
973
|
-
higherthigh: new A.Vector3(H, N.y +
|
|
974
|
-
thigh: new A.Vector3(H, N.y +
|
|
975
|
-
knee: new A.Vector3(H, N.y +
|
|
976
|
-
leg: new A.Vector3(H, N.y +
|
|
991
|
+
higherthigh: new A.Vector3(H, N.y + E / 32 * 15, W),
|
|
992
|
+
thigh: new A.Vector3(H, N.y + E / 8 * 3, W),
|
|
993
|
+
knee: new A.Vector3(H, N.y + E / 4, W),
|
|
994
|
+
leg: new A.Vector3(H, N.y + E / 8, W),
|
|
977
995
|
feet: new A.Vector3(H, N.y, W)
|
|
978
|
-
}, K = (
|
|
996
|
+
}, K = (C.y - (N.y + E / 7 * 2)) / 2 / Math.tan(25 * (Math.PI / 180)), Xe = {
|
|
979
997
|
veryclose: K / 4,
|
|
980
998
|
closer: K / 3,
|
|
981
999
|
close: K / 2.5,
|
|
@@ -986,76 +1004,76 @@ const Le = (e, t, s, r) => new us(pt(e), t, s, r), ms = () => {
|
|
|
986
1004
|
farther: K * 3,
|
|
987
1005
|
veryfar: K * 4
|
|
988
1006
|
};
|
|
989
|
-
|
|
1007
|
+
Ht(Ye), Wt(Xe);
|
|
990
1008
|
} catch (T) {
|
|
991
1009
|
console.warn(T);
|
|
992
1010
|
}
|
|
993
|
-
|
|
1011
|
+
ae(!0);
|
|
994
1012
|
}
|
|
995
1013
|
};
|
|
996
|
-
return /* @__PURE__ */
|
|
997
|
-
},
|
|
1014
|
+
return /* @__PURE__ */ v.createElement(Ss, { parentGpuTier: l, setIsGpuAvailable: u, tonemapping: d }, B ? /* @__PURE__ */ v.createElement(v.Fragment, null, M && /* @__PURE__ */ v.createElement(vs, { character: M, autoLookAt: !!w }), M && /* @__PURE__ */ v.createElement(v.Fragment, null, /* @__PURE__ */ v.createElement(ft, { preset: y }), /* @__PURE__ */ v.createElement("primitive", { object: M, castShadow: !0, receiveShadow: !0 }))) : /* @__PURE__ */ v.createElement(v.Fragment, null));
|
|
1015
|
+
}, ws = {
|
|
998
1016
|
emotions: [],
|
|
999
1017
|
currentTopEmotion: Se.Neutral,
|
|
1000
1018
|
useTopEmotionOnly: !0,
|
|
1001
1019
|
autoDecay: !1
|
|
1002
|
-
}, ie =
|
|
1020
|
+
}, ie = ne()(() => ws), Qs = (e) => {
|
|
1003
1021
|
if (ie.setState({ emotions: e || [] }), e != null && e.length) {
|
|
1004
1022
|
const t = e.reduce((s, r) => s.value > r.value ? s : r);
|
|
1005
1023
|
ie.setState({ currentTopEmotion: t.emotion });
|
|
1006
1024
|
} else
|
|
1007
1025
|
ie.setState({ currentTopEmotion: Se.Neutral });
|
|
1008
|
-
},
|
|
1026
|
+
}, Ys = (e) => {
|
|
1009
1027
|
ie.setState({ useTopEmotionOnly: e });
|
|
1010
|
-
},
|
|
1028
|
+
}, Xs = (e) => {
|
|
1011
1029
|
ie.setState({ autoDecay: e });
|
|
1012
|
-
},
|
|
1030
|
+
}, $s = (e) => {
|
|
1013
1031
|
const t = k.getState().FACSManager;
|
|
1014
1032
|
t == null || t.playFacialAnimation({ ...e });
|
|
1015
1033
|
};
|
|
1016
1034
|
export {
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1035
|
+
Zs as Character,
|
|
1036
|
+
nr as CharacterState,
|
|
1037
|
+
ar as CreationTool,
|
|
1038
|
+
F as Distances,
|
|
1039
|
+
sr as Object3D,
|
|
1040
|
+
I as Positions,
|
|
1023
1041
|
G as Rotations,
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1042
|
+
Ws as addBlendshape,
|
|
1043
|
+
qs as addSPPASViseme,
|
|
1044
|
+
Ge as addViseme,
|
|
1045
|
+
or as bmlTags,
|
|
1046
|
+
ir as emotionList,
|
|
1047
|
+
Ke as flushBlendshapeData,
|
|
1048
|
+
Je as flushLipSyncData,
|
|
1049
|
+
Es as getAnimationsMap,
|
|
1050
|
+
Ns as getCameraPosition,
|
|
1051
|
+
Vs as getCharacterHeight,
|
|
1052
|
+
Rs as getLookAt,
|
|
1053
|
+
Js as getVoices,
|
|
1054
|
+
Jt as lookAtAndKeep,
|
|
1055
|
+
zs as lookAtAndSteady,
|
|
1056
|
+
Us as playAnimationByName,
|
|
1057
|
+
$s as playFacialAnimation,
|
|
1058
|
+
Ls as presets,
|
|
1059
|
+
Kt as releaseLookAt,
|
|
1060
|
+
Xs as setAutoDecay,
|
|
1061
|
+
js as setAutoPlay,
|
|
1062
|
+
Hs as setBlendshapes,
|
|
1063
|
+
ze as setCameraPosition,
|
|
1064
|
+
Be as setCharacterState,
|
|
1065
|
+
Is as setCurrentAUs,
|
|
1066
|
+
Fs as setCurrentGaze,
|
|
1067
|
+
Bs as setCurrentHeadPose,
|
|
1068
|
+
cs as setCurrentUtterance,
|
|
1069
|
+
Qs as setEmotions,
|
|
1052
1070
|
ue as setLookAtCamera,
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1071
|
+
qt as setMovable,
|
|
1072
|
+
Ds as setShowFirstTarget,
|
|
1073
|
+
Gs as setTextToSpeak,
|
|
1074
|
+
Ys as setUseTopEmotionOnly,
|
|
1075
|
+
Ks as setVisemeIntensity,
|
|
1076
|
+
Os as setVisemes,
|
|
1077
|
+
ds as setVoice,
|
|
1060
1078
|
k as useCharacterStore
|
|
1061
1079
|
};
|