Skip to main content

LightTable

Struct LightTable 

Source
pub struct LightTable {
    pub kind: LightTableKind,
    pub stride: u32,
    pub capacity: u32,
    pub fields: Vec<LightField>,
}
Expand description

The scene’s lights of one kind as a program reads them from a buffer: one record of stride bytes per core.light of kind, in no order the programs rely on (they read how many there are from a super::FrameParameter::LightCount constant and visit each), each holding fields as 32-bit floats. A byte no field covers is read by no program of the source; a consumer writes zero there. The source’s buffer holds at most capacity records.

Fields§

§kind: LightTableKind§stride: u32

Bytes per record: the buffer’s element size.

§capacity: u32

The most records the source’s buffer holds.

§fields: Vec<LightField>

Implementations§

Source§

impl LightTable

Source

pub fn holds(&self, light: &Light) -> bool

Whether light is of the table’s kind: a point light for a point table, a spot for a spot table.

Source

pub fn verify(&self, element_stride: Option<u32>) -> Result<(), String>

The table agrees with itself and with its buffer: a stride of whole floats that a structured buffer’s elements equal (element_stride, None for a raw or typed buffer), a capacity, each field whole floats inside the record and no two overlapping, a spot’s fields only in a spot table, a constant finite and every constant and unknown saying why, and a shadow’s place only in a table that says whether the light is shadowed (LightValue::Shadowed).

Source

pub fn reads_shadowed(&self) -> bool

Whether the records say which lights are shadowed (LightValue::Shadowed).

Source

pub fn pack( &self, w: &World, view: &[[f32; 4]; 4], shadows: &LocalShadows, ) -> Result<PackedLights, String>

The world’s lights of the table’s kind as its records, seen from view (the frame’s world-to-view matrix, by rows: view-space component r of a world position p is view[r] . (p, 1); its rotation is taken as rigid). Each light is a core.light of the kind with a core.transform, a range and, for a spot, an outer cone below 90 degrees; the colours need the world’s core.light_unit. A spot’s core.spot_frustum, where it has one, is its shape: its two half-angles and near plane take the place of the outer cone. Beyond capacity the lights nearest the view’s origin are kept.

shadows are the lights the consumer draws with a local shadow this frame (LocalShadows::none where it draws none): in a table that says which lights are shadowed, such a light’s record takes LightValue::Shadowed 1 and its shadow’s place, every other record 0 and zeros. Refused: a shadow for a light whose core.light casts none (cast_shadows Some(false)), and a shadow with fewer projection terms or faces than the record holds.

Trait Implementations§

Source§

impl Clone for LightTable

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 LightTable

Source§

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

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

impl PartialEq for LightTable

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 LightTable

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 LightTable

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.