bind method

  1. @override
void bind(
  1. RenderPass pass,
  2. HostBuffer transientsBuffer,
  3. EnvironmentMap environment
)
override

Binds the fragment's uniform blocks, textures, and (when useEnvironment) the environment IBL samplers. Called by the engine during the background draw; not part of the app-facing API.

Implementation

@override
void bind(
  gpu.RenderPass pass,
  gpu.HostBuffer transientsBuffer,
  EnvironmentMap environment,
) {
  // Parameters (the MaterialParams block plus any declared samplers) carry
  // the sky's inputs; the raw uniform-block path is unused here.
  parameters.bind(pass, fragmentShader, transientsBuffer);
  // A `requires: [environment]` sky samples the scene's prefiltered
  // radiance, bound the same way the standard material binds it.
  if (useEnvironment) {
    pass.bindTexture(
      fragmentShader.getUniformSlot('prefiltered_radiance'),
      environment.prefilteredRadianceTexture,
      sampler: gpu.SamplerOptions(
        minFilter: gpu.MinMagFilter.linear,
        magFilter: gpu.MinMagFilter.linear,
        widthAddressMode: gpu.SamplerAddressMode.repeat,
        heightAddressMode: gpu.SamplerAddressMode.clampToEdge,
      ),
    );
  }
}