Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (size_t i = 0; i < pyramids.size(); ++i) {
- if (pyramids[i].ray_intersect(orig, dir, hit, N, nearest_dist)) {
- material = pyramids[i].material;
- }
- }
- for (size_t i = 0; i < cylinders.size(); ++i) {
- float dist_i;
- if (cylinders[i].ray_intersect(orig, dir, dist_i) && dist_i < nearest_dist) {
- nearest_dist = dist_i;
- hit = orig + dir * dist_i;
- N = (hit - cylinders[i].center).normalize();
- material = cylinders[i].material;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement