laymur 0.16.0 → 0.17.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.
Files changed (266) hide show
  1. package/README.md +84 -208
  2. package/dist/core/constraints/UIAspectConstraint/UIAspectConstraint.js +41 -0
  3. package/dist/{constraints → core/constraints}/UIConstraint.d.ts +2 -2
  4. package/dist/core/constraints/UIConstraint.js +11 -0
  5. package/dist/core/constraints/UICustomConstraint.js +37 -0
  6. package/dist/core/constraints/UIHeightConstraint/UIHeightConstraint.js +34 -0
  7. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.js +3 -0
  8. package/dist/core/constraints/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.js +100 -0
  9. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.js +4 -0
  10. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +136 -0
  11. package/dist/core/constraints/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.js +40 -0
  12. package/dist/core/constraints/UISingleParameterConstraint/UISingleParameterConstraint.js +71 -0
  13. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.js +3 -0
  14. package/dist/core/constraints/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.js +100 -0
  15. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.js +4 -0
  16. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +136 -0
  17. package/dist/core/constraints/UIVerticalProportionConstraint/UIVerticalProportionConstraint.js +40 -0
  18. package/dist/core/constraints/UIWidthConstraint/UIWidthConstraint.js +34 -0
  19. package/dist/core/constraints/builders/UIConstraint2DBuilder.Internal.js +19 -0
  20. package/dist/core/constraints/builders/UIConstraint2DBuilder.js +138 -0
  21. package/dist/core/constraints/builders/UICoverConstraintBuilder.Internal.js +3 -0
  22. package/dist/core/constraints/builders/UICoverConstraintBuilder.js +63 -0
  23. package/dist/core/constraints/builders/UIFitConstraintBuilder.Internal.js +3 -0
  24. package/dist/core/constraints/builders/UIFitConstraintBuilder.js +63 -0
  25. package/dist/{elements → core/elements}/UIAnchor/UIAnchor.Internal.d.ts +3 -0
  26. package/dist/core/elements/UIAnchor/UIAnchor.Internal.js +5 -0
  27. package/dist/{elements → core/elements}/UIAnchor/UIAnchor.d.ts +3 -3
  28. package/dist/core/elements/UIAnchor/UIAnchor.js +49 -0
  29. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.Internal.js +15 -0
  30. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.js +259 -0
  31. package/dist/core/elements/UIDummy/UIDummy.Internal.js +8 -0
  32. package/dist/{elements → core/elements}/UIDummy/UIDummy.d.ts +2 -2
  33. package/dist/core/elements/UIDummy/UIDummy.js +173 -0
  34. package/dist/core/elements/UIElement/UIElement.Internal.js +5 -0
  35. package/dist/{elements → core/elements}/UIElement/UIElement.d.ts +2 -2
  36. package/dist/core/elements/UIElement/UIElement.js +74 -0
  37. package/dist/core/elements/UIGraphics/UIGraphics.Internal.js +7 -0
  38. package/dist/core/elements/UIGraphics/UIGraphics.js +126 -0
  39. package/dist/core/elements/UIImage/UIImage.js +85 -0
  40. package/dist/core/elements/UINineSlice/UINineSlice.Internal.js +12 -0
  41. package/dist/core/elements/UINineSlice/UINineSlice.js +188 -0
  42. package/dist/core/elements/UIProgress/UIProgress.Internal.js +3 -0
  43. package/dist/core/elements/UIProgress/UIProgress.js +165 -0
  44. package/dist/core/elements/UIScene/UIScene.Internal.js +27 -0
  45. package/dist/core/elements/UIScene/UIScene.js +157 -0
  46. package/dist/core/elements/UIText/UIText.Internal.js +12 -0
  47. package/dist/core/elements/UIText/UIText.Measuring.js +153 -0
  48. package/dist/core/elements/UIText/UIText.Rendering.js +61 -0
  49. package/dist/core/elements/UIText/UIText.js +265 -0
  50. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.js +5 -0
  51. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.js +147 -0
  52. package/dist/core/layers/UILayer/UILayer.Internal.js +7 -0
  53. package/dist/core/layers/UILayer/UILayer.js +113 -0
  54. package/dist/core/miscellaneous/UIExpression.js +128 -0
  55. package/dist/core/miscellaneous/UIMode.js +30 -0
  56. package/dist/core/miscellaneous/UIOrientation.js +20 -0
  57. package/dist/core/miscellaneous/UIPriority.js +63 -0
  58. package/dist/core/miscellaneous/UIRelation.js +40 -0
  59. package/dist/core/miscellaneous/UITransparencyMode.js +12 -0
  60. package/dist/core/miscellaneous/area/UIArea.js +5 -0
  61. package/dist/core/miscellaneous/area/UIAreaCircle.js +32 -0
  62. package/dist/core/miscellaneous/area/UIAreaPolygon.js +40 -0
  63. package/dist/core/miscellaneous/area/UIAreaRectangle.js +36 -0
  64. package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.js +72 -0
  65. package/dist/core/miscellaneous/asserts.js +163 -0
  66. package/dist/core/miscellaneous/canvas.js +37 -0
  67. package/dist/core/miscellaneous/color/UIColor.Internal.js +42 -0
  68. package/dist/core/miscellaneous/color/UIColor.js +636 -0
  69. package/dist/core/miscellaneous/computeTransform.js +82 -0
  70. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.js +168 -0
  71. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js +349 -0
  72. package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.js +357 -0
  73. package/dist/core/miscellaneous/generic-plane/shared.js +228 -0
  74. package/dist/core/miscellaneous/insets/UIInsets.Internal.js +3 -0
  75. package/dist/core/miscellaneous/insets/UIInsets.js +224 -0
  76. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.js +19 -0
  77. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +51 -0
  78. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js +48 -0
  79. package/dist/{miscellaneous → core/miscellaneous}/math.d.ts +2 -0
  80. package/dist/core/miscellaneous/math.js +11 -0
  81. package/dist/core/miscellaneous/micro/UIMicro.Internal.js +15 -0
  82. package/dist/core/miscellaneous/micro/UIMicro.js +181 -0
  83. package/dist/core/miscellaneous/resize-policy/UIResizePolicy.js +9 -0
  84. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.js +50 -0
  85. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.js +52 -0
  86. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.js +52 -0
  87. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.js +50 -0
  88. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.js +52 -0
  89. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.js +52 -0
  90. package/dist/core/miscellaneous/resize-policy/UIResizePolicyNone.js +13 -0
  91. package/dist/core/miscellaneous/shared.js +37 -0
  92. package/dist/core/miscellaneous/text-span/UITextSpan.js +36 -0
  93. package/dist/core/miscellaneous/text-style/UITextStyle.Internal.js +17 -0
  94. package/dist/core/miscellaneous/text-style/UITextStyle.js +372 -0
  95. package/dist/core/miscellaneous/texture/UITextureView.Internal.js +6 -0
  96. package/dist/core/miscellaneous/texture/UITextureView.js +234 -0
  97. package/dist/core/miscellaneous/webglCapabilities.js +103 -0
  98. package/dist/core/shaders/UIImage.glsl.js +3 -0
  99. package/dist/core/shaders/UINineSlice.glsl.js +3 -0
  100. package/dist/core/shaders/UIProgress.glsl.js +3 -0
  101. package/dist/core/shaders/UIProgressMaskFunctionCircular.glsl.js +3 -0
  102. package/dist/core/shaders/UIProgressMaskFunctionDirectional.glsl.js +3 -0
  103. package/dist/{wrappers → core/wrappers}/UIInputWrapper/UIInputWrapper.Internal.d.ts +1 -1
  104. package/dist/{wrappers → core/wrappers}/UIInputWrapper/UIInputWrapper.d.ts +2 -2
  105. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +108 -0
  106. package/dist/{wrappers → core/wrappers}/UISceneWrapper/UISceneWrapper.Internal.d.ts +1 -1
  107. package/dist/{wrappers → core/wrappers}/UISceneWrapper/UISceneWrapper.d.ts +2 -2
  108. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.js +75 -0
  109. package/dist/{wrappers → core/wrappers}/UISolverWrapper/UISolverWrapper.Internal.d.ts +1 -1
  110. package/dist/{wrappers → core/wrappers}/UISolverWrapper/UISolverWrapper.d.ts +2 -2
  111. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +505 -0
  112. package/dist/index.js +51 -9246
  113. package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.d.ts +21 -0
  114. package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.js +47 -0
  115. package/dist/particles/behaviorModules/UIBehaviorModule.d.ts +14 -0
  116. package/dist/particles/behaviorModules/UIBehaviorModule.js +9 -0
  117. package/dist/particles/behaviorModules/UIBehaviorPointGravity.d.ts +39 -0
  118. package/dist/particles/behaviorModules/UIBehaviorPointGravity.js +110 -0
  119. package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +22 -0
  120. package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +66 -0
  121. package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.d.ts +20 -0
  122. package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.js +48 -0
  123. package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.d.ts +26 -0
  124. package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.js +66 -0
  125. package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.d.ts +20 -0
  126. package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.js +49 -0
  127. package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.d.ts +26 -0
  128. package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.js +70 -0
  129. package/dist/particles/elements/UIEmitter.Internal.d.ts +15 -0
  130. package/dist/particles/elements/UIEmitter.Internal.js +11 -0
  131. package/dist/particles/elements/UIEmitter.d.ts +68 -0
  132. package/dist/particles/elements/UIEmitter.js +203 -0
  133. package/dist/particles/index.d.ts +18 -0
  134. package/dist/particles/index.js +18 -0
  135. package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +13 -0
  136. package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +211 -0
  137. package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +17 -0
  138. package/dist/particles/instancedParticle/UIInstancedParticle.js +93 -0
  139. package/dist/particles/miscellaneous/miscellaneous.d.ts +32 -0
  140. package/dist/particles/miscellaneous/miscellaneous.js +67 -0
  141. package/dist/particles/renderingModules/UIRenderingColorOverLife.d.ts +14 -0
  142. package/dist/particles/renderingModules/UIRenderingColorOverLife.js +32 -0
  143. package/dist/particles/renderingModules/UIRenderingColorOverVelocity.d.ts +15 -0
  144. package/dist/particles/renderingModules/UIRenderingColorOverVelocity.js +37 -0
  145. package/dist/particles/renderingModules/UIRenderingModule.d.ts +8 -0
  146. package/dist/particles/renderingModules/UIRenderingModule.js +9 -0
  147. package/dist/particles/renderingModules/UIRenderingTexture.d.ts +14 -0
  148. package/dist/particles/renderingModules/UIRenderingTexture.js +26 -0
  149. package/dist/particles/shaders/UIRenderingColorOverLife.glsl.js +3 -0
  150. package/dist/particles/shaders/UIRenderingColorOverVelocity.glsl.js +3 -0
  151. package/dist/particles/shaders/UIRenderingTexture.glsl.js +3 -0
  152. package/dist/particles/spawnModules/UISpawnModule.d.ts +9 -0
  153. package/dist/particles/spawnModules/UISpawnModule.js +9 -0
  154. package/dist/particles/spawnModules/UISpawnOffset.d.ts +21 -0
  155. package/dist/particles/spawnModules/UISpawnOffset.js +46 -0
  156. package/dist/particles/spawnModules/UISpawnRandomLifetime.d.ts +20 -0
  157. package/dist/particles/spawnModules/UISpawnRandomLifetime.js +47 -0
  158. package/dist/particles/spawnModules/UISpawnRandomRotation.d.ts +20 -0
  159. package/dist/particles/spawnModules/UISpawnRandomRotation.js +45 -0
  160. package/dist/particles/spawnModules/UISpawnRandomScale.d.ts +26 -0
  161. package/dist/particles/spawnModules/UISpawnRandomScale.js +60 -0
  162. package/dist/particles/spawnModules/UISpawnRandomTorque.d.ts +20 -0
  163. package/dist/particles/spawnModules/UISpawnRandomTorque.js +45 -0
  164. package/dist/particles/spawnModules/UISpawnRandomVelocity.d.ts +26 -0
  165. package/dist/particles/spawnModules/UISpawnRandomVelocity.js +64 -0
  166. package/dist/particles/spawnModules/UISpawnRectangle.d.ts +27 -0
  167. package/dist/particles/spawnModules/UISpawnRectangle.js +62 -0
  168. package/package.json +27 -36
  169. package/dist/index.js.map +0 -1
  170. package/dist/index.min.js +0 -2
  171. package/dist/index.min.js.map +0 -1
  172. /package/dist/{constraints → core/constraints}/UIAspectConstraint/UIAspectConstraint.Internal.d.ts +0 -0
  173. /package/dist/{constraints → core/constraints}/UIAspectConstraint/UIAspectConstraint.d.ts +0 -0
  174. /package/dist/{constraints → core/constraints}/UICustomConstraint.d.ts +0 -0
  175. /package/dist/{constraints → core/constraints}/UIHeightConstraint/UIHeightConstraint.Internal.d.ts +0 -0
  176. /package/dist/{constraints → core/constraints}/UIHeightConstraint/UIHeightConstraint.d.ts +0 -0
  177. /package/dist/{constraints → core/constraints}/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.Internal.d.ts +0 -0
  178. /package/dist/{constraints → core/constraints}/UIHorizontalDistanceConstraint/UIHorizontalDistanceConstraint.d.ts +0 -0
  179. /package/dist/{constraints → core/constraints}/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.Internal.d.ts +0 -0
  180. /package/dist/{constraints → core/constraints}/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.d.ts +0 -0
  181. /package/dist/{constraints → core/constraints}/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.Internal.d.ts +0 -0
  182. /package/dist/{constraints → core/constraints}/UIHorizontalProportionConstraint/UIHorizontalProportionConstraint.d.ts +0 -0
  183. /package/dist/{constraints → core/constraints}/UISingleParameterConstraint/UISingleParameterConstraint.Internal.d.ts +0 -0
  184. /package/dist/{constraints → core/constraints}/UISingleParameterConstraint/UISingleParameterConstraint.d.ts +0 -0
  185. /package/dist/{constraints → core/constraints}/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.Internal.d.ts +0 -0
  186. /package/dist/{constraints → core/constraints}/UIVerticalDistanceConstraint/UIVerticalDistanceConstraint.d.ts +0 -0
  187. /package/dist/{constraints → core/constraints}/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.Internal.d.ts +0 -0
  188. /package/dist/{constraints → core/constraints}/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.d.ts +0 -0
  189. /package/dist/{constraints → core/constraints}/UIVerticalProportionConstraint/UIVerticalProportionConstraint.Internal.d.ts +0 -0
  190. /package/dist/{constraints → core/constraints}/UIVerticalProportionConstraint/UIVerticalProportionConstraint.d.ts +0 -0
  191. /package/dist/{constraints → core/constraints}/UIWidthConstraint/UIWidthConstraint.Internal.d.ts +0 -0
  192. /package/dist/{constraints → core/constraints}/UIWidthConstraint/UIWidthConstraint.d.ts +0 -0
  193. /package/dist/{constraints → core/constraints}/builders/UIConstraint2DBuilder.Internal.d.ts +0 -0
  194. /package/dist/{constraints → core/constraints}/builders/UIConstraint2DBuilder.d.ts +0 -0
  195. /package/dist/{constraints → core/constraints}/builders/UICoverConstraintBuilder.Internal.d.ts +0 -0
  196. /package/dist/{constraints → core/constraints}/builders/UICoverConstraintBuilder.d.ts +0 -0
  197. /package/dist/{constraints → core/constraints}/builders/UIFitConstraintBuilder.Internal.d.ts +0 -0
  198. /package/dist/{constraints → core/constraints}/builders/UIFitConstraintBuilder.d.ts +0 -0
  199. /package/dist/{elements → core/elements}/UIAnimatedImage/UIAnimatedImage.Internal.d.ts +0 -0
  200. /package/dist/{elements → core/elements}/UIAnimatedImage/UIAnimatedImage.d.ts +0 -0
  201. /package/dist/{elements → core/elements}/UIDummy/UIDummy.Internal.d.ts +0 -0
  202. /package/dist/{elements → core/elements}/UIElement/UIElement.Internal.d.ts +0 -0
  203. /package/dist/{elements → core/elements}/UIGraphics/UIGraphics.Internal.d.ts +0 -0
  204. /package/dist/{elements → core/elements}/UIGraphics/UIGraphics.d.ts +0 -0
  205. /package/dist/{elements → core/elements}/UIImage/UIImage.Internal.d.ts +0 -0
  206. /package/dist/{elements → core/elements}/UIImage/UIImage.d.ts +0 -0
  207. /package/dist/{elements → core/elements}/UINineSlice/UINineSlice.Internal.d.ts +0 -0
  208. /package/dist/{elements → core/elements}/UINineSlice/UINineSlice.d.ts +0 -0
  209. /package/dist/{elements → core/elements}/UIProgress/UIProgress.Internal.d.ts +0 -0
  210. /package/dist/{elements → core/elements}/UIProgress/UIProgress.d.ts +0 -0
  211. /package/dist/{elements → core/elements}/UIScene/UIScene.Internal.d.ts +0 -0
  212. /package/dist/{elements → core/elements}/UIScene/UIScene.d.ts +0 -0
  213. /package/dist/{elements → core/elements}/UIText/UIText.Interfaces.d.ts +0 -0
  214. /package/dist/{elements → core/elements}/UIText/UIText.Internal.d.ts +0 -0
  215. /package/dist/{elements → core/elements}/UIText/UIText.Measuring.d.ts +0 -0
  216. /package/dist/{elements → core/elements}/UIText/UIText.Rendering.d.ts +0 -0
  217. /package/dist/{elements → core/elements}/UIText/UIText.d.ts +0 -0
  218. /package/dist/{index.d.ts → core/index.d.ts} +0 -0
  219. /package/dist/{layers → core/layers}/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts +0 -0
  220. /package/dist/{layers → core/layers}/UIFullscreenLayer/UIFullscreenLayer.d.ts +0 -0
  221. /package/dist/{layers → core/layers}/UILayer/UILayer.Internal.d.ts +0 -0
  222. /package/dist/{layers → core/layers}/UILayer/UILayer.d.ts +0 -0
  223. /package/dist/{miscellaneous → core/miscellaneous}/UIExpression.d.ts +0 -0
  224. /package/dist/{miscellaneous → core/miscellaneous}/UIMode.d.ts +0 -0
  225. /package/dist/{miscellaneous → core/miscellaneous}/UIOrientation.d.ts +0 -0
  226. /package/dist/{miscellaneous → core/miscellaneous}/UIPriority.d.ts +0 -0
  227. /package/dist/{miscellaneous → core/miscellaneous}/UIRelation.d.ts +0 -0
  228. /package/dist/{miscellaneous → core/miscellaneous}/UITransparencyMode.d.ts +0 -0
  229. /package/dist/{miscellaneous → core/miscellaneous}/area/UIArea.d.ts +0 -0
  230. /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaCircle.d.ts +0 -0
  231. /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaPolygon.d.ts +0 -0
  232. /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaRectangle.d.ts +0 -0
  233. /package/dist/{miscellaneous → core/miscellaneous}/area/UIAreaRoundedRectangle.d.ts +0 -0
  234. /package/dist/{miscellaneous → core/miscellaneous}/asserts.d.ts +0 -0
  235. /package/dist/{miscellaneous → core/miscellaneous}/canvas.d.ts +0 -0
  236. /package/dist/{miscellaneous → core/miscellaneous}/color/UIColor.Internal.d.ts +0 -0
  237. /package/dist/{miscellaneous → core/miscellaneous}/color/UIColor.d.ts +0 -0
  238. /package/dist/{miscellaneous → core/miscellaneous}/computeTransform.d.ts +0 -0
  239. /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +0 -0
  240. /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.d.ts +0 -0
  241. /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts +0 -0
  242. /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.d.ts +0 -0
  243. /package/dist/{miscellaneous → core/miscellaneous}/generic-plane/shared.d.ts +0 -0
  244. /package/dist/{miscellaneous → core/miscellaneous}/insets/UIInsets.Internal.d.ts +0 -0
  245. /package/dist/{miscellaneous → core/miscellaneous}/insets/UIInsets.d.ts +0 -0
  246. /package/dist/{miscellaneous → core/miscellaneous}/mask-function/UIProgressMaskFunction.d.ts +0 -0
  247. /package/dist/{miscellaneous → core/miscellaneous}/mask-function/UIProgressMaskFunctionCircular.d.ts +0 -0
  248. /package/dist/{miscellaneous → core/miscellaneous}/mask-function/UIProgressMaskFunctionDirectional.d.ts +0 -0
  249. /package/dist/{miscellaneous → core/miscellaneous}/micro/UIMicro.Internal.d.ts +0 -0
  250. /package/dist/{miscellaneous → core/miscellaneous}/micro/UIMicro.d.ts +0 -0
  251. /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicy.d.ts +0 -0
  252. /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyCover.d.ts +0 -0
  253. /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyCross.d.ts +0 -0
  254. /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyCrossInverted.d.ts +0 -0
  255. /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyFit.d.ts +0 -0
  256. /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyFixedHeight.d.ts +0 -0
  257. /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyFixedWidth.d.ts +0 -0
  258. /package/dist/{miscellaneous → core/miscellaneous}/resize-policy/UIResizePolicyNone.d.ts +0 -0
  259. /package/dist/{miscellaneous → core/miscellaneous}/shared.d.ts +0 -0
  260. /package/dist/{miscellaneous → core/miscellaneous}/text-span/UITextSpan.Internal.d.ts +0 -0
  261. /package/dist/{miscellaneous → core/miscellaneous}/text-span/UITextSpan.d.ts +0 -0
  262. /package/dist/{miscellaneous → core/miscellaneous}/text-style/UITextStyle.Internal.d.ts +0 -0
  263. /package/dist/{miscellaneous → core/miscellaneous}/text-style/UITextStyle.d.ts +0 -0
  264. /package/dist/{miscellaneous → core/miscellaneous}/texture/UITextureView.Internal.d.ts +0 -0
  265. /package/dist/{miscellaneous → core/miscellaneous}/texture/UITextureView.d.ts +0 -0
  266. /package/dist/{miscellaneous → core/miscellaneous}/webglCapabilities.d.ts +0 -0
@@ -0,0 +1,357 @@
1
+ import { convertUIPropertiesToGLProperties, cloneProperties, extractZIndex, cloneGLProperties } from '../shared.js';
2
+ import { UIGenericInstancedPlane } from '../UIGenericInstancedPlane/UIGenericInstancedPlane.js';
3
+
4
+ /**
5
+ * Manages shader plane instances with automatic batching based on zIndex order.
6
+ *
7
+ * Uses dirty/flush pattern:
8
+ * - Mutations update internal state and mark dirty
9
+ * - flush() applies all pending changes to GPU representation
10
+ * - setVisibility is immediate (doesn't affect structure)
11
+ *
12
+ * @internal
13
+ */
14
+ class UIPlaneRegistry {
15
+ constructor(scene) {
16
+ // Source of truth
17
+ this._private_handlerToState = new Map();
18
+ this._private_lastHandler = 0;
19
+ // GPU representation
20
+ this._private_orderedMeshes = [];
21
+ this._private_handlerToDescriptor = new Map();
22
+ // Dirty tracking
23
+ this._private_pendingCreate = new Set();
24
+ this._private_pendingDelete = new Set();
25
+ this._private_pendingRelocate = new Set();
26
+ this._private_needsFlush = false;
27
+ this._private_scene = scene;
28
+ }
29
+ /**
30
+ * Creates plane with given shader and properties.
31
+ * Properties and transform are cloned; originals can be safely modified.
32
+ * Changes are pending until flush() is called.
33
+ * @returns Plane handler for subsequent operations
34
+ */
35
+ createPlane(source, properties, transform, visibility, transparency) {
36
+ const handler = this._private_lastHandler++;
37
+ const glProperties = convertUIPropertiesToGLProperties(cloneProperties(properties));
38
+ const zIndex = extractZIndex(transform);
39
+ const state = {
40
+ source,
41
+ properties: glProperties,
42
+ transform: transform.clone(),
43
+ visibility,
44
+ transparency,
45
+ zIndex,
46
+ };
47
+ this._private_handlerToState.set(handler, state);
48
+ this._private_pendingCreate.add(handler);
49
+ this._private_needsFlush = true;
50
+ return handler;
51
+ }
52
+ /**
53
+ * Removes plane. Changes are pending until flush() is called.
54
+ */
55
+ destroyPlane(handler) {
56
+ if (!this._private_handlerToState.has(handler)) {
57
+ throw new Error(`UIPlaneRegistry.destroyPlane: handler ${handler} not found`);
58
+ }
59
+ this._private_handlerToState.delete(handler);
60
+ // If was pending create, just remove from there
61
+ if (this._private_pendingCreate.has(handler)) {
62
+ this._private_pendingCreate.delete(handler);
63
+ return;
64
+ }
65
+ // Remove from relocate if was there
66
+ this._private_pendingRelocate.delete(handler);
67
+ // Mark for deletion
68
+ this._private_pendingDelete.add(handler);
69
+ this._private_needsFlush = true;
70
+ }
71
+ /**
72
+ * Updates plane properties.
73
+ * Values are copied; originals can be safely modified.
74
+ * If texture changes, element will be relocated on flush().
75
+ * Instantiable properties are applied immediately.
76
+ */
77
+ setProperties(handler, properties) {
78
+ const state = this._private_resolveState(handler);
79
+ const glProperties = convertUIPropertiesToGLProperties(properties);
80
+ // Check if any non-instantiable (texture) changed
81
+ let textureChanged = false;
82
+ for (const name in glProperties) {
83
+ const newProp = glProperties[name];
84
+ const oldProp = state.properties[name];
85
+ if (!newProp.glslTypeInfo.instantiable) {
86
+ if (oldProp.value !== newProp.value) {
87
+ textureChanged = true;
88
+ }
89
+ }
90
+ // Update state
91
+ state.properties[name] = {
92
+ value: newProp.value,
93
+ glslTypeInfo: newProp.glslTypeInfo,
94
+ };
95
+ }
96
+ if (textureChanged && !this._private_pendingCreate.has(handler)) {
97
+ this._private_pendingRelocate.add(handler);
98
+ this._private_needsFlush = true;
99
+ }
100
+ else {
101
+ // Apply immediately if already in mesh and no texture change
102
+ const descriptor = this._private_handlerToDescriptor.get(handler);
103
+ if (descriptor) {
104
+ descriptor.mesh.setPropertiesAt(descriptor.instanceIndex, glProperties);
105
+ }
106
+ }
107
+ }
108
+ /**
109
+ * Updates plane transform matrix.
110
+ * Matrix is copied; original can be safely modified.
111
+ * If zIndex changes, element will be relocated on flush().
112
+ */
113
+ setTransform(handler, transform) {
114
+ const state = this._private_resolveState(handler);
115
+ const newZIndex = extractZIndex(transform);
116
+ const oldZIndex = state.zIndex;
117
+ state.transform.copy(transform);
118
+ state.zIndex = newZIndex;
119
+ if (oldZIndex !== newZIndex && !this._private_pendingCreate.has(handler)) {
120
+ this._private_pendingRelocate.add(handler);
121
+ this._private_needsFlush = true;
122
+ }
123
+ else {
124
+ // Apply immediately if already in mesh and zIndex unchanged
125
+ const descriptor = this._private_handlerToDescriptor.get(handler);
126
+ if (descriptor) {
127
+ descriptor.mesh.setTransformAt(descriptor.instanceIndex, transform);
128
+ }
129
+ }
130
+ }
131
+ /**
132
+ * Updates plane visibility.
133
+ * This is applied immediately (doesn't affect batching structure).
134
+ */
135
+ setVisibility(handler, visibility) {
136
+ const state = this._private_resolveState(handler);
137
+ state.visibility = visibility;
138
+ // Apply immediately if already in a mesh
139
+ const descriptor = this._private_handlerToDescriptor.get(handler);
140
+ if (descriptor) {
141
+ descriptor.mesh.setVisibilityAt(descriptor.instanceIndex, visibility);
142
+ }
143
+ }
144
+ /**
145
+ * Updates plane transparency mode.
146
+ * Element will be relocated on flush() if transparency changes.
147
+ */
148
+ setTransparency(handler, transparency) {
149
+ const state = this._private_resolveState(handler);
150
+ if (state.transparency === transparency) {
151
+ return;
152
+ }
153
+ state.transparency = transparency;
154
+ if (!this._private_pendingCreate.has(handler)) {
155
+ this._private_pendingRelocate.add(handler);
156
+ this._private_needsFlush = true;
157
+ }
158
+ }
159
+ /**
160
+ * Apply all pending changes to GPU representation.
161
+ * Call this before rendering.
162
+ */
163
+ flush() {
164
+ if (!this._private_needsFlush) {
165
+ return;
166
+ }
167
+ this._private_processDeletes();
168
+ this._private_processRelocates();
169
+ this._private_processCreates();
170
+ this._private_mergeCompatibleNeighbors();
171
+ this._private_cleanupEmptyMeshes();
172
+ this._private_syncSceneOrder();
173
+ this._private_pendingCreate.clear();
174
+ this._private_pendingDelete.clear();
175
+ this._private_pendingRelocate.clear();
176
+ this._private_needsFlush = false;
177
+ }
178
+ _private_processDeletes() {
179
+ for (const handler of this._private_pendingDelete) {
180
+ const descriptor = this._private_handlerToDescriptor.get(handler);
181
+ if (!descriptor) {
182
+ continue; // Already removed
183
+ }
184
+ const { mesh, instanceIndex } = descriptor;
185
+ mesh.removeAt(instanceIndex);
186
+ this._private_shiftHandlerIndices(mesh, instanceIndex + 1, -1);
187
+ this._private_handlerToDescriptor.delete(handler);
188
+ }
189
+ }
190
+ _private_processRelocates() {
191
+ for (const handler of this._private_pendingRelocate) {
192
+ const descriptor = this._private_handlerToDescriptor.get(handler);
193
+ if (!descriptor) {
194
+ continue; // Not in mesh yet
195
+ }
196
+ const { mesh, instanceIndex } = descriptor;
197
+ mesh.removeAt(instanceIndex);
198
+ this._private_shiftHandlerIndices(mesh, instanceIndex + 1, -1);
199
+ this._private_handlerToDescriptor.delete(handler);
200
+ // Will be re-inserted in processCreates
201
+ this._private_pendingCreate.add(handler);
202
+ }
203
+ }
204
+ _private_processCreates() {
205
+ if (this._private_pendingCreate.size === 0) {
206
+ return;
207
+ }
208
+ // Collect and sort by zIndex
209
+ const toCreate = [];
210
+ for (const handler of this._private_pendingCreate) {
211
+ const state = this._private_handlerToState.get(handler);
212
+ if (state) {
213
+ toCreate.push({ handler, state });
214
+ }
215
+ }
216
+ toCreate.sort((a, b) => a.state.zIndex - b.state.zIndex);
217
+ // Check for duplicate zIndex
218
+ for (let i = 1; i < toCreate.length; i++) {
219
+ if (toCreate[i].state.zIndex === toCreate[i - 1].state.zIndex) {
220
+ throw new Error(`UIPlaneRegistry.flush: duplicate zIndex=${toCreate[i].state.zIndex} ` +
221
+ `for handlers ${toCreate[i - 1].handler} and ${toCreate[i].handler}`);
222
+ }
223
+ }
224
+ // Insert each element
225
+ for (const { handler, state } of toCreate) {
226
+ this._private_insertSingleElement(handler, state);
227
+ }
228
+ }
229
+ _private_insertSingleElement(handler, state) {
230
+ const { source, properties, transform, visibility, transparency, zIndex } = state;
231
+ // Find compatible mesh
232
+ let candidateMesh = null;
233
+ for (const mesh of this._private_orderedMeshes) {
234
+ if (!mesh.isCompatibleWith(source, properties, transparency)) {
235
+ continue;
236
+ }
237
+ if (mesh.instancesCount === 0) {
238
+ candidateMesh = mesh;
239
+ break;
240
+ }
241
+ const meshMinZ = mesh.getZIndexAt(0);
242
+ const meshMaxZ = mesh.getZIndexAt(mesh.instancesCount - 1);
243
+ // Can insert if zIndex fits within or extends the range
244
+ if (zIndex >= meshMinZ - 1 && zIndex <= meshMaxZ + 1) {
245
+ candidateMesh = mesh;
246
+ break;
247
+ }
248
+ }
249
+ if (candidateMesh) {
250
+ const instanceIndex = this._private_findInstanceIndexInMesh(candidateMesh, zIndex);
251
+ candidateMesh.insertAt(instanceIndex, properties, transform, visibility);
252
+ this._private_shiftHandlerIndices(candidateMesh, instanceIndex, 1);
253
+ this._private_handlerToDescriptor.set(handler, {
254
+ mesh: candidateMesh,
255
+ instanceIndex,
256
+ });
257
+ }
258
+ else {
259
+ // Create new mesh
260
+ const meshIndex = this._private_findMeshIndexForZIndex(zIndex);
261
+ const mesh = new UIGenericInstancedPlane(source, cloneGLProperties(properties), transparency);
262
+ mesh.insertAt(0, properties, transform, visibility);
263
+ this._private_orderedMeshes.splice(meshIndex, 0, mesh);
264
+ this._private_scene.add(mesh);
265
+ this._private_handlerToDescriptor.set(handler, { mesh, instanceIndex: 0 });
266
+ }
267
+ }
268
+ _private_mergeCompatibleNeighbors() {
269
+ let i = 0;
270
+ while (i < this._private_orderedMeshes.length - 1) {
271
+ const left = this._private_orderedMeshes[i];
272
+ const right = this._private_orderedMeshes[i + 1];
273
+ if (left.instancesCount === 0 || right.instancesCount === 0) {
274
+ i++;
275
+ continue;
276
+ }
277
+ const leftMaxZ = left.getZIndexAt(left.instancesCount - 1);
278
+ const rightMinZ = right.getZIndexAt(0);
279
+ // Check if they can be merged (non-overlapping zIndex ranges and compatible)
280
+ if (leftMaxZ < rightMinZ &&
281
+ left.isCompatibleWith(right.source, right.getProperties(), right.transparency)) {
282
+ const indexOffset = left.instancesCount;
283
+ left.merge(right);
284
+ this._private_remapHandlersAfterMerge(right, left, indexOffset);
285
+ this._private_scene.remove(right);
286
+ right.destroy();
287
+ this._private_orderedMeshes.splice(i + 1, 1);
288
+ // Don't increment i, check if we can merge again
289
+ continue;
290
+ }
291
+ i++;
292
+ }
293
+ }
294
+ _private_cleanupEmptyMeshes() {
295
+ for (let i = this._private_orderedMeshes.length - 1; i >= 0; i--) {
296
+ const mesh = this._private_orderedMeshes[i];
297
+ if (mesh.instancesCount === 0) {
298
+ this._private_scene.remove(mesh);
299
+ mesh.destroy();
300
+ this._private_orderedMeshes.splice(i, 1);
301
+ }
302
+ }
303
+ }
304
+ _private_resolveState(handler) {
305
+ const state = this._private_handlerToState.get(handler);
306
+ if (!state) {
307
+ throw new Error(`UIPlaneRegistry.resolveState: handler ${handler} not found`);
308
+ }
309
+ return state;
310
+ }
311
+ _private_findMeshIndexForZIndex(zIndex) {
312
+ for (let i = 0; i < this._private_orderedMeshes.length; i++) {
313
+ const mesh = this._private_orderedMeshes[i];
314
+ if (mesh.instancesCount > 0 && mesh.getZIndexAt(0) > zIndex) {
315
+ return i;
316
+ }
317
+ }
318
+ return this._private_orderedMeshes.length;
319
+ }
320
+ _private_findInstanceIndexInMesh(mesh, zIndex) {
321
+ for (let i = 0; i < mesh.instancesCount; i++) {
322
+ if (mesh.getZIndexAt(i) > zIndex) {
323
+ return i;
324
+ }
325
+ }
326
+ return mesh.instancesCount;
327
+ }
328
+ _private_shiftHandlerIndices(mesh, fromIndex, delta) {
329
+ for (const descriptor of this._private_handlerToDescriptor.values()) {
330
+ if (descriptor.mesh === mesh && descriptor.instanceIndex >= fromIndex) {
331
+ descriptor.instanceIndex += delta;
332
+ }
333
+ }
334
+ }
335
+ _private_remapHandlersAfterMerge(fromMesh, toMesh, indexOffset) {
336
+ for (const descriptor of this._private_handlerToDescriptor.values()) {
337
+ if (descriptor.mesh === fromMesh) {
338
+ descriptor.mesh = toMesh;
339
+ descriptor.instanceIndex += indexOffset;
340
+ }
341
+ }
342
+ }
343
+ _private_syncSceneOrder() {
344
+ // Sort meshes by their minimum zIndex
345
+ this._private_orderedMeshes.sort((a, b) => {
346
+ const aZ = a.instancesCount > 0 ? a.getZIndexAt(0) : 0;
347
+ const bZ = b.instancesCount > 0 ? b.getZIndexAt(0) : 0;
348
+ return aZ - bZ;
349
+ });
350
+ // Update render order
351
+ for (let i = 0; i < this._private_orderedMeshes.length; i++) {
352
+ this._private_orderedMeshes[i].renderOrder = i;
353
+ }
354
+ }
355
+ }
356
+
357
+ export { UIPlaneRegistry };
@@ -0,0 +1,228 @@
1
+ import { Texture, Vector2, Vector3, Vector4, Matrix3, Matrix4 } from 'three';
2
+ import { UIColor } from '../color/UIColor.js';
3
+ import { checkSRGBSupport } from '../webglCapabilities.js';
4
+
5
+ const DEFAULT_ALPHA_TEST = 0.5;
6
+ const GLSL_TYPE_INFO_FLOAT = Object.freeze({
7
+ glslTypeName: "float",
8
+ bufferSize: 1,
9
+ instantiable: true,
10
+ });
11
+ const GLSL_TYPE_INFO_SAMPLER2D = Object.freeze({
12
+ glslTypeName: "sampler2D",
13
+ bufferSize: -1,
14
+ instantiable: false,
15
+ });
16
+ const GLSL_TYPE_INFO_VEC2 = Object.freeze({
17
+ glslTypeName: "vec2",
18
+ bufferSize: 2,
19
+ instantiable: true,
20
+ });
21
+ const GLSL_TYPE_INFO_VEC3 = Object.freeze({
22
+ glslTypeName: "vec3",
23
+ bufferSize: 3,
24
+ instantiable: true,
25
+ });
26
+ const GLSL_TYPE_INFO_VEC4 = Object.freeze({
27
+ glslTypeName: "vec4",
28
+ bufferSize: 4,
29
+ instantiable: true,
30
+ });
31
+ const GLSL_TYPE_INFO_MAT3 = Object.freeze({
32
+ glslTypeName: "mat3",
33
+ bufferSize: 9,
34
+ instantiable: true,
35
+ });
36
+ const GLSL_TYPE_INFO_MAT4 = Object.freeze({
37
+ glslTypeName: "mat4",
38
+ bufferSize: 16,
39
+ instantiable: true,
40
+ });
41
+ function resolveGLSLTypeInfo(value) {
42
+ if (typeof value === "string") {
43
+ switch (value) {
44
+ case "number":
45
+ return GLSL_TYPE_INFO_FLOAT;
46
+ case "Texture":
47
+ return GLSL_TYPE_INFO_SAMPLER2D;
48
+ case "UIColor":
49
+ return GLSL_TYPE_INFO_VEC4;
50
+ case "Vector2":
51
+ return GLSL_TYPE_INFO_VEC2;
52
+ case "Vector3":
53
+ return GLSL_TYPE_INFO_VEC3;
54
+ case "Vector4":
55
+ return GLSL_TYPE_INFO_VEC4;
56
+ case "Matrix3":
57
+ return GLSL_TYPE_INFO_MAT3;
58
+ case "Matrix4":
59
+ return GLSL_TYPE_INFO_MAT4;
60
+ default:
61
+ throw new Error(`resolveGLSLTypeInfo.value: unsupported property type name`);
62
+ }
63
+ }
64
+ if (typeof value === "function") {
65
+ if (value === Number) {
66
+ return GLSL_TYPE_INFO_FLOAT;
67
+ }
68
+ if (value === Texture) {
69
+ return GLSL_TYPE_INFO_SAMPLER2D;
70
+ }
71
+ if (value === UIColor) {
72
+ return GLSL_TYPE_INFO_VEC4;
73
+ }
74
+ if (value === Vector2) {
75
+ return GLSL_TYPE_INFO_VEC2;
76
+ }
77
+ if (value === Vector3) {
78
+ return GLSL_TYPE_INFO_VEC3;
79
+ }
80
+ if (value === Vector4) {
81
+ return GLSL_TYPE_INFO_VEC4;
82
+ }
83
+ if (value === Matrix3) {
84
+ return GLSL_TYPE_INFO_MAT3;
85
+ }
86
+ if (value === Matrix4) {
87
+ return GLSL_TYPE_INFO_MAT4;
88
+ }
89
+ throw new Error(`resolveGLSLTypeInfo.value: unsupported property type constructor`);
90
+ }
91
+ if (typeof value === "number") {
92
+ return GLSL_TYPE_INFO_FLOAT;
93
+ }
94
+ if (value instanceof Texture) {
95
+ return GLSL_TYPE_INFO_SAMPLER2D;
96
+ }
97
+ if (value instanceof UIColor) {
98
+ return GLSL_TYPE_INFO_VEC4;
99
+ }
100
+ if (value instanceof Vector2) {
101
+ return GLSL_TYPE_INFO_VEC2;
102
+ }
103
+ if (value instanceof Vector3) {
104
+ return GLSL_TYPE_INFO_VEC3;
105
+ }
106
+ if (value instanceof Vector4) {
107
+ return GLSL_TYPE_INFO_VEC4;
108
+ }
109
+ if (value instanceof Matrix3) {
110
+ return GLSL_TYPE_INFO_MAT3;
111
+ }
112
+ if (value instanceof Matrix4) {
113
+ return GLSL_TYPE_INFO_MAT4;
114
+ }
115
+ throw new Error(`resolveGLSLTypeInfo.value: unsupported property type`);
116
+ }
117
+ function resolvePropertyUniform(name, material) {
118
+ const uniform = material.uniforms[`p_${name}`];
119
+ if (uniform === undefined) {
120
+ throw new Error(`resolvePropertyUniform.name: unknown uniform`);
121
+ }
122
+ return uniform;
123
+ }
124
+ function arePropertiesPartiallyCompatible(full, partial) {
125
+ for (const key in partial) {
126
+ if (!(key in full)) {
127
+ return false;
128
+ }
129
+ const infoFull = full[key].glslTypeInfo;
130
+ const infoPartial = partial[key].glslTypeInfo;
131
+ if (infoFull.glslTypeName !== infoPartial.glslTypeName) {
132
+ return false;
133
+ }
134
+ // Non-instantiable (textures) must match by reference
135
+ if (!infoFull.instantiable && full[key].value !== partial[key].value) {
136
+ return false;
137
+ }
138
+ }
139
+ return true;
140
+ }
141
+ function convertUIPropertiesToGLProperties(uiProperties) {
142
+ const glProperties = {};
143
+ for (const name in uiProperties) {
144
+ const value = uiProperties[name];
145
+ glProperties[name] = { value, glslTypeInfo: resolveGLSLTypeInfo(value) };
146
+ }
147
+ return glProperties;
148
+ }
149
+ function cloneProperty(property) {
150
+ if (typeof property === "number" || property instanceof Texture) {
151
+ return property;
152
+ }
153
+ return property.clone();
154
+ }
155
+ function cloneProperties(properties) {
156
+ const result = {};
157
+ for (const name in properties) {
158
+ result[name] = cloneProperty(properties[name]);
159
+ }
160
+ return result;
161
+ }
162
+ function cloneGLProperties(properties) {
163
+ const result = {};
164
+ for (const name in properties) {
165
+ const prop = properties[name];
166
+ result[name] = {
167
+ value: cloneProperty(prop.value),
168
+ glslTypeInfo: prop.glslTypeInfo,
169
+ };
170
+ }
171
+ return result;
172
+ }
173
+ /** Extracts zIndex from transform matrix (translation.z component) */
174
+ function extractZIndex(transform) {
175
+ return transform.elements[14];
176
+ }
177
+ /** Extracts zIndex from transform buffer at given instance index */
178
+ function extractZIndexFromBuffer(buffer, instanceIndex) {
179
+ return buffer[instanceIndex * 16 + 14];
180
+ }
181
+ function buildGenericPlaneFragmentShader(uniformDeclarations, varyingDeclarations, source) {
182
+ return `
183
+ // Defines
184
+ #define PI 3.14159265359
185
+ #define SRGB_SUPPORTED ${checkSRGBSupport() ? "1" : "0"}
186
+
187
+ // Uniforms
188
+ ${uniformDeclarations.join("\n")}
189
+
190
+ // Builtin varyings
191
+ varying vec3 p_position;
192
+ varying vec2 p_uv;
193
+
194
+ // User varyings
195
+ ${varyingDeclarations.join("\n")}
196
+
197
+ #include <alphahash_pars_fragment>
198
+
199
+ // sRGB decode helper
200
+ vec4 srgbTexture2D(sampler2D textureSampler, vec2 uv) {
201
+ #if SRGB_SUPPORTED
202
+ return texture2D(textureSampler, uv);
203
+ #else
204
+ vec4 textureValue = texture2D(textureSampler, uv);
205
+ return vec4(pow(textureValue.rgb, vec3(2.2)), textureValue.a);
206
+ #endif
207
+ }
208
+
209
+ // Source must define vec4 draw() function
210
+ ${source}
211
+ void main() {
212
+ vec4 diffuseColor = draw();
213
+ #ifdef USE_ALPHATEST
214
+ if (diffuseColor.a < ${DEFAULT_ALPHA_TEST.toFixed(2)}) {
215
+ discard;
216
+ }
217
+ #endif
218
+ #ifdef USE_ALPHAHASH
219
+ if (diffuseColor.a < getAlphaHashThreshold(p_position)) {
220
+ discard;
221
+ }
222
+ #endif
223
+ gl_FragColor = linearToOutputTexel(diffuseColor);
224
+ }
225
+ `;
226
+ }
227
+
228
+ export { DEFAULT_ALPHA_TEST, arePropertiesPartiallyCompatible, buildGenericPlaneFragmentShader, cloneGLProperties, cloneProperties, cloneProperty, convertUIPropertiesToGLProperties, extractZIndex, extractZIndexFromBuffer, resolveGLSLTypeInfo, resolvePropertyUniform };
@@ -0,0 +1,3 @@
1
+ const INSETS_DEFAULT_VALUE = 0;
2
+
3
+ export { INSETS_DEFAULT_VALUE };