Skip to content

Commit

Permalink
Merge pull request #14597 from oguzeroglu/unreal_bloom_pass_memory_op…
Browse files Browse the repository at this point in the history
…timization

UnrealBloomPass memory optimization
  • Loading branch information
mrdoob committed Jul 31, 2018
2 parents f97687c + 898225f commit 22db2d7
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions examples/js/postprocessing/UnrealBloomPass.js
@@ -1,6 +1,6 @@
/**
* @author spidersharma / http://eduperiment.com/
*
*
* Inspired from Unreal Engine
* https://docs.unrealengine.com/latest/INT/Engine/Rendering/PostProcessEffects/Bloom/
*/
Expand All @@ -13,6 +13,9 @@ THREE.UnrealBloomPass = function ( resolution, strength, radius, threshold ) {
this.threshold = threshold;
this.resolution = ( resolution !== undefined ) ? new THREE.Vector2( resolution.x, resolution.y ) : new THREE.Vector2( 256, 256 );

// create color only once here, reuse it later inside the render function
this.clearColor = new THREE.Color( 0, 0, 0 );

// render targets
var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat };
this.renderTargetsHorizontal = [];
Expand Down Expand Up @@ -189,7 +192,7 @@ THREE.UnrealBloomPass.prototype = Object.assign( Object.create( THREE.Pass.proto
var oldAutoClear = renderer.autoClear;
renderer.autoClear = false;

renderer.setClearColor( new THREE.Color( 0, 0, 0 ), 0 );
renderer.setClearColor( this.clearColor, 0 );

if ( maskActive ) renderer.context.disable( renderer.context.STENCIL_TEST );

Expand Down

0 comments on commit 22db2d7

Please sign in to comment.