Clean up shapes and lights lists

This commit is contained in:
Eryn Wells 2013-09-13 14:15:55 -07:00
parent fcd2781cc7
commit cae8b21068

View file

@ -20,6 +20,8 @@ Scene::Scene()
: width(640), height(480),
max_depth(5),
ambient(NULL),
shapes(),
lights(),
nrays(0),
pixels(NULL)
{ }
@ -27,6 +29,20 @@ Scene::Scene()
Scene::~Scene()
{
if (ambient != NULL) {
delete ambient;
}
for (Shape *s : shapes) {
delete s;
}
shapes.clear();
for (PointLight *l : lights) {
delete l;
}
lights.clear();
if (pixels != NULL) {
delete[] pixels;
_is_rendered = false;