|
@@ -10593,7 +10593,6 @@ var BABYLON;
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -10761,7 +10760,7 @@ var BABYLON;
|
|
|
this._badOS = /iPad/i.test(navigator.userAgent) || /iPhone/i.test(navigator.userAgent);
|
|
|
// Detect if we are running on a faulty buggy desktop OS.
|
|
|
this._badDesktopOS = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
|
- BABYLON.Tools.Log("Babylon.js engine (v" + Engine.Version + ") launched");
|
|
|
+ console.log("Babylon.js engine (v" + Engine.Version + ") launched");
|
|
|
this.enableOfflineSupport = (BABYLON.Database !== undefined);
|
|
|
}
|
|
|
Object.defineProperty(Engine, "LastCreatedEngine", {
|
|
@@ -20123,10 +20122,23 @@ var BABYLON;
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
|
});
|
|
|
+ /**
|
|
|
+ * Internal, gets the first post proces.
|
|
|
+ * @returns the first post process to be run on this camera.
|
|
|
+ */
|
|
|
+ Camera.prototype._getFirstPostProcess = function () {
|
|
|
+ for (var pp in this._postProcesses) {
|
|
|
+ if (this._postProcesses[pp] !== null) {
|
|
|
+ return this._postProcesses[pp];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ };
|
|
|
Camera.prototype._cascadePostProcessesToRigCams = function () {
|
|
|
// invalidate framebuffer
|
|
|
- if (this._postProcesses.length > 0) {
|
|
|
- this._postProcesses[0].markTextureDirty();
|
|
|
+ var firstPostProcess = this._getFirstPostProcess();
|
|
|
+ if (firstPostProcess) {
|
|
|
+ firstPostProcess.markTextureDirty();
|
|
|
}
|
|
|
// glue the rigPostProcess to the end of the user postprocesses & assign to each sub-camera
|
|
|
for (var i = 0, len = this._rigCameras.length; i < len; i++) {
|
|
@@ -20156,6 +20168,9 @@ var BABYLON;
|
|
|
if (insertAt == null || insertAt < 0) {
|
|
|
this._postProcesses.push(postProcess);
|
|
|
}
|
|
|
+ else if (this._postProcesses[insertAt] === null) {
|
|
|
+ this._postProcesses[insertAt] = postProcess;
|
|
|
+ }
|
|
|
else {
|
|
|
this._postProcesses.splice(insertAt, 0, postProcess);
|
|
|
}
|
|
@@ -20165,7 +20180,7 @@ var BABYLON;
|
|
|
Camera.prototype.detachPostProcess = function (postProcess) {
|
|
|
var idx = this._postProcesses.indexOf(postProcess);
|
|
|
if (idx !== -1) {
|
|
|
- this._postProcesses.splice(idx, 1);
|
|
|
+ this._postProcesses[idx] = null;
|
|
|
}
|
|
|
this._cascadePostProcessesToRigCams(); // also ensures framebuffer invalidated
|
|
|
};
|
|
@@ -20340,7 +20355,10 @@ var BABYLON;
|
|
|
else {
|
|
|
var i = this._postProcesses.length;
|
|
|
while (--i >= 0) {
|
|
|
- this._postProcesses[i].dispose(this);
|
|
|
+ var postProcess = this._postProcesses[i];
|
|
|
+ if (postProcess) {
|
|
|
+ postProcess.dispose(this);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
// Render targets
|
|
@@ -22960,6 +22978,13 @@ var BABYLON;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ // Particles
|
|
|
+ for (var _d = 0, _e = this.particleSystems; _d < _e.length; _d++) {
|
|
|
+ var particleSystem = _e[_d];
|
|
|
+ if (!particleSystem.isReady()) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
return true;
|
|
|
};
|
|
|
Scene.prototype.resetCachedMaterial = function () {
|
|
@@ -24052,7 +24077,7 @@ var BABYLON;
|
|
|
if (this.textures) {
|
|
|
for (var i = 0; i < this.textures.length; i++) {
|
|
|
var texture = this.textures[i];
|
|
|
- if (texture && texture.isRenderTarget) {
|
|
|
+ if (texture && texture.renderList) {
|
|
|
texture.freeRenderingGroups();
|
|
|
}
|
|
|
}
|
|
@@ -36770,7 +36795,7 @@ var BABYLON;
|
|
|
if (!camera) {
|
|
|
return false;
|
|
|
}
|
|
|
- var postProcesses = postProcesses || camera._postProcesses;
|
|
|
+ var postProcesses = postProcesses || camera._postProcesses.filter(function (pp) { return pp != null; });
|
|
|
if (!postProcesses || postProcesses.length === 0 || !this._scene.postProcessesEnabled) {
|
|
|
return false;
|
|
|
}
|
|
@@ -36829,7 +36854,7 @@ var BABYLON;
|
|
|
if (!camera) {
|
|
|
return;
|
|
|
}
|
|
|
- postProcesses = postProcesses || camera._postProcesses;
|
|
|
+ postProcesses = postProcesses || camera._postProcesses.filter(function (pp) { return pp != null; });
|
|
|
if (postProcesses.length === 0 || !this._scene.postProcessesEnabled) {
|
|
|
return;
|
|
|
}
|
|
@@ -51746,13 +51771,24 @@ var BABYLON;
|
|
|
}
|
|
|
};
|
|
|
/**
|
|
|
+ * Is this system ready to be used/rendered
|
|
|
+ * @return true if the system is ready
|
|
|
+ */
|
|
|
+ ParticleSystem.prototype.isReady = function () {
|
|
|
+ var effect = this._getEffect();
|
|
|
+ if (!this.emitter || !effect.isReady() || !this.particleTexture || !this.particleTexture.isReady()) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ };
|
|
|
+ /**
|
|
|
* Renders the particle system in its current state.
|
|
|
* @returns the current number of particles
|
|
|
*/
|
|
|
ParticleSystem.prototype.render = function () {
|
|
|
var effect = this._getEffect();
|
|
|
// Check
|
|
|
- if (!this.emitter || !effect.isReady() || !this.particleTexture || !this.particleTexture.isReady() || !this._particles.length) {
|
|
|
+ if (!this.isReady() || !this._particles.length) {
|
|
|
return 0;
|
|
|
}
|
|
|
var engine = this._scene.getEngine();
|
|
@@ -51763,7 +51799,7 @@ var BABYLON;
|
|
|
effect.setTexture("diffuseSampler", this.particleTexture);
|
|
|
effect.setMatrix("view", viewMatrix);
|
|
|
effect.setMatrix("projection", this._scene.getProjectionMatrix());
|
|
|
- if (this._isAnimationSheetEnabled) {
|
|
|
+ if (this._isAnimationSheetEnabled && this.particleTexture) {
|
|
|
var baseSize = this.particleTexture.getBaseSize();
|
|
|
effect.setFloat3("particlesInfos", this.spriteCellWidth / baseSize.width, this.spriteCellHeight / baseSize.height, baseSize.width / this.spriteCellWidth);
|
|
|
}
|
|
@@ -52816,6 +52852,16 @@ var BABYLON;
|
|
|
configurable: true
|
|
|
});
|
|
|
/**
|
|
|
+ * Is this system ready to be used/rendered
|
|
|
+ * @return true if the system is ready
|
|
|
+ */
|
|
|
+ GPUParticleSystem.prototype.isReady = function () {
|
|
|
+ if (!this.emitter || !this._updateEffect.isReady() || !this._renderEffect.isReady() || !this.particleTexture || !this.particleTexture.isReady()) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ };
|
|
|
+ /**
|
|
|
* Gets Wether the system has been started.
|
|
|
* @returns True if it has been started, otherwise false.
|
|
|
*/
|
|
@@ -52968,7 +53014,7 @@ var BABYLON;
|
|
|
}
|
|
|
this._recreateUpdateEffect();
|
|
|
this._recreateRenderEffect();
|
|
|
- if (!this.emitter || !this._updateEffect.isReady() || !this._renderEffect.isReady()) {
|
|
|
+ if (!this.isReady()) {
|
|
|
return 0;
|
|
|
}
|
|
|
if (this._currentRenderId === this._scene.getRenderId()) {
|
|
@@ -55542,6 +55588,13 @@ var BABYLON;
|
|
|
get: function () {
|
|
|
return this._sourceMesh.renderingGroupId;
|
|
|
},
|
|
|
+ set: function (value) {
|
|
|
+ if (!this._sourceMesh || value === this._sourceMesh.renderingGroupId) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //no-op with warning
|
|
|
+ BABYLON.Tools.Warn("Note - setting renderingGroupId of an instanced mesh has no effect on the scene");
|
|
|
+ },
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
|
});
|
|
@@ -58888,8 +58941,7 @@ var BABYLON;
|
|
|
for (var meshIndex = 0; meshIndex < currentRenderListLength; meshIndex++) {
|
|
|
var mesh = currentRenderList[meshIndex];
|
|
|
if (mesh) {
|
|
|
- if (!mesh.isReady()) {
|
|
|
- // Reset _currentRefreshId
|
|
|
+ if (!mesh.isReady(this.refreshRate === 0)) {
|
|
|
this.resetRefreshCounter();
|
|
|
continue;
|
|
|
}
|
|
@@ -60437,7 +60489,10 @@ var BABYLON;
|
|
|
camera.detachPostProcess(this);
|
|
|
var index = camera._postProcesses.indexOf(this);
|
|
|
if (index === 0 && camera._postProcesses.length > 0) {
|
|
|
- this._camera._postProcesses[0].markTextureDirty();
|
|
|
+ var firstPostProcess = this._camera._getFirstPostProcess();
|
|
|
+ if (firstPostProcess) {
|
|
|
+ firstPostProcess.markTextureDirty();
|
|
|
+ }
|
|
|
}
|
|
|
this.onActivateObservable.clear();
|
|
|
this.onAfterRenderObservable.clear();
|
|
@@ -67143,7 +67198,7 @@ var BABYLON;
|
|
|
var camera = cams[i];
|
|
|
var cameraName = camera.name;
|
|
|
for (var j = 0; j < this._indicesForCamera[cameraName].length; j++) {
|
|
|
- if (camera._postProcesses[this._indicesForCamera[cameraName][j]] === undefined) {
|
|
|
+ if (camera._postProcesses[this._indicesForCamera[cameraName][j]] === undefined || camera._postProcesses[this._indicesForCamera[cameraName][j]] === null) {
|
|
|
this._postProcesses[this._singleInstance ? 0 : cameraName].forEach(function (postProcess) {
|
|
|
cams[i].attachPostProcess(postProcess, _this._indicesForCamera[cameraName][j]);
|
|
|
});
|
|
@@ -69097,9 +69152,9 @@ var BABYLON;
|
|
|
if (blockCompilation === void 0) { blockCompilation = false; }
|
|
|
var _this = _super.call(this, name, "chromaticAberration", ["chromatic_aberration", "screen_width", "screen_height", "direction", "radialIntensity", "centerPosition"], [], options, camera, samplingMode, engine, reusable, null, textureType, undefined, null, blockCompilation) || this;
|
|
|
/**
|
|
|
- * The amount of seperation of rgb channels (default: 0)
|
|
|
+ * The amount of seperation of rgb channels (default: 30)
|
|
|
*/
|
|
|
- _this.aberrationAmount = 0;
|
|
|
+ _this.aberrationAmount = 30;
|
|
|
/**
|
|
|
* The amount the effect will increase for pixels closer to the edge of the screen. (default: 0)
|
|
|
*/
|