materialVertexInputs top-level constant
What a vertex block reads — version 2.
The vertex as the engine has it once morphed, and skinned on a skinned
draw: position and objectNormal in the mesh's own space (the pose's,
for a skinned mesh), world and normal after the model transform, the
first texture coordinate, the vertex colour, and origin, the model
transform's translation — where the object stands, so a field of grass
sways out of step blade by blade.
On an instanced draw (version 3) position and objectNormal are in
the node's space after the instance's transform, world after both,
color is the vertex's own (the instance's colour multiplies it after
the block), and instance is the instance's four numbers. On a
lightmapped draw color is white: the attribute holds the lightmap's
coordinate there.
Implementation
const List<MaterialInput> materialVertexInputs = <MaterialInput>[
MaterialInput('position', ExpressionType.vec3, 'f3d_position', since: 2),
MaterialInput(
'objectNormal',
ExpressionType.vec3,
'f3d_object_normal',
since: 2,
),
MaterialInput('world', ExpressionType.vec3, 'f3d_world', since: 2),
MaterialInput('normal', ExpressionType.vec3, 'f3d_normal', since: 2),
MaterialInput('uv', ExpressionType.vec2, 'texcoord', since: 2),
MaterialInput('color', ExpressionType.vec4, 'color', since: 2),
// Version 3: an instance's own four numbers on an instanced draw
// (`InstancedMeshNode.setInstanceData`), nought on every other.
MaterialInput('instance', ExpressionType.vec4, 'f3d_instance', since: 3),
MaterialInput(
'origin',
ExpressionType.vec3,
'frame_info.model[3].xyz',
since: 2,
),
];