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,188 @@
1
+ import { Vector4 } from 'three';
2
+ import { UIColor } from '../../miscellaneous/color/UIColor.js';
3
+ import { computeTrimmedTransformMatrix } from '../../miscellaneous/computeTransform.js';
4
+ import { UIInsets } from '../../miscellaneous/insets/UIInsets.js';
5
+ import { UITextureView } from '../../miscellaneous/texture/UITextureView.js';
6
+ import source from '../../shaders/UINineSlice.glsl.js';
7
+ import { UIElement } from '../UIElement/UIElement.js';
8
+ import { NINE_SLICE_DEFAULT_BORDER, NINE_SLICE_DEFAULT_REGION_MODE, UINineSliceRegionMode } from './UINineSlice.Internal.js';
9
+
10
+ /** Scalable textured image preserving border regions */
11
+ class UINineSlice extends UIElement {
12
+ /**
13
+ * Creates a new UINineSlice instance.
14
+ *
15
+ * Defaults size to texture dimensions if width and height not provided.
16
+ *
17
+ * @param layer - Layer containing this element
18
+ * @param texture - Texture to display
19
+ * @param options - Configuration options
20
+ */
21
+ constructor(layer, texture, options = {}) {
22
+ const color = new UIColor(options.color);
23
+ const textureView = new UITextureView(texture);
24
+ const textureTransform = textureView.calculateUVTransform();
25
+ options.width = options.width ?? textureView.width;
26
+ options.height = options.height ?? textureView.height;
27
+ const sliceBorders = new UIInsets(options.sliceBorders ?? NINE_SLICE_DEFAULT_BORDER);
28
+ const sliceRegions = new UIInsets(options.sliceRegions ?? NINE_SLICE_DEFAULT_BORDER);
29
+ const regionMode = options.regionMode ?? NINE_SLICE_DEFAULT_REGION_MODE;
30
+ const sliceBordersVector = new Vector4();
31
+ const sliceRegionsVector = new Vector4();
32
+ super(layer, source, {
33
+ texture: textureView.texture,
34
+ textureTransform: textureTransform,
35
+ color,
36
+ sliceBorders: sliceBordersVector,
37
+ sliceRegions: sliceRegionsVector,
38
+ }, options);
39
+ this._private_regionModeDirty = true;
40
+ this._private_sliceBordersVector = new Vector4();
41
+ this._private_sliceRegionsVector = new Vector4();
42
+ this._private_textureDimensionsDirty = true;
43
+ this._private_onTextureDimensionsChanged = () => {
44
+ this._private_textureDimensionsDirty = true;
45
+ };
46
+ this.texture = textureView;
47
+ this._private_textureTransform = textureTransform;
48
+ this._private_colorInternal = color;
49
+ this._private_sliceBordersInternal = sliceBorders;
50
+ this._private_sliceRegionsInternal = sliceRegions;
51
+ this._private_regionModeInternal = regionMode;
52
+ this._private_sliceBordersVector = sliceBordersVector;
53
+ this._private_sliceRegionsVector = sliceRegionsVector;
54
+ this._private_lastElementWidth = this.width;
55
+ this._private_lastElementHeight = this.height;
56
+ this.texture.signalDiminsionsChanged.on(this._private_onTextureDimensionsChanged);
57
+ }
58
+ /** Multiplicative tint. Alpha channel controls opacity. */
59
+ get color() {
60
+ return this._private_colorInternal;
61
+ }
62
+ /** Controls how sliceRegions values are interpreted */
63
+ get regionMode() {
64
+ return this._private_regionModeInternal;
65
+ }
66
+ /** Border size in normalized texture coordinates (0 to 1) */
67
+ get sliceBorders() {
68
+ return this._private_sliceBordersInternal;
69
+ }
70
+ /** Region size. Interpretation depends on regionMode. */
71
+ get sliceRegions() {
72
+ return this._private_sliceRegionsInternal;
73
+ }
74
+ /** Multiplicative tint. Alpha channel controls opacity. */
75
+ set color(value) {
76
+ this._private_colorInternal.set(value);
77
+ }
78
+ /** Controls how sliceRegions values are interpreted */
79
+ set regionMode(value) {
80
+ if (this._private_regionModeInternal !== value) {
81
+ this._private_regionModeInternal = value;
82
+ this._private_regionModeDirty = true;
83
+ }
84
+ }
85
+ /** Border size in normalized texture coordinates (0 to 1) */
86
+ set sliceBorders(value) {
87
+ this._private_sliceBordersInternal.set(value);
88
+ }
89
+ /** Region size. Interpretation depends on regionMode. */
90
+ set sliceRegions(value) {
91
+ this._private_sliceRegionsInternal.set(value);
92
+ }
93
+ /** Removes nine slice and frees resources */
94
+ destroy() {
95
+ this.texture.signalDiminsionsChanged.off(this._private_onTextureDimensionsChanged);
96
+ super.destroy();
97
+ }
98
+ setPlaneTransform() {
99
+ let properties;
100
+ const sliceBordersDirty = this._private_textureDimensionsDirty || this._private_sliceBordersInternal.dirty || this.texture.trimDirty;
101
+ if (sliceBordersDirty) {
102
+ properties ?? (properties = {});
103
+ properties["sliceBorders"] = this._private_calculateSliceBordersForShader(this._private_sliceBordersVector);
104
+ this._private_sliceBordersInternal.setDirtyFalse();
105
+ this._private_textureDimensionsDirty = false;
106
+ }
107
+ const sliceRegionsDirty = this._private_sliceRegionsInternal.dirty || this._private_regionModeDirty ||
108
+ (this._private_regionModeInternal === UINineSliceRegionMode.WORLD &&
109
+ this._private_checkElementDimensionsDirty());
110
+ if (sliceRegionsDirty) {
111
+ properties ?? (properties = {});
112
+ properties["sliceRegions"] = this._private_calculateSliceRegionsForShader(this._private_sliceRegionsVector);
113
+ this._private_sliceRegionsInternal.setDirtyFalse();
114
+ this._private_regionModeDirty = false;
115
+ this._private_setElementDimensionsDirtyFalse();
116
+ }
117
+ if (this._private_colorInternal.dirty) {
118
+ properties ?? (properties = {});
119
+ properties["color"] = this._private_colorInternal;
120
+ this._private_colorInternal.setDirtyFalse();
121
+ }
122
+ if (this.texture.textureDirty) {
123
+ properties ?? (properties = {});
124
+ properties["texture"] = this.texture.texture;
125
+ this.texture.setTextureDirtyFalse();
126
+ }
127
+ if (this.texture.uvTransformDirty) {
128
+ properties ?? (properties = {});
129
+ properties["textureTransform"] = this.texture.calculateUVTransform(this._private_textureTransform);
130
+ this.texture.setUVTransformDirtyFalse();
131
+ }
132
+ if (properties) {
133
+ this.sceneWrapper.setProperties(this.planeHandler, properties);
134
+ }
135
+ const isTransformDirty = this.micro.dirty ||
136
+ this.texture.trimDirty ||
137
+ this.inputWrapper.dirty ||
138
+ this.solverWrapper.dirty;
139
+ if (isTransformDirty) {
140
+ const micro = this.micro;
141
+ const textureTrim = this.texture.trim;
142
+ this.sceneWrapper.setTransform(this.planeHandler, computeTrimmedTransformMatrix(this.x, this.y, this.width, this.height, this.zIndex, micro.x, micro.y, micro.anchorX, micro.anchorY, micro.scaleX, micro.scaleY, micro.rotation, micro.anchorMode, textureTrim.left, textureTrim.right, textureTrim.top, textureTrim.bottom));
143
+ this.micro.setDirtyFalse();
144
+ this.texture.setTrimDirtyFalse();
145
+ }
146
+ }
147
+ _private_calculateSliceBordersForShader(result) {
148
+ const sourceWidth = this.texture.width;
149
+ const sourceHeight = this.texture.height;
150
+ const trim = this.texture.trim;
151
+ const trimmedWidth = sourceWidth - trim.left - trim.right;
152
+ const trimmedHeight = sourceHeight - trim.top - trim.bottom;
153
+ const trimNLeft = trim.left / sourceWidth;
154
+ const trimNRight = trim.right / sourceWidth;
155
+ const trimNTop = trim.top / sourceHeight;
156
+ const trimNBottom = trim.bottom / sourceHeight;
157
+ const trimmedWidthNorm = trimmedWidth / sourceWidth;
158
+ const trimmedHeightNorm = trimmedHeight / sourceHeight;
159
+ const srcLeft = this._private_sliceBordersInternal.left;
160
+ const srcRight = this._private_sliceBordersInternal.right;
161
+ const srcTop = this._private_sliceBordersInternal.top;
162
+ const srcBottom = this._private_sliceBordersInternal.bottom;
163
+ const left = Math.max(0, srcLeft - trimNLeft) / trimmedWidthNorm;
164
+ const right = Math.max(0, srcRight - trimNRight) / trimmedWidthNorm;
165
+ const top = Math.max(0, srcTop - trimNTop) / trimmedHeightNorm;
166
+ const bottom = Math.max(0, srcBottom - trimNBottom) / trimmedHeightNorm;
167
+ return result.set(Math.min(1, left), Math.min(1, right), Math.min(1, top), Math.min(1, bottom));
168
+ }
169
+ _private_calculateSliceRegionsForShader(result) {
170
+ if (this._private_regionModeInternal === UINineSliceRegionMode.NORMALIZED) {
171
+ return result.set(this._private_sliceRegionsInternal.left, this._private_sliceRegionsInternal.right, this._private_sliceRegionsInternal.top, this._private_sliceRegionsInternal.bottom);
172
+ }
173
+ const width = this.width;
174
+ const height = this.height;
175
+ return result.set(this._private_sliceRegionsInternal.left / width, this._private_sliceRegionsInternal.right / width, this._private_sliceRegionsInternal.top / height, this._private_sliceRegionsInternal.bottom / height);
176
+ }
177
+ _private_checkElementDimensionsDirty() {
178
+ return (this.solverWrapper.dirty &&
179
+ (this._private_lastElementWidth !== Math.round(this.width) ||
180
+ this._private_lastElementHeight !== Math.round(this.height)));
181
+ }
182
+ _private_setElementDimensionsDirtyFalse() {
183
+ this._private_lastElementWidth = Math.round(this.width);
184
+ this._private_lastElementHeight = Math.round(this.height);
185
+ }
186
+ }
187
+
188
+ export { UINineSlice };
@@ -0,0 +1,3 @@
1
+ const PROGRESS_DEFAULT_VALUE = 1;
2
+
3
+ export { PROGRESS_DEFAULT_VALUE };
@@ -0,0 +1,165 @@
1
+ import { MathUtils } from 'three';
2
+ import { assertValidNumber } from '../../miscellaneous/asserts.js';
3
+ import { UIColor } from '../../miscellaneous/color/UIColor.js';
4
+ import { computeTrimmedTransformMatrix } from '../../miscellaneous/computeTransform.js';
5
+ import { UIProgressMaskFunctionDirectional } from '../../miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js';
6
+ import { UITextureView } from '../../miscellaneous/texture/UITextureView.js';
7
+ import { isUIModeVisible } from '../../miscellaneous/UIMode.js';
8
+ import source from '../../shaders/UIProgress.glsl.js';
9
+ import { UIElement } from '../UIElement/UIElement.js';
10
+ import { PROGRESS_DEFAULT_VALUE } from './UIProgress.Internal.js';
11
+
12
+ /** Progress bar with customizable fill direction */
13
+ class UIProgress extends UIElement {
14
+ /**
15
+ * Creates a new UIProgress instance.
16
+ *
17
+ * Defaults size to texture dimensions if width and height not provided.
18
+ *
19
+ * @param layer - Layer containing this element
20
+ * @param texture - Texture to display
21
+ * @param options - Configuration options
22
+ */
23
+ constructor(layer, texture, options = {}) {
24
+ if (options.progress !== undefined) {
25
+ assertValidNumber(options.progress, "UIProgress.constructor.options.progress");
26
+ }
27
+ const color = new UIColor(options.color);
28
+ const textureView = new UITextureView(texture);
29
+ const textureTransform = textureView.calculateUVTransform();
30
+ const textureResolution = textureView.getResolution();
31
+ options.width = options.width ?? textureView.width;
32
+ options.height = options.height ?? textureView.height;
33
+ const progress = MathUtils.clamp(options.progress ?? PROGRESS_DEFAULT_VALUE, 0, 1);
34
+ const maskFunction = options.maskFunction ?? new UIProgressMaskFunctionDirectional();
35
+ super(layer, maskFunction.source + source, {
36
+ texture: textureView.texture,
37
+ textureTransform,
38
+ textureResolution,
39
+ color,
40
+ progress,
41
+ ...maskFunction.enumerateProperties(),
42
+ }, options);
43
+ this._private_progressDirty = false;
44
+ this._private_textureResolutionDirty = false;
45
+ this._private_onTextureDimensionsChanged = (width, height) => {
46
+ if (this.width !== width || this.height !== height) {
47
+ this.width = width;
48
+ this.height = height;
49
+ this._private_textureResolutionDirty = true;
50
+ }
51
+ };
52
+ this.texture = textureView;
53
+ this._private_textureTransform = textureTransform;
54
+ this._private_textureResolution = textureResolution;
55
+ this._private_colorInternal = color;
56
+ this._private_progressInternal = progress;
57
+ this._private_maskFunctionInternal = maskFunction;
58
+ this.texture.signalDiminsionsChanged.on(this._private_onTextureDimensionsChanged);
59
+ }
60
+ /** Multiplicative tint. Alpha channel controls opacity. */
61
+ get color() {
62
+ return this._private_colorInternal;
63
+ }
64
+ /** Function controlling fill direction and shape */
65
+ get maskFunction() {
66
+ return this._private_maskFunctionInternal;
67
+ }
68
+ /** Progress from 0 (empty) to 1 (full) */
69
+ get progress() {
70
+ return this._private_progressInternal;
71
+ }
72
+ /** Multiplicative tint. Alpha channel controls opacity. */
73
+ set color(value) {
74
+ this._private_colorInternal.set(value);
75
+ }
76
+ /** Function controlling fill direction and shape */
77
+ set maskFunction(value) {
78
+ if (this._private_maskFunctionInternal !== value) {
79
+ this._private_maskFunctionInternal = value;
80
+ this._private_rebuildPlane();
81
+ }
82
+ }
83
+ /** Progress from 0 (empty) to 1 (full). Clamped. */
84
+ set progress(value) {
85
+ assertValidNumber(value, "UIProgress.progress");
86
+ value = MathUtils.clamp(value, 0, 1);
87
+ if (this._private_progressInternal !== value) {
88
+ this._private_progressInternal = value;
89
+ this._private_progressDirty = true;
90
+ }
91
+ }
92
+ setPlaneTransform() {
93
+ let properties;
94
+ if (this._private_colorInternal.dirty) {
95
+ properties ?? (properties = {});
96
+ properties["color"] = this._private_colorInternal;
97
+ this._private_colorInternal.setDirtyFalse();
98
+ }
99
+ if (this.texture.textureDirty) {
100
+ properties ?? (properties = {});
101
+ properties["texture"] = this.texture.texture;
102
+ this.texture.setTextureDirtyFalse();
103
+ }
104
+ if (this.texture.uvTransformDirty) {
105
+ properties ?? (properties = {});
106
+ properties["textureTransform"] = this.texture.calculateUVTransform(this._private_textureTransform);
107
+ this.texture.setUVTransformDirtyFalse();
108
+ }
109
+ if (this._private_progressDirty) {
110
+ properties ?? (properties = {});
111
+ properties["progress"] = this._private_progressInternal;
112
+ this._private_progressDirty = false;
113
+ }
114
+ if (this._private_textureResolutionDirty) {
115
+ properties ?? (properties = {});
116
+ properties["textureResolution"] = this.texture.getResolution(this._private_textureResolution);
117
+ this._private_textureResolutionDirty = false;
118
+ }
119
+ if (this.maskFunction.dirty) {
120
+ properties ?? (properties = {});
121
+ const maskProperties = this.maskFunction.enumerateProperties();
122
+ for (const key in maskProperties) {
123
+ properties[key] = maskProperties[key];
124
+ }
125
+ this.maskFunction.setDirtyFalse();
126
+ }
127
+ if (properties) {
128
+ this.sceneWrapper.setProperties(this.planeHandler, properties);
129
+ }
130
+ const isTransformDirty = this.micro.dirty ||
131
+ this.texture.trimDirty ||
132
+ this.inputWrapper.dirty ||
133
+ this.solverWrapper.dirty;
134
+ if (isTransformDirty) {
135
+ const micro = this.micro;
136
+ const textureTrim = this.texture.trim;
137
+ this.sceneWrapper.setTransform(this.planeHandler, computeTrimmedTransformMatrix(this.x, this.y, this.width, this.height, this.zIndex, micro.x, micro.y, micro.anchorX, micro.anchorY, micro.scaleX, micro.scaleY, micro.rotation, micro.anchorMode, textureTrim.left, textureTrim.right, textureTrim.top, textureTrim.bottom));
138
+ this.micro.setDirtyFalse();
139
+ this.texture.setTrimDirtyFalse();
140
+ }
141
+ }
142
+ _private_rebuildPlane() {
143
+ this.sceneWrapper.destroyPlane(this.planeHandler);
144
+ const micro = this.micro;
145
+ const textureTrim = this.texture.trim;
146
+ this.planeHandler = this.sceneWrapper.createPlane(this._private_maskFunctionInternal.source + source, {
147
+ texture: this.texture.texture,
148
+ textureTransform: this.texture.calculateUVTransform(this._private_textureTransform),
149
+ textureResolution: this.texture.getResolution(this._private_textureResolution),
150
+ color: this._private_colorInternal,
151
+ progress: this._private_progressInternal,
152
+ ...this._private_maskFunctionInternal.enumerateProperties(),
153
+ }, computeTrimmedTransformMatrix(this.x, this.y, this.width, this.height, this.zIndex, micro.x, micro.y, micro.anchorX, micro.anchorY, micro.scaleX, micro.scaleY, micro.rotation, micro.anchorMode, textureTrim.left, textureTrim.right, textureTrim.top, textureTrim.bottom), isUIModeVisible(this.mode), this.transparencyMode);
154
+ this._private_colorInternal.setDirtyFalse();
155
+ this.texture.setTextureDirtyFalse();
156
+ this.texture.setUVTransformDirtyFalse();
157
+ this.texture.setTrimDirtyFalse();
158
+ this._private_progressDirty = false;
159
+ this._private_textureResolutionDirty = false;
160
+ this._private_maskFunctionInternal.setDirtyFalse();
161
+ this.micro.setDirtyFalse();
162
+ }
163
+ }
164
+
165
+ export { UIProgress };
@@ -0,0 +1,27 @@
1
+ import { UIColor } from '../../miscellaneous/color/UIColor.js';
2
+
3
+ /** Controls when scene re-renders */
4
+ var UISceneUpdateMode;
5
+ (function (UISceneUpdateMode) {
6
+ /** Re-render every frame */
7
+ UISceneUpdateMode[UISceneUpdateMode["EVERY_FRAME"] = 1] = "EVERY_FRAME";
8
+ /** Re-render every other frame */
9
+ UISceneUpdateMode[UISceneUpdateMode["EVERY_SECOND_FRAME"] = 2] = "EVERY_SECOND_FRAME";
10
+ /** Re-render when scene, camera, or updateMode changes */
11
+ UISceneUpdateMode[UISceneUpdateMode["ON_PROPERTIES_CHANGE"] = 3] = "ON_PROPERTIES_CHANGE";
12
+ /** Re-render when dimensions or resolutionFactor changes */
13
+ UISceneUpdateMode[UISceneUpdateMode["ON_DIMENSIONS_CHANGE"] = 4] = "ON_DIMENSIONS_CHANGE";
14
+ /** Re-render only via requestUpdate() */
15
+ UISceneUpdateMode[UISceneUpdateMode["MANUAL"] = 5] = "MANUAL";
16
+ })(UISceneUpdateMode || (UISceneUpdateMode = {}));
17
+ const SCENE_DEFAULT_RESOLUTION_FACTOR = 0.5;
18
+ const SCENE_MIN_RESOLUTION_FACTOR = 0.1;
19
+ const SCENE_MAX_RESOLUTION_FACTOR = 2;
20
+ const SCENE_DEFAULT_CAMERA_FOV = 60;
21
+ const SCENE_DEFAULT_CAMERA_NEAR = 0.1;
22
+ const SCENE_DEFAULT_CAMERA_FAR = 100;
23
+ const SCENE_DEFAULT_UPDATE_MODE = UISceneUpdateMode.ON_PROPERTIES_CHANGE;
24
+ const SCENE_DEFAULT_CLEAR_COLOR = new UIColor(0, 0, 0, 1);
25
+ const SCENE_DEFAULT_USE_DEPTH = true;
26
+
27
+ export { SCENE_DEFAULT_CAMERA_FAR, SCENE_DEFAULT_CAMERA_FOV, SCENE_DEFAULT_CAMERA_NEAR, SCENE_DEFAULT_CLEAR_COLOR, SCENE_DEFAULT_RESOLUTION_FACTOR, SCENE_DEFAULT_UPDATE_MODE, SCENE_DEFAULT_USE_DEPTH, SCENE_MAX_RESOLUTION_FACTOR, SCENE_MIN_RESOLUTION_FACTOR, UISceneUpdateMode };
@@ -0,0 +1,157 @@
1
+ import { MathUtils, WebGLRenderTarget, UnsignedByteType, LinearFilter, RGBAFormat, Matrix3, Scene, PerspectiveCamera } from 'three';
2
+ import { assertValidPositiveNumber } from '../../miscellaneous/asserts.js';
3
+ import { UIColor } from '../../miscellaneous/color/UIColor.js';
4
+ import source from '../../shaders/UIImage.glsl.js';
5
+ import { DUMMY_DEFAULT_WIDTH, DUMMY_DEFAULT_HEIGHT } from '../UIDummy/UIDummy.Internal.js';
6
+ import { UIElement } from '../UIElement/UIElement.js';
7
+ import { SCENE_DEFAULT_RESOLUTION_FACTOR, SCENE_MIN_RESOLUTION_FACTOR, SCENE_MAX_RESOLUTION_FACTOR, SCENE_DEFAULT_USE_DEPTH, SCENE_DEFAULT_CLEAR_COLOR, SCENE_DEFAULT_CAMERA_FOV, SCENE_DEFAULT_CAMERA_NEAR, SCENE_DEFAULT_CAMERA_FAR, SCENE_DEFAULT_UPDATE_MODE, UISceneUpdateMode } from './UIScene.Internal.js';
8
+
9
+ /** Renders Three.js scene to texture */
10
+ class UIScene extends UIElement {
11
+ /**
12
+ * Creates a new UIScene instance.
13
+ *
14
+ * @param layer - Layer containing this element
15
+ * @param options - Configuration options
16
+ * @throws If resolutionFactor outside range 0.1 to 2.0
17
+ */
18
+ constructor(layer, options = {}) {
19
+ if (options.resolutionFactor !== undefined) {
20
+ assertValidPositiveNumber(options.resolutionFactor, "UIScene.constructor.resolutionFactor");
21
+ }
22
+ const resolutionFactor = MathUtils.clamp(options.resolutionFactor ?? SCENE_DEFAULT_RESOLUTION_FACTOR, SCENE_MIN_RESOLUTION_FACTOR, SCENE_MAX_RESOLUTION_FACTOR);
23
+ const w = options.width ?? DUMMY_DEFAULT_WIDTH;
24
+ const h = options.height ?? DUMMY_DEFAULT_HEIGHT;
25
+ const renderTarget = new WebGLRenderTarget(w * resolutionFactor, h * resolutionFactor, {
26
+ format: RGBAFormat,
27
+ minFilter: LinearFilter,
28
+ magFilter: LinearFilter,
29
+ type: UnsignedByteType,
30
+ depthBuffer: options.enableDepthBuffer ?? SCENE_DEFAULT_USE_DEPTH,
31
+ stencilBuffer: false,
32
+ });
33
+ const color = new UIColor(options.color);
34
+ super(layer, source, {
35
+ texture: renderTarget.texture,
36
+ textureTransform: new Matrix3(),
37
+ color,
38
+ }, options);
39
+ this._private_evenFrame = true;
40
+ this._private_updateRequired = false;
41
+ this._private_resolutionFactorDirty = false;
42
+ this._private_propertyDirty = false;
43
+ this._private_colorInternal = color;
44
+ this._private_clearColorInternal = new UIColor(options.clearColor ?? SCENE_DEFAULT_CLEAR_COLOR);
45
+ this._private_renderTarget = renderTarget;
46
+ this._private_sceneInternal = options.scene ?? new Scene();
47
+ this._private_cameraInternal =
48
+ options.camera ??
49
+ new PerspectiveCamera(SCENE_DEFAULT_CAMERA_FOV, w / h, SCENE_DEFAULT_CAMERA_NEAR, SCENE_DEFAULT_CAMERA_FAR);
50
+ this._private_resolutionFactorInternal = resolutionFactor;
51
+ this._private_updateModeInternal = options.updateMode ?? SCENE_DEFAULT_UPDATE_MODE;
52
+ this._private_propertyDirty = options.updateMode !== UISceneUpdateMode.MANUAL;
53
+ }
54
+ /** Camera used for rendering */
55
+ get camera() {
56
+ return this._private_cameraInternal;
57
+ }
58
+ /** Background color for render target */
59
+ get clearColor() {
60
+ return this._private_clearColorInternal;
61
+ }
62
+ /** Multiplicative tint. Alpha channel controls opacity. */
63
+ get color() {
64
+ return this._private_colorInternal;
65
+ }
66
+ /** Render target resolution multiplier. Range 0.1 to 2.0. */
67
+ get resolutionFactor() {
68
+ return this._private_resolutionFactorInternal;
69
+ }
70
+ /** Three.js scene to render */
71
+ get scene() {
72
+ return this._private_sceneInternal;
73
+ }
74
+ /** Controls when scene re-renders */
75
+ get updateMode() {
76
+ return this._private_updateModeInternal;
77
+ }
78
+ /** Camera used for rendering */
79
+ set camera(value) {
80
+ if (this._private_cameraInternal !== value) {
81
+ this._private_cameraInternal = value;
82
+ this._private_propertyDirty = true;
83
+ }
84
+ }
85
+ /** Background color for render target */
86
+ set clearColor(value) {
87
+ this._private_clearColorInternal.set(value);
88
+ }
89
+ /** Multiplicative tint. Alpha channel controls opacity. */
90
+ set color(value) {
91
+ this._private_colorInternal.set(value);
92
+ }
93
+ /** Render target resolution multiplier. Range 0.1 to 2.0. */
94
+ set resolutionFactor(value) {
95
+ assertValidPositiveNumber(value, "UIScene.resolutionFactor");
96
+ value = MathUtils.clamp(value, SCENE_MIN_RESOLUTION_FACTOR, SCENE_MAX_RESOLUTION_FACTOR);
97
+ if (this._private_resolutionFactorInternal !== value) {
98
+ this._private_resolutionFactorInternal = value;
99
+ this._private_resolutionFactorDirty = true;
100
+ }
101
+ }
102
+ /** Three.js scene to render */
103
+ set scene(value) {
104
+ if (this._private_sceneInternal !== value) {
105
+ this._private_sceneInternal = value;
106
+ this._private_propertyDirty = true;
107
+ }
108
+ }
109
+ /** Controls when scene re-renders */
110
+ set updateMode(value) {
111
+ if (this._private_updateModeInternal !== value) {
112
+ this._private_updateModeInternal = value;
113
+ this._private_propertyDirty = true;
114
+ }
115
+ }
116
+ /** Removes element and frees resources */
117
+ destroy() {
118
+ this._private_renderTarget.dispose();
119
+ super.destroy();
120
+ }
121
+ /** Triggers re-render on next frame. Useful in MANUAL mode. */
122
+ requestUpdate() {
123
+ this._private_updateRequired = true;
124
+ }
125
+ onWillRender(renderer, deltaTime) {
126
+ this._private_evenFrame = !this._private_evenFrame;
127
+ const isFramebufferDirty = this._private_updateRequired ||
128
+ this._private_updateModeInternal === UISceneUpdateMode.EVERY_FRAME ||
129
+ (this._private_updateModeInternal === UISceneUpdateMode.EVERY_SECOND_FRAME && this._private_evenFrame) ||
130
+ (this._private_updateModeInternal === UISceneUpdateMode.ON_PROPERTIES_CHANGE && this._private_propertyDirty) ||
131
+ this._private_colorInternal.dirty ||
132
+ this._private_clearColorInternal.dirty ||
133
+ (this._private_updateModeInternal === UISceneUpdateMode.ON_DIMENSIONS_CHANGE &&
134
+ (this._private_resolutionFactorDirty || this.solverWrapper.dirty));
135
+ if (isFramebufferDirty) {
136
+ if (this._private_resolutionFactorDirty || this.solverWrapper.dirty) {
137
+ this._private_renderTarget.setSize(this.width * this._private_resolutionFactorInternal, this.height * this._private_resolutionFactorInternal);
138
+ this._private_resolutionFactorDirty = false;
139
+ }
140
+ if (this._private_colorInternal.dirty) {
141
+ this.sceneWrapper.setProperties(this.planeHandler, {
142
+ color: this._private_colorInternal,
143
+ });
144
+ this._private_colorInternal.setDirtyFalse();
145
+ }
146
+ renderer.setClearColor(this._private_clearColorInternal.getHexRGB(), this._private_clearColorInternal.a);
147
+ renderer.setRenderTarget(this._private_renderTarget);
148
+ renderer.clear(true, true, false);
149
+ renderer.render(this._private_sceneInternal, this._private_cameraInternal);
150
+ this._private_propertyDirty = false;
151
+ this._private_updateRequired = false;
152
+ }
153
+ super.onWillRender(renderer, deltaTime);
154
+ }
155
+ }
156
+
157
+ export { UIScene };
@@ -0,0 +1,12 @@
1
+ /** Controls how text adapts to element size */
2
+ var UITextResizeMode;
3
+ (function (UITextResizeMode) {
4
+ /** Break text into multiple lines when narrower than content*/
5
+ UITextResizeMode[UITextResizeMode["BREAK"] = 0] = "BREAK";
6
+ /** Scale text to fit fixed element size */
7
+ UITextResizeMode[UITextResizeMode["SCALE"] = 1] = "SCALE";
8
+ })(UITextResizeMode || (UITextResizeMode = {}));
9
+ const TEXT_DEFAULT_MAX_LINE_WIDTH = 1024;
10
+ const TEXT_DEFAULT_RESIZE_MODE = UITextResizeMode.SCALE;
11
+
12
+ export { TEXT_DEFAULT_MAX_LINE_WIDTH, TEXT_DEFAULT_RESIZE_MODE, UITextResizeMode };