2020-06-06 18:38:36 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "hittable.h"
|
|
|
|
#include "vec3.h"
|
|
|
|
|
|
|
|
class sphere : public hittable
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
sphere() {}
|
2023-02-20 02:19:28 +01:00
|
|
|
sphere(point3 centre, double r, std::shared_ptr<material> m) :
|
2020-06-06 18:38:36 +02:00
|
|
|
centre_(centre),
|
2020-06-07 00:59:30 +02:00
|
|
|
radius_(r),
|
|
|
|
mat_ptr_(m)
|
|
|
|
{};
|
2020-06-06 18:38:36 +02:00
|
|
|
|
|
|
|
virtual bool hit(const ray& r, double t_min, double t_max, hit_record& rec) const;
|
|
|
|
|
|
|
|
private:
|
2023-02-20 02:19:28 +01:00
|
|
|
point3 centre_;
|
|
|
|
double radius_;
|
|
|
|
std::shared_ptr<material> mat_ptr_;
|
2020-06-06 18:38:36 +02:00
|
|
|
};
|
|
|
|
|