Skip to content
Snippets Groups Projects
Commit 1b3bd80e authored by Yoel's avatar Yoel
Browse files

Implemented AABB for Spheres

parent 2c3c4650
No related branches found
No related tags found
No related merge requests found
......@@ -42,4 +42,8 @@ std::shared_ptr<cam::Hit> Sphere::intersect(const cam::Ray& r) const {
return nullptr;
}
}
util::AxisAlignedBoundingBox Sphere::bounds() const {
return util::AxisAlignedBoundingBox(util::Vec3(-radius),
util::Vec3(radius));
}
} // namespace shapes
......@@ -7,6 +7,7 @@ class Sphere : public Shape {
public:
Sphere(float radius, const std::shared_ptr<material::Material>& material);
std::shared_ptr<cam::Hit> intersect(const cam::Ray& r) const override;
util::AxisAlignedBoundingBox bounds() const override;
private:
std::shared_ptr<material::Material> material;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment