cargo fmt.

This commit is contained in:
Bill Thiede 2022-07-28 21:39:00 -07:00
parent 51185e9e84
commit 78f7ca8956
41 changed files with 329 additions and 406 deletions

View File

@ -1,15 +1,6 @@
use std::fmt;
use std::time::SystemTime;
use std::{fmt, time::SystemTime};
use actix_web::http;
use actix_web::middleware;
use actix_web::server;
use actix_web::App;
use actix_web::HttpRequest;
use actix_web::HttpResponse;
use actix_web::Path;
use actix_web::Query;
use actix_web::Result;
use actix_web::{http, middleware, server, App, HttpRequest, HttpResponse, Path, Query, Result};
use askama::Template;
use log::info;
use rand::SeedableRng;
@ -17,13 +8,12 @@ use rand_xorshift::XorShiftRng;
use serde_derive::Deserialize;
use structopt::StructOpt;
use renderer::noise;
use renderer::noise::lode::Lode;
use renderer::noise::perlin::Perlin;
use renderer::noise::NoiseType;
use renderer::texture::NoiseTexture;
use renderer::texture::Texture;
use renderer::vec3::Vec3;
use renderer::{
noise,
noise::{lode::Lode, perlin::Perlin, NoiseType},
texture::{NoiseTexture, Texture},
vec3::Vec3,
};
#[derive(StructOpt)]
#[structopt(name = "noise_explorer", about = "CLI for exploring Perlin noise")]
@ -453,16 +443,9 @@ fn main() -> Result<(), std::io::Error> {
mod tests {
use std::str;
use actix_web::http::Method;
use actix_web::test::TestServer;
use actix_web::HttpMessage;
use actix_web::Path;
use actix_web::Query;
use actix_web::{http::Method, test::TestServer, HttpMessage, Path, Query};
use super::NoiseParamsMarble;
use super::NoiseParamsScale;
use super::NoiseParamsTurbulence;
use super::OptionalParams;
use super::{NoiseParamsMarble, NoiseParamsScale, NoiseParamsTurbulence, OptionalParams};
#[test]
fn noise_param_from_req() {

View File

@ -1,15 +1,12 @@
#[macro_use]
extern crate criterion;
use criterion::Criterion;
use criterion::ParameterizedBenchmark;
use criterion::{Criterion, ParameterizedBenchmark};
use rtiow::hitable::Hit;
use rtiow::material::Lambertian;
use rtiow::ray::Ray;
use rtiow::sphere::Sphere;
use rtiow::texture::ConstantTexture;
use rtiow::vec3::Vec3;
use rtiow::{
hitable::Hit, material::Lambertian, ray::Ray, sphere::Sphere, texture::ConstantTexture,
vec3::Vec3,
};
fn criterion_benchmark(c: &mut Criterion) {
let sphere = Sphere::new(

View File

@ -1,7 +1,6 @@
use std::fmt;
use crate::ray::Ray;
use crate::vec3::Vec3;
use crate::{ray::Ray, vec3::Vec3};
#[derive(Debug, Clone, PartialEq)]
pub struct AABB {

View File

@ -1,16 +1,13 @@
use std;
use std::fmt;
use std::time::Instant;
use std::{self, fmt, time::Instant};
use log::info;
use rand;
use rand::Rng;
use rand::{self, Rng};
use crate::aabb::surrounding_box;
use crate::aabb::AABB;
use crate::hitable::Hit;
use crate::hitable::HitRecord;
use crate::ray::Ray;
use crate::{
aabb::{surrounding_box, AABB},
hitable::{Hit, HitRecord},
ray::Ray,
};
enum BVHNode {
Leaf(Box<dyn Hit>),
@ -232,12 +229,13 @@ impl Hit for BVH {
#[cfg(test)]
mod tests {
use crate::aabb::AABB;
use crate::material::Lambertian;
use crate::material::Metal;
use crate::sphere::Sphere;
use crate::texture::ConstantTexture;
use crate::vec3::Vec3;
use crate::{
aabb::AABB,
material::{Lambertian, Metal},
sphere::Sphere,
texture::ConstantTexture,
vec3::Vec3,
};
use super::*;

View File

@ -1,11 +1,11 @@
use std::f32::consts::PI;
use rand;
use rand::Rng;
use rand::{self, Rng};
use crate::ray::Ray;
use crate::vec3::cross;
use crate::vec3::Vec3;
use crate::{
ray::Ray,
vec3::{cross, Vec3},
};
fn random_in_unit_disk() -> Vec3 {
let mut rng = rand::thread_rng();

View File

@ -1,15 +1,15 @@
use std;
use rand;
use rand::Rng;
use rand::{self, Rng};
use crate::aabb::AABB;
use crate::hitable::Hit;
use crate::hitable::HitRecord;
use crate::material::Isotropic;
use crate::ray::Ray;
use crate::texture::Texture;
use crate::vec3::Vec3;
use crate::{
aabb::AABB,
hitable::{Hit, HitRecord},
material::Isotropic,
ray::Ray,
texture::Texture,
vec3::Vec3,
};
pub struct ConstantMedium<H, T>
where

View File

@ -1,16 +1,15 @@
use std::sync::Arc;
use crate::aabb::AABB;
use crate::flip_normals::FlipNormals;
use crate::hitable::Hit;
use crate::hitable::HitRecord;
use crate::hitable_list::HitableList;
use crate::material::Material;
use crate::ray::Ray;
use crate::rect::XYRect;
use crate::rect::XZRect;
use crate::rect::YZRect;
use crate::vec3::Vec3;
use crate::{
aabb::AABB,
flip_normals::FlipNormals,
hitable::{Hit, HitRecord},
hitable_list::HitableList,
material::Material,
ray::Ray,
rect::{XYRect, XZRect, YZRect},
vec3::Vec3,
};
pub struct Cuboid {
p_min: Vec3,

View File

@ -1,7 +1,8 @@
use crate::aabb::AABB;
use crate::hitable::Hit;
use crate::hitable::HitRecord;
use crate::ray::Ray;
use crate::{
aabb::AABB,
hitable::{Hit, HitRecord},
ray::Ray,
};
pub struct FlipNormals<H>
where

View File

@ -1,9 +1,6 @@
use std::sync::Arc;
use crate::aabb::AABB;
use crate::material::Material;
use crate::ray::Ray;
use crate::vec3::Vec3;
use crate::{aabb::AABB, material::Material, ray::Ray, vec3::Vec3};
pub struct HitRecord<'m> {
pub t: f32,

View File

@ -1,11 +1,11 @@
use std;
use crate::aabb::surrounding_box;
use crate::aabb::AABB;
use crate::hitable::Hit;
use crate::hitable::HitRecord;
use crate::ray::Ray;
use crate::vec3::Vec3;
use crate::{
aabb::{surrounding_box, AABB},
hitable::{Hit, HitRecord},
ray::Ray,
vec3::Vec3,
};
#[derive(Default)]
pub struct HitableList {

View File

@ -2,11 +2,11 @@ use std::fmt;
use log::info;
use crate::aabb::surrounding_box;
use crate::aabb::AABB;
use crate::hitable::Hit;
use crate::hitable::HitRecord;
use crate::ray::Ray;
use crate::{
aabb::{surrounding_box, AABB},
hitable::{Hit, HitRecord},
ray::Ray,
};
pub enum KDTree {
Leaf(Box<dyn Hit>),

View File

@ -1,13 +1,13 @@
use std::sync::Arc;
use rand;
use rand::Rng;
use rand::{self, Rng};
use crate::hitable::HitRecord;
use crate::ray::Ray;
use crate::texture::Texture;
use crate::vec3::dot;
use crate::vec3::Vec3;
use crate::{
hitable::HitRecord,
ray::Ray,
texture::Texture,
vec3::{dot, Vec3},
};
fn random_in_unit_sphere() -> Vec3 {
let mut rng = rand::thread_rng();

View File

@ -1,12 +1,11 @@
use crate::aabb::surrounding_box;
use crate::aabb::AABB;
use crate::hitable::Hit;
use crate::hitable::HitRecord;
use crate::material::Material;
use crate::ray::Ray;
use crate::sphere::get_sphere_uv;
use crate::vec3::dot;
use crate::vec3::Vec3;
use crate::{
aabb::{surrounding_box, AABB},
hitable::{Hit, HitRecord},
material::Material,
ray::Ray,
sphere::get_sphere_uv,
vec3::{dot, Vec3},
};
pub struct MovingSphere<M>
where

View File

@ -2,8 +2,7 @@ use log::trace;
/// Implements the concepts from https://lodev.org/cgtutor/randomnoise.html
use rand;
use crate::noise::NoiseSource;
use crate::vec3::Vec3;
use crate::{noise::NoiseSource, vec3::Vec3};
const NOISE_SIZE: usize = 128;
pub struct Lode {

View File

@ -1,12 +1,12 @@
// There are many math functions in this file, so we allow single letter variable names.
#![allow(clippy::many_single_char_names)]
use log::trace;
use rand::seq::SliceRandom;
use rand::Rng;
use rand::{seq::SliceRandom, Rng};
use crate::noise::NoiseSource;
use crate::vec3::dot;
use crate::vec3::Vec3;
use crate::{
noise::NoiseSource,
vec3::{dot, Vec3},
};
pub struct Perlin {
ran_vec: Vec<Vec3>,

View File

@ -1,10 +1,11 @@
use std::collections::HashMap;
use std::fs::File;
use std::io::BufWriter;
use std::path::Path;
use std::sync::Arc;
use std::sync::Mutex;
use std::time;
use std::{
collections::HashMap,
fs::File,
io::BufWriter,
path::Path,
sync::{Arc, Mutex},
time,
};
use chrono::Local;
use image;
@ -12,8 +13,7 @@ use lazy_static::lazy_static;
use log::info;
use serde_derive::Serialize;
use crate::renderer::Scene;
use crate::vec3::Vec3;
use crate::{renderer::Scene, vec3::Vec3};
// Main RGB image output from rendering the scene.
pub const MAIN_IMAGE: &str = "@final";

View File

@ -1,11 +1,12 @@
// There are many math functions in this file, so we allow single letter variable names.
#![allow(clippy::many_single_char_names)]
use crate::aabb::AABB;
use crate::hitable::Hit;
use crate::hitable::HitRecord;
use crate::material::Material;
use crate::ray::Ray;
use crate::vec3::Vec3;
use crate::{
aabb::AABB,
hitable::{Hit, HitRecord},
material::Material,
ray::Ray,
vec3::Vec3,
};
pub struct XYRect<M>
where

View File

@ -1,38 +1,34 @@
use std::fmt;
use std::ops::AddAssign;
use std::ops::Range;
use std::path::Path;
use std::path::PathBuf;
use std::str;
use std::sync;
use std::sync::mpsc::sync_channel;
use std::sync::mpsc::Receiver;
use std::sync::mpsc::SyncSender;
use std::sync::Arc;
use std::sync::Mutex;
use std::thread;
use std::time;
use std::{
fmt,
ops::{AddAssign, Range},
path::{Path, PathBuf},
str, sync,
sync::{
mpsc::{sync_channel, Receiver, SyncSender},
Arc, Mutex,
},
thread, time,
};
use core_affinity;
use log::info;
use log::trace;
use log::{info, trace};
use num_cpus;
use rand;
use rand::Rng;
use rand::{self, Rng};
use serde_derive::Serialize;
use structopt::StructOpt;
use crate::camera::Camera;
use crate::hitable::Hit;
use crate::human;
use crate::material::Lambertian;
use crate::output;
use crate::ray::Ray;
use crate::scenes;
use crate::sphere::Sphere;
use crate::texture::ConstantTexture;
use crate::texture::EnvMap;
use crate::vec3::Vec3;
use crate::{
camera::Camera,
hitable::Hit,
human,
material::Lambertian,
output,
ray::Ray,
scenes,
sphere::Sphere,
texture::{ConstantTexture, EnvMap},
vec3::Vec3,
};
#[derive(Debug)]
pub enum Model {

View File

@ -1,12 +1,11 @@
use std::f32::consts::PI;
use std::f32::MAX;
use std::f32::MIN;
use std::f32::{consts::PI, MAX, MIN};
use crate::aabb::AABB;
use crate::hitable::Hit;
use crate::hitable::HitRecord;
use crate::ray::Ray;
use crate::vec3::Vec3;
use crate::{
aabb::AABB,
hitable::{Hit, HitRecord},
ray::Ray,
vec3::Vec3,
};
pub struct RotateY<H>
where

View File

@ -1,18 +1,18 @@
use log::trace;
use rand;
use rand::Rng;
use rand::{self, Rng};
use crate::bvh::BVH;
use crate::camera::Camera;
use crate::hitable::Hit;
use crate::hitable_list::HitableList;
use crate::kdtree::KDTree;
use crate::material::Lambertian;
use crate::renderer::Opt;
use crate::renderer::Scene;
use crate::sphere::Sphere;
use crate::texture::ConstantTexture;
use crate::vec3::Vec3;
use crate::{
bvh::BVH,
camera::Camera,
hitable::Hit,
hitable_list::HitableList,
kdtree::KDTree,
material::Lambertian,
renderer::{Opt, Scene},
sphere::Sphere,
texture::ConstantTexture,
vec3::Vec3,
};
pub fn new(opt: &Opt) -> Scene {
let lookfrom = Vec3::new(20., 20., 20.);

View File

@ -1,21 +1,16 @@
use rand;
use rand::Rng;
use rand::{self, Rng};
use crate::camera::Camera;
use crate::hitable::Hit;
use crate::hitable_list::HitableList;
use crate::kdtree::KDTree;
use crate::material::Dielectric;
use crate::material::Lambertian;
use crate::material::Material;
use crate::material::Metal;
use crate::renderer::Opt;
use crate::renderer::Scene;
use crate::sphere::Sphere;
use crate::texture::CheckerTexture;
use crate::texture::ConstantTexture;
use crate::texture::EnvMap;
use crate::vec3::Vec3;
use crate::{
camera::Camera,
hitable::Hit,
hitable_list::HitableList,
kdtree::KDTree,
material::{Dielectric, Lambertian, Material, Metal},
renderer::{Opt, Scene},
sphere::Sphere,
texture::{CheckerTexture, ConstantTexture, EnvMap},
vec3::Vec3,
};
pub fn new(opt: &Opt) -> Scene {
let lookfrom = Vec3::new(13., 2., 3.);

View File

@ -1,16 +1,16 @@
use log::trace;
use crate::bvh::BVH;
use crate::camera::Camera;
use crate::hitable::Hit;
use crate::material::Lambertian;
use crate::material::Metal;
use crate::moving_sphere::MovingSphere;
use crate::renderer::Opt;
use crate::renderer::Scene;
use crate::sphere::Sphere;
use crate::texture::ConstantTexture;
use crate::vec3::Vec3;
use crate::{
bvh::BVH,
camera::Camera,
hitable::Hit,
material::{Lambertian, Metal},
moving_sphere::MovingSphere,
renderer::{Opt, Scene},
sphere::Sphere,
texture::ConstantTexture,
vec3::Vec3,
};
pub fn new(opt: &Opt) -> Scene {
let lookfrom = Vec3::new(3., 3., 2.);

View File

@ -1,22 +1,20 @@
use std::sync::Arc;
use crate::camera::Camera;
use crate::cuboid::Cuboid;
use crate::flip_normals::FlipNormals;
use crate::hitable::Hit;
use crate::hitable_list::HitableList;
use crate::kdtree::KDTree;
use crate::material::DiffuseLight;
use crate::material::Lambertian;
use crate::rect::XYRect;
use crate::rect::XZRect;
use crate::rect::YZRect;
use crate::renderer::Opt;
use crate::renderer::Scene;
use crate::rotate::RotateY;
use crate::texture::ConstantTexture;
use crate::translate::Translate;
use crate::vec3::Vec3;
use crate::{
camera::Camera,
cuboid::Cuboid,
flip_normals::FlipNormals,
hitable::Hit,
hitable_list::HitableList,
kdtree::KDTree,
material::{DiffuseLight, Lambertian},
rect::{XYRect, XZRect, YZRect},
renderer::{Opt, Scene},
rotate::RotateY,
texture::ConstantTexture,
translate::Translate,
vec3::Vec3,
};
pub fn new(opt: &Opt) -> Scene {
let lookfrom = Vec3::new(278., 278., -800.);

View File

@ -1,24 +1,21 @@
use std::sync::Arc;
use crate::camera::Camera;
use crate::constant_medium::ConstantMedium;
use crate::cuboid::Cuboid;
use crate::flip_normals::FlipNormals;
use crate::hitable::Hit;
use crate::hitable_list::HitableList;
use crate::kdtree::KDTree;
use crate::material::DiffuseLight;
use crate::material::Lambertian;
use crate::material::Material;
use crate::rect::XYRect;
use crate::rect::XZRect;
use crate::rect::YZRect;
use crate::renderer::Opt;
use crate::renderer::Scene;
use crate::rotate::RotateY;
use crate::texture::ConstantTexture;
use crate::translate::Translate;
use crate::vec3::Vec3;
use crate::{
camera::Camera,
constant_medium::ConstantMedium,
cuboid::Cuboid,
flip_normals::FlipNormals,
hitable::Hit,
hitable_list::HitableList,
kdtree::KDTree,
material::{DiffuseLight, Lambertian, Material},
rect::{XYRect, XZRect, YZRect},
renderer::{Opt, Scene},
rotate::RotateY,
texture::ConstantTexture,
translate::Translate,
vec3::Vec3,
};
pub fn new(opt: &Opt) -> Scene {
let lookfrom = Vec3::new(278., 278., -800.);

View File

@ -1,33 +1,26 @@
use std::sync::Arc;
use image;
use rand;
use rand::Rng;
use rand::{self, Rng};
use crate::camera::Camera;
use crate::constant_medium::ConstantMedium;
use crate::cuboid::Cuboid;
use crate::hitable::Hit;
use crate::hitable_list::HitableList;
use crate::kdtree::KDTree;
use crate::material::Dielectric;
use crate::material::DiffuseLight;
use crate::material::Lambertian;
use crate::material::Material;
use crate::material::Metal;
use crate::moving_sphere::MovingSphere;
use crate::noise::perlin::Perlin;
use crate::noise::NoiseType;
use crate::rect::XZRect;
use crate::renderer::Opt;
use crate::renderer::Scene;
use crate::rotate::RotateY;
use crate::sphere::Sphere;
use crate::texture::ConstantTexture;
use crate::texture::ImageTexture;
use crate::texture::NoiseTexture;
use crate::translate::Translate;
use crate::vec3::Vec3;
use crate::{
camera::Camera,
constant_medium::ConstantMedium,
cuboid::Cuboid,
hitable::Hit,
hitable_list::HitableList,
kdtree::KDTree,
material::{Dielectric, DiffuseLight, Lambertian, Material, Metal},
moving_sphere::MovingSphere,
noise::{perlin::Perlin, NoiseType},
rect::XZRect,
renderer::{Opt, Scene},
rotate::RotateY,
sphere::Sphere,
texture::{ConstantTexture, ImageTexture, NoiseTexture},
translate::Translate,
vec3::Vec3,
};
pub fn new(opt: &Opt) -> Scene {
let lookfrom = Vec3::new(478., 278., -600.);

View File

@ -1,24 +1,18 @@
use rand;
use crate::camera::Camera;
use crate::hitable::Hit;
use crate::hitable_list::HitableList;
use crate::kdtree::KDTree;
use crate::material::DiffuseLight;
use crate::material::Lambertian;
use crate::noise::perlin::Perlin;
use crate::noise::NoiseType;
use crate::rect::XYRect;
use crate::rect::XZRect;
use crate::rect::YZRect;
use crate::renderer::Opt;
use crate::renderer::Scene;
use crate::sphere::Sphere;
use crate::texture::ConstantTexture;
use crate::texture::ImageTexture;
use crate::texture::Mandelbrot;
use crate::texture::NoiseTexture;
use crate::vec3::Vec3;
use crate::{
camera::Camera,
hitable::Hit,
hitable_list::HitableList,
kdtree::KDTree,
material::{DiffuseLight, Lambertian},
noise::{perlin::Perlin, NoiseType},
rect::{XYRect, XZRect, YZRect},
renderer::{Opt, Scene},
sphere::Sphere,
texture::{ConstantTexture, ImageTexture, Mandelbrot, NoiseTexture},
vec3::Vec3,
};
pub fn new(opt: &Opt) -> Scene {
let lookfrom = Vec3::new(20., 20., 20.);

View File

@ -2,19 +2,18 @@ use std::sync::Arc;
use rand;
use crate::camera::Camera;
use crate::hitable::Hit;
use crate::hitable_list::HitableList;
use crate::kdtree::KDTree;
use crate::material::Lambertian;
use crate::noise::perlin::Perlin;
use crate::noise::NoiseType;
use crate::renderer::Opt;
use crate::renderer::Scene;
use crate::sphere::Sphere;
use crate::texture::NoiseTexture;
use crate::texture::Texture;
use crate::vec3::Vec3;
use crate::{
camera::Camera,
hitable::Hit,
hitable_list::HitableList,
kdtree::KDTree,
material::Lambertian,
noise::{perlin::Perlin, NoiseType},
renderer::{Opt, Scene},
sphere::Sphere,
texture::{NoiseTexture, Texture},
vec3::Vec3,
};
pub fn new(opt: &Opt) -> Scene {
let lookfrom = Vec3::new(13., 2., 3.);

View File

@ -1,18 +1,15 @@
use crate::camera::Camera;
use crate::hitable::Hit;
use crate::hitable_list::HitableList;
use crate::material::Dielectric;
use crate::material::Lambertian;
use crate::material::Metal;
use crate::moving_sphere::MovingSphere;
use crate::rect::XYRect;
use crate::renderer::Opt;
use crate::renderer::Scene;
use crate::sphere::Sphere;
use crate::texture::CheckerTexture;
use crate::texture::ConstantTexture;
use crate::texture::EnvMap;
use crate::vec3::Vec3;
use crate::{
camera::Camera,
hitable::Hit,
hitable_list::HitableList,
material::{Dielectric, Lambertian, Metal},
moving_sphere::MovingSphere,
rect::XYRect,
renderer::{Opt, Scene},
sphere::Sphere,
texture::{CheckerTexture, ConstantTexture, EnvMap},
vec3::Vec3,
};
// Draws many spheres along each positive axis.
// Blue X-positive

View File

@ -1,24 +1,19 @@
use image;
use rand;
use crate::camera::Camera;
use crate::hitable::Hit;
use crate::hitable_list::HitableList;
use crate::kdtree::KDTree;
use crate::material::DiffuseLight;
use crate::material::Lambertian;
use crate::noise::perlin::Perlin;
use crate::noise::NoiseType;
use crate::rect::XYRect;
use crate::rect::XZRect;
use crate::rect::YZRect;
use crate::renderer::Opt;
use crate::renderer::Scene;
use crate::sphere::Sphere;
use crate::texture::ConstantTexture;
use crate::texture::ImageTexture;
use crate::texture::NoiseTexture;
use crate::vec3::Vec3;
use crate::{
camera::Camera,
hitable::Hit,
hitable_list::HitableList,
kdtree::KDTree,
material::{DiffuseLight, Lambertian},
noise::{perlin::Perlin, NoiseType},
rect::{XYRect, XZRect, YZRect},
renderer::{Opt, Scene},
sphere::Sphere,
texture::{ConstantTexture, ImageTexture, NoiseTexture},
vec3::Vec3,
};
pub fn new(opt: &Opt) -> Scene {
let lookfrom = Vec3::new(20., 20., 20.);

View File

@ -1,18 +1,15 @@
use crate::camera::Camera;
use crate::hitable::Hit;
use crate::hitable_list::HitableList;
use crate::kdtree::KDTree;
use crate::material::Dielectric;
use crate::material::Lambertian;
use crate::material::Metal;
use crate::moving_sphere::MovingSphere;
use crate::renderer::Opt;
use crate::renderer::Scene;
use crate::sphere::Sphere;
use crate::texture::CheckerTexture;
use crate::texture::ConstantTexture;
use crate::texture::Texture;
use crate::vec3::Vec3;
use crate::{
camera::Camera,
hitable::Hit,
hitable_list::HitableList,
kdtree::KDTree,
material::{Dielectric, Lambertian, Metal},
moving_sphere::MovingSphere,
renderer::{Opt, Scene},
sphere::Sphere,
texture::{CheckerTexture, ConstantTexture, Texture},
vec3::Vec3,
};
pub fn new(opt: &Opt) -> Scene {
let lookfrom = Vec3::new(3., 4., 2.);

View File

@ -1,12 +1,12 @@
use std::f32::consts::PI;
use crate::aabb::AABB;
use crate::hitable::Hit;
use crate::hitable::HitRecord;
use crate::material::Material;
use crate::ray::Ray;
use crate::vec3::dot;
use crate::vec3::Vec3;
use crate::{
aabb::AABB,
hitable::{Hit, HitRecord},
material::Material,
ray::Ray,
vec3::{dot, Vec3},
};
pub struct Sphere<M>
where

View File

@ -1,5 +1,4 @@
use crate::texture::Texture;
use crate::vec3::Vec3;
use crate::{texture::Texture, vec3::Vec3};
pub struct CheckerTexture<T>
where

View File

@ -1,5 +1,4 @@
use crate::texture::Texture;
use crate::vec3::Vec3;
use crate::{texture::Texture, vec3::Vec3};
#[derive(Debug, PartialEq)]
pub struct ConstantTexture {

View File

@ -2,9 +2,10 @@ use std::f32;
use image::RgbImage;
use crate::texture::ImageTexture;
use crate::texture::Texture;
use crate::vec3::Vec3;
use crate::{
texture::{ImageTexture, Texture},
vec3::Vec3,
};
#[derive(Debug)]
pub struct EnvMap {

View File

@ -1,7 +1,6 @@
use image::RgbImage;
use crate::texture::Texture;
use crate::vec3::Vec3;
use crate::{texture::Texture, vec3::Vec3};
#[derive(Debug)]
pub struct ImageTexture {

View File

@ -1,9 +1,7 @@
#![allow(clippy::many_single_char_names)]
use rand;
use rand::Rng;
use rand::{self, Rng};
use crate::texture::Texture;
use crate::vec3::Vec3;
use crate::{texture::Texture, vec3::Vec3};
pub struct Mandelbrot {
palette: Vec<Vec3>,

View File

@ -4,12 +4,10 @@ mod envmap;
mod image;
mod mandelbrot;
mod noise;
pub use crate::texture::checker::CheckerTexture;
pub use crate::texture::constant::ConstantTexture;
pub use crate::texture::envmap::EnvMap;
pub use crate::texture::image::ImageTexture;
pub use crate::texture::mandelbrot::Mandelbrot;
pub use crate::texture::noise::NoiseTexture;
pub use crate::texture::{
checker::CheckerTexture, constant::ConstantTexture, envmap::EnvMap, image::ImageTexture,
mandelbrot::Mandelbrot, noise::NoiseTexture,
};
use std::sync::Arc;

View File

@ -1,7 +1,8 @@
use crate::noise::NoiseSource;
use crate::noise::NoiseType;
use crate::texture::Texture;
use crate::vec3::Vec3;
use crate::{
noise::{NoiseSource, NoiseType},
texture::Texture,
vec3::Vec3,
};
pub struct NoiseTexture<N>
where

View File

@ -1,8 +1,9 @@
use crate::aabb::AABB;
use crate::hitable::Hit;
use crate::hitable::HitRecord;
use crate::ray::Ray;
use crate::vec3::Vec3;
use crate::{
aabb::AABB,
hitable::{Hit, HitRecord},
ray::Ray,
vec3::Vec3,
};
pub struct Translate<H>
where

View File

@ -1,16 +1,12 @@
use std::convert::From;
use std::fmt;
use std::num::ParseFloatError;
use std::ops::Add;
use std::ops::Div;
use std::ops::Index;
use std::ops::Mul;
use std::ops::Neg;
use std::ops::Sub;
use std::str;
use std::{
convert::From,
fmt,
num::ParseFloatError,
ops::{Add, Div, Index, Mul, Neg, Sub},
str,
};
use serde_derive::Deserialize;
use serde_derive::Serialize;
use serde_derive::{Deserialize, Serialize};
#[derive(Default, Debug, Deserialize, Serialize, PartialEq, Copy, Clone)]
pub struct Vec3 {
@ -207,8 +203,7 @@ impl Sub for Vec3 {
#[cfg(test)]
mod tests {
use std::f32::consts::PI;
use std::str::FromStr;
use std::{f32::consts::PI, str::FromStr};
use super::*;

View File

@ -6,8 +6,7 @@ use cpuprofiler::PROFILER;
use log::info;
use structopt::StructOpt;
use renderer::renderer::render;
use renderer::renderer::Opt;
use renderer::renderer::{render, Opt};
#[cfg(not(feature = "profile"))]
struct MockTimer;