pub struct EffectRequest {
pub camera: RenderEffects,
pub video: RenderEffects,
pub antialiasing: Option<Antialiasing>,
pub programmatic: EffectOverride,
}Expand description
The layers a caller supplies, in the order they are applied.
A struct rather than positional arguments, for the reason this crate’s
SsrImages is one: two of these fields are the same type, so positional
arguments could be swapped at a call site and the frame would still compile
and still draw a picture.
Default is RenderEffects::DEFAULT_STACK wanted by the view, no
quality clamp, no antialiasing choice and no override — which resolves to
whatever the device permits, and is what every frame the engine drew before
this type existed did.
Fields§
§camera: RenderEffectsWhat this view needs, from its render stack.
Per camera because it is genuinely per view: topic 18’s render-to-texture security monitor and its planar reflection do not want reflections of their own, and that is a property of the camera rather than of the player’s hardware.
A crate::stack::CameraStack is what a view writes it from, which
is the render-stack RON topic 18 describes;
ForwardRenderer::set_camera_stack
is the one-layer setter. A renderer
per view is what makes the layer real either way — see this module’s
table — and apps/lantern’s monitor camera is the consumer whose stack
is still a constant rather than a file.
video: RenderEffectsWhat the player allows, from [engine.video].
A quality setting, so it only ever clamps downward: a player who turned reflections off gets none, and a player who turned them on gets them where the view asked for them.
crcbl’s start-up is what sets it: crcbl::settings::VIDEO_KEYS is
the one place a key is spelled, crcbl::engine::GpuContext reads the
namespace through crcbl_store::settings::SettingsStack while it opens,
and GpuContext::effect_request is what a renderer built on that context
is handed. See this module’s table.
RenderEffects::all is “the player has said nothing”, which is what a
missing key, a missing file and a missing settings directory all produce
— a clamp that removes nothing rather than a frame with no effects in it.
antialiasing: Option<Antialiasing>Which antialiasing tier the player picked, from
[engine.video] antialiasing.
None is “the player has not picked one”, and is what a
missing key, a missing file and a missing settings directory all produce
— the view’s own stack keeps the slot it asked for.
The one layer that replaces rather than clamps, and
Antialiasing’s docs carry the argument: the slot holds one filter, so
a player choosing CMAA2 where the camera asked for FXAA is asking for a
different filter and not for less of one. It is applied after
video and before programmatic,
so game code still has the last word before the device — see
resolve.
programmatic: EffectOverrideWhat this moment calls for, from game code.
Implementations§
Source§impl EffectRequest
impl EffectRequest
Sourcepub fn resolve(&self, device: RenderEffects) -> RenderEffects
pub fn resolve(&self, device: RenderEffects) -> RenderEffects
Applies the whole order and returns what the frame draws.
camera → clamped by video → the AA slot replaced by the player's tier
→ moved either way by the override
→ clamped by device, last and absolutelyThe antialiasing tier sits inside the order rather than beside it, and both of its neighbours matter. It is after the video clamp because a clamp can only take the resolve away, and the player picking a different filter is not a smaller ask; it is before the programmatic override because game code is the layer that may move a decision either way, and a tier applied after it would silently undo an override that had just forced a resolve on or off.
device is what the hardware can run. It cannot be overridden
upward: asking for an effect a device has no way to draw is what
DeviceDesc::required_features
is for, and it is not something a toggle can force.
Trait Implementations§
Source§impl Clone for EffectRequest
impl Clone for EffectRequest
impl Copy for EffectRequest
Source§impl Debug for EffectRequest
impl Debug for EffectRequest
Source§impl Default for EffectRequest
impl Default for EffectRequest
Source§fn default() -> Self
fn default() -> Self
RenderEffects::DEFAULT_STACK for the view, no quality clamp, no
antialiasing choice and no override.
The camera field is the default stack rather than
RenderEffects::all, and that constant carries the argument: the
effects that model the scene’s own light transport are what a view asks
for by saying nothing, and the lens effects are what it has to ask for.