pub struct WgpuRenderer<'a> { /* private fields */ }Expand description
WGPU-based renderer implementation.
Implementations§
Source§impl<'a> WgpuRenderer<'a>
impl<'a> WgpuRenderer<'a>
Sourcepub fn set_camera(&mut self, camera: Camera)
pub fn set_camera(&mut self, camera: Camera)
Set the active camera.
Sourcepub fn project(&self, world: Vec3) -> Option<ScreenPoint>
pub fn project(&self, world: Vec3) -> Option<ScreenPoint>
Project a world-space point to screen space.
Sourcepub fn clear_node_positions(&mut self)
pub fn clear_node_positions(&mut self)
Clear tracked node positions (call before each render).
Sourcepub fn get_node_positions(&self) -> &[(usize, ScreenPoint, f64)]
pub fn get_node_positions(&self) -> &[(usize, ScreenPoint, f64)]
Get tracked node positions (for epistemic anchor coordination).
Sourcepub fn hit_test(&self, point: ScreenPoint) -> Option<usize>
pub fn hit_test(&self, point: ScreenPoint) -> Option<usize>
Hit test: find which node contains the given screen point.
Returns the binary node index if a hit is found, None otherwise.
Zero-heap: uses stack-allocated f64 values for ray calculations.
Sourcepub fn pick_anchor(&self, x: f64, y: f64) -> Option<usize>
pub fn pick_anchor(&self, x: f64, y: f64) -> Option<usize>
Coordinate epistemic anchor at screen coordinates (x, y in physical pixels).
Sourcepub fn pick(&self, x: f64, y: f64) -> Option<usize>
👎Deprecated: Use pick_anchor() for epistemic anchor coordination
pub fn pick(&self, x: f64, y: f64) -> Option<usize>
Use pick_anchor() for epistemic anchor coordination
Legacy method for backward compatibility - use pick_anchor() for epistemic anchor coordination.
Sourcepub fn hover_anchor(&self, x: f64, y: f64) -> Option<usize>
pub fn hover_anchor(&self, x: f64, y: f64) -> Option<usize>
Check if mouse is hovering over epistemic anchor at screen coordinates (x, y in physical pixels).
Sourcepub fn hover(&self, x: f64, y: f64) -> Option<usize>
👎Deprecated: Use hover_anchor() for epistemic anchor coordination
pub fn hover(&self, x: f64, y: f64) -> Option<usize>
Use hover_anchor() for epistemic anchor coordination
Legacy method for backward compatibility - use hover_anchor() for epistemic anchor coordination.
Sourcepub fn line(
&self,
a: ScreenPoint,
b: ScreenPoint,
color: &str,
alpha: f64,
width: f64,
)
pub fn line( &self, a: ScreenPoint, b: ScreenPoint, color: &str, alpha: f64, width: f64, )
Draw a screen-space line segment.
Sourcepub fn point(&self, p: ScreenPoint, radius: f64, color: &str, alpha: f64)
pub fn point(&self, p: ScreenPoint, radius: f64, color: &str, alpha: f64)
Draw a filled screen-space disc (billboarded point).
Sourcepub fn fill_polygon(&self, points: &[ScreenPoint], color: &str, alpha: f64)
pub fn fill_polygon(&self, points: &[ScreenPoint], color: &str, alpha: f64)
Fill a screen-space polygon.
Source§impl<'a> WgpuRenderer<'a>
impl<'a> WgpuRenderer<'a>
Sourcepub fn read_pixels_with_receipt(&self) -> PixelReadback
pub fn read_pixels_with_receipt(&self) -> PixelReadback
Attempt a bounded pixel readback and return both bytes and evidence.
Sourcepub fn read_pixels(&self) -> Option<Vec<u8>>
pub fn read_pixels(&self) -> Option<Vec<u8>>
Read the offscreen target to a tightly-packed RGBA8 buffer
(width * height * 4 bytes, row-major). Returns None for refusal.
Sourcepub fn runtime_receipt(&self) -> WebGpuRuntimeReceipt
pub fn runtime_receipt(&self) -> WebGpuRuntimeReceipt
Return a complete bounded runtime receipt after attempting readback.
Sourcepub fn read_png(&self) -> Option<Vec<u8>>
pub fn read_png(&self) -> Option<Vec<u8>>
Read the offscreen target back as PNG-encoded bytes, ready to hand to a
webview as a data-URI or via a custom protocol. Returns None for surface
targets or if there is no GPU frame to read. Native-only (the wasm build
renders to a <canvas> and never reads back).
Sourcepub fn read_data_uri(&self) -> Option<String>
pub fn read_data_uri(&self) -> Option<String>
Read the offscreen frame back as a data:image/png;base64,... URI — drop
straight into a webview <img src>. Native-only.
Source§impl<'a> WgpuRenderer<'a>
impl<'a> WgpuRenderer<'a>
Sourcepub async fn new(
surface: Surface<'a>,
width: u32,
height: u32,
) -> Result<Self, String>
pub async fn new( surface: Surface<'a>, width: u32, height: u32, ) -> Result<Self, String>
Create a new WgpuRenderer that draws to a window surface.
Sourcepub async fn new_offscreen(
width: u32,
height: u32,
) -> Result<WgpuRenderer<'static>, String>
pub async fn new_offscreen( width: u32, height: u32, ) -> Result<WgpuRenderer<'static>, String>
Create a headless renderer that draws to an offscreen texture.
Sourcepub fn capabilities(&self) -> &WebGpuCapabilityReport
pub fn capabilities(&self) -> &WebGpuCapabilityReport
Return the bounded capability facts observed while constructing this renderer.
Sourcepub fn offscreen_extent(&self) -> Option<(u32, u32)>
pub fn offscreen_extent(&self) -> Option<(u32, u32)>
Return the effective offscreen extent, or None for a surface target.
Auto Trait Implementations§
impl<'a> !Freeze for WgpuRenderer<'a>
impl<'a> !RefUnwindSafe for WgpuRenderer<'a>
impl<'a> !UnwindSafe for WgpuRenderer<'a>
impl<'a> Send for WgpuRenderer<'a>
impl<'a> Sync for WgpuRenderer<'a>
impl<'a> Unpin for WgpuRenderer<'a>
impl<'a> UnsafeUnpin for WgpuRenderer<'a>
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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