bind method
Binds this material's render-pass state, uniforms, and textures.
The base implementation enables back-face culling with clockwise
winding on the Y-down rasterizer (accepting model-space CCW front faces).
Subclasses must call super.bind and then bind any per-material uniforms
and textures expected by their fragment shader. lighting carries the
IBL EnvironmentMap (and its intensity) plus the analytic lights and
shadow resources that materials shade against.
Implementation
@override
void bind(
gpu.RenderPass pass,
TransientWriter transientsBuffer,
Lighting lighting,
) {
pass.setCullMode(cullingMode);
pass.setWindingOrder(windingOrder);
// The variant the pipeline was built from, which differs from
// [fragmentShader] when an environment-sampling material supplied a
// cube-layout twin and the bound environment uses that layout.
final shader = fragmentShaderForLighting(lighting);
_bindStage(pass, shader, transientsBuffer, ShaderStage.fragment);
if (useEnvironment) {
_bindEnvironmentTextures(pass, shader, lighting);
}
// A shader that includes material_varyings.glsl and reads
// GetViewDirection declares this block.
EngineLightingUniforms.bindViewInfo(
pass,
shader,
transientsBuffer,
lighting,
);
if (_sceneInputs.isNotEmpty) {
EngineLightingUniforms.bindSceneInputTextures(
pass,
shader,
lighting,
_sceneInputs,
);
EngineLightingUniforms.bindSceneInputInfo(
pass,
shader,
lighting,
transientsBuffer,
);
}
}