Pre-1.0: signatures are not frozen. Generated from rustdoc JSON of the compiled crate; rustdoc JSON format version 60. Only public items are listed.
Dye field -> image: tone mapping, colour ramp, glow, optional bicubic upscale, dithering.
Everything is f32 with + - * / sqrt only (no libm transcendentals), so a render is as
deterministic as the simulation: the same [Fluid] and [FluidStyle] give the same bytes.
The result is a straight RGBA8 image (opaque over a background, or premultiplied light
when background is None) that [image_recording] wraps in one Recorder::image
command, so it paints like any other recording (Surface::Recording, NodeDescription::drawing).
Structs
structaster_blueprint::fluid_render::FluidImage
pub struct FluidImage { /* see fields */ }A rendered frame: tightly packed RGBA8, w * h * 4 bytes.
Public fields
| field | type | |
|---|---|---|
w | u32 | |
h | u32 | |
rgba | Vec<u8> | |
premultiplied | bool | true when the colour channels are premultiplied by alpha (background: None). |
Trait implementations: Clone, Debug, Default, Eq, PartialEq, StructuralPartialEq
structaster_blueprint::fluid_render::FluidRenderer
pub struct FluidRenderer { /* see fields */ }Reusable render buffers: rendering many frames allocates only when the size changes.
Methods
fn new() -> Selffn render(&mut self, fluid: &Fluid, style: &FluidStyle) -> &FluidImage— Renderfluidwithstyle. The returned image borrows the renderer's buffer.
Trait implementations: Clone, Debug, Default
structaster_blueprint::fluid_render::FluidStyle
pub struct FluidStyle { /* see fields */ }How a [Fluid] is turned into pixels.
Public fields
| field | type | |
|---|---|---|
exposure | f32 | Brightness before tone mapping (d -> 1 - 1/(1 + e d + (e d)^2 / 2), about 1 - exp(-e d)). |
glow | f32 | Bloom amount added from a blurred copy, 0 off, 0.3..0.8 is a soft glow. |
background | Option<[u8; 3]> | Colour the dye is added to (light on a dark base), sRGB. None renders premultiplied light on a transparent image so the panel behind shows through. |
ramp | Option<Vec<(f32, [u8; 3])>> | Colour ramp (position 0..1, sRGB) applied to the tone-mapped density; needs at least two stops. With a ramp the dye colour is ignored and only its density matters. |
obstacle | [u8; 3] | Colour of obstacle cells. |
upscale | usize | Output pixels per grid cell per axis, 1..=4. 1 leaves the smoothing to the renderer's bilinear sampling, more upsamples with Catmull-Rom (sharper, costs time). |
saturation | f32 | 1 keeps the colours, <1 washes them out, >1 pushes them. |
Methods
fn ember() -> Vec<(f32, [u8; 3])>— Flame / ember ramp: black, deep red, orange, yellow, white.fn ice() -> Vec<(f32, [u8; 3])>— Cool ink ramp: navy, teal, cyan, white.
Trait implementations: Clone, Debug, Default, PartialEq, StructuralPartialEq
Functions
fnaster_blueprint::fluid_render::image_recording
pub fn image_recording(img: &FluidImage, width: f64, height: f64) -> Result<std::sync::Arc<aster_ui::Recording>, aster_ui::Error>Wrap a rendered frame in a one-command recording that stretches it over (0, 0, width, height)
with bilinear sampling. This is the value core.fluid.dye.v1 outputs inside a Surface.
fnaster_blueprint::fluid_render::render_recording
pub fn render_recording(fluid: &fluid::Fluid, style: &FluidStyle, width: f64, height: f64) -> Result<std::sync::Arc<aster_ui::Recording>, aster_ui::Error>One-shot convenience: render fluid and wrap it.