|
@@ -8117,13 +8117,9 @@ var BABYLON;
|
|
scene._rebuildGeometries();
|
|
scene._rebuildGeometries();
|
|
scene._rebuildTextures();
|
|
scene._rebuildTextures();
|
|
}
|
|
}
|
|
- for (var _b = 0, _c = this.postProcesses; _b < _c.length; _b++) {
|
|
|
|
- var postprocess = _c[_b];
|
|
|
|
- postprocess._rebuild();
|
|
|
|
- }
|
|
|
|
// Uniforms
|
|
// Uniforms
|
|
- for (var _d = 0, _e = this._uniformBuffers; _d < _e.length; _d++) {
|
|
|
|
- var uniformBuffer = _e[_d];
|
|
|
|
|
|
+ for (var _b = 0, _c = this._uniformBuffers; _b < _c.length; _b++) {
|
|
|
|
+ var uniformBuffer = _c[_b];
|
|
uniformBuffer._rebuild();
|
|
uniformBuffer._rebuild();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
@@ -8423,22 +8419,21 @@ var BABYLON;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
Engine.prototype._renderLoop = function () {
|
|
Engine.prototype._renderLoop = function () {
|
|
- if (this._contextWasLost) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- var shouldRender = true;
|
|
|
|
- if (!this.renderEvenInBackground && this._windowIsBackground) {
|
|
|
|
- shouldRender = false;
|
|
|
|
- }
|
|
|
|
- if (shouldRender) {
|
|
|
|
- // Start new frame
|
|
|
|
- this.beginFrame();
|
|
|
|
- for (var index = 0; index < this._activeRenderLoops.length; index++) {
|
|
|
|
- var renderFunction = this._activeRenderLoops[index];
|
|
|
|
- renderFunction();
|
|
|
|
|
|
+ if (!this._contextWasLost) {
|
|
|
|
+ var shouldRender = true;
|
|
|
|
+ if (!this.renderEvenInBackground && this._windowIsBackground) {
|
|
|
|
+ shouldRender = false;
|
|
|
|
+ }
|
|
|
|
+ if (shouldRender) {
|
|
|
|
+ // Start new frame
|
|
|
|
+ this.beginFrame();
|
|
|
|
+ for (var index = 0; index < this._activeRenderLoops.length; index++) {
|
|
|
|
+ var renderFunction = this._activeRenderLoops[index];
|
|
|
|
+ renderFunction();
|
|
|
|
+ }
|
|
|
|
+ // Present
|
|
|
|
+ this.endFrame();
|
|
}
|
|
}
|
|
- // Present
|
|
|
|
- this.endFrame();
|
|
|
|
}
|
|
}
|
|
if (this._activeRenderLoops.length > 0) {
|
|
if (this._activeRenderLoops.length > 0) {
|
|
// Register new frame
|
|
// Register new frame
|
|
@@ -10406,6 +10401,9 @@ var BABYLON;
|
|
texture.generateMipMaps = generateMipMaps;
|
|
texture.generateMipMaps = generateMipMaps;
|
|
texture.format = format;
|
|
texture.format = format;
|
|
texture.type = type;
|
|
texture.type = type;
|
|
|
|
+ if (!this._doNotHandleContextLost) {
|
|
|
|
+ texture._bufferViewArray = data;
|
|
|
|
+ }
|
|
var textureType = this._getWebGLTextureType(type);
|
|
var textureType = this._getWebGLTextureType(type);
|
|
var internalFormat = this._getInternalFormat(format);
|
|
var internalFormat = this._getInternalFormat(format);
|
|
var internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);
|
|
var internalSizedFomat = this._getRGBABufferInternalSizedFormat(type);
|
|
@@ -10423,7 +10421,7 @@ var BABYLON;
|
|
if (!isPot) {
|
|
if (!isPot) {
|
|
generateMipMaps = false;
|
|
generateMipMaps = false;
|
|
}
|
|
}
|
|
- // Upload data if needed. The texture won t be ready until then.
|
|
|
|
|
|
+ // Upload data if needed. The texture won't be ready until then.
|
|
if (data) {
|
|
if (data) {
|
|
this.updateRawCubeTexture(texture, data, format, type, invertY, compression);
|
|
this.updateRawCubeTexture(texture, data, format, type, invertY, compression);
|
|
}
|
|
}
|
|
@@ -19401,14 +19399,17 @@ var BABYLON;
|
|
var mesh = _c[_b];
|
|
var mesh = _c[_b];
|
|
mesh._rebuild();
|
|
mesh._rebuild();
|
|
}
|
|
}
|
|
- for (var _d = 0, _e = this.postProcesses; _d < _e.length; _d++) {
|
|
|
|
- var postprocess = _e[_d];
|
|
|
|
- postprocess._rebuild();
|
|
|
|
|
|
+ if (this.postProcessManager) {
|
|
|
|
+ this.postProcessManager._rebuild();
|
|
}
|
|
}
|
|
- for (var _f = 0, _g = this.layers; _f < _g.length; _f++) {
|
|
|
|
- var layer = _g[_f];
|
|
|
|
|
|
+ for (var _d = 0, _e = this.layers; _d < _e.length; _d++) {
|
|
|
|
+ var layer = _e[_d];
|
|
layer._rebuild();
|
|
layer._rebuild();
|
|
}
|
|
}
|
|
|
|
+ for (var _f = 0, _g = this.highlightLayers; _f < _g.length; _f++) {
|
|
|
|
+ var highlightLayer = _g[_f];
|
|
|
|
+ highlightLayer._rebuild();
|
|
|
|
+ }
|
|
};
|
|
};
|
|
Scene.prototype._rebuildTextures = function () {
|
|
Scene.prototype._rebuildTextures = function () {
|
|
for (var _i = 0, _a = this.textures; _i < _a.length; _i++) {
|
|
for (var _i = 0, _a = this.textures; _i < _a.length; _i++) {
|
|
@@ -20044,6 +20045,11 @@ var BABYLON;
|
|
}, null, this.format, this._extension);
|
|
}, null, this.format, this._extension);
|
|
proxy._swapAndDie(this);
|
|
proxy._swapAndDie(this);
|
|
return;
|
|
return;
|
|
|
|
+ case InternalTexture.DATASOURCE_CUBERAW:
|
|
|
|
+ proxy = this._engine.createRawCubeTexture(this._bufferViewArray, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);
|
|
|
|
+ proxy._swapAndDie(this);
|
|
|
|
+ this.isReady = true;
|
|
|
|
+ return;
|
|
case InternalTexture.DATASOURCE_CUBEPREFILTERED:
|
|
case InternalTexture.DATASOURCE_CUBEPREFILTERED:
|
|
proxy = this._engine.createPrefilteredCubeTexture(this.url, null, this._lodGenerationScale, this._lodGenerationOffset, function (proxy) {
|
|
proxy = this._engine.createPrefilteredCubeTexture(this.url, null, this._lodGenerationScale, this._lodGenerationOffset, function (proxy) {
|
|
proxy._swapAndDie(_this);
|
|
proxy._swapAndDie(_this);
|
|
@@ -29776,6 +29782,9 @@ var BABYLON;
|
|
vertices.push(-1, -1);
|
|
vertices.push(-1, -1);
|
|
vertices.push(1, -1);
|
|
vertices.push(1, -1);
|
|
this._vertexBuffers[BABYLON.VertexBuffer.PositionKind] = new BABYLON.VertexBuffer(this._scene.getEngine(), vertices, BABYLON.VertexBuffer.PositionKind, false, false, 2);
|
|
this._vertexBuffers[BABYLON.VertexBuffer.PositionKind] = new BABYLON.VertexBuffer(this._scene.getEngine(), vertices, BABYLON.VertexBuffer.PositionKind, false, false, 2);
|
|
|
|
+ this._buildIndexBuffer();
|
|
|
|
+ };
|
|
|
|
+ PostProcessManager.prototype._buildIndexBuffer = function () {
|
|
// Indices
|
|
// Indices
|
|
var indices = [];
|
|
var indices = [];
|
|
indices.push(0);
|
|
indices.push(0);
|
|
@@ -29786,6 +29795,13 @@ var BABYLON;
|
|
indices.push(3);
|
|
indices.push(3);
|
|
this._indexBuffer = this._scene.getEngine().createIndexBuffer(indices);
|
|
this._indexBuffer = this._scene.getEngine().createIndexBuffer(indices);
|
|
};
|
|
};
|
|
|
|
+ PostProcessManager.prototype._rebuild = function () {
|
|
|
|
+ if (!this._vertexBuffers[BABYLON.VertexBuffer.PositionKind]) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ this._vertexBuffers[BABYLON.VertexBuffer.PositionKind]._rebuild();
|
|
|
|
+ this._buildIndexBuffer();
|
|
|
|
+ };
|
|
// Methods
|
|
// Methods
|
|
PostProcessManager.prototype._prepareFrame = function (sourceTexture, postProcesses) {
|
|
PostProcessManager.prototype._prepareFrame = function (sourceTexture, postProcesses) {
|
|
var postProcesses = postProcesses || this._scene.activeCamera._postProcesses;
|
|
var postProcesses = postProcesses || this._scene.activeCamera._postProcesses;
|
|
@@ -45906,6 +45922,9 @@ var BABYLON;
|
|
if (this.refreshRate === RenderTargetTexture.REFRESHRATE_RENDER_ONCE) {
|
|
if (this.refreshRate === RenderTargetTexture.REFRESHRATE_RENDER_ONCE) {
|
|
this.refreshRate = RenderTargetTexture.REFRESHRATE_RENDER_ONCE;
|
|
this.refreshRate = RenderTargetTexture.REFRESHRATE_RENDER_ONCE;
|
|
}
|
|
}
|
|
|
|
+ if (this._postProcessManager) {
|
|
|
|
+ this._postProcessManager._rebuild();
|
|
|
|
+ }
|
|
};
|
|
};
|
|
RenderTargetTexture._REFRESHRATE_RENDER_ONCE = 0;
|
|
RenderTargetTexture._REFRESHRATE_RENDER_ONCE = 0;
|
|
RenderTargetTexture._REFRESHRATE_RENDER_ONEVERYFRAME = 1;
|
|
RenderTargetTexture._REFRESHRATE_RENDER_ONEVERYFRAME = 1;
|
|
@@ -46837,8 +46856,6 @@ var BABYLON;
|
|
}
|
|
}
|
|
this._textures.dispose();
|
|
this._textures.dispose();
|
|
};
|
|
};
|
|
- PostProcess.prototype._rebuild = function () {
|
|
|
|
- };
|
|
|
|
PostProcess.prototype.dispose = function (camera) {
|
|
PostProcess.prototype.dispose = function (camera) {
|
|
camera = camera || this._camera;
|
|
camera = camera || this._camera;
|
|
this._disposeTextures();
|
|
this._disposeTextures();
|
|
@@ -52272,8 +52289,10 @@ var BABYLON;
|
|
Object.defineProperty(PostProcessRenderPipeline.prototype, "isSupported", {
|
|
Object.defineProperty(PostProcessRenderPipeline.prototype, "isSupported", {
|
|
get: function () {
|
|
get: function () {
|
|
for (var renderEffectName in this._renderEffects) {
|
|
for (var renderEffectName in this._renderEffects) {
|
|
- if (!this._renderEffects[renderEffectName].isSupported) {
|
|
|
|
- return false;
|
|
|
|
|
|
+ if (this._renderEffects.hasOwnProperty(renderEffectName)) {
|
|
|
|
+ if (!this._renderEffects[renderEffectName].isSupported) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
@@ -52316,13 +52335,17 @@ var BABYLON;
|
|
cameras.splice(indicesToDelete[i], 1);
|
|
cameras.splice(indicesToDelete[i], 1);
|
|
}
|
|
}
|
|
for (var renderEffectName in this._renderEffects) {
|
|
for (var renderEffectName in this._renderEffects) {
|
|
- this._renderEffects[renderEffectName]._attachCameras(_cam);
|
|
|
|
|
|
+ if (this._renderEffects.hasOwnProperty(renderEffectName)) {
|
|
|
|
+ this._renderEffects[renderEffectName]._attachCameras(_cam);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
};
|
|
};
|
|
PostProcessRenderPipeline.prototype._detachCameras = function (cameras) {
|
|
PostProcessRenderPipeline.prototype._detachCameras = function (cameras) {
|
|
var _cam = BABYLON.Tools.MakeArray(cameras || this._cameras);
|
|
var _cam = BABYLON.Tools.MakeArray(cameras || this._cameras);
|
|
for (var renderEffectName in this._renderEffects) {
|
|
for (var renderEffectName in this._renderEffects) {
|
|
- this._renderEffects[renderEffectName]._detachCameras(_cam);
|
|
|
|
|
|
+ if (this._renderEffects.hasOwnProperty(renderEffectName)) {
|
|
|
|
+ this._renderEffects[renderEffectName]._detachCameras(_cam);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
for (var i = 0; i < _cam.length; i++) {
|
|
for (var i = 0; i < _cam.length; i++) {
|
|
this._cameras.splice(this._cameras.indexOf(_cam[i]), 1);
|
|
this._cameras.splice(this._cameras.indexOf(_cam[i]), 1);
|
|
@@ -52334,16 +52357,20 @@ var BABYLON;
|
|
var pass = null;
|
|
var pass = null;
|
|
var renderEffectName;
|
|
var renderEffectName;
|
|
for (renderEffectName in this._renderEffects) {
|
|
for (renderEffectName in this._renderEffects) {
|
|
- pass = this._renderEffects[renderEffectName].getPass(passName);
|
|
|
|
- if (pass != null) {
|
|
|
|
- break;
|
|
|
|
|
|
+ if (this._renderEffects.hasOwnProperty(renderEffectName)) {
|
|
|
|
+ pass = this._renderEffects[renderEffectName].getPass(passName);
|
|
|
|
+ if (pass != null) {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (pass === null) {
|
|
if (pass === null) {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
for (renderEffectName in this._renderEffects) {
|
|
for (renderEffectName in this._renderEffects) {
|
|
- this._renderEffects[renderEffectName]._disable(_cam);
|
|
|
|
|
|
+ if (this._renderEffects.hasOwnProperty(renderEffectName)) {
|
|
|
|
+ this._renderEffects[renderEffectName]._disable(_cam);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
pass._name = PostProcessRenderPipeline.PASS_SAMPLER_NAME;
|
|
pass._name = PostProcessRenderPipeline.PASS_SAMPLER_NAME;
|
|
for (var i = 0; i < _cam.length; i++) {
|
|
for (var i = 0; i < _cam.length; i++) {
|
|
@@ -52365,12 +52392,16 @@ var BABYLON;
|
|
this._renderEffectsForIsolatedPass[cameraName]._disable(camera);
|
|
this._renderEffectsForIsolatedPass[cameraName]._disable(camera);
|
|
}
|
|
}
|
|
for (var renderEffectName in this._renderEffects) {
|
|
for (var renderEffectName in this._renderEffects) {
|
|
- this._renderEffects[renderEffectName]._enable(_cam);
|
|
|
|
|
|
+ if (this._renderEffects.hasOwnProperty(renderEffectName)) {
|
|
|
|
+ this._renderEffects[renderEffectName]._enable(_cam);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
};
|
|
};
|
|
PostProcessRenderPipeline.prototype._update = function () {
|
|
PostProcessRenderPipeline.prototype._update = function () {
|
|
for (var renderEffectName in this._renderEffects) {
|
|
for (var renderEffectName in this._renderEffects) {
|
|
- this._renderEffects[renderEffectName]._update();
|
|
|
|
|
|
+ if (this._renderEffects.hasOwnProperty(renderEffectName)) {
|
|
|
|
+ this._renderEffects[renderEffectName]._update();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
for (var i = 0; i < this._cameras.length; i++) {
|
|
for (var i = 0; i < this._cameras.length; i++) {
|
|
var cameraName = this._cameras[i].name;
|
|
var cameraName = this._cameras[i].name;
|
|
@@ -68136,15 +68167,7 @@ var BABYLON;
|
|
vertices.push(1, -1);
|
|
vertices.push(1, -1);
|
|
var vertexBuffer = new BABYLON.VertexBuffer(engine, vertices, BABYLON.VertexBuffer.PositionKind, false, false, 2);
|
|
var vertexBuffer = new BABYLON.VertexBuffer(engine, vertices, BABYLON.VertexBuffer.PositionKind, false, false, 2);
|
|
this._vertexBuffers[BABYLON.VertexBuffer.PositionKind] = vertexBuffer;
|
|
this._vertexBuffers[BABYLON.VertexBuffer.PositionKind] = vertexBuffer;
|
|
- // Indices
|
|
|
|
- var indices = [];
|
|
|
|
- indices.push(0);
|
|
|
|
- indices.push(1);
|
|
|
|
- indices.push(2);
|
|
|
|
- indices.push(0);
|
|
|
|
- indices.push(2);
|
|
|
|
- indices.push(3);
|
|
|
|
- this._indexBuffer = engine.createIndexBuffer(indices);
|
|
|
|
|
|
+ this._createIndexBuffer();
|
|
// Effect
|
|
// Effect
|
|
this._glowMapMergeEffect = engine.createEffect("glowMapMerge", [BABYLON.VertexBuffer.PositionKind], ["offset"], ["textureSampler"], "");
|
|
this._glowMapMergeEffect = engine.createEffect("glowMapMerge", [BABYLON.VertexBuffer.PositionKind], ["offset"], ["textureSampler"], "");
|
|
// Render target
|
|
// Render target
|
|
@@ -68194,6 +68217,22 @@ var BABYLON;
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
|
|
+ HighlightLayer.prototype._createIndexBuffer = function () {
|
|
|
|
+ var engine = this._scene.getEngine();
|
|
|
|
+ // Indices
|
|
|
|
+ var indices = [];
|
|
|
|
+ indices.push(0);
|
|
|
|
+ indices.push(1);
|
|
|
|
+ indices.push(2);
|
|
|
|
+ indices.push(0);
|
|
|
|
+ indices.push(2);
|
|
|
|
+ indices.push(3);
|
|
|
|
+ this._indexBuffer = engine.createIndexBuffer(indices);
|
|
|
|
+ };
|
|
|
|
+ HighlightLayer.prototype._rebuild = function () {
|
|
|
|
+ this._vertexBuffers[BABYLON.VertexBuffer.PositionKind]._rebuild();
|
|
|
|
+ this._createIndexBuffer();
|
|
|
|
+ };
|
|
/**
|
|
/**
|
|
* Creates the render target textures and post processes used in the highlight layer.
|
|
* Creates the render target textures and post processes used in the highlight layer.
|
|
*/
|
|
*/
|
|
@@ -70242,7 +70281,15 @@ var BABYLON;
|
|
this._scene = scene || BABYLON.Engine.LastCreatedScene;
|
|
this._scene = scene || BABYLON.Engine.LastCreatedScene;
|
|
this._scene.layers.push(this);
|
|
this._scene.layers.push(this);
|
|
var engine = this._scene.getEngine();
|
|
var engine = this._scene.getEngine();
|
|
- this._rebuild();
|
|
|
|
|
|
+ // VBO
|
|
|
|
+ var vertices = [];
|
|
|
|
+ vertices.push(1, 1);
|
|
|
|
+ vertices.push(-1, 1);
|
|
|
|
+ vertices.push(-1, -1);
|
|
|
|
+ vertices.push(1, -1);
|
|
|
|
+ var vertexBuffer = new BABYLON.VertexBuffer(engine, vertices, BABYLON.VertexBuffer.PositionKind, false, false, 2);
|
|
|
|
+ this._vertexBuffers[BABYLON.VertexBuffer.PositionKind] = vertexBuffer;
|
|
|
|
+ this._createIndexBuffer();
|
|
// Effects
|
|
// Effects
|
|
this._effect = engine.createEffect("layer", [BABYLON.VertexBuffer.PositionKind], ["textureMatrix", "color", "scale", "offset"], ["textureSampler"], "");
|
|
this._effect = engine.createEffect("layer", [BABYLON.VertexBuffer.PositionKind], ["textureMatrix", "color", "scale", "offset"], ["textureSampler"], "");
|
|
this._alphaTestEffect = engine.createEffect("layer", [BABYLON.VertexBuffer.PositionKind], ["textureMatrix", "color", "scale", "offset"], ["textureSampler"], "#define ALPHATEST");
|
|
this._alphaTestEffect = engine.createEffect("layer", [BABYLON.VertexBuffer.PositionKind], ["textureMatrix", "color", "scale", "offset"], ["textureSampler"], "#define ALPHATEST");
|
|
@@ -70277,16 +70324,8 @@ var BABYLON;
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
- Layer.prototype._rebuild = function () {
|
|
|
|
|
|
+ Layer.prototype._createIndexBuffer = function () {
|
|
var engine = this._scene.getEngine();
|
|
var engine = this._scene.getEngine();
|
|
- // VBO
|
|
|
|
- var vertices = [];
|
|
|
|
- vertices.push(1, 1);
|
|
|
|
- vertices.push(-1, 1);
|
|
|
|
- vertices.push(-1, -1);
|
|
|
|
- vertices.push(1, -1);
|
|
|
|
- var vertexBuffer = new BABYLON.VertexBuffer(engine, vertices, BABYLON.VertexBuffer.PositionKind, false, false, 2);
|
|
|
|
- this._vertexBuffers[BABYLON.VertexBuffer.PositionKind] = vertexBuffer;
|
|
|
|
// Indices
|
|
// Indices
|
|
var indices = [];
|
|
var indices = [];
|
|
indices.push(0);
|
|
indices.push(0);
|
|
@@ -70297,6 +70336,10 @@ var BABYLON;
|
|
indices.push(3);
|
|
indices.push(3);
|
|
this._indexBuffer = engine.createIndexBuffer(indices);
|
|
this._indexBuffer = engine.createIndexBuffer(indices);
|
|
};
|
|
};
|
|
|
|
+ Layer.prototype._rebuild = function () {
|
|
|
|
+ this._vertexBuffers[BABYLON.VertexBuffer.PositionKind]._rebuild();
|
|
|
|
+ this._createIndexBuffer();
|
|
|
|
+ };
|
|
Layer.prototype.render = function () {
|
|
Layer.prototype.render = function () {
|
|
var currentEffect = this.alphaTest ? this._alphaTestEffect : this._effect;
|
|
var currentEffect = this.alphaTest ? this._alphaTestEffect : this._effect;
|
|
// Check
|
|
// Check
|