Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions types/three/src/materials/Material.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -556,10 +556,26 @@ export class Material extends EventDispatcher<{ dispose: {} }> {
*/
set alphaTest(value: number);

/**
* An optional callback that is executed immediately before the material is used to render a 3D object.
* Unlike properties, the callback is not supported by {@link .clone()}, {@link .copy()} and {@link .toJSON()}.
* This callback is only supported in `WebGLRenderer` (not `WebGPURenderer`).
*/
onBeforeRender(
renderer: WebGLRenderer,
scene: Scene,
camera: Camera,
geometry: BufferGeometry,
object: Object3D,
group: Group,
): void;

/**
* An optional callback that is executed immediately before the shader program is compiled.
* This function is called with the associated WebGL program parameters and renderer.
* This function is called with the shader source code as a parameter.
* Useful for the modification of built-in materials.
* Unlike properties, the callback is not supported by {@link .clone()}, {@link .copy()} and {@link .toJSON()}.
* This callback is only supported in `WebGLRenderer` (not `WebGPURenderer`).
* @param parameters WebGL program parameters
* @param renderer WebGLRenderer context that is initializing the material
*/
Expand Down Expand Up @@ -612,16 +628,4 @@ export class Material extends EventDispatcher<{ dispose: {} }> {
* @deprecated onBuild() has been removed.
*/
onBuild(object: Object3D, parameters: WebGLProgramParametersWithUniforms, renderer: WebGLRenderer): void;

/**
* @deprecated onBeforeRender() has been removed.
*/
onBeforeRender(
renderer: WebGLRenderer,
scene: Scene,
camera: Camera,
geometry: BufferGeometry,
object: Object3D,
group: Group,
): void;
}