Skip to content

Commit

Permalink
RoughnessMipmapper: Removed temporal Scene.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed May 27, 2020
1 parent 1ce26dd commit 4cc880d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions examples/jsm/utils/RoughnessMipmapper.js
Expand Up @@ -16,16 +16,14 @@ import {
OrthographicCamera,
PlaneBufferGeometry,
RawShaderMaterial,
Scene,
Vector2,
WebGLRenderTarget
} from "../../../build/three.module.js";

var RoughnessMipmapper = ( function () {

var _mipmapMaterial = _getMipmapMaterial();
var _scene = new Scene();
_scene.add( new Mesh( new PlaneBufferGeometry( 2, 2 ), _mipmapMaterial ) );
var _mesh = new Mesh( new PlaneBufferGeometry( 2, 2 ), _mipmapMaterial );

var _flatCamera = new OrthographicCamera( 0, 1, 0, 1, 0, 1 );
var _tempTarget = null;
Expand All @@ -35,7 +33,7 @@ var RoughnessMipmapper = ( function () {
var RoughnessMipmapper = function ( renderer ) {

_renderer = renderer;
_renderer.compile( _scene, _flatCamera );
_renderer.compile( _mesh, _flatCamera );

};

Expand Down Expand Up @@ -101,7 +99,7 @@ var RoughnessMipmapper = ( function () {
_tempTarget.viewport.set( position.x, position.y, width, height );
_tempTarget.scissor.set( position.x, position.y, width, height );
_renderer.setRenderTarget( _tempTarget );
_renderer.render( _scene, _flatCamera );
_renderer.render( _mesh, _flatCamera );
_renderer.copyFramebufferToTexture( position, material.roughnessMap, mip );
_mipmapMaterial.uniforms.roughnessMap.value = material.roughnessMap;

Expand All @@ -117,7 +115,7 @@ var RoughnessMipmapper = ( function () {
dispose: function ( ) {

_mipmapMaterial.dispose();
_scene.children[ 0 ].geometry.dispose();
_mesh.geometry.dispose();
if ( _tempTarget != null ) _tempTarget.dispose();

}
Expand Down

0 comments on commit 4cc880d

Please sign in to comment.