#include "scene.h" #include "mesh.h" #include void Scene::getMeshTypes(std::vector &meshTypes) { std::set typesSet; for(SceneIterator* geometryIt = getGeometry(); geometryIt->isValid(); geometryIt->next()) typesSet.emplace(geometryIt->getItem()->mesh->getFlags()); for(unsigned int type : typesSet) meshTypes.push_back(type); } void Scene::getLightTypes(std::vector &lightTypes) { std::set typesSet; for(SceneIterator* lightIt = getLights(); lightIt->isValid(); lightIt->next()) typesSet.emplace(lightIt->getItem()->getFlags()); for(unsigned int type : typesSet) lightTypes.push_back(type); } BasicScene::~BasicScene() { clearScene(); } void BasicScene::addMesh(GeometryNode* gn) { geometry.push_back(gn); } GeometryNode* BasicScene::addMesh(Mesh* m, glm::mat4 transform) { GeometryNode *gn = new GeometryNode(m, transform); allocations.push_back(gn); addMesh(gn); return gn; } void BasicScene::addLight(Light* myLight) { lights.push_back(myLight); } void BasicScene::clearScene() { for(GeometryNode *gn : allocations) delete gn; allocations.clear(); geometry.clear(); lights.clear(); } SceneIterator* BasicScene::getLights() { return new ArrayIterator(lights); } SceneIterator* BasicScene::getGeometry() { return new ArrayIterator(geometry); }