@galacean/engine-core 2.0.0-alpha.36 → 2.0.0-alpha.37
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/main.js +582 -7
- package/dist/main.js.map +1 -1
- package/dist/module.js +579 -8
- package/dist/module.js.map +1 -1
- package/package.json +3 -3
- package/types/particle/ParticleGenerator.d.ts +17 -1
- package/types/particle/enums/ParticleSubEmitterInheritProperty.d.ts +17 -0
- package/types/particle/enums/ParticleSubEmitterType.d.ts +9 -0
- package/types/particle/index.d.ts +4 -0
- package/types/particle/modules/ParticleCompositeGradient.d.ts +1 -0
- package/types/particle/modules/ParticleGeneratorModule.d.ts +0 -2
- package/types/particle/modules/SubEmitter.d.ts +27 -0
- package/types/particle/modules/SubEmittersModule.d.ts +36 -0
package/dist/module.js
CHANGED
|
@@ -33888,8 +33888,10 @@ var ParticleStopMode = /*#__PURE__*/ function(ParticleStopMode) {
|
|
|
33888
33888
|
/**
|
|
33889
33889
|
* @internal
|
|
33890
33890
|
*/ _proto._onEnable = function _onEnable() {
|
|
33891
|
-
|
|
33892
|
-
|
|
33891
|
+
var generator = this.generator;
|
|
33892
|
+
generator._setTransformFeedback();
|
|
33893
|
+
if (generator.main.playOnEnabled) {
|
|
33894
|
+
generator.play(false);
|
|
33893
33895
|
}
|
|
33894
33896
|
};
|
|
33895
33897
|
/**
|
|
@@ -34484,6 +34486,14 @@ ParticleTransformFeedbackSimulator._deltaTimeProperty = ShaderProperty.getByName
|
|
|
34484
34486
|
return ParticleGradientMode;
|
|
34485
34487
|
}({});
|
|
34486
34488
|
|
|
34489
|
+
/**
|
|
34490
|
+
* Particle sub emitter trigger type.
|
|
34491
|
+
*/ var ParticleSubEmitterType = /*#__PURE__*/ function(ParticleSubEmitterType) {
|
|
34492
|
+
/** Triggered when a parent particle is born. */ ParticleSubEmitterType[ParticleSubEmitterType["Birth"] = 0] = "Birth";
|
|
34493
|
+
/** Triggered when a parent particle dies (lifetime expired). */ ParticleSubEmitterType[ParticleSubEmitterType["Death"] = 1] = "Death";
|
|
34494
|
+
return ParticleSubEmitterType;
|
|
34495
|
+
}({});
|
|
34496
|
+
|
|
34487
34497
|
/**
|
|
34488
34498
|
* @internal
|
|
34489
34499
|
*/ var ParticleRandomSubSeeds = /*#__PURE__*/ function(ParticleRandomSubSeeds) {
|
|
@@ -34505,6 +34515,7 @@ ParticleTransformFeedbackSimulator._deltaTimeProperty = ShaderProperty.getByName
|
|
|
34505
34515
|
ParticleRandomSubSeeds[ParticleRandomSubSeeds["ForceOverLifetime"] = 3875246972] = "ForceOverLifetime";
|
|
34506
34516
|
ParticleRandomSubSeeds[ParticleRandomSubSeeds["LimitVelocityOverLifetime"] = 3047300990] = "LimitVelocityOverLifetime";
|
|
34507
34517
|
ParticleRandomSubSeeds[ParticleRandomSubSeeds["Noise"] = 4105357473] = "Noise";
|
|
34518
|
+
ParticleRandomSubSeeds[ParticleRandomSubSeeds["SubEmitter"] = 2622110509] = "SubEmitter";
|
|
34508
34519
|
ParticleRandomSubSeeds[ParticleRandomSubSeeds["EmissionRate"] = 2625893077] = "EmissionRate";
|
|
34509
34520
|
return ParticleRandomSubSeeds;
|
|
34510
34521
|
}({});
|
|
@@ -34574,6 +34585,12 @@ ParticleTransformFeedbackSimulator._deltaTimeProperty = ShaderProperty.getByName
|
|
|
34574
34585
|
* @param colorKeys - The color keys
|
|
34575
34586
|
* @param alphaKeys - The alpha keys
|
|
34576
34587
|
*/ _proto.setKeys = function setKeys(colorKeys, alphaKeys) {
|
|
34588
|
+
if (colorKeys.length > 4) {
|
|
34589
|
+
throw new Error("Gradient can only have 4 color keys");
|
|
34590
|
+
}
|
|
34591
|
+
if (alphaKeys.length > 4) {
|
|
34592
|
+
throw new Error("Gradient can only have 4 alpha keys");
|
|
34593
|
+
}
|
|
34577
34594
|
var currentColorKeys = this._colorKeys;
|
|
34578
34595
|
var currentAlphaKeys = this._alphaKeys;
|
|
34579
34596
|
for(var i = 0, n = currentColorKeys.length; i < n; i++){
|
|
@@ -34628,6 +34645,60 @@ ParticleTransformFeedbackSimulator._deltaTimeProperty = ShaderProperty.getByName
|
|
|
34628
34645
|
}
|
|
34629
34646
|
return typeArray;
|
|
34630
34647
|
};
|
|
34648
|
+
/**
|
|
34649
|
+
* @internal
|
|
34650
|
+
*/ _proto._evaluate = function _evaluate(time, out) {
|
|
34651
|
+
var alphaKeys = this._alphaKeys;
|
|
34652
|
+
var alphaCount = alphaKeys.length;
|
|
34653
|
+
if (alphaCount === 0) {
|
|
34654
|
+
out.a = 0;
|
|
34655
|
+
} else {
|
|
34656
|
+
var alphaMaxTime = alphaKeys[alphaCount - 1].time;
|
|
34657
|
+
var alphaT = Math.min(time, alphaMaxTime);
|
|
34658
|
+
for(var i = 0; i < alphaCount; i++){
|
|
34659
|
+
var key = alphaKeys[i];
|
|
34660
|
+
if (alphaT <= key.time) {
|
|
34661
|
+
if (i === 0) {
|
|
34662
|
+
out.a = key.alpha;
|
|
34663
|
+
} else {
|
|
34664
|
+
var lastKey = alphaKeys[i - 1];
|
|
34665
|
+
var age = (alphaT - lastKey.time) / (key.time - lastKey.time);
|
|
34666
|
+
out.a = lastKey.alpha + (key.alpha - lastKey.alpha) * age;
|
|
34667
|
+
}
|
|
34668
|
+
break;
|
|
34669
|
+
}
|
|
34670
|
+
}
|
|
34671
|
+
}
|
|
34672
|
+
var colorKeys = this._colorKeys;
|
|
34673
|
+
var colorCount = colorKeys.length;
|
|
34674
|
+
if (colorCount === 0) {
|
|
34675
|
+
out.r = 0;
|
|
34676
|
+
out.g = 0;
|
|
34677
|
+
out.b = 0;
|
|
34678
|
+
} else {
|
|
34679
|
+
var colorMaxTime = colorKeys[colorCount - 1].time;
|
|
34680
|
+
var colorT = Math.min(time, colorMaxTime);
|
|
34681
|
+
for(var i1 = 0; i1 < colorCount; i1++){
|
|
34682
|
+
var key1 = colorKeys[i1];
|
|
34683
|
+
if (colorT <= key1.time) {
|
|
34684
|
+
var c = key1.color;
|
|
34685
|
+
if (i1 === 0) {
|
|
34686
|
+
out.r = c.r;
|
|
34687
|
+
out.g = c.g;
|
|
34688
|
+
out.b = c.b;
|
|
34689
|
+
} else {
|
|
34690
|
+
var lastKey1 = colorKeys[i1 - 1];
|
|
34691
|
+
var last = lastKey1.color;
|
|
34692
|
+
var age1 = (colorT - lastKey1.time) / (key1.time - lastKey1.time);
|
|
34693
|
+
out.r = last.r + (c.r - last.r) * age1;
|
|
34694
|
+
out.g = last.g + (c.g - last.g) * age1;
|
|
34695
|
+
out.b = last.b + (c.b - last.b) * age1;
|
|
34696
|
+
}
|
|
34697
|
+
break;
|
|
34698
|
+
}
|
|
34699
|
+
}
|
|
34700
|
+
}
|
|
34701
|
+
};
|
|
34631
34702
|
_proto._addKey = function _addKey(keys, key) {
|
|
34632
34703
|
var time = key.time;
|
|
34633
34704
|
var count = keys.length;
|
|
@@ -34807,6 +34878,17 @@ __decorate([
|
|
|
34807
34878
|
case ParticleGradientMode.TwoConstants:
|
|
34808
34879
|
Color.lerp(this.constantMin, this.constantMax, lerpFactor, out);
|
|
34809
34880
|
break;
|
|
34881
|
+
case ParticleGradientMode.Gradient:
|
|
34882
|
+
this.gradientMax._evaluate(time, out);
|
|
34883
|
+
break;
|
|
34884
|
+
case ParticleGradientMode.TwoGradients:
|
|
34885
|
+
{
|
|
34886
|
+
var tmp = ParticleCompositeGradient._tempColor;
|
|
34887
|
+
this.gradientMin._evaluate(time, tmp);
|
|
34888
|
+
this.gradientMax._evaluate(time, out);
|
|
34889
|
+
Color.lerp(tmp, out, lerpFactor, out);
|
|
34890
|
+
break;
|
|
34891
|
+
}
|
|
34810
34892
|
}
|
|
34811
34893
|
};
|
|
34812
34894
|
_create_class(ParticleCompositeGradient, [
|
|
@@ -34835,6 +34917,7 @@ __decorate([
|
|
|
34835
34917
|
]);
|
|
34836
34918
|
return ParticleCompositeGradient;
|
|
34837
34919
|
}();
|
|
34920
|
+
ParticleCompositeGradient._tempColor = new Color();
|
|
34838
34921
|
__decorate([
|
|
34839
34922
|
deepClone
|
|
34840
34923
|
], ParticleCompositeGradient.prototype, "constantMin", void 0);
|
|
@@ -35012,6 +35095,31 @@ __decorate([
|
|
|
35012
35095
|
};
|
|
35013
35096
|
/**
|
|
35014
35097
|
* @internal
|
|
35098
|
+
*/ _proto._evaluateCumulative = function _evaluateCumulative(normalizedAge, lerpFactor) {
|
|
35099
|
+
switch(this.mode){
|
|
35100
|
+
case ParticleCurveMode.Constant:
|
|
35101
|
+
return this.constantMax * normalizedAge;
|
|
35102
|
+
case ParticleCurveMode.TwoConstants:
|
|
35103
|
+
return (this.constantMin + (this.constantMax - this.constantMin) * lerpFactor) * normalizedAge;
|
|
35104
|
+
case ParticleCurveMode.Curve:
|
|
35105
|
+
var _this_curveMax;
|
|
35106
|
+
var _this_curveMax__evaluateCumulative;
|
|
35107
|
+
return (_this_curveMax__evaluateCumulative = (_this_curveMax = this.curveMax) == null ? void 0 : _this_curveMax._evaluateCumulative(normalizedAge)) != null ? _this_curveMax__evaluateCumulative : 0;
|
|
35108
|
+
case ParticleCurveMode.TwoCurves:
|
|
35109
|
+
{
|
|
35110
|
+
var _this_curveMin, _this_curveMax1;
|
|
35111
|
+
var _this_curveMin__evaluateCumulative;
|
|
35112
|
+
var min = (_this_curveMin__evaluateCumulative = (_this_curveMin = this.curveMin) == null ? void 0 : _this_curveMin._evaluateCumulative(normalizedAge)) != null ? _this_curveMin__evaluateCumulative : 0;
|
|
35113
|
+
var _this_curveMax__evaluateCumulative1;
|
|
35114
|
+
var max = (_this_curveMax__evaluateCumulative1 = (_this_curveMax1 = this.curveMax) == null ? void 0 : _this_curveMax1._evaluateCumulative(normalizedAge)) != null ? _this_curveMax__evaluateCumulative1 : 0;
|
|
35115
|
+
return min + (max - min) * lerpFactor;
|
|
35116
|
+
}
|
|
35117
|
+
default:
|
|
35118
|
+
return 0;
|
|
35119
|
+
}
|
|
35120
|
+
};
|
|
35121
|
+
/**
|
|
35122
|
+
* @internal
|
|
35015
35123
|
*/ _proto._getMax = function _getMax() {
|
|
35016
35124
|
switch(this.mode){
|
|
35017
35125
|
case ParticleCurveMode.Constant:
|
|
@@ -36856,6 +36964,34 @@ __decorate([
|
|
|
36856
36964
|
};
|
|
36857
36965
|
/**
|
|
36858
36966
|
* @internal
|
|
36967
|
+
*/ _proto._evaluateCumulative = function _evaluateCumulative(normalizedAge) {
|
|
36968
|
+
var keys = this.keys;
|
|
36969
|
+
var length = keys.length;
|
|
36970
|
+
if (length === 0) return 0;
|
|
36971
|
+
// Single key is a constant curve (matches `_evaluate`); its integral is value × age.
|
|
36972
|
+
if (length === 1) return keys[0].value * normalizedAge;
|
|
36973
|
+
var firstKey = keys[0];
|
|
36974
|
+
if (normalizedAge <= firstKey.time) return firstKey.value * normalizedAge;
|
|
36975
|
+
var cumulative = firstKey.value * firstKey.time;
|
|
36976
|
+
for(var i = 1; i < length; i++){
|
|
36977
|
+
var key = keys[i];
|
|
36978
|
+
var lastKey = keys[i - 1];
|
|
36979
|
+
var segmentTime = key.time - lastKey.time;
|
|
36980
|
+
if (segmentTime <= 0) continue;
|
|
36981
|
+
if (key.time >= normalizedAge) {
|
|
36982
|
+
var offsetTime = normalizedAge - lastKey.time;
|
|
36983
|
+
var t = offsetTime / segmentTime;
|
|
36984
|
+
var currentValue = lastKey.value + (key.value - lastKey.value) * t;
|
|
36985
|
+
cumulative += (lastKey.value + currentValue) * 0.5 * offsetTime;
|
|
36986
|
+
return cumulative;
|
|
36987
|
+
}
|
|
36988
|
+
cumulative += (lastKey.value + key.value) * 0.5 * segmentTime;
|
|
36989
|
+
}
|
|
36990
|
+
var lastKey1 = keys[length - 1];
|
|
36991
|
+
return cumulative + lastKey1.value * (normalizedAge - lastKey1.time);
|
|
36992
|
+
};
|
|
36993
|
+
/**
|
|
36994
|
+
* @internal
|
|
36859
36995
|
*/ _proto._getTypeArray = function _getTypeArray() {
|
|
36860
36996
|
var typeArray = this._typeArray || (this._typeArray = new Float32Array(4 * 2));
|
|
36861
36997
|
if (this._typeArrayDirty) {
|
|
@@ -37666,6 +37802,221 @@ __decorate([
|
|
|
37666
37802
|
deepClone
|
|
37667
37803
|
], VelocityOverLifetimeModule.prototype, "_velocityZ", void 0);
|
|
37668
37804
|
|
|
37805
|
+
/**
|
|
37806
|
+
* Optional parent properties a sub-emitter inherits
|
|
37807
|
+
* Sub particles are always emitted at the parent particle's position; these flags only select
|
|
37808
|
+
* which additional properties are inherited on top of that.
|
|
37809
|
+
*/ var ParticleSubEmitterInheritProperty = /*#__PURE__*/ function(ParticleSubEmitterInheritProperty) {
|
|
37810
|
+
/** Inherit no additional properties; sub particles are still emitted at the parent's position. */ ParticleSubEmitterInheritProperty[ParticleSubEmitterInheritProperty["None"] = 0] = "None";
|
|
37811
|
+
/** Multiply parent's current color into the sub particle's start color. */ ParticleSubEmitterInheritProperty[ParticleSubEmitterInheritProperty["Color"] = 1] = "Color";
|
|
37812
|
+
/** Multiply parent's current size into the sub particle's start size. */ ParticleSubEmitterInheritProperty[ParticleSubEmitterInheritProperty["Size"] = 2] = "Size";
|
|
37813
|
+
/** Add parent's current rotation onto the sub particle's start rotation. */ ParticleSubEmitterInheritProperty[ParticleSubEmitterInheritProperty["Rotation"] = 4] = "Rotation";
|
|
37814
|
+
/** Emit the sub particle along the parent's velocity direction. */ ParticleSubEmitterInheritProperty[ParticleSubEmitterInheritProperty["Velocity"] = 8] = "Velocity";
|
|
37815
|
+
return ParticleSubEmitterInheritProperty;
|
|
37816
|
+
}({});
|
|
37817
|
+
|
|
37818
|
+
/**
|
|
37819
|
+
* One slot in `SubEmittersModule.subEmitters`. Configures which sub-emitter
|
|
37820
|
+
* fires, on which parent event, with what inheritance, probability, and count.
|
|
37821
|
+
*/ var SubEmitter = /*#__PURE__*/ function() {
|
|
37822
|
+
function SubEmitter() {
|
|
37823
|
+
/** Bitmask of properties inherited from the parent particle. */ this.inheritProperties = ParticleSubEmitterInheritProperty.None;
|
|
37824
|
+
/** Probability (0..1) the sub-emitter fires for any given event. */ this.emitProbability = 1;
|
|
37825
|
+
/** Number of sub particles emitted per parent event. */ this.emitCount = 1;
|
|
37826
|
+
/** @internal */ this._module = null;
|
|
37827
|
+
this._emitter = null;
|
|
37828
|
+
this._type = ParticleSubEmitterType.Birth;
|
|
37829
|
+
}
|
|
37830
|
+
_create_class(SubEmitter, [
|
|
37831
|
+
{
|
|
37832
|
+
key: "emitter",
|
|
37833
|
+
get: /**
|
|
37834
|
+
* Target particle renderer the sub particles emit into.
|
|
37835
|
+
*/ function get() {
|
|
37836
|
+
return this._emitter;
|
|
37837
|
+
},
|
|
37838
|
+
set: function set(value) {
|
|
37839
|
+
var _this__module;
|
|
37840
|
+
if (value === this._emitter) return;
|
|
37841
|
+
(_this__module = this._module) == null ? void 0 : _this__module._validateEmitter(value);
|
|
37842
|
+
this._emitter = value;
|
|
37843
|
+
}
|
|
37844
|
+
},
|
|
37845
|
+
{
|
|
37846
|
+
key: "type",
|
|
37847
|
+
get: /**
|
|
37848
|
+
* Which parent-particle event drives this slot.
|
|
37849
|
+
*/ function get() {
|
|
37850
|
+
return this._type;
|
|
37851
|
+
},
|
|
37852
|
+
set: function set(value) {
|
|
37853
|
+
var _this__module;
|
|
37854
|
+
if (value === this._type) return;
|
|
37855
|
+
this._type = value;
|
|
37856
|
+
(_this__module = this._module) == null ? void 0 : _this__module._generator._setTransformFeedback();
|
|
37857
|
+
}
|
|
37858
|
+
}
|
|
37859
|
+
]);
|
|
37860
|
+
return SubEmitter;
|
|
37861
|
+
}();
|
|
37862
|
+
__decorate([
|
|
37863
|
+
ignoreClone
|
|
37864
|
+
], SubEmitter.prototype, "_module", void 0);
|
|
37865
|
+
|
|
37866
|
+
/**
|
|
37867
|
+
* Fires sub-emitters on parent particle lifecycle events (Birth / Death).
|
|
37868
|
+
* @remarks Requires WebGL2; the module stays inactive on WebGL1.
|
|
37869
|
+
*/ var SubEmittersModule = /*#__PURE__*/ function(ParticleGeneratorModule) {
|
|
37870
|
+
_inherits(SubEmittersModule, ParticleGeneratorModule);
|
|
37871
|
+
function SubEmittersModule() {
|
|
37872
|
+
var _this;
|
|
37873
|
+
_this = ParticleGeneratorModule.apply(this, arguments) || this, _this._subEmitters = [], _this._probabilityRand = new Rand(0, ParticleRandomSubSeeds.SubEmitter);
|
|
37874
|
+
return _this;
|
|
37875
|
+
}
|
|
37876
|
+
var _proto = SubEmittersModule.prototype;
|
|
37877
|
+
/**
|
|
37878
|
+
* Add a sub-emitter slot.
|
|
37879
|
+
* @param emitter - Target particle renderer
|
|
37880
|
+
* @param type - Trigger event (`Birth` / `Death`)
|
|
37881
|
+
* @param inheritProperties - Bitmask of properties inherited from the parent particle
|
|
37882
|
+
* @param emitProbability - Per-event fire probability [0, 1]
|
|
37883
|
+
* @param emitCount - Number of sub particles emitted per parent event
|
|
37884
|
+
*/ _proto.addSubEmitter = function addSubEmitter(emitter, type, inheritProperties, emitProbability, emitCount) {
|
|
37885
|
+
if (inheritProperties === void 0) inheritProperties = ParticleSubEmitterInheritProperty.None;
|
|
37886
|
+
if (emitProbability === void 0) emitProbability = 1;
|
|
37887
|
+
if (emitCount === void 0) emitCount = 1;
|
|
37888
|
+
if (SubEmittersModule._wouldCreateCycle(emitter, this._generator)) {
|
|
37889
|
+
throw new Error("Sub-emitter would create a cycle");
|
|
37890
|
+
}
|
|
37891
|
+
var sub = new SubEmitter();
|
|
37892
|
+
sub.emitter = emitter;
|
|
37893
|
+
sub.type = type;
|
|
37894
|
+
sub.inheritProperties = inheritProperties;
|
|
37895
|
+
sub.emitProbability = emitProbability;
|
|
37896
|
+
sub.emitCount = emitCount;
|
|
37897
|
+
sub._module = this;
|
|
37898
|
+
this._subEmitters.push(sub);
|
|
37899
|
+
this._generator._setTransformFeedback();
|
|
37900
|
+
};
|
|
37901
|
+
/**
|
|
37902
|
+
* Remove the sub-emitter at the given index.
|
|
37903
|
+
* @param index - Index of the sub-emitter to remove
|
|
37904
|
+
*/ _proto.removeSubEmitterByIndex = function removeSubEmitterByIndex(index) {
|
|
37905
|
+
this._subEmitters.splice(index, 1);
|
|
37906
|
+
this._generator._setTransformFeedback();
|
|
37907
|
+
};
|
|
37908
|
+
/**
|
|
37909
|
+
* @internal
|
|
37910
|
+
*/ _proto._dispatchEvent = function _dispatchEvent(type, worldPosition, parentColor, parentSize, parentRotation, worldDirection) {
|
|
37911
|
+
var subEmitters = this.subEmitters;
|
|
37912
|
+
for(var i = 0, n = subEmitters.length; i < n; i++){
|
|
37913
|
+
var sub = subEmitters[i];
|
|
37914
|
+
if (sub.type !== type) continue;
|
|
37915
|
+
var target = sub.emitter;
|
|
37916
|
+
if (target === null || target.destroyed) continue;
|
|
37917
|
+
var count = sub.emitCount;
|
|
37918
|
+
if (count <= 0) continue;
|
|
37919
|
+
if (sub.emitProbability < 1.0 && this._probabilityRand.random() >= sub.emitProbability) {
|
|
37920
|
+
continue;
|
|
37921
|
+
}
|
|
37922
|
+
var inherit = sub.inheritProperties;
|
|
37923
|
+
var colorOverride = (inherit & ParticleSubEmitterInheritProperty.Color) !== 0 ? parentColor : null;
|
|
37924
|
+
var sizeOverride = (inherit & ParticleSubEmitterInheritProperty.Size) !== 0 ? parentSize : null;
|
|
37925
|
+
var rotationOverride = (inherit & ParticleSubEmitterInheritProperty.Rotation) !== 0 ? parentRotation : null;
|
|
37926
|
+
var directionOverride = (inherit & ParticleSubEmitterInheritProperty.Velocity) !== 0 ? worldDirection : null;
|
|
37927
|
+
target.generator._emitFromSubEmitter(count, worldPosition, colorOverride, sizeOverride, rotationOverride, directionOverride);
|
|
37928
|
+
}
|
|
37929
|
+
};
|
|
37930
|
+
/**
|
|
37931
|
+
* @internal
|
|
37932
|
+
*/ _proto._resetRandomSeed = function _resetRandomSeed(seed) {
|
|
37933
|
+
this._probabilityRand.reset(seed, ParticleRandomSubSeeds.SubEmitter);
|
|
37934
|
+
};
|
|
37935
|
+
/**
|
|
37936
|
+
* @internal
|
|
37937
|
+
*/ _proto._hasSubEmitterOfType = function _hasSubEmitterOfType(type) {
|
|
37938
|
+
if (!this.enabled) return false;
|
|
37939
|
+
var subEmitters = this.subEmitters;
|
|
37940
|
+
for(var i = 0, n = subEmitters.length; i < n; i++){
|
|
37941
|
+
if (subEmitters[i].type === type) return true;
|
|
37942
|
+
}
|
|
37943
|
+
return false;
|
|
37944
|
+
};
|
|
37945
|
+
/**
|
|
37946
|
+
* @internal
|
|
37947
|
+
*/ _proto._cloneTo = function _cloneTo(target) {
|
|
37948
|
+
// _module is @ignoreClone, so re-link each cloned slot back to its new module
|
|
37949
|
+
var subEmitters = target._subEmitters;
|
|
37950
|
+
for(var i = 0, n = subEmitters.length; i < n; i++){
|
|
37951
|
+
subEmitters[i]._module = target;
|
|
37952
|
+
}
|
|
37953
|
+
};
|
|
37954
|
+
/**
|
|
37955
|
+
* @internal
|
|
37956
|
+
*/ _proto._validateEmitter = function _validateEmitter(emitter) {
|
|
37957
|
+
if (emitter && SubEmittersModule._wouldCreateCycle(emitter, this._generator)) {
|
|
37958
|
+
throw new Error("Sub-emitter would create a cycle");
|
|
37959
|
+
}
|
|
37960
|
+
};
|
|
37961
|
+
SubEmittersModule._wouldCreateCycle = function _wouldCreateCycle(target, root) {
|
|
37962
|
+
var visited = SubEmittersModule._cycleVisited;
|
|
37963
|
+
var stack = SubEmittersModule._cycleStack;
|
|
37964
|
+
visited.clear();
|
|
37965
|
+
stack.length = 0;
|
|
37966
|
+
stack.push(target.generator);
|
|
37967
|
+
var found = false;
|
|
37968
|
+
while(stack.length > 0){
|
|
37969
|
+
var cur = stack.pop();
|
|
37970
|
+
if (cur === root) {
|
|
37971
|
+
found = true;
|
|
37972
|
+
break;
|
|
37973
|
+
}
|
|
37974
|
+
if (visited.has(cur)) continue;
|
|
37975
|
+
visited.add(cur);
|
|
37976
|
+
var slots = cur.subEmitters.subEmitters;
|
|
37977
|
+
for(var i = 0, n = slots.length; i < n; i++){
|
|
37978
|
+
var _slots_i_emitter;
|
|
37979
|
+
var child = (_slots_i_emitter = slots[i].emitter) == null ? void 0 : _slots_i_emitter.generator;
|
|
37980
|
+
if (child && !visited.has(child)) stack.push(child);
|
|
37981
|
+
}
|
|
37982
|
+
}
|
|
37983
|
+
visited.clear();
|
|
37984
|
+
stack.length = 0;
|
|
37985
|
+
return found;
|
|
37986
|
+
};
|
|
37987
|
+
_create_class(SubEmittersModule, [
|
|
37988
|
+
{
|
|
37989
|
+
key: "subEmitters",
|
|
37990
|
+
get: /**
|
|
37991
|
+
* The configured sub-emitters.
|
|
37992
|
+
*/ function get() {
|
|
37993
|
+
return this._subEmitters;
|
|
37994
|
+
}
|
|
37995
|
+
},
|
|
37996
|
+
{
|
|
37997
|
+
key: "enabled",
|
|
37998
|
+
get: function get() {
|
|
37999
|
+
return this._enabled && this._generator._renderer.engine._hardwareRenderer.isWebGL2;
|
|
38000
|
+
},
|
|
38001
|
+
set: function set(value) {
|
|
38002
|
+
if (value !== this._enabled) {
|
|
38003
|
+
this._enabled = value;
|
|
38004
|
+
this._generator._setTransformFeedback();
|
|
38005
|
+
}
|
|
38006
|
+
}
|
|
38007
|
+
}
|
|
38008
|
+
]);
|
|
38009
|
+
return SubEmittersModule;
|
|
38010
|
+
}(ParticleGeneratorModule);
|
|
38011
|
+
SubEmittersModule._cycleVisited = new Set();
|
|
38012
|
+
SubEmittersModule._cycleStack = [];
|
|
38013
|
+
__decorate([
|
|
38014
|
+
deepClone
|
|
38015
|
+
], SubEmittersModule.prototype, "_subEmitters", void 0);
|
|
38016
|
+
__decorate([
|
|
38017
|
+
ignoreClone
|
|
38018
|
+
], SubEmittersModule.prototype, "_probabilityRand", void 0);
|
|
38019
|
+
|
|
37669
38020
|
/**
|
|
37670
38021
|
* Particle Generator.
|
|
37671
38022
|
*/ var ParticleGenerator = /*#__PURE__*/ function() {
|
|
@@ -37685,6 +38036,7 @@ __decorate([
|
|
|
37685
38036
|
/** @internal */ this._subPrimitive = new SubMesh(0, 0, MeshTopology.Triangles);
|
|
37686
38037
|
/** @internal */ this._useTransformFeedback = false;
|
|
37687
38038
|
/** @internal */ this._feedbackBindingIndex = -1;
|
|
38039
|
+
this._feedbackReadback = null;
|
|
37688
38040
|
this._isPlaying = false;
|
|
37689
38041
|
this._instanceBufferResized = false;
|
|
37690
38042
|
this._waitProcessRetiredElementCount = 0;
|
|
@@ -37693,6 +38045,13 @@ __decorate([
|
|
|
37693
38045
|
this._firstActiveTransformedBoundingBox = 0;
|
|
37694
38046
|
this._firstFreeTransformedBoundingBox = 0;
|
|
37695
38047
|
this._playStartDelay = 0;
|
|
38048
|
+
this._eventPos = new Vector3();
|
|
38049
|
+
this._eventColor = new Color();
|
|
38050
|
+
this._eventSize = new Vector3();
|
|
38051
|
+
this._eventRotation = new Vector3();
|
|
38052
|
+
this._eventDir = new Vector3();
|
|
38053
|
+
this._emitLocalPos = new Vector3();
|
|
38054
|
+
this._emitDirection = new Vector3();
|
|
37696
38055
|
this._renderer = renderer;
|
|
37697
38056
|
var subPrimitive = new SubPrimitive();
|
|
37698
38057
|
subPrimitive.start = 0;
|
|
@@ -37705,6 +38064,7 @@ __decorate([
|
|
|
37705
38064
|
this.sizeOverLifetime = new SizeOverLifetimeModule(this);
|
|
37706
38065
|
this.limitVelocityOverLifetime = new LimitVelocityOverLifetimeModule(this);
|
|
37707
38066
|
this.noise = new NoiseModule(this);
|
|
38067
|
+
this.subEmitters = new SubEmittersModule(this);
|
|
37708
38068
|
this.customData = new CustomDataModule(this);
|
|
37709
38069
|
this.emission.enabled = true;
|
|
37710
38070
|
}
|
|
@@ -38036,11 +38396,12 @@ __decorate([
|
|
|
38036
38396
|
this.rotationOverLifetime._resetRandomSeed(seed);
|
|
38037
38397
|
this.colorOverLifetime._resetRandomSeed(seed);
|
|
38038
38398
|
this.noise._resetRandomSeed(seed);
|
|
38399
|
+
this.subEmitters._resetRandomSeed(seed);
|
|
38039
38400
|
};
|
|
38040
38401
|
/**
|
|
38041
38402
|
* @internal
|
|
38042
38403
|
*/ _proto._setTransformFeedback = function _setTransformFeedback() {
|
|
38043
|
-
var needed = this.limitVelocityOverLifetime.enabled || this.noise.enabled;
|
|
38404
|
+
var needed = this._renderer.engine._hardwareRenderer.isWebGL2 && (this.limitVelocityOverLifetime.enabled || this.noise.enabled || this.subEmitters._hasSubEmitterOfType(ParticleSubEmitterType.Death));
|
|
38044
38405
|
if (needed === this._useTransformFeedback) return;
|
|
38045
38406
|
this._useTransformFeedback = needed;
|
|
38046
38407
|
// Switching TF mode invalidates all active particle state: feedback buffers and instance
|
|
@@ -38201,7 +38562,7 @@ __decorate([
|
|
|
38201
38562
|
this._transformedBoundsArray[previousFreeElement * ParticleBufferUtils.boundsFloatStride + boundsTimeOffset] = this._playTime;
|
|
38202
38563
|
}
|
|
38203
38564
|
};
|
|
38204
|
-
_proto._addNewParticle = function _addNewParticle(position, direction, transform, playTime, emitWorldPositionOverride) {
|
|
38565
|
+
_proto._addNewParticle = function _addNewParticle(position, direction, transform, playTime, emitWorldPositionOverride, inheritColor, inheritSize, inheritRotation) {
|
|
38205
38566
|
var firstFreeElement = this._firstFreeElement;
|
|
38206
38567
|
var nextFreeElement = firstFreeElement + 1;
|
|
38207
38568
|
if (nextFreeElement >= this._currentParticleCount) {
|
|
@@ -38239,7 +38600,7 @@ __decorate([
|
|
|
38239
38600
|
// Time
|
|
38240
38601
|
instanceVertices[offset + ParticleBufferUtils.timeOffset] = playTime;
|
|
38241
38602
|
// Color
|
|
38242
|
-
var startColor = ParticleGenerator.
|
|
38603
|
+
var startColor = ParticleGenerator._tempColor;
|
|
38243
38604
|
main.startColor.evaluate(undefined, main._startColorRand.random(), startColor);
|
|
38244
38605
|
startColor.copyToArray(instanceVertices, offset + 8);
|
|
38245
38606
|
var duration = this.main.duration;
|
|
@@ -38340,11 +38701,79 @@ __decorate([
|
|
|
38340
38701
|
if (limitVelocityOverLifetime.enabled && (limitVelocityOverLifetime._isSpeedRandomMode() || limitVelocityOverLifetime._isDragRandomMode())) {
|
|
38341
38702
|
instanceVertices[offset + 41] = limitVelocityOverLifetime._speedRand.random();
|
|
38342
38703
|
}
|
|
38704
|
+
// Apply sub-emit inherit: multiply color/size, add rotation
|
|
38705
|
+
if (inheritColor) {
|
|
38706
|
+
instanceVertices[offset + 8] *= inheritColor.r;
|
|
38707
|
+
instanceVertices[offset + 9] *= inheritColor.g;
|
|
38708
|
+
instanceVertices[offset + 10] *= inheritColor.b;
|
|
38709
|
+
instanceVertices[offset + 11] *= inheritColor.a;
|
|
38710
|
+
}
|
|
38711
|
+
if (inheritSize) {
|
|
38712
|
+
instanceVertices[offset + 12] *= inheritSize.x;
|
|
38713
|
+
instanceVertices[offset + 13] *= inheritSize.y;
|
|
38714
|
+
instanceVertices[offset + 14] *= inheritSize.z;
|
|
38715
|
+
}
|
|
38716
|
+
if (inheritRotation) {
|
|
38717
|
+
instanceVertices[offset + 15] += inheritRotation.x;
|
|
38718
|
+
instanceVertices[offset + 16] += inheritRotation.y;
|
|
38719
|
+
instanceVertices[offset + 17] += inheritRotation.z;
|
|
38720
|
+
}
|
|
38343
38721
|
// Initialize feedback buffer for this particle
|
|
38344
38722
|
if (this._useTransformFeedback) {
|
|
38345
38723
|
this._addFeedbackParticle(firstFreeElement, position, direction, startSpeed, transform, pos);
|
|
38346
38724
|
}
|
|
38347
38725
|
this._firstFreeElement = nextFreeElement;
|
|
38726
|
+
if (this.subEmitters._hasSubEmitterOfType(ParticleSubEmitterType.Birth)) {
|
|
38727
|
+
this._onParticleBirth(offset, position, direction, transform);
|
|
38728
|
+
}
|
|
38729
|
+
};
|
|
38730
|
+
_proto._onParticleBirth = function _onParticleBirth(offset, position, direction, transform) {
|
|
38731
|
+
var worldRotation = transform.worldRotationQuaternion;
|
|
38732
|
+
var birthPos = this._eventPos;
|
|
38733
|
+
Vector3.transformByQuat(position, worldRotation, birthPos);
|
|
38734
|
+
birthPos.add(transform.worldPosition);
|
|
38735
|
+
// Birth emission direction is known directly; Death reads it back from the feedback buffer
|
|
38736
|
+
var worldDirection = this._eventDir;
|
|
38737
|
+
Vector3.transformByQuat(direction, worldRotation, worldDirection);
|
|
38738
|
+
var parentColor = this._eventColor;
|
|
38739
|
+
var parentSize = this._eventSize;
|
|
38740
|
+
var parentRotation = this._eventRotation;
|
|
38741
|
+
this._evaluateOverLifetime(offset, 0, parentColor, parentSize, parentRotation);
|
|
38742
|
+
this.subEmitters._dispatchEvent(ParticleSubEmitterType.Birth, birthPos, parentColor, parentSize, parentRotation, worldDirection);
|
|
38743
|
+
};
|
|
38744
|
+
/**
|
|
38745
|
+
* @internal
|
|
38746
|
+
*/ _proto._emitFromSubEmitter = function _emitFromSubEmitter(count, worldPosition, inheritColor, inheritSize, inheritRotation, worldDirection) {
|
|
38747
|
+
if (count <= 0) return;
|
|
38748
|
+
var main = this.main;
|
|
38749
|
+
var notRetired = this._getNotRetiredParticleCount();
|
|
38750
|
+
var available = main.maxParticles - notRetired;
|
|
38751
|
+
if (available <= 0) return;
|
|
38752
|
+
if (count > available) count = available;
|
|
38753
|
+
var transform = this._renderer.entity.transform;
|
|
38754
|
+
var emitterWorldPosition = transform.worldPosition, emitterWorldRotation = transform.worldRotationQuaternion;
|
|
38755
|
+
// Convert event world position into local emission space for a_ShapePos
|
|
38756
|
+
var localPos = this._emitLocalPos;
|
|
38757
|
+
Vector3.subtract(worldPosition, emitterWorldPosition, localPos);
|
|
38758
|
+
var invRot = ParticleGenerator._tempQuat0;
|
|
38759
|
+
Quaternion.invert(emitterWorldRotation, invRot);
|
|
38760
|
+
Vector3.transformByQuat(localPos, invRot, localPos);
|
|
38761
|
+
var direction = this._emitDirection;
|
|
38762
|
+
if (worldDirection) {
|
|
38763
|
+
Vector3.transformByQuat(worldDirection, invRot, direction);
|
|
38764
|
+
var len = Math.sqrt(direction.x * direction.x + direction.y * direction.y + direction.z * direction.z);
|
|
38765
|
+
if (len > MathUtil.zeroTolerance) {
|
|
38766
|
+
direction.set(direction.x / len, direction.y / len, direction.z / len);
|
|
38767
|
+
} else {
|
|
38768
|
+
direction.set(0, 0, -1);
|
|
38769
|
+
}
|
|
38770
|
+
} else {
|
|
38771
|
+
direction.set(0, 0, -1);
|
|
38772
|
+
}
|
|
38773
|
+
var playTime = this._playTime;
|
|
38774
|
+
for(var i = 0; i < count; i++){
|
|
38775
|
+
this._addNewParticle(localPos, direction, transform, playTime, undefined, inheritColor, inheritSize, inheritRotation);
|
|
38776
|
+
}
|
|
38348
38777
|
};
|
|
38349
38778
|
_proto._addFeedbackParticle = function _addFeedbackParticle(index, shapePosition, direction, startSpeed, transform, emitWorldPosition) {
|
|
38350
38779
|
var position;
|
|
@@ -38368,7 +38797,10 @@ __decorate([
|
|
|
38368
38797
|
var engine = this._renderer.engine;
|
|
38369
38798
|
var frameCount = engine.time.frameCount;
|
|
38370
38799
|
var instanceVertices = this._instanceVertices;
|
|
38371
|
-
|
|
38800
|
+
var hasDeathSlot = this.subEmitters._hasSubEmitterOfType(ParticleSubEmitterType.Death);
|
|
38801
|
+
var firstNewElement = this._firstNewElement;
|
|
38802
|
+
var feedbackLoaded = false;
|
|
38803
|
+
while(this._firstActiveElement !== firstNewElement){
|
|
38372
38804
|
var activeParticleOffset = this._firstActiveElement * ParticleBufferUtils.instanceVertexFloatStride;
|
|
38373
38805
|
var activeParticleTimeOffset = activeParticleOffset + ParticleBufferUtils.timeOffset;
|
|
38374
38806
|
var particleAge = this._playTime - instanceVertices[activeParticleTimeOffset];
|
|
@@ -38376,6 +38808,13 @@ __decorate([
|
|
|
38376
38808
|
if (Math.fround(particleAge) < instanceVertices[activeParticleOffset + ParticleBufferUtils.startLifeTimeOffset]) {
|
|
38377
38809
|
break;
|
|
38378
38810
|
}
|
|
38811
|
+
if (hasDeathSlot) {
|
|
38812
|
+
if (this._feedbackSimulator && !feedbackLoaded) {
|
|
38813
|
+
this._readbackFeedback(this._firstActiveElement, firstNewElement);
|
|
38814
|
+
feedbackLoaded = true;
|
|
38815
|
+
}
|
|
38816
|
+
this._onParticleDeath(activeParticleOffset);
|
|
38817
|
+
}
|
|
38379
38818
|
// Store frame count in time offset to free retired particle
|
|
38380
38819
|
instanceVertices[activeParticleTimeOffset] = frameCount;
|
|
38381
38820
|
if (++this._firstActiveElement >= this._currentParticleCount) {
|
|
@@ -38385,6 +38824,110 @@ __decorate([
|
|
|
38385
38824
|
this._waitProcessRetiredElementCount++;
|
|
38386
38825
|
}
|
|
38387
38826
|
};
|
|
38827
|
+
_proto._readbackFeedback = function _readbackFeedback(firstActiveElement, firstNewElement) {
|
|
38828
|
+
var stride = ParticleBufferUtils.feedbackVertexStride;
|
|
38829
|
+
var floatStride = stride / 4;
|
|
38830
|
+
var totalFloatCount = this._currentParticleCount * floatStride;
|
|
38831
|
+
var readback = this._feedbackReadback;
|
|
38832
|
+
if (!readback || readback.length < totalFloatCount) {
|
|
38833
|
+
readback = this._feedbackReadback = new Float32Array(totalFloatCount);
|
|
38834
|
+
}
|
|
38835
|
+
var buffer = this._feedbackSimulator.readBinding.buffer;
|
|
38836
|
+
var wrapped = firstActiveElement >= firstNewElement;
|
|
38837
|
+
var firstSegmentEnd = wrapped ? this._currentParticleCount : firstNewElement;
|
|
38838
|
+
buffer.getData(readback, firstActiveElement * stride, firstActiveElement * floatStride, (firstSegmentEnd - firstActiveElement) * floatStride);
|
|
38839
|
+
if (wrapped && firstNewElement > 0) {
|
|
38840
|
+
buffer.getData(readback, 0, 0, firstNewElement * floatStride);
|
|
38841
|
+
}
|
|
38842
|
+
};
|
|
38843
|
+
_proto._onParticleDeath = function _onParticleDeath(particleOffset) {
|
|
38844
|
+
var instanceVertices = this._instanceVertices;
|
|
38845
|
+
var transform = this._renderer.entity.transform;
|
|
38846
|
+
var simSpaceLocal = this.main.simulationSpace === ParticleSimulationSpace.Local;
|
|
38847
|
+
var worldRotation = transform.worldRotationQuaternion;
|
|
38848
|
+
var ringIndex = particleOffset / ParticleBufferUtils.instanceVertexFloatStride;
|
|
38849
|
+
var feedbackData = this._feedbackReadback;
|
|
38850
|
+
var feedbackOffset = ringIndex * ParticleBufferUtils.feedbackVertexStride / 4;
|
|
38851
|
+
var local = this._eventPos;
|
|
38852
|
+
local.set(feedbackData[feedbackOffset], feedbackData[feedbackOffset + 1], feedbackData[feedbackOffset + 2]);
|
|
38853
|
+
if (simSpaceLocal) {
|
|
38854
|
+
Vector3.transformByQuat(local, worldRotation, local);
|
|
38855
|
+
local.add(transform.worldPosition);
|
|
38856
|
+
}
|
|
38857
|
+
var worldDirection = this._eventDir;
|
|
38858
|
+
worldDirection.set(feedbackData[feedbackOffset + 3], feedbackData[feedbackOffset + 4], feedbackData[feedbackOffset + 5]);
|
|
38859
|
+
if (simSpaceLocal) {
|
|
38860
|
+
Vector3.transformByQuat(worldDirection, worldRotation, worldDirection);
|
|
38861
|
+
} else {
|
|
38862
|
+
var spawnRotation = ParticleGenerator._tempQuat0;
|
|
38863
|
+
spawnRotation.set(instanceVertices[particleOffset + 30], instanceVertices[particleOffset + 31], instanceVertices[particleOffset + 32], instanceVertices[particleOffset + 33]);
|
|
38864
|
+
Vector3.transformByQuat(worldDirection, spawnRotation, worldDirection);
|
|
38865
|
+
}
|
|
38866
|
+
// Evaluate at the parent's normalizedAge so children inherit its visible appearance at death.
|
|
38867
|
+
var lifetime = instanceVertices[particleOffset + 3];
|
|
38868
|
+
var bornTime = instanceVertices[particleOffset + 7];
|
|
38869
|
+
var parentColor = this._eventColor;
|
|
38870
|
+
var parentSize = this._eventSize;
|
|
38871
|
+
var parentRotation = this._eventRotation;
|
|
38872
|
+
var normalizedAge = Math.min(Math.max((this._playTime - bornTime) / lifetime, 0), 1);
|
|
38873
|
+
this._evaluateOverLifetime(particleOffset, normalizedAge, parentColor, parentSize, parentRotation);
|
|
38874
|
+
this.subEmitters._dispatchEvent(ParticleSubEmitterType.Death, local, parentColor, parentSize, parentRotation, worldDirection);
|
|
38875
|
+
};
|
|
38876
|
+
_proto._evaluateOverLifetime = function _evaluateOverLifetime(particleOffset, normalizedAge, parentColor, parentSize, parentRotation) {
|
|
38877
|
+
var instanceVertices = this._instanceVertices;
|
|
38878
|
+
var r = instanceVertices[particleOffset + 8];
|
|
38879
|
+
var g = instanceVertices[particleOffset + 9];
|
|
38880
|
+
var b = instanceVertices[particleOffset + 10];
|
|
38881
|
+
var a = instanceVertices[particleOffset + 11];
|
|
38882
|
+
var col = this.colorOverLifetime;
|
|
38883
|
+
if (col.enabled) {
|
|
38884
|
+
var colorFactor = ParticleGenerator._tempColor;
|
|
38885
|
+
col.color.evaluate(normalizedAge, instanceVertices[particleOffset + 20], colorFactor);
|
|
38886
|
+
r *= colorFactor.r;
|
|
38887
|
+
g *= colorFactor.g;
|
|
38888
|
+
b *= colorFactor.b;
|
|
38889
|
+
a *= colorFactor.a;
|
|
38890
|
+
}
|
|
38891
|
+
parentColor.set(r, g, b, a);
|
|
38892
|
+
var sx = instanceVertices[particleOffset + 12];
|
|
38893
|
+
var sy = instanceVertices[particleOffset + 13];
|
|
38894
|
+
var sz = instanceVertices[particleOffset + 14];
|
|
38895
|
+
var sol = this.sizeOverLifetime;
|
|
38896
|
+
// SOL only contributes in Curve / TwoCurves modes (shader gates on RENDERER_SOL_CURVE_MODE)
|
|
38897
|
+
if (sol.enabled && (sol.sizeX.mode === ParticleCurveMode.Curve || sol.sizeX.mode === ParticleCurveMode.TwoCurves)) {
|
|
38898
|
+
var sizeRand = instanceVertices[particleOffset + 21];
|
|
38899
|
+
if (sol.separateAxes) {
|
|
38900
|
+
sx *= sol.sizeX.evaluate(normalizedAge, sizeRand);
|
|
38901
|
+
sy *= sol.sizeY.evaluate(normalizedAge, sizeRand);
|
|
38902
|
+
sz *= sol.sizeZ.evaluate(normalizedAge, sizeRand);
|
|
38903
|
+
} else {
|
|
38904
|
+
var factor = sol.sizeX.evaluate(normalizedAge, sizeRand);
|
|
38905
|
+
sx *= factor;
|
|
38906
|
+
sy *= factor;
|
|
38907
|
+
sz *= factor;
|
|
38908
|
+
}
|
|
38909
|
+
}
|
|
38910
|
+
parentSize.set(sx, sy, sz);
|
|
38911
|
+
var rx = instanceVertices[particleOffset + 15];
|
|
38912
|
+
var ry = instanceVertices[particleOffset + 16];
|
|
38913
|
+
var rz = instanceVertices[particleOffset + 17];
|
|
38914
|
+
var rol = this.rotationOverLifetime;
|
|
38915
|
+
if (rol.enabled) {
|
|
38916
|
+
var rotRand = instanceVertices[particleOffset + 22];
|
|
38917
|
+
var lifetime = instanceVertices[particleOffset + 3];
|
|
38918
|
+
var rolZ = rol.rotationZ._evaluateCumulative(normalizedAge, rotRand) * lifetime;
|
|
38919
|
+
if (rol.separateAxes) {
|
|
38920
|
+
rx += rol.rotationX._evaluateCumulative(normalizedAge, rotRand) * lifetime;
|
|
38921
|
+
ry += rol.rotationY._evaluateCumulative(normalizedAge, rotRand) * lifetime;
|
|
38922
|
+
rz += rolZ;
|
|
38923
|
+
} else if (this.main.startRotation3D) {
|
|
38924
|
+
rz += rolZ;
|
|
38925
|
+
} else {
|
|
38926
|
+
rx += rolZ; // 2D rotation: shader stores the Z angle in a_StartRotation0.x
|
|
38927
|
+
}
|
|
38928
|
+
}
|
|
38929
|
+
parentRotation.set(rx, ry, rz);
|
|
38930
|
+
};
|
|
38388
38931
|
_proto._freeRetiredParticles = function _freeRetiredParticles() {
|
|
38389
38932
|
var frameCount = this._renderer.engine.time.frameCount;
|
|
38390
38933
|
while(this._firstRetiredElement !== this._firstActiveElement){
|
|
@@ -38654,7 +39197,8 @@ ParticleGenerator._tempVector30 = new Vector3();
|
|
|
38654
39197
|
ParticleGenerator._tempVector31 = new Vector3();
|
|
38655
39198
|
ParticleGenerator._tempVector32 = new Vector3();
|
|
38656
39199
|
ParticleGenerator._tempMat = new Matrix();
|
|
38657
|
-
ParticleGenerator.
|
|
39200
|
+
ParticleGenerator._tempColor = new Color();
|
|
39201
|
+
ParticleGenerator._tempQuat0 = new Quaternion();
|
|
38658
39202
|
ParticleGenerator._tempParticleRenderers = new Array();
|
|
38659
39203
|
ParticleGenerator._particleIncreaseCount = 128;
|
|
38660
39204
|
ParticleGenerator._transformedBoundsIncreaseCount = 16;
|
|
@@ -38689,6 +39233,9 @@ __decorate([
|
|
|
38689
39233
|
__decorate([
|
|
38690
39234
|
deepClone
|
|
38691
39235
|
], ParticleGenerator.prototype, "noise", void 0);
|
|
39236
|
+
__decorate([
|
|
39237
|
+
deepClone
|
|
39238
|
+
], ParticleGenerator.prototype, "subEmitters", void 0);
|
|
38692
39239
|
__decorate([
|
|
38693
39240
|
deepClone
|
|
38694
39241
|
], ParticleGenerator.prototype, "customData", void 0);
|
|
@@ -38728,6 +39275,9 @@ __decorate([
|
|
|
38728
39275
|
__decorate([
|
|
38729
39276
|
ignoreClone
|
|
38730
39277
|
], ParticleGenerator.prototype, "_feedbackBindingIndex", void 0);
|
|
39278
|
+
__decorate([
|
|
39279
|
+
ignoreClone
|
|
39280
|
+
], ParticleGenerator.prototype, "_feedbackReadback", void 0);
|
|
38731
39281
|
__decorate([
|
|
38732
39282
|
ignoreClone
|
|
38733
39283
|
], ParticleGenerator.prototype, "_isPlaying", void 0);
|
|
@@ -38758,6 +39308,27 @@ __decorate([
|
|
|
38758
39308
|
__decorate([
|
|
38759
39309
|
ignoreClone
|
|
38760
39310
|
], ParticleGenerator.prototype, "_playStartDelay", void 0);
|
|
39311
|
+
__decorate([
|
|
39312
|
+
ignoreClone
|
|
39313
|
+
], ParticleGenerator.prototype, "_eventPos", void 0);
|
|
39314
|
+
__decorate([
|
|
39315
|
+
ignoreClone
|
|
39316
|
+
], ParticleGenerator.prototype, "_eventColor", void 0);
|
|
39317
|
+
__decorate([
|
|
39318
|
+
ignoreClone
|
|
39319
|
+
], ParticleGenerator.prototype, "_eventSize", void 0);
|
|
39320
|
+
__decorate([
|
|
39321
|
+
ignoreClone
|
|
39322
|
+
], ParticleGenerator.prototype, "_eventRotation", void 0);
|
|
39323
|
+
__decorate([
|
|
39324
|
+
ignoreClone
|
|
39325
|
+
], ParticleGenerator.prototype, "_eventDir", void 0);
|
|
39326
|
+
__decorate([
|
|
39327
|
+
ignoreClone
|
|
39328
|
+
], ParticleGenerator.prototype, "_emitLocalPos", void 0);
|
|
39329
|
+
__decorate([
|
|
39330
|
+
ignoreClone
|
|
39331
|
+
], ParticleGenerator.prototype, "_emitDirection", void 0);
|
|
38761
39332
|
|
|
38762
39333
|
/**
|
|
38763
39334
|
* Base material for visual effects like particles and trails.
|
|
@@ -40922,5 +41493,5 @@ __decorate([
|
|
|
40922
41493
|
return Polyfill;
|
|
40923
41494
|
}();
|
|
40924
41495
|
|
|
40925
|
-
export { AmbientLight, AmbientOcclusion, AmbientOcclusionQuality, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationStringCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorCondition, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorControllerParameter, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorLayerMask, AnimatorState, AnimatorStateInstance, AnimatorStateMachine, AnimatorStateTransition, AntiAliasing, AssetPromise, AssetType, AudioClip, AudioManager, AudioSource, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, BasicRenderPipeline, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlinnPhongMaterial, Blitter, BloomDownScaleMode, BloomEffect, BoolUpdateFlag, BoxColliderShape, BoxShape, Buffer, BufferAsset, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CameraModifyFlags, CameraType, Canvas, CapsuleColliderShape, CharRenderInfo, CharacterController, CircleShape, ClearableObjectPool, CloneManager, CloneUtils, Collider, ColliderShape, ColliderShapeUpAxis, Collision, CollisionDetectionMode, ColorOverLifetimeModule, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContactPoint, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, CustomDataModule, DataType, DependentMode, DepthTextureMode, DiffuseMode, DirectLight, DisorderedArray, Downsampling, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineEventType, EngineObject, Entity, EntityModifyFlags, EventDispatcher, FinalPass, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, GradientAlphaKey, GradientColorKey, HemisphereShape, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, JSONAsset, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, LayerPathMask, Light, LimitVelocityOverLifetimeModule, Loader, Logger, MSAASamples, MainModule, Material, Mesh, MeshColliderShape, MeshColliderShapeCookingFlag, MeshRenderer, MeshShape, MeshTopology, ModelMesh, NoiseModule, OverflowMode, PBRMaterial, ParticleCompositeCurve, ParticleCompositeGradient, ParticleCurve, ParticleCurveMode, ParticleGenerator, ParticleGradient, ParticleGradientMode, ParticleMaterial, ParticleRenderMode, ParticleRenderer, ParticleScaleMode, ParticleShapeArcMode, ParticleShapeType, ParticleSimulationSpace, ParticleStopMode, PhysicsMaterial, PhysicsMaterialCombineMode, PhysicsScene, PipelineStage, PlaneColliderShape, Platform, PointLight, Pointer, PointerButton, PointerEventData, PointerEventEmitter, PointerPhase, Polyfill, PostProcess, PostProcessEffect, PostProcessEffectBoolParameter, PostProcessEffectColorParameter, PostProcessEffectEnumParameter, PostProcessEffectFloatParameter, PostProcessEffectParameter, PostProcessEffectTextureParameter, PostProcessEffectVector2Parameter, PostProcessEffectVector3Parameter, PostProcessEffectVector4Parameter, PostProcessManager, PostProcessPass, PostProcessPassEvent, PostProcessUberPass, Primitive, PrimitiveMesh, Probe, ReferResource, RefractionMode, RenderBufferDepthFormat, RenderElement, RenderFace, RenderQueue, RenderQueueFlags, RenderQueueType, RenderStateElementKey, RenderTarget, Renderer, RendererUpdateFlags, RenderingStatistics, ReplacementFailureStrategy, ResourceManager, ReturnableObjectPool, RotationOverLifetimeModule, SafeLoopArray, Scene, SceneManager, Script, SetDataOptions, Shader, ShaderData, ShaderDataGroup, ShaderFactory, ShaderLanguage, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, Signal, SimpleSpriteAssembler, SizeOverLifetimeModule, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SlicedSpriteAssembler, SphereColliderShape, SphereShape, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteModifyFlags, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, SubFont, SubMesh, SubPrimitive, SubShader, SunMode, SystemInfo, TextAsset, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureSheetAnimationModule, TextureUsage, TextureUtils, TextureWrapMode, TiledSpriteAssembler, Time, TonemappingEffect, TonemappingMode, TrailMaterial, TrailRenderer, TrailTextureMode, Transform, TransformModifyFlags, UnlitMaterial, Utils, VelocityOverLifetimeModule, VertexAttribute, VertexBufferBinding, VertexElement, VertexElementFormat, VertexMergeBatcher, WrapMode, XRManager, assignmentClone, deepClone, dependentComponents, ignoreClone, registerPointerEventEmitter, request, resourceLoader, shallowClone };
|
|
41496
|
+
export { AmbientLight, AmbientOcclusion, AmbientOcclusionQuality, AnimationArrayCurve, AnimationBoolCurve, AnimationClip, AnimationClipCurveBinding, AnimationColorCurve, AnimationCurve, AnimationEvent, AnimationFloatArrayCurve, AnimationFloatCurve, AnimationQuaternionCurve, AnimationRectCurve, AnimationRefCurve, AnimationStringCurve, AnimationVector2Curve, AnimationVector3Curve, AnimationVector4Curve, Animator, AnimatorCondition, AnimatorConditionMode, AnimatorController, AnimatorControllerLayer, AnimatorControllerParameter, AnimatorCullingMode, AnimatorLayerBlendingMode, AnimatorLayerMask, AnimatorState, AnimatorStateInstance, AnimatorStateMachine, AnimatorStateTransition, AntiAliasing, AssetPromise, AssetType, AudioClip, AudioManager, AudioSource, Background, BackgroundMode, BackgroundTextureFillMode, BaseMaterial, BasicRenderPipeline, BlendFactor, BlendMode, BlendOperation, BlendShape, BlendShapeFrame, BlinnPhongMaterial, Blitter, BloomDownScaleMode, BloomEffect, BoolUpdateFlag, BoxColliderShape, BoxShape, Buffer, BufferAsset, BufferBindFlag, BufferMesh, BufferUsage, BufferUtil, Burst, Camera, CameraClearFlags, CameraModifyFlags, CameraType, Canvas, CapsuleColliderShape, CharRenderInfo, CharacterController, CircleShape, ClearableObjectPool, CloneManager, CloneUtils, Collider, ColliderShape, ColliderShapeUpAxis, Collision, CollisionDetectionMode, ColorOverLifetimeModule, ColorWriteMask, CompareFunction, Component, ConeEmitType, ConeShape, ContactPoint, ContentRestorer, ControllerCollisionFlag, ControllerNonWalkableMode, CubeProbe, CullMode, CurveKey, CustomDataModule, DataType, DependentMode, DepthTextureMode, DiffuseMode, DirectLight, DisorderedArray, Downsampling, DynamicCollider, DynamicColliderConstraints, EmissionModule, Engine, EngineEventType, EngineObject, Entity, EntityModifyFlags, EventDispatcher, FinalPass, FixedJoint, FogMode, Font, FontStyle, GLCapabilityType, GradientAlphaKey, GradientColorKey, HemisphereShape, HingeJoint, HitResult, IndexBufferBinding, IndexFormat, InputManager, InterpolationType, JSONAsset, Joint, JointLimits, JointMotor, Keyframe, Keys, Layer, LayerPathMask, Light, LimitVelocityOverLifetimeModule, Loader, Logger, MSAASamples, MainModule, Material, Mesh, MeshColliderShape, MeshColliderShapeCookingFlag, MeshRenderer, MeshShape, MeshTopology, ModelMesh, NoiseModule, OverflowMode, PBRMaterial, ParticleCompositeCurve, ParticleCompositeGradient, ParticleCurve, ParticleCurveMode, ParticleGenerator, ParticleGradient, ParticleGradientMode, ParticleMaterial, ParticleRenderMode, ParticleRenderer, ParticleScaleMode, ParticleShapeArcMode, ParticleShapeType, ParticleSimulationSpace, ParticleStopMode, ParticleSubEmitterInheritProperty, ParticleSubEmitterType, PhysicsMaterial, PhysicsMaterialCombineMode, PhysicsScene, PipelineStage, PlaneColliderShape, Platform, PointLight, Pointer, PointerButton, PointerEventData, PointerEventEmitter, PointerPhase, Polyfill, PostProcess, PostProcessEffect, PostProcessEffectBoolParameter, PostProcessEffectColorParameter, PostProcessEffectEnumParameter, PostProcessEffectFloatParameter, PostProcessEffectParameter, PostProcessEffectTextureParameter, PostProcessEffectVector2Parameter, PostProcessEffectVector3Parameter, PostProcessEffectVector4Parameter, PostProcessManager, PostProcessPass, PostProcessPassEvent, PostProcessUberPass, Primitive, PrimitiveMesh, Probe, ReferResource, RefractionMode, RenderBufferDepthFormat, RenderElement, RenderFace, RenderQueue, RenderQueueFlags, RenderQueueType, RenderStateElementKey, RenderTarget, Renderer, RendererUpdateFlags, RenderingStatistics, ReplacementFailureStrategy, ResourceManager, ReturnableObjectPool, RotationOverLifetimeModule, SafeLoopArray, Scene, SceneManager, Script, SetDataOptions, Shader, ShaderData, ShaderDataGroup, ShaderFactory, ShaderLanguage, ShaderMacro, ShaderMacroCollection, ShaderPass, ShaderProperty, ShaderPropertyType, ShaderTagKey, ShadowCascadesMode, ShadowResolution, ShadowType, Signal, SimpleSpriteAssembler, SizeOverLifetimeModule, Skin, SkinnedMeshRenderer, Sky, SkyBoxMaterial, SkyProceduralMaterial, SlicedSpriteAssembler, SphereColliderShape, SphereShape, SpotLight, SpringJoint, Sprite, SpriteAtlas, SpriteDrawMode, SpriteMask, SpriteMaskInteraction, SpriteMaskLayer, SpriteModifyFlags, SpriteRenderer, SpriteTileMode, StateMachineScript, StaticCollider, StencilOperation, SubEmitter, SubEmittersModule, SubFont, SubMesh, SubPrimitive, SubShader, SunMode, SystemInfo, TextAsset, TextHorizontalAlignment, TextRenderer, TextUtils, TextVerticalAlignment, Texture, Texture2D, Texture2DArray, TextureCoordinate, TextureCube, TextureCubeFace, TextureDepthCompareFunction, TextureFilterMode, TextureFormat, TextureSheetAnimationModule, TextureUsage, TextureUtils, TextureWrapMode, TiledSpriteAssembler, Time, TonemappingEffect, TonemappingMode, TrailMaterial, TrailRenderer, TrailTextureMode, Transform, TransformModifyFlags, UnlitMaterial, Utils, VelocityOverLifetimeModule, VertexAttribute, VertexBufferBinding, VertexElement, VertexElementFormat, VertexMergeBatcher, WrapMode, XRManager, assignmentClone, deepClone, dependentComponents, ignoreClone, registerPointerEventEmitter, request, resourceLoader, shallowClone };
|
|
40926
41497
|
//# sourceMappingURL=module.js.map
|