Skip to main content

RecordingScene

Struct RecordingScene 

Source
pub struct RecordingScene {
Show 14 fields stage: Stage, screen_video: VideoTexture, cam_video: VideoTexture, screen_dims: StreamDimensions, cam_dims: StreamDimensions, cam_layout: CamLayout, screen_sprite: NodeId, cam_container: NodeId, cam_sprite: NodeId, backdrop: Option<NodeId>, cursor: Option<NodeId>, shadow: Option<NodeId>, border: Option<NodeId>, wallpaper: Option<NodeId>,
}
Expand description

Two-stream composition: fullscreen screen-capture + circular webcam bubble. Owns the Stage + the per-stream VideoTextures.

The struct itself doesn’t render — pass Self::stage to Renderer::render_stage or call the Self::render convenience wrapper.

Fields§

§stage: Stage§screen_video: VideoTexture§cam_video: VideoTexture§screen_dims: StreamDimensions§cam_dims: StreamDimensions§cam_layout: CamLayout§screen_sprite: NodeId§cam_container: NodeId§cam_sprite: NodeId§backdrop: Option<NodeId>

Editor-only backdrop node (a full-NDC Graphics rect drawn behind the screen). Lazily created on the first set_background_* call; the recorder never touches it, so its scene stays a plain three-node screen + cam stage.

§cursor: Option<NodeId>

Editor-only cursor-overlay node (a Graphics pointer + click ripples, drawn over the framed screen). Lazily created on the first Self::set_cursor call; the recorder never touches it (its live capture already has a cursor baked into the screen frame).

§shadow: Option<NodeId>

Editor-only drop-shadow node (ED.18): a dark, offset rounded-rect drawn behind the framed screen (Phase 1, like the backdrop), so the offset sliver reads as a shadow. Lazily created by Self::set_frame_shadow.

§border: Option<NodeId>

Editor-only inset-border node (ED.18): a rounded-rect stroke tracing the frame window, drawn over the screen (Phase 2, like the cursor). Lazily created by Self::set_frame_border.

§wallpaper: Option<NodeId>

Editor-only wallpaper backdrop (ED.18): a full-NDC Sprite of a decoded image, drawn behind everything. A Sprite (not Graphics) so the renderer’s batch order paints it before the gradient/shadow graphics — the backmost layer. Mutually exclusive with the gradient/color backdrop (the app hides one when the other is set). Created by Self::set_background_wallpaper.

Implementations§

Source§

impl RecordingScene

Source

pub fn new( app: &Application, screen_dims: StreamDimensions, cam_dims: StreamDimensions, cam_layout: CamLayout, ) -> Self

Build a fresh scene. Allocates two VideoTextures at the requested dimensions (the host re-uploads BGRA bytes via Self::set_screen_frame / Self::set_camera_frame on every captured frame); inserts the corresponding sprites into the stage with the cam wrapped in a circular-clip container.

§Panics

Panics if either dimension pair is zero — the wgpu texture allocator rejects zero-size textures and we’d prefer the trap fire at construction.

Source

pub fn set_screen_frame(&mut self, app: &Application, bgra: &[u8])

Upload the latest screen-capture frame. bgra is top-down packed BGRA8 (the standard CoreVideo / GStreamer convention) and bgra.len() must equal screen_dims().byte_len(). The method flips rows internally to match wisp’s sprite convention before uploading — see flip_bgra_rows_top_down_to_bottom_up.

§Panics

Panics with "VideoTexture::upload_bgra: byte length mismatch" if bgra.len() doesn’t match the configured screen dimensions.

Source

pub fn set_camera_frame(&mut self, app: &Application, bgra: &[u8])

Upload the latest camera frame. bgra is top-down packed BGRA8 (same convention as Self::set_screen_frame) and bgra.len() must equal cam_dims().byte_len().

§Panics

Panics with "VideoTexture::upload_bgra: byte length mismatch" if bgra.len() doesn’t match the configured cam dimensions.

Source

pub fn render( &self, renderer: &Renderer, app: &Application, view: &TextureView, clear: Color, ) -> RenderStats

Render the composed scene into view. Thin wrapper around Renderer::render_stage — callers that need the RenderStats can use that directly via Self::stage.

Source

pub fn stage(&self) -> &Stage

Borrow the scene graph (e.g. to call Renderer::render_stage directly).

Source

pub fn stage_mut(&mut self) -> &mut Stage

Mutable borrow of the underlying stage — exposed so future extensions (annotations, cursor overlays, watermarks) can attach extra nodes without monkey-patching this type.

Source

pub fn screen_dims(&self) -> StreamDimensions

Configured screen dimensions.

Source

pub fn cam_dims(&self) -> StreamDimensions

Configured camera dimensions.

Source

pub fn cam_layout(&self) -> CamLayout

Active camera layout (centre + radius).

Source

pub fn screen_sprite_id(&self) -> NodeId

NodeId of the fullscreen screen sprite. Exposed so callers (storybook stories, future editor) can tweak the sprite’s container without rebuilding the scene.

Source

pub fn cam_container_id(&self) -> NodeId

NodeId of the cam container (the one holding the clip). Modifying this container’s transform moves the bubble.

Source

pub fn cam_sprite_id(&self) -> NodeId

NodeId of the cam sprite (inside the cam container).

Source

pub fn set_camera_visible(&mut self, visible: bool)

Toggle the camera bubble’s visibility. Hiding the cam container prevents the cam sprite from rendering at all — useful when the recording session has the camera channel disabled (no upload happens, so VideoTexture would sample whatever wgpu’s create_texture left in memory; not guaranteed to be zero).

Source

pub fn set_screen_visible(&mut self, visible: bool)

Toggle the screen sprite’s visibility. Same rationale as Self::set_camera_visible for the screen channel.

Source

pub fn set_screen_transform(&mut self, transform: Transform)

Set the screen sprite’s local transform. The recorder leaves this at the base fill-NDC transform (position 0, scale 2); the editor (ED.16/ED.15) writes a per-frame crop-then-zoom transform here so the composed frame punches in / reframes. The screen sprite is anchored centre, so a scale of 2 * z magnifies the source by z about the frame centre, and position shifts the focal point in NDC.

Source

pub fn set_screen_clip(&mut self, shape: Option<MaskShape>)

Set (or clear) the screen sprite’s clip — the editor’s rounded-corner frame window (ED.18). The shape is in fixed output NDC (the clip is screen-space, not transform-aware), so the window stays put while the screen transform punches in inside it. Setting a clip makes the screen a dispatched node that composites over the backdrop. The recorder leaves this None (full-bleed, no clip).

Source

fn backdrop_graphics_mut(&mut self) -> &mut Graphics

Lazily insert (or fetch) the backdrop Graphics node. It is added as a child of root with no clip, so it renders in the advanced-dispatch Phase 1 (behind the clipped, dispatched screen sprite). The recorder never calls a set_background_* method, so this node is never created for a recording scene.

Source

pub fn set_background_gradient( &mut self, from: Color, to: Color, angle_deg: f32, )

Paint the backdrop as a linear gradient between two colors at angle_deg (0 = left→right, 90 = bottom→top), and make it visible. Editor-only (the framed-screen look behind the rounded canvas).

Source

pub fn set_background_color(&mut self, color: Color)

Paint the backdrop as a flat color fill, and make it visible.

Source

pub fn set_background_visible(&mut self, visible: bool)

Toggle the backdrop’s visibility. No-op if no backdrop has been set (the recorder path).

Source

fn cursor_graphics_mut(&mut self) -> &mut Graphics

Lazily insert (or fetch) the cursor-overlay Graphics node. It carries a full-NDC clip so it renders in the advanced-dispatch Phase 2 (over the framed, also-dispatched screen sprite), and is added after the screen so it composites on top. Editor-only — never created for a recording scene.

Source

pub fn set_cursor( &mut self, pointer_ndc: Vec2, half: f32, ripples: &[CursorRipple], )

Draw the cursor overlay (ED.19): expanding click ripples under a dark-outlined white pointer at pointer_ndc, with the pointer sized by half (NDC half-extent). All coordinates are output NDC — the app maps the captured normalized position through the screen transform so the pointer stays glued to its pixel through zoom/crop/padding. Makes the overlay visible. Editor-only.

Source

pub fn set_cursor_visible(&mut self, visible: bool)

Toggle the cursor overlay’s visibility. No-op if no cursor has been set (the recorder path).

Source

fn shadow_graphics_mut(&mut self) -> &mut Graphics

Lazily insert (or fetch) the drop-shadow Graphics node — an unclipped root child, so it renders in advanced-dispatch Phase 1 (behind the dispatched, clipped screen sprite). Added after the backdrop so the shadow composites over the backdrop but under the screen.

Source

pub fn set_frame_shadow( &mut self, window: Rect, corner_radius: f32, offset: Vec2, color: Color, )

Draw the framed-screen drop shadow (ED.18): a color rounded-rect the shape of the frame window, offset by offset (NDC), drawn behind the screen so only the offset sliver shows. Editor-only — the recorder never calls this, so its scene has no shadow node.

Source

pub fn set_frame_shadow_visible(&mut self, visible: bool)

Toggle the drop-shadow’s visibility. No-op if unset (recorder path).

Source

fn border_graphics_mut(&mut self) -> &mut Graphics

Lazily insert (or fetch) the inset-border Graphics node — carries a full-NDC clip so it dispatches in Phase 2 (over the framed screen), mirroring the cursor overlay.

Source

pub fn set_frame_border( &mut self, window: Rect, corner_radius: f32, stroke: Stroke, )

Draw the inset border (ED.18): a stroked rounded-rect tracing the frame window, over the screen. Transparent fill so only the stroke shows. Editor-only.

Source

pub fn set_frame_border_visible(&mut self, visible: bool)

Toggle the inset border’s visibility. No-op if unset (recorder path).

Source

pub fn set_background_wallpaper( &mut self, app: &Application, width: u32, height: u32, rgba: &[u8], )

Set the wallpaper backdrop (ED.18) from decoded RGBA8 (width*height*4 bytes — the app decodes the image; wisp must not gain an asset path). A full-NDC Sprite, the backmost layer. The caller is responsible for hiding the gradient/color backdrop (they’re mutually exclusive — a Sprite and a Graphics backdrop fight the batch order). Rebuilds the node on each call (wallpaper changes are user-driven + rare).

§Panics

Panics if rgba.len() != width * height * 4 (via Texture::from_rgba).

Source

pub fn set_background_wallpaper_visible(&mut self, visible: bool)

Toggle the wallpaper backdrop’s visibility. No-op if unset (recorder path); also the app’s lever for the wallpaper↔gradient mutual exclusion.

Trait Implementations§

Source§

impl Debug for RecordingScene

Source§

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

Formats the value using the given formatter. Read more

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<T> Downcast<T> for T

§

fn downcast(&self) -> &T

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> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

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,