Skip to main content

LocalShadowAtlas

Struct LocalShadowAtlas 

Source
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: TargetId

The depth target the faces are drawn into (crate::render_graph::RenderGraph::targets).

§size: [u32; 2]

The target’s width and height in texels.

§region: u32

The side of a region in texels: a face’s viewport.

§covered: u32

How 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: f32

A 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: RenderState

The 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: String

What the source’s layout rests on: which of its values were read from the frames and which inferred.

Implementations§

Source§

impl LocalShadowAtlas

Source

pub fn capacity(&self) -> usize

How many lights the atlas holds: whole sets of faces in its regions.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for LocalShadowAtlas

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LocalShadowAtlas

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for LocalShadowAtlas

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for LocalShadowAtlas

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for LocalShadowAtlas

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.