pub struct PathTracerBuffer {
pub width: usize,
pub height: usize,
pub accumulator: Vec<[f32; 3]>,
pub sample_count: Vec<u32>,
}Expand description
A pixel accumulation buffer for progressive rendering.
Fields§
§width: usizeBuffer width in pixels.
height: usizeBuffer height in pixels.
accumulator: Vec<[f32; 3]>Accumulated colour per pixel (RGB, floating point).
sample_count: Vec<u32>Number of samples accumulated per pixel.
Implementations§
Source§impl PathTracerBuffer
impl PathTracerBuffer
Sourcepub fn new(width: usize, height: usize) -> Self
pub fn new(width: usize, height: usize) -> Self
Create a new buffer of width × height pixels, all zeroed.
Sourcepub fn add_sample(&mut self, x: usize, y: usize, color: [f32; 3])
pub fn add_sample(&mut self, x: usize, y: usize, color: [f32; 3])
Add a colour sample to pixel (x, y).
Sourcepub fn get_pixel(&self, x: usize, y: usize) -> [f32; 3]
pub fn get_pixel(&self, x: usize, y: usize) -> [f32; 3]
Get the averaged colour at pixel (x, y).
Sourcepub fn total_samples(&self) -> u64
pub fn total_samples(&self) -> u64
Total number of samples accumulated across all pixels.
Trait Implementations§
Source§impl Clone for PathTracerBuffer
impl Clone for PathTracerBuffer
Source§fn clone(&self) -> PathTracerBuffer
fn clone(&self) -> PathTracerBuffer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for PathTracerBuffer
impl RefUnwindSafe for PathTracerBuffer
impl Send for PathTracerBuffer
impl Sync for PathTracerBuffer
impl Unpin for PathTracerBuffer
impl UnsafeUnpin for PathTracerBuffer
impl UnwindSafe for PathTracerBuffer
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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