Demo Class Reference

A demo consisting of a sequence of scenes. More...

#include <Demo.h>

List of all members.

Public Member Functions

 Demo ()
 ~Demo ()
void Init (int argc, char *argv[])
void Play ()
void AddScene (Scene *scene, int duration, int blend_in)

Private Types

typedef Demo::SceneListElem SceneList

Private Member Functions

void SwitchMonitor ()
void SwitchPlayback ()
void UpdateTime ()
void PrintUsage ()
void DisplayLoop ()
void IdleLoop ()
void Reshape (int w, int h)
void Keyboard (unsigned char key, int x, int y)
void KeyboardSpecial (int key, int x, int y)
void SetGlobalAmbientPlayback (float red, float green, float blue, float alpha)
void SetGlobalAmbientMonitor (float red, float green, float blue, float alpha)
void SetGlobalSpecularReflection (float red, float green, float blue, float alpha)
void SetGlobalShininess (int shininess)

Static Private Member Functions

static void static_display ()
static void static_idle ()
static void static_reshape (int w, int h)
static void static_keyboard (unsigned char key, int x, int y)
static void static_keyboard_special (int key, int x, int y)

Private Attributes

bool is_initialized
int window_width
int window_height
bool fullscreen_enabled
int culling_mode
bool level_of_detail_enabled
bool monitoring_mode
bool demo_playing
Cameramonitor_camera
int demo_time
int last_measure_time
int frame_rate
int last_frame_rate_time
int incremental_rate
char buffer [200]
SceneListfirst_scene
SceneListElemcurrent_scene
float global_ambient_playback [4]
float global_ambient_monitor [4]
float global_specular_reflection [4]
int global_shininess

Static Private Attributes

static Democurrent_demo = NULL

Classes

struct  SceneListElem


Detailed Description

A demo consisting of a sequence of scenes.

This is the main class. When the demo is played, a sequence of scenes are rendered either in fullscreen mode or in a window of an arbitrary size. The demo supports blending between scenes using the OpenGL accumulation buffer. Apart from the ability to start and stop the playback of the demo it also provides a mechanism to monitor the scenes. When entering this monitoring mode, playback of the demo is stopped and the camera may be moved around freely. Additionally, the bounding volumes that are currently used to apply view frustum culling are displayed as well as the camera that captures the scene and its view frustum. Furthermore, all the objects are drawn with the level of detail that it used for the camera that captures the scene.

The demo also contains some basic properties for illumination that are common to all scenes, such as the minimal ambient light during playback and during monitoring mode or the properties of the specular reflections.

Definition at line 38 of file Demo.h.


Member Typedef Documentation

typedef struct Demo::SceneListElem Demo::SceneList [private]
 

Data structure to hold the scenes.


Constructor & Destructor Documentation

Demo::Demo  ) 
 

Constructor: Brings the demo into a consistent state.

Definition at line 4 of file Demo.cpp.

Demo::~Demo  ) 
 

Destructor: Frees ressources needed by the demo

Definition at line 30 of file Demo.cpp.


Member Function Documentation

void Demo::AddScene Scene scene,
int  duration,
int  blend_in
 

Adds a scene to the demo. The duration of this scene as well as the time needed to blend in the scene can be specified manually.

Parameters:
scene The scene which shall be added to the demo. Scenes are played in the same order as they were added.
duration Duration of the scene in milliseconds.
blend_in Amount of time needed to blend the scene in. The scene before is blended out linearly over the same time span.

Definition at line 155 of file Demo.cpp.

void Demo::DisplayLoop  )  [private]
 

The display loop of the demo. Handles the drawing of the scenes.

Definition at line 259 of file Demo.cpp.

void Demo::IdleLoop  )  [private]
 

Idle loop, does nothing.

Definition at line 332 of file Demo.cpp.

void Demo::Init int  argc,
char *  argv[]
 

Initializes the demo, its scenes and OpenGL states.

Parameters:
argc The number of arguments in argv
argv Array of strings specifiying the mode in which the demo gets played If nothing is specified, the demo plays at 640x480 in windowed mode. If there are two numbers, the demo plays at this resolution in windowed mode. If there is one string, the demo tries to play in the fullscreen mode specified by that string. This string must be of the format "WIDTHxHEIGHT:BPP@REFRESHRATE".

Definition at line 48 of file Demo.cpp.

void Demo::Keyboard unsigned char  key,
int  x,
int  y
[private]
 

Keyboard function, called whenever a regular keyboard key is pressed.

Parameters:
key The key being pressed.

Definition at line 343 of file Demo.cpp.

void Demo::KeyboardSpecial int  key,
int  x,
int  y
[private]
 

Special keyboard input function, called whenever a special keyboard key is pressed.

Parameters:
key The key being pressed

Definition at line 397 of file Demo.cpp.

void Demo::Play  ) 
 

Starts the playback of the demo.

Definition at line 135 of file Demo.cpp.

void Demo::PrintUsage  )  [private]
 

Prints a short description to the console.

Definition at line 512 of file Demo.cpp.

void Demo::Reshape int  w,
int  h
[private]
 

Reshape function, called whenever the display window gets resized.

Parameters:
w The new width of the viewport
h The new height of the viewport

Definition at line 338 of file Demo.cpp.

void Demo::SetGlobalAmbientMonitor float  red,
float  green,
float  blue,
float  alpha
[private]
 

Sets the global ambient illumination when monitor mode.

Parameters:
red Red part of the ambient light.
green Green part of the ambient light.
blue Blue part of the ambient light.
alpha Alpha value of the ambient light.

Definition at line 464 of file Demo.cpp.

void Demo::SetGlobalAmbientPlayback float  red,
float  green,
float  blue,
float  alpha
[private]
 

Sets the global ambient illumination when not in monitoring mode.

Parameters:
red Red part of the ambient light.
green Green part of the ambient light.
blue Blue part of the ambient light.
alpha Alpha value of the ambient light.

Definition at line 456 of file Demo.cpp.

void Demo::SetGlobalShininess int  shininess  )  [private]
 

Sets the shininess of all the specular reflections.

Parameters:
shininess Determines the shininess of the specular reflections.

Definition at line 480 of file Demo.cpp.

void Demo::SetGlobalSpecularReflection float  red,
float  green,
float  blue,
float  alpha
[private]
 

Sets the global specular reflection.

Parameters:
red Red part of the specular reflection.
green Green part of the specular reflection.
blue Blue part of the specular reflection.
alpha Alpha value of the specular reflection.

Definition at line 472 of file Demo.cpp.

void Demo::static_display  )  [static, private]
 

This static function is required by glut.

Definition at line 487 of file Demo.cpp.

void Demo::static_idle  )  [static, private]
 

This static function is required by glut.

Definition at line 492 of file Demo.cpp.

void Demo::static_keyboard unsigned char  key,
int  x,
int  y
[static, private]
 

This static function is required by glut.

Definition at line 502 of file Demo.cpp.

void Demo::static_keyboard_special int  key,
int  x,
int  y
[static, private]
 

This static function is required by glut.

Definition at line 507 of file Demo.cpp.

void Demo::static_reshape int  w,
int  h
[static, private]
 

This static function is required by glut.

Definition at line 497 of file Demo.cpp.

void Demo::SwitchMonitor  )  [private]
 

Switches monitoring mode on respectively off.

Definition at line 194 of file Demo.cpp.

void Demo::SwitchPlayback  )  [private]
 

Switches playback on respectively off.

Definition at line 213 of file Demo.cpp.

void Demo::UpdateTime  )  [private]
 

Updates the elapsed demo time. The time in only increased if the demo is actually playing.

Definition at line 222 of file Demo.cpp.


Member Data Documentation

char Demo::buffer[200] [private]
 

Buffer used for string creation.

Definition at line 164 of file Demo.h.

int Demo::culling_mode [private]
 

Describes the mode currently used for view frustum culling: C_NONE, C_BOUNDING_BOX, C_SPHERE or C_MIXED.

Definition at line 134 of file Demo.h.

Demo * Demo::current_demo = NULL [static, private]
 

This static variable determines the currently active demo.

Definition at line 197 of file Demo.h.

SceneListElem* Demo::current_scene [private]
 

Pointer to the currently active scene during playback.

Definition at line 230 of file Demo.h.

bool Demo::demo_playing [private]
 

States if the demo is currently playing.

Definition at line 143 of file Demo.h.

int Demo::demo_time [private]
 

Actual time of the demo in milliseconds

Definition at line 149 of file Demo.h.

SceneList* Demo::first_scene [private]
 

List constaining all the scenes of the demo.

Definition at line 227 of file Demo.h.

int Demo::frame_rate [private]
 

Current frame rate.

Definition at line 155 of file Demo.h.

bool Demo::fullscreen_enabled [private]
 

States if the demo is in fullscreen_mode. NOT YET SUPPORTED.

Definition at line 131 of file Demo.h.

float Demo::global_ambient_monitor[4] [private]
 

Global ambient light when in monitoring mode.

Definition at line 240 of file Demo.h.

float Demo::global_ambient_playback[4] [private]
 

Global ambient light when not in monitoring mode.

Definition at line 237 of file Demo.h.

int Demo::global_shininess [private]
 

Global shininess value.

Definition at line 246 of file Demo.h.

float Demo::global_specular_reflection[4] [private]
 

Global specular reflection.

Definition at line 243 of file Demo.h.

int Demo::incremental_rate [private]
 

Simple counter used for the frame rate calculation.

Definition at line 161 of file Demo.h.

bool Demo::is_initialized [private]
 

States if the demo has been initialized or not

Definition at line 122 of file Demo.h.

int Demo::last_frame_rate_time [private]
 

States when the frame rate was evaluated for the last time.

Definition at line 158 of file Demo.h.

int Demo::last_measure_time [private]
 

Last valid time measurement used to update the demo time.

Definition at line 152 of file Demo.h.

bool Demo::level_of_detail_enabled [private]
 

States if objects shall be drawn using different levels of detail.

Definition at line 137 of file Demo.h.

Camera* Demo::monitor_camera [private]
 

The camera used to monitor the scenes of the demo.

Definition at line 146 of file Demo.h.

bool Demo::monitoring_mode [private]
 

States if the demo is currently running in monitoring mode.

Definition at line 140 of file Demo.h.

int Demo::window_height [private]
 

Screen height of the demo.

Definition at line 128 of file Demo.h.

int Demo::window_width [private]
 

Screen width of the demo.

Definition at line 125 of file Demo.h.


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