|
@@ -68286,7 +68286,6 @@ var BABYLON;
|
|
|
/**
|
|
|
* Creates a new instance of @see CircleOfConfusionPostProcess
|
|
|
* @param name The name of the effect.
|
|
|
- * @param scene The scene the effect belongs to.
|
|
|
* @param depthTexture The depth texture of the scene to compute the circle of confusion.
|
|
|
* @param options The required width/height ratio to downsize to before computing the render pass.
|
|
|
* @param camera The camera to apply the render pass to.
|
|
@@ -68295,7 +68294,7 @@ var BABYLON;
|
|
|
* @param reusable If the post process can be reused on the same frame. (default: false)
|
|
|
* @param textureType Type of textures used when performing the post process. (default: 0)
|
|
|
*/
|
|
|
- function CircleOfConfusionPostProcess(name, scene, depthTexture, options, camera, samplingMode, engine, reusable, textureType) {
|
|
|
+ function CircleOfConfusionPostProcess(name, depthTexture, options, camera, samplingMode, engine, reusable, textureType) {
|
|
|
if (textureType === void 0) { textureType = BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT; }
|
|
|
var _this = _super.call(this, name, "circleOfConfusion", ["cameraMinMaxZ", "focusDistance", "cocPrecalculation"], ["depthSampler"], options, camera, samplingMode, engine, reusable, null, textureType) || this;
|
|
|
/**
|
|
@@ -68321,9 +68320,7 @@ var BABYLON;
|
|
|
var cocPrecalculation = ((aperture * _this.focalLength) / ((_this.focusDistance - _this.focalLength))); // * ((this.focusDistance - pixelDistance)/pixelDistance) [This part is done in shader]
|
|
|
effect.setFloat('focusDistance', _this.focusDistance);
|
|
|
effect.setFloat('cocPrecalculation', cocPrecalculation);
|
|
|
- if (scene.activeCamera) {
|
|
|
- effect.setFloat2('cameraMinMaxZ', scene.activeCamera.minZ, scene.activeCamera.maxZ);
|
|
|
- }
|
|
|
+ effect.setFloat2('cameraMinMaxZ', depthTexture.activeCamera.minZ, depthTexture.activeCamera.maxZ);
|
|
|
});
|
|
|
return _this;
|
|
|
}
|
|
@@ -68404,16 +68401,15 @@ var BABYLON;
|
|
|
/**
|
|
|
* Creates a new instance of @see DepthOfFieldEffect
|
|
|
* @param scene The scene the effect belongs to.
|
|
|
+ * @param depthTexture The depth texture of the scene to compute the circle of confusion.
|
|
|
* @param pipelineTextureType The type of texture to be used when performing the post processing.
|
|
|
*/
|
|
|
- function DepthOfFieldEffect(scene, blurLevel, pipelineTextureType) {
|
|
|
+ function DepthOfFieldEffect(scene, depthTexture, blurLevel, pipelineTextureType) {
|
|
|
if (blurLevel === void 0) { blurLevel = DepthOfFieldEffectBlurLevel.Low; }
|
|
|
if (pipelineTextureType === void 0) { pipelineTextureType = 0; }
|
|
|
var _this = _super.call(this, scene.getEngine(), "depth of field", function () {
|
|
|
- // Enable and get current depth map
|
|
|
- var depthMap = scene.enableDepthRenderer().getDepthMap();
|
|
|
// Circle of confusion value for each pixel is used to determine how much to blur that pixel
|
|
|
- _this._circleOfConfusion = new BABYLON.CircleOfConfusionPostProcess("circleOfConfusion", scene, depthMap, 1, null, BABYLON.Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType);
|
|
|
+ _this._circleOfConfusion = new BABYLON.CircleOfConfusionPostProcess("circleOfConfusion", depthTexture, 1, null, BABYLON.Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType);
|
|
|
// Capture circle of confusion texture
|
|
|
_this._depthOfFieldPass = new BABYLON.PassPostProcess("depthOfFieldPass", 1.0, null, BABYLON.Texture.BILINEAR_SAMPLINGMODE, scene.getEngine(), false, pipelineTextureType);
|
|
|
_this._depthOfFieldPass.autoClear = false;
|
|
@@ -68777,7 +68773,9 @@ var BABYLON;
|
|
|
this._disposePostProcesses();
|
|
|
this._reset();
|
|
|
if (this.depthOfFieldEnabled) {
|
|
|
- this.depthOfField = new BABYLON.DepthOfFieldEffect(this._scene, this._depthOfFieldBlurLevel, this._defaultPipelineTextureType);
|
|
|
+ // Enable and get current depth map
|
|
|
+ var depthTexture = this._scene.enableDepthRenderer(this._cameras[0]).getDepthMap();
|
|
|
+ this.depthOfField = new BABYLON.DepthOfFieldEffect(this._scene, depthTexture, this._depthOfFieldBlurLevel, this._defaultPipelineTextureType);
|
|
|
this.addEffect(this.depthOfField);
|
|
|
}
|
|
|
if (this.bloomEnabled) {
|