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
package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { UIGenericInstancedPlane } from
|
|
3
|
-
|
|
1
|
+
import { cloneGLProperties, cloneProperties, convertUIPropertiesToGLProperties, extractZIndex, } from "../shared.js";
|
|
2
|
+
import { UIGenericInstancedPlane } from "../UIGenericInstancedPlane/UIGenericInstancedPlane.js";
|
|
4
3
|
/**
|
|
5
4
|
* Manages shader plane instances with automatic batching based on zIndex order.
|
|
6
5
|
*
|
|
@@ -9,19 +8,24 @@ import { UIGenericInstancedPlane } from '../UIGenericInstancedPlane/UIGenericIns
|
|
|
9
8
|
* - flush() applies all pending changes to GPU representation
|
|
10
9
|
* - setVisibility is immediate (doesn't affect structure)
|
|
11
10
|
*
|
|
11
|
+
* Ordered objects, such as particle emitters, are placed by depth on the same scale as plane
|
|
12
|
+
* zIndex; an object is above a plane of equal depth. No mesh spans the depth of an ordered object,
|
|
13
|
+
* so the object gets a renderOrder between the meshes below and above it.
|
|
14
|
+
*
|
|
12
15
|
* @internal
|
|
13
16
|
*/
|
|
14
|
-
class UIPlaneRegistry {
|
|
17
|
+
export class UIPlaneRegistry {
|
|
15
18
|
constructor(scene) {
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
this.
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
19
|
+
this.handlerToState = new Map();
|
|
20
|
+
this.lastHandler = 0;
|
|
21
|
+
this.orderedMeshes = [];
|
|
22
|
+
this.handlerToDescriptor = new Map();
|
|
23
|
+
this.objectToDepth = new Map();
|
|
24
|
+
this.pendingCreate = new Set();
|
|
25
|
+
this.pendingDelete = new Set();
|
|
26
|
+
this.pendingRelocate = new Set();
|
|
27
|
+
this.needsFlush = false;
|
|
28
|
+
this.scene = scene;
|
|
25
29
|
}
|
|
26
30
|
/**
|
|
27
31
|
* Creates plane with given shader and properties.
|
|
@@ -30,7 +34,7 @@ class UIPlaneRegistry {
|
|
|
30
34
|
* @returns Plane handler for subsequent operations
|
|
31
35
|
*/
|
|
32
36
|
createPlane(source, properties, transform, visibility, transparency, blend, hsl) {
|
|
33
|
-
const handler = this.
|
|
37
|
+
const handler = this.lastHandler++;
|
|
34
38
|
const glProperties = convertUIPropertiesToGLProperties(cloneProperties(properties));
|
|
35
39
|
const zIndex = extractZIndex(transform);
|
|
36
40
|
const state = {
|
|
@@ -43,26 +47,26 @@ class UIPlaneRegistry {
|
|
|
43
47
|
hsl: { h: hsl.h, s: hsl.s, l: hsl.l },
|
|
44
48
|
zIndex,
|
|
45
49
|
};
|
|
46
|
-
this.
|
|
47
|
-
this.
|
|
48
|
-
this.
|
|
50
|
+
this.handlerToState.set(handler, state);
|
|
51
|
+
this.pendingCreate.add(handler);
|
|
52
|
+
this.needsFlush = true;
|
|
49
53
|
return handler;
|
|
50
54
|
}
|
|
51
55
|
/**
|
|
52
56
|
* Removes plane. Changes are pending until flush() is called.
|
|
53
57
|
*/
|
|
54
58
|
destroyPlane(handler) {
|
|
55
|
-
if (!this.
|
|
56
|
-
throw new Error(`UIPlaneRegistry.destroyPlane: handler ${handler} not found`);
|
|
59
|
+
if (!this.handlerToState.has(handler)) {
|
|
60
|
+
throw new Error(`UIPlaneRegistry.destroyPlane: handler ${handler} not found; its element may be destroyed`);
|
|
57
61
|
}
|
|
58
|
-
this.
|
|
59
|
-
if (this.
|
|
60
|
-
this.
|
|
62
|
+
this.handlerToState.delete(handler);
|
|
63
|
+
if (this.pendingCreate.has(handler)) {
|
|
64
|
+
this.pendingCreate.delete(handler);
|
|
61
65
|
return;
|
|
62
66
|
}
|
|
63
|
-
this.
|
|
64
|
-
this.
|
|
65
|
-
this.
|
|
67
|
+
this.pendingRelocate.delete(handler);
|
|
68
|
+
this.pendingDelete.add(handler);
|
|
69
|
+
this.needsFlush = true;
|
|
66
70
|
}
|
|
67
71
|
/**
|
|
68
72
|
* Updates plane properties.
|
|
@@ -71,7 +75,7 @@ class UIPlaneRegistry {
|
|
|
71
75
|
* Instantiable properties are applied immediately.
|
|
72
76
|
*/
|
|
73
77
|
setProperties(handler, properties) {
|
|
74
|
-
const state = this.
|
|
78
|
+
const state = this.resolveState(handler);
|
|
75
79
|
const glProperties = convertUIPropertiesToGLProperties(properties);
|
|
76
80
|
let textureChanged = false;
|
|
77
81
|
for (const name in glProperties) {
|
|
@@ -87,12 +91,12 @@ class UIPlaneRegistry {
|
|
|
87
91
|
glslTypeInfo: newProp.glslTypeInfo,
|
|
88
92
|
};
|
|
89
93
|
}
|
|
90
|
-
if (textureChanged && !this.
|
|
91
|
-
this.
|
|
92
|
-
this.
|
|
94
|
+
if (textureChanged && !this.pendingCreate.has(handler)) {
|
|
95
|
+
this.pendingRelocate.add(handler);
|
|
96
|
+
this.needsFlush = true;
|
|
93
97
|
}
|
|
94
98
|
else {
|
|
95
|
-
const descriptor = this.
|
|
99
|
+
const descriptor = this.handlerToDescriptor.get(handler);
|
|
96
100
|
if (descriptor) {
|
|
97
101
|
descriptor.mesh.setPropertiesAt(descriptor.instanceIndex, glProperties);
|
|
98
102
|
}
|
|
@@ -104,17 +108,17 @@ class UIPlaneRegistry {
|
|
|
104
108
|
* If zIndex changes, element will be relocated on flush().
|
|
105
109
|
*/
|
|
106
110
|
setTransform(handler, transform) {
|
|
107
|
-
const state = this.
|
|
111
|
+
const state = this.resolveState(handler);
|
|
108
112
|
const newZIndex = extractZIndex(transform);
|
|
109
113
|
const oldZIndex = state.zIndex;
|
|
110
114
|
state.transform.copy(transform);
|
|
111
115
|
state.zIndex = newZIndex;
|
|
112
|
-
if (oldZIndex !== newZIndex && !this.
|
|
113
|
-
this.
|
|
114
|
-
this.
|
|
116
|
+
if (oldZIndex !== newZIndex && !this.pendingCreate.has(handler)) {
|
|
117
|
+
this.pendingRelocate.add(handler);
|
|
118
|
+
this.needsFlush = true;
|
|
115
119
|
}
|
|
116
120
|
else {
|
|
117
|
-
const descriptor = this.
|
|
121
|
+
const descriptor = this.handlerToDescriptor.get(handler);
|
|
118
122
|
if (descriptor) {
|
|
119
123
|
descriptor.mesh.setTransformAt(descriptor.instanceIndex, transform);
|
|
120
124
|
}
|
|
@@ -125,9 +129,9 @@ class UIPlaneRegistry {
|
|
|
125
129
|
* This is applied immediately (doesn't affect batching structure).
|
|
126
130
|
*/
|
|
127
131
|
setVisibility(handler, visibility) {
|
|
128
|
-
const state = this.
|
|
132
|
+
const state = this.resolveState(handler);
|
|
129
133
|
state.visibility = visibility;
|
|
130
|
-
const descriptor = this.
|
|
134
|
+
const descriptor = this.handlerToDescriptor.get(handler);
|
|
131
135
|
if (descriptor) {
|
|
132
136
|
descriptor.mesh.setVisibilityAt(descriptor.instanceIndex, visibility);
|
|
133
137
|
}
|
|
@@ -137,9 +141,9 @@ class UIPlaneRegistry {
|
|
|
137
141
|
* This is applied immediately (doesn't affect batching structure).
|
|
138
142
|
*/
|
|
139
143
|
setBlend(handler, blend) {
|
|
140
|
-
const state = this.
|
|
144
|
+
const state = this.resolveState(handler);
|
|
141
145
|
state.blend = blend;
|
|
142
|
-
const descriptor = this.
|
|
146
|
+
const descriptor = this.handlerToDescriptor.get(handler);
|
|
143
147
|
if (descriptor) {
|
|
144
148
|
descriptor.mesh.setBlendAt(descriptor.instanceIndex, blend);
|
|
145
149
|
}
|
|
@@ -149,11 +153,11 @@ class UIPlaneRegistry {
|
|
|
149
153
|
* This is applied immediately (doesn't affect batching structure).
|
|
150
154
|
*/
|
|
151
155
|
setHSL(handler, hsl) {
|
|
152
|
-
const state = this.
|
|
156
|
+
const state = this.resolveState(handler);
|
|
153
157
|
state.hsl.h = hsl.h;
|
|
154
158
|
state.hsl.s = hsl.s;
|
|
155
159
|
state.hsl.l = hsl.l;
|
|
156
|
-
const descriptor = this.
|
|
160
|
+
const descriptor = this.handlerToDescriptor.get(handler);
|
|
157
161
|
if (descriptor) {
|
|
158
162
|
descriptor.mesh.setHSLAt(descriptor.instanceIndex, hsl);
|
|
159
163
|
}
|
|
@@ -163,67 +167,122 @@ class UIPlaneRegistry {
|
|
|
163
167
|
* Element will be relocated on flush() if transparency changes.
|
|
164
168
|
*/
|
|
165
169
|
setTransparency(handler, transparency) {
|
|
166
|
-
const state = this.
|
|
170
|
+
const state = this.resolveState(handler);
|
|
167
171
|
if (state.transparency === transparency) {
|
|
168
172
|
return;
|
|
169
173
|
}
|
|
170
174
|
state.transparency = transparency;
|
|
171
|
-
if (!this.
|
|
172
|
-
this.
|
|
173
|
-
this.
|
|
175
|
+
if (!this.pendingCreate.has(handler)) {
|
|
176
|
+
this.pendingRelocate.add(handler);
|
|
177
|
+
this.needsFlush = true;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Adds an object drawn between planes at the given depth.
|
|
182
|
+
* Its renderOrder is managed by the registry. Changes are pending until flush() is called.
|
|
183
|
+
*/
|
|
184
|
+
insertOrderedObject(object, depth) {
|
|
185
|
+
if (this.objectToDepth.has(object)) {
|
|
186
|
+
throw new Error(`UIPlaneRegistry.insertOrderedObject: object ${object.id} is already inserted`);
|
|
187
|
+
}
|
|
188
|
+
this.objectToDepth.set(object, depth);
|
|
189
|
+
this.scene.add(object);
|
|
190
|
+
this.needsFlush = true;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Moves an ordered object to the given depth.
|
|
194
|
+
* Changes are pending until flush() is called.
|
|
195
|
+
*/
|
|
196
|
+
setOrderedObjectDepth(object, depth) {
|
|
197
|
+
const currentDepth = this.objectToDepth.get(object);
|
|
198
|
+
if (currentDepth === undefined) {
|
|
199
|
+
throw new Error(`UIPlaneRegistry.setOrderedObjectDepth: object ${object.id} not found; it may be removed already`);
|
|
200
|
+
}
|
|
201
|
+
if (currentDepth !== depth) {
|
|
202
|
+
this.objectToDepth.set(object, depth);
|
|
203
|
+
this.needsFlush = true;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Removes an ordered object; the meshes it separated merge back on flush().
|
|
208
|
+
*/
|
|
209
|
+
removeOrderedObject(object) {
|
|
210
|
+
if (!this.objectToDepth.delete(object)) {
|
|
211
|
+
throw new Error(`UIPlaneRegistry.removeOrderedObject: object ${object.id} not found; it may be removed already`);
|
|
174
212
|
}
|
|
213
|
+
this.scene.remove(object);
|
|
214
|
+
this.needsFlush = true;
|
|
175
215
|
}
|
|
176
216
|
/**
|
|
177
217
|
* Apply all pending changes to GPU representation.
|
|
178
218
|
* Call this before rendering.
|
|
179
219
|
*/
|
|
180
220
|
flush() {
|
|
181
|
-
if (!this.
|
|
221
|
+
if (!this.needsFlush) {
|
|
182
222
|
return;
|
|
183
223
|
}
|
|
184
|
-
this.
|
|
185
|
-
this.
|
|
186
|
-
this.
|
|
187
|
-
this.
|
|
188
|
-
this.
|
|
189
|
-
this.
|
|
190
|
-
this.
|
|
191
|
-
this.
|
|
192
|
-
this.
|
|
193
|
-
this.
|
|
224
|
+
this.processDeletes();
|
|
225
|
+
this.processRelocates();
|
|
226
|
+
this.processCreates();
|
|
227
|
+
this.splitAtObjects();
|
|
228
|
+
this.mergeCompatibleNeighbors();
|
|
229
|
+
this.cleanupEmptyMeshes();
|
|
230
|
+
this.syncSceneOrder();
|
|
231
|
+
this.pendingCreate.clear();
|
|
232
|
+
this.pendingDelete.clear();
|
|
233
|
+
this.pendingRelocate.clear();
|
|
234
|
+
this.needsFlush = false;
|
|
194
235
|
}
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
236
|
+
/**
|
|
237
|
+
* Removes all meshes from the scene and frees their GPU resources.
|
|
238
|
+
* Textures and ordered objects are left to their owners.
|
|
239
|
+
*/
|
|
240
|
+
destroy() {
|
|
241
|
+
for (const mesh of this.orderedMeshes) {
|
|
242
|
+
this.scene.remove(mesh);
|
|
243
|
+
mesh.destroy();
|
|
244
|
+
}
|
|
245
|
+
this.orderedMeshes.length = 0;
|
|
246
|
+
this.handlerToState.clear();
|
|
247
|
+
this.handlerToDescriptor.clear();
|
|
248
|
+
this.objectToDepth.clear();
|
|
249
|
+
this.pendingCreate.clear();
|
|
250
|
+
this.pendingDelete.clear();
|
|
251
|
+
this.pendingRelocate.clear();
|
|
252
|
+
this.needsFlush = false;
|
|
253
|
+
}
|
|
254
|
+
processDeletes() {
|
|
255
|
+
for (const handler of this.pendingDelete) {
|
|
256
|
+
const descriptor = this.handlerToDescriptor.get(handler);
|
|
198
257
|
if (!descriptor) {
|
|
199
258
|
continue;
|
|
200
259
|
}
|
|
201
260
|
const { mesh, instanceIndex } = descriptor;
|
|
202
261
|
mesh.removeAt(instanceIndex);
|
|
203
|
-
this.
|
|
204
|
-
this.
|
|
262
|
+
this.shiftHandlerIndices(mesh, instanceIndex + 1, -1);
|
|
263
|
+
this.handlerToDescriptor.delete(handler);
|
|
205
264
|
}
|
|
206
265
|
}
|
|
207
|
-
|
|
208
|
-
for (const handler of this.
|
|
209
|
-
const descriptor = this.
|
|
266
|
+
processRelocates() {
|
|
267
|
+
for (const handler of this.pendingRelocate) {
|
|
268
|
+
const descriptor = this.handlerToDescriptor.get(handler);
|
|
210
269
|
if (!descriptor) {
|
|
211
270
|
continue;
|
|
212
271
|
}
|
|
213
272
|
const { mesh, instanceIndex } = descriptor;
|
|
214
273
|
mesh.removeAt(instanceIndex);
|
|
215
|
-
this.
|
|
216
|
-
this.
|
|
217
|
-
this.
|
|
274
|
+
this.shiftHandlerIndices(mesh, instanceIndex + 1, -1);
|
|
275
|
+
this.handlerToDescriptor.delete(handler);
|
|
276
|
+
this.pendingCreate.add(handler);
|
|
218
277
|
}
|
|
219
278
|
}
|
|
220
|
-
|
|
221
|
-
if (this.
|
|
279
|
+
processCreates() {
|
|
280
|
+
if (this.pendingCreate.size === 0) {
|
|
222
281
|
return;
|
|
223
282
|
}
|
|
224
283
|
const toCreate = [];
|
|
225
|
-
for (const handler of this.
|
|
226
|
-
const state = this.
|
|
284
|
+
for (const handler of this.pendingCreate) {
|
|
285
|
+
const state = this.handlerToState.get(handler);
|
|
227
286
|
if (state) {
|
|
228
287
|
toCreate.push({ handler, state });
|
|
229
288
|
}
|
|
@@ -236,14 +295,14 @@ class UIPlaneRegistry {
|
|
|
236
295
|
}
|
|
237
296
|
}
|
|
238
297
|
for (const { handler, state } of toCreate) {
|
|
239
|
-
this.
|
|
298
|
+
this.insertSingleElement(handler, state);
|
|
240
299
|
}
|
|
241
300
|
}
|
|
242
|
-
|
|
301
|
+
insertSingleElement(handler, state) {
|
|
243
302
|
const { source, properties, transform, visibility, transparency, blend, hsl, zIndex } = state;
|
|
244
|
-
let newMeshIndex = this.
|
|
245
|
-
for (let i = 0; i < this.
|
|
246
|
-
const mesh = this.
|
|
303
|
+
let newMeshIndex = this.orderedMeshes.length;
|
|
304
|
+
for (let i = 0; i < this.orderedMeshes.length; i++) {
|
|
305
|
+
const mesh = this.orderedMeshes[i];
|
|
247
306
|
if (mesh.instancesCount === 0) {
|
|
248
307
|
continue;
|
|
249
308
|
}
|
|
@@ -255,13 +314,13 @@ class UIPlaneRegistry {
|
|
|
255
314
|
}
|
|
256
315
|
if (zIndex <= meshMaxZ) {
|
|
257
316
|
if (mesh.isCompatibleWith(source, properties, transparency)) {
|
|
258
|
-
const instanceIndex = this.
|
|
317
|
+
const instanceIndex = this.findInstanceIndexInMesh(mesh, zIndex);
|
|
259
318
|
mesh.insertAt(instanceIndex, properties, transform, visibility, blend, hsl);
|
|
260
|
-
this.
|
|
261
|
-
this.
|
|
319
|
+
this.shiftHandlerIndices(mesh, instanceIndex, 1);
|
|
320
|
+
this.handlerToDescriptor.set(handler, { mesh, instanceIndex });
|
|
262
321
|
return;
|
|
263
322
|
}
|
|
264
|
-
const splitIndex = this.
|
|
323
|
+
const splitIndex = this.findInstanceIndexInMesh(mesh, zIndex);
|
|
265
324
|
if (splitIndex === 0) {
|
|
266
325
|
newMeshIndex = i;
|
|
267
326
|
}
|
|
@@ -269,7 +328,7 @@ class UIPlaneRegistry {
|
|
|
269
328
|
newMeshIndex = i + 1;
|
|
270
329
|
}
|
|
271
330
|
else {
|
|
272
|
-
this.
|
|
331
|
+
this.splitMeshAt(i, mesh, splitIndex);
|
|
273
332
|
newMeshIndex = i + 1;
|
|
274
333
|
}
|
|
275
334
|
break;
|
|
@@ -278,31 +337,57 @@ class UIPlaneRegistry {
|
|
|
278
337
|
}
|
|
279
338
|
const mesh = new UIGenericInstancedPlane(source, cloneGLProperties(properties), transparency);
|
|
280
339
|
mesh.insertAt(0, properties, transform, visibility, blend, hsl);
|
|
281
|
-
this.
|
|
282
|
-
this.
|
|
283
|
-
this.
|
|
340
|
+
this.orderedMeshes.splice(newMeshIndex, 0, mesh);
|
|
341
|
+
this.scene.add(mesh);
|
|
342
|
+
this.handlerToDescriptor.set(handler, { mesh, instanceIndex: 0 });
|
|
284
343
|
}
|
|
285
344
|
/**
|
|
286
345
|
* Split an existing mesh at the given instance index, inserting the tail half as a
|
|
287
346
|
* new mesh immediately after it in render order. Descriptors are remapped to follow
|
|
288
347
|
* their instances into the new mesh.
|
|
289
348
|
*/
|
|
290
|
-
|
|
349
|
+
splitMeshAt(meshIndex, mesh, splitIndex) {
|
|
291
350
|
const tail = mesh.split(splitIndex);
|
|
292
|
-
for (const descriptor of this.
|
|
351
|
+
for (const descriptor of this.handlerToDescriptor.values()) {
|
|
293
352
|
if (descriptor.mesh === mesh && descriptor.instanceIndex >= splitIndex) {
|
|
294
353
|
descriptor.mesh = tail;
|
|
295
354
|
descriptor.instanceIndex -= splitIndex;
|
|
296
355
|
}
|
|
297
356
|
}
|
|
298
|
-
this.
|
|
299
|
-
this.
|
|
357
|
+
this.orderedMeshes.splice(meshIndex + 1, 0, tail);
|
|
358
|
+
this.scene.add(tail);
|
|
300
359
|
}
|
|
301
|
-
|
|
360
|
+
/**
|
|
361
|
+
* Splits every mesh that spans the depth of an ordered object. Runs after all inserts, since
|
|
362
|
+
* an object may move into a mesh whose planes stayed in place.
|
|
363
|
+
*/
|
|
364
|
+
splitAtObjects() {
|
|
365
|
+
for (const depth of this.objectToDepth.values()) {
|
|
366
|
+
for (let i = 0; i < this.orderedMeshes.length; i++) {
|
|
367
|
+
const mesh = this.orderedMeshes[i];
|
|
368
|
+
if (mesh.instancesCount < 2) {
|
|
369
|
+
continue;
|
|
370
|
+
}
|
|
371
|
+
if (mesh.getZIndexAt(0) <= depth && depth < mesh.getZIndexAt(mesh.instancesCount - 1)) {
|
|
372
|
+
this.splitMeshAt(i, mesh, this.findInstanceIndexInMesh(mesh, depth));
|
|
373
|
+
break;
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
hasObjectBetween(minZ, maxZ) {
|
|
379
|
+
for (const depth of this.objectToDepth.values()) {
|
|
380
|
+
if (minZ <= depth && depth < maxZ) {
|
|
381
|
+
return true;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return false;
|
|
385
|
+
}
|
|
386
|
+
mergeCompatibleNeighbors() {
|
|
302
387
|
let i = 0;
|
|
303
|
-
while (i < this.
|
|
304
|
-
const left = this.
|
|
305
|
-
const right = this.
|
|
388
|
+
while (i < this.orderedMeshes.length - 1) {
|
|
389
|
+
const left = this.orderedMeshes[i];
|
|
390
|
+
const right = this.orderedMeshes[i + 1];
|
|
306
391
|
if (left.instancesCount === 0 || right.instancesCount === 0) {
|
|
307
392
|
i++;
|
|
308
393
|
continue;
|
|
@@ -310,36 +395,37 @@ class UIPlaneRegistry {
|
|
|
310
395
|
const leftMaxZ = left.getZIndexAt(left.instancesCount - 1);
|
|
311
396
|
const rightMinZ = right.getZIndexAt(0);
|
|
312
397
|
if (leftMaxZ < rightMinZ &&
|
|
398
|
+
!this.hasObjectBetween(leftMaxZ, rightMinZ) &&
|
|
313
399
|
left.isCompatibleWith(right.source, right.getProperties(), right.transparency)) {
|
|
314
400
|
const indexOffset = left.instancesCount;
|
|
315
401
|
left.merge(right);
|
|
316
|
-
this.
|
|
317
|
-
this.
|
|
402
|
+
this.remapHandlersAfterMerge(right, left, indexOffset);
|
|
403
|
+
this.scene.remove(right);
|
|
318
404
|
right.destroy();
|
|
319
|
-
this.
|
|
405
|
+
this.orderedMeshes.splice(i + 1, 1);
|
|
320
406
|
continue;
|
|
321
407
|
}
|
|
322
408
|
i++;
|
|
323
409
|
}
|
|
324
410
|
}
|
|
325
|
-
|
|
326
|
-
for (let i = this.
|
|
327
|
-
const mesh = this.
|
|
411
|
+
cleanupEmptyMeshes() {
|
|
412
|
+
for (let i = this.orderedMeshes.length - 1; i >= 0; i--) {
|
|
413
|
+
const mesh = this.orderedMeshes[i];
|
|
328
414
|
if (mesh.instancesCount === 0) {
|
|
329
|
-
this.
|
|
415
|
+
this.scene.remove(mesh);
|
|
330
416
|
mesh.destroy();
|
|
331
|
-
this.
|
|
417
|
+
this.orderedMeshes.splice(i, 1);
|
|
332
418
|
}
|
|
333
419
|
}
|
|
334
420
|
}
|
|
335
|
-
|
|
336
|
-
const state = this.
|
|
421
|
+
resolveState(handler) {
|
|
422
|
+
const state = this.handlerToState.get(handler);
|
|
337
423
|
if (!state) {
|
|
338
|
-
throw new Error(`UIPlaneRegistry.resolveState: handler ${handler} not found`);
|
|
424
|
+
throw new Error(`UIPlaneRegistry.resolveState: handler ${handler} not found; its element may be destroyed`);
|
|
339
425
|
}
|
|
340
426
|
return state;
|
|
341
427
|
}
|
|
342
|
-
|
|
428
|
+
findInstanceIndexInMesh(mesh, zIndex) {
|
|
343
429
|
for (let i = 0; i < mesh.instancesCount; i++) {
|
|
344
430
|
if (mesh.getZIndexAt(i) > zIndex) {
|
|
345
431
|
return i;
|
|
@@ -347,31 +433,39 @@ class UIPlaneRegistry {
|
|
|
347
433
|
}
|
|
348
434
|
return mesh.instancesCount;
|
|
349
435
|
}
|
|
350
|
-
|
|
351
|
-
for (const descriptor of this.
|
|
436
|
+
shiftHandlerIndices(mesh, fromIndex, delta) {
|
|
437
|
+
for (const descriptor of this.handlerToDescriptor.values()) {
|
|
352
438
|
if (descriptor.mesh === mesh && descriptor.instanceIndex >= fromIndex) {
|
|
353
439
|
descriptor.instanceIndex += delta;
|
|
354
440
|
}
|
|
355
441
|
}
|
|
356
442
|
}
|
|
357
|
-
|
|
358
|
-
for (const descriptor of this.
|
|
443
|
+
remapHandlersAfterMerge(fromMesh, toMesh, indexOffset) {
|
|
444
|
+
for (const descriptor of this.handlerToDescriptor.values()) {
|
|
359
445
|
if (descriptor.mesh === fromMesh) {
|
|
360
446
|
descriptor.mesh = toMesh;
|
|
361
447
|
descriptor.instanceIndex += indexOffset;
|
|
362
448
|
}
|
|
363
449
|
}
|
|
364
450
|
}
|
|
365
|
-
|
|
366
|
-
this.
|
|
451
|
+
syncSceneOrder() {
|
|
452
|
+
this.orderedMeshes.sort((a, b) => {
|
|
367
453
|
const aZ = a.instancesCount > 0 ? a.getZIndexAt(0) : 0;
|
|
368
454
|
const bZ = b.instancesCount > 0 ? b.getZIndexAt(0) : 0;
|
|
369
455
|
return aZ - bZ;
|
|
370
456
|
});
|
|
371
|
-
|
|
372
|
-
|
|
457
|
+
const objects = [...this.objectToDepth].sort((a, b) => a[1] - b[1]);
|
|
458
|
+
let objectIndex = 0;
|
|
459
|
+
let renderOrder = 0;
|
|
460
|
+
for (const mesh of this.orderedMeshes) {
|
|
461
|
+
const meshZ = mesh.instancesCount > 0 ? mesh.getZIndexAt(0) : 0;
|
|
462
|
+
while (objectIndex < objects.length && objects[objectIndex][1] < meshZ) {
|
|
463
|
+
objects[objectIndex++][0].renderOrder = renderOrder++;
|
|
464
|
+
}
|
|
465
|
+
mesh.renderOrder = renderOrder++;
|
|
466
|
+
}
|
|
467
|
+
while (objectIndex < objects.length) {
|
|
468
|
+
objects[objectIndex++][0].renderOrder = renderOrder++;
|
|
373
469
|
}
|
|
374
470
|
}
|
|
375
471
|
}
|
|
376
|
-
|
|
377
|
-
export { UIPlaneRegistry };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IUniform, ShaderMaterial } from "three";
|
|
2
2
|
import { Matrix3, Matrix4, Texture, Vector2, Vector3, Vector4 } from "three";
|
|
3
|
-
import type { UITransparencyMode } from "../UITransparencyMode";
|
|
4
|
-
import { UIColor } from "../color/UIColor";
|
|
3
|
+
import type { UITransparencyMode } from "../UITransparencyMode.js";
|
|
4
|
+
import { UIColor } from "../color/UIColor.js";
|
|
5
5
|
export type UIProperty = Texture | UIColor | Vector2 | Vector3 | Vector4 | Matrix3 | Matrix4 | number;
|
|
6
6
|
export type UIPropertyName = "Texture" | "UIColor" | "Vector2" | "Vector3" | "Vector4" | "Matrix3" | "Matrix4" | "number";
|
|
7
7
|
export type UIPropertyConstructor = typeof Texture | typeof UIColor | typeof Vector2 | typeof Vector3 | typeof Vector4 | typeof Matrix3 | typeof Matrix4 | NumberConstructor;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Texture, Vector2, Vector3, Vector4
|
|
2
|
-
import { UIColor } from
|
|
3
|
-
import { checkSRGBSupport } from
|
|
4
|
-
|
|
1
|
+
import { Matrix3, Matrix4, Texture, Vector2, Vector3, Vector4 } from "three";
|
|
2
|
+
import { UIColor } from "../color/UIColor.js";
|
|
3
|
+
import { checkSRGBSupport } from "../webglCapabilities.js";
|
|
5
4
|
const GLSL_TYPE_INFO_FLOAT = Object.freeze({
|
|
6
5
|
glslTypeName: "float",
|
|
7
6
|
bufferSize: 1,
|
|
@@ -37,7 +36,7 @@ const GLSL_TYPE_INFO_MAT4 = Object.freeze({
|
|
|
37
36
|
bufferSize: 16,
|
|
38
37
|
instantiable: true,
|
|
39
38
|
});
|
|
40
|
-
function resolveGLSLTypeInfo(value) {
|
|
39
|
+
export function resolveGLSLTypeInfo(value) {
|
|
41
40
|
if (typeof value === "string") {
|
|
42
41
|
switch (value) {
|
|
43
42
|
case "number":
|
|
@@ -57,7 +56,7 @@ function resolveGLSLTypeInfo(value) {
|
|
|
57
56
|
case "Matrix4":
|
|
58
57
|
return GLSL_TYPE_INFO_MAT4;
|
|
59
58
|
default:
|
|
60
|
-
throw new Error(`resolveGLSLTypeInfo.value: unsupported property type name`);
|
|
59
|
+
throw new Error(`resolveGLSLTypeInfo.value: unsupported property type name "${value}"`);
|
|
61
60
|
}
|
|
62
61
|
}
|
|
63
62
|
if (typeof value === "function") {
|
|
@@ -85,7 +84,7 @@ function resolveGLSLTypeInfo(value) {
|
|
|
85
84
|
if (value === Matrix4) {
|
|
86
85
|
return GLSL_TYPE_INFO_MAT4;
|
|
87
86
|
}
|
|
88
|
-
throw new Error(`resolveGLSLTypeInfo.value: unsupported property type constructor`);
|
|
87
|
+
throw new Error(`resolveGLSLTypeInfo.value: unsupported property type constructor ${value.name}`);
|
|
89
88
|
}
|
|
90
89
|
if (typeof value === "number") {
|
|
91
90
|
return GLSL_TYPE_INFO_FLOAT;
|
|
@@ -113,14 +112,14 @@ function resolveGLSLTypeInfo(value) {
|
|
|
113
112
|
}
|
|
114
113
|
throw new Error(`resolveGLSLTypeInfo.value: unsupported property type`);
|
|
115
114
|
}
|
|
116
|
-
function resolvePropertyUniform(name, material) {
|
|
115
|
+
export function resolvePropertyUniform(name, material) {
|
|
117
116
|
const uniform = material.uniforms[`p_${name}`];
|
|
118
117
|
if (uniform === undefined) {
|
|
119
|
-
throw new Error(`resolvePropertyUniform.name: unknown uniform`);
|
|
118
|
+
throw new Error(`resolvePropertyUniform.name: unknown uniform "p_${name}"`);
|
|
120
119
|
}
|
|
121
120
|
return uniform;
|
|
122
121
|
}
|
|
123
|
-
function arePropertiesPartiallyCompatible(full, partial) {
|
|
122
|
+
export function arePropertiesPartiallyCompatible(full, partial) {
|
|
124
123
|
for (const key in partial) {
|
|
125
124
|
if (!(key in full)) {
|
|
126
125
|
return false;
|
|
@@ -136,7 +135,7 @@ function arePropertiesPartiallyCompatible(full, partial) {
|
|
|
136
135
|
}
|
|
137
136
|
return true;
|
|
138
137
|
}
|
|
139
|
-
function convertUIPropertiesToGLProperties(uiProperties) {
|
|
138
|
+
export function convertUIPropertiesToGLProperties(uiProperties) {
|
|
140
139
|
const glProperties = {};
|
|
141
140
|
for (const name in uiProperties) {
|
|
142
141
|
const value = uiProperties[name];
|
|
@@ -144,20 +143,20 @@ function convertUIPropertiesToGLProperties(uiProperties) {
|
|
|
144
143
|
}
|
|
145
144
|
return glProperties;
|
|
146
145
|
}
|
|
147
|
-
function cloneProperty(property) {
|
|
146
|
+
export function cloneProperty(property) {
|
|
148
147
|
if (typeof property === "number" || property instanceof Texture) {
|
|
149
148
|
return property;
|
|
150
149
|
}
|
|
151
150
|
return property.clone();
|
|
152
151
|
}
|
|
153
|
-
function cloneProperties(properties) {
|
|
152
|
+
export function cloneProperties(properties) {
|
|
154
153
|
const result = {};
|
|
155
154
|
for (const name in properties) {
|
|
156
155
|
result[name] = cloneProperty(properties[name]);
|
|
157
156
|
}
|
|
158
157
|
return result;
|
|
159
158
|
}
|
|
160
|
-
function cloneGLProperties(properties) {
|
|
159
|
+
export function cloneGLProperties(properties) {
|
|
161
160
|
const result = {};
|
|
162
161
|
for (const name in properties) {
|
|
163
162
|
const prop = properties[name];
|
|
@@ -169,14 +168,14 @@ function cloneGLProperties(properties) {
|
|
|
169
168
|
return result;
|
|
170
169
|
}
|
|
171
170
|
/** Extracts zIndex from transform matrix (translation.z component) */
|
|
172
|
-
function extractZIndex(transform) {
|
|
171
|
+
export function extractZIndex(transform) {
|
|
173
172
|
return transform.elements[14];
|
|
174
173
|
}
|
|
175
174
|
/** Extracts zIndex from transform buffer at given instance index */
|
|
176
|
-
function extractZIndexFromBuffer(buffer, instanceIndex) {
|
|
175
|
+
export function extractZIndexFromBuffer(buffer, instanceIndex) {
|
|
177
176
|
return buffer[instanceIndex * 16 + 14];
|
|
178
177
|
}
|
|
179
|
-
function buildGenericPlaneFragmentShader(uniformDeclarations, varyingDeclarations, source, alphaTestValue, usePremultipliedAlpha) {
|
|
178
|
+
export function buildGenericPlaneFragmentShader(uniformDeclarations, varyingDeclarations, source, alphaTestValue, usePremultipliedAlpha) {
|
|
180
179
|
return `
|
|
181
180
|
// Defines
|
|
182
181
|
#define PI 3.14159265359
|
|
@@ -287,5 +286,3 @@ function buildGenericPlaneFragmentShader(uniformDeclarations, varyingDeclaration
|
|
|
287
286
|
}
|
|
288
287
|
`;
|
|
289
288
|
}
|
|
290
|
-
|
|
291
|
-
export { arePropertiesPartiallyCompatible, buildGenericPlaneFragmentShader, cloneGLProperties, cloneProperties, cloneProperty, convertUIPropertiesToGLProperties, extractZIndex, extractZIndexFromBuffer, resolveGLSLTypeInfo, resolvePropertyUniform };
|