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