|
@@ -20123,10 +20123,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 +20169,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 +20181,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 +20356,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
|
|
@@ -36770,7 +36789,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 +36848,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;
|
|
|
}
|
|
@@ -55542,6 +55561,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
|
|
|
});
|
|
@@ -60437,7 +60463,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 +67172,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]);
|
|
|
});
|