pub struct VolumetricRenderer { /* private fields */ }Expand description
Cross-platform volumetric renderer SDK. Native instances render offscreen on the same physical wgpu device as QualiaDB inference and expose caller-buffered RGBA8 readback.
Implementations§
Source§impl VolumetricRenderer
impl VolumetricRenderer
Sourcepub fn from_portal_gpu(inner: PortalGpu) -> Self
pub fn from_portal_gpu(inner: PortalGpu) -> Self
Create a volumetric renderer from an existing PortalGpu instance.
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>
New offscreen renderer.
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>
Create a 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).
Call render() to draw a frame; the swapchain present is automatic.
Sourcepub fn upload_tensor_buffer(&mut self, bytes: &[u8]) -> Result<u32, String>
pub fn upload_tensor_buffer(&mut self, bytes: &[u8]) -> Result<u32, String>
Uploads a tensor buffer.
Sourcepub fn load_hmc_asset(
&mut self,
hmc_bytes: &[u8],
asset_key: &str,
) -> Result<(u32, u32, f32), String>
pub fn load_hmc_asset( &mut self, hmc_bytes: &[u8], asset_key: &str, ) -> Result<(u32, u32, f32), String>
Load one .10d scene asset and its digest-verified HMC texture dependencies.
Texture decode and GPU residency remain cold, bounded asset-boundary work.
Sourcepub fn load_hmc_asset_with_texture_request(
&mut self,
hmc_bytes: &[u8],
asset_key: &str,
request: HmcTextureStreamRequest,
) -> Result<((u32, u32, f32), HmcTextureAdmissionReport), String>
pub fn load_hmc_asset_with_texture_request( &mut self, hmc_bytes: &[u8], asset_key: &str, request: HmcTextureStreamRequest, ) -> Result<((u32, u32, f32), HmcTextureAdmissionReport), String>
Load an HMC .10d asset while admitting texture mips according to view footprint
and streaming budgets. For KTX2 resources with stored coarse levels, the authored
mip is decoded directly without decompressing level zero or performing CPU filtering.
Sourcepub fn load_hmc_asset_with_texture_budget(
&mut self,
hmc_bytes: &[u8],
asset_key: &str,
budget: TextureStreamBudget,
) -> Result<((u32, u32, f32), HmcTextureAdmissionReport), String>
pub fn load_hmc_asset_with_texture_budget( &mut self, hmc_bytes: &[u8], asset_key: &str, budget: TextureStreamBudget, ) -> Result<((u32, u32, f32), HmcTextureAdmissionReport), String>
Load an HMC .10d asset while admitting only the highest-priority coarse-to-fine texture
mip prefix that fits the supplied per-load budgets. A texture admitted at mip m is
physically allocated from that mip’s dimensions, with its remaining coarser chain generated
on the GPU. Deferred interpretations use typed fallback maps for this scene load.
These budgets govern incremental HMC residency; they are separate from the 42 MiB semantic Sentinel and from graphics reservations owned by earlier scene loads. This API does not evict or refine textures already bound into existing material groups.
Sourcepub fn request_texture_stream(
&self,
request: HmcTextureStreamApplyRequest<'_>,
) -> Result<HmcTextureStreamPlan, String>
pub fn request_texture_stream( &self, request: HmcTextureStreamApplyRequest<'_>, ) -> Result<HmcTextureStreamPlan, String>
Plan a bounded working-set transition for the active HMC asset. The request list is the complete set of interpretations that should remain resident; omitted entries are evicted.
Sourcepub fn apply_texture_stream(
&mut self,
plan: HmcTextureStreamPlan,
) -> Result<(), String>
pub fn apply_texture_stream( &mut self, plan: HmcTextureStreamPlan, ) -> Result<(), String>
Apply a previously generated texture plan. A stale generation is rejected before any GPU mutation; successful refinement/eviction rebuilds the active material bind groups.
Sourcepub fn load_hmc_water_asset(
&mut self,
hmc_bytes: &[u8],
asset_key: &str,
) -> Result<(u32, u32), String>
pub fn load_hmc_water_asset( &mut self, hmc_bytes: &[u8], asset_key: &str, ) -> Result<(u32, u32), String>
Load a verified HMC mesh as the renderer-owned water surface. The surface uses shared scene depth and remains outside semantic picking.
Sourcepub fn upload_10d_mesh(&mut self, bytes: &[u8]) -> Result<u32, String>
pub fn upload_10d_mesh(&mut self, bytes: &[u8]) -> Result<u32, String>
Upload a .10d QuantizedMesh section (QualiaDB’s compact native
geometry format — u16-quantized vertices within the mesh’s bounding
box, u16/u32 triangle indices).
Decode/allocation occurs once at this explicit asset boundary; the resulting vertex/index buffers use the normal zero-copy GPU draw path.
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
Uploads a colored mesh.
Sourcepub fn set_camera(&mut self, yaw: f32, pitch: f32, zoom: f32)
pub fn set_camera(&mut self, yaw: f32, pitch: f32, zoom: f32)
Sets camera.
Sourcepub fn set_sun_shadows_enabled(&mut self, enabled: bool)
pub fn set_sun_shadows_enabled(&mut self, enabled: bool)
Toggle the bounded portable directional shadow pass. When its VRAM reservation is refused, the renderer keeps the unshadowed material path available.
Sourcepub fn sun_shadow_resolution(&self) -> Option<u32>
pub fn sun_shadow_resolution(&self) -> Option<u32>
Sun-shadow resolution.
Sourcepub fn set_screen_space_ao_enabled(&mut self, enabled: bool)
pub fn set_screen_space_ao_enabled(&mut self, enabled: bool)
Enable the optional half-resolution depth/normal ambient-visibility pass when budget permits.
Sourcepub fn set_screen_space_ao(&mut self, radius: f32, strength: f32, bias: f32)
pub fn set_screen_space_ao(&mut self, radius: f32, strength: f32, bias: f32)
Set the world-space AO radius, indirect visibility strength, and normal-offset bias.
Sourcepub fn set_screen_space_ao_sample_count(&mut self, samples: u32)
pub fn set_screen_space_ao_sample_count(&mut self, samples: u32)
Sets screen-space-ao-sample-count.
Sourcepub fn screen_space_ao_available(&self) -> bool
pub fn screen_space_ao_available(&self) -> bool
true when SSAO is available.
Sourcepub fn screen_space_ao_resolution(&self) -> Option<(u32, u32)>
pub fn screen_space_ao_resolution(&self) -> Option<(u32, u32)>
SSAO resolution.
Sourcepub fn render(
&mut self,
time_seconds: f32,
telemetry: &SystemTelemetry,
) -> Result<(), String>
pub fn render( &mut self, time_seconds: f32, telemetry: &SystemTelemetry, ) -> Result<(), String>
Renders.
Sourcepub fn render_scene_frame(
&mut self,
scene: &RenderScene,
width: u32,
height: u32,
time_seconds: f32,
telemetry: &SystemTelemetry,
) -> Result<(), String>
pub fn render_scene_frame( &mut self, scene: &RenderScene, width: u32, height: u32, time_seconds: f32, telemetry: &SystemTelemetry, ) -> Result<(), String>
Render a frame of scene into the active surface or offscreen target.
Converts scene nodes to Tensor10D instances, compiles faces/edges into a colored mesh, updates the camera orientation and distance, and executes the render pass.
Sourcepub fn required_rgba8_bytes(&self) -> usize
pub fn required_rgba8_bytes(&self) -> usize
Required RGBA8 bytes.
Sourcepub fn queue_pick(&mut self, x: f32, y: f32)
pub fn queue_pick(&mut self, x: f32, y: f32)
P9.3 — Queue an integer pick at pixel (x, y). The result is available
after the next render() call via poll_pick_readback().
Sourcepub fn poll_pick_readback(&mut self) -> Option<u32>
pub fn poll_pick_readback(&mut self) -> Option<u32>
P9.3 — Poll for a completed GPU pick readback. Returns Some(node_index)
if the picking pass has completed, or None if still pending.
Sourcepub fn cpu_pick_node_at(
tensor: &[u8],
canvas_w: f64,
canvas_h: f64,
pick_x: f64,
pick_y: f64,
yaw: f32,
standpoint: &ObserverStandpoint,
) -> Option<u32>
pub fn cpu_pick_node_at( tensor: &[u8], canvas_w: f64, canvas_h: f64, pick_x: f64, pick_y: f64, yaw: f32, standpoint: &ObserverStandpoint, ) -> Option<u32>
Legacy planar CPU picker retained for callers using the Canvas2D
projection. The camera-aware WebGPU-equivalent oracle is exposed by
Self::cpu_pick_node_at_camera.
Sourcepub fn cpu_pick_node_at_camera(
tensor: &[u8],
canvas_w: u32,
canvas_h: u32,
pick_x: f64,
pick_y: f64,
frame_time: f32,
camera: CameraState,
standpoint: &ObserverStandpoint,
) -> Option<u32>
pub fn cpu_pick_node_at_camera( tensor: &[u8], canvas_w: u32, canvas_h: u32, pick_x: f64, pick_y: f64, frame_time: f32, camera: CameraState, standpoint: &ObserverStandpoint, ) -> Option<u32>
CPU oracle for the Tensor10D WebGPU picking pass. Uses the same camera, frame time, observer/PGA transform, clip range, pixel footprint and depth ordering as the GPU projector.
Sourcepub fn load_10d_asset(
&mut self,
bytes: &[u8],
) -> Result<(u32, u32, f32), String>
pub fn load_10d_asset( &mut self, bytes: &[u8], ) -> Result<(u32, u32, f32), String>
Native shared decode/upload path with the legacy Core compatibility profile.
Sourcepub fn colour_by_field(value: f32, min: f32, max: f32) -> [f32; 3]
pub fn colour_by_field(value: f32, min: f32, max: f32) -> [f32; 3]
P9.3 — Colour-by-field: map a scalar field value to a deterministic RGB colour. The mapping is a simple linear interpolation across a fixed colour ramp, ensuring the same field value produces the same colour on both CPU and GPU paths.
Sourcepub fn temporal_scrub(
tensor: &[u8],
t_slice: f32,
t_window: f32,
) -> Result<Vec<u32>, String>
pub fn temporal_scrub( tensor: &[u8], t_slice: f32, t_window: f32, ) -> Result<Vec<u32>, String>
P9.3 — Temporal-scrub: filter tensor nodes to those within the
[t_slice - t_window/2, t_slice + t_window/2] time window. Returns
the indices of nodes in the window, byte-identical to a linear-scan
oracle.
Source§impl VolumetricRenderer
impl VolumetricRenderer
pub fn load_10d_review_asset( &mut self, bytes: &[u8], ) -> Result<(ReviewGeometry, f32), String>
pub fn render_10d_review_pngs( &mut self, bytes: &[u8], side: u32, ) -> Result<(ReviewGeometry, Vec<(ReviewView, Vec<u8>)>), String>
Source§impl VolumetricRenderer
impl VolumetricRenderer
Sourcepub fn render_10d_shot(
&mut self,
bytes: &[u8],
shot: &NativeShot,
) -> Result<(ReviewGeometry, Vec<Vec<u8>>), String>
pub fn render_10d_shot( &mut self, bytes: &[u8], shot: &NativeShot, ) -> Result<(ReviewGeometry, Vec<Vec<u8>>), String>
Render explicit timestamps from immutable bind geometry. Texture resources,
when used, must first be admitted with load_hmc_asset_with_texture_budget.
Auto Trait Implementations§
impl !Freeze for VolumetricRenderer
impl !RefUnwindSafe for VolumetricRenderer
impl !Sync for VolumetricRenderer
impl !UnwindSafe for VolumetricRenderer
impl Send for VolumetricRenderer
impl Unpin for VolumetricRenderer
impl UnsafeUnpin for VolumetricRenderer
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