fmt
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
use crate::{ray::Ray, util::deg_to_rad, vec3::Vec3};
|
||||
|
||||
#[derive(Debug)]
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#![feature(core_float_math)]
|
||||
|
||||
mod util;
|
||||
mod camera;
|
||||
mod objects;
|
||||
mod ray;
|
||||
mod raytracer;
|
||||
mod scenes;
|
||||
mod util;
|
||||
mod vec3;
|
||||
|
||||
use std::{env, fs};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
pub mod colour_source;
|
||||
pub mod dielectric;
|
||||
pub mod lambertian;
|
||||
pub mod normal;
|
||||
pub mod traits;
|
||||
pub mod texture;
|
||||
pub mod colour_source;
|
||||
pub mod traits;
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
use image::{DynamicImage, ImageReader};
|
||||
use log::trace;
|
||||
|
||||
use crate::{
|
||||
objects::hit::Hit,
|
||||
vec3::Vec3,
|
||||
};
|
||||
use crate::{objects::hit::Hit, vec3::Vec3};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Texture {
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@ use std::f32::consts::PI;
|
||||
use std::fmt::{self, Debug};
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::Vec3;
|
||||
use crate::objects::hit::Hit;
|
||||
use crate::objects::materials::traits::Material;
|
||||
use crate::objects::traits::Hittable;
|
||||
use crate::ray::Ray;
|
||||
use crate::Vec3;
|
||||
|
||||
pub struct Sphere {
|
||||
center: Vec3,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use std::fmt::Debug;
|
||||
|
||||
use crate::Ray;
|
||||
use crate::objects::hit::Hit;
|
||||
use crate::vec3::Vec3;
|
||||
use crate::Ray;
|
||||
|
||||
pub trait Hittable: Debug + Send + Sync {
|
||||
fn to_uv(&self, point: &Vec3) -> Vec3;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use image::{ExtendedColorType, ImageEncoder, codecs::png::PngEncoder};
|
||||
use image::{codecs::png::PngEncoder, ExtendedColorType, ImageEncoder};
|
||||
use log::{error, info, trace};
|
||||
use rayon::iter::IntoParallelIterator;
|
||||
use rayon::prelude::*;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
pub mod raw_camera;
|
||||
pub mod material_def;
|
||||
pub mod hittable_def;
|
||||
pub mod material_def;
|
||||
pub mod raw_camera;
|
||||
pub mod scene;
|
||||
|
||||
@@ -2,8 +2,13 @@ use std::sync::Arc;
|
||||
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::objects::materials::{dielectric::Dielectric, lambertian::{Lambertian, Metal}, normal::Normal, texture::Texture, traits::Material};
|
||||
|
||||
use crate::objects::materials::{
|
||||
dielectric::Dielectric,
|
||||
lambertian::{Lambertian, Metal},
|
||||
normal::Normal,
|
||||
texture::Texture,
|
||||
traits::Material,
|
||||
};
|
||||
|
||||
#[derive(Deserialize)]
|
||||
#[serde(tag = "type", rename_all = "lowercase")]
|
||||
|
||||
@@ -3,4 +3,3 @@ use std::f32::consts::PI;
|
||||
pub(crate) fn deg_to_rad(deg: f32) -> f32 {
|
||||
deg * PI / 180.
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,11 @@ impl Vec3 {
|
||||
|
||||
pub fn random_unit_hemisphere(n: &Self) -> Self {
|
||||
let v = Self::random_unit();
|
||||
if n.dot(&v) > 0.0 { v } else { -v }
|
||||
if n.dot(&v) > 0.0 {
|
||||
v
|
||||
} else {
|
||||
-v
|
||||
}
|
||||
}
|
||||
|
||||
pub fn x(&self) -> &f32 {
|
||||
|
||||
Reference in New Issue
Block a user