2022-10-11 17:27:22 +02:00

36 lines
574 B
C++

#include "scene.h"
namespace kek {
Scene::Scene() {
this->lights = new LightList();
}
Scene::~Scene() {
for(GameObject *obj : objects) delete obj;
for(Light *l : lights->point) delete l;
delete lights;
}
void Scene::addObject(GameObject *object) {
objects.push_back(object);
}
void Scene::removeObject(GameObject *object) {
for(auto it = objects.begin(); it < objects.end(); it++) {
if(*it == object) {
objects.erase(it);
delete object;
break;
}
}
}
void Scene::draw(Shader *shader) {
for(GameObject *obj : objects) {
obj->draw(shader);
}
}
}