Skip to content

Commit 86e7694

Browse files
authored
Merge pull request #15908 from JohannesDeml/feature/fix-material-definition
Precise onBeforeCompile input shader param for Material in documentation and Material definition
2 parents da0d66d + b339e48 commit 86e7694

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

docs/api/en/materials/Material.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ <h3>[method:null dispose]()</h3>
295295
These needs to be disposed by [page:Texture Texture].
296296
</p>
297297

298-
<h3>[method:null onBeforeCompile]( [param:Object shader], [param:WebGLRenderer renderer] )</h3>
298+
<h3>[method:null onBeforeCompile]( [param:Shader shader], [param:WebGLRenderer renderer] )</h3>
299299
<p>
300300
An optional callback that is executed immediately before the shader program is compiled.
301301
This function is called with the shader source code as a parameter. Useful for the modification of built-in materials.

docs/api/zh/materials/Material.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ <h3>[method:null dispose]()</h3>
243243
<p> 处理材质。材质的纹理不会被处理。需要通过[page:Texture Texture]处理。
244244
</p>
245245

246-
<h3>[method:null onBeforeCompile]( [param:Object shader], [param:WebGLRenderer renderer] )</h3>
246+
<h3>[method:null onBeforeCompile]( [param:Shader shader], [param:WebGLRenderer renderer] )</h3>
247247
<p> 在编译shader程序之前立即执行的可选回调。此函数使用shader源码作为参数。用于修改内置材质。
248248
</p>
249249

src/materials/Material.d.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { Plane } from './../math/Plane';
2+
import { Shader } from './../renderers/shaders/ShaderLib'
23
import { EventDispatcher } from './../core/EventDispatcher';
4+
import { WebGLRenderer } from './../renderers/WebGLRenderer';
35
import {
46
BlendingDstFactor,
57
BlendingEquation,
@@ -266,6 +268,13 @@ export class Material extends EventDispatcher {
266268
*/
267269
dispose(): void;
268270

271+
/**
272+
* 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.
273+
* @param shader Source code of the shader
274+
* @param renderer WebGLRenderer Context that is initializing the material
275+
*/
276+
onBeforeCompile ( shader : Shader, renderer : WebGLRenderer ) : void;
277+
269278
/**
270279
* Sets the properties based on the values.
271280
* @param values A container with parameters.

0 commit comments

Comments
 (0)