laymur 0.23.0 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.d.ts +3 -3
- package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.js +14 -16
- package/dist/core/constraints/UIConstraint.d.ts +22 -2
- package/dist/core/constraints/UIConstraint.js +26 -3
- package/dist/core/constraints/UICustomConstraint.d.ts +4 -4
- package/dist/core/constraints/UICustomConstraint.js +15 -15
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.d.ts +3 -3
- package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.js +11 -13
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.js +1 -3
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +3 -3
- package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js +30 -30
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.js +2 -4
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +3 -3
- package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +40 -39
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +3 -3
- package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js +13 -15
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts +3 -3
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.js +1 -0
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +13 -7
- package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.js +37 -30
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.js +1 -3
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +3 -3
- package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js +30 -30
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.js +2 -4
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +3 -3
- package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +40 -39
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +3 -3
- package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js +13 -15
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.d.ts +1 -1
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.js +1 -0
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.d.ts +3 -3
- package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.js +11 -13
- package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.d.ts +3 -3
- package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.js +1 -3
- package/dist/core/constraints/builders/UIConstraint2DBuilder.d.ts +11 -11
- package/dist/core/constraints/builders/UIConstraint2DBuilder.js +10 -13
- package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.d.ts +1 -1
- package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.js +1 -3
- package/dist/core/constraints/builders/UICoverConstraintBuilder.d.ts +7 -7
- package/dist/core/constraints/builders/UICoverConstraintBuilder.js +10 -13
- package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.d.ts +1 -1
- package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.js +1 -3
- package/dist/core/constraints/builders/UIFitConstraintBuilder.d.ts +7 -7
- package/dist/core/constraints/builders/UIFitConstraintBuilder.js +10 -13
- package/dist/core/elements/UIAnchor/UIAnchor.Internal.js +3 -5
- package/dist/core/elements/UIAnchor/UIAnchor.d.ts +23 -5
- package/dist/core/elements/UIAnchor/UIAnchor.js +42 -8
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +2 -2
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.js +4 -6
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.d.ts +10 -10
- package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.js +108 -111
- package/dist/core/elements/UIDummy/UIDummy.Internal.d.ts +4 -4
- package/dist/core/elements/UIDummy/UIDummy.Internal.js +5 -8
- package/dist/core/elements/UIDummy/UIDummy.d.ts +19 -11
- package/dist/core/elements/UIDummy/UIDummy.js +59 -42
- package/dist/core/elements/UIElement/UIElement.Internal.d.ts +5 -5
- package/dist/core/elements/UIElement/UIElement.Internal.js +9 -12
- package/dist/core/elements/UIElement/UIElement.d.ts +11 -11
- package/dist/core/elements/UIElement/UIElement.js +57 -60
- package/dist/core/elements/UIGraphics/UIGraphics.Internal.d.ts +3 -3
- package/dist/core/elements/UIGraphics/UIGraphics.Internal.js +4 -7
- package/dist/core/elements/UIGraphics/UIGraphics.d.ts +7 -7
- package/dist/core/elements/UIGraphics/UIGraphics.js +44 -47
- package/dist/core/elements/UIImage/UIImage.Internal.d.ts +2 -2
- package/dist/core/elements/UIImage/UIImage.Internal.js +1 -0
- package/dist/core/elements/UIImage/UIImage.d.ts +9 -9
- package/dist/core/elements/UIImage/UIImage.js +21 -24
- package/dist/core/elements/UINineSlice/UINineSlice.Internal.d.ts +3 -3
- package/dist/core/elements/UINineSlice/UINineSlice.Internal.js +3 -5
- package/dist/core/elements/UINineSlice/UINineSlice.d.ts +12 -12
- package/dist/core/elements/UINineSlice/UINineSlice.js +71 -73
- package/dist/core/elements/UIProgress/UIProgress.Internal.d.ts +3 -4
- package/dist/core/elements/UIProgress/UIProgress.Internal.js +1 -3
- package/dist/core/elements/UIProgress/UIProgress.d.ts +10 -10
- package/dist/core/elements/UIProgress/UIProgress.js +59 -62
- package/dist/core/elements/UIScene/UIScene.Internal.d.ts +3 -3
- package/dist/core/elements/UIScene/UIScene.Internal.js +11 -14
- package/dist/core/elements/UIScene/UIScene.d.ts +8 -8
- package/dist/core/elements/UIScene/UIScene.js +68 -69
- package/dist/core/elements/UIText/UIText.Bidi.d.ts +2 -2
- package/dist/core/elements/UIText/UIText.Bidi.js +3 -5
- package/dist/core/elements/UIText/UIText.Interfaces.d.ts +6 -2
- package/dist/core/elements/UIText/UIText.Interfaces.js +1 -0
- package/dist/core/elements/UIText/UIText.Internal.d.ts +4 -4
- package/dist/core/elements/UIText/UIText.Internal.js +5 -7
- package/dist/core/elements/UIText/UIText.Measuring.d.ts +14 -7
- package/dist/core/elements/UIText/UIText.Measuring.js +115 -55
- package/dist/core/elements/UIText/UIText.Rendering.d.ts +3 -3
- package/dist/core/elements/UIText/UIText.Rendering.js +6 -9
- package/dist/core/elements/UIText/UIText.d.ts +28 -14
- package/dist/core/elements/UIText/UIText.js +181 -141
- package/dist/core/index.d.ts +55 -54
- package/dist/core/index.js +53 -0
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts +4 -4
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.js +2 -5
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.d.ts +4 -4
- package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.js +43 -42
- package/dist/core/layers/UILayer/UILayer.Internal.d.ts +2 -2
- package/dist/core/layers/UILayer/UILayer.Internal.js +4 -7
- package/dist/core/layers/UILayer/UILayer.d.ts +19 -4
- package/dist/core/layers/UILayer/UILayer.js +125 -62
- package/dist/core/miscellaneous/UIBlendMode.js +1 -3
- package/dist/core/miscellaneous/UIExpression.js +16 -19
- package/dist/core/miscellaneous/UIMode.js +3 -5
- package/dist/core/miscellaneous/UIOrientation.js +2 -4
- package/dist/core/miscellaneous/UIPriority.js +5 -8
- package/dist/core/miscellaneous/UIRelation.js +5 -8
- package/dist/core/miscellaneous/UITransparencyMode.js +1 -3
- package/dist/core/miscellaneous/area/UIArea.js +1 -3
- package/dist/core/miscellaneous/area/UIAreaCircle.d.ts +1 -1
- package/dist/core/miscellaneous/area/UIAreaCircle.js +3 -6
- package/dist/core/miscellaneous/area/UIAreaPolygon.d.ts +2 -2
- package/dist/core/miscellaneous/area/UIAreaPolygon.js +3 -6
- package/dist/core/miscellaneous/area/UIAreaRectangle.d.ts +1 -1
- package/dist/core/miscellaneous/area/UIAreaRectangle.js +3 -6
- package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.d.ts +1 -1
- package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.js +3 -6
- package/dist/core/miscellaneous/asserts.d.ts +30 -1
- package/dist/core/miscellaneous/asserts.js +87 -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 +10 -5
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.js +63 -58
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Layout.d.ts +52 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Layout.js +110 -0
- package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js +181 -261
- 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 +209 -115
- package/dist/core/miscellaneous/generic-plane/shared.d.ts +12 -12
- package/dist/core/miscellaneous/generic-plane/shared.js +28 -23
- package/dist/core/miscellaneous/insets/UIInsets.Internal.js +1 -3
- package/dist/core/miscellaneous/insets/UIInsets.d.ts +1 -1
- package/dist/core/miscellaneous/insets/UIInsets.js +96 -99
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.js +1 -3
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +1 -1
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +14 -17
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.d.ts +2 -2
- package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js +13 -16
- package/dist/core/miscellaneous/math.js +3 -5
- package/dist/core/miscellaneous/micro/UIMicro.Internal.js +6 -8
- package/dist/core/miscellaneous/micro/UIMicro.d.ts +1 -1
- package/dist/core/miscellaneous/micro/UIMicro.js +91 -94
- package/dist/core/miscellaneous/resize-policy/UIResizePolicy.js +1 -3
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.js +12 -15
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.js +13 -16
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.js +13 -16
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.js +12 -15
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.js +13 -16
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.js +13 -16
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.d.ts +1 -1
- package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.js +3 -6
- package/dist/core/miscellaneous/shared.d.ts +1 -1
- package/dist/core/miscellaneous/shared.js +4 -7
- package/dist/core/miscellaneous/text-span/UITextSpan.Internal.d.ts +1 -1
- package/dist/core/miscellaneous/text-span/UITextSpan.Internal.js +1 -0
- package/dist/core/miscellaneous/text-span/UITextSpan.d.ts +2 -2
- package/dist/core/miscellaneous/text-span/UITextSpan.js +10 -13
- package/dist/core/miscellaneous/text-style/UITextStyle.Internal.js +15 -17
- package/dist/core/miscellaneous/text-style/UITextStyle.d.ts +13 -2
- package/dist/core/miscellaneous/text-style/UITextStyle.js +222 -207
- package/dist/core/miscellaneous/texture/UITextureView.Internal.d.ts +7 -0
- package/dist/core/miscellaneous/texture/UITextureView.Internal.js +16 -6
- package/dist/core/miscellaneous/texture/UITextureView.d.ts +1 -1
- package/dist/core/miscellaneous/texture/UITextureView.js +113 -117
- package/dist/core/miscellaneous/webglCapabilities.js +3 -4
- package/dist/core/shaders/UIImage.d.ts +9 -0
- package/dist/core/shaders/UIImage.js +14 -0
- package/dist/core/shaders/UINineSlice.d.ts +11 -0
- package/dist/core/shaders/UINineSlice.js +57 -0
- package/dist/core/shaders/UIProgress.d.ts +14 -0
- package/dist/core/shaders/UIProgress.js +21 -0
- package/dist/core/shaders/UIProgressMaskFunctionCircular.d.ts +2 -0
- package/dist/core/shaders/UIProgressMaskFunctionCircular.js +16 -0
- package/dist/core/shaders/UIProgressMaskFunctionDirectional.d.ts +2 -0
- package/dist/core/shaders/UIProgressMaskFunctionDirectional.js +15 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.d.ts +4 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.js +1 -0
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.d.ts +7 -1
- package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +50 -47
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.d.ts +5 -2
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.js +1 -0
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.d.ts +11 -3
- package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.js +42 -26
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.d.ts +5 -3
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.js +1 -0
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.d.ts +20 -4
- package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +138 -117
- package/dist/debug/UIAspectDebug.d.ts +3 -3
- package/dist/debug/UIAspectDebug.js +64 -68
- package/dist/debug/UIConstraintDebug.d.ts +1 -1
- package/dist/debug/UIConstraintDebug.js +1 -0
- package/dist/debug/UIHeightDebug.d.ts +3 -3
- package/dist/debug/UIHeightDebug.js +63 -67
- package/dist/debug/UIHorizontalDistanceDebug.d.ts +3 -3
- package/dist/debug/UIHorizontalDistanceDebug.js +76 -81
- package/dist/debug/UIHorizontalInterpolationDebug.d.ts +3 -3
- package/dist/debug/UIHorizontalInterpolationDebug.js +74 -78
- package/dist/debug/UILayerDebug.d.ts +1 -1
- package/dist/debug/UILayerDebug.js +55 -64
- package/dist/debug/UIVerticalDistanceDebug.d.ts +3 -3
- package/dist/debug/UIVerticalDistanceDebug.js +76 -81
- package/dist/debug/UIVerticalInterpolationDebug.d.ts +3 -3
- package/dist/debug/UIVerticalInterpolationDebug.js +74 -78
- package/dist/debug/UIWidthDebug.d.ts +3 -3
- package/dist/debug/UIWidthDebug.js +63 -67
- package/dist/debug/index.d.ts +8 -8
- package/dist/debug/index.js +8 -8
- package/dist/debug/miscellaneous.js +8 -11
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.d.ts +3 -3
- package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.js +13 -16
- package/dist/particles/behaviorModules/UIBehaviorModule.d.ts +1 -1
- package/dist/particles/behaviorModules/UIBehaviorModule.js +1 -3
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.d.ts +3 -3
- package/dist/particles/behaviorModules/UIBehaviorPointGravity.js +37 -40
- package/dist/particles/behaviorModules/UIBehaviorScaleOscillation.d.ts +41 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOscillation.js +87 -0
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +17 -20
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.js +13 -16
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.js +21 -24
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.js +13 -16
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.d.ts +2 -2
- package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.js +21 -24
- package/dist/particles/elements/UIEmitter.Internal.d.ts +2 -2
- package/dist/particles/elements/UIEmitter.Internal.js +6 -9
- package/dist/particles/elements/UIEmitter.d.ts +17 -11
- package/dist/particles/elements/UIEmitter.js +100 -88
- package/dist/particles/index.d.ts +20 -18
- package/dist/particles/index.js +19 -18
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +1 -1
- package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +14 -15
- package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +4 -1
- package/dist/particles/instancedParticle/UIInstancedParticle.js +40 -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/UIGenericInstancedPlane/UIGenericInstancedPlane.js
CHANGED
|
@@ -1,36 +1,25 @@
|
|
|
1
|
-
import { Mesh
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { Mesh } from "three";
|
|
2
|
+
import { assertVertexAttributeBudget } from "../../asserts.js";
|
|
3
|
+
import { arePropertiesPartiallyCompatible, cloneGLProperties, resolvePropertyUniform, TRANSFORM_ZINDEX_OFFSET, } from "../shared.js";
|
|
4
|
+
import { BUILTIN_BLEND, BUILTIN_HSL, BUILTIN_TRANSFORM, BUILTIN_VISIBILITY, buildMaterial, buildPackedAttribute, buildPlaneLayout, CAPACITY_STEP, copyBetweenBuffers, INITIAL_CAPACITY, INSTANCED_PLANE_GEOMETRY, shiftBufferRegion, writePropertyToArray, } from "./UIGenericInstancedPlane.Internal.js";
|
|
5
|
+
import { packedAttributeName, resolvePackedField } from "./UIGenericInstancedPlane.Layout.js";
|
|
6
|
+
const TEMP_FIELD_VALUES = new Float32Array(16);
|
|
5
7
|
/**
|
|
6
8
|
* Instanced shader plane mesh for batched rendering.
|
|
7
9
|
*
|
|
8
10
|
* Operates on indices, not handlers. Registry manages handler->index mapping.
|
|
9
11
|
* Elements are ordered by zIndex (ascending) within the buffer.
|
|
10
12
|
*
|
|
13
|
+
* Per-instance data (the builtin transform, visibility, blend and HSL plus every instantiable
|
|
14
|
+
* property) is packed into as few vertex attributes as possible, see
|
|
15
|
+
* UIGenericInstancedPlane.Layout.ts. The zIndex is read back from the packed transform.
|
|
16
|
+
*
|
|
11
17
|
* @internal
|
|
12
18
|
*/
|
|
13
|
-
class UIGenericInstancedPlane extends Mesh {
|
|
19
|
+
export class UIGenericInstancedPlane extends Mesh {
|
|
14
20
|
constructor(source, properties, transparency, initialCapacity = INITIAL_CAPACITY) {
|
|
15
21
|
const uniformProperties = {};
|
|
16
|
-
const varyingProperties = {
|
|
17
|
-
instanceVisibility: {
|
|
18
|
-
value: 1,
|
|
19
|
-
glslTypeInfo: resolveGLSLTypeInfo("number"),
|
|
20
|
-
},
|
|
21
|
-
instanceTransform: {
|
|
22
|
-
value: new Matrix4().identity(),
|
|
23
|
-
glslTypeInfo: resolveGLSLTypeInfo("Matrix4"),
|
|
24
|
-
},
|
|
25
|
-
instanceBlend: {
|
|
26
|
-
value: 1,
|
|
27
|
-
glslTypeInfo: resolveGLSLTypeInfo("number"),
|
|
28
|
-
},
|
|
29
|
-
instanceHSL: {
|
|
30
|
-
value: new Vector3(0, 1, 0),
|
|
31
|
-
glslTypeInfo: resolveGLSLTypeInfo("Vector3"),
|
|
32
|
-
},
|
|
33
|
-
};
|
|
22
|
+
const varyingProperties = {};
|
|
34
23
|
for (const name in properties) {
|
|
35
24
|
const descriptor = properties[name];
|
|
36
25
|
if (descriptor.glslTypeInfo.instantiable) {
|
|
@@ -40,213 +29,155 @@ class UIGenericInstancedPlane extends Mesh {
|
|
|
40
29
|
uniformProperties[name] = descriptor;
|
|
41
30
|
}
|
|
42
31
|
}
|
|
32
|
+
const layout = buildPlaneLayout(varyingProperties);
|
|
43
33
|
const instancedGeometry = INSTANCED_PLANE_GEOMETRY.clone();
|
|
44
|
-
const shaderMaterial = buildMaterial(source, uniformProperties,
|
|
34
|
+
const shaderMaterial = buildMaterial(source, uniformProperties, layout, transparency);
|
|
45
35
|
super(instancedGeometry, shaderMaterial);
|
|
36
|
+
this.onBeforeRenderInternal = (renderer) => {
|
|
37
|
+
assertVertexAttributeBudget(renderer, this.vertexAttributeCount, this.vertexAttributeSubject);
|
|
38
|
+
};
|
|
46
39
|
this.frustumCulled = false;
|
|
47
40
|
this.matrixAutoUpdate = false;
|
|
48
41
|
this.matrixWorldAutoUpdate = false;
|
|
49
42
|
this.source = source;
|
|
50
43
|
this.transparency = transparency;
|
|
51
|
-
this.
|
|
52
|
-
this.
|
|
53
|
-
this.
|
|
54
|
-
this.
|
|
55
|
-
this.
|
|
56
|
-
this.
|
|
57
|
-
this.
|
|
58
|
-
this.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
44
|
+
this.instancedGeometry = instancedGeometry;
|
|
45
|
+
this.shaderMaterial = shaderMaterial;
|
|
46
|
+
this.properties = properties;
|
|
47
|
+
this.uniformProperties = uniformProperties;
|
|
48
|
+
this.layout = layout;
|
|
49
|
+
this.packedAttributes = [];
|
|
50
|
+
this.transformField = resolvePackedField(layout, BUILTIN_TRANSFORM);
|
|
51
|
+
this.visibilityField = resolvePackedField(layout, BUILTIN_VISIBILITY);
|
|
52
|
+
this.blendField = resolvePackedField(layout, BUILTIN_BLEND);
|
|
53
|
+
this.hslField = resolvePackedField(layout, BUILTIN_HSL);
|
|
54
|
+
const zIndexColumn = this.transformField.columns.find(({ sourceOffset, size }) => sourceOffset <= TRANSFORM_ZINDEX_OFFSET && TRANSFORM_ZINDEX_OFFSET < sourceOffset + size);
|
|
55
|
+
if (zIndexColumn === undefined) {
|
|
56
|
+
throw new Error(`UIGenericInstancedPlane.constructor: transform layout lacks the zIndex`);
|
|
57
|
+
}
|
|
58
|
+
this.zIndexAttributeIndex = zIndexColumn.attributeIndex;
|
|
59
|
+
this.zIndexComponentOffset =
|
|
60
|
+
zIndexColumn.componentOffset + TRANSFORM_ZINDEX_OFFSET - zIndexColumn.sourceOffset;
|
|
61
|
+
this.vertexAttributeCount =
|
|
62
|
+
Object.keys(INSTANCED_PLANE_GEOMETRY.attributes).length + layout.attributeSizes.length;
|
|
63
|
+
this.vertexAttributeSubject = `UIGenericInstancedPlane.onBeforeRender.properties (${Object.keys(varyingProperties).join(", ")})`;
|
|
64
|
+
this.onBeforeRender = this.onBeforeRenderInternal;
|
|
65
|
+
this.capacity = Math.max(Math.ceil(initialCapacity / CAPACITY_STEP) * CAPACITY_STEP, CAPACITY_STEP);
|
|
66
|
+
this.instancesCountInternal = 0;
|
|
67
|
+
this.instancedGeometry.instanceCount = 0;
|
|
68
|
+
for (let i = 0; i < layout.attributeSizes.length; i++) {
|
|
69
|
+
const attribute = buildPackedAttribute(layout.attributeSizes[i], this.capacity);
|
|
70
|
+
this.instancedGeometry.setAttribute(packedAttributeName(i), attribute);
|
|
71
|
+
this.packedAttributes.push(attribute);
|
|
72
|
+
}
|
|
73
|
+
for (const name in this.uniformProperties) {
|
|
74
|
+
const { value } = this.uniformProperties[name];
|
|
75
|
+
const uniform = resolvePropertyUniform(name, this.shaderMaterial);
|
|
68
76
|
uniform.value = value;
|
|
69
77
|
}
|
|
70
|
-
this.
|
|
78
|
+
this.shaderMaterial.uniformsNeedUpdate = true;
|
|
71
79
|
}
|
|
72
80
|
/** Current number of active instances */
|
|
73
81
|
get instancesCount() {
|
|
74
|
-
return this.
|
|
82
|
+
return this.instancesCountInternal;
|
|
75
83
|
}
|
|
76
84
|
/**
|
|
77
85
|
* Insert instance at given index. Elements at [index..end) are shifted right.
|
|
78
86
|
*/
|
|
79
87
|
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.
|
|
82
|
-
}
|
|
83
|
-
this.
|
|
84
|
-
if (index < this.
|
|
85
|
-
this.
|
|
86
|
-
}
|
|
87
|
-
this.
|
|
88
|
-
this.
|
|
89
|
-
this.
|
|
88
|
+
if (index < 0 || index > this.instancesCountInternal) {
|
|
89
|
+
throw new Error(`UIGenericInstancedPlane.insertAt.index: out of bounds (index=${index}, count=${this.instancesCountInternal})`);
|
|
90
|
+
}
|
|
91
|
+
this.ensureCapacity(this.instancesCountInternal + 1);
|
|
92
|
+
if (index < this.instancesCountInternal) {
|
|
93
|
+
this.shiftBuffersRight(index, 1);
|
|
94
|
+
}
|
|
95
|
+
this.writeField(index, this.transformField, transform.elements);
|
|
96
|
+
this.writeVisibility(index, visibility);
|
|
97
|
+
this.writeBlend(index, blend);
|
|
98
|
+
this.writeHSL(index, hsl);
|
|
99
|
+
this.writeProperties(index, properties);
|
|
100
|
+
this.instancesCountInternal++;
|
|
101
|
+
this.instancedGeometry.instanceCount = this.instancesCountInternal;
|
|
90
102
|
}
|
|
91
103
|
/**
|
|
92
104
|
* Remove instance at given index. Elements at [index+1..end) are shifted left.
|
|
93
105
|
*/
|
|
94
106
|
removeAt(index) {
|
|
95
|
-
if (index < 0 || index >= this.
|
|
96
|
-
throw new Error(`UIGenericInstancedPlane.removeAt.index: out of bounds (index=${index}, count=${this.
|
|
107
|
+
if (index < 0 || index >= this.instancesCountInternal) {
|
|
108
|
+
throw new Error(`UIGenericInstancedPlane.removeAt.index: out of bounds (index=${index}, count=${this.instancesCountInternal})`);
|
|
97
109
|
}
|
|
98
|
-
if (index < this.
|
|
99
|
-
this.
|
|
110
|
+
if (index < this.instancesCountInternal - 1) {
|
|
111
|
+
this.shiftBuffersLeft(index + 1, 1);
|
|
100
112
|
}
|
|
101
|
-
this.
|
|
102
|
-
this.
|
|
113
|
+
this.instancesCountInternal--;
|
|
114
|
+
this.instancedGeometry.instanceCount = this.instancesCountInternal;
|
|
103
115
|
}
|
|
104
116
|
/** Update properties at given index */
|
|
105
117
|
setPropertiesAt(index, properties) {
|
|
106
|
-
if (index < 0 || index >= this.
|
|
107
|
-
throw new Error(`UIGenericInstancedPlane.setPropertiesAt.index: out of bounds (index=${index}, count=${this.
|
|
108
|
-
}
|
|
109
|
-
for (const name in properties) {
|
|
110
|
-
const { value, glslTypeInfo } = properties[name];
|
|
111
|
-
if (glslTypeInfo.instantiable) {
|
|
112
|
-
const attribute = this._private_resolveAttribute(name);
|
|
113
|
-
const offset = index * attribute.itemSize;
|
|
114
|
-
writePropertyToArray(value, attribute.array, offset);
|
|
115
|
-
attribute.needsUpdate = true;
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
const uniform = resolvePropertyUniform(name, this._private_shaderMaterial);
|
|
119
|
-
uniform.value = value;
|
|
120
|
-
this._private_shaderMaterial.uniformsNeedUpdate = true;
|
|
121
|
-
}
|
|
118
|
+
if (index < 0 || index >= this.instancesCountInternal) {
|
|
119
|
+
throw new Error(`UIGenericInstancedPlane.setPropertiesAt.index: out of bounds (index=${index}, count=${this.instancesCountInternal})`);
|
|
122
120
|
}
|
|
121
|
+
this.writeProperties(index, properties);
|
|
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.
|
|
128
|
-
}
|
|
129
|
-
const attribute = this._private_resolveAttribute("instanceTransform");
|
|
130
|
-
const array = attribute.array;
|
|
131
|
-
const offset = index * 16;
|
|
132
|
-
const elements = transform.elements;
|
|
133
|
-
for (let j = 0; j < 16; j++) {
|
|
134
|
-
array[offset + j] = elements[j];
|
|
125
|
+
if (index < 0 || index >= this.instancesCountInternal) {
|
|
126
|
+
throw new Error(`UIGenericInstancedPlane.setTransformAt.index: out of bounds (index=${index}, count=${this.instancesCountInternal})`);
|
|
135
127
|
}
|
|
136
|
-
|
|
128
|
+
this.writeField(index, this.transformField, transform.elements);
|
|
137
129
|
}
|
|
138
130
|
/** Update visibility at given index */
|
|
139
131
|
setVisibilityAt(index, visible) {
|
|
140
|
-
if (index < 0 || index >= this.
|
|
141
|
-
throw new Error(`UIGenericInstancedPlane.setVisibilityAt.index: out of bounds (index=${index}, count=${this.
|
|
132
|
+
if (index < 0 || index >= this.instancesCountInternal) {
|
|
133
|
+
throw new Error(`UIGenericInstancedPlane.setVisibilityAt.index: out of bounds (index=${index}, count=${this.instancesCountInternal})`);
|
|
142
134
|
}
|
|
143
|
-
|
|
144
|
-
const array = attribute.array;
|
|
145
|
-
array[index] = visible ? 1 : 0;
|
|
146
|
-
attribute.needsUpdate = true;
|
|
135
|
+
this.writeVisibility(index, visible);
|
|
147
136
|
}
|
|
148
137
|
/** Update blend factor at given index (1 = normal over, 0 = additive) */
|
|
149
138
|
setBlendAt(index, blend) {
|
|
150
|
-
if (index < 0 || index >= this.
|
|
151
|
-
throw new Error(`UIGenericInstancedPlane.setBlendAt.index: out of bounds (index=${index}, count=${this.
|
|
139
|
+
if (index < 0 || index >= this.instancesCountInternal) {
|
|
140
|
+
throw new Error(`UIGenericInstancedPlane.setBlendAt.index: out of bounds (index=${index}, count=${this.instancesCountInternal})`);
|
|
152
141
|
}
|
|
153
|
-
|
|
154
|
-
const array = attribute.array;
|
|
155
|
-
array[index] = blend;
|
|
156
|
-
attribute.needsUpdate = true;
|
|
142
|
+
this.writeBlend(index, blend);
|
|
157
143
|
}
|
|
158
144
|
/** Update HSL adjustment at given index (hue in turns, saturation multiplier, lightness offset) */
|
|
159
145
|
setHSLAt(index, hsl) {
|
|
160
|
-
if (index < 0 || index >= this.
|
|
161
|
-
throw new Error(`UIGenericInstancedPlane.setHSLAt.index: out of bounds (index=${index}, count=${this.
|
|
162
|
-
}
|
|
163
|
-
const attribute = this._private_resolveAttribute("instanceHSL");
|
|
164
|
-
const array = attribute.array;
|
|
165
|
-
const offset = index * 3;
|
|
166
|
-
array[offset] = hsl.h;
|
|
167
|
-
array[offset + 1] = hsl.s;
|
|
168
|
-
array[offset + 2] = hsl.l;
|
|
169
|
-
attribute.needsUpdate = true;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Extract complete instance data at given index.
|
|
173
|
-
* Returns cloned data safe for external use.
|
|
174
|
-
*/
|
|
175
|
-
extractDataAt(index) {
|
|
176
|
-
if (index < 0 || index >= this._private_instancesCountInternal) {
|
|
177
|
-
throw new Error(`UIGenericInstancedPlane.extractDataAt.index: out of bounds (index=${index}, count=${this._private_instancesCountInternal})`);
|
|
178
|
-
}
|
|
179
|
-
const properties = {};
|
|
180
|
-
for (const name in this._private_uniformProperties) {
|
|
181
|
-
const prop = this._private_uniformProperties[name];
|
|
182
|
-
properties[name] = {
|
|
183
|
-
value: cloneProperty(prop.value),
|
|
184
|
-
glslTypeInfo: prop.glslTypeInfo,
|
|
185
|
-
};
|
|
146
|
+
if (index < 0 || index >= this.instancesCountInternal) {
|
|
147
|
+
throw new Error(`UIGenericInstancedPlane.setHSLAt.index: out of bounds (index=${index}, count=${this.instancesCountInternal})`);
|
|
186
148
|
}
|
|
187
|
-
|
|
188
|
-
if (name === "instanceVisibility" ||
|
|
189
|
-
name === "instanceTransform" ||
|
|
190
|
-
name === "instanceBlend" ||
|
|
191
|
-
name === "instanceHSL") {
|
|
192
|
-
continue;
|
|
193
|
-
}
|
|
194
|
-
const { value, glslTypeInfo } = this._private_varyingProperties[name];
|
|
195
|
-
const attribute = this._private_propertyBuffers.get(name);
|
|
196
|
-
const array = attribute.array;
|
|
197
|
-
const offset = index * attribute.itemSize;
|
|
198
|
-
properties[name] = {
|
|
199
|
-
value: reconstructValue(value, array, offset),
|
|
200
|
-
glslTypeInfo,
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
const transformAttribute = this._private_propertyBuffers.get("instanceTransform");
|
|
204
|
-
const transformArray = transformAttribute.array;
|
|
205
|
-
const transform = new Matrix4();
|
|
206
|
-
transform.fromArray(transformArray, index * 16);
|
|
207
|
-
const visibilityAttribute = this._private_propertyBuffers.get("instanceVisibility");
|
|
208
|
-
const visibilityArray = visibilityAttribute.array;
|
|
209
|
-
const visibility = visibilityArray[index] >= 0.5;
|
|
210
|
-
return {
|
|
211
|
-
source: this.source,
|
|
212
|
-
properties,
|
|
213
|
-
transform,
|
|
214
|
-
visibility,
|
|
215
|
-
transparency: this.transparency,
|
|
216
|
-
};
|
|
149
|
+
this.writeHSL(index, hsl);
|
|
217
150
|
}
|
|
218
151
|
/** Get zIndex at given index (from transform buffer) */
|
|
219
152
|
getZIndexAt(index) {
|
|
220
|
-
if (index < 0 || index >= this.
|
|
221
|
-
throw new Error(`UIGenericInstancedPlane.getZIndexAt.index: out of bounds (index=${index}, count=${this.
|
|
153
|
+
if (index < 0 || index >= this.instancesCountInternal) {
|
|
154
|
+
throw new Error(`UIGenericInstancedPlane.getZIndexAt.index: out of bounds (index=${index}, count=${this.instancesCountInternal})`);
|
|
222
155
|
}
|
|
223
|
-
const attribute = this.
|
|
224
|
-
return
|
|
156
|
+
const attribute = this.packedAttributes[this.zIndexAttributeIndex];
|
|
157
|
+
return attribute.array[index * attribute.itemSize + this.zIndexComponentOffset];
|
|
225
158
|
}
|
|
226
159
|
/**
|
|
227
160
|
* Merge another instanced plane into this one (append).
|
|
228
161
|
* Other plane becomes empty after merge.
|
|
229
162
|
*/
|
|
230
163
|
merge(other) {
|
|
231
|
-
if (other.
|
|
164
|
+
if (other.layout.signature !== this.layout.signature) {
|
|
165
|
+
throw new Error(`UIGenericInstancedPlane.merge.other: incompatible attribute layout`);
|
|
166
|
+
}
|
|
167
|
+
if (other.instancesCountInternal === 0) {
|
|
232
168
|
return;
|
|
233
169
|
}
|
|
234
|
-
this.
|
|
235
|
-
for (
|
|
236
|
-
const
|
|
237
|
-
if (!otherAttribute) {
|
|
238
|
-
throw new Error(`UIGenericInstancedPlane.merge: missing attribute ${name} in source`);
|
|
239
|
-
}
|
|
170
|
+
this.ensureCapacity(this.instancesCountInternal + other.instancesCountInternal);
|
|
171
|
+
for (let i = 0; i < this.packedAttributes.length; i++) {
|
|
172
|
+
const thisAttribute = this.packedAttributes[i];
|
|
240
173
|
const itemSize = thisAttribute.itemSize;
|
|
241
|
-
|
|
242
|
-
const dstArray = thisAttribute.array;
|
|
243
|
-
copyBetweenBuffers(srcArray, 0, dstArray, this._private_instancesCountInternal * itemSize, other._private_instancesCountInternal * itemSize);
|
|
174
|
+
copyBetweenBuffers(other.packedAttributes[i].array, 0, thisAttribute.array, this.instancesCountInternal * itemSize, other.instancesCountInternal * itemSize);
|
|
244
175
|
thisAttribute.needsUpdate = true;
|
|
245
176
|
}
|
|
246
|
-
this.
|
|
247
|
-
this.
|
|
248
|
-
other.
|
|
249
|
-
other.
|
|
177
|
+
this.instancesCountInternal += other.instancesCountInternal;
|
|
178
|
+
this.instancedGeometry.instanceCount = this.instancesCountInternal;
|
|
179
|
+
other.instancesCountInternal = 0;
|
|
180
|
+
other.instancedGeometry.instanceCount = 0;
|
|
250
181
|
}
|
|
251
182
|
/**
|
|
252
183
|
* Split this plane at given index.
|
|
@@ -254,140 +185,129 @@ class UIGenericInstancedPlane extends Mesh {
|
|
|
254
185
|
* This plane keeps elements [0..atIndex).
|
|
255
186
|
*/
|
|
256
187
|
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.
|
|
259
|
-
}
|
|
260
|
-
const tailCount = this.
|
|
261
|
-
const newPlane = new UIGenericInstancedPlane(this.source, cloneGLProperties(
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
for (const [name, thisAttribute] of this._private_propertyBuffers) {
|
|
266
|
-
const newAttribute = newPlane._private_propertyBuffers.get(name);
|
|
267
|
-
if (!newAttribute) {
|
|
268
|
-
throw new Error(`UIGenericInstancedPlane.split: missing attribute ${name} in new plane`);
|
|
269
|
-
}
|
|
188
|
+
if (atIndex <= 0 || atIndex >= this.instancesCountInternal) {
|
|
189
|
+
throw new Error(`UIGenericInstancedPlane.split.atIndex: must be in range (0, count) (atIndex=${atIndex}, count=${this.instancesCountInternal})`);
|
|
190
|
+
}
|
|
191
|
+
const tailCount = this.instancesCountInternal - atIndex;
|
|
192
|
+
const newPlane = new UIGenericInstancedPlane(this.source, cloneGLProperties(this.properties), this.transparency, tailCount);
|
|
193
|
+
for (let i = 0; i < this.packedAttributes.length; i++) {
|
|
194
|
+
const thisAttribute = this.packedAttributes[i];
|
|
195
|
+
const newAttribute = newPlane.packedAttributes[i];
|
|
270
196
|
const itemSize = thisAttribute.itemSize;
|
|
271
|
-
|
|
272
|
-
const dstArray = newAttribute.array;
|
|
273
|
-
copyBetweenBuffers(srcArray, atIndex * itemSize, dstArray, 0, tailCount * itemSize);
|
|
197
|
+
copyBetweenBuffers(thisAttribute.array, atIndex * itemSize, newAttribute.array, 0, tailCount * itemSize);
|
|
274
198
|
newAttribute.needsUpdate = true;
|
|
275
199
|
}
|
|
276
|
-
newPlane.
|
|
277
|
-
newPlane.
|
|
278
|
-
this.
|
|
279
|
-
this.
|
|
200
|
+
newPlane.instancesCountInternal = tailCount;
|
|
201
|
+
newPlane.instancedGeometry.instanceCount = tailCount;
|
|
202
|
+
this.instancesCountInternal = atIndex;
|
|
203
|
+
this.instancedGeometry.instanceCount = atIndex;
|
|
280
204
|
return newPlane;
|
|
281
205
|
}
|
|
282
206
|
/**
|
|
283
207
|
* Check if this plane can accept elements with given parameters.
|
|
284
208
|
*/
|
|
285
209
|
isCompatibleWith(source, properties, transparency) {
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
if (this.transparency !== transparency) {
|
|
290
|
-
return false;
|
|
291
|
-
}
|
|
292
|
-
const result = arePropertiesPartiallyCompatible({ ...this._private_uniformProperties, ...this._private_varyingProperties }, properties);
|
|
293
|
-
return result;
|
|
210
|
+
return (this.source === source &&
|
|
211
|
+
this.transparency === transparency &&
|
|
212
|
+
arePropertiesPartiallyCompatible(this.properties, properties));
|
|
294
213
|
}
|
|
295
|
-
/**
|
|
296
|
-
|
|
297
|
-
|
|
214
|
+
/**
|
|
215
|
+
* Check if another plane can be merged into this one: same shader source and transparency, same
|
|
216
|
+
* attribute layout and the same uniform values.
|
|
217
|
+
*/
|
|
218
|
+
canMerge(other) {
|
|
219
|
+
return (this.source === other.source &&
|
|
220
|
+
this.transparency === other.transparency &&
|
|
221
|
+
this.layout.signature === other.layout.signature &&
|
|
222
|
+
arePropertiesPartiallyCompatible(this.uniformProperties, other.uniformProperties) &&
|
|
223
|
+
arePropertiesPartiallyCompatible(other.uniformProperties, this.uniformProperties));
|
|
298
224
|
}
|
|
299
225
|
/** Remove all instances, reset to empty state */
|
|
300
226
|
clearInstances() {
|
|
301
|
-
this.
|
|
302
|
-
this.
|
|
227
|
+
this.instancesCountInternal = 0;
|
|
228
|
+
this.instancedGeometry.instanceCount = 0;
|
|
303
229
|
}
|
|
304
230
|
/** Dispose geometry, material, and clear buffers */
|
|
305
231
|
destroy() {
|
|
306
|
-
this.
|
|
307
|
-
this.
|
|
308
|
-
this.
|
|
232
|
+
this.instancedGeometry.dispose();
|
|
233
|
+
this.shaderMaterial.dispose();
|
|
234
|
+
this.packedAttributes.length = 0;
|
|
309
235
|
}
|
|
310
|
-
|
|
311
|
-
if (requiredCapacity <= this.
|
|
236
|
+
ensureCapacity(requiredCapacity) {
|
|
237
|
+
if (requiredCapacity <= this.capacity) {
|
|
312
238
|
return;
|
|
313
239
|
}
|
|
314
240
|
const newCapacity = Math.ceil(requiredCapacity / CAPACITY_STEP) * CAPACITY_STEP;
|
|
315
|
-
for (
|
|
316
|
-
const
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
this.
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
241
|
+
for (let i = 0; i < this.packedAttributes.length; i++) {
|
|
242
|
+
const oldAttribute = this.packedAttributes[i];
|
|
243
|
+
const newAttribute = buildPackedAttribute(oldAttribute.itemSize, newCapacity);
|
|
244
|
+
newAttribute.array.set(oldAttribute.array);
|
|
245
|
+
this.instancedGeometry.setAttribute(packedAttributeName(i), newAttribute);
|
|
246
|
+
this.packedAttributes[i] = newAttribute;
|
|
247
|
+
}
|
|
248
|
+
this.capacity = newCapacity;
|
|
249
|
+
// three.js caches the drawable instance count from the attribute sizes on the first render and
|
|
250
|
+
// only resets it on dispose; without this a grown plane keeps drawing the old capacity
|
|
251
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- private three.js field
|
|
252
|
+
this.instancedGeometry._maxInstanceCount = newCapacity;
|
|
324
253
|
}
|
|
325
|
-
|
|
326
|
-
const elementsToMove = this.
|
|
254
|
+
shiftBuffersRight(fromIndex, delta) {
|
|
255
|
+
const elementsToMove = this.instancesCountInternal - fromIndex;
|
|
327
256
|
if (elementsToMove <= 0) {
|
|
328
257
|
return;
|
|
329
258
|
}
|
|
330
|
-
for (const attribute of this.
|
|
259
|
+
for (const attribute of this.packedAttributes) {
|
|
331
260
|
shiftBufferRegion(attribute.array, attribute.itemSize, fromIndex, elementsToMove, delta);
|
|
332
261
|
attribute.needsUpdate = true;
|
|
333
262
|
}
|
|
334
263
|
}
|
|
335
|
-
|
|
336
|
-
const elementsToMove = this.
|
|
264
|
+
shiftBuffersLeft(fromIndex, delta) {
|
|
265
|
+
const elementsToMove = this.instancesCountInternal - fromIndex;
|
|
337
266
|
if (elementsToMove <= 0) {
|
|
338
267
|
return;
|
|
339
268
|
}
|
|
340
|
-
for (const attribute of this.
|
|
269
|
+
for (const attribute of this.packedAttributes) {
|
|
341
270
|
shiftBufferRegion(attribute.array, attribute.itemSize, fromIndex, elementsToMove, -delta);
|
|
342
271
|
attribute.needsUpdate = true;
|
|
343
272
|
}
|
|
344
273
|
}
|
|
345
|
-
|
|
346
|
-
const visibilityAttribute = this._private_resolveAttribute("instanceVisibility");
|
|
347
|
-
visibilityAttribute.array[index] = visibility ? 1 : 0;
|
|
348
|
-
visibilityAttribute.needsUpdate = true;
|
|
349
|
-
const blendAttribute = this._private_resolveAttribute("instanceBlend");
|
|
350
|
-
blendAttribute.array[index] = blend;
|
|
351
|
-
blendAttribute.needsUpdate = true;
|
|
352
|
-
const hslAttribute = this._private_resolveAttribute("instanceHSL");
|
|
353
|
-
const hslArray = hslAttribute.array;
|
|
354
|
-
const hslOffset = index * 3;
|
|
355
|
-
hslArray[hslOffset] = hsl.h;
|
|
356
|
-
hslArray[hslOffset + 1] = hsl.s;
|
|
357
|
-
hslArray[hslOffset + 2] = hsl.l;
|
|
358
|
-
hslAttribute.needsUpdate = true;
|
|
359
|
-
const transformAttribute = this._private_resolveAttribute("instanceTransform");
|
|
360
|
-
const transformArray = transformAttribute.array;
|
|
361
|
-
const transformOffset = index * 16;
|
|
362
|
-
const elements = transform.elements;
|
|
363
|
-
for (let j = 0; j < 16; j++) {
|
|
364
|
-
transformArray[transformOffset + j] = elements[j];
|
|
365
|
-
}
|
|
366
|
-
transformAttribute.needsUpdate = true;
|
|
274
|
+
writeProperties(index, properties) {
|
|
367
275
|
for (const name in properties) {
|
|
368
276
|
const { value, glslTypeInfo } = properties[name];
|
|
369
277
|
if (glslTypeInfo.instantiable) {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
const offset = index * attribute.itemSize;
|
|
373
|
-
writePropertyToArray(value, attribute.array, offset);
|
|
374
|
-
attribute.needsUpdate = true;
|
|
375
|
-
}
|
|
278
|
+
writePropertyToArray(value, TEMP_FIELD_VALUES, 0);
|
|
279
|
+
this.writeField(index, resolvePackedField(this.layout, name), TEMP_FIELD_VALUES);
|
|
376
280
|
}
|
|
377
281
|
else {
|
|
378
|
-
const uniform = resolvePropertyUniform(name, this.
|
|
282
|
+
const uniform = resolvePropertyUniform(name, this.shaderMaterial);
|
|
379
283
|
uniform.value = value;
|
|
380
|
-
this.
|
|
284
|
+
this.shaderMaterial.uniformsNeedUpdate = true;
|
|
381
285
|
}
|
|
382
286
|
}
|
|
383
287
|
}
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
288
|
+
writeVisibility(index, visibility) {
|
|
289
|
+
TEMP_FIELD_VALUES[0] = visibility ? 1 : 0;
|
|
290
|
+
this.writeField(index, this.visibilityField, TEMP_FIELD_VALUES);
|
|
291
|
+
}
|
|
292
|
+
writeBlend(index, blend) {
|
|
293
|
+
TEMP_FIELD_VALUES[0] = blend;
|
|
294
|
+
this.writeField(index, this.blendField, TEMP_FIELD_VALUES);
|
|
295
|
+
}
|
|
296
|
+
writeHSL(index, hsl) {
|
|
297
|
+
TEMP_FIELD_VALUES[0] = hsl.h;
|
|
298
|
+
TEMP_FIELD_VALUES[1] = hsl.s;
|
|
299
|
+
TEMP_FIELD_VALUES[2] = hsl.l;
|
|
300
|
+
this.writeField(index, this.hslField, TEMP_FIELD_VALUES);
|
|
301
|
+
}
|
|
302
|
+
writeField(index, field, values) {
|
|
303
|
+
for (const { attributeIndex, componentOffset, sourceOffset, size } of field.columns) {
|
|
304
|
+
const attribute = this.packedAttributes[attributeIndex];
|
|
305
|
+
const array = attribute.array;
|
|
306
|
+
const offset = index * attribute.itemSize + componentOffset;
|
|
307
|
+
for (let i = 0; i < size; i++) {
|
|
308
|
+
array[offset + i] = values[sourceOffset + i];
|
|
309
|
+
}
|
|
310
|
+
attribute.needsUpdate = true;
|
|
388
311
|
}
|
|
389
|
-
return attribute;
|
|
390
312
|
}
|
|
391
313
|
}
|
|
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 {};
|