run method
Returns linear RGBA for attachment zero. Null discards the fragment.
Implementation
@override
Vector4? run(Float32List v, ShaderBindings b, FragmentContext c) {
final cx = v[4] * 2.0 - 1.0;
final cy = v[5] * 2.0 - 1.0;
final radius = math.sqrt(cx * cx + cy * cy);
final falloff = 1.0 - smoothstep(0.0, 1.0, radius);
final intensity =
falloff *
falloff *
(soft ? softParticleFade(b, c, v[6], v[7], v[8]) : 1.0);
var fogged = 1.0;
final fog = b.vec4('FogInfo', 'fog', Vector4.zero());
if (fog.w > 0.0) {
final d = fogDistance(b, v[6], v[7], v[8]);
fogged = math.exp(-fog.w * d).clamp(0.0, 1.0);
}
final scale = v[3] * intensity * fogged;
// Alpha one with the colour premultiplied: these draw additively, so the
// alpha channel is not what decides how much of them lands.
return Vector4(v[0] * scale, v[1] * scale, v[2] * scale, 1.0);
}