snoopy/include/sphere.h

24 lines
524 B
C++

#pragma once
#include "hittable.h"
#include "vec3.h"
class sphere : public hittable
{
public:
sphere() {}
sphere(point3 centre, double r, std::shared_ptr<material> m) :
centre_(centre),
radius_(r),
mat_ptr_(m)
{};
virtual bool hit(const ray& r, double t_min, double t_max, hit_record& rec) const;
private:
point3 centre_;
double radius_;
std::shared_ptr<material> mat_ptr_;
};