#[repr(C)]pub struct ClusterParams {}Expand description
Per-frame uniform for the clustered light-binning compute pass and the forward
pass that reads the per-cluster lists. The compute kernel unprojects each
cluster’s screen tile through inv_view_proj and walks camera rays to the
slice’s near/far depth to build a world-space AABB (same convention as the fog
froxel kernel), then tests each GpuLight sphere against it. The forward pass
reads the grid dims + depth range + screen size to map a fragment to its
cluster. 128 bytes; packed_float3 keeps cam_pos / view_forward inside their
16-byte lanes. Must match the ClusterParams struct in the light-cull and
forward shaders.
Fields§
§inv_view_proj: [[f32; 4]; 4]Inverse view-projection; unprojects a clip-space corner to world space.
cam_pos: [f32; 3]Camera world position; ray origin for the cluster-AABB build.
z_near: f32Camera near plane in view units (positive distance).
view_forward: [f32; 3]Camera forward axis (world space, unit); projects a ray onto view depth.
z_far: f32Far bound of the clustered range in view units (positive distance).
grid_x: u32Cluster tiles across the screen.
grid_y: u32Cluster tiles down the screen.
grid_z: u32Exponential depth slices per cluster column.
num_lights: u32Number of valid GpuLight entries the kernel bins.
screen_w: f32Render-target size in pixels; maps a fragment’s position.xy to a tile.
screen_h: f32Render-target height in pixels.
use_clusters: u321 = the forward pass reads the per-cluster list (main camera); 0 = it
falls back to iterating all num_lights lights (planar / probe re-renders,
whose viewpoint differs from the grid the main camera binned).
_pad: u32Padding so the field layout matches the shader-side struct.
Implementations§
Source§impl ClusterParams
impl ClusterParams
Sourcepub const ZERO: ClusterParams
pub const ZERO: ClusterParams
Neutral params for context construction before the first per-frame update. use_clusters = 0 so the forward pass falls back to brute-force iteration until a real frame’s camera fills the grid.
Trait Implementations§
Source§impl Clone for ClusterParams
impl Clone for ClusterParams
Source§fn clone(&self) -> ClusterParams
fn clone(&self) -> ClusterParams
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more