setDepthOnlyVertex method

void setDepthOnlyVertex(
  1. Shader? shader, {
  2. VertexBufferDescriptor? positionStream,
})

Assigns the position-only vertex shader the depth-style passes (shadow maps, the depth prepass, the selection mask) draw this geometry with, or clears it when shader is null.

Those passes bind only the first vertex stream, at slot 0, and the engine's instance-rate model transform at slot 1. positionStream describes that first stream as shader reads it; the engine appends the instance slot. Without a depth shader, a geometry with a declared setVertexLayout draws depth through its full vertex shader and every stream, which also works but fetches more per vertex.

Implementation

void setDepthOnlyVertex(
  gpu.Shader? shader, {
  VertexBufferDescriptor? positionStream,
}) {
  if (shader == null) {
    _declaredDepthOnlyVertex = null;
    return;
  }
  if (positionStream == null) {
    throw ArgumentError.notNull('positionStream');
  }
  _declaredDepthOnlyVertex = (
    shader: shader,
    layout: VertexLayoutDescriptor(
      buffers: [positionStream, _kInstanceModelTransformBuffer],
    ),
  );
}