浏览代码

SAOPass: Fixed handling of orthographic camera

Mugen87 7 年之前
父节点
当前提交
c6c671cf75
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      examples/js/postprocessing/SAOPass.js

+ 5 - 4
examples/js/postprocessing/SAOPass.js

@@ -79,6 +79,7 @@ THREE.SAOPass = function ( scene, camera, depthTexture, useNormals, resolution )
 	this.saoMaterial.extensions.drawBuffers = true;
 	this.saoMaterial.defines[ 'DEPTH_PACKING' ] = this.supportsDepthTextureExtension ? 0 : 1;
 	this.saoMaterial.defines[ 'NORMAL_TEXTURE' ] = this.supportsNormalTexture ? 1 : 0;
+	this.saoMaterial.defines[ 'PERSPECTIVE_CAMERA' ] = this.camera.isPerspectiveCamera ? 1 : 0;
 	this.saoMaterial.uniforms[ 'tDepth' ].value = ( this.supportsDepthTextureExtension ) ? depthTexture : this.depthRenderTarget.texture;
 	this.saoMaterial.uniforms[ 'tNormal' ].value = this.normalRenderTarget.texture;
 	this.saoMaterial.uniforms[ 'size' ].value.set( this.resolution.x, this.resolution.y );
@@ -182,7 +183,7 @@ THREE.SAOPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ),
 
 		}
 
-		if ( this.params.output == 1 ) {
+		if ( this.params.output === 1 ) {
 
 			return;
 
@@ -255,7 +256,7 @@ THREE.SAOPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ),
 
 		var outputMaterial = this.materialCopy;
 		// Setting up SAO rendering
-		if ( this.params.output == 3 ) {
+		if ( this.params.output === 3 ) {
 
 			if ( this.supportsDepthTextureExtension ) {
 
@@ -270,7 +271,7 @@ THREE.SAOPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ),
 
 			}
 
-		} else if ( this.params.output == 4 ) {
+		} else if ( this.params.output === 4 ) {
 
 			this.materialCopy.uniforms[ 'tDiffuse' ].value = this.normalRenderTarget.texture;
 			this.materialCopy.needsUpdate = true;
@@ -283,7 +284,7 @@ THREE.SAOPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ),
 		}
 
 		// Blending depends on output, only want a CustomBlending when showing SAO
-		if ( this.params.output == 0 ) {
+		if ( this.params.output === 0 ) {
 
 			outputMaterial.blending = THREE.CustomBlending;