Demo.h

00001 #ifndef DEMO_
00002 #define DEMO_
00003 
00004 #include <stdio.h>
00005 #include <stdlib.h>
00006 #include <windows.h>
00007 #include <GL/gl.h>
00008 #include <GL/glu.h>
00009 #include <GL/glut.h>
00010 
00011 #include "Scene.h"
00012 
00013 #define DEMO_NOT_YET_STARTED            -1
00014 
00015 #define DELTA_X                         2.0f
00016 #define DELTA_Y                         2.0f
00017 #define DELTA_Z                         2.0f
00018 #define DELTA_ROLL                      1.0f
00019 #define DELTA_PITCH                     1.0f
00020 #define DELTA_YAW                       1.0f
00021 
00022 
00038 class Demo
00039 {
00040 public:
00044         Demo ();
00045 
00049         ~Demo ();
00050 
00061         void Init (int argc, char * argv[]);
00062 
00066         void Play ();
00067 
00068 private:
00072         void SwitchMonitor ();
00073 
00077         void SwitchPlayback ();
00078 
00082         void UpdateTime ();
00083 
00087         void PrintUsage ();
00088 
00092         void DisplayLoop ();
00093 
00097         void IdleLoop ();
00098 
00105         void Reshape (int w, int h);
00106 
00112         void Keyboard (unsigned char key, int x, int y);
00113 
00119         void KeyboardSpecial (int key, int x, int y);
00120 
00122         bool is_initialized;
00123 
00125         int window_width;
00126 
00128         int window_height;
00129 
00131         bool fullscreen_enabled;
00132 
00134         int culling_mode;               
00135 
00137         bool level_of_detail_enabled;
00138 
00140         bool monitoring_mode;
00141 
00143         bool demo_playing;
00144 
00146         Camera * monitor_camera;
00147 
00149         int demo_time;
00150 
00152         int last_measure_time;
00153 
00155         int frame_rate;
00156 
00158         int last_frame_rate_time;
00159 
00161         int incremental_rate;
00162 
00164         char buffer[200];
00165 
00166 //-----------------------------------------------------------------------------------------------------
00167 //                                                                      GLUT WRAPPER
00168 //-----------------------------------------------------------------------------------------------------
00172         static void static_display ();
00173 
00177         static void static_idle ();
00178 
00182         static void static_reshape (int w, int h);
00183 
00187         static void static_keyboard (unsigned char key, int x, int y);
00188 
00192         static void static_keyboard_special (int key, int x, int y);
00193 
00197         static Demo * current_demo;
00198 
00199 //-----------------------------------------------------------------------------------------------------
00200 //                                                                      SCENE MANAGEMENT
00201 //-----------------------------------------------------------------------------------------------------
00202 public:
00213         void AddScene (Scene * scene, int duration, int blend_in);
00214 
00215 private:
00217         typedef struct SceneListElem
00218         {
00219                 SceneListElem * next;           
00220                 Scene * scene;                          
00221                 int start_time;                         
00222                 int end_time;                           
00223                 int blend;                                      
00224         }SceneList;
00225 
00227         SceneList * first_scene;
00228 
00230         SceneListElem * current_scene;
00231 
00232 //------------------------------------------------------------------------------------------------------
00233 //                                                                      LIGHTING
00234 //------------------------------------------------------------------------------------------------------
00235         
00237         float global_ambient_playback [4];
00238 
00240         float global_ambient_monitor [4];
00241 
00243         float global_specular_reflection [4];
00244 
00246         int global_shininess;
00247 
00256         void SetGlobalAmbientPlayback (float red, float green, float blue, float alpha);
00257 
00266         void SetGlobalAmbientMonitor (float red, float green, float blue, float alpha);
00267 
00276         void SetGlobalSpecularReflection (float red, float green, float blue, float alpha);
00277 
00283         void SetGlobalShininess (int shininess);
00284 };
00285 
00286 
00287 #endif

Generated on Sun Jul 2 13:20:39 2006 for Demo by  doxygen 1.4.6-NO