run method
Returns linear RGBA for attachment zero. Null discards the fragment.
Implementation
@override
Vector4? run(Float32List v, ShaderBindings b, FragmentContext c) {
final s = readSurface(v, b, c);
if (s == null) return null;
// No ORM map: a purely diffuse model has no response to metallic or
// roughness, so sampling it would leave a slot the compiler then drops.
applyCommonMaps(s, v, b, c);
final lit = accumulateLights(
s,
b,
c,
shade: (s, light) => s.albedo,
shadowed: true,
).scaled(s.occlusion);
final ambient =
(s.albedo.clone()..multiply(s.ambient + sampleLightmap(v, b, c)))
.scaled(s.occlusion);
final total = lit + ambient + s.emissive;
final debug = writeDebugView(c, v, b, s, total);
if (debug != null) return debug;
return writeLit(
c,
v,
b,
color: total,
alpha: s.alpha,
normal: s.normal,
roughness: s.roughness,
);
}