Skip to main content

SceneDef

Struct SceneDef 

Source
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 str

The scene’s stable id, used by --scene <ID>.

§title: &'static str

A short title for the GUI and the scene list.

§description: &'static str

What 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: u32

How 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: u32

The sample count of the offscreen target the snapshot tests bind.

§depth: bool

Whether that offscreen target carries a depth-stencil attachment.

§ui: bool

Whether 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: bool

Whether 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: Build

Build 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§

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Component for T
where T: 'static,

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

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

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send> ⓘ

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

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

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more