pub struct MotionVectorRenderer {
pipeline: RenderPipeline,
vertex_buffer: Buffer,
vertex_count: u32,
}Expand description
GPU pass for the MD2 motion-vector grid.
Fields§
§pipeline: RenderPipeline§vertex_buffer: Buffer§vertex_count: u32Logical vertex count after the most recent Self::update.
Always segments * 2.
Implementations§
Source§impl MotionVectorRenderer
impl MotionVectorRenderer
pub fn new(device: &Device, format: TextureFormat) -> Self
Sourcepub fn update(
&mut self,
queue: &Queue,
params: MotionVectorParams,
warp_field: Option<WarpField<'_>>,
) -> u32
pub fn update( &mut self, queue: &Queue, params: MotionVectorParams, warp_field: Option<WarpField<'_>>, ) -> u32
Rebuild the per-frame segment stream from a MotionVectorParams
snapshot and upload it. Returns the number of segments produced
— 0 when the pass is a no-op (zero alpha, zero grid, etc).
warp_field (when Some) carries the per-vertex uv_warp array
from the warp mesh; the segment at grid cell (i, j) then points
along the local warp displacement (uv_warp - uv_orig) instead
of a flat horizontal stub. Matches MD2’s “streaks” feel: the
segments anticipate the trail the feedback loop will pull them
into. Pass None to fall back to the horizontal-stub default.
pub fn render(&self, encoder: &mut CommandEncoder, view: &TextureView)
Sourcepub fn segment_count(&self) -> u32
pub fn segment_count(&self) -> u32
Number of segments the next Self::render will issue (two
vertices each). Exposed for tests.
Auto Trait Implementations§
impl Freeze for MotionVectorRenderer
impl !RefUnwindSafe for MotionVectorRenderer
impl Send for MotionVectorRenderer
impl Sync for MotionVectorRenderer
impl Unpin for MotionVectorRenderer
impl !UnwindSafe for MotionVectorRenderer
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
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