laymur 0.25.2 → 0.27.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 (186) hide show
  1. package/README.md +114 -34
  2. package/dist/core/constraints/UICustomConstraint.d.ts +1 -1
  3. package/dist/core/constraints/UIHorizontalInterpolationConstraint/UIHorizontalInterpolationConstraint.js +1 -1
  4. package/dist/core/constraints/UIVerticalInterpolationConstraint/UIVerticalInterpolationConstraint.js +1 -1
  5. package/dist/core/constraints/builders/UIConstraint2DBuilder.d.ts +2 -3
  6. package/dist/core/elements/UIAnchor/UIAnchor.d.ts +2 -2
  7. package/dist/core/elements/UIAnchor/UIAnchor.js +3 -2
  8. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.d.ts +2 -2
  9. package/dist/core/elements/UIAnimatedImage/UIAnimatedImage.js +24 -12
  10. package/dist/core/elements/UIDummy/UIDummy.Internal.d.ts +13 -0
  11. package/dist/core/elements/UIDummy/UIDummy.d.ts +74 -5
  12. package/dist/core/elements/UIDummy/UIDummy.js +222 -29
  13. package/dist/core/elements/UIElement/UIElement.Internal.d.ts +1 -1
  14. package/dist/core/elements/UIElement/UIElement.d.ts +37 -1
  15. package/dist/core/elements/UIElement/UIElement.js +84 -6
  16. package/dist/core/elements/UIGraphics/UIGraphics.Internal.d.ts +1 -1
  17. package/dist/core/elements/UIGraphics/UIGraphics.d.ts +1 -1
  18. package/dist/core/elements/UIGraphics/UIGraphics.js +4 -4
  19. package/dist/core/elements/UIImage/UIImage.d.ts +2 -2
  20. package/dist/core/elements/UIImage/UIImage.js +10 -8
  21. package/dist/core/elements/UINineSlice/UINineSlice.d.ts +4 -4
  22. package/dist/core/elements/UINineSlice/UINineSlice.js +11 -9
  23. package/dist/core/elements/UIProgress/UIProgress.d.ts +2 -2
  24. package/dist/core/elements/UIProgress/UIProgress.js +17 -15
  25. package/dist/core/elements/UIScene/UIScene.Internal.d.ts +1 -1
  26. package/dist/core/elements/UIScene/UIScene.d.ts +3 -2
  27. package/dist/core/elements/UIScene/UIScene.js +21 -14
  28. package/dist/core/elements/UIText/UIText.Measuring.d.ts +1 -1
  29. package/dist/core/elements/UIText/UIText.d.ts +3 -3
  30. package/dist/core/elements/UIText/UIText.js +8 -8
  31. package/dist/core/index.d.ts +60 -11
  32. package/dist/core/index.js +22 -7
  33. package/dist/core/layers/UILayer/UILayer.d.ts +45 -5
  34. package/dist/core/layers/UILayer/UILayer.js +103 -10
  35. package/dist/core/layers/UIViewportLayer/UIViewportLayer.Internal.d.ts +27 -0
  36. package/dist/core/layers/{UIFullscreenLayer/UIFullscreenLayer.Internal.js → UIViewportLayer/UIViewportLayer.Internal.js} +1 -1
  37. package/dist/core/layers/UIViewportLayer/UIViewportLayer.d.ts +98 -0
  38. package/dist/core/layers/UIViewportLayer/UIViewportLayer.js +251 -0
  39. package/dist/core/miscellaneous/UIAffineMatrix3.d.ts +13 -0
  40. package/dist/core/miscellaneous/UIAffineMatrix3.js +13 -0
  41. package/dist/core/miscellaneous/area/UIArea.d.ts +10 -1
  42. package/dist/core/miscellaneous/area/UIArea.js +4 -1
  43. package/dist/core/miscellaneous/area/UIAreaCircle.d.ts +1 -0
  44. package/dist/core/miscellaneous/area/UIAreaCircle.js +0 -1
  45. package/dist/core/miscellaneous/area/UIAreaPolygon.d.ts +1 -0
  46. package/dist/core/miscellaneous/area/UIAreaPolygon.js +0 -1
  47. package/dist/core/miscellaneous/area/UIAreaRectangle.d.ts +1 -0
  48. package/dist/core/miscellaneous/area/UIAreaRectangle.js +0 -1
  49. package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.d.ts +1 -0
  50. package/dist/core/miscellaneous/area/UIAreaRoundedRectangle.js +0 -1
  51. package/dist/core/miscellaneous/asserts.d.ts +23 -0
  52. package/dist/core/miscellaneous/asserts.js +44 -0
  53. package/dist/core/miscellaneous/canvas.js +7 -2
  54. package/dist/core/miscellaneous/color/UIColor.js +5 -2
  55. package/dist/core/miscellaneous/computeTransform.d.ts +12 -0
  56. package/dist/core/miscellaneous/computeTransform.js +20 -0
  57. package/dist/core/miscellaneous/context-monitor/UIContextMonitor.d.ts +1 -0
  58. package/dist/core/miscellaneous/context-monitor/UIContextMonitor.js +60 -0
  59. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.d.ts +17 -3
  60. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Internal.js +88 -26
  61. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Layout.d.ts +9 -0
  62. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.Layout.js +29 -6
  63. package/dist/core/miscellaneous/generic-plane/UIGenericInstancedPlane/UIGenericInstancedPlane.js +51 -11
  64. package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.Internal.d.ts +2 -0
  65. package/dist/core/miscellaneous/generic-plane/UIGenericPlaneRegistry/UIGenericPlaneRegistry.js +47 -6
  66. package/dist/core/miscellaneous/generic-plane/shared.d.ts +15 -3
  67. package/dist/core/miscellaneous/generic-plane/shared.js +38 -7
  68. package/dist/core/miscellaneous/generic-plane/varyingPacking.d.ts +46 -0
  69. package/dist/core/miscellaneous/generic-plane/varyingPacking.js +170 -0
  70. package/dist/core/miscellaneous/mask/UIMask.Internal.d.ts +61 -0
  71. package/dist/core/miscellaneous/mask/UIMask.Internal.js +56 -0
  72. package/dist/core/miscellaneous/mask/UIMask.d.ts +84 -0
  73. package/dist/core/miscellaneous/mask/UIMask.js +265 -0
  74. package/dist/core/miscellaneous/mask/UIMaskMaterialPatch.d.ts +50 -0
  75. package/dist/core/miscellaneous/mask/UIMaskMaterialPatch.js +233 -0
  76. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.d.ts +10 -1
  77. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunction.js +7 -1
  78. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.d.ts +2 -0
  79. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionCircular.js +0 -1
  80. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.d.ts +2 -0
  81. package/dist/core/miscellaneous/mask-function/UIProgressMaskFunctionDirectional.js +0 -1
  82. package/dist/core/miscellaneous/micro/UIMicro.Internal.d.ts +3 -0
  83. package/dist/core/miscellaneous/micro/UIMicro.Internal.js +1 -0
  84. package/dist/core/miscellaneous/micro/UIMicro.d.ts +18 -1
  85. package/dist/core/miscellaneous/micro/UIMicro.js +23 -2
  86. package/dist/core/miscellaneous/resize-policy/UIResizePolicy.d.ts +19 -1
  87. package/dist/core/miscellaneous/resize-policy/UIResizePolicy.js +16 -3
  88. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCover.js +2 -2
  89. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCross.js +2 -2
  90. package/dist/core/miscellaneous/resize-policy/UIResizePolicyCrossInverted.js +2 -2
  91. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFit.js +2 -2
  92. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedHeight.js +2 -2
  93. package/dist/core/miscellaneous/resize-policy/UIResizePolicyFixedWidth.js +2 -2
  94. package/dist/core/miscellaneous/text-style/UITextStyle.js +2 -2
  95. package/dist/core/miscellaneous/texture/UITextureView.d.ts +6 -2
  96. package/dist/core/miscellaneous/texture/UITextureView.js +13 -9
  97. package/dist/core/miscellaneous/viewport/UIElementViewport.d.ts +31 -0
  98. package/dist/core/miscellaneous/viewport/UIElementViewport.js +54 -0
  99. package/dist/core/miscellaneous/viewport/UIViewport.d.ts +37 -0
  100. package/dist/core/miscellaneous/viewport/UIViewport.js +31 -0
  101. package/dist/core/miscellaneous/viewport/UIWindowViewport.d.ts +13 -0
  102. package/dist/core/miscellaneous/viewport/UIWindowViewport.js +25 -0
  103. package/dist/core/miscellaneous/webglCapabilities.js +61 -55
  104. package/dist/core/shaders/UIMask.d.ts +15 -0
  105. package/dist/core/shaders/UIMask.js +45 -0
  106. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.Internal.d.ts +36 -5
  107. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.d.ts +23 -2
  108. package/dist/core/wrappers/UIInputWrapper/UIInputWrapper.js +153 -15
  109. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.Internal.d.ts +3 -1
  110. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.d.ts +1 -0
  111. package/dist/core/wrappers/UISceneWrapper/UISceneWrapper.js +3 -0
  112. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.Internal.d.ts +2 -0
  113. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.d.ts +3 -0
  114. package/dist/core/wrappers/UISolverWrapper/UISolverWrapper.js +36 -16
  115. package/dist/debug/UIAspectDebug.js +4 -0
  116. package/dist/debug/UIHeightDebug.js +4 -0
  117. package/dist/debug/UIHorizontalDistanceDebug.js +5 -0
  118. package/dist/debug/UIHorizontalInterpolationDebug.js +5 -0
  119. package/dist/debug/UILayerDebug.d.ts +7 -0
  120. package/dist/debug/UILayerDebug.js +21 -0
  121. package/dist/debug/UIVerticalDistanceDebug.js +5 -0
  122. package/dist/debug/UIVerticalInterpolationDebug.js +5 -0
  123. package/dist/debug/UIWidthDebug.js +4 -0
  124. package/dist/debug/index.d.ts +2 -0
  125. package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.d.ts +8 -1
  126. package/dist/particles/behaviorModules/UIBehaviorDirectionalGravity.js +0 -2
  127. package/dist/particles/behaviorModules/UIBehaviorModule.d.ts +12 -2
  128. package/dist/particles/behaviorModules/UIBehaviorModule.js +2 -1
  129. package/dist/particles/behaviorModules/UIBehaviorPointGravity.d.ts +8 -1
  130. package/dist/particles/behaviorModules/UIBehaviorPointGravity.js +13 -12
  131. package/dist/particles/behaviorModules/UIBehaviorScaleOscillation.d.ts +7 -0
  132. package/dist/particles/behaviorModules/UIBehaviorScaleOscillation.js +6 -6
  133. package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.d.ts +7 -0
  134. package/dist/particles/behaviorModules/UIBehaviorScaleOverLife.js +4 -5
  135. package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.d.ts +8 -1
  136. package/dist/particles/behaviorModules/UIBehaviorTorqueDamping.js +8 -10
  137. package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.d.ts +10 -2
  138. package/dist/particles/behaviorModules/UIBehaviorTorqueNoise.js +8 -7
  139. package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.d.ts +7 -0
  140. package/dist/particles/behaviorModules/UIBehaviorVelocityDamping.js +8 -10
  141. package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.d.ts +13 -4
  142. package/dist/particles/behaviorModules/UIBehaviorVelocityNoise.js +12 -10
  143. package/dist/particles/elements/UIEmitter.Internal.d.ts +21 -1
  144. package/dist/particles/elements/UIEmitter.Internal.js +6 -0
  145. package/dist/particles/elements/UIEmitter.d.ts +20 -11
  146. package/dist/particles/elements/UIEmitter.js +100 -54
  147. package/dist/particles/index.d.ts +7 -1
  148. package/dist/particles/index.js +4 -0
  149. package/dist/particles/instancedParticle/UIInstancedParticle.Internal.d.ts +19 -4
  150. package/dist/particles/instancedParticle/UIInstancedParticle.Internal.js +117 -83
  151. package/dist/particles/instancedParticle/UIInstancedParticle.d.ts +8 -0
  152. package/dist/particles/instancedParticle/UIInstancedParticle.js +41 -4
  153. package/dist/particles/miscellaneous/miscellaneous.d.ts +34 -0
  154. package/dist/particles/miscellaneous/miscellaneous.js +72 -0
  155. package/dist/particles/renderingModules/UIRenderingColorOverLife.d.ts +4 -0
  156. package/dist/particles/renderingModules/UIRenderingColorOverLife.js +2 -4
  157. package/dist/particles/renderingModules/UIRenderingColorOverVelocity.d.ts +4 -0
  158. package/dist/particles/renderingModules/UIRenderingColorOverVelocity.js +2 -5
  159. package/dist/particles/renderingModules/UIRenderingModule.d.ts +11 -1
  160. package/dist/particles/renderingModules/UIRenderingModule.js +4 -1
  161. package/dist/particles/renderingModules/UIRenderingTexture.d.ts +4 -0
  162. package/dist/particles/renderingModules/UIRenderingTexture.js +2 -1
  163. package/dist/particles/shaders/UIRenderingColorOverLife.d.ts +1 -2
  164. package/dist/particles/shaders/UIRenderingColorOverLife.js +5 -3
  165. package/dist/particles/shaders/UIRenderingColorOverVelocity.d.ts +1 -9
  166. package/dist/particles/shaders/UIRenderingColorOverVelocity.js +6 -13
  167. package/dist/particles/spawnModules/UISpawnModule.d.ts +16 -1
  168. package/dist/particles/spawnModules/UISpawnModule.js +3 -1
  169. package/dist/particles/spawnModules/UISpawnOffset.d.ts +7 -0
  170. package/dist/particles/spawnModules/UISpawnOffset.js +0 -2
  171. package/dist/particles/spawnModules/UISpawnRandomLifetime.d.ts +8 -1
  172. package/dist/particles/spawnModules/UISpawnRandomLifetime.js +5 -7
  173. package/dist/particles/spawnModules/UISpawnRandomRotation.d.ts +7 -0
  174. package/dist/particles/spawnModules/UISpawnRandomRotation.js +5 -5
  175. package/dist/particles/spawnModules/UISpawnRandomScale.d.ts +7 -0
  176. package/dist/particles/spawnModules/UISpawnRandomScale.js +4 -5
  177. package/dist/particles/spawnModules/UISpawnRandomTorque.d.ts +7 -0
  178. package/dist/particles/spawnModules/UISpawnRandomTorque.js +5 -5
  179. package/dist/particles/spawnModules/UISpawnRandomVelocity.d.ts +7 -0
  180. package/dist/particles/spawnModules/UISpawnRandomVelocity.js +6 -6
  181. package/dist/particles/spawnModules/UISpawnRectangle.d.ts +7 -0
  182. package/dist/particles/spawnModules/UISpawnRectangle.js +6 -6
  183. package/package.json +13 -4
  184. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.Internal.d.ts +0 -21
  185. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.d.ts +0 -63
  186. package/dist/core/layers/UIFullscreenLayer/UIFullscreenLayer.js +0 -144
@@ -16,7 +16,8 @@ function buildMultiTextureShader(count) {
16
16
  }
17
17
  return [
18
18
  "vec4 draw() {",
19
- ` int idx = int(PARTICLE_RANDOM_A * ${count}.0);`,
19
+ // Clamped: at mediump precision a value just below 1 can round up to 1
20
+ ` int idx = int(min(PARTICLE_RANDOM_A * ${count}.0, ${count}.0 - 0.5));`,
20
21
  " mat3 t;",
21
22
  ...branches,
22
23
  " vec2 transformedUV = (t * vec3(p_uv, 1.0)).xy;",
@@ -1,2 +1 @@
1
- declare const source: string;
2
- export default source;
1
+ export declare function buildColorOverLifeSource(gradientSize: number): string;
@@ -1,7 +1,9 @@
1
- const source = `
1
+ import { buildGradientCoordinate } from "../miscellaneous/miscellaneous.js";
2
+ export function buildColorOverLifeSource(gradientSize) {
3
+ return `
2
4
  vec4 draw() {
3
5
  float t = clamp(PARTICLE_AGE / PARTICLE_LIFETIME, 0.0, 1.0);
4
- return srgbTexture2D(p_colorOverLifeTexture, vec2(t, 0.5));
6
+ return srgbTexture2D(p_colorOverLifeTexture, vec2(${buildGradientCoordinate("t", gradientSize)}, 0.5));
5
7
  }
6
8
  `;
7
- export default source;
9
+ }
@@ -1,9 +1 @@
1
- /**
2
- * The empty COLOR_OVER_VELOCITY_MAX macro is a placeholder: UIRenderingColorOverVelocity
3
- * rewrites the first occurrence of that token into "COLOR_OVER_VELOCITY_MAX <value>",
4
- * which turns this line into a real definition. The newline after it is load-bearing -
5
- * a "#define" body runs to end of line, so collapsing it would swallow draw() into
6
- * the macro and leave the shader without an entry point.
7
- */
8
- declare const source: string;
9
- export default source;
1
+ export declare function buildColorOverVelocitySource(gradientSize: number, maxVelocity: number): string;
@@ -1,16 +1,9 @@
1
- /**
2
- * The empty COLOR_OVER_VELOCITY_MAX macro is a placeholder: UIRenderingColorOverVelocity
3
- * rewrites the first occurrence of that token into "COLOR_OVER_VELOCITY_MAX <value>",
4
- * which turns this line into a real definition. The newline after it is load-bearing -
5
- * a "#define" body runs to end of line, so collapsing it would swallow draw() into
6
- * the macro and leave the shader without an entry point.
7
- */
8
- const source = `
9
- #define COLOR_OVER_VELOCITY_MAX
10
-
1
+ import { buildGradientCoordinate, toGLSLFloat } from "../miscellaneous/miscellaneous.js";
2
+ export function buildColorOverVelocitySource(gradientSize, maxVelocity) {
3
+ return `
11
4
  vec4 draw() {
12
- float t = clamp(length(vec2(PARTICLE_VELOCITY_X, PARTICLE_VELOCITY_Y)) / COLOR_OVER_VELOCITY_MAX, 0.0, 1.0);
13
- return srgbTexture2D(p_colorOverVelocityTexture, vec2(t, 0.5));
5
+ float t = clamp(length(vec2(PARTICLE_VELOCITY_X, PARTICLE_VELOCITY_Y)) / ${toGLSLFloat(maxVelocity)}, 0.0, 1.0);
6
+ return srgbTexture2D(p_colorOverVelocityTexture, vec2(${buildGradientCoordinate("t", gradientSize)}, 0.5));
14
7
  }
15
8
  `;
16
- export default source;
9
+ }
@@ -1,9 +1,24 @@
1
+ import type { InstancedBufferAttribute } from "three";
1
2
  import type { UIPropertyName } from "../../core/miscellaneous/generic-plane/shared.js";
2
3
  /**
3
4
  * Base class for particle spawn modules.
4
5
  *
5
- * Spawn modules initialize particle properties when particles are created.
6
+ * Spawn modules initialize particle properties when particles are created. Declare the
7
+ * per-particle properties the module writes in `requiredProperties`, usually
8
+ * `{ builtin: "Matrix4" }` (laid out by the BUILTIN_OFFSET_* constants), and fill them in `spawn`.
6
9
  */
7
10
  export declare abstract class UISpawnModule<T extends Record<string, UIPropertyName> = Record<string, UIPropertyName>> {
11
+ /** Per-particle properties the module writes, by name and type */
12
+ abstract readonly requiredProperties: T;
13
+ /**
14
+ * Initializes the particles in [instanceBegin, instanceEnd). They come zeroed, except builtin
15
+ * scale 1 and lifetime 1 second, and with their seed set.
16
+ * @param properties Per-particle buffers of the required properties
17
+ * @param randomSalt Salt for `particleRandomStream`: random values of the module are
18
+ * independent of those of other modules, also of another instance of the same module
19
+ */
20
+ abstract spawn(properties: {
21
+ [K in keyof T]: InstancedBufferAttribute;
22
+ }, instanceBegin: number, instanceEnd: number, randomSalt: number): void;
8
23
  destroy?(): void;
9
24
  }
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * Base class for particle spawn modules.
3
3
  *
4
- * Spawn modules initialize particle properties when particles are created.
4
+ * Spawn modules initialize particle properties when particles are created. Declare the
5
+ * per-particle properties the module writes in `requiredProperties`, usually
6
+ * `{ builtin: "Matrix4" }` (laid out by the BUILTIN_OFFSET_* constants), and fill them in `spawn`.
5
7
  */
6
8
  export class UISpawnModule {
7
9
  }
@@ -1,3 +1,4 @@
1
+ import type { InstancedBufferAttribute } from "three";
1
2
  import type { Vector2Like } from "../../core/miscellaneous/math.js";
2
3
  import type { UIVector2Config } from "../miscellaneous/miscellaneous.js";
3
4
  import { UISpawnModule } from "./UISpawnModule.js";
@@ -9,6 +10,9 @@ import { UISpawnModule } from "./UISpawnModule.js";
9
10
  export declare class UISpawnOffset extends UISpawnModule<{
10
11
  builtin: "Matrix4";
11
12
  }> {
13
+ readonly requiredProperties: {
14
+ readonly builtin: "Matrix4";
15
+ };
12
16
  private offsetInternal;
13
17
  /**
14
18
  * @param offset - Initial particle position offset
@@ -18,4 +22,7 @@ export declare class UISpawnOffset extends UISpawnModule<{
18
22
  get offset(): Vector2Like;
19
23
  /** Particle position offset */
20
24
  set offset(value: UIVector2Config);
25
+ spawn(properties: {
26
+ builtin: InstancedBufferAttribute;
27
+ }, instanceBegin: number, instanceEnd: number): void;
21
28
  }
@@ -12,7 +12,6 @@ export class UISpawnOffset extends UISpawnModule {
12
12
  */
13
13
  constructor(offset = { x: 0, y: 0 }) {
14
14
  super();
15
- /** @internal */
16
15
  this.requiredProperties = { builtin: "Matrix4" };
17
16
  this.offsetInternal = resolveUIVector2Config(offset);
18
17
  assertValidNumber(this.offsetInternal.x, "UISpawnOffset.constructor.offset.x");
@@ -28,7 +27,6 @@ export class UISpawnOffset extends UISpawnModule {
28
27
  assertValidNumber(this.offsetInternal.x, "UISpawnOffset.offset.x");
29
28
  assertValidNumber(this.offsetInternal.y, "UISpawnOffset.offset.y");
30
29
  }
31
- /** @internal */
32
30
  spawn(properties, instanceBegin, instanceEnd) {
33
31
  const { builtin } = properties;
34
32
  const { array, itemSize } = builtin;
@@ -1,13 +1,17 @@
1
+ import type { InstancedBufferAttribute } from "three";
1
2
  import type { UIRange, UIRangeConfig } from "../miscellaneous/miscellaneous.js";
2
3
  import { UISpawnModule } from "./UISpawnModule.js";
3
4
  /**
4
5
  * Assigns random lifetime to particles.
5
6
  *
6
- * Lifetime is chosen uniformly from the specified range. Age is set to 0.
7
+ * Lifetime is chosen uniformly from the specified range.
7
8
  */
8
9
  export declare class UISpawnRandomLifetime extends UISpawnModule<{
9
10
  builtin: "Matrix4";
10
11
  }> {
12
+ readonly requiredProperties: {
13
+ readonly builtin: "Matrix4";
14
+ };
11
15
  private lifetimeInternal;
12
16
  /**
13
17
  * @param lifetime - Lifetime range in seconds. Accepts number, tuple, or range object
@@ -17,4 +21,7 @@ export declare class UISpawnRandomLifetime extends UISpawnModule<{
17
21
  get lifetime(): UIRange;
18
22
  /** Lifetime range in seconds */
19
23
  set lifetime(value: UIRangeConfig);
24
+ spawn(properties: {
25
+ builtin: InstancedBufferAttribute;
26
+ }, instanceBegin: number, instanceEnd: number, randomSalt: number): void;
20
27
  }
@@ -1,11 +1,11 @@
1
1
  import { MathUtils } from "three";
2
2
  import { assertValidPositiveNumber } from "../../core/miscellaneous/asserts.js";
3
- import { BUILTIN_OFFSET_AGE, BUILTIN_OFFSET_LIFETIME, resolveUIRangeConfig, } from "../miscellaneous/miscellaneous.js";
3
+ import { BUILTIN_OFFSET_LIFETIME, particleRandom, particleRandomStream, resolveUIRangeConfig, } from "../miscellaneous/miscellaneous.js";
4
4
  import { UISpawnModule } from "./UISpawnModule.js";
5
5
  /**
6
6
  * Assigns random lifetime to particles.
7
7
  *
8
- * Lifetime is chosen uniformly from the specified range. Age is set to 0.
8
+ * Lifetime is chosen uniformly from the specified range.
9
9
  */
10
10
  export class UISpawnRandomLifetime extends UISpawnModule {
11
11
  /**
@@ -13,7 +13,6 @@ export class UISpawnRandomLifetime extends UISpawnModule {
13
13
  */
14
14
  constructor(lifetime = { min: 4, max: 8 }) {
15
15
  super();
16
- /** @internal */
17
16
  this.requiredProperties = { builtin: "Matrix4" };
18
17
  this.lifetimeInternal = resolveUIRangeConfig(lifetime);
19
18
  assertValidPositiveNumber(this.lifetimeInternal.min, "UISpawnRandomLifetime.constructor.lifetime.min");
@@ -29,15 +28,14 @@ export class UISpawnRandomLifetime extends UISpawnModule {
29
28
  assertValidPositiveNumber(this.lifetimeInternal.min, "UISpawnRandomLifetime.lifetime.min");
30
29
  assertValidPositiveNumber(this.lifetimeInternal.max, "UISpawnRandomLifetime.lifetime.max");
31
30
  }
32
- /** @internal */
33
- spawn(properties, instanceBegin, instanceEnd) {
31
+ spawn(properties, instanceBegin, instanceEnd, randomSalt) {
34
32
  const { builtin } = properties;
35
33
  const { array, itemSize } = builtin;
36
34
  const { min: lifetimeMin, max: lifetimeMax } = this.lifetimeInternal;
35
+ const lifetimeStream = particleRandomStream(randomSalt, 0);
37
36
  for (let i = instanceBegin; i < instanceEnd; i++) {
38
37
  const itemOffset = i * itemSize;
39
- array[itemOffset + BUILTIN_OFFSET_LIFETIME] = MathUtils.randFloat(lifetimeMin, lifetimeMax);
40
- array[itemOffset + BUILTIN_OFFSET_AGE] = 0;
38
+ array[itemOffset + BUILTIN_OFFSET_LIFETIME] = MathUtils.lerp(lifetimeMin, lifetimeMax, particleRandom(array, itemOffset, lifetimeStream));
41
39
  }
42
40
  builtin.needsUpdate = true;
43
41
  }
@@ -1,3 +1,4 @@
1
+ import type { InstancedBufferAttribute } from "three";
1
2
  import type { UIRange, UIRangeConfig } from "../miscellaneous/miscellaneous.js";
2
3
  import { UISpawnModule } from "./UISpawnModule.js";
3
4
  /**
@@ -8,6 +9,9 @@ import { UISpawnModule } from "./UISpawnModule.js";
8
9
  export declare class UISpawnRandomRotation extends UISpawnModule<{
9
10
  builtin: "Matrix4";
10
11
  }> {
12
+ requiredProperties: {
13
+ readonly builtin: "Matrix4";
14
+ };
11
15
  private rotationInternal;
12
16
  /**
13
17
  * @param rotation - Rotation range in radians. Accepts number, tuple, or range object
@@ -17,4 +21,7 @@ export declare class UISpawnRandomRotation extends UISpawnModule<{
17
21
  get rotation(): UIRange;
18
22
  /** Rotation range in radians */
19
23
  set rotation(value: UIRangeConfig);
24
+ spawn(properties: {
25
+ builtin: InstancedBufferAttribute;
26
+ }, instanceBegin: number, instanceEnd: number, randomSalt: number): void;
20
27
  }
@@ -1,6 +1,6 @@
1
1
  import { MathUtils } from "three";
2
2
  import { assertValidNumber } from "../../core/miscellaneous/asserts.js";
3
- import { BUILTIN_OFFSET_ROTATION, resolveUIRangeConfig } from "../miscellaneous/miscellaneous.js";
3
+ import { BUILTIN_OFFSET_ROTATION, particleRandom, particleRandomStream, resolveUIRangeConfig, } from "../miscellaneous/miscellaneous.js";
4
4
  import { UISpawnModule } from "./UISpawnModule.js";
5
5
  /**
6
6
  * Assigns random rotation to particles.
@@ -13,7 +13,6 @@ export class UISpawnRandomRotation extends UISpawnModule {
13
13
  */
14
14
  constructor(rotation = { min: -Math.PI, max: Math.PI }) {
15
15
  super();
16
- /** @internal */
17
16
  this.requiredProperties = { builtin: "Matrix4" };
18
17
  this.rotationInternal = resolveUIRangeConfig(rotation);
19
18
  assertValidNumber(this.rotationInternal.min, "UISpawnRandomRotation.constructor.rotation.min");
@@ -29,13 +28,14 @@ export class UISpawnRandomRotation extends UISpawnModule {
29
28
  assertValidNumber(this.rotationInternal.min, "UISpawnRandomRotation.rotation.min");
30
29
  assertValidNumber(this.rotationInternal.max, "UISpawnRandomRotation.rotation.max");
31
30
  }
32
- /** @internal */
33
- spawn(properties, instanceBegin, instanceEnd) {
31
+ spawn(properties, instanceBegin, instanceEnd, randomSalt) {
34
32
  const { builtin } = properties;
35
33
  const { array, itemSize } = builtin;
36
34
  const { min: rotationMin, max: rotationMax } = this.rotationInternal;
35
+ const rotationStream = particleRandomStream(randomSalt, 0);
37
36
  for (let i = instanceBegin; i < instanceEnd; i++) {
38
- array[i * itemSize + BUILTIN_OFFSET_ROTATION] = MathUtils.randFloat(rotationMin, rotationMax);
37
+ const itemOffset = i * itemSize;
38
+ array[itemOffset + BUILTIN_OFFSET_ROTATION] = MathUtils.lerp(rotationMin, rotationMax, particleRandom(array, itemOffset, rotationStream));
39
39
  }
40
40
  builtin.needsUpdate = true;
41
41
  }
@@ -1,3 +1,4 @@
1
+ import type { InstancedBufferAttribute } from "three";
1
2
  import type { UIAspectConfig, UIRange, UIRangeConfig } from "../miscellaneous/miscellaneous.js";
2
3
  import { UISpawnModule } from "./UISpawnModule.js";
3
4
  /**
@@ -8,6 +9,9 @@ import { UISpawnModule } from "./UISpawnModule.js";
8
9
  export declare class UISpawnRandomScale extends UISpawnModule<{
9
10
  builtin: "Matrix4";
10
11
  }> {
12
+ requiredProperties: {
13
+ readonly builtin: "Matrix4";
14
+ };
11
15
  private scaleInternal;
12
16
  private aspectInternal;
13
17
  /**
@@ -23,4 +27,7 @@ export declare class UISpawnRandomScale extends UISpawnModule<{
23
27
  set scale(value: UIRangeConfig);
24
28
  /** Width/height aspect ratio */
25
29
  set aspect(value: UIAspectConfig);
30
+ spawn(properties: {
31
+ builtin: InstancedBufferAttribute;
32
+ }, instanceBegin: number, instanceEnd: number, randomSalt: number): void;
26
33
  }
@@ -1,6 +1,6 @@
1
1
  import { MathUtils } from "three";
2
2
  import { assertValidPositiveNumber } from "../../core/miscellaneous/asserts.js";
3
- import { BUILTIN_OFFSET_SCALE_X, BUILTIN_OFFSET_SCALE_Y, resolveAspect, resolveUIRangeConfig, } from "../miscellaneous/miscellaneous.js";
3
+ import { BUILTIN_OFFSET_SCALE_X, BUILTIN_OFFSET_SCALE_Y, particleRandom, particleRandomStream, resolveAspect, resolveUIRangeConfig, } from "../miscellaneous/miscellaneous.js";
4
4
  import { UISpawnModule } from "./UISpawnModule.js";
5
5
  /**
6
6
  * Assigns random scale to particles.
@@ -14,7 +14,6 @@ export class UISpawnRandomScale extends UISpawnModule {
14
14
  */
15
15
  constructor(scale = { min: 50, max: 100 }, aspect = 1) {
16
16
  super();
17
- /** @internal */
18
17
  this.requiredProperties = { builtin: "Matrix4" };
19
18
  this.scaleInternal = resolveUIRangeConfig(scale);
20
19
  this.aspectInternal = resolveAspect(aspect);
@@ -41,14 +40,14 @@ export class UISpawnRandomScale extends UISpawnModule {
41
40
  this.aspectInternal = resolveAspect(value);
42
41
  assertValidPositiveNumber(this.aspectInternal, "UISpawnRandomScale.aspect");
43
42
  }
44
- /** @internal */
45
- spawn(properties, instanceBegin, instanceEnd) {
43
+ spawn(properties, instanceBegin, instanceEnd, randomSalt) {
46
44
  const { builtin } = properties;
47
45
  const { array, itemSize } = builtin;
48
46
  const { min: scaleMin, max: scaleMax } = this.scaleInternal;
47
+ const scaleStream = particleRandomStream(randomSalt, 0);
49
48
  for (let i = instanceBegin; i < instanceEnd; i++) {
50
49
  const itemOffset = i * itemSize;
51
- const randomScale = MathUtils.randFloat(scaleMin, scaleMax);
50
+ const randomScale = MathUtils.lerp(scaleMin, scaleMax, particleRandom(array, itemOffset, scaleStream));
52
51
  array[itemOffset + BUILTIN_OFFSET_SCALE_X] = randomScale * this.aspectInternal;
53
52
  array[itemOffset + BUILTIN_OFFSET_SCALE_Y] = randomScale;
54
53
  }
@@ -1,3 +1,4 @@
1
+ import type { InstancedBufferAttribute } from "three";
1
2
  import type { UIRange, UIRangeConfig } from "../miscellaneous/miscellaneous.js";
2
3
  import { UISpawnModule } from "./UISpawnModule.js";
3
4
  /**
@@ -8,6 +9,9 @@ import { UISpawnModule } from "./UISpawnModule.js";
8
9
  export declare class UISpawnRandomTorque extends UISpawnModule<{
9
10
  builtin: "Matrix4";
10
11
  }> {
12
+ readonly requiredProperties: {
13
+ readonly builtin: "Matrix4";
14
+ };
11
15
  private torqueInternal;
12
16
  /**
13
17
  * @param torque - Angular velocity range in radians/second. Accepts number, tuple, or range object
@@ -17,4 +21,7 @@ export declare class UISpawnRandomTorque extends UISpawnModule<{
17
21
  get torque(): UIRange;
18
22
  /** Angular velocity range in radians/second */
19
23
  set torque(value: UIRangeConfig);
24
+ spawn(properties: {
25
+ builtin: InstancedBufferAttribute;
26
+ }, instanceBegin: number, instanceEnd: number, randomSalt: number): void;
20
27
  }
@@ -1,6 +1,6 @@
1
1
  import { MathUtils } from "three";
2
2
  import { assertValidNumber } from "../../core/miscellaneous/asserts.js";
3
- import { BUILTIN_OFFSET_TORQUE, resolveUIRangeConfig } from "../miscellaneous/miscellaneous.js";
3
+ import { BUILTIN_OFFSET_TORQUE, particleRandom, particleRandomStream, resolveUIRangeConfig, } from "../miscellaneous/miscellaneous.js";
4
4
  import { UISpawnModule } from "./UISpawnModule.js";
5
5
  /**
6
6
  * Assigns random angular velocity to particles.
@@ -13,7 +13,6 @@ export class UISpawnRandomTorque extends UISpawnModule {
13
13
  */
14
14
  constructor(torque = { min: -Math.PI, max: Math.PI }) {
15
15
  super();
16
- /** @internal */
17
16
  this.requiredProperties = { builtin: "Matrix4" };
18
17
  this.torqueInternal = resolveUIRangeConfig(torque);
19
18
  assertValidNumber(this.torqueInternal.min, "UISpawnRandomTorque.constructor.torque.min");
@@ -29,13 +28,14 @@ export class UISpawnRandomTorque extends UISpawnModule {
29
28
  assertValidNumber(this.torqueInternal.min, "UISpawnRandomTorque.torque.min");
30
29
  assertValidNumber(this.torqueInternal.max, "UISpawnRandomTorque.torque.max");
31
30
  }
32
- /** @internal */
33
- spawn(properties, instanceBegin, instanceEnd) {
31
+ spawn(properties, instanceBegin, instanceEnd, randomSalt) {
34
32
  const { builtin } = properties;
35
33
  const { array, itemSize } = builtin;
36
34
  const { min: torqueMin, max: torqueMax } = this.torqueInternal;
35
+ const torqueStream = particleRandomStream(randomSalt, 0);
37
36
  for (let i = instanceBegin; i < instanceEnd; i++) {
38
- array[i * itemSize + BUILTIN_OFFSET_TORQUE] = MathUtils.randFloat(torqueMin, torqueMax);
37
+ const itemOffset = i * itemSize;
38
+ array[itemOffset + BUILTIN_OFFSET_TORQUE] = MathUtils.lerp(torqueMin, torqueMax, particleRandom(array, itemOffset, torqueStream));
39
39
  }
40
40
  builtin.needsUpdate = true;
41
41
  }
@@ -1,3 +1,4 @@
1
+ import type { InstancedBufferAttribute } from "three";
1
2
  import type { UIRange, UIRangeConfig } from "../miscellaneous/miscellaneous.js";
2
3
  import { UISpawnModule } from "./UISpawnModule.js";
3
4
  /**
@@ -8,6 +9,9 @@ import { UISpawnModule } from "./UISpawnModule.js";
8
9
  export declare class UISpawnRandomVelocity extends UISpawnModule<{
9
10
  builtin: "Matrix4";
10
11
  }> {
12
+ readonly requiredProperties: {
13
+ readonly builtin: "Matrix4";
14
+ };
11
15
  private angleInternal;
12
16
  private magnitudeInternal;
13
17
  /**
@@ -23,4 +27,7 @@ export declare class UISpawnRandomVelocity extends UISpawnModule<{
23
27
  set angle(value: UIRangeConfig);
24
28
  /** Speed range in units/second */
25
29
  set magnitude(value: UIRangeConfig);
30
+ spawn(properties: {
31
+ builtin: InstancedBufferAttribute;
32
+ }, instanceBegin: number, instanceEnd: number, randomSalt: number): void;
26
33
  }
@@ -1,6 +1,6 @@
1
1
  import { MathUtils } from "three";
2
2
  import { assertValidNumber } from "../../core/miscellaneous/asserts.js";
3
- import { BUILTIN_OFFSET_VELOCITY_X, BUILTIN_OFFSET_VELOCITY_Y, resolveUIRangeConfig, } from "../miscellaneous/miscellaneous.js";
3
+ import { BUILTIN_OFFSET_VELOCITY_X, BUILTIN_OFFSET_VELOCITY_Y, particleRandom, particleRandomStream, resolveUIRangeConfig, } from "../miscellaneous/miscellaneous.js";
4
4
  import { UISpawnModule } from "./UISpawnModule.js";
5
5
  /**
6
6
  * Assigns random velocity to particles.
@@ -14,7 +14,6 @@ export class UISpawnRandomVelocity extends UISpawnModule {
14
14
  */
15
15
  constructor(angle = { min: -Math.PI, max: Math.PI }, magnitude = { min: -50, max: 50 }) {
16
16
  super();
17
- /** @internal */
18
17
  this.requiredProperties = { builtin: "Matrix4" };
19
18
  this.angleInternal = resolveUIRangeConfig(angle);
20
19
  this.magnitudeInternal = resolveUIRangeConfig(magnitude);
@@ -43,16 +42,17 @@ export class UISpawnRandomVelocity extends UISpawnModule {
43
42
  assertValidNumber(this.magnitudeInternal.min, "UISpawnRandomVelocity.magnitude.min");
44
43
  assertValidNumber(this.magnitudeInternal.max, "UISpawnRandomVelocity.magnitude.max");
45
44
  }
46
- /** @internal */
47
- spawn(properties, instanceBegin, instanceEnd) {
45
+ spawn(properties, instanceBegin, instanceEnd, randomSalt) {
48
46
  const { builtin } = properties;
49
47
  const { array, itemSize } = builtin;
50
48
  const { min: angleMin, max: angleMax } = this.angleInternal;
51
49
  const { min: magnitudeMin, max: magnitudeMax } = this.magnitudeInternal;
50
+ const angleStream = particleRandomStream(randomSalt, 0);
51
+ const magnitudeStream = particleRandomStream(randomSalt, 1);
52
52
  for (let i = instanceBegin; i < instanceEnd; i++) {
53
53
  const itemOffset = i * itemSize;
54
- const angle = MathUtils.randFloat(angleMin, angleMax);
55
- const magnitude = MathUtils.randFloat(magnitudeMin, magnitudeMax);
54
+ const angle = MathUtils.lerp(angleMin, angleMax, particleRandom(array, itemOffset, angleStream));
55
+ const magnitude = MathUtils.lerp(magnitudeMin, magnitudeMax, particleRandom(array, itemOffset, magnitudeStream));
56
56
  array[itemOffset + BUILTIN_OFFSET_VELOCITY_X] = Math.cos(angle) * magnitude;
57
57
  array[itemOffset + BUILTIN_OFFSET_VELOCITY_Y] = Math.sin(angle) * magnitude;
58
58
  }
@@ -1,3 +1,4 @@
1
+ import type { InstancedBufferAttribute } from "three";
1
2
  import type { Vector2Like } from "../../core/miscellaneous/math.js";
2
3
  import type { UIVector2Config } from "../miscellaneous/miscellaneous.js";
3
4
  import { UISpawnModule } from "./UISpawnModule.js";
@@ -9,6 +10,9 @@ import { UISpawnModule } from "./UISpawnModule.js";
9
10
  export declare class UISpawnRectangle extends UISpawnModule<{
10
11
  builtin: "Matrix4";
11
12
  }> {
13
+ readonly requiredProperties: {
14
+ readonly builtin: "Matrix4";
15
+ };
12
16
  private minInternal;
13
17
  private maxInternal;
14
18
  /**
@@ -24,4 +28,7 @@ export declare class UISpawnRectangle extends UISpawnModule<{
24
28
  set min(value: UIVector2Config);
25
29
  /** Top-right corner of spawn area */
26
30
  set max(value: UIVector2Config);
31
+ spawn(properties: {
32
+ builtin: InstancedBufferAttribute;
33
+ }, instanceBegin: number, instanceEnd: number, randomSalt: number): void;
27
34
  }
@@ -1,6 +1,6 @@
1
1
  import { MathUtils } from "three";
2
2
  import { assertValidNumber } from "../../core/miscellaneous/asserts.js";
3
- import { BUILTIN_OFFSET_POSITION_X, BUILTIN_OFFSET_POSITION_Y, resolveUIVector2Config, } from "../miscellaneous/miscellaneous.js";
3
+ import { BUILTIN_OFFSET_POSITION_X, BUILTIN_OFFSET_POSITION_Y, particleRandom, particleRandomStream, resolveUIVector2Config, } from "../miscellaneous/miscellaneous.js";
4
4
  import { UISpawnModule } from "./UISpawnModule.js";
5
5
  /**
6
6
  * Spawns particles at random positions within a rectangle.
@@ -14,7 +14,6 @@ export class UISpawnRectangle extends UISpawnModule {
14
14
  */
15
15
  constructor(min = { x: -50, y: -50 }, max = { x: 50, y: 50 }) {
16
16
  super();
17
- /** @internal */
18
17
  this.requiredProperties = { builtin: "Matrix4" };
19
18
  this.minInternal = resolveUIVector2Config(min);
20
19
  this.maxInternal = resolveUIVector2Config(max);
@@ -43,16 +42,17 @@ export class UISpawnRectangle extends UISpawnModule {
43
42
  assertValidNumber(this.maxInternal.x, "UISpawnRectangle.max.x");
44
43
  assertValidNumber(this.maxInternal.y, "UISpawnRectangle.max.y");
45
44
  }
46
- /** @internal */
47
- spawn(properties, instanceBegin, instanceEnd) {
45
+ spawn(properties, instanceBegin, instanceEnd, randomSalt) {
48
46
  const { builtin } = properties;
49
47
  const { array, itemSize } = builtin;
50
48
  const { x: minX, y: minY } = this.minInternal;
51
49
  const { x: maxX, y: maxY } = this.maxInternal;
50
+ const xStream = particleRandomStream(randomSalt, 0);
51
+ const yStream = particleRandomStream(randomSalt, 1);
52
52
  for (let i = instanceBegin; i < instanceEnd; i++) {
53
53
  const itemOffset = i * itemSize;
54
- array[itemOffset + BUILTIN_OFFSET_POSITION_X] = MathUtils.randFloat(minX, maxX);
55
- array[itemOffset + BUILTIN_OFFSET_POSITION_Y] = MathUtils.randFloat(minY, maxY);
54
+ array[itemOffset + BUILTIN_OFFSET_POSITION_X] = MathUtils.lerp(minX, maxX, particleRandom(array, itemOffset, xStream));
55
+ array[itemOffset + BUILTIN_OFFSET_POSITION_Y] = MathUtils.lerp(minY, maxY, particleRandom(array, itemOffset, yStream));
56
56
  }
57
57
  builtin.needsUpdate = true;
58
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "laymur",
3
- "version": "0.25.2",
3
+ "version": "0.27.0",
4
4
  "description": "Constraint-based UI library for Three.js mobile advertisements",
5
5
  "keywords": [
6
6
  "ui",
@@ -22,6 +22,8 @@
22
22
  "scripts": {
23
23
  "clean": "rm -rf dist",
24
24
  "build": "npm run clean && tsc -p tsconfig.json",
25
+ "lint": "eslint src",
26
+ "format": "prettier --write . && eslint src --fix",
25
27
  "prepublishOnly": "npm run build"
26
28
  },
27
29
  "main": "./dist/core/index.js",
@@ -53,12 +55,19 @@
53
55
  "ferrsign": "^0.0.4",
54
56
  "three": ">=0.157.0 <0.180.0"
55
57
  },
58
+ "peerDependenciesMeta": {
59
+ "fast-simplex-noise": {
60
+ "optional": true
61
+ }
62
+ },
56
63
  "devDependencies": {
57
64
  "@types/node": "^25.0.2",
58
65
  "@types/three": "^0.157.0",
59
- "@typescript-eslint/eslint-plugin": "^8.32.0",
60
- "@typescript-eslint/parser": "^8.32.0",
61
- "eslint": "^9.26.0",
66
+ "@typescript-eslint/eslint-plugin": "^8.72.1",
67
+ "@typescript-eslint/parser": "^8.72.1",
68
+ "eslint": "^10.14.0",
69
+ "eslint-plugin-simple-import-sort": "^12.1.1",
70
+ "prettier": "^3.9.10",
62
71
  "typescript": "^5.8.3"
63
72
  }
64
73
  }
@@ -1,21 +0,0 @@
1
- import type { UIResizePolicy } from "../../miscellaneous/resize-policy/UIResizePolicy.js";
2
- import { UIResizePolicyNone } from "../../miscellaneous/resize-policy/UIResizePolicyNone.js";
3
- import type { UILayerOptions } from "../UILayer/UILayer.Internal.js";
4
- import type { UIFullscreenLayer } from "./UIFullscreenLayer.js";
5
- /** Fullscreen layer input event data */
6
- export interface UIFullscreenLayerInputEventData {
7
- /** X coordinate */
8
- x: number;
9
- /** Y coordinate */
10
- y: number;
11
- /** Pointer identifier */
12
- identifier: number;
13
- /** Layer that emitted the event */
14
- layer: UIFullscreenLayer;
15
- }
16
- /** Configuration for fullscreen layer */
17
- export interface UIFullscreenLayerOptions extends Omit<UILayerOptions, "width" | "height"> {
18
- /** Strategy for handling window resize */
19
- resizePolicy: UIResizePolicy;
20
- }
21
- export declare const FULLSCREEN_LAYER_DEFAULT_RESIZE_POLICY: UIResizePolicyNone;
@@ -1,63 +0,0 @@
1
- import type { FerrsignView1 } from "ferrsign";
2
- import type { Camera, Vector2, WebGLRenderer } from "three";
3
- import { Ray, Vector3 } from "three";
4
- import type { UIResizePolicy } from "../../miscellaneous/resize-policy/UIResizePolicy.js";
5
- import { UILayer } from "../UILayer/UILayer.js";
6
- import type { UIFullscreenLayerInputEventData, UIFullscreenLayerOptions } from "./UIFullscreenLayer.Internal.js";
7
- /** Layer that automatically handles browser window resizing and input events */
8
- export declare class UIFullscreenLayer extends UILayer {
9
- private resizePolicyInternal;
10
- private resizePolicyDirty;
11
- private readonly signalPointerPressedInternal;
12
- private readonly signalPointerMovedInternal;
13
- private readonly signalPointerReleasedInternal;
14
- constructor(options?: Partial<UIFullscreenLayerOptions>);
15
- /** Current resize policy */
16
- get resizePolicy(): UIResizePolicy;
17
- /** Signal fired when pointer is pressed */
18
- get signalPointerPressed(): FerrsignView1<UIFullscreenLayerInputEventData>;
19
- /** Signal fired when pointer is moved */
20
- get signalPointerMoved(): FerrsignView1<UIFullscreenLayerInputEventData>;
21
- /** Signal fired when pointer is released */
22
- get signalPointerReleased(): FerrsignView1<UIFullscreenLayerInputEventData>;
23
- /** Updates resize policy */
24
- set resizePolicy(value: UIResizePolicy);
25
- /** Removes event listeners and destroys the layer with its elements and constraints */
26
- destroy(): void;
27
- /**
28
- * Renders layer and all visible elements
29
- * @param renderer Three.js WebGL renderer
30
- * @param deltaTime Time since last frame in seconds
31
- */
32
- render(renderer: WebGLRenderer, deltaTime: number): void;
33
- /**
34
- * Projects 3D world position to 2D layer coordinates
35
- * @param position World position
36
- * @param camera Three.js camera
37
- * @param result Reusable vector instance
38
- * @returns Layer coordinates
39
- */
40
- projectWorldPosition(position: Vector3, camera: Camera, result?: Vector3): Vector3;
41
- /**
42
- * Projects 2D layer coordinates to 3D world position
43
- * @param position Layer coordinates
44
- * @param camera Three.js camera
45
- * @param z Depth coordinate
46
- * @param result Reusable vector instance
47
- * @returns World position
48
- */
49
- projectLayerPosition(position: Vector2, camera: Camera, z?: number, result?: Vector3): Vector3;
50
- /**
51
- * Builds ray from layer position through camera
52
- * @param position Layer coordinates
53
- * @param camera Three.js camera
54
- * @param result Reusable ray instance
55
- * @returns Ray from near to far plane
56
- */
57
- buildRay(position: Vector2, camera: Camera, result?: Ray): Ray;
58
- private readonly onResize;
59
- private readonly onPointerDown;
60
- private readonly onPointerMove;
61
- private readonly onPointerUp;
62
- private handleWindowInput;
63
- }