pub struct VelocityBuffer {
pub width: u32,
pub height: u32,
/* private fields */
}Expand description
Per-pixel screen-space velocity (in UV units/frame).
This is populated each frame by the scene renderer before the blur pass. Glyphs with high velocity write their screen-space motion vector here.
Fields§
§width: u32§height: u32Implementations§
Source§impl VelocityBuffer
impl VelocityBuffer
pub fn new(width: u32, height: u32) -> Self
pub fn clear(&mut self)
pub fn set(&mut self, x: u32, y: u32, velocity: Vec2)
pub fn get(&self, x: u32, y: u32) -> Vec2
Sourcepub fn add(&mut self, x: u32, y: u32, velocity: Vec2)
pub fn add(&mut self, x: u32, y: u32, velocity: Vec2)
Add velocity to a pixel (accumulate from multiple sources).
Sourcepub fn splat(&mut self, pos_px: Vec2, vel_uv: Vec2, radius_px: f32)
pub fn splat(&mut self, pos_px: Vec2, vel_uv: Vec2, radius_px: f32)
Write a glyph’s screen-space velocity to the buffer.
pos_px is pixel position, vel_uv is screen-space velocity in UV units/frame.
Writes to a small neighborhood for fill coverage.
Sourcepub fn clamp(&mut self, max_length: f32)
pub fn clamp(&mut self, max_length: f32)
Clamp all velocities to max_length UV units per frame.
Sourcepub fn as_f32_slice(&self) -> &[f32]
pub fn as_f32_slice(&self) -> &[f32]
Raw f32 slice for GPU upload (RG32F: 2 floats per pixel).
pub fn pixel_count(&self) -> usize
Auto Trait Implementations§
impl Freeze for VelocityBuffer
impl RefUnwindSafe for VelocityBuffer
impl Send for VelocityBuffer
impl Sync for VelocityBuffer
impl Unpin for VelocityBuffer
impl UnsafeUnpin for VelocityBuffer
impl UnwindSafe for VelocityBuffer
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
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.