2 eqemu - electronic queue system emulator
3 Copyright (C) 2014 John Tsiombikas <nuclear@member.fsf.org>,
4 Eleni-Maria Stea <eleni@mutantstargoat.com>
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 for(size_t i=0; i<objects.size(); i++) {
29 for(size_t i=0; i<meshes.size(); i++) {
34 bool Scene::load(const char *fname)
36 FILE *fp = fopen(fname, "rb");
38 fprintf(stderr, "failed to open scene file: %s\n", fname);
42 bool res = load_obj(fp);
47 void Scene::add_object(Object *obj)
49 objects.push_back(obj);
52 void Scene::add_mesh(Mesh *mesh)
54 meshes.push_back(mesh);
57 int Scene::get_num_objects() const
59 return (int)objects.size();
62 int Scene::get_num_meshes() const
64 return (int)meshes.size();
67 Object *Scene::get_object(int idx) const
72 Object *Scene::get_object(const char *name) const
74 for(size_t i=0; i<objects.size(); i++) {
75 if(strcmp(objects[i]->get_name(), name) == 0) {
82 bool Scene::remove_object(Object *obj)
84 for(size_t i=0; i<objects.size(); i++) {
85 if(objects[i] == obj) {
86 objects.erase(objects.begin() + i);
93 Mesh *Scene::get_mesh(int idx) const
98 void Scene::update(long msec)
102 void Scene::render() const
104 for(size_t i=0; i<objects.size(); i++) {
105 objects[i]->render();