started work on CompoundShape

This commit is contained in:
2026-02-04 21:17:07 +02:00
parent 5744c8b509
commit ffd2cca5c9
8 changed files with 134 additions and 39 deletions

24
src/CompoundShape.cpp Normal file
View 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;
}
}