50 lines
1.3 KiB
Rust
50 lines
1.3 KiB
Rust
use crate::core::geometry::{Bounds2i, Point2i};
|
|
use crate::core::pbrt::Float;
|
|
use crate::spectra::colorspace::RGBColorSpace;
|
|
use crate::utils::math::SquareMatrix;
|
|
use smallvec::SmallVec;
|
|
use std::collections::HashMap;
|
|
|
|
use std::ops::{Deref, DerefMut};
|
|
#[derive(Debug, Clone, Default)]
|
|
pub struct ImageChannelDesc {
|
|
pub offset: Vec<usize>,
|
|
}
|
|
|
|
impl ImageChannelDesc {
|
|
pub fn new(offset: &[usize]) -> Self {
|
|
Self {
|
|
offset: offset.into(),
|
|
}
|
|
}
|
|
|
|
pub fn size(&self) -> usize {
|
|
self.offset.len()
|
|
}
|
|
|
|
pub fn is_empty(&self) -> bool {
|
|
self.offset.is_empty()
|
|
}
|
|
pub fn is_identity(&self) -> bool {
|
|
for i in 0..self.size() {
|
|
if self.offset[i] != i {
|
|
return false;
|
|
}
|
|
}
|
|
true
|
|
}
|
|
}
|
|
|
|
#[derive(Debug, Default)]
|
|
pub struct ImageMetadata {
|
|
pub render_time_seconds: Option<Float>,
|
|
pub camera_from_world: Option<SquareMatrix<Float, 4>>,
|
|
pub ndc_from_world: Option<SquareMatrix<Float, 4>>,
|
|
pub pixel_bounds: Option<Bounds2i>,
|
|
pub full_resolution: Option<Point2i>,
|
|
pub samples_per_pixel: Option<i32>,
|
|
pub mse: Option<Float>,
|
|
pub colorspace: Option<RGBColorSpace>,
|
|
pub strings: HashMap<String, String>,
|
|
pub string_vectors: HashMap<String, Vec<String>>,
|
|
}
|