Advanced search tips: use spaces to require multiple terms (AND), | for alternatives (OR), wrap phrases in quotes (="a b"), =term for exact match, 'term to include, !term to exclude, ^term to match prefix, !^term to exclude prefix, .ext$ to match suffix, and !.ext$ to exclude suffix.

cluster.wgsl

Import path

Constants

CLUSTERABLE_OBJECT_TYPE_POINT_LIGHT

#
const CLUSTERABLE_OBJECT_TYPE_POINT_LIGHT: u32 = 0u

CLUSTERABLE_OBJECT_TYPE_SPOT_LIGHT

#
const CLUSTERABLE_OBJECT_TYPE_SPOT_LIGHT: u32 = 1u

CLUSTERABLE_OBJECT_TYPE_REFLECTION_PROBE

#
const CLUSTERABLE_OBJECT_TYPE_REFLECTION_PROBE: u32 = 2u

CLUSTERABLE_OBJECT_TYPE_IRRADIANCE_VOLUME

#
const CLUSTERABLE_OBJECT_TYPE_IRRADIANCE_VOLUME: u32 = 3u

CLUSTERABLE_OBJECT_TYPE_DECAL

#
const CLUSTERABLE_OBJECT_TYPE_DECAL: u32 = 4u

NDC_MIN

#
const NDC_MIN: vec2<f32> = vec2<f32>(-1.0)

NDC_MAX

#
const NDC_MAX: vec2<f32> = vec2<f32>(1.0)

Structures

ClusterMetadata

#

See the comments in bevy_pbr/src/cluster/gpu.rs for information on the fields.

struct ClusterMetadata {
indirect_draw_params: ClusterRasterIndirectDrawParams ,
clustered_light_count: u32 ,
reflection_probe_count: u32 ,
irradiance_volume_count: u32 ,
decal_count: u32 ,
z_slice_list_capacity: u32 ,
index_list_size: u32 ,
farthest_z: atomic<u32> ,
}

ClusterRasterIndirectDrawParams

#

Indirect draw parameters in the format required by the WebGPU specification.

struct ClusterRasterIndirectDrawParams {
index_count: u32 ,
instance_count: atomic<u32> ,
first_index: u32 ,
base_vertex: u32 ,
first_instance: u32 ,
}

ClusterableObjectZSlice

#

See the comments in bevy_pbr/src/cluster/gpu.rs for information on the fields.

struct ClusterableObjectZSlice {
object_index: u32 ,
object_type: u32 ,
z_slice: u32 ,
}

Aabb

#

An axis-aligned bounding box.

struct Aabb { }

AabbU

#

This is used for cluster bounds.

struct AabbU { }

Functions

cluster_space_object_aabb

#

See bevy_light::cluster::assign::cluster_space_clusterable_object_aabb.

fn cluster_space_object_aabb (
position: vec3<f32>
radius: f32
view_from_world: mat4x4<f32>
clip_from_view: mat4x4<f32>
view_from_world_scale: vec3<f32>
) -> Aabb

compute_view_from_world_scale

#

Computes the scale of the camera from the view matrix.

fn compute_view_from_world_scale (
world_from_view: mat4x4<f32>
) -> vec3<f32>

ndc_position_to_cluster

#

Returns the cluster coordinates corresponding to a position in normalized device coordinates. See bevy_light::cluster::assign::ndc_position_to_cluster.

fn ndc_position_to_cluster (
cluster_dimensions: vec3<u32>
cluster_factors: vec2<f32>
is_orthographic: bool
view_z: f32
) -> vec3<u32>

calculate_sphere_cluster_bounds

#

Returns the AABB encompassing all clusters that intersect a sphere.

fn calculate_sphere_cluster_bounds (
position: vec3<f32>
radius: f32
view_from_world: mat4x4<f32>
clip_from_view: mat4x4<f32>
view_from_world_scale: vec3<f32>
cluster_dimensions: vec3<u32>
cluster_factors: vec2<f32>
is_orthographic: bool
) -> AabbU