Skip to content

Commit

Permalink
Material: Added onBeforeCompile()
Browse files Browse the repository at this point in the history
  • Loading branch information
mrdoob committed Jun 9, 2017
1 parent b31e000 commit e55898c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/materials/Material.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ Object.assign( Material.prototype, EventDispatcher.prototype, {

isMaterial: true,

onBeforeCompile: function () {},

setValues: function ( values ) {

if ( values === undefined ) return;
Expand Down
2 changes: 2 additions & 0 deletions src/renderers/WebGLRenderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1567,6 +1567,8 @@ function WebGLRenderer( parameters ) {

material.__webglShader = materialProperties.__webglShader;

material.onBeforeCompile();

program = programCache.acquireProgram( material, parameters, code );

materialProperties.program = program;
Expand Down
2 changes: 2 additions & 0 deletions src/renderers/webgl/WebGLPrograms.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,8 @@ function WebGLPrograms( renderer, capabilities ) {

}

array.push( material.onBeforeCompile.toString() );

array.push( renderer.gammaOutput );

return array.join();
Expand Down

0 comments on commit e55898c

Please sign in to comment.