pub struct PortalGpu { /* private fields */ }Implementations§
Source§impl PortalGpu
impl PortalGpu
Sourcepub fn new_offscreen(
width: u32,
height: u32,
particle_cap: usize,
) -> Result<Self, String>
pub fn new_offscreen( width: u32, height: u32, particle_cap: usize, ) -> Result<Self, String>
Build a native offscreen renderer on QualiaDB’s process-wide shared GPU device.
The output target is linear Rgba8Unorm. Call Self::render and then
Self::read_rgba8_into to retrieve tightly packed pixels into a caller-owned buffer.
Sourcepub fn new_surface(
hwnd: isize,
width: u32,
height: u32,
particle_cap: usize,
) -> Result<Self, String>
pub fn new_surface( hwnd: isize, width: u32, height: u32, particle_cap: usize, ) -> Result<Self, String>
Build a native surface renderer that draws directly to a window’s GPU swapchain.
This is the native desktop path — no PNG round-trip, no webview <img>. The surface
is created from a raw window handle (HWND on Windows) and frames are presented directly
to the OS swapchain.
The surface format is chosen from the adapter’s capabilities (sRGB preferred).
Call Self::render to draw a frame; the swapchain present is automatic.
Sourcepub fn set_ambient_enabled(&mut self, on: bool)
pub fn set_ambient_enabled(&mut self, on: bool)
Enable/disable the ambient particle field draw. Off by default (a plain mesh/anatomy view has no use for the decorative random cloud); a Tensor10D upload turns it on since the particles then encode epistemic nodes. The mixer’s “ambient” channel drives this.
pub fn upload_tensor_buffer(&mut self, bytes: &[u8]) -> Result<u32, String>
pub fn tensor_node_count(&self) -> u32
Sourcepub fn set_artefact_joint(&mut self, joint: Option<Joint>)
pub fn set_artefact_joint(&mut self, joint: Option<Joint>)
Drive the loaded mesh by a kinematic joint (Phase 2). None freezes it at identity.
Sourcepub fn set_artefact_world(&mut self, world: Option<Aabb>)
pub fn set_artefact_world(&mut self, world: Option<Aabb>)
Constrain the artefact to a world bound; a joint pose that would leave it is refused
(the artefact holds at the last admitted pose). None = unconstrained.
Sourcepub fn artefact_refused(&self) -> bool
pub fn artefact_refused(&self) -> bool
Whether last frame’s proposed joint pose was deterministically refused (clamped at the bound).
pub fn has_tensor_buffer(&self) -> bool
Sourcepub fn upload_mesh(&mut self, positions: &[[f32; 3]], indices: &[u32]) -> u32
pub fn upload_mesh(&mut self, positions: &[[f32; 3]], indices: &[u32]) -> u32
Upload an imported triangle mesh (Phase 1.2). positions are model-space f32x3 (the caller
centres + scales them to the orbit frame); indices is a flat triangle list (tris * 3).
Returns the triangle count; clears any prior mesh when empty.
Sourcepub fn upload_mesh_colored(
&mut self,
positions: &[[f32; 3]],
colors: &[[f32; 4]],
indices: &[u32],
) -> u32
pub fn upload_mesh_colored( &mut self, positions: &[[f32; 3]], colors: &[[f32; 4]], indices: &[u32], ) -> u32
Upload a triangle mesh with per-vertex linear RGBA colours. When colors is empty the
engine’s neutral blue-grey material is used; any non-empty slice must match positions.
pub fn set_camera(&mut self, yaw: f32, pitch: f32, zoom: f32)
pub fn set_standpoint(&mut self, observer: ObserverStandpoint)
pub fn observer_standpoint(&self) -> ObserverStandpoint
pub fn camera_state(&self) -> CameraState
Sourcepub fn surface_size(&self) -> (u32, u32)
pub fn surface_size(&self) -> (u32, u32)
Configured surface/depth size. The swapchain texture follows the canvas backing store,
so callers compare this to canvas.width()/height() and resize() on divergence —
otherwise color and depth attachments mismatch and the render pass fails validation.
pub fn resize(&mut self, width: u32, height: u32)
Sourcepub fn sync_bloom_targets(&mut self)
pub fn sync_bloom_targets(&mut self)
Reconcile HDR bloom textures with current VramLedger operational mode.
pub fn queue_pick(&mut self, x: f32, y: f32)
pub fn poll_pick_readback(&mut self) -> Option<u32>
pub fn render( &mut self, time: f32, telemetry: &SystemTelemetry, ) -> Result<(), String>
Sourcepub fn required_rgba8_bytes(&self) -> usize
pub fn required_rgba8_bytes(&self) -> usize
Number of bytes required by Self::read_rgba8_into.
Sourcepub fn read_rgba8_into(&self, out: &mut [u8]) -> Result<usize, String>
pub fn read_rgba8_into(&self, out: &mut [u8]) -> Result<usize, String>
Read the most recently rendered native offscreen frame into tightly packed RGBA8 bytes.
This is deliberately caller-buffered: no Vec is created in the renderer. Browser surface
instances return an error because their swapchain images are presented, not retained.
pub fn particle_count(&self) -> u32
Auto Trait Implementations§
impl !Freeze for PortalGpu
impl !RefUnwindSafe for PortalGpu
impl Send for PortalGpu
impl Sync for PortalGpu
impl Unpin for PortalGpu
impl UnsafeUnpin for PortalGpu
impl !UnwindSafe for PortalGpu
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<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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