Skip to content

Commit

Permalink
Clean up.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Jun 14, 2016
1 parent 889c9c2 commit 0d81c76
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
8 changes: 5 additions & 3 deletions examples/js/postprocessing/ManualMSAARenderPass.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ THREE.ManualMSAARenderPass = function ( scene, camera, clearColor, clearAlpha )

// as we need to clear the buffer in this pass, clearColor must be set to something, defaults to black.
this.clearColor = ( clearColor !== undefined ) ? clearColor : 0x000000;
this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 1;
this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0;

if ( THREE.CopyShader === undefined ) console.error( "THREE.ManualMSAARenderPass relies on THREE.CopyShader" );

Expand Down Expand Up @@ -82,7 +82,8 @@ THREE.ManualMSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.
var autoClear = renderer.autoClear;
renderer.autoClear = false;

var oldClearColorHex = renderer.getClearColor().getHex(), oldClearAlpha = renderer.getClearAlpha();
var oldClearColor = renderer.getClearColor().getHex();
var oldClearAlpha = renderer.getClearAlpha();

var baseSampleWeight = 1.0 / jitterOffsets.length;
var roundingRange = 1 / 32;
Expand Down Expand Up @@ -122,7 +123,8 @@ THREE.ManualMSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.
if ( this.camera.clearViewOffset ) this.camera.clearViewOffset();

renderer.autoClear = autoClear;
renderer.setClearColor( oldClearColorHex, oldClearAlpha );
renderer.setClearColor( oldClearColor, oldClearAlpha );

}

} );
Expand Down
10 changes: 6 additions & 4 deletions examples/js/postprocessing/RenderPass.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ THREE.RenderPass = function ( scene, camera, overrideMaterial, clearColor, clear
this.overrideMaterial = overrideMaterial;

this.clearColor = clearColor;
this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 1;
this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0;

this.clear = true;
this.needsSwap = false;
Expand All @@ -27,10 +27,12 @@ THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype

this.scene.overrideMaterial = this.overrideMaterial;

var oldClearColor, oldClearAlpha;

if ( this.clearColor ) {

var oldClearColorHex = renderer.getClearColor();
var oldClearAlpha = renderer.getClearAlpha();
oldClearColor = renderer.getClearColor().getHex();
oldClearAlpha = renderer.getClearAlpha();

renderer.setClearColor( this.clearColor, this.clearAlpha );

Expand All @@ -40,7 +42,7 @@ THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype

if ( this.clearColor ) {

renderer.setClearColor( oldClearColorHex, oldClearAlpha );
renderer.setClearColor( oldClearColor, oldClearAlpha );

}

Expand Down
4 changes: 2 additions & 2 deletions src/renderers/webgl/WebGLProgram.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,15 +284,15 @@ THREE.WebGLProgram = ( function () {

prefixVertex = [

'#define SHADER_NAME ' + material.__webglShader.name,
'#define SHADER_NAME RawShaderMaterial',

customDefines

].filter( filterEmptyLine ).join( '\n' );

prefixFragment = [

'#define SHADER_NAME ' + material.__webglShader.name,
'#define SHADER_NAME RawShaderMaterial',

customDefines

Expand Down

0 comments on commit 0d81c76

Please sign in to comment.