Tracer
hittablelist.h
1 #ifndef hittablelist_h
2 #define hittablelist_h
3 
4 #include "hittable.h"
5 
6 class hittable_list: public hittable {
7  public:
8  hittable **list;
9  int list_size;
10  __device__ hittable_list(){}
11  __device__ hittable_list(hittable **a, int b) {
12  list=a;
13  list_size=b;
14  }
15  __device__ bool hit(const ray &r, float min, float max, hit_record &rec) const{
16  hit_record temp;
17  bool hit = false;
18  double closest_time = max;
19  for(int i = 0 ; i < list_size ; i++) {
20  if(list[i]->hit(r,min,closest_time,temp)) {
21  hit = true;
22  closest_time = temp.t;
23  rec = temp;
24  }
25  }
26  return hit;
27  }
28 };
29 
30 #endif
Definition: hittablelist.h:6
Definition: ray.h:4
Definition: hittable.h:8
Definition: hittable.h:15