perf:writer

This commit is contained in:
dengqn 2025-08-05 19:04:27 +08:00
parent f60a06d84b
commit 89ad39b3e4
2 changed files with 3 additions and 3 deletions

View File

@ -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();

View File

@ -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);