rtiow: change scene to aid in debugging.
This commit is contained in:
parent
a8756debb8
commit
f8ec874d13
@ -16,7 +16,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
pub fn new(opt: &Opt) -> Scene {
|
pub fn new(opt: &Opt) -> Scene {
|
||||||
let lookfrom = Vec3::new(100., 200., 200.);
|
let lookfrom = Vec3::new(-100., 200., 200.);
|
||||||
let lookat = Vec3::new(0., 1., 0.);
|
let lookat = Vec3::new(0., 1., 0.);
|
||||||
let dist_to_focus = 10.0;
|
let dist_to_focus = 10.0;
|
||||||
let aperture = 0.0;
|
let aperture = 0.0;
|
||||||
@ -26,7 +26,7 @@ pub fn new(opt: &Opt) -> Scene {
|
|||||||
lookfrom,
|
lookfrom,
|
||||||
lookat,
|
lookat,
|
||||||
Vec3::new(0., 1., 0.),
|
Vec3::new(0., 1., 0.),
|
||||||
20.,
|
45.,
|
||||||
opt.width as f32 / opt.height as f32,
|
opt.width as f32 / opt.height as f32,
|
||||||
aperture,
|
aperture,
|
||||||
dist_to_focus,
|
dist_to_focus,
|
||||||
@ -36,7 +36,7 @@ pub fn new(opt: &Opt) -> Scene {
|
|||||||
let ground_color = if opt.use_accel {
|
let ground_color = if opt.use_accel {
|
||||||
ConstantTexture::new(Vec3::new(1.0, 0.4, 0.4))
|
ConstantTexture::new(Vec3::new(1.0, 0.4, 0.4))
|
||||||
} else {
|
} else {
|
||||||
ConstantTexture::new(Vec3::new(0.4, 1.0, 0.4))
|
ConstantTexture::new(Vec3::new(0.4, 0.4, 0.4))
|
||||||
};
|
};
|
||||||
|
|
||||||
let stl_cube = STL::parse(
|
let stl_cube = STL::parse(
|
||||||
@ -48,7 +48,7 @@ pub fn new(opt: &Opt) -> Scene {
|
|||||||
let light_height = 200.;
|
let light_height = 200.;
|
||||||
let tri_mesh = Triangles::new(
|
let tri_mesh = Triangles::new(
|
||||||
&stl_cube,
|
&stl_cube,
|
||||||
Lambertian::new(ConstantTexture::new(Vec3::new(1., 0.1, 0.1))),
|
Lambertian::new(ConstantTexture::new(Vec3::new(1., 1., 1.))),
|
||||||
1.,
|
1.,
|
||||||
);
|
);
|
||||||
dbg!(tri_mesh.triangles.len(), tri_mesh.bbox);
|
dbg!(tri_mesh.triangles.len(), tri_mesh.bbox);
|
||||||
|
|||||||
@ -83,6 +83,7 @@ where
|
|||||||
{
|
{
|
||||||
// Based on https://www.scratchapixel.com/lessons/3d-basic-rendering/ray-tracing-rendering-a-triangle/ray-triangle-intersection-geometric-solution.html
|
// Based on https://www.scratchapixel.com/lessons/3d-basic-rendering/ray-tracing-rendering-a-triangle/ray-triangle-intersection-geometric-solution.html
|
||||||
fn hit(&self, r: Ray, _t_min: f32, _t_max: f32) -> Option<HitRecord> {
|
fn hit(&self, r: Ray, _t_min: f32, _t_max: f32) -> Option<HitRecord> {
|
||||||
|
// TODO(wathiede): add an acceleration structure to more cheaply skip some triangles.
|
||||||
for tri in &self.triangles {
|
for tri in &self.triangles {
|
||||||
let n = tri.normal;
|
let n = tri.normal;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user