56 lines
1.5 KiB
C++
56 lines
1.5 KiB
C++
#ifndef AARECT_H
|
|
#define AARECT_H
|
|
|
|
#include "hittable.h"
|
|
#include "material.h"
|
|
|
|
class Xy_rect : public Hittable {
|
|
public:
|
|
Xy_rect() {}
|
|
|
|
Xy_rect(double x0_, double x1_, double y0_, double y1_, double k_, std::shared_ptr<Material> mat)
|
|
: x0(x0_), x1(x1_), y0(y0_), y1(y1_), k(k_), mat_ptr(mat) {}
|
|
|
|
virtual bool hit(const Ray& r, double t0, double t1, hit_record& rec) const;
|
|
|
|
virtual bool bounding_box(double t0, double t1, Aabb& output_box) const;
|
|
|
|
private:
|
|
double x0, x1, y0, y1, k;
|
|
std::shared_ptr<Material> mat_ptr;
|
|
};
|
|
|
|
class Xz_rect : public Hittable {
|
|
public:
|
|
Xz_rect() {}
|
|
|
|
Xz_rect(double x0_, double x1_, double z0_, double z1_, double k_, std::shared_ptr<Material> mat)
|
|
: x0(x0_), x1(x1_), z0(z0_), z1(z1_), k(k_), mat_ptr(mat) {}
|
|
|
|
virtual bool hit(const Ray& r, double t0, double t1, hit_record& rec) const;
|
|
|
|
virtual bool bounding_box(double t0, double t1, Aabb& output_box) const;
|
|
|
|
private:
|
|
double x0, x1, z0, z1, k;
|
|
std::shared_ptr<Material> mat_ptr;
|
|
};
|
|
|
|
class Yz_rect : public Hittable {
|
|
public:
|
|
Yz_rect() {}
|
|
|
|
Yz_rect(double y0_, double y1_, double z0_, double z1_, double k_, std::shared_ptr<Material> mat)
|
|
: y0(y0_), y1(y1_), z0(z0_), z1(z1_), k(k_), mat_ptr(mat) {}
|
|
|
|
virtual bool hit(const Ray& r, double t0, double t1, hit_record& rec) const;
|
|
|
|
virtual bool bounding_box(double t0, double t1, Aabb& output_box) const;
|
|
|
|
private:
|
|
double y0, y1, z0, z1, k;
|
|
std::shared_ptr<Material> mat_ptr;
|
|
};
|
|
|
|
#endif // AARECT_H
|