@davi-ai/react-bodyengine-three 1.0.31 → 1.0.33

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/index.js CHANGED
@@ -1,37 +1,37 @@
1
- import S, { useState as F, useMemo as Se, useEffect as k, useRef as te, useCallback as Ke, Suspense as Ze } from "react";
2
- import * as b from "three/webgpu";
3
- import { Vector3 as Qe, TempNode as $e, NodeUpdateType as Ye, Vector2 as ye, RenderTarget as we, DepthTexture as ve, HalfFloatType as xe, NodeMaterial as Je, NoBlending as Xe, Matrix4 as J, RendererUtils as Te, QuadMesh as et, FloatType as tt } from "three/webgpu";
4
- import { Object3D as Jr } from "three/webgpu";
5
- import { CharacterState as q, CreationTool as X, AvaturnLoader as rt, AvatarSDKLoader as st, CC3Loader as nt, Character as ue } from "@davi-ai/bodyengine-three";
6
- import { CharacterState as es, CreationTool as ts, bmlTags as rs, emotionList as ss } from "@davi-ai/bodyengine-three";
7
- import { useDetectGPU as at, PerformanceMonitor as ot, PerspectiveCamera as it, CameraControls as ct, Environment as lt } from "@react-three/drei";
8
- import { convertToTexture as ht, uniform as Q, passTexture as dt, texture as ke, velocity as Ee, struct as ut, Fn as ee, float as Z, vec2 as me, If as Me, vec4 as oe, max as ae, ivec2 as mt, luminance as Ae, add as Ue, uv as pt, mix as gt, logarithmicDepthToViewZ as ft, viewZToPerspectiveDepth as Ce, getViewPosition as yt, viewZToOrthographicDepth as St, pass as bt, mrt as wt, diffuseColor as vt, output as xt, packNormalToRGB as Tt, normalView as kt, sample as Mt, unpackRGBToNormal as At } from "three/tsl";
9
- import { ssgi as Ct } from "three/addons/tsl/display/SSGINode.js";
10
- import { Canvas as Pt, useThree as _t, useFrame as je } from "@react-three/fiber";
11
- import { createSpeechSynthesisPonyfill as Nt, SpeechSynthesisUtterance as Vt } from "@davi-ai/web-speech-cognitive-services-davi";
12
- const Pe = (e) => {
1
+ import D, { useState as te, useMemo as it, useEffect as j, useRef as Te, useCallback as $t, Suspense as Qt } from "react";
2
+ import * as B from "three/webgpu";
3
+ import { Vector3 as Bt, TempNode as He, NodeUpdateType as Xt, Vector2 as ve, RenderTarget as st, DepthTexture as pt, HalfFloatType as gt, NodeMaterial as Dt, NoBlending as Jt, Matrix4 as xe, RendererUtils as Ue, QuadMesh as zt, FloatType as es, UnsignedByteType as ft, RedFormat as ts, UnsignedInt101111Type as ss, RGBFormat as ns, MathUtils as os, DataTexture as as, RepeatWrapping as yt } from "three/webgpu";
4
+ import { Object3D as Co } from "three/webgpu";
5
+ import { CharacterState as de, surfaceId as rs, surfaceMask as We, SURFACE as Ke, CreationTool as Se, AvaturnLoader as is, AvatarSDKLoader as cs, CC3Loader as ls, Character as Ye } from "@davi-ai/bodyengine-three";
6
+ import { CharacterState as Mo, CreationTool as _o, bmlTags as ko, emotionList as Po } from "@davi-ai/bodyengine-three";
7
+ import { useDetectGPU as ds, PerformanceMonitor as us, PerspectiveCamera as hs, CameraControls as ms, Environment as ps } from "@react-three/drei";
8
+ import { convertToTexture as qe, uniform as I, passTexture as ze, texture as Fe, OnBeforeRenderPipeline as gs, OnAfterRenderPipeline as fs, velocity as ct, struct as ys, Fn as Q, float as C, vec2 as K, If as he, vec4 as J, max as q, vec3 as ae, ivec2 as ke, luminance as Ae, add as xs, uv as Re, mix as Pe, logarithmicDepthToViewZ as Ft, viewZToPerspectiveDepth as nt, getViewPosition as Ie, viewZToOrthographicDepth as Ss, NodeUpdateType as Ot, reference as je, uint as oe, sub as bs, abs as pe, HALF_PI as Ze, sqrt as Et, PI as fe, Loop as Oe, pow as Ge, mul as $e, Break as Ts, normalize as be, dot as ie, clamp as _e, div as vs, ceil as As, shiftRight as ws, countOneBits as xt, sign as St, property as Ee, outputStruct as Cs, screenCoordinate as bt, interleavedGradientNoise as Ns, fract as Ms, rand as _s, cos as ot, sin as at, cross as Tt, acos as ks, bool as vt, getNormalFromDepth as Lt, nodeObject as rt, uniformArray as Ps, textureSize as Vs, mat2 as Is, int as At, min as ce, pass as Ut, mrt as jt, diffuseColor as Rs, output as Gt, packNormalToRGB as Bs, normalView as Ds, sample as zs, unpackRGBToNormal as Fs, exp as Os, perspectiveDepthToViewZ as Es } from "three/tsl";
9
+ import { SimplexNoise as Ls } from "three/examples/jsm/math/SimplexNoise.js";
10
+ import { Canvas as Us, useThree as js, useFrame as Ht } from "@react-three/fiber";
11
+ import { createSpeechSynthesisPonyfill as Gs, SpeechSynthesisUtterance as Hs } from "@davi-ai/web-speech-cognitive-services-davi";
12
+ const wt = (e) => {
13
13
  let t;
14
- const r = /* @__PURE__ */ new Set(), s = (u, C) => {
15
- const _ = typeof u == "function" ? u(t) : u;
16
- if (!Object.is(_, t)) {
17
- const N = t;
18
- t = C ?? (typeof _ != "object" || _ === null) ? _ : Object.assign({}, t, _), r.forEach((l) => l(t, N));
14
+ const s = /* @__PURE__ */ new Set(), a = (v, S) => {
15
+ const V = typeof v == "function" ? v(t) : v;
16
+ if (!Object.is(V, t)) {
17
+ const m = t;
18
+ t = S ?? (typeof V != "object" || V === null) ? V : Object.assign({}, t, V), s.forEach((k) => k(t, m));
19
19
  }
20
- }, o = () => t, x = { setState: s, getState: o, getInitialState: () => T, subscribe: (u) => (r.add(u), () => r.delete(u)) }, T = t = e(s, o, x);
21
- return x;
22
- }, It = (e) => e ? Pe(e) : Pe, Rt = (e) => e;
23
- function Bt(e, t = Rt) {
24
- const r = S.useSyncExternalStore(
20
+ }, r = () => t, f = { setState: a, getState: r, getInitialState: () => T, subscribe: (v) => (s.add(v), () => s.delete(v)) }, T = t = e(a, r, f);
21
+ return f;
22
+ }, qs = (e) => e ? wt(e) : wt, Ws = (e) => e;
23
+ function Ks(e, t = Ws) {
24
+ const s = D.useSyncExternalStore(
25
25
  e.subscribe,
26
- S.useCallback(() => t(e.getState()), [e, t]),
27
- S.useCallback(() => t(e.getInitialState()), [e, t])
26
+ D.useCallback(() => t(e.getState()), [e, t]),
27
+ D.useCallback(() => t(e.getInitialState()), [e, t])
28
28
  );
29
- return S.useDebugValue(r), r;
29
+ return D.useDebugValue(s), s;
30
30
  }
31
- const zt = (e) => {
32
- const t = It(e), r = (s) => Bt(t, s);
33
- return Object.assign(r, t), r;
34
- }, se = (e) => zt, v = se()(() => ({
31
+ const Ys = (e) => {
32
+ const t = qs(e), s = (a) => Ks(t, a);
33
+ return Object.assign(s, t), s;
34
+ }, Ce = (e) => Ys, O = Ce()(() => ({
35
35
  character: null,
36
36
  managers: [],
37
37
  globalManager: null,
@@ -47,91 +47,91 @@ const zt = (e) => {
47
47
  characterWidth: 0,
48
48
  characterHeight: 0,
49
49
  characterDepth: 0,
50
- characterState: q.idle
51
- })), Dt = (e) => {
52
- v.setState({ character: e }), v.setState({ managers: {
50
+ characterState: de.idle
51
+ })), Zs = (e) => {
52
+ O.setState({ character: e }), O.setState({ managers: {
53
53
  lipSyncManager: (e == null ? void 0 : e.lipSyncManager) || null,
54
54
  blendshapeManager: (e == null ? void 0 : e.blendshapeManager) || null,
55
55
  eyeBlinkManager: (e == null ? void 0 : e.eyeBlinkManager) || null,
56
56
  animationManager: (e == null ? void 0 : e.animationManager) || null
57
- } }), v.setState({ globalManager: (e == null ? void 0 : e.globalManager) || null }), v.setState({ lipSyncManager: (e == null ? void 0 : e.lipSyncManager) || null }), v.setState({ blendshapeManager: (e == null ? void 0 : e.blendshapeManager) || null }), v.setState({ eyeBlinkManager: (e == null ? void 0 : e.eyeBlinkManager) || null }), v.setState({ animationManager: (e == null ? void 0 : e.animationManager) || null }), v.setState({ FACSManager: (e == null ? void 0 : e.FACSManager) || null }), v.setState({ headPoseManager: (e == null ? void 0 : e.headPoseManager) || null }), v.setState({ gazeManager: (e == null ? void 0 : e.gazeManager) || null }), v.setState({ bmlManager: (e == null ? void 0 : e.bmlManager) || null });
58
- }, _e = (e) => {
59
- v.setState({ animationsLoaded: e });
60
- }, Ft = (e) => {
61
- v.setState({ characterWidth: e.x }), v.setState({ characterHeight: e.y }), v.setState({ characterDepth: e.z });
62
- }, Cr = () => v.getState().characterHeight, Ne = (e) => {
63
- v.setState({ characterState: e });
64
- }, D = se()(() => ({
57
+ } }), O.setState({ globalManager: (e == null ? void 0 : e.globalManager) || null }), O.setState({ lipSyncManager: (e == null ? void 0 : e.lipSyncManager) || null }), O.setState({ blendshapeManager: (e == null ? void 0 : e.blendshapeManager) || null }), O.setState({ eyeBlinkManager: (e == null ? void 0 : e.eyeBlinkManager) || null }), O.setState({ animationManager: (e == null ? void 0 : e.animationManager) || null }), O.setState({ FACSManager: (e == null ? void 0 : e.FACSManager) || null }), O.setState({ headPoseManager: (e == null ? void 0 : e.headPoseManager) || null }), O.setState({ gazeManager: (e == null ? void 0 : e.gazeManager) || null }), O.setState({ bmlManager: (e == null ? void 0 : e.bmlManager) || null });
58
+ }, Ct = (e) => {
59
+ O.setState({ animationsLoaded: e });
60
+ }, $s = (e) => {
61
+ O.setState({ characterWidth: e.x }), O.setState({ characterHeight: e.y }), O.setState({ characterDepth: e.z });
62
+ }, Jn = () => O.getState().characterHeight, Nt = (e) => {
63
+ O.setState({ characterState: e });
64
+ }, se = Ce()(() => ({
65
65
  cameraRef: null,
66
- cameraPosition: new Qe(0, 0, 5),
66
+ cameraPosition: new Bt(0, 0, 5),
67
67
  bodyCenter: null,
68
68
  defaultPositions: null,
69
69
  defaultDistances: null,
70
70
  lookAt: null,
71
71
  movable: !0
72
- })), Et = (e) => {
73
- D.setState({ cameraRef: e });
74
- }, Ve = (e) => {
75
- D.setState({ cameraPosition: e });
76
- }, Pr = () => D.getState().cameraPosition, Ut = (e) => {
77
- D.setState({ bodyCenter: e });
78
- }, jt = (e) => {
79
- D.setState({ defaultPositions: e });
80
- }, Lt = (e) => {
81
- D.setState({ defaultDistances: e });
82
- }, Ie = (e) => {
83
- D.setState({ lookAt: e });
84
- }, _r = () => D.getState().lookAt, Ot = (e) => {
85
- D.setState({ movable: e });
86
- }, U = se()(() => ({
72
+ })), Qs = (e) => {
73
+ se.setState({ cameraRef: e });
74
+ }, Mt = (e) => {
75
+ se.setState({ cameraPosition: e });
76
+ }, eo = () => se.getState().cameraPosition, Xs = (e) => {
77
+ se.setState({ bodyCenter: e });
78
+ }, Js = (e) => {
79
+ se.setState({ defaultPositions: e });
80
+ }, en = (e) => {
81
+ se.setState({ defaultDistances: e });
82
+ }, _t = (e) => {
83
+ se.setState({ lookAt: e });
84
+ }, to = () => se.getState().lookAt, tn = (e) => {
85
+ se.setState({ movable: e });
86
+ }, re = Ce()(() => ({
87
87
  currentAUs: null,
88
88
  currentGaze: null,
89
89
  currentHeadPose: null,
90
90
  lookAtCamera: !1,
91
91
  targets: [],
92
92
  showFirstTarget: !1
93
- })), Ht = (e) => {
94
- U.setState({ targets: e });
95
- }, Nr = (e) => {
96
- U.setState({ currentAUs: e });
97
- }, Vr = (e) => {
98
- U.setState({ currentGaze: e });
99
- }, Ir = (e) => {
100
- U.setState({ currentHeadPose: e });
101
- }, pe = (e) => {
102
- U.setState({ lookAtCamera: e }), e ? Gt() : Wt();
103
- }, Gt = (e) => {
104
- const t = v.getState().globalManager;
93
+ })), sn = (e) => {
94
+ re.setState({ targets: e });
95
+ }, so = (e) => {
96
+ re.setState({ currentAUs: e });
97
+ }, no = (e) => {
98
+ re.setState({ currentGaze: e });
99
+ }, oo = (e) => {
100
+ re.setState({ currentHeadPose: e });
101
+ }, Qe = (e) => {
102
+ re.setState({ lookAtCamera: e }), e ? nn() : on();
103
+ }, nn = (e) => {
104
+ const t = O.getState().globalManager;
105
105
  if (e)
106
106
  t == null || t.lookAtAndKeep(e);
107
107
  else {
108
- const r = D.getState().cameraRef;
109
- t == null || t.lookAtAndKeep(r);
108
+ const s = se.getState().cameraRef;
109
+ t == null || t.lookAtAndKeep(s);
110
110
  }
111
- }, Wt = () => {
111
+ }, on = () => {
112
112
  var e;
113
- (e = v.getState().globalManager) == null || e.releaseLookAt();
114
- }, Rr = (e) => {
115
- U.setState({ showFirstTarget: e });
116
- }, re = se()(() => ({
113
+ (e = O.getState().globalManager) == null || e.releaseLookAt();
114
+ }, ao = (e) => {
115
+ re.setState({ showFirstTarget: e });
116
+ }, we = Ce()(() => ({
117
117
  animationsNames: [],
118
118
  animations: /* @__PURE__ */ new Map(),
119
119
  currentAnimation: null,
120
120
  autoPlay: !0
121
- })), qt = (e) => {
122
- re.setState({ animationsNames: e });
123
- }, Kt = (e) => {
124
- re.setState({ animations: e });
125
- }, Br = () => re.getState().animations, zr = (e) => {
126
- re.setState({ autoPlay: e });
127
- }, Dr = (e) => {
128
- if (re.setState({ autoPlay: !1 }), re.getState().animationsNames.includes(e)) {
129
- const r = v.getState().animationManager;
130
- r == null || r.playAnimation(e);
121
+ })), an = (e) => {
122
+ we.setState({ animationsNames: e });
123
+ }, rn = (e) => {
124
+ we.setState({ animations: e });
125
+ }, ro = () => we.getState().animations, io = (e) => {
126
+ we.setState({ autoPlay: e });
127
+ }, co = (e) => {
128
+ if (we.setState({ autoPlay: !1 }), we.getState().animationsNames.includes(e)) {
129
+ const s = O.getState().animationManager;
130
+ s == null || s.playAnimation(e);
131
131
  }
132
132
  };
133
- var V = /* @__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))(V || {}), W = /* @__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))(W || {}), I = /* @__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))(I || {}), le = /* @__PURE__ */ ((e) => (e.cc3 = "CC_Base_Body", e.avatarsdk = "AvatarBody", e.avaturn = "Body_Mesh", e))(le || {}), be = /* @__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))(be || {});
134
- const Re = /* @__PURE__ */ new Map([
133
+ var $ = /* @__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))($ || {}), le = /* @__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))(le || {}), X = /* @__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))(X || {}), Le = /* @__PURE__ */ ((e) => (e.cc3 = "CC_Base_Body", e.avatarsdk = "AvatarBody", e.avaturn = "Body_Mesh", e))(Le || {}), lt = /* @__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))(lt || {});
134
+ const kt = /* @__PURE__ */ new Map([
135
135
  [0, "sil"],
136
136
  [1, "aa"],
137
137
  [2, "aa"],
@@ -154,7 +154,7 @@ const Re = /* @__PURE__ */ new Map([
154
154
  [19, "DD"],
155
155
  [20, "kk"],
156
156
  [21, "PP"]
157
- ]), Zt = /* @__PURE__ */ new Map([
157
+ ]), cn = /* @__PURE__ */ new Map([
158
158
  ["#", "#"],
159
159
  ["p", "p"],
160
160
  ["b", "b"],
@@ -203,7 +203,7 @@ const Re = /* @__PURE__ */ new Map([
203
203
  ["9~", "oẽ"],
204
204
  ["N", "ŋ"],
205
205
  ["J", "ɲ"]
206
- ]), Qt = /* @__PURE__ */ new Map([
206
+ ]), ln = /* @__PURE__ */ new Map([
207
207
  ["#", 0],
208
208
  ["æ", 1],
209
209
  ["ə", 1],
@@ -244,48 +244,48 @@ const Re = /* @__PURE__ */ new Map([
244
244
  ["p", 21],
245
245
  ["b", 21],
246
246
  ["m", 21]
247
- ]), $t = {
248
- position: V.mouth,
249
- distance: I.farther,
250
- lookAt: V.lowerbelly
251
- }, Yt = {
252
- position: V.mouth,
253
- distance: I.close,
254
- lookAt: V.mouth
255
- }, Jt = {
256
- position: V.mouth,
257
- distance: I.midclose,
258
- lookAt: V.mouth
259
- }, Xt = {
260
- position: V.neck,
261
- distance: I.close,
262
- lookAt: V.neck
263
- }, er = {
264
- position: V.eye,
265
- distance: I.medium,
266
- lookAt: V.neck
267
- }, tr = {
268
- position: V.eye,
269
- distance: I.medium,
270
- lookAt: V.clavicle
271
- }, rr = {
272
- position: V.eye,
273
- distance: I.midfar,
274
- lookAt: V.belly
275
- }, sr = {
276
- position: V.eye,
277
- distance: I.far,
278
- lookAt: V.lowerbelly
279
- }, Fr = {
280
- default: $t,
281
- head: Yt,
282
- neck: Jt,
283
- shoulders: Xt,
284
- chest: er,
285
- belly: tr,
286
- knees: rr,
287
- feet: sr
288
- }, w = se()(() => ({
247
+ ]), dn = {
248
+ position: $.mouth,
249
+ distance: X.farther,
250
+ lookAt: $.lowerbelly
251
+ }, un = {
252
+ position: $.mouth,
253
+ distance: X.close,
254
+ lookAt: $.mouth
255
+ }, hn = {
256
+ position: $.mouth,
257
+ distance: X.midclose,
258
+ lookAt: $.mouth
259
+ }, mn = {
260
+ position: $.neck,
261
+ distance: X.close,
262
+ lookAt: $.neck
263
+ }, pn = {
264
+ position: $.eye,
265
+ distance: X.medium,
266
+ lookAt: $.neck
267
+ }, gn = {
268
+ position: $.eye,
269
+ distance: X.medium,
270
+ lookAt: $.clavicle
271
+ }, fn = {
272
+ position: $.eye,
273
+ distance: X.midfar,
274
+ lookAt: $.belly
275
+ }, yn = {
276
+ position: $.eye,
277
+ distance: X.far,
278
+ lookAt: $.lowerbelly
279
+ }, lo = {
280
+ default: dn,
281
+ head: un,
282
+ neck: hn,
283
+ shoulders: mn,
284
+ chest: pn,
285
+ belly: gn,
286
+ knees: fn,
287
+ feet: yn
288
+ }, z = Ce()(() => ({
289
289
  credentials: void 0,
290
290
  currentUtterance: null,
291
291
  boundaries: [],
@@ -298,125 +298,125 @@ const Re = /* @__PURE__ */ new Map([
298
298
  textToSpeak: null,
299
299
  visemeIntensity: 1,
300
300
  useBlendshapeManager: !1
301
- })), nr = (e) => {
302
- w.setState({ credentials: e });
303
- }, ar = (e) => {
301
+ })), xn = (e) => {
302
+ z.setState({ credentials: e });
303
+ }, Sn = (e) => {
304
304
  if (e) {
305
- const t = w.getState().voice;
305
+ const t = z.getState().voice;
306
306
  t && (e.voice = t);
307
307
  }
308
- w.setState({ currentUtterance: e }), w.setState({ textToSpeak: null });
309
- }, Er = (e) => {
310
- w.setState({ visemes: e });
311
- }, Ur = (e) => {
312
- w.setState({ blendshapes: e });
313
- }, Le = (e) => {
314
- w.setState({ visemes: [...w.getState().visemes, e] });
315
- }, jr = (e) => {
316
- w.setState({ blendshapes: [...w.getState().blendshapes, e] });
317
- }, Lr = (e, t) => {
318
- const r = Zt.get(e.name);
319
- if (r) {
320
- const s = Qt.get(r);
321
- s !== void 0 && Le({ ...e, name: `${s}`, elapsedTime: e.elapsedTime * (t || 1e7) });
322
- }
323
- }, or = (e) => {
324
- w.setState({ currentVisemeIndex: e });
325
- }, ir = (e) => {
326
- w.setState({ currentBlendshapeIndex: e });
327
- }, Oe = () => {
308
+ z.setState({ currentUtterance: e }), z.setState({ textToSpeak: null });
309
+ }, uo = (e) => {
310
+ z.setState({ visemes: e });
311
+ }, ho = (e) => {
312
+ z.setState({ blendshapes: e });
313
+ }, qt = (e) => {
314
+ z.setState({ visemes: [...z.getState().visemes, e] });
315
+ }, mo = (e) => {
316
+ z.setState({ blendshapes: [...z.getState().blendshapes, e] });
317
+ }, po = (e, t) => {
318
+ const s = cn.get(e.name);
319
+ if (s) {
320
+ const a = ln.get(s);
321
+ a !== void 0 && qt({ ...e, name: `${a}`, elapsedTime: e.elapsedTime * (t || 1e7) });
322
+ }
323
+ }, bn = (e) => {
324
+ z.setState({ currentVisemeIndex: e });
325
+ }, Tn = (e) => {
326
+ z.setState({ currentBlendshapeIndex: e });
327
+ }, Wt = () => {
328
328
  var e;
329
- w.setState({
329
+ z.setState({
330
330
  visemes: [],
331
331
  currentVisemeIndex: 0
332
- }), (e = v.getState().lipSyncManager) == null || e.stop();
333
- }, He = () => {
332
+ }), (e = O.getState().lipSyncManager) == null || e.stop();
333
+ }, Kt = () => {
334
334
  var e;
335
- w.setState({
335
+ z.setState({
336
336
  blendshapes: [],
337
337
  currentBlendshapeIndex: 0
338
- }), (e = v.getState().blendshapeManager) == null || e.stop();
339
- }, cr = (e) => {
340
- w.setState({ voice: e });
341
- }, Be = (e) => {
342
- w.setState({ voices: e });
343
- }, Or = (e) => {
344
- w.setState({ textToSpeak: e });
345
- }, Hr = () => w.getState().voices, Gr = (e) => {
346
- w.setState({ visemeIntensity: e });
347
- }, lr = (e) => {
348
- e !== w.getState().useBlendshapeManager && (Oe(), He(), w.setState({ useBlendshapeManager: e }));
349
- }, hr = (e, t, r) => {
350
- let s = r[e.position || V.eye].getComponent(0);
351
- const o = r[e.position || V.mouth].getComponent(1);
352
- let a = 0;
353
- const M = typeof e.distance == "string" ? parseInt(e.distance) : e.distance, x = typeof e.rotation == "string" ? parseInt(e.rotation) : e.rotation;
354
- switch (M) {
355
- case I.veryclose:
356
- a = t.veryclose;
338
+ }), (e = O.getState().blendshapeManager) == null || e.stop();
339
+ }, vn = (e) => {
340
+ z.setState({ voice: e });
341
+ }, Pt = (e) => {
342
+ z.setState({ voices: e });
343
+ }, go = (e) => {
344
+ z.setState({ textToSpeak: e });
345
+ }, fo = () => z.getState().voices, yo = (e) => {
346
+ z.setState({ visemeIntensity: e });
347
+ }, An = (e) => {
348
+ e !== z.getState().useBlendshapeManager && (Wt(), Kt(), z.setState({ useBlendshapeManager: e }));
349
+ }, wn = (e, t, s) => {
350
+ let a = s[e.position || $.eye].getComponent(0);
351
+ const r = s[e.position || $.mouth].getComponent(1);
352
+ let o = 0;
353
+ const d = typeof e.distance == "string" ? parseInt(e.distance) : e.distance, f = typeof e.rotation == "string" ? parseInt(e.rotation) : e.rotation;
354
+ switch (d) {
355
+ case X.veryclose:
356
+ o = t.veryclose;
357
357
  break;
358
- case I.closer:
359
- a = t.closer;
358
+ case X.closer:
359
+ o = t.closer;
360
360
  break;
361
- case I.close:
362
- a = t.close;
361
+ case X.close:
362
+ o = t.close;
363
363
  break;
364
- case I.midclose:
365
- a = t.midclose;
364
+ case X.midclose:
365
+ o = t.midclose;
366
366
  break;
367
- case I.medium:
368
- a = t.medium;
367
+ case X.medium:
368
+ o = t.medium;
369
369
  break;
370
- case I.midfar:
371
- a = t.midfar;
370
+ case X.midfar:
371
+ o = t.midfar;
372
372
  break;
373
- case I.far:
374
- a = t.far;
373
+ case X.far:
374
+ o = t.far;
375
375
  break;
376
- case I.farther:
376
+ case X.farther:
377
377
  case void 0:
378
378
  default:
379
- a = t.farther;
379
+ o = t.farther;
380
380
  break;
381
- case I.veryfar:
382
- a = t.veryfar;
381
+ case X.veryfar:
382
+ o = t.veryfar;
383
383
  break;
384
384
  }
385
- if (x && x !== W.face)
386
- switch (x) {
387
- case W.eighthleft: {
385
+ if (f && f !== le.face)
386
+ switch (f) {
387
+ case le.eighthleft: {
388
388
  const T = 0.2588190451;
389
- s = s - a * T, a = a * Math.sqrt(1 - Math.pow(T, 2));
389
+ a = a - o * T, o = o * Math.sqrt(1 - Math.pow(T, 2));
390
390
  break;
391
391
  }
392
- case W.thirdleft:
393
- s = s - a * (1 / 2), a = a * (Math.sqrt(3) / 2);
392
+ case le.thirdleft:
393
+ a = a - o * (1 / 2), o = o * (Math.sqrt(3) / 2);
394
394
  break;
395
- case W.quarterleft:
396
- s = s - a * (Math.SQRT2 / 2), a = a * (Math.SQRT2 / 2);
395
+ case le.quarterleft:
396
+ a = a - o * (Math.SQRT2 / 2), o = o * (Math.SQRT2 / 2);
397
397
  break;
398
- case W.halfleft:
399
- s = s - a, a = r.eye.getComponent(2);
398
+ case le.halfleft:
399
+ a = a - o, o = s.eye.getComponent(2);
400
400
  break;
401
- case W.eighthright: {
401
+ case le.eighthright: {
402
402
  const T = 0.2588190451;
403
- s = s + a * T, a = a * Math.sqrt(1 - Math.pow(T, 2));
403
+ a = a + o * T, o = o * Math.sqrt(1 - Math.pow(T, 2));
404
404
  break;
405
405
  }
406
- case W.thirdright:
407
- s = s + a * (1 / 2), a = a * (Math.sqrt(3) / 2);
406
+ case le.thirdright:
407
+ a = a + o * (1 / 2), o = o * (Math.sqrt(3) / 2);
408
408
  break;
409
- case W.quarterright:
410
- s = s + a * (Math.SQRT2 / 2), a = a * (Math.SQRT2 / 2);
409
+ case le.quarterright:
410
+ a = a + o * (Math.SQRT2 / 2), o = o * (Math.SQRT2 / 2);
411
411
  break;
412
- case W.halfright:
413
- s = s + a, a = r.eye.getComponent(2);
412
+ case le.halfright:
413
+ a = a + o, o = s.eye.getComponent(2);
414
414
  break;
415
415
  }
416
- return new b.Vector3(s, o, a);
417
- }, ge = /* @__PURE__ */ new et(), ze = /* @__PURE__ */ new ye();
418
- let fe;
419
- class dr extends $e {
416
+ return new B.Vector3(a, r, o);
417
+ }, Xe = /* @__PURE__ */ new zt(), Vt = /* @__PURE__ */ new ve();
418
+ let Je;
419
+ class Cn extends He {
420
420
  static get type() {
421
421
  return "TRAANode";
422
422
  }
@@ -428,8 +428,8 @@ class dr extends $e {
428
428
  * @param {TextureNode} velocityNode - A node that represents the scene's velocity.
429
429
  * @param {Camera} camera - The camera the scene is rendered with.
430
430
  */
431
- constructor(t, r, s, o) {
432
- super("vec4"), this.isTRAANode = !0, this.updateBeforeType = Ye.FRAME, this.beautyNode = t, this.depthNode = r, this.velocityNode = s, this.camera = o, this.depthThreshold = 5e-4, this.edgeDepthDiff = 1e-3, this.maxVelocityLength = 128, this.useSubpixelCorrection = !0, this._jitterIndex = 0, this._invSize = Q(new ye()), this._historyRenderTarget = new we(1, 1, { depthBuffer: !1, type: xe, depthTexture: new ve() }), this._historyRenderTarget.texture.name = "TRAANode.history", this._resolveRenderTarget = new we(1, 1, { depthBuffer: !1, type: xe }), this._resolveRenderTarget.texture.name = "TRAANode.resolve", this._resolveMaterial = new Je(), this._resolveMaterial.name = "TRAA.resolve", this._resolveMaterial.blending = Xe, this._textureNode = dt(this, this._resolveRenderTarget.texture), this._originalProjectionMatrix = new J(), this._cameraNearFar = Q(new ye()), this._cameraWorldMatrix = Q(new J()), this._cameraWorldMatrixInverse = Q(new J()), this._cameraProjectionMatrixInverse = Q(new J()), this._previousCameraWorldMatrix = Q(new J()), this._previousCameraProjectionMatrixInverse = Q(new J()), this._previousDepthNode = ke(new ve(1, 1)), this._needsPostProcessingSync = !1, this._velocityNode = null;
431
+ constructor(t, s, a, r) {
432
+ super("vec4"), this.isTRAANode = !0, this.updateBeforeType = Xt.FRAME, this.beautyNode = t, this.depthNode = s, this.velocityNode = a, this.camera = r, this.depthThreshold = 5e-4, this.edgeDepthDiff = 1e-3, this.maxVelocityLength = 32, this.useSubpixelCorrection = !0, this._jitterIndex = 0, this._invSize = I(new ve()), this._historyRenderTarget = new st(1, 1, { depthBuffer: !1, type: gt, depthTexture: new pt() }), this._historyRenderTarget.texture.name = "TRAANode.history", this._resolveRenderTarget = new st(1, 1, { depthBuffer: !1, type: gt }), this._resolveRenderTarget.texture.name = "TRAANode.resolve", this._resolveMaterial = new Dt(), this._resolveMaterial.name = "TRAA.resolve", this._resolveMaterial.blending = Jt, this._textureNode = ze(this, this._resolveRenderTarget.texture), this._originalProjectionMatrix = new xe(), this._cameraNearFar = I(new ve()), this._cameraWorldMatrix = I(new xe()), this._cameraWorldMatrixInverse = I(new xe()), this._cameraProjectionMatrixInverse = I(new xe()), this._previousCameraWorldMatrix = I(new xe()), this._previousCameraProjectionMatrixInverse = I(new xe()), this._previousDepthNode = Fe(new pt(1, 1)), this._needsPostProcessingSync = !1, this._velocityNode = null;
433
433
  }
434
434
  /**
435
435
  * Returns the result of the effect as a texture node.
@@ -439,14 +439,28 @@ class dr extends $e {
439
439
  getTextureNode() {
440
440
  return this._textureNode;
441
441
  }
442
+ /**
443
+ * Returns the history buffer as a texture node. During the update of a new frame this
444
+ * texture holds the *previous* frame's anti-aliased resolve, which makes it a cheap
445
+ * feedback source for effects that want last frame's final lighting (e.g. feeding it
446
+ * into SSGI as the beauty input turns single-bounce GI into infinite bounces).
447
+ *
448
+ * Note: this is intentionally a plain TextureNode (not a PassTextureNode) so referencing
449
+ * it does not create a cyclic dependency in the node graph.
450
+ *
451
+ * @return {TextureNode} A texture node that represents the previous frame's resolve.
452
+ */
453
+ getHistoryTextureNode() {
454
+ return this._historyTextureNode === void 0 && (this._historyTextureNode = Fe(this._historyRenderTarget.texture)), this._historyTextureNode;
455
+ }
442
456
  /**
443
457
  * Sets the size of the effect.
444
458
  *
445
459
  * @param {number} width - The width of the effect.
446
460
  * @param {number} height - The height of the effect.
447
461
  */
448
- setSize(t, r) {
449
- this._historyRenderTarget.setSize(t, r), this._resolveRenderTarget.setSize(t, r), this._invSize.value.set(1 / t, 1 / r);
462
+ setSize(t, s) {
463
+ this._historyRenderTarget.setSize(t, s), this._resolveRenderTarget.setSize(t, s), this._invSize.value.set(1 / t, 1 / s);
450
464
  }
451
465
  /**
452
466
  * Defines the TRAA's current jitter as a view offset
@@ -455,30 +469,30 @@ class dr extends $e {
455
469
  * @param {number} width - The width of the effect.
456
470
  * @param {number} height - The height of the effect.
457
471
  */
458
- setViewOffset(t, r) {
472
+ setViewOffset(t, s) {
459
473
  this.camera.updateProjectionMatrix(), this._originalProjectionMatrix.copy(this.camera.projectionMatrix), this._velocityNode.setProjectionMatrix(this._originalProjectionMatrix);
460
- const s = {
474
+ const a = {
461
475
  fullWidth: t,
462
- fullHeight: r,
476
+ fullHeight: s,
463
477
  offsetX: 0,
464
478
  offsetY: 0,
465
479
  width: t,
466
- height: r
467
- }, o = Fe[this._jitterIndex];
480
+ height: s
481
+ }, r = Rt[this._jitterIndex];
468
482
  this.camera.setViewOffset(
469
- s.fullWidth,
470
- s.fullHeight,
471
- s.offsetX + (o[0] - 0.5) / 2,
472
- s.offsetY + (o[1] - 0.5) / 2,
473
- s.width,
474
- s.height
483
+ a.fullWidth,
484
+ a.fullHeight,
485
+ a.offsetX + (r[0] - 0.5) * 1,
486
+ a.offsetY + (r[1] - 0.5) * 1,
487
+ a.width,
488
+ a.height
475
489
  );
476
490
  }
477
491
  /**
478
492
  * Clears the view offset from the scene's camera.
479
493
  */
480
494
  clearViewOffset() {
481
- this.camera.clearViewOffset(), this._velocityNode.setProjectionMatrix(null), this._jitterIndex++, this._jitterIndex = this._jitterIndex % (Fe.length - 1);
495
+ this.camera.clearViewOffset(), this._velocityNode.setProjectionMatrix(null), this._jitterIndex++, this._jitterIndex = this._jitterIndex % Rt.length;
482
496
  }
483
497
  /**
484
498
  * This method is used to render the effect once per frame.
@@ -486,18 +500,18 @@ class dr extends $e {
486
500
  * @param {NodeFrame} frame - The current node frame.
487
501
  */
488
502
  updateBefore(t) {
489
- const { renderer: r } = t;
503
+ const { renderer: s } = t;
490
504
  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);
491
- const s = this.beautyNode.isRTTNode ? this.beautyNode.renderTarget : this.beautyNode.passNode.renderTarget, o = s.texture.width, a = s.texture.height;
492
- this._needsPostProcessingSync === !0 && (this.setViewOffset(o, a), this._needsPostProcessingSync = !1), fe = Te.resetRendererState(r, fe);
493
- const M = this._historyRenderTarget.width !== o || this._historyRenderTarget.height !== a;
494
- this.setSize(o, a), M === !0 && (r.initRenderTarget(this._historyRenderTarget), r.initRenderTarget(this._resolveRenderTarget), r.copyTextureToTexture(s.texture, this._historyRenderTarget.texture)), r.setClearColor(16777215, 0), r.setRenderTarget(this._resolveRenderTarget), ge.material = this._resolveMaterial, ge.name = "TRAA", ge.render(r), r.setRenderTarget(null), r.copyTextureToTexture(this._resolveRenderTarget.texture, this._historyRenderTarget.texture);
495
- const x = r.getDrawingBufferSize(ze);
496
- if (this._historyRenderTarget.height === x.height && this._historyRenderTarget.width === x.width) {
505
+ const a = this.beautyNode.isRTTNode ? this.beautyNode.renderTarget : this.beautyNode.passNode.renderTarget, r = a.texture.width, o = a.texture.height;
506
+ this._needsPostProcessingSync === !0 && (this.setViewOffset(r, o), this._needsPostProcessingSync = !1), Je = Ue.resetRendererState(s, Je);
507
+ const d = this._historyRenderTarget.width !== r || this._historyRenderTarget.height !== o;
508
+ this.setSize(r, o), d === !0 && (s.initRenderTarget(this._historyRenderTarget), s.initRenderTarget(this._resolveRenderTarget), s.copyTextureToTexture(a.texture, this._historyRenderTarget.texture)), s.setClearColor(16777215, 0), s.setRenderTarget(this._resolveRenderTarget), Xe.material = this._resolveMaterial, Xe.name = "TRAA", Xe.render(s), s.setRenderTarget(null), s.copyTextureToTexture(this._resolveRenderTarget.texture, this._historyRenderTarget.texture);
509
+ const f = s.getDrawingBufferSize(Vt);
510
+ if (this._historyRenderTarget.height === f.height && this._historyRenderTarget.width === f.width) {
497
511
  const T = this.depthNode.value;
498
- r.copyTextureToTexture(T, this._historyRenderTarget.depthTexture), this._previousDepthNode.value = this._historyRenderTarget.depthTexture;
512
+ s.copyTextureToTexture(T, this._historyRenderTarget.depthTexture), this._previousDepthNode.value = this._historyRenderTarget.depthTexture;
499
513
  }
500
- Te.restoreRendererState(r, fe);
514
+ Ue.restoreRendererState(s, Je);
501
515
  }
502
516
  /**
503
517
  * This method is used to setup the effect's render targets and TSL code.
@@ -506,43 +520,42 @@ class dr extends $e {
506
520
  * @return {PassTextureNode}
507
521
  */
508
522
  setup(t) {
509
- const r = t.context.renderPipeline;
510
- r && (this._needsPostProcessingSync = !0, r.context.onBeforeRenderPipeline = () => {
511
- const l = t.renderer.getDrawingBufferSize(ze);
512
- this.setViewOffset(l.width, l.height);
513
- }, r.context.onAfterRenderPipeline = () => {
523
+ t.renderPipeline && !t.context.renderPipelineState.viewOffsetOwner && (t.context.renderPipelineState.viewOffsetOwner = this, this._needsPostProcessingSync = !0, gs(() => {
524
+ const u = t.renderer.getDrawingBufferSize(Vt);
525
+ this.setViewOffset(u.width, u.height);
526
+ }), fs(() => {
514
527
  this.clearViewOffset();
515
- }), t.renderer.reversedDepthBuffer === !0 && (this._historyRenderTarget.depthTexture.type = tt), t.context.velocity !== void 0 ? this._velocityNode = t.context.velocity : this._velocityNode = Ee;
516
- const s = (l) => {
517
- const { x: i, y: f } = this._cameraNearFar, d = ft(l, i, f);
518
- return Ce(d, i, f);
519
- }, o = ut({
528
+ })), t.renderer.reversedDepthBuffer === !0 && (this._historyRenderTarget.depthTexture.type = es), t.context.velocity !== void 0 ? this._velocityNode = t.context.velocity : this._velocityNode = ct;
529
+ const s = (u) => {
530
+ const { x: g, y: i } = this._cameraNearFar, n = Ft(u, g, i);
531
+ return nt(n, g, i);
532
+ }, a = ys({
520
533
  closestDepth: "float",
521
534
  closestPositionTexel: "vec2",
522
535
  farthestDepth: "float"
523
- }), a = ee(([l]) => {
524
- const i = Z(2).toVar(), f = me(0).toVar(), d = Z(-1).toVar();
536
+ }), r = Q(([u]) => {
537
+ const g = C(2).toVar(), i = K(0).toVar(), n = C(-1).toVar();
525
538
  for (let c = -1; c <= 1; ++c)
526
- for (let n = -1; n <= 1; ++n) {
527
- const g = l.add(me(c, n)).toVar();
528
- let h = this.depthNode.load(g).r;
529
- t.renderer.reversedDepthBuffer && (h = h.oneMinus()), t.renderer.logarithmicDepthBuffer && (h = s(h)), h = h.toVar(), Me(h.lessThan(i), () => {
530
- i.assign(h), f.assign(g);
531
- }), Me(h.greaterThan(d), () => {
532
- d.assign(h);
539
+ for (let h = -1; h <= 1; ++h) {
540
+ const y = u.add(K(c, h)).toVar();
541
+ let p = this.depthNode.load(y).r;
542
+ t.renderer.reversedDepthBuffer && (p = p.oneMinus()), t.renderer.logarithmicDepthBuffer && (p = s(p)), p = p.toVar(), he(p.lessThan(g), () => {
543
+ g.assign(p), i.assign(y);
544
+ }), he(p.greaterThan(n), () => {
545
+ n.assign(p);
533
546
  });
534
547
  }
535
- return o(i, f, d);
536
- }), M = (l) => {
537
- let i = this._previousDepthNode.sample(l).r;
538
- t.renderer.logarithmicDepthBuffer && (i = s(i));
539
- const f = yt(l, i, this._previousCameraProjectionMatrixInverse), d = this._previousCameraWorldMatrix.mul(oe(f, 1)).xyz, c = this._cameraWorldMatrixInverse.mul(oe(d, 1)).z;
540
- return this.camera.isOrthographicCamera ? St(c, this._cameraNearFar.x, this._cameraNearFar.y) : Ce(c, this._cameraNearFar.x, this._cameraNearFar.y);
541
- }, x = ee(([l, i, f, d]) => {
542
- const c = d.rgb.add(f.rgb).mul(0.5), n = d.rgb.sub(f.rgb).mul(0.5).add(1e-7), g = i.sub(oe(c, l.a)), p = g.xyz.div(n).abs(), R = ae(p.x, p.y, p.z);
543
- return R.greaterThan(1).select(
544
- oe(c, l.a).add(g.div(R)),
545
- i
548
+ return a(g, i, n);
549
+ }), o = (u) => {
550
+ let g = this._previousDepthNode.sample(u).r;
551
+ t.renderer.reversedDepthBuffer && (g = g.oneMinus()), t.renderer.logarithmicDepthBuffer && (g = s(g));
552
+ const i = Ie(u, g, this._previousCameraProjectionMatrixInverse), n = this._previousCameraWorldMatrix.mul(J(i, 1)).xyz, c = this._cameraWorldMatrixInverse.mul(J(n, 1)).z;
553
+ return this.camera.isOrthographicCamera ? Ss(c, this._cameraNearFar.x, this._cameraNearFar.y) : nt(c, this._cameraNearFar.x, this._cameraNearFar.y);
554
+ }, d = Q(([u, g, i, n]) => {
555
+ const c = n.rgb.add(i.rgb).mul(0.5), h = n.rgb.sub(i.rgb).mul(0.5).add(1e-7), y = g.sub(J(c, u.a)), A = y.xyz.div(h).abs(), w = q(A.x, A.y, A.z);
556
+ return w.greaterThan(1).select(
557
+ J(c, u.a).add(y.div(w)),
558
+ g
546
559
  );
547
560
  }).setLayout({
548
561
  name: "clipAABB",
@@ -553,7 +566,23 @@ class dr extends $e {
553
566
  { name: "minColor", type: "vec4" },
554
567
  { name: "maxColor", type: "vec4" }
555
568
  ]
556
- }), T = ee(([l, i, f, d]) => {
569
+ }), f = Q(([u]) => ae(
570
+ u.x.mul(0.25).add(u.y.mul(0.5)).add(u.z.mul(0.25)),
571
+ u.x.mul(0.5).sub(u.z.mul(0.5)),
572
+ u.x.mul(-0.25).add(u.y.mul(0.5)).sub(u.z.mul(0.25))
573
+ )).setLayout({
574
+ name: "RGBToYCoCg",
575
+ type: "vec3",
576
+ inputs: [{ name: "c", type: "vec3" }]
577
+ }), T = Q(([u]) => ae(
578
+ u.x.add(u.y).sub(u.z),
579
+ u.x.add(u.z),
580
+ u.x.sub(u.y).sub(u.z)
581
+ )).setLayout({
582
+ name: "YCoCgToRGB",
583
+ type: "vec3",
584
+ inputs: [{ name: "c", type: "vec3" }]
585
+ }), v = Q(([u, g, i, n]) => {
557
586
  const c = [
558
587
  [-1, -1],
559
588
  [-1, 1],
@@ -563,15 +592,15 @@ class dr extends $e {
563
592
  [0, -1],
564
593
  [0, 1],
565
594
  [-1, 0]
566
- ], n = i.toVar(), g = i.pow2().toVar();
567
- for (const [H, j] of c) {
568
- const B = this.beautyNode.offset(mt(H, j)).load(l).max(0);
569
- n.addAssign(B), g.addAssign(B.pow2());
595
+ ], h = J(f(g.rgb), g.a).toVar(), y = J(f(i.rgb), i.a).toVar(), p = h.toVar(), A = h.pow2().toVar();
596
+ for (const [Z, G] of c) {
597
+ const E = this.beautyNode.offset(ke(Z, G)).load(u).max(0), U = J(f(E.rgb), E.a).toVar();
598
+ p.addAssign(U), A.addAssign(U.pow2());
570
599
  }
571
- const h = Z(c.length + 1), p = n.div(h), R = g.div(h).sub(p.pow2()).max(0).sqrt().mul(d), m = p.sub(R), y = p.add(R);
572
- return x(p.clamp(m, y), f, m, y);
573
- }), u = ee(([l, i]) => {
574
- const d = l.mul(i).fract().abs(), c = ae(d, d.oneMinus());
600
+ const w = C(c.length + 1), l = p.div(w), b = A.div(w).sub(l.pow2()).max(0).sqrt().mul(n), M = l.sub(b), _ = l.add(b), x = d(l.clamp(M, _), y, M, _);
601
+ return J(T(x.rgb), x.a);
602
+ }), S = Q(([u, g]) => {
603
+ const n = u.mul(g).fract().abs(), c = q(n, n.oneMinus());
575
604
  return c.x.mul(c.y).oneMinus().div(0.75);
576
605
  }).setLayout({
577
606
  name: "subpixelCorrection",
@@ -580,16 +609,19 @@ class dr extends $e {
580
609
  { name: "velocityUV", type: "vec2" },
581
610
  { name: "textureSize", type: "ivec2" }
582
611
  ]
583
- }), C = ee(([l, i, f]) => {
584
- const d = f.oneMinus(), c = l.mul(Z(1).div(ae(l.r, l.g, l.b).add(1))), n = i.mul(Z(1).div(ae(i.r, i.g, i.b).add(1))), g = Ae(c.rgb), h = Ae(n.rgb);
585
- return f.mulAssign(Z(1).div(g.add(1))), d.mulAssign(Z(1).div(h.add(1))), Ue(l.mul(f), i.mul(d)).div(ae(f.add(d), 1e-5)).toVar();
586
- }), _ = ke(this._historyRenderTarget.texture), N = ee(() => {
587
- const l = pt(), i = this.beautyNode.size(), f = l.mul(i), d = a(f), c = d.get("closestDepth"), n = d.get("closestPositionTexel"), g = d.get("farthestDepth"), h = this.velocityNode.load(n).xy.mul(me(0.5, -0.5)), p = l.sub(h), R = M(p), m = p.greaterThanEqual(0).all().and(p.lessThanEqual(1).all()), y = g.sub(c).greaterThan(this.edgeDepthDiff), H = c.sub(R).greaterThan(this.depthThreshold), j = m.and(y.or(H.not())), B = this.beautyNode.sample(l), $ = _.sample(l.sub(h)), ce = l.sub(p).mul(i).length().div(this.maxVelocityLength).saturate(), Y = Z(0.035).toVar();
588
- this.useSubpixelCorrection && Y.addAssign(u(h, i).mul(0.35)), Y.assign(j.select(Y.add(ce).saturate(), 1));
589
- const he = gt(0.5, 1, ce.oneMinus().pow2()), de = T(f, B, $, he);
590
- return C(B, de, Y);
612
+ }), V = Q(([u, g, i]) => {
613
+ const n = i.oneMinus(), c = u.mul(C(1).div(q(u.r, u.g, u.b).add(1))), h = g.mul(C(1).div(q(g.r, g.g, g.b).add(1))), y = Ae(c.rgb), p = Ae(h.rgb);
614
+ return i.mulAssign(C(1).div(y.add(1))), n.mulAssign(C(1).div(p.add(1))), xs(u.mul(i), g.mul(n)).div(q(i.add(n), 1e-5)).toVar();
615
+ }), m = Fe(this._historyRenderTarget.texture), k = Q(([u, g]) => {
616
+ const i = u.mul(g), n = i.sub(0.5).floor().add(0.5).toVar(), c = i.sub(n).toVar(), h = c.mul(c.mul(c.mul(-0.5).add(1)).sub(0.5)).toVar(), y = c.pow2().mul(c.mul(1.5).sub(2.5)).add(1).toVar(), p = c.mul(c.mul(c.mul(-1.5).add(2)).add(0.5)).toVar(), A = c.pow2().mul(c.mul(0.5).sub(0.5)).toVar(), w = y.add(p).toVar(), l = p.div(w).toVar(), b = n.sub(1).mul(this._invSize).toVar(), M = n.add(2).mul(this._invSize).toVar(), _ = n.add(l).mul(this._invSize).toVar();
617
+ return m.sample(K(b.x, b.y)).mul(h.x.mul(h.y)).add(m.sample(K(_.x, b.y)).mul(w.x.mul(h.y))).add(m.sample(K(M.x, b.y)).mul(A.x.mul(h.y))).add(m.sample(K(b.x, _.y)).mul(h.x.mul(w.y))).add(m.sample(K(_.x, _.y)).mul(w.x.mul(w.y))).add(m.sample(K(M.x, _.y)).mul(A.x.mul(w.y))).add(m.sample(K(b.x, M.y)).mul(h.x.mul(A.y))).add(m.sample(K(_.x, M.y)).mul(w.x.mul(A.y))).add(m.sample(K(M.x, M.y)).mul(A.x.mul(A.y))).max(0);
618
+ }), R = Q(() => {
619
+ const u = Re(), g = this.beautyNode.size(), i = u.mul(g), n = r(i), c = n.get("closestDepth"), h = n.get("closestPositionTexel"), y = n.get("farthestDepth"), p = this.velocityNode.load(h).xy.mul(K(0.5, -0.5)), A = u.sub(p), w = o(A), l = A.greaterThanEqual(0).all().and(A.lessThanEqual(1).all()), b = y.sub(c).greaterThan(this.edgeDepthDiff), M = c.sub(w).greaterThan(this.depthThreshold), _ = l.and(b.or(M.not())), x = this.beautyNode.sample(u), Z = k(A, g), G = u.sub(A).mul(g).length().div(this.maxVelocityLength).saturate(), E = C(0.01).toVar();
620
+ this.useSubpixelCorrection && E.addAssign(S(p, g).mul(0.2)), E.assign(_.select(E.add(G).saturate(), 1));
621
+ const U = Pe(0.5, 1, G.oneMinus().pow2()), P = v(i, x, Z, U);
622
+ return V(x, P, E);
591
623
  });
592
- return this._resolveMaterial.colorNode = N(), this._textureNode;
624
+ return this._resolveMaterial.colorNode = R(), this._textureNode;
593
625
  }
594
626
  /**
595
627
  * Frees internal resources. This method should be called
@@ -599,413 +631,743 @@ class dr extends $e {
599
631
  this._historyRenderTarget.dispose(), this._resolveRenderTarget.dispose(), this._resolveMaterial.dispose();
600
632
  }
601
633
  }
602
- function De(e, t) {
603
- let r = 1, s = 0;
634
+ function It(e, t) {
635
+ let s = 1, a = 0;
604
636
  for (; e > 0; )
605
- r /= t, s += r * (e % t), e = Math.floor(e / t);
606
- return s;
637
+ s /= t, a += s * (e % t), e = Math.floor(e / t);
638
+ return a;
607
639
  }
608
- const Fe = /* @__PURE__ */ Array.from(
609
- { length: 32 },
610
- (e, t) => [De(t + 1, 2), De(t + 1, 3)]
611
- ), ur = (e, t, r, s) => new dr(ht(e), t, r, s), mr = () => {
612
- const e = v((n) => n.animationsLoaded), t = v((n) => n.characterState), r = v((n) => n.lipSyncManager), s = v((n) => n.blendshapeManager), o = w((n) => n.credentials), a = w((n) => n.currentUtterance), M = w((n) => n.textToSpeak), x = w((n) => n.visemes), T = w((n) => n.blendshapes), u = w((n) => n.visemeIntensity), C = w((n) => n.currentVisemeIndex), _ = w((n) => n.currentBlendshapeIndex), N = w((n) => n.useBlendshapeManager), [l, i] = F(!1), [f, d] = F(!1), c = Se(() => o != null && o.region && (o.subscriptionKey || o.token) ? Nt({
640
+ const Rt = /* @__PURE__ */ Array.from(
641
+ { length: 16 },
642
+ (e, t) => [It(t + 1, 2), It(t + 1, 3)]
643
+ ), Yt = (e, t, s, a) => new Cn(qe(e), t, s, a), et = /* @__PURE__ */ new zt(), Nn = /* @__PURE__ */ new ve(), Mn = [60, 300, 180, 240, 120, 0], _n = [0, 0.5, 0.25, 0.75];
644
+ let tt;
645
+ class kn extends He {
646
+ static get type() {
647
+ return "SSGINode";
648
+ }
649
+ /**
650
+ * Constructs a new SSGI node.
651
+ *
652
+ * @param {TextureNode} beautyNode - A texture node that represents the beauty or scene pass.
653
+ * @param {TextureNode} depthNode - A texture node that represents the scene's depth.
654
+ * @param {TextureNode} normalNode - A texture node that represents the scene's normals.
655
+ * @param {PerspectiveCamera} camera - The camera the scene is rendered with.
656
+ */
657
+ constructor(t, s, a, r) {
658
+ super("vec4"), this.beautyNode = t, this.depthNode = s, this.normalNode = a, this.updateBeforeType = Ot.FRAME, this.sliceCount = I(1, "uint"), this.stepCount = I(12, "uint"), this.aoIntensity = I(1, "float"), this.giIntensity = I(10, "float"), this.radius = I(12, "float"), this.useScreenSpaceSampling = I(!0, "bool"), this.expFactor = I(2, "float"), this.thickness = I(1, "float"), this.useLinearThickness = I(!1, "bool"), this.backfaceLighting = I(0, "float"), this.useTemporalFiltering = !0, this.resolutionScale = 1, this._resolution = I(new ve()), this._halfProjScale = I(1), this._temporalDirection = I(0), this._temporalOffset = I(0), this._cameraProjectionMatrix = I(r.projectionMatrix), this._cameraProjectionMatrixInverse = I(r.projectionMatrixInverse), this._cameraNear = je("near", "float", r), this._cameraFar = je("far", "float", r), this._camera = r, this._ssgiRenderTarget = new st(1, 1, { depthBuffer: !1, count: 3 });
659
+ const o = this._ssgiRenderTarget.textures[0];
660
+ o.name = "SSGI.AO", o.type = ft, o.format = ts;
661
+ const d = this._ssgiRenderTarget.textures[1];
662
+ d.name = "SSGI.GI", d.type = ss, d.format = ns;
663
+ const f = this._ssgiRenderTarget.textures[2];
664
+ f.name = "SSGI.BentNormals", f.type = ft, this._material = new Dt(), this._material.name = "SSGI", this._aoNode = ze(this, this._ssgiRenderTarget.textures[0]), this._giNode = ze(this, this._ssgiRenderTarget.textures[1]), this._bentNormalNode = ze(this, this._ssgiRenderTarget.textures[2]);
665
+ }
666
+ /**
667
+ * Returns the AO result of the effect as a texture node.
668
+ *
669
+ * @return {PassTextureNode} A texture node that represents the AO result of the effect.
670
+ */
671
+ getAONode() {
672
+ return this._aoNode;
673
+ }
674
+ /**
675
+ * Returns the GI result of the effect as a texture node.
676
+ *
677
+ * @return {PassTextureNode} A texture node that represents the GI result of the effect.
678
+ */
679
+ getGINode() {
680
+ return this._giNode;
681
+ }
682
+ /**
683
+ * Returns the bent normals of the effect as a texture node. The bent normal is the
684
+ * average unoccluded direction of the hemisphere, in view space, packed into `[0, 1]`
685
+ * (unpack with `normal * 2 - 1`). It can be used for occlusion-aware environment
686
+ * lighting (e.g. sampling IBL along the bent normal instead of the surface normal).
687
+ *
688
+ * @return {PassTextureNode} A texture node that represents the bent normals of the effect.
689
+ */
690
+ getBentNormalNode() {
691
+ return this._bentNormalNode;
692
+ }
693
+ /**
694
+ * Sets the size of the effect.
695
+ *
696
+ * @param {number} width - The width of the effect.
697
+ * @param {number} height - The height of the effect.
698
+ */
699
+ setSize(t, s) {
700
+ t = Math.max(1, Math.round(t * this.resolutionScale)), s = Math.max(1, Math.round(s * this.resolutionScale)), this._resolution.value.set(t, s), this._ssgiRenderTarget.setSize(t, s), this._halfProjScale.value = s / (Math.tan(this._camera.fov * os.DEG2RAD * 0.5) * 2) * 0.5;
701
+ }
702
+ /**
703
+ * This method is used to render the effect once per frame.
704
+ *
705
+ * @param {NodeFrame} frame - The current node frame.
706
+ */
707
+ updateBefore(t) {
708
+ const { renderer: s } = t;
709
+ tt = Ue.resetRendererState(s, tt);
710
+ const a = s.getDrawingBufferSize(Nn);
711
+ if (this.setSize(a.width, a.height), this.useTemporalFiltering === !0) {
712
+ const r = t.frameId;
713
+ this._temporalDirection.value = Mn[r % 6] / 360, this._temporalOffset.value = _n[r % 4];
714
+ } else
715
+ this._temporalDirection.value = 1, this._temporalOffset.value = 1;
716
+ et.material = this._material, et.name = "SSGI", s.setClearColor(16777215, 1), s.setRenderTarget(this._ssgiRenderTarget), et.render(s), Ue.restoreRendererState(s, tt);
717
+ }
718
+ /**
719
+ * This method is used to setup the effect's TSL code.
720
+ *
721
+ * @param {NodeBuilder} builder - The current node builder.
722
+ * @return {PassTextureNode}
723
+ */
724
+ setup(t) {
725
+ const s = t.renderer;
726
+ s.backend.isWebGPUBackend === !0 && s.hasFeature("rg11b10ufloat-renderable") === !1 && console.error('THREE.SSGINode: The device does not support the "rg11b10ufloat-renderable" feature which is required for SSGI.');
727
+ const a = Re(), r = oe(32), o = oe(0), d = (i) => {
728
+ const n = this.depthNode.sample(i).r;
729
+ if (t.renderer.logarithmicDepthBuffer === !0) {
730
+ const c = Ft(n, this._cameraNear, this._cameraFar);
731
+ return nt(c, this._cameraNear, this._cameraFar);
732
+ }
733
+ return n;
734
+ }, f = (i) => this.normalNode !== null ? this.normalNode.sample(i).rgb.normalize() : Lt(i, this.depthNode.value, this._cameraProjectionMatrixInverse), T = (i) => this.beautyNode.sample(i), v = Q(([i]) => C(0.25).mul(bs(i.y, i.x).bitAnd(3))).setLayout({
735
+ name: "spatialOffsets",
736
+ type: "float",
737
+ inputs: [
738
+ { name: "position", type: "vec2" }
739
+ ]
740
+ }), S = Q(([i]) => {
741
+ const n = pe(i).mul(C(-0.156583)).add(Ze);
742
+ n.mulAssign(Et(pe(i).oneMinus()));
743
+ const c = i.x.greaterThanEqual(0).select(n.x, fe.sub(n.x)), h = i.y.greaterThanEqual(0).select(n.y, fe.sub(n.y));
744
+ return K(c, h);
745
+ }).setLayout({
746
+ name: "GTAOFastAcos",
747
+ type: "vec2",
748
+ inputs: [
749
+ { name: "value", type: "vec2" }
750
+ ]
751
+ }), V = Q(([i, n, c, h, y, p, A, w, l, b]) => {
752
+ const M = this.stepCount.toConst(), _ = this.expFactor.toConst(), x = this.thickness.toConst(), Z = this.backfaceLighting.toConst(), G = i.select(K(1, -1), K(-1, 1)), E = i.select(1, -1), U = ae(0);
753
+ return Oe({ start: oe(0), end: M, type: "uint", condition: "<" }, ({ i: P }) => {
754
+ const N = Ge(pe($e(n, C(P).add(p)).div(c)), _).mul(c).toConst(), L = y.mul(q(N, C(P).add(1))).toConst(), H = A.add(L.mul(G)).toConst();
755
+ he(H.x.lessThanEqual(0).or(H.y.lessThanEqual(0)).or(H.x.greaterThanEqual(1)).or(H.y.greaterThanEqual(1)), () => {
756
+ Ts();
757
+ });
758
+ const ne = Ie(H, d(H), this._cameraProjectionMatrixInverse).toConst(), W = ne.sub(h).normalize().toConst(), ue = this.useLinearThickness.select(ne.z.negate().div(this._cameraFar).clamp().mul(100), C(1)), Y = be(ne.sub(ue.mul(w).mul(x)).sub(h));
759
+ let F = K(ie(W, w), ie(Y, w));
760
+ F = S(_e(F, -1, 1)), F = _e(vs($e(E, F.negate()).sub(b.sub(Ze)), fe)), F = i.select(F.yx, F.xy);
761
+ const me = F.x.toConst(), ee = F.y.toConst(), Ne = oe(F.mul(C(r))).toConst(), Be = oe(As(ee.sub(me).mul(C(r)))).toConst();
762
+ let ge = Be.greaterThan(oe(0)).select(oe(ws(oe(4294967295), oe(32).sub(r).add(r.sub(Be)))), oe(0)).toConst().shiftLeft(Ne);
763
+ ge = ge.bitAnd(o.bitNot()), o.assign(o.bitOr(ge));
764
+ const Me = xt(ge);
765
+ he(Me.greaterThan(0), () => {
766
+ const dt = T(H);
767
+ he(Ae(dt).greaterThan(1e-3), () => {
768
+ const ut = be(W), ht = _e(ie(l, ut));
769
+ he(ht.greaterThan(1e-3), () => {
770
+ const mt = f(H);
771
+ let ye = ie(mt, ut.negate());
772
+ const Zt = St(ye).lessThan(0).select(pe(ye).mul(Z), pe(ye));
773
+ ye = Z.greaterThan(0).and(ie(mt, w).greaterThan(0)).select(Zt, _e(ye)), U.rgb.addAssign(C(Me).div(C(r)).mul(dt).mul(ht).mul(ye));
774
+ });
775
+ });
776
+ });
777
+ }), U;
778
+ }), m = Ee("float"), k = Ee("vec3"), R = Ee("vec4"), u = Cs(m, k, R), g = Q(() => {
779
+ const i = d(a).toVar();
780
+ i.greaterThanEqual(1).discard();
781
+ const n = Ie(a, i, this._cameraProjectionMatrixInverse).toVar(), c = f(a).toVar(), h = be(n.xyz.negate()).toVar(), y = v(bt), p = Ns(bt), A = this._temporalDirection.mul(0.02), w = Ms(y.add(this._temporalOffset)).add(_s(a.add(A).mul(2).sub(1))), l = C(0), b = ae(0), M = ae(0), _ = this.sliceCount.toConst(), x = this.stepCount.toConst(), Z = this.aoIntensity.toConst(), G = this.giIntensity.toConst(), E = this.radius.toConst(), U = C(0).toVar();
782
+ he(this.useScreenSpaceSampling, () => {
783
+ U.assign(E.mul(this._resolution.x.div(2)).div(C(16)));
784
+ }).Else(() => {
785
+ U.assign(q(E.mul(this._halfProjScale).div(n.z.negate()), C(x)));
786
+ }), U.divAssign(C(x).add(1));
787
+ const P = q(1, C(x.sub(1))).mul(U).toConst();
788
+ Oe({ start: oe(0), end: _, type: "uint", condition: "<" }, ({ i: ne }) => {
789
+ const W = $e(C(ne).add(p).add(this._temporalDirection), fe.div(C(_))).toConst(), ue = ae(K(ot(W), at(W)), 0).toConst(), Y = ue.xy.mul(C(1).div(this._resolution)).toConst(), F = be(Tt(ue, h)).toConst(), me = Tt(h, F).toConst(), ee = c.sub(F.mul(ie(c, F))).toConst(), Ne = be(ee).toConst(), Be = _e(ie(Ne, h), -1, 1).toConst(), De = St(ie(ee, me)).negate().mul(ks(Be)).toConst();
790
+ o.assign(0), b.addAssign(V(vt(!0), U, P, n, Y, w, a, h, c, De)), b.addAssign(V(vt(!1), U, P, n, Y, w, a, h, c, De)), l.addAssign(C(xt(o)).div(C(r))), Oe({ start: oe(0), end: r, type: "uint", condition: "<", name: "j" }, ({ j: ge }) => {
791
+ he(o.shiftRight(ge).bitAnd(oe(1)).equal(oe(0)), () => {
792
+ const Me = Ze.sub(De).sub(C(ge).add(0.5).div(C(r)).mul(fe));
793
+ M.addAssign(h.mul(ot(Me)).add(me.mul(at(Me))));
794
+ });
795
+ });
796
+ }), l.divAssign(C(_)), l.assign(Ge(l.clamp().oneMinus(), Z).clamp()), b.divAssign(C(_)), b.mulAssign(G);
797
+ const N = C(7).toConst(), L = Ae(b), H = L.greaterThan(N).select(N.div(L), C(1));
798
+ return b.mulAssign(H), M.assign(be(M.add(c.mul(1e-4)))), m.assign(l), k.assign(b), R.assign(J(M.mul(0.5).add(0.5), 1)), J(0);
799
+ });
800
+ return this._material.colorNode = g().context(t.getSharedContext()), this._material.outputNode = u, this._material.needsUpdate = !0, this._aoNode;
801
+ }
802
+ /**
803
+ * Frees internal resources. This method should be called
804
+ * when the effect is no longer required.
805
+ */
806
+ dispose() {
807
+ this._ssgiRenderTarget.dispose(), this._material.dispose();
808
+ }
809
+ }
810
+ const Pn = (e, t, s, a) => new kn(qe(e), t, s, a);
811
+ class Vn extends He {
812
+ static get type() {
813
+ return "DenoiseNode";
814
+ }
815
+ /**
816
+ * Constructs a new denoise node.
817
+ *
818
+ * @param {TextureNode} textureNode - The texture node that represents the input of the effect (e.g. AO).
819
+ * @param {Node<float>} depthNode - A node that represents the scene's depth.
820
+ * @param {?Node<vec3>} normalNode - A node that represents the scene's normals.
821
+ * @param {Camera} camera - The camera the scene is rendered with.
822
+ */
823
+ constructor(t, s, a, r) {
824
+ super("vec4"), this.textureNode = t, this.depthNode = s, this.normalNode = a, this.noiseNode = Fe(Rn()), this.lumaPhi = I(5), this.depthPhi = I(5), this.normalPhi = I(5), this.radius = I(5), this.index = I(0), this.updateBeforeType = Ot.FRAME, this._resolution = I(new ve()), this._sampleVectors = Ps(In(16, 2, 1)), this._cameraProjectionMatrixInverse = I(r.projectionMatrixInverse);
825
+ }
826
+ /**
827
+ * This method is used to update internal uniforms once per frame.
828
+ *
829
+ * @param {NodeFrame} frame - The current node frame.
830
+ */
831
+ updateBefore() {
832
+ const t = this.textureNode.value;
833
+ this._resolution.value.set(t.image.width, t.image.height);
834
+ }
835
+ /**
836
+ * This method is used to setup the effect's TSL code.
837
+ *
838
+ * @param {NodeBuilder} builder - The current node builder.
839
+ * @return {ShaderCallNodeInternal}
840
+ */
841
+ setup() {
842
+ const t = Re(), s = (S) => this.textureNode.sample(S), a = (S) => this.depthNode.sample(S).x, r = (S) => this.normalNode !== null ? this.normalNode.sample(S).rgb.normalize() : Lt(S, this.depthNode.value, this._cameraProjectionMatrixInverse), o = (S) => this.noiseNode.sample(S), d = (S, V, m, k) => {
843
+ const R = s(k).toVar(), u = a(k).toVar(), g = r(k).toVar(), i = Ie(k, u, this._cameraProjectionMatrixInverse).toVar(), n = ie(V, g), c = Ge(q(n, 0), this.normalPhi), h = pe(Ae(R.rgb).sub(Ae(S))), y = q(C(1).sub(h.div(this.lumaPhi)), 0), p = pe(ie(m.sub(i), V)), A = q(C(1).sub(p.div(this.depthPhi)), 0), w = y.mul(A).mul(c).toVar();
844
+ return { color: R.mul(w), weight: w };
845
+ }, f = Q(([S]) => {
846
+ const V = a(S).toVar(), m = r(S).toVar(), k = s(S).toVar(), R = Ee("vec4");
847
+ return he(V.greaterThanEqual(1).or(ie(m, m).equal(0)), () => {
848
+ R.assign(k);
849
+ }).Else(() => {
850
+ const u = ae(k.rgb), g = Ie(S, V, this._cameraProjectionMatrixInverse).toConst(), i = Vs(this.noiseNode, 0);
851
+ let n = K(S.x, S.y.oneMinus());
852
+ n = n.mul(this._resolution.div(i));
853
+ const c = o(n).toVar(), h = at(c.element(this.index.mod(4).mul(2).mul(fe))), y = ot(c.element(this.index.mod(4).mul(2).mul(fe))), p = K(h, y), A = Is(p.x, p.y.negate(), p.x, p.y), w = C(1).toVar(), l = J(k).toVar();
854
+ Oe({ start: At(0), end: At(16), type: "int", condition: "<" }, ({ i: b }) => {
855
+ const M = this._sampleVectors.element(b), _ = A.mul(M.xy.mul(C(1).add(M.z.mul(this.radius.sub(1))))).div(this._resolution), x = S.add(_), Z = d(u, m, g, x);
856
+ l.addAssign(Z.color), w.addAssign(Z.weight);
857
+ }), R.assign(l.div(w));
858
+ }), R;
859
+ });
860
+ return Q(() => f(t))();
861
+ }
862
+ }
863
+ function In(e, t, s) {
864
+ const a = [];
865
+ for (let r = 0; r < e; r++) {
866
+ const o = 2 * Math.PI * t * r / e, d = Math.pow(r / (e - 1), s);
867
+ a.push(new Bt(Math.cos(o), Math.sin(o), d));
868
+ }
869
+ return a;
870
+ }
871
+ function Rn(e = 64) {
872
+ const t = new Ls(), s = e * e * 4, a = new Uint8Array(s);
873
+ for (let o = 0; o < e; o++)
874
+ for (let d = 0; d < e; d++) {
875
+ const f = o, T = d;
876
+ a[(o * e + d) * 4] = (t.noise(f, T) * 0.5 + 0.5) * 255, a[(o * e + d) * 4 + 1] = (t.noise(f + e, T) * 0.5 + 0.5) * 255, a[(o * e + d) * 4 + 2] = (t.noise(f, T + e) * 0.5 + 0.5) * 255, a[(o * e + d) * 4 + 3] = (t.noise(f + e, T + e) * 0.5 + 0.5) * 255;
877
+ }
878
+ const r = new as(a, e, e);
879
+ return r.wrapS = yt, r.wrapT = yt, r.needsUpdate = !0, r;
880
+ }
881
+ const Bn = (e, t, s, a) => new Vn(qe(e), rt(t), rt(s), a);
882
+ class Dn extends He {
883
+ static get type() {
884
+ return "CASNode";
885
+ }
886
+ /**
887
+ * Constructs a new CAS node.
888
+ *
889
+ * @param {TextureNode} textureNode - The texture node to sharpen (premultiplied, linear).
890
+ * @param {number} [amount=0.5] - Sharpening strength in [0,1]: 0 = off, 1 = RCAS maximum.
891
+ * @param {boolean} [denoise=true] - Whether to attenuate sharpening where the 3×3 cross looks like noise.
892
+ */
893
+ constructor(t, s = 0.5, a = !0) {
894
+ super("vec4"), this.isCASNode = !0, this.textureNode = t, this.amount = I(s), this.denoise = I(a ? 1 : 0);
895
+ }
896
+ /**
897
+ * This method is used to setup the effect's TSL code.
898
+ *
899
+ * @param {NodeBuilder} builder - The current node builder.
900
+ * @return {Node<vec4>}
901
+ */
902
+ setup() {
903
+ const t = this.textureNode, s = (d) => Et(d.div(d.add(1))), a = (d) => {
904
+ const f = d.pow2().min(0.9999);
905
+ return f.div(f.oneMinus());
906
+ }, r = (d) => d.g.add(d.r.add(d.b).mul(0.5));
907
+ return Q(() => {
908
+ const d = ke(t.size()).toConst(), f = d.sub(1).toConst(), T = ke(Re().mul(K(d))).toConst(), v = (U, P) => {
909
+ const N = t.load(q(ce(T.add(ke(U, P)), f), ke(0))), L = N.a.saturate().toConst(), H = L.greaterThan(1 / 255).select(N.rgb.max(0).div(L), ae(0));
910
+ return { p: s(H).toConst(), a: L };
911
+ }, S = v(0, 0), V = v(0, -1), m = v(-1, 0), k = v(1, 0), R = v(0, 1), u = ce(ce(V.p, m.p), ce(k.p, R.p)).toConst(), g = q(q(V.p, m.p), q(k.p, R.p)).toConst(), i = C(0.25 - 1 / 16), n = ce(u, S.p).div(g.mul(4).max(1e-5)), c = ae(1).sub(q(g, S.p)).div(u.mul(4).sub(4)), h = q(n.negate(), c).toConst(), y = q(i.negate(), ce(q(h.r, q(h.g, h.b)), 0)).mul(this.amount).toVar(), p = r(V.p), A = r(m.p), w = r(S.p), l = r(k.p), b = r(R.p), M = p.add(A).add(l).add(b).mul(0.25).sub(w), _ = q(q(p, A), q(w, q(l, b))).sub(ce(ce(p, A), ce(w, ce(l, b)))), x = C(1).sub(pe(M).div(_.max(1 / 65536)).saturate().mul(0.5));
912
+ y.mulAssign(this.denoise.greaterThan(0.5).select(x, 1));
913
+ const Z = y.mul(4).add(1).reciprocal().toConst(), G = a(V.p.add(m.p).add(k.p).add(R.p).mul(y).add(S.p).mul(Z).max(0)), E = V.a.add(m.a).add(k.a).add(R.a).mul(y).add(S.a).mul(Z).saturate().toConst();
914
+ return J(G.mul(E), E);
915
+ })();
916
+ }
917
+ }
918
+ const zn = (e, t, s) => new Dn(typeof e.getTextureNode == "function" ? e.getTextureNode() : qe(e), t, s);
919
+ function Fn(e, t) {
920
+ const s = Ut(e, t);
921
+ s.setMRT(jt({
922
+ output: Gt,
923
+ diffuseColor: Rs,
924
+ // alpha holds the kind of surface for the composite (SURFACE: eye / skin / hair / other,
925
+ // 0 = background) in the byte the RGBA8 target already stores
926
+ normal: J(Bs(Ds), rs),
927
+ velocity: ct
928
+ }));
929
+ const a = s.getTextureNode("output"), r = s.getTextureNode("depth"), o = s.getTextureNode("normal"), d = s.getTextureNode("velocity"), f = s.getTextureNode("diffuseColor");
930
+ s.getTexture("diffuseColor").type = B.UnsignedByteType, s.getTexture("normal").type = B.UnsignedByteType;
931
+ const T = We(o.a, Ke.skin), v = We(o.a, Ke.eye), S = We(o.a, Ke.hair), V = zs((G) => Fs(o.sample(G))), m = Pn(a, r, V, t);
932
+ m.resolutionScale = 0.5, m.aoIntensity.value = 1, m.giIntensity.value = 5, m.sliceCount.value = 2, m.stepCount.value = 8, m.thickness.value = 0.03, m.radius.value = 1, m.expFactor.value = 1, m.backfaceLighting.value = 0.1;
933
+ const k = m.getAONode(), R = m.getGINode(), u = je("near", "float", t), g = je("far", "float", t), i = (G) => Es(r.sample(G).r, u, g), n = Q(() => {
934
+ const G = Re(), E = K(m.getAONode().size()), U = G.mul(E).sub(0.5), P = U.floor(), N = U.sub(P), L = i(G), H = J(0).toVar(), ne = C(0).toVar();
935
+ for (const [W, ue] of [[0, 0], [1, 0], [0, 1], [1, 1]]) {
936
+ const Y = P.add(K(W + 0.5, ue + 0.5)).div(E), F = (W === 1 ? N.x : N.x.oneMinus()).mul(ue === 1 ? N.y : N.y.oneMinus()), me = Os(L.sub(i(Y)).abs().mul(-32)).add(1e-3), ee = F.mul(me);
937
+ H.addAssign(J(R.sample(Y).rgb, k.sample(Y).r).mul(ee)), ne.addAssign(ee);
938
+ }
939
+ return H.div(ne);
940
+ }), c = Bn(n(), r, V, t);
941
+ c.radius.value = 8, c.depthPhi.value = 0.1, c.lumaPhi.value = 5;
942
+ const h = rt(c), y = I(0.5), p = I(0.5), A = h.a.oneMinus().mul(Pe(C(1), y, S)).mul(Pe(C(1), p, v)).oneMinus(), w = Pe(a.rgb, f.rgb, f.a), l = Q(([G, E]) => {
943
+ const U = E.mul(2.0404).sub(0.3324), P = E.mul(-4.7951).add(0.6417), N = E.mul(2.7552).add(0.6903);
944
+ return ae(G).max(U.mul(G).add(P).mul(G).add(N).mul(G));
945
+ }), b = I(new B.Vector3(0.45, 0.15, 0.05)), M = Pe(ae(A), Ge(ae(A), ae(1).sub(b)), T), _ = J(
946
+ a.rgb.mul(l(M, w)).add(w.mul(h.rgb)),
947
+ // indirect diffuse modulated by albedo
948
+ a.a
949
+ ), x = Yt(_, r, d, t);
950
+ return x._resolveMaterial.needsUpdate = !0, { outputNode: zn(x, 0.5), scenePassColor: a, traaPass: x, giPass: m, denoisePass: c, ao: k, gi: R, hairAO: y, eyeAO: p };
951
+ }
952
+ function On(e, t) {
953
+ const s = Ut(e, t);
954
+ s.setMRT(jt({ output: Gt, velocity: ct }));
955
+ const a = s.getTextureNode("output"), r = Yt(a, s.getTextureNode("depth"), s.getTextureNode("velocity"), t);
956
+ return r._resolveMaterial.needsUpdate = !0, { outputNode: r, scenePassColor: a, traaPass: r };
957
+ }
958
+ const En = () => {
959
+ const e = O((n) => n.animationsLoaded), t = O((n) => n.characterState), s = O((n) => n.lipSyncManager), a = O((n) => n.blendshapeManager), r = z((n) => n.credentials), o = z((n) => n.currentUtterance), d = z((n) => n.textToSpeak), f = z((n) => n.visemes), T = z((n) => n.blendshapes), v = z((n) => n.visemeIntensity), S = z((n) => n.currentVisemeIndex), V = z((n) => n.currentBlendshapeIndex), m = z((n) => n.useBlendshapeManager), [k, R] = te(!1), [u, g] = te(!1), i = it(() => r != null && r.region && (r.subscriptionKey || r.token) ? Gs({
613
960
  credentials: {
614
- region: o.region,
615
- authorizationToken: o.token,
616
- subscriptionKey: o.subscriptionKey
961
+ region: r.region,
962
+ authorizationToken: r.token,
963
+ subscriptionKey: r.subscriptionKey
617
964
  }
618
- }) : null, [o]);
619
- return k(() => {
620
- if (c) {
621
- const n = c.speechSynthesis.getVoices();
622
- n && Array.isArray(n) && n.length ? (Be(n), i(!0)) : c.speechSynthesis.onvoiceschanged = () => {
623
- Be(c.speechSynthesis.getVoices()), i(!0);
965
+ }) : null, [r]);
966
+ return j(() => {
967
+ if (i) {
968
+ const n = i.speechSynthesis.getVoices();
969
+ n && Array.isArray(n) && n.length ? (Pt(n), R(!0)) : i.speechSynthesis.onvoiceschanged = () => {
970
+ Pt(i.speechSynthesis.getVoices()), R(!0);
624
971
  };
625
972
  }
626
- }, [c]), k(() => {
627
- l && (N ? !!s : !!r) && e && d(!0);
628
- }, [l, r, s, e, N]), k(() => {
629
- if (M) {
630
- const n = new Vt(M);
631
- ar(n);
973
+ }, [i]), j(() => {
974
+ k && (m ? !!a : !!s) && e && g(!0);
975
+ }, [k, s, a, e, m]), j(() => {
976
+ if (d) {
977
+ const n = new Hs(d);
978
+ Sn(n);
632
979
  }
633
- }, [M]), k(() => {
634
- var n, g;
635
- a && f ? (a.onstart = () => {
636
- console.log("Start"), Ne(q.speaking);
637
- }, a.onend = () => {
638
- console.log("End"), Ne(q.idle);
639
- }, a.onboundary = () => {
640
- }, a.onviseme = (h) => {
641
- Le(h);
642
- }, (n = c == null ? void 0 : c.speechSynthesis) == null || n.speak(a, null)) : (g = c == null ? void 0 : c.speechSynthesis) == null || g.cancel();
643
- }, [a]), k(() => {
644
- r && (r.visemeIntensity = u);
645
- }, [u]), k(() => {
646
- if (!N && r && t === q.speaking) {
647
- if (!r.isStarted && r.start(), x.length > 1 && C === 0)
648
- x.forEach((n) => {
649
- const g = parseInt(n.name);
650
- if (!isNaN(g)) {
651
- const h = Re.get(g);
652
- h && r.PlayVisemeAsync(h, n.elapsedTime / 1e4);
980
+ }, [d]), j(() => {
981
+ var n, c;
982
+ o && u ? (o.onstart = () => {
983
+ console.log("Start"), Nt(de.speaking);
984
+ }, o.onend = () => {
985
+ console.log("End"), Nt(de.idle);
986
+ }, o.onboundary = () => {
987
+ }, o.onviseme = (h) => {
988
+ qt(h);
989
+ }, (n = i == null ? void 0 : i.speechSynthesis) == null || n.speak(o, null)) : (c = i == null ? void 0 : i.speechSynthesis) == null || c.cancel();
990
+ }, [o]), j(() => {
991
+ s && (s.visemeIntensity = v);
992
+ }, [v]), j(() => {
993
+ if (!m && s && t === de.speaking) {
994
+ if (!s.isStarted && s.start(), f.length > 1 && S === 0)
995
+ f.forEach((n) => {
996
+ const c = parseInt(n.name);
997
+ if (!isNaN(c)) {
998
+ const h = kt.get(c);
999
+ h && s.PlayVisemeAsync(h, n.elapsedTime / 1e4);
653
1000
  }
654
1001
  });
655
1002
  else
656
- for (let n = C + 1; n < x.length; n++) {
657
- const g = x[n], h = parseInt(g.name);
1003
+ for (let n = S + 1; n < f.length; n++) {
1004
+ const c = f[n], h = parseInt(c.name);
658
1005
  if (!isNaN(h)) {
659
- const p = Re.get(h);
660
- p && r.PlayVisemeAsync(p, g.elapsedTime / 1e4);
1006
+ const y = kt.get(h);
1007
+ y && s.PlayVisemeAsync(y, c.elapsedTime / 1e4);
661
1008
  }
662
1009
  }
663
- or(x.length - 1);
1010
+ bn(f.length - 1);
664
1011
  }
665
- }, [t, x, r, N]), k(() => {
666
- if (N && s && t === q.speaking) {
667
- if (!s.isStarted && s.start(), T.length > 1 && _ === 0)
1012
+ }, [t, f, s, m]), j(() => {
1013
+ if (m && a && t === de.speaking) {
1014
+ if (!a.isStarted && a.start(), T.length > 1 && V === 0)
668
1015
  T.forEach((n) => {
669
- s.PlayBlendShapeAsync(n);
1016
+ a.PlayBlendShapeAsync(n);
670
1017
  });
671
1018
  else
672
- for (let n = _ + 1; n < T.length; n++) {
673
- const g = T[n];
674
- s.PlayBlendShapeAsync(g);
1019
+ for (let n = V + 1; n < T.length; n++) {
1020
+ const c = T[n];
1021
+ a.PlayBlendShapeAsync(c);
675
1022
  }
676
- ir(T.length - 1);
1023
+ Tn(T.length - 1);
677
1024
  }
678
- }, [t, T, s, N]), k(() => {
679
- t !== q.speaking && (Oe(), He());
1025
+ }, [t, T, a, m]), j(() => {
1026
+ t !== de.speaking && (Wt(), Kt());
680
1027
  }, [t]), null;
681
- }, pr = ({ points: e, color: t = "red" }) => {
682
- const r = Se(() => {
683
- const s = new b.BufferGeometry().setFromPoints(e), o = new b.LineBasicMaterial({ color: t, toneMapped: !1 });
684
- return new b.Line(s, o);
1028
+ }, Ln = ({ points: e, color: t = "red" }) => {
1029
+ const s = it(() => {
1030
+ const a = new B.BufferGeometry().setFromPoints(e), r = new B.LineBasicMaterial({ color: t, toneMapped: !1 });
1031
+ return new B.Line(a, r);
685
1032
  }, [e, t]);
686
- return /* @__PURE__ */ S.createElement("primitive", { object: r });
687
- }, gr = ({ parentGpuTier: e, setIsGpuAvailable: t, children: r, tonemapping: s }) => {
688
- const o = D((m) => m.cameraPosition), a = D((m) => m.lookAt), M = D((m) => m.movable), x = U((m) => m.targets), T = U((m) => m.showFirstTarget), [u] = F(e || at()), [C, _] = F(
1033
+ return /* @__PURE__ */ D.createElement("primitive", { object: s });
1034
+ }, Un = ({ parentGpuTier: e, setIsGpuAvailable: t, children: s, tonemapping: a, inspector: r = !1 }) => {
1035
+ const o = se((l) => l.cameraPosition), d = se((l) => l.lookAt), f = se((l) => l.movable), T = re((l) => l.targets), v = re((l) => l.showFirstTarget), [S, V] = te(e || ds()), [m, k] = te(
689
1036
  "low"
690
1037
  /* low */
691
- ), [N, l] = F(null), [i, f] = F(void 0), d = te(null), c = te(null), n = te(null), g = (m) => {
692
- m.preventDefault(), m.stopPropagation();
1038
+ ), [R, u] = te(null), [g, i] = te(void 0), n = Te(null), c = Te(null), h = Te(null), y = (l) => {
1039
+ l.preventDefault(), l.stopPropagation();
693
1040
  };
694
- k(() => {
695
- Et(c.current);
696
- }, [c.current]), k(() => {
697
- var m, y, H, j;
698
- if (M)
699
- N == null || N.abort(), l(null);
1041
+ j(() => {
1042
+ Qs(c.current);
1043
+ }, [c.current]), j(() => {
1044
+ var l, b, M, _;
1045
+ if (f)
1046
+ R == null || R.abort(), u(null);
700
1047
  else {
701
- const B = new AbortController();
702
- l(B), (m = d.current) == null || m.addEventListener("wheel", g, { passive: !1, signal: B.signal }), (y = d.current) == null || y.addEventListener("pointerdown", g, { passive: !1, signal: B.signal }), (H = d.current) == null || H.addEventListener("pointermove", g, { passive: !1, signal: B.signal }), (j = d.current) == null || j.addEventListener("click", g, { passive: !1, signal: B.signal });
1048
+ const x = new AbortController();
1049
+ u(x), (l = n.current) == null || l.addEventListener("wheel", y, { passive: !1, signal: x.signal }), (b = n.current) == null || b.addEventListener("pointerdown", y, { passive: !1, signal: x.signal }), (M = n.current) == null || M.addEventListener("pointermove", y, { passive: !1, signal: x.signal }), (_ = n.current) == null || _.addEventListener("click", y, { passive: !1, signal: x.signal });
703
1050
  }
704
- }, [M]), k(() => {
705
- n != null && n.current && a && o && n.current.setLookAt(o.x, o.y, o.z, a.x, a.y, a.z, !0);
706
- }, [o, a]), k(() => {
707
- if (u)
708
- if (u.type === "FALLBACK")
709
- _(
710
- "medium"
711
- /* medium */
1051
+ }, [f]), j(() => {
1052
+ h != null && h.current && d && o && h.current.setLookAt(o.x, o.y, o.z, d.x, d.y, d.z, !0);
1053
+ }, [o, d]), j(() => {
1054
+ e && V(e);
1055
+ }, [e]), j(() => {
1056
+ if (S)
1057
+ if (S.type === "FALLBACK") {
1058
+ const l = typeof navigator < "u" && /Macintosh|Mac OS X/.test(navigator.userAgent);
1059
+ k(
1060
+ l ? "medium" : "low"
1061
+ /* low */
712
1062
  );
713
- else
714
- switch (u.tier) {
1063
+ } else
1064
+ switch (S.tier) {
715
1065
  case 0:
716
1066
  case 1:
717
- _(
1067
+ k(
718
1068
  "low"
719
1069
  /* low */
720
1070
  );
721
1071
  break;
722
1072
  case 2:
723
- _(
1073
+ k(
724
1074
  "medium"
725
1075
  /* medium */
726
1076
  );
727
1077
  break;
728
1078
  case 3:
729
- _(
1079
+ k(
730
1080
  "high"
731
1081
  /* high */
732
1082
  );
733
1083
  break;
734
1084
  default:
735
- _(
1085
+ k(
736
1086
  "low"
737
1087
  /* low */
738
1088
  );
739
1089
  break;
740
1090
  }
741
- }, [u]), k(() => {
742
- switch (C && (h.current = C), C) {
1091
+ }, [S]), j(() => {
1092
+ switch (m && (p.current = m), m) {
743
1093
  case "low":
744
1094
  console.warn("Retorik React-Bodyengine-Three > GPU tier too low, no rendering available"), t(!1);
745
1095
  break;
746
1096
  case "medium":
747
- f([0.8, 1]), console.log(`Retorik React-Bodyengine-Three > GPU tier detected : ${C}`), t(!0);
1097
+ i([0.8, 1]), console.log(`Retorik React-Bodyengine-Three > GPU tier detected : ${m}`), t(!0);
748
1098
  break;
749
1099
  case "high":
750
- f([1, 2]), console.log(`Retorik React-Bodyengine-Three > GPU tier detected : ${C}`), t(!0);
1100
+ i([1, 1.5]), console.log(`Retorik React-Bodyengine-Three > GPU tier detected : ${m}`), t(!0);
751
1101
  break;
752
1102
  }
753
- }, [C]);
754
- const h = te(void 0), p = Ke(async (m) => {
755
- const y = new b.WebGPURenderer({
756
- canvas: m.canvas,
1103
+ }, [m]);
1104
+ const p = Te(void 0), A = $t(async (l) => {
1105
+ const b = new B.WebGPURenderer({
1106
+ canvas: l.canvas,
757
1107
  antialias: !1,
758
1108
  alpha: !0,
759
1109
  powerPreference: "high-performance"
760
1110
  });
761
- return y.setClearColor(new b.Color("#000000"), 0), y.setPixelRatio(devicePixelRatio), y.shadowMap.type = b.PCFSoftShadowMap, await y.init(), y;
762
- }, []), R = Se(() => {
763
- if (x.length) {
764
- const m = x[0], y = new b.Vector3(m.position.x - 0.5, m.position.y, m.position.z - 0.1), H = new b.Vector3(m.position.x + 0.5, m.position.y, m.position.z - 0.1);
765
- return [y, H];
1111
+ return b.setClearColor(new B.Color("#000000"), 0), b.setPixelRatio(Math.min(devicePixelRatio, 1.5)), b.shadowMap.type = B.PCFShadowMap, await b.init(), b;
1112
+ }, []), w = it(() => {
1113
+ if (T.length) {
1114
+ const l = T[0], b = new B.Vector3(l.position.x - 0.5, l.position.y, l.position.z - 0.1), M = new B.Vector3(l.position.x + 0.5, l.position.y, l.position.z - 0.1);
1115
+ return [b, M];
766
1116
  } else if (o) {
767
- const m = new b.Vector3(o.x - 0.5, o.y, o.z - 0.1), y = new b.Vector3(o.x + 0.5, o.y, o.z - 0.1);
768
- return [m, y];
1117
+ const l = new B.Vector3(o.x - 0.5, o.y, o.z - 0.1), b = new B.Vector3(o.x + 0.5, o.y, o.z - 0.1);
1118
+ return [l, b];
769
1119
  }
770
1120
  return [];
771
- }, [x, o]);
772
- return i ? /* @__PURE__ */ S.createElement(Pt, { gl: p, dpr: i, ref: d, shadows: !0 }, /* @__PURE__ */ S.createElement(ot, { iterations: 5, ms: 100, threshold: 0.75 }, /* @__PURE__ */ S.createElement(fr, { tonemapping: s, processedTier: C }), /* @__PURE__ */ S.createElement(mr, null), /* @__PURE__ */ S.createElement(it, { ref: c, makeDefault: !0, fov: 28 }), /* @__PURE__ */ S.createElement(ct, { ref: n }), T && R.length && /* @__PURE__ */ S.createElement(pr, { points: R, color: "red" }), /* @__PURE__ */ S.createElement(Ze, { fallback: null }, r))) : /* @__PURE__ */ S.createElement(S.Fragment, null);
773
- }, fr = ({ tonemapping: e, processedTier: t }) => {
774
- const { gl: r, scene: s, camera: o, size: a } = _t(), [M] = F(new b.Vector3(-3, 2, 2)), [x] = F(new b.Vector3(0, 1, 0)), [T] = F(2), [u] = F(-3e-3), [C] = F(0.6), _ = te(null), N = te(null);
775
- return k(() => {
776
- r && (r.shadowMap.type = b.PCFSoftShadowMap, r.toneMapping = e, t !== "low" ? s.environmentIntensity = C : s.environmentIntensity = 1);
777
- }, [r, e]), k(() => {
778
- s.environmentIntensity = C;
779
- }, [C]), k(() => {
780
- if (!r || !s || !o || !t) return;
781
- s.background = null;
782
- const l = t === "high", i = bt(s, o);
783
- i.setMRT(
784
- /*isHigh
785
- ?*/
786
- wt({ output: xt, diffuseColor: vt, normal: Tt(kt), velocity: Ee })
787
- //: mrt({ output, velocity })
788
- );
789
- let f;
790
- const d = i.getTextureNode("output");
791
- i.getTextureNode("diffuseColor");
792
- const c = i.getTextureNode("depth"), n = i.getTextureNode("velocity"), g = i.getTextureNode("normal"), h = Mt((B) => At(g.sample(B))), p = Ct(d, c, h, o);
793
- p.aoIntensity.value = 1, p.giIntensity.value = 10, p.sliceCount.value = l ? 2 : 1, p.stepCount.value = 8, p.thickness.value = 0.03, p.radius.value = 0.5, p.expFactor.value = 1, p.backfaceLighting.value = 0.1;
794
- const R = p.getAONode().toInspector("SSGI.AO"), m = p.getGINode().toInspector("SSGI.GI"), y = oe(Ue(d.rgb.mul(R.r), d.rgb.mul(m.rgb)), d.a);
795
- f = ur(y, c, n, o);
796
- const j = new b.RenderPipeline(r);
797
- return j.outputNode = f, N.current = j, () => {
798
- j.dispose(), N.current = null;
1121
+ }, [T, o]);
1122
+ return g ? (
1123
+ // "percentage" = PCFShadowMap; shadows={true} would make R3F set the removed PCFSoftShadowMap
1124
+ /* @__PURE__ */ D.createElement(Us, { gl: A, dpr: g, ref: n, shadows: "percentage" }, /* @__PURE__ */ D.createElement(us, { iterations: 5, ms: 100, threshold: 0.75 }, /* @__PURE__ */ D.createElement(jn, { tonemapping: a, processedTier: m, inspector: r }), /* @__PURE__ */ D.createElement(En, null), /* @__PURE__ */ D.createElement(hs, { ref: c, makeDefault: !0, fov: 28 }), /* @__PURE__ */ D.createElement(ms, { ref: h }), v && w.length && /* @__PURE__ */ D.createElement(Ln, { points: w, color: "red" }), /* @__PURE__ */ D.createElement(Qt, { fallback: null }, s)))
1125
+ ) : /* @__PURE__ */ D.createElement(D.Fragment, null);
1126
+ }, jn = ({ tonemapping: e, processedTier: t, inspector: s = !1 }) => {
1127
+ const [a, r] = te(!1), { gl: o, scene: d, camera: f, size: T } = js(), [v] = te(new B.Vector3(-3, 2, 2)), [S] = te(new B.Vector3(0, 1, 0)), [V] = te(3.5), [m] = te(-2e-4), [k] = te(0.57), [R] = te(0.25), u = Te(null), g = Te(null);
1128
+ return j(() => {
1129
+ o && (o.shadowMap.type = B.PCFShadowMap, o.toneMapping = e, t !== "low" ? d.environmentIntensity = R : d.environmentIntensity = 1);
1130
+ }, [o, e]), j(() => {
1131
+ d.environmentIntensity = R;
1132
+ }, [R]), j(() => {
1133
+ if (!s || !o || a) return;
1134
+ let i = !1;
1135
+ return import("three/addons/inspector/Inspector.js").then(({ Inspector: n }) => {
1136
+ i || (o.inspector = new n(), r(!0));
1137
+ }).catch((n) => console.warn("Scene: could not load three's Inspector", n)), () => {
1138
+ i = !0;
1139
+ };
1140
+ }, [s, o, a]), j(() => {
1141
+ if (!o || !d || !f || !t) return;
1142
+ d.background = null;
1143
+ const i = t === "high", n = i ? Fn(d, f) : On(d, f), { outputNode: c, scenePassColor: h, traaPass: y, giPass: p, ao: A, gi: w, hairAO: l, eyeAO: b } = n, M = new B.RenderPipeline(o);
1144
+ if (M.outputNode = c, g.current = M, s && a && o.inspector) {
1145
+ const _ = () => {
1146
+ M.needsUpdate = !0;
1147
+ }, x = o.inspector.createParameters(i ? "SSGI + TRAA" : "TRAA");
1148
+ if (i) {
1149
+ const Z = { output: 0, feedback: !1 }, G = { Combined: 0, AO: 1, GI: 2, Direct: 3 };
1150
+ x.add(Z, "output", G).name("output").onChange((E) => {
1151
+ const U = Number(E);
1152
+ M.outputNode = U === 1 ? J(ae(A.r), 1) : U === 2 ? J(w.rgb, 1) : U === 3 ? h : c, _();
1153
+ }), x.add(p.sliceCount, "value", 1, 4, 1).name("slice count"), x.add(p.stepCount, "value", 1, 32, 1).name("step count"), x.add(p.radius, "value", 0.1, 2).name("radius"), x.add(p.expFactor, "value", 1e-3, 10).name("exp factor"), x.add(p.thickness, "value", 1e-3, 0.1).name("thickness"), x.add(p.backfaceLighting, "value", 0, 1).name("backface lighting"), x.add(p.aoIntensity, "value", 0, 4).name("AO intensity"), x.add(p.giIntensity, "value", 0, 20).name("GI intensity"), x.add(p, "resolutionScale", 0.25, 1).name("SSGI resolution scale"), x.add(l, "value", 0, 1).name("SSGI AO on hair"), x.add(b, "value", 0, 1).name("SSGI AO on eyes"), x.add(Z, "feedback").name("SSGI 2nd bounce (TRAA history)").onChange((E) => {
1154
+ p.beautyNode = E ? y.getHistoryTextureNode() : h, _();
1155
+ });
1156
+ }
1157
+ x.add(y, "maxVelocityLength", 4, 128, 1).name("TRAA max velocity").onChange(_), x.add(y, "depthThreshold", 1e-4, 0.01).name("TRAA depth threshold").onChange(_), x.add(y, "edgeDepthDiff", 1e-4, 0.01).name("TRAA edge depth diff").onChange(_), x.add(y, "useSubpixelCorrection").name("TRAA subpixel correction").onChange(_);
1158
+ }
1159
+ return () => {
1160
+ M.dispose(), g.current = null;
799
1161
  };
800
- }, [r, s, o, t]), k(() => {
801
- !r || !a || r.setSize(a.width, a.height);
802
- }, [a]), je(({ gl: l, scene: i, camera: f }) => {
803
- N.current && N.current.render();
804
- }, 1), /* @__PURE__ */ S.createElement(S.Fragment, null, t !== "low" && r && /* @__PURE__ */ S.createElement(S.Fragment, null, /* @__PURE__ */ S.createElement("directionalLight", { ref: _, color: "white", position: M.toArray(), "target-position": x.toArray(), intensity: T, castShadow: !0, "shadow-mapSize-width": 512, "shadow-mapSize-height": 512, "shadow-bias": u, "shadow-intensity": 0.7, "shadow-radius": 1.5 }, /* @__PURE__ */ S.createElement("orthographicCamera", { attach: "shadow-camera", args: [-1, 1, 2, -0.5, 2, 8] }))));
805
- }, yr = ({ character: e, autoLookAt: t }) => {
806
- const r = v((u) => u.characterState), s = U((u) => u.currentAUs), o = U((u) => u.currentGaze), a = U((u) => u.currentHeadPose), M = U((u) => u.lookAtCamera), x = D((u) => u.cameraPosition), T = U((u) => u.targets);
807
- return je((u, C) => {
808
- const _ = {
809
- deltaTime: C,
810
- timestamp: u.clock.oldTime,
811
- AU: s,
812
- gaze: o,
813
- headPose: a,
814
- characterState: r,
815
- lookAt: M ? x : void 0,
1162
+ }, [o, d, f, t, s, a]), j(() => {
1163
+ !o || !T || o.setSize(T.width, T.height);
1164
+ }, [T]), Ht(({ gl: i, scene: n, camera: c }) => {
1165
+ g.current && g.current.render();
1166
+ }, 1), /* @__PURE__ */ D.createElement(D.Fragment, null, t !== "low" && o && /* @__PURE__ */ D.createElement(D.Fragment, null, /* @__PURE__ */ D.createElement("directionalLight", { ref: u, color: "white", position: v.toArray(), "target-position": S.toArray(), intensity: V, castShadow: !0, "shadow-mapSize-width": 1024, "shadow-mapSize-height": 1024, "shadow-bias": m, "shadow-normalBias": 3e-3, "shadow-intensity": 0.6, "shadow-radius": 2.5 }, /* @__PURE__ */ D.createElement("orthographicCamera", { attach: "shadow-camera", args: [-1, 1, 2, -0.5, 2, 5] })), t === "high" && /* @__PURE__ */ D.createElement("directionalLight", { name: "RimLight", color: "#fff4e8", position: [0.9, 2.3, -3.2], "target-position": [0, 1.6, 0], intensity: k })));
1167
+ }, Gn = ({ character: e, autoLookAt: t }) => {
1168
+ const s = O((v) => v.characterState), a = re((v) => v.currentAUs), r = re((v) => v.currentGaze), o = re((v) => v.currentHeadPose), d = re((v) => v.lookAtCamera), f = se((v) => v.cameraPosition), T = re((v) => v.targets);
1169
+ return Ht((v, S) => {
1170
+ const V = {
1171
+ deltaTime: S,
1172
+ timestamp: v.clock.oldTime,
1173
+ AU: a,
1174
+ gaze: r,
1175
+ headPose: o,
1176
+ characterState: s,
1177
+ lookAt: d ? f : void 0,
816
1178
  targets: T
817
1179
  };
818
- e.update(_);
819
- }), k(() => {
1180
+ e.update(V);
1181
+ }), j(() => {
820
1182
  if (t)
821
- switch (r) {
822
- case q.idle:
823
- case q.waiting:
824
- pe(!1);
1183
+ switch (s) {
1184
+ case de.idle:
1185
+ case de.waiting:
1186
+ Qe(!1);
825
1187
  break;
826
- case q.listening:
827
- case q.speaking:
828
- pe(!0);
1188
+ case de.listening:
1189
+ case de.speaking:
1190
+ Qe(!0);
829
1191
  break;
830
1192
  }
831
1193
  else
832
- pe(!1);
833
- }, [r, t]), k(() => {
834
- Dt(e);
1194
+ Qe(!1);
1195
+ }, [s, t]), j(() => {
1196
+ Zs(e);
835
1197
  }, [e]), null;
836
- }, Wr = ({ url: e, type: t, animationsUrl: r, gender: s, speechSynthesis: o, camera: a, onLoadingCompleted: M, autoLookAt: x, breathing: T, disableAnimations: u, debug: C, enableBml: _, animationWeights: N, license: l, detectGpuData: i, environmentPreset: f = "apartment", tonemapping: d = b.NeutralToneMapping, targets: c, useBlendshapeManager: n = !1 }) => {
837
- const g = v((P) => P.animationsLoaded), h = D((P) => P.defaultPositions), p = D((P) => P.defaultDistances), [R, m] = F(), [y, H] = F(null), [j, B] = F(), [$, ce] = F(!1), Y = async (P) => {
838
- let A = null;
1198
+ }, xo = ({ url: e, type: t, animationsUrl: s, gender: a, speechSynthesis: r, camera: o, onLoadingCompleted: d, autoLookAt: f, breathing: T, disableAnimations: v, debug: S, inspector: V, enableBml: m, animationWeights: k, license: R, detectGpuData: u, environmentPreset: g = "apartment", tonemapping: i = B.NeutralToneMapping, targets: n, useBlendshapeManager: c = !1 }) => {
1199
+ const h = O((P) => P.animationsLoaded), y = se((P) => P.defaultPositions), p = se((P) => P.defaultDistances), [A, w] = te(), [l, b] = te(null), [M, _] = te(), [x, Z] = te(!1), G = async (P) => {
1200
+ let N = null;
839
1201
  switch (t) {
840
- case X.cc3:
841
- A = new nt(), B(le.cc3);
1202
+ case Se.cc3:
1203
+ N = new ls(), _(Le.cc3);
842
1204
  break;
843
- case X.avatarsdk:
844
- A = new st(), B(le.avatarsdk);
1205
+ case Se.avatarsdk:
1206
+ N = new cs(), _(Le.avatarsdk);
845
1207
  break;
846
- case X.avaturn:
847
- A = new rt(), B(le.avaturn);
1208
+ case Se.avaturn:
1209
+ N = new is(), _(Le.avaturn);
848
1210
  break;
849
1211
  }
850
- const z = await A.loadAsync(P).catch((G) => console.warn("Error loading character : ", G));
851
- if (z) {
852
- let G = null;
1212
+ const L = await N.loadAsync(P).catch((H) => console.warn("Error loading character : ", H));
1213
+ if (L) {
1214
+ let H = null;
853
1215
  const ne = {
854
- mesh: z,
855
- onAnimationsLoaded: he,
856
- animationsUrl: r,
857
- gender: s || "male",
1216
+ mesh: L,
1217
+ onAnimationsLoaded: E,
1218
+ animationsUrl: s,
1219
+ gender: a || "male",
858
1220
  type: t,
859
- debug: C,
860
- enableBmlManager: !!_,
861
- animationWeights: N,
862
- useBlendshapeManager: n,
863
- license: l
1221
+ debug: S,
1222
+ enableBmlManager: !!m,
1223
+ animationWeights: k,
1224
+ useBlendshapeManager: c,
1225
+ license: R
864
1226
  };
865
1227
  switch (t) {
866
- case X.cc3:
867
- G = await ue.fromCharacterCreator(ne);
1228
+ case Se.cc3:
1229
+ H = await Ye.fromCharacterCreator(ne);
868
1230
  break;
869
- case X.avatarsdk:
870
- G = await ue.fromAvatarSDK(ne);
1231
+ case Se.avatarsdk:
1232
+ H = await Ye.fromAvatarSDK(ne);
871
1233
  break;
872
- case X.avaturn:
873
- G = await ue.fromAvaturn(ne);
1234
+ case Se.avaturn:
1235
+ H = await Ye.fromAvaturn(ne);
874
1236
  break;
875
1237
  }
876
- G && H(G);
1238
+ H && b(H);
877
1239
  }
878
- }, he = () => {
879
- _e(!0);
1240
+ }, E = () => {
1241
+ Ct(!0);
880
1242
  };
881
- k(() => {
882
- var P, A;
883
- y && g && (T === !1 && ((A = (P = y.animationManager) == null ? void 0 : P.disableBreathing) == null || A.call(P)), $ ? (qt(y.getAllAnimationNames()), Kt(y.getAllAnimations()), setTimeout(() => {
884
- M == null || M();
885
- }, 1e3)) : de());
886
- }, [y, g, $]), k(() => {
887
- Ht(c || []);
888
- }, [c]), k(() => {
889
- _e(!1), R !== void 0 && (R ? Y(e) : M == null || M());
890
- }, [e, R]), k(() => {
891
- if ($ && p && h)
892
- if (a) {
893
- const P = hr(a, p, h);
894
- Ve(P), Ie(a.lookAt ? h[a.lookAt] : h.lowerbelly), Ot(!!a.movable);
1243
+ j(() => {
1244
+ var P, N;
1245
+ l && h && (T === !1 && ((N = (P = l.animationManager) == null ? void 0 : P.disableBreathing) == null || N.call(P)), x ? (an(l.getAllAnimationNames()), rn(l.getAllAnimations()), setTimeout(() => {
1246
+ d == null || d();
1247
+ }, 1e3)) : U());
1248
+ }, [l, h, x]), j(() => {
1249
+ sn(n || []);
1250
+ }, [n]), j(() => {
1251
+ Ct(!1), A !== void 0 && (A ? G(e) : d == null || d());
1252
+ }, [e, A]), j(() => {
1253
+ if (x && p && y)
1254
+ if (o) {
1255
+ const P = wn(o, p, y);
1256
+ Mt(P), _t(o.lookAt ? y[o.lookAt] : y.lowerbelly), tn(!!o.movable);
895
1257
  } else {
896
- const P = h.mouth.clone();
897
- P.setComponent(2, p.farther), Ve(P), Ie(h.lowerbelly);
1258
+ const P = y.mouth.clone();
1259
+ P.setComponent(2, p.farther), Mt(P), _t(y.lowerbelly);
898
1260
  }
899
- }, [$, a, p, h]), k(() => {
900
- o && (o.credentials && nr(o.credentials), o.voice && cr(o.voice));
901
- }, [o]), k(() => {
902
- lr(n);
903
- }, [n]);
904
- const de = () => {
905
- if (y && j) {
1261
+ }, [x, o, p, y]), j(() => {
1262
+ r && (r.credentials && xn(r.credentials), r.voice && vn(r.voice));
1263
+ }, [r]), j(() => {
1264
+ An(c);
1265
+ }, [c]);
1266
+ const U = () => {
1267
+ if (l && M) {
906
1268
  try {
907
- const P = new b.Box3().setFromObject(y), A = P.max, z = P.min, G = new b.Vector3((A.x + z.x) / 2, (A.y + z.y) / 2, (A.z + z.z) / 2);
908
- Ut(G);
909
- const ne = Math.abs(A.x - z.x), E = Math.abs(A.y - z.y), Ge = Math.abs(A.z - z.z);
910
- Ft({
1269
+ const P = new B.Box3().setFromObject(l), N = P.max, L = P.min, H = new B.Vector3((N.x + L.x) / 2, (N.y + L.y) / 2, (N.z + L.z) / 2);
1270
+ Xs(H);
1271
+ const ne = Math.abs(N.x - L.x), W = Math.abs(N.y - L.y), ue = Math.abs(N.z - L.z);
1272
+ $s({
911
1273
  x: ne,
912
- y: E,
913
- z: Ge
1274
+ y: W,
1275
+ z: ue
914
1276
  });
915
- const L = (A.x + z.x) / 2, O = (A.z + z.z) / 2, We = {
916
- eye: new b.Vector3(L, A.y - E / 16, O),
917
- mouth: new b.Vector3(L, A.y - E / 12, O),
918
- neck: new b.Vector3(L, A.y - E / 8, O),
919
- clavicle: new b.Vector3(L, A.y - E / 6, O),
920
- torso: new b.Vector3(L, A.y - E / 4, O),
921
- belly: new b.Vector3(L, A.y - E / 8 * 3, O),
922
- lowerbelly: new b.Vector3(L, A.y - E / 32 * 15, O),
923
- hips: G,
924
- higherthigh: new b.Vector3(L, z.y + E / 32 * 15, O),
925
- thigh: new b.Vector3(L, z.y + E / 8 * 3, O),
926
- knee: new b.Vector3(L, z.y + E / 4, O),
927
- leg: new b.Vector3(L, z.y + E / 8, O),
928
- feet: new b.Vector3(L, z.y, O)
929
- }, K = (A.y - (z.y + E / 7 * 2)) / 2 / Math.tan(25 * (Math.PI / 180)), qe = {
930
- veryclose: K / 4,
931
- closer: K / 3,
932
- close: K / 2.5,
933
- midclose: K / 2,
934
- medium: K,
935
- midfar: K * 2,
936
- far: K * 2.5,
937
- farther: K * 3,
938
- veryfar: K * 4
1277
+ const Y = (N.x + L.x) / 2, F = (N.z + L.z) / 2, me = {
1278
+ eye: new B.Vector3(Y, N.y - W / 16, F),
1279
+ mouth: new B.Vector3(Y, N.y - W / 12, F),
1280
+ neck: new B.Vector3(Y, N.y - W / 8, F),
1281
+ clavicle: new B.Vector3(Y, N.y - W / 6, F),
1282
+ torso: new B.Vector3(Y, N.y - W / 4, F),
1283
+ belly: new B.Vector3(Y, N.y - W / 8 * 3, F),
1284
+ lowerbelly: new B.Vector3(Y, N.y - W / 32 * 15, F),
1285
+ hips: H,
1286
+ higherthigh: new B.Vector3(Y, L.y + W / 32 * 15, F),
1287
+ thigh: new B.Vector3(Y, L.y + W / 8 * 3, F),
1288
+ knee: new B.Vector3(Y, L.y + W / 4, F),
1289
+ leg: new B.Vector3(Y, L.y + W / 8, F),
1290
+ feet: new B.Vector3(Y, L.y, F)
1291
+ }, ee = (N.y - (L.y + W / 7 * 2)) / 2 / Math.tan(25 * (Math.PI / 180)), Ne = {
1292
+ veryclose: ee / 4,
1293
+ closer: ee / 3,
1294
+ close: ee / 2.5,
1295
+ midclose: ee / 2,
1296
+ medium: ee,
1297
+ midfar: ee * 2,
1298
+ far: ee * 2.5,
1299
+ farther: ee * 3,
1300
+ veryfar: ee * 4
939
1301
  };
940
- jt(We), Lt(qe);
1302
+ Js(me), en(Ne);
941
1303
  } catch (P) {
942
1304
  console.warn(P);
943
1305
  }
944
- ce(!0);
1306
+ Z(!0);
945
1307
  }
946
1308
  };
947
- return /* @__PURE__ */ S.createElement(gr, { parentGpuTier: i, setIsGpuAvailable: m, tonemapping: d }, R ? /* @__PURE__ */ S.createElement(S.Fragment, null, y && /* @__PURE__ */ S.createElement(yr, { character: y, autoLookAt: !!x }), y && /* @__PURE__ */ S.createElement(S.Fragment, null, /* @__PURE__ */ S.createElement(lt, { preset: f }), /* @__PURE__ */ S.createElement("primitive", { object: y, castShadow: !0, receiveShadow: !0 }))) : /* @__PURE__ */ S.createElement(S.Fragment, null));
948
- }, Sr = {
1309
+ return /* @__PURE__ */ D.createElement(Un, { parentGpuTier: u, setIsGpuAvailable: w, tonemapping: i, inspector: V }, A ? /* @__PURE__ */ D.createElement(D.Fragment, null, l && /* @__PURE__ */ D.createElement(Gn, { character: l, autoLookAt: !!f }), l && /* @__PURE__ */ D.createElement(D.Fragment, null, /* @__PURE__ */ D.createElement(ps, { preset: g }), /* @__PURE__ */ D.createElement("primitive", { object: l, castShadow: !0, receiveShadow: !0 }))) : /* @__PURE__ */ D.createElement(D.Fragment, null));
1310
+ }, Hn = {
949
1311
  emotions: [],
950
- currentTopEmotion: be.Neutral,
1312
+ currentTopEmotion: lt.Neutral,
951
1313
  useTopEmotionOnly: !0,
952
1314
  autoDecay: !1
953
- }, ie = se()(() => Sr), qr = (e) => {
954
- if (ie.setState({ emotions: e || [] }), e != null && e.length) {
955
- const t = e.reduce((r, s) => r.value > s.value ? r : s);
956
- ie.setState({ currentTopEmotion: t.emotion });
1315
+ }, Ve = Ce()(() => Hn), So = (e) => {
1316
+ if (Ve.setState({ emotions: e || [] }), e != null && e.length) {
1317
+ const t = e.reduce((s, a) => s.value > a.value ? s : a);
1318
+ Ve.setState({ currentTopEmotion: t.emotion });
957
1319
  } else
958
- ie.setState({ currentTopEmotion: be.Neutral });
959
- }, Kr = (e) => {
960
- ie.setState({ useTopEmotionOnly: e });
961
- }, Zr = (e) => {
962
- ie.setState({ autoDecay: e });
963
- }, Qr = (e) => {
964
- const t = v.getState().FACSManager;
1320
+ Ve.setState({ currentTopEmotion: lt.Neutral });
1321
+ }, bo = (e) => {
1322
+ Ve.setState({ useTopEmotionOnly: e });
1323
+ }, To = (e) => {
1324
+ Ve.setState({ autoDecay: e });
1325
+ }, vo = (e) => {
1326
+ const t = O.getState().FACSManager;
965
1327
  t == null || t.playFacialAnimation({ ...e });
966
1328
  };
967
1329
  export {
968
- Wr as Character,
969
- es as CharacterState,
970
- ts as CreationTool,
971
- I as Distances,
972
- Jr as Object3D,
973
- V as Positions,
974
- W as Rotations,
975
- jr as addBlendshape,
976
- Lr as addSPPASViseme,
977
- Le as addViseme,
978
- rs as bmlTags,
979
- ss as emotionList,
980
- He as flushBlendshapeData,
981
- Oe as flushLipSyncData,
982
- Br as getAnimationsMap,
983
- Pr as getCameraPosition,
984
- Cr as getCharacterHeight,
985
- _r as getLookAt,
986
- Hr as getVoices,
987
- Gt as lookAtAndKeep,
988
- Dr as playAnimationByName,
989
- Qr as playFacialAnimation,
990
- Fr as presets,
991
- Wt as releaseLookAt,
992
- Zr as setAutoDecay,
993
- zr as setAutoPlay,
994
- Ur as setBlendshapes,
995
- Ve as setCameraPosition,
996
- Ne as setCharacterState,
997
- Nr as setCurrentAUs,
998
- Vr as setCurrentGaze,
999
- Ir as setCurrentHeadPose,
1000
- ar as setCurrentUtterance,
1001
- qr as setEmotions,
1002
- pe as setLookAtCamera,
1003
- Ot as setMovable,
1004
- Rr as setShowFirstTarget,
1005
- Or as setTextToSpeak,
1006
- Kr as setUseTopEmotionOnly,
1007
- Gr as setVisemeIntensity,
1008
- Er as setVisemes,
1009
- cr as setVoice,
1010
- v as useCharacterStore
1330
+ xo as Character,
1331
+ Mo as CharacterState,
1332
+ _o as CreationTool,
1333
+ X as Distances,
1334
+ Co as Object3D,
1335
+ $ as Positions,
1336
+ le as Rotations,
1337
+ mo as addBlendshape,
1338
+ po as addSPPASViseme,
1339
+ qt as addViseme,
1340
+ ko as bmlTags,
1341
+ Po as emotionList,
1342
+ Kt as flushBlendshapeData,
1343
+ Wt as flushLipSyncData,
1344
+ ro as getAnimationsMap,
1345
+ eo as getCameraPosition,
1346
+ Jn as getCharacterHeight,
1347
+ to as getLookAt,
1348
+ fo as getVoices,
1349
+ nn as lookAtAndKeep,
1350
+ co as playAnimationByName,
1351
+ vo as playFacialAnimation,
1352
+ lo as presets,
1353
+ on as releaseLookAt,
1354
+ To as setAutoDecay,
1355
+ io as setAutoPlay,
1356
+ ho as setBlendshapes,
1357
+ Mt as setCameraPosition,
1358
+ Nt as setCharacterState,
1359
+ so as setCurrentAUs,
1360
+ no as setCurrentGaze,
1361
+ oo as setCurrentHeadPose,
1362
+ Sn as setCurrentUtterance,
1363
+ So as setEmotions,
1364
+ Qe as setLookAtCamera,
1365
+ tn as setMovable,
1366
+ ao as setShowFirstTarget,
1367
+ go as setTextToSpeak,
1368
+ bo as setUseTopEmotionOnly,
1369
+ yo as setVisemeIntensity,
1370
+ uo as setVisemes,
1371
+ vn as setVoice,
1372
+ O as useCharacterStore
1011
1373
  };