@vincentt-xr/sdk 2.0.0-alpha.7 → 2.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/GROUNDING.md +1109 -13
- package/dist/{DebuggerUI-BjOMr8q_.js → DebuggerUI-C-ldiozL.js} +1 -1
- package/dist/{DebuggerUI-B6bP6P9r.cjs → DebuggerUI-CWX5EtQv.cjs} +1 -1
- package/dist/FaceMeshRenderer-BEEXZwS6.cjs +158 -0
- package/dist/FaceMeshRenderer-UuH5sTXG.js +1322 -0
- package/dist/FaceRetouch-C7h7x9kd.js +683 -0
- package/dist/FaceRetouch-DqftT26Y.cjs +134 -0
- package/dist/GLTFLoader-C5q63sKO.js +1633 -0
- package/dist/GLTFLoader-Cb_CRwmG.cjs +1 -0
- package/dist/SegmentationOverlay-DQuW3dsc.js +133 -0
- package/dist/SegmentationOverlay-aWVod8Kl.cjs +1 -0
- package/dist/assets/cache.d.ts +99 -0
- package/dist/assets/estimate.d.ts +11 -0
- package/dist/assets/index.d.ts +7 -0
- package/dist/assets/loaders.d.ts +28 -0
- package/dist/assets/react.d.ts +33 -0
- package/dist/calibration/calibration.d.ts +70 -0
- package/dist/calibration/index.d.ts +6 -0
- package/dist/calibration/storage.d.ts +13 -0
- package/dist/calibration/types.d.ts +53 -0
- package/dist/calibration/useXRCalibration.d.ts +46 -0
- package/dist/camera/CameraPermissionGate.d.ts +26 -0
- package/dist/camera/devices.d.ts +26 -0
- package/dist/camera/index.d.ts +8 -0
- package/dist/camera/permission.d.ts +86 -0
- package/dist/camera/useCameraPermission.d.ts +35 -0
- package/dist/capabilities/detect.d.ts +45 -0
- package/dist/capabilities/index.d.ts +5 -0
- package/dist/capabilities/types.d.ts +120 -0
- package/dist/capabilities/useXRCapabilities.d.ts +18 -0
- package/dist/compat/environment.d.ts +5 -0
- package/dist/compat/index.d.ts +4 -0
- package/dist/compat/run.d.ts +18 -0
- package/dist/compat/scenarios.d.ts +10 -0
- package/dist/compat/types.d.ts +101 -0
- package/dist/components/BodyTracker/index.d.ts +9 -0
- package/dist/components/FaceMesh/canonical/CanonicalFaceMeshRenderer.d.ts +33 -3
- package/dist/components/FaceMesh/canonical/parseCanonicalFaceModel.d.ts +12 -0
- package/dist/components/FaceMesh/canonical/shaders.d.ts +1 -1
- package/dist/components/FaceMesh/index.d.ts +1 -1
- package/dist/components/GestureListener/index.d.ts +11 -0
- package/dist/components/HandTracker/index.d.ts +10 -0
- package/dist/components/HolisticTracker/index.d.ts +69 -0
- package/dist/components/HolisticTracker/settings.d.ts +58 -0
- package/dist/components/HolisticTracker/signals.d.ts +49 -0
- package/dist/components/IrisEffect/IrisMaterial.d.ts +73 -0
- package/dist/components/IrisEffect/index.d.ts +51 -0
- package/dist/components/IrisEffect/settings.d.ts +117 -0
- package/dist/components/LipEffect/LipEffect.d.ts +7 -1
- package/dist/components/LipEffect/LipEffectMaterial.d.ts +43 -7
- package/dist/components/LipEffect/LipEffects.d.ts +9 -0
- package/dist/components/LipEffect/defaults.d.ts +27 -4
- package/dist/components/LipEffect/index.d.ts +11 -3
- package/dist/components/LipEffect/settings.d.ts +271 -0
- package/dist/components/LipEffect/types.d.ts +56 -9
- package/dist/components/LipEffect/useLipDesignTextures.d.ts +11 -0
- package/dist/components/LipEffect/uvGuide.d.ts +59 -0
- package/dist/components/PersonCutout/index.d.ts +50 -0
- package/dist/components/PersonCutout/personCutout.d.ts +16 -0
- package/dist/components/ScreenImage/components/ScreenImageBody.d.ts +1 -1
- package/dist/components/ScreenImage/index.d.ts +3 -1
- package/dist/components/ScreenImage/materials/ScreenImageBlendMaterial.d.ts +1 -1
- package/dist/components/ScreenImage/materials/ScreenImageMaskMaterial.d.ts +11 -0
- package/dist/components/ScreenImage/source.d.ts +6 -0
- package/dist/components/ScreenImage/types.d.ts +18 -0
- package/dist/components/SegmentationOverlay/SegmentationOverlay.d.ts +37 -0
- package/dist/components/SegmentationOverlay/SegmentationOverlayMaterial.d.ts +31 -0
- package/dist/components/SegmentationOverlay/index.d.ts +9 -0
- package/dist/components/SegmentationOverlay/maskTexture.d.ts +23 -0
- package/dist/components/SegmentationOverlay/providers.d.ts +72 -0
- package/dist/components/SegmentationOverlay/settings.d.ts +65 -0
- package/dist/components/XRProvider/index.d.ts +16 -2
- package/dist/components/XRViewport/hooks/useViewportExternalFaces.d.ts +1 -1
- package/dist/components/XRViewport/hooks/useViewportMediaSource.d.ts +1 -1
- package/dist/components/XRViewport/hooks/useViewportPipeline.d.ts +1 -1
- package/dist/components/index.d.ts +3 -0
- package/dist/constants/index.d.ts +4 -1
- package/dist/contexts-CO0sd4JQ.cjs +1 -0
- package/dist/{contexts-ByhzppYl.js → contexts-FzlnnMYD.js} +252 -246
- package/dist/coordinates/feed.d.ts +52 -0
- package/dist/coordinates/index.d.ts +5 -0
- package/dist/coordinates/spaces.d.ts +49 -0
- package/dist/coordinates/viewport.d.ts +22 -0
- package/dist/coordinates/world.d.ts +15 -0
- package/dist/debug-ui/gesture-settings/index.d.ts +14 -0
- package/dist/debug-ui/holistic-tracker-settings/index.d.ts +16 -0
- package/dist/debug-ui/index.d.ts +14 -0
- package/dist/debug-ui/iris-effect-settings/index.d.ts +12 -0
- package/dist/debug-ui/lip-effect-settings/index.d.ts +15 -0
- package/dist/debug-ui/media-source.cjs +1 -1
- package/dist/debug-ui/media-source.js +1 -1
- package/dist/debug-ui/product-hotspots/index.d.ts +24 -0
- package/dist/debug-ui/segmentation-overlay-settings/index.d.ts +12 -0
- package/dist/debug-ui/xr-diagnostics/index.d.ts +25 -0
- package/dist/debug-ui.cjs +3 -3
- package/dist/debug-ui.js +2057 -1687
- package/dist/detector-K8aej4MB.js +59 -0
- package/dist/detector-ijypGtse.cjs +1 -0
- package/dist/entries/core.d.ts +18 -1
- package/dist/entries/face-effects.d.ts +11 -3
- package/dist/entries/low-level.d.ts +22 -3
- package/dist/entries/product.d.ts +11 -0
- package/dist/entries/tracking.d.ts +24 -1
- package/dist/face-effects.cjs +155 -1
- package/dist/face-effects.js +1134 -2197
- package/dist/gestures/definitions.d.ts +85 -0
- package/dist/gestures/detector.d.ts +87 -0
- package/dist/gestures/index.d.ts +8 -0
- package/dist/gestures/measures.d.ts +101 -0
- package/dist/gestures/settings.d.ts +49 -0
- package/dist/{getFaceInfo-C4QpCQIY.js → getFaceInfo-BkZfaQs-.js} +5 -5
- package/dist/{getFaceInfo-fA1bFBub.cjs → getFaceInfo-ahPxQFGu.cjs} +1 -1
- package/dist/hooks/selectors.d.ts +68 -1
- package/dist/hooks/useCalibrationFaceTracker.d.ts +1 -1
- package/dist/hooks/useFaceInfo.d.ts +13 -1
- package/dist/hooks/useFaceInfos.d.ts +1 -1
- package/dist/hooks/useGesture.d.ts +32 -0
- package/dist/hooks/useIrisTracking.d.ts +45 -0
- package/dist/hooks/useXRDiagnostics.d.ts +81 -0
- package/dist/hooks/useXRModel.d.ts +7 -0
- package/dist/hooks/useXRSession/facade.d.ts +42 -2
- package/dist/hooks/useXRSession/index.d.ts +2 -2
- package/dist/hooks/useXRSession/reason.d.ts +3 -1
- package/dist/hooks/useXRSession/registry.d.ts +14 -0
- package/dist/hooks/useXRSession/store.d.ts +52 -3
- package/dist/index--RgGzZ6X.cjs +47 -0
- package/dist/{index-VJ0SJwmG.js → index-CHVbH0hz.js} +4 -4
- package/dist/index-CeVkgsag.cjs +1 -0
- package/dist/index-CnGox6Xr.js +3054 -0
- package/dist/{index-ByoNj0QP.js → index-CsUdQ-pn.js} +113 -111
- package/dist/{index-BjmTe9eM.cjs → index-DKBAh6hV.cjs} +1 -1
- package/dist/index-DsZwTfG0.cjs +1 -0
- package/dist/index-Dw6tj2Mi.js +144 -0
- package/dist/index-OCPjOaeP.cjs +1 -0
- package/dist/{index-DXT3WccE.js → index-s9pF4zkG.js} +1065 -1101
- package/dist/internal-BYza1h8_.cjs +1 -0
- package/dist/{internal-Dmk1cTXq.js → internal-vsfNQycj.js} +15 -16
- package/dist/internal.cjs +1 -1
- package/dist/internal.js +2 -2
- package/dist/iris/compute.d.ts +25 -0
- package/dist/iris/index.d.ts +4 -0
- package/dist/iris/lead.d.ts +19 -0
- package/dist/iris/types.d.ts +87 -0
- package/dist/landmarkMask-CbTFzBYG.js +224 -0
- package/dist/landmarkMask-u7es2k4X.cjs +1 -0
- package/dist/low-level.cjs +1 -1
- package/dist/low-level.js +1085 -634
- package/dist/main.cjs +1 -1
- package/dist/main.js +1519 -465
- package/dist/measures-9dQPdw96.js +154 -0
- package/dist/measures-KfJzpvod.cjs +1 -0
- package/dist/models/Base/index.d.ts +49 -0
- package/dist/models/Body/index.d.ts +1 -1
- package/dist/models/Face/index.d.ts +1 -1
- package/dist/models/Hand/GestureTracking.d.ts +1 -1
- package/dist/models/Hand/HandTracking.d.ts +1 -1
- package/dist/models/Holistic/index.d.ts +49 -0
- package/dist/models/Holistic/result.d.ts +68 -0
- package/dist/models/SemanticSegmentation/index.d.ts +31 -0
- package/dist/models/SemanticSegmentation/presets.d.ts +28 -0
- package/dist/models/index.d.ts +2 -0
- package/dist/product/ProductDimensions.d.ts +16 -0
- package/dist/product/ProductHotspot.d.ts +16 -0
- package/dist/product/ProductViewer.d.ts +9 -0
- package/dist/product/details.d.ts +53 -0
- package/dist/product/index.d.ts +14 -0
- package/dist/product/loadModelViewer.d.ts +4 -0
- package/dist/product/types.d.ts +71 -0
- package/dist/product/useProductAr.d.ts +37 -0
- package/dist/product/useProductDetails.d.ts +60 -0
- package/dist/product.cjs +1 -0
- package/dist/product.js +414 -0
- package/dist/providers-C0Dlhh9Z.js +365 -0
- package/dist/providers-YNwkmNeK.cjs +62 -0
- package/dist/quality/XRQualityController.d.ts +25 -0
- package/dist/quality/controller.d.ts +33 -0
- package/dist/quality/index.d.ts +6 -0
- package/dist/quality/types.d.ts +100 -0
- package/dist/quality/useXRQuality.d.ts +28 -0
- package/dist/{renderGroups-KZk6eRiY.js → renderGroups-CN1cGFUo.js} +1 -1
- package/dist/{renderGroups-80H3DpTl.cjs → renderGroups-O4KmaMl9.cjs} +1 -1
- package/dist/renderPasses-Cg-zqmEz.cjs +21 -0
- package/dist/renderPasses-NnKZVfBy.js +1460 -0
- package/dist/scene-object.cjs +1 -1
- package/dist/scene-object.js +2 -2
- package/dist/screenTransform-BenfCtZt.js +44 -0
- package/dist/screenTransform-BiXdpVf0.cjs +1 -0
- package/dist/segmentation-9PhSvc-R.cjs +1 -0
- package/dist/segmentation-CeOTKemr.js +5 -0
- package/dist/segmentation2d/faceMemory.d.ts +28 -0
- package/dist/segmentation2d/faceRegions.d.ts +24 -0
- package/dist/segmentation2d/index.d.ts +9 -0
- package/dist/segmentation2d/maskUv.d.ts +23 -0
- package/dist/segmentation2d/rasterize.d.ts +14 -0
- package/dist/segmentation2d/types.d.ts +46 -0
- package/dist/selectors-C5G1PMYL.js +195 -0
- package/dist/selectors-Du_PsVnW.cjs +1 -0
- package/dist/{session-CpkiK5YA.cjs → session-BBr0yN8h.cjs} +7 -7
- package/dist/{session-DLFN_VII.js → session-Cy0m7l7-.js} +76 -76
- package/dist/settings-DRR7-snV.cjs +1 -0
- package/dist/settings-aQk845NJ.js +73 -0
- package/dist/subjects/index.d.ts +2 -0
- package/dist/subjects/select.d.ts +62 -0
- package/dist/subjects/types.d.ts +55 -0
- package/dist/tracking-config/apply.d.ts +57 -0
- package/dist/tracking-config/index.d.ts +7 -0
- package/dist/tracking-config/resolve.d.ts +25 -0
- package/dist/tracking-config/storage.d.ts +8 -0
- package/dist/tracking-config/types.d.ts +106 -0
- package/dist/tracking-config/useXRTrackingConfig.d.ts +38 -0
- package/dist/tracking.cjs +1 -1
- package/dist/tracking.js +1056 -383
- package/dist/types/compositor.d.ts +21 -0
- package/dist/types/holistic.d.ts +121 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/model.d.ts +22 -2
- package/dist/types/nodes.d.ts +27 -2
- package/dist/types/segmentation.d.ts +19 -0
- package/dist/types/session.d.ts +41 -3
- package/dist/useFaceInfo-Blf7FCu3.js +303 -0
- package/dist/useFaceInfo-C5mO8NQY.cjs +1 -0
- package/dist/useXRCapabilities-B1R2ghy-.cjs +1 -0
- package/dist/useXRCapabilities-C68v__wB.js +30 -0
- package/dist/utils/fns.d.ts +6 -3
- package/dist/utils/integrity.d.ts +4 -1
- package/dist/utils/updateThrottle.d.ts +2 -0
- package/dist/utils/useStableUniforms.d.ts +18 -0
- package/docs/api/adaptive-quality.mdx +104 -0
- package/docs/api/asset-lifecycle.mdx +78 -0
- package/docs/api/camera-permission.mdx +142 -0
- package/docs/api/coordinate-spaces.mdx +165 -0
- package/docs/api/cross-camera.mdx +88 -0
- package/docs/api/diagnostics-calibration.mdx +97 -0
- package/docs/api/face-effects.mdx +6 -0
- package/docs/api/face-mesh.mdx +4 -2
- package/docs/api/gestures.mdx +173 -0
- package/docs/api/holistic-tracker.mdx +159 -0
- package/docs/api/iris-tracking.mdx +242 -0
- package/docs/api/multi-subject.mdx +95 -0
- package/docs/api/person-cutout.mdx +136 -0
- package/docs/api/product-ar.mdx +111 -0
- package/docs/api/product-details.mdx +78 -0
- package/docs/api/screen-space-coordinates.mdx +4 -1
- package/docs/api/segmentation-overlay.mdx +301 -0
- package/docs/api/session-lifecycle.mdx +136 -0
- package/docs/api/trackers.mdx +5 -0
- package/docs/api/tracking-config.mdx +108 -0
- package/docs/docs.json +23 -1
- package/docs/examples/lip-shaders.mdx +224 -0
- package/docs/guides/lip-effect-textures.mdx +292 -0
- package/docs/guides/lip-uv-template.png +0 -0
- package/docs/guides/lip-uv-template.svg +1 -0
- package/package.json +13 -1
- package/dist/FaceMeshRenderer-C5l6VLdO.cjs +0 -155
- package/dist/FaceMeshRenderer-wjAHrJzP.js +0 -1270
- package/dist/FaceRetouch-BkJzoA79.cjs +0 -134
- package/dist/FaceRetouch-DwbKQJAN.js +0 -551
- package/dist/contexts-Dr62It_K.cjs +0 -1
- package/dist/index-9dlAQAhy.js +0 -1462
- package/dist/index-BpEf2BBb.cjs +0 -1
- package/dist/index-CyUUurQT.cjs +0 -1
- package/dist/index-DCiMbxC3.cjs +0 -1
- package/dist/index-DpI-qo5X.cjs +0 -17
- package/dist/index-DyVF4vEW.js +0 -111
- package/dist/internal-Cq-TEQ5Y.cjs +0 -1
- package/dist/renderLayers-lDtL0_43.cjs +0 -1
- package/dist/renderLayers-zrK2pv5O.js +0 -13
- package/dist/renderPasses-BOoBSr8z.cjs +0 -21
- package/dist/renderPasses-BcquyVtu.js +0 -1500
- package/dist/selectors-B8H97CKA.js +0 -59
- package/dist/selectors-CZLKT2Iv.cjs +0 -1
- package/dist/useFaceInfo-BJ8-_MOs.cjs +0 -1
- package/dist/useFaceInfo-Dk426LTu.js +0 -62
- package/dist/useFaceResults-CtetsO9M.js +0 -19
- package/dist/useFaceResults-wBJF3zyp.cjs +0 -1
package/dist/face-effects.js
CHANGED
|
@@ -1,2287 +1,1165 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
import { jsxs as F, jsx as p, Fragment as te } from "react/jsx-runtime";
|
|
2
|
+
import { useFrame as ge, useThree as ke, useLoader as Ve } from "@react-three/fiber";
|
|
3
|
+
import { useRef as k, useEffect as N, useState as ve, useMemo as D } from "react";
|
|
4
|
+
import * as m from "three";
|
|
5
|
+
import { Vector3 as Ye, Euler as $e, DoubleSide as j } from "three";
|
|
6
|
+
import { R as Be, u as Ee } from "./selectors-C5G1PMYL.js";
|
|
7
|
+
import { u as He } from "./SegmentationOverlay-DQuW3dsc.js";
|
|
8
|
+
import { S as nr } from "./SegmentationOverlay-DQuW3dsc.js";
|
|
9
|
+
import { o as he, l as de, p as Xe } from "./index-CnGox6Xr.js";
|
|
10
|
+
import { F as ir, b as ar, e as sr } from "./index-CnGox6Xr.js";
|
|
11
|
+
import { r as We, D as xe, L as ze, c as je, a as Me } from "./FaceRetouch-C7h7x9kd.js";
|
|
12
|
+
import { q as lr, b as ur, u as hr, v as dr, F as pr, w as mr, I as fr, d as gr, e as vr, i as Er, j as xr, k as Mr, l as yr, g as Sr, h as wr, n as Tr, m as _r, x as Fr, p as Lr, o as Ar, y as Cr, s as Ir, f as Pr, t as Rr } from "./FaceRetouch-C7h7x9kd.js";
|
|
13
|
+
import { b as Ze, c as Ke } from "./index-CsUdQ-pn.js";
|
|
14
|
+
import { G as qe } from "./GLTFLoader-C5q63sKO.js";
|
|
15
|
+
import { Text as Z } from "@react-three/drei";
|
|
16
|
+
import { S as Dr } from "./segmentation-CeOTKemr.js";
|
|
17
|
+
import { C as ye, g as re, u as Se, h as Qe } from "./FaceMeshRenderer-UuH5sTXG.js";
|
|
18
|
+
import { t as Or, D as Nr, j as Gr, k as kr, l as Vr, d as Yr, e as $r, f as Br, F as Hr, a as Xr, b as Wr, c as zr, n as jr, o as Zr, i as Kr, p as qr, q as Qr, r as Jr, v as en, w as tn, y as rn, x as nn, m as on, s as an } from "./FaceMeshRenderer-UuH5sTXG.js";
|
|
19
|
+
import { T as pe } from "./index-Dw6tj2Mi.js";
|
|
20
|
+
import { F as cn, P as ln, d as un, e as hn, f as dn, g as pn } from "./providers-C0Dlhh9Z.js";
|
|
21
|
+
import { D as fn, S as gn, e as vn, g as En, p as xn, f as Mn, r as yn } from "./landmarkMask-CbTFzBYG.js";
|
|
22
|
+
const Je = () => ({
|
|
23
|
+
irisCenter: { value: new m.Vector2() },
|
|
24
|
+
irisRadius: { value: 0 },
|
|
25
|
+
irisOffset: { value: new m.Vector2() },
|
|
26
|
+
irisConfidence: { value: 0 },
|
|
27
|
+
irisOpenness: { value: 0 },
|
|
28
|
+
time: { value: 0 },
|
|
29
|
+
color: { value: new m.Color("#4fa3ff") },
|
|
30
|
+
opacity: { value: 1 },
|
|
31
|
+
mirror: { value: 0 },
|
|
32
|
+
tintImage: { value: 0 },
|
|
33
|
+
map: { value: null }
|
|
34
|
+
}), et = (e, t, r) => (e.irisCenter.value.set(t.center.x, t.center.y), e.irisRadius.value = t.radius, e.irisOffset.value.set(t.offset.x, t.offset.y), e.irisConfidence.value = t.confidence, e.irisOpenness.value = t.openness, e.time.value = r.time, r.color !== void 0 && e.color.value.set(r.color), r.opacity !== void 0 && (e.opacity.value = r.opacity), e.mirror.value = r.mirrored ? 1 : 0, r.tintImage !== void 0 && (e.tintImage.value = r.tintImage ? 1 : 0), r.map !== void 0 && (e.map.value = r.map), e), we = `
|
|
35
|
+
varying vec2 vUv;
|
|
36
|
+
void main() {
|
|
37
|
+
vUv = uv;
|
|
38
|
+
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
|
39
|
+
}
|
|
40
|
+
`, tt = `
|
|
41
|
+
uniform vec2 irisOffset;
|
|
42
|
+
uniform float irisConfidence;
|
|
43
|
+
uniform float time;
|
|
44
|
+
uniform vec3 color;
|
|
45
|
+
uniform float opacity;
|
|
46
|
+
uniform float mirror;
|
|
47
|
+
varying vec2 vUv;
|
|
48
|
+
|
|
49
|
+
float hash(float n) { return fract(sin(n) * 43758.5453123); }
|
|
50
|
+
|
|
51
|
+
void main() {
|
|
52
|
+
vec2 p = vUv - 0.5;
|
|
53
|
+
p.x = mix(p.x, -p.x, mirror);
|
|
54
|
+
float r = length(p) * 2.0;
|
|
55
|
+
if (r > 1.0) discard;
|
|
56
|
+
float angle = atan(p.y, p.x);
|
|
57
|
+
// Radial fibres: a few overlapping angular frequencies, slowly rotating.
|
|
58
|
+
float fibres = 0.5
|
|
59
|
+
+ 0.25 * sin(angle * 36.0 + time * 0.3)
|
|
60
|
+
+ 0.15 * sin(angle * 91.0 - r * 6.0)
|
|
61
|
+
+ 0.10 * sin(angle * 17.0 + time * 0.7);
|
|
62
|
+
vec3 base = color * (0.55 + 0.6 * fibres) * (1.1 - 0.5 * r);
|
|
63
|
+
// Limbal ring: darken the outer edge.
|
|
64
|
+
base *= 1.0 - smoothstep(0.78, 1.0, r) * 0.7;
|
|
65
|
+
// Pupil: a soft dark disc offset slightly with the iris position in the eye.
|
|
66
|
+
vec2 pupil = p - irisOffset * 0.08;
|
|
67
|
+
float pupilR = length(pupil) * 2.0;
|
|
68
|
+
float pupilMask = 1.0 - smoothstep(0.26, 0.36, pupilR);
|
|
69
|
+
base = mix(base, vec3(0.02), pupilMask);
|
|
70
|
+
// Specular glint.
|
|
71
|
+
float glint = 1.0 - smoothstep(0.0, 0.14, length(p - vec2(-0.18, 0.2)));
|
|
72
|
+
base += glint * 0.8;
|
|
73
|
+
float edge = 1.0 - smoothstep(0.92, 1.0, r);
|
|
74
|
+
gl_FragColor = vec4(base, opacity * edge * irisConfidence);
|
|
75
|
+
#include <colorspace_fragment>
|
|
76
|
+
}
|
|
77
|
+
`, rt = `
|
|
78
|
+
uniform sampler2D map;
|
|
79
|
+
uniform float irisConfidence;
|
|
80
|
+
uniform vec3 color;
|
|
81
|
+
uniform float opacity;
|
|
82
|
+
uniform float mirror;
|
|
83
|
+
uniform float tintImage;
|
|
84
|
+
varying vec2 vUv;
|
|
85
|
+
void main() {
|
|
86
|
+
vec2 uv = vUv;
|
|
87
|
+
uv.x = mix(uv.x, 1.0 - uv.x, mirror);
|
|
88
|
+
vec4 texel = texture2D(map, uv);
|
|
89
|
+
// Image as authored; multiplied by the tint only when tintImage is on.
|
|
90
|
+
vec3 rgb = texel.rgb * mix(vec3(1.0), color, tintImage);
|
|
91
|
+
gl_FragColor = vec4(rgb, texel.a * opacity * irisConfidence);
|
|
92
|
+
#include <colorspace_fragment>
|
|
93
|
+
}
|
|
94
|
+
`, Te = {
|
|
95
|
+
transparent: !0,
|
|
96
|
+
depthTest: !1,
|
|
97
|
+
depthWrite: !1,
|
|
98
|
+
side: m.DoubleSide
|
|
99
|
+
}, nt = (e) => new m.ShaderMaterial({
|
|
100
|
+
...Te,
|
|
101
|
+
uniforms: e,
|
|
102
|
+
vertexShader: we,
|
|
103
|
+
fragmentShader: tt
|
|
104
|
+
}), ot = (e) => new m.ShaderMaterial({
|
|
105
|
+
...Te,
|
|
106
|
+
uniforms: e,
|
|
107
|
+
vertexShader: we,
|
|
108
|
+
fragmentShader: rt
|
|
109
|
+
}), it = Be.TRACKED, at = (e, t) => {
|
|
110
|
+
const [r, a] = ve(null);
|
|
111
|
+
return N(() => {
|
|
112
|
+
if (t != null) {
|
|
113
|
+
a(null);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
if (!e) {
|
|
117
|
+
a(null);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
let n = !1;
|
|
121
|
+
const s = new m.TextureLoader();
|
|
122
|
+
s.setCrossOrigin("anonymous");
|
|
123
|
+
const l = s.load(e, (i) => {
|
|
124
|
+
n || (i.colorSpace = m.SRGBColorSpace, i.needsUpdate = !0, a(i));
|
|
125
|
+
});
|
|
126
|
+
return () => {
|
|
127
|
+
n = !0, l.dispose(), a((i) => i === l ? null : i);
|
|
128
|
+
};
|
|
129
|
+
}, [e, t]), t ?? r;
|
|
130
|
+
}, st = (e, t, r, a, n) => {
|
|
131
|
+
const s = D(() => Je(), []), l = D(
|
|
132
|
+
() => t === "image" ? ot(s) : nt(s),
|
|
133
|
+
[t, s]
|
|
134
|
+
);
|
|
135
|
+
N(() => () => l.dispose(), [l]);
|
|
136
|
+
const i = k(a);
|
|
137
|
+
i.current = a;
|
|
138
|
+
const c = D(() => r ? typeof r == "function" ? r({ side: e, uniforms: s, result: n, texture: i.current }) : r : null, [r, n, e, s]);
|
|
139
|
+
return N(() => {
|
|
140
|
+
if (!(!c || typeof r != "function"))
|
|
141
|
+
return () => c.dispose();
|
|
142
|
+
}, [c, r]), { material: c ?? l, uniforms: s };
|
|
143
|
+
}, me = ({
|
|
144
|
+
side: e,
|
|
145
|
+
eye: t,
|
|
146
|
+
settings: r,
|
|
147
|
+
texture: a,
|
|
148
|
+
override: n,
|
|
149
|
+
result: s,
|
|
150
|
+
renderOrder: l,
|
|
151
|
+
clock: i
|
|
26
152
|
}) => {
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
153
|
+
const c = k(null), { camera: d } = ke(), { material: h, uniforms: u } = st(e, r.mode, n, a, s), g = k(new m.Vector3()), E = k(new m.Vector3()), x = k({ x: 0, y: 0, z: 0, visibility: 0 });
|
|
154
|
+
return ge(() => {
|
|
155
|
+
const M = c.current;
|
|
156
|
+
if (!M) return;
|
|
157
|
+
const f = t.detected && t.confidence > 0 && (r.mode !== "image" || n !== void 0 || a !== null);
|
|
158
|
+
if (M.visible = f, !f) return;
|
|
159
|
+
x.current.x = t.center.x, x.current.y = t.center.y, x.current.z = t.center.z, he(x.current, d, g.current), x.current.x = t.center.x + t.radius, he(x.current, d, E.current);
|
|
160
|
+
const o = g.current.distanceTo(E.current) * r.scale;
|
|
161
|
+
M.position.copy(g.current), M.scale.set(o, o, 1), et(u, t, {
|
|
162
|
+
time: i.current,
|
|
163
|
+
color: r.color,
|
|
164
|
+
opacity: r.opacity,
|
|
165
|
+
mirrored: r.mirrored,
|
|
166
|
+
tintImage: r.tintImage,
|
|
167
|
+
map: a
|
|
168
|
+
});
|
|
169
|
+
}), /* @__PURE__ */ p(
|
|
170
|
+
"mesh",
|
|
37
171
|
{
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
172
|
+
ref: c,
|
|
173
|
+
material: h,
|
|
174
|
+
renderOrder: l,
|
|
175
|
+
frustumCulled: !1,
|
|
176
|
+
visible: !1,
|
|
177
|
+
children: /* @__PURE__ */ p("planeGeometry", { args: [2, 2] })
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
}, $t = ({
|
|
181
|
+
numFaces: e,
|
|
182
|
+
active: t = !0,
|
|
183
|
+
predictMs: r = 0,
|
|
184
|
+
texture: a,
|
|
185
|
+
material: n,
|
|
186
|
+
renderOrder: s = it,
|
|
187
|
+
onTracking: l,
|
|
188
|
+
...i
|
|
189
|
+
}) => {
|
|
190
|
+
const c = We(i), d = He({
|
|
191
|
+
faceIndex: c.faceIndex,
|
|
192
|
+
numFaces: e,
|
|
193
|
+
active: t,
|
|
194
|
+
targetFps: c.targetFps > 0 ? c.targetFps : void 0,
|
|
195
|
+
holdMs: c.holdMs,
|
|
196
|
+
predictMs: r,
|
|
197
|
+
smoothing: c.smoothing,
|
|
198
|
+
leadMs: c.leadMs
|
|
199
|
+
}), h = k(l);
|
|
200
|
+
h.current = l;
|
|
201
|
+
const { result: u, ready: g, status: E, error: x } = d;
|
|
202
|
+
N(() => {
|
|
203
|
+
var v;
|
|
204
|
+
(v = h.current) == null || v.call(h, { result: u, ready: g, status: E, error: x });
|
|
205
|
+
}, [u, g, E, x]);
|
|
206
|
+
const M = at(c.textureUrl, a), f = k(0);
|
|
207
|
+
ge((v, A) => {
|
|
208
|
+
f.current += A;
|
|
209
|
+
});
|
|
210
|
+
const o = c.eye !== "right", T = c.eye !== "left";
|
|
211
|
+
return /* @__PURE__ */ F("group", { children: [
|
|
212
|
+
o && /* @__PURE__ */ p(
|
|
213
|
+
me,
|
|
214
|
+
{
|
|
215
|
+
side: "left",
|
|
216
|
+
eye: u.left,
|
|
217
|
+
settings: c,
|
|
218
|
+
texture: M,
|
|
219
|
+
override: n,
|
|
220
|
+
result: u,
|
|
221
|
+
renderOrder: s,
|
|
222
|
+
clock: f
|
|
223
|
+
}
|
|
224
|
+
),
|
|
225
|
+
T && /* @__PURE__ */ p(
|
|
226
|
+
me,
|
|
227
|
+
{
|
|
228
|
+
side: "right",
|
|
229
|
+
eye: u.right,
|
|
230
|
+
settings: c,
|
|
231
|
+
texture: M,
|
|
232
|
+
override: n,
|
|
233
|
+
result: u,
|
|
234
|
+
renderOrder: s,
|
|
235
|
+
clock: f
|
|
236
|
+
}
|
|
237
|
+
)
|
|
238
|
+
] });
|
|
239
|
+
}, oe = 30, Bt = {
|
|
240
|
+
...xe,
|
|
241
|
+
renderOrder: oe
|
|
242
|
+
}, W = {
|
|
243
|
+
minU: 0.382,
|
|
244
|
+
maxU: 0.618,
|
|
245
|
+
minV: 0.263,
|
|
246
|
+
maxV: 0.35,
|
|
247
|
+
mouthV: 0.305
|
|
248
|
+
}, G = {
|
|
249
|
+
outerRing: "#e85d75",
|
|
250
|
+
innerRing: "#2563eb",
|
|
251
|
+
wireframe: "#94a3b8",
|
|
252
|
+
text: "#0f172a",
|
|
253
|
+
frame: "#cbd5e1"
|
|
254
|
+
}, K = (e, t, r) => ({
|
|
255
|
+
x: e * r,
|
|
256
|
+
y: (1 - t) * r
|
|
257
|
+
}), ne = (e, t) => [
|
|
258
|
+
e.uvs[t * 2],
|
|
259
|
+
e.uvs[t * 2 + 1]
|
|
260
|
+
], ie = (e) => {
|
|
261
|
+
const t = { minU: 1 / 0, maxU: -1 / 0, minV: 1 / 0, maxV: -1 / 0 };
|
|
262
|
+
ye.forEach((a) => {
|
|
263
|
+
const [n, s] = ne(e, a);
|
|
264
|
+
t.minU = Math.min(t.minU, n), t.maxU = Math.max(t.maxU, n), t.minV = Math.min(t.minV, s), t.maxV = Math.max(t.maxV, s);
|
|
265
|
+
});
|
|
266
|
+
const r = re.reduce((a, n) => a + ne(e, n)[1], 0) / re.length;
|
|
267
|
+
return { ...t, mouthV: r };
|
|
268
|
+
}, _ = (e) => Number(e.toFixed(2)).toString(), ct = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), lt = (e, t = {}) => {
|
|
269
|
+
const { size: r = 1024, region: a = "canvas", wireframe: n = !0, labels: s = !0, background: l } = t, i = ie(e), c = (y) => {
|
|
270
|
+
const [I, w] = ne(e, y);
|
|
271
|
+
return K(I, w, r);
|
|
272
|
+
}, d = (y) => {
|
|
273
|
+
const { x: I, y: w } = c(y);
|
|
274
|
+
return `${_(I)},${_(w)}`;
|
|
275
|
+
}, h = (y) => {
|
|
276
|
+
const I = [];
|
|
277
|
+
for (let w = 0; w < y.length; w += 3)
|
|
278
|
+
I.push(
|
|
279
|
+
`M${d(y[w])}L${d(y[w + 1])}L${d(y[w + 2])}Z`
|
|
280
|
+
);
|
|
281
|
+
return I.join("");
|
|
282
|
+
}, u = K(i.minU, i.maxV, r), g = K(i.maxU, i.minV, r), E = g.x - u.x, x = g.y - u.y, M = (u.x + g.x) / 2, f = a === "lips" ? Math.max(E, x) * 0.45 : 0, o = a === "lips" ? [u.x - f, u.y - f, E + f * 2, x + f * 2] : [0, 0, r, r], T = o[2] / 100, v = T * 0.25, A = T * 1.6, C = `font-family="ui-monospace, SFMono-Regular, Menlo, monospace" font-size="${_(A)}" fill="${G.text}"`, L = [];
|
|
283
|
+
if (l && L.push(`<rect width="${r}" height="${r}" fill="${l}"/>`), L.push(
|
|
284
|
+
`<rect x="${_(v / 2)}" y="${_(v / 2)}" width="${_(r - v)}" height="${_(r - v)}" fill="none" stroke="${G.frame}" stroke-width="${_(v)}"/>`
|
|
285
|
+
), n && e.lipIndices.length > 0 && L.push(
|
|
286
|
+
`<path d="${h(e.lipIndices)}" fill="${G.outerRing}" fill-opacity="0.08" stroke="${G.wireframe}" stroke-width="${_(v * 0.5)}" stroke-linejoin="round"/>`
|
|
287
|
+
), e.mouthIndices.length > 0 && L.push(
|
|
288
|
+
`<path d="${h(e.mouthIndices)}" fill="${G.innerRing}" fill-opacity="0.25" stroke="none"/>`
|
|
289
|
+
), L.push(
|
|
290
|
+
`<polygon points="${ye.map(d).join(" ")}" fill="none" stroke="${G.outerRing}" stroke-width="${_(v)}" stroke-linejoin="round"/>`,
|
|
291
|
+
`<polygon points="${re.map(d).join(" ")}" fill="none" stroke="${G.innerRing}" stroke-width="${_(v)}" stroke-dasharray="${_(v * 3)} ${_(v * 2)}" stroke-linejoin="round"/>`
|
|
292
|
+
), s) {
|
|
293
|
+
const y = T * 1.2, I = A * 1.3, w = (P, R, U, S = "middle", Y = "") => `<text x="${_(P)}" y="${_(R)}" text-anchor="${S}" ${C}${Y}>${ct(U)}</text>`, O = (u.y + g.y) / 2;
|
|
294
|
+
if (L.push(
|
|
295
|
+
w(u.x - y, O, "subject's RIGHT ▸", "end"),
|
|
296
|
+
w(g.x + y, O, "◂ subject's LEFT", "start"),
|
|
297
|
+
w(M, u.y - y, "upper lip (outer ring = painted edge)"),
|
|
298
|
+
w(
|
|
299
|
+
M,
|
|
300
|
+
g.y + y + A,
|
|
301
|
+
"lower lip · dashed ring = mouth interior, hidden in outer-and-inner-lips mode"
|
|
302
|
+
),
|
|
303
|
+
w(
|
|
304
|
+
M,
|
|
305
|
+
g.y + y + A + I,
|
|
306
|
+
`lip region: u ${_(i.minU)}–${_(i.maxU)}, v ${_(i.minV)}–${_(i.maxV)} (image x ${Math.round(i.minU * 100)}–${Math.round(i.maxU * 100)}%, y ${Math.round((1 - i.maxV) * 100)}–${Math.round((1 - i.minV) * 100)}%)`
|
|
307
|
+
)
|
|
308
|
+
), a === "canvas") {
|
|
309
|
+
const P = T * 2.5, R = [
|
|
310
|
+
`${r}×${r} canvas, same layout as Canonical_Face_Color.png.`,
|
|
311
|
+
"Only the lip triangles are sampled; transparent pixels leave the skin untouched.",
|
|
312
|
+
"Image LEFT = subject's RIGHT (screen-right on a mirrored webcam view)."
|
|
313
|
+
];
|
|
314
|
+
L.push(
|
|
315
|
+
w(
|
|
316
|
+
P,
|
|
317
|
+
P + A,
|
|
318
|
+
"Lip UV template — canonical face UV atlas",
|
|
319
|
+
"start",
|
|
320
|
+
' font-weight="bold"'
|
|
321
|
+
),
|
|
322
|
+
...R.map(
|
|
323
|
+
(U, S) => w(P, P + A + I * (S + 1), U, "start")
|
|
324
|
+
),
|
|
325
|
+
w(
|
|
326
|
+
P,
|
|
327
|
+
r - P,
|
|
328
|
+
"generated from canonical_face_model.obj uv attributes",
|
|
329
|
+
"start"
|
|
330
|
+
)
|
|
331
|
+
);
|
|
48
332
|
}
|
|
333
|
+
}
|
|
334
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" width="${r}" height="${r}" viewBox="${o.map(_).join(" ")}">${L.join("")}</svg>`;
|
|
335
|
+
}, ut = (e, t) => `data:image/svg+xml;charset=utf-8,${encodeURIComponent(lt(e, t))}`, Ht = (e, t = {}) => new Promise((r, a) => {
|
|
336
|
+
const n = t.size ?? 1024, s = new Image();
|
|
337
|
+
s.onload = () => {
|
|
338
|
+
const l = document.createElement("canvas");
|
|
339
|
+
l.width = n, l.height = n;
|
|
340
|
+
const i = l.getContext("2d");
|
|
341
|
+
if (!i) {
|
|
342
|
+
a(new Error("lip UV guide: 2D canvas context unavailable"));
|
|
343
|
+
return;
|
|
344
|
+
}
|
|
345
|
+
i.drawImage(s, 0, 0, n, n), l.toBlob((c) => {
|
|
346
|
+
c ? r(c) : a(new Error("lip UV guide: PNG encoding failed"));
|
|
347
|
+
}, "image/png");
|
|
348
|
+
}, s.onerror = () => a(new Error("lip UV guide: could not rasterize the SVG")), s.src = ut(e, t);
|
|
349
|
+
}), ht = new m.Vector3(0.35, 0.6, 1).normalize(), dt = `
|
|
350
|
+
attribute vec2 faceUv;
|
|
351
|
+
attribute float lipEdge;
|
|
352
|
+
varying vec2 vFaceUv;
|
|
353
|
+
varying vec2 vUv;
|
|
354
|
+
varying float vLipEdge;
|
|
355
|
+
varying vec3 vNormal;
|
|
356
|
+
varying vec3 vViewDir;
|
|
357
|
+
void main() {
|
|
358
|
+
vUv = uv;
|
|
359
|
+
vFaceUv = faceUv;
|
|
360
|
+
vLipEdge = lipEdge;
|
|
361
|
+
vec4 mvPosition = modelViewMatrix * vec4(position, 1.0);
|
|
362
|
+
vNormal = normalize(normalMatrix * normal);
|
|
363
|
+
vViewDir = -mvPosition.xyz;
|
|
364
|
+
gl_Position = projectionMatrix * mvPosition;
|
|
365
|
+
}`, pt = `
|
|
366
|
+
uniform sampler2D cameraTexture;
|
|
367
|
+
uniform sampler2D designTexture;
|
|
368
|
+
uniform sampler2D lowerDesignTexture;
|
|
369
|
+
uniform vec3 tint;
|
|
370
|
+
uniform vec3 lowerTint;
|
|
371
|
+
uniform vec3 highlightColor;
|
|
372
|
+
uniform vec3 gradientColor;
|
|
373
|
+
uniform vec3 innerLipColor;
|
|
374
|
+
uniform vec3 lightDirection;
|
|
375
|
+
uniform float opacity;
|
|
376
|
+
uniform float lowerOpacity;
|
|
377
|
+
uniform float intensity;
|
|
378
|
+
uniform float shading;
|
|
379
|
+
uniform float gloss;
|
|
380
|
+
uniform float roughness;
|
|
381
|
+
uniform float gradientAmount;
|
|
382
|
+
uniform float gradientDirection;
|
|
383
|
+
uniform float edgeSoftness;
|
|
384
|
+
uniform float innerLipAmount;
|
|
385
|
+
uniform float innerLipWidth;
|
|
386
|
+
uniform float mouthLineV;
|
|
387
|
+
uniform vec2 lipMin;
|
|
388
|
+
uniform vec2 lipSize;
|
|
389
|
+
uniform mat3 textureTransform;
|
|
390
|
+
varying vec2 vFaceUv;
|
|
391
|
+
varying vec2 vUv;
|
|
392
|
+
varying float vLipEdge;
|
|
393
|
+
varying vec3 vNormal;
|
|
394
|
+
varying vec3 vViewDir;
|
|
395
|
+
void main() {
|
|
396
|
+
vec3 base = texture2D(cameraTexture, vFaceUv).rgb;
|
|
397
|
+
|
|
398
|
+
// Upper / lower lip, blended over a thin band at the mouth line so the
|
|
399
|
+
// corners do not show a seam.
|
|
400
|
+
float upper = smoothstep(-0.004, 0.004, vUv.y - mouthLineV);
|
|
401
|
+
vec2 designUv = (textureTransform * vec3(vUv, 1.0)).xy;
|
|
402
|
+
vec4 design = mix(
|
|
403
|
+
texture2D(lowerDesignTexture, designUv),
|
|
404
|
+
texture2D(designTexture, designUv),
|
|
405
|
+
upper
|
|
49
406
|
);
|
|
50
|
-
|
|
51
|
-
|
|
407
|
+
vec3 lipTint = mix(lowerTint, tint, upper);
|
|
408
|
+
float lipOpacity = mix(lowerOpacity, opacity, upper);
|
|
409
|
+
|
|
410
|
+
// Gradient: outward from the mouth line, or across the lip box.
|
|
411
|
+
float gradientT = gradientDirection < 0.5
|
|
412
|
+
? 1.0 - vLipEdge
|
|
413
|
+
: gradientDirection < 1.5
|
|
414
|
+
? clamp((vUv.y - lipMin.y) / max(lipSize.y, 1e-4), 0.0, 1.0)
|
|
415
|
+
: clamp((vUv.x - lipMin.x) / max(lipSize.x, 1e-4), 0.0, 1.0);
|
|
416
|
+
lipTint = mix(lipTint, gradientColor, gradientT * gradientAmount);
|
|
417
|
+
|
|
418
|
+
// Inner lip tint, reaching innerLipWidth of the band out from the mouth line.
|
|
419
|
+
float inner = smoothstep(1.0 - max(innerLipWidth, 1e-4), 1.0, vLipEdge);
|
|
420
|
+
lipTint = mix(lipTint, innerLipColor, inner * innerLipAmount);
|
|
421
|
+
|
|
422
|
+
vec3 painted = mix(design.rgb, design.rgb * lipTint, intensity);
|
|
423
|
+
|
|
424
|
+
// Keep the lips' own light and shadow under the paint.
|
|
425
|
+
float luminance = dot(base, vec3(0.299, 0.587, 0.114));
|
|
426
|
+
painted = mix(painted, painted * min(luminance * 2.0, 1.5), shading);
|
|
427
|
+
|
|
428
|
+
// Blinn-Phong highlight; roughness widens and softens it.
|
|
429
|
+
vec3 n = normalize(vNormal);
|
|
430
|
+
if (!gl_FrontFacing) n = -n;
|
|
431
|
+
vec3 h = normalize(normalize(lightDirection) + normalize(vViewDir));
|
|
432
|
+
float shininess = mix(96.0, 4.0, roughness);
|
|
433
|
+
float specular = pow(max(dot(n, h), 0.0), shininess) * gloss;
|
|
434
|
+
|
|
435
|
+
// Feather the outer boundary.
|
|
436
|
+
float edgeFade = edgeSoftness > 0.0 ? smoothstep(0.0, edgeSoftness, vLipEdge) : 1.0;
|
|
437
|
+
|
|
438
|
+
float coverage = design.a * lipOpacity * edgeFade;
|
|
439
|
+
vec3 color = mix(base, painted, coverage) + highlightColor * specular * coverage;
|
|
440
|
+
gl_FragColor = vec4(color, coverage);
|
|
441
|
+
// Inputs are linear (sRGB textures decode on sample); encode for the output.
|
|
442
|
+
#include <colorspace_fragment>
|
|
443
|
+
}`;
|
|
444
|
+
let H = null;
|
|
445
|
+
const mt = () => (H || (H = new m.DataTexture(new Uint8Array([255, 255, 255, 255]), 1, 1), H.needsUpdate = !0), H), _e = () => {
|
|
446
|
+
const e = {
|
|
447
|
+
cameraTexture: { value: null },
|
|
448
|
+
designTexture: { value: null },
|
|
449
|
+
lowerDesignTexture: { value: null },
|
|
450
|
+
tint: { value: new m.Color() },
|
|
451
|
+
lowerTint: { value: new m.Color() },
|
|
452
|
+
highlightColor: { value: new m.Color() },
|
|
453
|
+
gradientColor: { value: new m.Color() },
|
|
454
|
+
innerLipColor: { value: new m.Color() },
|
|
455
|
+
lightDirection: { value: ht.clone() },
|
|
456
|
+
opacity: { value: 1 },
|
|
457
|
+
lowerOpacity: { value: 1 },
|
|
458
|
+
intensity: { value: 1 },
|
|
459
|
+
shading: { value: 0 },
|
|
460
|
+
gloss: { value: 0 },
|
|
461
|
+
roughness: { value: 0.5 },
|
|
462
|
+
gradientAmount: { value: 0 },
|
|
463
|
+
gradientDirection: { value: 0 },
|
|
464
|
+
edgeSoftness: { value: 0 },
|
|
465
|
+
innerLipAmount: { value: 0 },
|
|
466
|
+
innerLipWidth: { value: 0 },
|
|
467
|
+
mouthLineV: { value: W.mouthV },
|
|
468
|
+
lipMin: { value: new m.Vector2() },
|
|
469
|
+
lipSize: { value: new m.Vector2() },
|
|
470
|
+
textureTransform: { value: new m.Matrix3() }
|
|
471
|
+
};
|
|
472
|
+
return new m.ShaderMaterial({
|
|
473
|
+
uniforms: e,
|
|
474
|
+
vertexShader: dt,
|
|
475
|
+
fragmentShader: pt,
|
|
476
|
+
transparent: !0,
|
|
477
|
+
side: m.DoubleSide,
|
|
478
|
+
depthWrite: !1,
|
|
479
|
+
toneMapped: !1,
|
|
480
|
+
// three.js only runs the stencil comparison when `stencilWrite` is true.
|
|
481
|
+
// Keep-ops make it a pure test: nothing is written back, so the mouth
|
|
482
|
+
// stencil (written by the mouth group) survives for every lip material.
|
|
483
|
+
stencilWrite: !0,
|
|
484
|
+
stencilRef: 1,
|
|
485
|
+
stencilFunc: m.AlwaysStencilFunc,
|
|
486
|
+
stencilFail: m.KeepStencilOp,
|
|
487
|
+
stencilZFail: m.KeepStencilOp,
|
|
488
|
+
stencilZPass: m.KeepStencilOp
|
|
489
|
+
});
|
|
490
|
+
}, Fe = (e, {
|
|
491
|
+
cameraTexture: t,
|
|
492
|
+
designTexture: r,
|
|
493
|
+
lowerDesignTexture: a = null,
|
|
494
|
+
settings: n,
|
|
495
|
+
lipUvBounds: s = W,
|
|
496
|
+
subtractMouth: l = !1
|
|
497
|
+
}) => {
|
|
498
|
+
const i = e.uniforms, c = mt(), d = n.colorMode === "solid", h = d ? c : r ?? c, u = d ? c : n.splitLips ? a ?? r ?? c : h;
|
|
499
|
+
return i.cameraTexture.value = t, i.designTexture.value = h, i.lowerDesignTexture.value = u, i.tint.value.set(n.color), i.lowerTint.value.set(n.splitLips ? n.lowerLipColor : n.color), i.highlightColor.value.set(n.highlightColor), i.gradientColor.value.set(n.gradientColor), i.innerLipColor.value.set(n.innerLipColor), i.opacity.value = n.opacity, i.lowerOpacity.value = n.splitLips ? n.lowerLipOpacity : n.opacity, i.intensity.value = n.intensity, i.shading.value = n.shading, i.gloss.value = n.gloss, i.roughness.value = n.roughness, i.gradientAmount.value = n.gradientAmount, i.gradientDirection.value = ze.indexOf(n.gradientDirection), i.edgeSoftness.value = n.edgeSoftness, i.innerLipAmount.value = n.innerLipAmount, i.innerLipWidth.value = n.innerLipWidth, i.mouthLineV.value = s.mouthV, i.lipMin.value.set(s.minU, s.minV), i.lipSize.value.set(s.maxU - s.minU, s.maxV - s.minV), je(n, s, i.textureTransform.value), e.stencilFunc = l ? m.NotEqualStencilFunc : m.AlwaysStencilFunc, e;
|
|
500
|
+
}, fe = (e, t) => {
|
|
501
|
+
const r = D(() => t ? _e() : null, [t]);
|
|
502
|
+
return N(() => () => r == null ? void 0 : r.dispose(), [r]), r && Fe(r, e), r;
|
|
503
|
+
}, Le = (e) => {
|
|
504
|
+
const t = D(_e, []);
|
|
505
|
+
return N(() => () => t.dispose(), [t]), Fe(t, e), t;
|
|
506
|
+
}, Xt = (e) => {
|
|
507
|
+
const t = Le(e);
|
|
508
|
+
return /* @__PURE__ */ p("primitive", { object: t, attach: "material" });
|
|
509
|
+
}, Ae = (e, t) => {
|
|
510
|
+
const [r, a] = Ve(m.TextureLoader, [
|
|
511
|
+
typeof e == "string" ? e : pe,
|
|
512
|
+
typeof t == "string" ? t : pe
|
|
513
|
+
]);
|
|
514
|
+
for (const n of [r, a])
|
|
515
|
+
n.colorSpace !== m.SRGBColorSpace && (n.colorSpace = m.SRGBColorSpace, n.needsUpdate = !0);
|
|
516
|
+
return {
|
|
517
|
+
designTexture: typeof e == "string" ? r : e ?? null,
|
|
518
|
+
lowerDesignTexture: typeof t == "string" ? a : t ?? null
|
|
519
|
+
};
|
|
520
|
+
}, Ce = (e) => (e ?? xe.maskMode) === "outer-and-inner-lips";
|
|
521
|
+
let q = null;
|
|
522
|
+
const ft = () => (q || (q = new m.MeshBasicMaterial({
|
|
523
|
+
colorWrite: !1,
|
|
524
|
+
depthWrite: !1,
|
|
525
|
+
depthTest: !1,
|
|
526
|
+
stencilWrite: !0,
|
|
527
|
+
stencilRef: 1,
|
|
528
|
+
stencilFunc: m.AlwaysStencilFunc,
|
|
529
|
+
stencilZPass: m.ReplaceStencilOp
|
|
530
|
+
})), q);
|
|
531
|
+
let Q = null;
|
|
532
|
+
const gt = () => (Q || (Q = new m.MeshBasicMaterial({ visible: !1 })), Q), vt = ({
|
|
533
|
+
faceIndex: e = 0,
|
|
52
534
|
designTexture: t,
|
|
53
|
-
|
|
54
|
-
opacity: r = X.opacity,
|
|
55
|
-
intensity: n = X.intensity,
|
|
56
|
-
maskMode: i = X.maskMode,
|
|
57
|
-
shading: s = X.shading,
|
|
535
|
+
lowerDesignTexture: r,
|
|
58
536
|
material: a,
|
|
59
|
-
|
|
537
|
+
sharedMaterial: n,
|
|
538
|
+
maxUpdateFps: s,
|
|
539
|
+
holdMs: l,
|
|
540
|
+
predictMs: i,
|
|
541
|
+
renderOrder: c = oe,
|
|
542
|
+
...d
|
|
60
543
|
}) => {
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
),
|
|
65
|
-
|
|
66
|
-
|
|
544
|
+
const h = Me(d), u = Ae(t, r), g = Ee() ?? null, E = Se(), x = D(
|
|
545
|
+
() => E ? ie(E) : W,
|
|
546
|
+
[E]
|
|
547
|
+
), M = Ce(h.maskMode), f = !n && !a, o = fe(
|
|
548
|
+
{ cameraTexture: g, ...u, settings: h, lipUvBounds: x, subtractMouth: M },
|
|
549
|
+
f
|
|
550
|
+
), T = fe(
|
|
551
|
+
{ cameraTexture: g, ...u, settings: h, lipUvBounds: x, subtractMouth: !1 },
|
|
552
|
+
f && !M
|
|
553
|
+
), v = ({ faceUv: C, lipEdge: L }, y) => {
|
|
554
|
+
if (n) return n;
|
|
555
|
+
if (a && C && L) {
|
|
556
|
+
const I = {
|
|
557
|
+
cameraTexture: g,
|
|
558
|
+
designTexture: u.designTexture,
|
|
559
|
+
lowerDesignTexture: u.lowerDesignTexture,
|
|
560
|
+
faceUv: C,
|
|
561
|
+
lipEdge: L,
|
|
562
|
+
faceIndex: e,
|
|
563
|
+
maskMode: h.maskMode,
|
|
564
|
+
lipUvBounds: x,
|
|
565
|
+
settings: h
|
|
566
|
+
};
|
|
567
|
+
return typeof a == "function" ? a(I) : a;
|
|
568
|
+
}
|
|
569
|
+
return y ?? gt();
|
|
570
|
+
};
|
|
571
|
+
return /* @__PURE__ */ p(
|
|
572
|
+
Qe,
|
|
67
573
|
{
|
|
68
|
-
faceIndex:
|
|
574
|
+
faceIndex: e,
|
|
69
575
|
showMouthGeometry: !0,
|
|
70
576
|
showLipsGeometry: !0,
|
|
71
577
|
showBaseGeometry: !1,
|
|
72
|
-
showMouthMask:
|
|
578
|
+
showMouthMask: !1,
|
|
73
579
|
showEyeGeometry: !1,
|
|
74
580
|
showNoseGeometry: !1,
|
|
75
581
|
showLeftEyeGeometry: !1,
|
|
76
582
|
showRightEyeGeometry: !1,
|
|
77
583
|
showEyeMask: !1,
|
|
78
584
|
showNoseMask: !1,
|
|
79
|
-
renderOrder:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (p === "mouth")
|
|
85
|
-
return /* @__PURE__ */ T(
|
|
86
|
-
"meshBasicMaterial",
|
|
87
|
-
{
|
|
88
|
-
color: "#ffffff",
|
|
89
|
-
colorWrite: !1,
|
|
90
|
-
depthWrite: !1,
|
|
91
|
-
depthTest: !1,
|
|
92
|
-
stencilWrite: !0,
|
|
93
|
-
stencilRef: 1,
|
|
94
|
-
stencilFunc: b.AlwaysStencilFunc,
|
|
95
|
-
stencilZPass: b.ReplaceStencilOp
|
|
96
|
-
}
|
|
97
|
-
);
|
|
98
|
-
const g = {
|
|
99
|
-
cameraTexture: d,
|
|
100
|
-
designTexture: h,
|
|
101
|
-
lipMask: null,
|
|
102
|
-
faceUv: null,
|
|
103
|
-
faceIndex: l
|
|
104
|
-
};
|
|
105
|
-
return a ? typeof a == "function" ? a(g) : a : /* @__PURE__ */ T(
|
|
106
|
-
Wt,
|
|
107
|
-
{
|
|
108
|
-
context: g,
|
|
109
|
-
color: e,
|
|
110
|
-
opacity: r,
|
|
111
|
-
intensity: n,
|
|
112
|
-
shading: s,
|
|
113
|
-
subtractMouth: !0
|
|
114
|
-
}
|
|
115
|
-
);
|
|
116
|
-
}
|
|
585
|
+
renderOrder: c,
|
|
586
|
+
maxUpdateFps: s,
|
|
587
|
+
holdMs: l,
|
|
588
|
+
predictMs: i,
|
|
589
|
+
materialOverride: (C) => C.geometryKey === "mouth" ? M ? ft() : v(C, T) : v(C, o)
|
|
117
590
|
}
|
|
118
591
|
);
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
return new hn(e);
|
|
157
|
-
}), this.register(function(e) {
|
|
158
|
-
return new dn(e);
|
|
159
|
-
}), this.register(function(e) {
|
|
160
|
-
return new nn(e);
|
|
161
|
-
}), this.register(function(e) {
|
|
162
|
-
return new sn(e);
|
|
163
|
-
}), this.register(function(e) {
|
|
164
|
-
return new rn(e);
|
|
165
|
-
}), this.register(function(e) {
|
|
166
|
-
return new on(e);
|
|
167
|
-
}), this.register(function(e) {
|
|
168
|
-
return new Jt(e);
|
|
169
|
-
}), this.register(function(e) {
|
|
170
|
-
return new an(e);
|
|
171
|
-
}), this.register(function(e) {
|
|
172
|
-
return new tn(e);
|
|
173
|
-
}), this.register(function(e) {
|
|
174
|
-
return new ln(e);
|
|
175
|
-
}), this.register(function(e) {
|
|
176
|
-
return new cn(e);
|
|
177
|
-
}), this.register(function(e) {
|
|
178
|
-
return new Zt(e);
|
|
179
|
-
}), this.register(function(e) {
|
|
180
|
-
return new fn(e);
|
|
181
|
-
}), this.register(function(e) {
|
|
182
|
-
return new pn(e);
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
load(t, e, r, n) {
|
|
186
|
-
const i = this;
|
|
187
|
-
let s;
|
|
188
|
-
if (this.resourcePath !== "")
|
|
189
|
-
s = this.resourcePath;
|
|
190
|
-
else if (this.path !== "") {
|
|
191
|
-
const c = Z.extractUrlBase(t);
|
|
192
|
-
s = Z.resolveURL(c, this.path);
|
|
193
|
-
} else
|
|
194
|
-
s = Z.extractUrlBase(t);
|
|
195
|
-
this.manager.itemStart(t);
|
|
196
|
-
const a = function(c) {
|
|
197
|
-
n ? n(c) : console.error(c), i.manager.itemError(t), i.manager.itemEnd(t);
|
|
198
|
-
}, o = new ke(this.manager);
|
|
199
|
-
o.setPath(this.path), o.setResponseType("arraybuffer"), o.setRequestHeader(this.requestHeader), o.setWithCredentials(this.withCredentials), o.load(t, function(c) {
|
|
200
|
-
try {
|
|
201
|
-
i.parse(c, s, function(h) {
|
|
202
|
-
e(h), i.manager.itemEnd(t);
|
|
203
|
-
}, a);
|
|
204
|
-
} catch (h) {
|
|
205
|
-
a(h);
|
|
206
|
-
}
|
|
207
|
-
}, r, a);
|
|
208
|
-
}
|
|
209
|
-
setDRACOLoader(t) {
|
|
210
|
-
return this.dracoLoader = t, this;
|
|
211
|
-
}
|
|
212
|
-
setKTX2Loader(t) {
|
|
213
|
-
return this.ktx2Loader = t, this;
|
|
214
|
-
}
|
|
215
|
-
setMeshoptDecoder(t) {
|
|
216
|
-
return this.meshoptDecoder = t, this;
|
|
217
|
-
}
|
|
218
|
-
register(t) {
|
|
219
|
-
return this.pluginCallbacks.indexOf(t) === -1 && this.pluginCallbacks.push(t), this;
|
|
220
|
-
}
|
|
221
|
-
unregister(t) {
|
|
222
|
-
return this.pluginCallbacks.indexOf(t) !== -1 && this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t), 1), this;
|
|
223
|
-
}
|
|
224
|
-
parse(t, e, r, n) {
|
|
225
|
-
let i;
|
|
226
|
-
const s = {}, a = {}, o = new TextDecoder();
|
|
227
|
-
if (typeof t == "string")
|
|
228
|
-
i = JSON.parse(t);
|
|
229
|
-
else if (t instanceof ArrayBuffer)
|
|
230
|
-
if (o.decode(new Uint8Array(t, 0, 4)) === ze) {
|
|
231
|
-
try {
|
|
232
|
-
s[E.KHR_BINARY_GLTF] = new mn(t);
|
|
233
|
-
} catch (u) {
|
|
234
|
-
n && n(u);
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
i = JSON.parse(s[E.KHR_BINARY_GLTF].content);
|
|
238
|
-
} else
|
|
239
|
-
i = JSON.parse(o.decode(t));
|
|
240
|
-
else
|
|
241
|
-
i = t;
|
|
242
|
-
if (i.asset === void 0 || i.asset.version[0] < 2) {
|
|
243
|
-
n && n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
const c = new bn(i, {
|
|
247
|
-
path: e || this.resourcePath || "",
|
|
248
|
-
crossOrigin: this.crossOrigin,
|
|
249
|
-
requestHeader: this.requestHeader,
|
|
250
|
-
manager: this.manager,
|
|
251
|
-
ktx2Loader: this.ktx2Loader,
|
|
252
|
-
meshoptDecoder: this.meshoptDecoder
|
|
253
|
-
});
|
|
254
|
-
c.fileLoader.setRequestHeader(this.requestHeader);
|
|
255
|
-
for (let h = 0; h < this.pluginCallbacks.length; h++) {
|
|
256
|
-
const u = this.pluginCallbacks[h](c);
|
|
257
|
-
u.name || console.error("THREE.GLTFLoader: Invalid plugin found: missing name"), a[u.name] = u, s[u.name] = !0;
|
|
258
|
-
}
|
|
259
|
-
if (i.extensionsUsed)
|
|
260
|
-
for (let h = 0; h < i.extensionsUsed.length; ++h) {
|
|
261
|
-
const u = i.extensionsUsed[h], d = i.extensionsRequired || [];
|
|
262
|
-
switch (u) {
|
|
263
|
-
case E.KHR_MATERIALS_UNLIT:
|
|
264
|
-
s[u] = new Qt();
|
|
265
|
-
break;
|
|
266
|
-
case E.KHR_DRACO_MESH_COMPRESSION:
|
|
267
|
-
s[u] = new gn(i, this.dracoLoader);
|
|
268
|
-
break;
|
|
269
|
-
case E.KHR_TEXTURE_TRANSFORM:
|
|
270
|
-
s[u] = new An();
|
|
271
|
-
break;
|
|
272
|
-
case E.KHR_MESH_QUANTIZATION:
|
|
273
|
-
s[u] = new Tn();
|
|
274
|
-
break;
|
|
275
|
-
default:
|
|
276
|
-
d.indexOf(u) >= 0 && a[u] === void 0 && console.warn('THREE.GLTFLoader: Unknown extension "' + u + '".');
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
c.setExtensions(s), c.setPlugins(a), c.parse(r, n);
|
|
280
|
-
}
|
|
281
|
-
parseAsync(t, e) {
|
|
282
|
-
const r = this;
|
|
283
|
-
return new Promise(function(n, i) {
|
|
284
|
-
r.parse(t, e, n, i);
|
|
285
|
-
});
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
function qt() {
|
|
289
|
-
let l = {};
|
|
290
|
-
return {
|
|
291
|
-
get: function(t) {
|
|
292
|
-
return l[t];
|
|
293
|
-
},
|
|
294
|
-
add: function(t, e) {
|
|
295
|
-
l[t] = e;
|
|
296
|
-
},
|
|
297
|
-
remove: function(t) {
|
|
298
|
-
delete l[t];
|
|
299
|
-
},
|
|
300
|
-
removeAll: function() {
|
|
301
|
-
l = {};
|
|
302
|
-
}
|
|
303
|
-
};
|
|
304
|
-
}
|
|
305
|
-
const E = {
|
|
306
|
-
KHR_BINARY_GLTF: "KHR_binary_glTF",
|
|
307
|
-
KHR_DRACO_MESH_COMPRESSION: "KHR_draco_mesh_compression",
|
|
308
|
-
KHR_LIGHTS_PUNCTUAL: "KHR_lights_punctual",
|
|
309
|
-
KHR_MATERIALS_CLEARCOAT: "KHR_materials_clearcoat",
|
|
310
|
-
KHR_MATERIALS_DISPERSION: "KHR_materials_dispersion",
|
|
311
|
-
KHR_MATERIALS_IOR: "KHR_materials_ior",
|
|
312
|
-
KHR_MATERIALS_SHEEN: "KHR_materials_sheen",
|
|
313
|
-
KHR_MATERIALS_SPECULAR: "KHR_materials_specular",
|
|
314
|
-
KHR_MATERIALS_TRANSMISSION: "KHR_materials_transmission",
|
|
315
|
-
KHR_MATERIALS_IRIDESCENCE: "KHR_materials_iridescence",
|
|
316
|
-
KHR_MATERIALS_ANISOTROPY: "KHR_materials_anisotropy",
|
|
317
|
-
KHR_MATERIALS_UNLIT: "KHR_materials_unlit",
|
|
318
|
-
KHR_MATERIALS_VOLUME: "KHR_materials_volume",
|
|
319
|
-
KHR_TEXTURE_BASISU: "KHR_texture_basisu",
|
|
320
|
-
KHR_TEXTURE_TRANSFORM: "KHR_texture_transform",
|
|
321
|
-
KHR_MESH_QUANTIZATION: "KHR_mesh_quantization",
|
|
322
|
-
KHR_MATERIALS_EMISSIVE_STRENGTH: "KHR_materials_emissive_strength",
|
|
323
|
-
EXT_MATERIALS_BUMP: "EXT_materials_bump",
|
|
324
|
-
EXT_TEXTURE_WEBP: "EXT_texture_webp",
|
|
325
|
-
EXT_TEXTURE_AVIF: "EXT_texture_avif",
|
|
326
|
-
EXT_MESHOPT_COMPRESSION: "EXT_meshopt_compression",
|
|
327
|
-
EXT_MESH_GPU_INSTANCING: "EXT_mesh_gpu_instancing"
|
|
328
|
-
};
|
|
329
|
-
class Zt {
|
|
330
|
-
constructor(t) {
|
|
331
|
-
this.parser = t, this.name = E.KHR_LIGHTS_PUNCTUAL, this.cache = { refs: {}, uses: {} };
|
|
332
|
-
}
|
|
333
|
-
_markDefs() {
|
|
334
|
-
const t = this.parser, e = this.parser.json.nodes || [];
|
|
335
|
-
for (let r = 0, n = e.length; r < n; r++) {
|
|
336
|
-
const i = e[r];
|
|
337
|
-
i.extensions && i.extensions[this.name] && i.extensions[this.name].light !== void 0 && t._addNodeRef(this.cache, i.extensions[this.name].light);
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
_loadLight(t) {
|
|
341
|
-
const e = this.parser, r = "light:" + t;
|
|
342
|
-
let n = e.cache.get(r);
|
|
343
|
-
if (n) return n;
|
|
344
|
-
const i = e.json, o = ((i.extensions && i.extensions[this.name] || {}).lights || [])[t];
|
|
345
|
-
let c;
|
|
346
|
-
const h = new j(16777215);
|
|
347
|
-
o.color !== void 0 && h.setRGB(o.color[0], o.color[1], o.color[2], v);
|
|
348
|
-
const u = o.range !== void 0 ? o.range : 0;
|
|
349
|
-
switch (o.type) {
|
|
350
|
-
case "directional":
|
|
351
|
-
c = new lt(h), c.target.position.set(0, 0, -1), c.add(c.target);
|
|
352
|
-
break;
|
|
353
|
-
case "point":
|
|
354
|
-
c = new ct(h), c.distance = u;
|
|
355
|
-
break;
|
|
356
|
-
case "spot":
|
|
357
|
-
c = new at(h), c.distance = u, o.spot = o.spot || {}, o.spot.innerConeAngle = o.spot.innerConeAngle !== void 0 ? o.spot.innerConeAngle : 0, o.spot.outerConeAngle = o.spot.outerConeAngle !== void 0 ? o.spot.outerConeAngle : Math.PI / 4, c.angle = o.spot.outerConeAngle, c.penumbra = 1 - o.spot.innerConeAngle / o.spot.outerConeAngle, c.target.position.set(0, 0, -1), c.add(c.target);
|
|
358
|
-
break;
|
|
359
|
-
default:
|
|
360
|
-
throw new Error("THREE.GLTFLoader: Unexpected light type: " + o.type);
|
|
361
|
-
}
|
|
362
|
-
return c.position.set(0, 0, 0), O(c, o), o.intensity !== void 0 && (c.intensity = o.intensity), c.name = e.createUniqueName(o.name || "light_" + t), n = Promise.resolve(c), e.cache.add(r, n), n;
|
|
363
|
-
}
|
|
364
|
-
getDependency(t, e) {
|
|
365
|
-
if (t === "light")
|
|
366
|
-
return this._loadLight(e);
|
|
367
|
-
}
|
|
368
|
-
createNodeAttachment(t) {
|
|
369
|
-
const e = this, r = this.parser, i = r.json.nodes[t], a = (i.extensions && i.extensions[this.name] || {}).light;
|
|
370
|
-
return a === void 0 ? null : this._loadLight(a).then(function(o) {
|
|
371
|
-
return r._getNodeRef(e.cache, a, o);
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
class Qt {
|
|
376
|
-
constructor() {
|
|
377
|
-
this.name = E.KHR_MATERIALS_UNLIT;
|
|
378
|
-
}
|
|
379
|
-
getMaterialType() {
|
|
380
|
-
return q;
|
|
381
|
-
}
|
|
382
|
-
extendParams(t, e, r) {
|
|
383
|
-
const n = [];
|
|
384
|
-
t.color = new j(1, 1, 1), t.opacity = 1;
|
|
385
|
-
const i = e.pbrMetallicRoughness;
|
|
386
|
-
if (i) {
|
|
387
|
-
if (Array.isArray(i.baseColorFactor)) {
|
|
388
|
-
const s = i.baseColorFactor;
|
|
389
|
-
t.color.setRGB(s[0], s[1], s[2], v), t.opacity = s[3];
|
|
390
|
-
}
|
|
391
|
-
i.baseColorTexture !== void 0 && n.push(r.assignTexture(t, "map", i.baseColorTexture, Q));
|
|
392
|
-
}
|
|
393
|
-
return Promise.all(n);
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
class Jt {
|
|
397
|
-
constructor(t) {
|
|
398
|
-
this.parser = t, this.name = E.KHR_MATERIALS_EMISSIVE_STRENGTH;
|
|
399
|
-
}
|
|
400
|
-
extendMaterialParams(t, e) {
|
|
401
|
-
const n = this.parser.json.materials[t];
|
|
402
|
-
if (!n.extensions || !n.extensions[this.name])
|
|
403
|
-
return Promise.resolve();
|
|
404
|
-
const i = n.extensions[this.name].emissiveStrength;
|
|
405
|
-
return i !== void 0 && (e.emissiveIntensity = i), Promise.resolve();
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
class $t {
|
|
409
|
-
constructor(t) {
|
|
410
|
-
this.parser = t, this.name = E.KHR_MATERIALS_CLEARCOAT;
|
|
411
|
-
}
|
|
412
|
-
getMaterialType(t) {
|
|
413
|
-
const r = this.parser.json.materials[t];
|
|
414
|
-
return !r.extensions || !r.extensions[this.name] ? null : C;
|
|
415
|
-
}
|
|
416
|
-
extendMaterialParams(t, e) {
|
|
417
|
-
const r = this.parser, n = r.json.materials[t];
|
|
418
|
-
if (!n.extensions || !n.extensions[this.name])
|
|
419
|
-
return Promise.resolve();
|
|
420
|
-
const i = [], s = n.extensions[this.name];
|
|
421
|
-
if (s.clearcoatFactor !== void 0 && (e.clearcoat = s.clearcoatFactor), s.clearcoatTexture !== void 0 && i.push(r.assignTexture(e, "clearcoatMap", s.clearcoatTexture)), s.clearcoatRoughnessFactor !== void 0 && (e.clearcoatRoughness = s.clearcoatRoughnessFactor), s.clearcoatRoughnessTexture !== void 0 && i.push(r.assignTexture(e, "clearcoatRoughnessMap", s.clearcoatRoughnessTexture)), s.clearcoatNormalTexture !== void 0 && (i.push(r.assignTexture(e, "clearcoatNormalMap", s.clearcoatNormalTexture)), s.clearcoatNormalTexture.scale !== void 0)) {
|
|
422
|
-
const a = s.clearcoatNormalTexture.scale;
|
|
423
|
-
e.clearcoatNormalScale = new Be(a, a);
|
|
424
|
-
}
|
|
425
|
-
return Promise.all(i);
|
|
426
|
-
}
|
|
427
|
-
}
|
|
428
|
-
class en {
|
|
429
|
-
constructor(t) {
|
|
430
|
-
this.parser = t, this.name = E.KHR_MATERIALS_DISPERSION;
|
|
431
|
-
}
|
|
432
|
-
getMaterialType(t) {
|
|
433
|
-
const r = this.parser.json.materials[t];
|
|
434
|
-
return !r.extensions || !r.extensions[this.name] ? null : C;
|
|
435
|
-
}
|
|
436
|
-
extendMaterialParams(t, e) {
|
|
437
|
-
const n = this.parser.json.materials[t];
|
|
438
|
-
if (!n.extensions || !n.extensions[this.name])
|
|
439
|
-
return Promise.resolve();
|
|
440
|
-
const i = n.extensions[this.name];
|
|
441
|
-
return e.dispersion = i.dispersion !== void 0 ? i.dispersion : 0, Promise.resolve();
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
class tn {
|
|
445
|
-
constructor(t) {
|
|
446
|
-
this.parser = t, this.name = E.KHR_MATERIALS_IRIDESCENCE;
|
|
447
|
-
}
|
|
448
|
-
getMaterialType(t) {
|
|
449
|
-
const r = this.parser.json.materials[t];
|
|
450
|
-
return !r.extensions || !r.extensions[this.name] ? null : C;
|
|
451
|
-
}
|
|
452
|
-
extendMaterialParams(t, e) {
|
|
453
|
-
const r = this.parser, n = r.json.materials[t];
|
|
454
|
-
if (!n.extensions || !n.extensions[this.name])
|
|
455
|
-
return Promise.resolve();
|
|
456
|
-
const i = [], s = n.extensions[this.name];
|
|
457
|
-
return s.iridescenceFactor !== void 0 && (e.iridescence = s.iridescenceFactor), s.iridescenceTexture !== void 0 && i.push(r.assignTexture(e, "iridescenceMap", s.iridescenceTexture)), s.iridescenceIor !== void 0 && (e.iridescenceIOR = s.iridescenceIor), e.iridescenceThicknessRange === void 0 && (e.iridescenceThicknessRange = [100, 400]), s.iridescenceThicknessMinimum !== void 0 && (e.iridescenceThicknessRange[0] = s.iridescenceThicknessMinimum), s.iridescenceThicknessMaximum !== void 0 && (e.iridescenceThicknessRange[1] = s.iridescenceThicknessMaximum), s.iridescenceThicknessTexture !== void 0 && i.push(r.assignTexture(e, "iridescenceThicknessMap", s.iridescenceThicknessTexture)), Promise.all(i);
|
|
458
|
-
}
|
|
459
|
-
}
|
|
460
|
-
class nn {
|
|
461
|
-
constructor(t) {
|
|
462
|
-
this.parser = t, this.name = E.KHR_MATERIALS_SHEEN;
|
|
463
|
-
}
|
|
464
|
-
getMaterialType(t) {
|
|
465
|
-
const r = this.parser.json.materials[t];
|
|
466
|
-
return !r.extensions || !r.extensions[this.name] ? null : C;
|
|
467
|
-
}
|
|
468
|
-
extendMaterialParams(t, e) {
|
|
469
|
-
const r = this.parser, n = r.json.materials[t];
|
|
470
|
-
if (!n.extensions || !n.extensions[this.name])
|
|
471
|
-
return Promise.resolve();
|
|
472
|
-
const i = [];
|
|
473
|
-
e.sheenColor = new j(0, 0, 0), e.sheenRoughness = 0, e.sheen = 1;
|
|
474
|
-
const s = n.extensions[this.name];
|
|
475
|
-
if (s.sheenColorFactor !== void 0) {
|
|
476
|
-
const a = s.sheenColorFactor;
|
|
477
|
-
e.sheenColor.setRGB(a[0], a[1], a[2], v);
|
|
478
|
-
}
|
|
479
|
-
return s.sheenRoughnessFactor !== void 0 && (e.sheenRoughness = s.sheenRoughnessFactor), s.sheenColorTexture !== void 0 && i.push(r.assignTexture(e, "sheenColorMap", s.sheenColorTexture, Q)), s.sheenRoughnessTexture !== void 0 && i.push(r.assignTexture(e, "sheenRoughnessMap", s.sheenRoughnessTexture)), Promise.all(i);
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
class sn {
|
|
483
|
-
constructor(t) {
|
|
484
|
-
this.parser = t, this.name = E.KHR_MATERIALS_TRANSMISSION;
|
|
485
|
-
}
|
|
486
|
-
getMaterialType(t) {
|
|
487
|
-
const r = this.parser.json.materials[t];
|
|
488
|
-
return !r.extensions || !r.extensions[this.name] ? null : C;
|
|
489
|
-
}
|
|
490
|
-
extendMaterialParams(t, e) {
|
|
491
|
-
const r = this.parser, n = r.json.materials[t];
|
|
492
|
-
if (!n.extensions || !n.extensions[this.name])
|
|
493
|
-
return Promise.resolve();
|
|
494
|
-
const i = [], s = n.extensions[this.name];
|
|
495
|
-
return s.transmissionFactor !== void 0 && (e.transmission = s.transmissionFactor), s.transmissionTexture !== void 0 && i.push(r.assignTexture(e, "transmissionMap", s.transmissionTexture)), Promise.all(i);
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
class rn {
|
|
499
|
-
constructor(t) {
|
|
500
|
-
this.parser = t, this.name = E.KHR_MATERIALS_VOLUME;
|
|
501
|
-
}
|
|
502
|
-
getMaterialType(t) {
|
|
503
|
-
const r = this.parser.json.materials[t];
|
|
504
|
-
return !r.extensions || !r.extensions[this.name] ? null : C;
|
|
505
|
-
}
|
|
506
|
-
extendMaterialParams(t, e) {
|
|
507
|
-
const r = this.parser, n = r.json.materials[t];
|
|
508
|
-
if (!n.extensions || !n.extensions[this.name])
|
|
509
|
-
return Promise.resolve();
|
|
510
|
-
const i = [], s = n.extensions[this.name];
|
|
511
|
-
e.thickness = s.thicknessFactor !== void 0 ? s.thicknessFactor : 0, s.thicknessTexture !== void 0 && i.push(r.assignTexture(e, "thicknessMap", s.thicknessTexture)), e.attenuationDistance = s.attenuationDistance || 1 / 0;
|
|
512
|
-
const a = s.attenuationColor || [1, 1, 1];
|
|
513
|
-
return e.attenuationColor = new j().setRGB(a[0], a[1], a[2], v), Promise.all(i);
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
class on {
|
|
517
|
-
constructor(t) {
|
|
518
|
-
this.parser = t, this.name = E.KHR_MATERIALS_IOR;
|
|
519
|
-
}
|
|
520
|
-
getMaterialType(t) {
|
|
521
|
-
const r = this.parser.json.materials[t];
|
|
522
|
-
return !r.extensions || !r.extensions[this.name] ? null : C;
|
|
523
|
-
}
|
|
524
|
-
extendMaterialParams(t, e) {
|
|
525
|
-
const n = this.parser.json.materials[t];
|
|
526
|
-
if (!n.extensions || !n.extensions[this.name])
|
|
527
|
-
return Promise.resolve();
|
|
528
|
-
const i = n.extensions[this.name];
|
|
529
|
-
return e.ior = i.ior !== void 0 ? i.ior : 1.5, Promise.resolve();
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
class an {
|
|
533
|
-
constructor(t) {
|
|
534
|
-
this.parser = t, this.name = E.KHR_MATERIALS_SPECULAR;
|
|
535
|
-
}
|
|
536
|
-
getMaterialType(t) {
|
|
537
|
-
const r = this.parser.json.materials[t];
|
|
538
|
-
return !r.extensions || !r.extensions[this.name] ? null : C;
|
|
539
|
-
}
|
|
540
|
-
extendMaterialParams(t, e) {
|
|
541
|
-
const r = this.parser, n = r.json.materials[t];
|
|
542
|
-
if (!n.extensions || !n.extensions[this.name])
|
|
543
|
-
return Promise.resolve();
|
|
544
|
-
const i = [], s = n.extensions[this.name];
|
|
545
|
-
e.specularIntensity = s.specularFactor !== void 0 ? s.specularFactor : 1, s.specularTexture !== void 0 && i.push(r.assignTexture(e, "specularIntensityMap", s.specularTexture));
|
|
546
|
-
const a = s.specularColorFactor || [1, 1, 1];
|
|
547
|
-
return e.specularColor = new j().setRGB(a[0], a[1], a[2], v), s.specularColorTexture !== void 0 && i.push(r.assignTexture(e, "specularColorMap", s.specularColorTexture, Q)), Promise.all(i);
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
class cn {
|
|
551
|
-
constructor(t) {
|
|
552
|
-
this.parser = t, this.name = E.EXT_MATERIALS_BUMP;
|
|
553
|
-
}
|
|
554
|
-
getMaterialType(t) {
|
|
555
|
-
const r = this.parser.json.materials[t];
|
|
556
|
-
return !r.extensions || !r.extensions[this.name] ? null : C;
|
|
557
|
-
}
|
|
558
|
-
extendMaterialParams(t, e) {
|
|
559
|
-
const r = this.parser, n = r.json.materials[t];
|
|
560
|
-
if (!n.extensions || !n.extensions[this.name])
|
|
561
|
-
return Promise.resolve();
|
|
562
|
-
const i = [], s = n.extensions[this.name];
|
|
563
|
-
return e.bumpScale = s.bumpFactor !== void 0 ? s.bumpFactor : 1, s.bumpTexture !== void 0 && i.push(r.assignTexture(e, "bumpMap", s.bumpTexture)), Promise.all(i);
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
class ln {
|
|
567
|
-
constructor(t) {
|
|
568
|
-
this.parser = t, this.name = E.KHR_MATERIALS_ANISOTROPY;
|
|
569
|
-
}
|
|
570
|
-
getMaterialType(t) {
|
|
571
|
-
const r = this.parser.json.materials[t];
|
|
572
|
-
return !r.extensions || !r.extensions[this.name] ? null : C;
|
|
573
|
-
}
|
|
574
|
-
extendMaterialParams(t, e) {
|
|
575
|
-
const r = this.parser, n = r.json.materials[t];
|
|
576
|
-
if (!n.extensions || !n.extensions[this.name])
|
|
577
|
-
return Promise.resolve();
|
|
578
|
-
const i = [], s = n.extensions[this.name];
|
|
579
|
-
return s.anisotropyStrength !== void 0 && (e.anisotropy = s.anisotropyStrength), s.anisotropyRotation !== void 0 && (e.anisotropyRotation = s.anisotropyRotation), s.anisotropyTexture !== void 0 && i.push(r.assignTexture(e, "anisotropyMap", s.anisotropyTexture)), Promise.all(i);
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
class un {
|
|
583
|
-
constructor(t) {
|
|
584
|
-
this.parser = t, this.name = E.KHR_TEXTURE_BASISU;
|
|
585
|
-
}
|
|
586
|
-
loadTexture(t) {
|
|
587
|
-
const e = this.parser, r = e.json, n = r.textures[t];
|
|
588
|
-
if (!n.extensions || !n.extensions[this.name])
|
|
589
|
-
return null;
|
|
590
|
-
const i = n.extensions[this.name], s = e.options.ktx2Loader;
|
|
591
|
-
if (!s) {
|
|
592
|
-
if (r.extensionsRequired && r.extensionsRequired.indexOf(this.name) >= 0)
|
|
593
|
-
throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");
|
|
594
|
-
return null;
|
|
595
|
-
}
|
|
596
|
-
return e.loadTextureImage(t, i.source, s);
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
class hn {
|
|
600
|
-
constructor(t) {
|
|
601
|
-
this.parser = t, this.name = E.EXT_TEXTURE_WEBP, this.isSupported = null;
|
|
602
|
-
}
|
|
603
|
-
loadTexture(t) {
|
|
604
|
-
const e = this.name, r = this.parser, n = r.json, i = n.textures[t];
|
|
605
|
-
if (!i.extensions || !i.extensions[e])
|
|
606
|
-
return null;
|
|
607
|
-
const s = i.extensions[e], a = n.images[s.source];
|
|
608
|
-
let o = r.textureLoader;
|
|
609
|
-
if (a.uri) {
|
|
610
|
-
const c = r.options.manager.getHandler(a.uri);
|
|
611
|
-
c !== null && (o = c);
|
|
612
|
-
}
|
|
613
|
-
return this.detectSupport().then(function(c) {
|
|
614
|
-
if (c) return r.loadTextureImage(t, s.source, o);
|
|
615
|
-
if (n.extensionsRequired && n.extensionsRequired.indexOf(e) >= 0)
|
|
616
|
-
throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");
|
|
617
|
-
return r.loadTexture(t);
|
|
618
|
-
});
|
|
619
|
-
}
|
|
620
|
-
detectSupport() {
|
|
621
|
-
return this.isSupported || (this.isSupported = new Promise(function(t) {
|
|
622
|
-
const e = new Image();
|
|
623
|
-
e.src = "data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA", e.onload = e.onerror = function() {
|
|
624
|
-
t(e.height === 1);
|
|
625
|
-
};
|
|
626
|
-
})), this.isSupported;
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
class dn {
|
|
630
|
-
constructor(t) {
|
|
631
|
-
this.parser = t, this.name = E.EXT_TEXTURE_AVIF, this.isSupported = null;
|
|
632
|
-
}
|
|
633
|
-
loadTexture(t) {
|
|
634
|
-
const e = this.name, r = this.parser, n = r.json, i = n.textures[t];
|
|
635
|
-
if (!i.extensions || !i.extensions[e])
|
|
636
|
-
return null;
|
|
637
|
-
const s = i.extensions[e], a = n.images[s.source];
|
|
638
|
-
let o = r.textureLoader;
|
|
639
|
-
if (a.uri) {
|
|
640
|
-
const c = r.options.manager.getHandler(a.uri);
|
|
641
|
-
c !== null && (o = c);
|
|
642
|
-
}
|
|
643
|
-
return this.detectSupport().then(function(c) {
|
|
644
|
-
if (c) return r.loadTextureImage(t, s.source, o);
|
|
645
|
-
if (n.extensionsRequired && n.extensionsRequired.indexOf(e) >= 0)
|
|
646
|
-
throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");
|
|
647
|
-
return r.loadTexture(t);
|
|
648
|
-
});
|
|
649
|
-
}
|
|
650
|
-
detectSupport() {
|
|
651
|
-
return this.isSupported || (this.isSupported = new Promise(function(t) {
|
|
652
|
-
const e = new Image();
|
|
653
|
-
e.src = "data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=", e.onload = e.onerror = function() {
|
|
654
|
-
t(e.height === 1);
|
|
655
|
-
};
|
|
656
|
-
})), this.isSupported;
|
|
657
|
-
}
|
|
658
|
-
}
|
|
659
|
-
class fn {
|
|
660
|
-
constructor(t) {
|
|
661
|
-
this.name = E.EXT_MESHOPT_COMPRESSION, this.parser = t;
|
|
662
|
-
}
|
|
663
|
-
loadBufferView(t) {
|
|
664
|
-
const e = this.parser.json, r = e.bufferViews[t];
|
|
665
|
-
if (r.extensions && r.extensions[this.name]) {
|
|
666
|
-
const n = r.extensions[this.name], i = this.parser.getDependency("buffer", n.buffer), s = this.parser.options.meshoptDecoder;
|
|
667
|
-
if (!s || !s.supported) {
|
|
668
|
-
if (e.extensionsRequired && e.extensionsRequired.indexOf(this.name) >= 0)
|
|
669
|
-
throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");
|
|
670
|
-
return null;
|
|
671
|
-
}
|
|
672
|
-
return i.then(function(a) {
|
|
673
|
-
const o = n.byteOffset || 0, c = n.byteLength || 0, h = n.count, u = n.byteStride, d = new Uint8Array(a, o, c);
|
|
674
|
-
return s.decodeGltfBufferAsync ? s.decodeGltfBufferAsync(h, u, d, n.mode, n.filter).then(function(p) {
|
|
675
|
-
return p.buffer;
|
|
676
|
-
}) : s.ready.then(function() {
|
|
677
|
-
const p = new ArrayBuffer(h * u);
|
|
678
|
-
return s.decodeGltfBuffer(new Uint8Array(p), h, u, d, n.mode, n.filter), p;
|
|
679
|
-
});
|
|
680
|
-
});
|
|
681
|
-
} else
|
|
682
|
-
return null;
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
class pn {
|
|
686
|
-
constructor(t) {
|
|
687
|
-
this.name = E.EXT_MESH_GPU_INSTANCING, this.parser = t;
|
|
688
|
-
}
|
|
689
|
-
createNodeMesh(t) {
|
|
690
|
-
const e = this.parser.json, r = e.nodes[t];
|
|
691
|
-
if (!r.extensions || !r.extensions[this.name] || r.mesh === void 0)
|
|
692
|
-
return null;
|
|
693
|
-
const n = e.meshes[r.mesh];
|
|
694
|
-
for (const c of n.primitives)
|
|
695
|
-
if (c.mode !== N.TRIANGLES && c.mode !== N.TRIANGLE_STRIP && c.mode !== N.TRIANGLE_FAN && c.mode !== void 0)
|
|
696
|
-
return null;
|
|
697
|
-
const s = r.extensions[this.name].attributes, a = [], o = {};
|
|
698
|
-
for (const c in s)
|
|
699
|
-
a.push(this.parser.getDependency("accessor", s[c]).then((h) => (o[c] = h, o[c])));
|
|
700
|
-
return a.length < 1 ? null : (a.push(this.parser.createNodeMesh(t)), Promise.all(a).then((c) => {
|
|
701
|
-
const h = c.pop(), u = h.isGroup ? h.children : [h], d = c[0].count, p = [];
|
|
702
|
-
for (const g of u) {
|
|
703
|
-
const A = new te(), m = new U(), f = new Ue(), x = new U(1, 1, 1), M = new ut(g.geometry, g.material, d);
|
|
704
|
-
for (let R = 0; R < d; R++)
|
|
705
|
-
o.TRANSLATION && m.fromBufferAttribute(o.TRANSLATION, R), o.ROTATION && f.fromBufferAttribute(o.ROTATION, R), o.SCALE && x.fromBufferAttribute(o.SCALE, R), M.setMatrixAt(R, A.compose(m, f, x));
|
|
706
|
-
for (const R in o)
|
|
707
|
-
if (R === "_COLOR_0") {
|
|
708
|
-
const y = o[R];
|
|
709
|
-
M.instanceColor = new ht(y.array, y.itemSize, y.normalized);
|
|
710
|
-
} else R !== "TRANSLATION" && R !== "ROTATION" && R !== "SCALE" && g.geometry.setAttribute(R, o[R]);
|
|
711
|
-
Ge.prototype.copy.call(M, g), this.parser.assignFinalMaterial(M), p.push(M);
|
|
712
|
-
}
|
|
713
|
-
return h.isGroup ? (h.clear(), h.add(...p), h) : p[0];
|
|
714
|
-
}));
|
|
715
|
-
}
|
|
716
|
-
}
|
|
717
|
-
const ze = "glTF", z = 12, Fe = { JSON: 1313821514, BIN: 5130562 };
|
|
718
|
-
class mn {
|
|
719
|
-
constructor(t) {
|
|
720
|
-
this.name = E.KHR_BINARY_GLTF, this.content = null, this.body = null;
|
|
721
|
-
const e = new DataView(t, 0, z), r = new TextDecoder();
|
|
722
|
-
if (this.header = {
|
|
723
|
-
magic: r.decode(new Uint8Array(t.slice(0, 4))),
|
|
724
|
-
version: e.getUint32(4, !0),
|
|
725
|
-
length: e.getUint32(8, !0)
|
|
726
|
-
}, this.header.magic !== ze)
|
|
727
|
-
throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");
|
|
728
|
-
if (this.header.version < 2)
|
|
729
|
-
throw new Error("THREE.GLTFLoader: Legacy binary file detected.");
|
|
730
|
-
const n = this.header.length - z, i = new DataView(t, z);
|
|
731
|
-
let s = 0;
|
|
732
|
-
for (; s < n; ) {
|
|
733
|
-
const a = i.getUint32(s, !0);
|
|
734
|
-
s += 4;
|
|
735
|
-
const o = i.getUint32(s, !0);
|
|
736
|
-
if (s += 4, o === Fe.JSON) {
|
|
737
|
-
const c = new Uint8Array(t, z + s, a);
|
|
738
|
-
this.content = r.decode(c);
|
|
739
|
-
} else if (o === Fe.BIN) {
|
|
740
|
-
const c = z + s;
|
|
741
|
-
this.body = t.slice(c, c + a);
|
|
742
|
-
}
|
|
743
|
-
s += a;
|
|
744
|
-
}
|
|
745
|
-
if (this.content === null)
|
|
746
|
-
throw new Error("THREE.GLTFLoader: JSON content not found.");
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
class gn {
|
|
750
|
-
constructor(t, e) {
|
|
751
|
-
if (!e)
|
|
752
|
-
throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");
|
|
753
|
-
this.name = E.KHR_DRACO_MESH_COMPRESSION, this.json = t, this.dracoLoader = e, this.dracoLoader.preload();
|
|
754
|
-
}
|
|
755
|
-
decodePrimitive(t, e) {
|
|
756
|
-
const r = this.json, n = this.dracoLoader, i = t.extensions[this.name].bufferView, s = t.extensions[this.name].attributes, a = {}, o = {}, c = {};
|
|
757
|
-
for (const h in s) {
|
|
758
|
-
const u = ge[h] || h.toLowerCase();
|
|
759
|
-
a[u] = s[h];
|
|
760
|
-
}
|
|
761
|
-
for (const h in t.attributes) {
|
|
762
|
-
const u = ge[h] || h.toLowerCase();
|
|
763
|
-
if (s[h] !== void 0) {
|
|
764
|
-
const d = r.accessors[t.attributes[h]], p = Y[d.componentType];
|
|
765
|
-
c[u] = p.name, o[u] = d.normalized === !0;
|
|
766
|
-
}
|
|
767
|
-
}
|
|
768
|
-
return e.getDependency("bufferView", i).then(function(h) {
|
|
769
|
-
return new Promise(function(u, d) {
|
|
770
|
-
n.decodeDracoFile(h, function(p) {
|
|
771
|
-
for (const g in p.attributes) {
|
|
772
|
-
const A = p.attributes[g], m = o[g];
|
|
773
|
-
m !== void 0 && (A.normalized = m);
|
|
774
|
-
}
|
|
775
|
-
u(p);
|
|
776
|
-
}, a, c, v, d);
|
|
777
|
-
});
|
|
778
|
-
});
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
class An {
|
|
782
|
-
constructor() {
|
|
783
|
-
this.name = E.KHR_TEXTURE_TRANSFORM;
|
|
784
|
-
}
|
|
785
|
-
extendTexture(t, e) {
|
|
786
|
-
return (e.texCoord === void 0 || e.texCoord === t.channel) && e.offset === void 0 && e.rotation === void 0 && e.scale === void 0 || (t = t.clone(), e.texCoord !== void 0 && (t.channel = e.texCoord), e.offset !== void 0 && t.offset.fromArray(e.offset), e.rotation !== void 0 && (t.rotation = e.rotation), e.scale !== void 0 && t.repeat.fromArray(e.scale), t.needsUpdate = !0), t;
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
class Tn {
|
|
790
|
-
constructor() {
|
|
791
|
-
this.name = E.KHR_MESH_QUANTIZATION;
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
class qe extends Bt {
|
|
795
|
-
constructor(t, e, r, n) {
|
|
796
|
-
super(t, e, r, n);
|
|
797
|
-
}
|
|
798
|
-
copySampleValue_(t) {
|
|
799
|
-
const e = this.resultBuffer, r = this.sampleValues, n = this.valueSize, i = t * n * 3 + n;
|
|
800
|
-
for (let s = 0; s !== n; s++)
|
|
801
|
-
e[s] = r[i + s];
|
|
802
|
-
return e;
|
|
803
|
-
}
|
|
804
|
-
interpolate_(t, e, r, n) {
|
|
805
|
-
const i = this.resultBuffer, s = this.sampleValues, a = this.valueSize, o = a * 2, c = a * 3, h = n - e, u = (r - e) / h, d = u * u, p = d * u, g = t * c, A = g - c, m = -2 * p + 3 * d, f = p - d, x = 1 - m, M = f - d + u;
|
|
806
|
-
for (let R = 0; R !== a; R++) {
|
|
807
|
-
const y = s[A + R + a], I = s[A + R + o] * h, S = s[g + R + a], P = s[g + R] * h;
|
|
808
|
-
i[R] = x * y + M * I + m * S + f * P;
|
|
809
|
-
}
|
|
810
|
-
return i;
|
|
811
|
-
}
|
|
812
|
-
}
|
|
813
|
-
const En = new Ue();
|
|
814
|
-
class xn extends qe {
|
|
815
|
-
interpolate_(t, e, r, n) {
|
|
816
|
-
const i = super.interpolate_(t, e, r, n);
|
|
817
|
-
return En.fromArray(i).normalize().toArray(i), i;
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
const N = {
|
|
821
|
-
POINTS: 0,
|
|
822
|
-
LINES: 1,
|
|
823
|
-
LINE_LOOP: 2,
|
|
824
|
-
LINE_STRIP: 3,
|
|
825
|
-
TRIANGLES: 4,
|
|
826
|
-
TRIANGLE_STRIP: 5,
|
|
827
|
-
TRIANGLE_FAN: 6
|
|
828
|
-
}, Y = {
|
|
829
|
-
5120: Int8Array,
|
|
830
|
-
5121: Uint8Array,
|
|
831
|
-
5122: Int16Array,
|
|
832
|
-
5123: Uint16Array,
|
|
833
|
-
5125: Uint32Array,
|
|
834
|
-
5126: Float32Array
|
|
835
|
-
}, Oe = {
|
|
836
|
-
9728: Ke,
|
|
837
|
-
9729: pe,
|
|
838
|
-
9984: Tt,
|
|
839
|
-
9985: At,
|
|
840
|
-
9986: gt,
|
|
841
|
-
9987: je
|
|
842
|
-
}, De = {
|
|
843
|
-
33071: xt,
|
|
844
|
-
33648: Et,
|
|
845
|
-
10497: me
|
|
846
|
-
}, ce = {
|
|
847
|
-
SCALAR: 1,
|
|
848
|
-
VEC2: 2,
|
|
849
|
-
VEC3: 3,
|
|
850
|
-
VEC4: 4,
|
|
851
|
-
MAT2: 4,
|
|
852
|
-
MAT3: 9,
|
|
853
|
-
MAT4: 16
|
|
854
|
-
}, ge = {
|
|
855
|
-
POSITION: "position",
|
|
856
|
-
NORMAL: "normal",
|
|
857
|
-
TANGENT: "tangent",
|
|
858
|
-
TEXCOORD_0: "uv",
|
|
859
|
-
TEXCOORD_1: "uv1",
|
|
860
|
-
TEXCOORD_2: "uv2",
|
|
861
|
-
TEXCOORD_3: "uv3",
|
|
862
|
-
COLOR_0: "color",
|
|
863
|
-
WEIGHTS_0: "skinWeight",
|
|
864
|
-
JOINTS_0: "skinIndex"
|
|
865
|
-
}, k = {
|
|
866
|
-
scale: "scale",
|
|
867
|
-
translation: "position",
|
|
868
|
-
rotation: "quaternion",
|
|
869
|
-
weights: "morphTargetInfluences"
|
|
870
|
-
}, Rn = {
|
|
871
|
-
CUBICSPLINE: void 0,
|
|
872
|
-
// We use a custom interpolant (GLTFCubicSplineInterpolation) for CUBICSPLINE tracks. Each
|
|
873
|
-
// keyframe track will be initialized with a default interpolation type, then modified.
|
|
874
|
-
LINEAR: Ye,
|
|
875
|
-
STEP: Ht
|
|
876
|
-
}, le = {
|
|
877
|
-
OPAQUE: "OPAQUE",
|
|
878
|
-
MASK: "MASK",
|
|
879
|
-
BLEND: "BLEND"
|
|
880
|
-
};
|
|
881
|
-
function Mn(l) {
|
|
882
|
-
return l.DefaultMaterial === void 0 && (l.DefaultMaterial = new Xe({
|
|
883
|
-
color: 16777215,
|
|
884
|
-
emissive: 0,
|
|
885
|
-
metalness: 1,
|
|
886
|
-
roughness: 1,
|
|
887
|
-
transparent: !1,
|
|
888
|
-
depthTest: !0,
|
|
889
|
-
side: kt
|
|
890
|
-
})), l.DefaultMaterial;
|
|
891
|
-
}
|
|
892
|
-
function B(l, t, e) {
|
|
893
|
-
for (const r in e.extensions)
|
|
894
|
-
l[r] === void 0 && (t.userData.gltfExtensions = t.userData.gltfExtensions || {}, t.userData.gltfExtensions[r] = e.extensions[r]);
|
|
895
|
-
}
|
|
896
|
-
function O(l, t) {
|
|
897
|
-
t.extras !== void 0 && (typeof t.extras == "object" ? Object.assign(l.userData, t.extras) : console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, " + t.extras));
|
|
898
|
-
}
|
|
899
|
-
function _n(l, t, e) {
|
|
900
|
-
let r = !1, n = !1, i = !1;
|
|
901
|
-
for (let c = 0, h = t.length; c < h; c++) {
|
|
902
|
-
const u = t[c];
|
|
903
|
-
if (u.POSITION !== void 0 && (r = !0), u.NORMAL !== void 0 && (n = !0), u.COLOR_0 !== void 0 && (i = !0), r && n && i) break;
|
|
904
|
-
}
|
|
905
|
-
if (!r && !n && !i) return Promise.resolve(l);
|
|
906
|
-
const s = [], a = [], o = [];
|
|
907
|
-
for (let c = 0, h = t.length; c < h; c++) {
|
|
908
|
-
const u = t[c];
|
|
909
|
-
if (r) {
|
|
910
|
-
const d = u.POSITION !== void 0 ? e.getDependency("accessor", u.POSITION) : l.attributes.position;
|
|
911
|
-
s.push(d);
|
|
912
|
-
}
|
|
913
|
-
if (n) {
|
|
914
|
-
const d = u.NORMAL !== void 0 ? e.getDependency("accessor", u.NORMAL) : l.attributes.normal;
|
|
915
|
-
a.push(d);
|
|
916
|
-
}
|
|
917
|
-
if (i) {
|
|
918
|
-
const d = u.COLOR_0 !== void 0 ? e.getDependency("accessor", u.COLOR_0) : l.attributes.color;
|
|
919
|
-
o.push(d);
|
|
920
|
-
}
|
|
921
|
-
}
|
|
922
|
-
return Promise.all([
|
|
923
|
-
Promise.all(s),
|
|
924
|
-
Promise.all(a),
|
|
925
|
-
Promise.all(o)
|
|
926
|
-
]).then(function(c) {
|
|
927
|
-
const h = c[0], u = c[1], d = c[2];
|
|
928
|
-
return r && (l.morphAttributes.position = h), n && (l.morphAttributes.normal = u), i && (l.morphAttributes.color = d), l.morphTargetsRelative = !0, l;
|
|
929
|
-
});
|
|
930
|
-
}
|
|
931
|
-
function yn(l, t) {
|
|
932
|
-
if (l.updateMorphTargets(), t.weights !== void 0)
|
|
933
|
-
for (let e = 0, r = t.weights.length; e < r; e++)
|
|
934
|
-
l.morphTargetInfluences[e] = t.weights[e];
|
|
935
|
-
if (t.extras && Array.isArray(t.extras.targetNames)) {
|
|
936
|
-
const e = t.extras.targetNames;
|
|
937
|
-
if (l.morphTargetInfluences.length === e.length) {
|
|
938
|
-
l.morphTargetDictionary = {};
|
|
939
|
-
for (let r = 0, n = e.length; r < n; r++)
|
|
940
|
-
l.morphTargetDictionary[e[r]] = r;
|
|
941
|
-
} else
|
|
942
|
-
console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.");
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
function wn(l) {
|
|
946
|
-
let t;
|
|
947
|
-
const e = l.extensions && l.extensions[E.KHR_DRACO_MESH_COMPRESSION];
|
|
948
|
-
if (e ? t = "draco:" + e.bufferView + ":" + e.indices + ":" + ue(e.attributes) : t = l.indices + ":" + ue(l.attributes) + ":" + l.mode, l.targets !== void 0)
|
|
949
|
-
for (let r = 0, n = l.targets.length; r < n; r++)
|
|
950
|
-
t += ":" + ue(l.targets[r]);
|
|
951
|
-
return t;
|
|
952
|
-
}
|
|
953
|
-
function ue(l) {
|
|
954
|
-
let t = "";
|
|
955
|
-
const e = Object.keys(l).sort();
|
|
956
|
-
for (let r = 0, n = e.length; r < n; r++)
|
|
957
|
-
t += e[r] + ":" + l[e[r]] + ";";
|
|
958
|
-
return t;
|
|
959
|
-
}
|
|
960
|
-
function Ae(l) {
|
|
961
|
-
switch (l) {
|
|
962
|
-
case Int8Array:
|
|
963
|
-
return 1 / 127;
|
|
964
|
-
case Uint8Array:
|
|
965
|
-
return 1 / 255;
|
|
966
|
-
case Int16Array:
|
|
967
|
-
return 1 / 32767;
|
|
968
|
-
case Uint16Array:
|
|
969
|
-
return 1 / 65535;
|
|
970
|
-
default:
|
|
971
|
-
throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.");
|
|
972
|
-
}
|
|
973
|
-
}
|
|
974
|
-
function Sn(l) {
|
|
975
|
-
return l.search(/\.jpe?g($|\?)/i) > 0 || l.search(/^data\:image\/jpeg/) === 0 ? "image/jpeg" : l.search(/\.webp($|\?)/i) > 0 || l.search(/^data\:image\/webp/) === 0 ? "image/webp" : l.search(/\.ktx2($|\?)/i) > 0 || l.search(/^data\:image\/ktx2/) === 0 ? "image/ktx2" : "image/png";
|
|
976
|
-
}
|
|
977
|
-
const Ln = new te();
|
|
978
|
-
class bn {
|
|
979
|
-
constructor(t = {}, e = {}) {
|
|
980
|
-
this.json = t, this.extensions = {}, this.plugins = {}, this.options = e, this.cache = new qt(), this.associations = /* @__PURE__ */ new Map(), this.primitiveCache = {}, this.nodeCache = {}, this.meshCache = { refs: {}, uses: {} }, this.cameraCache = { refs: {}, uses: {} }, this.lightCache = { refs: {}, uses: {} }, this.sourceCache = {}, this.textureCache = {}, this.nodeNamesUsed = {};
|
|
981
|
-
let r = !1, n = -1, i = !1, s = -1;
|
|
982
|
-
if (typeof navigator < "u") {
|
|
983
|
-
const a = navigator.userAgent;
|
|
984
|
-
r = /^((?!chrome|android).)*safari/i.test(a) === !0;
|
|
985
|
-
const o = a.match(/Version\/(\d+)/);
|
|
986
|
-
n = r && o ? parseInt(o[1], 10) : -1, i = a.indexOf("Firefox") > -1, s = i ? a.match(/Firefox\/([0-9]+)\./)[1] : -1;
|
|
987
|
-
}
|
|
988
|
-
typeof createImageBitmap > "u" || r && n < 17 || i && s < 98 ? this.textureLoader = new dt(this.options.manager) : this.textureLoader = new ft(this.options.manager), this.textureLoader.setCrossOrigin(this.options.crossOrigin), this.textureLoader.setRequestHeader(this.options.requestHeader), this.fileLoader = new ke(this.options.manager), this.fileLoader.setResponseType("arraybuffer"), this.options.crossOrigin === "use-credentials" && this.fileLoader.setWithCredentials(!0);
|
|
989
|
-
}
|
|
990
|
-
setExtensions(t) {
|
|
991
|
-
this.extensions = t;
|
|
992
|
-
}
|
|
993
|
-
setPlugins(t) {
|
|
994
|
-
this.plugins = t;
|
|
995
|
-
}
|
|
996
|
-
parse(t, e) {
|
|
997
|
-
const r = this, n = this.json, i = this.extensions;
|
|
998
|
-
this.cache.removeAll(), this.nodeCache = {}, this._invokeAll(function(s) {
|
|
999
|
-
return s._markDefs && s._markDefs();
|
|
1000
|
-
}), Promise.all(this._invokeAll(function(s) {
|
|
1001
|
-
return s.beforeRoot && s.beforeRoot();
|
|
1002
|
-
})).then(function() {
|
|
1003
|
-
return Promise.all([
|
|
1004
|
-
r.getDependencies("scene"),
|
|
1005
|
-
r.getDependencies("animation"),
|
|
1006
|
-
r.getDependencies("camera")
|
|
1007
|
-
]);
|
|
1008
|
-
}).then(function(s) {
|
|
1009
|
-
const a = {
|
|
1010
|
-
scene: s[0][n.scene || 0],
|
|
1011
|
-
scenes: s[0],
|
|
1012
|
-
animations: s[1],
|
|
1013
|
-
cameras: s[2],
|
|
1014
|
-
asset: n.asset,
|
|
1015
|
-
parser: r,
|
|
1016
|
-
userData: {}
|
|
1017
|
-
};
|
|
1018
|
-
return B(i, a, n), O(a, n), Promise.all(r._invokeAll(function(o) {
|
|
1019
|
-
return o.afterRoot && o.afterRoot(a);
|
|
1020
|
-
})).then(function() {
|
|
1021
|
-
for (const o of a.scenes)
|
|
1022
|
-
o.updateMatrixWorld();
|
|
1023
|
-
t(a);
|
|
1024
|
-
});
|
|
1025
|
-
}).catch(e);
|
|
1026
|
-
}
|
|
1027
|
-
/**
|
|
1028
|
-
* Marks the special nodes/meshes in json for efficient parse.
|
|
1029
|
-
*/
|
|
1030
|
-
_markDefs() {
|
|
1031
|
-
const t = this.json.nodes || [], e = this.json.skins || [], r = this.json.meshes || [];
|
|
1032
|
-
for (let n = 0, i = e.length; n < i; n++) {
|
|
1033
|
-
const s = e[n].joints;
|
|
1034
|
-
for (let a = 0, o = s.length; a < o; a++)
|
|
1035
|
-
t[s[a]].isBone = !0;
|
|
1036
|
-
}
|
|
1037
|
-
for (let n = 0, i = t.length; n < i; n++) {
|
|
1038
|
-
const s = t[n];
|
|
1039
|
-
s.mesh !== void 0 && (this._addNodeRef(this.meshCache, s.mesh), s.skin !== void 0 && (r[s.mesh].isSkinnedMesh = !0)), s.camera !== void 0 && this._addNodeRef(this.cameraCache, s.camera);
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
/**
|
|
1043
|
-
* Counts references to shared node / Object3D resources. These resources
|
|
1044
|
-
* can be reused, or "instantiated", at multiple nodes in the scene
|
|
1045
|
-
* hierarchy. Mesh, Camera, and Light instances are instantiated and must
|
|
1046
|
-
* be marked. Non-scenegraph resources (like Materials, Geometries, and
|
|
1047
|
-
* Textures) can be reused directly and are not marked here.
|
|
1048
|
-
*
|
|
1049
|
-
* Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
|
|
1050
|
-
*
|
|
1051
|
-
* @param {Object} cache
|
|
1052
|
-
* @param {Object3D} index
|
|
1053
|
-
*/
|
|
1054
|
-
_addNodeRef(t, e) {
|
|
1055
|
-
e !== void 0 && (t.refs[e] === void 0 && (t.refs[e] = t.uses[e] = 0), t.refs[e]++);
|
|
1056
|
-
}
|
|
1057
|
-
/**
|
|
1058
|
-
* Returns a reference to a shared resource, cloning it if necessary.
|
|
1059
|
-
*
|
|
1060
|
-
* @param {Object} cache
|
|
1061
|
-
* @param {Number} index
|
|
1062
|
-
* @param {Object} object
|
|
1063
|
-
* @return {Object}
|
|
1064
|
-
*/
|
|
1065
|
-
_getNodeRef(t, e, r) {
|
|
1066
|
-
if (t.refs[e] <= 1) return r;
|
|
1067
|
-
const n = r.clone(), i = (s, a) => {
|
|
1068
|
-
const o = this.associations.get(s);
|
|
1069
|
-
o != null && this.associations.set(a, o);
|
|
1070
|
-
for (const [c, h] of s.children.entries())
|
|
1071
|
-
i(h, a.children[c]);
|
|
1072
|
-
};
|
|
1073
|
-
return i(r, n), n.name += "_instance_" + t.uses[e]++, n;
|
|
1074
|
-
}
|
|
1075
|
-
_invokeOne(t) {
|
|
1076
|
-
const e = Object.values(this.plugins);
|
|
1077
|
-
e.push(this);
|
|
1078
|
-
for (let r = 0; r < e.length; r++) {
|
|
1079
|
-
const n = t(e[r]);
|
|
1080
|
-
if (n) return n;
|
|
1081
|
-
}
|
|
1082
|
-
return null;
|
|
1083
|
-
}
|
|
1084
|
-
_invokeAll(t) {
|
|
1085
|
-
const e = Object.values(this.plugins);
|
|
1086
|
-
e.unshift(this);
|
|
1087
|
-
const r = [];
|
|
1088
|
-
for (let n = 0; n < e.length; n++) {
|
|
1089
|
-
const i = t(e[n]);
|
|
1090
|
-
i && r.push(i);
|
|
1091
|
-
}
|
|
1092
|
-
return r;
|
|
1093
|
-
}
|
|
1094
|
-
/**
|
|
1095
|
-
* Requests the specified dependency asynchronously, with caching.
|
|
1096
|
-
* @param {string} type
|
|
1097
|
-
* @param {number} index
|
|
1098
|
-
* @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
|
|
1099
|
-
*/
|
|
1100
|
-
getDependency(t, e) {
|
|
1101
|
-
const r = t + ":" + e;
|
|
1102
|
-
let n = this.cache.get(r);
|
|
1103
|
-
if (!n) {
|
|
1104
|
-
switch (t) {
|
|
1105
|
-
case "scene":
|
|
1106
|
-
n = this.loadScene(e);
|
|
1107
|
-
break;
|
|
1108
|
-
case "node":
|
|
1109
|
-
n = this._invokeOne(function(i) {
|
|
1110
|
-
return i.loadNode && i.loadNode(e);
|
|
1111
|
-
});
|
|
1112
|
-
break;
|
|
1113
|
-
case "mesh":
|
|
1114
|
-
n = this._invokeOne(function(i) {
|
|
1115
|
-
return i.loadMesh && i.loadMesh(e);
|
|
1116
|
-
});
|
|
1117
|
-
break;
|
|
1118
|
-
case "accessor":
|
|
1119
|
-
n = this.loadAccessor(e);
|
|
1120
|
-
break;
|
|
1121
|
-
case "bufferView":
|
|
1122
|
-
n = this._invokeOne(function(i) {
|
|
1123
|
-
return i.loadBufferView && i.loadBufferView(e);
|
|
1124
|
-
});
|
|
1125
|
-
break;
|
|
1126
|
-
case "buffer":
|
|
1127
|
-
n = this.loadBuffer(e);
|
|
1128
|
-
break;
|
|
1129
|
-
case "material":
|
|
1130
|
-
n = this._invokeOne(function(i) {
|
|
1131
|
-
return i.loadMaterial && i.loadMaterial(e);
|
|
1132
|
-
});
|
|
1133
|
-
break;
|
|
1134
|
-
case "texture":
|
|
1135
|
-
n = this._invokeOne(function(i) {
|
|
1136
|
-
return i.loadTexture && i.loadTexture(e);
|
|
1137
|
-
});
|
|
1138
|
-
break;
|
|
1139
|
-
case "skin":
|
|
1140
|
-
n = this.loadSkin(e);
|
|
1141
|
-
break;
|
|
1142
|
-
case "animation":
|
|
1143
|
-
n = this._invokeOne(function(i) {
|
|
1144
|
-
return i.loadAnimation && i.loadAnimation(e);
|
|
1145
|
-
});
|
|
1146
|
-
break;
|
|
1147
|
-
case "camera":
|
|
1148
|
-
n = this.loadCamera(e);
|
|
1149
|
-
break;
|
|
1150
|
-
default:
|
|
1151
|
-
if (n = this._invokeOne(function(i) {
|
|
1152
|
-
return i != this && i.getDependency && i.getDependency(t, e);
|
|
1153
|
-
}), !n)
|
|
1154
|
-
throw new Error("Unknown type: " + t);
|
|
1155
|
-
break;
|
|
1156
|
-
}
|
|
1157
|
-
this.cache.add(r, n);
|
|
1158
|
-
}
|
|
1159
|
-
return n;
|
|
1160
|
-
}
|
|
1161
|
-
/**
|
|
1162
|
-
* Requests all dependencies of the specified type asynchronously, with caching.
|
|
1163
|
-
* @param {string} type
|
|
1164
|
-
* @return {Promise<Array<Object>>}
|
|
1165
|
-
*/
|
|
1166
|
-
getDependencies(t) {
|
|
1167
|
-
let e = this.cache.get(t);
|
|
1168
|
-
if (!e) {
|
|
1169
|
-
const r = this, n = this.json[t + (t === "mesh" ? "es" : "s")] || [];
|
|
1170
|
-
e = Promise.all(n.map(function(i, s) {
|
|
1171
|
-
return r.getDependency(t, s);
|
|
1172
|
-
})), this.cache.add(t, e);
|
|
1173
|
-
}
|
|
1174
|
-
return e;
|
|
1175
|
-
}
|
|
1176
|
-
/**
|
|
1177
|
-
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
|
|
1178
|
-
* @param {number} bufferIndex
|
|
1179
|
-
* @return {Promise<ArrayBuffer>}
|
|
1180
|
-
*/
|
|
1181
|
-
loadBuffer(t) {
|
|
1182
|
-
const e = this.json.buffers[t], r = this.fileLoader;
|
|
1183
|
-
if (e.type && e.type !== "arraybuffer")
|
|
1184
|
-
throw new Error("THREE.GLTFLoader: " + e.type + " buffer type is not supported.");
|
|
1185
|
-
if (e.uri === void 0 && t === 0)
|
|
1186
|
-
return Promise.resolve(this.extensions[E.KHR_BINARY_GLTF].body);
|
|
1187
|
-
const n = this.options;
|
|
1188
|
-
return new Promise(function(i, s) {
|
|
1189
|
-
r.load(Z.resolveURL(e.uri, n.path), i, void 0, function() {
|
|
1190
|
-
s(new Error('THREE.GLTFLoader: Failed to load buffer "' + e.uri + '".'));
|
|
1191
|
-
});
|
|
1192
|
-
});
|
|
1193
|
-
}
|
|
1194
|
-
/**
|
|
1195
|
-
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
|
|
1196
|
-
* @param {number} bufferViewIndex
|
|
1197
|
-
* @return {Promise<ArrayBuffer>}
|
|
1198
|
-
*/
|
|
1199
|
-
loadBufferView(t) {
|
|
1200
|
-
const e = this.json.bufferViews[t];
|
|
1201
|
-
return this.getDependency("buffer", e.buffer).then(function(r) {
|
|
1202
|
-
const n = e.byteLength || 0, i = e.byteOffset || 0;
|
|
1203
|
-
return r.slice(i, i + n);
|
|
1204
|
-
});
|
|
1205
|
-
}
|
|
1206
|
-
/**
|
|
1207
|
-
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
|
|
1208
|
-
* @param {number} accessorIndex
|
|
1209
|
-
* @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
|
|
1210
|
-
*/
|
|
1211
|
-
loadAccessor(t) {
|
|
1212
|
-
const e = this, r = this.json, n = this.json.accessors[t];
|
|
1213
|
-
if (n.bufferView === void 0 && n.sparse === void 0) {
|
|
1214
|
-
const s = ce[n.type], a = Y[n.componentType], o = n.normalized === !0, c = new a(n.count * s);
|
|
1215
|
-
return Promise.resolve(new re(c, s, o));
|
|
1216
|
-
}
|
|
1217
|
-
const i = [];
|
|
1218
|
-
return n.bufferView !== void 0 ? i.push(this.getDependency("bufferView", n.bufferView)) : i.push(null), n.sparse !== void 0 && (i.push(this.getDependency("bufferView", n.sparse.indices.bufferView)), i.push(this.getDependency("bufferView", n.sparse.values.bufferView))), Promise.all(i).then(function(s) {
|
|
1219
|
-
const a = s[0], o = ce[n.type], c = Y[n.componentType], h = c.BYTES_PER_ELEMENT, u = h * o, d = n.byteOffset || 0, p = n.bufferView !== void 0 ? r.bufferViews[n.bufferView].byteStride : void 0, g = n.normalized === !0;
|
|
1220
|
-
let A, m;
|
|
1221
|
-
if (p && p !== u) {
|
|
1222
|
-
const f = Math.floor(d / p), x = "InterleavedBuffer:" + n.bufferView + ":" + n.componentType + ":" + f + ":" + n.count;
|
|
1223
|
-
let M = e.cache.get(x);
|
|
1224
|
-
M || (A = new c(a, f * p, n.count * p / h), M = new pt(A, p / h), e.cache.add(x, M)), m = new mt(M, o, d % p / h, g);
|
|
1225
|
-
} else
|
|
1226
|
-
a === null ? A = new c(n.count * o) : A = new c(a, d, n.count * o), m = new re(A, o, g);
|
|
1227
|
-
if (n.sparse !== void 0) {
|
|
1228
|
-
const f = ce.SCALAR, x = Y[n.sparse.indices.componentType], M = n.sparse.indices.byteOffset || 0, R = n.sparse.values.byteOffset || 0, y = new x(s[1], M, n.sparse.count * f), I = new c(s[2], R, n.sparse.count * o);
|
|
1229
|
-
a !== null && (m = new re(m.array.slice(), m.itemSize, m.normalized)), m.normalized = !1;
|
|
1230
|
-
for (let S = 0, P = y.length; S < P; S++) {
|
|
1231
|
-
const L = y[S];
|
|
1232
|
-
if (m.setX(L, I[S * o]), o >= 2 && m.setY(L, I[S * o + 1]), o >= 3 && m.setZ(L, I[S * o + 2]), o >= 4 && m.setW(L, I[S * o + 3]), o >= 5) throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.");
|
|
1233
|
-
}
|
|
1234
|
-
m.normalized = g;
|
|
1235
|
-
}
|
|
1236
|
-
return m;
|
|
1237
|
-
});
|
|
1238
|
-
}
|
|
1239
|
-
/**
|
|
1240
|
-
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
|
|
1241
|
-
* @param {number} textureIndex
|
|
1242
|
-
* @return {Promise<THREE.Texture|null>}
|
|
1243
|
-
*/
|
|
1244
|
-
loadTexture(t) {
|
|
1245
|
-
const e = this.json, r = this.options, i = e.textures[t].source, s = e.images[i];
|
|
1246
|
-
let a = this.textureLoader;
|
|
1247
|
-
if (s.uri) {
|
|
1248
|
-
const o = r.manager.getHandler(s.uri);
|
|
1249
|
-
o !== null && (a = o);
|
|
1250
|
-
}
|
|
1251
|
-
return this.loadTextureImage(t, i, a);
|
|
1252
|
-
}
|
|
1253
|
-
loadTextureImage(t, e, r) {
|
|
1254
|
-
const n = this, i = this.json, s = i.textures[t], a = i.images[e], o = (a.uri || a.bufferView) + ":" + s.sampler;
|
|
1255
|
-
if (this.textureCache[o])
|
|
1256
|
-
return this.textureCache[o];
|
|
1257
|
-
const c = this.loadImageSource(e, r).then(function(h) {
|
|
1258
|
-
h.flipY = !1, h.name = s.name || a.name || "", h.name === "" && typeof a.uri == "string" && a.uri.startsWith("data:image/") === !1 && (h.name = a.uri);
|
|
1259
|
-
const d = (i.samplers || {})[s.sampler] || {};
|
|
1260
|
-
return h.magFilter = Oe[d.magFilter] || pe, h.minFilter = Oe[d.minFilter] || je, h.wrapS = De[d.wrapS] || me, h.wrapT = De[d.wrapT] || me, h.generateMipmaps = !h.isCompressedTexture && h.minFilter !== Ke && h.minFilter !== pe, n.associations.set(h, { textures: t }), h;
|
|
1261
|
-
}).catch(function() {
|
|
1262
|
-
return null;
|
|
1263
|
-
});
|
|
1264
|
-
return this.textureCache[o] = c, c;
|
|
1265
|
-
}
|
|
1266
|
-
loadImageSource(t, e) {
|
|
1267
|
-
const r = this, n = this.json, i = this.options;
|
|
1268
|
-
if (this.sourceCache[t] !== void 0)
|
|
1269
|
-
return this.sourceCache[t].then((u) => u.clone());
|
|
1270
|
-
const s = n.images[t], a = self.URL || self.webkitURL;
|
|
1271
|
-
let o = s.uri || "", c = !1;
|
|
1272
|
-
if (s.bufferView !== void 0)
|
|
1273
|
-
o = r.getDependency("bufferView", s.bufferView).then(function(u) {
|
|
1274
|
-
c = !0;
|
|
1275
|
-
const d = new Blob([u], { type: s.mimeType });
|
|
1276
|
-
return o = a.createObjectURL(d), o;
|
|
1277
|
-
});
|
|
1278
|
-
else if (s.uri === void 0)
|
|
1279
|
-
throw new Error("THREE.GLTFLoader: Image " + t + " is missing URI and bufferView");
|
|
1280
|
-
const h = Promise.resolve(o).then(function(u) {
|
|
1281
|
-
return new Promise(function(d, p) {
|
|
1282
|
-
let g = d;
|
|
1283
|
-
e.isImageBitmapLoader === !0 && (g = function(A) {
|
|
1284
|
-
const m = new Se(A);
|
|
1285
|
-
m.needsUpdate = !0, d(m);
|
|
1286
|
-
}), e.load(Z.resolveURL(u, i.path), g, void 0, p);
|
|
1287
|
-
});
|
|
1288
|
-
}).then(function(u) {
|
|
1289
|
-
return c === !0 && a.revokeObjectURL(o), O(u, s), u.userData.mimeType = s.mimeType || Sn(s.uri), u;
|
|
1290
|
-
}).catch(function(u) {
|
|
1291
|
-
throw console.error("THREE.GLTFLoader: Couldn't load texture", o), u;
|
|
1292
|
-
});
|
|
1293
|
-
return this.sourceCache[t] = h, h;
|
|
1294
|
-
}
|
|
1295
|
-
/**
|
|
1296
|
-
* Asynchronously assigns a texture to the given material parameters.
|
|
1297
|
-
*
|
|
1298
|
-
* @param {Object} materialParams
|
|
1299
|
-
* @param {string} mapName
|
|
1300
|
-
* @param {Object} mapDef
|
|
1301
|
-
* @param {string} colorSpace
|
|
1302
|
-
* @return {Promise<Texture>}
|
|
1303
|
-
*/
|
|
1304
|
-
assignTexture(t, e, r, n) {
|
|
1305
|
-
const i = this;
|
|
1306
|
-
return this.getDependency("texture", r.index).then(function(s) {
|
|
1307
|
-
if (!s) return null;
|
|
1308
|
-
if (r.texCoord !== void 0 && r.texCoord > 0 && (s = s.clone(), s.channel = r.texCoord), i.extensions[E.KHR_TEXTURE_TRANSFORM]) {
|
|
1309
|
-
const a = r.extensions !== void 0 ? r.extensions[E.KHR_TEXTURE_TRANSFORM] : void 0;
|
|
1310
|
-
if (a) {
|
|
1311
|
-
const o = i.associations.get(s);
|
|
1312
|
-
s = i.extensions[E.KHR_TEXTURE_TRANSFORM].extendTexture(s, a), i.associations.set(s, o);
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
return n !== void 0 && (s.colorSpace = n), t[e] = s, s;
|
|
1316
|
-
});
|
|
1317
|
-
}
|
|
1318
|
-
/**
|
|
1319
|
-
* Assigns final material to a Mesh, Line, or Points instance. The instance
|
|
1320
|
-
* already has a material (generated from the glTF material options alone)
|
|
1321
|
-
* but reuse of the same glTF material may require multiple threejs materials
|
|
1322
|
-
* to accommodate different primitive types, defines, etc. New materials will
|
|
1323
|
-
* be created if necessary, and reused from a cache.
|
|
1324
|
-
* @param {Object3D} mesh Mesh, Line, or Points instance.
|
|
1325
|
-
*/
|
|
1326
|
-
assignFinalMaterial(t) {
|
|
1327
|
-
const e = t.geometry;
|
|
1328
|
-
let r = t.material;
|
|
1329
|
-
const n = e.attributes.tangent === void 0, i = e.attributes.color !== void 0, s = e.attributes.normal === void 0;
|
|
1330
|
-
if (t.isPoints) {
|
|
1331
|
-
const a = "PointsMaterial:" + r.uuid;
|
|
1332
|
-
let o = this.cache.get(a);
|
|
1333
|
-
o || (o = new Rt(), ie.prototype.copy.call(o, r), o.color.copy(r.color), o.map = r.map, o.sizeAttenuation = !1, this.cache.add(a, o)), r = o;
|
|
1334
|
-
} else if (t.isLine) {
|
|
1335
|
-
const a = "LineBasicMaterial:" + r.uuid;
|
|
1336
|
-
let o = this.cache.get(a);
|
|
1337
|
-
o || (o = new Mt(), ie.prototype.copy.call(o, r), o.color.copy(r.color), o.map = r.map, this.cache.add(a, o)), r = o;
|
|
1338
|
-
}
|
|
1339
|
-
if (n || i || s) {
|
|
1340
|
-
let a = "ClonedMaterial:" + r.uuid + ":";
|
|
1341
|
-
n && (a += "derivative-tangents:"), i && (a += "vertex-colors:"), s && (a += "flat-shading:");
|
|
1342
|
-
let o = this.cache.get(a);
|
|
1343
|
-
o || (o = r.clone(), i && (o.vertexColors = !0), s && (o.flatShading = !0), n && (o.normalScale && (o.normalScale.y *= -1), o.clearcoatNormalScale && (o.clearcoatNormalScale.y *= -1)), this.cache.add(a, o), this.associations.set(o, this.associations.get(r))), r = o;
|
|
1344
|
-
}
|
|
1345
|
-
t.material = r;
|
|
1346
|
-
}
|
|
1347
|
-
getMaterialType() {
|
|
1348
|
-
return Xe;
|
|
1349
|
-
}
|
|
1350
|
-
/**
|
|
1351
|
-
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
|
|
1352
|
-
* @param {number} materialIndex
|
|
1353
|
-
* @return {Promise<Material>}
|
|
1354
|
-
*/
|
|
1355
|
-
loadMaterial(t) {
|
|
1356
|
-
const e = this, r = this.json, n = this.extensions, i = r.materials[t];
|
|
1357
|
-
let s;
|
|
1358
|
-
const a = {}, o = i.extensions || {}, c = [];
|
|
1359
|
-
if (o[E.KHR_MATERIALS_UNLIT]) {
|
|
1360
|
-
const u = n[E.KHR_MATERIALS_UNLIT];
|
|
1361
|
-
s = u.getMaterialType(), c.push(u.extendParams(a, i, e));
|
|
1362
|
-
} else {
|
|
1363
|
-
const u = i.pbrMetallicRoughness || {};
|
|
1364
|
-
if (a.color = new j(1, 1, 1), a.opacity = 1, Array.isArray(u.baseColorFactor)) {
|
|
1365
|
-
const d = u.baseColorFactor;
|
|
1366
|
-
a.color.setRGB(d[0], d[1], d[2], v), a.opacity = d[3];
|
|
1367
|
-
}
|
|
1368
|
-
u.baseColorTexture !== void 0 && c.push(e.assignTexture(a, "map", u.baseColorTexture, Q)), a.metalness = u.metallicFactor !== void 0 ? u.metallicFactor : 1, a.roughness = u.roughnessFactor !== void 0 ? u.roughnessFactor : 1, u.metallicRoughnessTexture !== void 0 && (c.push(e.assignTexture(a, "metalnessMap", u.metallicRoughnessTexture)), c.push(e.assignTexture(a, "roughnessMap", u.metallicRoughnessTexture))), s = this._invokeOne(function(d) {
|
|
1369
|
-
return d.getMaterialType && d.getMaterialType(t);
|
|
1370
|
-
}), c.push(Promise.all(this._invokeAll(function(d) {
|
|
1371
|
-
return d.extendMaterialParams && d.extendMaterialParams(t, a);
|
|
1372
|
-
})));
|
|
1373
|
-
}
|
|
1374
|
-
i.doubleSided === !0 && (a.side = $);
|
|
1375
|
-
const h = i.alphaMode || le.OPAQUE;
|
|
1376
|
-
if (h === le.BLEND ? (a.transparent = !0, a.depthWrite = !1) : (a.transparent = !1, h === le.MASK && (a.alphaTest = i.alphaCutoff !== void 0 ? i.alphaCutoff : 0.5)), i.normalTexture !== void 0 && s !== q && (c.push(e.assignTexture(a, "normalMap", i.normalTexture)), a.normalScale = new Be(1, 1), i.normalTexture.scale !== void 0)) {
|
|
1377
|
-
const u = i.normalTexture.scale;
|
|
1378
|
-
a.normalScale.set(u, u);
|
|
1379
|
-
}
|
|
1380
|
-
if (i.occlusionTexture !== void 0 && s !== q && (c.push(e.assignTexture(a, "aoMap", i.occlusionTexture)), i.occlusionTexture.strength !== void 0 && (a.aoMapIntensity = i.occlusionTexture.strength)), i.emissiveFactor !== void 0 && s !== q) {
|
|
1381
|
-
const u = i.emissiveFactor;
|
|
1382
|
-
a.emissive = new j().setRGB(u[0], u[1], u[2], v);
|
|
1383
|
-
}
|
|
1384
|
-
return i.emissiveTexture !== void 0 && s !== q && c.push(e.assignTexture(a, "emissiveMap", i.emissiveTexture, Q)), Promise.all(c).then(function() {
|
|
1385
|
-
const u = new s(a);
|
|
1386
|
-
return i.name && (u.name = i.name), O(u, i), e.associations.set(u, { materials: t }), i.extensions && B(n, u, i), u;
|
|
1387
|
-
});
|
|
1388
|
-
}
|
|
1389
|
-
/**
|
|
1390
|
-
* When Object3D instances are targeted by animation, they need unique names.
|
|
1391
|
-
*
|
|
1392
|
-
* @param {String} originalName
|
|
1393
|
-
* @return {String}
|
|
1394
|
-
*/
|
|
1395
|
-
createUniqueName(t) {
|
|
1396
|
-
const e = _t.sanitizeNodeName(t || "");
|
|
1397
|
-
return e in this.nodeNamesUsed ? e + "_" + ++this.nodeNamesUsed[e] : (this.nodeNamesUsed[e] = 0, e);
|
|
1398
|
-
}
|
|
1399
|
-
/**
|
|
1400
|
-
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
|
|
1401
|
-
*
|
|
1402
|
-
* Creates BufferGeometries from primitives.
|
|
1403
|
-
*
|
|
1404
|
-
* @param {Array<GLTF.Primitive>} primitives
|
|
1405
|
-
* @return {Promise<Array<BufferGeometry>>}
|
|
1406
|
-
*/
|
|
1407
|
-
loadGeometries(t) {
|
|
1408
|
-
const e = this, r = this.extensions, n = this.primitiveCache;
|
|
1409
|
-
function i(a) {
|
|
1410
|
-
return r[E.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a, e).then(function(o) {
|
|
1411
|
-
return ve(o, a, e);
|
|
1412
|
-
});
|
|
1413
|
-
}
|
|
1414
|
-
const s = [];
|
|
1415
|
-
for (let a = 0, o = t.length; a < o; a++) {
|
|
1416
|
-
const c = t[a], h = wn(c), u = n[h];
|
|
1417
|
-
if (u)
|
|
1418
|
-
s.push(u.promise);
|
|
1419
|
-
else {
|
|
1420
|
-
let d;
|
|
1421
|
-
c.extensions && c.extensions[E.KHR_DRACO_MESH_COMPRESSION] ? d = i(c) : d = ve(new yt(), c, e), n[h] = { primitive: c, promise: d }, s.push(d);
|
|
1422
|
-
}
|
|
1423
|
-
}
|
|
1424
|
-
return Promise.all(s);
|
|
1425
|
-
}
|
|
1426
|
-
/**
|
|
1427
|
-
* Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
|
|
1428
|
-
* @param {number} meshIndex
|
|
1429
|
-
* @return {Promise<Group|Mesh|SkinnedMesh>}
|
|
1430
|
-
*/
|
|
1431
|
-
loadMesh(t) {
|
|
1432
|
-
const e = this, r = this.json, n = this.extensions, i = r.meshes[t], s = i.primitives, a = [];
|
|
1433
|
-
for (let o = 0, c = s.length; o < c; o++) {
|
|
1434
|
-
const h = s[o].material === void 0 ? Mn(this.cache) : this.getDependency("material", s[o].material);
|
|
1435
|
-
a.push(h);
|
|
1436
|
-
}
|
|
1437
|
-
return a.push(e.loadGeometries(s)), Promise.all(a).then(function(o) {
|
|
1438
|
-
const c = o.slice(0, o.length - 1), h = o[o.length - 1], u = [];
|
|
1439
|
-
for (let p = 0, g = h.length; p < g; p++) {
|
|
1440
|
-
const A = h[p], m = s[p];
|
|
1441
|
-
let f;
|
|
1442
|
-
const x = c[p];
|
|
1443
|
-
if (m.mode === N.TRIANGLES || m.mode === N.TRIANGLE_STRIP || m.mode === N.TRIANGLE_FAN || m.mode === void 0)
|
|
1444
|
-
f = i.isSkinnedMesh === !0 ? new wt(A, x) : new St(A, x), f.isSkinnedMesh === !0 && f.normalizeSkinWeights(), m.mode === N.TRIANGLE_STRIP ? f.geometry = Pe(f.geometry, He) : m.mode === N.TRIANGLE_FAN && (f.geometry = Pe(f.geometry, fe));
|
|
1445
|
-
else if (m.mode === N.LINES)
|
|
1446
|
-
f = new Lt(A, x);
|
|
1447
|
-
else if (m.mode === N.LINE_STRIP)
|
|
1448
|
-
f = new bt(A, x);
|
|
1449
|
-
else if (m.mode === N.LINE_LOOP)
|
|
1450
|
-
f = new It(A, x);
|
|
1451
|
-
else if (m.mode === N.POINTS)
|
|
1452
|
-
f = new Nt(A, x);
|
|
1453
|
-
else
|
|
1454
|
-
throw new Error("THREE.GLTFLoader: Primitive mode unsupported: " + m.mode);
|
|
1455
|
-
Object.keys(f.geometry.morphAttributes).length > 0 && yn(f, i), f.name = e.createUniqueName(i.name || "mesh_" + t), O(f, i), m.extensions && B(n, f, m), e.assignFinalMaterial(f), u.push(f);
|
|
1456
|
-
}
|
|
1457
|
-
for (let p = 0, g = u.length; p < g; p++)
|
|
1458
|
-
e.associations.set(u[p], {
|
|
1459
|
-
meshes: t,
|
|
1460
|
-
primitives: p
|
|
1461
|
-
});
|
|
1462
|
-
if (u.length === 1)
|
|
1463
|
-
return i.extensions && B(n, u[0], i), u[0];
|
|
1464
|
-
const d = new oe();
|
|
1465
|
-
i.extensions && B(n, d, i), e.associations.set(d, { meshes: t });
|
|
1466
|
-
for (let p = 0, g = u.length; p < g; p++)
|
|
1467
|
-
d.add(u[p]);
|
|
1468
|
-
return d;
|
|
1469
|
-
});
|
|
1470
|
-
}
|
|
1471
|
-
/**
|
|
1472
|
-
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
|
|
1473
|
-
* @param {number} cameraIndex
|
|
1474
|
-
* @return {Promise<THREE.Camera>}
|
|
1475
|
-
*/
|
|
1476
|
-
loadCamera(t) {
|
|
1477
|
-
let e;
|
|
1478
|
-
const r = this.json.cameras[t], n = r[r.type];
|
|
1479
|
-
if (!n) {
|
|
1480
|
-
console.warn("THREE.GLTFLoader: Missing camera parameters.");
|
|
1481
|
-
return;
|
|
1482
|
-
}
|
|
1483
|
-
return r.type === "perspective" ? e = new Ct(Pt.radToDeg(n.yfov), n.aspectRatio || 1, n.znear || 1, n.zfar || 2e6) : r.type === "orthographic" && (e = new Ft(-n.xmag, n.xmag, n.ymag, -n.ymag, n.znear, n.zfar)), r.name && (e.name = this.createUniqueName(r.name)), O(e, r), Promise.resolve(e);
|
|
1484
|
-
}
|
|
1485
|
-
/**
|
|
1486
|
-
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
|
|
1487
|
-
* @param {number} skinIndex
|
|
1488
|
-
* @return {Promise<Skeleton>}
|
|
1489
|
-
*/
|
|
1490
|
-
loadSkin(t) {
|
|
1491
|
-
const e = this.json.skins[t], r = [];
|
|
1492
|
-
for (let n = 0, i = e.joints.length; n < i; n++)
|
|
1493
|
-
r.push(this._loadNodeShallow(e.joints[n]));
|
|
1494
|
-
return e.inverseBindMatrices !== void 0 ? r.push(this.getDependency("accessor", e.inverseBindMatrices)) : r.push(null), Promise.all(r).then(function(n) {
|
|
1495
|
-
const i = n.pop(), s = n, a = [], o = [];
|
|
1496
|
-
for (let c = 0, h = s.length; c < h; c++) {
|
|
1497
|
-
const u = s[c];
|
|
1498
|
-
if (u) {
|
|
1499
|
-
a.push(u);
|
|
1500
|
-
const d = new te();
|
|
1501
|
-
i !== null && d.fromArray(i.array, c * 16), o.push(d);
|
|
1502
|
-
} else
|
|
1503
|
-
console.warn('THREE.GLTFLoader: Joint "%s" could not be found.', e.joints[c]);
|
|
1504
|
-
}
|
|
1505
|
-
return new Ot(a, o);
|
|
1506
|
-
});
|
|
1507
|
-
}
|
|
1508
|
-
/**
|
|
1509
|
-
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
|
|
1510
|
-
* @param {number} animationIndex
|
|
1511
|
-
* @return {Promise<AnimationClip>}
|
|
1512
|
-
*/
|
|
1513
|
-
loadAnimation(t) {
|
|
1514
|
-
const e = this.json, r = this, n = e.animations[t], i = n.name ? n.name : "animation_" + t, s = [], a = [], o = [], c = [], h = [];
|
|
1515
|
-
for (let u = 0, d = n.channels.length; u < d; u++) {
|
|
1516
|
-
const p = n.channels[u], g = n.samplers[p.sampler], A = p.target, m = A.node, f = n.parameters !== void 0 ? n.parameters[g.input] : g.input, x = n.parameters !== void 0 ? n.parameters[g.output] : g.output;
|
|
1517
|
-
A.node !== void 0 && (s.push(this.getDependency("node", m)), a.push(this.getDependency("accessor", f)), o.push(this.getDependency("accessor", x)), c.push(g), h.push(A));
|
|
1518
|
-
}
|
|
1519
|
-
return Promise.all([
|
|
1520
|
-
Promise.all(s),
|
|
1521
|
-
Promise.all(a),
|
|
1522
|
-
Promise.all(o),
|
|
1523
|
-
Promise.all(c),
|
|
1524
|
-
Promise.all(h)
|
|
1525
|
-
]).then(function(u) {
|
|
1526
|
-
const d = u[0], p = u[1], g = u[2], A = u[3], m = u[4], f = [];
|
|
1527
|
-
for (let x = 0, M = d.length; x < M; x++) {
|
|
1528
|
-
const R = d[x], y = p[x], I = g[x], S = A[x], P = m[x];
|
|
1529
|
-
if (R === void 0) continue;
|
|
1530
|
-
R.updateMatrix && R.updateMatrix();
|
|
1531
|
-
const L = r._createAnimationTracks(R, y, I, S, P);
|
|
1532
|
-
if (L)
|
|
1533
|
-
for (let F = 0; F < L.length; F++)
|
|
1534
|
-
f.push(L[F]);
|
|
1535
|
-
}
|
|
1536
|
-
return new Dt(i, void 0, f);
|
|
1537
|
-
});
|
|
1538
|
-
}
|
|
1539
|
-
createNodeMesh(t) {
|
|
1540
|
-
const e = this.json, r = this, n = e.nodes[t];
|
|
1541
|
-
return n.mesh === void 0 ? null : r.getDependency("mesh", n.mesh).then(function(i) {
|
|
1542
|
-
const s = r._getNodeRef(r.meshCache, n.mesh, i);
|
|
1543
|
-
return n.weights !== void 0 && s.traverse(function(a) {
|
|
1544
|
-
if (a.isMesh)
|
|
1545
|
-
for (let o = 0, c = n.weights.length; o < c; o++)
|
|
1546
|
-
a.morphTargetInfluences[o] = n.weights[o];
|
|
1547
|
-
}), s;
|
|
1548
|
-
});
|
|
1549
|
-
}
|
|
1550
|
-
/**
|
|
1551
|
-
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
|
|
1552
|
-
* @param {number} nodeIndex
|
|
1553
|
-
* @return {Promise<Object3D>}
|
|
1554
|
-
*/
|
|
1555
|
-
loadNode(t) {
|
|
1556
|
-
const e = this.json, r = this, n = e.nodes[t], i = r._loadNodeShallow(t), s = [], a = n.children || [];
|
|
1557
|
-
for (let c = 0, h = a.length; c < h; c++)
|
|
1558
|
-
s.push(r.getDependency("node", a[c]));
|
|
1559
|
-
const o = n.skin === void 0 ? Promise.resolve(null) : r.getDependency("skin", n.skin);
|
|
1560
|
-
return Promise.all([
|
|
1561
|
-
i,
|
|
1562
|
-
Promise.all(s),
|
|
1563
|
-
o
|
|
1564
|
-
]).then(function(c) {
|
|
1565
|
-
const h = c[0], u = c[1], d = c[2];
|
|
1566
|
-
d !== null && h.traverse(function(p) {
|
|
1567
|
-
p.isSkinnedMesh && p.bind(d, Ln);
|
|
1568
|
-
});
|
|
1569
|
-
for (let p = 0, g = u.length; p < g; p++)
|
|
1570
|
-
h.add(u[p]);
|
|
1571
|
-
return h;
|
|
1572
|
-
});
|
|
1573
|
-
}
|
|
1574
|
-
// ._loadNodeShallow() parses a single node.
|
|
1575
|
-
// skin and child nodes are created and added in .loadNode() (no '_' prefix).
|
|
1576
|
-
_loadNodeShallow(t) {
|
|
1577
|
-
const e = this.json, r = this.extensions, n = this;
|
|
1578
|
-
if (this.nodeCache[t] !== void 0)
|
|
1579
|
-
return this.nodeCache[t];
|
|
1580
|
-
const i = e.nodes[t], s = i.name ? n.createUniqueName(i.name) : "", a = [], o = n._invokeOne(function(c) {
|
|
1581
|
-
return c.createNodeMesh && c.createNodeMesh(t);
|
|
1582
|
-
});
|
|
1583
|
-
return o && a.push(o), i.camera !== void 0 && a.push(n.getDependency("camera", i.camera).then(function(c) {
|
|
1584
|
-
return n._getNodeRef(n.cameraCache, i.camera, c);
|
|
1585
|
-
})), n._invokeAll(function(c) {
|
|
1586
|
-
return c.createNodeAttachment && c.createNodeAttachment(t);
|
|
1587
|
-
}).forEach(function(c) {
|
|
1588
|
-
a.push(c);
|
|
1589
|
-
}), this.nodeCache[t] = Promise.all(a).then(function(c) {
|
|
1590
|
-
let h;
|
|
1591
|
-
if (i.isBone === !0 ? h = new vt() : c.length > 1 ? h = new oe() : c.length === 1 ? h = c[0] : h = new Ge(), h !== c[0])
|
|
1592
|
-
for (let u = 0, d = c.length; u < d; u++)
|
|
1593
|
-
h.add(c[u]);
|
|
1594
|
-
if (i.name && (h.userData.name = i.name, h.name = s), O(h, i), i.extensions && B(r, h, i), i.matrix !== void 0) {
|
|
1595
|
-
const u = new te();
|
|
1596
|
-
u.fromArray(i.matrix), h.applyMatrix4(u);
|
|
1597
|
-
} else
|
|
1598
|
-
i.translation !== void 0 && h.position.fromArray(i.translation), i.rotation !== void 0 && h.quaternion.fromArray(i.rotation), i.scale !== void 0 && h.scale.fromArray(i.scale);
|
|
1599
|
-
return n.associations.has(h) || n.associations.set(h, {}), n.associations.get(h).nodes = t, h;
|
|
1600
|
-
}), this.nodeCache[t];
|
|
1601
|
-
}
|
|
1602
|
-
/**
|
|
1603
|
-
* Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
|
|
1604
|
-
* @param {number} sceneIndex
|
|
1605
|
-
* @return {Promise<Group>}
|
|
1606
|
-
*/
|
|
1607
|
-
loadScene(t) {
|
|
1608
|
-
const e = this.extensions, r = this.json.scenes[t], n = this, i = new oe();
|
|
1609
|
-
r.name && (i.name = n.createUniqueName(r.name)), O(i, r), r.extensions && B(e, i, r);
|
|
1610
|
-
const s = r.nodes || [], a = [];
|
|
1611
|
-
for (let o = 0, c = s.length; o < c; o++)
|
|
1612
|
-
a.push(n.getDependency("node", s[o]));
|
|
1613
|
-
return Promise.all(a).then(function(o) {
|
|
1614
|
-
for (let h = 0, u = o.length; h < u; h++)
|
|
1615
|
-
i.add(o[h]);
|
|
1616
|
-
const c = (h) => {
|
|
1617
|
-
const u = /* @__PURE__ */ new Map();
|
|
1618
|
-
for (const [d, p] of n.associations)
|
|
1619
|
-
(d instanceof ie || d instanceof Se) && u.set(d, p);
|
|
1620
|
-
return h.traverse((d) => {
|
|
1621
|
-
const p = n.associations.get(d);
|
|
1622
|
-
p != null && u.set(d, p);
|
|
1623
|
-
}), u;
|
|
1624
|
-
};
|
|
1625
|
-
return n.associations = c(i), i;
|
|
1626
|
-
});
|
|
1627
|
-
}
|
|
1628
|
-
_createAnimationTracks(t, e, r, n, i) {
|
|
1629
|
-
const s = [], a = t.name ? t.name : t.uuid, o = [];
|
|
1630
|
-
k[i.path] === k.weights ? t.traverse(function(d) {
|
|
1631
|
-
d.morphTargetInfluences && o.push(d.name ? d.name : d.uuid);
|
|
1632
|
-
}) : o.push(a);
|
|
1633
|
-
let c;
|
|
1634
|
-
switch (k[i.path]) {
|
|
1635
|
-
case k.weights:
|
|
1636
|
-
c = be;
|
|
1637
|
-
break;
|
|
1638
|
-
case k.rotation:
|
|
1639
|
-
c = Ie;
|
|
1640
|
-
break;
|
|
1641
|
-
case k.position:
|
|
1642
|
-
case k.scale:
|
|
1643
|
-
c = Le;
|
|
1644
|
-
break;
|
|
1645
|
-
default:
|
|
1646
|
-
switch (r.itemSize) {
|
|
1647
|
-
case 1:
|
|
1648
|
-
c = be;
|
|
1649
|
-
break;
|
|
1650
|
-
case 2:
|
|
1651
|
-
case 3:
|
|
1652
|
-
default:
|
|
1653
|
-
c = Le;
|
|
1654
|
-
break;
|
|
1655
|
-
}
|
|
1656
|
-
break;
|
|
1657
|
-
}
|
|
1658
|
-
const h = n.interpolation !== void 0 ? Rn[n.interpolation] : Ye, u = this._getArrayFromAccessor(r);
|
|
1659
|
-
for (let d = 0, p = o.length; d < p; d++) {
|
|
1660
|
-
const g = new c(
|
|
1661
|
-
o[d] + "." + k[i.path],
|
|
1662
|
-
e.array,
|
|
1663
|
-
u,
|
|
1664
|
-
h
|
|
1665
|
-
);
|
|
1666
|
-
n.interpolation === "CUBICSPLINE" && this._createCubicSplineTrackInterpolant(g), s.push(g);
|
|
1667
|
-
}
|
|
1668
|
-
return s;
|
|
1669
|
-
}
|
|
1670
|
-
_getArrayFromAccessor(t) {
|
|
1671
|
-
let e = t.array;
|
|
1672
|
-
if (t.normalized) {
|
|
1673
|
-
const r = Ae(e.constructor), n = new Float32Array(e.length);
|
|
1674
|
-
for (let i = 0, s = e.length; i < s; i++)
|
|
1675
|
-
n[i] = e[i] * r;
|
|
1676
|
-
e = n;
|
|
1677
|
-
}
|
|
1678
|
-
return e;
|
|
1679
|
-
}
|
|
1680
|
-
_createCubicSplineTrackInterpolant(t) {
|
|
1681
|
-
t.createInterpolant = function(r) {
|
|
1682
|
-
const n = this instanceof Ie ? xn : qe;
|
|
1683
|
-
return new n(this.times, this.values, this.getValueSize() / 3, r);
|
|
1684
|
-
}, t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline = !0;
|
|
1685
|
-
}
|
|
1686
|
-
}
|
|
1687
|
-
function In(l, t, e) {
|
|
1688
|
-
const r = t.attributes, n = new Ut();
|
|
1689
|
-
if (r.POSITION !== void 0) {
|
|
1690
|
-
const a = e.json.accessors[r.POSITION], o = a.min, c = a.max;
|
|
1691
|
-
if (o !== void 0 && c !== void 0) {
|
|
1692
|
-
if (n.set(
|
|
1693
|
-
new U(o[0], o[1], o[2]),
|
|
1694
|
-
new U(c[0], c[1], c[2])
|
|
1695
|
-
), a.normalized) {
|
|
1696
|
-
const h = Ae(Y[a.componentType]);
|
|
1697
|
-
n.min.multiplyScalar(h), n.max.multiplyScalar(h);
|
|
1698
|
-
}
|
|
1699
|
-
} else {
|
|
1700
|
-
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
1701
|
-
return;
|
|
1702
|
-
}
|
|
1703
|
-
} else
|
|
1704
|
-
return;
|
|
1705
|
-
const i = t.targets;
|
|
1706
|
-
if (i !== void 0) {
|
|
1707
|
-
const a = new U(), o = new U();
|
|
1708
|
-
for (let c = 0, h = i.length; c < h; c++) {
|
|
1709
|
-
const u = i[c];
|
|
1710
|
-
if (u.POSITION !== void 0) {
|
|
1711
|
-
const d = e.json.accessors[u.POSITION], p = d.min, g = d.max;
|
|
1712
|
-
if (p !== void 0 && g !== void 0) {
|
|
1713
|
-
if (o.setX(Math.max(Math.abs(p[0]), Math.abs(g[0]))), o.setY(Math.max(Math.abs(p[1]), Math.abs(g[1]))), o.setZ(Math.max(Math.abs(p[2]), Math.abs(g[2]))), d.normalized) {
|
|
1714
|
-
const A = Ae(Y[d.componentType]);
|
|
1715
|
-
o.multiplyScalar(A);
|
|
1716
|
-
}
|
|
1717
|
-
a.max(o);
|
|
1718
|
-
} else
|
|
1719
|
-
console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");
|
|
1720
|
-
}
|
|
1721
|
-
}
|
|
1722
|
-
n.expandByVector(a);
|
|
1723
|
-
}
|
|
1724
|
-
l.boundingBox = n;
|
|
1725
|
-
const s = new Gt();
|
|
1726
|
-
n.getCenter(s.center), s.radius = n.min.distanceTo(n.max) / 2, l.boundingSphere = s;
|
|
1727
|
-
}
|
|
1728
|
-
function ve(l, t, e) {
|
|
1729
|
-
const r = t.attributes, n = [];
|
|
1730
|
-
function i(s, a) {
|
|
1731
|
-
return e.getDependency("accessor", s).then(function(o) {
|
|
1732
|
-
l.setAttribute(a, o);
|
|
1733
|
-
});
|
|
1734
|
-
}
|
|
1735
|
-
for (const s in r) {
|
|
1736
|
-
const a = ge[s] || s.toLowerCase();
|
|
1737
|
-
a in l.attributes || n.push(i(r[s], a));
|
|
1738
|
-
}
|
|
1739
|
-
if (t.indices !== void 0 && !l.index) {
|
|
1740
|
-
const s = e.getDependency("accessor", t.indices).then(function(a) {
|
|
1741
|
-
l.setIndex(a);
|
|
1742
|
-
});
|
|
1743
|
-
n.push(s);
|
|
1744
|
-
}
|
|
1745
|
-
return Ne.workingColorSpace !== v && "COLOR_0" in r && console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${Ne.workingColorSpace}" not supported.`), O(l, t), In(l, t, e), Promise.all(n).then(function() {
|
|
1746
|
-
return t.targets !== void 0 ? _n(l, t.targets, e) : l;
|
|
1747
|
-
});
|
|
1748
|
-
}
|
|
1749
|
-
const ee = [0, 0, -10], G = [0.5, 0.5, 0.5], Ze = 1, he = /* @__PURE__ */ new Map(), Nn = (l) => {
|
|
1750
|
-
const t = he.get(l);
|
|
592
|
+
}, Ie = {}, Et = (e, t) => typeof e == "function" ? e(t) : e ?? Ie, Wt = ({
|
|
593
|
+
maxFaces: e = 2,
|
|
594
|
+
faces: t,
|
|
595
|
+
shareMaterial: r = typeof t != "function",
|
|
596
|
+
maxUpdateFps: a,
|
|
597
|
+
holdMs: n,
|
|
598
|
+
predictMs: s,
|
|
599
|
+
renderOrder: l = oe
|
|
600
|
+
}) => {
|
|
601
|
+
const i = typeof t == "function" ? Ie : t, { designTexture: c, lowerDesignTexture: d, material: h, sharedMaterial: u, ...g } = i, E = Me(g), x = Ae(c, d), M = Ee() ?? null, f = Se(), o = D(
|
|
602
|
+
() => f ? ie(f) : W,
|
|
603
|
+
[f]
|
|
604
|
+
), T = Le({
|
|
605
|
+
cameraTexture: M,
|
|
606
|
+
...x,
|
|
607
|
+
settings: E,
|
|
608
|
+
lipUvBounds: o,
|
|
609
|
+
subtractMouth: Ce(E.maskMode)
|
|
610
|
+
}), v = u ?? (r && !h ? T : void 0), A = Math.max(0, Math.round(e));
|
|
611
|
+
return /* @__PURE__ */ p(te, { children: Array.from({ length: A }, (C, L) => {
|
|
612
|
+
const y = Et(t, L);
|
|
613
|
+
return y ? /* @__PURE__ */ p(
|
|
614
|
+
vt,
|
|
615
|
+
{
|
|
616
|
+
...y,
|
|
617
|
+
faceIndex: L,
|
|
618
|
+
sharedMaterial: y.sharedMaterial ?? v,
|
|
619
|
+
maxUpdateFps: y.maxUpdateFps ?? a,
|
|
620
|
+
holdMs: y.holdMs ?? n,
|
|
621
|
+
predictMs: y.predictMs ?? s,
|
|
622
|
+
renderOrder: y.renderOrder ?? l
|
|
623
|
+
},
|
|
624
|
+
L
|
|
625
|
+
) : null;
|
|
626
|
+
}) });
|
|
627
|
+
}, X = [0, 0, -10], V = [0.5, 0.5, 0.5], Pe = 1, J = /* @__PURE__ */ new Map(), xt = (e) => {
|
|
628
|
+
const t = J.get(e);
|
|
1751
629
|
if (t) return t;
|
|
1752
|
-
const
|
|
1753
|
-
(n) => new Promise((
|
|
1754
|
-
|
|
630
|
+
const r = new qe(), a = Xe(e).then(
|
|
631
|
+
(n) => new Promise((s, l) => {
|
|
632
|
+
r.parse(n, "", s, l);
|
|
1755
633
|
})
|
|
1756
634
|
).catch((n) => {
|
|
1757
|
-
throw
|
|
635
|
+
throw J.delete(e), n;
|
|
1758
636
|
});
|
|
1759
|
-
return
|
|
1760
|
-
},
|
|
1761
|
-
position:
|
|
637
|
+
return J.set(e, a), a;
|
|
638
|
+
}, Re = ({
|
|
639
|
+
position: e,
|
|
1762
640
|
rotation: t,
|
|
1763
|
-
scale:
|
|
1764
|
-
url:
|
|
641
|
+
scale: r,
|
|
642
|
+
url: a,
|
|
1765
643
|
showDebugMaterial: n = !1,
|
|
1766
|
-
opacity:
|
|
644
|
+
opacity: s = Pe
|
|
1767
645
|
}) => {
|
|
1768
|
-
const
|
|
1769
|
-
|
|
646
|
+
const l = a ?? new URL("/assets/xr/3d-models/head-occluder-v2.glb", de.assetStorageEndpoint).toString(), [i, c] = ve(null);
|
|
647
|
+
N(() => {
|
|
1770
648
|
let h = !1;
|
|
1771
|
-
return
|
|
1772
|
-
h ||
|
|
649
|
+
return xt(l).then((u) => {
|
|
650
|
+
h || c(u.scene);
|
|
1773
651
|
}).catch((u) => {
|
|
1774
|
-
h || console.error(`${
|
|
652
|
+
h || console.error(`${de.loggerPrefix} head occluder load failed`, u);
|
|
1775
653
|
}), () => {
|
|
1776
654
|
h = !0;
|
|
1777
655
|
};
|
|
1778
|
-
}, [
|
|
1779
|
-
const
|
|
1780
|
-
if (!
|
|
1781
|
-
const h =
|
|
656
|
+
}, [l]);
|
|
657
|
+
const d = D(() => {
|
|
658
|
+
if (!i) return null;
|
|
659
|
+
const h = i.clone();
|
|
1782
660
|
return h.traverse((u) => {
|
|
1783
|
-
u instanceof
|
|
661
|
+
u instanceof m.Mesh && (u.material = new m.MeshStandardMaterial({
|
|
1784
662
|
color: 15132390,
|
|
1785
663
|
colorWrite: n,
|
|
1786
664
|
depthWrite: !0,
|
|
1787
|
-
opacity: n ?
|
|
1788
|
-
side:
|
|
665
|
+
opacity: n ? s : 1,
|
|
666
|
+
side: m.DoubleSide,
|
|
1789
667
|
transparent: n
|
|
1790
668
|
}));
|
|
1791
669
|
}), h;
|
|
1792
|
-
}, [
|
|
1793
|
-
return
|
|
1794
|
-
if (
|
|
670
|
+
}, [i, n, s]);
|
|
671
|
+
return N(() => {
|
|
672
|
+
if (d)
|
|
1795
673
|
return () => {
|
|
1796
|
-
|
|
1797
|
-
h instanceof
|
|
674
|
+
d.traverse((h) => {
|
|
675
|
+
h instanceof m.Mesh && h.material.dispose();
|
|
1798
676
|
});
|
|
1799
677
|
};
|
|
1800
|
-
}, [
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
), t &&
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
),
|
|
1809
|
-
},
|
|
1810
|
-
children:
|
|
678
|
+
}, [d]), d ? (e ? d.position.set(e[0], e[1], e[2]) : d.position.set(
|
|
679
|
+
X[0],
|
|
680
|
+
X[1],
|
|
681
|
+
X[2]
|
|
682
|
+
), t && d.rotation.set(t[0], t[1], t[2]), r ? d.scale.set(r[0], r[1], r[2]) : d.scale.set(
|
|
683
|
+
V[0],
|
|
684
|
+
V[1],
|
|
685
|
+
V[2]
|
|
686
|
+
), d.renderOrder = -1, /* @__PURE__ */ p("primitive", { object: d })) : null;
|
|
687
|
+
}, Mt = 4, zt = ({
|
|
688
|
+
children: e,
|
|
1811
689
|
faceIndex: t = 0,
|
|
1812
|
-
numFaces:
|
|
1813
|
-
scaleWithFace:
|
|
690
|
+
numFaces: r = Mt,
|
|
691
|
+
scaleWithFace: a = !0,
|
|
1814
692
|
occluder: n = !0,
|
|
1815
|
-
showFaceMesh:
|
|
1816
|
-
faceMeshMaterial:
|
|
693
|
+
showFaceMesh: s = !1,
|
|
694
|
+
faceMeshMaterial: l
|
|
1817
695
|
}) => {
|
|
1818
|
-
const
|
|
1819
|
-
() => new
|
|
696
|
+
const i = D(
|
|
697
|
+
() => new m.MeshBasicMaterial({
|
|
1820
698
|
color: "#22c55e",
|
|
1821
|
-
side:
|
|
699
|
+
side: m.BackSide,
|
|
1822
700
|
transparent: !0,
|
|
1823
701
|
opacity: 0.35,
|
|
1824
702
|
depthWrite: !1
|
|
1825
703
|
}),
|
|
1826
704
|
[]
|
|
1827
|
-
),
|
|
1828
|
-
return /* @__PURE__ */
|
|
1829
|
-
|
|
1830
|
-
|
|
705
|
+
), c = n === !1 ? null : n === !0 ? {} : n;
|
|
706
|
+
return /* @__PURE__ */ F(Ze, { faceIndex: t, numFaces: r, scaleWithFace: a, children: [
|
|
707
|
+
c && /* @__PURE__ */ p(
|
|
708
|
+
Re,
|
|
1831
709
|
{
|
|
1832
|
-
position:
|
|
1833
|
-
rotation:
|
|
1834
|
-
scale:
|
|
1835
|
-
url:
|
|
1836
|
-
showDebugMaterial:
|
|
1837
|
-
opacity:
|
|
710
|
+
position: c.position ?? X,
|
|
711
|
+
rotation: c.rotation,
|
|
712
|
+
scale: c.scale ?? V,
|
|
713
|
+
url: c.url,
|
|
714
|
+
showDebugMaterial: c.showDebugMaterial,
|
|
715
|
+
opacity: c.opacity ?? Pe
|
|
1838
716
|
}
|
|
1839
717
|
),
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
718
|
+
e,
|
|
719
|
+
s && /* @__PURE__ */ p(
|
|
720
|
+
Ke,
|
|
1843
721
|
{
|
|
1844
722
|
faceIndex: t,
|
|
1845
|
-
numFaces:
|
|
1846
|
-
material:
|
|
723
|
+
numFaces: r,
|
|
724
|
+
material: l ?? i
|
|
1847
725
|
}
|
|
1848
726
|
)
|
|
1849
727
|
] });
|
|
1850
|
-
},
|
|
1851
|
-
eyeMidX:
|
|
728
|
+
}, yt = 57, St = 15.5, ee = yt / Math.PI / St, wt = -0.134, Tt = -0.024, b = (e, t, r) => Math.min(r, Math.max(t, e)), Ue = (e, t) => e * t - t / 2, De = (e, t) => -(e * t - t / 2), _t = ({
|
|
729
|
+
eyeMidX: e,
|
|
1852
730
|
noseX: t,
|
|
1853
|
-
offsetX:
|
|
1854
|
-
rawYaw:
|
|
731
|
+
offsetX: r,
|
|
732
|
+
rawYaw: a,
|
|
1855
733
|
sideMidX: n
|
|
1856
734
|
}) => {
|
|
1857
|
-
const
|
|
1858
|
-
return
|
|
1859
|
-
},
|
|
1860
|
-
baseScale:
|
|
735
|
+
const s = b((Math.abs(a) - 0.18) / 0.42, 0, 1), l = n * 0.75 + e * 0.25, i = e * 0.7 + t * 0.3;
|
|
736
|
+
return l * (1 - s) + i * s + r;
|
|
737
|
+
}, jt = ({
|
|
738
|
+
baseScale: e,
|
|
1861
739
|
pitchRadians: t
|
|
1862
740
|
}) => {
|
|
1863
|
-
const
|
|
1864
|
-
return [
|
|
1865
|
-
},
|
|
1866
|
-
const t = Math.abs(
|
|
1867
|
-
return Math.sign(
|
|
1868
|
-
},
|
|
1869
|
-
pitchRadians:
|
|
741
|
+
const r = t * 180 / Math.PI, n = 1 + b((r - 6) / 22, 0, 1) * 0.22;
|
|
742
|
+
return [e[0] * n, e[1] * n, e[2] * n];
|
|
743
|
+
}, Zt = ({ yawRadians: e }) => {
|
|
744
|
+
const t = Math.abs(e * 180 / Math.PI), a = 0.066 * b((t - 8) / 12, 0, 1);
|
|
745
|
+
return Math.sign(e) * a;
|
|
746
|
+
}, Kt = ({
|
|
747
|
+
pitchRadians: e
|
|
1870
748
|
}) => {
|
|
1871
|
-
const t =
|
|
1872
|
-
return -0.026 *
|
|
1873
|
-
},
|
|
1874
|
-
baseOffset:
|
|
749
|
+
const t = e * 180 / Math.PI;
|
|
750
|
+
return -0.026 * b((-t - 6) / 18, 0, 1);
|
|
751
|
+
}, qt = ({
|
|
752
|
+
baseOffset: e,
|
|
1875
753
|
yawRadians: t
|
|
1876
754
|
}) => {
|
|
1877
|
-
const
|
|
1878
|
-
return
|
|
1879
|
-
},
|
|
1880
|
-
baseOffsetY:
|
|
755
|
+
const r = Math.abs(t * 180 / Math.PI), a = b((r - 8) / 24, 0, 1);
|
|
756
|
+
return e + a * 0.25;
|
|
757
|
+
}, Qt = ({
|
|
758
|
+
baseOffsetY: e,
|
|
1881
759
|
baseScaleY: t,
|
|
1882
|
-
face:
|
|
760
|
+
face: r
|
|
1883
761
|
}) => {
|
|
1884
|
-
if (!
|
|
762
|
+
if (!r || r.bounds.width <= 0)
|
|
1885
763
|
return {
|
|
1886
764
|
aspectRatio: 0,
|
|
1887
765
|
normalizedAspect: 0,
|
|
1888
766
|
scaleY: t,
|
|
1889
|
-
offsetY:
|
|
767
|
+
offsetY: e
|
|
1890
768
|
};
|
|
1891
|
-
const
|
|
769
|
+
const a = r.bounds.height / r.bounds.width, n = b((a - 1.55) / 0.35, -1, 1);
|
|
1892
770
|
return {
|
|
1893
|
-
aspectRatio:
|
|
771
|
+
aspectRatio: a,
|
|
1894
772
|
normalizedAspect: n,
|
|
1895
773
|
scaleY: t + n * 0.06,
|
|
1896
|
-
offsetY:
|
|
774
|
+
offsetY: e + n * 5e-3
|
|
1897
775
|
};
|
|
1898
|
-
},
|
|
1899
|
-
face:
|
|
776
|
+
}, Ft = ({
|
|
777
|
+
face: e,
|
|
1900
778
|
offsetX: t,
|
|
1901
|
-
offsetY:
|
|
1902
|
-
scaleX:
|
|
779
|
+
offsetY: r,
|
|
780
|
+
scaleX: a,
|
|
1903
781
|
scaleY: n
|
|
1904
782
|
}) => {
|
|
1905
|
-
const
|
|
783
|
+
const s = e.bounds.width * a, l = e.bounds.height * n, i = e.bounds.centerX + t, c = e.bounds.centerY + r;
|
|
1906
784
|
return {
|
|
1907
|
-
x:
|
|
1908
|
-
y:
|
|
1909
|
-
width:
|
|
1910
|
-
height:
|
|
1911
|
-
centerX:
|
|
1912
|
-
centerY:
|
|
785
|
+
x: i - s * 0.5,
|
|
786
|
+
y: c - l * 0.5,
|
|
787
|
+
width: s,
|
|
788
|
+
height: l,
|
|
789
|
+
centerX: i,
|
|
790
|
+
centerY: c
|
|
1913
791
|
};
|
|
1914
|
-
},
|
|
1915
|
-
face:
|
|
792
|
+
}, Lt = ({
|
|
793
|
+
face: e,
|
|
1916
794
|
height: t,
|
|
1917
|
-
lockDepth:
|
|
1918
|
-
lockRotation:
|
|
795
|
+
lockDepth: r,
|
|
796
|
+
lockRotation: a,
|
|
1919
797
|
model: n,
|
|
1920
|
-
offsetX:
|
|
1921
|
-
offsetY:
|
|
1922
|
-
scaleX:
|
|
1923
|
-
scaleY:
|
|
1924
|
-
scaleZ:
|
|
798
|
+
offsetX: s,
|
|
799
|
+
offsetY: l,
|
|
800
|
+
scaleX: i,
|
|
801
|
+
scaleY: c,
|
|
802
|
+
scaleZ: d,
|
|
1925
803
|
width: h
|
|
1926
804
|
}) => {
|
|
1927
|
-
const u =
|
|
1928
|
-
face:
|
|
1929
|
-
offsetX:
|
|
1930
|
-
offsetY:
|
|
1931
|
-
scaleX:
|
|
1932
|
-
scaleY:
|
|
1933
|
-
}),
|
|
1934
|
-
eyeMidX:
|
|
1935
|
-
noseX: (
|
|
1936
|
-
offsetX:
|
|
1937
|
-
rawYaw:
|
|
1938
|
-
sideMidX:
|
|
1939
|
-
}),
|
|
1940
|
-
(
|
|
805
|
+
const u = Ft({
|
|
806
|
+
face: e,
|
|
807
|
+
offsetX: s,
|
|
808
|
+
offsetY: l,
|
|
809
|
+
scaleX: i,
|
|
810
|
+
scaleY: c
|
|
811
|
+
}), g = e.landmarks[33], E = e.landmarks[263], x = e.landmarks[234], M = e.landmarks[454], f = e.landmarks[1], o = e.landmarks[10], T = e.landmarks[152], v = u.width * h, A = u.height * t, C = g && E ? (g.x + E.x) * 0.5 : e.bounds.centerX, L = g && E ? (g.y + E.y) * 0.5 : e.bounds.centerY - e.bounds.height * 0.15, y = x && M ? (x.x + M.x) * 0.5 : C, I = (o == null ? void 0 : o.y) ?? e.bounds.minY, w = (T == null ? void 0 : T.y) ?? e.bounds.maxY, O = (I + w) * 0.5, P = g && E ? Math.atan2(E.y - g.y, E.x - g.x) : 0, R = f && e.bounds.width > 0 ? b((f.x - e.bounds.centerX) / (e.bounds.width * 0.5), -1, 1) * 0.75 : 0, U = _t({
|
|
812
|
+
eyeMidX: C,
|
|
813
|
+
noseX: (f == null ? void 0 : f.x) ?? C,
|
|
814
|
+
offsetX: s,
|
|
815
|
+
rawYaw: R,
|
|
816
|
+
sideMidX: y
|
|
817
|
+
}), S = O * 0.75 + L * 0.25 + l, Y = n === "v2" ? Ue(U, h) : u.centerX * h - h / 2, $ = n === "v2" ? De(e.bounds.centerY + l * 0.75, t) : -(u.centerY * t - t / 2), B = o && f ? Math.max(1e-4, f.y - o.y) : e.bounds.height * 0.42, ae = f && T ? Math.max(1e-4, T.y - f.y) : e.bounds.height * 0.58, se = (ae - B) / (ae + B), ce = b((se - wt) / 0.28, -1, 1) * 0.58, le = f && e.bounds.height > 0 ? b(
|
|
818
|
+
(e.bounds.centerY - f.y) / (e.bounds.height * 0.5) - Tt,
|
|
1941
819
|
-1,
|
|
1942
820
|
1
|
|
1943
|
-
) * 0.18 : 0,
|
|
821
|
+
) * 0.18 : 0, z = ce * 0.82 + le * 0.18, ue = a ? 0 : n === "v2" ? R * 0.72 : R, Oe = a ? 0 : n === "v2" ? -z * 0.78 : -z, Ne = a ? 0 : -P, Ge = r ? v * ee : n === "v2" ? v * (ee + Math.abs(ue) * 0.18) : v * ee;
|
|
1944
822
|
return {
|
|
1945
|
-
centerXPx:
|
|
1946
|
-
centerYPx:
|
|
1947
|
-
depthPx:
|
|
1948
|
-
heightPx:
|
|
1949
|
-
pitch:
|
|
1950
|
-
rawPitch:
|
|
1951
|
-
rawPitchFromBalance:
|
|
1952
|
-
rawPitchFromCenter:
|
|
1953
|
-
rawYaw:
|
|
1954
|
-
rotationZ:
|
|
1955
|
-
roll:
|
|
823
|
+
centerXPx: Y,
|
|
824
|
+
centerYPx: $,
|
|
825
|
+
depthPx: Ge * d,
|
|
826
|
+
heightPx: A,
|
|
827
|
+
pitch: Oe,
|
|
828
|
+
rawPitch: z,
|
|
829
|
+
rawPitchFromBalance: ce,
|
|
830
|
+
rawPitchFromCenter: le,
|
|
831
|
+
rawYaw: R,
|
|
832
|
+
rotationZ: Ne,
|
|
833
|
+
roll: P,
|
|
1956
834
|
shape: u,
|
|
1957
|
-
skullAnchorX:
|
|
1958
|
-
skullAnchorY:
|
|
1959
|
-
verticalBalance:
|
|
1960
|
-
widthPx:
|
|
1961
|
-
yaw:
|
|
835
|
+
skullAnchorX: U,
|
|
836
|
+
skullAnchorY: S,
|
|
837
|
+
verticalBalance: se,
|
|
838
|
+
widthPx: v,
|
|
839
|
+
yaw: ue
|
|
1962
840
|
};
|
|
1963
|
-
},
|
|
1964
|
-
lockDepth:
|
|
841
|
+
}, At = ({
|
|
842
|
+
lockDepth: e,
|
|
1965
843
|
lockRotation: t,
|
|
1966
|
-
model:
|
|
1967
|
-
face:
|
|
844
|
+
model: r,
|
|
845
|
+
face: a,
|
|
1968
846
|
height: n,
|
|
1969
|
-
headDepthOffset:
|
|
1970
|
-
offsetX:
|
|
1971
|
-
offsetY:
|
|
1972
|
-
rotationOffsetX:
|
|
1973
|
-
rotationOffsetY:
|
|
847
|
+
headDepthOffset: s,
|
|
848
|
+
offsetX: l,
|
|
849
|
+
offsetY: i,
|
|
850
|
+
rotationOffsetX: c,
|
|
851
|
+
rotationOffsetY: d,
|
|
1974
852
|
rotationOffsetZ: h,
|
|
1975
853
|
scaleX: u,
|
|
1976
|
-
scaleY:
|
|
1977
|
-
scaleZ:
|
|
1978
|
-
skullCenterMode:
|
|
1979
|
-
skullVerticalBias:
|
|
1980
|
-
width:
|
|
1981
|
-
}) =>
|
|
1982
|
-
lockDepth:
|
|
854
|
+
scaleY: g,
|
|
855
|
+
scaleZ: E,
|
|
856
|
+
skullCenterMode: x,
|
|
857
|
+
skullVerticalBias: M,
|
|
858
|
+
width: f
|
|
859
|
+
}) => be({
|
|
860
|
+
lockDepth: e,
|
|
1983
861
|
lockRotation: t,
|
|
1984
|
-
model:
|
|
1985
|
-
face:
|
|
862
|
+
model: r,
|
|
863
|
+
face: a,
|
|
1986
864
|
height: n,
|
|
1987
|
-
headDepthOffset:
|
|
1988
|
-
offsetX:
|
|
1989
|
-
offsetY:
|
|
1990
|
-
rotationOffsetX:
|
|
1991
|
-
rotationOffsetY:
|
|
865
|
+
headDepthOffset: s,
|
|
866
|
+
offsetX: l,
|
|
867
|
+
offsetY: i,
|
|
868
|
+
rotationOffsetX: c,
|
|
869
|
+
rotationOffsetY: d,
|
|
1992
870
|
rotationOffsetZ: h,
|
|
1993
871
|
scaleX: u,
|
|
1994
|
-
scaleY:
|
|
1995
|
-
scaleZ:
|
|
1996
|
-
skullCenterMode:
|
|
1997
|
-
skullVerticalBias:
|
|
1998
|
-
width:
|
|
1999
|
-
}).pose,
|
|
2000
|
-
lockDepth:
|
|
872
|
+
scaleY: g,
|
|
873
|
+
scaleZ: E,
|
|
874
|
+
skullCenterMode: x,
|
|
875
|
+
skullVerticalBias: M,
|
|
876
|
+
width: f
|
|
877
|
+
}).pose, be = ({
|
|
878
|
+
lockDepth: e,
|
|
2001
879
|
lockRotation: t,
|
|
2002
|
-
model:
|
|
2003
|
-
face:
|
|
880
|
+
model: r,
|
|
881
|
+
face: a,
|
|
2004
882
|
height: n,
|
|
2005
|
-
headDepthOffset:
|
|
2006
|
-
offsetX:
|
|
2007
|
-
offsetY:
|
|
2008
|
-
rotationOffsetX:
|
|
2009
|
-
rotationOffsetY:
|
|
883
|
+
headDepthOffset: s,
|
|
884
|
+
offsetX: l,
|
|
885
|
+
offsetY: i,
|
|
886
|
+
rotationOffsetX: c,
|
|
887
|
+
rotationOffsetY: d,
|
|
2010
888
|
rotationOffsetZ: h,
|
|
2011
889
|
scaleX: u,
|
|
2012
|
-
scaleY:
|
|
2013
|
-
scaleZ:
|
|
2014
|
-
skullCenterMode:
|
|
2015
|
-
skullVerticalBias:
|
|
2016
|
-
width:
|
|
890
|
+
scaleY: g,
|
|
891
|
+
scaleZ: E,
|
|
892
|
+
skullCenterMode: x,
|
|
893
|
+
skullVerticalBias: M,
|
|
894
|
+
width: f
|
|
2017
895
|
}) => {
|
|
2018
|
-
const
|
|
2019
|
-
face:
|
|
896
|
+
const o = Lt({
|
|
897
|
+
face: a,
|
|
2020
898
|
height: n,
|
|
2021
|
-
lockDepth:
|
|
899
|
+
lockDepth: e,
|
|
2022
900
|
lockRotation: t,
|
|
2023
|
-
model:
|
|
2024
|
-
offsetX:
|
|
2025
|
-
offsetY:
|
|
901
|
+
model: r,
|
|
902
|
+
offsetX: l,
|
|
903
|
+
offsetY: i,
|
|
2026
904
|
scaleX: u,
|
|
2027
|
-
scaleY:
|
|
2028
|
-
scaleZ:
|
|
2029
|
-
width:
|
|
905
|
+
scaleY: g,
|
|
906
|
+
scaleZ: E,
|
|
907
|
+
width: f
|
|
2030
908
|
});
|
|
2031
|
-
if (
|
|
2032
|
-
const
|
|
909
|
+
if (x) {
|
|
910
|
+
const v = new Ye(
|
|
2033
911
|
0,
|
|
2034
|
-
|
|
2035
|
-
-
|
|
912
|
+
o.heightPx * M,
|
|
913
|
+
-o.depthPx * s
|
|
2036
914
|
).applyEuler(
|
|
2037
|
-
new
|
|
2038
|
-
),
|
|
915
|
+
new $e(o.pitch, o.yaw, o.rotationZ, "XYZ")
|
|
916
|
+
), A = Ue(o.skullAnchorX, f), C = De(o.skullAnchorY, n);
|
|
2039
917
|
return {
|
|
2040
918
|
pose: {
|
|
2041
|
-
boxCenterZ:
|
|
2042
|
-
centerX:
|
|
2043
|
-
centerY:
|
|
2044
|
-
width:
|
|
2045
|
-
height:
|
|
2046
|
-
depth:
|
|
2047
|
-
rotationX:
|
|
2048
|
-
rotationY:
|
|
2049
|
-
rotationZ:
|
|
919
|
+
boxCenterZ: v.z,
|
|
920
|
+
centerX: A + v.x,
|
|
921
|
+
centerY: C + v.y,
|
|
922
|
+
width: o.widthPx,
|
|
923
|
+
height: o.heightPx,
|
|
924
|
+
depth: o.depthPx,
|
|
925
|
+
rotationX: o.pitch + c,
|
|
926
|
+
rotationY: o.yaw + d,
|
|
927
|
+
rotationZ: o.rotationZ + h
|
|
2050
928
|
},
|
|
2051
929
|
debugMetrics: {
|
|
2052
930
|
face: {
|
|
2053
|
-
centerX:
|
|
2054
|
-
centerY:
|
|
2055
|
-
width:
|
|
2056
|
-
height:
|
|
931
|
+
centerX: o.shape.centerX,
|
|
932
|
+
centerY: o.shape.centerY,
|
|
933
|
+
width: o.shape.width,
|
|
934
|
+
height: o.shape.height
|
|
2057
935
|
},
|
|
2058
936
|
normalized: {
|
|
2059
|
-
rawPitch:
|
|
2060
|
-
rawPitchFromBalance:
|
|
2061
|
-
rawPitchFromCenter:
|
|
2062
|
-
rawYaw:
|
|
2063
|
-
roll:
|
|
2064
|
-
verticalBalance:
|
|
937
|
+
rawPitch: o.rawPitch,
|
|
938
|
+
rawPitchFromBalance: o.rawPitchFromBalance,
|
|
939
|
+
rawPitchFromCenter: o.rawPitchFromCenter,
|
|
940
|
+
rawYaw: o.rawYaw,
|
|
941
|
+
roll: o.roll,
|
|
942
|
+
verticalBalance: o.verticalBalance
|
|
2065
943
|
},
|
|
2066
944
|
pose: {
|
|
2067
|
-
pitch:
|
|
2068
|
-
yaw:
|
|
2069
|
-
rotationX:
|
|
2070
|
-
rotationY:
|
|
2071
|
-
rotationZ:
|
|
945
|
+
pitch: o.pitch,
|
|
946
|
+
yaw: o.yaw,
|
|
947
|
+
rotationX: o.pitch + c,
|
|
948
|
+
rotationY: o.yaw + d,
|
|
949
|
+
rotationZ: o.rotationZ + h
|
|
2072
950
|
},
|
|
2073
951
|
skullAnchor: {
|
|
2074
|
-
x:
|
|
2075
|
-
y:
|
|
952
|
+
x: o.skullAnchorX,
|
|
953
|
+
y: o.skullAnchorY
|
|
2076
954
|
},
|
|
2077
955
|
center: {
|
|
2078
|
-
x:
|
|
2079
|
-
y:
|
|
2080
|
-
z:
|
|
956
|
+
x: A + v.x,
|
|
957
|
+
y: C + v.y,
|
|
958
|
+
z: v.z
|
|
2081
959
|
},
|
|
2082
|
-
depthPx:
|
|
960
|
+
depthPx: o.depthPx,
|
|
2083
961
|
screen: {
|
|
2084
|
-
widthPx:
|
|
2085
|
-
heightPx:
|
|
962
|
+
widthPx: o.widthPx,
|
|
963
|
+
heightPx: o.heightPx
|
|
2086
964
|
}
|
|
2087
965
|
}
|
|
2088
966
|
};
|
|
2089
967
|
}
|
|
2090
968
|
return {
|
|
2091
969
|
pose: {
|
|
2092
|
-
boxCenterZ: -
|
|
2093
|
-
centerX:
|
|
2094
|
-
centerY:
|
|
2095
|
-
width:
|
|
2096
|
-
height:
|
|
2097
|
-
depth:
|
|
2098
|
-
rotationX:
|
|
2099
|
-
rotationY:
|
|
2100
|
-
rotationZ:
|
|
970
|
+
boxCenterZ: -o.depthPx * s,
|
|
971
|
+
centerX: o.centerXPx,
|
|
972
|
+
centerY: o.centerYPx,
|
|
973
|
+
width: o.widthPx,
|
|
974
|
+
height: o.heightPx,
|
|
975
|
+
depth: o.depthPx,
|
|
976
|
+
rotationX: o.pitch + c,
|
|
977
|
+
rotationY: o.yaw + d,
|
|
978
|
+
rotationZ: o.rotationZ + h
|
|
2101
979
|
},
|
|
2102
980
|
debugMetrics: {
|
|
2103
981
|
face: {
|
|
2104
|
-
centerX:
|
|
2105
|
-
centerY:
|
|
2106
|
-
width:
|
|
2107
|
-
height:
|
|
982
|
+
centerX: o.shape.centerX,
|
|
983
|
+
centerY: o.shape.centerY,
|
|
984
|
+
width: o.shape.width,
|
|
985
|
+
height: o.shape.height
|
|
2108
986
|
},
|
|
2109
987
|
normalized: {
|
|
2110
|
-
rawPitch:
|
|
2111
|
-
rawPitchFromBalance:
|
|
2112
|
-
rawPitchFromCenter:
|
|
2113
|
-
rawYaw:
|
|
2114
|
-
roll:
|
|
2115
|
-
verticalBalance:
|
|
988
|
+
rawPitch: o.rawPitch,
|
|
989
|
+
rawPitchFromBalance: o.rawPitchFromBalance,
|
|
990
|
+
rawPitchFromCenter: o.rawPitchFromCenter,
|
|
991
|
+
rawYaw: o.rawYaw,
|
|
992
|
+
roll: o.roll,
|
|
993
|
+
verticalBalance: o.verticalBalance
|
|
2116
994
|
},
|
|
2117
995
|
pose: {
|
|
2118
|
-
pitch:
|
|
2119
|
-
yaw:
|
|
2120
|
-
rotationX:
|
|
2121
|
-
rotationY:
|
|
2122
|
-
rotationZ:
|
|
996
|
+
pitch: o.pitch,
|
|
997
|
+
yaw: o.yaw,
|
|
998
|
+
rotationX: o.pitch + c,
|
|
999
|
+
rotationY: o.yaw + d,
|
|
1000
|
+
rotationZ: o.rotationZ + h
|
|
2123
1001
|
},
|
|
2124
1002
|
skullAnchor: {
|
|
2125
|
-
x:
|
|
2126
|
-
y:
|
|
1003
|
+
x: o.skullAnchorX,
|
|
1004
|
+
y: o.skullAnchorY
|
|
2127
1005
|
},
|
|
2128
1006
|
center: {
|
|
2129
|
-
x:
|
|
2130
|
-
y:
|
|
2131
|
-
z: -
|
|
1007
|
+
x: o.centerXPx,
|
|
1008
|
+
y: o.centerYPx,
|
|
1009
|
+
z: -o.depthPx * s
|
|
2132
1010
|
},
|
|
2133
|
-
depthPx:
|
|
1011
|
+
depthPx: o.depthPx,
|
|
2134
1012
|
screen: {
|
|
2135
|
-
widthPx:
|
|
2136
|
-
heightPx:
|
|
1013
|
+
widthPx: o.widthPx,
|
|
1014
|
+
heightPx: o.heightPx
|
|
2137
1015
|
}
|
|
2138
1016
|
}
|
|
2139
1017
|
};
|
|
2140
|
-
},
|
|
2141
|
-
lockDepth:
|
|
1018
|
+
}, Jt = ({
|
|
1019
|
+
lockDepth: e,
|
|
2142
1020
|
lockRotation: t,
|
|
2143
|
-
model:
|
|
2144
|
-
face:
|
|
1021
|
+
model: r,
|
|
1022
|
+
face: a,
|
|
2145
1023
|
height: n,
|
|
2146
|
-
headDepthOffset:
|
|
2147
|
-
offsetX:
|
|
2148
|
-
offsetY:
|
|
2149
|
-
rotationOffsetX:
|
|
2150
|
-
rotationOffsetY:
|
|
1024
|
+
headDepthOffset: s,
|
|
1025
|
+
offsetX: l,
|
|
1026
|
+
offsetY: i,
|
|
1027
|
+
rotationOffsetX: c,
|
|
1028
|
+
rotationOffsetY: d,
|
|
2151
1029
|
rotationOffsetZ: h,
|
|
2152
1030
|
scaleX: u,
|
|
2153
|
-
scaleY:
|
|
2154
|
-
scaleZ:
|
|
2155
|
-
skullCenterMode:
|
|
2156
|
-
skullVerticalBias:
|
|
2157
|
-
width:
|
|
2158
|
-
}) =>
|
|
2159
|
-
lockDepth:
|
|
1031
|
+
scaleY: g,
|
|
1032
|
+
scaleZ: E,
|
|
1033
|
+
skullCenterMode: x,
|
|
1034
|
+
skullVerticalBias: M,
|
|
1035
|
+
width: f
|
|
1036
|
+
}) => be({
|
|
1037
|
+
lockDepth: e,
|
|
2160
1038
|
lockRotation: t,
|
|
2161
|
-
model:
|
|
2162
|
-
face:
|
|
1039
|
+
model: r,
|
|
1040
|
+
face: a,
|
|
2163
1041
|
height: n,
|
|
2164
|
-
headDepthOffset:
|
|
2165
|
-
offsetX:
|
|
2166
|
-
offsetY:
|
|
2167
|
-
rotationOffsetX:
|
|
2168
|
-
rotationOffsetY:
|
|
1042
|
+
headDepthOffset: s,
|
|
1043
|
+
offsetX: l,
|
|
1044
|
+
offsetY: i,
|
|
1045
|
+
rotationOffsetX: c,
|
|
1046
|
+
rotationOffsetY: d,
|
|
2169
1047
|
rotationOffsetZ: h,
|
|
2170
1048
|
scaleX: u,
|
|
2171
|
-
scaleY:
|
|
2172
|
-
scaleZ:
|
|
2173
|
-
skullCenterMode:
|
|
2174
|
-
skullVerticalBias:
|
|
2175
|
-
width:
|
|
2176
|
-
}).debugMetrics,
|
|
2177
|
-
boxColor:
|
|
1049
|
+
scaleY: g,
|
|
1050
|
+
scaleZ: E,
|
|
1051
|
+
skullCenterMode: x,
|
|
1052
|
+
skullVerticalBias: M,
|
|
1053
|
+
width: f
|
|
1054
|
+
}).debugMetrics, er = ({
|
|
1055
|
+
boxColor: e,
|
|
2178
1056
|
boxOpacity: t,
|
|
2179
|
-
face:
|
|
2180
|
-
headDepthOffset:
|
|
1057
|
+
face: r,
|
|
1058
|
+
headDepthOffset: a,
|
|
2181
1059
|
lockDepth: n,
|
|
2182
|
-
lockRotation:
|
|
2183
|
-
model:
|
|
2184
|
-
occluderOffset:
|
|
2185
|
-
occluderOpacity:
|
|
2186
|
-
occluderScale:
|
|
1060
|
+
lockRotation: s,
|
|
1061
|
+
model: l,
|
|
1062
|
+
occluderOffset: i,
|
|
1063
|
+
occluderOpacity: c,
|
|
1064
|
+
occluderScale: d,
|
|
2187
1065
|
showOccluderProxy: h = !1,
|
|
2188
1066
|
offsetX: u,
|
|
2189
|
-
offsetY:
|
|
2190
|
-
pose:
|
|
2191
|
-
rotationOffsetX:
|
|
2192
|
-
rotationOffsetY:
|
|
2193
|
-
rotationOffsetZ:
|
|
2194
|
-
scaleX:
|
|
2195
|
-
scaleY:
|
|
2196
|
-
scaleZ:
|
|
2197
|
-
show:
|
|
2198
|
-
showCenterDot:
|
|
2199
|
-
showFacePlaneReference:
|
|
2200
|
-
showGizmo:
|
|
2201
|
-
showHeadOccluder:
|
|
2202
|
-
skullCenterMode:
|
|
2203
|
-
skullVerticalBias:
|
|
2204
|
-
url:
|
|
2205
|
-
viewportHeight:
|
|
2206
|
-
viewportWidth:
|
|
1067
|
+
offsetY: g,
|
|
1068
|
+
pose: E,
|
|
1069
|
+
rotationOffsetX: x,
|
|
1070
|
+
rotationOffsetY: M,
|
|
1071
|
+
rotationOffsetZ: f,
|
|
1072
|
+
scaleX: o,
|
|
1073
|
+
scaleY: T,
|
|
1074
|
+
scaleZ: v,
|
|
1075
|
+
show: A,
|
|
1076
|
+
showCenterDot: C,
|
|
1077
|
+
showFacePlaneReference: L,
|
|
1078
|
+
showGizmo: y,
|
|
1079
|
+
showHeadOccluder: I,
|
|
1080
|
+
skullCenterMode: w,
|
|
1081
|
+
skullVerticalBias: O,
|
|
1082
|
+
url: P,
|
|
1083
|
+
viewportHeight: R,
|
|
1084
|
+
viewportWidth: U
|
|
2207
1085
|
}) => {
|
|
2208
|
-
const
|
|
2209
|
-
face:
|
|
2210
|
-
width:
|
|
2211
|
-
height:
|
|
2212
|
-
headDepthOffset:
|
|
1086
|
+
const S = D(() => E || (!r || U <= 0 || R <= 0 ? null : At({
|
|
1087
|
+
face: r,
|
|
1088
|
+
width: U,
|
|
1089
|
+
height: R,
|
|
1090
|
+
headDepthOffset: a,
|
|
2213
1091
|
lockDepth: n,
|
|
2214
|
-
lockRotation:
|
|
2215
|
-
model:
|
|
1092
|
+
lockRotation: s,
|
|
1093
|
+
model: l,
|
|
2216
1094
|
offsetX: u,
|
|
2217
|
-
offsetY:
|
|
2218
|
-
rotationOffsetX:
|
|
2219
|
-
rotationOffsetY:
|
|
2220
|
-
rotationOffsetZ:
|
|
2221
|
-
scaleX:
|
|
2222
|
-
scaleY:
|
|
2223
|
-
scaleZ:
|
|
2224
|
-
skullCenterMode:
|
|
2225
|
-
skullVerticalBias:
|
|
1095
|
+
offsetY: g,
|
|
1096
|
+
rotationOffsetX: x,
|
|
1097
|
+
rotationOffsetY: M,
|
|
1098
|
+
rotationOffsetZ: f,
|
|
1099
|
+
scaleX: o,
|
|
1100
|
+
scaleY: T,
|
|
1101
|
+
scaleZ: v,
|
|
1102
|
+
skullCenterMode: w,
|
|
1103
|
+
skullVerticalBias: O
|
|
2226
1104
|
})), [
|
|
2227
|
-
e,
|
|
2228
1105
|
r,
|
|
1106
|
+
a,
|
|
2229
1107
|
n,
|
|
2230
|
-
i,
|
|
2231
1108
|
s,
|
|
1109
|
+
l,
|
|
2232
1110
|
u,
|
|
2233
|
-
d,
|
|
2234
1111
|
g,
|
|
2235
|
-
A,
|
|
2236
|
-
m,
|
|
2237
|
-
f,
|
|
2238
1112
|
x,
|
|
2239
1113
|
M,
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
1114
|
+
f,
|
|
1115
|
+
o,
|
|
1116
|
+
T,
|
|
1117
|
+
v,
|
|
1118
|
+
w,
|
|
1119
|
+
O,
|
|
1120
|
+
E,
|
|
1121
|
+
R,
|
|
1122
|
+
U
|
|
2245
1123
|
]);
|
|
2246
|
-
if (!
|
|
2247
|
-
const
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
1124
|
+
if (!A || !S) return null;
|
|
1125
|
+
const Y = w ? [0, -S.height * O, S.depth * a] : [0, 0, 0], $ = S.height, B = [
|
|
1126
|
+
V[0] * d[0] * $,
|
|
1127
|
+
V[1] * d[1] * $,
|
|
1128
|
+
V[2] * d[2] * $
|
|
2251
1129
|
];
|
|
2252
|
-
return /* @__PURE__ */
|
|
2253
|
-
/* @__PURE__ */
|
|
1130
|
+
return /* @__PURE__ */ F(te, { children: [
|
|
1131
|
+
/* @__PURE__ */ F(
|
|
2254
1132
|
"group",
|
|
2255
1133
|
{
|
|
2256
|
-
position: [
|
|
2257
|
-
rotation: [
|
|
1134
|
+
position: [S.centerX, S.centerY, S.boxCenterZ],
|
|
1135
|
+
rotation: [S.rotationX, S.rotationY, S.rotationZ],
|
|
2258
1136
|
children: [
|
|
2259
|
-
/* @__PURE__ */
|
|
2260
|
-
/* @__PURE__ */
|
|
2261
|
-
/* @__PURE__ */
|
|
1137
|
+
/* @__PURE__ */ p("group", { scale: [S.width, S.height, S.depth], children: t > 0 && /* @__PURE__ */ F("mesh", { children: [
|
|
1138
|
+
/* @__PURE__ */ p("boxGeometry", { args: [1, 1, 1] }),
|
|
1139
|
+
/* @__PURE__ */ p("meshBasicMaterial", { color: e, wireframe: !0, transparent: !0, opacity: t })
|
|
2262
1140
|
] }) }),
|
|
2263
|
-
|
|
2264
|
-
/* @__PURE__ */
|
|
2265
|
-
/* @__PURE__ */
|
|
1141
|
+
C && /* @__PURE__ */ F("mesh", { children: [
|
|
1142
|
+
/* @__PURE__ */ p("sphereGeometry", { args: [6, 20, 20] }),
|
|
1143
|
+
/* @__PURE__ */ p("meshBasicMaterial", { color: e })
|
|
2266
1144
|
] }),
|
|
2267
|
-
|
|
2268
|
-
/* @__PURE__ */
|
|
2269
|
-
/* @__PURE__ */
|
|
2270
|
-
/* @__PURE__ */
|
|
1145
|
+
L && /* @__PURE__ */ F("group", { position: Y, children: [
|
|
1146
|
+
/* @__PURE__ */ F("mesh", { rotation: [0, 0, Math.PI / 4], children: [
|
|
1147
|
+
/* @__PURE__ */ p("ringGeometry", { args: [6, 8, 24] }),
|
|
1148
|
+
/* @__PURE__ */ p("meshBasicMaterial", { color: "#f8fafc", side: j })
|
|
2271
1149
|
] }),
|
|
2272
|
-
/* @__PURE__ */
|
|
2273
|
-
/* @__PURE__ */
|
|
2274
|
-
/* @__PURE__ */
|
|
1150
|
+
/* @__PURE__ */ F("mesh", { rotation: [0, 0, Math.PI / 2], children: [
|
|
1151
|
+
/* @__PURE__ */ p("planeGeometry", { args: [3, 16] }),
|
|
1152
|
+
/* @__PURE__ */ p("meshBasicMaterial", { color: "#f8fafc", transparent: !0, opacity: 0.9, side: j })
|
|
2275
1153
|
] }),
|
|
2276
|
-
/* @__PURE__ */
|
|
2277
|
-
/* @__PURE__ */
|
|
2278
|
-
/* @__PURE__ */
|
|
1154
|
+
/* @__PURE__ */ F("mesh", { children: [
|
|
1155
|
+
/* @__PURE__ */ p("planeGeometry", { args: [16, 3] }),
|
|
1156
|
+
/* @__PURE__ */ p("meshBasicMaterial", { color: "#f8fafc", transparent: !0, opacity: 0.9, side: j })
|
|
2279
1157
|
] })
|
|
2280
1158
|
] }),
|
|
2281
|
-
|
|
2282
|
-
h && /* @__PURE__ */
|
|
2283
|
-
/* @__PURE__ */
|
|
2284
|
-
/* @__PURE__ */
|
|
1159
|
+
I && /* @__PURE__ */ F(te, { children: [
|
|
1160
|
+
h && /* @__PURE__ */ F("mesh", { position: i, scale: B, renderOrder: 20, children: [
|
|
1161
|
+
/* @__PURE__ */ p("sphereGeometry", { args: [1, 24, 16] }),
|
|
1162
|
+
/* @__PURE__ */ p(
|
|
2285
1163
|
"meshBasicMaterial",
|
|
2286
1164
|
{
|
|
2287
1165
|
color: "#facc15",
|
|
@@ -2293,57 +1171,57 @@ const ee = [0, 0, -10], G = [0.5, 0.5, 0.5], Ze = 1, he = /* @__PURE__ */ new Ma
|
|
|
2293
1171
|
}
|
|
2294
1172
|
)
|
|
2295
1173
|
] }),
|
|
2296
|
-
/* @__PURE__ */
|
|
2297
|
-
|
|
1174
|
+
/* @__PURE__ */ p(
|
|
1175
|
+
Re,
|
|
2298
1176
|
{
|
|
2299
|
-
opacity:
|
|
2300
|
-
position:
|
|
2301
|
-
scale:
|
|
1177
|
+
opacity: c,
|
|
1178
|
+
position: i,
|
|
1179
|
+
scale: B,
|
|
2302
1180
|
showDebugMaterial: !0,
|
|
2303
|
-
url:
|
|
1181
|
+
url: P
|
|
2304
1182
|
}
|
|
2305
1183
|
)
|
|
2306
1184
|
] })
|
|
2307
1185
|
]
|
|
2308
1186
|
}
|
|
2309
1187
|
),
|
|
2310
|
-
|
|
1188
|
+
y && /* @__PURE__ */ p(
|
|
2311
1189
|
"group",
|
|
2312
1190
|
{
|
|
2313
|
-
position: [
|
|
2314
|
-
rotation: [
|
|
1191
|
+
position: [S.centerX, S.centerY, S.boxCenterZ],
|
|
1192
|
+
rotation: [S.rotationX, S.rotationY, S.rotationZ],
|
|
2315
1193
|
renderOrder: 10,
|
|
2316
|
-
children: /* @__PURE__ */
|
|
2317
|
-
/* @__PURE__ */
|
|
2318
|
-
/* @__PURE__ */
|
|
2319
|
-
/* @__PURE__ */
|
|
1194
|
+
children: /* @__PURE__ */ F("group", { children: [
|
|
1195
|
+
/* @__PURE__ */ F("mesh", { children: [
|
|
1196
|
+
/* @__PURE__ */ p("sphereGeometry", { args: [6, 20, 20] }),
|
|
1197
|
+
/* @__PURE__ */ p("meshBasicMaterial", { color: "#e2e8f0", depthTest: !1, depthWrite: !1 })
|
|
2320
1198
|
] }),
|
|
2321
|
-
/* @__PURE__ */
|
|
2322
|
-
/* @__PURE__ */
|
|
2323
|
-
/* @__PURE__ */
|
|
1199
|
+
/* @__PURE__ */ F("mesh", { position: [18, 0, 0], rotation: [0, 0, -Math.PI / 2], children: [
|
|
1200
|
+
/* @__PURE__ */ p("cylinderGeometry", { args: [1.6, 1.6, 24, 12] }),
|
|
1201
|
+
/* @__PURE__ */ p("meshBasicMaterial", { color: "#ef4444", depthTest: !1, depthWrite: !1 })
|
|
2324
1202
|
] }),
|
|
2325
|
-
/* @__PURE__ */
|
|
2326
|
-
/* @__PURE__ */
|
|
2327
|
-
/* @__PURE__ */
|
|
1203
|
+
/* @__PURE__ */ F("mesh", { position: [34, 0, 0], rotation: [0, 0, -Math.PI / 2], children: [
|
|
1204
|
+
/* @__PURE__ */ p("coneGeometry", { args: [4.2, 12, 16] }),
|
|
1205
|
+
/* @__PURE__ */ p("meshBasicMaterial", { color: "#ef4444", depthTest: !1, depthWrite: !1 })
|
|
2328
1206
|
] }),
|
|
2329
|
-
/* @__PURE__ */
|
|
2330
|
-
/* @__PURE__ */
|
|
2331
|
-
/* @__PURE__ */
|
|
1207
|
+
/* @__PURE__ */ F("mesh", { position: [0, 18, 0], children: [
|
|
1208
|
+
/* @__PURE__ */ p("cylinderGeometry", { args: [1.6, 1.6, 24, 12] }),
|
|
1209
|
+
/* @__PURE__ */ p("meshBasicMaterial", { color: "#22c55e", depthTest: !1, depthWrite: !1 })
|
|
2332
1210
|
] }),
|
|
2333
|
-
/* @__PURE__ */
|
|
2334
|
-
/* @__PURE__ */
|
|
2335
|
-
/* @__PURE__ */
|
|
1211
|
+
/* @__PURE__ */ F("mesh", { position: [0, 34, 0], children: [
|
|
1212
|
+
/* @__PURE__ */ p("coneGeometry", { args: [4.2, 12, 16] }),
|
|
1213
|
+
/* @__PURE__ */ p("meshBasicMaterial", { color: "#22c55e", depthTest: !1, depthWrite: !1 })
|
|
2336
1214
|
] }),
|
|
2337
|
-
/* @__PURE__ */
|
|
2338
|
-
/* @__PURE__ */
|
|
2339
|
-
/* @__PURE__ */
|
|
1215
|
+
/* @__PURE__ */ F("mesh", { position: [0, 0, 18], rotation: [Math.PI / 2, 0, 0], children: [
|
|
1216
|
+
/* @__PURE__ */ p("cylinderGeometry", { args: [1.6, 1.6, 24, 12] }),
|
|
1217
|
+
/* @__PURE__ */ p("meshBasicMaterial", { color: "#3b82f6", depthTest: !1, depthWrite: !1 })
|
|
2340
1218
|
] }),
|
|
2341
|
-
/* @__PURE__ */
|
|
2342
|
-
/* @__PURE__ */
|
|
2343
|
-
/* @__PURE__ */
|
|
1219
|
+
/* @__PURE__ */ F("mesh", { position: [0, 0, 34], rotation: [Math.PI / 2, 0, 0], children: [
|
|
1220
|
+
/* @__PURE__ */ p("coneGeometry", { args: [4.2, 12, 16] }),
|
|
1221
|
+
/* @__PURE__ */ p("meshBasicMaterial", { color: "#3b82f6", depthTest: !1, depthWrite: !1 })
|
|
2344
1222
|
] }),
|
|
2345
|
-
/* @__PURE__ */
|
|
2346
|
-
|
|
1223
|
+
/* @__PURE__ */ p(
|
|
1224
|
+
Z,
|
|
2347
1225
|
{
|
|
2348
1226
|
position: [42, 0, 0],
|
|
2349
1227
|
fontSize: 10,
|
|
@@ -2355,8 +1233,8 @@ const ee = [0, 0, -10], G = [0.5, 0.5, 0.5], Ze = 1, he = /* @__PURE__ */ new Ma
|
|
|
2355
1233
|
children: "X"
|
|
2356
1234
|
}
|
|
2357
1235
|
),
|
|
2358
|
-
/* @__PURE__ */
|
|
2359
|
-
|
|
1236
|
+
/* @__PURE__ */ p(
|
|
1237
|
+
Z,
|
|
2360
1238
|
{
|
|
2361
1239
|
position: [0, 42, 0],
|
|
2362
1240
|
fontSize: 10,
|
|
@@ -2368,8 +1246,8 @@ const ee = [0, 0, -10], G = [0.5, 0.5, 0.5], Ze = 1, he = /* @__PURE__ */ new Ma
|
|
|
2368
1246
|
children: "Y"
|
|
2369
1247
|
}
|
|
2370
1248
|
),
|
|
2371
|
-
/* @__PURE__ */
|
|
2372
|
-
|
|
1249
|
+
/* @__PURE__ */ p(
|
|
1250
|
+
Z,
|
|
2373
1251
|
{
|
|
2374
1252
|
position: [0, 0, 42],
|
|
2375
1253
|
fontSize: 10,
|
|
@@ -2387,61 +1265,120 @@ const ee = [0, 0, -10], G = [0.5, 0.5, 0.5], Ze = 1, he = /* @__PURE__ */ new Ma
|
|
|
2387
1265
|
] });
|
|
2388
1266
|
};
|
|
2389
1267
|
export {
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
1268
|
+
Or as CANONICAL_FACE_MESH_GEOMETRY_SPECS,
|
|
1269
|
+
W as CANONICAL_LIP_UV_BOUNDS,
|
|
1270
|
+
Qe as CanonicalFaceMeshRenderer,
|
|
1271
|
+
Nr as DEFAULT_APPEARANCE,
|
|
1272
|
+
Gr as DEFAULT_FACE_MESH_RENDERER,
|
|
1273
|
+
kr as DEFAULT_FACE_MESH_TRANSFORM,
|
|
1274
|
+
lr as DEFAULT_FACE_WARP_3D_SETTINGS,
|
|
1275
|
+
it as DEFAULT_IRIS_EFFECT_RENDER_ORDER,
|
|
1276
|
+
ur as DEFAULT_IRIS_EFFECT_SETTINGS,
|
|
1277
|
+
Bt as DEFAULT_LIP_EFFECT,
|
|
1278
|
+
oe as DEFAULT_LIP_EFFECT_RENDER_ORDER,
|
|
1279
|
+
xe as DEFAULT_LIP_EFFECT_SETTINGS,
|
|
1280
|
+
Vr as DEFAULT_MASKING,
|
|
1281
|
+
fn as DEFAULT_SEGMENTATION_OVERLAY_SETTINGS,
|
|
1282
|
+
Yr as FACE_MESH_ALPHA_MAPS,
|
|
1283
|
+
$r as FACE_MESH_BLEND_MODES,
|
|
1284
|
+
Br as FACE_MESH_MASK_TEXTURE_SOURCES,
|
|
1285
|
+
Hr as FACE_MESH_MATERIAL_TYPES,
|
|
1286
|
+
Xr as FACE_MESH_SHADER_PRESETS,
|
|
1287
|
+
Wr as FACE_MESH_SIDES,
|
|
1288
|
+
zr as FACE_MESH_TEXTURE_MAPS,
|
|
1289
|
+
cn as FACE_REGION_LABELS,
|
|
1290
|
+
hr as FACE_RETOUCH_DEFAULT_CONTROLS,
|
|
1291
|
+
dr as FACE_RETOUCH_SETTINGS_FIELDS,
|
|
1292
|
+
pr as FACE_WARP_3D_PRESET,
|
|
1293
|
+
jr as FaceMeshMaterial,
|
|
1294
|
+
Zr as FaceMeshRenderer,
|
|
1295
|
+
mr as FaceRetouch,
|
|
1296
|
+
ir as FaceTrackMemory,
|
|
1297
|
+
Pe as HEAD_OCCLUDER_DEFAULT_OPACITY,
|
|
1298
|
+
X as HEAD_OCCLUDER_DEFAULT_POSITION,
|
|
1299
|
+
V as HEAD_OCCLUDER_DEFAULT_SCALE,
|
|
1300
|
+
zt as HeadBinding,
|
|
1301
|
+
er as HeadBindingOccluder,
|
|
1302
|
+
Re as HeadOccluder,
|
|
1303
|
+
fr as IRIS_EFFECT_EYES,
|
|
1304
|
+
gr as IRIS_EFFECT_MODES,
|
|
1305
|
+
vr as IRIS_EFFECT_SETTINGS_FIELDS,
|
|
1306
|
+
rt as IRIS_IMAGE_FRAGMENT,
|
|
1307
|
+
tt as IRIS_SHADER_FRAGMENT,
|
|
1308
|
+
we as IRIS_VERTEX_SHADER,
|
|
1309
|
+
$t as IrisEffect,
|
|
1310
|
+
Er as LIP_EFFECT_COLOR_MODES,
|
|
1311
|
+
pt as LIP_EFFECT_FRAGMENT_SHADER,
|
|
1312
|
+
ze as LIP_EFFECT_GRADIENT_DIRECTIONS,
|
|
1313
|
+
xr as LIP_EFFECT_PRESETS,
|
|
1314
|
+
Mr as LIP_EFFECT_PRESET_KEYS,
|
|
1315
|
+
yr as LIP_EFFECT_SETTINGS_FIELDS,
|
|
1316
|
+
dt as LIP_EFFECT_VERTEX_SHADER,
|
|
1317
|
+
G as LIP_UV_GUIDE_COLORS,
|
|
1318
|
+
vt as LipEffect,
|
|
1319
|
+
Xt as LipEffectMaterial,
|
|
1320
|
+
Wt as LipEffects,
|
|
1321
|
+
ln as PERSON_MASK_LABELS,
|
|
1322
|
+
gn as SEGMENTATION_OVERLAY_BLEND_MODES,
|
|
1323
|
+
vn as SEGMENTATION_OVERLAY_SETTINGS_FIELDS,
|
|
1324
|
+
En as SEMANTIC_MASK_LABELS,
|
|
1325
|
+
Dr as SEMANTIC_SEGMENTATION_PRESETS,
|
|
1326
|
+
nr as SegmentationOverlay,
|
|
1327
|
+
Sr as alphaMapOptions,
|
|
1328
|
+
Kr as blendModeIndices,
|
|
1329
|
+
wr as blendModeOptions,
|
|
1330
|
+
qr as canonicalFaceAlphaMaskUrl,
|
|
1331
|
+
Qr as canonicalFaceTextureStyle2Url,
|
|
1332
|
+
Jr as canonicalFaceTextureUrl,
|
|
1333
|
+
ar as clearSemanticMask,
|
|
1334
|
+
Qt as computeAdaptiveVerticalFit,
|
|
1335
|
+
At as computeHeadBindingCubePose,
|
|
1336
|
+
Jt as computeHeadBindingDebugMetrics,
|
|
1337
|
+
Ft as computeHeadBindingShape,
|
|
1338
|
+
qt as computeUniversalHeadDepthOffset,
|
|
1339
|
+
jt as computeUniversalOccluderScale,
|
|
1340
|
+
Kt as computeUniversalPitchOffsetY,
|
|
1341
|
+
Zt as computeUniversalYawOffsetX,
|
|
1342
|
+
ot as createIrisImageMaterial,
|
|
1343
|
+
nt as createIrisShaderMaterial,
|
|
1344
|
+
Je as createIrisUniforms,
|
|
1345
|
+
_e as createLipEffectMaterial,
|
|
1346
|
+
je as createLipTextureTransform,
|
|
1347
|
+
ut as createLipUvGuideDataUrl,
|
|
1348
|
+
Ht as createLipUvGuidePngBlob,
|
|
1349
|
+
lt as createLipUvGuideSvg,
|
|
1350
|
+
sr as createSemanticMask,
|
|
1351
|
+
ie as getLipUvBounds,
|
|
1352
|
+
Tr as isLipEffectPresetKey,
|
|
1353
|
+
K as lipUvToPixel,
|
|
1354
|
+
en as mapFaceMeshRendererProps,
|
|
1355
|
+
tn as mapFaceMeshRendererSettingsToProps,
|
|
1356
|
+
_r as materialTypeOptions,
|
|
1357
|
+
rn as parseCanonicalFaceModel,
|
|
1358
|
+
xn as parseOverlayLabels,
|
|
1359
|
+
Fr as patchFaceRetouchControls,
|
|
1360
|
+
Lr as patchIrisEffectSettings,
|
|
1361
|
+
Ar as patchLipEffectSettings,
|
|
1362
|
+
Mn as patchSegmentationOverlaySettings,
|
|
1363
|
+
nn as resolveFaceMeshRendererSettings,
|
|
1364
|
+
Cr as resolveFaceRetouchControls,
|
|
1365
|
+
We as resolveIrisEffectSettings,
|
|
1366
|
+
Et as resolveLipEffectFaceConfig,
|
|
1367
|
+
Me as resolveLipEffectSettings,
|
|
1368
|
+
yn as resolveSegmentationOverlaySettings,
|
|
1369
|
+
Ir as shaderPresetOptions,
|
|
1370
|
+
Pr as sideOptions,
|
|
1371
|
+
be as solveHeadBinding,
|
|
1372
|
+
on as supportsBlendMode,
|
|
1373
|
+
an as supportsTexturePanel,
|
|
1374
|
+
Rr as textureMapOptions,
|
|
1375
|
+
et as updateIrisUniforms,
|
|
1376
|
+
Fe as updateLipEffectMaterial,
|
|
1377
|
+
Se as useCanonicalFaceMesh,
|
|
1378
|
+
un as useFaceRegionMask,
|
|
1379
|
+
hn as useHairMask,
|
|
1380
|
+
Ae as useLipDesignTextures,
|
|
1381
|
+
Le as useLipEffectMaterial,
|
|
1382
|
+
dn as usePersonMask,
|
|
1383
|
+
pn as useSemanticSegmentationMask
|
|
2447
1384
|
};
|