Skip to main content

CameraStack

Struct CameraStack 

Source
pub struct CameraStack {
    pub shadows: Option<ShadowsPass>,
    pub ambient_occlusion: Option<AmbientOcclusionPass>,
    pub reflections: Option<ReflectionsPass>,
    pub bloom: Option<BloomPass>,
    pub antialiasing: Option<AntialiasingPass>,
    pub volumetric_fog: Option<VolumetricFogPass>,
    pub auto_exposure: Option<AutoExposurePass>,
    pub contact_shadows: Option<ContactShadowsPass>,
}
Expand description

What one view asks its frame to draw, as a file.

One optional pass per effect RenderEffects carries, bar the two antialiasing bits, which are one AntialiasingPass naming a tier — this module’s header says why. compile is the whole of the mapping: a bit per Some.

§Unknown fields are refused

deny_unknown_fields, so a stack naming a pass this engine does not have — a typo, a rung from a later version, a tier’s own word written as though it were a field — fails to parse rather than silently drawing something else. StackError names the line, the column and the field.

§Round trip

use crcbl_render::stack::CameraStack;

let stack = CameraStack::default();
assert_eq!(CameraStack::from_ron(&stack.to_ron())?, stack);

Fields§

§shadows: Option<ShadowsPass>

The shadow atlas and everything that fills it.

§ambient_occlusion: Option<AmbientOcclusionPass>

The occlusion pass and its depth-weighted blur.

§reflections: Option<ReflectionsPass>

The reflection march and the blur that composites it.

§bloom: Option<BloomPass>

The bloom chain.

§antialiasing: Option<AntialiasingPass>

The frame’s one antialiasing resolve, and which tier fills it.

§volumetric_fog: Option<VolumetricFogPass>

The froxel scatter, its column scan and the composite over the frame.

§auto_exposure: Option<AutoExposurePass>

The luminance histogram, its reduce, and the tonemap reading the result.

§contact_shadows: Option<ContactShadowsPass>

The short march along the sun’s direction through the depth prepass.

Implementations§

Source§

impl CameraStack

Source

pub const fn empty() -> Self

A stack that asks for nothing: every field None.

What a file holding () parses to, and the base a stack is built up from — default_stack is written on it.

Source

pub const fn default_stack() -> Self

The file form of RenderEffects::DEFAULT_STACK: a pass exactly where that constant has a bit.

The three light-transport effects and the resolve the default carries — a view that has been given no lens. default_stack().compile() == RenderEffects::DEFAULT_STACK is asserted, so the two cannot drift: this is the same statement written twice, once as bits and once as a file, and the file is the one a demo can edit.

Source

pub const fn compile(&self) -> RenderEffects

The effect set this stack asks for: a bit per Some.

This is what the camera layer of the resolution order carries. It is a request, not what the frame draws — the player’s [engine.video] clamp, the programmatic override and the device all still apply, in that order, and EffectRequest::resolve is where they do.

The antialiasing field contributes Antialiasing::bits rather than one bit, which is how a stack names the higher tier without a second field.

Source

pub fn from_ron(text: &str) -> Result<Self, StackError>

Parses one RON document.

§Errors

StackError if the text is not RON, or is RON that is not this struct: an unknown field, a tier that is not on the ladder, a missing bracket. The error names the line, the column and — where ron can say — the field.

Source

pub fn to_ron(&self) -> String

Writes this stack back out, deterministically.

Byte-identical for equal stacks, on every platform. Fields print in struct order because that is the order serde’s derive visits them, and the newline is pinned to \n here rather than left to ron::ser::PrettyConfig’s default, which is \r\n on Windows — a writer whose output depended on the host is not one a scene format can keep in git. No field carries a number today, so what a float would print as is ron’s answer and not this function’s.

§Panics

Never, in practice: this struct is options of field-less structs and one C-like enum, and ron’s serializer has no failing path over those. The Result exists for maps with non-string keys and for Serialize implementations that raise their own errors, and this type has neither.

Trait Implementations§

Source§

impl Clone for CameraStack

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 Copy for CameraStack

Source§

impl Debug for CameraStack

Source§

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

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

impl Default for CameraStack

Source§

impl<'de> Deserialize<'de> for CameraStack

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for CameraStack

Source§

impl PartialEq for CameraStack

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 CameraStack

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 CameraStack

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<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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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.