#ifndef RAYTRYCPP_SPHERE_H #define RAYTRYCPP_SPHERE_H #include "RenderObject.h" #include namespace raytry { class Sphere : public RenderObject { public: Sphere(QVector3D position, float radius); Sphere(QVector3D position, float radius, RenderMaterial material); Sphere(); ~Sphere() override = default; [[nodiscard]] std::optional intersects(const Ray &ray) const override; [[nodiscard]] RenderMaterial material() const override; [[nodiscard]] QVector3D calculateNormal(QVector3D hitpoint) const override; #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug dbg) const { return dbg << "Sphere(" << position << ", radius" << radius << ")"; } friend QDebug operator<<(QDebug dbg, const Sphere& sphere) { return sphere.operator<<(std::move(dbg)); } #endif private: RenderMaterial mat; QVector3D position; float radius; }; }// namespace raytry #endif//RAYTRYCPP_SPHERE_H