laymur 0.22.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 +25 -17
- package/dist/core/elements/UIElement/UIElement.js +76 -69
- 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 -8
- package/dist/core/elements/UIProgress/UIProgress.js +60 -58
- 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 +14 -17
- 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 +3 -3
- package/dist/core/miscellaneous/texture/UITextureView.js +114 -118
- 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 +27 -4
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +162 -123
- 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,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { UIMicroAnchorMode } from
|
|
3
|
-
|
|
1
|
+
import { Matrix4, Quaternion, Vector3 } from "three";
|
|
2
|
+
import { UIMicroAnchorMode } from "../miscellaneous/micro/UIMicro.Internal.js";
|
|
4
3
|
const TEMP_POSITION = new Vector3();
|
|
5
4
|
const TEMP_QUATERNION = new Quaternion();
|
|
6
5
|
const TEMP_SCALE = new Vector3();
|
|
@@ -10,7 +9,7 @@ const Z_AXIS = new Vector3(0, 0, 1);
|
|
|
10
9
|
* Computes element transform matrix.
|
|
11
10
|
* @returns Transform matrix (reused, do not store reference)
|
|
12
11
|
*/
|
|
13
|
-
function computeTransformMatrix(x, y, width, height, zIndex, microX, microY, microAnchorX, microAnchorY, microScaleX, microScaleY, microRotation, microAnchorMode) {
|
|
12
|
+
export function computeTransformMatrix(x, y, width, height, zIndex, microX, microY, microAnchorX, microAnchorY, microScaleX, microScaleY, microRotation, microAnchorMode) {
|
|
14
13
|
const scaledWidth = width * microScaleX;
|
|
15
14
|
const scaledHeight = height * microScaleY;
|
|
16
15
|
const anchorOffsetX = microAnchorX * scaledWidth;
|
|
@@ -46,7 +45,7 @@ function computeTransformMatrix(x, y, width, height, zIndex, microX, microY, mic
|
|
|
46
45
|
* @param trimBottom Pixels trimmed from bottom
|
|
47
46
|
* @returns Transform matrix (reused, do not store reference)
|
|
48
47
|
*/
|
|
49
|
-
function computeTrimmedTransformMatrix(x, y, width, height, zIndex, microX, microY, microAnchorX, microAnchorY, microScaleX, microScaleY, microRotation, microAnchorMode, trimLeft, trimRight, trimTop, trimBottom) {
|
|
48
|
+
export function computeTrimmedTransformMatrix(x, y, width, height, zIndex, microX, microY, microAnchorX, microAnchorY, microScaleX, microScaleY, microRotation, microAnchorMode, trimLeft, trimRight, trimTop, trimBottom) {
|
|
50
49
|
const trimmedWidth = width - trimLeft - trimRight;
|
|
51
50
|
const trimmedHeight = height - trimTop - trimBottom;
|
|
52
51
|
const scaledWidth = width * microScaleX;
|
|
@@ -78,5 +77,3 @@ function computeTrimmedTransformMatrix(x, y, width, height, zIndex, microX, micr
|
|
|
78
77
|
TEMP_MATRIX.compose(TEMP_POSITION, TEMP_QUATERNION, TEMP_SCALE);
|
|
79
78
|
return TEMP_MATRIX;
|
|
80
79
|
}
|
|
81
|
-
|
|
82
|
-
export { computeTransformMatrix, computeTrimmedTransformMatrix };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InstancedBufferAttribute, InstancedBufferGeometry, ShaderMaterial } from "three";
|
|
2
|
-
import { UITransparencyMode } from "../../UITransparencyMode";
|
|
3
|
-
import type { GLProperty, UIProperty } from "../shared";
|
|
2
|
+
import { UITransparencyMode } from "../../UITransparencyMode.js";
|
|
3
|
+
import type { GLProperty, UIProperty } from "../shared.js";
|
|
4
4
|
export declare const INSTANCED_PLANE_GEOMETRY: InstancedBufferGeometry;
|
|
5
5
|
export declare const CAPACITY_STEP = 4;
|
|
6
6
|
export declare const INITIAL_CAPACITY = 1;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { UIColor } from
|
|
3
|
-
import { UITransparencyMode } from
|
|
4
|
-
import { buildGenericPlaneFragmentShader, resolveGLSLTypeInfo } from
|
|
5
|
-
|
|
6
|
-
const INSTANCED_PLANE_GEOMETRY = (() => {
|
|
1
|
+
import { DoubleSide, Float32BufferAttribute, InstancedBufferAttribute, InstancedBufferGeometry, Matrix3, Matrix4, ShaderMaterial, Uint16BufferAttribute, Vector2, Vector3, Vector4, } from "three";
|
|
2
|
+
import { UIColor } from "../../color/UIColor.js";
|
|
3
|
+
import { UITransparencyMode } from "../../UITransparencyMode.js";
|
|
4
|
+
import { buildGenericPlaneFragmentShader, resolveGLSLTypeInfo } from "../shared.js";
|
|
5
|
+
export const INSTANCED_PLANE_GEOMETRY = (() => {
|
|
7
6
|
const geometry = new InstancedBufferGeometry();
|
|
8
7
|
const indices = new Uint16Array([0, 2, 1, 2, 3, 1]);
|
|
9
8
|
geometry.setIndex(new Uint16BufferAttribute(indices, 1));
|
|
@@ -13,10 +12,10 @@ const INSTANCED_PLANE_GEOMETRY = (() => {
|
|
|
13
12
|
geometry.setAttribute("uv", new Float32BufferAttribute(uvs, 2));
|
|
14
13
|
return geometry;
|
|
15
14
|
})();
|
|
16
|
-
const CAPACITY_STEP = 4;
|
|
17
|
-
const INITIAL_CAPACITY = 1;
|
|
15
|
+
export const CAPACITY_STEP = 4;
|
|
16
|
+
export const INITIAL_CAPACITY = 1;
|
|
18
17
|
const TEMP_COLOR_VECTOR = new Vector4();
|
|
19
|
-
function writePropertyToArray(value, array, offset) {
|
|
18
|
+
export function writePropertyToArray(value, array, offset) {
|
|
20
19
|
if (value instanceof UIColor) {
|
|
21
20
|
value.toGLSLColor(TEMP_COLOR_VECTOR);
|
|
22
21
|
array[offset] = TEMP_COLOR_VECTOR.x;
|
|
@@ -49,14 +48,14 @@ function writePropertyToArray(value, array, offset) {
|
|
|
49
48
|
array[offset] = value;
|
|
50
49
|
}
|
|
51
50
|
}
|
|
52
|
-
function buildEmptyInstancedBufferAttribute(value, capacity) {
|
|
51
|
+
export function buildEmptyInstancedBufferAttribute(value, capacity) {
|
|
53
52
|
const info = resolveGLSLTypeInfo(value);
|
|
54
53
|
if (!info.instantiable) {
|
|
55
54
|
throw new Error(`buildEmptyInstancedBufferAttribute.value: cannot create instanced attribute for non-instantiable type`);
|
|
56
55
|
}
|
|
57
56
|
return new InstancedBufferAttribute(new Float32Array(capacity * info.bufferSize), info.bufferSize);
|
|
58
57
|
}
|
|
59
|
-
function buildMaterial(source, uniformProperties, varyingProperties, transparency) {
|
|
58
|
+
export function buildMaterial(source, uniformProperties, varyingProperties, transparency) {
|
|
60
59
|
const uniforms = {};
|
|
61
60
|
const uniformDeclarations = [];
|
|
62
61
|
const attributeDeclarations = [];
|
|
@@ -120,7 +119,7 @@ function buildMaterial(source, uniformProperties, varyingProperties, transparenc
|
|
|
120
119
|
premultipliedAlpha,
|
|
121
120
|
});
|
|
122
121
|
}
|
|
123
|
-
function reconstructValue(referenceValue, array, offset) {
|
|
122
|
+
export function reconstructValue(referenceValue, array, offset) {
|
|
124
123
|
if (typeof referenceValue === "number") {
|
|
125
124
|
return array[offset];
|
|
126
125
|
}
|
|
@@ -152,7 +151,7 @@ function reconstructValue(referenceValue, array, offset) {
|
|
|
152
151
|
* Shift buffer region within the same array.
|
|
153
152
|
* Uses copyWithin for efficient memory moves with correct overlap handling.
|
|
154
153
|
*/
|
|
155
|
-
function shiftBufferRegion(array, itemSize, fromIndex, count, delta) {
|
|
154
|
+
export function shiftBufferRegion(array, itemSize, fromIndex, count, delta) {
|
|
156
155
|
if (count <= 0 || delta === 0) {
|
|
157
156
|
return;
|
|
158
157
|
}
|
|
@@ -164,10 +163,8 @@ function shiftBufferRegion(array, itemSize, fromIndex, count, delta) {
|
|
|
164
163
|
/**
|
|
165
164
|
* Copy data between two different buffers.
|
|
166
165
|
*/
|
|
167
|
-
function copyBetweenBuffers(src, srcOffset, dst, dstOffset, length) {
|
|
166
|
+
export function copyBetweenBuffers(src, srcOffset, dst, dstOffset, length) {
|
|
168
167
|
for (let i = 0; i < length; i++) {
|
|
169
168
|
dst[dstOffset + i] = src[srcOffset + i];
|
|
170
169
|
}
|
|
171
170
|
}
|
|
172
|
-
|
|
173
|
-
export { CAPACITY_STEP, INITIAL_CAPACITY, INSTANCED_PLANE_GEOMETRY, buildEmptyInstancedBufferAttribute, buildMaterial, copyBetweenBuffers, reconstructValue, shiftBufferRegion, writePropertyToArray };
|
package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { InstancedBufferAttribute, Matrix4, Mesh, Vector3 } from "three";
|
|
2
|
+
import { arePropertiesPartiallyCompatible, cloneGLProperties, cloneProperty, extractZIndexFromBuffer, resolveGLSLTypeInfo, resolvePropertyUniform, } from "../shared.js";
|
|
3
|
+
import { buildEmptyInstancedBufferAttribute, buildMaterial, CAPACITY_STEP, copyBetweenBuffers, INITIAL_CAPACITY, INSTANCED_PLANE_GEOMETRY, reconstructValue, shiftBufferRegion, writePropertyToArray, } from "./UIGenericInstancedPlane.Internal.js";
|
|
5
4
|
/**
|
|
6
5
|
* Instanced shader plane mesh for batched rendering.
|
|
7
6
|
*
|
|
@@ -10,7 +9,7 @@ import { INITIAL_CAPACITY, INSTANCED_PLANE_GEOMETRY, buildMaterial, CAPACITY_STE
|
|
|
10
9
|
*
|
|
11
10
|
* @internal
|
|
12
11
|
*/
|
|
13
|
-
class UIGenericInstancedPlane extends Mesh {
|
|
12
|
+
export class UIGenericInstancedPlane extends Mesh {
|
|
14
13
|
constructor(source, properties, transparency, initialCapacity = INITIAL_CAPACITY) {
|
|
15
14
|
const uniformProperties = {};
|
|
16
15
|
const varyingProperties = {
|
|
@@ -48,85 +47,85 @@ class UIGenericInstancedPlane extends Mesh {
|
|
|
48
47
|
this.matrixWorldAutoUpdate = false;
|
|
49
48
|
this.source = source;
|
|
50
49
|
this.transparency = transparency;
|
|
51
|
-
this.
|
|
52
|
-
this.
|
|
53
|
-
this.
|
|
54
|
-
this.
|
|
55
|
-
this.
|
|
56
|
-
this.
|
|
57
|
-
this.
|
|
58
|
-
this.
|
|
59
|
-
for (const name in this.
|
|
60
|
-
const { value } = this.
|
|
61
|
-
const attribute = buildEmptyInstancedBufferAttribute(value, this.
|
|
62
|
-
this.
|
|
63
|
-
this.
|
|
64
|
-
}
|
|
65
|
-
for (const name in this.
|
|
66
|
-
const { value } = this.
|
|
67
|
-
const uniform = resolvePropertyUniform(name, this.
|
|
50
|
+
this.instancedGeometry = instancedGeometry;
|
|
51
|
+
this.shaderMaterial = shaderMaterial;
|
|
52
|
+
this.uniformProperties = uniformProperties;
|
|
53
|
+
this.varyingProperties = varyingProperties;
|
|
54
|
+
this.propertyBuffers = new Map();
|
|
55
|
+
this.capacity = Math.max(Math.ceil(initialCapacity / CAPACITY_STEP) * CAPACITY_STEP, CAPACITY_STEP);
|
|
56
|
+
this.instancesCountInternal = 0;
|
|
57
|
+
this.instancedGeometry.instanceCount = 0;
|
|
58
|
+
for (const name in this.varyingProperties) {
|
|
59
|
+
const { value } = this.varyingProperties[name];
|
|
60
|
+
const attribute = buildEmptyInstancedBufferAttribute(value, this.capacity);
|
|
61
|
+
this.instancedGeometry.setAttribute(`a_${name}`, attribute);
|
|
62
|
+
this.propertyBuffers.set(name, attribute);
|
|
63
|
+
}
|
|
64
|
+
for (const name in this.uniformProperties) {
|
|
65
|
+
const { value } = this.uniformProperties[name];
|
|
66
|
+
const uniform = resolvePropertyUniform(name, this.shaderMaterial);
|
|
68
67
|
uniform.value = value;
|
|
69
68
|
}
|
|
70
|
-
this.
|
|
69
|
+
this.shaderMaterial.uniformsNeedUpdate = true;
|
|
71
70
|
}
|
|
72
71
|
/** Current number of active instances */
|
|
73
72
|
get instancesCount() {
|
|
74
|
-
return this.
|
|
73
|
+
return this.instancesCountInternal;
|
|
75
74
|
}
|
|
76
75
|
/**
|
|
77
76
|
* Insert instance at given index. Elements at [index..end) are shifted right.
|
|
78
77
|
*/
|
|
79
78
|
insertAt(index, properties, transform, visibility, blend, hsl) {
|
|
80
|
-
if (index < 0 || index > this.
|
|
81
|
-
throw new Error(`UIGenericInstancedPlane.insertAt.index: out of bounds (index=${index}, count=${this.
|
|
79
|
+
if (index < 0 || index > this.instancesCountInternal) {
|
|
80
|
+
throw new Error(`UIGenericInstancedPlane.insertAt.index: out of bounds (index=${index}, count=${this.instancesCountInternal})`);
|
|
82
81
|
}
|
|
83
|
-
this.
|
|
84
|
-
if (index < this.
|
|
85
|
-
this.
|
|
82
|
+
this.ensureCapacity(this.instancesCountInternal + 1);
|
|
83
|
+
if (index < this.instancesCountInternal) {
|
|
84
|
+
this.shiftBuffersRight(index, 1);
|
|
86
85
|
}
|
|
87
|
-
this.
|
|
88
|
-
this.
|
|
89
|
-
this.
|
|
86
|
+
this.writeToBuffers(index, properties, transform, visibility, blend, hsl);
|
|
87
|
+
this.instancesCountInternal++;
|
|
88
|
+
this.instancedGeometry.instanceCount = this.instancesCountInternal;
|
|
90
89
|
}
|
|
91
90
|
/**
|
|
92
91
|
* Remove instance at given index. Elements at [index+1..end) are shifted left.
|
|
93
92
|
*/
|
|
94
93
|
removeAt(index) {
|
|
95
|
-
if (index < 0 || index >= this.
|
|
96
|
-
throw new Error(`UIGenericInstancedPlane.removeAt.index: out of bounds (index=${index}, count=${this.
|
|
94
|
+
if (index < 0 || index >= this.instancesCountInternal) {
|
|
95
|
+
throw new Error(`UIGenericInstancedPlane.removeAt.index: out of bounds (index=${index}, count=${this.instancesCountInternal})`);
|
|
97
96
|
}
|
|
98
|
-
if (index < this.
|
|
99
|
-
this.
|
|
97
|
+
if (index < this.instancesCountInternal - 1) {
|
|
98
|
+
this.shiftBuffersLeft(index + 1, 1);
|
|
100
99
|
}
|
|
101
|
-
this.
|
|
102
|
-
this.
|
|
100
|
+
this.instancesCountInternal--;
|
|
101
|
+
this.instancedGeometry.instanceCount = this.instancesCountInternal;
|
|
103
102
|
}
|
|
104
103
|
/** Update properties at given index */
|
|
105
104
|
setPropertiesAt(index, properties) {
|
|
106
|
-
if (index < 0 || index >= this.
|
|
107
|
-
throw new Error(`UIGenericInstancedPlane.setPropertiesAt.index: out of bounds (index=${index}, count=${this.
|
|
105
|
+
if (index < 0 || index >= this.instancesCountInternal) {
|
|
106
|
+
throw new Error(`UIGenericInstancedPlane.setPropertiesAt.index: out of bounds (index=${index}, count=${this.instancesCountInternal})`);
|
|
108
107
|
}
|
|
109
108
|
for (const name in properties) {
|
|
110
109
|
const { value, glslTypeInfo } = properties[name];
|
|
111
110
|
if (glslTypeInfo.instantiable) {
|
|
112
|
-
const attribute = this.
|
|
111
|
+
const attribute = this.resolveAttribute(name);
|
|
113
112
|
const offset = index * attribute.itemSize;
|
|
114
113
|
writePropertyToArray(value, attribute.array, offset);
|
|
115
114
|
attribute.needsUpdate = true;
|
|
116
115
|
}
|
|
117
116
|
else {
|
|
118
|
-
const uniform = resolvePropertyUniform(name, this.
|
|
117
|
+
const uniform = resolvePropertyUniform(name, this.shaderMaterial);
|
|
119
118
|
uniform.value = value;
|
|
120
|
-
this.
|
|
119
|
+
this.shaderMaterial.uniformsNeedUpdate = true;
|
|
121
120
|
}
|
|
122
121
|
}
|
|
123
122
|
}
|
|
124
123
|
/** Update transform at given index */
|
|
125
124
|
setTransformAt(index, transform) {
|
|
126
|
-
if (index < 0 || index >= this.
|
|
127
|
-
throw new Error(`UIGenericInstancedPlane.setTransformAt.index: out of bounds (index=${index}, count=${this.
|
|
125
|
+
if (index < 0 || index >= this.instancesCountInternal) {
|
|
126
|
+
throw new Error(`UIGenericInstancedPlane.setTransformAt.index: out of bounds (index=${index}, count=${this.instancesCountInternal})`);
|
|
128
127
|
}
|
|
129
|
-
const attribute = this.
|
|
128
|
+
const attribute = this.resolveAttribute("instanceTransform");
|
|
130
129
|
const array = attribute.array;
|
|
131
130
|
const offset = index * 16;
|
|
132
131
|
const elements = transform.elements;
|
|
@@ -137,30 +136,30 @@ class UIGenericInstancedPlane extends Mesh {
|
|
|
137
136
|
}
|
|
138
137
|
/** Update visibility at given index */
|
|
139
138
|
setVisibilityAt(index, visible) {
|
|
140
|
-
if (index < 0 || index >= this.
|
|
141
|
-
throw new Error(`UIGenericInstancedPlane.setVisibilityAt.index: out of bounds (index=${index}, count=${this.
|
|
139
|
+
if (index < 0 || index >= this.instancesCountInternal) {
|
|
140
|
+
throw new Error(`UIGenericInstancedPlane.setVisibilityAt.index: out of bounds (index=${index}, count=${this.instancesCountInternal})`);
|
|
142
141
|
}
|
|
143
|
-
const attribute = this.
|
|
142
|
+
const attribute = this.resolveAttribute("instanceVisibility");
|
|
144
143
|
const array = attribute.array;
|
|
145
144
|
array[index] = visible ? 1 : 0;
|
|
146
145
|
attribute.needsUpdate = true;
|
|
147
146
|
}
|
|
148
147
|
/** Update blend factor at given index (1 = normal over, 0 = additive) */
|
|
149
148
|
setBlendAt(index, blend) {
|
|
150
|
-
if (index < 0 || index >= this.
|
|
151
|
-
throw new Error(`UIGenericInstancedPlane.setBlendAt.index: out of bounds (index=${index}, count=${this.
|
|
149
|
+
if (index < 0 || index >= this.instancesCountInternal) {
|
|
150
|
+
throw new Error(`UIGenericInstancedPlane.setBlendAt.index: out of bounds (index=${index}, count=${this.instancesCountInternal})`);
|
|
152
151
|
}
|
|
153
|
-
const attribute = this.
|
|
152
|
+
const attribute = this.resolveAttribute("instanceBlend");
|
|
154
153
|
const array = attribute.array;
|
|
155
154
|
array[index] = blend;
|
|
156
155
|
attribute.needsUpdate = true;
|
|
157
156
|
}
|
|
158
157
|
/** Update HSL adjustment at given index (hue in turns, saturation multiplier, lightness offset) */
|
|
159
158
|
setHSLAt(index, hsl) {
|
|
160
|
-
if (index < 0 || index >= this.
|
|
161
|
-
throw new Error(`UIGenericInstancedPlane.setHSLAt.index: out of bounds (index=${index}, count=${this.
|
|
159
|
+
if (index < 0 || index >= this.instancesCountInternal) {
|
|
160
|
+
throw new Error(`UIGenericInstancedPlane.setHSLAt.index: out of bounds (index=${index}, count=${this.instancesCountInternal})`);
|
|
162
161
|
}
|
|
163
|
-
const attribute = this.
|
|
162
|
+
const attribute = this.resolveAttribute("instanceHSL");
|
|
164
163
|
const array = attribute.array;
|
|
165
164
|
const offset = index * 3;
|
|
166
165
|
array[offset] = hsl.h;
|
|
@@ -173,26 +172,26 @@ class UIGenericInstancedPlane extends Mesh {
|
|
|
173
172
|
* Returns cloned data safe for external use.
|
|
174
173
|
*/
|
|
175
174
|
extractDataAt(index) {
|
|
176
|
-
if (index < 0 || index >= this.
|
|
177
|
-
throw new Error(`UIGenericInstancedPlane.extractDataAt.index: out of bounds (index=${index}, count=${this.
|
|
175
|
+
if (index < 0 || index >= this.instancesCountInternal) {
|
|
176
|
+
throw new Error(`UIGenericInstancedPlane.extractDataAt.index: out of bounds (index=${index}, count=${this.instancesCountInternal})`);
|
|
178
177
|
}
|
|
179
178
|
const properties = {};
|
|
180
|
-
for (const name in this.
|
|
181
|
-
const prop = this.
|
|
179
|
+
for (const name in this.uniformProperties) {
|
|
180
|
+
const prop = this.uniformProperties[name];
|
|
182
181
|
properties[name] = {
|
|
183
182
|
value: cloneProperty(prop.value),
|
|
184
183
|
glslTypeInfo: prop.glslTypeInfo,
|
|
185
184
|
};
|
|
186
185
|
}
|
|
187
|
-
for (const name in this.
|
|
186
|
+
for (const name in this.varyingProperties) {
|
|
188
187
|
if (name === "instanceVisibility" ||
|
|
189
188
|
name === "instanceTransform" ||
|
|
190
189
|
name === "instanceBlend" ||
|
|
191
190
|
name === "instanceHSL") {
|
|
192
191
|
continue;
|
|
193
192
|
}
|
|
194
|
-
const { value, glslTypeInfo } = this.
|
|
195
|
-
const attribute = this.
|
|
193
|
+
const { value, glslTypeInfo } = this.varyingProperties[name];
|
|
194
|
+
const attribute = this.propertyBuffers.get(name);
|
|
196
195
|
const array = attribute.array;
|
|
197
196
|
const offset = index * attribute.itemSize;
|
|
198
197
|
properties[name] = {
|
|
@@ -200,11 +199,11 @@ class UIGenericInstancedPlane extends Mesh {
|
|
|
200
199
|
glslTypeInfo,
|
|
201
200
|
};
|
|
202
201
|
}
|
|
203
|
-
const transformAttribute = this.
|
|
202
|
+
const transformAttribute = this.propertyBuffers.get("instanceTransform");
|
|
204
203
|
const transformArray = transformAttribute.array;
|
|
205
204
|
const transform = new Matrix4();
|
|
206
205
|
transform.fromArray(transformArray, index * 16);
|
|
207
|
-
const visibilityAttribute = this.
|
|
206
|
+
const visibilityAttribute = this.propertyBuffers.get("instanceVisibility");
|
|
208
207
|
const visibilityArray = visibilityAttribute.array;
|
|
209
208
|
const visibility = visibilityArray[index] >= 0.5;
|
|
210
209
|
return {
|
|
@@ -217,10 +216,10 @@ class UIGenericInstancedPlane extends Mesh {
|
|
|
217
216
|
}
|
|
218
217
|
/** Get zIndex at given index (from transform buffer) */
|
|
219
218
|
getZIndexAt(index) {
|
|
220
|
-
if (index < 0 || index >= this.
|
|
221
|
-
throw new Error(`UIGenericInstancedPlane.getZIndexAt.index: out of bounds (index=${index}, count=${this.
|
|
219
|
+
if (index < 0 || index >= this.instancesCountInternal) {
|
|
220
|
+
throw new Error(`UIGenericInstancedPlane.getZIndexAt.index: out of bounds (index=${index}, count=${this.instancesCountInternal})`);
|
|
222
221
|
}
|
|
223
|
-
const attribute = this.
|
|
222
|
+
const attribute = this.propertyBuffers.get("instanceTransform");
|
|
224
223
|
return extractZIndexFromBuffer(attribute.array, index);
|
|
225
224
|
}
|
|
226
225
|
/**
|
|
@@ -228,25 +227,25 @@ class UIGenericInstancedPlane extends Mesh {
|
|
|
228
227
|
* Other plane becomes empty after merge.
|
|
229
228
|
*/
|
|
230
229
|
merge(other) {
|
|
231
|
-
if (other.
|
|
230
|
+
if (other.instancesCountInternal === 0) {
|
|
232
231
|
return;
|
|
233
232
|
}
|
|
234
|
-
this.
|
|
235
|
-
for (const [name, thisAttribute] of this.
|
|
236
|
-
const otherAttribute = other.
|
|
233
|
+
this.ensureCapacity(this.instancesCountInternal + other.instancesCountInternal);
|
|
234
|
+
for (const [name, thisAttribute] of this.propertyBuffers) {
|
|
235
|
+
const otherAttribute = other.propertyBuffers.get(name);
|
|
237
236
|
if (!otherAttribute) {
|
|
238
237
|
throw new Error(`UIGenericInstancedPlane.merge: missing attribute ${name} in source`);
|
|
239
238
|
}
|
|
240
239
|
const itemSize = thisAttribute.itemSize;
|
|
241
240
|
const srcArray = otherAttribute.array;
|
|
242
241
|
const dstArray = thisAttribute.array;
|
|
243
|
-
copyBetweenBuffers(srcArray, 0, dstArray, this.
|
|
242
|
+
copyBetweenBuffers(srcArray, 0, dstArray, this.instancesCountInternal * itemSize, other.instancesCountInternal * itemSize);
|
|
244
243
|
thisAttribute.needsUpdate = true;
|
|
245
244
|
}
|
|
246
|
-
this.
|
|
247
|
-
this.
|
|
248
|
-
other.
|
|
249
|
-
other.
|
|
245
|
+
this.instancesCountInternal += other.instancesCountInternal;
|
|
246
|
+
this.instancedGeometry.instanceCount = this.instancesCountInternal;
|
|
247
|
+
other.instancesCountInternal = 0;
|
|
248
|
+
other.instancedGeometry.instanceCount = 0;
|
|
250
249
|
}
|
|
251
250
|
/**
|
|
252
251
|
* Split this plane at given index.
|
|
@@ -254,16 +253,16 @@ class UIGenericInstancedPlane extends Mesh {
|
|
|
254
253
|
* This plane keeps elements [0..atIndex).
|
|
255
254
|
*/
|
|
256
255
|
split(atIndex) {
|
|
257
|
-
if (atIndex <= 0 || atIndex >= this.
|
|
258
|
-
throw new Error(`UIGenericInstancedPlane.split.atIndex: must be in range (0, count) (atIndex=${atIndex}, count=${this.
|
|
256
|
+
if (atIndex <= 0 || atIndex >= this.instancesCountInternal) {
|
|
257
|
+
throw new Error(`UIGenericInstancedPlane.split.atIndex: must be in range (0, count) (atIndex=${atIndex}, count=${this.instancesCountInternal})`);
|
|
259
258
|
}
|
|
260
|
-
const tailCount = this.
|
|
259
|
+
const tailCount = this.instancesCountInternal - atIndex;
|
|
261
260
|
const newPlane = new UIGenericInstancedPlane(this.source, cloneGLProperties({
|
|
262
|
-
...this.
|
|
263
|
-
...this.
|
|
261
|
+
...this.uniformProperties,
|
|
262
|
+
...this.varyingProperties,
|
|
264
263
|
}), this.transparency, tailCount);
|
|
265
|
-
for (const [name, thisAttribute] of this.
|
|
266
|
-
const newAttribute = newPlane.
|
|
264
|
+
for (const [name, thisAttribute] of this.propertyBuffers) {
|
|
265
|
+
const newAttribute = newPlane.propertyBuffers.get(name);
|
|
267
266
|
if (!newAttribute) {
|
|
268
267
|
throw new Error(`UIGenericInstancedPlane.split: missing attribute ${name} in new plane`);
|
|
269
268
|
}
|
|
@@ -273,10 +272,10 @@ class UIGenericInstancedPlane extends Mesh {
|
|
|
273
272
|
copyBetweenBuffers(srcArray, atIndex * itemSize, dstArray, 0, tailCount * itemSize);
|
|
274
273
|
newAttribute.needsUpdate = true;
|
|
275
274
|
}
|
|
276
|
-
newPlane.
|
|
277
|
-
newPlane.
|
|
278
|
-
this.
|
|
279
|
-
this.
|
|
275
|
+
newPlane.instancesCountInternal = tailCount;
|
|
276
|
+
newPlane.instancedGeometry.instanceCount = tailCount;
|
|
277
|
+
this.instancesCountInternal = atIndex;
|
|
278
|
+
this.instancedGeometry.instanceCount = atIndex;
|
|
280
279
|
return newPlane;
|
|
281
280
|
}
|
|
282
281
|
/**
|
|
@@ -289,74 +288,74 @@ class UIGenericInstancedPlane extends Mesh {
|
|
|
289
288
|
if (this.transparency !== transparency) {
|
|
290
289
|
return false;
|
|
291
290
|
}
|
|
292
|
-
const result = arePropertiesPartiallyCompatible({ ...this.
|
|
291
|
+
const result = arePropertiesPartiallyCompatible({ ...this.uniformProperties, ...this.varyingProperties }, properties);
|
|
293
292
|
return result;
|
|
294
293
|
}
|
|
295
294
|
/** Get all properties configuration (for compatibility checks) */
|
|
296
295
|
getProperties() {
|
|
297
|
-
return { ...this.
|
|
296
|
+
return { ...this.uniformProperties, ...this.varyingProperties };
|
|
298
297
|
}
|
|
299
298
|
/** Remove all instances, reset to empty state */
|
|
300
299
|
clearInstances() {
|
|
301
|
-
this.
|
|
302
|
-
this.
|
|
300
|
+
this.instancesCountInternal = 0;
|
|
301
|
+
this.instancedGeometry.instanceCount = 0;
|
|
303
302
|
}
|
|
304
303
|
/** Dispose geometry, material, and clear buffers */
|
|
305
304
|
destroy() {
|
|
306
|
-
this.
|
|
307
|
-
this.
|
|
308
|
-
this.
|
|
305
|
+
this.instancedGeometry.dispose();
|
|
306
|
+
this.shaderMaterial.dispose();
|
|
307
|
+
this.propertyBuffers.clear();
|
|
309
308
|
}
|
|
310
|
-
|
|
311
|
-
if (requiredCapacity <= this.
|
|
309
|
+
ensureCapacity(requiredCapacity) {
|
|
310
|
+
if (requiredCapacity <= this.capacity) {
|
|
312
311
|
return;
|
|
313
312
|
}
|
|
314
313
|
const newCapacity = Math.ceil(requiredCapacity / CAPACITY_STEP) * CAPACITY_STEP;
|
|
315
|
-
for (const [name, oldAttribute] of this.
|
|
314
|
+
for (const [name, oldAttribute] of this.propertyBuffers) {
|
|
316
315
|
const itemSize = oldAttribute.itemSize;
|
|
317
316
|
const newArray = new Float32Array(newCapacity * itemSize);
|
|
318
317
|
newArray.set(oldAttribute.array);
|
|
319
318
|
const newAttribute = new InstancedBufferAttribute(newArray, itemSize);
|
|
320
|
-
this.
|
|
321
|
-
this.
|
|
319
|
+
this.instancedGeometry.setAttribute(`a_${name}`, newAttribute);
|
|
320
|
+
this.propertyBuffers.set(name, newAttribute);
|
|
322
321
|
}
|
|
323
|
-
this.
|
|
322
|
+
this.capacity = newCapacity;
|
|
324
323
|
}
|
|
325
|
-
|
|
326
|
-
const elementsToMove = this.
|
|
324
|
+
shiftBuffersRight(fromIndex, delta) {
|
|
325
|
+
const elementsToMove = this.instancesCountInternal - fromIndex;
|
|
327
326
|
if (elementsToMove <= 0) {
|
|
328
327
|
return;
|
|
329
328
|
}
|
|
330
|
-
for (const attribute of this.
|
|
329
|
+
for (const attribute of this.propertyBuffers.values()) {
|
|
331
330
|
shiftBufferRegion(attribute.array, attribute.itemSize, fromIndex, elementsToMove, delta);
|
|
332
331
|
attribute.needsUpdate = true;
|
|
333
332
|
}
|
|
334
333
|
}
|
|
335
|
-
|
|
336
|
-
const elementsToMove = this.
|
|
334
|
+
shiftBuffersLeft(fromIndex, delta) {
|
|
335
|
+
const elementsToMove = this.instancesCountInternal - fromIndex;
|
|
337
336
|
if (elementsToMove <= 0) {
|
|
338
337
|
return;
|
|
339
338
|
}
|
|
340
|
-
for (const attribute of this.
|
|
339
|
+
for (const attribute of this.propertyBuffers.values()) {
|
|
341
340
|
shiftBufferRegion(attribute.array, attribute.itemSize, fromIndex, elementsToMove, -delta);
|
|
342
341
|
attribute.needsUpdate = true;
|
|
343
342
|
}
|
|
344
343
|
}
|
|
345
|
-
|
|
346
|
-
const visibilityAttribute = this.
|
|
344
|
+
writeToBuffers(index, properties, transform, visibility, blend, hsl) {
|
|
345
|
+
const visibilityAttribute = this.resolveAttribute("instanceVisibility");
|
|
347
346
|
visibilityAttribute.array[index] = visibility ? 1 : 0;
|
|
348
347
|
visibilityAttribute.needsUpdate = true;
|
|
349
|
-
const blendAttribute = this.
|
|
348
|
+
const blendAttribute = this.resolveAttribute("instanceBlend");
|
|
350
349
|
blendAttribute.array[index] = blend;
|
|
351
350
|
blendAttribute.needsUpdate = true;
|
|
352
|
-
const hslAttribute = this.
|
|
351
|
+
const hslAttribute = this.resolveAttribute("instanceHSL");
|
|
353
352
|
const hslArray = hslAttribute.array;
|
|
354
353
|
const hslOffset = index * 3;
|
|
355
354
|
hslArray[hslOffset] = hsl.h;
|
|
356
355
|
hslArray[hslOffset + 1] = hsl.s;
|
|
357
356
|
hslArray[hslOffset + 2] = hsl.l;
|
|
358
357
|
hslAttribute.needsUpdate = true;
|
|
359
|
-
const transformAttribute = this.
|
|
358
|
+
const transformAttribute = this.resolveAttribute("instanceTransform");
|
|
360
359
|
const transformArray = transformAttribute.array;
|
|
361
360
|
const transformOffset = index * 16;
|
|
362
361
|
const elements = transform.elements;
|
|
@@ -367,7 +366,7 @@ class UIGenericInstancedPlane extends Mesh {
|
|
|
367
366
|
for (const name in properties) {
|
|
368
367
|
const { value, glslTypeInfo } = properties[name];
|
|
369
368
|
if (glslTypeInfo.instantiable) {
|
|
370
|
-
const attribute = this.
|
|
369
|
+
const attribute = this.propertyBuffers.get(name);
|
|
371
370
|
if (attribute) {
|
|
372
371
|
const offset = index * attribute.itemSize;
|
|
373
372
|
writePropertyToArray(value, attribute.array, offset);
|
|
@@ -375,19 +374,17 @@ class UIGenericInstancedPlane extends Mesh {
|
|
|
375
374
|
}
|
|
376
375
|
}
|
|
377
376
|
else {
|
|
378
|
-
const uniform = resolvePropertyUniform(name, this.
|
|
377
|
+
const uniform = resolvePropertyUniform(name, this.shaderMaterial);
|
|
379
378
|
uniform.value = value;
|
|
380
|
-
this.
|
|
379
|
+
this.shaderMaterial.uniformsNeedUpdate = true;
|
|
381
380
|
}
|
|
382
381
|
}
|
|
383
382
|
}
|
|
384
|
-
|
|
385
|
-
const attribute = this.
|
|
383
|
+
resolveAttribute(name) {
|
|
384
|
+
const attribute = this.propertyBuffers.get(name);
|
|
386
385
|
if (attribute === undefined) {
|
|
387
386
|
throw new Error(`UIGenericInstancedPlane.resolveAttribute.name: unknown attribute "${name}"`);
|
|
388
387
|
}
|
|
389
388
|
return attribute;
|
|
390
389
|
}
|
|
391
390
|
}
|
|
392
|
-
|
|
393
|
-
export { UIGenericInstancedPlane };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Matrix4 } from "three";
|
|
2
|
-
import type { UITransparencyMode } from "../../UITransparencyMode";
|
|
3
|
-
import type { GLProperty, HSLAdjustment } from "../shared";
|
|
4
|
-
import type { UIGenericInstancedPlane } from "../UIGenericInstancedPlane/UIGenericInstancedPlane";
|
|
2
|
+
import type { UITransparencyMode } from "../../UITransparencyMode.js";
|
|
3
|
+
import type { GLProperty, HSLAdjustment } from "../shared.js";
|
|
4
|
+
import type { UIGenericInstancedPlane } from "../UIGenericInstancedPlane/UIGenericInstancedPlane.js";
|
|
5
5
|
export interface PlaneDescriptor {
|
|
6
6
|
mesh: UIGenericInstancedPlane;
|
|
7
7
|
instanceIndex: number;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|