pub trait FnWrite<'a>: FnMut(&str, usize, usize, usize, usize, usize, usize, &PixelFormat, &[f32]) -> Error + 'a { }
Expand description
A closure which is called for each bucket of pixels the
OutputDriver
instance sends
during rendering.
It is passed to ɴsɪ via the "callback.write"
attribute on that node.
Example
let write = nsi::output::WriteCallback::new(
|name: &str,
width: usize,
height: usize,
x_min: usize,
x_max_plus_one: usize,
y_min: usize,
y_max_plus_one: usize,
pixel_format: &nsi::output::PixelFormat,
pixel_data: &[f32]| {
/// Send our pixels to some texture for realtime display.
nsi::output::Error::None
},
);
ctx.set_attribute(
"oxidized_output_driver",
&[
nsi::string!("drivername", "ferris"),
// While rendering, send all pixel buckets to the write closure.
nsi::callback!("callback.write", write),
],
);