|
@@ -1480,7 +1480,7 @@ export class GPUParticleSystem extends BaseParticleSystem implements IDisposable
|
|
|
public clone(name: string, newEmitter: any): GPUParticleSystem {
|
|
|
var result = new GPUParticleSystem(name, { capacity: this._capacity, randomTextureSize: this._randomTextureSize }, this._scene);
|
|
|
|
|
|
- DeepCopier.DeepCopy(this, result);
|
|
|
+ DeepCopier.DeepCopy(this, result, ["particles", "customShader", "noiseTexture", "particleTexture", "onDisposeObservable"]);
|
|
|
|
|
|
if (newEmitter === undefined) {
|
|
|
newEmitter = this.emitter;
|
|
@@ -1491,6 +1491,74 @@ export class GPUParticleSystem extends BaseParticleSystem implements IDisposable
|
|
|
result.particleTexture = new Texture(this.particleTexture.url, this._scene);
|
|
|
}
|
|
|
|
|
|
+ result.noiseTexture = this.noiseTexture;
|
|
|
+ result.emitter = newEmitter;
|
|
|
+ if (this.particleTexture) {
|
|
|
+ result.particleTexture = new Texture(this.particleTexture.url, this._scene);
|
|
|
+ }
|
|
|
+
|
|
|
+ // Clone gradients
|
|
|
+ if (this._colorGradients) {
|
|
|
+ this._colorGradients.forEach((v) => {
|
|
|
+ result.addColorGradient(v.gradient, v.color1, v.color2);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (this._dragGradients) {
|
|
|
+ this._dragGradients.forEach((v) => {
|
|
|
+ result.addDragGradient(v.gradient, v.factor1);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (this._angularSpeedGradients) {
|
|
|
+ this._angularSpeedGradients.forEach((v) => {
|
|
|
+ result.addAngularSpeedGradient(v.gradient, v.factor1);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (this._emitRateGradients) {
|
|
|
+ this._emitRateGradients.forEach((v) => {
|
|
|
+ result.addEmitRateGradient(v.gradient, v.factor1, v.factor2);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (this._lifeTimeGradients) {
|
|
|
+ this._lifeTimeGradients.forEach((v) => {
|
|
|
+ result.addLifeTimeGradient(v.gradient, v.factor1, v.factor2);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (this._limitVelocityGradients) {
|
|
|
+ this._limitVelocityGradients.forEach((v) => {
|
|
|
+ result.addLimitVelocityGradient(v.gradient, v.factor1);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (this._sizeGradients) {
|
|
|
+ this._sizeGradients.forEach((v) => {
|
|
|
+ result.addSizeGradient(v.gradient, v.factor1);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (this._startSizeGradients) {
|
|
|
+ this._startSizeGradients.forEach((v) => {
|
|
|
+ result.addStartSizeGradient(v.gradient, v.factor1, v.factor2);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (this._velocityGradients) {
|
|
|
+ this._velocityGradients.forEach((v) => {
|
|
|
+ result.addVelocityGradient(v.gradient, v.factor1);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (this._rampGradients) {
|
|
|
+ this._rampGradients.forEach((v) => {
|
|
|
+ result.addRampGradient(v.gradient, v.color);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (this._colorRemapGradients) {
|
|
|
+ this._colorRemapGradients.forEach((v) => {
|
|
|
+ result.addColorRemapGradient(v.gradient, v.factor1, v.factor2!);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (this._alphaRemapGradients) {
|
|
|
+ this._alphaRemapGradients.forEach((v) => {
|
|
|
+ result.addAlphaRemapGradient(v.gradient, v.factor1, v.factor2!);
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
return result;
|
|
|
}
|
|
|
|