Improve module path usage and remove extern crate declarations where possible.

This commit is contained in:
Nathan Vegdahl 2018-12-16 13:02:49 -08:00
parent 178c0bd6cb
commit 28a07de456
41 changed files with 283 additions and 285 deletions

View File

@ -1,19 +1,16 @@
#![allow(dead_code)]
use std;
use mem_arena::MemArena;
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 crate::{
algorithm::partition, bbox::BBox, boundable::Boundable, lerp::lerp_slice, ray::AccelRay,
timer::Timer,
};
use super::bvh_base::{BVHBase, BVHBaseNode, BVH_MAX_DEPTH};
use super::ACCEL_NODE_RAY_TESTS;
use super::ACCEL_TRAV_TIME;
use super::{
bvh_base::{BVHBase, BVHBaseNode, BVH_MAX_DEPTH},
ACCEL_NODE_RAY_TESTS, ACCEL_TRAV_TIME,
};
#[derive(Copy, Clone, Debug)]
pub struct BVH<'a> {

View File

@ -1,20 +1,17 @@
#![allow(dead_code)]
use std;
use bvh_order::{calc_traversal_code, SplitAxes, TRAVERSAL_TABLE};
use mem_arena::MemArena;
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 crate::{
algorithm::partition, bbox::BBox, boundable::Boundable, lerp::lerp_slice, ray::AccelRay,
timer::Timer,
};
use super::bvh_base::{BVHBase, BVHBaseNode, BVH_MAX_DEPTH};
use super::ACCEL_NODE_RAY_TESTS;
use super::ACCEL_TRAV_TIME;
use bvh_order::{calc_traversal_code, SplitAxes, TRAVERSAL_TABLE};
use super::{
bvh_base::{BVHBase, BVHBaseNode, BVH_MAX_DEPTH},
ACCEL_NODE_RAY_TESTS, ACCEL_TRAV_TIME,
};
#[derive(Copy, Clone, Debug)]
pub struct BVH4<'a> {

View File

@ -1,9 +1,6 @@
#![allow(dead_code)]
use crate::algorithm::merge_slices_append;
use crate::bbox::BBox;
use crate::lerp::lerp_slice;
use crate::math::log2_64;
use crate::{algorithm::merge_slices_append, bbox::BBox, lerp::lerp_slice, math::log2_64};
use super::objects_split::{median_split, sah_split};

View File

@ -1,8 +1,10 @@
use mem_arena::MemArena;
use crate::bbox::BBox;
use crate::math::{Normal, Point, Vector};
use crate::shading::surface_closure::SurfaceClosure;
use crate::{
bbox::BBox,
math::{Normal, Point, Vector},
shading::surface_closure::SurfaceClosure,
};
use super::LightAccel;

View File

@ -1,13 +1,14 @@
use mem_arena::MemArena;
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 crate::{
algorithm::merge_slices_append,
bbox::BBox,
lerp::lerp_slice,
math::{Normal, Point, Vector},
shading::surface_closure::SurfaceClosure,
};
use super::objects_split::sah_split;
use super::LightAccel;
use super::{objects_split::sah_split, LightAccel};
const ARITY_LOG2: usize = 3; // Determines how much to collapse the binary tree,
// implicitly defining the light tree's arity. 1 = no collapsing, leave as binary

View File

@ -7,13 +7,17 @@ mod objects_split;
use std::cell::Cell;
use crate::math::{Normal, Point, Vector};
use crate::shading::surface_closure::SurfaceClosure;
use crate::{
math::{Normal, Point, Vector},
shading::surface_closure::SurfaceClosure,
};
pub use self::bvh::{BVHNode, BVH};
pub use self::bvh4::{BVH4Node, BVH4};
pub use self::light_array::LightArray;
pub use self::light_tree::LightTree;
pub use self::{
bvh::{BVHNode, BVH},
bvh4::{BVH4Node, BVH4},
light_array::LightArray,
light_tree::LightTree,
};
// Track BVH traversal time
thread_local! {

View File

@ -1,15 +1,14 @@
#![allow(dead_code)]
use std;
use std::cmp::Ordering;
use halton;
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;
use crate::{
algorithm::{partition, quick_select},
bbox::BBox,
lerp::lerp_slice,
math::{dot, Vector},
sampling::uniform_sample_hemisphere,
};
const SAH_BIN_COUNT: usize = 13; // Prime numbers work best, for some reason
const SPLIT_PLANE_COUNT: usize = 5;

View File

@ -1,11 +1,11 @@
#![allow(dead_code)]
use std;
use std::cmp;
use std::cmp::Ordering;
use std::cmp::{self, Ordering};
use crate::hash::hash_u64;
use crate::lerp::{lerp_slice, Lerp};
use crate::{
hash::hash_u64,
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

View File

@ -1,12 +1,15 @@
#![allow(dead_code)]
use std;
use std::iter::Iterator;
use std::ops::{BitOr, BitOrAssign};
use std::{
iter::Iterator,
ops::{BitOr, BitOrAssign},
};
use crate::lerp::{lerp, lerp_slice, Lerp};
use crate::math::{fast_minf32, Matrix4x4, Point};
use crate::ray::AccelRay;
use crate::{
lerp::{lerp, lerp_slice, Lerp},
math::{fast_minf32, Matrix4x4, Point},
ray::AccelRay,
};
const BBOX_MAXT_ADJUST: f32 = 1.000_000_24;

View File

@ -2,10 +2,12 @@
use mem_arena::MemArena;
use crate::lerp::lerp_slice;
use crate::math::{Matrix4x4, Point, Vector};
use crate::ray::Ray;
use crate::sampling::square_to_circle;
use crate::{
lerp::lerp_slice,
math::{Matrix4x4, Point, Vector},
ray::Ray,
sampling::square_to_circle,
};
#[derive(Copy, Clone, Debug)]
pub struct Camera<'a> {

View File

@ -1,12 +1,10 @@
use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign};
pub use color::{rec709_e_to_xyz, rec709_to_xyz, xyz_to_rec709, xyz_to_rec709_e};
use float4::Float4;
use spectra_xyz::{spectrum_xyz_to_p_4, EQUAL_ENERGY_REFLECTANCE};
use crate::lerp::Lerp;
use crate::math::fast_exp;
use float4::Float4;
pub use crate::color_util::{rec709_e_to_xyz, rec709_to_xyz, xyz_to_rec709, xyz_to_rec709_e};
use crate::{lerp::Lerp, math::fast_exp};
// Minimum and maximum wavelength of light we care about, in nanometers
const WL_MIN: f32 = 380.0;

View File

@ -1,5 +1,3 @@
use std;
pub fn hash_u32(n: u32, seed: u32) -> u32 {
let mut hash = n;
for _ in 0..3 {

View File

@ -1,17 +1,17 @@
#![allow(dead_code)]
use std::cell::{RefCell, UnsafeCell};
use std::cmp;
use std::fs::File;
use std::io;
use std::io::Write;
use std::marker::PhantomData;
use std::path::Path;
use std::sync::Mutex;
use std::{
cell::{RefCell, UnsafeCell},
cmp,
fs::File,
io,
io::Write,
marker::PhantomData,
path::Path,
sync::Mutex,
};
use half::f16;
use openexr;
use png_encode_mini;
use crate::color::{xyz_to_rec709_e, XYZ};

View File

@ -1,6 +1,5 @@
#![allow(dead_code)]
use float4;
use math3d::{Matrix4x4, Normal, Point, Vector};
/// Trait for allowing a type to be linearly interpolated.

View File

@ -2,10 +2,12 @@ use std::f64::consts::PI as PI_64;
use mem_arena::MemArena;
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 crate::{
color::{Color, SpectralSample, XYZ},
lerp::lerp_slice,
math::{coordinate_system_from_vector, Vector},
sampling::{uniform_sample_cone, uniform_sample_cone_pdf},
};
use super::WorldLightSource;

View File

@ -4,13 +4,16 @@ mod sphere_light;
use std::fmt::Debug;
use crate::color::SpectralSample;
use crate::math::{Matrix4x4, Normal, Point, Vector};
use crate::surface::Surface;
use crate::{
color::SpectralSample,
math::{Matrix4x4, Normal, Point, Vector},
surface::Surface,
};
pub use self::distant_disk_light::DistantDiskLight;
pub use self::rectangle_light::RectangleLight;
pub use self::sphere_light::SphereLight;
pub use self::{
distant_disk_light::DistantDiskLight, rectangle_light::RectangleLight,
sphere_light::SphereLight,
};
/// A finite light source that can be bounded in space.
pub trait SurfaceLight: Surface {

View File

@ -1,18 +1,20 @@
use mem_arena::MemArena;
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 crate::{
bbox::BBox,
boundable::Boundable,
color::{Color, SpectralSample, XYZ},
lerp::lerp_slice,
math::{cross, dot, Matrix4x4, Normal, Point, Vector},
ray::{AccelRay, Ray},
sampling::{
spherical_triangle_solid_angle, triangle_surface_area, uniform_sample_spherical_triangle,
uniform_sample_triangle,
},
shading::surface_closure::{EmitClosure, SurfaceClosureUnion},
shading::SurfaceShader,
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;

View File

@ -2,16 +2,18 @@ use std::f64::consts::PI as PI_64;
use mem_arena::MemArena;
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 crate::{
bbox::BBox,
boundable::Boundable,
color::{Color, SpectralSample, XYZ},
lerp::lerp_slice,
math::{coordinate_system_from_vector, dot, Matrix4x4, Normal, Point, Vector},
ray::{AccelRay, Ray},
sampling::{uniform_sample_cone, uniform_sample_cone_pdf, uniform_sample_sphere},
shading::surface_closure::{EmitClosure, SurfaceClosureUnion},
shading::SurfaceShader,
surface::{Surface, SurfaceIntersection, SurfaceIntersectionData},
};
use super::SurfaceLight;

View File

@ -11,28 +11,6 @@
#![allow(clippy::needless_range_loop)]
#![allow(clippy::excessive_precision)]
extern crate bvh_order;
extern crate color as color_util;
extern crate float4;
extern crate halton;
extern crate math3d;
extern crate mem_arena;
extern crate spectra_xyz;
extern crate base64;
extern crate clap;
extern crate crossbeam;
extern crate half;
extern crate num_cpus;
extern crate openexr;
extern crate png_encode_mini;
extern crate rustc_serialize;
extern crate scoped_threadpool;
extern crate time;
#[macro_use]
extern crate nom;
#[macro_use]
extern crate lazy_static;
@ -61,24 +39,22 @@ mod timer;
mod tracer;
mod transform_stack;
use std::fs::File;
use std::io;
use std::io::Read;
use std::mem;
use std::path::Path;
use std::str::FromStr;
use std::{fs::File, io, io::Read, mem, path::Path, str::FromStr};
use clap::{App, Arg};
use nom::{error_position, take_until};
use mem_arena::MemArena;
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;
use crate::{
accel::{BVH4Node, BVHNode},
bbox::BBox,
parse::{parse_scene, DataTree},
ray::{AccelRay, Ray},
renderer::LightPath,
surface::SurfaceIntersection,
timer::Timer,
};
const VERSION: &str = env!("CARGO_PKG_VERSION");

View File

@ -3,8 +3,12 @@
use std::str;
use nom::IResult::*;
use nom::{digit, multispace, IResult, Needed};
use nom::{
call, complete, delimited, digit, do_parse, error_position, multispace, named, one_of, opt,
tag, tuple_parser,
IResult::{self, *},
Needed,
};
// Consumes any whitespace, including zero whitespace
named!(any_space<Option<&[u8]>>, opt!(complete!(multispace)));

View File

@ -1,8 +1,6 @@
#![allow(dead_code)]
use std::iter::Iterator;
use std::result::Result;
use std::slice;
use std::{iter::Iterator, result::Result, slice};
#[derive(Debug, Eq, PartialEq)]
pub enum DataTree<'a> {

View File

@ -6,5 +6,4 @@ mod psy_light;
mod psy_mesh_surface;
mod psy_surface_shader;
pub use self::data_tree::DataTree;
pub use self::psy::parse_scene;
pub use self::{data_tree::DataTree, psy::parse_scene};

View File

@ -1,24 +1,27 @@
#![allow(dead_code)]
use std::f32;
use std::result::Result;
use std::{f32, result::Result};
use nom::IResult;
use nom::{call, closure, eof, error_position, terminated, tuple, tuple_parser, IResult};
use mem_arena::MemArena;
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 crate::{
camera::Camera,
color::{rec709_e_to_xyz, XYZ},
light::WorldLightSource,
math::Matrix4x4,
renderer::Renderer,
scene::Scene,
scene::World,
};
use super::basics::{ws_f32, ws_u32};
use super::psy_assembly::parse_assembly;
use super::psy_light::parse_distant_disk_light;
use super::DataTree;
use super::{
basics::{ws_f32, ws_u32},
psy_assembly::parse_assembly,
psy_light::parse_distant_disk_light,
DataTree,
};
#[derive(Debug)]
pub enum PsyParseError {

View File

@ -6,11 +6,13 @@ use mem_arena::MemArena;
use crate::scene::{Assembly, AssemblyBuilder, Object};
use super::psy::{parse_matrix, PsyParseError};
use super::psy_light::{parse_rectangle_light, parse_sphere_light};
use super::psy_mesh_surface::parse_mesh_surface;
use super::psy_surface_shader::parse_surface_shader;
use super::DataTree;
use super::{
psy::{parse_matrix, PsyParseError},
psy_light::{parse_rectangle_light, parse_sphere_light},
psy_mesh_surface::parse_mesh_surface,
psy_surface_shader::parse_surface_shader,
DataTree,
};
pub fn parse_assembly<'a>(
arena: &'a MemArena,

View File

@ -2,17 +2,17 @@
use std::result::Result;
use nom::IResult;
use nom::{call, closure, tuple, tuple_parser, IResult};
use mem_arena::MemArena;
use crate::color::{rec709_e_to_xyz, XYZ};
use crate::light::{DistantDiskLight, RectangleLight, SphereLight};
use crate::math::Vector;
use crate::{
color::{rec709_e_to_xyz, XYZ},
light::{DistantDiskLight, RectangleLight, SphereLight},
math::Vector,
};
use super::basics::ws_f32;
use super::psy::PsyParseError;
use super::DataTree;
use super::{basics::ws_f32, psy::PsyParseError, DataTree};
pub fn parse_distant_disk_light<'a>(
arena: &'a MemArena,

View File

@ -2,16 +2,20 @@
use std::result::Result;
use nom::IResult;
use nom::{call, closure, tuple, tuple_parser, IResult};
use mem_arena::MemArena;
use crate::math::{Normal, Point};
use crate::surface::triangle_mesh::TriangleMesh;
use crate::{
math::{Normal, Point},
surface::triangle_mesh::TriangleMesh,
};
use super::basics::{ws_f32, ws_usize};
use super::psy::PsyParseError;
use super::DataTree;
use super::{
basics::{ws_f32, ws_usize},
psy::PsyParseError,
DataTree,
};
// pub struct TriangleMesh {
// time_samples: usize,

View File

@ -2,16 +2,16 @@
use std::result::Result;
use nom::IResult;
use nom::{call, closure, tuple, tuple_parser, IResult};
use mem_arena::MemArena;
use crate::color::{rec709_e_to_xyz, XYZ};
use crate::shading::{SimpleSurfaceShader, SurfaceShader};
use crate::{
color::{rec709_e_to_xyz, XYZ},
shading::{SimpleSurfaceShader, SurfaceShader},
};
use super::basics::ws_f32;
use super::psy::PsyParseError;
use super::DataTree;
use super::{basics::ws_f32, psy::PsyParseError, DataTree};
// pub struct TriangleMesh {
// time_samples: usize,

View File

@ -1,9 +1,8 @@
#![allow(dead_code)]
use std;
use float4::Float4;
use crate::math::{Matrix4x4, Point, Vector};
use float4::Float4;
const OCCLUSION_FLAG: u32 = 1;
const DONE_FLAG: u32 = 1 << 1;

View File

@ -1,32 +1,34 @@
use std;
use std::cell::Cell;
use std::cmp;
use std::cmp::min;
use std::io::{self, Write};
use std::sync::{Mutex, RwLock};
use std::{
cell::Cell,
cmp,
cmp::min,
io::{self, Write},
sync::{Mutex, RwLock},
};
use crossbeam::sync::MsQueue;
use scoped_threadpool::Pool;
use halton;
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 crate::{
accel::{ACCEL_NODE_RAY_TESTS, ACCEL_TRAV_TIME},
algorithm::partition_pair,
color::{map_0_1_to_wavelength, Color, SpectralSample, XYZ},
fp_utils::robust_ray_origin,
hash::hash_u32,
hilbert,
image::Image,
math::{fast_logit, upper_power_of_two},
mis::power_heuristic,
ray::Ray,
scene::{Scene, SceneLightSample},
surface,
timer::Timer,
tracer::Tracer,
transform_stack::TransformStack,
};
#[derive(Debug)]
pub struct Renderer<'a> {
pub output_file: String,

View File

@ -1,8 +1,6 @@
#![allow(dead_code)]
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 std::{f32::consts::FRAC_PI_4 as QPI_32, f32::consts::PI as PI_32, f64::consts::PI as PI_64};
use crate::math::{cross, dot, Point, Vector};

View File

@ -2,17 +2,19 @@ use std::collections::HashMap;
use mem_arena::MemArena;
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;
use crate::{
accel::BVH4,
accel::{LightAccel, LightTree},
bbox::{transform_bbox_slice_from, BBox},
boundable::Boundable,
color::SpectralSample,
lerp::lerp_slice,
light::SurfaceLight,
math::{Matrix4x4, Normal, Point},
shading::SurfaceShader,
surface::{Surface, SurfaceIntersection},
transform_stack::TransformStack,
};
#[derive(Copy, Clone, Debug)]
pub struct Assembly<'a> {

View File

@ -1,16 +1,20 @@
mod assembly;
mod world;
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;
use crate::{
accel::LightAccel,
algorithm::weighted_choice,
camera::Camera,
color::SpectralSample,
math::{Normal, Point, Vector},
surface::SurfaceIntersection,
transform_stack::TransformStack,
};
pub use self::assembly::{Assembly, AssemblyBuilder, InstanceType, Object};
pub use self::world::World;
pub use self::{
assembly::{Assembly, AssemblyBuilder, InstanceType, Object},
world::World,
};
#[derive(Debug)]
pub struct Scene<'a> {

View File

@ -1,5 +1,4 @@
use crate::color::XYZ;
use crate::light::WorldLightSource;
use crate::{color::XYZ, light::WorldLightSource};
#[derive(Debug)]
pub struct World<'a> {

View File

@ -2,11 +2,14 @@ pub mod surface_closure;
use std::fmt::Debug;
use crate::{
color::{Color, XYZ},
surface::SurfaceIntersectionData,
};
use self::surface_closure::{
EmitClosure, GGXClosure, GTRClosure, LambertClosure, SurfaceClosureUnion,
};
use crate::color::{Color, XYZ};
use crate::surface::SurfaceIntersectionData;
/// Trait for surface shaders.
pub trait SurfaceShader: Debug + Sync {

View File

@ -2,10 +2,12 @@
use std::f32::consts::PI as PI_32;
use crate::color::SpectralSample;
use crate::lerp::lerp;
use crate::math::{clamp, dot, zup_to_vec, Normal, Vector};
use crate::sampling::cosine_sample_hemisphere;
use crate::{
color::SpectralSample,
lerp::lerp,
math::{clamp, dot, zup_to_vec, Normal, Vector},
sampling::cosine_sample_hemisphere,
};
const INV_PI: f32 = 1.0 / PI_32;
const H_PI: f32 = PI_32 / 2.0;

View File

@ -5,11 +5,13 @@ pub mod triangle_mesh;
use std::fmt::Debug;
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;
use crate::{
boundable::Boundable,
math::{Matrix4x4, Normal, Point, Vector},
ray::{AccelRay, Ray},
shading::surface_closure::SurfaceClosureUnion,
shading::SurfaceShader,
};
pub trait Surface: Boundable + Debug + Sync {
fn intersect_rays(

View File

@ -1,8 +1,6 @@
#![allow(dead_code)]
use crate::fp_utils::fp_gamma;
use crate::math::Point;
use crate::ray::Ray;
use crate::{fp_utils::fp_gamma, math::Point, ray::Ray};
/// Intersects `ray` with `tri`, returning `Some((t, b0, b1, b2))`, or `None`
/// if no intersection.

View File

@ -1,19 +1,18 @@
#![allow(dead_code)]
use std;
use mem_arena::MemArena;
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 crate::{
accel::BVH4,
bbox::BBox,
boundable::Boundable,
lerp::lerp_slice,
math::{cross, dot, Matrix4x4, Normal, Point},
ray::{AccelRay, Ray},
shading::SurfaceShader,
};
use super::triangle;
use super::{Surface, SurfaceIntersection, SurfaceIntersectionData};
use super::{triangle, Surface, SurfaceIntersection, SurfaceIntersectionData};
#[derive(Copy, Clone, Debug)]
pub struct TriangleMesh<'a> {

View File

@ -1,9 +1,6 @@
#![allow(dead_code)]
use std::thread;
use std::time::Duration;
use time;
use std::{thread, time::Duration};
#[derive(Copy, Clone)]
pub struct Timer {

View File

@ -1,13 +1,15 @@
use std::iter;
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;
use crate::{
algorithm::partition,
color::{rec709_to_xyz, XYZ},
lerp::lerp_slice,
ray::{AccelRay, Ray},
scene::{Assembly, InstanceType, Object},
shading::{SimpleSurfaceShader, SurfaceShader},
surface::SurfaceIntersection,
transform_stack::TransformStack,
};
pub struct Tracer<'a> {
rays: Vec<AccelRay>,

View File

@ -1,7 +1,6 @@
use std::cmp;
use crate::algorithm::merge_slices_to;
use crate::math::Matrix4x4;
use crate::{algorithm::merge_slices_to, math::Matrix4x4};
pub struct TransformStack {
stack: Vec<Matrix4x4>,