bindDepthAlphaMask method

  1. @override
void bindDepthAlphaMask(
  1. RenderPass pass,
  2. Shader shader,
  3. TransientWriter transientsBuffer
)

Binds the mask texture and MaskInfo parameters consumed by the masked depth fragment shaders; shader is the masked variant the pass drew with. Called only when depthAlphaMasked is true.

Implementation

@override
void bindDepthAlphaMask(
  gpu.RenderPass pass,
  gpu.Shader shader,
  TransientWriter transientsBuffer,
) {
  // Mirrors the coverage the color pass tests in Surface():
  // texture.a * weighted vertex-color alpha * baseColorFactor alpha.
  final params = Float32List(4)
    ..[0] = alphaCutoff
    ..[1] = baseColorFactor.a
    ..[2] = vertexColorWeight;
  pass.bindUniform(
    shader.getUniformSlot('MaskInfo'),
    transientsBuffer.emplace(ByteData.sublistView(params)),
  );
  pass.bindTexture(
    shader.getUniformSlot('mask_texture'),
    Material.whitePlaceholder(resolveTextureSource(baseColorTexture)),
    sampler: textureSourceSampler(baseColorTexture) ?? _repeatSampler,
  );
}