perf:writer
This commit is contained in:
parent
f60a06d84b
commit
89ad39b3e4
|
@ -108,7 +108,7 @@ impl<'a> Camera<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 限制出射光线的角度(0.001经验值)
|
// 限制出射光线的角度(0.001经验值)
|
||||||
let hr = world.hit(&ray, 0.01, f32::MAX);
|
let hr = world.hit(&ray, 0.001, f32::MAX);
|
||||||
if hr.t >= 0.0 {
|
if hr.t >= 0.0 {
|
||||||
// diffuse normal vec
|
// diffuse normal vec
|
||||||
let diffuse_vec = Vec3::random_unit();
|
let diffuse_vec = Vec3::random_unit();
|
||||||
|
|
|
@ -46,10 +46,10 @@ fn camera_render() {
|
||||||
// world
|
// world
|
||||||
// world objects(spheres)
|
// world objects(spheres)
|
||||||
let mut world = HittableList::new();
|
let mut world = HittableList::new();
|
||||||
world.put(Box::new(Sphere::new(Point::new(0.0, 0.1, -1.0), 0.5)));
|
world.put(Box::new(Sphere::new(Point::new(0.0, 0.0, -1.0), 0.5)));
|
||||||
world.put(Box::new(Sphere::new(Point::new(0.3, 0.1, -1.0), 0.1)));
|
world.put(Box::new(Sphere::new(Point::new(0.3, 0.1, -1.0), 0.1)));
|
||||||
world.put(Box::new(Sphere::new(Point::new(-0.5, 0.0, -1.0), 0.3)));
|
world.put(Box::new(Sphere::new(Point::new(-0.5, 0.0, -1.0), 0.3)));
|
||||||
world.put(Box::new(Sphere::new(Point::new(0.0, -100.0, -1.0), 100.0)));
|
world.put(Box::new(Sphere::new(Point::new(0.0, -1000.0, -1.0), 1000.0)));
|
||||||
world.put(Box::new(Sphere::new(Point::new(-0.5, 0.2, -0.5), 0.4)));
|
world.put(Box::new(Sphere::new(Point::new(-0.5, 0.2, -0.5), 0.4)));
|
||||||
|
|
||||||
camera.render(&world);
|
camera.render(&world);
|
||||||
|
|
Loading…
Reference in New Issue