sparcoon 0.2.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/emitter/FXEmitter.Internal.d.ts +4 -0
- package/dist/emitter/FXEmitter.Internal.js +20 -1
- package/dist/emitter/FXEmitter.d.ts +4 -4
- package/dist/emitter/FXEmitter.js +1 -2
- package/dist/emitter/behavior/{FXBehaviorModule.d.ts → FXBehavior.d.ts} +1 -1
- package/dist/emitter/behavior/{FXBehaviorModule.js → FXBehavior.js} +2 -2
- package/dist/emitter/behavior/FXBehaviorDirectionalGravity.d.ts +3 -3
- package/dist/emitter/behavior/FXBehaviorDirectionalGravity.js +2 -2
- package/dist/emitter/behavior/FXBehaviorPointGravity.d.ts +2 -2
- package/dist/emitter/behavior/FXBehaviorPointGravity.js +2 -2
- package/dist/emitter/behavior/FXBehaviorScaleOverLife.d.ts +3 -3
- package/dist/emitter/behavior/FXBehaviorScaleOverLife.js +2 -2
- package/dist/emitter/behavior/FXBehaviorTorqueDamping.d.ts +3 -3
- package/dist/emitter/behavior/FXBehaviorTorqueDamping.js +2 -2
- package/dist/emitter/behavior/FXBehaviorTorqueNoise.d.ts +2 -2
- package/dist/emitter/behavior/FXBehaviorTorqueNoise.js +2 -2
- package/dist/emitter/behavior/FXBehaviorVelocityDamping.d.ts +3 -3
- package/dist/emitter/behavior/FXBehaviorVelocityDamping.js +2 -2
- package/dist/emitter/behavior/FXBehaviorVelocityNoise.d.ts +2 -2
- package/dist/emitter/behavior/FXBehaviorVelocityNoise.js +2 -2
- package/dist/emitter/spawn/{FXSpawnModule.d.ts → FXSpawn.d.ts} +1 -1
- package/dist/emitter/spawn/{FXSpawnModule.js → FXSpawn.js} +2 -2
- package/dist/emitter/spawn/FXSpawnBox.d.ts +3 -3
- package/dist/emitter/spawn/FXSpawnBox.js +2 -2
- package/dist/emitter/spawn/{FXSpawnOffset.d.ts → FXSpawnPoint.d.ts} +3 -3
- package/dist/emitter/spawn/{FXSpawnOffset.js → FXSpawnPoint.js} +3 -3
- package/dist/emitter/spawn/FXSpawnRandomLifetime.d.ts +3 -3
- package/dist/emitter/spawn/FXSpawnRandomLifetime.js +2 -2
- package/dist/emitter/spawn/FXSpawnRandomRotation.d.ts +3 -3
- package/dist/emitter/spawn/FXSpawnRandomRotation.js +2 -2
- package/dist/emitter/spawn/FXSpawnRandomScale.d.ts +3 -3
- package/dist/emitter/spawn/FXSpawnRandomScale.js +2 -2
- package/dist/emitter/spawn/FXSpawnRandomTorque.d.ts +3 -3
- package/dist/emitter/spawn/FXSpawnRandomTorque.js +2 -2
- package/dist/emitter/spawn/FXSpawnRandomVelocity.d.ts +3 -3
- package/dist/emitter/spawn/FXSpawnRandomVelocity.js +2 -2
- package/dist/emitter/spawn/FXSpawnSphere.d.ts +2 -2
- package/dist/emitter/spawn/FXSpawnSphere.js +2 -2
- package/dist/index.d.ts +11 -7
- package/dist/index.js +10 -7
- package/dist/instancedParticle/FXInstancedParticle.Internal.d.ts +0 -4
- package/dist/instancedParticle/FXInstancedParticle.Internal.js +1 -19
- package/dist/materials/FXDiffuseMaterial/FXDiffuseMaterial.Internal.d.ts +6 -8
- package/dist/materials/FXDiffuseMaterial/FXDiffuseMaterial.Internal.js +84 -40
- package/dist/materials/FXDiffuseMaterial/FXDiffuseMaterial.d.ts +11 -11
- package/dist/materials/FXDiffuseMaterial/FXDiffuseMaterial.js +16 -8
- package/dist/materials/{FXMaterial.Internal.d.ts → FXMaterial/FXMaterial.Internal.d.ts} +3 -2
- package/dist/materials/{FXMaterial.Internal.js → FXMaterial/FXMaterial.Internal.js} +3 -3
- package/dist/materials/{FXMaterial.d.ts → FXMaterial/FXMaterial.d.ts} +7 -2
- package/dist/materials/FXMaterial/FXMaterial.js +25 -0
- package/dist/materials/FXUnlitMaterial/FXUnlitMaterial.Internal.d.ts +5 -3
- package/dist/materials/FXUnlitMaterial/FXUnlitMaterial.Internal.js +35 -20
- package/dist/materials/FXUnlitMaterial/FXUnlitMaterial.d.ts +4 -9
- package/dist/materials/FXUnlitMaterial/FXUnlitMaterial.js +2 -5
- package/dist/miscellaneous/miscellaneous.d.ts +1 -0
- package/dist/miscellaneous/miscellaneous.js +24 -1
- package/dist/{materials/color-nodes → nodes/color}/FXColorOverLifeNode.d.ts +0 -1
- package/dist/nodes/color/FXColorOverLifeNode.js +44 -0
- package/dist/nodes/normal/FXFlatNormalNode.d.ts +4 -0
- package/dist/nodes/normal/FXFlatNormalNode.js +14 -0
- package/dist/nodes/normal/FXNormalNode.d.ts +3 -0
- package/dist/nodes/normal/FXNormalNode.js +4 -0
- package/dist/nodes/normal/FXSphericalNormalNode.d.ts +4 -0
- package/dist/nodes/normal/FXSphericalNormalNode.js +19 -0
- package/dist/nodes/texture/FXAnimatedTextureNode.d.ts +12 -0
- package/dist/nodes/texture/FXAnimatedTextureNode.js +88 -0
- package/dist/nodes/texture/FXStaticTextureNode.d.ts +6 -0
- package/dist/nodes/texture/FXStaticTextureNode.js +34 -0
- package/dist/nodes/texture/FXTextureNode.d.ts +3 -0
- package/dist/nodes/texture/FXTextureNode.js +8 -0
- package/package.json +1 -1
- package/dist/materials/FXMaterial.js +0 -21
- package/dist/materials/color-nodes/FXAnimatedTextureNode.d.ts +0 -10
- package/dist/materials/color-nodes/FXAnimatedTextureNode.js +0 -41
- package/dist/materials/color-nodes/FXColorOverLifeNode.js +0 -38
- package/dist/materials/color-nodes/FXStaticTextureNode.d.ts +0 -5
- package/dist/materials/color-nodes/FXStaticTextureNode.js +0 -23
- package/dist/materials/miscellaneous.d.ts +0 -1
- package/dist/materials/miscellaneous.js +0 -25
- /package/dist/{materials/color-nodes → nodes/color}/FXColorNode.d.ts +0 -0
- /package/dist/{materials/color-nodes → nodes/color}/FXColorNode.js +0 -0
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { FXPropertyName, GLTypeInfo } from "../instancedParticle/shared";
|
|
1
2
|
export interface FXEmitterPlayOptions {
|
|
2
3
|
duration: number;
|
|
3
4
|
}
|
|
@@ -6,3 +7,6 @@ export declare const EMITTER_DEFAULT_CAPACITY_STEP = 32;
|
|
|
6
7
|
export declare const EMITTER_DEFAULT_AUTOMATICALLY_DESTROY_MODULES = true;
|
|
7
8
|
export declare const EMITTER_DEFAULT_CAST_SHADOW = false;
|
|
8
9
|
export declare const EMITTER_DEFAULT_RECEIVE_SHADOW = false;
|
|
10
|
+
export declare function collectProperties(keeper: Record<string, GLTypeInfo>, modules: readonly {
|
|
11
|
+
requiredProperties?: Record<string, FXPropertyName>;
|
|
12
|
+
}[], debugContext: string): void;
|
|
@@ -1,7 +1,26 @@
|
|
|
1
|
+
import { resolveGLSLTypeInfo } from '../instancedParticle/shared.js';
|
|
2
|
+
|
|
1
3
|
const EMITTER_DEFAULT_EXPECTED_CAPACITY = 32;
|
|
2
4
|
const EMITTER_DEFAULT_CAPACITY_STEP = 32;
|
|
3
5
|
const EMITTER_DEFAULT_AUTOMATICALLY_DESTROY_MODULES = true;
|
|
4
6
|
const EMITTER_DEFAULT_CAST_SHADOW = false;
|
|
5
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
|
+
}
|
|
6
25
|
|
|
7
|
-
export { EMITTER_DEFAULT_AUTOMATICALLY_DESTROY_MODULES, EMITTER_DEFAULT_CAPACITY_STEP, EMITTER_DEFAULT_CAST_SHADOW, EMITTER_DEFAULT_EXPECTED_CAPACITY, EMITTER_DEFAULT_RECEIVE_SHADOW };
|
|
26
|
+
export { EMITTER_DEFAULT_AUTOMATICALLY_DESTROY_MODULES, EMITTER_DEFAULT_CAPACITY_STEP, EMITTER_DEFAULT_CAST_SHADOW, EMITTER_DEFAULT_EXPECTED_CAPACITY, EMITTER_DEFAULT_RECEIVE_SHADOW, collectProperties };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Object3D } from "three";
|
|
2
|
-
import type { FXMaterial } from "../materials/FXMaterial";
|
|
3
|
-
import type {
|
|
2
|
+
import type { FXMaterial } from "../materials/FXMaterial/FXMaterial";
|
|
3
|
+
import type { FXBehavior } from "./behavior/FXBehavior";
|
|
4
4
|
import type { FXEmitterPlayOptions } from "./FXEmitter.Internal";
|
|
5
|
-
import type {
|
|
5
|
+
import type { FXSpawn } from "./spawn/FXSpawn";
|
|
6
6
|
export interface FXEmitterOptions {
|
|
7
7
|
expectedCapacity: number;
|
|
8
8
|
capacityStep: number;
|
|
@@ -20,7 +20,7 @@ export declare class FXEmitter extends Object3D {
|
|
|
20
20
|
private emissionAccumulator;
|
|
21
21
|
private emissionDuration;
|
|
22
22
|
private emissionElapsed;
|
|
23
|
-
constructor(spawnSequence:
|
|
23
|
+
constructor(spawnSequence: FXSpawn[], behaviorSequence: readonly FXBehavior[], material: FXMaterial, options?: Partial<FXEmitterOptions>);
|
|
24
24
|
static onWillRender: (deltaTime: number) => void;
|
|
25
25
|
destroy(): void;
|
|
26
26
|
burst(count: number): void;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Object3D } from 'three';
|
|
2
2
|
import { FXInstancedParticle } from '../instancedParticle/FXInstancedParticle.js';
|
|
3
|
-
import { collectProperties } from '../instancedParticle/FXInstancedParticle.Internal.js';
|
|
4
3
|
import { resolveGLSLTypeInfo } from '../instancedParticle/shared.js';
|
|
5
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';
|
|
6
|
-
import { 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';
|
|
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';
|
|
7
6
|
|
|
8
7
|
const EMITTERS = new Array();
|
|
9
8
|
class FXEmitter extends Object3D {
|
|
@@ -5,7 +5,7 @@ import type { FXPropertyName } from "../../instancedParticle/shared";
|
|
|
5
5
|
*
|
|
6
6
|
* Behavior modules update particle properties each frame.
|
|
7
7
|
*/
|
|
8
|
-
export declare abstract class
|
|
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;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Vector3Like } from "../../miscellaneous/math";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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
|
|
9
|
+
export declare class FXBehaviorDirectionalGravity extends FXBehavior<{
|
|
10
10
|
builtin: "Matrix4";
|
|
11
11
|
}> {
|
|
12
12
|
private directionInternal;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { assertValidNumber } from '../../miscellaneous/asserts.js';
|
|
2
2
|
import { resolveFXVector3Config, BUILTIN_OFFSET_VELOCITY_X, BUILTIN_OFFSET_VELOCITY_Y, BUILTIN_OFFSET_VELOCITY_Z } from '../../miscellaneous/miscellaneous.js';
|
|
3
|
-
import {
|
|
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
|
|
10
|
+
class FXBehaviorDirectionalGravity extends FXBehavior {
|
|
11
11
|
/**
|
|
12
12
|
* @param direction - Acceleration vector in units/second²
|
|
13
13
|
*/
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Vector3Like } from "../../miscellaneous/math";
|
|
2
2
|
import { type FXRange, type FXRangeConfig, type FXVector3Config } from "../../miscellaneous/miscellaneous";
|
|
3
|
-
import {
|
|
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
|
|
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
2
|
import { assertValidNumber } from '../../miscellaneous/asserts.js';
|
|
3
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 {
|
|
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
|
|
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 {
|
|
2
|
-
import {
|
|
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
|
|
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
2
|
import { assertValidNonNegativeNumber, assertValidPositiveNumber } from '../../miscellaneous/asserts.js';
|
|
3
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 {
|
|
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
|
|
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 {
|
|
2
|
-
import {
|
|
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
|
|
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
2
|
import { assertValidNonNegativeNumber } from '../../miscellaneous/asserts.js';
|
|
3
3
|
import { resolveFXRangeConfig, BUILTIN_OFFSET_RANDOM_B, BUILTIN_OFFSET_TORQUE } from '../../miscellaneous/miscellaneous.js';
|
|
4
|
-
import {
|
|
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
|
|
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
1
|
import type { FXRange, FXRangeConfig } from "../../miscellaneous/miscellaneous";
|
|
2
|
-
import {
|
|
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
|
|
8
|
+
export declare class FXBehaviorTorqueNoise extends FXBehavior<{
|
|
9
9
|
builtin: "Matrix4";
|
|
10
10
|
}> {
|
|
11
11
|
private scaleInternal;
|
|
@@ -2,7 +2,7 @@ import { m as modExports } from '../../_virtual/mod.js';
|
|
|
2
2
|
import { MathUtils } from 'three';
|
|
3
3
|
import { assertValidPositiveNumber, assertValidNonNegativeNumber } from '../../miscellaneous/asserts.js';
|
|
4
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 {
|
|
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
|
|
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 {
|
|
2
|
-
import {
|
|
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
|
|
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
2
|
import { assertValidNonNegativeNumber } from '../../miscellaneous/asserts.js';
|
|
3
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 {
|
|
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
|
|
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
1
|
import type { FXRange, FXRangeConfig } from "../../miscellaneous/miscellaneous";
|
|
2
|
-
import {
|
|
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
|
|
8
|
+
export declare class FXBehaviorVelocityNoise extends FXBehavior<{
|
|
9
9
|
builtin: "Matrix4";
|
|
10
10
|
}> {
|
|
11
11
|
private scaleInternal;
|
|
@@ -2,7 +2,7 @@ import { m as modExports } from '../../_virtual/mod.js';
|
|
|
2
2
|
import { MathUtils } from 'three';
|
|
3
3
|
import { assertValidPositiveNumber, assertValidNonNegativeNumber } from '../../miscellaneous/asserts.js';
|
|
4
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 {
|
|
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
|
|
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
|
|
@@ -4,6 +4,6 @@ import type { FXPropertyName } from "../../instancedParticle/shared";
|
|
|
4
4
|
*
|
|
5
5
|
* Spawn modules initialize particle properties when particles are created.
|
|
6
6
|
*/
|
|
7
|
-
export declare abstract class
|
|
7
|
+
export declare abstract class FXSpawn<T extends Record<string, FXPropertyName> = Record<string, FXPropertyName>> {
|
|
8
8
|
destroy?(): void;
|
|
9
9
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Vector3Like } from "../../miscellaneous/math";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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
|
|
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
2
|
import { assertValidNumber } from '../../miscellaneous/asserts.js';
|
|
3
3
|
import { resolveFXVector3Config, BUILTIN_OFFSET_POSITION_X, BUILTIN_OFFSET_POSITION_Y, BUILTIN_OFFSET_POSITION_Z } from '../../miscellaneous/miscellaneous.js';
|
|
4
|
-
import {
|
|
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
|
|
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
1
|
import type { Vector3Like } from "../../miscellaneous/math";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
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
|
|
9
|
+
export declare class FXSpawnPoint extends FXSpawn<{
|
|
10
10
|
builtin: "Matrix4";
|
|
11
11
|
}> {
|
|
12
12
|
private offsetInternal;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { assertValidNumber } from '../../miscellaneous/asserts.js';
|
|
2
2
|
import { resolveFXVector3Config, BUILTIN_OFFSET_POSITION_X, BUILTIN_OFFSET_POSITION_Y, BUILTIN_OFFSET_POSITION_Z } from '../../miscellaneous/miscellaneous.js';
|
|
3
|
-
import {
|
|
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
|
|
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 {
|
|
49
|
+
export { FXSpawnPoint };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
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
|
|
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
2
|
import { assertValidPositiveNumber } from '../../miscellaneous/asserts.js';
|
|
3
3
|
import { resolveFXRangeConfig, BUILTIN_OFFSET_LIFETIME, BUILTIN_OFFSET_AGE } from '../../miscellaneous/miscellaneous.js';
|
|
4
|
-
import {
|
|
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
|
|
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 {
|
|
2
|
-
import {
|
|
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
|
|
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
2
|
import { assertValidNumber } from '../../miscellaneous/asserts.js';
|
|
3
3
|
import { resolveFXRangeConfig, BUILTIN_OFFSET_ROTATION } from '../../miscellaneous/miscellaneous.js';
|
|
4
|
-
import {
|
|
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
|
|
11
|
+
class FXSpawnRandomRotation extends FXSpawn {
|
|
12
12
|
/**
|
|
13
13
|
* @param rotation - Rotation range in radians. Accepts number, tuple, or range object
|
|
14
14
|
*/
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { FXAspectConfig, FXRange, FXRangeConfig } from "../../miscellaneous/miscellaneous";
|
|
2
|
+
import { FXSpawn } from "./FXSpawn";
|
|
3
3
|
/**
|
|
4
4
|
* Assigns random scale to particles.
|
|
5
5
|
*
|
|
6
6
|
* Base scale is chosen uniformly from the range. Aspect ratio is applied to X scale.
|
|
7
7
|
*/
|
|
8
|
-
export declare class FXSpawnRandomScale extends
|
|
8
|
+
export declare class FXSpawnRandomScale extends FXSpawn<{
|
|
9
9
|
builtin: "Matrix4";
|
|
10
10
|
}> {
|
|
11
11
|
private scaleInternal;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { MathUtils } from 'three';
|
|
2
2
|
import { assertValidPositiveNumber } from '../../miscellaneous/asserts.js';
|
|
3
3
|
import { resolveFXRangeConfig, resolveAspect, BUILTIN_OFFSET_SCALE_X, BUILTIN_OFFSET_SCALE_Y } from '../../miscellaneous/miscellaneous.js';
|
|
4
|
-
import {
|
|
4
|
+
import { FXSpawn } from './FXSpawn.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Assigns random scale to particles.
|
|
8
8
|
*
|
|
9
9
|
* Base scale is chosen uniformly from the range. Aspect ratio is applied to X scale.
|
|
10
10
|
*/
|
|
11
|
-
class FXSpawnRandomScale extends
|
|
11
|
+
class FXSpawnRandomScale extends FXSpawn {
|
|
12
12
|
/**
|
|
13
13
|
* @param scale - Base scale range. Accepts number, tuple, or range object
|
|
14
14
|
* @param aspect - Width/height ratio. Accepts number or texture
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { FXRange, FXRangeConfig } from "../../miscellaneous/miscellaneous";
|
|
2
|
+
import { FXSpawn } from "./FXSpawn";
|
|
3
3
|
/**
|
|
4
4
|
* Assigns random angular velocity to particles.
|
|
5
5
|
*
|
|
6
6
|
* Torque (rotation speed) is chosen uniformly from the specified range.
|
|
7
7
|
*/
|
|
8
|
-
export declare class FXSpawnRandomTorque extends
|
|
8
|
+
export declare class FXSpawnRandomTorque extends FXSpawn<{
|
|
9
9
|
builtin: "Matrix4";
|
|
10
10
|
}> {
|
|
11
11
|
private torqueInternal;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { MathUtils } from 'three';
|
|
2
2
|
import { assertValidNumber } from '../../miscellaneous/asserts.js';
|
|
3
3
|
import { resolveFXRangeConfig, BUILTIN_OFFSET_TORQUE } from '../../miscellaneous/miscellaneous.js';
|
|
4
|
-
import {
|
|
4
|
+
import { FXSpawn } from './FXSpawn.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Assigns random angular velocity to particles.
|
|
8
8
|
*
|
|
9
9
|
* Torque (rotation speed) is chosen uniformly from the specified range.
|
|
10
10
|
*/
|
|
11
|
-
class FXSpawnRandomTorque extends
|
|
11
|
+
class FXSpawnRandomTorque extends FXSpawn {
|
|
12
12
|
/**
|
|
13
13
|
* @param torque - Angular velocity range in radians/second. Accepts number, tuple, or range object
|
|
14
14
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Vector3 } from "three";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export declare class FXSpawnRandomVelocity extends
|
|
2
|
+
import type { FXRange, FXRangeConfig } from "../../miscellaneous/miscellaneous";
|
|
3
|
+
import { FXSpawn } from "./FXSpawn";
|
|
4
|
+
export declare class FXSpawnRandomVelocity extends FXSpawn<{
|
|
5
5
|
builtin: "Matrix4";
|
|
6
6
|
}> {
|
|
7
7
|
private angleInternal;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Vector3, MathUtils } from 'three';
|
|
2
2
|
import { assertValidNumber } from '../../miscellaneous/asserts.js';
|
|
3
3
|
import { resolveFXRangeConfig, BUILTIN_OFFSET_VELOCITY_X, BUILTIN_OFFSET_VELOCITY_Y, BUILTIN_OFFSET_VELOCITY_Z } from '../../miscellaneous/miscellaneous.js';
|
|
4
|
-
import {
|
|
4
|
+
import { FXSpawn } from './FXSpawn.js';
|
|
5
5
|
|
|
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
|
|
9
|
+
class FXSpawnRandomVelocity extends FXSpawn {
|
|
10
10
|
constructor(direction = new Vector3(0, 1, 0), angle = { min: 0, max: Math.PI }, magnitude = { min: -50, max: 50 }) {
|
|
11
11
|
super();
|
|
12
12
|
/** @internal */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { FXSpawn } from "./FXSpawn";
|
|
2
2
|
/**
|
|
3
3
|
* Spawns particles at random positions within a spherical shell.
|
|
4
4
|
*
|
|
@@ -7,7 +7,7 @@ import { FXSpawnModule } from "./FXSpawnModule";
|
|
|
7
7
|
* - `Math.PI / 2` - full sphere
|
|
8
8
|
* - Values in between produce a spherical band/zone
|
|
9
9
|
*/
|
|
10
|
-
export declare class FXSpawnSphere extends
|
|
10
|
+
export declare class FXSpawnSphere extends FXSpawn<{
|
|
11
11
|
builtin: "Matrix4";
|
|
12
12
|
}> {
|
|
13
13
|
private innerRadiusInternal;
|