Browse Source

Merge pull request #13362 from sunag/91dev-shadercompile

add renderer prop in onBeforeCompile
Mr.doob 7 years ago
parent
commit
6c2d00a48d
2 changed files with 2 additions and 2 deletions
  1. 1 1
      docs/api/materials/Material.html
  2. 1 1
      src/renderers/WebGLRenderer.js

+ 1 - 1
docs/api/materials/Material.html

@@ -308,7 +308,7 @@
 		These needs to be disposed by [page:Texture Texture].
 		These needs to be disposed by [page:Texture Texture].
 		</div>
 		</div>
 
 
-		<h3>[method:null onBeforeCompile]()</h3>
+		<h3>[method:null onBeforeCompile]( [param:Object shader], [param:WebGLRenderer renderer] )</h3>
 		<div>
 		<div>
 		An optional callback that is executed immediately before the shader program is compiled.
 		An optional callback that is executed immediately before the shader program is compiled.
 		This function is called with the shader source code as a parameter. Useful for the modification of built-in materials.
 		This function is called with the shader source code as a parameter. Useful for the modification of built-in materials.

+ 1 - 1
src/renderers/WebGLRenderer.js

@@ -1513,7 +1513,7 @@ function WebGLRenderer( parameters ) {
 
 
 			}
 			}
 
 
-			material.onBeforeCompile( materialProperties.shader );
+			material.onBeforeCompile( materialProperties.shader, _this );
 
 
 			program = programCache.acquireProgram( material, materialProperties.shader, parameters, code );
 			program = programCache.acquireProgram( material, materialProperties.shader, parameters, code );