Skip to main content

SceneDesc

Struct SceneDesc 

Source
pub struct SceneDesc<'a> {
    pub meshes: Vec<MeshDesc<'a>>,
    pub materials: Vec<GpuMaterial>,
    pub page: PageDesc<'a>,
    pub probes: ProbeGrid,
    pub capacities: Capacities,
}
Expand description

Everything a ForwardRenderer makes resident, and how much room it reserves for it.

Read once, at with_scene, and never again: the pools it sizes are created there and none of them grows. The order of meshes and materials is load-bearing — see the module docs.

Fields§

§meshes: Vec<MeshDesc<'a>>

The resident meshes, in the order their table ids are handed out.

§materials: Vec<GpuMaterial>

§3.2’s material table, row by row. Row 0 is what an instance written without a material id names, so it is the row every unassigned object shades through.

§page: PageDesc<'a>

The base-colour page the rows above index.

§probes: ProbeGrid

Topic 50’s irradiance volume, added to the flat ambient term wherever it covers.

ProbeGrid::default is a grid of nothing and changes no pixel, which is what a description that does not mention it gets.

§capacities: Capacities

How much room each pool reserves.

Implementations§

Source§

impl SceneDesc<'_>

Source

pub fn instance_bounds( &self, instances: &[InstanceDesc], root: Mat4, ) -> Result<Aabb, SceneBoundsError>

The box around every vertex of instances, each placed by root * instance.transform.

Folded from the placed vertices, so it is the tightest axis-aligned box around them; Aabb::transformed of the mesh’s own box would contain them too, but is larger under any rotation that is not a quarter turn. A Geometry::Dag is bounded by level 0, its finest. An instance whose mesh has no vertices contributes nothing.

A placed vertex that is NaN or infinite fails the call — from a bad vertex, a bad instance transform or root, or a finite product that overflowed. Aabb::from_points would skip a NaN, which a cull box wants and a placement or collision box does not.

§Errors

The first SceneBoundsError an instance meets, in slice order, and SceneBoundsError::Empty when no instance has a vertex.

Source

pub fn instance_parts( &self, instances: &[InstanceDesc], ) -> Result<Vec<Aabb>, SceneBoundsError>

One box per instance, in slice order, each around its mesh’s vertices placed by InstanceDesc::transform alone — the parts of a rigid compound in the frame the instance transforms are written in.

Widened to f64, they are what crcbl_phys::AabbCompound::new takes: every box is finite and none is inverted. A flat part (an axis where min == max, from planar geometry or a zero scale) is returned as it is; a caller wanting a minimum thickness pads it.

§Errors

The first SceneBoundsError an instance meets, in slice order, including SceneBoundsError::EmptyPart for a mesh with no vertices. An empty slice is not an error: it yields no parts.

Trait Implementations§

Source§

impl<'a> Clone for SceneDesc<'a>

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<'a> Debug for SceneDesc<'a>

Source§

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

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

impl<'a> PartialEq for SceneDesc<'a>

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<'a> StructuralPartialEq for SceneDesc<'a>

Auto Trait Implementations§

§

impl<'a> Forget for SceneDesc<'a>

§

impl<'a> Freeze for SceneDesc<'a>

§

impl<'a> Move for SceneDesc<'a>

§

impl<'a> RefUnwindSafe for SceneDesc<'a>

§

impl<'a> Send for SceneDesc<'a>

§

impl<'a> Sync for SceneDesc<'a>

§

impl<'a> Unpin for SceneDesc<'a>

§

impl<'a> UnsafeUnpin for SceneDesc<'a>

§

impl<'a> UnwindSafe for SceneDesc<'a>

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<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> HalThreadSafe for T
where T: Send + Sync,

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> 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.