runAt method

  1. @override
Vector4 runAt(
  1. int vertexIndex,
  2. int instanceIndex,
  3. Float32List a,
  4. ShaderBindings bindings,
  5. Float32List out,
)
override

The same as CpuVertexShader.run, plus the vertex's and the instance's own indices.

run must still work — a caller that has no indices, or a rasteriser that has not been taught to pass them, falls back to it — so an implementation answers both and shares whatever it can.

Implementation

@override
Vector4 runAt(
  int vertexIndex,
  int instanceIndex,
  Float32List a,
  ShaderBindings bindings,
  Float32List out,
) {
  final clip = _plain.runAt(vertexIndex, instanceIndex, a, bindings, out);
  out[kVLightmap] = a[kColour];
  out[kVLightmap + 1] = a[kColour + 1];
  for (var i = 0; i < 4; i++) {
    out[kVInstance + i] = 0.0;
  }
  for (var i = 0; i < 4; i++) {
    out[kVColour + i] = 1.0;
  }
  return clip;
}