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.
Files changed (314) hide show
  1. package/README.md +1 -1
  2. package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.d.ts +1 -1
  3. package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.Internal.js +1 -0
  4. package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.d.ts +3 -3
  5. package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.js +14 -16
  6. package/dist/core/constraints/UIConstraint.d.ts +22 -2
  7. package/dist/core/constraints/UIConstraint.js +26 -3
  8. package/dist/core/constraints/UICustomConstraint.d.ts +4 -4
  9. package/dist/core/constraints/UICustomConstraint.js +15 -15
  10. package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.d.ts +1 -1
  11. package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.Internal.js +1 -0
  12. package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.d.ts +3 -3
  13. package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.js +11 -13
  14. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +1 -1
  15. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.js +1 -3
  16. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +3 -3
  17. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js +30 -30
  18. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +1 -1
  19. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.js +2 -4
  20. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +3 -3
  21. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +40 -39
  22. package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts +1 -1
  23. package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.js +1 -0
  24. package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +3 -3
  25. package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js +13 -15
  26. package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts +3 -3
  27. package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.Internal.js +1 -0
  28. package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +13 -7
  29. package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.js +37 -30
  30. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +1 -1
  31. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.js +1 -3
  32. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +3 -3
  33. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js +30 -30
  34. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +1 -1
  35. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.js +2 -4
  36. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +3 -3
  37. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +40 -39
  38. package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts +1 -1
  39. package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.js +1 -0
  40. package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +3 -3
  41. package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js +13 -15
  42. package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.d.ts +1 -1
  43. package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.Internal.js +1 -0
  44. package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.d.ts +3 -3
  45. package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.js +11 -13
  46. package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.d.ts +3 -3
  47. package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.js +1 -3
  48. package/dist/core/constraints/builders/UIConstraint2DBuilder.d.ts +11 -11
  49. package/dist/core/constraints/builders/UIConstraint2DBuilder.js +10 -13
  50. package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.d.ts +1 -1
  51. package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.js +1 -3
  52. package/dist/core/constraints/builders/UICoverConstraintBuilder.d.ts +7 -7
  53. package/dist/core/constraints/builders/UICoverConstraintBuilder.js +10 -13
  54. package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.d.ts +1 -1
  55. package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.js +1 -3
  56. package/dist/core/constraints/builders/UIFitConstraintBuilder.d.ts +7 -7
  57. package/dist/core/constraints/builders/UIFitConstraintBuilder.js +10 -13
  58. package/dist/core/elements/UIAnchor/UIAnchor.Internal.js +3 -5
  59. package/dist/core/elements/UIAnchor/UIAnchor.d.ts +23 -5
  60. package/dist/core/elements/UIAnchor/UIAnchor.js +42 -8
  61. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +2 -2
  62. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.js +4 -6
  63. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.d.ts +10 -10
  64. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.js +108 -111
  65. package/dist/core/elements/UIDummy/UIDummy.Internal.d.ts +4 -4
  66. package/dist/core/elements/UIDummy/UIDummy.Internal.js +5 -8
  67. package/dist/core/elements/UIDummy/UIDummy.d.ts +19 -11
  68. package/dist/core/elements/UIDummy/UIDummy.js +59 -42
  69. package/dist/core/elements/UIElement/UIElement.Internal.d.ts +5 -5
  70. package/dist/core/elements/UIElement/UIElement.Internal.js +9 -12
  71. package/dist/core/elements/UIElement/UIElement.d.ts +25 -17
  72. package/dist/core/elements/UIElement/UIElement.js +76 -69
  73. package/dist/core/elements/UIGraphics/UIGraphics.Internal.d.ts +3 -3
  74. package/dist/core/elements/UIGraphics/UIGraphics.Internal.js +4 -7
  75. package/dist/core/elements/UIGraphics/UIGraphics.d.ts +7 -7
  76. package/dist/core/elements/UIGraphics/UIGraphics.js +44 -47
  77. package/dist/core/elements/UIImage/UIImage.Internal.d.ts +2 -2
  78. package/dist/core/elements/UIImage/UIImage.Internal.js +1 -0
  79. package/dist/core/elements/UIImage/UIImage.d.ts +9 -9
  80. package/dist/core/elements/UIImage/UIImage.js +21 -24
  81. package/dist/core/elements/UINineSlice/UINineSlice.Internal.d.ts +3 -3
  82. package/dist/core/elements/UINineSlice/UINineSlice.Internal.js +3 -5
  83. package/dist/core/elements/UINineSlice/UINineSlice.d.ts +12 -12
  84. package/dist/core/elements/UINineSlice/UINineSlice.js +71 -73
  85. package/dist/core/elements/UIProgress/UIProgress.Internal.d.ts +3 -4
  86. package/dist/core/elements/UIProgress/UIProgress.Internal.js +1 -3
  87. package/dist/core/elements/UIProgress/UIProgress.d.ts +10 -8
  88. package/dist/core/elements/UIProgress/UIProgress.js +60 -58
  89. package/dist/core/elements/UIScene/UIScene.Internal.d.ts +3 -3
  90. package/dist/core/elements/UIScene/UIScene.Internal.js +11 -14
  91. package/dist/core/elements/UIScene/UIScene.d.ts +8 -8
  92. package/dist/core/elements/UIScene/UIScene.js +68 -69
  93. package/dist/core/elements/UIText/UIText.Bidi.d.ts +2 -2
  94. package/dist/core/elements/UIText/UIText.Bidi.js +3 -5
  95. package/dist/core/elements/UIText/UIText.Interfaces.d.ts +6 -2
  96. package/dist/core/elements/UIText/UIText.Interfaces.js +1 -0
  97. package/dist/core/elements/UIText/UIText.Internal.d.ts +4 -4
  98. package/dist/core/elements/UIText/UIText.Internal.js +5 -7
  99. package/dist/core/elements/UIText/UIText.Measuring.d.ts +14 -7
  100. package/dist/core/elements/UIText/UIText.Measuring.js +115 -55
  101. package/dist/core/elements/UIText/UIText.Rendering.d.ts +3 -3
  102. package/dist/core/elements/UIText/UIText.Rendering.js +6 -9
  103. package/dist/core/elements/UIText/UIText.d.ts +28 -14
  104. package/dist/core/elements/UIText/UIText.js +181 -141
  105. package/dist/core/index.d.ts +55 -54
  106. package/dist/core/index.js +53 -0
  107. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts +4 -4
  108. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.js +2 -5
  109. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.d.ts +4 -4
  110. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.js +43 -42
  111. package/dist/core/layers/UILayer/UILayer.Internal.d.ts +2 -2
  112. package/dist/core/layers/UILayer/UILayer.Internal.js +4 -7
  113. package/dist/core/layers/UILayer/UILayer.d.ts +19 -4
  114. package/dist/core/layers/UILayer/UILayer.js +125 -62
  115. package/dist/core/miscellaneous/UIBlendMode.js +1 -3
  116. package/dist/core/miscellaneous/UIExpression.js +16 -19
  117. package/dist/core/miscellaneous/UIMode.js +3 -5
  118. package/dist/core/miscellaneous/UIOrientation.js +2 -4
  119. package/dist/core/miscellaneous/UIPriority.js +5 -8
  120. package/dist/core/miscellaneous/UIRelation.js +5 -8
  121. package/dist/core/miscellaneous/UITransparencyMode.js +1 -3
  122. package/dist/core/miscellaneous/area/UIArea.js +1 -3
  123. package/dist/core/miscellaneous/area/UIAreaCircle.d.ts +1 -1
  124. package/dist/core/miscellaneous/area/UIAreaCircle.js +3 -6
  125. package/dist/core/miscellaneous/area/UIAreaPolygon.d.ts +2 -2
  126. package/dist/core/miscellaneous/area/UIAreaPolygon.js +3 -6
  127. package/dist/core/miscellaneous/area/UIAreaRectangle.d.ts +1 -1
  128. package/dist/core/miscellaneous/area/UIAreaRectangle.js +3 -6
  129. package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.d.ts +1 -1
  130. package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.js +3 -6
  131. package/dist/core/miscellaneous/asserts.d.ts +20 -1
  132. package/dist/core/miscellaneous/asserts.js +71 -19
  133. package/dist/core/miscellaneous/canvas.js +13 -7
  134. package/dist/core/miscellaneous/color/UIColor.Internal.d.ts +1 -1
  135. package/dist/core/miscellaneous/color/UIColor.Internal.js +1 -3
  136. package/dist/core/miscellaneous/color/UIColor.d.ts +1 -1
  137. package/dist/core/miscellaneous/color/UIColor.js +202 -205
  138. package/dist/core/miscellaneous/computeTransform.d.ts +1 -1
  139. package/dist/core/miscellaneous/computeTransform.js +4 -7
  140. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +2 -2
  141. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.js +13 -16
  142. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js +115 -118
  143. package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts +3 -3
  144. package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.js +1 -0
  145. package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.js +208 -114
  146. package/dist/core/miscellaneous/generic-plane/shared.d.ts +2 -2
  147. package/dist/core/miscellaneous/generic-plane/shared.js +16 -19
  148. package/dist/core/miscellaneous/insets/UIInsets.Internal.js +1 -3
  149. package/dist/core/miscellaneous/insets/UIInsets.d.ts +1 -1
  150. package/dist/core/miscellaneous/insets/UIInsets.js +96 -99
  151. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.js +1 -3
  152. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +1 -1
  153. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +14 -17
  154. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.d.ts +2 -2
  155. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js +14 -17
  156. package/dist/core/miscellaneous/math.js +3 -5
  157. package/dist/core/miscellaneous/micro/UIMicro.Internal.js +6 -8
  158. package/dist/core/miscellaneous/micro/UIMicro.d.ts +1 -1
  159. package/dist/core/miscellaneous/micro/UIMicro.js +91 -94
  160. package/dist/core/miscellaneous/resize-policy/UIResizePolicy.js +1 -3
  161. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.d.ts +1 -1
  162. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.js +12 -15
  163. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.d.ts +1 -1
  164. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.js +13 -16
  165. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.d.ts +1 -1
  166. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.js +13 -16
  167. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.d.ts +1 -1
  168. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.js +12 -15
  169. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.d.ts +1 -1
  170. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.js +13 -16
  171. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.d.ts +1 -1
  172. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.js +13 -16
  173. package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.d.ts +1 -1
  174. package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.js +3 -6
  175. package/dist/core/miscellaneous/shared.d.ts +1 -1
  176. package/dist/core/miscellaneous/shared.js +4 -7
  177. package/dist/core/miscellaneous/text-span/UITextSpan.Internal.d.ts +1 -1
  178. package/dist/core/miscellaneous/text-span/UITextSpan.Internal.js +1 -0
  179. package/dist/core/miscellaneous/text-span/UITextSpan.d.ts +2 -2
  180. package/dist/core/miscellaneous/text-span/UITextSpan.js +10 -13
  181. package/dist/core/miscellaneous/text-style/UITextStyle.Internal.js +15 -17
  182. package/dist/core/miscellaneous/text-style/UITextStyle.d.ts +13 -2
  183. package/dist/core/miscellaneous/text-style/UITextStyle.js +222 -207
  184. package/dist/core/miscellaneous/texture/UITextureView.Internal.d.ts +7 -0
  185. package/dist/core/miscellaneous/texture/UITextureView.Internal.js +16 -6
  186. package/dist/core/miscellaneous/texture/UITextureView.d.ts +3 -3
  187. package/dist/core/miscellaneous/texture/UITextureView.js +114 -118
  188. package/dist/core/miscellaneous/webglCapabilities.js +3 -4
  189. package/dist/core/shaders/UIImage.d.ts +9 -0
  190. package/dist/core/shaders/UIImage.js +14 -0
  191. package/dist/core/shaders/UINineSlice.d.ts +11 -0
  192. package/dist/core/shaders/UINineSlice.js +57 -0
  193. package/dist/core/shaders/UIProgress.d.ts +14 -0
  194. package/dist/core/shaders/UIProgress.js +21 -0
  195. package/dist/core/shaders/UIProgressMaskFunctionCircular.d.ts +2 -0
  196. package/dist/core/shaders/UIProgressMaskFunctionCircular.js +16 -0
  197. package/dist/core/shaders/UIProgressMaskFunctionDirectional.d.ts +2 -0
  198. package/dist/core/shaders/UIProgressMaskFunctionDirectional.js +15 -0
  199. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.d.ts +4 -0
  200. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.js +1 -0
  201. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.d.ts +7 -1
  202. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +50 -47
  203. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.d.ts +5 -2
  204. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.js +1 -0
  205. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.d.ts +11 -3
  206. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.js +42 -26
  207. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.d.ts +5 -3
  208. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.js +1 -0
  209. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.d.ts +27 -4
  210. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +162 -123
  211. package/dist/debug/UIAspectDebug.d.ts +3 -3
  212. package/dist/debug/UIAspectDebug.js +64 -68
  213. package/dist/debug/UIConstraintDebug.d.ts +1 -1
  214. package/dist/debug/UIConstraintDebug.js +1 -0
  215. package/dist/debug/UIHeightDebug.d.ts +3 -3
  216. package/dist/debug/UIHeightDebug.js +63 -67
  217. package/dist/debug/UIHorizontalDistanceDebug.d.ts +3 -3
  218. package/dist/debug/UIHorizontalDistanceDebug.js +76 -81
  219. package/dist/debug/UIHorizontalInterpolationDebug.d.ts +3 -3
  220. package/dist/debug/UIHorizontalInterpolationDebug.js +74 -78
  221. package/dist/debug/UILayerDebug.d.ts +1 -1
  222. package/dist/debug/UILayerDebug.js +55 -64
  223. package/dist/debug/UIVerticalDistanceDebug.d.ts +3 -3
  224. package/dist/debug/UIVerticalDistanceDebug.js +76 -81
  225. package/dist/debug/UIVerticalInterpolationDebug.d.ts +3 -3
  226. package/dist/debug/UIVerticalInterpolationDebug.js +74 -78
  227. package/dist/debug/UIWidthDebug.d.ts +3 -3
  228. package/dist/debug/UIWidthDebug.js +63 -67
  229. package/dist/debug/index.d.ts +8 -8
  230. package/dist/debug/index.js +8 -8
  231. package/dist/debug/miscellaneous.js +8 -11
  232. package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.d.ts +3 -3
  233. package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.js +13 -16
  234. package/dist/particles/behaviorModules/UIBehaviorModule.d.ts +1 -1
  235. package/dist/particles/behaviorModules/UIBehaviorModule.js +1 -3
  236. package/dist/particles/behaviorModules/UIBehaviorPointGravity.d.ts +3 -3
  237. package/dist/particles/behaviorModules/UIBehaviorPointGravity.js +37 -40
  238. package/dist/particles/behaviorModules/UIBehaviorScaleOscillation.d.ts +41 -0
  239. package/dist/particles/behaviorModules/UIBehaviorScaleOscillation.js +87 -0
  240. package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +2 -2
  241. package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +17 -20
  242. package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.d.ts +2 -2
  243. package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.js +13 -16
  244. package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.d.ts +2 -2
  245. package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.js +21 -24
  246. package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.d.ts +2 -2
  247. package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.js +13 -16
  248. package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.d.ts +2 -2
  249. package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.js +21 -24
  250. package/dist/particles/elements/UIEmitter.Internal.d.ts +2 -2
  251. package/dist/particles/elements/UIEmitter.Internal.js +6 -9
  252. package/dist/particles/elements/UIEmitter.d.ts +17 -11
  253. package/dist/particles/elements/UIEmitter.js +100 -88
  254. package/dist/particles/index.d.ts +20 -18
  255. package/dist/particles/index.js +19 -18
  256. package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +1 -1
  257. package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +14 -15
  258. package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +1 -1
  259. package/dist/particles/instancedParticle/UIInstancedParticle.js +29 -32
  260. package/dist/particles/miscellaneous/miscellaneous.d.ts +3 -3
  261. package/dist/particles/miscellaneous/miscellaneous.js +26 -27
  262. package/dist/particles/renderingModules/UIRenderingColorOverLife.d.ts +2 -2
  263. package/dist/particles/renderingModules/UIRenderingColorOverLife.js +5 -8
  264. package/dist/particles/renderingModules/UIRenderingColorOverVelocity.d.ts +2 -2
  265. package/dist/particles/renderingModules/UIRenderingColorOverVelocity.js +6 -9
  266. package/dist/particles/renderingModules/UIRenderingModule.js +1 -3
  267. package/dist/particles/renderingModules/UIRenderingTexture.d.ts +2 -2
  268. package/dist/particles/renderingModules/UIRenderingTexture.js +4 -7
  269. package/dist/particles/shaders/UIRenderingColorOverLife.d.ts +2 -0
  270. package/dist/particles/shaders/UIRenderingColorOverLife.js +7 -0
  271. package/dist/particles/shaders/UIRenderingColorOverVelocity.d.ts +9 -0
  272. package/dist/particles/shaders/UIRenderingColorOverVelocity.js +16 -0
  273. package/dist/particles/shaders/UIRenderingTexture.d.ts +2 -0
  274. package/dist/particles/shaders/UIRenderingTexture.js +7 -0
  275. package/dist/particles/spawnModules/UISpawnModule.d.ts +1 -1
  276. package/dist/particles/spawnModules/UISpawnModule.js +1 -3
  277. package/dist/particles/spawnModules/UISpawnOffset.d.ts +3 -3
  278. package/dist/particles/spawnModules/UISpawnOffset.js +12 -15
  279. package/dist/particles/spawnModules/UISpawnRandomLifetime.d.ts +2 -2
  280. package/dist/particles/spawnModules/UISpawnRandomLifetime.js +13 -16
  281. package/dist/particles/spawnModules/UISpawnRandomRotation.d.ts +2 -2
  282. package/dist/particles/spawnModules/UISpawnRandomRotation.js +13 -16
  283. package/dist/particles/spawnModules/UISpawnRandomScale.d.ts +2 -2
  284. package/dist/particles/spawnModules/UISpawnRandomScale.js +19 -22
  285. package/dist/particles/spawnModules/UISpawnRandomTorque.d.ts +2 -2
  286. package/dist/particles/spawnModules/UISpawnRandomTorque.js +13 -16
  287. package/dist/particles/spawnModules/UISpawnRandomVelocity.d.ts +2 -2
  288. package/dist/particles/spawnModules/UISpawnRandomVelocity.js +21 -24
  289. package/dist/particles/spawnModules/UISpawnRectangle.d.ts +3 -3
  290. package/dist/particles/spawnModules/UISpawnRectangle.js +21 -24
  291. package/package.json +13 -17
  292. package/dist/_virtual/2d.js +0 -3
  293. package/dist/_virtual/3d.js +0 -3
  294. package/dist/_virtual/4d.js +0 -3
  295. package/dist/_virtual/mod.js +0 -5
  296. package/dist/_virtual/mod2.js +0 -3
  297. package/dist/core/shaders/UIImage.glsl.js +0 -3
  298. package/dist/core/shaders/UINineSlice.glsl.js +0 -3
  299. package/dist/core/shaders/UIProgress.glsl.js +0 -3
  300. package/dist/core/shaders/UIProgressMaskFunctionCircular.glsl.js +0 -3
  301. package/dist/core/shaders/UIProgressMaskFunctionDirectional.glsl.js +0 -3
  302. package/dist/index.js +0 -52
  303. package/dist/node_modules/fast-simplex-noise/lib/2d.js +0 -93
  304. package/dist/node_modules/fast-simplex-noise/lib/3d.js +0 -142
  305. package/dist/node_modules/fast-simplex-noise/lib/4d.js +0 -196
  306. package/dist/node_modules/fast-simplex-noise/lib/mod.js +0 -24
  307. package/dist/node_modules/three/examples/jsm/lines/Line2.js +0 -56
  308. package/dist/node_modules/three/examples/jsm/lines/LineGeometry.js +0 -157
  309. package/dist/node_modules/three/examples/jsm/lines/LineMaterial.js +0 -691
  310. package/dist/node_modules/three/examples/jsm/lines/LineSegments2.js +0 -415
  311. package/dist/node_modules/three/examples/jsm/lines/LineSegmentsGeometry.js +0 -289
  312. package/dist/particles/shaders/UIRenderingColorOverLife.glsl.js +0 -3
  313. package/dist/particles/shaders/UIRenderingColorOverVelocity.glsl.js +0 -3
  314. package/dist/particles/shaders/UIRenderingTexture.glsl.js +0 -3
@@ -1,6 +1,5 @@
1
- import { convertUIPropertiesToGLProperties, cloneProperties, extractZIndex, cloneGLProperties } from '../shared.js';
2
- import { UIGenericInstancedPlane } from '../UIGenericInstancedPlane/UIGenericInstancedPlane.js';
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._private_handlerToState = new Map();
17
- this._private_lastHandler = 0;
18
- this._private_orderedMeshes = [];
19
- this._private_handlerToDescriptor = new Map();
20
- this._private_pendingCreate = new Set();
21
- this._private_pendingDelete = new Set();
22
- this._private_pendingRelocate = new Set();
23
- this._private_needsFlush = false;
24
- this._private_scene = scene;
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._private_lastHandler++;
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._private_handlerToState.set(handler, state);
47
- this._private_pendingCreate.add(handler);
48
- this._private_needsFlush = true;
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._private_handlerToState.has(handler)) {
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._private_handlerToState.delete(handler);
59
- if (this._private_pendingCreate.has(handler)) {
60
- this._private_pendingCreate.delete(handler);
62
+ this.handlerToState.delete(handler);
63
+ if (this.pendingCreate.has(handler)) {
64
+ this.pendingCreate.delete(handler);
61
65
  return;
62
66
  }
63
- this._private_pendingRelocate.delete(handler);
64
- this._private_pendingDelete.add(handler);
65
- this._private_needsFlush = true;
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._private_resolveState(handler);
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._private_pendingCreate.has(handler)) {
91
- this._private_pendingRelocate.add(handler);
92
- this._private_needsFlush = true;
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._private_handlerToDescriptor.get(handler);
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._private_resolveState(handler);
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._private_pendingCreate.has(handler)) {
113
- this._private_pendingRelocate.add(handler);
114
- this._private_needsFlush = true;
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._private_handlerToDescriptor.get(handler);
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._private_resolveState(handler);
132
+ const state = this.resolveState(handler);
129
133
  state.visibility = visibility;
130
- const descriptor = this._private_handlerToDescriptor.get(handler);
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._private_resolveState(handler);
144
+ const state = this.resolveState(handler);
141
145
  state.blend = blend;
142
- const descriptor = this._private_handlerToDescriptor.get(handler);
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._private_resolveState(handler);
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._private_handlerToDescriptor.get(handler);
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._private_resolveState(handler);
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._private_pendingCreate.has(handler)) {
172
- this._private_pendingRelocate.add(handler);
173
- this._private_needsFlush = true;
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._private_needsFlush) {
221
+ if (!this.needsFlush) {
182
222
  return;
183
223
  }
184
- this._private_processDeletes();
185
- this._private_processRelocates();
186
- this._private_processCreates();
187
- this._private_mergeCompatibleNeighbors();
188
- this._private_cleanupEmptyMeshes();
189
- this._private_syncSceneOrder();
190
- this._private_pendingCreate.clear();
191
- this._private_pendingDelete.clear();
192
- this._private_pendingRelocate.clear();
193
- this._private_needsFlush = false;
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
- _private_processDeletes() {
196
- for (const handler of this._private_pendingDelete) {
197
- const descriptor = this._private_handlerToDescriptor.get(handler);
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._private_shiftHandlerIndices(mesh, instanceIndex + 1, -1);
204
- this._private_handlerToDescriptor.delete(handler);
262
+ this.shiftHandlerIndices(mesh, instanceIndex + 1, -1);
263
+ this.handlerToDescriptor.delete(handler);
205
264
  }
206
265
  }
207
- _private_processRelocates() {
208
- for (const handler of this._private_pendingRelocate) {
209
- const descriptor = this._private_handlerToDescriptor.get(handler);
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._private_shiftHandlerIndices(mesh, instanceIndex + 1, -1);
216
- this._private_handlerToDescriptor.delete(handler);
217
- this._private_pendingCreate.add(handler);
274
+ this.shiftHandlerIndices(mesh, instanceIndex + 1, -1);
275
+ this.handlerToDescriptor.delete(handler);
276
+ this.pendingCreate.add(handler);
218
277
  }
219
278
  }
220
- _private_processCreates() {
221
- if (this._private_pendingCreate.size === 0) {
279
+ processCreates() {
280
+ if (this.pendingCreate.size === 0) {
222
281
  return;
223
282
  }
224
283
  const toCreate = [];
225
- for (const handler of this._private_pendingCreate) {
226
- const state = this._private_handlerToState.get(handler);
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._private_insertSingleElement(handler, state);
298
+ this.insertSingleElement(handler, state);
240
299
  }
241
300
  }
242
- _private_insertSingleElement(handler, state) {
301
+ insertSingleElement(handler, state) {
243
302
  const { source, properties, transform, visibility, transparency, blend, hsl, zIndex } = state;
244
- let newMeshIndex = this._private_orderedMeshes.length;
245
- for (let i = 0; i < this._private_orderedMeshes.length; i++) {
246
- const mesh = this._private_orderedMeshes[i];
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._private_findInstanceIndexInMesh(mesh, zIndex);
317
+ const instanceIndex = this.findInstanceIndexInMesh(mesh, zIndex);
259
318
  mesh.insertAt(instanceIndex, properties, transform, visibility, blend, hsl);
260
- this._private_shiftHandlerIndices(mesh, instanceIndex, 1);
261
- this._private_handlerToDescriptor.set(handler, { mesh, instanceIndex });
319
+ this.shiftHandlerIndices(mesh, instanceIndex, 1);
320
+ this.handlerToDescriptor.set(handler, { mesh, instanceIndex });
262
321
  return;
263
322
  }
264
- const splitIndex = this._private_findInstanceIndexInMesh(mesh, zIndex);
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._private_splitMeshAt(i, mesh, splitIndex);
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._private_orderedMeshes.splice(newMeshIndex, 0, mesh);
282
- this._private_scene.add(mesh);
283
- this._private_handlerToDescriptor.set(handler, { mesh, instanceIndex: 0 });
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
- _private_splitMeshAt(meshIndex, mesh, splitIndex) {
349
+ splitMeshAt(meshIndex, mesh, splitIndex) {
291
350
  const tail = mesh.split(splitIndex);
292
- for (const descriptor of this._private_handlerToDescriptor.values()) {
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._private_orderedMeshes.splice(meshIndex + 1, 0, tail);
299
- this._private_scene.add(tail);
357
+ this.orderedMeshes.splice(meshIndex + 1, 0, tail);
358
+ this.scene.add(tail);
300
359
  }
301
- _private_mergeCompatibleNeighbors() {
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._private_orderedMeshes.length - 1) {
304
- const left = this._private_orderedMeshes[i];
305
- const right = this._private_orderedMeshes[i + 1];
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._private_remapHandlersAfterMerge(right, left, indexOffset);
317
- this._private_scene.remove(right);
402
+ this.remapHandlersAfterMerge(right, left, indexOffset);
403
+ this.scene.remove(right);
318
404
  right.destroy();
319
- this._private_orderedMeshes.splice(i + 1, 1);
405
+ this.orderedMeshes.splice(i + 1, 1);
320
406
  continue;
321
407
  }
322
408
  i++;
323
409
  }
324
410
  }
325
- _private_cleanupEmptyMeshes() {
326
- for (let i = this._private_orderedMeshes.length - 1; i >= 0; i--) {
327
- const mesh = this._private_orderedMeshes[i];
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._private_scene.remove(mesh);
415
+ this.scene.remove(mesh);
330
416
  mesh.destroy();
331
- this._private_orderedMeshes.splice(i, 1);
417
+ this.orderedMeshes.splice(i, 1);
332
418
  }
333
419
  }
334
420
  }
335
- _private_resolveState(handler) {
336
- const state = this._private_handlerToState.get(handler);
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
- _private_findInstanceIndexInMesh(mesh, zIndex) {
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
- _private_shiftHandlerIndices(mesh, fromIndex, delta) {
351
- for (const descriptor of this._private_handlerToDescriptor.values()) {
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
- _private_remapHandlersAfterMerge(fromMesh, toMesh, indexOffset) {
358
- for (const descriptor of this._private_handlerToDescriptor.values()) {
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
- _private_syncSceneOrder() {
366
- this._private_orderedMeshes.sort((a, b) => {
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
- for (let i = 0; i < this._private_orderedMeshes.length; i++) {
372
- this._private_orderedMeshes[i].renderOrder = i;
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, Matrix3, Matrix4 } from 'three';
2
- import { UIColor } from '../color/UIColor.js';
3
- import { checkSRGBSupport } from '../webglCapabilities.js';
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 };
@@ -1,3 +1 @@
1
- const INSETS_DEFAULT_VALUE = 0;
2
-
3
- export { INSETS_DEFAULT_VALUE };
1
+ export const INSETS_DEFAULT_VALUE = 0;