goat3dgfx

annotate src/scene.cc @ 9:25b911c7c35c

fixed some line endings fixed the cubemap2.jpg file in examples/cubemap/data which was resized improperly causing seams...
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 18 Nov 2013 04:10:19 +0200
parents
children 1868c5975f31
rev   line source
nuclear@0 1 #include "scene.h"
nuclear@0 2 #include "opengl.h"
nuclear@0 3
nuclear@0 4 Scene::~Scene()
nuclear@0 5 {
nuclear@0 6 destroy();
nuclear@0 7 }
nuclear@0 8
nuclear@0 9 void Scene::destroy()
nuclear@0 10 {
nuclear@0 11 for(size_t i=0; i<objects.size(); i++) {
nuclear@0 12 delete objects[i];
nuclear@0 13 }
nuclear@0 14 objects.clear();
nuclear@0 15
nuclear@0 16 for(size_t i=0; i<meshes.size(); i++) {
nuclear@0 17 delete meshes[i];
nuclear@0 18 }
nuclear@0 19 meshes.clear();
nuclear@0 20
nuclear@0 21 for(size_t i=0; i<curves.size(); i++) {
nuclear@0 22 delete curves[i];
nuclear@0 23 }
nuclear@0 24 curves.clear();
nuclear@0 25 }
nuclear@0 26
nuclear@0 27 void Scene::draw(long msec) const
nuclear@0 28 {
nuclear@0 29 for(size_t i=0; i<objects.size(); i++) {
nuclear@0 30 objects[i]->draw(msec);
nuclear@0 31 }
nuclear@0 32
nuclear@0 33 if(objects.empty()) {
nuclear@0 34 printf("rendering meshes directly\n");
nuclear@0 35 for(size_t i=0; i<meshes.size(); i++) {
nuclear@0 36 meshes[i]->draw();
nuclear@0 37 }
nuclear@0 38 }
nuclear@0 39 }