use shared::Float; use shared::core::bssrdf::BSSRDFTable; pub struct BSSRDFTableData { pub rho_samples: Vec, pub radius_samples: Vec, pub profile: Vec, pub rho_eff: Vec, pub profile_cdf: Vec, } impl BSSRDFTableData { pub fn new(n_rho_samples: usize, n_radius_samples: usize) -> Self { let rho_samples: Vec = Vec::with_capacity(n_rho_samples); let radius_samples: Vec = Vec::with_capacity(n_radius_samples); let profile: Vec = Vec::with_capacity(n_radius_samples * n_rho_samples); let rho_eff: Vec = Vec::with_capacity(n_rho_samples); let profile_cdf: Vec = Vec::with_capacity(n_radius_samples * n_rho_samples); Self { rho_samples, radius_samples, profile, rho_eff, profile_cdf, } } pub fn view(&self, rho_ptr: *const Float, radius_ptr: *const Float) -> BSSRDFTable { BSSRDFTable { rho_samples: rho_ptr, n_rho: self.rho_samples.len() as u32, radius_samples: radius_ptr, n_radius: self.radius_samples.len() as u32, profile: self.profile, profile_cdf: self.profile_cdf, rho_eff: self.rho_eff, } } }