sparcoon 0.0.4 → 0.0.6
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/behaviorModules/FXBehaviorDirectionalGravity.js +4 -4
- package/dist/behaviorModules/FXBehaviorPointGravity.js +16 -16
- package/dist/behaviorModules/FXBehaviorScaleOverLife.js +5 -5
- package/dist/behaviorModules/FXBehaviorTorqueDamping.js +4 -4
- package/dist/behaviorModules/FXBehaviorTorqueNoise.js +8 -8
- package/dist/behaviorModules/FXBehaviorVelocityDamping.js +4 -4
- package/dist/behaviorModules/FXBehaviorVelocityNoise.js +8 -8
- package/dist/color/FXColor.js +30 -30
- package/dist/instancedParticle/FXInstancedParticle.Internal.js +1 -1
- package/dist/miscellaneous/texture/FXTextureView.js +11 -11
- package/dist/spawnModules/FXSpawnBox.js +12 -12
- package/dist/spawnModules/FXSpawnOffset.js +6 -6
- package/dist/spawnModules/FXSpawnRandomLifetime.js +4 -4
- package/dist/spawnModules/FXSpawnRandomRotation.js +4 -4
- package/dist/spawnModules/FXSpawnRandomScale.js +6 -6
- package/dist/spawnModules/FXSpawnRandomTorque.js +4 -4
- package/package.json +1 -1
|
@@ -16,8 +16,8 @@ class FXBehaviorDirectionalGravity extends FXBehaviorModule {
|
|
|
16
16
|
/** @internal */
|
|
17
17
|
this.requiredProperties = { builtin: "Matrix4" };
|
|
18
18
|
this._private_directionInternal = resolveFXVector2Config(direction);
|
|
19
|
-
assertValidNumber(this._private_directionInternal.x, "
|
|
20
|
-
assertValidNumber(this._private_directionInternal.y, "
|
|
19
|
+
assertValidNumber(this._private_directionInternal.x, "FXBehaviorDirectionalGravity.constructor.direction.x");
|
|
20
|
+
assertValidNumber(this._private_directionInternal.y, "FXBehaviorDirectionalGravity.constructor.direction.y");
|
|
21
21
|
}
|
|
22
22
|
/** Acceleration vector in units/second² */
|
|
23
23
|
get direction() {
|
|
@@ -26,8 +26,8 @@ class FXBehaviorDirectionalGravity extends FXBehaviorModule {
|
|
|
26
26
|
/** Acceleration vector in units/second² */
|
|
27
27
|
set direction(value) {
|
|
28
28
|
this._private_directionInternal = resolveFXVector2Config(value);
|
|
29
|
-
assertValidNumber(this._private_directionInternal.x, "
|
|
30
|
-
assertValidNumber(this._private_directionInternal.y, "
|
|
29
|
+
assertValidNumber(this._private_directionInternal.x, "FXBehaviorDirectionalGravity.direction.x");
|
|
30
|
+
assertValidNumber(this._private_directionInternal.y, "FXBehaviorDirectionalGravity.direction.y");
|
|
31
31
|
}
|
|
32
32
|
/** @internal */
|
|
33
33
|
update(properties, instanceCount, deltaTime) {
|
|
@@ -20,17 +20,17 @@ class FXBehaviorPointGravity extends FXBehaviorModule {
|
|
|
20
20
|
/** @internal */
|
|
21
21
|
this.requiredProperties = { builtin: "Matrix4" };
|
|
22
22
|
this._private_centerInternal = resolveFXVector2Config(center);
|
|
23
|
-
assertValidNumber(this._private_centerInternal.x, "
|
|
24
|
-
assertValidNumber(this._private_centerInternal.y, "
|
|
23
|
+
assertValidNumber(this._private_centerInternal.x, "FXBehaviorPointGravity.constructor.center.x");
|
|
24
|
+
assertValidNumber(this._private_centerInternal.y, "FXBehaviorPointGravity.constructor.center.y");
|
|
25
25
|
this._private_strengthInternal = resolveFXRangeConfig(strength);
|
|
26
|
-
assertValidNumber(this._private_strengthInternal.min, "
|
|
27
|
-
assertValidNumber(this._private_strengthInternal.max, "
|
|
26
|
+
assertValidNumber(this._private_strengthInternal.min, "FXBehaviorPointGravity.constructor.strength.min");
|
|
27
|
+
assertValidNumber(this._private_strengthInternal.max, "FXBehaviorPointGravity.constructor.strength.max");
|
|
28
28
|
this._private_exponentInternal = resolveFXRangeConfig(exponent);
|
|
29
|
-
assertValidNumber(this._private_exponentInternal.min, "
|
|
30
|
-
assertValidNumber(this._private_exponentInternal.max, "
|
|
29
|
+
assertValidNumber(this._private_exponentInternal.min, "FXBehaviorPointGravity.constructor.exponent.min");
|
|
30
|
+
assertValidNumber(this._private_exponentInternal.max, "FXBehaviorPointGravity.constructor.exponent.max");
|
|
31
31
|
this._private_thresholdInternal = resolveFXRangeConfig(threshold);
|
|
32
|
-
assertValidNumber(this._private_thresholdInternal.min, "
|
|
33
|
-
assertValidNumber(this._private_thresholdInternal.max, "
|
|
32
|
+
assertValidNumber(this._private_thresholdInternal.min, "FXBehaviorPointGravity.constructor.threshold.min");
|
|
33
|
+
assertValidNumber(this._private_thresholdInternal.max, "FXBehaviorPointGravity.constructor.threshold.max");
|
|
34
34
|
}
|
|
35
35
|
/** Gravity center position */
|
|
36
36
|
get center() {
|
|
@@ -51,26 +51,26 @@ class FXBehaviorPointGravity extends FXBehaviorModule {
|
|
|
51
51
|
/** Gravity center position */
|
|
52
52
|
set center(value) {
|
|
53
53
|
this._private_centerInternal = resolveFXVector2Config(value);
|
|
54
|
-
assertValidNumber(this._private_centerInternal.x, "
|
|
55
|
-
assertValidNumber(this._private_centerInternal.y, "
|
|
54
|
+
assertValidNumber(this._private_centerInternal.x, "FXBehaviorPointGravity.center.x");
|
|
55
|
+
assertValidNumber(this._private_centerInternal.y, "FXBehaviorPointGravity.center.y");
|
|
56
56
|
}
|
|
57
57
|
/** Force multiplier range */
|
|
58
58
|
set strength(value) {
|
|
59
59
|
this._private_strengthInternal = resolveFXRangeConfig(value);
|
|
60
|
-
assertValidNumber(this._private_strengthInternal.min, "
|
|
61
|
-
assertValidNumber(this._private_strengthInternal.max, "
|
|
60
|
+
assertValidNumber(this._private_strengthInternal.min, "FXBehaviorPointGravity.strength.min");
|
|
61
|
+
assertValidNumber(this._private_strengthInternal.max, "FXBehaviorPointGravity.strength.max");
|
|
62
62
|
}
|
|
63
63
|
/** Distance power exponent range */
|
|
64
64
|
set exponent(value) {
|
|
65
65
|
this._private_exponentInternal = resolveFXRangeConfig(value);
|
|
66
|
-
assertValidNumber(this._private_exponentInternal.min, "
|
|
67
|
-
assertValidNumber(this._private_exponentInternal.max, "
|
|
66
|
+
assertValidNumber(this._private_exponentInternal.min, "FXBehaviorPointGravity.exponent.min");
|
|
67
|
+
assertValidNumber(this._private_exponentInternal.max, "FXBehaviorPointGravity.exponent.max");
|
|
68
68
|
}
|
|
69
69
|
/** Minimum distance range */
|
|
70
70
|
set threshold(value) {
|
|
71
71
|
this._private_thresholdInternal = resolveFXRangeConfig(value);
|
|
72
|
-
assertValidNumber(this._private_thresholdInternal.min, "
|
|
73
|
-
assertValidNumber(this._private_thresholdInternal.max, "
|
|
72
|
+
assertValidNumber(this._private_thresholdInternal.min, "FXBehaviorPointGravity.threshold.min");
|
|
73
|
+
assertValidNumber(this._private_thresholdInternal.max, "FXBehaviorPointGravity.threshold.max");
|
|
74
74
|
}
|
|
75
75
|
/** @internal */
|
|
76
76
|
update(properties, instanceCount, deltaTime) {
|
|
@@ -19,16 +19,16 @@ class FXBehaviorScaleOverLife extends FXBehaviorModule {
|
|
|
19
19
|
this.requiredProperties = { builtin: "Matrix4" };
|
|
20
20
|
this._private_scales = [];
|
|
21
21
|
if (scales.length < 2) {
|
|
22
|
-
throw new Error("
|
|
22
|
+
throw new Error("FXBehaviorScaleOverLife.scales: the number of scale anchors must be more than two");
|
|
23
23
|
}
|
|
24
24
|
for (let i = 0; i < scales.length; i++) {
|
|
25
25
|
const scale = resolveFXRangeConfig(scales[i]);
|
|
26
|
-
assertValidNonNegativeNumber(scale.min, `
|
|
27
|
-
assertValidNonNegativeNumber(scale.max, `
|
|
26
|
+
assertValidNonNegativeNumber(scale.min, `FXBehaviorScaleOverLife.constructor.scales[${i}].min`);
|
|
27
|
+
assertValidNonNegativeNumber(scale.max, `FXBehaviorScaleOverLife.constructor.scales[${i}].max`);
|
|
28
28
|
this._private_scales.push(scale);
|
|
29
29
|
}
|
|
30
30
|
this._private_aspectInternal = resolveAspect(aspect);
|
|
31
|
-
assertValidPositiveNumber(this._private_aspectInternal, "
|
|
31
|
+
assertValidPositiveNumber(this._private_aspectInternal, "FXBehaviorScaleOverLife.constructor.aspect");
|
|
32
32
|
}
|
|
33
33
|
/** Width/height aspect ratio */
|
|
34
34
|
get aspect() {
|
|
@@ -37,7 +37,7 @@ class FXBehaviorScaleOverLife extends FXBehaviorModule {
|
|
|
37
37
|
/** Width/height aspect ratio */
|
|
38
38
|
set aspect(value) {
|
|
39
39
|
this._private_aspectInternal = resolveAspect(value);
|
|
40
|
-
assertValidPositiveNumber(this._private_aspectInternal, "
|
|
40
|
+
assertValidPositiveNumber(this._private_aspectInternal, "FXBehaviorScaleOverLife.aspect");
|
|
41
41
|
}
|
|
42
42
|
/** @internal */
|
|
43
43
|
update(properties, instanceCount) {
|
|
@@ -17,8 +17,8 @@ class FXBehaviorTorqueDamping extends FXBehaviorModule {
|
|
|
17
17
|
/** @internal */
|
|
18
18
|
this.requiredProperties = { builtin: "Matrix4" };
|
|
19
19
|
this._private_dampingInternal = resolveFXRangeConfig(damping);
|
|
20
|
-
assertValidNonNegativeNumber(this._private_dampingInternal.min, `
|
|
21
|
-
assertValidNonNegativeNumber(this._private_dampingInternal.max, `
|
|
20
|
+
assertValidNonNegativeNumber(this._private_dampingInternal.min, `FXBehaviorTorqueDamping.constructor.damping.min`);
|
|
21
|
+
assertValidNonNegativeNumber(this._private_dampingInternal.max, `FXBehaviorTorqueDamping.constructor.damping.max`);
|
|
22
22
|
}
|
|
23
23
|
/** Damping coefficient range (0-1) */
|
|
24
24
|
get damping() {
|
|
@@ -27,8 +27,8 @@ class FXBehaviorTorqueDamping extends FXBehaviorModule {
|
|
|
27
27
|
/** Damping coefficient range (0-1) */
|
|
28
28
|
set damping(value) {
|
|
29
29
|
this._private_dampingInternal = resolveFXRangeConfig(value);
|
|
30
|
-
assertValidNonNegativeNumber(this._private_dampingInternal.min, `
|
|
31
|
-
assertValidNonNegativeNumber(this._private_dampingInternal.max, `
|
|
30
|
+
assertValidNonNegativeNumber(this._private_dampingInternal.min, `FXBehaviorTorqueDamping.damping.min`);
|
|
31
|
+
assertValidNonNegativeNumber(this._private_dampingInternal.max, `FXBehaviorTorqueDamping.damping.max`);
|
|
32
32
|
}
|
|
33
33
|
/** @internal */
|
|
34
34
|
update(properties, instanceCount, deltaTime) {
|
|
@@ -18,11 +18,11 @@ class FXBehaviorTorqueNoise extends FXBehaviorModule {
|
|
|
18
18
|
/** @internal */
|
|
19
19
|
this.requiredProperties = { builtin: "Matrix4" };
|
|
20
20
|
this._private_scaleInternal = resolveFXRangeConfig(scale);
|
|
21
|
-
assertValidPositiveNumber(this._private_scaleInternal.min, `
|
|
22
|
-
assertValidPositiveNumber(this._private_scaleInternal.max, `
|
|
21
|
+
assertValidPositiveNumber(this._private_scaleInternal.min, `FXBehaviorTorqueNoise.constructor.scale.min`);
|
|
22
|
+
assertValidPositiveNumber(this._private_scaleInternal.max, `FXBehaviorTorqueNoise.constructor.scale.max`);
|
|
23
23
|
this._private_strengthInternal = resolveFXRangeConfig(strength);
|
|
24
|
-
assertValidNonNegativeNumber(this._private_strengthInternal.min, `
|
|
25
|
-
assertValidNonNegativeNumber(this._private_strengthInternal.max, `
|
|
24
|
+
assertValidNonNegativeNumber(this._private_strengthInternal.min, `FXBehaviorTorqueNoise.constructor.strength.min`);
|
|
25
|
+
assertValidNonNegativeNumber(this._private_strengthInternal.max, `FXBehaviorTorqueNoise.constructor.strength.max`);
|
|
26
26
|
}
|
|
27
27
|
/** Noise frequency range */
|
|
28
28
|
get scale() {
|
|
@@ -35,14 +35,14 @@ class FXBehaviorTorqueNoise extends FXBehaviorModule {
|
|
|
35
35
|
/** Noise frequency range */
|
|
36
36
|
set scale(value) {
|
|
37
37
|
this._private_scaleInternal = resolveFXRangeConfig(value);
|
|
38
|
-
assertValidPositiveNumber(this._private_scaleInternal.min, `
|
|
39
|
-
assertValidPositiveNumber(this._private_scaleInternal.max, `
|
|
38
|
+
assertValidPositiveNumber(this._private_scaleInternal.min, `FXBehaviorTorqueNoise.scale.min`);
|
|
39
|
+
assertValidPositiveNumber(this._private_scaleInternal.max, `FXBehaviorTorqueNoise.scale.max`);
|
|
40
40
|
}
|
|
41
41
|
/** Force multiplier range */
|
|
42
42
|
set strength(value) {
|
|
43
43
|
this._private_strengthInternal = resolveFXRangeConfig(value);
|
|
44
|
-
assertValidNonNegativeNumber(this._private_strengthInternal.min, `
|
|
45
|
-
assertValidNonNegativeNumber(this._private_strengthInternal.max, `
|
|
44
|
+
assertValidNonNegativeNumber(this._private_strengthInternal.min, `FXBehaviorTorqueNoise.strength.min`);
|
|
45
|
+
assertValidNonNegativeNumber(this._private_strengthInternal.max, `FXBehaviorTorqueNoise.strength.max`);
|
|
46
46
|
}
|
|
47
47
|
/** @internal */
|
|
48
48
|
update(properties, instanceCount, deltaTime) {
|
|
@@ -17,8 +17,8 @@ class FXBehaviorVelocityDamping extends FXBehaviorModule {
|
|
|
17
17
|
/** @internal */
|
|
18
18
|
this.requiredProperties = { builtin: "Matrix4" };
|
|
19
19
|
this._private_dampingInternal = resolveFXRangeConfig(damping);
|
|
20
|
-
assertValidNonNegativeNumber(this._private_dampingInternal.min, `
|
|
21
|
-
assertValidNonNegativeNumber(this._private_dampingInternal.max, `
|
|
20
|
+
assertValidNonNegativeNumber(this._private_dampingInternal.min, `FXBehaviorVelocityDamping.constructor.damping.min`);
|
|
21
|
+
assertValidNonNegativeNumber(this._private_dampingInternal.max, `FXBehaviorVelocityDamping.constructor.damping.max`);
|
|
22
22
|
}
|
|
23
23
|
/** Damping coefficient range (0-1) */
|
|
24
24
|
get damping() {
|
|
@@ -27,8 +27,8 @@ class FXBehaviorVelocityDamping extends FXBehaviorModule {
|
|
|
27
27
|
/** Damping coefficient range (0-1) */
|
|
28
28
|
set damping(value) {
|
|
29
29
|
this._private_dampingInternal = resolveFXRangeConfig(value);
|
|
30
|
-
assertValidNonNegativeNumber(this._private_dampingInternal.min, `
|
|
31
|
-
assertValidNonNegativeNumber(this._private_dampingInternal.max, `
|
|
30
|
+
assertValidNonNegativeNumber(this._private_dampingInternal.min, `FXBehaviorVelocityDamping.damping.min`);
|
|
31
|
+
assertValidNonNegativeNumber(this._private_dampingInternal.max, `FXBehaviorVelocityDamping.damping.max`);
|
|
32
32
|
}
|
|
33
33
|
/** @internal */
|
|
34
34
|
update(properties, instanceCount, deltaTime) {
|
|
@@ -18,11 +18,11 @@ class FXBehaviorVelocityNoise extends FXBehaviorModule {
|
|
|
18
18
|
/** @internal */
|
|
19
19
|
this.requiredProperties = { builtin: "Matrix4" };
|
|
20
20
|
this._private_scaleInternal = resolveFXRangeConfig(scale);
|
|
21
|
-
assertValidPositiveNumber(this._private_scaleInternal.min, `
|
|
22
|
-
assertValidPositiveNumber(this._private_scaleInternal.max, `
|
|
21
|
+
assertValidPositiveNumber(this._private_scaleInternal.min, `FXBehaviorVelocityNoise.constructor.scale.min`);
|
|
22
|
+
assertValidPositiveNumber(this._private_scaleInternal.max, `FXBehaviorVelocityNoise.constructor.scale.max`);
|
|
23
23
|
this._private_strengthInternal = resolveFXRangeConfig(strength);
|
|
24
|
-
assertValidNonNegativeNumber(this._private_strengthInternal.min, `
|
|
25
|
-
assertValidNonNegativeNumber(this._private_strengthInternal.max, `
|
|
24
|
+
assertValidNonNegativeNumber(this._private_strengthInternal.min, `FXBehaviorVelocityNoise.constructor.strength.min`);
|
|
25
|
+
assertValidNonNegativeNumber(this._private_strengthInternal.max, `FXBehaviorVelocityNoise.constructor.strength.max`);
|
|
26
26
|
}
|
|
27
27
|
/** Noise frequency range */
|
|
28
28
|
get scale() {
|
|
@@ -35,14 +35,14 @@ class FXBehaviorVelocityNoise extends FXBehaviorModule {
|
|
|
35
35
|
/** Noise frequency range */
|
|
36
36
|
set scale(value) {
|
|
37
37
|
this._private_scaleInternal = resolveFXRangeConfig(value);
|
|
38
|
-
assertValidPositiveNumber(this._private_scaleInternal.min, `
|
|
39
|
-
assertValidPositiveNumber(this._private_scaleInternal.max, `
|
|
38
|
+
assertValidPositiveNumber(this._private_scaleInternal.min, `FXBehaviorVelocityNoise.scale.min`);
|
|
39
|
+
assertValidPositiveNumber(this._private_scaleInternal.max, `FXBehaviorVelocityNoise.scale.max`);
|
|
40
40
|
}
|
|
41
41
|
/** Force multiplier range */
|
|
42
42
|
set strength(value) {
|
|
43
43
|
this._private_strengthInternal = resolveFXRangeConfig(value);
|
|
44
|
-
assertValidNonNegativeNumber(this._private_strengthInternal.min, `
|
|
45
|
-
assertValidNonNegativeNumber(this._private_strengthInternal.max, `
|
|
44
|
+
assertValidNonNegativeNumber(this._private_strengthInternal.min, `FXBehaviorVelocityNoise.strength.min`);
|
|
45
|
+
assertValidNonNegativeNumber(this._private_strengthInternal.max, `FXBehaviorVelocityNoise.strength.max`);
|
|
46
46
|
}
|
|
47
47
|
/** @internal */
|
|
48
48
|
update(properties, instanceCount, deltaTime) {
|
package/dist/color/FXColor.js
CHANGED
|
@@ -212,7 +212,7 @@ class FXColor {
|
|
|
212
212
|
}
|
|
213
213
|
/** Red component (0 to 1) */
|
|
214
214
|
set r(value) {
|
|
215
|
-
assertValidNumber(value, "
|
|
215
|
+
assertValidNumber(value, "FXColor.r");
|
|
216
216
|
value = MathUtils.clamp(value, 0, 1);
|
|
217
217
|
this._private_ensureRGBUpdatedFromHSL();
|
|
218
218
|
if (value !== this._private_rInternal) {
|
|
@@ -223,7 +223,7 @@ class FXColor {
|
|
|
223
223
|
}
|
|
224
224
|
/** Green component (0 to 1) */
|
|
225
225
|
set g(value) {
|
|
226
|
-
assertValidNumber(value, "
|
|
226
|
+
assertValidNumber(value, "FXColor.g");
|
|
227
227
|
value = MathUtils.clamp(value, 0, 1);
|
|
228
228
|
this._private_ensureRGBUpdatedFromHSL();
|
|
229
229
|
if (value !== this._private_gInternal) {
|
|
@@ -234,7 +234,7 @@ class FXColor {
|
|
|
234
234
|
}
|
|
235
235
|
/** Blue component (0 to 1) */
|
|
236
236
|
set b(value) {
|
|
237
|
-
assertValidNumber(value, "
|
|
237
|
+
assertValidNumber(value, "FXColor.b");
|
|
238
238
|
value = MathUtils.clamp(value, 0, 1);
|
|
239
239
|
this._private_ensureRGBUpdatedFromHSL();
|
|
240
240
|
if (value !== this._private_bInternal) {
|
|
@@ -245,7 +245,7 @@ class FXColor {
|
|
|
245
245
|
}
|
|
246
246
|
/** Alpha component (0 to 1) */
|
|
247
247
|
set a(value) {
|
|
248
|
-
assertValidNumber(value, "
|
|
248
|
+
assertValidNumber(value, "FXColor.a");
|
|
249
249
|
value = MathUtils.clamp(value, 0, 1);
|
|
250
250
|
if (value !== this._private_aInternal) {
|
|
251
251
|
this._private_aInternal = value;
|
|
@@ -254,7 +254,7 @@ class FXColor {
|
|
|
254
254
|
}
|
|
255
255
|
/** Hue component (0 to 360) */
|
|
256
256
|
set hue(value) {
|
|
257
|
-
assertValidNumber(value, "
|
|
257
|
+
assertValidNumber(value, "FXColor.hue");
|
|
258
258
|
value = MathUtils.clamp(value, 0, 360);
|
|
259
259
|
this._private_ensureHSLUpdatedFromRGB();
|
|
260
260
|
if (value !== this._private_hInternal) {
|
|
@@ -265,7 +265,7 @@ class FXColor {
|
|
|
265
265
|
}
|
|
266
266
|
/** Saturation component (0 to 1) */
|
|
267
267
|
set saturation(value) {
|
|
268
|
-
assertValidNumber(value, "
|
|
268
|
+
assertValidNumber(value, "FXColor.saturation");
|
|
269
269
|
value = MathUtils.clamp(value, 0, 1);
|
|
270
270
|
this._private_ensureHSLUpdatedFromRGB();
|
|
271
271
|
if (value !== this._private_sInternal) {
|
|
@@ -276,7 +276,7 @@ class FXColor {
|
|
|
276
276
|
}
|
|
277
277
|
/** Lightness component (0 to 1) */
|
|
278
278
|
set lightness(value) {
|
|
279
|
-
assertValidNumber(value, "
|
|
279
|
+
assertValidNumber(value, "FXColor.lightness");
|
|
280
280
|
value = MathUtils.clamp(value, 0, 1);
|
|
281
281
|
this._private_ensureHSLUpdatedFromRGB();
|
|
282
282
|
if (value !== this._private_lInternal) {
|
|
@@ -312,14 +312,14 @@ class FXColor {
|
|
|
312
312
|
if (typeof firstArgument === "number") {
|
|
313
313
|
return this.setHexRGB(firstArgument, a);
|
|
314
314
|
}
|
|
315
|
-
throw new Error("
|
|
315
|
+
throw new Error("FXColor.set: cannot create color from provided arguments");
|
|
316
316
|
}
|
|
317
317
|
/** Sets RGBA components directly */
|
|
318
318
|
setRGBA(r, g, b, a = this._private_aInternal) {
|
|
319
|
-
assertValidNumber(r, "
|
|
320
|
-
assertValidNumber(g, "
|
|
321
|
-
assertValidNumber(b, "
|
|
322
|
-
assertValidNumber(a, "
|
|
319
|
+
assertValidNumber(r, "FXColor.setRGBA.r");
|
|
320
|
+
assertValidNumber(g, "FXColor.setRGBA.g");
|
|
321
|
+
assertValidNumber(b, "FXColor.setRGBA.b");
|
|
322
|
+
assertValidNumber(a, "FXColor.setRGBA.a");
|
|
323
323
|
r = MathUtils.clamp(r, 0, 1);
|
|
324
324
|
g = MathUtils.clamp(g, 0, 1);
|
|
325
325
|
b = MathUtils.clamp(b, 0, 1);
|
|
@@ -365,7 +365,7 @@ class FXColor {
|
|
|
365
365
|
}
|
|
366
366
|
/** Sets from 32-bit hex RGBA (RRGGBBAA) */
|
|
367
367
|
setHexRGBA(hex) {
|
|
368
|
-
assertValidNumber(hex, "
|
|
368
|
+
assertValidNumber(hex, "FXColor.setHexRGBA.hex");
|
|
369
369
|
this._private_ensureRGBUpdatedFromHSL();
|
|
370
370
|
const r = ((hex >> 16) & 0xff) / 255;
|
|
371
371
|
const g = ((hex >> 8) & 0xff) / 255;
|
|
@@ -386,8 +386,8 @@ class FXColor {
|
|
|
386
386
|
}
|
|
387
387
|
/** Sets from 24-bit hex RGB (RRGGBB) */
|
|
388
388
|
setHexRGB(hex, a = this._private_aInternal) {
|
|
389
|
-
assertValidNumber(hex, "
|
|
390
|
-
assertValidNumber(a, "
|
|
389
|
+
assertValidNumber(hex, "FXColor.setHexRGB.hex");
|
|
390
|
+
assertValidNumber(a, "FXColor.setHexRGB.a");
|
|
391
391
|
a = MathUtils.clamp(a, 0, 1);
|
|
392
392
|
this._private_ensureRGBUpdatedFromHSL();
|
|
393
393
|
const r = ((hex >> 16) & 0xff) / 255;
|
|
@@ -414,33 +414,33 @@ class FXColor {
|
|
|
414
414
|
*/
|
|
415
415
|
setHexString(hexString) {
|
|
416
416
|
if (!hexString.startsWith("#")) {
|
|
417
|
-
throw new Error(`
|
|
417
|
+
throw new Error(`FXColor.setHexString.hexString: invalid hex string format. expected format: "#ffffff" or "#ffffffff"`);
|
|
418
418
|
}
|
|
419
419
|
const hex = hexString.slice(1);
|
|
420
420
|
if (hex.length === 6) {
|
|
421
421
|
const hexNumber = parseInt(hex, 16);
|
|
422
422
|
if (isNaN(hexNumber)) {
|
|
423
|
-
throw new Error(`
|
|
423
|
+
throw new Error(`FXColor.setHexString.hexString: invalid hex string format. expected format: "#ffffff" or "#ffffffff"`);
|
|
424
424
|
}
|
|
425
425
|
return this.setHexRGB(hexNumber);
|
|
426
426
|
}
|
|
427
427
|
else if (hex.length === 8) {
|
|
428
428
|
const hexNumber = parseInt(hex, 16);
|
|
429
429
|
if (isNaN(hexNumber)) {
|
|
430
|
-
throw new Error(`
|
|
430
|
+
throw new Error(`FXColor.setHexString.hexString: invalid hex string format. expected format: "#ffffff" or "#ffffffff"`);
|
|
431
431
|
}
|
|
432
432
|
return this.setHexRGBA(hexNumber);
|
|
433
433
|
}
|
|
434
434
|
else {
|
|
435
|
-
throw new Error(`
|
|
435
|
+
throw new Error(`FXColor.setHexString.hexString: invalid hex string format. expected format: "#ffffff" or "#ffffffff"`);
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
438
|
/** Sets from HSL values */
|
|
439
439
|
setHSL(h, s, l, a = this._private_aInternal) {
|
|
440
|
-
assertValidNumber(h, "
|
|
441
|
-
assertValidNumber(s, "
|
|
442
|
-
assertValidNumber(l, "
|
|
443
|
-
assertValidNumber(a, "
|
|
440
|
+
assertValidNumber(h, "FXColor.setHSL.h");
|
|
441
|
+
assertValidNumber(s, "FXColor.setHSL.s");
|
|
442
|
+
assertValidNumber(l, "FXColor.setHSL.l");
|
|
443
|
+
assertValidNumber(a, "FXColor.setHSL.a");
|
|
444
444
|
h = MathUtils.clamp(h, 0, 360);
|
|
445
445
|
s = MathUtils.clamp(s, 0, 1);
|
|
446
446
|
l = MathUtils.clamp(l, 0, 1);
|
|
@@ -465,21 +465,21 @@ class FXColor {
|
|
|
465
465
|
* @throws If color name unknown
|
|
466
466
|
*/
|
|
467
467
|
setColorName(colorName, a = this._private_aInternal) {
|
|
468
|
-
assertValidNumber(a, "
|
|
468
|
+
assertValidNumber(a, "FXColor.setColorName.a");
|
|
469
469
|
a = MathUtils.clamp(a, 0, 1);
|
|
470
470
|
const normalizedName = colorName.toLowerCase().trim();
|
|
471
471
|
const hex = COLORS[normalizedName];
|
|
472
472
|
if (hex === undefined) {
|
|
473
|
-
throw new Error(`
|
|
473
|
+
throw new Error(`FXColor.setColorName.colorName: unknown color name`);
|
|
474
474
|
}
|
|
475
475
|
return this.setHexRGB(hex, a);
|
|
476
476
|
}
|
|
477
477
|
/** Sets from linear (GLSL) color space */
|
|
478
478
|
setGLSLColor(r, g, b, a = this._private_aInternal) {
|
|
479
|
-
assertValidNumber(r, "
|
|
480
|
-
assertValidNumber(g, "
|
|
481
|
-
assertValidNumber(b, "
|
|
482
|
-
assertValidNumber(a, "
|
|
479
|
+
assertValidNumber(r, "FXColor.setGLSLColor.r");
|
|
480
|
+
assertValidNumber(g, "FXColor.setGLSLColor.g");
|
|
481
|
+
assertValidNumber(b, "FXColor.setGLSLColor.b");
|
|
482
|
+
assertValidNumber(a, "FXColor.setGLSLColor.a");
|
|
483
483
|
a = MathUtils.clamp(a, 0, 1);
|
|
484
484
|
this._private_ensureRGBUpdatedFromHSL();
|
|
485
485
|
const sRGBR = linearToSRGB(r);
|
|
@@ -500,7 +500,7 @@ class FXColor {
|
|
|
500
500
|
}
|
|
501
501
|
/** Sets from Three.js Color */
|
|
502
502
|
setThreeColor(threeColor, a = this._private_aInternal) {
|
|
503
|
-
assertValidNumber(a, "
|
|
503
|
+
assertValidNumber(a, "FXColor.setThreeColor.a");
|
|
504
504
|
a = MathUtils.clamp(a, 0, 1);
|
|
505
505
|
this._private_ensureRGBUpdatedFromHSL();
|
|
506
506
|
if (threeColor.r !== this._private_rInternal ||
|
|
@@ -177,7 +177,7 @@ function buildParticleFragmentShader(uniformDeclarations, varyingDeclarations, s
|
|
|
177
177
|
discard;
|
|
178
178
|
}
|
|
179
179
|
#ifdef USE_ALPHAHASH
|
|
180
|
-
if (diffuseColor.a < getAlphaHashThreshold(
|
|
180
|
+
if (diffuseColor.a < getAlphaHashThreshold(vec3(p_builtin[0][0], p_builtin[0][1], p_builtin[0][2]))) {
|
|
181
181
|
discard;
|
|
182
182
|
}
|
|
183
183
|
#endif
|
|
@@ -178,18 +178,18 @@ class FXTextureView {
|
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
_private_setFromAtlasConfig(config) {
|
|
181
|
-
assertValidPositiveNumber(config.sourceSize.w, "
|
|
182
|
-
assertValidPositiveNumber(config.sourceSize.h, "
|
|
183
|
-
assertValidNonNegativeNumber(config.frame.x, "
|
|
184
|
-
assertValidNonNegativeNumber(config.frame.y, "
|
|
185
|
-
assertValidPositiveNumber(config.frame.w, "
|
|
186
|
-
assertValidPositiveNumber(config.frame.h, "
|
|
187
|
-
assertValidNonNegativeNumber(config.spriteSourceSize.x, "
|
|
188
|
-
assertValidNonNegativeNumber(config.spriteSourceSize.y, "
|
|
189
|
-
assertValidPositiveNumber(config.spriteSourceSize.w, "
|
|
190
|
-
assertValidPositiveNumber(config.spriteSourceSize.h, "
|
|
181
|
+
assertValidPositiveNumber(config.sourceSize.w, "FXTextureView.setFromAtlasConfig.config.sourceSize.w");
|
|
182
|
+
assertValidPositiveNumber(config.sourceSize.h, "FXTextureView.setFromAtlasConfig.config.sourceSize.h");
|
|
183
|
+
assertValidNonNegativeNumber(config.frame.x, "FXTextureView.setFromAtlasConfig.config.frame.x");
|
|
184
|
+
assertValidNonNegativeNumber(config.frame.y, "FXTextureView.setFromAtlasConfig.config.frame.y");
|
|
185
|
+
assertValidPositiveNumber(config.frame.w, "FXTextureView.setFromAtlasConfig.config.frame.w");
|
|
186
|
+
assertValidPositiveNumber(config.frame.h, "FXTextureView.setFromAtlasConfig.config.frame.h");
|
|
187
|
+
assertValidNonNegativeNumber(config.spriteSourceSize.x, "FXTextureView.setFromAtlasConfig.config.spriteSourceSize.x");
|
|
188
|
+
assertValidNonNegativeNumber(config.spriteSourceSize.y, "FXTextureView.setFromAtlasConfig.config.spriteSourceSize.y");
|
|
189
|
+
assertValidPositiveNumber(config.spriteSourceSize.w, "FXTextureView.setFromAtlasConfig.config.spriteSourceSize.w");
|
|
190
|
+
assertValidPositiveNumber(config.spriteSourceSize.h, "FXTextureView.setFromAtlasConfig.config.spriteSourceSize.h");
|
|
191
191
|
if (config.scale !== undefined) {
|
|
192
|
-
assertValidPositiveNumber(config.scale, "
|
|
192
|
+
assertValidPositiveNumber(config.scale, "FXTextureView.setFromAtlasConfig.config.scale");
|
|
193
193
|
}
|
|
194
194
|
this._private_sourceWidth = config.sourceSize.w;
|
|
195
195
|
this._private_sourceHeight = config.sourceSize.h;
|
|
@@ -19,12 +19,12 @@ class FXSpawnBox extends FXSpawnModule {
|
|
|
19
19
|
this.requiredProperties = { builtin: "Matrix4" };
|
|
20
20
|
this._private_minInternal = resolveFXVector2Config(min);
|
|
21
21
|
this._private_maxInternal = resolveFXVector2Config(max);
|
|
22
|
-
assertValidNumber(this._private_minInternal.x, "
|
|
23
|
-
assertValidNumber(this._private_minInternal.y, "
|
|
24
|
-
assertValidNumber(this._private_minInternal.z, "
|
|
25
|
-
assertValidNumber(this._private_maxInternal.x, "
|
|
26
|
-
assertValidNumber(this._private_maxInternal.y, "
|
|
27
|
-
assertValidNumber(this._private_maxInternal.z, "
|
|
22
|
+
assertValidNumber(this._private_minInternal.x, "FXSpawnRectangle.constructor.min.x");
|
|
23
|
+
assertValidNumber(this._private_minInternal.y, "FXSpawnRectangle.constructor.min.y");
|
|
24
|
+
assertValidNumber(this._private_minInternal.z, "FXSpawnRectangle.constructor.min.z");
|
|
25
|
+
assertValidNumber(this._private_maxInternal.x, "FXSpawnRectangle.constructor.max.x");
|
|
26
|
+
assertValidNumber(this._private_maxInternal.y, "FXSpawnRectangle.constructor.max.y");
|
|
27
|
+
assertValidNumber(this._private_maxInternal.z, "FXSpawnRectangle.constructor.max.z");
|
|
28
28
|
}
|
|
29
29
|
/** Bottom-left corner of spawn area */
|
|
30
30
|
get min() {
|
|
@@ -37,16 +37,16 @@ class FXSpawnBox extends FXSpawnModule {
|
|
|
37
37
|
/** Bottom-left corner of spawn area */
|
|
38
38
|
set min(value) {
|
|
39
39
|
this._private_minInternal = resolveFXVector2Config(value);
|
|
40
|
-
assertValidNumber(this._private_minInternal.x, "
|
|
41
|
-
assertValidNumber(this._private_minInternal.y, "
|
|
42
|
-
assertValidNumber(this._private_minInternal.z, "
|
|
40
|
+
assertValidNumber(this._private_minInternal.x, "FXSpawnRectangle.min.x");
|
|
41
|
+
assertValidNumber(this._private_minInternal.y, "FXSpawnRectangle.min.y");
|
|
42
|
+
assertValidNumber(this._private_minInternal.z, "FXSpawnRectangle.min.z");
|
|
43
43
|
}
|
|
44
44
|
/** Top-right corner of spawn area */
|
|
45
45
|
set max(value) {
|
|
46
46
|
this._private_maxInternal = resolveFXVector2Config(value);
|
|
47
|
-
assertValidNumber(this._private_maxInternal.x, "
|
|
48
|
-
assertValidNumber(this._private_maxInternal.y, "
|
|
49
|
-
assertValidNumber(this._private_maxInternal.z, "
|
|
47
|
+
assertValidNumber(this._private_maxInternal.x, "FXSpawnRectangle.max.x");
|
|
48
|
+
assertValidNumber(this._private_maxInternal.y, "FXSpawnRectangle.max.y");
|
|
49
|
+
assertValidNumber(this._private_maxInternal.z, "FXSpawnRectangle.max.z");
|
|
50
50
|
}
|
|
51
51
|
/** @internal */
|
|
52
52
|
spawn(properties, instanceBegin, instanceEnd) {
|
|
@@ -16,9 +16,9 @@ class FXSpawnOffset extends FXSpawnModule {
|
|
|
16
16
|
/** @internal */
|
|
17
17
|
this.requiredProperties = { builtin: "Matrix4" };
|
|
18
18
|
this._private_offsetInternal = resolveFXVector2Config(offset);
|
|
19
|
-
assertValidNumber(this._private_offsetInternal.x, "
|
|
20
|
-
assertValidNumber(this._private_offsetInternal.y, "
|
|
21
|
-
assertValidNumber(this._private_offsetInternal.z, "
|
|
19
|
+
assertValidNumber(this._private_offsetInternal.x, "FXSpawnOffset.constructor.offset.x");
|
|
20
|
+
assertValidNumber(this._private_offsetInternal.y, "FXSpawnOffset.constructor.offset.y");
|
|
21
|
+
assertValidNumber(this._private_offsetInternal.z, "FXSpawnOffset.constructor.offset.z");
|
|
22
22
|
}
|
|
23
23
|
/** Particle position offset */
|
|
24
24
|
get offset() {
|
|
@@ -27,9 +27,9 @@ class FXSpawnOffset extends FXSpawnModule {
|
|
|
27
27
|
/** Particle position offset */
|
|
28
28
|
set offset(value) {
|
|
29
29
|
this._private_offsetInternal = resolveFXVector2Config(value);
|
|
30
|
-
assertValidNumber(this._private_offsetInternal.x, "
|
|
31
|
-
assertValidNumber(this._private_offsetInternal.y, "
|
|
32
|
-
assertValidNumber(this._private_offsetInternal.z, "
|
|
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
33
|
}
|
|
34
34
|
/** @internal */
|
|
35
35
|
spawn(properties, instanceBegin, instanceEnd) {
|
|
@@ -17,8 +17,8 @@ class FXSpawnRandomLifetime extends FXSpawnModule {
|
|
|
17
17
|
/** @internal */
|
|
18
18
|
this.requiredProperties = { builtin: "Matrix4" };
|
|
19
19
|
this._private_lifetimeInternal = resolveFXRangeConfig(lifetime);
|
|
20
|
-
assertValidPositiveNumber(this._private_lifetimeInternal.min, "
|
|
21
|
-
assertValidPositiveNumber(this._private_lifetimeInternal.max, "
|
|
20
|
+
assertValidPositiveNumber(this._private_lifetimeInternal.min, "FXSpawnRandomLifetime.constructor.lifetime.min");
|
|
21
|
+
assertValidPositiveNumber(this._private_lifetimeInternal.max, "FXSpawnRandomLifetime.constructor.lifetime.max");
|
|
22
22
|
}
|
|
23
23
|
/** Lifetime range in seconds */
|
|
24
24
|
get lifetime() {
|
|
@@ -27,8 +27,8 @@ class FXSpawnRandomLifetime extends FXSpawnModule {
|
|
|
27
27
|
/** Lifetime range in seconds */
|
|
28
28
|
set lifetime(value) {
|
|
29
29
|
this._private_lifetimeInternal = resolveFXRangeConfig(value);
|
|
30
|
-
assertValidPositiveNumber(this._private_lifetimeInternal.min, "
|
|
31
|
-
assertValidPositiveNumber(this._private_lifetimeInternal.max, "
|
|
30
|
+
assertValidPositiveNumber(this._private_lifetimeInternal.min, "FXSpawnRandomLifetime.lifetime.min");
|
|
31
|
+
assertValidPositiveNumber(this._private_lifetimeInternal.max, "FXSpawnRandomLifetime.lifetime.max");
|
|
32
32
|
}
|
|
33
33
|
/** @internal */
|
|
34
34
|
spawn(properties, instanceBegin, instanceEnd) {
|
|
@@ -17,8 +17,8 @@ class FXSpawnRandomRotation extends FXSpawnModule {
|
|
|
17
17
|
/** @internal */
|
|
18
18
|
this.requiredProperties = { builtin: "Matrix4" };
|
|
19
19
|
this._private_rotationInternal = resolveFXRangeConfig(rotation);
|
|
20
|
-
assertValidNumber(this._private_rotationInternal.min, "
|
|
21
|
-
assertValidNumber(this._private_rotationInternal.max, "
|
|
20
|
+
assertValidNumber(this._private_rotationInternal.min, "FXSpawnRandomRotation.constructor.rotation.min");
|
|
21
|
+
assertValidNumber(this._private_rotationInternal.max, "FXSpawnRandomRotation.constructor.rotation.max");
|
|
22
22
|
}
|
|
23
23
|
/** Rotation range in radians */
|
|
24
24
|
get rotation() {
|
|
@@ -27,8 +27,8 @@ class FXSpawnRandomRotation extends FXSpawnModule {
|
|
|
27
27
|
/** Rotation range in radians */
|
|
28
28
|
set rotation(value) {
|
|
29
29
|
this._private_rotationInternal = resolveFXRangeConfig(value);
|
|
30
|
-
assertValidNumber(this._private_rotationInternal.min, "
|
|
31
|
-
assertValidNumber(this._private_rotationInternal.max, "
|
|
30
|
+
assertValidNumber(this._private_rotationInternal.min, "FXSpawnRandomRotation.rotation.min");
|
|
31
|
+
assertValidNumber(this._private_rotationInternal.max, "FXSpawnRandomRotation.rotation.max");
|
|
32
32
|
}
|
|
33
33
|
/** @internal */
|
|
34
34
|
spawn(properties, instanceBegin, instanceEnd) {
|
|
@@ -19,9 +19,9 @@ class FXSpawnRandomScale extends FXSpawnModule {
|
|
|
19
19
|
this.requiredProperties = { builtin: "Matrix4" };
|
|
20
20
|
this._private_scaleInternal = resolveFXRangeConfig(scale);
|
|
21
21
|
this._private_aspectInternal = resolveAspect(aspect);
|
|
22
|
-
assertValidPositiveNumber(this._private_scaleInternal.min, "
|
|
23
|
-
assertValidPositiveNumber(this._private_scaleInternal.max, "
|
|
24
|
-
assertValidPositiveNumber(this._private_aspectInternal, "
|
|
22
|
+
assertValidPositiveNumber(this._private_scaleInternal.min, "FXSpawnRandomScale.constructor.scale.min");
|
|
23
|
+
assertValidPositiveNumber(this._private_scaleInternal.max, "FXSpawnRandomScale.constructor.scale.max");
|
|
24
|
+
assertValidPositiveNumber(this._private_aspectInternal, "FXSpawnRandomScale.constructor.aspect");
|
|
25
25
|
}
|
|
26
26
|
/** Base scale range */
|
|
27
27
|
get scale() {
|
|
@@ -34,13 +34,13 @@ class FXSpawnRandomScale extends FXSpawnModule {
|
|
|
34
34
|
/** Base scale range */
|
|
35
35
|
set scale(value) {
|
|
36
36
|
this._private_scaleInternal = resolveFXRangeConfig(value);
|
|
37
|
-
assertValidPositiveNumber(this._private_scaleInternal.min, "
|
|
38
|
-
assertValidPositiveNumber(this._private_scaleInternal.max, "
|
|
37
|
+
assertValidPositiveNumber(this._private_scaleInternal.min, "FXSpawnRandomScale.scale.min");
|
|
38
|
+
assertValidPositiveNumber(this._private_scaleInternal.max, "FXSpawnRandomScale.scale.max");
|
|
39
39
|
}
|
|
40
40
|
/** Width/height aspect ratio */
|
|
41
41
|
set aspect(value) {
|
|
42
42
|
this._private_aspectInternal = resolveAspect(value);
|
|
43
|
-
assertValidPositiveNumber(this._private_aspectInternal, "
|
|
43
|
+
assertValidPositiveNumber(this._private_aspectInternal, "FXSpawnRandomScale.aspect");
|
|
44
44
|
}
|
|
45
45
|
/** @internal */
|
|
46
46
|
spawn(properties, instanceBegin, instanceEnd) {
|
|
@@ -17,8 +17,8 @@ class FXSpawnRandomTorque extends FXSpawnModule {
|
|
|
17
17
|
/** @internal */
|
|
18
18
|
this.requiredProperties = { builtin: "Matrix4" };
|
|
19
19
|
this._private_torqueInternal = resolveFXRangeConfig(torque);
|
|
20
|
-
assertValidNumber(this._private_torqueInternal.min, "
|
|
21
|
-
assertValidNumber(this._private_torqueInternal.max, "
|
|
20
|
+
assertValidNumber(this._private_torqueInternal.min, "FXSpawnRandomTorque.constructor.torque.min");
|
|
21
|
+
assertValidNumber(this._private_torqueInternal.max, "FXSpawnRandomTorque.constructor.torque.max");
|
|
22
22
|
}
|
|
23
23
|
/** Angular velocity range in radians/second */
|
|
24
24
|
get torque() {
|
|
@@ -27,8 +27,8 @@ class FXSpawnRandomTorque extends FXSpawnModule {
|
|
|
27
27
|
/** Angular velocity range in radians/second */
|
|
28
28
|
set torque(value) {
|
|
29
29
|
this._private_torqueInternal = resolveFXRangeConfig(value);
|
|
30
|
-
assertValidNumber(this._private_torqueInternal.min, "
|
|
31
|
-
assertValidNumber(this._private_torqueInternal.max, "
|
|
30
|
+
assertValidNumber(this._private_torqueInternal.min, "FXSpawnRandomTorque.torque.min");
|
|
31
|
+
assertValidNumber(this._private_torqueInternal.max, "FXSpawnRandomTorque.torque.max");
|
|
32
32
|
}
|
|
33
33
|
/** @internal */
|
|
34
34
|
spawn(properties, instanceBegin, instanceEnd) {
|