Clean up shapes and lights lists
This commit is contained in:
parent
fcd2781cc7
commit
cae8b21068
1 changed files with 16 additions and 0 deletions
16
src/scene.cc
16
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue