sparcoon 0.1.0 → 0.3.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 (109) hide show
  1. package/dist/{elements → emitter}/FXEmitter.Internal.d.ts +4 -4
  2. package/dist/emitter/FXEmitter.Internal.js +26 -0
  3. package/dist/emitter/FXEmitter.d.ts +31 -0
  4. package/dist/{elements → emitter}/FXEmitter.js +14 -22
  5. package/dist/{behaviorModules/FXBehaviorModule.d.ts → emitter/behavior/FXBehavior.d.ts} +2 -2
  6. package/dist/{behaviorModules/FXBehaviorModule.js → emitter/behavior/FXBehavior.js} +2 -2
  7. package/dist/{behaviorModules → emitter/behavior}/FXBehaviorDirectionalGravity.d.ts +4 -4
  8. package/dist/{behaviorModules → emitter/behavior}/FXBehaviorDirectionalGravity.js +4 -4
  9. package/dist/{behaviorModules → emitter/behavior}/FXBehaviorPointGravity.d.ts +4 -4
  10. package/dist/{behaviorModules → emitter/behavior}/FXBehaviorPointGravity.js +4 -4
  11. package/dist/{behaviorModules → emitter/behavior}/FXBehaviorScaleOverLife.d.ts +3 -3
  12. package/dist/{behaviorModules → emitter/behavior}/FXBehaviorScaleOverLife.js +4 -4
  13. package/dist/{behaviorModules → emitter/behavior}/FXBehaviorTorqueDamping.d.ts +3 -3
  14. package/dist/{behaviorModules → emitter/behavior}/FXBehaviorTorqueDamping.js +4 -4
  15. package/dist/{behaviorModules → emitter/behavior}/FXBehaviorTorqueNoise.d.ts +3 -3
  16. package/dist/{behaviorModules → emitter/behavior}/FXBehaviorTorqueNoise.js +5 -5
  17. package/dist/{behaviorModules → emitter/behavior}/FXBehaviorVelocityDamping.d.ts +3 -3
  18. package/dist/{behaviorModules → emitter/behavior}/FXBehaviorVelocityDamping.js +4 -4
  19. package/dist/{behaviorModules → emitter/behavior}/FXBehaviorVelocityNoise.d.ts +3 -3
  20. package/dist/{behaviorModules → emitter/behavior}/FXBehaviorVelocityNoise.js +5 -5
  21. package/dist/emitter/spawn/FXSpawn.d.ts +9 -0
  22. package/dist/{spawnModules/FXSpawnModule.js → emitter/spawn/FXSpawn.js} +2 -2
  23. package/dist/{spawnModules → emitter/spawn}/FXSpawnBox.d.ts +4 -4
  24. package/dist/{spawnModules → emitter/spawn}/FXSpawnBox.js +4 -4
  25. package/dist/{spawnModules/FXSpawnOffset.d.ts → emitter/spawn/FXSpawnPoint.d.ts} +4 -4
  26. package/dist/{spawnModules/FXSpawnOffset.js → emitter/spawn/FXSpawnPoint.js} +5 -5
  27. package/dist/{spawnModules → emitter/spawn}/FXSpawnRandomLifetime.d.ts +3 -3
  28. package/dist/{spawnModules → emitter/spawn}/FXSpawnRandomLifetime.js +4 -4
  29. package/dist/{spawnModules → emitter/spawn}/FXSpawnRandomRotation.d.ts +3 -3
  30. package/dist/{spawnModules → emitter/spawn}/FXSpawnRandomRotation.js +4 -4
  31. package/dist/{spawnModules → emitter/spawn}/FXSpawnRandomScale.d.ts +3 -3
  32. package/dist/{spawnModules → emitter/spawn}/FXSpawnRandomScale.js +4 -4
  33. package/dist/{spawnModules → emitter/spawn}/FXSpawnRandomTorque.d.ts +3 -3
  34. package/dist/{spawnModules → emitter/spawn}/FXSpawnRandomTorque.js +4 -4
  35. package/dist/{spawnModules → emitter/spawn}/FXSpawnRandomVelocity.d.ts +3 -3
  36. package/dist/{spawnModules → emitter/spawn}/FXSpawnRandomVelocity.js +4 -4
  37. package/dist/emitter/spawn/FXSpawnSphere.d.ts +38 -0
  38. package/dist/emitter/spawn/FXSpawnSphere.js +89 -0
  39. package/dist/index.d.ts +28 -20
  40. package/dist/index.js +28 -22
  41. package/dist/instancedParticle/FXInstancedParticle.Internal.d.ts +1 -12
  42. package/dist/instancedParticle/FXInstancedParticle.Internal.js +2 -206
  43. package/dist/instancedParticle/FXInstancedParticle.d.ts +3 -5
  44. package/dist/instancedParticle/FXInstancedParticle.js +4 -10
  45. package/dist/instancedParticle/shared.d.ts +1 -1
  46. package/dist/instancedParticle/shared.js +1 -1
  47. package/dist/materials/FXDiffuseMaterial/FXDiffuseMaterial.Internal.d.ts +7 -0
  48. package/dist/materials/FXDiffuseMaterial/FXDiffuseMaterial.Internal.js +141 -0
  49. package/dist/materials/FXDiffuseMaterial/FXDiffuseMaterial.d.ts +15 -0
  50. package/dist/materials/FXDiffuseMaterial/FXDiffuseMaterial.js +26 -0
  51. package/dist/materials/FXMaterial/FXMaterial.Internal.d.ts +5 -0
  52. package/dist/materials/FXMaterial/FXMaterial.Internal.js +106 -0
  53. package/dist/materials/FXMaterial/FXMaterial.d.ts +19 -0
  54. package/dist/materials/FXMaterial/FXMaterial.js +25 -0
  55. package/dist/materials/FXUnlitMaterial/FXUnlitMaterial.Internal.d.ts +6 -0
  56. package/dist/materials/FXUnlitMaterial/FXUnlitMaterial.Internal.js +84 -0
  57. package/dist/materials/FXUnlitMaterial/FXUnlitMaterial.d.ts +6 -0
  58. package/dist/materials/FXUnlitMaterial/FXUnlitMaterial.js +14 -0
  59. package/dist/{color → miscellaneous/color}/FXColor.js +2 -2
  60. package/dist/miscellaneous/miscellaneous.d.ts +2 -1
  61. package/dist/miscellaneous/miscellaneous.js +24 -1
  62. package/dist/nodes/color/FXColorNode.d.ts +3 -0
  63. package/dist/nodes/color/FXColorNode.js +8 -0
  64. package/dist/nodes/color/FXColorOverLifeNode.d.ts +6 -0
  65. package/dist/nodes/color/FXColorOverLifeNode.js +38 -0
  66. package/dist/nodes/normal/FXFlatNormalNode.d.ts +4 -0
  67. package/dist/nodes/normal/FXFlatNormalNode.js +14 -0
  68. package/dist/nodes/normal/FXNormalNode.d.ts +3 -0
  69. package/dist/nodes/normal/FXNormalNode.js +4 -0
  70. package/dist/nodes/normal/FXSphericalNormalNode.d.ts +4 -0
  71. package/dist/nodes/normal/FXSphericalNormalNode.js +19 -0
  72. package/dist/nodes/texture/FXAnimatedTextureNode.d.ts +11 -0
  73. package/dist/nodes/texture/FXAnimatedTextureNode.js +80 -0
  74. package/dist/nodes/texture/FXStaticTextureNode.d.ts +5 -0
  75. package/dist/nodes/texture/FXStaticTextureNode.js +26 -0
  76. package/dist/nodes/texture/FXTextureNode.d.ts +3 -0
  77. package/dist/nodes/texture/FXTextureNode.js +8 -0
  78. package/package.json +1 -1
  79. package/dist/elements/FXEmitter.Internal.js +0 -12
  80. package/dist/elements/FXEmitter.d.ts +0 -38
  81. package/dist/instancedParticle/FXParticleDepthMaterial.d.ts +0 -2
  82. package/dist/instancedParticle/FXParticleDepthMaterial.js +0 -52
  83. package/dist/instancedParticle/FXParticleLambertMaterial.d.ts +0 -4
  84. package/dist/instancedParticle/FXParticleLambertMaterial.js +0 -152
  85. package/dist/instancedParticle/FXParticleNormalsMode.d.ts +0 -5
  86. package/dist/instancedParticle/FXParticleNormalsMode.js +0 -8
  87. package/dist/instancedParticle/FXParticleRenderingMode.d.ts +0 -4
  88. package/dist/instancedParticle/FXParticleRenderingMode.js +0 -7
  89. package/dist/miscellaneous/texture/FXTextureView.Internal.js +0 -6
  90. package/dist/miscellaneous/texture/FXTextureView.js +0 -234
  91. package/dist/renderingModules/FXRenderingAnimatedTexture.d.ts +0 -5
  92. package/dist/renderingModules/FXRenderingAnimatedTexture.js +0 -14
  93. package/dist/renderingModules/FXRenderingColorOverLife.d.ts +0 -14
  94. package/dist/renderingModules/FXRenderingColorOverLife.js +0 -32
  95. package/dist/renderingModules/FXRenderingColorOverVelocity.d.ts +0 -15
  96. package/dist/renderingModules/FXRenderingColorOverVelocity.js +0 -37
  97. package/dist/renderingModules/FXRenderingModule.d.ts +0 -8
  98. package/dist/renderingModules/FXRenderingModule.js +0 -9
  99. package/dist/renderingModules/FXRenderingShadow.d.ts +0 -12
  100. package/dist/renderingModules/FXRenderingTexture.d.ts +0 -14
  101. package/dist/renderingModules/FXRenderingTexture.js +0 -26
  102. package/dist/shaders/FXRenderingAnimatedTexture.glsl.js +0 -3
  103. package/dist/shaders/FXRenderingColorOverLife.glsl.js +0 -3
  104. package/dist/shaders/FXRenderingColorOverVelocity.glsl.js +0 -3
  105. package/dist/shaders/FXRenderingTexture.glsl.js +0 -3
  106. package/dist/spawnModules/FXSpawnModule.d.ts +0 -9
  107. /package/dist/{color → miscellaneous/color}/FXColor.Internal.d.ts +0 -0
  108. /package/dist/{color → miscellaneous/color}/FXColor.Internal.js +0 -0
  109. /package/dist/{color → miscellaneous/color}/FXColor.d.ts +0 -0
@@ -1,5 +1,4 @@
1
- import { FXParticleNormalsMode } from "../instancedParticle/FXParticleNormalsMode";
2
- import { FXParticleRenderingMode } from "../instancedParticle/FXParticleRenderingMode";
1
+ import type { FXPropertyName, GLTypeInfo } from "../instancedParticle/shared";
3
2
  export interface FXEmitterPlayOptions {
4
3
  duration: number;
5
4
  }
@@ -8,5 +7,6 @@ export declare const EMITTER_DEFAULT_CAPACITY_STEP = 32;
8
7
  export declare const EMITTER_DEFAULT_AUTOMATICALLY_DESTROY_MODULES = true;
9
8
  export declare const EMITTER_DEFAULT_CAST_SHADOW = false;
10
9
  export declare const EMITTER_DEFAULT_RECEIVE_SHADOW = false;
11
- export declare const EMITTER_DEFAULT_RENDERING_MODE = FXParticleRenderingMode.Unlit;
12
- export declare const EMITTER_DEFAULT_NORMALS_MODE = FXParticleNormalsMode.Flat;
10
+ export declare function collectProperties(keeper: Record<string, GLTypeInfo>, modules: readonly {
11
+ requiredProperties?: Record<string, FXPropertyName>;
12
+ }[], debugContext: string): void;
@@ -0,0 +1,26 @@
1
+ import { resolveGLSLTypeInfo } from '../instancedParticle/shared.js';
2
+
3
+ const EMITTER_DEFAULT_EXPECTED_CAPACITY = 32;
4
+ const EMITTER_DEFAULT_CAPACITY_STEP = 32;
5
+ const EMITTER_DEFAULT_AUTOMATICALLY_DESTROY_MODULES = true;
6
+ const EMITTER_DEFAULT_CAST_SHADOW = false;
7
+ const EMITTER_DEFAULT_RECEIVE_SHADOW = false;
8
+ function collectProperties(keeper, modules, debugContext) {
9
+ for (const module of modules) {
10
+ if (module.requiredProperties === undefined) {
11
+ continue;
12
+ }
13
+ for (const key in module.requiredProperties) {
14
+ const existingTypeInfo = keeper[key];
15
+ const newTypeInfo = resolveGLSLTypeInfo(module.requiredProperties[key]);
16
+ if (existingTypeInfo === undefined) {
17
+ keeper[key] = newTypeInfo;
18
+ }
19
+ else if (existingTypeInfo.glslTypeName !== newTypeInfo.glslTypeName) {
20
+ throw new Error(`${debugContext}: property conflict for "${key}"`);
21
+ }
22
+ }
23
+ }
24
+ }
25
+
26
+ export { EMITTER_DEFAULT_AUTOMATICALLY_DESTROY_MODULES, EMITTER_DEFAULT_CAPACITY_STEP, EMITTER_DEFAULT_CAST_SHADOW, EMITTER_DEFAULT_EXPECTED_CAPACITY, EMITTER_DEFAULT_RECEIVE_SHADOW, collectProperties };
@@ -0,0 +1,31 @@
1
+ import { Object3D } from "three";
2
+ import type { FXMaterial } from "../materials/FXMaterial/FXMaterial";
3
+ import type { FXBehavior } from "./behavior/FXBehavior";
4
+ import type { FXEmitterPlayOptions } from "./FXEmitter.Internal";
5
+ import type { FXSpawn } from "./spawn/FXSpawn";
6
+ export interface FXEmitterOptions {
7
+ expectedCapacity: number;
8
+ capacityStep: number;
9
+ automaticallyDestroyModules: boolean;
10
+ castShadow: boolean;
11
+ receiveShadow: boolean;
12
+ }
13
+ export declare class FXEmitter extends Object3D {
14
+ private readonly spawnSequence;
15
+ private readonly behaviorSequence;
16
+ automaticallyDestroyModules: boolean;
17
+ private readonly mesh;
18
+ private readonly material;
19
+ private emissionRate;
20
+ private emissionAccumulator;
21
+ private emissionDuration;
22
+ private emissionElapsed;
23
+ constructor(spawnSequence: FXSpawn[], behaviorSequence: readonly FXBehavior[], material: FXMaterial, options?: Partial<FXEmitterOptions>);
24
+ static onWillRender: (deltaTime: number) => void;
25
+ destroy(): void;
26
+ burst(count: number): void;
27
+ reset(): void;
28
+ play(rate: number, options?: Partial<FXEmitterPlayOptions>): void;
29
+ stop(): void;
30
+ private readonly onRendering;
31
+ }
@@ -1,20 +1,15 @@
1
- import { Object3D, NormalBlending } from 'three';
1
+ import { Object3D } from 'three';
2
2
  import { FXInstancedParticle } from '../instancedParticle/FXInstancedParticle.js';
3
- import { collectProperties, collectUniforms } from '../instancedParticle/FXInstancedParticle.Internal.js';
4
- import { buildParticleDepthMaterial } from '../instancedParticle/FXParticleDepthMaterial.js';
5
- export { FXParticleNormalsMode } from '../instancedParticle/FXParticleNormalsMode.js';
6
- export { FXParticleRenderingMode } from '../instancedParticle/FXParticleRenderingMode.js';
7
3
  import { resolveGLSLTypeInfo } from '../instancedParticle/shared.js';
8
4
  import { BUILTIN_OFFSET_AGE, BUILTIN_OFFSET_POSITION_X, BUILTIN_OFFSET_VELOCITY_X, BUILTIN_OFFSET_POSITION_Y, BUILTIN_OFFSET_VELOCITY_Y, BUILTIN_OFFSET_POSITION_Z, BUILTIN_OFFSET_VELOCITY_Z, BUILTIN_OFFSET_ROTATION, BUILTIN_OFFSET_TORQUE, BUILTIN_OFFSET_RANDOM_A, BUILTIN_OFFSET_RANDOM_B, BUILTIN_OFFSET_RANDOM_C } from '../miscellaneous/miscellaneous.js';
9
- import { EMITTER_DEFAULT_EXPECTED_CAPACITY, EMITTER_DEFAULT_CAPACITY_STEP, EMITTER_DEFAULT_RENDERING_MODE, EMITTER_DEFAULT_NORMALS_MODE, EMITTER_DEFAULT_CAST_SHADOW, EMITTER_DEFAULT_RECEIVE_SHADOW, EMITTER_DEFAULT_AUTOMATICALLY_DESTROY_MODULES } from './FXEmitter.Internal.js';
5
+ import { collectProperties, EMITTER_DEFAULT_EXPECTED_CAPACITY, EMITTER_DEFAULT_CAPACITY_STEP, EMITTER_DEFAULT_CAST_SHADOW, EMITTER_DEFAULT_RECEIVE_SHADOW, EMITTER_DEFAULT_AUTOMATICALLY_DESTROY_MODULES } from './FXEmitter.Internal.js';
10
6
 
11
- const INSTANCES = new Array();
7
+ const EMITTERS = new Array();
12
8
  class FXEmitter extends Object3D {
13
- constructor(_private_spawnSequence, _private_behaviorSequence, _private_renderingSequence, options = {}) {
9
+ constructor(_private_spawnSequence, _private_behaviorSequence, material, options = {}) {
14
10
  super();
15
11
  this._private_spawnSequence = _private_spawnSequence;
16
12
  this._private_behaviorSequence = _private_behaviorSequence;
17
- this._private_renderingSequence = _private_renderingSequence;
18
13
  this._private_emissionRate = 0;
19
14
  this._private_emissionAccumulator = 0;
20
15
  this._private_emissionDuration = Infinity;
@@ -78,28 +73,27 @@ class FXEmitter extends Object3D {
78
73
  const collectedProperties = {
79
74
  builtin: resolveGLSLTypeInfo("Matrix4"),
80
75
  };
81
- collectProperties(collectedProperties, _private_spawnSequence, "FXEmitter.constructor.spawnSequence:");
76
+ collectProperties(collectedProperties, _private_spawnSequence, "FXEmitter.constructor.spawnSequence");
82
77
  collectProperties(collectedProperties, _private_behaviorSequence, "FXEmitter.constructor.behaviorSequence");
83
- collectProperties(collectedProperties, _private_renderingSequence, "FXEmitter.constructor.renderingSequence");
84
- const collectedUniforms = {};
85
- collectUniforms(collectedUniforms, _private_renderingSequence, "FXEmitter.constructor.renderingSequence");
86
- this._private_mesh = new FXInstancedParticle(_private_renderingSequence.map((module) => module.source), collectedUniforms, collectedProperties, options.expectedCapacity ?? EMITTER_DEFAULT_EXPECTED_CAPACITY, options.capacityStep ?? EMITTER_DEFAULT_CAPACITY_STEP, options.blending ?? NormalBlending, options.useAlphaHashing ?? false, options.renderingMode ?? EMITTER_DEFAULT_RENDERING_MODE, options.normalsMode ?? EMITTER_DEFAULT_NORMALS_MODE);
78
+ const threeMaterial = material.buildThreeMaterial(collectedProperties);
79
+ this._private_mesh = new FXInstancedParticle(collectedProperties, options.expectedCapacity ?? EMITTER_DEFAULT_EXPECTED_CAPACITY, options.capacityStep ?? EMITTER_DEFAULT_CAPACITY_STEP, threeMaterial);
87
80
  if (options.castShadow ?? EMITTER_DEFAULT_CAST_SHADOW) {
88
81
  this._private_mesh.castShadow = true;
89
- this._private_mesh.customDepthMaterial = buildParticleDepthMaterial();
82
+ this._private_mesh.customDepthMaterial = material.buildDepthMaterial();
90
83
  }
91
84
  if (options.receiveShadow ?? EMITTER_DEFAULT_RECEIVE_SHADOW) {
92
85
  this._private_mesh.receiveShadow = true;
93
86
  }
94
87
  this.automaticallyDestroyModules =
95
88
  options.automaticallyDestroyModules ?? EMITTER_DEFAULT_AUTOMATICALLY_DESTROY_MODULES;
89
+ this._private_material = material;
96
90
  this.add(this._private_mesh);
97
- INSTANCES.push(this);
91
+ EMITTERS.push(this);
98
92
  }
99
93
  destroy() {
100
- const index = INSTANCES.indexOf(this);
94
+ const index = EMITTERS.indexOf(this);
101
95
  if (index !== -1) {
102
- INSTANCES.splice(index, 1);
96
+ EMITTERS.splice(index, 1);
103
97
  }
104
98
  if (this.automaticallyDestroyModules) {
105
99
  for (const module of this._private_spawnSequence) {
@@ -108,9 +102,7 @@ class FXEmitter extends Object3D {
108
102
  for (const module of this._private_behaviorSequence) {
109
103
  module.destroy?.();
110
104
  }
111
- for (const module of this._private_renderingSequence) {
112
- module.destroy?.();
113
- }
105
+ this._private_material.destroy();
114
106
  }
115
107
  this.removeFromParent();
116
108
  }
@@ -150,7 +142,7 @@ class FXEmitter extends Object3D {
150
142
  }
151
143
  }
152
144
  FXEmitter.onWillRender = (deltaTime) => {
153
- for (const instance of INSTANCES) {
145
+ for (const instance of EMITTERS) {
154
146
  instance._private_onRendering(deltaTime);
155
147
  }
156
148
  };
@@ -1,11 +1,11 @@
1
1
  import type { InstancedBufferAttribute } from "three";
2
- import type { FXPropertyName } from "../instancedParticle/shared";
2
+ import type { FXPropertyName } from "../../instancedParticle/shared";
3
3
  /**
4
4
  * Base class for particle behavior modules.
5
5
  *
6
6
  * Behavior modules update particle properties each frame.
7
7
  */
8
- export declare abstract class FXBehaviorModule<T extends Record<string, FXPropertyName> = Record<string, FXPropertyName>> {
8
+ export declare abstract class FXBehavior<T extends Record<string, FXPropertyName> = Record<string, FXPropertyName>> {
9
9
  abstract readonly requiredProperties: T;
10
10
  abstract update(properties: {
11
11
  [K in keyof T]: InstancedBufferAttribute;
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Behavior modules update particle properties each frame.
5
5
  */
6
- class FXBehaviorModule {
6
+ class FXBehavior {
7
7
  }
8
8
 
9
- export { FXBehaviorModule };
9
+ export { FXBehavior };
@@ -1,12 +1,12 @@
1
- import type { Vector3Like } from "../miscellaneous/math";
2
- import { type FXVector3Config } from "../miscellaneous/miscellaneous";
3
- import { FXBehaviorModule } from "./FXBehaviorModule";
1
+ import type { Vector3Like } from "../../miscellaneous/math";
2
+ import type { FXVector3Config } from "../../miscellaneous/miscellaneous";
3
+ import { FXBehavior } from "./FXBehavior";
4
4
  /**
5
5
  * Applies constant acceleration to all particles.
6
6
  *
7
7
  * Adds the direction vector to particle velocity each frame.
8
8
  */
9
- export declare class FXBehaviorDirectionalGravity extends FXBehaviorModule<{
9
+ export declare class FXBehaviorDirectionalGravity extends FXBehavior<{
10
10
  builtin: "Matrix4";
11
11
  }> {
12
12
  private directionInternal;
@@ -1,13 +1,13 @@
1
- import { assertValidNumber } from '../miscellaneous/asserts.js';
2
- import { resolveFXVector3Config, BUILTIN_OFFSET_VELOCITY_X, BUILTIN_OFFSET_VELOCITY_Y, BUILTIN_OFFSET_VELOCITY_Z } from '../miscellaneous/miscellaneous.js';
3
- import { FXBehaviorModule } from './FXBehaviorModule.js';
1
+ import { assertValidNumber } from '../../miscellaneous/asserts.js';
2
+ import { resolveFXVector3Config, BUILTIN_OFFSET_VELOCITY_X, BUILTIN_OFFSET_VELOCITY_Y, BUILTIN_OFFSET_VELOCITY_Z } from '../../miscellaneous/miscellaneous.js';
3
+ import { FXBehavior } from './FXBehavior.js';
4
4
 
5
5
  /**
6
6
  * Applies constant acceleration to all particles.
7
7
  *
8
8
  * Adds the direction vector to particle velocity each frame.
9
9
  */
10
- class FXBehaviorDirectionalGravity extends FXBehaviorModule {
10
+ class FXBehaviorDirectionalGravity extends FXBehavior {
11
11
  /**
12
12
  * @param direction - Acceleration vector in units/second²
13
13
  */
@@ -1,12 +1,12 @@
1
- import type { Vector3Like } from "../miscellaneous/math";
2
- import { type FXRange, type FXRangeConfig, type FXVector3Config } from "../miscellaneous/miscellaneous";
3
- import { FXBehaviorModule } from "./FXBehaviorModule";
1
+ import type { Vector3Like } from "../../miscellaneous/math";
2
+ import { type FXRange, type FXRangeConfig, type FXVector3Config } from "../../miscellaneous/miscellaneous";
3
+ import { FXBehavior } from "./FXBehavior";
4
4
  /**
5
5
  * Applies gravity attraction toward a point.
6
6
  *
7
7
  * Force follows inverse power law: strength / distance^exponent. Particles closer than threshold are unaffected.
8
8
  */
9
- export declare class FXBehaviorPointGravity extends FXBehaviorModule<{
9
+ export declare class FXBehaviorPointGravity extends FXBehavior<{
10
10
  builtin: "Matrix4";
11
11
  }> {
12
12
  private centerInternal;
@@ -1,14 +1,14 @@
1
1
  import { MathUtils } from 'three';
2
- import { assertValidNumber } from '../miscellaneous/asserts.js';
3
- import { resolveFXVector3Config, resolveFXRangeConfig, BUILTIN_OFFSET_POSITION_X, BUILTIN_OFFSET_POSITION_Y, BUILTIN_OFFSET_POSITION_Z, BUILTIN_OFFSET_RANDOM_A, BUILTIN_OFFSET_RANDOM_B, BUILTIN_OFFSET_RANDOM_C, BUILTIN_OFFSET_VELOCITY_X, BUILTIN_OFFSET_VELOCITY_Y, BUILTIN_OFFSET_VELOCITY_Z } from '../miscellaneous/miscellaneous.js';
4
- import { FXBehaviorModule } from './FXBehaviorModule.js';
2
+ import { assertValidNumber } from '../../miscellaneous/asserts.js';
3
+ import { resolveFXVector3Config, resolveFXRangeConfig, BUILTIN_OFFSET_POSITION_X, BUILTIN_OFFSET_POSITION_Y, BUILTIN_OFFSET_POSITION_Z, BUILTIN_OFFSET_RANDOM_A, BUILTIN_OFFSET_RANDOM_B, BUILTIN_OFFSET_RANDOM_C, BUILTIN_OFFSET_VELOCITY_X, BUILTIN_OFFSET_VELOCITY_Y, BUILTIN_OFFSET_VELOCITY_Z } from '../../miscellaneous/miscellaneous.js';
4
+ import { FXBehavior } from './FXBehavior.js';
5
5
 
6
6
  /**
7
7
  * Applies gravity attraction toward a point.
8
8
  *
9
9
  * Force follows inverse power law: strength / distance^exponent. Particles closer than threshold are unaffected.
10
10
  */
11
- class FXBehaviorPointGravity extends FXBehaviorModule {
11
+ class FXBehaviorPointGravity extends FXBehavior {
12
12
  /**
13
13
  * @param center - Gravity center position
14
14
  * @param strength - Force multiplier range. Accepts number, tuple, or range object
@@ -1,11 +1,11 @@
1
- import { type FXAspectConfig, type FXRangeConfig } from "../miscellaneous/miscellaneous";
2
- import { FXBehaviorModule } from "./FXBehaviorModule";
1
+ import type { FXAspectConfig, FXRangeConfig } from "../../miscellaneous/miscellaneous";
2
+ import { FXBehavior } from "./FXBehavior";
3
3
  /**
4
4
  * Animates particle scale over lifetime.
5
5
  *
6
6
  * Interpolates between scale anchors based on particle age. Requires at least 2 anchors.
7
7
  */
8
- export declare class FXBehaviorScaleOverLife extends FXBehaviorModule<{
8
+ export declare class FXBehaviorScaleOverLife extends FXBehavior<{
9
9
  builtin: "Matrix4";
10
10
  }> {
11
11
  private readonly scales;
@@ -1,14 +1,14 @@
1
1
  import { MathUtils } from 'three';
2
- import { assertValidNonNegativeNumber, assertValidPositiveNumber } from '../miscellaneous/asserts.js';
3
- import { resolveFXRangeConfig, resolveAspect, BUILTIN_OFFSET_AGE, BUILTIN_OFFSET_LIFETIME, BUILTIN_OFFSET_RANDOM_A, BUILTIN_OFFSET_SCALE_X, BUILTIN_OFFSET_SCALE_Y } from '../miscellaneous/miscellaneous.js';
4
- import { FXBehaviorModule } from './FXBehaviorModule.js';
2
+ import { assertValidNonNegativeNumber, assertValidPositiveNumber } from '../../miscellaneous/asserts.js';
3
+ import { resolveFXRangeConfig, resolveAspect, BUILTIN_OFFSET_AGE, BUILTIN_OFFSET_LIFETIME, BUILTIN_OFFSET_RANDOM_A, BUILTIN_OFFSET_SCALE_X, BUILTIN_OFFSET_SCALE_Y } from '../../miscellaneous/miscellaneous.js';
4
+ import { FXBehavior } from './FXBehavior.js';
5
5
 
6
6
  /**
7
7
  * Animates particle scale over lifetime.
8
8
  *
9
9
  * Interpolates between scale anchors based on particle age. Requires at least 2 anchors.
10
10
  */
11
- class FXBehaviorScaleOverLife extends FXBehaviorModule {
11
+ class FXBehaviorScaleOverLife extends FXBehavior {
12
12
  /**
13
13
  * @param scales - Scale anchor points. Each accepts number, tuple, or range object
14
14
  * @param aspect - Width/height ratio. Accepts number or texture
@@ -1,11 +1,11 @@
1
- import { type FXRange, type FXRangeConfig } from "../miscellaneous/miscellaneous";
2
- import { FXBehaviorModule } from "./FXBehaviorModule";
1
+ import type { FXRange, FXRangeConfig } from "../../miscellaneous/miscellaneous";
2
+ import { FXBehavior } from "./FXBehavior";
3
3
  /**
4
4
  * Reduces particle angular velocity over time.
5
5
  *
6
6
  * Applies exponential decay to torque. Damping of 0 means no effect, 1 means instant stop.
7
7
  */
8
- export declare class FXBehaviorTorqueDamping extends FXBehaviorModule<{
8
+ export declare class FXBehaviorTorqueDamping extends FXBehavior<{
9
9
  builtin: "Matrix4";
10
10
  }> {
11
11
  private dampingInternal;
@@ -1,14 +1,14 @@
1
1
  import { MathUtils } from 'three';
2
- import { assertValidNonNegativeNumber } from '../miscellaneous/asserts.js';
3
- import { resolveFXRangeConfig, BUILTIN_OFFSET_RANDOM_B, BUILTIN_OFFSET_TORQUE } from '../miscellaneous/miscellaneous.js';
4
- import { FXBehaviorModule } from './FXBehaviorModule.js';
2
+ import { assertValidNonNegativeNumber } from '../../miscellaneous/asserts.js';
3
+ import { resolveFXRangeConfig, BUILTIN_OFFSET_RANDOM_B, BUILTIN_OFFSET_TORQUE } from '../../miscellaneous/miscellaneous.js';
4
+ import { FXBehavior } from './FXBehavior.js';
5
5
 
6
6
  /**
7
7
  * Reduces particle angular velocity over time.
8
8
  *
9
9
  * Applies exponential decay to torque. Damping of 0 means no effect, 1 means instant stop.
10
10
  */
11
- class FXBehaviorTorqueDamping extends FXBehaviorModule {
11
+ class FXBehaviorTorqueDamping extends FXBehavior {
12
12
  /**
13
13
  * @param damping - Damping coefficient range (0-1). Accepts number, tuple, or range object
14
14
  */
@@ -1,11 +1,11 @@
1
- import type { FXRange, FXRangeConfig } from "../miscellaneous/miscellaneous";
2
- import { FXBehaviorModule } from "./FXBehaviorModule";
1
+ import type { FXRange, FXRangeConfig } from "../../miscellaneous/miscellaneous";
2
+ import { FXBehavior } from "./FXBehavior";
3
3
  /**
4
4
  * Applies noise-based angular acceleration to particles.
5
5
  *
6
6
  * Uses 2D noise based on particle position. Higher scale means finer noise detail.
7
7
  */
8
- export declare class FXBehaviorTorqueNoise extends FXBehaviorModule<{
8
+ export declare class FXBehaviorTorqueNoise extends FXBehavior<{
9
9
  builtin: "Matrix4";
10
10
  }> {
11
11
  private scaleInternal;
@@ -1,8 +1,8 @@
1
- import { m as modExports } from '../_virtual/mod.js';
1
+ import { m as modExports } from '../../_virtual/mod.js';
2
2
  import { MathUtils } from 'three';
3
- import { assertValidPositiveNumber, assertValidNonNegativeNumber } from '../miscellaneous/asserts.js';
4
- import { resolveFXRangeConfig, BUILTIN_OFFSET_RANDOM_C, BUILTIN_OFFSET_POSITION_X, BUILTIN_OFFSET_POSITION_Y, BUILTIN_OFFSET_POSITION_Z, BUILTIN_OFFSET_RANDOM_A, BUILTIN_OFFSET_TORQUE } from '../miscellaneous/miscellaneous.js';
5
- import { FXBehaviorModule } from './FXBehaviorModule.js';
3
+ import { assertValidPositiveNumber, assertValidNonNegativeNumber } from '../../miscellaneous/asserts.js';
4
+ import { resolveFXRangeConfig, BUILTIN_OFFSET_RANDOM_C, BUILTIN_OFFSET_POSITION_X, BUILTIN_OFFSET_POSITION_Y, BUILTIN_OFFSET_POSITION_Z, BUILTIN_OFFSET_RANDOM_A, BUILTIN_OFFSET_TORQUE } from '../../miscellaneous/miscellaneous.js';
5
+ import { FXBehavior } from './FXBehavior.js';
6
6
 
7
7
  const generateNoise3D = modExports.makeNoise3D();
8
8
  /**
@@ -10,7 +10,7 @@ const generateNoise3D = modExports.makeNoise3D();
10
10
  *
11
11
  * Uses 2D noise based on particle position. Higher scale means finer noise detail.
12
12
  */
13
- class FXBehaviorTorqueNoise extends FXBehaviorModule {
13
+ class FXBehaviorTorqueNoise extends FXBehavior {
14
14
  /**
15
15
  * @param scale - Noise frequency range. Accepts number, tuple, or range object
16
16
  * @param strength - Force multiplier range. Accepts number, tuple, or range object
@@ -1,11 +1,11 @@
1
- import { type FXRange, type FXRangeConfig } from "../miscellaneous/miscellaneous";
2
- import { FXBehaviorModule } from "./FXBehaviorModule";
1
+ import type { FXRange, FXRangeConfig } from "../../miscellaneous/miscellaneous";
2
+ import { FXBehavior } from "./FXBehavior";
3
3
  /**
4
4
  * Reduces particle velocity over time.
5
5
  *
6
6
  * Applies exponential decay to velocity. Damping of 0 means no effect, 1 means instant stop.
7
7
  */
8
- export declare class FXBehaviorVelocityDamping extends FXBehaviorModule<{
8
+ export declare class FXBehaviorVelocityDamping extends FXBehavior<{
9
9
  builtin: "Matrix4";
10
10
  }> {
11
11
  private dampingInternal;
@@ -1,14 +1,14 @@
1
1
  import { MathUtils } from 'three';
2
- import { assertValidNonNegativeNumber } from '../miscellaneous/asserts.js';
3
- import { resolveFXRangeConfig, BUILTIN_OFFSET_RANDOM_B, BUILTIN_OFFSET_VELOCITY_X, BUILTIN_OFFSET_VELOCITY_Y, BUILTIN_OFFSET_VELOCITY_Z } from '../miscellaneous/miscellaneous.js';
4
- import { FXBehaviorModule } from './FXBehaviorModule.js';
2
+ import { assertValidNonNegativeNumber } from '../../miscellaneous/asserts.js';
3
+ import { resolveFXRangeConfig, BUILTIN_OFFSET_RANDOM_B, BUILTIN_OFFSET_VELOCITY_X, BUILTIN_OFFSET_VELOCITY_Y, BUILTIN_OFFSET_VELOCITY_Z } from '../../miscellaneous/miscellaneous.js';
4
+ import { FXBehavior } from './FXBehavior.js';
5
5
 
6
6
  /**
7
7
  * Reduces particle velocity over time.
8
8
  *
9
9
  * Applies exponential decay to velocity. Damping of 0 means no effect, 1 means instant stop.
10
10
  */
11
- class FXBehaviorVelocityDamping extends FXBehaviorModule {
11
+ class FXBehaviorVelocityDamping extends FXBehavior {
12
12
  /**
13
13
  * @param damping - Damping coefficient range (0-1). Accepts number, tuple, or range object
14
14
  */
@@ -1,11 +1,11 @@
1
- import type { FXRange, FXRangeConfig } from "../miscellaneous/miscellaneous";
2
- import { FXBehaviorModule } from "./FXBehaviorModule";
1
+ import type { FXRange, FXRangeConfig } from "../../miscellaneous/miscellaneous";
2
+ import { FXBehavior } from "./FXBehavior";
3
3
  /**
4
4
  * Applies noise-based acceleration to particles.
5
5
  *
6
6
  * Uses 2D noise based on particle position. Higher scale means finer noise detail.
7
7
  */
8
- export declare class FXBehaviorVelocityNoise extends FXBehaviorModule<{
8
+ export declare class FXBehaviorVelocityNoise extends FXBehavior<{
9
9
  builtin: "Matrix4";
10
10
  }> {
11
11
  private scaleInternal;
@@ -1,8 +1,8 @@
1
- import { m as modExports } from '../_virtual/mod.js';
1
+ import { m as modExports } from '../../_virtual/mod.js';
2
2
  import { MathUtils } from 'three';
3
- import { assertValidPositiveNumber, assertValidNonNegativeNumber } from '../miscellaneous/asserts.js';
4
- import { resolveFXRangeConfig, BUILTIN_OFFSET_POSITION_X, BUILTIN_OFFSET_POSITION_Y, BUILTIN_OFFSET_POSITION_Z, BUILTIN_OFFSET_RANDOM_C, BUILTIN_OFFSET_RANDOM_A, BUILTIN_OFFSET_VELOCITY_X, BUILTIN_OFFSET_VELOCITY_Y, BUILTIN_OFFSET_VELOCITY_Z } from '../miscellaneous/miscellaneous.js';
5
- import { FXBehaviorModule } from './FXBehaviorModule.js';
3
+ import { assertValidPositiveNumber, assertValidNonNegativeNumber } from '../../miscellaneous/asserts.js';
4
+ import { resolveFXRangeConfig, BUILTIN_OFFSET_POSITION_X, BUILTIN_OFFSET_POSITION_Y, BUILTIN_OFFSET_POSITION_Z, BUILTIN_OFFSET_RANDOM_C, BUILTIN_OFFSET_RANDOM_A, BUILTIN_OFFSET_VELOCITY_X, BUILTIN_OFFSET_VELOCITY_Y, BUILTIN_OFFSET_VELOCITY_Z } from '../../miscellaneous/miscellaneous.js';
5
+ import { FXBehavior } from './FXBehavior.js';
6
6
 
7
7
  const generateNoise3D0 = modExports.makeNoise3D();
8
8
  const generateNoise3D1 = modExports.makeNoise3D();
@@ -12,7 +12,7 @@ const generateNoise3D2 = modExports.makeNoise3D();
12
12
  *
13
13
  * Uses 2D noise based on particle position. Higher scale means finer noise detail.
14
14
  */
15
- class FXBehaviorVelocityNoise extends FXBehaviorModule {
15
+ class FXBehaviorVelocityNoise extends FXBehavior {
16
16
  /**
17
17
  * @param scale - Noise frequency range. Accepts number, tuple, or range object
18
18
  * @param strength - Force multiplier range. Accepts number, tuple, or range object
@@ -0,0 +1,9 @@
1
+ import type { FXPropertyName } from "../../instancedParticle/shared";
2
+ /**
3
+ * Base class for particle spawn modules.
4
+ *
5
+ * Spawn modules initialize particle properties when particles are created.
6
+ */
7
+ export declare abstract class FXSpawn<T extends Record<string, FXPropertyName> = Record<string, FXPropertyName>> {
8
+ destroy?(): void;
9
+ }
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Spawn modules initialize particle properties when particles are created.
5
5
  */
6
- class FXSpawnModule {
6
+ class FXSpawn {
7
7
  }
8
8
 
9
- export { FXSpawnModule };
9
+ export { FXSpawn };
@@ -1,12 +1,12 @@
1
- import type { Vector3Like } from "../miscellaneous/math";
2
- import { type FXVector3Config } from "../miscellaneous/miscellaneous";
3
- import { FXSpawnModule } from "./FXSpawnModule";
1
+ import type { Vector3Like } from "../../miscellaneous/math";
2
+ import type { FXVector3Config } from "../../miscellaneous/miscellaneous";
3
+ import { FXSpawn } from "./FXSpawn";
4
4
  /**
5
5
  * Spawns particles at random positions within an axis-aligned bounding box.
6
6
  *
7
7
  * Position is chosen uniformly within the bounds defined by min and max.
8
8
  */
9
- export declare class FXSpawnBox extends FXSpawnModule<{
9
+ export declare class FXSpawnBox extends FXSpawn<{
10
10
  builtin: "Matrix4";
11
11
  }> {
12
12
  private minInternal;
@@ -1,14 +1,14 @@
1
1
  import { MathUtils } from 'three';
2
- import { assertValidNumber } from '../miscellaneous/asserts.js';
3
- import { resolveFXVector3Config, BUILTIN_OFFSET_POSITION_X, BUILTIN_OFFSET_POSITION_Y, BUILTIN_OFFSET_POSITION_Z } from '../miscellaneous/miscellaneous.js';
4
- import { FXSpawnModule } from './FXSpawnModule.js';
2
+ import { assertValidNumber } from '../../miscellaneous/asserts.js';
3
+ import { resolveFXVector3Config, BUILTIN_OFFSET_POSITION_X, BUILTIN_OFFSET_POSITION_Y, BUILTIN_OFFSET_POSITION_Z } from '../../miscellaneous/miscellaneous.js';
4
+ import { FXSpawn } from './FXSpawn.js';
5
5
 
6
6
  /**
7
7
  * Spawns particles at random positions within an axis-aligned bounding box.
8
8
  *
9
9
  * Position is chosen uniformly within the bounds defined by min and max.
10
10
  */
11
- class FXSpawnBox extends FXSpawnModule {
11
+ class FXSpawnBox extends FXSpawn {
12
12
  /**
13
13
  * @param min - Minimum corner of the spawn box
14
14
  * @param max - Maximum corner of the spawn box
@@ -1,12 +1,12 @@
1
- import type { Vector3Like } from "../miscellaneous/math";
2
- import type { FXVector3Config } from "../miscellaneous/miscellaneous";
3
- import { FXSpawnModule } from "./FXSpawnModule";
1
+ import type { Vector3Like } from "../../miscellaneous/math";
2
+ import type { FXVector3Config } from "../../miscellaneous/miscellaneous";
3
+ import { FXSpawn } from "./FXSpawn";
4
4
  /**
5
5
  * Sets particle spawn position offset.
6
6
  *
7
7
  * All particles spawned with this module start at the specified position.
8
8
  */
9
- export declare class FXSpawnOffset extends FXSpawnModule<{
9
+ export declare class FXSpawnPoint extends FXSpawn<{
10
10
  builtin: "Matrix4";
11
11
  }> {
12
12
  private offsetInternal;
@@ -1,13 +1,13 @@
1
- import { assertValidNumber } from '../miscellaneous/asserts.js';
2
- import { resolveFXVector3Config, BUILTIN_OFFSET_POSITION_X, BUILTIN_OFFSET_POSITION_Y, BUILTIN_OFFSET_POSITION_Z } from '../miscellaneous/miscellaneous.js';
3
- import { FXSpawnModule } from './FXSpawnModule.js';
1
+ import { assertValidNumber } from '../../miscellaneous/asserts.js';
2
+ import { resolveFXVector3Config, BUILTIN_OFFSET_POSITION_X, BUILTIN_OFFSET_POSITION_Y, BUILTIN_OFFSET_POSITION_Z } from '../../miscellaneous/miscellaneous.js';
3
+ import { FXSpawn } from './FXSpawn.js';
4
4
 
5
5
  /**
6
6
  * Sets particle spawn position offset.
7
7
  *
8
8
  * All particles spawned with this module start at the specified position.
9
9
  */
10
- class FXSpawnOffset extends FXSpawnModule {
10
+ class FXSpawnPoint extends FXSpawn {
11
11
  /**
12
12
  * @param offset - Initial particle position offset
13
13
  */
@@ -46,4 +46,4 @@ class FXSpawnOffset extends FXSpawnModule {
46
46
  }
47
47
  }
48
48
 
49
- export { FXSpawnOffset };
49
+ export { FXSpawnPoint };
@@ -1,11 +1,11 @@
1
- import type { FXRange, FXRangeConfig } from "../miscellaneous/miscellaneous";
2
- import { FXSpawnModule } from "./FXSpawnModule";
1
+ import type { FXRange, FXRangeConfig } from "../../miscellaneous/miscellaneous";
2
+ import { FXSpawn } from "./FXSpawn";
3
3
  /**
4
4
  * Assigns random lifetime to particles.
5
5
  *
6
6
  * Lifetime is chosen uniformly from the specified range. Age is set to 0.
7
7
  */
8
- export declare class FXSpawnRandomLifetime extends FXSpawnModule<{
8
+ export declare class FXSpawnRandomLifetime extends FXSpawn<{
9
9
  builtin: "Matrix4";
10
10
  }> {
11
11
  private lifetimeInternal;
@@ -1,14 +1,14 @@
1
1
  import { MathUtils } from 'three';
2
- import { assertValidPositiveNumber } from '../miscellaneous/asserts.js';
3
- import { resolveFXRangeConfig, BUILTIN_OFFSET_LIFETIME, BUILTIN_OFFSET_AGE } from '../miscellaneous/miscellaneous.js';
4
- import { FXSpawnModule } from './FXSpawnModule.js';
2
+ import { assertValidPositiveNumber } from '../../miscellaneous/asserts.js';
3
+ import { resolveFXRangeConfig, BUILTIN_OFFSET_LIFETIME, BUILTIN_OFFSET_AGE } from '../../miscellaneous/miscellaneous.js';
4
+ import { FXSpawn } from './FXSpawn.js';
5
5
 
6
6
  /**
7
7
  * Assigns random lifetime to particles.
8
8
  *
9
9
  * Lifetime is chosen uniformly from the specified range. Age is set to 0.
10
10
  */
11
- class FXSpawnRandomLifetime extends FXSpawnModule {
11
+ class FXSpawnRandomLifetime extends FXSpawn {
12
12
  /**
13
13
  * @param lifetime - Lifetime range in seconds. Accepts number, tuple, or range object
14
14
  */
@@ -1,11 +1,11 @@
1
- import { type FXRange, type FXRangeConfig } from "../miscellaneous/miscellaneous";
2
- import { FXSpawnModule } from "./FXSpawnModule";
1
+ import type { FXRange, FXRangeConfig } from "../../miscellaneous/miscellaneous";
2
+ import { FXSpawn } from "./FXSpawn";
3
3
  /**
4
4
  * Assigns random rotation to particles.
5
5
  *
6
6
  * Initial rotation is chosen uniformly from the specified range.
7
7
  */
8
- export declare class FXSpawnRandomRotation extends FXSpawnModule<{
8
+ export declare class FXSpawnRandomRotation extends FXSpawn<{
9
9
  builtin: "Matrix4";
10
10
  }> {
11
11
  private rotationInternal;
@@ -1,14 +1,14 @@
1
1
  import { MathUtils } from 'three';
2
- import { assertValidNumber } from '../miscellaneous/asserts.js';
3
- import { resolveFXRangeConfig, BUILTIN_OFFSET_ROTATION } from '../miscellaneous/miscellaneous.js';
4
- import { FXSpawnModule } from './FXSpawnModule.js';
2
+ import { assertValidNumber } from '../../miscellaneous/asserts.js';
3
+ import { resolveFXRangeConfig, BUILTIN_OFFSET_ROTATION } from '../../miscellaneous/miscellaneous.js';
4
+ import { FXSpawn } from './FXSpawn.js';
5
5
 
6
6
  /**
7
7
  * Assigns random rotation to particles.
8
8
  *
9
9
  * Initial rotation is chosen uniformly from the specified range.
10
10
  */
11
- class FXSpawnRandomRotation extends FXSpawnModule {
11
+ class FXSpawnRandomRotation extends FXSpawn {
12
12
  /**
13
13
  * @param rotation - Rotation range in radians. Accepts number, tuple, or range object
14
14
  */