From cae8b210688d0588c2ff557f216f4714c6df04ef Mon Sep 17 00:00:00 2001 From: Eryn Wells Date: Fri, 13 Sep 2013 14:15:55 -0700 Subject: [PATCH] Clean up shapes and lights lists --- src/scene.cc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/scene.cc b/src/scene.cc index 8905b75..9030439 100644 --- a/src/scene.cc +++ b/src/scene.cc @@ -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;