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: u32Bytes per record: the buffer’s element size.
capacity: u32The most records the source’s buffer holds.
fields: Vec<LightField>Implementations§
Source§impl LightTable
impl LightTable
Sourcepub fn holds(&self, light: &Light) -> bool
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.
Sourcepub fn verify(&self, element_stride: Option<u32>) -> Result<(), String>
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).
Sourcepub fn reads_shadowed(&self) -> bool
pub fn reads_shadowed(&self) -> bool
Whether the records say which lights are shadowed (LightValue::Shadowed).
Sourcepub fn pack(
&self,
w: &World,
view: &[[f32; 4]; 4],
shadows: &LocalShadows,
) -> Result<PackedLights, String>
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.