Skip to content
Snippets Groups Projects
Commit 9d277fd7 authored by Yoel's avatar Yoel
Browse files

Implemented BoundingVolumes Group.

parent e4365e8c
No related branches found
No related tags found
No related merge requests found
......@@ -37,7 +37,18 @@ std::shared_ptr<cam::Hit> Group::intersect(const cam::Ray& r) const {
}
return result;
}
util::AxisAlignedBoundingBox Group::bounds() const {
return util::AxisAlignedBoundingBox();
}
void Group::add(const std::shared_ptr<Shape>& shape) {
shapeList.push_back(shape);
}
void Group::rebuildBoundingVolume() {
util::AxisAlignedBoundingBox bb = shapeList[0]->bounds();
for (auto shape_bb : shapeList) {
bb = bb + shape_bb->bounds();
}
boundingVolume = bb;
}
} // namespace shapes
\ No newline at end of file
......@@ -13,10 +13,14 @@ class Group : public Shape {
Group(const util::Mat4& matrix);
std::shared_ptr<cam::Hit> intersect(const cam::Ray& r) const override;
util::AxisAlignedBoundingBox bounds() const override;
// protected:TODO
void add(const std::shared_ptr<shapes::Shape>& shape);
private:
void rebuildBoundingVolume();
util::AxisAlignedBoundingBox boundingVolume;
std::vector<std::shared_ptr<Shape>> shapeList;
util::Transformation transform;
};
......
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