sparcoon 0.7.3 → 0.9.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/README.md +124 -76
- package/dist/artifact/FXArtifact.d.ts +120 -0
- package/dist/artifact/FXArtifact.js +1 -0
- package/dist/coreLayout.d.ts +22 -0
- package/dist/coreLayout.js +32 -0
- package/dist/editor/index.d.ts +8 -0
- package/dist/editor/index.js +17 -0
- package/dist/effect/FXEffect.d.ts +77 -0
- package/dist/effect/FXEffect.js +454 -0
- package/dist/effect/FXEffectSampling.Internal.d.ts +24 -0
- package/dist/effect/FXEffectSampling.Internal.js +165 -0
- package/dist/effect/FXEffectSpec.d.ts +115 -0
- package/dist/effect/FXEffectSpec.js +1 -0
- package/dist/emitter/FXEmitter.Internal.d.ts +23 -58
- package/dist/emitter/FXEmitter.Internal.js +13 -29
- package/dist/emitter/FXEmitter.d.ts +54 -46
- package/dist/emitter/FXEmitter.js +357 -186
- package/dist/emitter/FXFromArtifactsOptions.d.ts +13 -0
- package/dist/emitter/FXFromArtifactsOptions.js +1 -0
- package/dist/emitter/FXObjectMotion.Internal.d.ts +33 -0
- package/dist/emitter/FXObjectMotion.Internal.js +87 -0
- package/dist/emitter/FXSimulationHolder.d.ts +1 -0
- package/dist/emitter/FXSimulationHolder.js +43 -0
- package/dist/index.d.ts +11 -39
- package/dist/index.js +13 -36
- package/dist/instancedParticle/FXInstancedParticle.d.ts +1 -22
- package/dist/instancedParticle/FXInstancedParticle.js +145 -85
- package/dist/instancedParticle/glTypeInfo.d.ts +5 -0
- package/dist/instancedParticle/glTypeInfo.js +3 -0
- package/dist/instancedParticle/primitiveGeometry.d.ts +10 -0
- package/dist/instancedParticle/primitiveGeometry.js +30 -0
- package/dist/miscellaneous/asserts.d.ts +1 -18
- package/dist/miscellaneous/asserts.js +21 -28
- package/dist/miscellaneous/fxMath.d.ts +26 -0
- package/dist/miscellaneous/fxMath.js +261 -0
- package/dist/miscellaneous/math.d.ts +2 -7
- package/dist/miscellaneous/math.js +8 -9
- package/dist/miscellaneous/texture/fxDataTexture.d.ts +26 -0
- package/dist/miscellaneous/texture/fxDataTexture.js +20 -0
- package/dist/render/FXArtifactMaterial.Internal.d.ts +16 -0
- package/dist/render/FXArtifactMaterial.Internal.js +944 -0
- package/dist/render/FXArtifactMaterial.d.ts +1 -0
- package/dist/render/FXArtifactMaterial.js +79 -0
- package/dist/render/FXMaterialOptions.d.ts +27 -0
- package/dist/render/FXMaterialOptions.js +5 -0
- package/dist/render/FXMesh.d.ts +47 -0
- package/dist/render/FXMesh.js +99 -0
- package/dist/render/FXMeshMaterial.d.ts +40 -0
- package/dist/render/FXMeshMaterial.js +77 -0
- package/dist/world/FXWorld.d.ts +52 -0
- package/dist/world/FXWorld.js +104 -0
- package/package.json +49 -29
- package/dist/_virtual/2d.js +0 -3
- package/dist/_virtual/3d.js +0 -3
- package/dist/_virtual/4d.js +0 -3
- package/dist/_virtual/mod.js +0 -5
- package/dist/_virtual/mod2.js +0 -3
- package/dist/emitter/behavior/FXBehavior.d.ts +0 -24
- package/dist/emitter/behavior/FXBehavior.js +0 -10
- package/dist/emitter/behavior/FXBehaviorDirectionalForce.d.ts +0 -23
- package/dist/emitter/behavior/FXBehaviorDirectionalForce.js +0 -72
- package/dist/emitter/behavior/FXBehaviorPointForce.d.ts +0 -36
- package/dist/emitter/behavior/FXBehaviorPointForce.js +0 -94
- package/dist/emitter/behavior/FXBehaviorScaleOverLife.d.ts +0 -24
- package/dist/emitter/behavior/FXBehaviorScaleOverLife.js +0 -55
- package/dist/emitter/behavior/FXBehaviorTorqueDamping.d.ts +0 -20
- package/dist/emitter/behavior/FXBehaviorTorqueDamping.js +0 -48
- package/dist/emitter/behavior/FXBehaviorTorqueNoise.d.ts +0 -25
- package/dist/emitter/behavior/FXBehaviorTorqueNoise.js +0 -67
- package/dist/emitter/behavior/FXBehaviorTorqueOverLife.d.ts +0 -19
- package/dist/emitter/behavior/FXBehaviorTorqueOverLife.js +0 -41
- package/dist/emitter/behavior/FXBehaviorVelocityDamping.d.ts +0 -20
- package/dist/emitter/behavior/FXBehaviorVelocityDamping.js +0 -50
- package/dist/emitter/behavior/FXBehaviorVelocityNoise.d.ts +0 -25
- package/dist/emitter/behavior/FXBehaviorVelocityNoise.js +0 -76
- package/dist/emitter/behavior/FXBehaviorVelocityOverLife.d.ts +0 -22
- package/dist/emitter/behavior/FXBehaviorVelocityOverLife.js +0 -55
- package/dist/emitter/spawn/FXSpawn.d.ts +0 -11
- package/dist/emitter/spawn/FXSpawn.js +0 -10
- package/dist/emitter/spawn/FXSpawnBox.d.ts +0 -18
- package/dist/emitter/spawn/FXSpawnBox.js +0 -50
- package/dist/emitter/spawn/FXSpawnLifetime.d.ts +0 -17
- package/dist/emitter/spawn/FXSpawnLifetime.js +0 -44
- package/dist/emitter/spawn/FXSpawnOffset.d.ts +0 -21
- package/dist/emitter/spawn/FXSpawnOffset.js +0 -49
- package/dist/emitter/spawn/FXSpawnPoint.d.ts +0 -18
- package/dist/emitter/spawn/FXSpawnPoint.js +0 -46
- package/dist/emitter/spawn/FXSpawnRotation.d.ts +0 -17
- package/dist/emitter/spawn/FXSpawnRotation.js +0 -42
- package/dist/emitter/spawn/FXSpawnScale.d.ts +0 -22
- package/dist/emitter/spawn/FXSpawnScale.js +0 -56
- package/dist/emitter/spawn/FXSpawnSphere.d.ts +0 -36
- package/dist/emitter/spawn/FXSpawnSphere.js +0 -87
- package/dist/emitter/spawn/FXSpawnTorque.d.ts +0 -17
- package/dist/emitter/spawn/FXSpawnTorque.js +0 -42
- package/dist/emitter/spawn/FXSpawnVelocity.d.ts +0 -29
- package/dist/emitter/spawn/FXSpawnVelocity.js +0 -91
- package/dist/instancedParticle/FXInstancedParticle.Internal.d.ts +0 -2
- package/dist/instancedParticle/shared.d.ts +0 -19
- package/dist/instancedParticle/shared.js +0 -116
- package/dist/materials/FXDiffuseMaterial/FXDiffuseMaterial.Internal.d.ts +0 -24
- package/dist/materials/FXDiffuseMaterial/FXDiffuseMaterial.Internal.js +0 -275
- package/dist/materials/FXDiffuseMaterial/FXDiffuseMaterial.d.ts +0 -75
- package/dist/materials/FXDiffuseMaterial/FXDiffuseMaterial.js +0 -63
- package/dist/materials/FXMaterial/FXBlending.Internal.d.ts +0 -24
- package/dist/materials/FXMaterial/FXBlending.Internal.js +0 -64
- package/dist/materials/FXMaterial/FXDepthMaterial.Internal.d.ts +0 -4
- package/dist/materials/FXMaterial/FXDepthMaterial.Internal.js +0 -144
- package/dist/materials/FXMaterial/FXDistanceMaterial.Internal.d.ts +0 -4
- package/dist/materials/FXMaterial/FXDistanceMaterial.Internal.js +0 -175
- package/dist/materials/FXMaterial/FXMaterial.d.ts +0 -70
- package/dist/materials/FXMaterial/FXMaterial.js +0 -51
- package/dist/materials/FXUnlitMaterial/FXUnlitMaterial.Internal.d.ts +0 -7
- package/dist/materials/FXUnlitMaterial/FXUnlitMaterial.Internal.js +0 -103
- package/dist/materials/FXUnlitMaterial/FXUnlitMaterial.d.ts +0 -7
- package/dist/materials/FXUnlitMaterial/FXUnlitMaterial.js +0 -21
- package/dist/miscellaneous/color/FXColor.Internal.d.ts +0 -7
- package/dist/miscellaneous/color/FXColor.Internal.js +0 -42
- package/dist/miscellaneous/color/FXColor.d.ts +0 -234
- package/dist/miscellaneous/color/FXColor.js +0 -636
- package/dist/miscellaneous/curve/FXCurve1D.Internal.d.ts +0 -20
- package/dist/miscellaneous/curve/FXCurve1D.d.ts +0 -17
- package/dist/miscellaneous/curve/FXCurve1D.js +0 -94
- package/dist/miscellaneous/miscellaneous.d.ts +0 -34
- package/dist/miscellaneous/miscellaneous.js +0 -85
- package/dist/miscellaneous/texture/FXTextureView.Internal.d.ts +0 -49
- package/dist/miscellaneous/texture/FXTextureView.Internal.js +0 -6
- package/dist/miscellaneous/texture/FXTextureView.d.ts +0 -72
- package/dist/miscellaneous/texture/FXTextureView.js +0 -234
- package/dist/miscellaneous/webglCapabilities.d.ts +0 -1
- package/dist/miscellaneous/webglCapabilities.js +0 -45
- package/dist/node_modules/fast-simplex-noise/lib/2d.js +0 -93
- package/dist/node_modules/fast-simplex-noise/lib/3d.js +0 -142
- package/dist/node_modules/fast-simplex-noise/lib/4d.js +0 -196
- package/dist/node_modules/fast-simplex-noise/lib/mod.js +0 -24
- package/dist/nodes/FXNode.d.ts +0 -5
- package/dist/nodes/FXNode.js +0 -10
- package/dist/nodes/blending/FXNodeBlending.d.ts +0 -6
- package/dist/nodes/blending/FXNodeBlending.js +0 -9
- package/dist/nodes/blending/FXNodeLightnessBlendingMask.d.ts +0 -19
- package/dist/nodes/blending/FXNodeLightnessBlendingMask.js +0 -65
- package/dist/nodes/color/FXNodeColor.d.ts +0 -6
- package/dist/nodes/color/FXNodeColor.js +0 -9
- package/dist/nodes/color/FXNodeColorOverLife.d.ts +0 -22
- package/dist/nodes/color/FXNodeColorOverLife.js +0 -64
- package/dist/nodes/color/FXNodeSphericalClip.d.ts +0 -21
- package/dist/nodes/color/FXNodeSphericalClip.js +0 -54
- package/dist/nodes/normal/FXNodeFlatNormal.d.ts +0 -6
- package/dist/nodes/normal/FXNodeFlatNormal.js +0 -16
- package/dist/nodes/normal/FXNodeNormal.d.ts +0 -6
- package/dist/nodes/normal/FXNodeNormal.js +0 -9
- package/dist/nodes/normal/FXNodeSphericalNormal.d.ts +0 -6
- package/dist/nodes/normal/FXNodeSphericalNormal.js +0 -23
- package/dist/nodes/texture/FXNodeAnimatedTexture.d.ts +0 -52
- package/dist/nodes/texture/FXNodeAnimatedTexture.js +0 -151
- package/dist/nodes/texture/FXNodeStaticTexture.d.ts +0 -20
- package/dist/nodes/texture/FXNodeStaticTexture.js +0 -67
- package/dist/nodes/texture/FXNodeTexture.d.ts +0 -6
- package/dist/nodes/texture/FXNodeTexture.js +0 -9
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { FXRange, FXRangeConfig } from "../../miscellaneous/miscellaneous";
|
|
2
|
-
import { FXBehavior } from "./FXBehavior";
|
|
3
|
-
/**
|
|
4
|
-
* Applies noise-based acceleration to particles
|
|
5
|
-
*
|
|
6
|
-
* @remarks
|
|
7
|
-
* Higher `scale` values produce finer noise detail.
|
|
8
|
-
*/
|
|
9
|
-
export declare class FXBehaviorVelocityNoise extends FXBehavior<{
|
|
10
|
-
builtin: "Matrix4";
|
|
11
|
-
}> {
|
|
12
|
-
private scaleInternal;
|
|
13
|
-
private strengthInternal;
|
|
14
|
-
/**
|
|
15
|
-
* @param scale - Noise frequency range; must be positive.
|
|
16
|
-
* @param strength - Force multiplier range; must be non-negative.
|
|
17
|
-
*/
|
|
18
|
-
constructor(scale: FXRangeConfig, strength: FXRangeConfig);
|
|
19
|
-
/** Noise frequency range */
|
|
20
|
-
get scale(): FXRange;
|
|
21
|
-
/** Force multiplier range */
|
|
22
|
-
get strength(): FXRange;
|
|
23
|
-
set scale(value: FXRangeConfig);
|
|
24
|
-
set strength(value: FXRangeConfig);
|
|
25
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
import { m as modExports } from '../../_virtual/mod.js';
|
|
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 { FXBehavior } from './FXBehavior.js';
|
|
6
|
-
|
|
7
|
-
const generateNoise3D0 = modExports.makeNoise3D();
|
|
8
|
-
const generateNoise3D1 = modExports.makeNoise3D();
|
|
9
|
-
const generateNoise3D2 = modExports.makeNoise3D();
|
|
10
|
-
/**
|
|
11
|
-
* Applies noise-based acceleration to particles
|
|
12
|
-
*
|
|
13
|
-
* @remarks
|
|
14
|
-
* Higher `scale` values produce finer noise detail.
|
|
15
|
-
*/
|
|
16
|
-
class FXBehaviorVelocityNoise extends FXBehavior {
|
|
17
|
-
/**
|
|
18
|
-
* @param scale - Noise frequency range; must be positive.
|
|
19
|
-
* @param strength - Force multiplier range; must be non-negative.
|
|
20
|
-
*/
|
|
21
|
-
constructor(scale, strength) {
|
|
22
|
-
super();
|
|
23
|
-
/** @internal */
|
|
24
|
-
this.requiredProperties = { builtin: "Matrix4" };
|
|
25
|
-
this._private_scaleInternal = resolveFXRangeConfig(scale);
|
|
26
|
-
assertValidPositiveNumber(this._private_scaleInternal.min, `FXBehaviorVelocityNoise.constructor.scale.min`);
|
|
27
|
-
assertValidPositiveNumber(this._private_scaleInternal.max, `FXBehaviorVelocityNoise.constructor.scale.max`);
|
|
28
|
-
this._private_strengthInternal = resolveFXRangeConfig(strength);
|
|
29
|
-
assertValidNonNegativeNumber(this._private_strengthInternal.min, `FXBehaviorVelocityNoise.constructor.strength.min`);
|
|
30
|
-
assertValidNonNegativeNumber(this._private_strengthInternal.max, `FXBehaviorVelocityNoise.constructor.strength.max`);
|
|
31
|
-
}
|
|
32
|
-
/** Noise frequency range */
|
|
33
|
-
get scale() {
|
|
34
|
-
return this._private_scaleInternal;
|
|
35
|
-
}
|
|
36
|
-
/** Force multiplier range */
|
|
37
|
-
get strength() {
|
|
38
|
-
return this._private_strengthInternal;
|
|
39
|
-
}
|
|
40
|
-
set scale(value) {
|
|
41
|
-
this._private_scaleInternal = resolveFXRangeConfig(value);
|
|
42
|
-
assertValidPositiveNumber(this._private_scaleInternal.min, `FXBehaviorVelocityNoise.scale.min`);
|
|
43
|
-
assertValidPositiveNumber(this._private_scaleInternal.max, `FXBehaviorVelocityNoise.scale.max`);
|
|
44
|
-
}
|
|
45
|
-
set strength(value) {
|
|
46
|
-
this._private_strengthInternal = resolveFXRangeConfig(value);
|
|
47
|
-
assertValidNonNegativeNumber(this._private_strengthInternal.min, `FXBehaviorVelocityNoise.strength.min`);
|
|
48
|
-
assertValidNonNegativeNumber(this._private_strengthInternal.max, `FXBehaviorVelocityNoise.strength.max`);
|
|
49
|
-
}
|
|
50
|
-
/** @internal */
|
|
51
|
-
update(properties, instanceCount, deltaTime) {
|
|
52
|
-
const { builtin } = properties;
|
|
53
|
-
const { array, itemSize } = builtin;
|
|
54
|
-
for (let i = 0; i < instanceCount; i++) {
|
|
55
|
-
const itemOffset = i * itemSize;
|
|
56
|
-
const x = array[itemOffset + BUILTIN_OFFSET_POSITION_X];
|
|
57
|
-
const y = array[itemOffset + BUILTIN_OFFSET_POSITION_Y];
|
|
58
|
-
const z = array[itemOffset + BUILTIN_OFFSET_POSITION_Z];
|
|
59
|
-
// Constant over the life of a particle but different for each particle
|
|
60
|
-
const scaleT = array[itemOffset + BUILTIN_OFFSET_RANDOM_C];
|
|
61
|
-
const scale = MathUtils.lerp(this._private_scaleInternal.min, this._private_scaleInternal.max, scaleT);
|
|
62
|
-
const noiseX = generateNoise3D0(x * scale, y * scale, z * scale);
|
|
63
|
-
const noiseY = generateNoise3D1(x * scale, y * scale, z * scale);
|
|
64
|
-
const noiseZ = generateNoise3D2(x * scale, y * scale, z * scale);
|
|
65
|
-
// Constant over the life of a particle but different for each particle
|
|
66
|
-
const strengthT = array[itemOffset + BUILTIN_OFFSET_RANDOM_A];
|
|
67
|
-
const strength = MathUtils.lerp(this._private_strengthInternal.min, this._private_strengthInternal.max, strengthT);
|
|
68
|
-
array[itemOffset + BUILTIN_OFFSET_VELOCITY_X] += noiseX * strength * deltaTime;
|
|
69
|
-
array[itemOffset + BUILTIN_OFFSET_VELOCITY_Y] += noiseY * strength * deltaTime;
|
|
70
|
-
array[itemOffset + BUILTIN_OFFSET_VELOCITY_Z] += noiseZ * strength * deltaTime;
|
|
71
|
-
}
|
|
72
|
-
builtin.needsUpdate = true;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export { FXBehaviorVelocityNoise };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { FXCurve1DConfig } from "../../miscellaneous/curve/FXCurve1D";
|
|
2
|
-
import { FXCurve1D } from "../../miscellaneous/curve/FXCurve1D";
|
|
3
|
-
import type { FXRange } from "../../miscellaneous/miscellaneous";
|
|
4
|
-
import { FXBehavior } from "./FXBehavior";
|
|
5
|
-
/**
|
|
6
|
-
* Animates particle speed over lifetime using a {@link FXCurve1D}
|
|
7
|
-
*
|
|
8
|
-
* @remarks
|
|
9
|
-
* Particles with zero velocity are not affected.
|
|
10
|
-
*/
|
|
11
|
-
export declare class FXBehaviorVelocityOverLife extends FXBehavior<{
|
|
12
|
-
builtin: "Matrix4";
|
|
13
|
-
}> {
|
|
14
|
-
private curveInternal;
|
|
15
|
-
/**
|
|
16
|
-
* @param curve - Speed curve; accepts a {@link FXCurve1D} instance or a `FXRange[]` shorthand
|
|
17
|
-
*/
|
|
18
|
-
constructor(curve: FXCurve1DConfig<FXRange>);
|
|
19
|
-
/** Active speed curve */
|
|
20
|
-
get curve(): FXCurve1D<FXRange>;
|
|
21
|
-
set curve(value: FXCurve1DConfig<FXRange>);
|
|
22
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { MathUtils } from 'three';
|
|
2
|
-
import { FXCurve1D } from '../../miscellaneous/curve/FXCurve1D.js';
|
|
3
|
-
import { BUILTIN_OFFSET_AGE, BUILTIN_OFFSET_LIFETIME, BUILTIN_OFFSET_VELOCITY_X, BUILTIN_OFFSET_VELOCITY_Y, BUILTIN_OFFSET_VELOCITY_Z, BUILTIN_OFFSET_RANDOM_A } from '../../miscellaneous/miscellaneous.js';
|
|
4
|
-
import { FXBehavior } from './FXBehavior.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Animates particle speed over lifetime using a {@link FXCurve1D}
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* Particles with zero velocity are not affected.
|
|
11
|
-
*/
|
|
12
|
-
class FXBehaviorVelocityOverLife extends FXBehavior {
|
|
13
|
-
/**
|
|
14
|
-
* @param curve - Speed curve; accepts a {@link FXCurve1D} instance or a `FXRange[]` shorthand
|
|
15
|
-
*/
|
|
16
|
-
constructor(curve) {
|
|
17
|
-
super();
|
|
18
|
-
/** @internal */
|
|
19
|
-
this.requiredProperties = { builtin: "Matrix4" };
|
|
20
|
-
this._private_curveInternal = new FXCurve1D(curve);
|
|
21
|
-
}
|
|
22
|
-
/** Active speed curve */
|
|
23
|
-
get curve() {
|
|
24
|
-
return this._private_curveInternal;
|
|
25
|
-
}
|
|
26
|
-
set curve(value) {
|
|
27
|
-
this._private_curveInternal = new FXCurve1D(value);
|
|
28
|
-
}
|
|
29
|
-
/** @internal */
|
|
30
|
-
update(properties, instanceCount) {
|
|
31
|
-
const { builtin } = properties;
|
|
32
|
-
const { array, itemSize } = builtin;
|
|
33
|
-
for (let i = 0; i < instanceCount; i++) {
|
|
34
|
-
const itemOffset = i * itemSize;
|
|
35
|
-
const lifeT = Math.min(array[itemOffset + BUILTIN_OFFSET_AGE] / array[itemOffset + BUILTIN_OFFSET_LIFETIME], 1);
|
|
36
|
-
const velocityX = array[itemOffset + BUILTIN_OFFSET_VELOCITY_X];
|
|
37
|
-
const velocityY = array[itemOffset + BUILTIN_OFFSET_VELOCITY_Y];
|
|
38
|
-
const velocityZ = array[itemOffset + BUILTIN_OFFSET_VELOCITY_Z];
|
|
39
|
-
const currentSpeed = Math.sqrt(velocityX * velocityX + velocityY * velocityY + velocityZ * velocityZ);
|
|
40
|
-
if (currentSpeed === 0) {
|
|
41
|
-
continue;
|
|
42
|
-
}
|
|
43
|
-
const velocityT = array[itemOffset + BUILTIN_OFFSET_RANDOM_A];
|
|
44
|
-
const { a, b, t: localT } = this._private_curveInternal.sample(lifeT);
|
|
45
|
-
const targetSpeed = MathUtils.lerp(MathUtils.lerp(a.min, a.max, velocityT), MathUtils.lerp(b.min, b.max, velocityT), localT);
|
|
46
|
-
const scaleFactor = targetSpeed / currentSpeed;
|
|
47
|
-
array[itemOffset + BUILTIN_OFFSET_VELOCITY_X] = velocityX * scaleFactor;
|
|
48
|
-
array[itemOffset + BUILTIN_OFFSET_VELOCITY_Y] = velocityY * scaleFactor;
|
|
49
|
-
array[itemOffset + BUILTIN_OFFSET_VELOCITY_Z] = velocityZ * scaleFactor;
|
|
50
|
-
}
|
|
51
|
-
builtin.needsUpdate = true;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export { FXBehaviorVelocityOverLife };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { FXPropertyName } from "../../instancedParticle/shared";
|
|
2
|
-
/**
|
|
3
|
-
* Abstract base for particle spawn modules that initialize per-particle properties at birth
|
|
4
|
-
*
|
|
5
|
-
* @typeParam T - Map of local property keys to {@link FXPropertyName} identifiers,
|
|
6
|
-
* declaring which particle attributes this spawn module writes
|
|
7
|
-
*/
|
|
8
|
-
export declare abstract class FXSpawn<T extends Record<string, FXPropertyName> = Record<string, FXPropertyName>> {
|
|
9
|
-
/** Releases any resources held by this spawn module */
|
|
10
|
-
destroy?(): void;
|
|
11
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Abstract base for particle spawn modules that initialize per-particle properties at birth
|
|
3
|
-
*
|
|
4
|
-
* @typeParam T - Map of local property keys to {@link FXPropertyName} identifiers,
|
|
5
|
-
* declaring which particle attributes this spawn module writes
|
|
6
|
-
*/
|
|
7
|
-
class FXSpawn {
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export { FXSpawn };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Vector3Like } from "../../miscellaneous/math";
|
|
2
|
-
import type { FXVector3Config } from "../../miscellaneous/miscellaneous";
|
|
3
|
-
import { FXSpawn } from "./FXSpawn";
|
|
4
|
-
/**
|
|
5
|
-
* Spawns particles at random positions within an axis-aligned bounding box centered at the origin
|
|
6
|
-
*/
|
|
7
|
-
export declare class FXSpawnBox extends FXSpawn<{
|
|
8
|
-
builtin: "Matrix4";
|
|
9
|
-
}> {
|
|
10
|
-
private sizeInternal;
|
|
11
|
-
/**
|
|
12
|
-
* @param size - Dimensions of the spawn box. Defaults to `{ x: 1, y: 1, z: 1 }`
|
|
13
|
-
*/
|
|
14
|
-
constructor(size?: FXVector3Config);
|
|
15
|
-
/** Size of the spawn box */
|
|
16
|
-
get size(): Vector3Like;
|
|
17
|
-
set size(value: FXVector3Config);
|
|
18
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
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 { FXSpawn } from './FXSpawn.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Spawns particles at random positions within an axis-aligned bounding box centered at the origin
|
|
8
|
-
*/
|
|
9
|
-
class FXSpawnBox extends FXSpawn {
|
|
10
|
-
/**
|
|
11
|
-
* @param size - Dimensions of the spawn box. Defaults to `{ x: 1, y: 1, z: 1 }`
|
|
12
|
-
*/
|
|
13
|
-
constructor(size = { x: 1, y: 1, z: 1 }) {
|
|
14
|
-
super();
|
|
15
|
-
/** @internal */
|
|
16
|
-
this.requiredProperties = { builtin: "Matrix4" };
|
|
17
|
-
this._private_sizeInternal = resolveFXVector3Config(size);
|
|
18
|
-
assertValidNumber(this._private_sizeInternal.x, "FXSpawnBox.constructor.size.x");
|
|
19
|
-
assertValidNumber(this._private_sizeInternal.y, "FXSpawnBox.constructor.size.y");
|
|
20
|
-
assertValidNumber(this._private_sizeInternal.z, "FXSpawnBox.constructor.size.z");
|
|
21
|
-
}
|
|
22
|
-
/** Size of the spawn box */
|
|
23
|
-
get size() {
|
|
24
|
-
return this._private_sizeInternal;
|
|
25
|
-
}
|
|
26
|
-
set size(value) {
|
|
27
|
-
this._private_sizeInternal = resolveFXVector3Config(value);
|
|
28
|
-
assertValidNumber(this._private_sizeInternal.x, "FXSpawnBox.size.x");
|
|
29
|
-
assertValidNumber(this._private_sizeInternal.y, "FXSpawnBox.size.y");
|
|
30
|
-
assertValidNumber(this._private_sizeInternal.z, "FXSpawnBox.size.z");
|
|
31
|
-
}
|
|
32
|
-
/** @internal */
|
|
33
|
-
spawn(properties, instanceBegin, instanceEnd) {
|
|
34
|
-
const { builtin } = properties;
|
|
35
|
-
const { array, itemSize } = builtin;
|
|
36
|
-
const { x: sizeX, y: sizeY, z: sizeZ } = this._private_sizeInternal;
|
|
37
|
-
const halfX = sizeX * 0.5;
|
|
38
|
-
const halfY = sizeY * 0.5;
|
|
39
|
-
const halfZ = sizeZ * 0.5;
|
|
40
|
-
for (let i = instanceBegin; i < instanceEnd; i++) {
|
|
41
|
-
const itemOffset = i * itemSize;
|
|
42
|
-
array[itemOffset + BUILTIN_OFFSET_POSITION_X] = MathUtils.randFloat(-halfX, halfX);
|
|
43
|
-
array[itemOffset + BUILTIN_OFFSET_POSITION_Y] = MathUtils.randFloat(-halfY, halfY);
|
|
44
|
-
array[itemOffset + BUILTIN_OFFSET_POSITION_Z] = MathUtils.randFloat(-halfZ, halfZ);
|
|
45
|
-
}
|
|
46
|
-
builtin.needsUpdate = true;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export { FXSpawnBox };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { FXRange, FXRangeConfig } from "../../miscellaneous/miscellaneous";
|
|
2
|
-
import { FXSpawn } from "./FXSpawn";
|
|
3
|
-
/**
|
|
4
|
-
* Assigns a random lifetime to each spawned particle
|
|
5
|
-
*/
|
|
6
|
-
export declare class FXSpawnLifetime extends FXSpawn<{
|
|
7
|
-
builtin: "Matrix4";
|
|
8
|
-
}> {
|
|
9
|
-
private lifetimeInternal;
|
|
10
|
-
/**
|
|
11
|
-
* @param lifetime - Lifetime range in seconds; must be positive. Defaults to `{ min: 4, max: 8 }`
|
|
12
|
-
*/
|
|
13
|
-
constructor(lifetime?: FXRangeConfig);
|
|
14
|
-
/** Lifetime range in seconds */
|
|
15
|
-
get lifetime(): FXRange;
|
|
16
|
-
set lifetime(value: FXRangeConfig);
|
|
17
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
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 { FXSpawn } from './FXSpawn.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Assigns a random lifetime to each spawned particle
|
|
8
|
-
*/
|
|
9
|
-
class FXSpawnLifetime extends FXSpawn {
|
|
10
|
-
/**
|
|
11
|
-
* @param lifetime - Lifetime range in seconds; must be positive. Defaults to `{ min: 4, max: 8 }`
|
|
12
|
-
*/
|
|
13
|
-
constructor(lifetime = { min: 4, max: 8 }) {
|
|
14
|
-
super();
|
|
15
|
-
/** @internal */
|
|
16
|
-
this.requiredProperties = { builtin: "Matrix4" };
|
|
17
|
-
this._private_lifetimeInternal = resolveFXRangeConfig(lifetime);
|
|
18
|
-
assertValidPositiveNumber(this._private_lifetimeInternal.min, "FXSpawnLifetime.constructor.lifetime.min");
|
|
19
|
-
assertValidPositiveNumber(this._private_lifetimeInternal.max, "FXSpawnLifetime.constructor.lifetime.max");
|
|
20
|
-
}
|
|
21
|
-
/** Lifetime range in seconds */
|
|
22
|
-
get lifetime() {
|
|
23
|
-
return this._private_lifetimeInternal;
|
|
24
|
-
}
|
|
25
|
-
set lifetime(value) {
|
|
26
|
-
this._private_lifetimeInternal = resolveFXRangeConfig(value);
|
|
27
|
-
assertValidPositiveNumber(this._private_lifetimeInternal.min, "FXSpawnLifetime.lifetime.min");
|
|
28
|
-
assertValidPositiveNumber(this._private_lifetimeInternal.max, "FXSpawnLifetime.lifetime.max");
|
|
29
|
-
}
|
|
30
|
-
/** @internal */
|
|
31
|
-
spawn(properties, instanceBegin, instanceEnd) {
|
|
32
|
-
const { builtin } = properties;
|
|
33
|
-
const { array, itemSize } = builtin;
|
|
34
|
-
const { min: lifetimeMin, max: lifetimeMax } = this._private_lifetimeInternal;
|
|
35
|
-
for (let i = instanceBegin; i < instanceEnd; i++) {
|
|
36
|
-
const itemOffset = i * itemSize;
|
|
37
|
-
array[itemOffset + BUILTIN_OFFSET_LIFETIME] = MathUtils.randFloat(lifetimeMin, lifetimeMax);
|
|
38
|
-
array[itemOffset + BUILTIN_OFFSET_AGE] = 0;
|
|
39
|
-
}
|
|
40
|
-
builtin.needsUpdate = true;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export { FXSpawnLifetime };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { Vector3Like } from "../../miscellaneous/math";
|
|
2
|
-
import type { FXVector3Config } from "../../miscellaneous/miscellaneous";
|
|
3
|
-
import { FXSpawn } from "./FXSpawn";
|
|
4
|
-
/**
|
|
5
|
-
* Shifts particle spawn positions by a fixed offset
|
|
6
|
-
*
|
|
7
|
-
* @remarks
|
|
8
|
-
* Adds to the position set by any preceding spawn step rather than overwriting it.
|
|
9
|
-
*/
|
|
10
|
-
export declare class FXSpawnOffset extends FXSpawn<{
|
|
11
|
-
builtin: "Matrix4";
|
|
12
|
-
}> {
|
|
13
|
-
private offsetInternal;
|
|
14
|
-
/**
|
|
15
|
-
* @param offset - Position offset applied to each spawned particle. Defaults to `{ x: 0, y: 0, z: 0 }`
|
|
16
|
-
*/
|
|
17
|
-
constructor(offset?: FXVector3Config);
|
|
18
|
-
/** Particle position offset */
|
|
19
|
-
get offset(): Vector3Like;
|
|
20
|
-
set offset(value: FXVector3Config);
|
|
21
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
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
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Shifts particle spawn positions by a fixed offset
|
|
7
|
-
*
|
|
8
|
-
* @remarks
|
|
9
|
-
* Adds to the position set by any preceding spawn step rather than overwriting it.
|
|
10
|
-
*/
|
|
11
|
-
class FXSpawnOffset extends FXSpawn {
|
|
12
|
-
/**
|
|
13
|
-
* @param offset - Position offset applied to each spawned particle. Defaults to `{ x: 0, y: 0, z: 0 }`
|
|
14
|
-
*/
|
|
15
|
-
constructor(offset = { x: 0, y: 0, z: 0 }) {
|
|
16
|
-
super();
|
|
17
|
-
/** @internal */
|
|
18
|
-
this.requiredProperties = { builtin: "Matrix4" };
|
|
19
|
-
this._private_offsetInternal = resolveFXVector3Config(offset);
|
|
20
|
-
assertValidNumber(this._private_offsetInternal.x, "FXSpawnOffset.constructor.offset.x");
|
|
21
|
-
assertValidNumber(this._private_offsetInternal.y, "FXSpawnOffset.constructor.offset.y");
|
|
22
|
-
assertValidNumber(this._private_offsetInternal.z, "FXSpawnOffset.constructor.offset.z");
|
|
23
|
-
}
|
|
24
|
-
/** Particle position offset */
|
|
25
|
-
get offset() {
|
|
26
|
-
return this._private_offsetInternal;
|
|
27
|
-
}
|
|
28
|
-
set offset(value) {
|
|
29
|
-
this._private_offsetInternal = resolveFXVector3Config(value);
|
|
30
|
-
assertValidNumber(this._private_offsetInternal.x, "FXSpawnOffset.offset.x");
|
|
31
|
-
assertValidNumber(this._private_offsetInternal.y, "FXSpawnOffset.offset.y");
|
|
32
|
-
assertValidNumber(this._private_offsetInternal.z, "FXSpawnOffset.offset.z");
|
|
33
|
-
}
|
|
34
|
-
/** @internal */
|
|
35
|
-
spawn(properties, instanceBegin, instanceEnd) {
|
|
36
|
-
const { builtin } = properties;
|
|
37
|
-
const { array, itemSize } = builtin;
|
|
38
|
-
const { x: offsetX, y: offsetY, z: offsetZ } = this._private_offsetInternal;
|
|
39
|
-
for (let i = instanceBegin; i < instanceEnd; i++) {
|
|
40
|
-
const itemOffset = i * itemSize;
|
|
41
|
-
array[itemOffset + BUILTIN_OFFSET_POSITION_X] += offsetX;
|
|
42
|
-
array[itemOffset + BUILTIN_OFFSET_POSITION_Y] += offsetY;
|
|
43
|
-
array[itemOffset + BUILTIN_OFFSET_POSITION_Z] += offsetZ;
|
|
44
|
-
}
|
|
45
|
-
builtin.needsUpdate = true;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
export { FXSpawnOffset };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { Vector3Like } from "../../miscellaneous/math";
|
|
2
|
-
import type { FXVector3Config } from "../../miscellaneous/miscellaneous";
|
|
3
|
-
import { FXSpawn } from "./FXSpawn";
|
|
4
|
-
/**
|
|
5
|
-
* Spawns all particles at a single fixed position
|
|
6
|
-
*/
|
|
7
|
-
export declare class FXSpawnPoint extends FXSpawn<{
|
|
8
|
-
builtin: "Matrix4";
|
|
9
|
-
}> {
|
|
10
|
-
private positionInternal;
|
|
11
|
-
/**
|
|
12
|
-
* @param position - World-space spawn position. Defaults to `{ x: 0, y: 0, z: 0 }`
|
|
13
|
-
*/
|
|
14
|
-
constructor(position?: FXVector3Config);
|
|
15
|
-
/** Spawn position */
|
|
16
|
-
get position(): Vector3Like;
|
|
17
|
-
set position(value: FXVector3Config);
|
|
18
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
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
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Spawns all particles at a single fixed position
|
|
7
|
-
*/
|
|
8
|
-
class FXSpawnPoint extends FXSpawn {
|
|
9
|
-
/**
|
|
10
|
-
* @param position - World-space spawn position. Defaults to `{ x: 0, y: 0, z: 0 }`
|
|
11
|
-
*/
|
|
12
|
-
constructor(position = { x: 0, y: 0, z: 0 }) {
|
|
13
|
-
super();
|
|
14
|
-
/** @internal */
|
|
15
|
-
this.requiredProperties = { builtin: "Matrix4" };
|
|
16
|
-
this._private_positionInternal = resolveFXVector3Config(position);
|
|
17
|
-
assertValidNumber(this._private_positionInternal.x, "FXSpawnPoint.constructor.position.x");
|
|
18
|
-
assertValidNumber(this._private_positionInternal.y, "FXSpawnPoint.constructor.position.y");
|
|
19
|
-
assertValidNumber(this._private_positionInternal.z, "FXSpawnPoint.constructor.position.z");
|
|
20
|
-
}
|
|
21
|
-
/** Spawn position */
|
|
22
|
-
get position() {
|
|
23
|
-
return this._private_positionInternal;
|
|
24
|
-
}
|
|
25
|
-
set position(value) {
|
|
26
|
-
this._private_positionInternal = resolveFXVector3Config(value);
|
|
27
|
-
assertValidNumber(this._private_positionInternal.x, "FXSpawnPoint.position.x");
|
|
28
|
-
assertValidNumber(this._private_positionInternal.y, "FXSpawnPoint.position.y");
|
|
29
|
-
assertValidNumber(this._private_positionInternal.z, "FXSpawnPoint.position.z");
|
|
30
|
-
}
|
|
31
|
-
/** @internal */
|
|
32
|
-
spawn(properties, instanceBegin, instanceEnd) {
|
|
33
|
-
const { builtin } = properties;
|
|
34
|
-
const { array, itemSize } = builtin;
|
|
35
|
-
const { x: positionX, y: positionY, z: positionZ } = this._private_positionInternal;
|
|
36
|
-
for (let i = instanceBegin; i < instanceEnd; i++) {
|
|
37
|
-
const itemOffset = i * itemSize;
|
|
38
|
-
array[itemOffset + BUILTIN_OFFSET_POSITION_X] = positionX;
|
|
39
|
-
array[itemOffset + BUILTIN_OFFSET_POSITION_Y] = positionY;
|
|
40
|
-
array[itemOffset + BUILTIN_OFFSET_POSITION_Z] = positionZ;
|
|
41
|
-
}
|
|
42
|
-
builtin.needsUpdate = true;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export { FXSpawnPoint };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import type { FXRange, FXRangeConfig } from "../../miscellaneous/miscellaneous";
|
|
2
|
-
import { FXSpawn } from "./FXSpawn";
|
|
3
|
-
/**
|
|
4
|
-
* Assigns a random initial rotation to each spawned particle
|
|
5
|
-
*/
|
|
6
|
-
export declare class FXSpawnRotation extends FXSpawn<{
|
|
7
|
-
builtin: "Matrix4";
|
|
8
|
-
}> {
|
|
9
|
-
private rotationInternal;
|
|
10
|
-
/**
|
|
11
|
-
* @param rotation - Rotation range in radians. Defaults to `{ min: -Math.PI, max: Math.PI }`
|
|
12
|
-
*/
|
|
13
|
-
constructor(rotation?: FXRangeConfig);
|
|
14
|
-
/** Rotation range in radians */
|
|
15
|
-
get rotation(): FXRange;
|
|
16
|
-
set rotation(value: FXRangeConfig);
|
|
17
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { MathUtils } from 'three';
|
|
2
|
-
import { assertValidNumber } from '../../miscellaneous/asserts.js';
|
|
3
|
-
import { resolveFXRangeConfig, BUILTIN_OFFSET_ROTATION } from '../../miscellaneous/miscellaneous.js';
|
|
4
|
-
import { FXSpawn } from './FXSpawn.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Assigns a random initial rotation to each spawned particle
|
|
8
|
-
*/
|
|
9
|
-
class FXSpawnRotation extends FXSpawn {
|
|
10
|
-
/**
|
|
11
|
-
* @param rotation - Rotation range in radians. Defaults to `{ min: -Math.PI, max: Math.PI }`
|
|
12
|
-
*/
|
|
13
|
-
constructor(rotation = { min: -Math.PI, max: Math.PI }) {
|
|
14
|
-
super();
|
|
15
|
-
/** @internal */
|
|
16
|
-
this.requiredProperties = { builtin: "Matrix4" };
|
|
17
|
-
this._private_rotationInternal = resolveFXRangeConfig(rotation);
|
|
18
|
-
assertValidNumber(this._private_rotationInternal.min, "FXSpawnRotation.constructor.rotation.min");
|
|
19
|
-
assertValidNumber(this._private_rotationInternal.max, "FXSpawnRotation.constructor.rotation.max");
|
|
20
|
-
}
|
|
21
|
-
/** Rotation range in radians */
|
|
22
|
-
get rotation() {
|
|
23
|
-
return this._private_rotationInternal;
|
|
24
|
-
}
|
|
25
|
-
set rotation(value) {
|
|
26
|
-
this._private_rotationInternal = resolveFXRangeConfig(value);
|
|
27
|
-
assertValidNumber(this._private_rotationInternal.min, "FXSpawnRotation.rotation.min");
|
|
28
|
-
assertValidNumber(this._private_rotationInternal.max, "FXSpawnRotation.rotation.max");
|
|
29
|
-
}
|
|
30
|
-
/** @internal */
|
|
31
|
-
spawn(properties, instanceBegin, instanceEnd) {
|
|
32
|
-
const { builtin } = properties;
|
|
33
|
-
const { array, itemSize } = builtin;
|
|
34
|
-
const { min: rotationMin, max: rotationMax } = this._private_rotationInternal;
|
|
35
|
-
for (let i = instanceBegin; i < instanceEnd; i++) {
|
|
36
|
-
array[i * itemSize + BUILTIN_OFFSET_ROTATION] = MathUtils.randFloat(rotationMin, rotationMax);
|
|
37
|
-
}
|
|
38
|
-
builtin.needsUpdate = true;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export { FXSpawnRotation };
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { FXAspectConfig, FXRange, FXRangeConfig } from "../../miscellaneous/miscellaneous";
|
|
2
|
-
import { FXSpawn } from "./FXSpawn";
|
|
3
|
-
/**
|
|
4
|
-
* Assigns a random initial scale to each spawned particle
|
|
5
|
-
*/
|
|
6
|
-
export declare class FXSpawnScale extends FXSpawn<{
|
|
7
|
-
builtin: "Matrix4";
|
|
8
|
-
}> {
|
|
9
|
-
private scaleInternal;
|
|
10
|
-
private aspectInternal;
|
|
11
|
-
/**
|
|
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`
|
|
14
|
-
*/
|
|
15
|
-
constructor(scale?: FXRangeConfig, aspect?: FXAspectConfig);
|
|
16
|
-
/** Base scale range */
|
|
17
|
-
get scale(): FXRange;
|
|
18
|
-
/** Width/height aspect ratio */
|
|
19
|
-
get aspect(): number;
|
|
20
|
-
set scale(value: FXRangeConfig);
|
|
21
|
-
set aspect(value: FXAspectConfig);
|
|
22
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { MathUtils } from 'three';
|
|
2
|
-
import { assertValidPositiveNumber } from '../../miscellaneous/asserts.js';
|
|
3
|
-
import { resolveFXRangeConfig, resolveAspect, BUILTIN_OFFSET_SCALE_X, BUILTIN_OFFSET_SCALE_Y } from '../../miscellaneous/miscellaneous.js';
|
|
4
|
-
import { FXSpawn } from './FXSpawn.js';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Assigns a random initial scale to each spawned particle
|
|
8
|
-
*/
|
|
9
|
-
class FXSpawnScale extends FXSpawn {
|
|
10
|
-
/**
|
|
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`
|
|
13
|
-
*/
|
|
14
|
-
constructor(scale = { min: 1, max: 2 }, aspect = 1) {
|
|
15
|
-
super();
|
|
16
|
-
/** @internal */
|
|
17
|
-
this.requiredProperties = { builtin: "Matrix4" };
|
|
18
|
-
this._private_scaleInternal = resolveFXRangeConfig(scale);
|
|
19
|
-
this._private_aspectInternal = resolveAspect(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");
|
|
23
|
-
}
|
|
24
|
-
/** Base scale range */
|
|
25
|
-
get scale() {
|
|
26
|
-
return this._private_scaleInternal;
|
|
27
|
-
}
|
|
28
|
-
/** Width/height aspect ratio */
|
|
29
|
-
get aspect() {
|
|
30
|
-
return this._private_aspectInternal;
|
|
31
|
-
}
|
|
32
|
-
set scale(value) {
|
|
33
|
-
this._private_scaleInternal = resolveFXRangeConfig(value);
|
|
34
|
-
assertValidPositiveNumber(this._private_scaleInternal.min, "FXSpawnScale.scale.min");
|
|
35
|
-
assertValidPositiveNumber(this._private_scaleInternal.max, "FXSpawnScale.scale.max");
|
|
36
|
-
}
|
|
37
|
-
set aspect(value) {
|
|
38
|
-
this._private_aspectInternal = resolveAspect(value);
|
|
39
|
-
assertValidPositiveNumber(this._private_aspectInternal, "FXSpawnScale.aspect");
|
|
40
|
-
}
|
|
41
|
-
/** @internal */
|
|
42
|
-
spawn(properties, instanceBegin, instanceEnd) {
|
|
43
|
-
const { builtin } = properties;
|
|
44
|
-
const { array, itemSize } = builtin;
|
|
45
|
-
const { min: scaleMin, max: scaleMax } = this._private_scaleInternal;
|
|
46
|
-
for (let i = instanceBegin; i < instanceEnd; i++) {
|
|
47
|
-
const itemOffset = i * itemSize;
|
|
48
|
-
const randomScale = MathUtils.randFloat(scaleMin, scaleMax);
|
|
49
|
-
array[itemOffset + BUILTIN_OFFSET_SCALE_X] = randomScale * this._private_aspectInternal;
|
|
50
|
-
array[itemOffset + BUILTIN_OFFSET_SCALE_Y] = randomScale;
|
|
51
|
-
}
|
|
52
|
-
builtin.needsUpdate = true;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export { FXSpawnScale };
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { FXSpawn } from "./FXSpawn";
|
|
2
|
-
/**
|
|
3
|
-
* Spawns particles at random positions within a spherical shell
|
|
4
|
-
*
|
|
5
|
-
* @remarks
|
|
6
|
-
* The `angle` parameter controls the polar spread from the equatorial plane:
|
|
7
|
-
* - `0` - flat disk (XZ plane only)
|
|
8
|
-
* - `Math.PI / 2` - full sphere
|
|
9
|
-
* - Values in between produce a spherical band
|
|
10
|
-
*/
|
|
11
|
-
export declare class FXSpawnSphere extends FXSpawn<{
|
|
12
|
-
builtin: "Matrix4";
|
|
13
|
-
}> {
|
|
14
|
-
private innerRadiusInternal;
|
|
15
|
-
private outerRadiusInternal;
|
|
16
|
-
private angleInternal;
|
|
17
|
-
/**
|
|
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`
|
|
21
|
-
*/
|
|
22
|
-
constructor(innerRadius?: number, outerRadius?: number, angle?: number);
|
|
23
|
-
/** Minimum spawn radius */
|
|
24
|
-
get innerRadius(): number;
|
|
25
|
-
/** Maximum spawn radius */
|
|
26
|
-
get outerRadius(): number;
|
|
27
|
-
/**
|
|
28
|
-
* Polar half-angle from the equatorial plane.
|
|
29
|
-
* - `0` - flat disk
|
|
30
|
-
* - `Math.PI / 2` - full sphere
|
|
31
|
-
*/
|
|
32
|
-
get angle(): number;
|
|
33
|
-
set innerRadius(value: number);
|
|
34
|
-
set outerRadius(value: number);
|
|
35
|
-
set angle(value: number);
|
|
36
|
-
}
|