Advertisement
The_Law

Untitled

Apr 17th, 2021
3,083
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. for (size_t i = 0; i < pyramids.size(); ++i) {
  2.         if (pyramids[i].ray_intersect(orig, dir, hit, N, nearest_dist)) {
  3.             material = pyramids[i].material;
  4.         }
  5.     }
  6.  
  7.     for (size_t i = 0; i < cylinders.size(); ++i) {
  8.         float dist_i;
  9.         if (cylinders[i].ray_intersect(orig, dir, dist_i) && dist_i < nearest_dist) {
  10.             nearest_dist = dist_i;
  11.             hit = orig + dir * dist_i;
  12.             N = (hit - cylinders[i].center).normalize();
  13.             material = cylinders[i].material;
  14.         }
  15.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement