@vincentt-xr/sdk 2.0.0-alpha.8 → 2.0.0-alpha.9
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 +4643 -170
- package/README.md +1 -0
- package/dist/CanonicalHeadFrame-BHcWyaiK.js +1506 -0
- package/dist/CanonicalHeadFrame-D-_T1OMU.cjs +1 -0
- package/dist/DebuggerUI-7ngnJsBe.js +275 -0
- package/dist/DebuggerUI-CoglgKdO.cjs +1 -0
- package/dist/FaceRetouch-CLoTfrcs.js +1071 -0
- package/dist/FaceRetouch-J1lC1WbS.cjs +134 -0
- package/dist/FaceSurface-CHAMEeG1.cjs +1 -0
- package/dist/FaceSurface-DmP9AEeC.js +27 -0
- package/dist/SegmentationOverlay-D_FWkcyP.cjs +35 -0
- package/dist/SegmentationOverlay-vn5x_knv.js +6237 -0
- package/dist/SkeletonUtils-C2r90MtN.js +21 -0
- package/dist/SkeletonUtils-CddIup1F.cjs +1 -0
- package/dist/TextLabel-XE0rQSDn.cjs +2 -0
- package/dist/TextLabel-c9BCucOI.js +961 -0
- package/dist/assets/gltfLoader.d.ts +16 -0
- package/dist/assets/loaders.d.ts +16 -1
- package/dist/body-pose/index.d.ts +521 -0
- package/dist/body-trigger/__fixtures__/syntheticBody.d.ts +83 -0
- package/dist/body-trigger/frame.d.ts +88 -0
- package/dist/body-trigger/index.d.ts +6 -0
- package/dist/body-trigger/moves.d.ts +235 -0
- package/dist/body-trigger/trigger.d.ts +75 -0
- package/dist/calibration/calibration.d.ts +11 -6
- package/dist/canonicalFace-BHwyCx1c.js +9 -0
- package/dist/canonicalFace-C83I225R.cjs +1 -0
- package/dist/components/BodyInstruction/BodyPoseHint.d.ts +63 -0
- package/dist/components/BodyInstruction/index.d.ts +69 -0
- package/dist/components/BodyInstruction/useBodyPose.d.ts +23 -0
- package/dist/components/BodyTracker/index.d.ts +10 -2
- package/dist/components/BodyTrigger/index.d.ts +49 -0
- package/dist/components/Debugger/DebuggerProvider.d.ts +14 -1
- package/dist/components/Debugger/DebuggerUI.d.ts +3 -1
- package/dist/components/FaceAtlas/FaceAtlasLayer.d.ts +114 -0
- package/dist/components/FaceAtlas/MadeUpCamera.d.ts +80 -0
- package/dist/components/FaceAtlas/constants.d.ts +8 -0
- package/dist/components/FaceAtlas/index.d.ts +7 -0
- package/dist/components/FaceAtlas/useFaceAtlasSurface.d.ts +84 -0
- package/dist/components/FaceAtlas/useFaceSkin.d.ts +84 -0
- package/dist/components/FaceCharacter/ExternalFaceMesh.d.ts +109 -0
- package/dist/components/FaceCharacter/FaceExpressionController.d.ts +53 -0
- package/dist/components/FaceCharacter/FaceMorph.d.ts +71 -0
- package/dist/components/FaceCharacter/FacePiercing.d.ts +65 -0
- package/dist/components/FaceCharacter/FaceReprojection.d.ts +85 -0
- package/dist/components/FaceCharacter/FaceRig.d.ts +38 -0
- package/dist/components/FaceCharacter/FaceSurface.d.ts +49 -0
- package/dist/components/FaceCharacter/FaceSurfaceOccluder.d.ts +39 -0
- package/dist/components/FaceCharacter/PinToFaceMesh.d.ts +68 -0
- package/dist/components/FaceCharacter/index.d.ts +18 -0
- package/dist/components/FaceCharacter/useFaceReprojector.d.ts +10 -0
- package/dist/components/FaceInset/FaceInset.d.ts +68 -0
- package/dist/components/FaceInset/frame.d.ts +94 -0
- package/dist/components/FaceInset/index.d.ts +6 -0
- package/dist/components/FaceInset/material.d.ts +40 -0
- package/dist/components/FaceInset/useFaceInsetTexture.d.ts +37 -0
- package/dist/components/FaceInstruction/FaceExpressionHint.d.ts +43 -0
- package/dist/components/FaceInstruction/index.d.ts +56 -0
- package/dist/components/FaceInstruction/useFaceExpression.d.ts +20 -0
- package/dist/components/FaceLiquify/FaceLiquify.d.ts +49 -0
- package/dist/components/FaceLiquify/debug.d.ts +37 -0
- package/dist/components/FaceLiquify/frame.d.ts +55 -0
- package/dist/components/FaceLiquify/index.d.ts +10 -0
- package/dist/components/FaceLiquify/material.d.ts +39 -0
- package/dist/components/FaceLiquify/pass.d.ts +49 -0
- package/dist/components/FaceLiquify/presence.d.ts +25 -0
- package/dist/components/FaceLiquify/presets.d.ts +82 -0
- package/dist/components/FaceLiquify/selfTest.d.ts +66 -0
- package/dist/components/FaceLiquify/target.d.ts +85 -0
- package/dist/components/FaceLiquify/warp.d.ts +72 -0
- package/dist/components/FaceMesh/canonical/CanonicalFaceMeshRenderer.d.ts +5 -3
- package/dist/components/FaceMesh/canonical/geometryGroups.d.ts +21 -0
- package/dist/components/FaceMesh/canonical/parseCanonicalFaceModel.d.ts +9 -0
- package/dist/components/FaceMesh/index.d.ts +1 -1
- package/dist/components/FaceRetouch/Background.d.ts +3 -1
- package/dist/components/FaceRetouch/FaceRetouch.d.ts +5 -0
- package/dist/components/FaceRetouch/renderState.d.ts +19 -0
- package/dist/components/FaceSwap/FaceMirror.d.ts +46 -0
- package/dist/components/FaceSwap/FaceSwap.d.ts +58 -0
- package/dist/components/FaceSwap/FaceTextureLayer.d.ts +72 -0
- package/dist/components/FaceSwap/faceSwapPlan.d.ts +91 -0
- package/dist/components/FaceSwap/index.d.ts +13 -0
- package/dist/components/FaceSwap/settings.d.ts +300 -0
- package/dist/components/FaceSwap/useFaceTexture.d.ts +35 -0
- package/dist/components/FaceSwap/useLiveFace.d.ts +38 -0
- package/dist/components/FaceSwap/useLiveFaceTexture.d.ts +31 -0
- package/dist/components/FaceWarp3D/FaceWarp3D.d.ts +50 -0
- package/dist/components/FaceWarp3D/index.d.ts +2 -3
- package/dist/components/Faceless/Faceless.d.ts +51 -0
- package/dist/components/Faceless/index.d.ts +2 -0
- package/dist/components/HairLock/HairLock.d.ts +39 -0
- package/dist/components/HairLock/index.d.ts +2 -0
- package/dist/components/HairLock/lockGeometry.d.ts +15 -0
- package/dist/components/HandCutout/index.d.ts +35 -0
- package/dist/components/HandInstruction/HandGestureHint.d.ts +70 -0
- package/dist/components/HandInstruction/index.d.ts +74 -0
- package/dist/components/HandInstruction/useHandGesture.d.ts +22 -0
- package/dist/components/HandRig/ForearmOccluder.d.ts +29 -0
- package/dist/components/HandRig/HandAttachment.d.ts +34 -0
- package/dist/components/HandRig/HandOccluder.d.ts +55 -0
- package/dist/components/HandRig/HandTattoo.d.ts +61 -0
- package/dist/components/HandRig/WristAttachment.d.ts +34 -0
- package/dist/components/HandRig/index.d.ts +101 -0
- package/dist/components/HandRig/useArmMask.d.ts +29 -0
- package/dist/components/HandRig/wristSolve.d.ts +69 -0
- package/dist/components/HandTouch/HandTouch.d.ts +62 -0
- package/dist/components/HandTouch/Touchable.d.ts +36 -0
- package/dist/components/HandTouch/index.d.ts +2 -0
- package/dist/components/HeadBinding/index.d.ts +14 -0
- package/dist/components/HeadOccluder/CanonicalHeadFrame.d.ts +22 -0
- package/dist/components/HeadOccluder/Earrings.d.ts +55 -0
- package/dist/components/HeadOccluder/HeadAttachment.d.ts +38 -0
- package/dist/components/HeadOccluder/NeckOccluder.d.ts +64 -0
- package/dist/components/HeadOccluder/earringPlacement.d.ts +31 -0
- package/dist/components/HeadOccluder/headAttachmentPoints.d.ts +69 -0
- package/dist/components/HeadOccluder/index.d.ts +57 -3
- package/dist/components/HeadOccluder/useCanonicalHeadFit.d.ts +36 -0
- package/dist/components/HeadOccluder/useLandmarkPoseFit.d.ts +80 -0
- package/dist/components/Instruction/HintStage.d.ts +29 -0
- package/dist/components/Instruction/InstructionCue.d.ts +126 -0
- package/dist/components/Instruction/gestureHold.d.ts +20 -0
- package/dist/components/Instruction/ghost.d.ts +129 -0
- package/dist/components/Instruction/hintBlend.d.ts +19 -0
- package/dist/components/Instruction/hintLook.d.ts +81 -0
- package/dist/components/Instruction/hintLoop.d.ts +36 -0
- package/dist/components/Instruction/index.d.ts +41 -0
- package/dist/components/Instruction/useGhostModel.d.ts +33 -0
- package/dist/components/Instruction/useInstructionHold.d.ts +72 -0
- package/dist/components/LipEffect/LipEffect.d.ts +22 -2
- package/dist/components/LipEffect/LipEffectMaterial.d.ts +62 -10
- package/dist/components/LipEffect/LipEffects.d.ts +5 -2
- package/dist/components/LipEffect/defaults.d.ts +21 -2
- package/dist/components/LipEffect/index.d.ts +1 -1
- package/dist/components/LipEffect/lipShading.d.ts +73 -0
- package/dist/components/LipEffect/settings.d.ts +117 -13
- package/dist/components/LipEffect/shader.d.ts +39 -0
- package/dist/components/LipEffect/types.d.ts +82 -10
- package/dist/components/LipEffect/useLipDesignTextures.d.ts +6 -0
- package/dist/components/LipEffect/uvGuide.d.ts +31 -16
- package/dist/components/Makeup/Blush.d.ts +18 -0
- package/dist/components/Makeup/Brows.d.ts +20 -0
- package/dist/components/Makeup/Contour.d.ts +17 -0
- package/dist/components/Makeup/Eyeliner.d.ts +20 -0
- package/dist/components/Makeup/Eyeshadow.d.ts +20 -0
- package/dist/components/Makeup/Highlighter.d.ts +18 -0
- package/dist/components/Makeup/MakeupDesign.d.ts +37 -0
- package/dist/components/Makeup/MakeupRegion.d.ts +132 -0
- package/dist/components/Makeup/constants.d.ts +44 -0
- package/dist/components/Makeup/design.d.ts +106 -0
- package/dist/components/Makeup/designSamples.d.ts +42 -0
- package/dist/components/Makeup/eyes.d.ts +114 -0
- package/dist/components/Makeup/fields.d.ts +10 -0
- package/dist/components/Makeup/geometry.d.ts +106 -0
- package/dist/components/Makeup/index.d.ts +26 -0
- package/dist/components/Makeup/looks.d.ts +28 -0
- package/dist/components/Makeup/material.d.ts +239 -0
- package/dist/components/Makeup/settings.d.ts +54 -0
- package/dist/components/Makeup/shades.d.ts +143 -0
- package/dist/components/Makeup/shapes.d.ts +27 -0
- package/dist/components/Makeup/skinTone.d.ts +135 -0
- package/dist/components/Makeup/types.d.ts +110 -0
- package/dist/components/Makeup/useMakeupSkinTone.d.ts +40 -0
- package/dist/components/Necklace/Necklace.d.ts +44 -0
- package/dist/components/Necklace/index.d.ts +1 -0
- package/dist/components/ParticleEmitter/ParticleEmitter.d.ts +69 -0
- package/dist/components/ParticleEmitter/index.d.ts +1 -0
- package/dist/components/ShoulderOccluder/index.d.ts +43 -0
- package/dist/components/ShoulderOccluder/useCanonicalTorsoFit.d.ts +24 -0
- package/dist/components/SpringSwing/SpringSwing.d.ts +22 -0
- package/dist/components/SpringSwing/index.d.ts +1 -0
- package/dist/components/XRScene/renderOutputTarget.d.ts +12 -0
- package/dist/components/index.d.ts +8 -0
- package/dist/config/index.d.ts +0 -1
- package/dist/context-DTxSQvp4.js +13 -0
- package/dist/context-hA0Rb2Xa.cjs +1 -0
- package/dist/contexts-BH7PdKFS.cjs +1 -0
- package/dist/contexts-jak8-tND.js +667 -0
- package/dist/coordinates/index.d.ts +2 -0
- package/dist/coordinates/side.d.ts +40 -0
- package/dist/debug-ui/default-setting.cjs +2 -2
- package/dist/debug-ui/face-swap-settings/index.d.ts +22 -0
- package/dist/debug-ui/hierarchy-panel/index.d.ts +3 -2
- package/dist/debug-ui/index.d.ts +4 -3
- package/dist/debug-ui/media-source/index.d.ts +1 -1
- package/dist/debug-ui/media-source/session.d.ts +30 -2
- package/dist/debug-ui/media-source.cjs +1 -1
- package/dist/debug-ui/media-source.js +1 -1
- package/dist/debug-ui/object-inspector-panel/index.d.ts +3 -2
- package/dist/debug-ui/product-hotspots/index.d.ts +3 -2
- package/dist/debug-ui/scene-editor/hierarchy-panel.d.ts +3 -1
- package/dist/debug-ui/scene-editor/inspector-panel.d.ts +3 -1
- package/dist/debug-ui/screen-image-settings/index.d.ts +3 -1
- package/dist/debug-ui/screen-text-settings/ScreenTextSettingsPanel.d.ts +1 -1
- package/dist/debug-ui/screen-text-settings/types.d.ts +2 -0
- package/dist/debug-ui/settings-panel/index.d.ts +6 -1
- package/dist/debug-ui/shared/debugWindow.d.ts +51 -0
- package/dist/debug-ui/xr-diagnostics/index.d.ts +3 -2
- package/dist/debug-ui.cjs +3 -3
- package/dist/debug-ui.js +2250 -2472
- package/dist/entries/all.d.ts +3 -1
- package/dist/entries/core.d.ts +3 -2
- package/dist/entries/face-effects.d.ts +114 -8
- package/dist/entries/instructions.d.ts +48 -0
- package/dist/entries/internal.d.ts +2 -1
- package/dist/entries/low-level.d.ts +28 -1
- package/dist/entries/particles.d.ts +11 -0
- package/dist/entries/tracking.d.ts +37 -2
- package/dist/face-atlas/attributes.d.ts +30 -0
- package/dist/face-atlas/eyes.d.ts +272 -0
- package/dist/face-atlas/faceAtlas.generated.d.ts +46 -0
- package/dist/face-atlas/glsl/atlasVertex.d.ts +46 -0
- package/dist/face-atlas/glsl/common.d.ts +55 -0
- package/dist/face-atlas/glsl/design.d.ts +49 -0
- package/dist/face-atlas/glsl/eyes.d.ts +73 -0
- package/dist/face-atlas/glsl/finish.d.ts +24 -0
- package/dist/face-atlas/glsl/format.d.ts +4 -0
- package/dist/face-atlas/glsl/index.d.ts +59 -0
- package/dist/face-atlas/glsl/shading.d.ts +15 -0
- package/dist/face-atlas/glsl/shapes.d.ts +66 -0
- package/dist/face-atlas/glsl/sparkle.d.ts +19 -0
- package/dist/face-atlas/glsl/uniforms.d.ts +106 -0
- package/dist/face-atlas/guide.d.ts +51 -0
- package/dist/face-atlas/index.d.ts +25 -0
- package/dist/face-atlas/lead.d.ts +117 -0
- package/dist/face-atlas/madeUpCamera.d.ts +125 -0
- package/dist/face-atlas/masks.d.ts +53 -0
- package/dist/face-atlas/obj.d.ts +69 -0
- package/dist/face-atlas/polylines.d.ts +63 -0
- package/dist/face-atlas/probe/FaceSkinProbe.d.ts +208 -0
- package/dist/face-atlas/probe/__fixtures__/emulate.d.ts +9 -0
- package/dist/face-atlas/probe/__fixtures__/face.d.ts +24 -0
- package/dist/face-atlas/probe/constants.d.ts +137 -0
- package/dist/face-atlas/probe/glsl.d.ts +43 -0
- package/dist/face-atlas/probe/lightFit.d.ts +108 -0
- package/dist/face-atlas/probe/schedule.d.ts +44 -0
- package/dist/face-atlas/probe/selfTest.d.ts +87 -0
- package/dist/face-atlas/probe/stats.d.ts +143 -0
- package/dist/face-atlas/probe/targets.d.ts +70 -0
- package/dist/face-atlas/probe/unwrap.d.ts +76 -0
- package/dist/face-atlas/quality.d.ts +28 -0
- package/dist/face-atlas/regions.d.ts +31 -0
- package/dist/face-atlas/registry.d.ts +252 -0
- package/dist/face-atlas/renderState.d.ts +86 -0
- package/dist/face-atlas/selfOcclusion.d.ts +62 -0
- package/dist/face-atlas/shading.d.ts +406 -0
- package/dist/face-atlas/shapes.d.ts +86 -0
- package/dist/face-atlas/sides.d.ts +41 -0
- package/dist/face-atlas/skinMask.d.ts +35 -0
- package/dist/face-atlas/surface.d.ts +155 -0
- package/dist/face-atlas/topology.d.ts +44 -0
- package/dist/face-character/__fixtures__/faceImageDetections.d.ts +25 -0
- package/dist/face-character/__fixtures__/faceNode.d.ts +22 -0
- package/dist/face-character/bindFaceModel.d.ts +106 -0
- package/dist/face-character/canonicalFace.d.ts +17 -0
- package/dist/face-character/canonicalFaceGeometry.d.ts +11 -0
- package/dist/face-character/canonicalFacePositions.d.ts +7 -0
- package/dist/face-character/driveFaceModel.d.ts +57 -0
- package/dist/face-character/expressionOutputs.d.ts +45 -0
- package/dist/face-character/faceExpressions.d.ts +104 -0
- package/dist/face-character/faceImageLandmarker.d.ts +93 -0
- package/dist/face-character/faceMeshBinding.d.ts +62 -0
- package/dist/face-character/faceMorph.d.ts +77 -0
- package/dist/face-character/faceMorphs.d.ts +46 -0
- package/dist/face-character/facePhoto.d.ts +138 -0
- package/dist/face-character/facePiercings.d.ts +116 -0
- package/dist/face-character/facePin.d.ts +131 -0
- package/dist/face-character/faceReprojection.d.ts +273 -0
- package/dist/face-character/faceReprojector.d.ts +171 -0
- package/dist/face-character/faceRig.d.ts +176 -0
- package/dist/face-character/faceSwapPresence.d.ts +85 -0
- package/dist/face-character/faceTexture.d.ts +169 -0
- package/dist/face-character/faceTextureBaker.d.ts +86 -0
- package/dist/face-character/faceTextureGuide.d.ts +106 -0
- package/dist/face-character/faceTextureStats.d.ts +298 -0
- package/dist/face-character/faceTransfer.d.ts +396 -0
- package/dist/face-character/faceTransferGeometry.d.ts +109 -0
- package/dist/face-character/faceTransferSelfTest.d.ts +94 -0
- package/dist/face-character/faceWarp3D.d.ts +101 -0
- package/dist/face-character/faceless.d.ts +79 -0
- package/dist/face-character/featureWarp.d.ts +28 -0
- package/dist/face-character/liveFaceRegistry.d.ts +370 -0
- package/dist/face-character/liveValue.d.ts +12 -0
- package/dist/face-character/memo.d.ts +15 -0
- package/dist/face-effects.cjs +2252 -83
- package/dist/face-effects.js +14234 -1231
- package/dist/face-expression/index.d.ts +182 -0
- package/dist/face-info/landmarks.d.ts +17 -3
- package/dist/face-info/types.d.ts +20 -3
- package/dist/gestures/definitions.d.ts +15 -2
- package/dist/gestures/index.d.ts +1 -1
- package/dist/gestures/measures.d.ts +21 -8
- package/dist/getFaceInfo-B1otSDMX.cjs +1 -0
- package/dist/getFaceInfo-Cu4xDWiL.js +62 -0
- package/dist/hand/armFit.d.ts +46 -0
- package/dist/hand/armMask.d.ts +178 -0
- package/dist/hand/handCutout.d.ts +23 -0
- package/dist/hand/handCutoutRegistry.d.ts +7 -0
- package/dist/hand/handGestures.d.ts +524 -0
- package/dist/hand/handPose.d.ts +98 -0
- package/dist/hand/handRigSolver.d.ts +159 -0
- package/dist/hand/handTattoo.d.ts +81 -0
- package/dist/hand/handTouch.d.ts +240 -0
- package/dist/hand/wrist.d.ts +44 -0
- package/dist/hand/wristFilter.d.ts +44 -0
- package/dist/hooks/selectors.d.ts +8 -0
- package/dist/hooks/useFaceModelAcquisition.d.ts +38 -0
- package/dist/hooks/useTrackerContext.d.ts +6 -0
- package/dist/index-B1_TzJaI.js +1104 -0
- package/dist/index-BavF06C6.js +190 -0
- package/dist/index-BfFmpddl.cjs +21 -0
- package/dist/index-BuBzneeW.cjs +46 -0
- package/dist/index-CGsQWodV.cjs +1 -0
- package/dist/index-CIe7eCMH.js +3200 -0
- package/dist/index-CfSF8LXa.cjs +1 -0
- package/dist/index-D5GTzOzD.cjs +1 -0
- package/dist/index-DBhQzvVa.js +314 -0
- package/dist/index-DE17y0ZI.cjs +1 -0
- package/dist/index-JII7huPk.js +442 -0
- package/dist/index-tpCr9CLj.cjs +1 -0
- package/dist/{renderPasses-NnKZVfBy.js → index-w1S7fI2B.js} +219 -247
- package/dist/index-zGaqrz_K.js +188 -0
- package/dist/instructions.cjs +30 -0
- package/dist/instructions.js +1507 -0
- package/dist/{internal-vsfNQycj.js → internal-B90P-clC.js} +138 -118
- package/dist/internal-Cjinca64.cjs +1 -0
- package/dist/internal.cjs +1 -1
- package/dist/internal.js +15 -10
- package/dist/iris/compute.d.ts +7 -5
- package/dist/iris/types.d.ts +6 -4
- package/dist/{landmarkMask-CbTFzBYG.js → landmarkMask-BFDyBnKM.js} +6 -6
- package/dist/landmarks-BlUqf5MZ.cjs +1 -0
- package/dist/landmarks-bftdwq6Z.js +76 -0
- package/dist/loaders-BGAUACsd.js +363 -0
- package/dist/loaders-BJ1_QCHt.cjs +1 -0
- package/dist/low-level.cjs +1 -1
- package/dist/low-level.js +666 -602
- package/dist/main.cjs +1 -1
- package/dist/main.js +866 -1182
- package/dist/models/Body/index.d.ts +2 -0
- package/dist/models/Face/constants.d.ts +8 -0
- package/dist/models/Face/index.d.ts +3 -11
- package/dist/models/Face/rotation.d.ts +18 -3
- package/dist/models/Hand/HandTracking.d.ts +17 -1
- package/dist/models/Segmentation/index.d.ts +2 -0
- package/dist/models/nodeSource.d.ts +9 -0
- package/dist/particles/emission.d.ts +24 -0
- package/dist/particles/eyes.d.ts +24 -0
- package/dist/particles/glsl.d.ts +14 -0
- package/dist/particles/index.d.ts +10 -0
- package/dist/particles/motion.d.ts +42 -0
- package/dist/particles/presets.d.ts +12 -0
- package/dist/particles/ring.d.ts +58 -0
- package/dist/particles/selfTest.d.ts +53 -0
- package/dist/particles/settings.d.ts +127 -0
- package/dist/particles/shapes.d.ts +29 -0
- package/dist/particles/spawner.d.ts +60 -0
- package/dist/particles/system.d.ts +64 -0
- package/dist/particles.cjs +122 -0
- package/dist/particles.js +774 -0
- package/dist/product.cjs +1 -1
- package/dist/product.js +29 -29
- package/dist/{providers-C0Dlhh9Z.js → providers-C8rE26Uf.js} +127 -126
- package/dist/providers-DHsrhDI2.cjs +62 -0
- package/dist/render/renderPasses.d.ts +8 -0
- package/dist/render/sceneBeforeRender.d.ts +12 -0
- package/dist/{renderGroups-CN1cGFUo.js → renderGroups-B38pUaX2.js} +1 -1
- package/dist/{renderGroups-O4KmaMl9.cjs → renderGroups-Cb_4Ar1Q.cjs} +1 -1
- package/dist/renderPasses-B6l8IpJv.js +1290 -0
- package/dist/renderPasses-dqmkft4P.cjs +158 -0
- package/dist/renderState-CJNmj5jz.js +39 -0
- package/dist/renderState-apSfg4eR.cjs +1 -0
- package/dist/scene-object.cjs +1 -1
- package/dist/scene-object.js +2 -2
- package/dist/segmentation-Cb3ouK6Z.js +1758 -0
- package/dist/segmentation-D9pYO6aR.cjs +1 -0
- package/dist/segmentation2d/types.d.ts +6 -0
- package/dist/select-Ck5LGz-J.cjs +1 -0
- package/dist/select-pYRo_win.js +233 -0
- package/dist/selectors-C4X71aoD.cjs +1 -0
- package/dist/selectors-DmNaKIwE.js +196 -0
- package/dist/session-BrH8G7iJ.cjs +31 -0
- package/dist/session-DgA_z6O1.js +418 -0
- package/dist/{settings-aQk845NJ.js → settings-BJ7FMBsO.js} +53 -15
- package/dist/settings-C63FMBlF.cjs +1 -0
- package/dist/similarityFit-BFqHND2e.cjs +1 -0
- package/dist/similarityFit-Bbz-R8AY.js +91 -0
- package/dist/spring/index.d.ts +2 -0
- package/dist/spring/spring.d.ts +69 -0
- package/dist/spring/swing.d.ts +54 -0
- package/dist/tracking.cjs +10 -1
- package/dist/tracking.js +1002 -855
- package/dist/trigger-D0Pm9noT.cjs +49 -0
- package/dist/trigger-IQeys0oS.js +2128 -0
- package/dist/types/face.d.ts +20 -1
- package/dist/types/hand-tracking.d.ts +9 -0
- package/dist/types/nodes.d.ts +20 -1
- package/dist/types/segmentation.d.ts +5 -0
- package/dist/updateThrottle-BseecYag.js +4 -0
- package/dist/updateThrottle-Of5Y4SVa.cjs +1 -0
- package/dist/useFaceInfo-BHDNCvsJ.cjs +1 -0
- package/dist/useFaceInfo-J4x7LsqL.js +76 -0
- package/dist/useFaceResultReader-BvEo5REG.js +61 -0
- package/dist/useFaceResultReader-DuaL1KJG.cjs +1 -0
- package/dist/useInstructionHold-DOu-RpCM.js +53 -0
- package/dist/useInstructionHold-DwJY1Alr.cjs +1 -0
- package/dist/useLandmarkPoseFit-Bg-h9BPb.cjs +1 -0
- package/dist/useLandmarkPoseFit-Bmb3h6Mw.js +87 -0
- package/dist/{useXRCapabilities-B1R2ghy-.cjs → useXRCapabilities-Cr3RzuAW.cjs} +1 -1
- package/dist/{useXRCapabilities-C68v__wB.js → useXRCapabilities-Cxmlmpbd.js} +1 -1
- package/dist/utils/canonicalRigidLandmarks.d.ts +8 -0
- package/dist/utils/headOccluderFit.d.ts +42 -0
- package/dist/utils/integrity.d.ts +17 -0
- package/dist/utils/resolveNumFaces.d.ts +13 -0
- package/dist/utils/shoulderOccluderFit.d.ts +38 -0
- package/dist/utils/similarityFit.d.ts +23 -0
- package/dist/uv-BMFt19bg.cjs +1 -0
- package/dist/{index-CsUdQ-pn.js → uv-DJU_XfmN.js} +15 -249
- package/docs/SDK_DOCUMENTATION.md +1 -2
- package/docs/api/adaptive-quality.mdx +1 -1
- package/docs/api/body-instructions.mdx +285 -0
- package/docs/api/body-triggers.mdx +234 -0
- package/docs/api/camera-permission.mdx +1 -1
- package/docs/api/coordinate-spaces.mdx +7 -4
- package/docs/api/cross-camera.mdx +3 -2
- package/docs/api/debug-ui-scene-editor.mdx +23 -2
- package/docs/api/external-face-mesh.mdx +231 -0
- package/docs/api/face-actions.mdx +20 -16
- package/docs/api/face-attribute-expression.mdx +1 -1
- package/docs/api/face-binding-anchors.mdx +4 -2
- package/docs/api/face-character.mdx +157 -0
- package/docs/api/face-effects.mdx +3 -0
- package/docs/api/face-expression-controller.mdx +153 -0
- package/docs/api/face-info.mdx +17 -11
- package/docs/api/face-inset.mdx +204 -0
- package/docs/api/face-instructions.mdx +183 -0
- package/docs/api/face-liquify.mdx +196 -0
- package/docs/api/face-mesh.mdx +4 -7
- package/docs/api/face-morph.mdx +117 -0
- package/docs/api/face-painting.mdx +7 -0
- package/docs/api/face-reprojection.mdx +154 -0
- package/docs/api/face-retouching.mdx +18 -10
- package/docs/api/face-swap.mdx +350 -0
- package/docs/api/face-warp-3d.mdx +166 -0
- package/docs/api/faceless.mdx +143 -0
- package/docs/api/gestures.mdx +68 -32
- package/docs/api/hair.mdx +97 -0
- package/docs/api/hand-instructions.mdx +222 -0
- package/docs/api/hand-rig.mdx +535 -0
- package/docs/api/hand-touch.mdx +162 -0
- package/docs/api/head-occluder.mdx +563 -0
- package/docs/api/holistic-tracker.mdx +6 -1
- package/docs/api/instructions.mdx +323 -0
- package/docs/api/iris-tracking.mdx +24 -19
- package/docs/api/made-up-camera.mdx +131 -0
- package/docs/api/makeup-skin-tone.mdx +135 -0
- package/docs/api/makeup.mdx +353 -0
- package/docs/api/multi-subject.mdx +4 -1
- package/docs/api/particles.mdx +155 -0
- package/docs/api/person-cutout.mdx +1 -1
- package/docs/api/pin-to-face-mesh.mdx +274 -0
- package/docs/api/product-ar.mdx +5 -2
- package/docs/api/segmentation-overlay.mdx +1 -1
- package/docs/docs.json +29 -1
- package/docs/examples/lip-shaders.mdx +82 -33
- package/docs/guides/face-atlas-template.svg +1 -0
- package/docs/guides/face-atlas-textures.mdx +186 -0
- package/docs/guides/face-texture-template.svg +1 -0
- package/docs/guides/harness-debug-ui.mdx +4 -4
- package/docs/guides/lip-effect-textures.mdx +178 -102
- package/docs/guides/lip-uv-template.png +0 -0
- package/docs/guides/lip-uv-template.svg +1 -1
- package/docs/guides/makeup-design-textures.mdx +109 -0
- package/docs/introduction.mdx +1 -2
- package/package.json +11 -1
- package/dist/DebuggerUI-C-ldiozL.js +0 -269
- package/dist/DebuggerUI-CWX5EtQv.cjs +0 -1
- package/dist/FaceMeshRenderer-BEEXZwS6.cjs +0 -158
- package/dist/FaceMeshRenderer-UuH5sTXG.js +0 -1322
- package/dist/FaceRetouch-C7h7x9kd.js +0 -683
- package/dist/FaceRetouch-DqftT26Y.cjs +0 -134
- package/dist/GLTFLoader-C5q63sKO.js +0 -1633
- package/dist/GLTFLoader-Cb_CRwmG.cjs +0 -1
- package/dist/SegmentationOverlay-DQuW3dsc.js +0 -133
- package/dist/SegmentationOverlay-aWVod8Kl.cjs +0 -1
- package/dist/components/FaceWarp3D/FaceWarp3DHead.d.ts +0 -15
- package/dist/components/FaceWarp3D/defaults.d.ts +0 -37
- package/dist/components/FaceWarp3D/warp.d.ts +0 -13
- package/dist/contexts-CO0sd4JQ.cjs +0 -1
- package/dist/contexts-FzlnnMYD.js +0 -669
- package/dist/debug-ui/face-warp-3d/index.d.ts +0 -6
- package/dist/getFaceInfo-BkZfaQs-.js +0 -118
- package/dist/getFaceInfo-ahPxQFGu.cjs +0 -1
- package/dist/index--RgGzZ6X.cjs +0 -47
- package/dist/index-CHVbH0hz.js +0 -214
- package/dist/index-CeVkgsag.cjs +0 -1
- package/dist/index-CnGox6Xr.js +0 -3054
- package/dist/index-DKBAh6hV.cjs +0 -1
- package/dist/index-DsZwTfG0.cjs +0 -1
- package/dist/index-Dw6tj2Mi.js +0 -144
- package/dist/index-OCPjOaeP.cjs +0 -1
- package/dist/index-s9pF4zkG.js +0 -2053
- package/dist/internal-BYza1h8_.cjs +0 -1
- package/dist/measures-9dQPdw96.js +0 -154
- package/dist/measures-KfJzpvod.cjs +0 -1
- package/dist/providers-YNwkmNeK.cjs +0 -62
- package/dist/renderPasses-Cg-zqmEz.cjs +0 -21
- package/dist/screenTransform-BenfCtZt.js +0 -44
- package/dist/screenTransform-BiXdpVf0.cjs +0 -1
- package/dist/segmentation-9PhSvc-R.cjs +0 -1
- package/dist/segmentation-CeOTKemr.js +0 -5
- package/dist/selectors-C5G1PMYL.js +0 -195
- package/dist/selectors-Du_PsVnW.cjs +0 -1
- package/dist/session-BBr0yN8h.cjs +0 -31
- package/dist/session-Cy0m7l7-.js +0 -363
- package/dist/settings-DRR7-snV.cjs +0 -1
- package/dist/useFaceInfo-Blf7FCu3.js +0 -303
- package/dist/useFaceInfo-C5mO8NQY.cjs +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const u=require("three");function U(h,t){if(t===u.TrianglesDrawMode)return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."),h;if(t===u.TriangleFanDrawMode||t===u.TriangleStripDrawMode){let e=h.getIndex();if(e===null){const s=[],a=h.getAttribute("position");if(a!==void 0){for(let o=0;o<a.count;o++)s.push(o);h.setIndex(s),e=h.getIndex()}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."),h}const i=e.count-2,n=[];if(t===u.TriangleFanDrawMode)for(let s=1;s<=i;s++)n.push(e.getX(0)),n.push(e.getX(s)),n.push(e.getX(s+1));else for(let s=0;s<i;s++)s%2===0?(n.push(e.getX(s)),n.push(e.getX(s+1)),n.push(e.getX(s+2))):(n.push(e.getX(s+2)),n.push(e.getX(s+1)),n.push(e.getX(s)));n.length/3!==i&&console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");const r=h.clone();return r.setIndex(n),r.clearGroups(),r}else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:",t),h}class q extends u.Loader{constructor(t){super(t),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new J(e)}),this.register(function(e){return new $(e)}),this.register(function(e){return new ce(e)}),this.register(function(e){return new le(e)}),this.register(function(e){return new ue(e)}),this.register(function(e){return new te(e)}),this.register(function(e){return new ne(e)}),this.register(function(e){return new se(e)}),this.register(function(e){return new re(e)}),this.register(function(e){return new Z(e)}),this.register(function(e){return new ie(e)}),this.register(function(e){return new ee(e)}),this.register(function(e){return new ae(e)}),this.register(function(e){return new oe(e)}),this.register(function(e){return new Q(e)}),this.register(function(e){return new fe(e)}),this.register(function(e){return new he(e)})}load(t,e,i,n){const r=this;let s;if(this.resourcePath!=="")s=this.resourcePath;else if(this.path!==""){const c=u.LoaderUtils.extractUrlBase(t);s=u.LoaderUtils.resolveURL(c,this.path)}else s=u.LoaderUtils.extractUrlBase(t);this.manager.itemStart(t);const a=function(c){n?n(c):console.error(c),r.manager.itemError(t),r.manager.itemEnd(t)},o=new u.FileLoader(this.manager);o.setPath(this.path),o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(t,function(c){try{r.parse(c,s,function(f){e(f),r.manager.itemEnd(t)},a)}catch(f){a(f)}},i,a)}setDRACOLoader(t){return this.dracoLoader=t,this}setKTX2Loader(t){return this.ktx2Loader=t,this}setMeshoptDecoder(t){return this.meshoptDecoder=t,this}register(t){return this.pluginCallbacks.indexOf(t)===-1&&this.pluginCallbacks.push(t),this}unregister(t){return this.pluginCallbacks.indexOf(t)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(t),1),this}parse(t,e,i,n){let r;const s={},a={},o=new TextDecoder;if(typeof t=="string")r=JSON.parse(t);else if(t instanceof ArrayBuffer)if(o.decode(new Uint8Array(t,0,4))===X){try{s[A.KHR_BINARY_GLTF]=new de(t)}catch(l){n&&n(l);return}r=JSON.parse(s[A.KHR_BINARY_GLTF].content)}else r=JSON.parse(o.decode(t));else r=t;if(r.asset===void 0||r.asset.version[0]<2){n&&n(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const c=new ye(r,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});c.fileLoader.setRequestHeader(this.requestHeader);for(let f=0;f<this.pluginCallbacks.length;f++){const l=this.pluginCallbacks[f](c);l.name||console.error("THREE.GLTFLoader: Invalid plugin found: missing name"),a[l.name]=l,s[l.name]=!0}if(r.extensionsUsed)for(let f=0;f<r.extensionsUsed.length;++f){const l=r.extensionsUsed[f],d=r.extensionsRequired||[];switch(l){case A.KHR_MATERIALS_UNLIT:s[l]=new Y;break;case A.KHR_DRACO_MESH_COMPRESSION:s[l]=new pe(r,this.dracoLoader);break;case A.KHR_TEXTURE_TRANSFORM:s[l]=new me;break;case A.KHR_MESH_QUANTIZATION:s[l]=new ge;break;default:d.indexOf(l)>=0&&a[l]===void 0&&console.warn('THREE.GLTFLoader: Unknown extension "'+l+'".')}}c.setExtensions(s),c.setPlugins(a),c.parse(i,n)}parseAsync(t,e){const i=this;return new Promise(function(n,r){i.parse(t,e,n,r)})}}function W(){let h={};return{get:function(t){return h[t]},add:function(t,e){h[t]=e},remove:function(t){delete h[t]},removeAll:function(){h={}}}}const A={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class Q{constructor(t){this.parser=t,this.name=A.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const t=this.parser,e=this.parser.json.nodes||[];for(let i=0,n=e.length;i<n;i++){const r=e[i];r.extensions&&r.extensions[this.name]&&r.extensions[this.name].light!==void 0&&t._addNodeRef(this.cache,r.extensions[this.name].light)}}_loadLight(t){const e=this.parser,i="light:"+t;let n=e.cache.get(i);if(n)return n;const r=e.json,o=((r.extensions&&r.extensions[this.name]||{}).lights||[])[t];let c;const f=new u.Color(16777215);o.color!==void 0&&f.setRGB(o.color[0],o.color[1],o.color[2],u.LinearSRGBColorSpace);const l=o.range!==void 0?o.range:0;switch(o.type){case"directional":c=new u.DirectionalLight(f),c.target.position.set(0,0,-1),c.add(c.target);break;case"point":c=new u.PointLight(f),c.distance=l;break;case"spot":c=new u.SpotLight(f),c.distance=l,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);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+o.type)}return c.position.set(0,0,0),y(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(i,n),n}getDependency(t,e){if(t==="light")return this._loadLight(e)}createNodeAttachment(t){const e=this,i=this.parser,r=i.json.nodes[t],a=(r.extensions&&r.extensions[this.name]||{}).light;return a===void 0?null:this._loadLight(a).then(function(o){return i._getNodeRef(e.cache,a,o)})}}class Y{constructor(){this.name=A.KHR_MATERIALS_UNLIT}getMaterialType(){return u.MeshBasicMaterial}extendParams(t,e,i){const n=[];t.color=new u.Color(1,1,1),t.opacity=1;const r=e.pbrMetallicRoughness;if(r){if(Array.isArray(r.baseColorFactor)){const s=r.baseColorFactor;t.color.setRGB(s[0],s[1],s[2],u.LinearSRGBColorSpace),t.opacity=s[3]}r.baseColorTexture!==void 0&&n.push(i.assignTexture(t,"map",r.baseColorTexture,u.SRGBColorSpace))}return Promise.all(n)}}class Z{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=n.extensions[this.name].emissiveStrength;return r!==void 0&&(e.emissiveIntensity=r),Promise.resolve()}}class J{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_CLEARCOAT}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];if(s.clearcoatFactor!==void 0&&(e.clearcoat=s.clearcoatFactor),s.clearcoatTexture!==void 0&&r.push(i.assignTexture(e,"clearcoatMap",s.clearcoatTexture)),s.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=s.clearcoatRoughnessFactor),s.clearcoatRoughnessTexture!==void 0&&r.push(i.assignTexture(e,"clearcoatRoughnessMap",s.clearcoatRoughnessTexture)),s.clearcoatNormalTexture!==void 0&&(r.push(i.assignTexture(e,"clearcoatNormalMap",s.clearcoatNormalTexture)),s.clearcoatNormalTexture.scale!==void 0)){const a=s.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new u.Vector2(a,a)}return Promise.all(r)}}class ${constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_DISPERSION}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=n.extensions[this.name];return e.dispersion=r.dispersion!==void 0?r.dispersion:0,Promise.resolve()}}class ee{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_IRIDESCENCE}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];return s.iridescenceFactor!==void 0&&(e.iridescence=s.iridescenceFactor),s.iridescenceTexture!==void 0&&r.push(i.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&&r.push(i.assignTexture(e,"iridescenceThicknessMap",s.iridescenceThicknessTexture)),Promise.all(r)}}class te{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_SHEEN}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[];e.sheenColor=new u.Color(0,0,0),e.sheenRoughness=0,e.sheen=1;const s=n.extensions[this.name];if(s.sheenColorFactor!==void 0){const a=s.sheenColorFactor;e.sheenColor.setRGB(a[0],a[1],a[2],u.LinearSRGBColorSpace)}return s.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=s.sheenRoughnessFactor),s.sheenColorTexture!==void 0&&r.push(i.assignTexture(e,"sheenColorMap",s.sheenColorTexture,u.SRGBColorSpace)),s.sheenRoughnessTexture!==void 0&&r.push(i.assignTexture(e,"sheenRoughnessMap",s.sheenRoughnessTexture)),Promise.all(r)}}class ne{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_TRANSMISSION}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];return s.transmissionFactor!==void 0&&(e.transmission=s.transmissionFactor),s.transmissionTexture!==void 0&&r.push(i.assignTexture(e,"transmissionMap",s.transmissionTexture)),Promise.all(r)}}class se{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_VOLUME}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];e.thickness=s.thicknessFactor!==void 0?s.thicknessFactor:0,s.thicknessTexture!==void 0&&r.push(i.assignTexture(e,"thicknessMap",s.thicknessTexture)),e.attenuationDistance=s.attenuationDistance||1/0;const a=s.attenuationColor||[1,1,1];return e.attenuationColor=new u.Color().setRGB(a[0],a[1],a[2],u.LinearSRGBColorSpace),Promise.all(r)}}class re{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_IOR}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const n=this.parser.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=n.extensions[this.name];return e.ior=r.ior!==void 0?r.ior:1.5,Promise.resolve()}}class ie{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_SPECULAR}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];e.specularIntensity=s.specularFactor!==void 0?s.specularFactor:1,s.specularTexture!==void 0&&r.push(i.assignTexture(e,"specularIntensityMap",s.specularTexture));const a=s.specularColorFactor||[1,1,1];return e.specularColor=new u.Color().setRGB(a[0],a[1],a[2],u.LinearSRGBColorSpace),s.specularColorTexture!==void 0&&r.push(i.assignTexture(e,"specularColorMap",s.specularColorTexture,u.SRGBColorSpace)),Promise.all(r)}}class oe{constructor(t){this.parser=t,this.name=A.EXT_MATERIALS_BUMP}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];return e.bumpScale=s.bumpFactor!==void 0?s.bumpFactor:1,s.bumpTexture!==void 0&&r.push(i.assignTexture(e,"bumpMap",s.bumpTexture)),Promise.all(r)}}class ae{constructor(t){this.parser=t,this.name=A.KHR_MATERIALS_ANISOTROPY}getMaterialType(t){const i=this.parser.json.materials[t];return!i.extensions||!i.extensions[this.name]?null:u.MeshPhysicalMaterial}extendMaterialParams(t,e){const i=this.parser,n=i.json.materials[t];if(!n.extensions||!n.extensions[this.name])return Promise.resolve();const r=[],s=n.extensions[this.name];return s.anisotropyStrength!==void 0&&(e.anisotropy=s.anisotropyStrength),s.anisotropyRotation!==void 0&&(e.anisotropyRotation=s.anisotropyRotation),s.anisotropyTexture!==void 0&&r.push(i.assignTexture(e,"anisotropyMap",s.anisotropyTexture)),Promise.all(r)}}class ce{constructor(t){this.parser=t,this.name=A.KHR_TEXTURE_BASISU}loadTexture(t){const e=this.parser,i=e.json,n=i.textures[t];if(!n.extensions||!n.extensions[this.name])return null;const r=n.extensions[this.name],s=e.options.ktx2Loader;if(!s){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(t,r.source,s)}}class le{constructor(t){this.parser=t,this.name=A.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(t){const e=this.name,i=this.parser,n=i.json,r=n.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=n.images[s.source];let o=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(o=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(t,s.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class ue{constructor(t){this.parser=t,this.name=A.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(t){const e=this.name,i=this.parser,n=i.json,r=n.textures[t];if(!r.extensions||!r.extensions[e])return null;const s=r.extensions[e],a=n.images[s.source];let o=i.textureLoader;if(a.uri){const c=i.options.manager.getHandler(a.uri);c!==null&&(o=c)}return this.detectSupport().then(function(c){if(c)return i.loadTextureImage(t,s.source,o);if(n.extensionsRequired&&n.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(t)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(t){const e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){t(e.height===1)}})),this.isSupported}}class fe{constructor(t){this.name=A.EXT_MESHOPT_COMPRESSION,this.parser=t}loadBufferView(t){const e=this.parser.json,i=e.bufferViews[t];if(i.extensions&&i.extensions[this.name]){const n=i.extensions[this.name],r=this.parser.getDependency("buffer",n.buffer),s=this.parser.options.meshoptDecoder;if(!s||!s.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return r.then(function(a){const o=n.byteOffset||0,c=n.byteLength||0,f=n.count,l=n.byteStride,d=new Uint8Array(a,o,c);return s.decodeGltfBufferAsync?s.decodeGltfBufferAsync(f,l,d,n.mode,n.filter).then(function(p){return p.buffer}):s.ready.then(function(){const p=new ArrayBuffer(f*l);return s.decodeGltfBuffer(new Uint8Array(p),f,l,d,n.mode,n.filter),p})})}else return null}}class he{constructor(t){this.name=A.EXT_MESH_GPU_INSTANCING,this.parser=t}createNodeMesh(t){const e=this.parser.json,i=e.nodes[t];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const n=e.meshes[i.mesh];for(const c of n.primitives)if(c.mode!==L.TRIANGLES&&c.mode!==L.TRIANGLE_STRIP&&c.mode!==L.TRIANGLE_FAN&&c.mode!==void 0)return null;const s=i.extensions[this.name].attributes,a=[],o={};for(const c in s)a.push(this.parser.getDependency("accessor",s[c]).then(f=>(o[c]=f,o[c])));return a.length<1?null:(a.push(this.parser.createNodeMesh(t)),Promise.all(a).then(c=>{const f=c.pop(),l=f.isGroup?f.children:[f],d=c[0].count,p=[];for(const g of l){const R=new u.Matrix4,m=new u.Vector3,T=new u.Quaternion,E=new u.Vector3(1,1,1),M=new u.InstancedMesh(g.geometry,g.material,d);for(let x=0;x<d;x++)o.TRANSLATION&&m.fromBufferAttribute(o.TRANSLATION,x),o.ROTATION&&T.fromBufferAttribute(o.ROTATION,x),o.SCALE&&E.fromBufferAttribute(o.SCALE,x),M.setMatrixAt(x,R.compose(m,T,E));for(const x in o)if(x==="_COLOR_0"){const _=o[x];M.instanceColor=new u.InstancedBufferAttribute(_.array,_.itemSize,_.normalized)}else x!=="TRANSLATION"&&x!=="ROTATION"&&x!=="SCALE"&&g.geometry.setAttribute(x,o[x]);u.Object3D.prototype.copy.call(M,g),this.parser.assignFinalMaterial(M),p.push(M)}return f.isGroup?(f.clear(),f.add(...p),f):p[0]}))}}const X="glTF",F=12,v={JSON:1313821514,BIN:5130562};class de{constructor(t){this.name=A.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(t,0,F),i=new TextDecoder;if(this.header={magic:i.decode(new Uint8Array(t.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==X)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const n=this.header.length-F,r=new DataView(t,F);let s=0;for(;s<n;){const a=r.getUint32(s,!0);s+=4;const o=r.getUint32(s,!0);if(s+=4,o===v.JSON){const c=new Uint8Array(t,F+s,a);this.content=i.decode(c)}else if(o===v.BIN){const c=F+s;this.body=t.slice(c,c+a)}s+=a}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class pe{constructor(t,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=A.KHR_DRACO_MESH_COMPRESSION,this.json=t,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(t,e){const i=this.json,n=this.dracoLoader,r=t.extensions[this.name].bufferView,s=t.extensions[this.name].attributes,a={},o={},c={};for(const f in s){const l=B[f]||f.toLowerCase();a[l]=s[f]}for(const f in t.attributes){const l=B[f]||f.toLowerCase();if(s[f]!==void 0){const d=i.accessors[t.attributes[f]],p=C[d.componentType];c[l]=p.name,o[l]=d.normalized===!0}}return e.getDependency("bufferView",r).then(function(f){return new Promise(function(l,d){n.decodeDracoFile(f,function(p){for(const g in p.attributes){const R=p.attributes[g],m=o[g];m!==void 0&&(R.normalized=m)}l(p)},a,c,u.LinearSRGBColorSpace,d)})})}}class me{constructor(){this.name=A.KHR_TEXTURE_TRANSFORM}extendTexture(t,e){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}}class ge{constructor(){this.name=A.KHR_MESH_QUANTIZATION}}class z extends u.Interpolant{constructor(t,e,i,n){super(t,e,i,n)}copySampleValue_(t){const e=this.resultBuffer,i=this.sampleValues,n=this.valueSize,r=t*n*3+n;for(let s=0;s!==n;s++)e[s]=i[r+s];return e}interpolate_(t,e,i,n){const r=this.resultBuffer,s=this.sampleValues,a=this.valueSize,o=a*2,c=a*3,f=n-e,l=(i-e)/f,d=l*l,p=d*l,g=t*c,R=g-c,m=-2*p+3*d,T=p-d,E=1-m,M=T-d+l;for(let x=0;x!==a;x++){const _=s[R+x+a],w=s[R+x+o]*f,S=s[g+x+a],O=s[g+x]*f;r[x]=E*_+M*w+m*S+T*O}return r}}const Ae=new u.Quaternion;class Te extends z{interpolate_(t,e,i,n){const r=super.interpolate_(t,e,i,n);return Ae.fromArray(r).normalize().toArray(r),r}}const L={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},C={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},j={9728:u.NearestFilter,9729:u.LinearFilter,9984:u.NearestMipmapNearestFilter,9985:u.LinearMipmapNearestFilter,9986:u.NearestMipmapLinearFilter,9987:u.LinearMipmapLinearFilter},K={33071:u.ClampToEdgeWrapping,33648:u.MirroredRepeatWrapping,10497:u.RepeatWrapping},P={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},B={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3",COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},I={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},Re={CUBICSPLINE:void 0,LINEAR:u.InterpolateLinear,STEP:u.InterpolateDiscrete},G={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function xe(h){return h.DefaultMaterial===void 0&&(h.DefaultMaterial=new u.MeshStandardMaterial({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:u.FrontSide})),h.DefaultMaterial}function N(h,t,e){for(const i in e.extensions)h[i]===void 0&&(t.userData.gltfExtensions=t.userData.gltfExtensions||{},t.userData.gltfExtensions[i]=e.extensions[i])}function y(h,t){t.extras!==void 0&&(typeof t.extras=="object"?Object.assign(h.userData,t.extras):console.warn("THREE.GLTFLoader: Ignoring primitive type .extras, "+t.extras))}function Ee(h,t,e){let i=!1,n=!1,r=!1;for(let c=0,f=t.length;c<f;c++){const l=t[c];if(l.POSITION!==void 0&&(i=!0),l.NORMAL!==void 0&&(n=!0),l.COLOR_0!==void 0&&(r=!0),i&&n&&r)break}if(!i&&!n&&!r)return Promise.resolve(h);const s=[],a=[],o=[];for(let c=0,f=t.length;c<f;c++){const l=t[c];if(i){const d=l.POSITION!==void 0?e.getDependency("accessor",l.POSITION):h.attributes.position;s.push(d)}if(n){const d=l.NORMAL!==void 0?e.getDependency("accessor",l.NORMAL):h.attributes.normal;a.push(d)}if(r){const d=l.COLOR_0!==void 0?e.getDependency("accessor",l.COLOR_0):h.attributes.color;o.push(d)}}return Promise.all([Promise.all(s),Promise.all(a),Promise.all(o)]).then(function(c){const f=c[0],l=c[1],d=c[2];return i&&(h.morphAttributes.position=f),n&&(h.morphAttributes.normal=l),r&&(h.morphAttributes.color=d),h.morphTargetsRelative=!0,h})}function Me(h,t){if(h.updateMorphTargets(),t.weights!==void 0)for(let e=0,i=t.weights.length;e<i;e++)h.morphTargetInfluences[e]=t.weights[e];if(t.extras&&Array.isArray(t.extras.targetNames)){const e=t.extras.targetNames;if(h.morphTargetInfluences.length===e.length){h.morphTargetDictionary={};for(let i=0,n=e.length;i<n;i++)h.morphTargetDictionary[e[i]]=i}else console.warn("THREE.GLTFLoader: Invalid extras.targetNames length. Ignoring names.")}}function Le(h){let t;const e=h.extensions&&h.extensions[A.KHR_DRACO_MESH_COMPRESSION];if(e?t="draco:"+e.bufferView+":"+e.indices+":"+k(e.attributes):t=h.indices+":"+k(h.attributes)+":"+h.mode,h.targets!==void 0)for(let i=0,n=h.targets.length;i<n;i++)t+=":"+k(h.targets[i]);return t}function k(h){let t="";const e=Object.keys(h).sort();for(let i=0,n=e.length;i<n;i++)t+=e[i]+":"+h[e[i]]+";";return t}function H(h){switch(h){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function Se(h){return h.search(/\.jpe?g($|\?)/i)>0||h.search(/^data\:image\/jpeg/)===0?"image/jpeg":h.search(/\.webp($|\?)/i)>0||h.search(/^data\:image\/webp/)===0?"image/webp":h.search(/\.ktx2($|\?)/i)>0||h.search(/^data\:image\/ktx2/)===0?"image/ktx2":"image/png"}const _e=new u.Matrix4;class ye{constructor(t={},e={}){this.json=t,this.extensions={},this.plugins={},this.options=e,this.cache=new W,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,n=-1,r=!1,s=-1;if(typeof navigator<"u"){const a=navigator.userAgent;i=/^((?!chrome|android).)*safari/i.test(a)===!0;const o=a.match(/Version\/(\d+)/);n=i&&o?parseInt(o[1],10):-1,r=a.indexOf("Firefox")>-1,s=r?a.match(/Firefox\/([0-9]+)\./)[1]:-1}typeof createImageBitmap>"u"||i&&n<17||r&&s<98?this.textureLoader=new u.TextureLoader(this.options.manager):this.textureLoader=new u.ImageBitmapLoader(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new u.FileLoader(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(t){this.extensions=t}setPlugins(t){this.plugins=t}parse(t,e){const i=this,n=this.json,r=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(s){return s._markDefs&&s._markDefs()}),Promise.all(this._invokeAll(function(s){return s.beforeRoot&&s.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(s){const a={scene:s[0][n.scene||0],scenes:s[0],animations:s[1],cameras:s[2],asset:n.asset,parser:i,userData:{}};return N(r,a,n),y(a,n),Promise.all(i._invokeAll(function(o){return o.afterRoot&&o.afterRoot(a)})).then(function(){for(const o of a.scenes)o.updateMatrixWorld();t(a)})}).catch(e)}_markDefs(){const t=this.json.nodes||[],e=this.json.skins||[],i=this.json.meshes||[];for(let n=0,r=e.length;n<r;n++){const s=e[n].joints;for(let a=0,o=s.length;a<o;a++)t[s[a]].isBone=!0}for(let n=0,r=t.length;n<r;n++){const s=t[n];s.mesh!==void 0&&(this._addNodeRef(this.meshCache,s.mesh),s.skin!==void 0&&(i[s.mesh].isSkinnedMesh=!0)),s.camera!==void 0&&this._addNodeRef(this.cameraCache,s.camera)}}_addNodeRef(t,e){e!==void 0&&(t.refs[e]===void 0&&(t.refs[e]=t.uses[e]=0),t.refs[e]++)}_getNodeRef(t,e,i){if(t.refs[e]<=1)return i;const n=i.clone(),r=(s,a)=>{const o=this.associations.get(s);o!=null&&this.associations.set(a,o);for(const[c,f]of s.children.entries())r(f,a.children[c])};return r(i,n),n.name+="_instance_"+t.uses[e]++,n}_invokeOne(t){const e=Object.values(this.plugins);e.push(this);for(let i=0;i<e.length;i++){const n=t(e[i]);if(n)return n}return null}_invokeAll(t){const e=Object.values(this.plugins);e.unshift(this);const i=[];for(let n=0;n<e.length;n++){const r=t(e[n]);r&&i.push(r)}return i}getDependency(t,e){const i=t+":"+e;let n=this.cache.get(i);if(!n){switch(t){case"scene":n=this.loadScene(e);break;case"node":n=this._invokeOne(function(r){return r.loadNode&&r.loadNode(e)});break;case"mesh":n=this._invokeOne(function(r){return r.loadMesh&&r.loadMesh(e)});break;case"accessor":n=this.loadAccessor(e);break;case"bufferView":n=this._invokeOne(function(r){return r.loadBufferView&&r.loadBufferView(e)});break;case"buffer":n=this.loadBuffer(e);break;case"material":n=this._invokeOne(function(r){return r.loadMaterial&&r.loadMaterial(e)});break;case"texture":n=this._invokeOne(function(r){return r.loadTexture&&r.loadTexture(e)});break;case"skin":n=this.loadSkin(e);break;case"animation":n=this._invokeOne(function(r){return r.loadAnimation&&r.loadAnimation(e)});break;case"camera":n=this.loadCamera(e);break;default:if(n=this._invokeOne(function(r){return r!=this&&r.getDependency&&r.getDependency(t,e)}),!n)throw new Error("Unknown type: "+t);break}this.cache.add(i,n)}return n}getDependencies(t){let e=this.cache.get(t);if(!e){const i=this,n=this.json[t+(t==="mesh"?"es":"s")]||[];e=Promise.all(n.map(function(r,s){return i.getDependency(t,s)})),this.cache.add(t,e)}return e}loadBuffer(t){const e=this.json.buffers[t],i=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&t===0)return Promise.resolve(this.extensions[A.KHR_BINARY_GLTF].body);const n=this.options;return new Promise(function(r,s){i.load(u.LoaderUtils.resolveURL(e.uri,n.path),r,void 0,function(){s(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(t){const e=this.json.bufferViews[t];return this.getDependency("buffer",e.buffer).then(function(i){const n=e.byteLength||0,r=e.byteOffset||0;return i.slice(r,r+n)})}loadAccessor(t){const e=this,i=this.json,n=this.json.accessors[t];if(n.bufferView===void 0&&n.sparse===void 0){const s=P[n.type],a=C[n.componentType],o=n.normalized===!0,c=new a(n.count*s);return Promise.resolve(new u.BufferAttribute(c,s,o))}const r=[];return n.bufferView!==void 0?r.push(this.getDependency("bufferView",n.bufferView)):r.push(null),n.sparse!==void 0&&(r.push(this.getDependency("bufferView",n.sparse.indices.bufferView)),r.push(this.getDependency("bufferView",n.sparse.values.bufferView))),Promise.all(r).then(function(s){const a=s[0],o=P[n.type],c=C[n.componentType],f=c.BYTES_PER_ELEMENT,l=f*o,d=n.byteOffset||0,p=n.bufferView!==void 0?i.bufferViews[n.bufferView].byteStride:void 0,g=n.normalized===!0;let R,m;if(p&&p!==l){const T=Math.floor(d/p),E="InterleavedBuffer:"+n.bufferView+":"+n.componentType+":"+T+":"+n.count;let M=e.cache.get(E);M||(R=new c(a,T*p,n.count*p/f),M=new u.InterleavedBuffer(R,p/f),e.cache.add(E,M)),m=new u.InterleavedBufferAttribute(M,o,d%p/f,g)}else a===null?R=new c(n.count*o):R=new c(a,d,n.count*o),m=new u.BufferAttribute(R,o,g);if(n.sparse!==void 0){const T=P.SCALAR,E=C[n.sparse.indices.componentType],M=n.sparse.indices.byteOffset||0,x=n.sparse.values.byteOffset||0,_=new E(s[1],M,n.sparse.count*T),w=new c(s[2],x,n.sparse.count*o);a!==null&&(m=new u.BufferAttribute(m.array.slice(),m.itemSize,m.normalized)),m.normalized=!1;for(let S=0,O=_.length;S<O;S++){const b=_[S];if(m.setX(b,w[S*o]),o>=2&&m.setY(b,w[S*o+1]),o>=3&&m.setZ(b,w[S*o+2]),o>=4&&m.setW(b,w[S*o+3]),o>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}m.normalized=g}return m})}loadTexture(t){const e=this.json,i=this.options,r=e.textures[t].source,s=e.images[r];let a=this.textureLoader;if(s.uri){const o=i.manager.getHandler(s.uri);o!==null&&(a=o)}return this.loadTextureImage(t,r,a)}loadTextureImage(t,e,i){const n=this,r=this.json,s=r.textures[t],a=r.images[e],o=(a.uri||a.bufferView)+":"+s.sampler;if(this.textureCache[o])return this.textureCache[o];const c=this.loadImageSource(e,i).then(function(f){f.flipY=!1,f.name=s.name||a.name||"",f.name===""&&typeof a.uri=="string"&&a.uri.startsWith("data:image/")===!1&&(f.name=a.uri);const d=(r.samplers||{})[s.sampler]||{};return f.magFilter=j[d.magFilter]||u.LinearFilter,f.minFilter=j[d.minFilter]||u.LinearMipmapLinearFilter,f.wrapS=K[d.wrapS]||u.RepeatWrapping,f.wrapT=K[d.wrapT]||u.RepeatWrapping,f.generateMipmaps=!f.isCompressedTexture&&f.minFilter!==u.NearestFilter&&f.minFilter!==u.LinearFilter,n.associations.set(f,{textures:t}),f}).catch(function(){return null});return this.textureCache[o]=c,c}loadImageSource(t,e){const i=this,n=this.json,r=this.options;if(this.sourceCache[t]!==void 0)return this.sourceCache[t].then(l=>l.clone());const s=n.images[t],a=self.URL||self.webkitURL;let o=s.uri||"",c=!1;if(s.bufferView!==void 0)o=i.getDependency("bufferView",s.bufferView).then(function(l){c=!0;const d=new Blob([l],{type:s.mimeType});return o=a.createObjectURL(d),o});else if(s.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+t+" is missing URI and bufferView");const f=Promise.resolve(o).then(function(l){return new Promise(function(d,p){let g=d;e.isImageBitmapLoader===!0&&(g=function(R){const m=new u.Texture(R);m.needsUpdate=!0,d(m)}),e.load(u.LoaderUtils.resolveURL(l,r.path),g,void 0,p)})}).then(function(l){return c===!0&&a.revokeObjectURL(o),y(l,s),l.userData.mimeType=s.mimeType||Se(s.uri),l}).catch(function(l){throw console.error("THREE.GLTFLoader: Couldn't load texture",o),l});return this.sourceCache[t]=f,f}assignTexture(t,e,i,n){const r=this;return this.getDependency("texture",i.index).then(function(s){if(!s)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(s=s.clone(),s.channel=i.texCoord),r.extensions[A.KHR_TEXTURE_TRANSFORM]){const a=i.extensions!==void 0?i.extensions[A.KHR_TEXTURE_TRANSFORM]:void 0;if(a){const o=r.associations.get(s);s=r.extensions[A.KHR_TEXTURE_TRANSFORM].extendTexture(s,a),r.associations.set(s,o)}}return n!==void 0&&(s.colorSpace=n),t[e]=s,s})}assignFinalMaterial(t){const e=t.geometry;let i=t.material;const n=e.attributes.tangent===void 0,r=e.attributes.color!==void 0,s=e.attributes.normal===void 0;if(t.isPoints){const a="PointsMaterial:"+i.uuid;let o=this.cache.get(a);o||(o=new u.PointsMaterial,u.Material.prototype.copy.call(o,i),o.color.copy(i.color),o.map=i.map,o.sizeAttenuation=!1,this.cache.add(a,o)),i=o}else if(t.isLine){const a="LineBasicMaterial:"+i.uuid;let o=this.cache.get(a);o||(o=new u.LineBasicMaterial,u.Material.prototype.copy.call(o,i),o.color.copy(i.color),o.map=i.map,this.cache.add(a,o)),i=o}if(n||r||s){let a="ClonedMaterial:"+i.uuid+":";n&&(a+="derivative-tangents:"),r&&(a+="vertex-colors:"),s&&(a+="flat-shading:");let o=this.cache.get(a);o||(o=i.clone(),r&&(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(i))),i=o}t.material=i}getMaterialType(){return u.MeshStandardMaterial}loadMaterial(t){const e=this,i=this.json,n=this.extensions,r=i.materials[t];let s;const a={},o=r.extensions||{},c=[];if(o[A.KHR_MATERIALS_UNLIT]){const l=n[A.KHR_MATERIALS_UNLIT];s=l.getMaterialType(),c.push(l.extendParams(a,r,e))}else{const l=r.pbrMetallicRoughness||{};if(a.color=new u.Color(1,1,1),a.opacity=1,Array.isArray(l.baseColorFactor)){const d=l.baseColorFactor;a.color.setRGB(d[0],d[1],d[2],u.LinearSRGBColorSpace),a.opacity=d[3]}l.baseColorTexture!==void 0&&c.push(e.assignTexture(a,"map",l.baseColorTexture,u.SRGBColorSpace)),a.metalness=l.metallicFactor!==void 0?l.metallicFactor:1,a.roughness=l.roughnessFactor!==void 0?l.roughnessFactor:1,l.metallicRoughnessTexture!==void 0&&(c.push(e.assignTexture(a,"metalnessMap",l.metallicRoughnessTexture)),c.push(e.assignTexture(a,"roughnessMap",l.metallicRoughnessTexture))),s=this._invokeOne(function(d){return d.getMaterialType&&d.getMaterialType(t)}),c.push(Promise.all(this._invokeAll(function(d){return d.extendMaterialParams&&d.extendMaterialParams(t,a)})))}r.doubleSided===!0&&(a.side=u.DoubleSide);const f=r.alphaMode||G.OPAQUE;if(f===G.BLEND?(a.transparent=!0,a.depthWrite=!1):(a.transparent=!1,f===G.MASK&&(a.alphaTest=r.alphaCutoff!==void 0?r.alphaCutoff:.5)),r.normalTexture!==void 0&&s!==u.MeshBasicMaterial&&(c.push(e.assignTexture(a,"normalMap",r.normalTexture)),a.normalScale=new u.Vector2(1,1),r.normalTexture.scale!==void 0)){const l=r.normalTexture.scale;a.normalScale.set(l,l)}if(r.occlusionTexture!==void 0&&s!==u.MeshBasicMaterial&&(c.push(e.assignTexture(a,"aoMap",r.occlusionTexture)),r.occlusionTexture.strength!==void 0&&(a.aoMapIntensity=r.occlusionTexture.strength)),r.emissiveFactor!==void 0&&s!==u.MeshBasicMaterial){const l=r.emissiveFactor;a.emissive=new u.Color().setRGB(l[0],l[1],l[2],u.LinearSRGBColorSpace)}return r.emissiveTexture!==void 0&&s!==u.MeshBasicMaterial&&c.push(e.assignTexture(a,"emissiveMap",r.emissiveTexture,u.SRGBColorSpace)),Promise.all(c).then(function(){const l=new s(a);return r.name&&(l.name=r.name),y(l,r),e.associations.set(l,{materials:t}),r.extensions&&N(n,l,r),l})}createUniqueName(t){const e=u.PropertyBinding.sanitizeNodeName(t||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(t){const e=this,i=this.extensions,n=this.primitiveCache;function r(a){return i[A.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(a,e).then(function(o){return V(o,a,e)})}const s=[];for(let a=0,o=t.length;a<o;a++){const c=t[a],f=Le(c),l=n[f];if(l)s.push(l.promise);else{let d;c.extensions&&c.extensions[A.KHR_DRACO_MESH_COMPRESSION]?d=r(c):d=V(new u.BufferGeometry,c,e),n[f]={primitive:c,promise:d},s.push(d)}}return Promise.all(s)}loadMesh(t){const e=this,i=this.json,n=this.extensions,r=i.meshes[t],s=r.primitives,a=[];for(let o=0,c=s.length;o<c;o++){const f=s[o].material===void 0?xe(this.cache):this.getDependency("material",s[o].material);a.push(f)}return a.push(e.loadGeometries(s)),Promise.all(a).then(function(o){const c=o.slice(0,o.length-1),f=o[o.length-1],l=[];for(let p=0,g=f.length;p<g;p++){const R=f[p],m=s[p];let T;const E=c[p];if(m.mode===L.TRIANGLES||m.mode===L.TRIANGLE_STRIP||m.mode===L.TRIANGLE_FAN||m.mode===void 0)T=r.isSkinnedMesh===!0?new u.SkinnedMesh(R,E):new u.Mesh(R,E),T.isSkinnedMesh===!0&&T.normalizeSkinWeights(),m.mode===L.TRIANGLE_STRIP?T.geometry=U(T.geometry,u.TriangleStripDrawMode):m.mode===L.TRIANGLE_FAN&&(T.geometry=U(T.geometry,u.TriangleFanDrawMode));else if(m.mode===L.LINES)T=new u.LineSegments(R,E);else if(m.mode===L.LINE_STRIP)T=new u.Line(R,E);else if(m.mode===L.LINE_LOOP)T=new u.LineLoop(R,E);else if(m.mode===L.POINTS)T=new u.Points(R,E);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+m.mode);Object.keys(T.geometry.morphAttributes).length>0&&Me(T,r),T.name=e.createUniqueName(r.name||"mesh_"+t),y(T,r),m.extensions&&N(n,T,m),e.assignFinalMaterial(T),l.push(T)}for(let p=0,g=l.length;p<g;p++)e.associations.set(l[p],{meshes:t,primitives:p});if(l.length===1)return r.extensions&&N(n,l[0],r),l[0];const d=new u.Group;r.extensions&&N(n,d,r),e.associations.set(d,{meshes:t});for(let p=0,g=l.length;p<g;p++)d.add(l[p]);return d})}loadCamera(t){let e;const i=this.json.cameras[t],n=i[i.type];if(!n){console.warn("THREE.GLTFLoader: Missing camera parameters.");return}return i.type==="perspective"?e=new u.PerspectiveCamera(u.MathUtils.radToDeg(n.yfov),n.aspectRatio||1,n.znear||1,n.zfar||2e6):i.type==="orthographic"&&(e=new u.OrthographicCamera(-n.xmag,n.xmag,n.ymag,-n.ymag,n.znear,n.zfar)),i.name&&(e.name=this.createUniqueName(i.name)),y(e,i),Promise.resolve(e)}loadSkin(t){const e=this.json.skins[t],i=[];for(let n=0,r=e.joints.length;n<r;n++)i.push(this._loadNodeShallow(e.joints[n]));return e.inverseBindMatrices!==void 0?i.push(this.getDependency("accessor",e.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(n){const r=n.pop(),s=n,a=[],o=[];for(let c=0,f=s.length;c<f;c++){const l=s[c];if(l){a.push(l);const d=new u.Matrix4;r!==null&&d.fromArray(r.array,c*16),o.push(d)}else console.warn('THREE.GLTFLoader: Joint "%s" could not be found.',e.joints[c])}return new u.Skeleton(a,o)})}loadAnimation(t){const e=this.json,i=this,n=e.animations[t],r=n.name?n.name:"animation_"+t,s=[],a=[],o=[],c=[],f=[];for(let l=0,d=n.channels.length;l<d;l++){const p=n.channels[l],g=n.samplers[p.sampler],R=p.target,m=R.node,T=n.parameters!==void 0?n.parameters[g.input]:g.input,E=n.parameters!==void 0?n.parameters[g.output]:g.output;R.node!==void 0&&(s.push(this.getDependency("node",m)),a.push(this.getDependency("accessor",T)),o.push(this.getDependency("accessor",E)),c.push(g),f.push(R))}return Promise.all([Promise.all(s),Promise.all(a),Promise.all(o),Promise.all(c),Promise.all(f)]).then(function(l){const d=l[0],p=l[1],g=l[2],R=l[3],m=l[4],T=[];for(let E=0,M=d.length;E<M;E++){const x=d[E],_=p[E],w=g[E],S=R[E],O=m[E];if(x===void 0)continue;x.updateMatrix&&x.updateMatrix();const b=i._createAnimationTracks(x,_,w,S,O);if(b)for(let D=0;D<b.length;D++)T.push(b[D])}return new u.AnimationClip(r,void 0,T)})}createNodeMesh(t){const e=this.json,i=this,n=e.nodes[t];return n.mesh===void 0?null:i.getDependency("mesh",n.mesh).then(function(r){const s=i._getNodeRef(i.meshCache,n.mesh,r);return n.weights!==void 0&&s.traverse(function(a){if(a.isMesh)for(let o=0,c=n.weights.length;o<c;o++)a.morphTargetInfluences[o]=n.weights[o]}),s})}loadNode(t){const e=this.json,i=this,n=e.nodes[t],r=i._loadNodeShallow(t),s=[],a=n.children||[];for(let c=0,f=a.length;c<f;c++)s.push(i.getDependency("node",a[c]));const o=n.skin===void 0?Promise.resolve(null):i.getDependency("skin",n.skin);return Promise.all([r,Promise.all(s),o]).then(function(c){const f=c[0],l=c[1],d=c[2];d!==null&&f.traverse(function(p){p.isSkinnedMesh&&p.bind(d,_e)});for(let p=0,g=l.length;p<g;p++)f.add(l[p]);return f})}_loadNodeShallow(t){const e=this.json,i=this.extensions,n=this;if(this.nodeCache[t]!==void 0)return this.nodeCache[t];const r=e.nodes[t],s=r.name?n.createUniqueName(r.name):"",a=[],o=n._invokeOne(function(c){return c.createNodeMesh&&c.createNodeMesh(t)});return o&&a.push(o),r.camera!==void 0&&a.push(n.getDependency("camera",r.camera).then(function(c){return n._getNodeRef(n.cameraCache,r.camera,c)})),n._invokeAll(function(c){return c.createNodeAttachment&&c.createNodeAttachment(t)}).forEach(function(c){a.push(c)}),this.nodeCache[t]=Promise.all(a).then(function(c){let f;if(r.isBone===!0?f=new u.Bone:c.length>1?f=new u.Group:c.length===1?f=c[0]:f=new u.Object3D,f!==c[0])for(let l=0,d=c.length;l<d;l++)f.add(c[l]);if(r.name&&(f.userData.name=r.name,f.name=s),y(f,r),r.extensions&&N(i,f,r),r.matrix!==void 0){const l=new u.Matrix4;l.fromArray(r.matrix),f.applyMatrix4(l)}else r.translation!==void 0&&f.position.fromArray(r.translation),r.rotation!==void 0&&f.quaternion.fromArray(r.rotation),r.scale!==void 0&&f.scale.fromArray(r.scale);return n.associations.has(f)||n.associations.set(f,{}),n.associations.get(f).nodes=t,f}),this.nodeCache[t]}loadScene(t){const e=this.extensions,i=this.json.scenes[t],n=this,r=new u.Group;i.name&&(r.name=n.createUniqueName(i.name)),y(r,i),i.extensions&&N(e,r,i);const s=i.nodes||[],a=[];for(let o=0,c=s.length;o<c;o++)a.push(n.getDependency("node",s[o]));return Promise.all(a).then(function(o){for(let f=0,l=o.length;f<l;f++)r.add(o[f]);const c=f=>{const l=new Map;for(const[d,p]of n.associations)(d instanceof u.Material||d instanceof u.Texture)&&l.set(d,p);return f.traverse(d=>{const p=n.associations.get(d);p!=null&&l.set(d,p)}),l};return n.associations=c(r),r})}_createAnimationTracks(t,e,i,n,r){const s=[],a=t.name?t.name:t.uuid,o=[];I[r.path]===I.weights?t.traverse(function(d){d.morphTargetInfluences&&o.push(d.name?d.name:d.uuid)}):o.push(a);let c;switch(I[r.path]){case I.weights:c=u.NumberKeyframeTrack;break;case I.rotation:c=u.QuaternionKeyframeTrack;break;case I.position:case I.scale:c=u.VectorKeyframeTrack;break;default:switch(i.itemSize){case 1:c=u.NumberKeyframeTrack;break;case 2:case 3:default:c=u.VectorKeyframeTrack;break}break}const f=n.interpolation!==void 0?Re[n.interpolation]:u.InterpolateLinear,l=this._getArrayFromAccessor(i);for(let d=0,p=o.length;d<p;d++){const g=new c(o[d]+"."+I[r.path],e.array,l,f);n.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(g),s.push(g)}return s}_getArrayFromAccessor(t){let e=t.array;if(t.normalized){const i=H(e.constructor),n=new Float32Array(e.length);for(let r=0,s=e.length;r<s;r++)n[r]=e[r]*i;e=n}return e}_createCubicSplineTrackInterpolant(t){t.createInterpolant=function(i){const n=this instanceof u.QuaternionKeyframeTrack?Te:z;return new n(this.times,this.values,this.getValueSize()/3,i)},t.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function we(h,t,e){const i=t.attributes,n=new u.Box3;if(i.POSITION!==void 0){const a=e.json.accessors[i.POSITION],o=a.min,c=a.max;if(o!==void 0&&c!==void 0){if(n.set(new u.Vector3(o[0],o[1],o[2]),new u.Vector3(c[0],c[1],c[2])),a.normalized){const f=H(C[a.componentType]);n.min.multiplyScalar(f),n.max.multiplyScalar(f)}}else{console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.");return}}else return;const r=t.targets;if(r!==void 0){const a=new u.Vector3,o=new u.Vector3;for(let c=0,f=r.length;c<f;c++){const l=r[c];if(l.POSITION!==void 0){const d=e.json.accessors[l.POSITION],p=d.min,g=d.max;if(p!==void 0&&g!==void 0){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){const R=H(C[d.componentType]);o.multiplyScalar(R)}a.max(o)}else console.warn("THREE.GLTFLoader: Missing min/max properties for accessor POSITION.")}}n.expandByVector(a)}h.boundingBox=n;const s=new u.Sphere;n.getCenter(s.center),s.radius=n.min.distanceTo(n.max)/2,h.boundingSphere=s}function V(h,t,e){const i=t.attributes,n=[];function r(s,a){return e.getDependency("accessor",s).then(function(o){h.setAttribute(a,o)})}for(const s in i){const a=B[s]||s.toLowerCase();a in h.attributes||n.push(r(i[s],a))}if(t.indices!==void 0&&!h.index){const s=e.getDependency("accessor",t.indices).then(function(a){h.setIndex(a)});n.push(s)}return u.ColorManagement.workingColorSpace!==u.LinearSRGBColorSpace&&"COLOR_0"in i&&console.warn(`THREE.GLTFLoader: Converting vertex colors from "srgb-linear" to "${u.ColorManagement.workingColorSpace}" not supported.`),y(h,t),we(h,t,e),Promise.all(n).then(function(){return t.targets!==void 0?Ee(h,t.targets,e):h})}exports.GLTFLoader=q;
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { useFrame as q, useThree as Q, useLoader as Z } from "@react-three/fiber";
|
|
2
|
-
import { useMemo as F, useRef as u, useEffect as $, useState as W } from "react";
|
|
3
|
-
import * as d from "three";
|
|
4
|
-
import { s as V, T as ee } from "./index-Dw6tj2Mi.js";
|
|
5
|
-
import { X as te, u as re, F as ne, i as se, n as B } from "./index-CnGox6Xr.js";
|
|
6
|
-
import { c as oe, I as ce, u as H, a as ae, b as ie, r as ue } from "./providers-C0Dlhh9Z.js";
|
|
7
|
-
import { u as de } from "./index-CsUdQ-pn.js";
|
|
8
|
-
import { jsx as j, jsxs as le } from "react/jsx-runtime";
|
|
9
|
-
import { u as fe, R as me } from "./selectors-C5G1PMYL.js";
|
|
10
|
-
import { r as pe } from "./landmarkMask-CbTFzBYG.js";
|
|
11
|
-
const D = () => ({
|
|
12
|
-
pos: new d.Vector3(),
|
|
13
|
-
prevRaw: new d.Vector3(),
|
|
14
|
-
dxHat: new d.Vector3(),
|
|
15
|
-
initialized: !1
|
|
16
|
-
}), Ce = ({
|
|
17
|
-
faceIndex: l = 0,
|
|
18
|
-
numFaces: v,
|
|
19
|
-
active: f = !0,
|
|
20
|
-
targetFps: y,
|
|
21
|
-
holdMs: m = 250,
|
|
22
|
-
predictMs: C = 0,
|
|
23
|
-
smoothing: p = 0,
|
|
24
|
-
leadMs: z = 80
|
|
25
|
-
} = {}) => {
|
|
26
|
-
const r = Number.isFinite(l) ? Math.max(0, Math.round(l)) : 0, n = Math.max(v ?? r + 1, r + 1), N = F(
|
|
27
|
-
() => ({
|
|
28
|
-
numFaces: n,
|
|
29
|
-
...y !== void 0 && y > 0 ? { targetFps: y } : {}
|
|
30
|
-
}),
|
|
31
|
-
[n, y]
|
|
32
|
-
), { node: s, ready: M, error: A } = de(
|
|
33
|
-
te.FACE_TRACKER,
|
|
34
|
-
N,
|
|
35
|
-
f
|
|
36
|
-
), { session: c } = re(), t = F(() => oe(r), [r]), S = u(null);
|
|
37
|
-
S.current || (S.current = new ne({ holdMs: m, predictMs: C })), $(() => {
|
|
38
|
-
var x;
|
|
39
|
-
(x = S.current) == null || x.setOptions({ holdMs: Math.max(0, m), predictMs: Math.max(0, C) });
|
|
40
|
-
}, [m, C]);
|
|
41
|
-
const k = u({
|
|
42
|
-
left: { center: D(), radius: D() },
|
|
43
|
-
right: { center: D(), radius: D() }
|
|
44
|
-
}), h = u(new d.Vector3()), g = u(new ce()), b = u(null), L = u(-1 / 0), a = u(!1), [R, o] = W("loading");
|
|
45
|
-
return q((x, E) => {
|
|
46
|
-
var U;
|
|
47
|
-
const G = A ? "error" : M && s ? "ready" : "loading";
|
|
48
|
-
G !== R && o(G);
|
|
49
|
-
const T = performance.now(), I = f && s ? s.getDetectionResults() : void 0, X = (U = I == null ? void 0 : I.faceLandmarks) == null ? void 0 : U[r], _ = X && X.length > 0 ? X : void 0, K = S.current.update(_ ? [_] : [], T)[0];
|
|
50
|
-
if (!K) {
|
|
51
|
-
(t.detected || t.version === 0) && H(t, void 0, T, { faceIndex: r }), a.current = !1, g.current.reset();
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
const O = !_;
|
|
55
|
-
O || (L.current = T);
|
|
56
|
-
const Y = O ? Math.max(0, m > 0 ? 1 - (T - L.current) / m : 0) : 1, J = se(c.store.getSnapshot().sourceKind);
|
|
57
|
-
if (H(t, K, T, { faceIndex: r, held: O, faceConfidence: Y, mirrored: J }), t.detected && !O) {
|
|
58
|
-
const P = I !== b.current;
|
|
59
|
-
b.current = I, a.current || g.current.reset();
|
|
60
|
-
for (const w of ["left", "right"]) {
|
|
61
|
-
const e = t[w];
|
|
62
|
-
P && g.current.observe(w, e.center, T), g.current.apply(w, T, z, e.center), B(e.center, e.trackerCenter);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
if (p > 0 && t.detected) {
|
|
66
|
-
const P = !a.current;
|
|
67
|
-
for (const w of ["left", "right"]) {
|
|
68
|
-
const e = t[w], i = k.current[w];
|
|
69
|
-
P && (i.center.initialized = !1, i.radius.initialized = !1), h.current.set(e.center.x, e.center.y, e.center.z), V(i.center, h.current, E, p), e.center.x = i.center.pos.x, e.center.y = i.center.pos.y, e.center.z = i.center.pos.z, B(e.center, e.trackerCenter), h.current.set(e.radius, 0, 0), V(i.radius, h.current, E, p), e.radius = i.radius.pos.x;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
a.current = t.detected;
|
|
73
|
-
}), { result: t, ready: M && R === "ready", status: R, error: A };
|
|
74
|
-
}, Me = ({
|
|
75
|
-
mask: l,
|
|
76
|
-
texture: v,
|
|
77
|
-
material: f,
|
|
78
|
-
renderOrder: y = me.BACKGROUND + 10,
|
|
79
|
-
visible: m = !0,
|
|
80
|
-
...C
|
|
81
|
-
}) => {
|
|
82
|
-
const p = pe(C), { camera: z, size: r } = Q(), n = fe() ?? null, N = Z(
|
|
83
|
-
d.TextureLoader,
|
|
84
|
-
typeof v == "string" ? v : ee
|
|
85
|
-
), s = typeof v == "string" ? N : v ?? null;
|
|
86
|
-
s && s.colorSpace !== d.SRGBColorSpace && (s.colorSpace = d.SRGBColorSpace, s.needsUpdate = !0);
|
|
87
|
-
const { holder: M, sync: A } = ae(l), c = n == null ? void 0 : n.image, t = (c == null ? void 0 : c.width) ?? 0, S = (c == null ? void 0 : c.height) ?? 0, k = ie({
|
|
88
|
-
cameraTexture: n,
|
|
89
|
-
maskTexture: M.texture,
|
|
90
|
-
mask: l,
|
|
91
|
-
settings: p,
|
|
92
|
-
designTexture: s,
|
|
93
|
-
feedWidth: t,
|
|
94
|
-
feedHeight: S
|
|
95
|
-
}), h = u(null), [, g] = W(0);
|
|
96
|
-
q(() => {
|
|
97
|
-
const o = A();
|
|
98
|
-
h.current !== o && (h.current = o, k.uniforms.maskTexture.value = o, g((x) => x + 1));
|
|
99
|
-
});
|
|
100
|
-
const b = F(() => {
|
|
101
|
-
const o = z;
|
|
102
|
-
if (!o.isPerspectiveCamera) return [10, 10];
|
|
103
|
-
const x = (o.position.z || 5) + 1, E = 2 * Math.tan(o.fov * Math.PI / 360) * x;
|
|
104
|
-
return [E * (r.width / r.height), E];
|
|
105
|
-
}, [z, r]);
|
|
106
|
-
if (!n || !m) return null;
|
|
107
|
-
const L = {
|
|
108
|
-
cameraTexture: n,
|
|
109
|
-
maskTexture: M.texture,
|
|
110
|
-
maskTransform: k.uniforms.maskTransform.value,
|
|
111
|
-
// Empty until the mask has data, exactly like the built-in material.
|
|
112
|
-
labelIndices: ue(l, p.label),
|
|
113
|
-
mask: l,
|
|
114
|
-
settings: p
|
|
115
|
-
}, a = f ? typeof f == "function" ? f(L) : f : k, R = a instanceof d.Material ? a : void 0;
|
|
116
|
-
return /* @__PURE__ */ j("group", { position: [0, 0, -1], children: /* @__PURE__ */ le(
|
|
117
|
-
"mesh",
|
|
118
|
-
{
|
|
119
|
-
renderOrder: y,
|
|
120
|
-
frustumCulled: !1,
|
|
121
|
-
material: R,
|
|
122
|
-
children: [
|
|
123
|
-
/* @__PURE__ */ j("planeGeometry", { args: b }),
|
|
124
|
-
R ? null : a
|
|
125
|
-
]
|
|
126
|
-
},
|
|
127
|
-
R ? "instance" : "node"
|
|
128
|
-
) });
|
|
129
|
-
};
|
|
130
|
-
export {
|
|
131
|
-
Me as S,
|
|
132
|
-
Ce as u
|
|
133
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const D=require("@react-three/fiber"),t=require("react"),Y=require("three"),H=require("./index-DsZwTfG0.cjs"),b=require("./index-CeVkgsag.cjs"),S=require("./providers-YNwkmNeK.cjs"),J=require("./index-OCPjOaeP.cjs"),G=require("react/jsx-runtime"),B=require("./selectors-Du_PsVnW.cjs"),Q=require("./landmarkMask-u7es2k4X.cjs");function Z(r){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const n in r)if(n!=="default"){const i=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(o,n,i.get?i:{enumerable:!0,get:()=>r[n]})}}return o.default=r,Object.freeze(o)}const p=Z(Y),j=()=>({pos:new p.Vector3,prevRaw:new p.Vector3,dxHat:new p.Vector3,initialized:!1}),ee=({faceIndex:r=0,numFaces:o,active:n=!0,targetFps:i,holdMs:R=250,predictMs:w=0,smoothing:T=0,leadMs:I=80}={})=>{const c=Number.isFinite(r)?Math.max(0,Math.round(r)):0,a=Math.max(o??c+1,c+1),L=t.useMemo(()=>({numFaces:a,...i!==void 0&&i>0?{targetFps:i}:{}}),[a,i]),{node:u,ready:E,error:z}=J.useXRModel(b.XRModel.FACE_TRACKER,L,n),{session:l}=b.useXRContext(),s=t.useMemo(()=>S.createIrisResult(c),[c]),v=t.useRef(null);v.current||(v.current=new b.FaceTrackMemory({holdMs:R,predictMs:w})),t.useEffect(()=>{var h;(h=v.current)==null||h.setOptions({holdMs:Math.max(0,R),predictMs:Math.max(0,w)})},[R,w]);const C=t.useRef({left:{center:j(),radius:j()},right:{center:j(),radius:j()}}),g=t.useRef(new p.Vector3),k=t.useRef(new S.IrisLead),A=t.useRef(null),P=t.useRef(-1/0),f=t.useRef(!1),[x,d]=t.useState("loading");return D.useFrame((h,O)=>{var V;const K=z?"error":E&&u?"ready":"loading";K!==x&&d(K);const y=performance.now(),q=n&&u?u.getDetectionResults():void 0,N=(V=q==null?void 0:q.faceLandmarks)==null?void 0:V[c],X=N&&N.length>0?N:void 0,U=v.current.update(X?[X]:[],y)[0];if(!U){(s.detected||s.version===0)&&S.updateIrisResult(s,void 0,y,{faceIndex:c}),f.current=!1,k.current.reset();return}const _=!X;_||(P.current=y);const $=_?Math.max(0,R>0?1-(y-P.current)/R:0):1,W=b.isMirroredSourceKind(l.store.getSnapshot().sourceKind);if(S.updateIrisResult(s,U,y,{faceIndex:c,held:_,faceConfidence:$,mirrored:W}),s.detected&&!_){const F=q!==A.current;A.current=q,f.current||k.current.reset();for(const M of["left","right"]){const e=s[M];F&&k.current.observe(M,e.center,y),k.current.apply(M,y,I,e.center),b.normalizedTrackerPointToTrackerPoint(e.center,e.trackerCenter)}}if(T>0&&s.detected){const F=!f.current;for(const M of["left","right"]){const e=s[M],m=C.current[M];F&&(m.center.initialized=!1,m.radius.initialized=!1),g.current.set(e.center.x,e.center.y,e.center.z),H.stepTrackingSmoothing(m.center,g.current,O,T),e.center.x=m.center.pos.x,e.center.y=m.center.pos.y,e.center.z=m.center.pos.z,b.normalizedTrackerPointToTrackerPoint(e.center,e.trackerCenter),g.current.set(e.radius,0,0),H.stepTrackingSmoothing(m.radius,g.current,O,T),e.radius=m.radius.pos.x}}f.current=s.detected}),{result:s,ready:E&&x==="ready",status:x,error:z}},te=({mask:r,texture:o,material:n,renderOrder:i=B.RENDER_LAYERS.BACKGROUND+10,visible:R=!0,...w})=>{const T=Q.resolveSegmentationOverlaySettings(w),{camera:I,size:c}=D.useThree(),a=B.useXRCameraTexture()??null,L=D.useLoader(p.TextureLoader,typeof o=="string"?o:H.TRANSPARENT_TEXTURE_DATA_URL),u=typeof o=="string"?L:o??null;u&&u.colorSpace!==p.SRGBColorSpace&&(u.colorSpace=p.SRGBColorSpace,u.needsUpdate=!0);const{holder:E,sync:z}=S.useSemanticMaskTexture(r),l=a==null?void 0:a.image,s=(l==null?void 0:l.width)??0,v=(l==null?void 0:l.height)??0,C=S.useSegmentationOverlayMaterial({cameraTexture:a,maskTexture:E.texture,mask:r,settings:T,designTexture:u,feedWidth:s,feedHeight:v}),g=t.useRef(null),[,k]=t.useState(0);D.useFrame(()=>{const d=z();g.current!==d&&(g.current=d,C.uniforms.maskTexture.value=d,k(h=>h+1))});const A=t.useMemo(()=>{const d=I;if(!d.isPerspectiveCamera)return[10,10];const h=(d.position.z||5)+1,O=2*Math.tan(d.fov*Math.PI/360)*h;return[O*(c.width/c.height),O]},[I,c]);if(!a||!R)return null;const P={cameraTexture:a,maskTexture:E.texture,maskTransform:C.uniforms.maskTransform.value,labelIndices:S.resolveActiveOverlayLabelIndices(r,T.label),mask:r,settings:T},f=n?typeof n=="function"?n(P):n:C,x=f instanceof p.Material?f:void 0;return G.jsx("group",{position:[0,0,-1],children:G.jsxs("mesh",{renderOrder:i,frustumCulled:!1,material:x,children:[G.jsx("planeGeometry",{args:A}),x?null:f]},x?"instance":"node")})};exports.SegmentationOverlay=te;exports.useIrisTracking=ee;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { FaceWarp3DSettings } from './defaults';
|
|
2
|
-
export type FaceWarp3DHeadProps = {
|
|
3
|
-
/** Topology-compatible head mesh. */
|
|
4
|
-
headMeshUrl: string;
|
|
5
|
-
/** Optional UV reference/base texture sampled with the FBX's authored UVs. */
|
|
6
|
-
uvTextureUrl?: string;
|
|
7
|
-
settings: Partial<FaceWarp3DSettings>;
|
|
8
|
-
faceIndex?: number;
|
|
9
|
-
opacity?: number;
|
|
10
|
-
renderOrder?: number;
|
|
11
|
-
visible?: boolean;
|
|
12
|
-
mirrorTextureX?: boolean;
|
|
13
|
-
baseColor?: string;
|
|
14
|
-
};
|
|
15
|
-
export declare const FaceWarp3DHead: ({ headMeshUrl, uvTextureUrl, settings, faceIndex, opacity, renderOrder, visible, baseColor, }: FaceWarp3DHeadProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export type FaceWarp3DSettings = {
|
|
2
|
-
enabled: boolean;
|
|
3
|
-
strength: number;
|
|
4
|
-
faceWidth: number;
|
|
5
|
-
faceHeight: number;
|
|
6
|
-
faceRoundness: number;
|
|
7
|
-
midfaceHeight: number;
|
|
8
|
-
foreheadHeight: number;
|
|
9
|
-
foreheadWidth: number;
|
|
10
|
-
cheekboneWidth: number;
|
|
11
|
-
cheekWidth: number;
|
|
12
|
-
cheekHollowness: number;
|
|
13
|
-
midfaceDepth: number;
|
|
14
|
-
scalpHeight: number;
|
|
15
|
-
headCurve: number;
|
|
16
|
-
faceTwist: number;
|
|
17
|
-
faceSwirl: number;
|
|
18
|
-
browDistance: number;
|
|
19
|
-
browHeight: number;
|
|
20
|
-
browDepth: number;
|
|
21
|
-
eyeSize: number;
|
|
22
|
-
leftEyeSize: number;
|
|
23
|
-
rightEyeSize: number;
|
|
24
|
-
eyeDistance: number;
|
|
25
|
-
leftEyeX: number;
|
|
26
|
-
rightEyeX: number;
|
|
27
|
-
leftEyeY: number;
|
|
28
|
-
rightEyeY: number;
|
|
29
|
-
noseSize: number;
|
|
30
|
-
noseLength: number;
|
|
31
|
-
mouthWidth: number;
|
|
32
|
-
mouthHeight: number;
|
|
33
|
-
jawWidth: number;
|
|
34
|
-
chinHeight: number;
|
|
35
|
-
};
|
|
36
|
-
export declare const DEFAULT_FACE_WARP_3D_SETTINGS: FaceWarp3DSettings;
|
|
37
|
-
export declare const FACE_WARP_3D_PRESET: FaceWarp3DSettings;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { NormalizedLandmark } from '@mediapipe/tasks-vision';
|
|
2
|
-
import { FaceWarp3DSettings } from './defaults';
|
|
3
|
-
type LandmarkLike = Pick<NormalizedLandmark, "x" | "y" | "z">;
|
|
4
|
-
export type FaceWarp3DMetrics = {
|
|
5
|
-
centerX: number;
|
|
6
|
-
centerY: number;
|
|
7
|
-
width: number;
|
|
8
|
-
height: number;
|
|
9
|
-
};
|
|
10
|
-
export declare const computeFaceWarp3DMetrics: (landmarks: LandmarkLike[]) => FaceWarp3DMetrics;
|
|
11
|
-
export declare const hasFaceWarp3D: (settings?: Partial<FaceWarp3DSettings>) => boolean;
|
|
12
|
-
export declare const applyFaceWarp3D: (landmark: LandmarkLike, metrics: FaceWarp3DMetrics, settings: Partial<FaceWarp3DSettings>, out: LandmarkLike) => LandmarkLike;
|
|
13
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var Re=Object.defineProperty;var Ee=(e,t,n)=>t in e?Re(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Q=(e,t,n)=>Ee(e,typeof t!="symbol"?t+"":t,n);const L=require("react/jsx-runtime"),J=require("@react-three/fiber"),A=require("react"),Te=require("three"),O=require("./selectors-Du_PsVnW.cjs"),fe=require("./index-CeVkgsag.cjs"),se=require("./index-DKBAh6hV.cjs");function Me(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,a.get?a:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const j=Me(Te),ue={display:"flex",alignItems:"center",justifyContent:"center",height:"100%",background:"#363636",color:"white",fontFamily:"monospace"},Ae=()=>L.jsx("div",{style:ue,children:"Loading..."}),Ce=e=>L.jsx("div",{style:ue,children:e.error}),Fe=e=>typeof e=="number"?e:Array.isArray(e)?e[1]:3,le={position:"absolute",top:0,left:0,width:"100%",height:"100%",zIndex:10},ce={sceneColorTexture:null,sceneDepthTexture:null},ke=({cap:e})=>{const t=J.useThree(o=>o.setDpr),n=O.useXRQualityState(),r=O.useXRQualityConfig()?(n==null?void 0:n.decision.tier.renderScale)??1:1;return A.useEffect(()=>{const o=Math.min(typeof window<"u"&&window.devicePixelRatio||1,e);t(Math.max(.5,o*r))},[t,e,r]),null},Ie=({onRenderOutputs:e,renderOutputs:t,size:n})=>{const{gl:a,scene:r,size:o}=J.useThree(),{session:c}=fe.useXRContext(),s=Math.max(1,Math.round((n==null?void 0:n.width)??o.width)),d=Math.max(1,Math.round((n==null?void 0:n.height)??o.height)),f=!!(t.sceneColor||t.sceneDepth),l=A.useMemo(()=>{if(!f)return null;const i=new j.WebGLRenderTarget(s,d,{colorSpace:j.SRGBColorSpace,depthBuffer:!0,stencilBuffer:!1});return t.sceneDepth&&(i.depthTexture=new j.DepthTexture(s,d),i.depthTexture.format=j.DepthFormat,i.depthTexture.type=j.UnsignedShortType),i},[f,d,t.sceneDepth,s]);return A.useEffect(()=>{if(!l){e==null||e(ce);return}return e==null||e({sceneColorTexture:t.sceneColor?l.texture:null,sceneDepthTexture:t.sceneDepth&&l.depthTexture?l.depthTexture:null}),()=>{var i;l.dispose(),(i=l.depthTexture)==null||i.dispose(),e==null||e(ce)}},[e,t.sceneColor,t.sceneDepth,l]),J.useFrame(()=>{if(!l)return;const i=[];t.excludeScreenUI!==!1&&r.traverse(x=>{x.visible&&x.renderOrder>=O.RENDER_LAYERS.SCREEN_UI&&(i.push(x),x.visible=!1)});const p=a.getRenderTarget(),v=a.xr.enabled;a.xr.enabled=!1,a.setRenderTarget(l),a.clear(),c._renderFrame(),a.setRenderTarget(p),a.xr.enabled=v,i.forEach(x=>{x.visible=!0})},-100),null},Le=({style:e,canvasProps:t,children:n,loadingComponent:a,loadingTransitionDuration:r,errorComponent:o,renderTargetSize:c,renderOutputs:s={},onRenderOutputs:d})=>{const f=A.useRef(null),l=A.useRef(null),i=A.useRef(null),p=A.useRef(!1),{session:v}=fe.useXRContext(),x=O.useXRReady(),u=O.useXRError(),[h,g]=A.useState(!0);return A.useEffect(()=>{if(c){v._setRenderSize(Math.round(c.width),Math.round(c.height));return}const y=(w,E)=>{w<=0||E<=0||v._setRenderSize(Math.round(w),Math.round(E))},m=()=>{!l.current||p.current||(p.current=!0,v._setRenderTarget(l.current))},C=(w,E)=>{i.current!==null&&cancelAnimationFrame(i.current),i.current=requestAnimationFrame(()=>{i.current=null,y(w,E)})},S=new ResizeObserver(w=>{const E=w[0];if(!E)return;const{width:B,height:I}=E.contentRect;m(),C(B,I)});return f.current&&S.observe(f.current),m(),()=>{S.disconnect(),i.current!==null&&(cancelAnimationFrame(i.current),i.current=null),p.current=!1}},[c,v]),A.useEffect(()=>{x&&(r?setTimeout(()=>{g(!1)},r):g(!1))},[x,r]),L.jsxs("div",{id:"vincentt-xr-container",ref:f,style:{width:"100%",height:"100%",...e,position:"relative"},children:[h&&L.jsx("div",{style:le,children:a||L.jsx(Ae,{})}),u&&L.jsx("div",{style:le,children:o||L.jsx(Ce,{error:u.message})}),L.jsxs(J.Canvas,{id:"vincentt-xr-canvas",ref:l,dpr:[1,3],gl:{alpha:!0,preserveDrawingBuffer:!1,antialias:!0,stencil:!0,premultipliedAlpha:!1,toneMapping:j.NoToneMapping},...t,onCreated:y=>{c?v._setRenderSize(Math.round(c.width),Math.round(c.height)):v._setRenderTarget(l.current),v._setR3FState({renderer:y.gl,scene:y.scene,camera:y.camera}),y.gl.outputColorSpace=j.SRGBColorSpace,t!=null&&t.onCreated&&t.onCreated(y)},children:[L.jsx(Ie,{onRenderOutputs:d,renderOutputs:s,size:c}),L.jsx(ke,{cap:Fe(t==null?void 0:t.dpr)}),n]})]})},xe=(e,t,n,a,r)=>{const o=e/2,c=t/2,s=n.left*o+a.left,d=n.right*o-a.right,f=n.bottom*c+a.bottom,l=n.top*c-a.top,i=d-s,p=l-f,v=(s+d)/2,x=(f+l)/2,u=r[0]*i/2,h=r[1]*p/2;return{centerX:v,centerY:x,width:i,height:p,pivotX:u,pivotY:h}},Xe={left:0,right:0,top:0,bottom:0},Be={left:0,right:0,top:0,bottom:0},Ge=[0,0],De=({anchors:e,offsets:t,pivot:n=Ge,children:a})=>{const{width:r,height:o}=se.useScreenSpace(),c=A.useMemo(()=>({anchors:{...Xe,...e??{}},offsets:{...Be,...t??{}}}),[e,t]),s=A.useMemo(()=>xe(r,o,c.anchors,c.offsets,n),[r,o,c,n]);A.useEffect(()=>{const i=c.anchors;i.left>i.right&&console.warn(`[ScreenTransform] inverted X axis: anchors.left (${i.left}) > anchors.right (${i.right})`),i.bottom>i.top&&console.warn(`[ScreenTransform] inverted Y axis: anchors.bottom (${i.bottom}) > anchors.top (${i.top})`),s.width<=0&&console.warn(`[ScreenTransform] zero or negative width (${s.width.toFixed(3)}) — anchors + offsets collapse the X extent`),s.height<=0&&console.warn(`[ScreenTransform] zero or negative height (${s.height.toFixed(3)}) — anchors + offsets collapse the Y extent`)},[c,s.width,s.height]);const d=n[0]!==0||n[1]!==0,f=d?[1,1,1]:[s.width,s.height,1],l=!d&&s.width>0&&s.height>0?s.width/s.height:null;return L.jsx("group",{position:[s.centerX-s.pivotX,s.centerY-s.pivotY,0],scale:f,renderOrder:O.RENDER_LAYERS.SCREEN_UI,children:L.jsx(se.ScreenRectAspectContext.Provider,{value:l,children:a})})};class ve{constructor(t,n){Q(this,"capabilities");Q(this,"snapshot");Q(this,"listeners",new Set);Q(this,"eventListeners",new Map);this.capabilities=t,this.snapshot={state:"idle",frame:0,time:0,playMode:"forward",loop:!0,loopCount:0,...n}}play(){const t=this.snapshot.state==="paused";this.update({state:"playing"}),this.emit(t?"Resume":"PlayBegin")}pause(){this.update({state:"paused"}),this.emit("Pause")}restart(){this.update({state:"playing",frame:0,time:0}),this.emit("PlayBegin")}setPlayMode(t){!this.capabilities.canReverse&&(t==="reverse"||t==="ping-pong"||t==="random")||this.update({playMode:t})}setLoop(t,n=0){this.update({loop:t,loopCount:n})}seek(t){this.capabilities.canSeek&&this.update({frame:Math.max(0,Math.floor(t)),time:Math.max(0,t)})}subscribe(t){return this.listeners.add(t),()=>this.listeners.delete(t)}on(t,n){const a=this.eventListeners.get(t)??new Set;return a.add(n),this.eventListeners.set(t,a),()=>this.off(t,n)}off(t,n){var a;(a=this.eventListeners.get(t))==null||a.delete(n)}getSnapshot(){return this.snapshot}dispose(){this.listeners.clear(),this.eventListeners.clear(),this.snapshot={...this.snapshot,state:"idle"}}updateSnapshot(t){this.update(t)}emit(t){var n;(n=this.eventListeners.get(t))==null||n.forEach(a=>a({type:t,snapshot:this.snapshot}))}update(t){this.snapshot={...this.snapshot,...t},this.listeners.forEach(n=>n(this.snapshot))}}const pe=(e,t,n,a,r)=>{const o=Math.max(1,Math.floor(t)),c=Math.max(0,Math.floor(e)),s=n==="ping-pong"&&o>1?o*2-2:o,d=Math.floor(c/s),f=r>0?d>=r:!a&&c>=s,l=f?s-1:c%s;return{frame:n==="reverse"?o-1-l%o:n==="random"?l*7919%o:n==="ping-pong"&&l>=o?s-l:l,ended:f,loop:d}},je=(e,t,n)=>{const a=Math.max(1,Math.floor(n));return Math.floor(Math.max(0,e)*Math.max(0,t))%a};var he={},ge,Ue;function $e(e,t,n,o){var r=0,o=o===void 0?{}:o,c=o.loop===void 0?null:o.loop,s=o.palette===void 0?null:o.palette;if(t<=0||n<=0||t>65535||n>65535)throw new Error("Width/Height invalid.");function d(h){var g=h.length;if(g<2||g>256||g&g-1)throw new Error("Invalid code/color length, must be power of 2 and 2 .. 256.");return g}e[r++]=71,e[r++]=73,e[r++]=70,e[r++]=56,e[r++]=57,e[r++]=97;var f=0,l=0;if(s!==null){for(var i=d(s);i>>=1;)++f;if(i=1<<f,--f,o.background!==void 0){if(l=o.background,l>=i)throw new Error("Background index out of range.");if(l===0)throw new Error("Background index explicitly passed as 0.")}}if(e[r++]=t&255,e[r++]=t>>8&255,e[r++]=n&255,e[r++]=n>>8&255,e[r++]=(s!==null?128:0)|f,e[r++]=l,e[r++]=0,s!==null)for(var p=0,v=s.length;p<v;++p){var x=s[p];e[r++]=x>>16&255,e[r++]=x>>8&255,e[r++]=x&255}if(c!==null){if(c<0||c>65535)throw new Error("Loop count invalid.");e[r++]=33,e[r++]=255,e[r++]=11,e[r++]=78,e[r++]=69,e[r++]=84,e[r++]=83,e[r++]=67,e[r++]=65,e[r++]=80,e[r++]=69,e[r++]=50,e[r++]=46,e[r++]=48,e[r++]=3,e[r++]=1,e[r++]=c&255,e[r++]=c>>8&255,e[r++]=0}var u=!1;this.addFrame=function(h,g,y,m,C,S){if(u===!0&&(--r,u=!1),S=S===void 0?{}:S,h<0||g<0||h>65535||g>65535)throw new Error("x/y invalid.");if(y<=0||m<=0||y>65535||m>65535)throw new Error("Width/Height invalid.");if(C.length<y*m)throw new Error("Not enough pixels for the frame size.");var w=!0,E=S.palette;if(E==null&&(w=!1,E=s),E==null)throw new Error("Must supply either a local or global palette.");for(var B=d(E),I=0;B>>=1;)++I;B=1<<I;var U=S.delay===void 0?0:S.delay,R=S.disposal===void 0?0:S.disposal;if(R<0||R>3)throw new Error("Disposal out of range.");var T=!1,k=0;if(S.transparent!==void 0&&S.transparent!==null&&(T=!0,k=S.transparent,k<0||k>=B))throw new Error("Transparent color index.");if((R!==0||T||U!==0)&&(e[r++]=33,e[r++]=249,e[r++]=4,e[r++]=R<<2|(T===!0?1:0),e[r++]=U&255,e[r++]=U>>8&255,e[r++]=k,e[r++]=0),e[r++]=44,e[r++]=h&255,e[r++]=h>>8&255,e[r++]=g&255,e[r++]=g>>8&255,e[r++]=y&255,e[r++]=y>>8&255,e[r++]=m&255,e[r++]=m>>8&255,e[r++]=w===!0?128|I-1:0,w===!0)for(var $=0,X=E.length;$<X;++$){var F=E[$];e[r++]=F>>16&255,e[r++]=F>>8&255,e[r++]=F&255}return r=qe(e,r,I<2?2:I,C),r},this.end=function(){return u===!1&&(e[r++]=59,u=!0),r},this.getOutputBuffer=function(){return e},this.setOutputBuffer=function(h){e=h},this.getOutputBufferPosition=function(){return r},this.setOutputBufferPosition=function(h){r=h}}function qe(e,t,n,a){e[t++]=n;var r=t++,o=1<<n,c=o-1,s=o+1,d=s+1,f=n+1,l=0,i=0;function p(S){for(;l>=S;)e[t++]=i&255,i>>=8,l-=8,t===r+256&&(e[r]=255,r=t++)}function v(S){i|=S<<l,l+=f,p(8)}var x=a[0]&c,u={};v(o);for(var h=1,g=a.length;h<g;++h){var y=a[h]&c,m=x<<8|y,C=u[m];if(C===void 0){for(i|=x<<l,l+=f;l>=8;)e[t++]=i&255,i>>=8,l-=8,t===r+256&&(e[r]=255,r=t++);d===4096?(v(o),d=s+1,f=n+1,u={}):(d>=1<<f&&++f,u[m]=d++),x=y}else x=C}return v(x),v(s),p(1),r+1===t?e[r]=0:(e[r]=t-r-1,e[t++]=0),t}function We(e){var t=0;if(e[t++]!==71||e[t++]!==73||e[t++]!==70||e[t++]!==56||(e[t++]+1&253)!==56||e[t++]!==97)throw new Error("Invalid GIF 87a/89a header.");var n=e[t++]|e[t++]<<8,a=e[t++]|e[t++]<<8,r=e[t++],o=r>>7,c=r&7,s=1<<c+1;e[t++],e[t++];var d=null,f=null;o&&(d=t,f=s,t+=s*3);var l=!0,i=[],p=0,v=null,x=0,u=null;for(this.width=n,this.height=a;l&&t<e.length;)switch(e[t++]){case 33:switch(e[t++]){case 255:if(e[t]!==11||e[t+1]==78&&e[t+2]==69&&e[t+3]==84&&e[t+4]==83&&e[t+5]==67&&e[t+6]==65&&e[t+7]==80&&e[t+8]==69&&e[t+9]==50&&e[t+10]==46&&e[t+11]==48&&e[t+12]==3&&e[t+13]==1&&e[t+16]==0)t+=14,u=e[t++]|e[t++]<<8,t++;else for(t+=12;;){var h=e[t++];if(!(h>=0))throw Error("Invalid block size");if(h===0)break;t+=h}break;case 249:if(e[t++]!==4||e[t+4]!==0)throw new Error("Invalid graphics extension block.");var g=e[t++];p=e[t++]|e[t++]<<8,v=e[t++],g&1||(v=null),x=g>>2&7,t++;break;case 254:for(;;){var h=e[t++];if(!(h>=0))throw Error("Invalid block size");if(h===0)break;t+=h}break;default:throw new Error("Unknown graphic control label: 0x"+e[t-1].toString(16))}break;case 44:var y=e[t++]|e[t++]<<8,m=e[t++]|e[t++]<<8,C=e[t++]|e[t++]<<8,S=e[t++]|e[t++]<<8,w=e[t++],E=w>>7,B=w>>6&1,I=w&7,U=1<<I+1,R=d,T=f,k=!1;if(E){var k=!0;R=t,T=U,t+=U*3}var $=t;for(t++;;){var h=e[t++];if(!(h>=0))throw Error("Invalid block size");if(h===0)break;t+=h}i.push({x:y,y:m,width:C,height:S,has_local_palette:k,palette_offset:R,palette_size:T,data_offset:$,data_length:t-$,transparent_index:v,interlaced:!!B,delay:p,disposal:x});break;case 59:l=!1;break;default:throw new Error("Unknown gif block: 0x"+e[t-1].toString(16))}this.numFrames=function(){return i.length},this.loopCount=function(){return u},this.frameInfo=function(X){if(X<0||X>=i.length)throw new Error("Frame index out of range.");return i[X]},this.decodeAndBlitFrameBGRA=function(X,F){var _=this.frameInfo(X),Z=_.width*_.height,q=new Uint8Array(Z);de(e,_.data_offset,q,Z);var W=_.palette_offset,P=_.transparent_index;P===null&&(P=256);var G=_.width,N=n-G,Y=G,K=(_.y*n+_.x)*4,ee=((_.y+_.height)*n+_.x)*4,M=K,V=N*4;_.interlaced===!0&&(V+=n*4*7);for(var H=8,z=0,te=q.length;z<te;++z){var D=q[z];if(Y===0&&(M+=V,Y=G,M>=ee&&(V=N*4+n*4*(H-1),M=K+(G+N)*(H<<1),H>>=1)),D===P)M+=4;else{var re=e[W+D*3],ne=e[W+D*3+1],ae=e[W+D*3+2];F[M++]=ae,F[M++]=ne,F[M++]=re,F[M++]=255}--Y}},this.decodeAndBlitFrameRGBA=function(X,F){var _=this.frameInfo(X),Z=_.width*_.height,q=new Uint8Array(Z);de(e,_.data_offset,q,Z);var W=_.palette_offset,P=_.transparent_index;P===null&&(P=256);var G=_.width,N=n-G,Y=G,K=(_.y*n+_.x)*4,ee=((_.y+_.height)*n+_.x)*4,M=K,V=N*4;_.interlaced===!0&&(V+=n*4*7);for(var H=8,z=0,te=q.length;z<te;++z){var D=q[z];if(Y===0&&(M+=V,Y=G,M>=ee&&(V=N*4+n*4*(H-1),M=K+(G+N)*(H<<1),H>>=1)),D===P)M+=4;else{var re=e[W+D*3],ne=e[W+D*3+1],ae=e[W+D*3+2];F[M++]=re,F[M++]=ne,F[M++]=ae,F[M++]=255}--Y}}}function de(e,t,n,a){for(var r=e[t++],o=1<<r,c=o+1,s=c+1,d=r+1,f=(1<<d)-1,l=0,i=0,p=0,v=e[t++],x=new Int32Array(4096),u=null;;){for(;l<16&&v!==0;)i|=e[t++]<<l,l+=8,v===1?v=e[t++]:--v;if(l<d)break;var h=i&f;if(i>>=d,l-=d,h===o){s=c+1,d=r+1,f=(1<<d)-1,u=null;continue}else if(h===c)break;for(var g=h<s?h:u,y=0,m=g;m>o;)m=x[m]>>8,++y;var C=m,S=p+y+(g!==h?1:0);if(S>a){console.log("Warning, gif stream longer than expected.");return}n[p++]=C,p+=y;var w=p;for(g!==h&&(n[p++]=C),m=g;y--;)m=x[m],n[--w]=m&255,m>>=8;u!==null&&s<4096&&(x[s++]=u<<8|C,s>=f+1&&d<12&&(++d,f=f<<1|1)),u=h}return p!==a&&console.log("Warning, gif stream shorter than expected."),n}try{Ue=he.GifWriter=$e,ge=he.GifReader=We}catch{}const Pe=ge;function Ne(e){return async(t,n)=>{const a=e.find(r=>r.canResolve(t));if(!a)throw new me("No texture provider matched source",t);return we(a.resolve.bind(a),t,n)}}class me extends Error{constructor(n,a){super(n);Q(this,"source");this.name="TextureSourceLoadError",this.source=a}}function b(e){if(e.aborted)throw new DOMException("Texture source load aborted","AbortError")}async function we(e,t,n){b(n);const a=await e(t,n);return n.aborted&&(a.dispose(),b(n)),a}function Ye(e){e==null||e.dispose()}const ye=5*1024*1024,oe=1e6,ie=180,Ve=(e,t,n)=>{for(let a=n.y;a<n.y+n.height;a+=1)e.fill(0,(a*t+n.x)*4,(a*t+n.x+n.width)*4)},He=(e,t,n,a,r)=>t.byteLength>ye?`file is ${(t.byteLength/1024/1024).toFixed(1)} MB; max is 5 MB`:n*a>oe?`canvas is ${n}x${a}; max area is ${oe}`:r>ie?`frame count is ${r}; max is ${ie}`:r===0?"frame count is 0":e?null:"source URL is empty",ze=e=>typeof e=="string"?e:e.src,Qe={canResolve:e=>typeof e=="string"?/\.gif(?:[?#].*)?$/i.test(e):e.kind==="gif",async resolve(e,t){const n=ze(e),a=await fetch(n,{signal:t});if(!a.ok)throw new Error(`GIF request failed with ${a.status}`);const r=new Uint8Array(await a.arrayBuffer());b(t);const o=new Pe(r),c=o.numFrames(),s=He(n,r,o.width,o.height,c);if(s)throw console.warn(`[xr-sdk] GIF ScreenImage source rejected: ${s}`,n),new Error(`GIF source rejected: ${s}`);const d=document.createElement("canvas");d.width=o.width,d.height=o.height;const f=d.getContext("2d");if(!f)throw new Error("Could not create GIF canvas context");const l=new j.CanvasTexture(d);l.colorSpace=j.SRGBColorSpace;const i=new Uint8Array(o.width*o.height*4),p=new ImageData(new Uint8ClampedArray(i.buffer),o.width,o.height),v=Array.from({length:c},(R,T)=>o.frameInfo(T)),x=v.reduce((R,T)=>R+Math.max(20,T.delay*10),0)/1e3,u=new ve({canSeek:!1,canReverse:!1,supportsLoopCount:!0},{state:"ready",duration:x,frameCount:c});let h=0,g=0,y=!1,m=!1,C=0,S=0,w=null;const E=(R,T=!1)=>{T&&(i.fill(0),w=null),(w==null?void 0:w.info.disposal)===2?Ve(i,o.width,w.info):w!=null&&w.restorePixels&&i.set(w.restorePixels);const k=v[R],$=k.disposal===3?new Uint8Array(i):null;return o.decodeAndBlitFrameRGBA(R,i),f.putImageData(p,0,0),l.needsUpdate=!0,w={info:k,restorePixels:$},m=!0,u.updateSnapshot({frame:R,time:v.slice(0,R).reduce((X,F)=>X+Math.max(20,F.delay*10),0)/1e3}),m=!1,u.emit("KeyFrameInSecond"),Math.max(20,k.delay*10)},B=R=>{g=window.setTimeout(()=>{h=requestAnimationFrame(I)},R)},I=()=>{if(y||u.getSnapshot().state!=="playing")return;const R=u.getSnapshot(),T=pe(C,c,R.playMode,R.loop,R.loopCount);if(T.ended){u.updateSnapshot({state:"ended",frame:T.frame,time:x}),u.emit("PlayEnd");return}const k=T.loop!==S;S=T.loop,C+=1,B(E(T.frame,k))},U=u.subscribe(R=>{m||(clearTimeout(g),cancelAnimationFrame(h),R.state==="playing"&&(h=requestAnimationFrame(I)))});return E(0),u.play(),{texture:l,controller:u,metadata:{width:o.width,height:o.height,duration:x,frameCount:c},dispose(){y=!0,U(),clearTimeout(g),cancelAnimationFrame(h),u.dispose(),l.dispose()}}}},Se=A.createContext(null),_e=A.createContext(null),Oe=()=>A.useContext(Se),Ze=()=>A.useContext(_e);exports.BasicAnimatedTextureController=ve;exports.MAX_GIF_BYTES=ye;exports.MAX_GIF_FRAMES=ie;exports.MAX_GIF_PIXELS=oe;exports.ScreenTransform=De;exports.TextureSourceLoadError=me;exports.XRScene=Le;exports.XRViewportRenderOutputsContext=_e;exports.XRViewportStateContext=Se;exports.computeScreenTransform=xe;exports.createTextureSourceResolver=Ne;exports.disposeResolvedTextureSource=Ye;exports.getPlaybackFrame=pe;exports.getSequenceFrame=je;exports.gifTextureSourceProvider=Qe;exports.resolveTextureSource=we;exports.throwIfAborted=b;exports.useXRViewportRenderOutputs=Ze;exports.useXRViewportState=Oe;
|