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, but the recommended approach moving forward is to use
WebGPURenderer with the new Node Material system and
[TSL]https://github.com/mrdoob/three.js/wiki/Three.js-Shading-Language.
Unlike properties, the callback is not supported by .clone(), .copy() and .toJSON().
This callback is only supported in WebGLRenderer (not WebGPURenderer).
Readonly_setReadonly_setFrees the GPU-related resources allocated by this instance. Call this method whenever this instance is no longer used in your app.
Material textures must be disposed of by the dispose() method of Texture.
In case onBeforeCompile is used, this callback can be used to identify values of settings used in onBeforeCompile, so three.js can reuse a cached shader or recompile the shader as needed.