pub struct LiquidOpticalRenderer { /* private fields */ }Expand description
Persistent zero-allocation photorealistic optical liquid renderer producing RGBA8 frames with Snell refraction, Beer-Lambert depth absorption, Fresnel reflections, optical caustics, buoyant bodies, foam, and glass vessel framing.
Implementations§
Source§impl LiquidOpticalRenderer
Scalar field splatting, separable Gaussian smoothing, gradient/caustic synthesis, and parallel optical shading for LiquidOpticalRenderer.
impl LiquidOpticalRenderer
Scalar field splatting, separable Gaussian smoothing, gradient/caustic synthesis, and parallel optical shading for LiquidOpticalRenderer.
Sourcepub fn new_renderer() -> Self
pub fn new_renderer() -> Self
Constructs a new LiquidOpticalRenderer with pre-allocated default field storage.
§Returns
Self- Ready optical liquid renderer.
Sourcepub fn resolve_render_dimensions(viewport_w: u32, viewport_h: u32) -> (u32, u32)
pub fn resolve_render_dimensions(viewport_w: u32, viewport_h: u32) -> (u32, u32)
Computes capped optical render dimensions (render_w, render_h) preserving viewport aspect ratio for arbitrary resize and fullscreen modes.
§Arguments
u32- Target viewport width in logical pixels.u32- Target viewport height in logical pixels.
§Returns
(u32, u32)- Optimal internal optical RGBA8(width, height)clamped to[FLUID_RENDER_MIN_DIM, FLUID_RENDER_MAX_DIM].
Sourcepub fn render_snapshot_into_vec(
&mut self,
snapshot: &FluidSimSnapshot,
width: u32,
height: u32,
rgba_out: &mut Vec<u8>,
) -> (u32, u32)
pub fn render_snapshot_into_vec( &mut self, snapshot: &FluidSimSnapshot, width: u32, height: u32, rgba_out: &mut Vec<u8>, ) -> (u32, u32)
Renders snapshot directly into an existing RGBA8 byte buffer rgba_out sized (width, height) with zero steady-state heap allocations.
§Arguments
&Self- Mutable optical liquid renderer.&FluidSimSnapshot- Interpolated simulation snapshot.u32- Output width in pixels.u32- Output height in pixels.&mut Vec<u8>- Destination RGBA8 byte buffer resized only if needed.
§Returns
(u32, u32)- Actual rendered(width, height)dimensions.
Sourcepub fn render_snapshot_into_pool(
&mut self,
snapshot: &FluidSimSnapshot,
viewport_w: u32,
viewport_h: u32,
pool: &RenderBufferPool,
fence_id: u64,
) -> Option<PooledFrameLease>
pub fn render_snapshot_into_pool( &mut self, snapshot: &FluidSimSnapshot, viewport_w: u32, viewport_h: u32, pool: &RenderBufferPool, fence_id: u64, ) -> Option<PooledFrameLease>
Renders snapshot directly into a bounded zero-allocation RenderBufferPool slot tagged with fence_id.
§Arguments
&Self- Mutable optical liquid renderer.&FluidSimSnapshot- Interpolated simulation snapshot.u32- Target viewport width in logical pixels.u32- Target viewport height in logical pixels.&RenderBufferPool- Bounded RGBA8 frame buffer pool.u64- Fence identifier guarding slot reclamation.
§Returns
Option<PooledFrameLease>- Rendered zero-copy frame lease, orNoneif all bounded pool slots are in flight.