#[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 more