Skip to main content

LiquidOpticalRenderer

Struct LiquidOpticalRenderer 

Source
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.

Source

pub fn new_renderer() -> Self

Constructs a new LiquidOpticalRenderer with pre-allocated default field storage.

§Returns
  • Self - Ready optical liquid renderer.
Source

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].
Source

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.
Source

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, or None if all bounded pool slots are in flight.
Source§

impl LiquidOpticalRenderer

Source

pub fn get_field_w(&self) -> usize

Source

pub fn get_mut_field_w(&mut self) -> &mut usize

Source

pub fn set_field_w(&mut self, val: usize) -> &mut Self

Source

pub fn get_field_h(&self) -> usize

Source

pub fn get_mut_field_h(&mut self) -> &mut usize

Source

pub fn set_field_h(&mut self, val: usize) -> &mut Self

Source

pub fn get_phi(&self) -> &Vec<f32>

Source

pub fn get_mut_phi(&mut self) -> &mut Vec<f32>

Source

pub fn set_phi(&mut self, val: Vec<f32>) -> &mut Self

Source

pub fn get_phi_tmp(&self) -> &Vec<f32>

Source

pub fn get_mut_phi_tmp(&mut self) -> &mut Vec<f32>

Source

pub fn set_phi_tmp(&mut self, val: Vec<f32>) -> &mut Self

Source

pub fn get_thickness(&self) -> &Vec<f32>

Source

pub fn get_mut_thickness(&mut self) -> &mut Vec<f32>

Source

pub fn set_thickness(&mut self, val: Vec<f32>) -> &mut Self

Source

pub fn get_thick_tmp(&self) -> &Vec<f32>

Source

pub fn get_mut_thick_tmp(&mut self) -> &mut Vec<f32>

Source

pub fn set_thick_tmp(&mut self, val: Vec<f32>) -> &mut Self

Source

pub fn get_foam(&self) -> &Vec<f32>

Source

pub fn get_mut_foam(&mut self) -> &mut Vec<f32>

Source

pub fn set_foam(&mut self, val: Vec<f32>) -> &mut Self

Source

pub fn get_grad_x(&self) -> &Vec<f32>

Source

pub fn get_mut_grad_x(&mut self) -> &mut Vec<f32>

Source

pub fn set_grad_x(&mut self, val: Vec<f32>) -> &mut Self

Source

pub fn get_grad_y(&self) -> &Vec<f32>

Source

pub fn get_mut_grad_y(&mut self) -> &mut Vec<f32>

Source

pub fn set_grad_y(&mut self, val: Vec<f32>) -> &mut Self

Source

pub fn get_caustic(&self) -> &Vec<f32>

Source

pub fn get_mut_caustic(&mut self) -> &mut Vec<f32>

Source

pub fn set_caustic(&mut self, val: Vec<f32>) -> &mut Self

Source

pub fn get_last_width(&self) -> u32

Source

pub fn get_mut_last_width(&mut self) -> &mut u32

Source

pub fn set_last_width(&mut self, val: u32) -> &mut Self

Source

pub fn get_last_height(&self) -> u32

Source

pub fn get_mut_last_height(&mut self) -> &mut u32

Source

pub fn set_last_height(&mut self, val: u32) -> &mut Self

Trait Implementations§

Source§

impl Clone for LiquidOpticalRenderer

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LiquidOpticalRenderer

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LiquidOpticalRenderer

Default empty pre-warmed optical liquid renderer.

Source§

fn default() -> Self

Creates a LiquidOpticalRenderer ready to allocate field scratch buffers on first render.

§Returns
  • Self - Default optical liquid renderer.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.