setVertexShader method

void setVertexShader(
  1. Shader? shader, {
  2. MeshVariant variant = MeshVariant.unskinned,
})

Assigns the vertex shader this material draws variant meshes with, or clears it when shader is null.

With no vertex shader the engine's standard one runs, which is the fragment-only workflow. Supplying one takes over the vertex stage for that mesh kind, and the shader must then satisfy the engine contract (see MATERIALS.md): it declares the FrameInfo block, the attributes its geometry's layout provides, and the v_* outputs the fragment stage reads.

A mesh kind with no shader falls back to the engine's, so a material can customize static meshes and leave skinned ones alone. Supply MeshVariant.depth when the vertex stage moves geometry and the shadow and depth passes should see the same displacement.

Implementation

void setVertexShader(
  gpu.Shader? shader, {
  MeshVariant variant = MeshVariant.unskinned,
}) {
  if (shader == null) {
    _vertexShaders.remove(variant);
    return;
  }
  _vertexShaders[variant] = shader;
}