pub enum UiDrawCommand {
SharedParticles {
particles: Arc<Vec<UiParticle>>,
dx: f32,
dy: f32,
},
Text {
text: String,
x: f32,
y: f32,
scale: f32,
color: Vec4,
emission: f32,
alignment: TextAlign,
},
Rect {
x: f32,
y: f32,
w: f32,
h: f32,
color: Vec4,
filled: bool,
},
Panel {
x: f32,
y: f32,
w: f32,
h: f32,
border: BorderStyle,
fill_color: Vec4,
border_color: Vec4,
},
Bar {
x: f32,
y: f32,
w: f32,
h: f32,
fill_pct: f32,
fill_color: Vec4,
bg_color: Vec4,
ghost_pct: Option<f32>,
ghost_color: Vec4,
},
Sprite {
lines: Vec<String>,
x: f32,
y: f32,
color: Vec4,
},
Particles(Vec<UiParticle>),
}Expand description
A single UI draw command, queued and executed in order.
Variants§
A cloud somebody else owns, drawn at an offset.
The ordinary Particles command takes a Vec, which means a caller
with a cached cloud has to clone it every frame to hand it over. A
static background of a hundred and forty thousand particles is seven
megabytes of allocation and copy per frame producing an identical
result — which is not a rendering cost, it is a memcpy the renderer
never asked for.
This takes a shared handle instead, so the caller keeps its cloud and passing it costs a reference count. The offset is applied while the instances are built, which is a pass the renderer was making anyway.
Text
Rect
Panel
Bar
Fields
Sprite
Particles(Vec<UiParticle>)
A cloud of independently placed glyphs.
Text is the wrong shape for this: a figure built out of particles has no
baseline, no advance width and no string, and routing it through
Text costs one String allocation per particle per frame. This is one
command for the whole cloud, and it exposes the per-instance rotation
and glow the glyph pipeline already supports.
Implementations§
Source§impl UiDrawCommand
impl UiDrawCommand
Sourcepub fn default_pass(&self) -> UiPass
pub fn default_pass(&self) -> UiPass
The pass a command lands in when nothing overrides it.
Trait Implementations§
Source§impl Clone for UiDrawCommand
impl Clone for UiDrawCommand
Auto Trait Implementations§
impl Freeze for UiDrawCommand
impl RefUnwindSafe for UiDrawCommand
impl Send for UiDrawCommand
impl Sync for UiDrawCommand
impl Unpin for UiDrawCommand
impl UnsafeUnpin for UiDrawCommand
impl UnwindSafe for UiDrawCommand
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
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>
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>
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)
&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)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.