goat3dgfx

view src/scene.cc @ 10:b4c9a24c946e

wrote an awesome configure script added "main" 3d engine source file with global init/cleanup
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 24 Nov 2013 13:30:44 +0200
parents
children 1868c5975f31
line source
1 #include "scene.h"
2 #include "opengl.h"
4 Scene::~Scene()
5 {
6 destroy();
7 }
9 void Scene::destroy()
10 {
11 for(size_t i=0; i<objects.size(); i++) {
12 delete objects[i];
13 }
14 objects.clear();
16 for(size_t i=0; i<meshes.size(); i++) {
17 delete meshes[i];
18 }
19 meshes.clear();
21 for(size_t i=0; i<curves.size(); i++) {
22 delete curves[i];
23 }
24 curves.clear();
25 }
27 void Scene::draw(long msec) const
28 {
29 for(size_t i=0; i<objects.size(); i++) {
30 objects[i]->draw(msec);
31 }
33 if(objects.empty()) {
34 printf("rendering meshes directly\n");
35 for(size_t i=0; i<meshes.size(); i++) {
36 meshes[i]->draw();
37 }
38 }
39 }