pub struct LocalShadowAtlas {
pub target: TargetId,
pub size: [u32; 2],
pub region: u32,
pub covered: u32,
pub regions: Vec<[u32; 2]>,
pub faces: Vec<ShadowFace>,
pub near_over_range: f32,
pub depth: ShadowDepth,
pub projection: Vec<ShadowDepthTerm>,
pub caster_state: RenderState,
pub why: String,
}Expand description
The layout of a source’s local-light shadow atlas, every value the source’s: one depth target, square regions in
the order the source fills them, the faces each shadowed light takes in its record’s order, and how a face
projects. A light takes faces.len() consecutive regions of regions, its first face the first of them.
Fields§
§target: TargetIdThe depth target the faces are drawn into (crate::render_graph::RenderGraph::targets).
size: [u32; 2]The target’s width and height in texels.
region: u32The side of a region in texels: a face’s viewport.
covered: u32How many texels across a region span the face’s 90 degrees, centred: the rest is a guard band on each side that the face’s projection covers past 90 degrees and the shadowed programs never sample.
regions: Vec<[u32; 2]>Each region’s top-left texel, in the order the source fills them.
faces: Vec<ShadowFace>A light’s faces, in the order its record lists them.
near_over_range: f32A face’s near plane over the light’s range (its far plane).
depth: ShadowDepth§projection: Vec<ShadowDepthTerm>The terms of a light’s record (LocalShadow::projection), in its order.
caster_state: RenderStateThe fixed-function state the source draws the casters into the atlas with (its depth test, bias and culling), what a consumer that draws them with programs of its own takes.
why: StringWhat the source’s layout rests on: which of its values were read from the frames and which inferred.
Implementations§
Source§impl LocalShadowAtlas
impl LocalShadowAtlas
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
How many lights the atlas holds: whole sets of faces in its regions.
Sourcepub fn verify(&self) -> Result<(), String>
pub fn verify(&self) -> Result<(), String>
The layout is whole: at least one face and one region; every region inside the target and none overlapping another; a guard band no wider than the region and as wide on both sides; each face a right-handed set of unit vectors at right angles; a near plane inside the range; at least one finite projection term; and a reason.
Sourcepub fn place(&self, chosen: &[ShadowedLight]) -> Result<ShadowPlacement, String>
pub fn place(&self, chosen: &[ShadowedLight]) -> Result<ShadowPlacement, String>
Place chosen, in that order: light i takes regions i * F .. of LocalShadowAtlas::regions (F faces
each). Refused, with the reason, where they do not fit (more lights than LocalShadowAtlas::capacity), where a
light is given twice, or where its centre is not finite or its range not above 0. A face’s view looks from the
centre along the face’s axis; its projection maps the covered texels to 90 degrees (the region’s
region / covered of the tangent to its edge) with the atlas’s ShadowDepth, near plane
range * near_over_range and far plane range.