clusterRow function

int clusterRow(
  1. ShaderBindings bindings,
  2. Vector3 world,
  3. int slot
)

ClusterRow: the row entry slot of world's cell names.

Implementation

int clusterRow(ShaderBindings bindings, Vector3 world, int slot) {
  final depth = bindings.vec4('LightListInfo', 'cluster_depth', Vector4.zero());
  final entry = clusterAt(bindings, world).offset.round() + slot;
  final four = lightListTexel(
    bindings,
    depth.w.round() + entry ~/ 16,
    (entry % 16) ~/ 4,
  );
  return switch (entry % 4) {
    0 => four.x,
    1 => four.y,
    2 => four.z,
    _ => four.w,
  }.round();
}