@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
|
@@ -0,0 +1,774 @@
|
|
|
1
|
+
var nt = Object.defineProperty;
|
|
2
|
+
var ct = (e, t, i) => t in e ? nt(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
|
|
3
|
+
var p = (e, t, i) => ct(e, typeof t != "symbol" ? t + "" : t, i);
|
|
4
|
+
import { jsx as M } from "react/jsx-runtime";
|
|
5
|
+
import { useThree as B } from "@react-three/fiber";
|
|
6
|
+
import { forwardRef as k, useMemo as lt, useRef as U, useImperativeHandle as ht, useState as ft, useEffect as H } from "react";
|
|
7
|
+
import { e as pt } from "./selectors-DmNaKIwE.js";
|
|
8
|
+
import { u as ut, F as mt } from "./index-BavF06C6.js";
|
|
9
|
+
import { p as dt } from "./index-CIe7eCMH.js";
|
|
10
|
+
import { C as yt, a as vt } from "./CanonicalHeadFrame-BHcWyaiK.js";
|
|
11
|
+
import * as h from "three";
|
|
12
|
+
import { a as gt } from "./useLandmarkPoseFit-Bmb3h6Mw.js";
|
|
13
|
+
const me = ["leftEye", "rightEye", "eyes"], St = [
|
|
14
|
+
263,
|
|
15
|
+
249,
|
|
16
|
+
390,
|
|
17
|
+
373,
|
|
18
|
+
374,
|
|
19
|
+
380,
|
|
20
|
+
381,
|
|
21
|
+
382,
|
|
22
|
+
362,
|
|
23
|
+
398,
|
|
24
|
+
384,
|
|
25
|
+
385,
|
|
26
|
+
386,
|
|
27
|
+
387,
|
|
28
|
+
388,
|
|
29
|
+
466
|
|
30
|
+
], Et = [
|
|
31
|
+
33,
|
|
32
|
+
7,
|
|
33
|
+
163,
|
|
34
|
+
144,
|
|
35
|
+
145,
|
|
36
|
+
153,
|
|
37
|
+
154,
|
|
38
|
+
155,
|
|
39
|
+
133,
|
|
40
|
+
173,
|
|
41
|
+
157,
|
|
42
|
+
158,
|
|
43
|
+
159,
|
|
44
|
+
160,
|
|
45
|
+
161,
|
|
46
|
+
246
|
|
47
|
+
], X = (e) => {
|
|
48
|
+
const t = [0, 0, 0];
|
|
49
|
+
return e.forEach((i) => {
|
|
50
|
+
for (let r = 0; r < 3; r += 1) t[r] += yt[i * 3 + r] / e.length;
|
|
51
|
+
}), t;
|
|
52
|
+
}, xt = 0.4, Mt = (() => {
|
|
53
|
+
const e = X(St), t = X(Et);
|
|
54
|
+
return Object.freeze([
|
|
55
|
+
(e[0] - t[0]) / 2,
|
|
56
|
+
(e[1] + t[1]) / 2,
|
|
57
|
+
(e[2] + t[2]) / 2 + xt
|
|
58
|
+
]);
|
|
59
|
+
})(), Ct = (e, t) => {
|
|
60
|
+
const [i, r, s] = Mt;
|
|
61
|
+
return [dt(t) * (e === "left" ? 1 : -1) * i, r, s];
|
|
62
|
+
}, At = (e) => e === "eyes" ? ["left", "right"] : [e === "leftEye" ? "left" : "right"], Rt = ["point", "sphere", "box", "cone"], bt = ["glow", "streak"], Tt = ["additive", "normal"], O = 4, L = 65536, I = Object.freeze({
|
|
63
|
+
rate: 60,
|
|
64
|
+
lifetime: 1.5,
|
|
65
|
+
lifetimeJitter: 0.2,
|
|
66
|
+
shape: "cone",
|
|
67
|
+
radius: 0,
|
|
68
|
+
boxSize: Object.freeze([10, 10, 10]),
|
|
69
|
+
angle: 15,
|
|
70
|
+
surface: !1,
|
|
71
|
+
speed: 30,
|
|
72
|
+
speedJitter: 0.2,
|
|
73
|
+
gravity: 0,
|
|
74
|
+
wind: Object.freeze([0, 0, 0]),
|
|
75
|
+
drag: 0,
|
|
76
|
+
size: Object.freeze([1, 0.2]),
|
|
77
|
+
sizeJitter: 0.3,
|
|
78
|
+
color: "#ffffff",
|
|
79
|
+
opacity: Object.freeze([1, 0]),
|
|
80
|
+
sprite: "glow",
|
|
81
|
+
stretch: 0.05,
|
|
82
|
+
blending: "additive",
|
|
83
|
+
maxParticles: 0,
|
|
84
|
+
seed: 1
|
|
85
|
+
}), wt = {
|
|
86
|
+
rate: [0, 1e4],
|
|
87
|
+
lifetime: [0.02, 30],
|
|
88
|
+
lifetimeJitter: [0, 1],
|
|
89
|
+
radius: [0, 1e4],
|
|
90
|
+
boxSize: [0, 1e4],
|
|
91
|
+
angle: [0, 180],
|
|
92
|
+
speed: [0, 1e5],
|
|
93
|
+
speedJitter: [0, 1],
|
|
94
|
+
gravity: [-1e5, 1e5],
|
|
95
|
+
wind: [-1e5, 1e5],
|
|
96
|
+
drag: [0, 100],
|
|
97
|
+
size: [0, 1e4],
|
|
98
|
+
sizeJitter: [0, 1],
|
|
99
|
+
opacity: [0, 1],
|
|
100
|
+
stretch: [0, 1],
|
|
101
|
+
maxParticles: [0, L],
|
|
102
|
+
seed: [-1e9, 1e9]
|
|
103
|
+
}, w = (e, t, i, r) => typeof e == "number" && Number.isFinite(e) ? Math.min(i, Math.max(t, e)) : r, _ = (e, t, i) => typeof t == "string" && e.includes(t) ? t : i, Y = (e, [t, i], r) => {
|
|
104
|
+
const s = Array.isArray(e) ? e : [];
|
|
105
|
+
return [0, 1, 2].map((o) => w(s[o], t, i, r[o]));
|
|
106
|
+
}, $ = (e, [t, i], r) => {
|
|
107
|
+
const s = typeof r == "number" ? [r, r] : r;
|
|
108
|
+
if (typeof e == "number") {
|
|
109
|
+
const a = w(e, t, i, s[0]);
|
|
110
|
+
return [a, a];
|
|
111
|
+
}
|
|
112
|
+
const o = Array.isArray(e) ? e : [];
|
|
113
|
+
return [w(o[0], t, i, s[0]), w(o[1], t, i, s[1])];
|
|
114
|
+
}, E = new h.Color(), zt = (e) => typeof e == "number" && Number.isFinite(e) ? (E.setHex(Math.max(0, Math.min(16777215, Math.round(e)))), [E.r, E.g, E.b]) : typeof e != "string" || e.trim() === "" ? null : (E.setRGB(-1, -1, -1), E.setStyle(e), E.r < 0 ? null : [E.r, E.g, E.b]), Pt = (e, t) => {
|
|
115
|
+
const i = (s) => {
|
|
116
|
+
const a = (Array.isArray(s) ? s : [s]).slice(0, O).map(zt);
|
|
117
|
+
return a.length > 0 && a.every(Boolean) ? a : null;
|
|
118
|
+
}, r = i(e) ?? i(t) ?? [[1, 1, 1]];
|
|
119
|
+
return { colors: Float32Array.from(r.flat()), colorCount: r.length };
|
|
120
|
+
}, It = (e, t, i = 0) => {
|
|
121
|
+
if (i > 0) return Math.min(L, Math.ceil(i));
|
|
122
|
+
const r = Math.max(0, e) * Math.max(0, t);
|
|
123
|
+
return Math.min(
|
|
124
|
+
L,
|
|
125
|
+
Math.max(1, Math.ceil(r * 1.1 + Math.max(0, e) * 0.1) + 8)
|
|
126
|
+
);
|
|
127
|
+
}, q = (e = {}, t = I) => {
|
|
128
|
+
const i = wt, r = (n) => w(e[n], i[n][0], i[n][1], t[n]), s = r("rate"), o = r("lifetime"), a = Math.round(r("maxParticles"));
|
|
129
|
+
return {
|
|
130
|
+
rate: s,
|
|
131
|
+
lifetime: o,
|
|
132
|
+
lifetimeJitter: r("lifetimeJitter"),
|
|
133
|
+
shape: _(Rt, e.shape, t.shape),
|
|
134
|
+
radius: r("radius"),
|
|
135
|
+
boxSize: Y(e.boxSize, i.boxSize, t.boxSize),
|
|
136
|
+
angle: r("angle"),
|
|
137
|
+
surface: typeof e.surface == "boolean" ? e.surface : t.surface,
|
|
138
|
+
speed: r("speed"),
|
|
139
|
+
speedJitter: r("speedJitter"),
|
|
140
|
+
gravity: r("gravity"),
|
|
141
|
+
wind: Y(e.wind, i.wind, t.wind),
|
|
142
|
+
drag: r("drag"),
|
|
143
|
+
size: $(e.size, i.size, t.size),
|
|
144
|
+
sizeJitter: r("sizeJitter"),
|
|
145
|
+
...Pt(e.color, t.color),
|
|
146
|
+
opacity: $(e.opacity, i.opacity, t.opacity),
|
|
147
|
+
sprite: _(bt, e.sprite, t.sprite),
|
|
148
|
+
stretch: r("stretch"),
|
|
149
|
+
blending: _(Tt, e.blending, t.blending),
|
|
150
|
+
maxParticles: a,
|
|
151
|
+
seed: r("seed"),
|
|
152
|
+
capacity: It(s, o, a)
|
|
153
|
+
};
|
|
154
|
+
}, _t = ["laser"], Dt = Object.freeze({
|
|
155
|
+
/**
|
|
156
|
+
* Laser beams: fast streaks in a narrow cone, a white-hot core cooling to
|
|
157
|
+
* red, additive. Made for the eyes (`target="eyes"`): beams straight out
|
|
158
|
+
* of the face.
|
|
159
|
+
*/
|
|
160
|
+
laser: Object.freeze({
|
|
161
|
+
rate: 900,
|
|
162
|
+
lifetime: 0.3,
|
|
163
|
+
lifetimeJitter: 0.15,
|
|
164
|
+
shape: "cone",
|
|
165
|
+
radius: 0.08,
|
|
166
|
+
angle: 0.6,
|
|
167
|
+
speed: 260,
|
|
168
|
+
speedJitter: 0.05,
|
|
169
|
+
gravity: 0,
|
|
170
|
+
wind: [0, 0, 0],
|
|
171
|
+
drag: 0,
|
|
172
|
+
size: [0.5, 0.2],
|
|
173
|
+
sizeJitter: 0.2,
|
|
174
|
+
color: ["#ffffff", "#ff3b30", "#7a0000"],
|
|
175
|
+
opacity: [1, 0],
|
|
176
|
+
sprite: "streak",
|
|
177
|
+
stretch: 0.08,
|
|
178
|
+
blending: "additive"
|
|
179
|
+
})
|
|
180
|
+
}), Lt = (e) => typeof e == "string" && _t.includes(e), kt = (e) => Lt(e) ? { ...I, ...Dt[e] } : I, C = 12, z = Object.freeze({
|
|
181
|
+
position: 0,
|
|
182
|
+
birth: 3,
|
|
183
|
+
velocity: 4,
|
|
184
|
+
lifetime: 7,
|
|
185
|
+
sizeScale: 8,
|
|
186
|
+
unit: 9,
|
|
187
|
+
seed: 10
|
|
188
|
+
}), Ot = () => ({
|
|
189
|
+
position: [0, 0, 0],
|
|
190
|
+
velocity: [0, 0, 0],
|
|
191
|
+
birth: 0,
|
|
192
|
+
lifetime: 0,
|
|
193
|
+
sizeScale: 1,
|
|
194
|
+
unit: 1,
|
|
195
|
+
seed: 0
|
|
196
|
+
});
|
|
197
|
+
class W {
|
|
198
|
+
constructor(t) {
|
|
199
|
+
p(this, "capacity");
|
|
200
|
+
/** `capacity × PARTICLE_RECORD_FLOATS` floats; a lifetime of 0 is an empty slot. */
|
|
201
|
+
p(this, "data");
|
|
202
|
+
p(this, "head", 0);
|
|
203
|
+
p(this, "dirtyFirst", 0);
|
|
204
|
+
p(this, "dirtyCount", 0);
|
|
205
|
+
this.capacity = Math.max(1, Math.floor(t)), this.data = new Float32Array(this.capacity * C);
|
|
206
|
+
}
|
|
207
|
+
/** The slot the next particle goes in (the oldest). */
|
|
208
|
+
get next() {
|
|
209
|
+
return this.head;
|
|
210
|
+
}
|
|
211
|
+
/** Writes a particle over the oldest slot; returns the slot. */
|
|
212
|
+
push(t) {
|
|
213
|
+
const i = this.head, r = i * C, s = this.data, o = z;
|
|
214
|
+
return s[r + o.position] = t.position[0], s[r + o.position + 1] = t.position[1], s[r + o.position + 2] = t.position[2], s[r + o.birth] = t.birth, s[r + o.velocity] = t.velocity[0], s[r + o.velocity + 1] = t.velocity[1], s[r + o.velocity + 2] = t.velocity[2], s[r + o.lifetime] = t.lifetime, s[r + o.sizeScale] = t.sizeScale, s[r + o.unit] = t.unit, s[r + o.seed] = t.seed, s[r + 11] = 0, this.dirtyCount === 0 && (this.dirtyFirst = i), this.dirtyCount = Math.min(this.capacity, this.dirtyCount + 1), this.head = (i + 1) % this.capacity, i;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* The slots written since the last call, as at most two ranges (one when
|
|
218
|
+
* they do not wrap, the whole ring after a full lap), then forgets them.
|
|
219
|
+
*/
|
|
220
|
+
takeDirty(t = []) {
|
|
221
|
+
t.length = 0;
|
|
222
|
+
const i = this.dirtyCount;
|
|
223
|
+
if (i === 0) return t;
|
|
224
|
+
if (i >= this.capacity)
|
|
225
|
+
t.push([0, this.capacity]);
|
|
226
|
+
else {
|
|
227
|
+
const r = this.dirtyFirst, s = r + i;
|
|
228
|
+
s <= this.capacity ? t.push([r, i]) : t.push([r, this.capacity - r], [0, s - this.capacity]);
|
|
229
|
+
}
|
|
230
|
+
return this.dirtyCount = 0, t;
|
|
231
|
+
}
|
|
232
|
+
/** Empties every slot (and marks them all for upload). */
|
|
233
|
+
clear() {
|
|
234
|
+
this.data.fill(0), this.head = 0, this.dirtyFirst = 0, this.dirtyCount = this.capacity;
|
|
235
|
+
}
|
|
236
|
+
/** Particles alive at `time` (s): born and not yet past their lifetime. */
|
|
237
|
+
aliveAt(t) {
|
|
238
|
+
const i = this.data;
|
|
239
|
+
let r = 0;
|
|
240
|
+
for (let s = 0; s < i.length; s += C) {
|
|
241
|
+
const o = t - i[s + z.birth];
|
|
242
|
+
o >= 0 && o < i[s + z.lifetime] && (r += 1);
|
|
243
|
+
}
|
|
244
|
+
return r;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
const F = 0.01, Ft = (e, t) => {
|
|
248
|
+
const i = e * t;
|
|
249
|
+
return i < F ? t * (1 - i / 2 + i * i / 6 - i * i * i / 24) : (1 - Math.exp(-i)) / e;
|
|
250
|
+
}, Nt = (e, t) => {
|
|
251
|
+
const i = e * t;
|
|
252
|
+
return i < F ? t * t * (0.5 - i / 6 + i * i / 24 - i * i * i / 120) : (t - (1 - Math.exp(-i)) / e) / e;
|
|
253
|
+
}, it = (e, t = [0, 0, 0]) => (t[0] = e.wind[0], t[1] = e.wind[1] - e.gravity, t[2] = e.wind[2], t), K = (e, t) => e[0] + (e[1] - e[0]) * t, Vt = (e, t, i = [0, 0, 0]) => {
|
|
254
|
+
const { colors: r, colorCount: s } = e, o = Math.min(1, Math.max(0, t)) * (s - 1), a = Math.min(s - 1, Math.floor(o)), n = Math.min(s - 1, a + 1), c = o - a;
|
|
255
|
+
for (let l = 0; l < 3; l += 1)
|
|
256
|
+
i[l] = r[a * 3 + l] + (r[n * 3 + l] - r[a * 3 + l]) * c;
|
|
257
|
+
return i;
|
|
258
|
+
}, Jt = () => ({
|
|
259
|
+
alive: !1,
|
|
260
|
+
age: 0,
|
|
261
|
+
life: 0,
|
|
262
|
+
position: [0, 0, 0],
|
|
263
|
+
velocity: [0, 0, 0],
|
|
264
|
+
size: 0,
|
|
265
|
+
opacity: 0,
|
|
266
|
+
color: [0, 0, 0]
|
|
267
|
+
}), Q = [0, 0, 0], de = (e, t, i, r, s = Jt()) => {
|
|
268
|
+
const o = t * C, a = z, n = e[o + a.lifetime], c = i - e[o + a.birth];
|
|
269
|
+
s.age = c, s.alive = n > 0 && c >= 0 && c < n;
|
|
270
|
+
const l = Math.min(Math.max(c, 0), Math.max(n, 0));
|
|
271
|
+
s.life = n > 0 ? l / n : 0;
|
|
272
|
+
const f = r.drag, u = Ft(f, l), S = Nt(f, l), x = Math.exp(-f * l), m = e[o + a.unit];
|
|
273
|
+
it(r, Q);
|
|
274
|
+
for (let d = 0; d < 3; d += 1) {
|
|
275
|
+
const b = Q[d] * m, y = e[o + a.velocity + d];
|
|
276
|
+
s.position[d] = e[o + a.position + d] + y * u + b * S, s.velocity[d] = y * x + b * u;
|
|
277
|
+
}
|
|
278
|
+
return s.size = K(r.size, s.life) * e[o + a.sizeScale], s.opacity = K(r.opacity, s.life), Vt(r, s.life, s.color), s;
|
|
279
|
+
}, Gt = (e) => Number.isInteger(e) ? `${e}.0` : `${e}`, jt = (
|
|
280
|
+
/* glsl */
|
|
281
|
+
`
|
|
282
|
+
uniform float uTime;
|
|
283
|
+
uniform float uDrag;
|
|
284
|
+
uniform vec3 uAcceleration;
|
|
285
|
+
uniform vec2 uSize;
|
|
286
|
+
uniform vec2 uOpacity;
|
|
287
|
+
uniform vec3 uColors[${O}];
|
|
288
|
+
uniform float uColorCount;
|
|
289
|
+
|
|
290
|
+
const float PARTICLE_DRAG_SERIES_LIMIT = ${Gt(F)};
|
|
291
|
+
|
|
292
|
+
float particleDragDistance(float k, float t) {
|
|
293
|
+
float kt = k * t;
|
|
294
|
+
if (kt < PARTICLE_DRAG_SERIES_LIMIT) {
|
|
295
|
+
return t * (1.0 - kt / 2.0 + kt * kt / 6.0 - kt * kt * kt / 24.0);
|
|
296
|
+
}
|
|
297
|
+
return (1.0 - exp(-kt)) / k;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
float particleDragAcceleration(float k, float t) {
|
|
301
|
+
float kt = k * t;
|
|
302
|
+
if (kt < PARTICLE_DRAG_SERIES_LIMIT) {
|
|
303
|
+
return t * t * (0.5 - kt / 6.0 + kt * kt / 24.0 - kt * kt * kt / 120.0);
|
|
304
|
+
}
|
|
305
|
+
return (t - (1.0 - exp(-kt)) / k) / k;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
vec3 particleColorAt(float life) {
|
|
309
|
+
float last = max(uColorCount, 1.0) - 1.0;
|
|
310
|
+
float x = clamp(life, 0.0, 1.0) * last;
|
|
311
|
+
float i = min(floor(x), last);
|
|
312
|
+
float j = min(i + 1.0, last);
|
|
313
|
+
return mix(uColors[int(i)], uColors[int(j)], x - i);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
struct ParticleState {
|
|
317
|
+
float alive;
|
|
318
|
+
float life;
|
|
319
|
+
vec3 position;
|
|
320
|
+
vec3 velocity;
|
|
321
|
+
float size;
|
|
322
|
+
float opacity;
|
|
323
|
+
vec3 color;
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
// start: position (world) and birth; motion: velocity (world) and lifetime;
|
|
327
|
+
// extra: size scale, unit (world units per emitter unit), seed.
|
|
328
|
+
ParticleState particleState(vec4 start, vec4 motion, vec4 extra, float time) {
|
|
329
|
+
ParticleState s;
|
|
330
|
+
float lifetime = motion.w;
|
|
331
|
+
float age = time - start.w;
|
|
332
|
+
s.alive = (lifetime > 0.0 && age >= 0.0 && age < lifetime) ? 1.0 : 0.0;
|
|
333
|
+
float t = clamp(age, 0.0, max(lifetime, 0.0));
|
|
334
|
+
s.life = lifetime > 0.0 ? t / lifetime : 0.0;
|
|
335
|
+
float D = particleDragDistance(uDrag, t);
|
|
336
|
+
float A = particleDragAcceleration(uDrag, t);
|
|
337
|
+
vec3 a = uAcceleration * extra.y;
|
|
338
|
+
s.position = start.xyz + motion.xyz * D + a * A;
|
|
339
|
+
s.velocity = motion.xyz * exp(-uDrag * t) + a * D;
|
|
340
|
+
s.size = mix(uSize.x, uSize.y, s.life) * extra.x;
|
|
341
|
+
s.opacity = mix(uOpacity.x, uOpacity.y, s.life);
|
|
342
|
+
s.color = particleColorAt(s.life);
|
|
343
|
+
return s;
|
|
344
|
+
}
|
|
345
|
+
`
|
|
346
|
+
), Bt = (
|
|
347
|
+
/* glsl */
|
|
348
|
+
`
|
|
349
|
+
attribute vec4 aStart;
|
|
350
|
+
attribute vec4 aMotion;
|
|
351
|
+
attribute vec4 aExtra;
|
|
352
|
+
uniform float uSprite;
|
|
353
|
+
uniform float uStretch;
|
|
354
|
+
varying vec2 vCorner;
|
|
355
|
+
varying vec4 vColor;
|
|
356
|
+
varying float vStreak;
|
|
357
|
+
${jt}
|
|
358
|
+
void main() {
|
|
359
|
+
ParticleState p = particleState(aStart, aMotion, aExtra, uTime);
|
|
360
|
+
vCorner = position.xy;
|
|
361
|
+
vColor = vec4(p.color, p.opacity);
|
|
362
|
+
vStreak = 0.0;
|
|
363
|
+
if (p.alive < 0.5 || p.size <= 0.0 || p.opacity <= 0.0) {
|
|
364
|
+
gl_Position = vec4(0.0, 0.0, 2.0, 1.0);
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
float halfSize = 0.5 * p.size;
|
|
368
|
+
vec3 head = (viewMatrix * vec4(p.position, 1.0)).xyz;
|
|
369
|
+
vec3 point = head + vec3(position.xy * halfSize, 0.0);
|
|
370
|
+
if (uSprite > 0.5) {
|
|
371
|
+
// Never longer than the particle's own path: a newborn streak starts at the emitter.
|
|
372
|
+
float tailSeconds = min(uStretch, max(uTime - aStart.w, 0.0));
|
|
373
|
+
vec3 tail = (viewMatrix * vec4(p.position - p.velocity * tailSeconds, 1.0)).xyz;
|
|
374
|
+
vec3 axis = head - tail;
|
|
375
|
+
vec3 toPoint = isOrthographic ? vec3(0.0, 0.0, -1.0) : normalize(head);
|
|
376
|
+
vec3 side = cross(axis, toPoint);
|
|
377
|
+
float sideLength = length(side);
|
|
378
|
+
// Seen end-on (or not moving), a streak is a glow.
|
|
379
|
+
if (sideLength > 0.05 * p.size) {
|
|
380
|
+
point = mix(tail, head, position.y * 0.5 + 0.5) + side / sideLength * position.x * halfSize;
|
|
381
|
+
vStreak = 1.0;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
gl_Position = projectionMatrix * vec4(point, 1.0);
|
|
385
|
+
}
|
|
386
|
+
`
|
|
387
|
+
), Ut = (
|
|
388
|
+
/* glsl */
|
|
389
|
+
`
|
|
390
|
+
varying vec2 vCorner;
|
|
391
|
+
varying vec4 vColor;
|
|
392
|
+
varying float vStreak;
|
|
393
|
+
void main() {
|
|
394
|
+
float shape;
|
|
395
|
+
if (vStreak > 0.5) {
|
|
396
|
+
float across = exp(-5.0 * vCorner.x * vCorner.x);
|
|
397
|
+
float along = clamp(vCorner.y * 0.5 + 0.5, 0.0, 1.0);
|
|
398
|
+
shape = across * along * along * (1.0 - smoothstep(0.9, 1.0, along));
|
|
399
|
+
} else {
|
|
400
|
+
float r2 = dot(vCorner, vCorner);
|
|
401
|
+
shape = r2 < 1.0 ? (1.0 - r2) * (1.0 - r2) : 0.0;
|
|
402
|
+
}
|
|
403
|
+
float alpha = shape * vColor.a;
|
|
404
|
+
if (alpha < 0.002) discard;
|
|
405
|
+
gl_FragColor = vec4(vColor.rgb, alpha);
|
|
406
|
+
#include <colorspace_fragment>
|
|
407
|
+
}
|
|
408
|
+
`
|
|
409
|
+
), Ht = 0.25, Xt = () => ({ carry: 0 }), Yt = (e, t, i, r = [], s = 1 / 0) => {
|
|
410
|
+
if (r.length = 0, !(t > 0) || !(i > 0)) return r;
|
|
411
|
+
const o = Math.min(Ht, i), a = e.carry + t * o, n = Math.floor(a), c = Math.max(0, n - Math.max(0, Math.floor(s)));
|
|
412
|
+
for (let l = c; l < n; l += 1) {
|
|
413
|
+
const f = (l + 1 - e.carry) / t;
|
|
414
|
+
r.push(Math.min(1, (i - o + f) / i));
|
|
415
|
+
}
|
|
416
|
+
return e.carry = a - n, r;
|
|
417
|
+
}, Z = (e) => {
|
|
418
|
+
let t = Math.floor(e) >>> 0;
|
|
419
|
+
return () => {
|
|
420
|
+
t = t + 1831565813 >>> 0;
|
|
421
|
+
let i = t;
|
|
422
|
+
return i = Math.imul(i ^ i >>> 15, i | 1), i ^= i + Math.imul(i ^ i >>> 7, i | 61), ((i ^ i >>> 14) >>> 0) / 4294967296;
|
|
423
|
+
};
|
|
424
|
+
}, rt = () => ({
|
|
425
|
+
position: [0, 0, 0],
|
|
426
|
+
direction: [0, 0, 1]
|
|
427
|
+
}), st = Math.PI / 180, P = (e, t, i) => {
|
|
428
|
+
const r = Math.cos(Math.min(180, Math.max(0, e)) * st), s = 1 - t() * (1 - r), o = Math.sqrt(Math.max(0, 1 - s * s)), a = t() * 2 * Math.PI;
|
|
429
|
+
return i[0] = o * Math.cos(a), i[1] = o * Math.sin(a), i[2] = s, i;
|
|
430
|
+
}, $t = (e, t) => P(180, e, t), qt = (e, t, i = rt()) => {
|
|
431
|
+
const r = i.position, s = i.direction;
|
|
432
|
+
switch (r[0] = 0, r[1] = 0, r[2] = 0, e.shape) {
|
|
433
|
+
case "sphere": {
|
|
434
|
+
$t(t, s);
|
|
435
|
+
const o = e.radius * (e.surface ? 1 : Math.cbrt(t()));
|
|
436
|
+
r[0] = s[0] * o, r[1] = s[1] * o, r[2] = s[2] * o;
|
|
437
|
+
break;
|
|
438
|
+
}
|
|
439
|
+
case "box": {
|
|
440
|
+
const [o, a, n] = e.boxSize;
|
|
441
|
+
if (r[0] = (t() - 0.5) * o, r[1] = (t() - 0.5) * a, r[2] = (t() - 0.5) * n, e.surface) {
|
|
442
|
+
const c = [a * n, o * n, o * a], l = c[0] + c[1] + c[2];
|
|
443
|
+
let f = t() * (l > 0 ? l : 3), u = 0;
|
|
444
|
+
if (l > 0)
|
|
445
|
+
for (; u < 2 && f >= c[u]; )
|
|
446
|
+
f -= c[u], u += 1;
|
|
447
|
+
else
|
|
448
|
+
u = Math.min(2, Math.floor(f));
|
|
449
|
+
r[u] = (t() < 0.5 ? -0.5 : 0.5) * e.boxSize[u];
|
|
450
|
+
}
|
|
451
|
+
P(e.angle, t, s);
|
|
452
|
+
break;
|
|
453
|
+
}
|
|
454
|
+
case "cone": {
|
|
455
|
+
const o = e.radius;
|
|
456
|
+
if (o > 0) {
|
|
457
|
+
const a = Math.sqrt(t()), n = t() * 2 * Math.PI, c = Math.cos(n), l = Math.sin(n);
|
|
458
|
+
r[0] = o * a * c, r[1] = o * a * l;
|
|
459
|
+
const f = Math.min(180, e.angle) * st * a;
|
|
460
|
+
s[0] = Math.sin(f) * c, s[1] = Math.sin(f) * l, s[2] = Math.cos(f);
|
|
461
|
+
} else
|
|
462
|
+
P(e.angle, t, s);
|
|
463
|
+
break;
|
|
464
|
+
}
|
|
465
|
+
default:
|
|
466
|
+
P(e.angle, t, s);
|
|
467
|
+
}
|
|
468
|
+
return i;
|
|
469
|
+
}, tt = (e) => {
|
|
470
|
+
const t = e.elements, i = Math.hypot(t[0], t[1], t[2]), r = Math.hypot(t[4], t[5], t[6]), s = Math.hypot(t[8], t[9], t[10]);
|
|
471
|
+
return (i + r + s) / 3;
|
|
472
|
+
}, D = rt(), g = Ot(), R = new h.Vector3(), v = new h.Vector3(), T = new h.Vector3(), Wt = (e, t, i, r, s) => {
|
|
473
|
+
const o = tt(i.from), a = tt(i.to);
|
|
474
|
+
for (let n = 0; n < r.length; n += 1) {
|
|
475
|
+
const c = r[n];
|
|
476
|
+
qt(t, s, D);
|
|
477
|
+
const l = s(), f = s(), u = s(), S = s();
|
|
478
|
+
R.fromArray(D.position), v.copy(R).applyMatrix4(i.from), T.copy(R).applyMatrix4(i.to), v.lerp(T, c), g.position[0] = v.x, g.position[1] = v.y, g.position[2] = v.z, R.fromArray(D.direction), v.copy(R).transformDirection(i.from), T.copy(R).transformDirection(i.to), v.lerp(T, c), v.lengthSq() > 1e-12 ? v.normalize() : v.copy(T);
|
|
479
|
+
const x = o + (a - o) * c, m = t.speed * (1 - t.speedJitter * l) * x;
|
|
480
|
+
g.velocity[0] = v.x * m, g.velocity[1] = v.y * m, g.velocity[2] = v.z * m, g.birth = i.timeFrom + (i.timeTo - i.timeFrom) * c, g.lifetime = t.lifetime * (1 - t.lifetimeJitter * f), g.sizeScale = (1 - t.sizeJitter * u) * x, g.unit = x, g.seed = S, e.push(g);
|
|
481
|
+
}
|
|
482
|
+
};
|
|
483
|
+
class Kt {
|
|
484
|
+
constructor(t) {
|
|
485
|
+
p(this, "ringValue");
|
|
486
|
+
p(this, "settingsValue");
|
|
487
|
+
p(this, "random");
|
|
488
|
+
p(this, "emission", Xt());
|
|
489
|
+
p(this, "births", []);
|
|
490
|
+
p(this, "last", new h.Matrix4());
|
|
491
|
+
p(this, "lastTime", null);
|
|
492
|
+
p(this, "frame", {
|
|
493
|
+
from: new h.Matrix4(),
|
|
494
|
+
to: new h.Matrix4(),
|
|
495
|
+
timeFrom: 0,
|
|
496
|
+
timeTo: 0
|
|
497
|
+
});
|
|
498
|
+
this.settingsValue = t, this.ringValue = new W(t.capacity), this.random = Z(t.seed);
|
|
499
|
+
}
|
|
500
|
+
get ring() {
|
|
501
|
+
return this.ringValue;
|
|
502
|
+
}
|
|
503
|
+
get settings() {
|
|
504
|
+
return this.settingsValue;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* New settings. A new capacity starts a new (empty) ring and a new seed a
|
|
508
|
+
* new random sequence; anything else applies to the particles already out
|
|
509
|
+
* (the shader reads it every frame) and to the next ones.
|
|
510
|
+
*/
|
|
511
|
+
setSettings(t) {
|
|
512
|
+
const i = this.settingsValue;
|
|
513
|
+
this.settingsValue = t, t.capacity !== i.capacity && (this.ringValue = new W(t.capacity), this.ringValue.clear()), t.seed !== i.seed && (this.random = Z(t.seed));
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* One frame at `time` (s) with the emitter at `matrix` (world): emits the
|
|
517
|
+
* particles due since the last update along the emitter's path, unless
|
|
518
|
+
* `emitting` is false. The first update only records the pose. Returns how
|
|
519
|
+
* many were emitted.
|
|
520
|
+
*/
|
|
521
|
+
update(t, i, r = !0) {
|
|
522
|
+
const s = this.lastTime;
|
|
523
|
+
if (this.lastTime = i, s === null || !r || !(i > s))
|
|
524
|
+
return this.last.copy(t), r || (this.emission.carry = 0), 0;
|
|
525
|
+
const o = this.settingsValue;
|
|
526
|
+
Yt(
|
|
527
|
+
this.emission,
|
|
528
|
+
o.rate,
|
|
529
|
+
i - s,
|
|
530
|
+
this.births,
|
|
531
|
+
this.ringValue.capacity
|
|
532
|
+
);
|
|
533
|
+
const a = this.frame;
|
|
534
|
+
return a.from.copy(this.last), a.to.copy(t), a.timeFrom = s, a.timeTo = i, Wt(this.ringValue, o, a, this.births, this.random), this.last.copy(t), this.births.length;
|
|
535
|
+
}
|
|
536
|
+
/** Removes every particle and forgets the last pose (the next update starts again). */
|
|
537
|
+
reset() {
|
|
538
|
+
this.ringValue.clear(), this.emission.carry = 0, this.lastTime = null;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
const Qt = () => ({
|
|
542
|
+
uTime: { value: 0 },
|
|
543
|
+
uDrag: { value: 0 },
|
|
544
|
+
uAcceleration: { value: new h.Vector3() },
|
|
545
|
+
uSize: { value: new h.Vector2(1, 1) },
|
|
546
|
+
uOpacity: { value: new h.Vector2(1, 1) },
|
|
547
|
+
uColors: { value: Array.from({ length: O }, () => new h.Vector3(1, 1, 1)) },
|
|
548
|
+
uColorCount: { value: 1 },
|
|
549
|
+
uSprite: { value: 0 },
|
|
550
|
+
uStretch: { value: 0 }
|
|
551
|
+
}), Zt = (e, t) => {
|
|
552
|
+
e.uDrag.value = t.drag, e.uAcceleration.value.fromArray(it(t)), e.uSize.value.set(t.size[0], t.size[1]), e.uOpacity.value.set(t.opacity[0], t.opacity[1]), e.uColors.value.forEach((i, r) => {
|
|
553
|
+
const s = Math.min(r, t.colorCount - 1) * 3;
|
|
554
|
+
i.set(t.colors[s], t.colors[s + 1], t.colors[s + 2]);
|
|
555
|
+
}), e.uColorCount.value = t.colorCount, e.uSprite.value = t.sprite === "streak" ? 1 : 0, e.uStretch.value = t.stretch;
|
|
556
|
+
}, te = [-1, -1, 0, 1, -1, 0, 1, 1, 0, -1, 1, 0], ee = [0, 1, 2, 0, 2, 3], et = (e) => {
|
|
557
|
+
const t = new h.InstancedBufferGeometry();
|
|
558
|
+
t.setAttribute("position", new h.Float32BufferAttribute(te, 3)), t.setIndex(ee);
|
|
559
|
+
const i = new h.InstancedInterleavedBuffer(e.data, C, 1);
|
|
560
|
+
return i.setUsage(h.DynamicDrawUsage), t.setAttribute("aStart", new h.InterleavedBufferAttribute(i, 4, 0)), t.setAttribute("aMotion", new h.InterleavedBufferAttribute(i, 4, 4)), t.setAttribute("aExtra", new h.InterleavedBufferAttribute(i, 4, 8)), t.instanceCount = e.capacity, t.boundingSphere = new h.Sphere(new h.Vector3(), 1 / 0), { geometry: t, buffer: i };
|
|
561
|
+
};
|
|
562
|
+
class ie {
|
|
563
|
+
constructor(t = {}, i) {
|
|
564
|
+
/** Add it anywhere in the scene (its own transform is ignored); render order is yours to set. */
|
|
565
|
+
p(this, "mesh");
|
|
566
|
+
p(this, "uniforms", Qt());
|
|
567
|
+
p(this, "spawner");
|
|
568
|
+
p(this, "buffer");
|
|
569
|
+
p(this, "bufferRing");
|
|
570
|
+
p(this, "epoch", null);
|
|
571
|
+
p(this, "ranges", []);
|
|
572
|
+
p(this, "disposed", !1);
|
|
573
|
+
const r = q(t, i);
|
|
574
|
+
this.spawner = new Kt(r), this.bufferRing = this.spawner.ring;
|
|
575
|
+
const { geometry: s, buffer: o } = et(this.bufferRing);
|
|
576
|
+
this.buffer = o;
|
|
577
|
+
const a = new h.ShaderMaterial({
|
|
578
|
+
name: "Particles",
|
|
579
|
+
uniforms: this.uniforms,
|
|
580
|
+
vertexShader: Bt,
|
|
581
|
+
fragmentShader: Ut,
|
|
582
|
+
transparent: !0,
|
|
583
|
+
depthTest: !0,
|
|
584
|
+
depthWrite: !1,
|
|
585
|
+
side: h.DoubleSide,
|
|
586
|
+
toneMapped: !1
|
|
587
|
+
});
|
|
588
|
+
this.mesh = new h.Mesh(s, a), this.mesh.name = "Particles", this.mesh.frustumCulled = !1, this.mesh.matrixAutoUpdate = !1, this.mesh.raycast = () => {
|
|
589
|
+
}, this.apply(r);
|
|
590
|
+
}
|
|
591
|
+
/** The settings in use (resolved). */
|
|
592
|
+
get settings() {
|
|
593
|
+
return this.spawner.settings;
|
|
594
|
+
}
|
|
595
|
+
/** The spawn records (slots in use show their lifetime above 0). */
|
|
596
|
+
get ring() {
|
|
597
|
+
return this.spawner.ring;
|
|
598
|
+
}
|
|
599
|
+
/** The clock the shader draws at (s since the first update). */
|
|
600
|
+
get time() {
|
|
601
|
+
return this.uniforms.uTime.value;
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* New settings (any subset, over `base`, default `DEFAULT_PARTICLE_SETTINGS`).
|
|
605
|
+
* A new capacity empties the particles; anything else applies to the
|
|
606
|
+
* particles already out too.
|
|
607
|
+
*/
|
|
608
|
+
setSettings(t, i = I) {
|
|
609
|
+
const r = q(t, i);
|
|
610
|
+
this.spawner.setSettings(r), this.apply(r);
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* One frame: the emitter at `matrix` (world) at `time` (s, any clock that
|
|
614
|
+
* moves forward). Emits the particles due (unless `emitting` is false),
|
|
615
|
+
* uploads the new slots and sets the clock. Call it after the world
|
|
616
|
+
* matrices are up to date and before the render (the scene's
|
|
617
|
+
* `onBeforeRender`) so new particles draw this frame. A second call at the
|
|
618
|
+
* same time does nothing more. Returns how many were emitted.
|
|
619
|
+
*/
|
|
620
|
+
update(t, i, r = !0) {
|
|
621
|
+
if (this.disposed) return 0;
|
|
622
|
+
this.epoch === null && (this.epoch = i);
|
|
623
|
+
const s = i - this.epoch, o = this.spawner.update(t, s, r);
|
|
624
|
+
return this.syncRing(), this.spawner.ring.takeDirty(this.ranges), this.ranges.length > 0 && (this.ranges.forEach(
|
|
625
|
+
([a, n]) => this.buffer.addUpdateRange(a * C, n * C)
|
|
626
|
+
), this.buffer.needsUpdate = !0), this.uniforms.uTime.value = s, o;
|
|
627
|
+
}
|
|
628
|
+
/** Particles alive now (counts the ring on the CPU: for a readout, not every frame). */
|
|
629
|
+
aliveCount() {
|
|
630
|
+
return this.spawner.ring.aliveAt(Math.fround(this.uniforms.uTime.value));
|
|
631
|
+
}
|
|
632
|
+
/** Removes every particle; the next update starts emitting again. */
|
|
633
|
+
reset() {
|
|
634
|
+
this.spawner.reset(), this.epoch = null, this.uniforms.uTime.value = 0;
|
|
635
|
+
}
|
|
636
|
+
dispose() {
|
|
637
|
+
this.disposed || (this.disposed = !0, this.mesh.geometry.dispose(), this.mesh.material.dispose());
|
|
638
|
+
}
|
|
639
|
+
apply(t) {
|
|
640
|
+
Zt(this.uniforms, t), this.mesh.material.blending = t.blending === "additive" ? h.AdditiveBlending : h.NormalBlending, this.syncRing();
|
|
641
|
+
}
|
|
642
|
+
/** A new ring (a capacity change) needs a new geometry around it. */
|
|
643
|
+
syncRing() {
|
|
644
|
+
const t = this.spawner.ring;
|
|
645
|
+
if (t === this.bufferRing || !this.mesh) return;
|
|
646
|
+
this.mesh.geometry.dispose();
|
|
647
|
+
const { geometry: i, buffer: r } = et(t);
|
|
648
|
+
this.mesh.geometry = i, this.buffer = r, this.bufferRing = t;
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
const re = (e) => {
|
|
652
|
+
for (let t = e; t; t = t.parent) if (!t.visible) return !1;
|
|
653
|
+
return !0;
|
|
654
|
+
}, N = k(
|
|
655
|
+
({
|
|
656
|
+
base: e,
|
|
657
|
+
emitting: t = !0,
|
|
658
|
+
renderOrder: i = 0,
|
|
659
|
+
position: r,
|
|
660
|
+
rotation: s,
|
|
661
|
+
scale: o,
|
|
662
|
+
onSystem: a,
|
|
663
|
+
children: n,
|
|
664
|
+
...c
|
|
665
|
+
}, l) => {
|
|
666
|
+
const f = B((y) => y.scene), u = B((y) => y.get), S = U(null);
|
|
667
|
+
ht(l, () => S.current, []);
|
|
668
|
+
const x = JSON.stringify(c), m = U({ settings: c, base: e, emitting: t, onSystem: a });
|
|
669
|
+
m.current = { settings: c, base: e, emitting: t, onSystem: a };
|
|
670
|
+
const [d, b] = ft(null);
|
|
671
|
+
return H(() => {
|
|
672
|
+
var V, J;
|
|
673
|
+
const y = new ie(m.current.settings, m.current.base);
|
|
674
|
+
f.add(y.mesh);
|
|
675
|
+
const at = gt(f, () => {
|
|
676
|
+
const A = S.current;
|
|
677
|
+
A && y.update(
|
|
678
|
+
A.matrixWorld,
|
|
679
|
+
u().clock.elapsedTime,
|
|
680
|
+
m.current.emitting && re(A)
|
|
681
|
+
);
|
|
682
|
+
});
|
|
683
|
+
return b(y), (J = (V = m.current).onSystem) == null || J.call(V, y), () => {
|
|
684
|
+
var A, G;
|
|
685
|
+
at(), f.remove(y.mesh), y.dispose(), (G = (A = m.current).onSystem) == null || G.call(A, null), b((j) => j === y ? null : j);
|
|
686
|
+
};
|
|
687
|
+
}, [f, u]), H(() => {
|
|
688
|
+
d == null || d.setSettings(m.current.settings, m.current.base);
|
|
689
|
+
}, [d, x, e]), d && (d.mesh.renderOrder = i), /* @__PURE__ */ M("group", { ref: S, position: r, rotation: s, scale: o, children: n });
|
|
690
|
+
}
|
|
691
|
+
);
|
|
692
|
+
N.displayName = "Emitter";
|
|
693
|
+
const ot = k(
|
|
694
|
+
({ target: e, faceIndex: t, numFaces: i, base: r, seed: s, ...o }, a) => {
|
|
695
|
+
const n = ut(), c = pt(), l = s ?? r.seed, f = /* @__PURE__ */ M(vt, { faceIndex: t, children: At(e).map((u, S) => /* @__PURE__ */ M("group", { position: Ct(u, c), children: /* @__PURE__ */ M(
|
|
696
|
+
N,
|
|
697
|
+
{
|
|
698
|
+
ref: S === 0 ? a : void 0,
|
|
699
|
+
base: r,
|
|
700
|
+
seed: l + S,
|
|
701
|
+
...o
|
|
702
|
+
}
|
|
703
|
+
) }, u)) });
|
|
704
|
+
return (n == null ? void 0 : n.type) === "face" ? f : /* @__PURE__ */ M(mt, { faceIndex: t ?? 0, numFaces: i, children: f });
|
|
705
|
+
}
|
|
706
|
+
);
|
|
707
|
+
ot.displayName = "EyeEmitters";
|
|
708
|
+
const se = k(
|
|
709
|
+
({ preset: e, target: t, faceIndex: i, numFaces: r, ...s }, o) => {
|
|
710
|
+
const a = lt(() => kt(e), [e]);
|
|
711
|
+
return t ? /* @__PURE__ */ M(
|
|
712
|
+
ot,
|
|
713
|
+
{
|
|
714
|
+
ref: o,
|
|
715
|
+
target: t,
|
|
716
|
+
faceIndex: i,
|
|
717
|
+
numFaces: r,
|
|
718
|
+
base: a,
|
|
719
|
+
...s
|
|
720
|
+
}
|
|
721
|
+
) : /* @__PURE__ */ M(N, { ref: o, base: a, ...s });
|
|
722
|
+
}
|
|
723
|
+
);
|
|
724
|
+
se.displayName = "ParticleEmitter";
|
|
725
|
+
export {
|
|
726
|
+
I as DEFAULT_PARTICLE_SETTINGS,
|
|
727
|
+
Tt as PARTICLE_BLENDINGS,
|
|
728
|
+
F as PARTICLE_DRAG_SERIES_LIMIT,
|
|
729
|
+
me as PARTICLE_EMITTER_TARGETS,
|
|
730
|
+
Mt as PARTICLE_EYE_CENTRE,
|
|
731
|
+
xt as PARTICLE_EYE_FORWARD,
|
|
732
|
+
Ut as PARTICLE_FRAGMENT_SHADER,
|
|
733
|
+
O as PARTICLE_MAX_COLORS,
|
|
734
|
+
L as PARTICLE_MAX_PARTICLES,
|
|
735
|
+
Ht as PARTICLE_MAX_STEP,
|
|
736
|
+
Dt as PARTICLE_PRESETS,
|
|
737
|
+
_t as PARTICLE_PRESET_KEYS,
|
|
738
|
+
z as PARTICLE_RECORD,
|
|
739
|
+
C as PARTICLE_RECORD_FLOATS,
|
|
740
|
+
wt as PARTICLE_SETTINGS_RANGES,
|
|
741
|
+
Rt as PARTICLE_SHAPES,
|
|
742
|
+
bt as PARTICLE_SPRITES,
|
|
743
|
+
jt as PARTICLE_STATE_GLSL,
|
|
744
|
+
Bt as PARTICLE_VERTEX_SHADER,
|
|
745
|
+
se as ParticleEmitter,
|
|
746
|
+
W as ParticleRing,
|
|
747
|
+
Kt as ParticleSpawner,
|
|
748
|
+
ie as ParticleSystem,
|
|
749
|
+
Zt as applyParticleUniforms,
|
|
750
|
+
Xt as createParticleEmission,
|
|
751
|
+
Z as createParticleRandom,
|
|
752
|
+
Ot as createParticleRecord,
|
|
753
|
+
Jt as createParticleSample,
|
|
754
|
+
rt as createParticleStart,
|
|
755
|
+
Qt as createParticleUniforms,
|
|
756
|
+
Lt as isParticlePreset,
|
|
757
|
+
zt as parseParticleColor,
|
|
758
|
+
it as particleAcceleration,
|
|
759
|
+
It as particleCapacity,
|
|
760
|
+
Vt as particleColorAt,
|
|
761
|
+
Nt as particleDragAcceleration,
|
|
762
|
+
Ft as particleDragDistance,
|
|
763
|
+
Ct as particleEyePosition,
|
|
764
|
+
K as particleOverLife,
|
|
765
|
+
kt as particlePresetBase,
|
|
766
|
+
At as particleTargetSides,
|
|
767
|
+
tt as particleUnitOf,
|
|
768
|
+
q as resolveParticleSettings,
|
|
769
|
+
de as sampleParticle,
|
|
770
|
+
P as sampleParticleCone,
|
|
771
|
+
qt as sampleParticleStart,
|
|
772
|
+
Wt as spawnParticles,
|
|
773
|
+
Yt as stepParticleEmission
|
|
774
|
+
};
|