rayzor

annotate 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
rev   line source
nuclear@0 1 #include "scene.h"
nuclear@0 2
nuclear@0 3 Scene::Scene()
nuclear@0 4 {
nuclear@0 5 name = 0;
nuclear@0 6 }
nuclear@0 7
nuclear@0 8 Scene::~Scene()
nuclear@0 9 {
nuclear@0 10 clear();
nuclear@0 11 }
nuclear@0 12
nuclear@0 13 void Scene::clear()
nuclear@0 14 {
nuclear@0 15 delete [] name;
nuclear@0 16
nuclear@0 17 size_t i;
nuclear@0 18 for(i=0; i<objects.size(); i++) {
nuclear@0 19 delete objects[i];
nuclear@0 20 }
nuclear@0 21 for(i=0; i<lights.size(); i++) {
nuclear@0 22 delete lights[i];
nuclear@0 23 }
nuclear@0 24 for(i=0; i<cameras.size(); i++) {
nuclear@0 25 delete cameras[i];
nuclear@0 26 }
nuclear@0 27 }
nuclear@0 28
nuclear@0 29 void Scene::set_name(const char *name)
nuclear@0 30 {
nuclear@0 31 delete [] this->name;
nuclear@0 32 this->name = new char[strlen(name) + 1];
nuclear@0 33 strcpy(this->name, name);
nuclear@0 34 }
nuclear@0 35
nuclear@0 36 const char *Scene::get_name() const
nuclear@0 37 {
nuclear@0 38 return name ? name : "<unknown>";
nuclear@0 39 }
nuclear@0 40
nuclear@0 41 void Scene::draw() const
nuclear@0 42 {
nuclear@0 43 }