rayzor

diff src/scene.cc @ 0:2a5340a6eee4

rayzor first commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 05 Apr 2014 08:46:27 +0300
parents
children a826bf0fb169
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/scene.cc	Sat Apr 05 08:46:27 2014 +0300
     1.3 @@ -0,0 +1,43 @@
     1.4 +#include "scene.h"
     1.5 +
     1.6 +Scene::Scene()
     1.7 +{
     1.8 +	name = 0;
     1.9 +}
    1.10 +
    1.11 +Scene::~Scene()
    1.12 +{
    1.13 +	clear();
    1.14 +}
    1.15 +
    1.16 +void Scene::clear()
    1.17 +{
    1.18 +	delete [] name;
    1.19 +
    1.20 +	size_t i;
    1.21 +	for(i=0; i<objects.size(); i++) {
    1.22 +		delete objects[i];
    1.23 +	}
    1.24 +	for(i=0; i<lights.size(); i++) {
    1.25 +		delete lights[i];
    1.26 +	}
    1.27 +	for(i=0; i<cameras.size(); i++) {
    1.28 +		delete cameras[i];
    1.29 +	}
    1.30 +}
    1.31 +
    1.32 +void Scene::set_name(const char *name)
    1.33 +{
    1.34 +	delete [] this->name;
    1.35 +	this->name = new char[strlen(name) + 1];
    1.36 +	strcpy(this->name, name);
    1.37 +}
    1.38 +
    1.39 +const char *Scene::get_name() const
    1.40 +{
    1.41 +	return name ? name : "<unknown>";
    1.42 +}
    1.43 +
    1.44 +void Scene::draw() const
    1.45 +{
    1.46 +}