pub struct BorderRenderer {
pipeline: RenderPipeline,
bind_group_layout: BindGroupLayout,
outer_uniform: Buffer,
inner_uniform: Buffer,
outer_bind_group: BindGroup,
inner_bind_group: BindGroup,
outer_visible: bool,
inner_visible: bool,
}Expand description
GPU pass for the two MD2 border rings.
Holds one shader, one alpha-blended pipeline, and two uniform buffers
(outer + inner ring) wired through a shared bind-group layout. Each
frame’s Self::update writes both buffers; Self::render
dispatches one draw per ring whose alpha is non-zero.
Fields§
§pipeline: RenderPipeline§bind_group_layout: BindGroupLayout§outer_uniform: Buffer§inner_uniform: Buffer§outer_bind_group: BindGroup§inner_bind_group: BindGroup§outer_visible: bool§inner_visible: boolImplementations§
Source§impl BorderRenderer
impl BorderRenderer
pub fn new(device: &Device, format: TextureFormat) -> Self
Sourcepub fn update(&mut self, queue: &Queue, params: BorderParams, aspect_ratio: f32)
pub fn update(&mut self, queue: &Queue, params: BorderParams, aspect_ratio: f32)
Recompute the per-ring uniforms from a BorderParams snapshot
and the current output aspect ratio. Rings with alpha ≤ 0 are
flagged as invisible so Self::render skips their draw call.
Sourcepub fn render(&self, encoder: &mut CommandEncoder, view: &TextureView)
pub fn render(&self, encoder: &mut CommandEncoder, view: &TextureView)
Render both visible rings into view. The pass loads existing
contents (no clear) so it composites on top of the warp / wave /
shape output.
Sourcepub fn batch_count(&self) -> usize
pub fn batch_count(&self) -> usize
Number of draw calls the next Self::render will issue.
Exposed for tests asserting that the pass becomes a no-op when
both rings are transparent.
Sourcepub fn bind_group_layout(&self) -> &BindGroupLayout
pub fn bind_group_layout(&self) -> &BindGroupLayout
Read-only access to the bind-group layout. Currently used only in unit tests that build their own pipelines.
Auto Trait Implementations§
impl Freeze for BorderRenderer
impl !RefUnwindSafe for BorderRenderer
impl Send for BorderRenderer
impl Sync for BorderRenderer
impl Unpin for BorderRenderer
impl !UnwindSafe for BorderRenderer
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