rayzor
annotate src/scene.cc @ 2:c273c6f799a4
added fixcase utility to fix the ftp-ed files' case on linux
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Sat, 05 Apr 2014 18:31:00 +0300 |
parents | 2a5340a6eee4 |
children | 5fcf72837b69 |
rev | line source |
---|---|
nuclear@1 | 1 #include "scene.h" |
nuclear@1 | 2 |
nuclear@1 | 3 Scene::Scene() |
nuclear@1 | 4 { |
nuclear@1 | 5 name = 0; |
nuclear@1 | 6 } |
nuclear@1 | 7 |
nuclear@1 | 8 Scene::~Scene() |
nuclear@1 | 9 { |
nuclear@1 | 10 clear(); |
nuclear@1 | 11 } |
nuclear@1 | 12 |
nuclear@1 | 13 void Scene::clear() |
nuclear@1 | 14 { |
nuclear@1 | 15 delete [] name; |
nuclear@1 | 16 |
nuclear@1 | 17 size_t i; |
nuclear@1 | 18 for(i=0; i<objects.size(); i++) { |
nuclear@1 | 19 delete objects[i]; |
nuclear@1 | 20 } |
nuclear@1 | 21 for(i=0; i<lights.size(); i++) { |
nuclear@1 | 22 delete lights[i]; |
nuclear@1 | 23 } |
nuclear@1 | 24 for(i=0; i<cameras.size(); i++) { |
nuclear@1 | 25 delete cameras[i]; |
nuclear@1 | 26 } |
nuclear@1 | 27 } |
nuclear@1 | 28 |
nuclear@1 | 29 void Scene::set_name(const char *name) |
nuclear@1 | 30 { |
nuclear@1 | 31 delete [] this->name; |
nuclear@1 | 32 this->name = new char[strlen(name) + 1]; |
nuclear@1 | 33 strcpy(this->name, name); |
nuclear@1 | 34 } |
nuclear@1 | 35 |
nuclear@1 | 36 const char *Scene::get_name() const |
nuclear@1 | 37 { |
nuclear@1 | 38 return name ? name : "<unknown>"; |
nuclear@1 | 39 } |
nuclear@1 | 40 |
nuclear@1 | 41 void Scene::draw() const |
nuclear@1 | 42 { |
nuclear@1 | 43 } |