sparcoon 0.5.0 → 0.6.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 (105) hide show
  1. package/README.md +6 -6
  2. package/dist/emitter/FXEmitter.Internal.d.ts +55 -0
  3. package/dist/emitter/FXEmitter.d.ts +49 -0
  4. package/dist/emitter/FXEmitter.js +64 -0
  5. package/dist/emitter/behavior/FXBehavior.d.ts +12 -2
  6. package/dist/emitter/behavior/FXBehavior.js +3 -2
  7. package/dist/emitter/behavior/FXBehaviorDirectionalForce.d.ts +25 -0
  8. package/dist/emitter/behavior/FXBehaviorDirectionalForce.js +74 -0
  9. package/dist/emitter/behavior/FXBehaviorPointForce.d.ts +40 -0
  10. package/dist/emitter/behavior/FXBehaviorPointForce.js +98 -0
  11. package/dist/emitter/behavior/FXBehaviorScaleOverLife.d.ts +9 -8
  12. package/dist/emitter/behavior/FXBehaviorScaleOverLife.js +12 -29
  13. package/dist/emitter/behavior/FXBehaviorTorqueDamping.d.ts +4 -3
  14. package/dist/emitter/behavior/FXBehaviorTorqueDamping.js +3 -2
  15. package/dist/emitter/behavior/FXBehaviorTorqueNoise.d.ts +4 -3
  16. package/dist/emitter/behavior/FXBehaviorTorqueNoise.js +3 -2
  17. package/dist/emitter/behavior/FXBehaviorTorqueOverLife.d.ts +17 -0
  18. package/dist/emitter/behavior/FXBehaviorTorqueOverLife.js +34 -0
  19. package/dist/emitter/behavior/FXBehaviorVelocityDamping.d.ts +3 -2
  20. package/dist/emitter/behavior/FXBehaviorVelocityDamping.js +3 -2
  21. package/dist/emitter/behavior/FXBehaviorVelocityNoise.d.ts +6 -5
  22. package/dist/emitter/behavior/FXBehaviorVelocityNoise.js +6 -5
  23. package/dist/emitter/behavior/FXBehaviorVelocityOverLife.d.ts +20 -0
  24. package/dist/emitter/behavior/FXBehaviorVelocityOverLife.js +48 -0
  25. package/dist/emitter/spawn/FXSpawn.d.ts +4 -2
  26. package/dist/emitter/spawn/FXSpawn.js +3 -2
  27. package/dist/emitter/spawn/FXSpawnBox.d.ts +8 -16
  28. package/dist/emitter/spawn/FXSpawnBox.js +23 -39
  29. package/dist/emitter/spawn/{FXSpawnRandomLifetime.d.ts → FXSpawnLifetime.d.ts} +3 -5
  30. package/dist/emitter/spawn/{FXSpawnRandomLifetime.js → FXSpawnLifetime.js} +8 -10
  31. package/dist/emitter/spawn/FXSpawnOffset.d.ts +9 -0
  32. package/dist/emitter/spawn/FXSpawnOffset.js +9 -0
  33. package/dist/emitter/spawn/FXSpawnPoint.d.ts +8 -0
  34. package/dist/emitter/spawn/FXSpawnPoint.js +8 -0
  35. package/dist/emitter/spawn/{FXSpawnRandomRotation.d.ts → FXSpawnRotation.d.ts} +3 -5
  36. package/dist/emitter/spawn/{FXSpawnRandomRotation.js → FXSpawnRotation.js} +8 -10
  37. package/dist/emitter/spawn/{FXSpawnRandomScale.d.ts → FXSpawnScale.d.ts} +4 -6
  38. package/dist/emitter/spawn/{FXSpawnRandomScale.js → FXSpawnScale.js} +12 -14
  39. package/dist/emitter/spawn/FXSpawnSphere.d.ts +11 -6
  40. package/dist/emitter/spawn/FXSpawnSphere.js +11 -6
  41. package/dist/emitter/spawn/{FXSpawnRandomTorque.d.ts → FXSpawnTorque.d.ts} +3 -5
  42. package/dist/emitter/spawn/{FXSpawnRandomTorque.js → FXSpawnTorque.js} +8 -10
  43. package/dist/emitter/spawn/FXSpawnVelocity.d.ts +32 -0
  44. package/dist/emitter/spawn/{FXSpawnRandomVelocity.js → FXSpawnVelocity.js} +26 -11
  45. package/dist/index.d.ts +23 -16
  46. package/dist/index.js +20 -16
  47. package/dist/materials/FXDiffuseMaterial/FXDiffuseMaterial.Internal.d.ts +4 -4
  48. package/dist/materials/FXDiffuseMaterial/FXDiffuseMaterial.Internal.js +2 -2
  49. package/dist/materials/FXDiffuseMaterial/FXDiffuseMaterial.d.ts +55 -5
  50. package/dist/materials/FXDiffuseMaterial/FXDiffuseMaterial.js +9 -2
  51. package/dist/materials/FXMaterial/FXDepthMaterial.Internal.d.ts +3 -3
  52. package/dist/materials/FXMaterial/FXDistanceMaterial.Internal.d.ts +3 -3
  53. package/dist/materials/FXMaterial/FXMaterial.d.ts +51 -5
  54. package/dist/materials/FXMaterial/FXMaterial.js +5 -0
  55. package/dist/materials/FXUnlitMaterial/FXUnlitMaterial.Internal.d.ts +3 -3
  56. package/dist/materials/FXUnlitMaterial/FXUnlitMaterial.d.ts +3 -3
  57. package/dist/materials/FXUnlitMaterial/FXUnlitMaterial.js +3 -3
  58. package/dist/miscellaneous/curve/FXCurve1D.Internal.d.ts +20 -0
  59. package/dist/miscellaneous/curve/FXCurve1D.d.ts +17 -0
  60. package/dist/miscellaneous/curve/FXCurve1D.js +94 -0
  61. package/dist/miscellaneous/miscellaneous.d.ts +3 -1
  62. package/dist/miscellaneous/miscellaneous.js +8 -4
  63. package/dist/miscellaneous/texture/FXTextureView.Internal.js +6 -0
  64. package/dist/miscellaneous/texture/FXTextureView.js +234 -0
  65. package/dist/nodes/color/FXNodeColor.d.ts +7 -0
  66. package/dist/nodes/color/FXNodeColor.js +11 -0
  67. package/dist/nodes/color/FXNodeColorOverLife.d.ts +25 -0
  68. package/dist/nodes/color/FXNodeColorOverLife.js +60 -0
  69. package/dist/nodes/color/FXNodeSphericalClip.d.ts +18 -0
  70. package/dist/nodes/color/FXNodeSphericalClip.js +45 -0
  71. package/dist/nodes/normal/FXNodeFlatNormal.d.ts +7 -0
  72. package/dist/nodes/normal/FXNodeFlatNormal.js +17 -0
  73. package/dist/nodes/normal/FXNodeNormal.d.ts +7 -0
  74. package/dist/nodes/normal/FXNodeNormal.js +7 -0
  75. package/dist/nodes/normal/FXNodeSphericalNormal.d.ts +7 -0
  76. package/dist/nodes/normal/{FXSphericalNormalNode.js → FXNodeSphericalNormal.js} +7 -4
  77. package/dist/nodes/texture/FXNodeAnimatedTexture.d.ts +47 -0
  78. package/dist/nodes/texture/FXNodeAnimatedTexture.js +137 -0
  79. package/dist/nodes/texture/FXNodeStaticTexture.d.ts +18 -0
  80. package/dist/nodes/texture/FXNodeStaticTexture.js +60 -0
  81. package/dist/nodes/texture/FXNodeTexture.d.ts +7 -0
  82. package/dist/nodes/texture/FXNodeTexture.js +11 -0
  83. package/package.json +2 -4
  84. package/dist/emitter/behavior/FXBehaviorDirectionalGravity.d.ts +0 -21
  85. package/dist/emitter/behavior/FXBehaviorDirectionalGravity.js +0 -51
  86. package/dist/emitter/behavior/FXBehaviorPointGravity.d.ts +0 -39
  87. package/dist/emitter/behavior/FXBehaviorPointGravity.js +0 -116
  88. package/dist/emitter/spawn/FXSpawnRandomVelocity.d.ts +0 -17
  89. package/dist/nodes/color/FXColorNode.d.ts +0 -3
  90. package/dist/nodes/color/FXColorNode.js +0 -8
  91. package/dist/nodes/color/FXColorOverLifeNode.d.ts +0 -6
  92. package/dist/nodes/color/FXColorOverLifeNode.js +0 -44
  93. package/dist/nodes/color/FXSphericalClipNode.d.ts +0 -5
  94. package/dist/nodes/color/FXSphericalClipNode.js +0 -30
  95. package/dist/nodes/normal/FXFlatNormalNode.d.ts +0 -4
  96. package/dist/nodes/normal/FXFlatNormalNode.js +0 -14
  97. package/dist/nodes/normal/FXNormalNode.d.ts +0 -3
  98. package/dist/nodes/normal/FXNormalNode.js +0 -4
  99. package/dist/nodes/normal/FXSphericalNormalNode.d.ts +0 -4
  100. package/dist/nodes/texture/FXAnimatedTextureNode.d.ts +0 -12
  101. package/dist/nodes/texture/FXAnimatedTextureNode.js +0 -88
  102. package/dist/nodes/texture/FXStaticTextureNode.d.ts +0 -6
  103. package/dist/nodes/texture/FXStaticTextureNode.js +0 -34
  104. package/dist/nodes/texture/FXTextureNode.d.ts +0 -3
  105. package/dist/nodes/texture/FXTextureNode.js +0 -8
@@ -1,16 +1,14 @@
1
1
  import type { FXRange, FXRangeConfig } from "../../miscellaneous/miscellaneous";
2
2
  import { FXSpawn } from "./FXSpawn";
3
3
  /**
4
- * Assigns random rotation to particles.
5
- *
6
- * Initial rotation is chosen uniformly from the specified range.
4
+ * Assigns a random initial rotation to each spawned particle
7
5
  */
8
- export declare class FXSpawnRandomRotation extends FXSpawn<{
6
+ export declare class FXSpawnRotation extends FXSpawn<{
9
7
  builtin: "Matrix4";
10
8
  }> {
11
9
  private rotationInternal;
12
10
  /**
13
- * @param rotation - Rotation range in radians. Accepts number, tuple, or range object
11
+ * @param rotation - Rotation range in radians. Defaults to `{ min: -Math.PI, max: Math.PI }`
14
12
  */
15
13
  constructor(rotation?: FXRangeConfig);
16
14
  /** Rotation range in radians */
@@ -4,21 +4,19 @@ import { resolveFXRangeConfig, BUILTIN_OFFSET_ROTATION } from '../../miscellaneo
4
4
  import { FXSpawn } from './FXSpawn.js';
5
5
 
6
6
  /**
7
- * Assigns random rotation to particles.
8
- *
9
- * Initial rotation is chosen uniformly from the specified range.
7
+ * Assigns a random initial rotation to each spawned particle
10
8
  */
11
- class FXSpawnRandomRotation extends FXSpawn {
9
+ class FXSpawnRotation extends FXSpawn {
12
10
  /**
13
- * @param rotation - Rotation range in radians. Accepts number, tuple, or range object
11
+ * @param rotation - Rotation range in radians. Defaults to `{ min: -Math.PI, max: Math.PI }`
14
12
  */
15
13
  constructor(rotation = { min: -Math.PI, max: Math.PI }) {
16
14
  super();
17
15
  /** @internal */
18
16
  this.requiredProperties = { builtin: "Matrix4" };
19
17
  this._private_rotationInternal = resolveFXRangeConfig(rotation);
20
- assertValidNumber(this._private_rotationInternal.min, "FXSpawnRandomRotation.constructor.rotation.min");
21
- assertValidNumber(this._private_rotationInternal.max, "FXSpawnRandomRotation.constructor.rotation.max");
18
+ assertValidNumber(this._private_rotationInternal.min, "FXSpawnRotation.constructor.rotation.min");
19
+ assertValidNumber(this._private_rotationInternal.max, "FXSpawnRotation.constructor.rotation.max");
22
20
  }
23
21
  /** Rotation range in radians */
24
22
  get rotation() {
@@ -27,8 +25,8 @@ class FXSpawnRandomRotation extends FXSpawn {
27
25
  /** Rotation range in radians */
28
26
  set rotation(value) {
29
27
  this._private_rotationInternal = resolveFXRangeConfig(value);
30
- assertValidNumber(this._private_rotationInternal.min, "FXSpawnRandomRotation.rotation.min");
31
- assertValidNumber(this._private_rotationInternal.max, "FXSpawnRandomRotation.rotation.max");
28
+ assertValidNumber(this._private_rotationInternal.min, "FXSpawnRotation.rotation.min");
29
+ assertValidNumber(this._private_rotationInternal.max, "FXSpawnRotation.rotation.max");
32
30
  }
33
31
  /** @internal */
34
32
  spawn(properties, instanceBegin, instanceEnd) {
@@ -42,4 +40,4 @@ class FXSpawnRandomRotation extends FXSpawn {
42
40
  }
43
41
  }
44
42
 
45
- export { FXSpawnRandomRotation };
43
+ export { FXSpawnRotation };
@@ -1,18 +1,16 @@
1
1
  import type { FXAspectConfig, FXRange, FXRangeConfig } from "../../miscellaneous/miscellaneous";
2
2
  import { FXSpawn } from "./FXSpawn";
3
3
  /**
4
- * Assigns random scale to particles.
5
- *
6
- * Base scale is chosen uniformly from the range. Aspect ratio is applied to X scale.
4
+ * Assigns a random initial scale to each spawned particle
7
5
  */
8
- export declare class FXSpawnRandomScale extends FXSpawn<{
6
+ export declare class FXSpawnScale extends FXSpawn<{
9
7
  builtin: "Matrix4";
10
8
  }> {
11
9
  private scaleInternal;
12
10
  private aspectInternal;
13
11
  /**
14
- * @param scale - Base scale range. Accepts number, tuple, or range object
15
- * @param aspect - Width/height ratio. Accepts number or texture
12
+ * @param scale - Base scale range; must be positive. Defaults to `{ min: 1, max: 2 }`
13
+ * @param aspect - Width/height ratio; must be positive. Defaults to `1`
16
14
  */
17
15
  constructor(scale?: FXRangeConfig, aspect?: FXAspectConfig);
18
16
  /** Base scale range */
@@ -4,24 +4,22 @@ import { resolveFXRangeConfig, resolveAspect, BUILTIN_OFFSET_SCALE_X, BUILTIN_OF
4
4
  import { FXSpawn } from './FXSpawn.js';
5
5
 
6
6
  /**
7
- * Assigns random scale to particles.
8
- *
9
- * Base scale is chosen uniformly from the range. Aspect ratio is applied to X scale.
7
+ * Assigns a random initial scale to each spawned particle
10
8
  */
11
- class FXSpawnRandomScale extends FXSpawn {
9
+ class FXSpawnScale extends FXSpawn {
12
10
  /**
13
- * @param scale - Base scale range. Accepts number, tuple, or range object
14
- * @param aspect - Width/height ratio. Accepts number or texture
11
+ * @param scale - Base scale range; must be positive. Defaults to `{ min: 1, max: 2 }`
12
+ * @param aspect - Width/height ratio; must be positive. Defaults to `1`
15
13
  */
16
- constructor(scale = { min: 50, max: 100 }, aspect = 1) {
14
+ constructor(scale = { min: 1, max: 2 }, aspect = 1) {
17
15
  super();
18
16
  /** @internal */
19
17
  this.requiredProperties = { builtin: "Matrix4" };
20
18
  this._private_scaleInternal = resolveFXRangeConfig(scale);
21
19
  this._private_aspectInternal = resolveAspect(aspect);
22
- assertValidPositiveNumber(this._private_scaleInternal.min, "FXSpawnRandomScale.constructor.scale.min");
23
- assertValidPositiveNumber(this._private_scaleInternal.max, "FXSpawnRandomScale.constructor.scale.max");
24
- assertValidPositiveNumber(this._private_aspectInternal, "FXSpawnRandomScale.constructor.aspect");
20
+ assertValidPositiveNumber(this._private_scaleInternal.min, "FXSpawnScale.constructor.scale.min");
21
+ assertValidPositiveNumber(this._private_scaleInternal.max, "FXSpawnScale.constructor.scale.max");
22
+ assertValidPositiveNumber(this._private_aspectInternal, "FXSpawnScale.constructor.aspect");
25
23
  }
26
24
  /** Base scale range */
27
25
  get scale() {
@@ -34,13 +32,13 @@ class FXSpawnRandomScale extends FXSpawn {
34
32
  /** Base scale range */
35
33
  set scale(value) {
36
34
  this._private_scaleInternal = resolveFXRangeConfig(value);
37
- assertValidPositiveNumber(this._private_scaleInternal.min, "FXSpawnRandomScale.scale.min");
38
- assertValidPositiveNumber(this._private_scaleInternal.max, "FXSpawnRandomScale.scale.max");
35
+ assertValidPositiveNumber(this._private_scaleInternal.min, "FXSpawnScale.scale.min");
36
+ assertValidPositiveNumber(this._private_scaleInternal.max, "FXSpawnScale.scale.max");
39
37
  }
40
38
  /** Width/height aspect ratio */
41
39
  set aspect(value) {
42
40
  this._private_aspectInternal = resolveAspect(value);
43
- assertValidPositiveNumber(this._private_aspectInternal, "FXSpawnRandomScale.aspect");
41
+ assertValidPositiveNumber(this._private_aspectInternal, "FXSpawnScale.aspect");
44
42
  }
45
43
  /** @internal */
46
44
  spawn(properties, instanceBegin, instanceEnd) {
@@ -57,4 +55,4 @@ class FXSpawnRandomScale extends FXSpawn {
57
55
  }
58
56
  }
59
57
 
60
- export { FXSpawnRandomScale };
58
+ export { FXSpawnScale };
@@ -1,11 +1,12 @@
1
1
  import { FXSpawn } from "./FXSpawn";
2
2
  /**
3
- * Spawns particles at random positions within a spherical shell.
3
+ * Spawns particles at random positions within a spherical shell
4
4
  *
5
+ * @remarks
5
6
  * The `angle` parameter controls the polar spread from the equatorial plane:
6
7
  * - `0` - flat disk (XZ plane only)
7
8
  * - `Math.PI / 2` - full sphere
8
- * - Values in between produce a spherical band/zone
9
+ * - Values in between produce a spherical band
9
10
  */
10
11
  export declare class FXSpawnSphere extends FXSpawn<{
11
12
  builtin: "Matrix4";
@@ -14,9 +15,9 @@ export declare class FXSpawnSphere extends FXSpawn<{
14
15
  private outerRadiusInternal;
15
16
  private angleInternal;
16
17
  /**
17
- * @param innerRadius - Minimum spawn radius (0 = spawn from center)
18
- * @param outerRadius - Maximum spawn radius
19
- * @param angle - Polar half-angle from equatorial plane: 0 = disk, Math.PI/2 = full sphere
18
+ * @param innerRadius - Minimum spawn radius; must be non-negative. Defaults to `0`
19
+ * @param outerRadius - Maximum spawn radius; must be non-negative. Defaults to `1`
20
+ * @param angle - Polar half-angle from equatorial plane in radians. Defaults to `Math.PI / 2`
20
21
  */
21
22
  constructor(innerRadius?: number, outerRadius?: number, angle?: number);
22
23
  /**
@@ -33,6 +34,10 @@ export declare class FXSpawnSphere extends FXSpawn<{
33
34
  set innerRadius(value: number);
34
35
  /** Maximum spawn radius */
35
36
  set outerRadius(value: number);
36
- /** @see {@link angle} */
37
+ /**
38
+ * Polar half-angle from the equatorial plane.
39
+ * - `0` - flat disk
40
+ * - `Math.PI / 2` - full sphere
41
+ */
37
42
  set angle(value: number);
38
43
  }
@@ -4,18 +4,19 @@ import { BUILTIN_OFFSET_POSITION_X, BUILTIN_OFFSET_POSITION_Y, BUILTIN_OFFSET_PO
4
4
  import { FXSpawn } from './FXSpawn.js';
5
5
 
6
6
  /**
7
- * Spawns particles at random positions within a spherical shell.
7
+ * Spawns particles at random positions within a spherical shell
8
8
  *
9
+ * @remarks
9
10
  * The `angle` parameter controls the polar spread from the equatorial plane:
10
11
  * - `0` - flat disk (XZ plane only)
11
12
  * - `Math.PI / 2` - full sphere
12
- * - Values in between produce a spherical band/zone
13
+ * - Values in between produce a spherical band
13
14
  */
14
15
  class FXSpawnSphere extends FXSpawn {
15
16
  /**
16
- * @param innerRadius - Minimum spawn radius (0 = spawn from center)
17
- * @param outerRadius - Maximum spawn radius
18
- * @param angle - Polar half-angle from equatorial plane: 0 = disk, Math.PI/2 = full sphere
17
+ * @param innerRadius - Minimum spawn radius; must be non-negative. Defaults to `0`
18
+ * @param outerRadius - Maximum spawn radius; must be non-negative. Defaults to `1`
19
+ * @param angle - Polar half-angle from equatorial plane in radians. Defaults to `Math.PI / 2`
19
20
  */
20
21
  constructor(innerRadius = 0, outerRadius = 1, angle = Math.PI / 2) {
21
22
  super();
@@ -54,7 +55,11 @@ class FXSpawnSphere extends FXSpawn {
54
55
  assertValidNonNegativeNumber(value, "FXSpawnSphere.outerRadius");
55
56
  this._private_outerRadiusInternal = value;
56
57
  }
57
- /** @see {@link angle} */
58
+ /**
59
+ * Polar half-angle from the equatorial plane.
60
+ * - `0` - flat disk
61
+ * - `Math.PI / 2` - full sphere
62
+ */
58
63
  set angle(value) {
59
64
  assertValidNumber(value, "FXSpawnSphere.angle");
60
65
  this._private_angleInternal = value;
@@ -1,16 +1,14 @@
1
1
  import type { FXRange, FXRangeConfig } from "../../miscellaneous/miscellaneous";
2
2
  import { FXSpawn } from "./FXSpawn";
3
3
  /**
4
- * Assigns random angular velocity to particles.
5
- *
6
- * Torque (rotation speed) is chosen uniformly from the specified range.
4
+ * Assigns a random initial angular velocity to each spawned particle
7
5
  */
8
- export declare class FXSpawnRandomTorque extends FXSpawn<{
6
+ export declare class FXSpawnTorque extends FXSpawn<{
9
7
  builtin: "Matrix4";
10
8
  }> {
11
9
  private torqueInternal;
12
10
  /**
13
- * @param torque - Angular velocity range in radians/second. Accepts number, tuple, or range object
11
+ * @param torque - Angular velocity range in radians/second. Defaults to `{ min: -Math.PI, max: Math.PI }`
14
12
  */
15
13
  constructor(torque?: FXRangeConfig);
16
14
  /** Angular velocity range in radians/second */
@@ -4,21 +4,19 @@ import { resolveFXRangeConfig, BUILTIN_OFFSET_TORQUE } from '../../miscellaneous
4
4
  import { FXSpawn } from './FXSpawn.js';
5
5
 
6
6
  /**
7
- * Assigns random angular velocity to particles.
8
- *
9
- * Torque (rotation speed) is chosen uniformly from the specified range.
7
+ * Assigns a random initial angular velocity to each spawned particle
10
8
  */
11
- class FXSpawnRandomTorque extends FXSpawn {
9
+ class FXSpawnTorque extends FXSpawn {
12
10
  /**
13
- * @param torque - Angular velocity range in radians/second. Accepts number, tuple, or range object
11
+ * @param torque - Angular velocity range in radians/second. Defaults to `{ min: -Math.PI, max: Math.PI }`
14
12
  */
15
13
  constructor(torque = { min: -Math.PI, max: Math.PI }) {
16
14
  super();
17
15
  /** @internal */
18
16
  this.requiredProperties = { builtin: "Matrix4" };
19
17
  this._private_torqueInternal = resolveFXRangeConfig(torque);
20
- assertValidNumber(this._private_torqueInternal.min, "FXSpawnRandomTorque.constructor.torque.min");
21
- assertValidNumber(this._private_torqueInternal.max, "FXSpawnRandomTorque.constructor.torque.max");
18
+ assertValidNumber(this._private_torqueInternal.min, "FXSpawnTorque.constructor.torque.min");
19
+ assertValidNumber(this._private_torqueInternal.max, "FXSpawnTorque.constructor.torque.max");
22
20
  }
23
21
  /** Angular velocity range in radians/second */
24
22
  get torque() {
@@ -27,8 +25,8 @@ class FXSpawnRandomTorque extends FXSpawn {
27
25
  /** Angular velocity range in radians/second */
28
26
  set torque(value) {
29
27
  this._private_torqueInternal = resolveFXRangeConfig(value);
30
- assertValidNumber(this._private_torqueInternal.min, "FXSpawnRandomTorque.torque.min");
31
- assertValidNumber(this._private_torqueInternal.max, "FXSpawnRandomTorque.torque.max");
28
+ assertValidNumber(this._private_torqueInternal.min, "FXSpawnTorque.torque.min");
29
+ assertValidNumber(this._private_torqueInternal.max, "FXSpawnTorque.torque.max");
32
30
  }
33
31
  /** @internal */
34
32
  spawn(properties, instanceBegin, instanceEnd) {
@@ -42,4 +40,4 @@ class FXSpawnRandomTorque extends FXSpawn {
42
40
  }
43
41
  }
44
42
 
45
- export { FXSpawnRandomTorque };
43
+ export { FXSpawnTorque };
@@ -0,0 +1,32 @@
1
+ import { Vector3 } from "three";
2
+ import type { FXRange, FXRangeConfig } from "../../miscellaneous/miscellaneous";
3
+ import { FXSpawn } from "./FXSpawn";
4
+ /**
5
+ * Assigns a random initial velocity to each spawned particle within a cone around a direction axis
6
+ */
7
+ export declare class FXSpawnVelocity extends FXSpawn<{
8
+ builtin: "Matrix4";
9
+ }> {
10
+ private angleInternal;
11
+ private magnitudeInternal;
12
+ private readonly directionInternal;
13
+ /**
14
+ * @param direction - Cone axis; normalized automatically. Defaults to `(0, 1, 0)`
15
+ * @param angle - Cone half-angle range in radians; `{ min: 0, max: 0 }` fires in a straight line.
16
+ * Defaults to `{ min: 0, max: Math.PI }`
17
+ * @param magnitude - Speed range in units/second. Defaults to `{ min: -1, max: 1 }`
18
+ */
19
+ constructor(direction?: Vector3, angle?: FXRangeConfig, magnitude?: FXRangeConfig);
20
+ /** Cone half-angle range in radians */
21
+ get angle(): FXRange;
22
+ /** Speed range in units/second */
23
+ get magnitude(): FXRange;
24
+ /** Cone axis (always normalized) */
25
+ get direction(): Vector3;
26
+ /** Cone half-angle range in radians */
27
+ set angle(value: FXRangeConfig);
28
+ /** Speed range in units/second */
29
+ set magnitude(value: FXRangeConfig);
30
+ /** Cone axis - normalized on assignment */
31
+ set direction(value: Vector3);
32
+ }
@@ -6,38 +6,53 @@ import { FXSpawn } from './FXSpawn.js';
6
6
  const TEMP_TANGENT = new Vector3();
7
7
  const TEMP_BITANGENT = new Vector3();
8
8
  const TEMP_VELOCITY = new Vector3();
9
- class FXSpawnRandomVelocity extends FXSpawn {
10
- constructor(direction = new Vector3(0, 1, 0), angle = { min: 0, max: Math.PI }, magnitude = { min: -50, max: 50 }) {
9
+ /**
10
+ * Assigns a random initial velocity to each spawned particle within a cone around a direction axis
11
+ */
12
+ class FXSpawnVelocity extends FXSpawn {
13
+ /**
14
+ * @param direction - Cone axis; normalized automatically. Defaults to `(0, 1, 0)`
15
+ * @param angle - Cone half-angle range in radians; `{ min: 0, max: 0 }` fires in a straight line.
16
+ * Defaults to `{ min: 0, max: Math.PI }`
17
+ * @param magnitude - Speed range in units/second. Defaults to `{ min: -1, max: 1 }`
18
+ */
19
+ constructor(direction = new Vector3(0, 1, 0), angle = { min: 0, max: Math.PI }, magnitude = { min: -1, max: 1 }) {
11
20
  super();
12
21
  /** @internal */
13
22
  this.requiredProperties = { builtin: "Matrix4" };
14
23
  this._private_directionInternal = direction.clone().normalize();
15
24
  this._private_angleInternal = resolveFXRangeConfig(angle);
16
25
  this._private_magnitudeInternal = resolveFXRangeConfig(magnitude);
17
- assertValidNumber(this._private_angleInternal.min, "FXSpawnRandomVelocity.constructor.angle.min");
18
- assertValidNumber(this._private_angleInternal.max, "FXSpawnRandomVelocity.constructor.angle.max");
19
- assertValidNumber(this._private_magnitudeInternal.min, "FXSpawnRandomVelocity.constructor.magnitude.min");
20
- assertValidNumber(this._private_magnitudeInternal.max, "FXSpawnRandomVelocity.constructor.magnitude.max");
26
+ assertValidNumber(this._private_angleInternal.min, "FXSpawnVelocity.constructor.angle.min");
27
+ assertValidNumber(this._private_angleInternal.max, "FXSpawnVelocity.constructor.angle.max");
28
+ assertValidNumber(this._private_magnitudeInternal.min, "FXSpawnVelocity.constructor.magnitude.min");
29
+ assertValidNumber(this._private_magnitudeInternal.max, "FXSpawnVelocity.constructor.magnitude.max");
21
30
  }
31
+ /** Cone half-angle range in radians */
22
32
  get angle() {
23
33
  return this._private_angleInternal;
24
34
  }
35
+ /** Speed range in units/second */
25
36
  get magnitude() {
26
37
  return this._private_magnitudeInternal;
27
38
  }
39
+ /** Cone axis (always normalized) */
28
40
  get direction() {
29
41
  return this._private_directionInternal;
30
42
  }
43
+ /** Cone half-angle range in radians */
31
44
  set angle(value) {
32
45
  this._private_angleInternal = resolveFXRangeConfig(value);
33
- assertValidNumber(this._private_angleInternal.min, "FXSpawnRandomVelocity.angle.min");
34
- assertValidNumber(this._private_angleInternal.max, "FXSpawnRandomVelocity.angle.max");
46
+ assertValidNumber(this._private_angleInternal.min, "FXSpawnVelocity.angle.min");
47
+ assertValidNumber(this._private_angleInternal.max, "FXSpawnVelocity.angle.max");
35
48
  }
49
+ /** Speed range in units/second */
36
50
  set magnitude(value) {
37
51
  this._private_magnitudeInternal = resolveFXRangeConfig(value);
38
- assertValidNumber(this._private_magnitudeInternal.min, "FXSpawnRandomVelocity.magnitude.min");
39
- assertValidNumber(this._private_magnitudeInternal.max, "FXSpawnRandomVelocity.magnitude.max");
52
+ assertValidNumber(this._private_magnitudeInternal.min, "FXSpawnVelocity.magnitude.min");
53
+ assertValidNumber(this._private_magnitudeInternal.max, "FXSpawnVelocity.magnitude.max");
40
54
  }
55
+ /** Cone axis - normalized on assignment */
41
56
  set direction(value) {
42
57
  this._private_directionInternal.copy(value).normalize();
43
58
  }
@@ -76,4 +91,4 @@ class FXSpawnRandomVelocity extends FXSpawn {
76
91
  }
77
92
  }
78
93
 
79
- export { FXSpawnRandomVelocity };
94
+ export { FXSpawnVelocity };
package/dist/index.d.ts CHANGED
@@ -1,30 +1,37 @@
1
- export { FXBehaviorDirectionalGravity } from "./emitter/behavior/FXBehaviorDirectionalGravity";
2
- export { FXBehaviorPointGravity } from "./emitter/behavior/FXBehaviorPointGravity";
1
+ export { FXBehaviorDirectionalForce } from "./emitter/behavior/FXBehaviorDirectionalForce";
2
+ export { FXBehaviorPointForce } from "./emitter/behavior/FXBehaviorPointForce";
3
3
  export { FXBehaviorScaleOverLife } from "./emitter/behavior/FXBehaviorScaleOverLife";
4
4
  export { FXBehaviorTorqueDamping } from "./emitter/behavior/FXBehaviorTorqueDamping";
5
5
  export { FXBehaviorTorqueNoise } from "./emitter/behavior/FXBehaviorTorqueNoise";
6
+ export { FXBehaviorTorqueOverLife } from "./emitter/behavior/FXBehaviorTorqueOverLife";
6
7
  export { FXBehaviorVelocityDamping } from "./emitter/behavior/FXBehaviorVelocityDamping";
7
8
  export { FXBehaviorVelocityNoise } from "./emitter/behavior/FXBehaviorVelocityNoise";
9
+ export { FXBehaviorVelocityOverLife } from "./emitter/behavior/FXBehaviorVelocityOverLife";
8
10
  export { FXEmitter } from "./emitter/FXEmitter";
9
11
  export { FXSpawnBox } from "./emitter/spawn/FXSpawnBox";
12
+ export { FXSpawnLifetime } from "./emitter/spawn/FXSpawnLifetime";
10
13
  export { FXSpawnOffset } from "./emitter/spawn/FXSpawnOffset";
11
14
  export { FXSpawnPoint } from "./emitter/spawn/FXSpawnPoint";
12
- export { FXSpawnRandomLifetime } from "./emitter/spawn/FXSpawnRandomLifetime";
13
- export { FXSpawnRandomRotation } from "./emitter/spawn/FXSpawnRandomRotation";
14
- export { FXSpawnRandomScale } from "./emitter/spawn/FXSpawnRandomScale";
15
- export { FXSpawnRandomTorque } from "./emitter/spawn/FXSpawnRandomTorque";
16
- export { FXSpawnRandomVelocity } from "./emitter/spawn/FXSpawnRandomVelocity";
15
+ export { FXSpawnRotation } from "./emitter/spawn/FXSpawnRotation";
16
+ export { FXSpawnScale } from "./emitter/spawn/FXSpawnScale";
17
17
  export { FXSpawnSphere } from "./emitter/spawn/FXSpawnSphere";
18
+ export { FXSpawnTorque } from "./emitter/spawn/FXSpawnTorque";
19
+ export { FXSpawnVelocity } from "./emitter/spawn/FXSpawnVelocity";
18
20
  export { FXDiffuseMaterial } from "./materials/FXDiffuseMaterial/FXDiffuseMaterial";
19
21
  export { FXMaterial } from "./materials/FXMaterial/FXMaterial";
20
22
  export { FXUnlitMaterial } from "./materials/FXUnlitMaterial/FXUnlitMaterial";
21
23
  export { FXColor } from "./miscellaneous/color/FXColor";
22
- export { FXColorNode } from "./nodes/color/FXColorNode";
23
- export { FXColorOverLifeNode } from "./nodes/color/FXColorOverLifeNode";
24
- export { FXSphericalClipNode } from "./nodes/color/FXSphericalClipNode";
25
- export { FXFlatNormalNode } from "./nodes/normal/FXFlatNormalNode";
26
- export { FXNormalNode } from "./nodes/normal/FXNormalNode";
27
- export { FXSphericalNormalNode } from "./nodes/normal/FXSphericalNormalNode";
28
- export { FXAnimatedTextureNode } from "./nodes/texture/FXAnimatedTextureNode";
29
- export { FXStaticTextureNode } from "./nodes/texture/FXStaticTextureNode";
30
- export { FXTextureNode } from "./nodes/texture/FXTextureNode";
24
+ export { FXCurve1D } from "./miscellaneous/curve/FXCurve1D";
25
+ export type { FXCurve1DAnchor, FXCurve1DConfig, FXCurve1DPoint, } from "./miscellaneous/curve/FXCurve1D";
26
+ export { FXTextureView } from "./miscellaneous/texture/FXTextureView";
27
+ export type { FXTextureAtlasConfig, FXTextureConfig, FXTextureRect, FXTextureSize, FXTextureTrim, } from "./miscellaneous/texture/FXTextureView.Internal";
28
+ export { FXNodeColor } from "./nodes/color/FXNodeColor";
29
+ export { FXNodeColorOverLife } from "./nodes/color/FXNodeColorOverLife";
30
+ export { FXNodeSphericalClip } from "./nodes/color/FXNodeSphericalClip";
31
+ export { FXNodeFlatNormal } from "./nodes/normal/FXNodeFlatNormal";
32
+ export { FXNodeNormal } from "./nodes/normal/FXNodeNormal";
33
+ export { FXNodeSphericalNormal } from "./nodes/normal/FXNodeSphericalNormal";
34
+ export { FXNodeAnimatedTexture } from "./nodes/texture/FXNodeAnimatedTexture";
35
+ export type { FXNodeAnimatedTextureOptions } from "./nodes/texture/FXNodeAnimatedTexture";
36
+ export { FXNodeStaticTexture } from "./nodes/texture/FXNodeStaticTexture";
37
+ export { FXNodeTexture } from "./nodes/texture/FXNodeTexture";
package/dist/index.js CHANGED
@@ -1,30 +1,34 @@
1
- export { FXBehaviorDirectionalGravity } from './emitter/behavior/FXBehaviorDirectionalGravity.js';
2
- export { FXBehaviorPointGravity } from './emitter/behavior/FXBehaviorPointGravity.js';
1
+ export { FXBehaviorDirectionalForce } from './emitter/behavior/FXBehaviorDirectionalForce.js';
2
+ export { FXBehaviorPointForce } from './emitter/behavior/FXBehaviorPointForce.js';
3
3
  export { FXBehaviorScaleOverLife } from './emitter/behavior/FXBehaviorScaleOverLife.js';
4
4
  export { FXBehaviorTorqueDamping } from './emitter/behavior/FXBehaviorTorqueDamping.js';
5
5
  export { FXBehaviorTorqueNoise } from './emitter/behavior/FXBehaviorTorqueNoise.js';
6
+ export { FXBehaviorTorqueOverLife } from './emitter/behavior/FXBehaviorTorqueOverLife.js';
6
7
  export { FXBehaviorVelocityDamping } from './emitter/behavior/FXBehaviorVelocityDamping.js';
7
8
  export { FXBehaviorVelocityNoise } from './emitter/behavior/FXBehaviorVelocityNoise.js';
9
+ export { FXBehaviorVelocityOverLife } from './emitter/behavior/FXBehaviorVelocityOverLife.js';
8
10
  export { FXEmitter } from './emitter/FXEmitter.js';
9
11
  export { FXSpawnBox } from './emitter/spawn/FXSpawnBox.js';
12
+ export { FXSpawnLifetime } from './emitter/spawn/FXSpawnLifetime.js';
10
13
  export { FXSpawnOffset } from './emitter/spawn/FXSpawnOffset.js';
11
14
  export { FXSpawnPoint } from './emitter/spawn/FXSpawnPoint.js';
12
- export { FXSpawnRandomLifetime } from './emitter/spawn/FXSpawnRandomLifetime.js';
13
- export { FXSpawnRandomRotation } from './emitter/spawn/FXSpawnRandomRotation.js';
14
- export { FXSpawnRandomScale } from './emitter/spawn/FXSpawnRandomScale.js';
15
- export { FXSpawnRandomTorque } from './emitter/spawn/FXSpawnRandomTorque.js';
16
- export { FXSpawnRandomVelocity } from './emitter/spawn/FXSpawnRandomVelocity.js';
15
+ export { FXSpawnRotation } from './emitter/spawn/FXSpawnRotation.js';
16
+ export { FXSpawnScale } from './emitter/spawn/FXSpawnScale.js';
17
17
  export { FXSpawnSphere } from './emitter/spawn/FXSpawnSphere.js';
18
+ export { FXSpawnTorque } from './emitter/spawn/FXSpawnTorque.js';
19
+ export { FXSpawnVelocity } from './emitter/spawn/FXSpawnVelocity.js';
18
20
  export { FXDiffuseMaterial } from './materials/FXDiffuseMaterial/FXDiffuseMaterial.js';
19
21
  export { FXMaterial } from './materials/FXMaterial/FXMaterial.js';
20
22
  export { FXUnlitMaterial } from './materials/FXUnlitMaterial/FXUnlitMaterial.js';
21
23
  export { FXColor } from './miscellaneous/color/FXColor.js';
22
- export { FXColorNode } from './nodes/color/FXColorNode.js';
23
- export { FXColorOverLifeNode } from './nodes/color/FXColorOverLifeNode.js';
24
- export { FXSphericalClipNode } from './nodes/color/FXSphericalClipNode.js';
25
- export { FXFlatNormalNode } from './nodes/normal/FXFlatNormalNode.js';
26
- export { FXNormalNode } from './nodes/normal/FXNormalNode.js';
27
- export { FXSphericalNormalNode } from './nodes/normal/FXSphericalNormalNode.js';
28
- export { FXAnimatedTextureNode } from './nodes/texture/FXAnimatedTextureNode.js';
29
- export { FXStaticTextureNode } from './nodes/texture/FXStaticTextureNode.js';
30
- export { FXTextureNode } from './nodes/texture/FXTextureNode.js';
24
+ export { FXCurve1D } from './miscellaneous/curve/FXCurve1D.js';
25
+ export { FXTextureView } from './miscellaneous/texture/FXTextureView.js';
26
+ export { FXNodeColor } from './nodes/color/FXNodeColor.js';
27
+ export { FXNodeColorOverLife } from './nodes/color/FXNodeColorOverLife.js';
28
+ export { FXNodeSphericalClip } from './nodes/color/FXNodeSphericalClip.js';
29
+ export { FXNodeFlatNormal } from './nodes/normal/FXNodeFlatNormal.js';
30
+ export { FXNodeNormal } from './nodes/normal/FXNodeNormal.js';
31
+ export { FXNodeSphericalNormal } from './nodes/normal/FXNodeSphericalNormal.js';
32
+ export { FXNodeAnimatedTexture } from './nodes/texture/FXNodeAnimatedTexture.js';
33
+ export { FXNodeStaticTexture } from './nodes/texture/FXNodeStaticTexture.js';
34
+ export { FXNodeTexture } from './nodes/texture/FXNodeTexture.js';
@@ -1,9 +1,9 @@
1
1
  import type { Blending } from "three";
2
2
  import { Color, MeshLambertMaterial } from "three";
3
3
  import type { GLTypeInfo } from "../../instancedParticle/shared";
4
- import type { FXColorNode } from "../../nodes/color/FXColorNode";
5
- import type { FXNormalNode } from "../../nodes/normal/FXNormalNode";
6
- import { FXTextureNode } from "../../nodes/texture/FXTextureNode";
4
+ import type { FXNodeColor } from "../../nodes/color/FXNodeColor";
5
+ import type { FXNodeNormal } from "../../nodes/normal/FXNodeNormal";
6
+ import { FXNodeTexture } from "../../nodes/texture/FXNodeTexture";
7
7
  export interface FXScatterUniforms {
8
8
  u_ScatterTint: {
9
9
  value: Color;
@@ -18,6 +18,6 @@ export interface FXScatterUniforms {
18
18
  value: number;
19
19
  };
20
20
  }
21
- export declare function buildFXDiffuseMaterial(varyings: Record<string, GLTypeInfo>, blending: Blending, useAlphaHashing: boolean, alphaTest: number, premultipliedAlpha: boolean, albedoNodes: readonly (FXColorNode | FXTextureNode)[], normalNodes: readonly (FXTextureNode | FXNormalNode)[], emissionNodes: readonly (FXColorNode | FXTextureNode)[], scatterUniforms?: FXScatterUniforms, shadowSensitivity?: {
21
+ export declare function buildFXDiffuseMaterial(varyings: Record<string, GLTypeInfo>, blending: Blending, useAlphaHashing: boolean, alphaTest: number, premultipliedAlpha: boolean, albedoNodes: readonly (FXNodeColor | FXNodeTexture)[], normalNodes: readonly (FXNodeTexture | FXNodeNormal)[], emissionNodes: readonly (FXNodeColor | FXNodeTexture)[], scatterUniforms?: FXScatterUniforms, shadowSensitivity?: {
22
22
  value: number;
23
23
  }): MeshLambertMaterial;
@@ -1,6 +1,6 @@
1
1
  import { MeshLambertMaterial, Color, DoubleSide } from 'three';
2
2
  import { PARTICLE_DEFINES } from '../../miscellaneous/miscellaneous.js';
3
- import { FXTextureNode } from '../../nodes/texture/FXTextureNode.js';
3
+ import { FXNodeTexture } from '../../nodes/texture/FXNodeTexture.js';
4
4
 
5
5
  /**
6
6
  * Wraps every `getShadow(...)` call in the shader source with
@@ -191,7 +191,7 @@ function buildFXDiffuseMaterial(varyings, blending, useAlphaHashing, alphaTest,
191
191
  let fragmentShader = shader.fragmentShader;
192
192
  if (useNormals) {
193
193
  const normalExpressions = normalNodes.map((node) => {
194
- if (node instanceof FXTextureNode) {
194
+ if (node instanceof FXNodeTexture) {
195
195
  return `normalize(${node.colorExpression}.rgb * 2.0 - 1.0)`;
196
196
  }
197
197
  return node.normalExpression;
@@ -1,24 +1,74 @@
1
1
  import type { ColorRepresentation } from "three";
2
- import type { FXColorNode } from "../../nodes/color/FXColorNode";
3
- import type { FXNormalNode } from "../../nodes/normal/FXNormalNode";
4
- import type { FXTextureNode } from "../../nodes/texture/FXTextureNode";
2
+ import type { FXNodeColor } from "../../nodes/color/FXNodeColor";
3
+ import type { FXNodeNormal } from "../../nodes/normal/FXNodeNormal";
4
+ import type { FXNodeTexture } from "../../nodes/texture/FXNodeTexture";
5
5
  import type { FXMaterialOptions } from "../FXMaterial/FXMaterial";
6
6
  import { FXMaterial } from "../FXMaterial/FXMaterial";
7
+ /**
8
+ * Configuration options for {@link FXDiffuseMaterial}
9
+ */
7
10
  export interface FXDiffuseMaterialOptions extends FXMaterialOptions {
8
- normalNodes: (FXTextureNode | FXNormalNode)[];
9
- emissionNodes: (FXColorNode | FXTextureNode)[];
11
+ /**
12
+ * Normal nodes for lighting; multiple nodes are blended together
13
+ *
14
+ * @defaultValue `[new FXNodeSphericalNormal()]`
15
+ */
16
+ normalNodes: (FXNodeTexture | FXNodeNormal)[];
17
+ /**
18
+ * Emission color nodes composited for emissive output
19
+ *
20
+ * @defaultValue `[]`
21
+ */
22
+ emissionNodes: (FXNodeColor | FXNodeTexture)[];
23
+ /**
24
+ * Enable subsurface scattering approximation
25
+ *
26
+ * @defaultValue `false`
27
+ */
10
28
  enableScatter: boolean;
29
+ /**
30
+ * Tint color applied to the scatter contribution
31
+ *
32
+ * @defaultValue `0xffd999`
33
+ */
11
34
  scatterTint: ColorRepresentation;
35
+ /**
36
+ * Scatter lobe sharpness; higher values produce a tighter highlight
37
+ *
38
+ * @defaultValue `10`
39
+ */
12
40
  scatterPower: number;
41
+ /**
42
+ * Forward scatter intensity (light-facing side)
43
+ *
44
+ * @defaultValue `1`
45
+ */
13
46
  forwardScatterStrength: number;
47
+ /**
48
+ * Back scatter intensity (back-lit side)
49
+ *
50
+ * @defaultValue `1`
51
+ */
14
52
  backScatterStrength: number;
53
+ /**
54
+ * Shadow influence (`0` = no shadows, `1` = full shadows)
55
+ *
56
+ * @defaultValue `1`
57
+ */
15
58
  shadowSensitivity: number;
16
59
  }
60
+ /**
61
+ * Diffuse particle material with lighting, normals, emission, and optional subsurface scattering
62
+ */
17
63
  export declare class FXDiffuseMaterial extends FXMaterial {
18
64
  private readonly normalNodes;
19
65
  private readonly emissionNodes;
20
66
  private readonly scatterUniforms;
21
67
  private readonly shadowSensitivity;
68
+ /**
69
+ * @param options - Material configuration
70
+ */
22
71
  constructor(options?: Partial<FXDiffuseMaterialOptions>);
72
+ /** Releases resources held by all albedo, normal, and emission nodes */
23
73
  destroy(): void;
24
74
  }