laymur 0.23.0 → 0.25.0
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/README.md +1 -1
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.d.ts +3 -3
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.js +14 -16
- package/dist/core/constraints/UIConstraint.d.ts +22 -2
- package/dist/core/constraints/UIConstraint.js +26 -3
- package/dist/core/constraints/UICustomConstraint.d.ts +4 -4
- package/dist/core/constraints/UICustomConstraint.js +15 -15
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.d.ts +3 -3
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.js +11 -13
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.js +1 -3
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +3 -3
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js +30 -30
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.js +2 -4
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +3 -3
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +40 -39
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +3 -3
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js +13 -15
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts +3 -3
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.js +1 -0
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +13 -7
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.js +37 -30
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.js +1 -3
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +3 -3
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js +30 -30
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.js +2 -4
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +3 -3
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +40 -39
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +3 -3
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js +13 -15
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.d.ts +3 -3
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.js +11 -13
- package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.d.ts +3 -3
- package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.js +1 -3
- package/dist/core/constraints/builders/UIConstraint2DBuilder.d.ts +11 -11
- package/dist/core/constraints/builders/UIConstraint2DBuilder.js +10 -13
- package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.d.ts +1 -1
- package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.js +1 -3
- package/dist/core/constraints/builders/UICoverConstraintBuilder.d.ts +7 -7
- package/dist/core/constraints/builders/UICoverConstraintBuilder.js +10 -13
- package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.d.ts +1 -1
- package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.js +1 -3
- package/dist/core/constraints/builders/UIFitConstraintBuilder.d.ts +7 -7
- package/dist/core/constraints/builders/UIFitConstraintBuilder.js +10 -13
- package/dist/core/elements/UIAnchor/UIAnchor.Internal.js +3 -5
- package/dist/core/elements/UIAnchor/UIAnchor.d.ts +23 -5
- package/dist/core/elements/UIAnchor/UIAnchor.js +42 -8
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +2 -2
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.js +4 -6
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.d.ts +10 -10
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.js +108 -111
- package/dist/core/elements/UIDummy/UIDummy.Internal.d.ts +4 -4
- package/dist/core/elements/UIDummy/UIDummy.Internal.js +5 -8
- package/dist/core/elements/UIDummy/UIDummy.d.ts +19 -11
- package/dist/core/elements/UIDummy/UIDummy.js +59 -42
- package/dist/core/elements/UIElement/UIElement.Internal.d.ts +5 -5
- package/dist/core/elements/UIElement/UIElement.Internal.js +9 -12
- package/dist/core/elements/UIElement/UIElement.d.ts +11 -11
- package/dist/core/elements/UIElement/UIElement.js +57 -60
- package/dist/core/elements/UIGraphics/UIGraphics.Internal.d.ts +3 -3
- package/dist/core/elements/UIGraphics/UIGraphics.Internal.js +4 -7
- package/dist/core/elements/UIGraphics/UIGraphics.d.ts +7 -7
- package/dist/core/elements/UIGraphics/UIGraphics.js +44 -47
- package/dist/core/elements/UIImage/UIImage.Internal.d.ts +2 -2
- package/dist/core/elements/UIImage/UIImage.Internal.js +1 -0
- package/dist/core/elements/UIImage/UIImage.d.ts +9 -9
- package/dist/core/elements/UIImage/UIImage.js +21 -24
- package/dist/core/elements/UINineSlice/UINineSlice.Internal.d.ts +3 -3
- package/dist/core/elements/UINineSlice/UINineSlice.Internal.js +3 -5
- package/dist/core/elements/UINineSlice/UINineSlice.d.ts +12 -12
- package/dist/core/elements/UINineSlice/UINineSlice.js +71 -73
- package/dist/core/elements/UIProgress/UIProgress.Internal.d.ts +3 -4
- package/dist/core/elements/UIProgress/UIProgress.Internal.js +1 -3
- package/dist/core/elements/UIProgress/UIProgress.d.ts +10 -10
- package/dist/core/elements/UIProgress/UIProgress.js +59 -62
- package/dist/core/elements/UIScene/UIScene.Internal.d.ts +3 -3
- package/dist/core/elements/UIScene/UIScene.Internal.js +11 -14
- package/dist/core/elements/UIScene/UIScene.d.ts +8 -8
- package/dist/core/elements/UIScene/UIScene.js +68 -69
- package/dist/core/elements/UIText/UIText.Bidi.d.ts +2 -2
- package/dist/core/elements/UIText/UIText.Bidi.js +3 -5
- package/dist/core/elements/UIText/UIText.Interfaces.d.ts +6 -2
- package/dist/core/elements/UIText/UIText.Interfaces.js +1 -0
- package/dist/core/elements/UIText/UIText.Internal.d.ts +4 -4
- package/dist/core/elements/UIText/UIText.Internal.js +5 -7
- package/dist/core/elements/UIText/UIText.Measuring.d.ts +14 -7
- package/dist/core/elements/UIText/UIText.Measuring.js +115 -55
- package/dist/core/elements/UIText/UIText.Rendering.d.ts +3 -3
- package/dist/core/elements/UIText/UIText.Rendering.js +6 -9
- package/dist/core/elements/UIText/UIText.d.ts +28 -14
- package/dist/core/elements/UIText/UIText.js +181 -141
- package/dist/core/index.d.ts +55 -54
- package/dist/core/index.js +53 -0
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts +4 -4
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.js +2 -5
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.d.ts +4 -4
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.js +43 -42
- package/dist/core/layers/UILayer/UILayer.Internal.d.ts +2 -2
- package/dist/core/layers/UILayer/UILayer.Internal.js +4 -7
- package/dist/core/layers/UILayer/UILayer.d.ts +19 -4
- package/dist/core/layers/UILayer/UILayer.js +125 -62
- package/dist/core/miscellaneous/UIBlendMode.js +1 -3
- package/dist/core/miscellaneous/UIExpression.js +16 -19
- package/dist/core/miscellaneous/UIMode.js +3 -5
- package/dist/core/miscellaneous/UIOrientation.js +2 -4
- package/dist/core/miscellaneous/UIPriority.js +5 -8
- package/dist/core/miscellaneous/UIRelation.js +5 -8
- package/dist/core/miscellaneous/UITransparencyMode.js +1 -3
- package/dist/core/miscellaneous/area/UIArea.js +1 -3
- package/dist/core/miscellaneous/area/UIAreaCircle.d.ts +1 -1
- package/dist/core/miscellaneous/area/UIAreaCircle.js +3 -6
- package/dist/core/miscellaneous/area/UIAreaPolygon.d.ts +2 -2
- package/dist/core/miscellaneous/area/UIAreaPolygon.js +3 -6
- package/dist/core/miscellaneous/area/UIAreaRectangle.d.ts +1 -1
- package/dist/core/miscellaneous/area/UIAreaRectangle.js +3 -6
- package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.d.ts +1 -1
- package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.js +3 -6
- package/dist/core/miscellaneous/asserts.d.ts +20 -1
- package/dist/core/miscellaneous/asserts.js +71 -19
- package/dist/core/miscellaneous/canvas.js +13 -7
- package/dist/core/miscellaneous/color/UIColor.Internal.d.ts +1 -1
- package/dist/core/miscellaneous/color/UIColor.Internal.js +1 -3
- package/dist/core/miscellaneous/color/UIColor.d.ts +1 -1
- package/dist/core/miscellaneous/color/UIColor.js +202 -205
- package/dist/core/miscellaneous/computeTransform.d.ts +1 -1
- package/dist/core/miscellaneous/computeTransform.js +4 -7
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +2 -2
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.js +13 -16
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js +115 -118
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts +3 -3
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.js +1 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.js +208 -114
- package/dist/core/miscellaneous/generic-plane/shared.d.ts +2 -2
- package/dist/core/miscellaneous/generic-plane/shared.js +16 -19
- package/dist/core/miscellaneous/insets/UIInsets.Internal.js +1 -3
- package/dist/core/miscellaneous/insets/UIInsets.d.ts +1 -1
- package/dist/core/miscellaneous/insets/UIInsets.js +96 -99
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.js +1 -3
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +1 -1
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +14 -17
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.d.ts +2 -2
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js +13 -16
- package/dist/core/miscellaneous/math.js +3 -5
- package/dist/core/miscellaneous/micro/UIMicro.Internal.js +6 -8
- package/dist/core/miscellaneous/micro/UIMicro.d.ts +1 -1
- package/dist/core/miscellaneous/micro/UIMicro.js +91 -94
- package/dist/core/miscellaneous/resize-policy/UIResizePolicy.js +1 -3
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.js +12 -15
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.js +13 -16
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.js +13 -16
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.js +12 -15
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.js +13 -16
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.js +13 -16
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.js +3 -6
- package/dist/core/miscellaneous/shared.d.ts +1 -1
- package/dist/core/miscellaneous/shared.js +4 -7
- package/dist/core/miscellaneous/text-span/UITextSpan.Internal.d.ts +1 -1
- package/dist/core/miscellaneous/text-span/UITextSpan.Internal.js +1 -0
- package/dist/core/miscellaneous/text-span/UITextSpan.d.ts +2 -2
- package/dist/core/miscellaneous/text-span/UITextSpan.js +10 -13
- package/dist/core/miscellaneous/text-style/UITextStyle.Internal.js +15 -17
- package/dist/core/miscellaneous/text-style/UITextStyle.d.ts +13 -2
- package/dist/core/miscellaneous/text-style/UITextStyle.js +222 -207
- package/dist/core/miscellaneous/texture/UITextureView.Internal.d.ts +7 -0
- package/dist/core/miscellaneous/texture/UITextureView.Internal.js +16 -6
- package/dist/core/miscellaneous/texture/UITextureView.d.ts +1 -1
- package/dist/core/miscellaneous/texture/UITextureView.js +113 -117
- package/dist/core/miscellaneous/webglCapabilities.js +3 -4
- package/dist/core/shaders/UIImage.d.ts +9 -0
- package/dist/core/shaders/UIImage.js +14 -0
- package/dist/core/shaders/UINineSlice.d.ts +11 -0
- package/dist/core/shaders/UINineSlice.js +57 -0
- package/dist/core/shaders/UIProgress.d.ts +14 -0
- package/dist/core/shaders/UIProgress.js +21 -0
- package/dist/core/shaders/UIProgressMaskFunctionCircular.d.ts +2 -0
- package/dist/core/shaders/UIProgressMaskFunctionCircular.js +16 -0
- package/dist/core/shaders/UIProgressMaskFunctionDirectional.d.ts +2 -0
- package/dist/core/shaders/UIProgressMaskFunctionDirectional.js +15 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.d.ts +4 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.js +1 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.d.ts +7 -1
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +50 -47
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.d.ts +5 -2
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.js +1 -0
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.d.ts +11 -3
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.js +42 -26
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.d.ts +5 -3
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.js +1 -0
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.d.ts +20 -4
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +138 -117
- package/dist/debug/UIAspectDebug.d.ts +3 -3
- package/dist/debug/UIAspectDebug.js +64 -68
- package/dist/debug/UIConstraintDebug.d.ts +1 -1
- package/dist/debug/UIConstraintDebug.js +1 -0
- package/dist/debug/UIHeightDebug.d.ts +3 -3
- package/dist/debug/UIHeightDebug.js +63 -67
- package/dist/debug/UIHorizontalDistanceDebug.d.ts +3 -3
- package/dist/debug/UIHorizontalDistanceDebug.js +76 -81
- package/dist/debug/UIHorizontalInterpolationDebug.d.ts +3 -3
- package/dist/debug/UIHorizontalInterpolationDebug.js +74 -78
- package/dist/debug/UILayerDebug.d.ts +1 -1
- package/dist/debug/UILayerDebug.js +55 -64
- package/dist/debug/UIVerticalDistanceDebug.d.ts +3 -3
- package/dist/debug/UIVerticalDistanceDebug.js +76 -81
- package/dist/debug/UIVerticalInterpolationDebug.d.ts +3 -3
- package/dist/debug/UIVerticalInterpolationDebug.js +74 -78
- package/dist/debug/UIWidthDebug.d.ts +3 -3
- package/dist/debug/UIWidthDebug.js +63 -67
- package/dist/debug/index.d.ts +8 -8
- package/dist/debug/index.js +8 -8
- package/dist/debug/miscellaneous.js +8 -11
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.d.ts +3 -3
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.js +13 -16
- package/dist/particles/behaviorModules/UIBehaviorModule.d.ts +1 -1
- package/dist/particles/behaviorModules/UIBehaviorModule.js +1 -3
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.d.ts +3 -3
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.js +37 -40
- package/dist/particles/behaviorModules/UIBehaviorScaleOscillation.d.ts +41 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOscillation.js +87 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +17 -20
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.js +13 -16
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.js +21 -24
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.js +13 -16
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.js +21 -24
- package/dist/particles/elements/UIEmitter.Internal.d.ts +2 -2
- package/dist/particles/elements/UIEmitter.Internal.js +6 -9
- package/dist/particles/elements/UIEmitter.d.ts +17 -11
- package/dist/particles/elements/UIEmitter.js +100 -88
- package/dist/particles/index.d.ts +20 -18
- package/dist/particles/index.js +19 -18
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +1 -1
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +14 -15
- package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +1 -1
- package/dist/particles/instancedParticle/UIInstancedParticle.js +29 -32
- package/dist/particles/miscellaneous/miscellaneous.d.ts +3 -3
- package/dist/particles/miscellaneous/miscellaneous.js +26 -27
- package/dist/particles/renderingModules/UIRenderingColorOverLife.d.ts +2 -2
- package/dist/particles/renderingModules/UIRenderingColorOverLife.js +5 -8
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.d.ts +2 -2
- package/dist/particles/renderingModules/UIRenderingColorOverVelocity.js +6 -9
- package/dist/particles/renderingModules/UIRenderingModule.js +1 -3
- package/dist/particles/renderingModules/UIRenderingTexture.d.ts +2 -2
- package/dist/particles/renderingModules/UIRenderingTexture.js +4 -7
- package/dist/particles/shaders/UIRenderingColorOverLife.d.ts +2 -0
- package/dist/particles/shaders/UIRenderingColorOverLife.js +7 -0
- package/dist/particles/shaders/UIRenderingColorOverVelocity.d.ts +9 -0
- package/dist/particles/shaders/UIRenderingColorOverVelocity.js +16 -0
- package/dist/particles/shaders/UIRenderingTexture.d.ts +2 -0
- package/dist/particles/shaders/UIRenderingTexture.js +7 -0
- package/dist/particles/spawnModules/UISpawnModule.d.ts +1 -1
- package/dist/particles/spawnModules/UISpawnModule.js +1 -3
- package/dist/particles/spawnModules/UISpawnOffset.d.ts +3 -3
- package/dist/particles/spawnModules/UISpawnOffset.js +12 -15
- package/dist/particles/spawnModules/UISpawnRandomLifetime.d.ts +2 -2
- package/dist/particles/spawnModules/UISpawnRandomLifetime.js +13 -16
- package/dist/particles/spawnModules/UISpawnRandomRotation.d.ts +2 -2
- package/dist/particles/spawnModules/UISpawnRandomRotation.js +13 -16
- package/dist/particles/spawnModules/UISpawnRandomScale.d.ts +2 -2
- package/dist/particles/spawnModules/UISpawnRandomScale.js +19 -22
- package/dist/particles/spawnModules/UISpawnRandomTorque.d.ts +2 -2
- package/dist/particles/spawnModules/UISpawnRandomTorque.js +13 -16
- package/dist/particles/spawnModules/UISpawnRandomVelocity.d.ts +2 -2
- package/dist/particles/spawnModules/UISpawnRandomVelocity.js +21 -24
- package/dist/particles/spawnModules/UISpawnRectangle.d.ts +3 -3
- package/dist/particles/spawnModules/UISpawnRectangle.js +21 -24
- package/package.json +13 -17
- package/dist/_virtual/2d.js +0 -3
- package/dist/_virtual/3d.js +0 -3
- package/dist/_virtual/4d.js +0 -3
- package/dist/_virtual/mod.js +0 -5
- package/dist/_virtual/mod2.js +0 -3
- package/dist/core/shaders/UIImage.glsl.js +0 -3
- package/dist/core/shaders/UINineSlice.glsl.js +0 -3
- package/dist/core/shaders/UIProgress.glsl.js +0 -3
- package/dist/core/shaders/UIProgressMaskFunctionCircular.glsl.js +0 -3
- package/dist/core/shaders/UIProgressMaskFunctionDirectional.glsl.js +0 -3
- package/dist/index.js +0 -52
- package/dist/node_modules/fast-simplex-noise/lib/2d.js +0 -93
- package/dist/node_modules/fast-simplex-noise/lib/3d.js +0 -142
- package/dist/node_modules/fast-simplex-noise/lib/4d.js +0 -196
- package/dist/node_modules/fast-simplex-noise/lib/mod.js +0 -24
- package/dist/node_modules/three/examples/jsm/lines/Line2.js +0 -56
- package/dist/node_modules/three/examples/jsm/lines/LineGeometry.js +0 -157
- package/dist/node_modules/three/examples/jsm/lines/LineMaterial.js +0 -691
- package/dist/node_modules/three/examples/jsm/lines/LineSegments2.js +0 -415
- package/dist/node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js +0 -289
- package/dist/particles/shaders/UIRenderingColorOverLife.glsl.js +0 -3
- package/dist/particles/shaders/UIRenderingColorOverVelocity.glsl.js +0 -3
- package/dist/particles/shaders/UIRenderingTexture.glsl.js +0 -3
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import { MathUtils } from
|
|
2
|
-
import { assertValidPositiveNumber,
|
|
3
|
-
import {
|
|
4
|
-
import { UIBehaviorModule } from
|
|
5
|
-
|
|
1
|
+
import { MathUtils } from "three";
|
|
2
|
+
import { assertValidNonNegativeNumber, assertValidPositiveNumber, } from "../../core/miscellaneous/asserts.js";
|
|
3
|
+
import { BUILTIN_OFFSET_POSITION_X, BUILTIN_OFFSET_POSITION_Y, BUILTIN_OFFSET_RANDOM_C, BUILTIN_OFFSET_RANDOM_D, BUILTIN_OFFSET_VELOCITY_X, BUILTIN_OFFSET_VELOCITY_Y, generateNoise2D, resolveUIRangeConfig, } from "../miscellaneous/miscellaneous.js";
|
|
4
|
+
import { UIBehaviorModule } from "./UIBehaviorModule.js";
|
|
6
5
|
/**
|
|
7
6
|
* Applies noise-based acceleration to particles.
|
|
8
7
|
*
|
|
9
8
|
* Uses 2D noise based on particle position. Higher scale means finer noise detail.
|
|
10
9
|
*/
|
|
11
|
-
class UIBehaviorVelocityNoise extends UIBehaviorModule {
|
|
10
|
+
export class UIBehaviorVelocityNoise extends UIBehaviorModule {
|
|
12
11
|
/**
|
|
13
12
|
* @param scale - Noise frequency range. Accepts number, tuple, or range object
|
|
14
13
|
* @param strength - Force multiplier range. Accepts number, tuple, or range object
|
|
@@ -17,32 +16,32 @@ class UIBehaviorVelocityNoise extends UIBehaviorModule {
|
|
|
17
16
|
super();
|
|
18
17
|
/** @internal */
|
|
19
18
|
this.requiredProperties = { builtin: "Matrix4" };
|
|
20
|
-
this.
|
|
21
|
-
assertValidPositiveNumber(this.
|
|
22
|
-
assertValidPositiveNumber(this.
|
|
23
|
-
this.
|
|
24
|
-
assertValidNonNegativeNumber(this.
|
|
25
|
-
assertValidNonNegativeNumber(this.
|
|
19
|
+
this.scaleInternal = resolveUIRangeConfig(scale);
|
|
20
|
+
assertValidPositiveNumber(this.scaleInternal.min, `UIBehaviorVelocityNoise.constructor.scale.min`);
|
|
21
|
+
assertValidPositiveNumber(this.scaleInternal.max, `UIBehaviorVelocityNoise.constructor.scale.max`);
|
|
22
|
+
this.strengthInternal = resolveUIRangeConfig(strength);
|
|
23
|
+
assertValidNonNegativeNumber(this.strengthInternal.min, `UIBehaviorVelocityNoise.constructor.strength.min`);
|
|
24
|
+
assertValidNonNegativeNumber(this.strengthInternal.max, `UIBehaviorVelocityNoise.constructor.strength.max`);
|
|
26
25
|
}
|
|
27
26
|
/** Noise frequency range */
|
|
28
27
|
get scale() {
|
|
29
|
-
return this.
|
|
28
|
+
return this.scaleInternal;
|
|
30
29
|
}
|
|
31
30
|
/** Force multiplier range */
|
|
32
31
|
get strength() {
|
|
33
|
-
return this.
|
|
32
|
+
return this.strengthInternal;
|
|
34
33
|
}
|
|
35
34
|
/** Noise frequency range */
|
|
36
35
|
set scale(value) {
|
|
37
|
-
this.
|
|
38
|
-
assertValidPositiveNumber(this.
|
|
39
|
-
assertValidPositiveNumber(this.
|
|
36
|
+
this.scaleInternal = resolveUIRangeConfig(value);
|
|
37
|
+
assertValidPositiveNumber(this.scaleInternal.min, `UIBehaviorVelocityNoise.scale.min`);
|
|
38
|
+
assertValidPositiveNumber(this.scaleInternal.max, `UIBehaviorVelocityNoise.scale.max`);
|
|
40
39
|
}
|
|
41
40
|
/** Force multiplier range */
|
|
42
41
|
set strength(value) {
|
|
43
|
-
this.
|
|
44
|
-
assertValidNonNegativeNumber(this.
|
|
45
|
-
assertValidNonNegativeNumber(this.
|
|
42
|
+
this.strengthInternal = resolveUIRangeConfig(value);
|
|
43
|
+
assertValidNonNegativeNumber(this.strengthInternal.min, `UIBehaviorVelocityNoise.strength.min`);
|
|
44
|
+
assertValidNonNegativeNumber(this.strengthInternal.max, `UIBehaviorVelocityNoise.strength.max`);
|
|
46
45
|
}
|
|
47
46
|
/** @internal */
|
|
48
47
|
update(properties, instanceCount, deltaTime) {
|
|
@@ -53,16 +52,14 @@ class UIBehaviorVelocityNoise extends UIBehaviorModule {
|
|
|
53
52
|
const x = array[itemOffset + BUILTIN_OFFSET_POSITION_X];
|
|
54
53
|
const y = array[itemOffset + BUILTIN_OFFSET_POSITION_Y];
|
|
55
54
|
const scaleT = array[itemOffset + BUILTIN_OFFSET_RANDOM_C];
|
|
56
|
-
const scale = MathUtils.lerp(this.
|
|
55
|
+
const scale = MathUtils.lerp(this.scaleInternal.min, this.scaleInternal.max, scaleT);
|
|
57
56
|
const noiseX = generateNoise2D(x * scale, y * scale);
|
|
58
57
|
const noiseY = generateNoise2D((x + 100) * scale, (y + 100) * scale);
|
|
59
58
|
const strengthT = array[itemOffset + BUILTIN_OFFSET_RANDOM_D];
|
|
60
|
-
const strength = MathUtils.lerp(this.
|
|
59
|
+
const strength = MathUtils.lerp(this.strengthInternal.min, this.strengthInternal.max, strengthT);
|
|
61
60
|
array[itemOffset + BUILTIN_OFFSET_VELOCITY_X] += noiseX * strength * deltaTime;
|
|
62
61
|
array[itemOffset + BUILTIN_OFFSET_VELOCITY_Y] += noiseY * strength * deltaTime;
|
|
63
62
|
}
|
|
64
63
|
builtin.needsUpdate = true;
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
|
-
|
|
68
|
-
export { UIBehaviorVelocityNoise };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UIMode } from "../../core";
|
|
2
|
-
import type { UIAnchorOptions } from "../../core/elements/UIAnchor/UIAnchor.Internal";
|
|
1
|
+
import { UIMode } from "../../core/index.js";
|
|
2
|
+
import type { UIAnchorOptions } from "../../core/elements/UIAnchor/UIAnchor.Internal.js";
|
|
3
3
|
export interface UIEmitterOptions extends UIAnchorOptions {
|
|
4
4
|
expectedCapacity: number;
|
|
5
5
|
capacityStep: number;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { UIMode } from
|
|
2
|
-
|
|
3
|
-
function ignoreInput() {
|
|
1
|
+
import { UIMode } from "../../core/index.js";
|
|
2
|
+
export function ignoreInput() {
|
|
4
3
|
return false;
|
|
5
4
|
}
|
|
6
|
-
const EMITTER_DEFAULT_MODE = UIMode.VISIBLE;
|
|
7
|
-
const EMITTER_DEFAULT_EXPECTED_CAPACITY = 32;
|
|
8
|
-
const EMITTER_DEFAULT_CAPACITY_STEP = 32;
|
|
9
|
-
const EMITTER_DEFAULT_AUTOMATICALLY_DESTROY_MODULES = true;
|
|
10
|
-
|
|
11
|
-
export { EMITTER_DEFAULT_AUTOMATICALLY_DESTROY_MODULES, EMITTER_DEFAULT_CAPACITY_STEP, EMITTER_DEFAULT_EXPECTED_CAPACITY, EMITTER_DEFAULT_MODE, ignoreInput };
|
|
5
|
+
export const EMITTER_DEFAULT_MODE = UIMode.VISIBLE;
|
|
6
|
+
export const EMITTER_DEFAULT_EXPECTED_CAPACITY = 32;
|
|
7
|
+
export const EMITTER_DEFAULT_CAPACITY_STEP = 32;
|
|
8
|
+
export const EMITTER_DEFAULT_AUTOMATICALLY_DESTROY_MODULES = true;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { UILayer } from "../../core";
|
|
2
|
-
import { UIAnchor } from "../../core/elements/UIAnchor/UIAnchor";
|
|
3
|
-
import type { UIAnchorOptions } from "../../core/elements/UIAnchor/UIAnchor.Internal";
|
|
4
|
-
import type { UIBehaviorModule } from "../behaviorModules/UIBehaviorModule";
|
|
5
|
-
import type { UIRenderingModule } from "../renderingModules/UIRenderingModule";
|
|
6
|
-
import type { UISpawnModule } from "../spawnModules/UISpawnModule";
|
|
7
|
-
import type { UIEmitterMode, UIEmitterPlayOptions } from "./UIEmitter.Internal";
|
|
1
|
+
import type { UILayer } from "../../core/index.js";
|
|
2
|
+
import { UIAnchor } from "../../core/elements/UIAnchor/UIAnchor.js";
|
|
3
|
+
import type { UIAnchorOptions } from "../../core/elements/UIAnchor/UIAnchor.Internal.js";
|
|
4
|
+
import type { UIBehaviorModule } from "../behaviorModules/UIBehaviorModule.js";
|
|
5
|
+
import type { UIRenderingModule } from "../renderingModules/UIRenderingModule.js";
|
|
6
|
+
import type { UISpawnModule } from "../spawnModules/UISpawnModule.js";
|
|
7
|
+
import type { UIEmitterMode, UIEmitterPlayOptions } from "./UIEmitter.Internal.js";
|
|
8
8
|
export interface UIEmitterOptions extends UIAnchorOptions {
|
|
9
9
|
mode: UIEmitterMode;
|
|
10
10
|
expectedCapacity: number;
|
|
@@ -39,14 +39,18 @@ export declare class UIEmitter extends UIAnchor {
|
|
|
39
39
|
constructor(layer: UILayer, spawnSequence: UISpawnModule[], behaviorSequence: readonly UIBehaviorModule[], renderingSequence: readonly UIRenderingModule[], options?: Partial<UIEmitterOptions>);
|
|
40
40
|
/** Visibility mode */
|
|
41
41
|
get mode(): UIEmitterMode;
|
|
42
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Rendering order among the elements of the layer. Higher values on top; elements with equal
|
|
44
|
+
* values keep the order of creation, a later one on top.
|
|
45
|
+
*/
|
|
43
46
|
get zIndex(): number;
|
|
44
47
|
/** Visibility mode */
|
|
45
48
|
set mode(value: UIEmitterMode);
|
|
46
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Rendering order among the elements of the layer. Higher values on top; elements with equal
|
|
51
|
+
* values keep the order of creation, a later one on top.
|
|
52
|
+
*/
|
|
47
53
|
set zIndex(value: number);
|
|
48
|
-
/** Removes emitter and optionally destroys modules */
|
|
49
|
-
destroy(): void;
|
|
50
54
|
/**
|
|
51
55
|
* Spawns a specific number of particles immediately.
|
|
52
56
|
*
|
|
@@ -64,5 +68,7 @@ export declare class UIEmitter extends UIAnchor {
|
|
|
64
68
|
play(rate: number, options?: Partial<UIEmitterPlayOptions>): void;
|
|
65
69
|
/** Stops continuous particle emission */
|
|
66
70
|
stop(): void;
|
|
71
|
+
/** Frees the particles and the input catcher, optionally destroys modules */
|
|
72
|
+
protected destroyInternal(): void;
|
|
67
73
|
private readonly onRendering;
|
|
68
74
|
}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { Vector2 } from
|
|
2
|
-
import { UIAnchor } from
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
1
|
+
import { Vector2 } from "three";
|
|
2
|
+
import { UIAnchor } from "../../core/elements/UIAnchor/UIAnchor.js";
|
|
3
|
+
import { assertValidNumber } from "../../core/miscellaneous/asserts.js";
|
|
4
|
+
import { resolveGLSLTypeInfo } from "../../core/miscellaneous/generic-plane/shared.js";
|
|
5
|
+
import { isUIModeVisible } from "../../core/miscellaneous/UIMode.js";
|
|
6
|
+
import { UIInstancedParticle } from "../instancedParticle/UIInstancedParticle.js";
|
|
7
|
+
import { collectProperties, collectUniforms, } from "../instancedParticle/UIInstancedParticle.Internal.js";
|
|
8
|
+
import { BUILTIN_OFFSET_AGE, BUILTIN_OFFSET_POSITION_X, BUILTIN_OFFSET_POSITION_Y, BUILTIN_OFFSET_RANDOM_A, BUILTIN_OFFSET_RANDOM_B, BUILTIN_OFFSET_RANDOM_C, BUILTIN_OFFSET_RANDOM_D, BUILTIN_OFFSET_RANDOM_E, BUILTIN_OFFSET_RANDOM_F, BUILTIN_OFFSET_ROTATION, BUILTIN_OFFSET_TORQUE, BUILTIN_OFFSET_VELOCITY_X, BUILTIN_OFFSET_VELOCITY_Y, } from "../miscellaneous/miscellaneous.js";
|
|
9
|
+
import { EMITTER_DEFAULT_AUTOMATICALLY_DESTROY_MODULES, EMITTER_DEFAULT_CAPACITY_STEP, EMITTER_DEFAULT_EXPECTED_CAPACITY, EMITTER_DEFAULT_MODE, ignoreInput, } from "./UIEmitter.Internal.js";
|
|
10
10
|
/**
|
|
11
11
|
* Particle emitter element.
|
|
12
12
|
*
|
|
13
13
|
* Spawns, updates, and renders particles using modular spawn/behavior/rendering pipeline.
|
|
14
14
|
*/
|
|
15
|
-
class UIEmitter extends UIAnchor {
|
|
15
|
+
export class UIEmitter extends UIAnchor {
|
|
16
16
|
/**
|
|
17
17
|
* @param layer - Layer containing this emitter
|
|
18
18
|
* @param spawnSequence - Modules that initialize new particles
|
|
@@ -20,54 +20,54 @@ class UIEmitter extends UIAnchor {
|
|
|
20
20
|
* @param renderingSequence - Modules that control particle appearance
|
|
21
21
|
* @param options - Configuration options
|
|
22
22
|
*/
|
|
23
|
-
constructor(layer,
|
|
23
|
+
constructor(layer, spawnSequence, behaviorSequence, renderingSequence, options = {}) {
|
|
24
24
|
super(layer, options);
|
|
25
|
-
this.
|
|
26
|
-
this.
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
this.
|
|
30
|
-
this.
|
|
31
|
-
this.
|
|
32
|
-
this.
|
|
25
|
+
this.spawnSequence = spawnSequence;
|
|
26
|
+
this.behaviorSequence = behaviorSequence;
|
|
27
|
+
this.renderingSequence = renderingSequence;
|
|
28
|
+
this.emissionRate = 0;
|
|
29
|
+
this.emissionAccumulator = 0;
|
|
30
|
+
this.emissionDuration = Infinity;
|
|
31
|
+
this.emissionElapsed = 0;
|
|
32
|
+
this.onRendering = (renderer, deltaTime) => {
|
|
33
|
+
this.layer.sceneWrapper.setOrderedObjectDepth(this.mesh, this.layer.inputWrapper.getDepth(this.catcherHandler));
|
|
33
34
|
{
|
|
34
|
-
const { builtin } = this.
|
|
35
|
+
const { builtin } = this.mesh.propertyBuffers;
|
|
35
36
|
const { array, itemSize } = builtin;
|
|
36
|
-
for (let i = 0; i < this.
|
|
37
|
+
for (let i = 0; i < this.mesh.instanceCount; i++) {
|
|
37
38
|
array[i * itemSize + BUILTIN_OFFSET_AGE] += deltaTime;
|
|
38
39
|
}
|
|
39
40
|
builtin.needsUpdate = true;
|
|
40
|
-
this.
|
|
41
|
+
this.mesh.removeDeadParticles();
|
|
41
42
|
}
|
|
42
|
-
if (this.
|
|
43
|
-
this.
|
|
44
|
-
if (this.
|
|
43
|
+
if (this.emissionRate > 0) {
|
|
44
|
+
this.emissionElapsed += deltaTime;
|
|
45
|
+
if (this.emissionElapsed >= this.emissionDuration) {
|
|
45
46
|
this.stop();
|
|
46
47
|
}
|
|
47
48
|
else {
|
|
48
|
-
this.
|
|
49
|
-
const particlesToSpawn = Math.floor(this.
|
|
49
|
+
this.emissionAccumulator += this.emissionRate * deltaTime;
|
|
50
|
+
const particlesToSpawn = Math.floor(this.emissionAccumulator);
|
|
50
51
|
if (particlesToSpawn > 0) {
|
|
51
52
|
this.burst(particlesToSpawn);
|
|
52
|
-
this.
|
|
53
|
+
this.emissionAccumulator -= particlesToSpawn;
|
|
53
54
|
}
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
|
-
if (this.
|
|
57
|
+
if (this.mesh.instanceCount === 0) {
|
|
57
58
|
return;
|
|
58
59
|
}
|
|
59
|
-
this.
|
|
60
|
-
this._private_mesh.setOrigin(this.x, this.y);
|
|
60
|
+
this.mesh.setOrigin(this.x, this.y);
|
|
61
61
|
{
|
|
62
|
-
const { propertyBuffers, instanceCount } = this.
|
|
63
|
-
for (const module of this.
|
|
62
|
+
const { propertyBuffers, instanceCount } = this.mesh;
|
|
63
|
+
for (const module of this.behaviorSequence) {
|
|
64
64
|
module.update(propertyBuffers, instanceCount, deltaTime);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
const { builtin } = this.
|
|
67
|
+
const { builtin } = this.mesh.propertyBuffers;
|
|
68
68
|
const { array, itemSize } = builtin;
|
|
69
69
|
{
|
|
70
|
-
for (let i = 0; i < this.
|
|
70
|
+
for (let i = 0; i < this.mesh.instanceCount; i++) {
|
|
71
71
|
const itemOffset = i * itemSize;
|
|
72
72
|
array[itemOffset + BUILTIN_OFFSET_POSITION_X] +=
|
|
73
73
|
array[itemOffset + BUILTIN_OFFSET_VELOCITY_X] * deltaTime;
|
|
@@ -77,7 +77,7 @@ class UIEmitter extends UIAnchor {
|
|
|
77
77
|
builtin.needsUpdate = true;
|
|
78
78
|
}
|
|
79
79
|
{
|
|
80
|
-
for (let i = 0; i < this.
|
|
80
|
+
for (let i = 0; i < this.mesh.instanceCount; i++) {
|
|
81
81
|
const itemOffset = i * itemSize;
|
|
82
82
|
array[itemOffset + BUILTIN_OFFSET_ROTATION] +=
|
|
83
83
|
array[itemOffset + BUILTIN_OFFSET_TORQUE] * deltaTime;
|
|
@@ -95,58 +95,49 @@ class UIEmitter extends UIAnchor {
|
|
|
95
95
|
// 10, 11, 12 randomX, randomY, randomZ
|
|
96
96
|
// 13, 14, 16 reservedX, reservedY, reservedZ
|
|
97
97
|
};
|
|
98
|
-
collectProperties(collectedProperties,
|
|
99
|
-
collectProperties(collectedProperties,
|
|
100
|
-
collectProperties(collectedProperties,
|
|
98
|
+
collectProperties(collectedProperties, spawnSequence, "UIEmitter.constructor.spawnSequence");
|
|
99
|
+
collectProperties(collectedProperties, behaviorSequence, "UIEmitter.constructor.behaviorSequence");
|
|
100
|
+
collectProperties(collectedProperties, renderingSequence, "UIEmitter.constructor.renderingSequence");
|
|
101
101
|
const collectedUniforms = {
|
|
102
102
|
origin: { value: new Vector2(), glslTypeInfo: resolveGLSLTypeInfo("Vector2") },
|
|
103
103
|
};
|
|
104
|
-
collectUniforms(collectedUniforms,
|
|
104
|
+
collectUniforms(collectedUniforms, renderingSequence, "UIEmitter.constructor.renderingSequence");
|
|
105
105
|
const zIndex = 0;
|
|
106
|
-
this.
|
|
107
|
-
this.
|
|
108
|
-
this.
|
|
109
|
-
this.layer.
|
|
110
|
-
this.layer.sceneWrapper.insertCustomObject(this._private_mesh);
|
|
106
|
+
this.catcherHandler = this.layer.inputWrapper.createInputCatcher(ignoreInput, ignoreInput, ignoreInput, zIndex);
|
|
107
|
+
this.mesh = new UIInstancedParticle(this.renderingSequence.map((module) => module.source), collectedUniforms, collectedProperties, options.expectedCapacity ?? EMITTER_DEFAULT_EXPECTED_CAPACITY, options.capacityStep ?? EMITTER_DEFAULT_CAPACITY_STEP);
|
|
108
|
+
this.layer.signalRendering.on(this.onRendering);
|
|
109
|
+
this.layer.sceneWrapper.insertOrderedObject(this.mesh, this.layer.inputWrapper.getDepth(this.catcherHandler));
|
|
111
110
|
this.automaticallyDestroyModules =
|
|
112
111
|
options.automaticallyDestroyModules ?? EMITTER_DEFAULT_AUTOMATICALLY_DESTROY_MODULES;
|
|
113
|
-
this.
|
|
112
|
+
this.modeInternal = options.mode ?? EMITTER_DEFAULT_MODE;
|
|
114
113
|
}
|
|
115
114
|
/** Visibility mode */
|
|
116
115
|
get mode() {
|
|
117
|
-
return this.
|
|
116
|
+
return this.modeInternal;
|
|
118
117
|
}
|
|
119
|
-
/**
|
|
118
|
+
/**
|
|
119
|
+
* Rendering order among the elements of the layer. Higher values on top; elements with equal
|
|
120
|
+
* values keep the order of creation, a later one on top.
|
|
121
|
+
*/
|
|
120
122
|
get zIndex() {
|
|
121
|
-
return this.layer.inputWrapper.getZIndex(this.
|
|
123
|
+
return this.layer.inputWrapper.getZIndex(this.catcherHandler);
|
|
122
124
|
}
|
|
123
125
|
/** Visibility mode */
|
|
124
126
|
set mode(value) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
this.
|
|
127
|
+
this.assertNotDestroyed("UIEmitter.mode");
|
|
128
|
+
if (this.modeInternal !== value) {
|
|
129
|
+
this.modeInternal = value;
|
|
130
|
+
this.mesh.visible = isUIModeVisible(value);
|
|
128
131
|
}
|
|
129
132
|
}
|
|
130
|
-
/**
|
|
133
|
+
/**
|
|
134
|
+
* Rendering order among the elements of the layer. Higher values on top; elements with equal
|
|
135
|
+
* values keep the order of creation, a later one on top.
|
|
136
|
+
*/
|
|
131
137
|
set zIndex(value) {
|
|
132
|
-
this.
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
destroy() {
|
|
136
|
-
this.layer.signalRendering.off(this._private_onRendering);
|
|
137
|
-
this.layer.sceneWrapper.removeCustomObject(this._private_mesh);
|
|
138
|
-
if (this.automaticallyDestroyModules) {
|
|
139
|
-
for (const module of this._private_spawnSequence) {
|
|
140
|
-
module.destroy?.();
|
|
141
|
-
}
|
|
142
|
-
for (const module of this._private_behaviorSequence) {
|
|
143
|
-
module.destroy?.();
|
|
144
|
-
}
|
|
145
|
-
for (const module of this._private_renderingSequence) {
|
|
146
|
-
module.destroy?.();
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
super.destroy();
|
|
138
|
+
this.assertNotDestroyed("UIEmitter.zIndex");
|
|
139
|
+
assertValidNumber(value, "UIEmitter.zIndex");
|
|
140
|
+
this.layer.inputWrapper.setZIndex(this.catcherHandler, value);
|
|
150
141
|
}
|
|
151
142
|
/**
|
|
152
143
|
* Spawns a specific number of particles immediately.
|
|
@@ -154,11 +145,12 @@ class UIEmitter extends UIAnchor {
|
|
|
154
145
|
* @param count - Number of particles to create
|
|
155
146
|
*/
|
|
156
147
|
burst(count) {
|
|
157
|
-
|
|
158
|
-
this.
|
|
159
|
-
|
|
148
|
+
this.assertNotDestroyed("UIEmitter.burst");
|
|
149
|
+
const instanceBegin = this.mesh.instanceCount;
|
|
150
|
+
this.mesh.createInstances(count);
|
|
151
|
+
const instanceEnd = this.mesh.instanceCount;
|
|
160
152
|
{
|
|
161
|
-
const { builtin } = this.
|
|
153
|
+
const { builtin } = this.mesh.propertyBuffers;
|
|
162
154
|
const { array, itemSize } = builtin;
|
|
163
155
|
for (let i = instanceBegin; i < instanceEnd; i++) {
|
|
164
156
|
const itemOffset = i * itemSize;
|
|
@@ -171,13 +163,14 @@ class UIEmitter extends UIAnchor {
|
|
|
171
163
|
}
|
|
172
164
|
builtin.needsUpdate = true;
|
|
173
165
|
}
|
|
174
|
-
for (const spawnModule of this.
|
|
175
|
-
spawnModule.spawn(this.
|
|
166
|
+
for (const spawnModule of this.spawnSequence) {
|
|
167
|
+
spawnModule.spawn(this.mesh.propertyBuffers, instanceBegin, instanceEnd);
|
|
176
168
|
}
|
|
177
169
|
}
|
|
178
170
|
/** Removes all active particles */
|
|
179
171
|
clear() {
|
|
180
|
-
this.
|
|
172
|
+
this.assertNotDestroyed("UIEmitter.clear");
|
|
173
|
+
this.mesh.drop();
|
|
181
174
|
}
|
|
182
175
|
/**
|
|
183
176
|
* Starts continuous particle emission.
|
|
@@ -186,18 +179,37 @@ class UIEmitter extends UIAnchor {
|
|
|
186
179
|
* @param options - Emission duration and other settings
|
|
187
180
|
*/
|
|
188
181
|
play(rate, options = {}) {
|
|
189
|
-
this.
|
|
190
|
-
this.
|
|
191
|
-
this.
|
|
192
|
-
this.
|
|
182
|
+
this.assertNotDestroyed("UIEmitter.play");
|
|
183
|
+
this.emissionRate = rate;
|
|
184
|
+
this.emissionAccumulator = 0;
|
|
185
|
+
this.emissionDuration = options.duration ?? Infinity;
|
|
186
|
+
this.emissionElapsed = 0;
|
|
193
187
|
}
|
|
194
188
|
/** Stops continuous particle emission */
|
|
195
189
|
stop() {
|
|
196
|
-
this.
|
|
197
|
-
this.
|
|
198
|
-
this.
|
|
199
|
-
this.
|
|
190
|
+
this.assertNotDestroyed("UIEmitter.stop");
|
|
191
|
+
this.emissionRate = 0;
|
|
192
|
+
this.emissionAccumulator = 0;
|
|
193
|
+
this.emissionDuration = Infinity;
|
|
194
|
+
this.emissionElapsed = 0;
|
|
195
|
+
}
|
|
196
|
+
/** Frees the particles and the input catcher, optionally destroys modules */
|
|
197
|
+
destroyInternal() {
|
|
198
|
+
this.layer.signalRendering.off(this.onRendering);
|
|
199
|
+
this.layer.sceneWrapper.removeOrderedObject(this.mesh);
|
|
200
|
+
this.mesh.destroy();
|
|
201
|
+
this.layer.inputWrapper.destroyInputCatcher(this.catcherHandler);
|
|
202
|
+
if (this.automaticallyDestroyModules) {
|
|
203
|
+
for (const module of this.spawnSequence) {
|
|
204
|
+
module.destroy?.();
|
|
205
|
+
}
|
|
206
|
+
for (const module of this.behaviorSequence) {
|
|
207
|
+
module.destroy?.();
|
|
208
|
+
}
|
|
209
|
+
for (const module of this.renderingSequence) {
|
|
210
|
+
module.destroy?.();
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
super.destroyInternal();
|
|
200
214
|
}
|
|
201
215
|
}
|
|
202
|
-
|
|
203
|
-
export { UIEmitter };
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
export { UIBehaviorDirectionalGravity } from "./behaviorModules/UIBehaviorDirectionalGravity";
|
|
2
|
-
export { UIBehaviorPointGravity } from "./behaviorModules/UIBehaviorPointGravity";
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
1
|
+
export { UIBehaviorDirectionalGravity } from "./behaviorModules/UIBehaviorDirectionalGravity.js";
|
|
2
|
+
export { UIBehaviorPointGravity } from "./behaviorModules/UIBehaviorPointGravity.js";
|
|
3
|
+
export { UIBehaviorScaleOscillation } from "./behaviorModules/UIBehaviorScaleOscillation.js";
|
|
4
|
+
export type { UIScaleOscillationAxis } from "./behaviorModules/UIBehaviorScaleOscillation.js";
|
|
5
|
+
export { UIBehaviorScaleOverLife } from "./behaviorModules/UIBehaviorScaleOverLife.js";
|
|
6
|
+
export { UIBehaviorTorqueDamping } from "./behaviorModules/UIBehaviorTorqueDamping.js";
|
|
7
|
+
export { UIBehaviorTorqueNoise } from "./behaviorModules/UIBehaviorTorqueNoise.js";
|
|
8
|
+
export { UIBehaviorVelocityDamping } from "./behaviorModules/UIBehaviorVelocityDamping.js";
|
|
9
|
+
export { UIBehaviorVelocityNoise } from "./behaviorModules/UIBehaviorVelocityNoise.js";
|
|
10
|
+
export { UIEmitter } from "./elements/UIEmitter.js";
|
|
11
|
+
export { UIRenderingColorOverLife } from "./renderingModules/UIRenderingColorOverLife.js";
|
|
12
|
+
export { UIRenderingColorOverVelocity } from "./renderingModules/UIRenderingColorOverVelocity.js";
|
|
13
|
+
export { UIRenderingTexture } from "./renderingModules/UIRenderingTexture.js";
|
|
14
|
+
export { UISpawnOffset } from "./spawnModules/UISpawnOffset.js";
|
|
15
|
+
export { UISpawnRandomLifetime } from "./spawnModules/UISpawnRandomLifetime.js";
|
|
16
|
+
export { UISpawnRandomRotation } from "./spawnModules/UISpawnRandomRotation.js";
|
|
17
|
+
export { UISpawnRandomScale } from "./spawnModules/UISpawnRandomScale.js";
|
|
18
|
+
export { UISpawnRandomTorque } from "./spawnModules/UISpawnRandomTorque.js";
|
|
19
|
+
export { UISpawnRandomVelocity } from "./spawnModules/UISpawnRandomVelocity.js";
|
|
20
|
+
export { UISpawnRectangle } from "./spawnModules/UISpawnRectangle.js";
|
package/dist/particles/index.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
export { UIBehaviorDirectionalGravity } from
|
|
2
|
-
export { UIBehaviorPointGravity } from
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
1
|
+
export { UIBehaviorDirectionalGravity } from "./behaviorModules/UIBehaviorDirectionalGravity.js";
|
|
2
|
+
export { UIBehaviorPointGravity } from "./behaviorModules/UIBehaviorPointGravity.js";
|
|
3
|
+
export { UIBehaviorScaleOscillation } from "./behaviorModules/UIBehaviorScaleOscillation.js";
|
|
4
|
+
export { UIBehaviorScaleOverLife } from "./behaviorModules/UIBehaviorScaleOverLife.js";
|
|
5
|
+
export { UIBehaviorTorqueDamping } from "./behaviorModules/UIBehaviorTorqueDamping.js";
|
|
6
|
+
export { UIBehaviorTorqueNoise } from "./behaviorModules/UIBehaviorTorqueNoise.js";
|
|
7
|
+
export { UIBehaviorVelocityDamping } from "./behaviorModules/UIBehaviorVelocityDamping.js";
|
|
8
|
+
export { UIBehaviorVelocityNoise } from "./behaviorModules/UIBehaviorVelocityNoise.js";
|
|
9
|
+
export { UIEmitter } from "./elements/UIEmitter.js";
|
|
10
|
+
export { UIRenderingColorOverLife } from "./renderingModules/UIRenderingColorOverLife.js";
|
|
11
|
+
export { UIRenderingColorOverVelocity } from "./renderingModules/UIRenderingColorOverVelocity.js";
|
|
12
|
+
export { UIRenderingTexture } from "./renderingModules/UIRenderingTexture.js";
|
|
13
|
+
export { UISpawnOffset } from "./spawnModules/UISpawnOffset.js";
|
|
14
|
+
export { UISpawnRandomLifetime } from "./spawnModules/UISpawnRandomLifetime.js";
|
|
15
|
+
export { UISpawnRandomRotation } from "./spawnModules/UISpawnRandomRotation.js";
|
|
16
|
+
export { UISpawnRandomScale } from "./spawnModules/UISpawnRandomScale.js";
|
|
17
|
+
export { UISpawnRandomTorque } from "./spawnModules/UISpawnRandomTorque.js";
|
|
18
|
+
export { UISpawnRandomVelocity } from "./spawnModules/UISpawnRandomVelocity.js";
|
|
19
|
+
export { UISpawnRectangle } from "./spawnModules/UISpawnRectangle.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { InstancedBufferGeometry, ShaderMaterial } from "three";
|
|
2
|
-
import type { GLProperty, GLTypeInfo, UIProperty, UIPropertyName } from "../../core/miscellaneous/generic-plane/shared";
|
|
2
|
+
import type { GLProperty, GLTypeInfo, UIProperty, UIPropertyName } from "../../core/miscellaneous/generic-plane/shared.js";
|
|
3
3
|
export declare const INSTANCED_PARTICLE_GEOMETRY: InstancedBufferGeometry;
|
|
4
4
|
export declare function collectProperties(keeper: Record<string, GLTypeInfo>, modules: readonly {
|
|
5
5
|
requiredProperties?: Record<string, UIPropertyName>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
const INSTANCED_PARTICLE_GEOMETRY = (() => {
|
|
1
|
+
import { BufferAttribute, DoubleSide, Float32BufferAttribute, InstancedBufferGeometry, ShaderMaterial, } from "three";
|
|
2
|
+
import { UIColor } from "../../core/index.js";
|
|
3
|
+
import { resolveGLSLTypeInfo } from "../../core/miscellaneous/generic-plane/shared.js";
|
|
4
|
+
import { checkSRGBSupport } from "../../core/miscellaneous/webglCapabilities.js";
|
|
5
|
+
export const INSTANCED_PARTICLE_GEOMETRY = (() => {
|
|
7
6
|
const geometry = new InstancedBufferGeometry();
|
|
8
7
|
const indices = new Uint16Array([0, 2, 1, 2, 3, 1]);
|
|
9
8
|
geometry.setIndex(new BufferAttribute(indices, 1));
|
|
@@ -13,7 +12,7 @@ const INSTANCED_PARTICLE_GEOMETRY = (() => {
|
|
|
13
12
|
geometry.setAttribute("uv", new Float32BufferAttribute(uvs, 2));
|
|
14
13
|
return geometry;
|
|
15
14
|
})();
|
|
16
|
-
function collectProperties(keeper, modules, debugContext) {
|
|
15
|
+
export function collectProperties(keeper, modules, debugContext) {
|
|
17
16
|
for (const module of modules) {
|
|
18
17
|
if (module.requiredProperties === undefined) {
|
|
19
18
|
continue;
|
|
@@ -25,12 +24,12 @@ function collectProperties(keeper, modules, debugContext) {
|
|
|
25
24
|
keeper[key] = newTypeInfo;
|
|
26
25
|
}
|
|
27
26
|
else if (existingTypeInfo.glslTypeName !== newTypeInfo.glslTypeName) {
|
|
28
|
-
throw new Error(`${debugContext}: property conflict for "${key}"`);
|
|
27
|
+
throw new Error(`${debugContext}: property conflict for "${key}" (${existingTypeInfo.glslTypeName} and ${newTypeInfo.glslTypeName})`);
|
|
29
28
|
}
|
|
30
29
|
}
|
|
31
30
|
}
|
|
32
31
|
}
|
|
33
|
-
function collectUniforms(keeper, modules, debugContext) {
|
|
32
|
+
export function collectUniforms(keeper, modules, debugContext) {
|
|
34
33
|
for (const module of modules) {
|
|
35
34
|
for (const key in module.requiredUniforms) {
|
|
36
35
|
const value = module.requiredUniforms[key];
|
|
@@ -40,12 +39,12 @@ function collectUniforms(keeper, modules, debugContext) {
|
|
|
40
39
|
keeper[key] = { value, glslTypeInfo: newPropertyTypeInfo };
|
|
41
40
|
}
|
|
42
41
|
else if (existingGLProperty.glslTypeInfo.glslTypeName !== newPropertyTypeInfo.glslTypeName) {
|
|
43
|
-
throw new Error(`${debugContext}:
|
|
42
|
+
throw new Error(`${debugContext}: uniform conflict for "${key}" (${existingGLProperty.glslTypeInfo.glslTypeName} and ${newPropertyTypeInfo.glslTypeName})`);
|
|
44
43
|
}
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
|
-
function buildParticleVertexShader(uniformDeclarations, attributeDeclarations, varyingDeclarations, vertexAssignments) {
|
|
47
|
+
export function buildParticleVertexShader(uniformDeclarations, attributeDeclarations, varyingDeclarations, vertexAssignments) {
|
|
49
48
|
return `
|
|
50
49
|
|
|
51
50
|
#define PARTICLE_POSITION_X a_builtin[0][0]
|
|
@@ -107,7 +106,7 @@ function buildParticleVertexShader(uniformDeclarations, attributeDeclarations, v
|
|
|
107
106
|
}
|
|
108
107
|
`;
|
|
109
108
|
}
|
|
110
|
-
function buildParticleFragmentShader(uniformDeclarations, varyingDeclarations, sources) {
|
|
109
|
+
export function buildParticleFragmentShader(uniformDeclarations, varyingDeclarations, sources) {
|
|
111
110
|
const renamedSources = sources.map((source, index) => {
|
|
112
111
|
return source.replace(/vec4\s+draw\s*\(\s*\)/g, `vec4 draw${index}()`);
|
|
113
112
|
});
|
|
@@ -181,7 +180,7 @@ function buildParticleFragmentShader(uniformDeclarations, varyingDeclarations, s
|
|
|
181
180
|
}
|
|
182
181
|
`;
|
|
183
182
|
}
|
|
184
|
-
function buildParticleMaterial(sources, uniformProperties, varyingProperties) {
|
|
183
|
+
export function buildParticleMaterial(sources, uniformProperties, varyingProperties) {
|
|
185
184
|
const uniforms = {};
|
|
186
185
|
const uniformDeclarations = [];
|
|
187
186
|
const attributeDeclarations = [];
|
|
@@ -203,9 +202,9 @@ function buildParticleMaterial(sources, uniformProperties, varyingProperties) {
|
|
|
203
202
|
vertexShader: buildParticleVertexShader(uniformDeclarations, attributeDeclarations, varyingDeclarations, vertexAssignments),
|
|
204
203
|
fragmentShader: buildParticleFragmentShader(uniformDeclarations, varyingDeclarations, sources),
|
|
205
204
|
transparent: true,
|
|
205
|
+
side: DoubleSide,
|
|
206
|
+
forceSinglePass: true,
|
|
206
207
|
depthWrite: false,
|
|
207
208
|
depthTest: true,
|
|
208
209
|
});
|
|
209
210
|
}
|
|
210
|
-
|
|
211
|
-
export { INSTANCED_PARTICLE_GEOMETRY, buildParticleFragmentShader, buildParticleMaterial, buildParticleVertexShader, collectProperties, collectUniforms };
|