Skip to content

Commit

Permalink
WebGLRenderer: Passing scene to onBeforeRender/onAfterRender. See #9738.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Sep 23, 2016
1 parent d04da47 commit 1d6925a
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1134,8 +1134,6 @@ function WebGLRenderer( parameters ) {

}

var fog = scene.fog;

// reset caching for this frame

_currentGeometryProgram = '';
Expand Down Expand Up @@ -1256,19 +1254,19 @@ function WebGLRenderer( parameters ) {

var overrideMaterial = scene.overrideMaterial;

renderObjects( opaqueObjects, camera, fog, overrideMaterial );
renderObjects( transparentObjects, camera, fog, overrideMaterial );
renderObjects( opaqueObjects, scene, camera, overrideMaterial );
renderObjects( transparentObjects, scene, camera, overrideMaterial );

} else {

// opaque pass (front-to-back order)

state.setBlending( NoBlending );
renderObjects( opaqueObjects, camera, fog );
renderObjects( opaqueObjects, scene, camera );

// transparent pass (back-to-front order)

renderObjects( transparentObjects, camera, fog );
renderObjects( transparentObjects, scene, camera );

}

Expand Down Expand Up @@ -1495,7 +1493,7 @@ function WebGLRenderer( parameters ) {

}

function renderObjects( renderList, camera, fog, overrideMaterial ) {
function renderObjects( renderList, scene, camera, overrideMaterial ) {

for ( var i = 0, l = renderList.length; i < l; i ++ ) {

Expand All @@ -1509,13 +1507,13 @@ function WebGLRenderer( parameters ) {
object.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );
object.normalMatrix.getNormalMatrix( object.modelViewMatrix );

object.onBeforeRender( _this, camera, geometry, material, group );
object.onBeforeRender( _this, scene, camera, geometry, material, group );

if ( object.isImmediateRenderObject ) {

setMaterial( material );

var program = setProgram( camera, fog, material, object );
var program = setProgram( camera, scene.fog, material, object );

_currentGeometryProgram = '';

Expand All @@ -1527,11 +1525,11 @@ function WebGLRenderer( parameters ) {

} else {

_this.renderBufferDirect( camera, fog, geometry, material, object, group );
_this.renderBufferDirect( camera, scene.fog, geometry, material, object, group );

}

object.onAfterRender( _this, camera, geometry, material, group );
object.onAfterRender( _this, scene, camera, geometry, material, group );


}
Expand Down

0 comments on commit 1d6925a

Please sign in to comment.