|
@@ -28152,10 +28152,6 @@ var BABYLON;
|
|
if (BABYLON.AudioEngine) {
|
|
if (BABYLON.AudioEngine) {
|
|
this.disposeSounds();
|
|
this.disposeSounds();
|
|
}
|
|
}
|
|
- // VR Helper
|
|
|
|
- if (this.VRHelper) {
|
|
|
|
- this.VRHelper.dispose();
|
|
|
|
- }
|
|
|
|
// Detach cameras
|
|
// Detach cameras
|
|
var canvas = this._engine.getRenderingCanvas();
|
|
var canvas = this._engine.getRenderingCanvas();
|
|
if (canvas) {
|
|
if (canvas) {
|
|
@@ -55685,6 +55681,8 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
this.cellIndex = 0;
|
|
this.cellIndex = 0;
|
|
/** @hidden */
|
|
/** @hidden */
|
|
|
|
+ this._attachedSubEmitters = null;
|
|
|
|
+ /** @hidden */
|
|
this._currentColor1 = new BABYLON.Color4(0, 0, 0, 0);
|
|
this._currentColor1 = new BABYLON.Color4(0, 0, 0, 0);
|
|
/** @hidden */
|
|
/** @hidden */
|
|
this._currentColor2 = new BABYLON.Color4(0, 0, 0, 0);
|
|
this._currentColor2 = new BABYLON.Color4(0, 0, 0, 0);
|
|
@@ -55708,6 +55706,7 @@ var BABYLON;
|
|
this._currentDrag1 = 0;
|
|
this._currentDrag1 = 0;
|
|
/** @hidden */
|
|
/** @hidden */
|
|
this._currentDrag2 = 0;
|
|
this._currentDrag2 = 0;
|
|
|
|
+ this.id = Particle._Count++;
|
|
if (!this.particleSystem.isAnimationSheetEnabled) {
|
|
if (!this.particleSystem.isAnimationSheetEnabled) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -55772,6 +55771,8 @@ var BABYLON;
|
|
other.angularSpeed = this.angularSpeed;
|
|
other.angularSpeed = this.angularSpeed;
|
|
other.particleSystem = this.particleSystem;
|
|
other.particleSystem = this.particleSystem;
|
|
other.cellIndex = this.cellIndex;
|
|
other.cellIndex = this.cellIndex;
|
|
|
|
+ other.id = this.id;
|
|
|
|
+ other._attachedSubEmitters = this._attachedSubEmitters;
|
|
if (this._currentColorGradient) {
|
|
if (this._currentColorGradient) {
|
|
other._currentColorGradient = this._currentColorGradient;
|
|
other._currentColorGradient = this._currentColorGradient;
|
|
other._currentColor1.copyFrom(this._currentColor1);
|
|
other._currentColor1.copyFrom(this._currentColor1);
|
|
@@ -55810,6 +55811,7 @@ var BABYLON;
|
|
other.remapData.copyFrom(this.remapData);
|
|
other.remapData.copyFrom(this.remapData);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
+ Particle._Count = 0;
|
|
return Particle;
|
|
return Particle;
|
|
}());
|
|
}());
|
|
BABYLON.Particle = Particle;
|
|
BABYLON.Particle = Particle;
|
|
@@ -56457,6 +56459,10 @@ var BABYLON;
|
|
if (epsilon === void 0) { epsilon = 0.01; }
|
|
if (epsilon === void 0) { epsilon = 0.01; }
|
|
var _this = _super.call(this, name) || this;
|
|
var _this = _super.call(this, name) || this;
|
|
/**
|
|
/**
|
|
|
|
+ * @hidden
|
|
|
|
+ */
|
|
|
|
+ _this._inheritedVelocityOffset = new BABYLON.Vector3();
|
|
|
|
+ /**
|
|
* An event triggered when the system is disposed
|
|
* An event triggered when the system is disposed
|
|
*/
|
|
*/
|
|
_this.onDisposeObservable = new BABYLON.Observable();
|
|
_this.onDisposeObservable = new BABYLON.Observable();
|
|
@@ -56483,12 +56489,18 @@ var BABYLON;
|
|
_this._currentStartSize2 = 0;
|
|
_this._currentStartSize2 = 0;
|
|
_this._rawTextureWidth = 256;
|
|
_this._rawTextureWidth = 256;
|
|
_this._useRampGradients = false;
|
|
_this._useRampGradients = false;
|
|
|
|
+ /**
|
|
|
|
+ * @hidden
|
|
|
|
+ * If the particle systems emitter should be disposed when the particle system is disposed
|
|
|
|
+ */
|
|
|
|
+ _this._disposeEmitterOnDispose = false;
|
|
// start of sub system methods
|
|
// start of sub system methods
|
|
/**
|
|
/**
|
|
* "Recycles" one of the particle by copying it back to the "stock" of particles and removing it from the active list.
|
|
* "Recycles" one of the particle by copying it back to the "stock" of particles and removing it from the active list.
|
|
* Its lifetime will start back at 0.
|
|
* Its lifetime will start back at 0.
|
|
*/
|
|
*/
|
|
_this.recycleParticle = function (particle) {
|
|
_this.recycleParticle = function (particle) {
|
|
|
|
+ // move particle from activeParticle list to stock particles
|
|
var lastParticle = _this._particles.pop();
|
|
var lastParticle = _this._particles.pop();
|
|
if (lastParticle !== particle) {
|
|
if (lastParticle !== particle) {
|
|
lastParticle.copyTo(particle);
|
|
lastParticle.copyTo(particle);
|
|
@@ -56504,17 +56516,34 @@ var BABYLON;
|
|
else {
|
|
else {
|
|
particle = new BABYLON.Particle(_this);
|
|
particle = new BABYLON.Particle(_this);
|
|
}
|
|
}
|
|
|
|
+ // Attach emitters
|
|
|
|
+ if (_this._subEmitters && _this._subEmitters.length > 0) {
|
|
|
|
+ var subEmitters = _this._subEmitters[Math.floor(Math.random() * _this._subEmitters.length)];
|
|
|
|
+ particle._attachedSubEmitters = [];
|
|
|
|
+ subEmitters.forEach(function (subEmitter) {
|
|
|
|
+ if (subEmitter.type === BABYLON.SubEmitterType.ATTACHED) {
|
|
|
|
+ var newEmitter = subEmitter.clone();
|
|
|
|
+ particle._attachedSubEmitters.push(newEmitter);
|
|
|
|
+ newEmitter.particleSystem.start();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
return particle;
|
|
return particle;
|
|
};
|
|
};
|
|
_this._emitFromParticle = function (particle) {
|
|
_this._emitFromParticle = function (particle) {
|
|
- if (!_this.subEmitters || _this.subEmitters.length === 0) {
|
|
|
|
|
|
+ if (!_this._subEmitters || _this._subEmitters.length === 0) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- var templateIndex = Math.floor(Math.random() * _this.subEmitters.length);
|
|
|
|
- var subSystem = _this.subEmitters[templateIndex].clone(_this.name + "_sub", particle.position.clone());
|
|
|
|
- subSystem._rootParticleSystem = _this;
|
|
|
|
- _this.activeSubSystems.push(subSystem);
|
|
|
|
- subSystem.start();
|
|
|
|
|
|
+ var templateIndex = Math.floor(Math.random() * _this._subEmitters.length);
|
|
|
|
+ _this._subEmitters[templateIndex].forEach(function (subEmitter) {
|
|
|
|
+ if (subEmitter.type === BABYLON.SubEmitterType.END) {
|
|
|
|
+ var subSystem = subEmitter.clone();
|
|
|
|
+ ParticleSystem._InheritParticleInfoToSubEmitter(subSystem, particle);
|
|
|
|
+ subSystem.particleSystem._rootParticleSystem = _this;
|
|
|
|
+ _this.activeSubSystems.push(subSystem.particleSystem);
|
|
|
|
+ subSystem.particleSystem.start();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
};
|
|
};
|
|
_this._capacity = capacity;
|
|
_this._capacity = capacity;
|
|
_this._epsilon = epsilon;
|
|
_this._epsilon = epsilon;
|
|
@@ -56541,6 +56570,13 @@ var BABYLON;
|
|
particle.age += _this._scaledUpdateSpeed;
|
|
particle.age += _this._scaledUpdateSpeed;
|
|
if (particle.age >= particle.lifeTime) { // Recycle by swapping with last particle
|
|
if (particle.age >= particle.lifeTime) { // Recycle by swapping with last particle
|
|
_this._emitFromParticle(particle);
|
|
_this._emitFromParticle(particle);
|
|
|
|
+ if (particle._attachedSubEmitters) {
|
|
|
|
+ particle._attachedSubEmitters.forEach(function (subEmitter) {
|
|
|
|
+ subEmitter.particleSystem.disposeOnStop = true;
|
|
|
|
+ subEmitter.particleSystem.stop();
|
|
|
|
+ });
|
|
|
|
+ particle._attachedSubEmitters = null;
|
|
|
|
+ }
|
|
_this.recycleParticle(particle);
|
|
_this.recycleParticle(particle);
|
|
index--;
|
|
index--;
|
|
return "continue";
|
|
return "continue";
|
|
@@ -56648,9 +56684,6 @@ var BABYLON;
|
|
particle.size = BABYLON.Scalar.Lerp(particle._currentSize1, particle._currentSize2, scale);
|
|
particle.size = BABYLON.Scalar.Lerp(particle._currentSize1, particle._currentSize2, scale);
|
|
});
|
|
});
|
|
}
|
|
}
|
|
- if (_this._isAnimationSheetEnabled) {
|
|
|
|
- particle.updateCellIndex();
|
|
|
|
- }
|
|
|
|
// Remap data
|
|
// Remap data
|
|
if (_this._useRampGradients) {
|
|
if (_this._useRampGradients) {
|
|
if (_this._colorRemapGradients && _this._colorRemapGradients.length > 0) {
|
|
if (_this._colorRemapGradients && _this._colorRemapGradients.length > 0) {
|
|
@@ -56670,6 +56703,15 @@ var BABYLON;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if (_this._isAnimationSheetEnabled) {
|
|
|
|
+ particle.updateCellIndex();
|
|
|
|
+ }
|
|
|
|
+ // Update the position of the attached sub-emitters to match their attached particle
|
|
|
|
+ if (particle._attachedSubEmitters && particle._attachedSubEmitters.length > 0) {
|
|
|
|
+ particle._attachedSubEmitters.forEach(function (subEmitter) {
|
|
|
|
+ ParticleSystem._InheritParticleInfoToSubEmitter(subEmitter, particle);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
}
|
|
}
|
|
};
|
|
};
|
|
var particle;
|
|
var particle;
|
|
@@ -56727,6 +56769,27 @@ var BABYLON;
|
|
ParticleSystem.prototype.getClassName = function () {
|
|
ParticleSystem.prototype.getClassName = function () {
|
|
return "ParticleSystem";
|
|
return "ParticleSystem";
|
|
};
|
|
};
|
|
|
|
+ ParticleSystem._InheritParticleInfoToSubEmitter = function (subEmitter, particle) {
|
|
|
|
+ if (subEmitter.particleSystem.emitter.position) {
|
|
|
|
+ var emitterMesh = subEmitter.particleSystem.emitter;
|
|
|
|
+ emitterMesh.position.copyFrom(particle.position);
|
|
|
|
+ if (subEmitter.inheritDirection) {
|
|
|
|
+ emitterMesh.position.subtractToRef(particle.direction, BABYLON.Tmp.Vector3[0]);
|
|
|
|
+ // Look at using Y as forward
|
|
|
|
+ emitterMesh.lookAt(BABYLON.Tmp.Vector3[0], 0, Math.PI / 2);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ var emitterPosition = subEmitter.particleSystem.emitter;
|
|
|
|
+ emitterPosition.copyFrom(particle.position);
|
|
|
|
+ if (subEmitter.inheritDirection) {
|
|
|
|
+ BABYLON.Tools.Warn("subEmitter.inheritDirection is not supported with non-mesh emitter type");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // Set inheritedVelocityOffset to be used when new particles are created
|
|
|
|
+ particle.direction.scaleToRef(subEmitter.inheritedVelocityAmount / 2, BABYLON.Tmp.Vector3[0]);
|
|
|
|
+ subEmitter.particleSystem._inheritedVelocityOffset.copyFrom(BABYLON.Tmp.Vector3[0]);
|
|
|
|
+ };
|
|
ParticleSystem.prototype._addFactorGradient = function (factorGradients, gradient, factor, factor2) {
|
|
ParticleSystem.prototype._addFactorGradient = function (factorGradients, gradient, factor, factor2) {
|
|
var newGradient = new BABYLON.FactorGradient();
|
|
var newGradient = new BABYLON.FactorGradient();
|
|
newGradient.gradient = gradient;
|
|
newGradient.gradient = gradient;
|
|
@@ -57241,10 +57304,25 @@ var BABYLON;
|
|
}, delay);
|
|
}, delay);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
+ // Convert the subEmitters field to the constant type field _subEmitters
|
|
|
|
+ this._subEmitters = new Array();
|
|
|
|
+ if (this.subEmitters) {
|
|
|
|
+ this.subEmitters.forEach(function (subEmitter) {
|
|
|
|
+ if (subEmitter instanceof ParticleSystem) {
|
|
|
|
+ _this._subEmitters.push([new BABYLON.SubEmitter(subEmitter)]);
|
|
|
|
+ }
|
|
|
|
+ else if (subEmitter instanceof BABYLON.SubEmitter) {
|
|
|
|
+ _this._subEmitters.push([subEmitter]);
|
|
|
|
+ }
|
|
|
|
+ else if (subEmitter instanceof Array) {
|
|
|
|
+ _this._subEmitters.push(subEmitter);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
this._started = true;
|
|
this._started = true;
|
|
this._stopped = false;
|
|
this._stopped = false;
|
|
this._actualFrame = 0;
|
|
this._actualFrame = 0;
|
|
- if (this.subEmitters && this.subEmitters.length != 0) {
|
|
|
|
|
|
+ if (this._subEmitters && this._subEmitters.length != 0) {
|
|
this.activeSubSystems = new Array();
|
|
this.activeSubSystems = new Array();
|
|
}
|
|
}
|
|
if (this.preWarmCycles) {
|
|
if (this.preWarmCycles) {
|
|
@@ -57506,6 +57584,8 @@ var BABYLON;
|
|
particle._initialStartSpriteCellID = this_1.startSpriteCellID;
|
|
particle._initialStartSpriteCellID = this_1.startSpriteCellID;
|
|
particle._initialEndSpriteCellID = this_1.endSpriteCellID;
|
|
particle._initialEndSpriteCellID = this_1.endSpriteCellID;
|
|
}
|
|
}
|
|
|
|
+ // Inherited Velocity
|
|
|
|
+ particle.direction.addInPlace(this_1._inheritedVelocityOffset);
|
|
// Remap
|
|
// Remap
|
|
if (this_1._useRampGradients) {
|
|
if (this_1._useRampGradients) {
|
|
particle.remapData = new BABYLON.Vector4(0, 1, 0, 1);
|
|
particle.remapData = new BABYLON.Vector4(0, 1, 0, 1);
|
|
@@ -57806,6 +57886,9 @@ var BABYLON;
|
|
this.noiseTexture = null;
|
|
this.noiseTexture = null;
|
|
}
|
|
}
|
|
this._removeFromRoot();
|
|
this._removeFromRoot();
|
|
|
|
+ if (this._disposeEmitterOnDispose && !this.emitter.isDisposed) {
|
|
|
|
+ this.emitter.dispose();
|
|
|
|
+ }
|
|
// Remove from scene
|
|
// Remove from scene
|
|
var index = this._scene.particleSystems.indexOf(this);
|
|
var index = this._scene.particleSystems.indexOf(this);
|
|
if (index > -1) {
|
|
if (index > -1) {
|
|
@@ -57843,6 +57926,52 @@ var BABYLON;
|
|
if (this.particleTexture) {
|
|
if (this.particleTexture) {
|
|
result.particleTexture = new BABYLON.Texture(this.particleTexture.url, this._scene);
|
|
result.particleTexture = new BABYLON.Texture(this.particleTexture.url, this._scene);
|
|
}
|
|
}
|
|
|
|
+ // Clone gradients
|
|
|
|
+ if (this._colorGradients) {
|
|
|
|
+ this._colorGradients.forEach(function (v) {
|
|
|
|
+ result.addColorGradient(v.gradient, v.color1, v.color2);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if (this._dragGradients) {
|
|
|
|
+ this._dragGradients.forEach(function (v) {
|
|
|
|
+ result.addDragGradient(v.gradient, v.factor1, v.factor2);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if (this._angularSpeedGradients) {
|
|
|
|
+ this._angularSpeedGradients.forEach(function (v) {
|
|
|
|
+ result.addAngularSpeedGradient(v.gradient, v.factor1, v.factor2);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if (this._emitRateGradients) {
|
|
|
|
+ this._emitRateGradients.forEach(function (v) {
|
|
|
|
+ result.addEmitRateGradient(v.gradient, v.factor1, v.factor2);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if (this._lifeTimeGradients) {
|
|
|
|
+ this._lifeTimeGradients.forEach(function (v) {
|
|
|
|
+ result.addLifeTimeGradient(v.gradient, v.factor1, v.factor2);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if (this._limitVelocityGradients) {
|
|
|
|
+ this._limitVelocityGradients.forEach(function (v) {
|
|
|
|
+ result.addLimitVelocityGradient(v.gradient, v.factor1, v.factor2);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if (this._sizeGradients) {
|
|
|
|
+ this._sizeGradients.forEach(function (v) {
|
|
|
|
+ result.addSizeGradient(v.gradient, v.factor1, v.factor2);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if (this._startSizeGradients) {
|
|
|
|
+ this._startSizeGradients.forEach(function (v) {
|
|
|
|
+ result.addStartSizeGradient(v.gradient, v.factor1, v.factor2);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if (this._velocityGradients) {
|
|
|
|
+ this._velocityGradients.forEach(function (v) {
|
|
|
|
+ result.addVelocityGradient(v.gradient, v.factor1, v.factor2);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
if (!this.preventAutoStart) {
|
|
if (!this.preventAutoStart) {
|
|
result.start();
|
|
result.start();
|
|
}
|
|
}
|
|
@@ -59333,6 +59462,81 @@ var BABYLON;
|
|
|
|
|
|
//# sourceMappingURL=babylon.particleSystemComponent.js.map
|
|
//# sourceMappingURL=babylon.particleSystemComponent.js.map
|
|
|
|
|
|
|
|
+var BABYLON;
|
|
|
|
+(function (BABYLON) {
|
|
|
|
+ /**
|
|
|
|
+ * Type of sub emitter
|
|
|
|
+ */
|
|
|
|
+ var SubEmitterType;
|
|
|
|
+ (function (SubEmitterType) {
|
|
|
|
+ /**
|
|
|
|
+ * Attached to the particle over it's lifetime
|
|
|
|
+ */
|
|
|
|
+ SubEmitterType[SubEmitterType["ATTACHED"] = 0] = "ATTACHED";
|
|
|
|
+ /**
|
|
|
|
+ * Created when the particle dies
|
|
|
|
+ */
|
|
|
|
+ SubEmitterType[SubEmitterType["END"] = 1] = "END";
|
|
|
|
+ })(SubEmitterType = BABYLON.SubEmitterType || (BABYLON.SubEmitterType = {}));
|
|
|
|
+ /**
|
|
|
|
+ * Sub emitter class used to emit particles from an existing particle
|
|
|
|
+ */
|
|
|
|
+ var SubEmitter = /** @class */ (function () {
|
|
|
|
+ /**
|
|
|
|
+ * Creates a sub emitter
|
|
|
|
+ * @param particleSystem the particle system to be used by the sub emitter
|
|
|
|
+ */
|
|
|
|
+ function SubEmitter(
|
|
|
|
+ /**
|
|
|
|
+ * the particle system to be used by the sub emitter
|
|
|
|
+ */
|
|
|
|
+ particleSystem) {
|
|
|
|
+ this.particleSystem = particleSystem;
|
|
|
|
+ /**
|
|
|
|
+ * Type of the submitter (Default: END)
|
|
|
|
+ */
|
|
|
|
+ this.type = SubEmitterType.END;
|
|
|
|
+ /**
|
|
|
|
+ * If the particle should inherit the direction from the particle it's attached to. (+Y will face the direction the particle is moving) (Default: false)
|
|
|
|
+ * Note: This only is supported when using an emitter of type Mesh
|
|
|
|
+ */
|
|
|
|
+ this.inheritDirection = false;
|
|
|
|
+ /**
|
|
|
|
+ * How much of the attached particles speed should be added to the sub emitted particle (default: 0)
|
|
|
|
+ */
|
|
|
|
+ this.inheritedVelocityAmount = 0;
|
|
|
|
+ }
|
|
|
|
+ /**
|
|
|
|
+ * Clones the sub emitter
|
|
|
|
+ * @returns the cloned sub emitter
|
|
|
|
+ */
|
|
|
|
+ SubEmitter.prototype.clone = function () {
|
|
|
|
+ // Clone particle system
|
|
|
|
+ var emitter = this.particleSystem.emitter;
|
|
|
|
+ if (!emitter) {
|
|
|
|
+ emitter = new BABYLON.Vector3();
|
|
|
|
+ }
|
|
|
|
+ else if (emitter instanceof BABYLON.Vector3) {
|
|
|
|
+ emitter = emitter.clone();
|
|
|
|
+ }
|
|
|
|
+ else if (emitter instanceof BABYLON.AbstractMesh) {
|
|
|
|
+ emitter = new BABYLON.Mesh("", emitter._scene);
|
|
|
|
+ }
|
|
|
|
+ var clone = new SubEmitter(this.particleSystem.clone("", emitter));
|
|
|
|
+ // Clone properties
|
|
|
|
+ clone.type = this.type;
|
|
|
|
+ clone.inheritDirection = this.inheritDirection;
|
|
|
|
+ clone.inheritedVelocityAmount = this.inheritedVelocityAmount;
|
|
|
|
+ clone.particleSystem._disposeEmitterOnDispose = true;
|
|
|
|
+ return clone;
|
|
|
|
+ };
|
|
|
|
+ return SubEmitter;
|
|
|
|
+ }());
|
|
|
|
+ BABYLON.SubEmitter = SubEmitter;
|
|
|
|
+})(BABYLON || (BABYLON = {}));
|
|
|
|
+
|
|
|
|
+//# sourceMappingURL=babylon.subEmitter.js.map
|
|
|
|
+
|
|
|
|
|
|
var BABYLON;
|
|
var BABYLON;
|
|
(function (BABYLON) {
|
|
(function (BABYLON) {
|
|
@@ -81391,6 +81595,7 @@ var BABYLON;
|
|
_this._hasCleared = false;
|
|
_this._hasCleared = false;
|
|
_this._prevPostProcess = null;
|
|
_this._prevPostProcess = null;
|
|
_this._prevPrevPostProcess = null;
|
|
_this._prevPrevPostProcess = null;
|
|
|
|
+ _this._depthOfFieldSceneObserver = null;
|
|
_this._cameras = cameras || scene.cameras;
|
|
_this._cameras = cameras || scene.cameras;
|
|
_this._cameras = _this._cameras.slice();
|
|
_this._cameras = _this._cameras.slice();
|
|
_this._camerasToBeAttached = _this._cameras.slice();
|
|
_this._camerasToBeAttached = _this._cameras.slice();
|
|
@@ -81742,14 +81947,32 @@ var BABYLON;
|
|
this._prevPrevPostProcess = null;
|
|
this._prevPrevPostProcess = null;
|
|
this._hasCleared = false;
|
|
this._hasCleared = false;
|
|
if (this.depthOfFieldEnabled) {
|
|
if (this.depthOfFieldEnabled) {
|
|
- var depthTexture = this._scene.enableDepthRenderer(this._cameras[0]).getDepthMap();
|
|
|
|
- this.depthOfField.depthTexture = depthTexture;
|
|
|
|
|
|
+ // Multi camera suport
|
|
|
|
+ if (this._cameras.length > 1) {
|
|
|
|
+ for (var _i = 0, _a = this._cameras; _i < _a.length; _i++) {
|
|
|
|
+ var camera = _a[_i];
|
|
|
|
+ this._scene.enableDepthRenderer(camera).getDepthMap();
|
|
|
|
+ }
|
|
|
|
+ this._depthOfFieldSceneObserver = this._scene.onAfterRenderTargetsRenderObservable.add(function (scene) {
|
|
|
|
+ if (_this._cameras.indexOf(scene.activeCamera) > -1) {
|
|
|
|
+ _this.depthOfField.depthTexture = scene.enableDepthRenderer(scene.activeCamera).getDepthMap();
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);
|
|
|
|
+ var depthRenderer = this._scene.enableDepthRenderer(this._cameras[0]);
|
|
|
|
+ this.depthOfField.depthTexture = depthRenderer.getDepthMap();
|
|
|
|
+ }
|
|
if (!this.depthOfField._isReady()) {
|
|
if (!this.depthOfField._isReady()) {
|
|
this.depthOfField._updateEffects();
|
|
this.depthOfField._updateEffects();
|
|
}
|
|
}
|
|
this.addEffect(this.depthOfField);
|
|
this.addEffect(this.depthOfField);
|
|
this._setAutoClearAndTextureSharing(this.depthOfField._effects[0], true);
|
|
this._setAutoClearAndTextureSharing(this.depthOfField._effects[0], true);
|
|
}
|
|
}
|
|
|
|
+ else {
|
|
|
|
+ this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);
|
|
|
|
+ }
|
|
if (this.bloomEnabled) {
|
|
if (this.bloomEnabled) {
|
|
if (!this.bloom._isReady()) {
|
|
if (!this.bloom._isReady()) {
|
|
this.bloom._updateEffects();
|
|
this.bloom._updateEffects();
|
|
@@ -81816,6 +82039,7 @@ var BABYLON;
|
|
this.sharpen.dispose(camera);
|
|
this.sharpen.dispose(camera);
|
|
}
|
|
}
|
|
if (this.depthOfField) {
|
|
if (this.depthOfField) {
|
|
|
|
+ this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);
|
|
this.depthOfField.disposeEffects(camera);
|
|
this.depthOfField.disposeEffects(camera);
|
|
}
|
|
}
|
|
if (this.bloom) {
|
|
if (this.bloom) {
|