[−][src]Struct pbrt::core::film::Film
Film models the sensor on a simulated camera. It may have a crop_window
that limits
rendering to a subset of the Film
.
Fields
full_resolution: Point2i
full_resolution represents the full extents of the film. This Film
may be further
limited by crop_window
.
filter: Box<dyn Filter>
filter specifies the sampling algorithm to use when evaluating pixels in the Film
.
diagonal_m: Float
physical distance of the Film
's diagonal in meters.
filename: String
filename to store the contents of the Film
cropped_pixel_bounds: Bounds2i
cropped_pixel_bounds represents the portion of the Film
to render
Methods
impl Film
[src]
pub fn new(
resolution: Point2i,
crop_window: Bounds2f,
filter: Box<dyn Filter>,
diagonal_mm: Float,
filename: String,
scale: Float,
max_sample_luminance: Float
) -> Film
[src]
resolution: Point2i,
crop_window: Bounds2f,
filter: Box<dyn Filter>,
diagonal_mm: Float,
filename: String,
scale: Float,
max_sample_luminance: Float
) -> Film
new creates a Film
struct from the given parameters. Note that diagonal_mm
specifies
the physical diagonal size of the Film
in millimeters, but the internal representation is
meters.
pub fn get_sample_bounds(&self) -> Bounds2i
[src]
Return the bounding box for sampling this Film
.
Examples
use pbrt::core::film::Film; use pbrt::core::geometry::Bounds2i; use pbrt::core::geometry::Point2i; use pbrt::filters::boxfilter::BoxFilter; let filter = BoxFilter::new([8., 8.].into()); let film = Film::new( [1920, 1080].into(), [[0.25, 0.25], [0.75, 0.75]].into(), Box::new(filter), 35.0, "output.png".to_string(), 1., 1., ); assert_eq!( film.get_sample_bounds(), Bounds2i::from([[472, 262], [1448, 818]]) );
pub fn get_physical_extent(&self) -> Bounds2f
[src]
Compute physical size of the film.
Examples
use pbrt::core::film::Film; use pbrt::core::geometry::Bounds2f; use pbrt::filters::boxfilter::BoxFilter; let filter = BoxFilter::new([8., 8.].into()); let diag_mm = 100.; let film = Film::new( [800, 600].into(), [[0., 0.], [1., 1.]].into(), Box::new(filter), diag_mm, "output.png".to_string(), 1., 1., ); assert_eq!( film.get_physical_extent(), Bounds2f::from([[-0.04, -0.03], [0.04, 0.03]]) ); let filter = BoxFilter::new([8., 8.].into()); let film = Film::new( [800, 600].into(), // The result of get_physical_extent doesn't change if crop_window is a subset of the Film. [[0.25, 0.25], [0.75, 0.75]].into(), Box::new(filter), diag_mm, "output.png".to_string(), 1., 1., ); assert_eq!( film.get_physical_extent(), Bounds2f::from([[-0.04, -0.03], [0.04, 0.03]]) );
pub fn get_film_tile(&self, sample_bounds: Bounds2i) -> FilmTile
[src]
Create a FilmTile
representing the subregion of this Film
denoted by sample_bounds
.
The FilmTile
should have its pixels contributed to the Film
by calling
merge_film_tile
.
Examples
use pbrt::core::film::Film; use pbrt::core::geometry::Bounds2i; use pbrt::filters::boxfilter::BoxFilter; let filter = BoxFilter::new([8., 8.].into()); let film = Film::new( [1920, 1080].into(), [[0.25, 0.25], [0.75, 0.75]].into(), Box::new(filter), 35.0, "output.png".to_string(), 1., 1., ); // Tile bigger than Film's crop area gets clipped to Film's crop area. assert_eq!( film.get_film_tile(Bounds2i::from([[0, 0], [1920, 1080]])) .get_pixel_bounds(), Bounds2i::from([[1920 / 4, 1080 / 4], [3 * 1920 / 4, 3 * 1080 / 4]]) ); // Tile smaller than Film's crop area is the given bound expanded by half the filter size. assert_eq!( film.get_film_tile(Bounds2i::from([[500, 500], [600, 600]])) .get_pixel_bounds(), Bounds2i::from([[492, 492], [608, 608]]) );
pub fn merge_film_tile(&self, tile: FilmTile)
[src]
Merge a FilmTile
into the Film
.
Examples
use pbrt::core::film::Film; use pbrt::core::film::FilmTile; use pbrt::core::film::Pixel; use pbrt::core::geometry::Bounds2i; use pbrt::core::spectrum::Spectrum; use pbrt::filters::boxfilter::BoxFilter; let filter = BoxFilter::new([8., 8.].into()); let film = Film::new( [20, 10].into(), [[0., 0.], [1., 1.]].into(), Box::new(filter), 35.0, "output.png".to_string(), 1., 1., ); let left = film.get_film_tile(Bounds2i::from([[0, 0], [10, 10]])); let right = film.get_film_tile(Bounds2i::from([[10, 0], [10, 10]])); // spawn threads and render to left and right. Then merge the results back into the film. film.merge_film_tile(left); film.merge_film_tile(right);
pub fn set_image(&self, _img: Vec<Spectrum>)
[src]
set_image allows the caller to directly set the pixel values of the entire Film
pub fn add_splat(&self, _p: &Point2f, _v: Spectrum)
[src]
add_splat adds the contributions of v
to the Film
at p
pub fn write_image(&self, splat_scale: Float)
[src]
write_image stores the contents of the Film
to the disk path specifed at construction
time.
pub fn clear(&self)
[src]
clear resets all pixel values to zero.
pub fn get_pixel_xyz(&self, p: Point2i) -> [Float; 3]
[src]
Not public in the C++ implementation, but necessary for docttest.
Auto Trait Implementations
impl !RefUnwindSafe for Film
impl !Send for Film
impl !Sync for Film
impl Unpin for Film
impl !UnwindSafe for Film
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
T: Parameter<Self>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,