25 lines
481 B
C++
25 lines
481 B
C++
#include "CompoundShape.hpp"
|
|
|
|
// constructors
|
|
|
|
CompoundShape::CompoundShape(const std::vector<Shape> shapes)
|
|
: shapes { shapes }
|
|
, transform { 1.0f } {
|
|
|
|
for (auto& shape : this->shapes) {
|
|
shape.init();
|
|
}
|
|
}
|
|
|
|
// public
|
|
|
|
void CompoundShape::draw() {
|
|
for (auto& shape : this->shapes) {
|
|
glm::mat4 orig_transform { shape.transform };
|
|
shape.transform *= shape.transform;
|
|
shape.draw();
|
|
shape.transform = orig_transform;
|
|
}
|
|
}
|
|
|