bind method

  1. @override
void bind(
  1. RenderPass pass,
  2. TransientWriter transientsBuffer,
  3. Matrix4 modelTransform,
  4. Matrix4 cameraTransform,
  5. Vector3 cameraPosition, {
  6. Shader? shaderOverride,
})
override

Binds vertex/index buffers and per-frame uniforms onto pass in preparation for a draw call.

Implementations write the model and camera transforms (and any subclass-specific values, like the joints texture for skinned geometry) into the supplied transient buffer and bind the resulting uniform views.

shaderOverride is the vertex shader the pipeline actually runs when it differs from this geometry's default vertexShader (a custom material's generated vertex variant). The per-frame uniforms (FrameInfo, the joints texture) must be bound against that shader's slots, since a variant can place its uniform blocks at different binding points.

Implementation

@override
void bind(
  gpu.RenderPass pass,
  TransientWriter transientsBuffer,
  vm.Matrix4 modelTransform,
  vm.Matrix4 cameraTransform,
  vm.Vector3 cameraPosition, {
  gpu.Shader? shaderOverride,
}) {
  bindGeometryBuffers(pass);

  // Unskinned vertex UBO. The model transform is NOT part of this block;
  // it arrives through the instance-rate vertex buffer (the last slot),
  // bound by the encoder for instanced and non-instanced draws alike.
  bindUnskinnedFrameInfo(
    pass,
    transientsBuffer,
    shaderOverride ?? vertexShader,
    cameraTransform,
    cameraPosition,
  );
}