@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
|
@@ -7,6 +7,7 @@ export declare class BodyTrackingModel extends BaseXRModel {
|
|
|
7
7
|
private landmarker;
|
|
8
8
|
private processingTime;
|
|
9
9
|
private coordinates;
|
|
10
|
+
private visibility;
|
|
10
11
|
private sourceCanvas;
|
|
11
12
|
private readonly downscaler;
|
|
12
13
|
constructor();
|
|
@@ -15,6 +16,7 @@ export declare class BodyTrackingModel extends BaseXRModel {
|
|
|
15
16
|
resume(): void;
|
|
16
17
|
dispose(): void;
|
|
17
18
|
private getLandmarks2D;
|
|
19
|
+
private getVisibility;
|
|
18
20
|
initialize(options?: BodyModelOptions): Promise<void>;
|
|
19
21
|
run({ sourceCanvas, targetFps, analysisScale }: RunModelParams): Promise<void>;
|
|
20
22
|
getModelNode(): XRModelNodeBodyTracking;
|
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
export declare const FACE_OCCLUDER_SCALE_FACTOR = 0.11;
|
|
2
2
|
export declare const FACE_OCCLUDER_Y_ROTATION_OFFSET_SCALE_FACTOR = 0.004;
|
|
3
|
+
/**
|
|
4
|
+
* The face landmarker model on the SDK CDN (`libConfig.assetStorageEndpoint`).
|
|
5
|
+
* Its SRI hash is in `INTEGRITY_MANIFEST`. The live tracker (VIDEO mode) and
|
|
6
|
+
* the still-image detector (IMAGE mode) both load it.
|
|
7
|
+
*/
|
|
8
|
+
export declare const FACE_TRACKING_MODEL_PATH = "/assets/xr/models/face_tracking.task";
|
|
9
|
+
/** The MediaPipe vision WASM folder on the SDK CDN. */
|
|
10
|
+
export declare const VISION_WASM_PATH = "/assets/xr/wasm";
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { NormalizedLandmark } from '@mediapipe/tasks-vision';
|
|
2
1
|
import { XRModelNodeFaceTracking } from '../../types/nodes';
|
|
3
2
|
import { RunModelParams } from '../../types';
|
|
4
3
|
import { PerformanceData } from '../../types/common';
|
|
@@ -6,6 +5,8 @@ import { FaceModelOptions } from '../../types/face';
|
|
|
6
5
|
import { BaseXRModel } from '../Base';
|
|
7
6
|
export declare class FaceTrackingModel extends BaseXRModel {
|
|
8
7
|
private landmarker;
|
|
8
|
+
/** The face model bytes, held while this model is alive (shared with the still-image detector). */
|
|
9
|
+
private modelBytes;
|
|
9
10
|
private processingTime;
|
|
10
11
|
private sourceCanvas;
|
|
11
12
|
private analysisCanvas;
|
|
@@ -16,12 +17,10 @@ export declare class FaceTrackingModel extends BaseXRModel {
|
|
|
16
17
|
private faces;
|
|
17
18
|
private leftCheekScratch;
|
|
18
19
|
private rightCheekScratch;
|
|
19
|
-
private landmarkScratch;
|
|
20
20
|
private rotMatrixScratch;
|
|
21
21
|
private rotQuatScratch;
|
|
22
22
|
private rotEulerScratch;
|
|
23
23
|
constructor();
|
|
24
|
-
private landmarkForSource;
|
|
25
24
|
private extractAndUpdateFaceData;
|
|
26
25
|
private processFaceTracking;
|
|
27
26
|
resume(): void;
|
|
@@ -30,17 +29,10 @@ export declare class FaceTrackingModel extends BaseXRModel {
|
|
|
30
29
|
private getDetectionResults;
|
|
31
30
|
private getRawFaceTrackingData;
|
|
32
31
|
initialize(options?: FaceModelOptions): Promise<void>;
|
|
32
|
+
private releaseModelBytes;
|
|
33
33
|
run({ sourceCanvas, getSource, targetFps, analysisScale, }: RunModelParams): Promise<void>;
|
|
34
34
|
getModelNode(): XRModelNodeFaceTracking;
|
|
35
35
|
getPerformanceData(): Promise<PerformanceData>;
|
|
36
36
|
}
|
|
37
37
|
export declare const resolveFaceYawRotation: (yawDegrees: number) => number;
|
|
38
38
|
export declare const resolveFaceAnalysisDimension: (numFaces: number) => 1024 | 512;
|
|
39
|
-
/**
|
|
40
|
-
* Reference (allocating) source-aware landmark normalization. Non-webcam
|
|
41
|
-
* sources (image/video) read mirrored from MediaPipe, so x is flipped to
|
|
42
|
-
* display space. The per-frame extraction path uses an in-place scratch
|
|
43
|
-
* variant (`landmarkForSource`) to avoid allocating; this pure form exists
|
|
44
|
-
* for callers/tests that need a plain array transform.
|
|
45
|
-
*/
|
|
46
|
-
export declare const normalizeFaceLandmarksForSource: (landmarks: NormalizedLandmark[], sourceKind?: "webcam" | "image" | "video") => NormalizedLandmark[];
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
import { Euler, Vector3 } from 'three';
|
|
2
|
-
/**
|
|
3
|
-
|
|
1
|
+
import { Euler, Matrix4, Quaternion, Vector3 } from 'three';
|
|
2
|
+
/**
|
|
3
|
+
* Writes the SDK convention: up and the person's own left positive. `euler`
|
|
4
|
+
* is the x-mirrored, inverted pose, whose `-y` / `z` read toward the SCREEN's
|
|
5
|
+
* left; that is the person's left on the mirrored webcam (`feedMirrored`,
|
|
6
|
+
* the default), and their right on an unmirrored feed, where yaw and roll are
|
|
7
|
+
* negated. Negating yaw and roll of an XYZ Euler is exactly the x-mirror of
|
|
8
|
+
* the rotation (pitch commutes with it), so the reading is the head as seen in
|
|
9
|
+
* a mirror on every feed (#298).
|
|
10
|
+
*/
|
|
11
|
+
export declare const writeFaceRotation: (euler: Euler, target: Vector3, feedMirrored?: boolean) => Vector3;
|
|
12
|
+
/**
|
|
13
|
+
* Writes the head's orientation from MediaPipe's facial transformation matrix:
|
|
14
|
+
* the rotation part, as-is. The matrix maps the canonical face into the camera
|
|
15
|
+
* space of the analyzed frame — the feed as displayed — whose axes are the
|
|
16
|
+
* three.js world axes, so no mirror or sign flip applies (#169).
|
|
17
|
+
*/
|
|
18
|
+
export declare const writeFaceQuaternion: (matrix: Matrix4, target: Quaternion) => Quaternion;
|
|
@@ -2,6 +2,20 @@ import { XRModelNodeHandTracking } from '../../types/nodes';
|
|
|
2
2
|
import { RunModelParams } from '../../types';
|
|
3
3
|
import { PerformanceData } from '../../types/common';
|
|
4
4
|
import { BaseXRModel } from '../Base';
|
|
5
|
+
/**
|
|
6
|
+
* The hand landmarker's thresholds. In video mode MediaPipe keeps following a
|
|
7
|
+
* hand's last box while the landmark model's presence score stays over
|
|
8
|
+
* `minHandPresenceConfidence`; at the 0.5 default a face under a hand's last
|
|
9
|
+
* position kept scoring as a "ghost" hand (a `HandCutout` then cut a hole in
|
|
10
|
+
* the face's makeup or liquify there). 0.65 is the strictest that still keeps
|
|
11
|
+
* a real hand half hidden behind the other (both hands over the mouth, which
|
|
12
|
+
* score between 0.65 and 0.7); detection and tracking keep MediaPipe's 0.5.
|
|
13
|
+
*/
|
|
14
|
+
export declare const HAND_TRACKING_CONFIDENCE: Readonly<{
|
|
15
|
+
minHandDetectionConfidence: 0.5;
|
|
16
|
+
minHandPresenceConfidence: 0.65;
|
|
17
|
+
minTrackingConfidence: 0.5;
|
|
18
|
+
}>;
|
|
5
19
|
export declare class HandTrackingModel extends BaseXRModel {
|
|
6
20
|
private landmarker;
|
|
7
21
|
private processingTime;
|
|
@@ -9,7 +23,9 @@ export declare class HandTrackingModel extends BaseXRModel {
|
|
|
9
23
|
private coordinates;
|
|
10
24
|
private gesture;
|
|
11
25
|
private handedness;
|
|
26
|
+
private poses;
|
|
12
27
|
private sourceCanvas;
|
|
28
|
+
private getSource;
|
|
13
29
|
private readonly downscaler;
|
|
14
30
|
constructor();
|
|
15
31
|
private getHandData;
|
|
@@ -17,7 +33,7 @@ export declare class HandTrackingModel extends BaseXRModel {
|
|
|
17
33
|
resume(): void;
|
|
18
34
|
dispose(): void;
|
|
19
35
|
initialize(): Promise<void>;
|
|
20
|
-
run({ sourceCanvas, targetFps, analysisScale }: RunModelParams): Promise<void>;
|
|
36
|
+
run({ sourceCanvas, getSource, targetFps, analysisScale, }: RunModelParams): Promise<void>;
|
|
21
37
|
getModelNode(): XRModelNodeHandTracking;
|
|
22
38
|
getPerformanceData(): Promise<PerformanceData>;
|
|
23
39
|
}
|
|
@@ -19,6 +19,8 @@ export declare class BackgroundSegmentationModel extends BaseXRModel {
|
|
|
19
19
|
private isProcessing;
|
|
20
20
|
private latestMask;
|
|
21
21
|
private rawCache;
|
|
22
|
+
/** When the frame behind `latestMask` was segmented (`performance.now()`). */
|
|
23
|
+
private latestMaskTimeMs;
|
|
22
24
|
private quality;
|
|
23
25
|
constructor();
|
|
24
26
|
private getQualityScaleFactor;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The model behind a model node. `getModelNode()` builds a new node object on
|
|
3
|
+
* each call (each `useXRModelNode` consumer holds its own), so per-model
|
|
4
|
+
* bookkeeping (a warning shown once) keys on this instead of the node. Not
|
|
5
|
+
* enumerable; absent on custom nodes.
|
|
6
|
+
*/
|
|
7
|
+
export declare const MODEL_NODE_SOURCE: unique symbol;
|
|
8
|
+
/** The model that made `node` (`MODEL_NODE_SOURCE`), else the node itself. */
|
|
9
|
+
export declare const modelNodeSource: (node: object) => object;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* When particles are born (pure): a continuous rate, with the fraction of a
|
|
3
|
+
* particle left at the end of a frame carried to the next, and each birth
|
|
4
|
+
* placed at its own moment inside the frame, so a moving emitter leaves
|
|
5
|
+
* evenly spaced particles at any frame rate.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* The longest stretch emitted in one frame (s): after a stall (a hidden tab,
|
|
9
|
+
* a slow load) emission resumes at its rate instead of firing a burst.
|
|
10
|
+
*/
|
|
11
|
+
export declare const PARTICLE_MAX_STEP = 0.25;
|
|
12
|
+
export type ParticleEmission = {
|
|
13
|
+
/** The fraction of the next particle already due (0..1). */
|
|
14
|
+
carry: number;
|
|
15
|
+
};
|
|
16
|
+
export declare const createParticleEmission: () => ParticleEmission;
|
|
17
|
+
/**
|
|
18
|
+
* The particles due over a frame of `dt` seconds at `rate` per second. Each
|
|
19
|
+
* birth goes into `out` as its moment in the frame (0 = the frame's start,
|
|
20
|
+
* 1 = now), oldest first; `out.length` is the count. Only the last
|
|
21
|
+
* `PARTICLE_MAX_STEP` seconds of a long frame emit, and at most `max`
|
|
22
|
+
* particles (the newest) per frame.
|
|
23
|
+
*/
|
|
24
|
+
export declare const stepParticleEmission: (emission: ParticleEmission, rate: number, dt: number, out?: number[], max?: number) => number[];
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where an eye emitter sits (pure): in the canonical head frame
|
|
3
|
+
* (`CanonicalHeadFrame`: centimetres, +Y up, +Z out of the face, +X
|
|
4
|
+
* MediaPipe's left), at the centre of the eye opening, a little in front of
|
|
5
|
+
* it, facing +Z (straight out of the face).
|
|
6
|
+
*/
|
|
7
|
+
/** What `<ParticleEmitter target>` emits from: one eye (the person's own side) or both. */
|
|
8
|
+
export declare const PARTICLE_EMITTER_TARGETS: readonly ["leftEye", "rightEye", "eyes"];
|
|
9
|
+
export type ParticleEmitterTarget = (typeof PARTICLE_EMITTER_TARGETS)[number];
|
|
10
|
+
/** How far in front of the eye opening the emitter sits (cm), clear of the eye's own surface. */
|
|
11
|
+
export declare const PARTICLE_EYE_FORWARD = 0.4;
|
|
12
|
+
/**
|
|
13
|
+
* The eye's centre (cm, canonical head frame) on MediaPipe's left (+X); the
|
|
14
|
+
* other eye is its mirror. The two contours averaged, so both eyes match.
|
|
15
|
+
*/
|
|
16
|
+
export declare const PARTICLE_EYE_CENTRE: readonly [number, number, number];
|
|
17
|
+
/**
|
|
18
|
+
* The person's own `side` eye in the canonical head frame on this feed:
|
|
19
|
+
* their left eye is MediaPipe's left (+X) on an unmirrored feed and
|
|
20
|
+
* MediaPipe's right (−X) on the mirrored webcam.
|
|
21
|
+
*/
|
|
22
|
+
export declare const particleEyePosition: (side: "left" | "right", mirrored: boolean) => [number, number, number];
|
|
23
|
+
/** The eyes a target emits from (the person's own sides). */
|
|
24
|
+
export declare const particleTargetSides: (target: ParticleEmitterTarget) => ("left" | "right")[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Uniforms and functions shared by the vertex shader and the self-test (GLSL ES 3.00 and 1.00). */
|
|
2
|
+
export declare const PARTICLE_STATE_GLSL: string;
|
|
3
|
+
/**
|
|
4
|
+
* One quad per particle (corners ±1 in `position`), in view space: the
|
|
5
|
+
* model matrix is ignored (particles are in world space). A streak runs from
|
|
6
|
+
* where the particle was `uStretch` seconds ago (at most its age) to where it
|
|
7
|
+
* is. A dead particle collapses outside the clip volume.
|
|
8
|
+
*/
|
|
9
|
+
export declare const PARTICLE_VERTEX_SHADER: string;
|
|
10
|
+
/**
|
|
11
|
+
* Straight alpha: the glow's soft disc, or the streak's soft line
|
|
12
|
+
* brightening toward its head (a soft cross-section, both ends fading).
|
|
13
|
+
*/
|
|
14
|
+
export declare const PARTICLE_FRAGMENT_SHADER = "\nvarying vec2 vCorner;\nvarying vec4 vColor;\nvarying float vStreak;\nvoid main() {\n float shape;\n if (vStreak > 0.5) {\n float across = exp(-5.0 * vCorner.x * vCorner.x);\n float along = clamp(vCorner.y * 0.5 + 0.5, 0.0, 1.0);\n shape = across * along * along * (1.0 - smoothstep(0.9, 1.0, along));\n } else {\n float r2 = dot(vCorner, vCorner);\n shape = r2 < 1.0 ? (1.0 - r2) * (1.0 - r2) : 0.0;\n }\n float alpha = shape * vColor.a;\n if (alpha < 0.002) discard;\n gl_FragColor = vec4(vColor.rgb, alpha);\n #include <colorspace_fragment>\n}\n";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { DEFAULT_PARTICLE_SETTINGS, PARTICLE_BLENDINGS, PARTICLE_MAX_COLORS, PARTICLE_MAX_PARTICLES, PARTICLE_SETTINGS_RANGES, PARTICLE_SHAPES, PARTICLE_SPRITES, parseParticleColor, particleCapacity, resolveParticleSettings, type ParticleBlending, type ParticleColor, type ParticleOverLife, type ParticleSettings, type ParticleShape, type ParticleSprite, type ResolvedParticleSettings, } from './settings';
|
|
2
|
+
export { createParticleRandom, createParticleStart, sampleParticleCone, sampleParticleStart, type ParticleRandom, type ParticleStart, } from './shapes';
|
|
3
|
+
export { PARTICLE_RECORD, PARTICLE_RECORD_FLOATS, ParticleRing, createParticleRecord, type ParticleRecord, type ParticleSlotRange, } from './ring';
|
|
4
|
+
export { PARTICLE_DRAG_SERIES_LIMIT, createParticleSample, particleAcceleration, particleColorAt, particleDragAcceleration, particleDragDistance, particleOverLife, sampleParticle, type ParticleSample, } from './motion';
|
|
5
|
+
export { PARTICLE_MAX_STEP, createParticleEmission, stepParticleEmission, type ParticleEmission, } from './emission';
|
|
6
|
+
export { PARTICLE_PRESETS, PARTICLE_PRESET_KEYS, isParticlePreset, particlePresetBase, type ParticlePreset, } from './presets';
|
|
7
|
+
export { PARTICLE_EMITTER_TARGETS, PARTICLE_EYE_CENTRE, PARTICLE_EYE_FORWARD, particleEyePosition, particleTargetSides, type ParticleEmitterTarget, } from './eyes';
|
|
8
|
+
export { PARTICLE_FRAGMENT_SHADER, PARTICLE_STATE_GLSL, PARTICLE_VERTEX_SHADER } from './glsl';
|
|
9
|
+
export { ParticleSystem, applyParticleUniforms, createParticleUniforms, type ParticleUniforms, } from './system';
|
|
10
|
+
export { ParticleSpawner, particleUnitOf, spawnParticles, type ParticleSpawnFrame, } from './spawner';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ResolvedParticleSettings } from './settings';
|
|
2
|
+
/**
|
|
3
|
+
* Particle motion and looks over life (pure): the closed forms the vertex
|
|
4
|
+
* shader evaluates, so a particle's state at any time follows from its spawn
|
|
5
|
+
* record alone. This is the CPU reference the shader is tested against.
|
|
6
|
+
*
|
|
7
|
+
* With drag k and a constant acceleration a (gravity and wind):
|
|
8
|
+
* v(t) = v0·e^(−kt) + a·D(t), D(t) = (1 − e^(−kt)) / k
|
|
9
|
+
* x(t) = x0 + v0·D(t) + a·A(t), A(t) = (t − D(t)) / k
|
|
10
|
+
* and with no drag D = t, A = t²/2 (a short series near kt = 0 keeps both
|
|
11
|
+
* accurate in float32).
|
|
12
|
+
*/
|
|
13
|
+
/** Below this k·t the series replaces the exponential forms. */
|
|
14
|
+
export declare const PARTICLE_DRAG_SERIES_LIMIT = 0.01;
|
|
15
|
+
/** How far a unit start velocity carries in `t` seconds under drag `k`: D(t). */
|
|
16
|
+
export declare const particleDragDistance: (k: number, t: number) => number;
|
|
17
|
+
/** How far a unit constant acceleration carries in `t` seconds under drag `k`: A(t). */
|
|
18
|
+
export declare const particleDragAcceleration: (k: number, t: number) => number;
|
|
19
|
+
/** The world acceleration (gravity along −Y plus wind), in emitter units / s². */
|
|
20
|
+
export declare const particleAcceleration: (settings: Pick<ResolvedParticleSettings, "gravity" | "wind">, out?: [number, number, number]) => [number, number, number];
|
|
21
|
+
/** Linear between birth (0) and death (1). */
|
|
22
|
+
export declare const particleOverLife: (range: readonly [number, number], life: number) => number;
|
|
23
|
+
/** The colour at `life` (0..1): the colours spread evenly from birth to death, mixed between neighbours. */
|
|
24
|
+
export declare const particleColorAt: (settings: Pick<ResolvedParticleSettings, "colors" | "colorCount">, life: number, out?: [number, number, number]) => [number, number, number];
|
|
25
|
+
/** One particle at one time. */
|
|
26
|
+
export type ParticleSample = {
|
|
27
|
+
/** Born and not yet past its lifetime. */
|
|
28
|
+
alive: boolean;
|
|
29
|
+
/** Seconds since birth. */
|
|
30
|
+
age: number;
|
|
31
|
+
/** 0 at birth … 1 at death. */
|
|
32
|
+
life: number;
|
|
33
|
+
position: [number, number, number];
|
|
34
|
+
velocity: [number, number, number];
|
|
35
|
+
/** World units. */
|
|
36
|
+
size: number;
|
|
37
|
+
opacity: number;
|
|
38
|
+
color: [number, number, number];
|
|
39
|
+
};
|
|
40
|
+
export declare const createParticleSample: () => ParticleSample;
|
|
41
|
+
/** Slot `slot` of a ring's records at `time` (s), as the shader computes it. */
|
|
42
|
+
export declare const sampleParticle: (data: Float32Array, slot: number, time: number, settings: ResolvedParticleSettings, out?: ParticleSample) => ParticleSample;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ParticleSettings } from './settings';
|
|
2
|
+
/**
|
|
3
|
+
* Built-in looks (pure). A preset is a base the emitter's own settings go on
|
|
4
|
+
* top of: `<ParticleEmitter preset="laser" speed={400} />` is the laser with
|
|
5
|
+
* faster beams. Values are in centimetres, as inside a head frame.
|
|
6
|
+
*/
|
|
7
|
+
export declare const PARTICLE_PRESET_KEYS: readonly ["laser"];
|
|
8
|
+
export type ParticlePreset = (typeof PARTICLE_PRESET_KEYS)[number];
|
|
9
|
+
export declare const PARTICLE_PRESETS: Readonly<Record<ParticlePreset, Partial<ParticleSettings>>>;
|
|
10
|
+
export declare const isParticlePreset: (value: unknown) => value is ParticlePreset;
|
|
11
|
+
/** The settings an emitter starts from: the preset over the defaults (the defaults alone for none or an unknown name). */
|
|
12
|
+
export declare const particlePresetBase: (preset?: string | null) => ParticleSettings;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The particles' spawn records (pure): a fixed ring of slots, each written
|
|
3
|
+
* once when a particle is emitted and never touched again. The shader works
|
|
4
|
+
* out everything else from the record and the time, so only the slots
|
|
5
|
+
* written since the last upload go to the GPU.
|
|
6
|
+
*/
|
|
7
|
+
/** Floats per particle (three vec4s). */
|
|
8
|
+
export declare const PARTICLE_RECORD_FLOATS = 12;
|
|
9
|
+
/**
|
|
10
|
+
* Each record's layout (float offsets): start position (world) and birth
|
|
11
|
+
* time (s); start velocity (world units / s) and lifetime (s); size scale
|
|
12
|
+
* (world units per emitter unit, times the size jitter), unit (world units
|
|
13
|
+
* per emitter unit, for gravity and wind) and a random seed (0..1).
|
|
14
|
+
*/
|
|
15
|
+
export declare const PARTICLE_RECORD: Readonly<{
|
|
16
|
+
position: 0;
|
|
17
|
+
birth: 3;
|
|
18
|
+
velocity: 4;
|
|
19
|
+
lifetime: 7;
|
|
20
|
+
sizeScale: 8;
|
|
21
|
+
unit: 9;
|
|
22
|
+
seed: 10;
|
|
23
|
+
}>;
|
|
24
|
+
/** One particle as emitted (reuse one object: `push` copies it). */
|
|
25
|
+
export type ParticleRecord = {
|
|
26
|
+
position: [number, number, number];
|
|
27
|
+
velocity: [number, number, number];
|
|
28
|
+
birth: number;
|
|
29
|
+
lifetime: number;
|
|
30
|
+
sizeScale: number;
|
|
31
|
+
unit: number;
|
|
32
|
+
seed: number;
|
|
33
|
+
};
|
|
34
|
+
export declare const createParticleRecord: () => ParticleRecord;
|
|
35
|
+
/** A range of slots: `[first, count]`. */
|
|
36
|
+
export type ParticleSlotRange = [number, number];
|
|
37
|
+
export declare class ParticleRing {
|
|
38
|
+
readonly capacity: number;
|
|
39
|
+
/** `capacity × PARTICLE_RECORD_FLOATS` floats; a lifetime of 0 is an empty slot. */
|
|
40
|
+
readonly data: Float32Array;
|
|
41
|
+
private head;
|
|
42
|
+
private dirtyFirst;
|
|
43
|
+
private dirtyCount;
|
|
44
|
+
constructor(capacity: number);
|
|
45
|
+
/** The slot the next particle goes in (the oldest). */
|
|
46
|
+
get next(): number;
|
|
47
|
+
/** Writes a particle over the oldest slot; returns the slot. */
|
|
48
|
+
push(record: ParticleRecord): number;
|
|
49
|
+
/**
|
|
50
|
+
* The slots written since the last call, as at most two ranges (one when
|
|
51
|
+
* they do not wrap, the whole ring after a full lap), then forgets them.
|
|
52
|
+
*/
|
|
53
|
+
takeDirty(out?: ParticleSlotRange[]): ParticleSlotRange[];
|
|
54
|
+
/** Empties every slot (and marks them all for upload). */
|
|
55
|
+
clear(): void;
|
|
56
|
+
/** Particles alive at `time` (s): born and not yet past their lifetime. */
|
|
57
|
+
aliveAt(time: number): number;
|
|
58
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as THREE from "three";
|
|
2
|
+
/**
|
|
3
|
+
* A GPU self-test of the particles on this device's WebGL2:
|
|
4
|
+
*
|
|
5
|
+
* 1. **compile**: the particle and parity shaders link, with no shader or GL error.
|
|
6
|
+
* 2. **parity**: `PARTICLE_STATE_GLSL` matches `sampleParticle` (the CPU
|
|
7
|
+
* reference) for particles from a moving, turning, scaled emitter, at
|
|
8
|
+
* several times, under no forces, under drag, gravity and wind, and with
|
|
9
|
+
* colour ramps (float targets; skipped where the GPU cannot render them).
|
|
10
|
+
* 3. **same frame**: particles emitted in the scene's before-render hook
|
|
11
|
+
* draw in that very render, along the emitter's path, and nowhere else.
|
|
12
|
+
* 4. **streak**: a streak lies along its motion and never reaches behind
|
|
13
|
+
* its emitter (its tail is at most its age).
|
|
14
|
+
* 5. **dead**: past their lifetime, particles draw nothing.
|
|
15
|
+
*
|
|
16
|
+
* The headless smoke run drives it (`example/smoke/particles.spec.ts`); open
|
|
17
|
+
* `/smoke/particles.html` on the dev server to run it on a device.
|
|
18
|
+
*/
|
|
19
|
+
export type ParticleSelfTestCheck = {
|
|
20
|
+
name: string;
|
|
21
|
+
ok: boolean;
|
|
22
|
+
detail: string;
|
|
23
|
+
};
|
|
24
|
+
export type ParticleSelfTestResult = {
|
|
25
|
+
ok: boolean;
|
|
26
|
+
error: string | null;
|
|
27
|
+
checks: ParticleSelfTestCheck[];
|
|
28
|
+
};
|
|
29
|
+
export declare const PARTICLE_SELF_TEST: Readonly<{
|
|
30
|
+
parityParticles: 256;
|
|
31
|
+
parityTimes: readonly number[];
|
|
32
|
+
/** Position and velocity: |GPU − CPU| ≤ abs + rel × |CPU|. */
|
|
33
|
+
motionTolerance: {
|
|
34
|
+
abs: number;
|
|
35
|
+
rel: number;
|
|
36
|
+
};
|
|
37
|
+
/** Size, opacity, colour and life. */
|
|
38
|
+
looksTolerance: 0.0002;
|
|
39
|
+
/** Birth and death within this of the time are not compared (float32 rounding). */
|
|
40
|
+
boundaryMargin: 0.001;
|
|
41
|
+
/** The draw checks' target (px, square) and view (world units across). */
|
|
42
|
+
drawSize: 128;
|
|
43
|
+
drawView: 32;
|
|
44
|
+
/** A pixel is lit above this (8-bit sum of RGB). */
|
|
45
|
+
litLevel: 24;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* Runs every check on `options.renderer` (default: an offscreen renderer it
|
|
49
|
+
* disposes). Never rejects: failures and thrown errors are in the result.
|
|
50
|
+
*/
|
|
51
|
+
export declare const runParticleSelfTest: (options?: {
|
|
52
|
+
renderer?: THREE.WebGLRenderer;
|
|
53
|
+
}) => Promise<ParticleSelfTestResult>;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Particle emitter settings (pure): the fields, their defaults and ranges,
|
|
3
|
+
* and `resolveParticleSettings`, which turns any partial (from an app or an
|
|
4
|
+
* agent) into a complete, clamped set the emitter and the shader read.
|
|
5
|
+
*
|
|
6
|
+
* Lengths, speeds and forces are in the emitter's own units: its world
|
|
7
|
+
* scale when a particle is emitted converts them (inside a head frame they
|
|
8
|
+
* are centimetres). Gravity pulls along the world's −Y, wind pushes along
|
|
9
|
+
* the world's axes; the shape and the direction particles leave in are in
|
|
10
|
+
* the emitter's axes (+Z forward).
|
|
11
|
+
*/
|
|
12
|
+
/** Where particles start: one point, a sphere, a box, or the base of a cone. */
|
|
13
|
+
export declare const PARTICLE_SHAPES: readonly ["point", "sphere", "box", "cone"];
|
|
14
|
+
export type ParticleShape = (typeof PARTICLE_SHAPES)[number];
|
|
15
|
+
/** The built-in particle shapes: a soft round glow, or a streak along the motion. */
|
|
16
|
+
export declare const PARTICLE_SPRITES: readonly ["glow", "streak"];
|
|
17
|
+
export type ParticleSprite = (typeof PARTICLE_SPRITES)[number];
|
|
18
|
+
/** `additive` brightens what is behind (light, lasers); `normal` covers it. */
|
|
19
|
+
export declare const PARTICLE_BLENDINGS: readonly ["additive", "normal"];
|
|
20
|
+
export type ParticleBlending = (typeof PARTICLE_BLENDINGS)[number];
|
|
21
|
+
/** A CSS colour (`"#ff3b30"`, `"red"`, `"rgb(255 0 0)"`) or a hex number (`0xff3b30`). */
|
|
22
|
+
export type ParticleColor = string | number;
|
|
23
|
+
/** One value for the whole life, or `[start, end]` (linear over life). */
|
|
24
|
+
export type ParticleOverLife = number | readonly [number, number];
|
|
25
|
+
/** The most colours over life. */
|
|
26
|
+
export declare const PARTICLE_MAX_COLORS = 4;
|
|
27
|
+
/** The most particles one emitter keeps alive. */
|
|
28
|
+
export declare const PARTICLE_MAX_PARTICLES = 65536;
|
|
29
|
+
export type ParticleSettings = {
|
|
30
|
+
/** Particles per second. */
|
|
31
|
+
rate: number;
|
|
32
|
+
/** Seconds each particle lives. */
|
|
33
|
+
lifetime: number;
|
|
34
|
+
/** 0..1: each particle lives `lifetime × (1 − lifetimeJitter × random)`. */
|
|
35
|
+
lifetimeJitter: number;
|
|
36
|
+
/** Where particles start (the emitter's axes and units). */
|
|
37
|
+
shape: ParticleShape;
|
|
38
|
+
/** `sphere`: its radius. `cone`: its base radius (0 = from one point). */
|
|
39
|
+
radius: number;
|
|
40
|
+
/** `box`: its full size along x, y, z. */
|
|
41
|
+
boxSize: readonly [number, number, number];
|
|
42
|
+
/**
|
|
43
|
+
* Degrees around the emitter's +Z: `point` and `box` send particles within
|
|
44
|
+
* this angle, `cone` is a cone of this half angle (180 = every direction).
|
|
45
|
+
* `sphere` sends them outward.
|
|
46
|
+
*/
|
|
47
|
+
angle: number;
|
|
48
|
+
/** `sphere` and `box`: start on the surface only. */
|
|
49
|
+
surface: boolean;
|
|
50
|
+
/** Start speed, units per second. */
|
|
51
|
+
speed: number;
|
|
52
|
+
/** 0..1: each particle starts at `speed × (1 − speedJitter × random)`. */
|
|
53
|
+
speedJitter: number;
|
|
54
|
+
/** Pull along the world's −Y, units per second² (negative floats up). */
|
|
55
|
+
gravity: number;
|
|
56
|
+
/** Constant push along the world's x, y, z, units per second². */
|
|
57
|
+
wind: readonly [number, number, number];
|
|
58
|
+
/** How fast speed decays, per second (0: none). With gravity or wind it sets the top speed. */
|
|
59
|
+
drag: number;
|
|
60
|
+
/** Size over life, units (the glow's width, the streak's thickness). */
|
|
61
|
+
size: ParticleOverLife;
|
|
62
|
+
/** 0..1: each particle is `size × (1 − sizeJitter × random)`. */
|
|
63
|
+
sizeJitter: number;
|
|
64
|
+
/** Colour over life: one colour, or up to 4 spread evenly from birth to death. */
|
|
65
|
+
color: ParticleColor | readonly ParticleColor[];
|
|
66
|
+
/** Opacity over life, 0..1. */
|
|
67
|
+
opacity: ParticleOverLife;
|
|
68
|
+
/** The built-in shape drawn. */
|
|
69
|
+
sprite: ParticleSprite;
|
|
70
|
+
/** `streak`: its length, as the seconds of motion it covers. */
|
|
71
|
+
stretch: number;
|
|
72
|
+
blending: ParticleBlending;
|
|
73
|
+
/** The most particles alive at once; 0 (default) sizes it from `rate × lifetime`. */
|
|
74
|
+
maxParticles: number;
|
|
75
|
+
/** The random sequence's seed: the same seed and inputs give the same particles. */
|
|
76
|
+
seed: number;
|
|
77
|
+
};
|
|
78
|
+
/** A generic emitter: a soft white spray along +Z, sized for centimetres. */
|
|
79
|
+
export declare const DEFAULT_PARTICLE_SETTINGS: ParticleSettings;
|
|
80
|
+
/** Valid ranges of the numeric fields (each component of `boxSize`, `wind`, `size`, `opacity`). */
|
|
81
|
+
export declare const PARTICLE_SETTINGS_RANGES: {
|
|
82
|
+
readonly rate: readonly [0, 10000];
|
|
83
|
+
readonly lifetime: readonly [0.02, 30];
|
|
84
|
+
readonly lifetimeJitter: readonly [0, 1];
|
|
85
|
+
readonly radius: readonly [0, 10000];
|
|
86
|
+
readonly boxSize: readonly [0, 10000];
|
|
87
|
+
readonly angle: readonly [0, 180];
|
|
88
|
+
readonly speed: readonly [0, 100000];
|
|
89
|
+
readonly speedJitter: readonly [0, 1];
|
|
90
|
+
readonly gravity: readonly [-100000, 100000];
|
|
91
|
+
readonly wind: readonly [-100000, 100000];
|
|
92
|
+
readonly drag: readonly [0, 100];
|
|
93
|
+
readonly size: readonly [0, 10000];
|
|
94
|
+
readonly sizeJitter: readonly [0, 1];
|
|
95
|
+
readonly opacity: readonly [0, 1];
|
|
96
|
+
readonly stretch: readonly [0, 1];
|
|
97
|
+
readonly maxParticles: readonly [0, 65536];
|
|
98
|
+
readonly seed: readonly [-1000000000, 1000000000];
|
|
99
|
+
};
|
|
100
|
+
/** Everything the emitter and the shader read, complete and clamped. */
|
|
101
|
+
export type ResolvedParticleSettings = Omit<ParticleSettings, "boxSize" | "wind" | "size" | "color" | "opacity"> & {
|
|
102
|
+
boxSize: [number, number, number];
|
|
103
|
+
wind: [number, number, number];
|
|
104
|
+
/** Size at birth and at death. */
|
|
105
|
+
size: [number, number];
|
|
106
|
+
/** Opacity at birth and at death. */
|
|
107
|
+
opacity: [number, number];
|
|
108
|
+
/** The colours over life, linear RGB, `colorCount` of them (1..4), 3 floats each. */
|
|
109
|
+
colors: Float32Array;
|
|
110
|
+
colorCount: number;
|
|
111
|
+
/** Particles kept (the ring's size): `maxParticles`, or enough for `rate × lifetime`. */
|
|
112
|
+
capacity: number;
|
|
113
|
+
};
|
|
114
|
+
/** A colour as linear RGB, or null when it cannot be read. */
|
|
115
|
+
export declare const parseParticleColor: (value: unknown) => [number, number, number] | null;
|
|
116
|
+
/**
|
|
117
|
+
* Particles to keep for `rate × lifetime` alive at once, with room for a
|
|
118
|
+
* slow frame's spawns: 10% more plus a tenth of a second's worth.
|
|
119
|
+
*/
|
|
120
|
+
export declare const particleCapacity: (rate: number, lifetime: number, maxParticles?: number) => number;
|
|
121
|
+
/**
|
|
122
|
+
* Any partial settings → complete, clamped settings. Missing, non-finite or
|
|
123
|
+
* unknown values fall back to `base` (default `DEFAULT_PARTICLE_SETTINGS`);
|
|
124
|
+
* numbers clamp to `PARTICLE_SETTINGS_RANGES`; colours that cannot be read
|
|
125
|
+
* fall back as a whole; more than 4 colours keep the first 4.
|
|
126
|
+
*/
|
|
127
|
+
export declare const resolveParticleSettings: (input?: Partial<ParticleSettings>, base?: ParticleSettings) => ResolvedParticleSettings;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ResolvedParticleSettings } from './settings';
|
|
2
|
+
/**
|
|
3
|
+
* Where a particle starts and which way it leaves (pure), in the emitter's
|
|
4
|
+
* own axes and units: +Z is forward. The emitter's world transform is
|
|
5
|
+
* applied when the particle is emitted (`spawnParticles`).
|
|
6
|
+
*/
|
|
7
|
+
/** A seeded random sequence in [0, 1) (mulberry32): the same seed gives the same numbers. */
|
|
8
|
+
export type ParticleRandom = () => number;
|
|
9
|
+
export declare const createParticleRandom: (seed: number) => ParticleRandom;
|
|
10
|
+
/** A start point and a unit direction, written in place. */
|
|
11
|
+
export type ParticleStart = {
|
|
12
|
+
position: [number, number, number];
|
|
13
|
+
direction: [number, number, number];
|
|
14
|
+
};
|
|
15
|
+
export declare const createParticleStart: () => ParticleStart;
|
|
16
|
+
/** A direction within `angle` degrees of +Z, uniform over that cap of the sphere. */
|
|
17
|
+
export declare const sampleParticleCone: (angle: number, random: ParticleRandom, out: [number, number, number]) => [number, number, number];
|
|
18
|
+
/**
|
|
19
|
+
* One particle's start (the emitter's axes and units):
|
|
20
|
+
* - `point`: at the origin, leaving within `angle` of +Z;
|
|
21
|
+
* - `sphere`: inside the sphere of `radius` (on it with `surface`), leaving
|
|
22
|
+
* outward from the centre;
|
|
23
|
+
* - `box`: inside the box of `boxSize` centred on the origin (on its faces
|
|
24
|
+
* with `surface`), leaving within `angle` of +Z;
|
|
25
|
+
* - `cone`: on the disc of `radius` at the origin, facing +Z, leaving along
|
|
26
|
+
* the cone of half angle `angle` (tilted outward by `angle × distance /
|
|
27
|
+
* radius`; with radius 0, anywhere within `angle`).
|
|
28
|
+
*/
|
|
29
|
+
export declare const sampleParticleStart: (settings: Pick<ResolvedParticleSettings, "shape" | "radius" | "boxSize" | "angle" | "surface">, random: ParticleRandom, out?: ParticleStart) => ParticleStart;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { ParticleRing } from './ring';
|
|
2
|
+
import { ResolvedParticleSettings } from './settings';
|
|
3
|
+
import { ParticleRandom } from './shapes';
|
|
4
|
+
import * as THREE from "three";
|
|
5
|
+
/**
|
|
6
|
+
* Emitting particles into the ring (pure, no GPU): each frame, the
|
|
7
|
+
* particles due are placed along the emitter's path from its last world
|
|
8
|
+
* transform to this one, at their own moments in the frame, and written as
|
|
9
|
+
* spawn records in world space. They keep their own path from then on.
|
|
10
|
+
*/
|
|
11
|
+
/** The emitter's mean world scale (world units per emitter unit). */
|
|
12
|
+
export declare const particleUnitOf: (matrix: THREE.Matrix4) => number;
|
|
13
|
+
/** One frame of the emitter's motion: its world transform and the clock (s) at the last frame and now. */
|
|
14
|
+
export type ParticleSpawnFrame = {
|
|
15
|
+
from: THREE.Matrix4;
|
|
16
|
+
to: THREE.Matrix4;
|
|
17
|
+
timeFrom: number;
|
|
18
|
+
timeTo: number;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Writes one particle per birth moment (`births`, 0..1 through the frame)
|
|
22
|
+
* into `ring`. Settings are in the emitter's units: its world scale at the
|
|
23
|
+
* birth converts speed and size and is kept for gravity and wind. The random
|
|
24
|
+
* sequence advances by the same count per particle whatever the settings.
|
|
25
|
+
*/
|
|
26
|
+
export declare const spawnParticles: (ring: ParticleRing, settings: ResolvedParticleSettings, frame: ParticleSpawnFrame, births: readonly number[], random: ParticleRandom) => void;
|
|
27
|
+
/**
|
|
28
|
+
* One emitter's particles on the CPU side: its settings, its ring of spawn
|
|
29
|
+
* records, its rate and random sequence, and its last pose. `update` once a
|
|
30
|
+
* frame with the emitter's world matrix and the clock; upload the ring's
|
|
31
|
+
* dirty slots after it.
|
|
32
|
+
*/
|
|
33
|
+
export declare class ParticleSpawner {
|
|
34
|
+
private ringValue;
|
|
35
|
+
private settingsValue;
|
|
36
|
+
private random;
|
|
37
|
+
private readonly emission;
|
|
38
|
+
private readonly births;
|
|
39
|
+
private readonly last;
|
|
40
|
+
private lastTime;
|
|
41
|
+
private readonly frame;
|
|
42
|
+
constructor(settings: ResolvedParticleSettings);
|
|
43
|
+
get ring(): ParticleRing;
|
|
44
|
+
get settings(): ResolvedParticleSettings;
|
|
45
|
+
/**
|
|
46
|
+
* New settings. A new capacity starts a new (empty) ring and a new seed a
|
|
47
|
+
* new random sequence; anything else applies to the particles already out
|
|
48
|
+
* (the shader reads it every frame) and to the next ones.
|
|
49
|
+
*/
|
|
50
|
+
setSettings(settings: ResolvedParticleSettings): void;
|
|
51
|
+
/**
|
|
52
|
+
* One frame at `time` (s) with the emitter at `matrix` (world): emits the
|
|
53
|
+
* particles due since the last update along the emitter's path, unless
|
|
54
|
+
* `emitting` is false. The first update only records the pose. Returns how
|
|
55
|
+
* many were emitted.
|
|
56
|
+
*/
|
|
57
|
+
update(matrix: THREE.Matrix4, time: number, emitting?: boolean): number;
|
|
58
|
+
/** Removes every particle and forgets the last pose (the next update starts again). */
|
|
59
|
+
reset(): void;
|
|
60
|
+
}
|