Skip to content

Commit

Permalink
Revert "Material: Remove obsolete callbacks. (mrdoob#28702)"
Browse files Browse the repository at this point in the history
DOPPLE: Re-restore onBeforeRender on materials, to fix probes.

This reverts commit 5557d53.
  • Loading branch information
gfodor committed Jul 31, 2024
1 parent 589bffc commit ebce4ba
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/materials/Material.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ class Material extends EventDispatcher {

}

onBuild( /* shaderobject, renderer */ ) {}

onBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {}

onBeforeCompile( /* shaderobject, renderer */ ) {}

customProgramCacheKey() {
Expand Down Expand Up @@ -516,19 +520,6 @@ class Material extends EventDispatcher {

}

onBuild( /* shaderobject, renderer */ ) {

console.warn( 'Material: onBuild() has been removed.' ); // @deprecated, r166

}

onBeforeRender( /* renderer, scene, camera, geometry, object, group */ ) {

console.warn( 'Material: onBeforeRender() has been removed.' ); // @deprecated, r166

}


}

export { Material };
4 changes: 4 additions & 0 deletions src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,8 @@ class WebGLRenderer {
object.modelViewMatrix.multiplyMatrices( camera.matrixWorldInverse, object.matrixWorld );
object.normalMatrix.getNormalMatrix( object.modelViewMatrix );

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

if ( material.transparent === true && material.side === DoubleSide && material.forceSinglePass === false ) {

material.side = BackSide;
Expand Down Expand Up @@ -1667,6 +1669,8 @@ class WebGLRenderer {

parameters.uniforms = programCache.getUniforms( material );

material.onBuild( object, parameters, _this );

material.onBeforeCompile( parameters, _this );

program = programCache.acquireProgram( parameters, programCacheKey );
Expand Down
2 changes: 2 additions & 0 deletions src/renderers/common/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1425,6 +1425,8 @@ class Renderer {

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

material.onBeforeRender( this, scene, camera, geometry, material, group );

//

if ( scene.overrideMaterial !== null ) {
Expand Down

0 comments on commit ebce4ba

Please sign in to comment.