First step transitioning to Rust 2018.
This commit is contained in:
parent
e3a9cbef84
commit
8deb1e87bb
|
@ -4,12 +4,12 @@ use std;
|
|||
|
||||
use mem_arena::MemArena;
|
||||
|
||||
use algorithm::partition;
|
||||
use bbox::BBox;
|
||||
use boundable::Boundable;
|
||||
use lerp::lerp_slice;
|
||||
use ray::AccelRay;
|
||||
use timer::Timer;
|
||||
use crate::algorithm::partition;
|
||||
use crate::bbox::BBox;
|
||||
use crate::boundable::Boundable;
|
||||
use crate::lerp::lerp_slice;
|
||||
use crate::ray::AccelRay;
|
||||
use crate::timer::Timer;
|
||||
|
||||
use super::bvh_base::{BVHBase, BVHBaseNode, BVH_MAX_DEPTH};
|
||||
use super::ACCEL_NODE_RAY_TESTS;
|
||||
|
|
|
@ -4,12 +4,12 @@ use std;
|
|||
|
||||
use mem_arena::MemArena;
|
||||
|
||||
use algorithm::partition;
|
||||
use bbox::BBox;
|
||||
use boundable::Boundable;
|
||||
use lerp::lerp_slice;
|
||||
use ray::AccelRay;
|
||||
use timer::Timer;
|
||||
use crate::algorithm::partition;
|
||||
use crate::bbox::BBox;
|
||||
use crate::boundable::Boundable;
|
||||
use crate::lerp::lerp_slice;
|
||||
use crate::ray::AccelRay;
|
||||
use crate::timer::Timer;
|
||||
|
||||
use super::bvh_base::{BVHBase, BVHBaseNode, BVH_MAX_DEPTH};
|
||||
use super::ACCEL_NODE_RAY_TESTS;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#![allow(dead_code)]
|
||||
|
||||
use algorithm::merge_slices_append;
|
||||
use bbox::BBox;
|
||||
use lerp::lerp_slice;
|
||||
use math::log2_64;
|
||||
use crate::algorithm::merge_slices_append;
|
||||
use crate::bbox::BBox;
|
||||
use crate::lerp::lerp_slice;
|
||||
use crate::math::log2_64;
|
||||
|
||||
use super::objects_split::{median_split, sah_split};
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use mem_arena::MemArena;
|
||||
|
||||
use bbox::BBox;
|
||||
use math::{Normal, Point, Vector};
|
||||
use shading::surface_closure::SurfaceClosure;
|
||||
use crate::bbox::BBox;
|
||||
use crate::math::{Normal, Point, Vector};
|
||||
use crate::shading::surface_closure::SurfaceClosure;
|
||||
|
||||
use super::LightAccel;
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
use mem_arena::MemArena;
|
||||
|
||||
use algorithm::merge_slices_append;
|
||||
use bbox::BBox;
|
||||
use lerp::lerp_slice;
|
||||
use math::{Normal, Point, Vector};
|
||||
use shading::surface_closure::SurfaceClosure;
|
||||
use crate::algorithm::merge_slices_append;
|
||||
use crate::bbox::BBox;
|
||||
use crate::lerp::lerp_slice;
|
||||
use crate::math::{Normal, Point, Vector};
|
||||
use crate::shading::surface_closure::SurfaceClosure;
|
||||
|
||||
use super::objects_split::sah_split;
|
||||
use super::LightAccel;
|
||||
|
|
|
@ -7,8 +7,8 @@ mod objects_split;
|
|||
|
||||
use std::cell::Cell;
|
||||
|
||||
use math::{Normal, Point, Vector};
|
||||
use shading::surface_closure::SurfaceClosure;
|
||||
use crate::math::{Normal, Point, Vector};
|
||||
use crate::shading::surface_closure::SurfaceClosure;
|
||||
|
||||
pub use self::bvh::{BVHNode, BVH};
|
||||
pub use self::bvh4::{BVH4Node, BVH4};
|
||||
|
|
|
@ -5,11 +5,11 @@ use std::cmp::Ordering;
|
|||
|
||||
use halton;
|
||||
|
||||
use algorithm::{partition, quick_select};
|
||||
use bbox::BBox;
|
||||
use lerp::lerp_slice;
|
||||
use math::{dot, Vector};
|
||||
use sampling::uniform_sample_hemisphere;
|
||||
use crate::algorithm::{partition, quick_select};
|
||||
use crate::bbox::BBox;
|
||||
use crate::lerp::lerp_slice;
|
||||
use crate::math::{dot, Vector};
|
||||
use crate::sampling::uniform_sample_hemisphere;
|
||||
|
||||
const SAH_BIN_COUNT: usize = 13; // Prime numbers work best, for some reason
|
||||
const SPLIT_PLANE_COUNT: usize = 5;
|
||||
|
|
|
@ -4,8 +4,8 @@ use std;
|
|||
use std::cmp;
|
||||
use std::cmp::Ordering;
|
||||
|
||||
use hash::hash_u64;
|
||||
use lerp::{lerp_slice, Lerp};
|
||||
use crate::hash::hash_u64;
|
||||
use crate::lerp::{lerp_slice, Lerp};
|
||||
|
||||
/// Selects an item from a slice based on a weighting function and a
|
||||
/// number (n) between 0.0 and 1.0. Returns the index of the selected
|
||||
|
|
|
@ -4,9 +4,9 @@ use std;
|
|||
use std::iter::Iterator;
|
||||
use std::ops::{BitOr, BitOrAssign};
|
||||
|
||||
use lerp::{lerp, lerp_slice, Lerp};
|
||||
use math::{fast_minf32, Matrix4x4, Point};
|
||||
use ray::AccelRay;
|
||||
use crate::lerp::{lerp, lerp_slice, Lerp};
|
||||
use crate::math::{fast_minf32, Matrix4x4, Point};
|
||||
use crate::ray::AccelRay;
|
||||
|
||||
const BBOX_MAXT_ADJUST: f32 = 1.000_000_24;
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#![allow(dead_code)]
|
||||
|
||||
use bbox::BBox;
|
||||
use crate::bbox::BBox;
|
||||
|
||||
pub trait Boundable {
|
||||
fn bounds(&self) -> &[BBox];
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
use mem_arena::MemArena;
|
||||
|
||||
use lerp::lerp_slice;
|
||||
use math::{Matrix4x4, Point, Vector};
|
||||
use ray::Ray;
|
||||
use sampling::square_to_circle;
|
||||
use crate::lerp::lerp_slice;
|
||||
use crate::math::{Matrix4x4, Point, Vector};
|
||||
use crate::ray::Ray;
|
||||
use crate::sampling::square_to_circle;
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct Camera<'a> {
|
||||
|
|
|
@ -2,11 +2,11 @@ use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign};
|
|||
|
||||
use spectra_xyz::{spectrum_xyz_to_p_4, EQUAL_ENERGY_REFLECTANCE};
|
||||
|
||||
use crate::lerp::Lerp;
|
||||
use crate::math::fast_exp;
|
||||
use float4::Float4;
|
||||
use lerp::Lerp;
|
||||
use math::fast_exp;
|
||||
|
||||
pub use color_util::{rec709_e_to_xyz, rec709_to_xyz, xyz_to_rec709, xyz_to_rec709_e};
|
||||
pub use crate::color_util::{rec709_e_to_xyz, rec709_to_xyz, xyz_to_rec709, xyz_to_rec709_e};
|
||||
|
||||
// Minimum and maximum wavelength of light we care about, in nanometers
|
||||
const WL_MIN: f32 = 380.0;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
//! This is based on the work in section 3.9 of "Physically Based Rendering:
|
||||
//! From Theory to Implementation" 3rd edition by Pharr et al.
|
||||
|
||||
use math::{dot, Normal, Point, Vector};
|
||||
use crate::math::{dot, Normal, Point, Vector};
|
||||
|
||||
#[inline(always)]
|
||||
pub fn fp_gamma(n: u32) -> f32 {
|
||||
|
|
12
src/image.rs
12
src/image.rs
|
@ -13,7 +13,7 @@ use half::f16;
|
|||
use openexr;
|
||||
use png_encode_mini;
|
||||
|
||||
use color::{xyz_to_rec709_e, XYZ};
|
||||
use crate::color::{xyz_to_rec709_e, XYZ};
|
||||
|
||||
#[derive(Debug)]
|
||||
#[allow(clippy::type_complexity)]
|
||||
|
@ -100,15 +100,15 @@ impl Image {
|
|||
let mut f = io::BufWriter::new(File::create(path)?);
|
||||
|
||||
// Write header
|
||||
try!(write!(f, "P3\n{} {}\n255\n", self.res.0, self.res.1));
|
||||
r#try!(write!(f, "P3\n{} {}\n255\n", self.res.0, self.res.1));
|
||||
|
||||
// Write pixels
|
||||
for y in 0..self.res.1 {
|
||||
for x in 0..self.res.0 {
|
||||
let (r, g, b) = quantize_tri_255(xyz_to_srgbe(self.get(x, y).to_tuple()));
|
||||
try!(write!(f, "{} {} {} ", r, g, b));
|
||||
r#try!(write!(f, "{} {} {} ", r, g, b));
|
||||
}
|
||||
try!(write!(f, "\n"));
|
||||
r#try!(write!(f, "\n"));
|
||||
}
|
||||
|
||||
// Done
|
||||
|
@ -120,14 +120,14 @@ impl Image {
|
|||
let mut f = io::BufWriter::new(File::create(path)?);
|
||||
|
||||
// Write header
|
||||
try!(write!(f, "P6\n{} {}\n255\n", self.res.0, self.res.1));
|
||||
r#try!(write!(f, "P6\n{} {}\n255\n", self.res.0, self.res.1));
|
||||
|
||||
// Write pixels
|
||||
for y in 0..self.res.1 {
|
||||
for x in 0..self.res.0 {
|
||||
let (r, g, b) = quantize_tri_255(xyz_to_srgbe(self.get(x, y).to_tuple()));
|
||||
let d = [r, g, b];
|
||||
try!(f.write_all(&d));
|
||||
r#try!(f.write_all(&d));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@ use std::f64::consts::PI as PI_64;
|
|||
|
||||
use mem_arena::MemArena;
|
||||
|
||||
use color::{Color, SpectralSample, XYZ};
|
||||
use lerp::lerp_slice;
|
||||
use math::{coordinate_system_from_vector, Vector};
|
||||
use sampling::{uniform_sample_cone, uniform_sample_cone_pdf};
|
||||
use crate::color::{Color, SpectralSample, XYZ};
|
||||
use crate::lerp::lerp_slice;
|
||||
use crate::math::{coordinate_system_from_vector, Vector};
|
||||
use crate::sampling::{uniform_sample_cone, uniform_sample_cone_pdf};
|
||||
|
||||
use super::WorldLightSource;
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ mod sphere_light;
|
|||
|
||||
use std::fmt::Debug;
|
||||
|
||||
use color::SpectralSample;
|
||||
use math::{Matrix4x4, Normal, Point, Vector};
|
||||
use surface::Surface;
|
||||
use crate::color::SpectralSample;
|
||||
use crate::math::{Matrix4x4, Normal, Point, Vector};
|
||||
use crate::surface::Surface;
|
||||
|
||||
pub use self::distant_disk_light::DistantDiskLight;
|
||||
pub use self::rectangle_light::RectangleLight;
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
use mem_arena::MemArena;
|
||||
|
||||
use bbox::BBox;
|
||||
use boundable::Boundable;
|
||||
use color::{Color, SpectralSample, XYZ};
|
||||
use lerp::lerp_slice;
|
||||
use math::{cross, dot, Matrix4x4, Normal, Point, Vector};
|
||||
use ray::{AccelRay, Ray};
|
||||
use sampling::{
|
||||
use crate::bbox::BBox;
|
||||
use crate::boundable::Boundable;
|
||||
use crate::color::{Color, SpectralSample, XYZ};
|
||||
use crate::lerp::lerp_slice;
|
||||
use crate::math::{cross, dot, Matrix4x4, Normal, Point, Vector};
|
||||
use crate::ray::{AccelRay, Ray};
|
||||
use crate::sampling::{
|
||||
spherical_triangle_solid_angle, triangle_surface_area, uniform_sample_spherical_triangle,
|
||||
uniform_sample_triangle,
|
||||
};
|
||||
use shading::surface_closure::{EmitClosure, SurfaceClosureUnion};
|
||||
use shading::SurfaceShader;
|
||||
use surface::{triangle, Surface, SurfaceIntersection, SurfaceIntersectionData};
|
||||
use crate::shading::surface_closure::{EmitClosure, SurfaceClosureUnion};
|
||||
use crate::shading::SurfaceShader;
|
||||
use crate::surface::{triangle, Surface, SurfaceIntersection, SurfaceIntersectionData};
|
||||
|
||||
use super::SurfaceLight;
|
||||
|
||||
|
|
|
@ -2,16 +2,16 @@ use std::f64::consts::PI as PI_64;
|
|||
|
||||
use mem_arena::MemArena;
|
||||
|
||||
use bbox::BBox;
|
||||
use boundable::Boundable;
|
||||
use color::{Color, SpectralSample, XYZ};
|
||||
use lerp::lerp_slice;
|
||||
use math::{coordinate_system_from_vector, dot, Matrix4x4, Normal, Point, Vector};
|
||||
use ray::{AccelRay, Ray};
|
||||
use sampling::{uniform_sample_cone, uniform_sample_cone_pdf, uniform_sample_sphere};
|
||||
use shading::surface_closure::{EmitClosure, SurfaceClosureUnion};
|
||||
use shading::SurfaceShader;
|
||||
use surface::{Surface, SurfaceIntersection, SurfaceIntersectionData};
|
||||
use crate::bbox::BBox;
|
||||
use crate::boundable::Boundable;
|
||||
use crate::color::{Color, SpectralSample, XYZ};
|
||||
use crate::lerp::lerp_slice;
|
||||
use crate::math::{coordinate_system_from_vector, dot, Matrix4x4, Normal, Point, Vector};
|
||||
use crate::ray::{AccelRay, Ray};
|
||||
use crate::sampling::{uniform_sample_cone, uniform_sample_cone_pdf, uniform_sample_sphere};
|
||||
use crate::shading::surface_closure::{EmitClosure, SurfaceClosureUnion};
|
||||
use crate::shading::SurfaceShader;
|
||||
use crate::surface::{Surface, SurfaceIntersection, SurfaceIntersectionData};
|
||||
|
||||
use super::SurfaceLight;
|
||||
|
||||
|
|
14
src/main.rs
14
src/main.rs
|
@ -72,13 +72,13 @@ use clap::{App, Arg};
|
|||
|
||||
use mem_arena::MemArena;
|
||||
|
||||
use accel::{BVH4Node, BVHNode};
|
||||
use bbox::BBox;
|
||||
use parse::{parse_scene, DataTree};
|
||||
use ray::{AccelRay, Ray};
|
||||
use renderer::LightPath;
|
||||
use surface::SurfaceIntersection;
|
||||
use timer::Timer;
|
||||
use crate::accel::{BVH4Node, BVHNode};
|
||||
use crate::bbox::BBox;
|
||||
use crate::parse::{parse_scene, DataTree};
|
||||
use crate::ray::{AccelRay, Ray};
|
||||
use crate::renderer::LightPath;
|
||||
use crate::surface::SurfaceIntersection;
|
||||
use crate::timer::Timer;
|
||||
|
||||
const VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||
|
||||
|
|
|
@ -156,7 +156,6 @@ fn take_decimal_real(i: &[u8]) -> IResult<&[u8], &[u8]> {
|
|||
mod test {
|
||||
use super::take_decimal_real;
|
||||
use super::*;
|
||||
use nom::IResult::*;
|
||||
|
||||
#[test]
|
||||
fn ws_u32_1() {
|
||||
|
|
|
@ -7,13 +7,13 @@ use nom::IResult;
|
|||
|
||||
use mem_arena::MemArena;
|
||||
|
||||
use camera::Camera;
|
||||
use color::{rec709_e_to_xyz, XYZ};
|
||||
use light::WorldLightSource;
|
||||
use math::Matrix4x4;
|
||||
use renderer::Renderer;
|
||||
use scene::Scene;
|
||||
use scene::World;
|
||||
use crate::camera::Camera;
|
||||
use crate::color::{rec709_e_to_xyz, XYZ};
|
||||
use crate::light::WorldLightSource;
|
||||
use crate::math::Matrix4x4;
|
||||
use crate::renderer::Renderer;
|
||||
use crate::scene::Scene;
|
||||
use crate::scene::World;
|
||||
|
||||
use super::basics::{ws_f32, ws_u32};
|
||||
use super::psy_assembly::parse_assembly;
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::result::Result;
|
|||
|
||||
use mem_arena::MemArena;
|
||||
|
||||
use scene::{Assembly, AssemblyBuilder, Object};
|
||||
use crate::scene::{Assembly, AssemblyBuilder, Object};
|
||||
|
||||
use super::psy::{parse_matrix, PsyParseError};
|
||||
use super::psy_light::{parse_rectangle_light, parse_sphere_light};
|
||||
|
|
|
@ -6,9 +6,9 @@ use nom::IResult;
|
|||
|
||||
use mem_arena::MemArena;
|
||||
|
||||
use color::{rec709_e_to_xyz, XYZ};
|
||||
use light::{DistantDiskLight, RectangleLight, SphereLight};
|
||||
use math::Vector;
|
||||
use crate::color::{rec709_e_to_xyz, XYZ};
|
||||
use crate::light::{DistantDiskLight, RectangleLight, SphereLight};
|
||||
use crate::math::Vector;
|
||||
|
||||
use super::basics::ws_f32;
|
||||
use super::psy::PsyParseError;
|
||||
|
|
|
@ -6,8 +6,8 @@ use nom::IResult;
|
|||
|
||||
use mem_arena::MemArena;
|
||||
|
||||
use math::{Normal, Point};
|
||||
use surface::triangle_mesh::TriangleMesh;
|
||||
use crate::math::{Normal, Point};
|
||||
use crate::surface::triangle_mesh::TriangleMesh;
|
||||
|
||||
use super::basics::{ws_f32, ws_usize};
|
||||
use super::psy::PsyParseError;
|
||||
|
|
|
@ -6,8 +6,8 @@ use nom::IResult;
|
|||
|
||||
use mem_arena::MemArena;
|
||||
|
||||
use color::{rec709_e_to_xyz, XYZ};
|
||||
use shading::{SimpleSurfaceShader, SurfaceShader};
|
||||
use crate::color::{rec709_e_to_xyz, XYZ};
|
||||
use crate::shading::{SimpleSurfaceShader, SurfaceShader};
|
||||
|
||||
use super::basics::ws_f32;
|
||||
use super::psy::PsyParseError;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
use std;
|
||||
|
||||
use crate::math::{Matrix4x4, Point, Vector};
|
||||
use float4::Float4;
|
||||
use math::{Matrix4x4, Point, Vector};
|
||||
|
||||
const OCCLUSION_FLAG: u32 = 1;
|
||||
const DONE_FLAG: u32 = 1 << 1;
|
||||
|
|
|
@ -10,22 +10,22 @@ use scoped_threadpool::Pool;
|
|||
|
||||
use halton;
|
||||
|
||||
use accel::{ACCEL_NODE_RAY_TESTS, ACCEL_TRAV_TIME};
|
||||
use algorithm::partition_pair;
|
||||
use color::{map_0_1_to_wavelength, Color, SpectralSample, XYZ};
|
||||
use crate::accel::{ACCEL_NODE_RAY_TESTS, ACCEL_TRAV_TIME};
|
||||
use crate::algorithm::partition_pair;
|
||||
use crate::color::{map_0_1_to_wavelength, Color, SpectralSample, XYZ};
|
||||
use crate::fp_utils::robust_ray_origin;
|
||||
use crate::hash::hash_u32;
|
||||
use crate::hilbert;
|
||||
use crate::image::Image;
|
||||
use crate::math::{fast_logit, upper_power_of_two};
|
||||
use crate::mis::power_heuristic;
|
||||
use crate::ray::Ray;
|
||||
use crate::scene::{Scene, SceneLightSample};
|
||||
use crate::surface;
|
||||
use crate::timer::Timer;
|
||||
use crate::tracer::Tracer;
|
||||
use crate::transform_stack::TransformStack;
|
||||
use float4::Float4;
|
||||
use fp_utils::robust_ray_origin;
|
||||
use hash::hash_u32;
|
||||
use hilbert;
|
||||
use image::Image;
|
||||
use math::{fast_logit, upper_power_of_two};
|
||||
use mis::power_heuristic;
|
||||
use ray::Ray;
|
||||
use scene::{Scene, SceneLightSample};
|
||||
use surface;
|
||||
use timer::Timer;
|
||||
use tracer::Tracer;
|
||||
use transform_stack::TransformStack;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Renderer<'a> {
|
||||
|
@ -299,7 +299,7 @@ impl<'a> Renderer<'a> {
|
|||
|
||||
// Pre-calculate base64 encoding if needed
|
||||
let base64_enc = if do_blender_output {
|
||||
use color::xyz_to_rec709_e;
|
||||
use crate::color::xyz_to_rec709_e;
|
||||
Some(img_bucket.rgba_base64(xyz_to_rec709_e))
|
||||
} else {
|
||||
None
|
||||
|
@ -445,7 +445,7 @@ impl LightPath {
|
|||
// If it's an emission closure, handle specially:
|
||||
// - Collect light from the emission.
|
||||
// - Terminate the path.
|
||||
use shading::surface_closure::SurfaceClosureUnion;
|
||||
use crate::shading::surface_closure::SurfaceClosureUnion;
|
||||
if let SurfaceClosureUnion::EmitClosure(ref clsr) = *closure {
|
||||
if let LightPathEvent::CameraRay = self.event {
|
||||
self.color += clsr.emitted_color().e;
|
||||
|
@ -657,7 +657,7 @@ impl LightPath {
|
|||
/// LDS samples aren't available.
|
||||
#[inline(always)]
|
||||
fn get_sample(dimension: u32, i: u32) -> f32 {
|
||||
use hash::hash_u32_to_f32;
|
||||
use crate::hash::hash_u32_to_f32;
|
||||
if dimension < halton::MAX_DIMENSION {
|
||||
halton::sample(dimension, i)
|
||||
} else {
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::f32::consts::FRAC_PI_4 as QPI_32;
|
|||
use std::f32::consts::PI as PI_32;
|
||||
use std::f64::consts::PI as PI_64;
|
||||
|
||||
use math::{cross, dot, Point, Vector};
|
||||
use crate::math::{cross, dot, Point, Vector};
|
||||
|
||||
/// Maps the unit square to the unit circle.
|
||||
/// NOTE: x and y should be distributed within [-1, 1],
|
||||
|
|
|
@ -2,17 +2,17 @@ use std::collections::HashMap;
|
|||
|
||||
use mem_arena::MemArena;
|
||||
|
||||
use accel::BVH4;
|
||||
use accel::{LightAccel, LightTree};
|
||||
use bbox::{transform_bbox_slice_from, BBox};
|
||||
use boundable::Boundable;
|
||||
use color::SpectralSample;
|
||||
use lerp::lerp_slice;
|
||||
use light::SurfaceLight;
|
||||
use math::{Matrix4x4, Normal, Point};
|
||||
use shading::SurfaceShader;
|
||||
use surface::{Surface, SurfaceIntersection};
|
||||
use transform_stack::TransformStack;
|
||||
use crate::accel::BVH4;
|
||||
use crate::accel::{LightAccel, LightTree};
|
||||
use crate::bbox::{transform_bbox_slice_from, BBox};
|
||||
use crate::boundable::Boundable;
|
||||
use crate::color::SpectralSample;
|
||||
use crate::lerp::lerp_slice;
|
||||
use crate::light::SurfaceLight;
|
||||
use crate::math::{Matrix4x4, Normal, Point};
|
||||
use crate::shading::SurfaceShader;
|
||||
use crate::surface::{Surface, SurfaceIntersection};
|
||||
use crate::transform_stack::TransformStack;
|
||||
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct Assembly<'a> {
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
mod assembly;
|
||||
mod world;
|
||||
|
||||
use accel::LightAccel;
|
||||
use algorithm::weighted_choice;
|
||||
use camera::Camera;
|
||||
use color::SpectralSample;
|
||||
use math::{Normal, Point, Vector};
|
||||
use surface::SurfaceIntersection;
|
||||
use transform_stack::TransformStack;
|
||||
use crate::accel::LightAccel;
|
||||
use crate::algorithm::weighted_choice;
|
||||
use crate::camera::Camera;
|
||||
use crate::color::SpectralSample;
|
||||
use crate::math::{Normal, Point, Vector};
|
||||
use crate::surface::SurfaceIntersection;
|
||||
use crate::transform_stack::TransformStack;
|
||||
|
||||
pub use self::assembly::{Assembly, AssemblyBuilder, InstanceType, Object};
|
||||
pub use self::world::World;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use color::XYZ;
|
||||
use light::WorldLightSource;
|
||||
use crate::color::XYZ;
|
||||
use crate::light::WorldLightSource;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct World<'a> {
|
||||
|
|
|
@ -5,8 +5,8 @@ use std::fmt::Debug;
|
|||
use self::surface_closure::{
|
||||
EmitClosure, GGXClosure, GTRClosure, LambertClosure, SurfaceClosureUnion,
|
||||
};
|
||||
use color::{Color, XYZ};
|
||||
use surface::SurfaceIntersectionData;
|
||||
use crate::color::{Color, XYZ};
|
||||
use crate::surface::SurfaceIntersectionData;
|
||||
|
||||
/// Trait for surface shaders.
|
||||
pub trait SurfaceShader: Debug + Sync {
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
use std::f32::consts::PI as PI_32;
|
||||
|
||||
use color::SpectralSample;
|
||||
use lerp::lerp;
|
||||
use math::{clamp, dot, zup_to_vec, Normal, Vector};
|
||||
use sampling::cosine_sample_hemisphere;
|
||||
use crate::color::SpectralSample;
|
||||
use crate::lerp::lerp;
|
||||
use crate::math::{clamp, dot, zup_to_vec, Normal, Vector};
|
||||
use crate::sampling::cosine_sample_hemisphere;
|
||||
|
||||
const INV_PI: f32 = 1.0 / PI_32;
|
||||
const H_PI: f32 = PI_32 / 2.0;
|
||||
|
|
|
@ -5,11 +5,11 @@ pub mod triangle_mesh;
|
|||
|
||||
use std::fmt::Debug;
|
||||
|
||||
use boundable::Boundable;
|
||||
use math::{Matrix4x4, Normal, Point, Vector};
|
||||
use ray::{AccelRay, Ray};
|
||||
use shading::surface_closure::SurfaceClosureUnion;
|
||||
use shading::SurfaceShader;
|
||||
use crate::boundable::Boundable;
|
||||
use crate::math::{Matrix4x4, Normal, Point, Vector};
|
||||
use crate::ray::{AccelRay, Ray};
|
||||
use crate::shading::surface_closure::SurfaceClosureUnion;
|
||||
use crate::shading::SurfaceShader;
|
||||
|
||||
pub trait Surface: Boundable + Debug + Sync {
|
||||
fn intersect_rays(
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#![allow(dead_code)]
|
||||
|
||||
use fp_utils::fp_gamma;
|
||||
use math::Point;
|
||||
use ray::Ray;
|
||||
use crate::fp_utils::fp_gamma;
|
||||
use crate::math::Point;
|
||||
use crate::ray::Ray;
|
||||
|
||||
/// Intersects `ray` with `tri`, returning `Some((t, b0, b1, b2))`, or `None`
|
||||
/// if no intersection.
|
||||
|
|
|
@ -4,13 +4,13 @@ use std;
|
|||
|
||||
use mem_arena::MemArena;
|
||||
|
||||
use accel::BVH4;
|
||||
use bbox::BBox;
|
||||
use boundable::Boundable;
|
||||
use lerp::lerp_slice;
|
||||
use math::{cross, dot, Matrix4x4, Normal, Point};
|
||||
use ray::{AccelRay, Ray};
|
||||
use shading::SurfaceShader;
|
||||
use crate::accel::BVH4;
|
||||
use crate::bbox::BBox;
|
||||
use crate::boundable::Boundable;
|
||||
use crate::lerp::lerp_slice;
|
||||
use crate::math::{cross, dot, Matrix4x4, Normal, Point};
|
||||
use crate::ray::{AccelRay, Ray};
|
||||
use crate::shading::SurfaceShader;
|
||||
|
||||
use super::triangle;
|
||||
use super::{Surface, SurfaceIntersection, SurfaceIntersectionData};
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
use std::iter;
|
||||
|
||||
use algorithm::partition;
|
||||
use color::{rec709_to_xyz, XYZ};
|
||||
use lerp::lerp_slice;
|
||||
use ray::{AccelRay, Ray};
|
||||
use scene::{Assembly, InstanceType, Object};
|
||||
use shading::{SimpleSurfaceShader, SurfaceShader};
|
||||
use surface::SurfaceIntersection;
|
||||
use transform_stack::TransformStack;
|
||||
use crate::algorithm::partition;
|
||||
use crate::color::{rec709_to_xyz, XYZ};
|
||||
use crate::lerp::lerp_slice;
|
||||
use crate::ray::{AccelRay, Ray};
|
||||
use crate::scene::{Assembly, InstanceType, Object};
|
||||
use crate::shading::{SimpleSurfaceShader, SurfaceShader};
|
||||
use crate::surface::SurfaceIntersection;
|
||||
use crate::transform_stack::TransformStack;
|
||||
|
||||
pub struct Tracer<'a> {
|
||||
rays: Vec<AccelRay>,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use std::cmp;
|
||||
|
||||
use algorithm::merge_slices_to;
|
||||
use math::Matrix4x4;
|
||||
use crate::algorithm::merge_slices_to;
|
||||
use crate::math::Matrix4x4;
|
||||
|
||||
pub struct TransformStack {
|
||||
stack: Vec<Matrix4x4>,
|
||||
|
|
|
@ -1204,7 +1204,7 @@ mod fallback {
|
|||
//===========================================================================
|
||||
|
||||
#[cfg(all(target_arch = "x86_64", target_feature = "sse"))]
|
||||
pub use x86_64_sse::{invert, transpose, v_max, v_min, Bool4, Float4};
|
||||
pub use crate::x86_64_sse::{invert, transpose, v_max, v_min, Bool4, Float4};
|
||||
|
||||
#[cfg(not(all(target_arch = "x86_64", target_feature = "sse")))]
|
||||
pub use fallback::{invert, transpose, v_max, v_min, Bool4, Float4};
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
mod matrices;
|
||||
|
||||
pub use matrices::NUM_DIMENSIONS;
|
||||
use matrices::{MATRICES, SIZE};
|
||||
pub use crate::matrices::NUM_DIMENSIONS;
|
||||
use crate::matrices::{MATRICES, SIZE};
|
||||
|
||||
/// Compute one component of the Sobol'-sequence, where the component
|
||||
/// corresponds to the dimension parameter, and the index specifies
|
||||
|
|
|
@ -11,9 +11,11 @@ use std::f32;
|
|||
|
||||
mod spectra_tables;
|
||||
|
||||
pub use spectra_tables::{EQUAL_ENERGY_REFLECTANCE, SPECTRUM_SAMPLE_MAX, SPECTRUM_SAMPLE_MIN};
|
||||
pub use crate::spectra_tables::{
|
||||
EQUAL_ENERGY_REFLECTANCE, SPECTRUM_SAMPLE_MAX, SPECTRUM_SAMPLE_MIN,
|
||||
};
|
||||
|
||||
use spectra_tables::{
|
||||
use crate::spectra_tables::{
|
||||
SPECTRUM_DATA_POINTS,
|
||||
// CMF_X,
|
||||
// CMF_Y,
|
||||
|
|
Loading…
Reference in New Issue
Block a user