vrshoot

annotate src/scene.cc @ 2:334d17aed7de

visual studio project files
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 02 Feb 2014 18:36:38 +0200
parents
children
rev   line source
nuclear@0 1 #include "scene.h"
nuclear@0 2 #include "assload.h"
nuclear@0 3 #include "opengl.h"
nuclear@0 4
nuclear@0 5 Scene::~Scene()
nuclear@0 6 {
nuclear@0 7 destroy();
nuclear@0 8 }
nuclear@0 9
nuclear@0 10 void Scene::destroy()
nuclear@0 11 {
nuclear@0 12 for(size_t i=0; i<objects.size(); i++) {
nuclear@0 13 delete objects[i];
nuclear@0 14 }
nuclear@0 15 objects.clear();
nuclear@0 16
nuclear@0 17 for(size_t i=0; i<meshes.size(); i++) {
nuclear@0 18 delete meshes[i];
nuclear@0 19 }
nuclear@0 20 meshes.clear();
nuclear@0 21
nuclear@0 22 for(size_t i=0; i<curves.size(); i++) {
nuclear@0 23 delete curves[i];
nuclear@0 24 }
nuclear@0 25 curves.clear();
nuclear@0 26 }
nuclear@0 27
nuclear@0 28 bool Scene::load(const char *fname)
nuclear@0 29 {
nuclear@0 30 return load_ass(this, fname);
nuclear@0 31 }
nuclear@0 32
nuclear@0 33 bool Scene::save(const char *fname) const
nuclear@0 34 {
nuclear@0 35 return false; // TODO
nuclear@0 36 }
nuclear@0 37
nuclear@0 38 void Scene::draw(long msec) const
nuclear@0 39 {
nuclear@0 40 for(size_t i=0; i<objects.size(); i++) {
nuclear@0 41 objects[i]->draw(msec);
nuclear@0 42 }
nuclear@0 43
nuclear@0 44 if(objects.empty()) {
nuclear@0 45 for(size_t i=0; i<meshes.size(); i++) {
nuclear@0 46 meshes[i]->draw();
nuclear@0 47 }
nuclear@0 48 }
nuclear@0 49 }