#[repr(C)]pub struct QuadInstance {
pub center: [f32; 2],
pub radius: f32,
pub inner: f32,
pub color: [f32; 4],
pub aa: f32,
pub shape: u32,
pub _pad: [f32; 2],
}Expand description
A screen-aligned quad instance carrying an SDF shape — the one instance
type the GPU pipeline draws (a CircleInstance/RingInstance/MarkerInstance
all lower into this). The vertex shader expands center ± (radius + aa) into a
quad; the fragment shader evaluates the SDF picked by shape.
48 bytes, #[repr(C)] — the GPU instance-buffer layout (matches sdf.wgsl).
Fields§
§center: [f32; 2]Centre in screen pixels.
radius: f32Outer radius (the disc / ring outer / marker half-extent), pixels.
inner: f32Inner radius — ring hole / rounded-square corner radius, pixels. 0 for a
plain circle / sharp marker.
color: [f32; 4]Straight RGBA in [0, 1].
aa: f32Anti-alias band half-width in pixels.
shape: u32One of the shape tags.
_pad: [f32; 2]Padding to a 16-byte multiple (48 bytes) so an instance array is naturally aligned for the GPU.
Implementations§
Source§impl QuadInstance
impl QuadInstance
Sourcepub fn half_extent(&self) -> f32
pub fn half_extent(&self) -> f32
The quad’s half-extent: outer radius plus the AA band (the vertex shader and the CPU raster both inflate the bound by this so the AA fringe is not clipped).
Trait Implementations§
Source§impl Clone for QuadInstance
impl Clone for QuadInstance
Source§fn clone(&self) -> QuadInstance
fn clone(&self) -> QuadInstance
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for QuadInstance
Source§impl Debug for QuadInstance
impl Debug for QuadInstance
Source§impl PartialEq for QuadInstance
impl PartialEq for QuadInstance
Source§fn eq(&self, other: &QuadInstance) -> bool
fn eq(&self, other: &QuadInstance) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for QuadInstance
Auto Trait Implementations§
impl Freeze for QuadInstance
impl RefUnwindSafe for QuadInstance
impl Send for QuadInstance
impl Sync for QuadInstance
impl Unpin for QuadInstance
impl UnsafeUnpin for QuadInstance
impl UnwindSafe for QuadInstance
Blanket Implementations§
impl<T> Allocation for T
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> 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