2 This file is part of the 3dengfx demo system.
4 Copyright (c) 2004, 2005 John Tsiombikas <nuclear@siggraph.org>
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 2 of the License, or
9 (at your option) any later version.
11 This program demo 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, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #include "3dengfx_config.h"
26 #include "3dengfx/3dengfx.hpp"
30 Part::Part(const char *name) {
32 this->name = new char[strlen(name)+1];
33 strcpy(this->name, name);
40 //timer_reset(&timer);
44 if(name) delete [] name;
48 void Part::pre_draw() {
50 ::set_render_target(dsys::tex[target]);
54 clear(Color(0, 0, 0));
55 clear_zbuffer_stencil(1.0f, 0);
57 time = dsys::get_demo_time() - start_time;
58 //timer_getmsec(&timer);
61 void Part::post_draw() {
63 ::set_render_target(0);
67 for(int i=0; i<8; i++) {
68 glDisable(GL_LIGHT0 + i);
71 set_ambient_light(0.0f);
74 void Part::set_name(const char *name) {
75 this->name = new char[strlen(name)+1];
76 strcpy(this->name, name);
79 const char *Part::get_name() const {
83 void Part::set_clear(bool enable) {
88 //timer_start(&timer);
89 start_time = dsys::get_demo_time();
96 void Part::set_target(RenderTarget targ) {
100 void Part::update_graphics() {
106 bool Part::operator <(const Part &part) const {
107 if(!name) return true;
108 if(!part.name) return false;
109 return strcmp(name, part.name) < 0;