started work on CompoundShape
This commit is contained in:
24
src/CompoundShape.cpp
Normal file
24
src/CompoundShape.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user