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
impl CameraStack
Sourcepub const fn empty() -> Self
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.
Sourcepub const fn default_stack() -> Self
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.
Sourcepub const fn compile(&self) -> RenderEffects
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.
Sourcepub fn from_ron(text: &str) -> Result<Self, StackError>
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.
Sourcepub fn to_ron(&self) -> String
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
impl Clone for CameraStack
impl Copy for CameraStack
Source§impl Debug for CameraStack
impl Debug for CameraStack
Source§impl Default for CameraStack
impl Default for CameraStack
Source§fn default() -> Self
fn default() -> Self
default_stack — the file form of
RenderEffects::DEFAULT_STACK.