Skip to content

Commit

Permalink
Change intersect_tri return to HitInfo(..., ..., ..., tri.col, ...);
Browse files Browse the repository at this point in the history
  • Loading branch information
kugimasa committed Aug 20, 2023
1 parent d0370ea commit 37f075e
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions resources/shader/compute-sample.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -273,18 +273,7 @@ fn intersect_tri(r: Ray, id: u32, closest: HitInfo) -> HitInfo {
let norm = face_norm(r, tri.norm.xyz);
let ray_dist = distance(pos, start);
let flags = vec4f(tri.emissive, 0.0, 0.0, 0.0);
hit = ray_dist < closest.dist &&
(0.0 <= u && u <= 1.0) &&
(0.0 <= v && (u + v) <= 1.0);

return HitInfo(
select(closest.dist, ray_dist, hit),
select(closest.pos, pos, hit),
select(closest.norm, norm, hit),
closest.uv,
select(closest.col, tri.col, hit),
select(closest.flags, flags, hit),
);
return HitInfo(ray_dist, pos, norm, closest.uv, tri.col, flags);
}

fn intersect_quad(r: Ray, id: u32, closest: HitInfo) -> HitInfo {
Expand Down

0 comments on commit 37f075e

Please sign in to comment.