Test whether a point can see a given direction without being occluded. Returns true if no triangle blocks the ray from `origin` going toward `direction_to_light` within `max_distance`. The origin should already be offset along the surface normal to avoid self-intersection.
(ray_origin: Vec3, direction_to_light: Vec3, max_distance: f32, scene: &Scene, bvh: &Bvh)
| 1690 | /// The origin should already be offset along the surface normal to |
| 1691 | /// avoid self-intersection. |
| 1692 | fn visible(ray_origin: Vec3, direction_to_light: Vec3, max_distance: f32, scene: &Scene, bvh: &Bvh) -> bool { |
| 1693 | let ray = Ray::new(ray_origin, direction_to_light); |
| 1694 | // We only need to know if ANY triangle is hit before max_distance; |
| 1695 | // a specialized "any-hit" traversal would be faster than |
| 1696 | // closest-hit, but the closest-hit cost is acceptable for Phase 3. |
| 1697 | match intersect_bvh(&ray, scene, bvh) { |
| 1698 | Some(hit) => hit.t >= max_distance, |
| 1699 | None => true, |
| 1700 | } |
| 1701 | } |
| 1702 | |
| 1703 | // ============================================================ |
| 1704 | // Path tracer |
no test coverage detected