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
impl RecordingScene
Sourcepub fn new(
app: &Application,
screen_dims: StreamDimensions,
cam_dims: StreamDimensions,
cam_layout: CamLayout,
) -> Self
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.
Sourcepub fn set_screen_frame(&mut self, app: &Application, bgra: &[u8])
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.
Sourcepub fn set_camera_frame(&mut self, app: &Application, bgra: &[u8])
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.
Sourcepub fn render(
&self,
renderer: &Renderer,
app: &Application,
view: &TextureView,
clear: Color,
) -> RenderStats
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.
Sourcepub fn stage(&self) -> &Stage
pub fn stage(&self) -> &Stage
Borrow the scene graph (e.g. to call
Renderer::render_stage directly).
Sourcepub fn stage_mut(&mut self) -> &mut Stage
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.
Sourcepub fn screen_dims(&self) -> StreamDimensions
pub fn screen_dims(&self) -> StreamDimensions
Configured screen dimensions.
Sourcepub fn cam_dims(&self) -> StreamDimensions
pub fn cam_dims(&self) -> StreamDimensions
Configured camera dimensions.
Sourcepub fn cam_layout(&self) -> CamLayout
pub fn cam_layout(&self) -> CamLayout
Active camera layout (centre + radius).
Sourcepub fn screen_sprite_id(&self) -> NodeId
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.
Sourcepub fn cam_container_id(&self) -> NodeId
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.
Sourcepub fn cam_sprite_id(&self) -> NodeId
pub fn cam_sprite_id(&self) -> NodeId
NodeId of the cam sprite (inside the cam container).
Sourcepub fn set_camera_visible(&mut self, visible: bool)
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).
Sourcepub fn set_screen_visible(&mut self, visible: bool)
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.
Sourcepub fn set_screen_transform(&mut self, transform: Transform)
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.
Sourcepub fn set_screen_clip(&mut self, shape: Option<MaskShape>)
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).
Sourcefn backdrop_graphics_mut(&mut self) -> &mut Graphics
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.
Sourcepub fn set_background_gradient(
&mut self,
from: Color,
to: Color,
angle_deg: f32,
)
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).
Sourcepub fn set_background_color(&mut self, color: Color)
pub fn set_background_color(&mut self, color: Color)
Paint the backdrop as a flat color fill, and make it visible.
Sourcepub fn set_background_visible(&mut self, visible: bool)
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).
Sourcefn cursor_graphics_mut(&mut self) -> &mut Graphics
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.
Sourcepub fn set_cursor(
&mut self,
pointer_ndc: Vec2,
half: f32,
ripples: &[CursorRipple],
)
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.
Sourcepub fn set_cursor_visible(&mut self, visible: bool)
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).
Sourcefn shadow_graphics_mut(&mut self) -> &mut Graphics
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.
Sourcepub fn set_frame_shadow(
&mut self,
window: Rect,
corner_radius: f32,
offset: Vec2,
color: Color,
)
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.
Sourcepub fn set_frame_shadow_visible(&mut self, visible: bool)
pub fn set_frame_shadow_visible(&mut self, visible: bool)
Toggle the drop-shadow’s visibility. No-op if unset (recorder path).
Sourcefn border_graphics_mut(&mut self) -> &mut Graphics
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.
Sourcepub fn set_frame_border(
&mut self,
window: Rect,
corner_radius: f32,
stroke: Stroke,
)
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.
Sourcepub fn set_frame_border_visible(&mut self, visible: bool)
pub fn set_frame_border_visible(&mut self, visible: bool)
Toggle the inset border’s visibility. No-op if unset (recorder path).
Sourcepub fn set_background_wallpaper(
&mut self,
app: &Application,
width: u32,
height: u32,
rgba: &[u8],
)
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).
Sourcepub fn set_background_wallpaper_visible(&mut self, visible: bool)
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§
Auto Trait Implementations§
impl Freeze for RecordingScene
impl !RefUnwindSafe for RecordingScene
impl Send for RecordingScene
impl Sync for RecordingScene
impl Unpin for RecordingScene
impl UnsafeUnpin for RecordingScene
impl !UnwindSafe for RecordingScene
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<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