pub struct SceneDef {Show 13 fields
pub id: &'static str,
pub title: &'static str,
pub description: &'static str,
pub size: (u32, u32),
pub baseline: Option<(u32, u32)>,
pub clear: Option<Color>,
pub frames: u32,
pub step_seconds: Option<f32>,
pub samples: u32,
pub depth: bool,
pub ui: bool,
pub reproducible_ui: bool,
pub build: Build,
}Expand description
One selectable scene.
The fields the snapshot tests draw the scene at — Self::size,
Self::frames, Self::samples and Self::depth — reproduce the
test the scene came from, so a captured frame is comparable with the
snapshot it was stored against. The windowed path draws at the window’s own
size instead, and only Self::build is shared.
Fields§
§id: &'static strThe scene’s stable id, used by --scene <ID>.
title: &'static strA short title for the GUI and the scene list.
description: &'static strWhat the scene shows, one line for the GUI.
size: (u32, u32)The render target size the scene’s snapshots were captured at.
baseline: Option<(u32, u32)>The aspect the windowed path keeps the scene’s 3D content at, as a
reference resolution, or None for a scene that draws no 3D content and
so has an aspect to keep.
A scene that declares one is drawn through the largest rectangle of that
aspect that fits the window, so a wide window and a narrow one show the
same picture — the wide one larger — instead of the wide one showing
more. The snapshot tests ignore this and draw at Self::size, which
the snapshots were captured at.
A UI-only scene declares none: an interface belongs on the whole window, and letterboxing it would put bars around a panel that has no aspect of its own.
clear: Option<Color>The colour the scene’s pass clears to, or None to clear to the default.
A scene whose picture is painted over a particular backdrop declares one; every other scene leaves its pass at the default clear.
frames: u32How many frames the snapshot tests draw before finishing.
step_seconds: Option<f32>How long each frame stays on screen in the windowed loop, in seconds,
or None for a scene that animates continuously from the frame delta.
The snapshot tests ignore this and draw the frames back to back, so a capture stays reproducible; the windowed path uses it so a scene whose frames were frozen as a sequence plays at a watchable pace rather than as fast as the display refreshes.
samples: u32The sample count of the offscreen target the snapshot tests bind.
depth: boolWhether that offscreen target carries a depth-stencil attachment.
ui: boolWhether the scene draws UI panels of its own.
The snapshot tests mount a UI source to drive them; the windowed path always mounts one, for the scene selector.
reproducible_ui: boolWhether the scene’s UI animates against egui’s clock.
A scene whose snapshots were captured with the clock suppressed — the
example’s own, whose panels live in egui windows — declares true, so
the snapshot tests zero egui’s animation time for it. The ported test
scenes were captured with the clock live, and declare false.
build: BuildBuild the scene’s world content and return its per-frame behaviour.
The world already holds the frame’s context, the renderer resource entity and the pass the scene draws through; the scene spawns its sources, meshes, camera and entities, sources inside the pass.
The entity is the UI source the shell mounted for the scene, when the run has one: a panel the scene draws hangs in that source’s scope, so the scene spawns it there rather than at the root — a source draws the subtree it owns and nothing beside it.
Auto Trait Implementations§
impl Forget for SceneDef
impl Freeze for SceneDef
impl RefUnwindSafe for SceneDef
impl Send for SceneDef
impl Sync for SceneDef
impl Unpin for SceneDef
impl UnsafeUnpin for SceneDef
impl UnwindSafe for SceneDef
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> Component for Twhere
T: 'static,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more