toytracer/hittable_list.h
2020-06-13 22:21:27 +02:00

28 lines
684 B
C++

#ifndef HITTABLE_LIST_H
#define HITTABLE_LIST_H
#include <memory>
#include <vector>
#include "bvh.h"
#include "hittable.h"
class Hittable_list : public Hittable {
public:
Hittable_list() {}
Hittable_list(std::shared_ptr<Hittable> object) { add(object); }
void clear() { objects.clear(); }
void add(std::shared_ptr<Hittable> object) { objects.push_back(object); }
virtual bool hit(const Ray& r, double tmin, double tmax, hit_record& rec) const;
bool bounding_box(double t0, double t1, Aabb& output_box) const;
Bvh_node generate_bvh(double t0, double t1);
private:
std::vector<std::shared_ptr<Hittable>> objects;
};
#endif // HITTABLE_LIST_H