resolved local state conflict
This commit is contained in:
@@ -27,7 +27,7 @@ pub struct Camera {
|
||||
defocus_disk_v: Vec3,
|
||||
}
|
||||
|
||||
// FIXME: kinda out of place in this file.
|
||||
// FIXME (low priority): kinda out of place in this file.
|
||||
fn deg_to_rad(deg: f32) -> f32 {
|
||||
deg * PI / 180.
|
||||
}
|
||||
|
||||
@@ -15,12 +15,12 @@ use crate::scenes::scene::Scene;
|
||||
use crate::vec3::Vec3;
|
||||
use dotenv::dotenv;
|
||||
|
||||
// TODO: implement scene serialization
|
||||
// TODO (low priority): implement scene serialization
|
||||
fn main() {
|
||||
dotenv().ok();
|
||||
pretty_env_logger::init();
|
||||
|
||||
// TODO: better cli parsing || add random flag to generate random scene
|
||||
// TODO (medium priority): better cli parsing || add random flag to generate random scene
|
||||
let mut json_file = "./scenes/scene.json";
|
||||
let args: Vec<String> = env::args().collect();
|
||||
if args.len() > 1 {
|
||||
|
||||
@@ -61,7 +61,7 @@ impl Hittable for Circle {
|
||||
|
||||
fn to_uv(&self, point: &Vec3) -> Vec3 {
|
||||
let p = *point - self.center;
|
||||
// TODO: add rotated texture support
|
||||
// TODO (low priority): add rotated texture support
|
||||
Vec3::new(
|
||||
0.5 + p.y().atan2(*p.x()) / (2. * PI),
|
||||
1. - (p.z() / self.radius).acos() / PI,
|
||||
|
||||
@@ -43,7 +43,7 @@ impl Hittable for Cube {
|
||||
}
|
||||
|
||||
fn to_uv(&self, _point: &Vec3) -> Vec3 {
|
||||
// TODO: map to [0.1] relative to specific face
|
||||
// TODO (low priority): map to [0.1] relative to specific face
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ impl Hit {
|
||||
(self.u, self.v)
|
||||
}
|
||||
|
||||
// TODO: use front_face to discard back-hits for culling
|
||||
// TODO (low priority): use front_face to discard back-hits for culling
|
||||
pub fn hit_list(hittables: &Vec<Arc<dyn Hittable>>, r: &Ray) -> Option<Hit> {
|
||||
let mut closest: Option<Hit> = None;
|
||||
for hittable in hittables {
|
||||
|
||||
@@ -74,7 +74,7 @@ impl Hittable for Sphere {
|
||||
|
||||
fn to_uv(&self, point: &Vec3) -> Vec3 {
|
||||
let p = *point - self.center;
|
||||
// TODO: add rotated texture support
|
||||
// TODO (medium priority): add rotated texture support
|
||||
Vec3::new(
|
||||
0.5 + p.y().atan2(*p.x()) / (2. * PI),
|
||||
1. - (p.z() / self.radius).acos() / PI,
|
||||
|
||||
@@ -26,7 +26,7 @@ pub fn write_image(filename: &str, pixels: &[u8], width: u32, height: u32) {
|
||||
pub fn render(scene: &mut Scene) {
|
||||
scene.init();
|
||||
|
||||
// TODO: currently splits per vertical line, but could be more granular (per chunk)
|
||||
// TODO (low priority): currently splits per vertical line, but could be more granular (per chunk)
|
||||
let mut pixels = vec![0_u8; (scene.get_image_width() * scene.get_image_height() * 3) as usize];
|
||||
let scanlines: Vec<(usize, &mut [u8])> = pixels
|
||||
.chunks_mut(scene.get_image_width() as usize * 3)
|
||||
|
||||
@@ -28,7 +28,7 @@ pub struct Scene {
|
||||
image_width: u32,
|
||||
image_height: u32,
|
||||
|
||||
// raytracing // TODO: think about organisation of these vars, also in Camera
|
||||
// raytracing
|
||||
max_depth: u32,
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user