pub struct GpuScene { /* private fields */ }Expand description
A retained list of GPU-friendly drawing commands in a logical coordinate
space. Build or update it with application state, then pass it to
GpuView. Commands paint in insertion order.
Implementations§
Source§impl GpuScene
impl GpuScene
pub fn new(width: f32, height: f32) -> Self
pub fn size(&self) -> (f32, f32)
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn rounded_rect(self, bounds: GpuRect, color: Hsla, radius: f32) -> Self
pub fn rounded_rect(self, bounds: GpuRect, color: Hsla, radius: f32) -> Self
Append a filled rounded rectangle.
Sourcepub fn bordered_rect(
self,
bounds: GpuRect,
fill: Hsla,
border: Hsla,
border_width: f32,
radius: f32,
) -> Self
pub fn bordered_rect( self, bounds: GpuRect, fill: Hsla, border: Hsla, border_width: f32, radius: f32, ) -> Self
Append a filled rectangle with a solid border.
pub fn push_rect(&mut self, bounds: GpuRect, color: Hsla)
Sourcepub fn texture(self, texture: GpuTexture, bounds: GpuRect) -> Self
pub fn texture(self, texture: GpuTexture, bounds: GpuRect) -> Self
Append a texture mapped over the supplied scene rectangle.
Sourcepub fn sprite(
self,
texture: GpuTexture,
source: GpuRect,
bounds: GpuRect,
) -> Self
pub fn sprite( self, texture: GpuTexture, source: GpuRect, bounds: GpuRect, ) -> Self
Draw one normalized region of a texture into a scene rectangle.
source uses 0.0..=1.0 texture coordinates. This keeps sprite-sheet
animation app-owned: select a frame while rebuilding the scene, without
creating a new texture or decoding the atlas again.
Sourcepub fn background(self, texture: GpuTexture) -> Self
pub fn background(self, texture: GpuTexture) -> Self
Append a texture covering the scene’s full logical bounds.
pub fn push_texture(&mut self, texture: GpuTexture, bounds: GpuRect)
pub fn push_sprite( &mut self, texture: GpuTexture, source: GpuRect, bounds: GpuRect, )
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GpuScene
impl RefUnwindSafe for GpuScene
impl Send for GpuScene
impl Sync for GpuScene
impl Unpin for GpuScene
impl UnsafeUnpin for GpuScene
impl UnwindSafe for GpuScene
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn 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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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.Source§fn as_any(&self) -> &(dyn Any + 'static)
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.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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> ⓘ
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 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> ⓘ
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