isOpaque method

  1. @override
bool isOpaque()
override

Whether geometry rendered with this material is fully opaque.

The renderer uses this to split draws into the opaque and translucent passes (see SceneEncoder). Translucent draws are depth-sorted and drawn after the opaque pass with alpha blending enabled.

Implementation

@override
bool isOpaque() {
  // BLEND always goes through the translucent pass. OPAQUE and MASK
  // are drawn in the opaque pass (MASK relies on the shader's
  // alpha-test discard); a sub-1 baseColorFactor alpha still forces
  // the translucent pass so directly-constructed translucent
  // materials keep working without an explicit alpha mode.
  if (alphaMode == AlphaMode.blend) return false;
  return baseColorFactor.a >= 1.0;
}