setColor method
Sets a vec4 parameter from a Color. If the parameter has a
source_color hint, the rgb channels are sRGB-decoded to linear (matching
the shader's SRGBToLinear); alpha is written as-is.
Implementation
void setColor(String name, Color color) {
final slot = _slot(name, FmatType.vec4);
var r = color.r, g = color.g, b = color.b;
if (slot.sourceColor) {
r = _srgbToLinear(r);
g = _srgbToLinear(g);
b = _srgbToLinear(b);
}
_writeFloats(slot.offsetBytes, [r, g, b, color.a]);
}