Classes | Typedefs | Functions | Variables

glut Namespace Reference
[Terrain Renderer]

Classes

struct  anim_channel_state_t
 An object can have many animations going at once. More...
class  MaxAnimations
class  AnimationState
 Simple class of fixed size to maintain per-object animation state. More...
class  Viewer
struct  camera_t
 camera_t : basic physical properties of a camera More...
struct  fps_t
 fps_t : handy object for frames-per-second calculations More...
class  State
struct  fcolor_t
 base floating point color object More...
class  Host
 If a client wants to use this library's glut helper entry point, it needs to supply an object that supports this interface. More...
class  Task
 Create one of these (you'll have to inherit) if you have openGL work you need to submit to requestTask(). More...
class  Material
 A Material is anything that needs to be set up prior to drawing, and possibly requiring some cleanup afterwards. More...
class  MaterialContext
 helper class: put one of these on the stack, and it will make sure that prepare() and cleanup() are called. More...
struct  render_context_t
 rendering context More...
struct  poly_request_t
 stores information necessary to render a polygon later More...
class  RenderQueue
 queue of requests More...
class  Renderable
 rendering interface -- anything that wants to draw has to implement this interface! More...
class  DisplayLine
 represents a single (small) status line to overlay in the demo More...
class  DemoHost
 You'll need to provide a class that inherits from DemoHost. More...
class  FontEffect
 general base class for font effect objects. More...
struct  font_rect_t
 font sizing information More...
class  Font
 a basic font class. More...
class  FontManager
 the font manager More...
struct  material_t
 material (used for rendering polygons) More...
class  MaterialRegistry
 Clients of the parsing APIs must implement this interface themselves. More...
struct  polygon_t
 polygon object. More...
class  model_t
 model object. More...
struct  lod_entry_t
 level-of-detail entry. contains a model and distance information More...
struct  lod_model_t
 level-of-detail model. Contains multiple level-of-detail entries (models) More...
class  Framebuffer
 provides a framebuffer of fixed size for offscreen rendering. More...
class  FramebufferContext
 simple helper class--put this on the stack and it will automatically call Framebuffer::setupForRendering() and Framebuffer::endRendering() for you. More...
struct  sphere_init_t
 data needed for cool spheres More...

Typedefs

typedef stack_array
< anim_channel_state_t,
MaxAnimations
animation_list_t
typedef threadsafe_map
< pthread_t, smart_ptr
< task_record_t > > 
task_map_t
typedef std::vector< smart_ptr
< DisplayLine > > 
vec_display_lines_t
typedef rect2d_t< int > pixel_rect_t
 standard 2D pixel rect

typedef rect2d_t< int > recti_t

Functions

void processTasks (void)
static void onExit (void)
static void onDisplay (void)
static void onIdle (void)
static void onMouseButton (int button, int state, int x, int y)
static void onMouseMove (int x, int y)
static void onKeyboard (byte_t key, int x, int y)
static void onSpecialKeys (int key, int x, int y)
static void onReshape (int w, int h)
void start (int argc,const char *argv[],int width,int height,const char *title,const char *gameModeString,smart_ptr< Host > &host)
 clients can call this to get common glut setup
void requestTask (Task *task)
 Here a thread can request that a task be handled by the open GL thread.
void drawRectLines (const rect3d_t &r,const glut_color_t &c) throw ()
 draw the outline of a 3D rectangle
void getModelViewMatrix (matrix4_t &T) throw ()
 get a 4x4 matrix from the given OpenGL matrix
static GLint getGlutInternalFormat (const media::image_t &image)
static GLint getGlutFormatFromColorFormat (const media::image_t &image)
static int createOpenGLTexture (const media::image_t &image)
void startDemo (int argc,const char *argv[],const char *title,DemoHost *host)
 use this method to kick off a quick demo (provide an instance of your own host, inherited from glut::DemoHost ).
smart_ptr< FontEffectgetCharacterAdvanceEffect (smart_ptr< Font > &font,const char *lines,int millisecondsPerCharacter,const glut_color_t &color)
 this font effect will write out lines of text one character at a time.
void breakLongString (const char *text,Font *font,int maxPixelWidth,std::string &output)
 given a long sequence of words in a given font, this routine returns the same words, only with line breaks inserted so that a single line is never longer than the specified width.
smart_ptr< FontgetDefaultFont (void)
 retrieve the default font (throws if there isn't one)
bool scaleFontToPixelHeight (Font *font,const char *textToScale,int desiredPixelHeight)
 scale the given font to the specified height in pixels.
void parseColor (std::istream &stream, img_color_t &color)
void parseMaterial (std::istream &stream, const char *parentDir, material_t &material)
void parsePolygon (MaterialRegistry *mreg, std::istream &stream, polygon_t &polygon)
void parseModel (MaterialRegistry *mreg, std::istream &stream, model_t &model)
void parseLodEntry (MaterialRegistry *mreg, std::istream &stream, lod_entry_t &entry)
void parseLodModel (MaterialRegistry *mreg, std::istream &stream, lod_model_t &lod_model)
smart_ptr< MaterialRegistrygetSimpleRegistry (const char *materialDir)
 get a simple implementation of a material registry.
smart_ptr< RenderableloadModel (const char *filename, MaterialRegistry *reg)
 load a model from a Wavepacket Glut Model file (.wgm extension, normally)
void writeModelToStream (std::ostream &stream, const model_t &model)
 assumes you have already written the key name, this will write the opening and closing brackets
static void renderColorPolygon (const polygon_t &p) throw ()
static void queuePolygon (const point3d_t *vertex_array, const polygon_t &p, poly_request_t &pr) throw ()
static void renderTexturePolygon (const point3d_t *vertex_array, const polygon_t &p) throw ()
static void getDictionaryFromNextLine (std::istream &stream, const char *debug_info, dictionary_t &d)
static byte_t getOptionalByte (const dictionary_t &d, const char *key)
static void writePoint3dToStream (std::ostream &stream, const point3d_t &p)
static void setUpImage (int width, int height, media::image_t &img)
static void setSegment (const point3d_t &p0, const point3d_t &p1, const matrix4_t &T, int genTextureId, int outTextureId, Framebuffer *framebuffer, float size, const glut::render_context_t &rc, poly_request_t *pr)
static int compareSegments (const void *p1, const void *p2) throw ()
smart_ptr< RenderablecreateCoolSphere (const sphere_init_t &si)
 create a really cool-looking sphere. Yeah.
static float randomX (float x)
static void jitter (point3d_t &p, float dx) throw ()
static void drawLightningRing (float radius, const point3d_t &axis, float phi, const glut_color_t &color) throw ()
smart_ptr< RenderablecreateSkybox (smart_ptr< Renderable > &box)
 treat the given model as a skybox
smart_ptr< RenderablecreateTerrain (hfield::Heightfield *hfield)
 create a renderable heightfield model
smart_ptr< RenderablecreateXformModel (const matrix4_t &xform,smart_ptr< Renderable > &model)
 Given a 4x4 transform and a base model, returns a wrapper model that applies the given transformation to the base model.

void getTrailingViewer (const Viewer &subject,float distance_back,Viewer &view) throw ()
 getTrailingViewer() -- for over-the-shoulder views
void setOpenGLProjection (const camera_t &camera) throw ()
 setOpenGLProjection() - set up OpenGL projection transformation
void setOpenGLViewer (const Viewer &viewer) throw ()
 setOpenGLViewer() - set up initial OpenGL model/view transformation
void addQuaternionRotation (const quaternion_t &q) throw ()
 addQuaternionRotation() - rotates current matrix by given quaternion
void setPlacement (const placement_t &p) throw ()
 setPlacement() - updates current modelview transformation for placement

void getViewFrustum (const camera_t &camera,const Viewer &viewer,frustum_t &viewFrustum) throw ()
 This is a method to determine the view frustum given the current camera settings and viewer orientation.
void drawFrustumEdges (const frustum_t &f,const glut_color_t &color) throw ()
 helper method to draw the edges of a frustum

void push2D (int screenWidth,int screenHeight)
 switches to 2D drawing.
void pop2D (void)
 restores 3D drawing (make sure to call this after calling push2D()!).
void drawCursor (int x, int y)

int createTextureFromImage (const media::image_t &image)

void createSphericalDensityMap (int size,const img_color_t &color,media::image_t &image)
void createCircularDensityMap (int size,const img_color_t &color,media::image_t &image)
 creates a density map where alpha is constant (specified by color)
void createLineSegmentDensityMap (int width,const img_color_t &color,media::image_t &image)
 horizontal line segment running through the middle third of the image

void drawTransparentPath (const point3d_t *pointArray,int *textureArray,int nSegments,Framebuffer *framebuffer,float size,int textureId,const render_context_t &rc,RenderQueue *rq)
 draws a path, creating a texture normal to the viewer along each segment.

Variables

static const float s_twoPi = 2.0 * M_PI
static const float s_radiansPerDegree = M_PI / 180.0
static task_map_t s_pendingTasks
static task_map_t s_completedTasks
static smart_ptr< Hosts_host
static bool s_fullscreen = false
static pthread_t s_glutThreadId = 0
static int s_width = 0
static int s_height = 0
static const int s_maxBufferSize = 256
static const int s_maxLighting = 3
static const float s_dRot = 0.25
static const float s_2 = sqrt(0.5)
static const int s_maxRGBA = 255
static const float s_eps = 1.0e-6

Typedef Documentation

typedef threadsafe_map<pthread_t, smart_ptr<task_record_t> > glut::task_map_t

Definition at line 68 of file glut.cpp.


Function Documentation

void glut::getTrailingViewer ( const Viewer &  subject,
float  dist,
Viewer &  view 
) throw ()

getTrailingViewer() -- for over-the-shoulder views

void glut::setOpenGLProjection ( const camera_t &  camera  )  throw ()

setOpenGLProjection() - set up OpenGL projection transformation

void glut::setOpenGLViewer ( const Viewer &  viewer  )  throw ()

setOpenGLViewer() - set up initial OpenGL model/view transformation

void glut::addQuaternionRotation ( const quaternion_t q  )  throw ()

addQuaternionRotation() - rotates current matrix by given quaternion

void glut::setPlacement ( const placement_t p  )  throw ()

setPlacement() - updates current modelview transformation for placement

void glut::processTasks ( void   ) 

Definition at line 90 of file glut.cpp.

static void glut::onExit ( void   )  [static]

Definition at line 131 of file glut.cpp.

static void glut::onDisplay ( void   )  [static]

Definition at line 159 of file glut.cpp.

static void glut::onIdle ( void   )  [static]

Definition at line 185 of file glut.cpp.

static void glut::onMouseButton ( int  button,
int  state,
int  x,
int  y 
) [static]

Definition at line 215 of file glut.cpp.

static void glut::onMouseMove ( int  x,
int  y 
) [static]

Definition at line 241 of file glut.cpp.

static void glut::onKeyboard ( byte_t  key,
int  x,
int  y 
) [static]

Definition at line 265 of file glut.cpp.

static void glut::onSpecialKeys ( int  key,
int  x,
int  y 
) [static]

Definition at line 291 of file glut.cpp.

static void glut::onReshape ( int  w,
int  h 
) [static]

Definition at line 317 of file glut.cpp.

static GLint glut::getGlutInternalFormat ( const media::image_t image  )  [static]

Definition at line 48 of file texture.cpp.

static GLint glut::getGlutFormatFromColorFormat ( const media::image_t image  )  [static]

Definition at line 59 of file texture.cpp.

static int glut::createOpenGLTexture ( const media::image_t image  )  [static]

Definition at line 81 of file texture.cpp.

static void glut::renderColorPolygon ( const polygon_t &  p  )  throw () [static]

Definition at line 47 of file model-draw.cpp.

static void glut::queuePolygon ( const point3d_t vertex_array,
const polygon_t &  p,
poly_request_t &  pr 
) throw () [static]

Definition at line 73 of file model-draw.cpp.

static void glut::renderTexturePolygon ( const point3d_t vertex_array,
const polygon_t &  p 
) throw () [static]

Definition at line 109 of file model-draw.cpp.

static void glut::getDictionaryFromNextLine ( std::istream &  stream,
const char *  debug_info,
dictionary_t d 
) [static]

Definition at line 63 of file model-parsing.cpp.

static byte_t glut::getOptionalByte ( const dictionary_t d,
const char *  key 
) [static]

Definition at line 84 of file model-parsing.cpp.

static void glut::writePoint3dToStream ( std::ostream &  stream,
const point3d_t p 
) [static]

Definition at line 101 of file model-parsing.cpp.

static void glut::setUpImage ( int  width,
int  height,
media::image_t img 
) [static]

Definition at line 50 of file density-map.cpp.

void glut::createSphericalDensityMap ( int  size,
const img_color_t color,
media::image_t image 
)

creates a density map where alpha varies by sphere cross-section

Parameters:
size width and height
void glut::createCircularDensityMap ( int  size,
const img_color_t color,
media::image_t img 
)

creates a density map where alpha is constant (specified by color)

Parameters:
size width and height
void glut::createLineSegmentDensityMap ( int  width,
const img_color_t color,
media::image_t img 
)

horizontal line segment running through the middle third of the image

static void glut::setSegment ( const point3d_t p0,
const point3d_t p1,
const matrix4_t T,
int  genTextureId,
int  outTextureId,
Framebuffer *  framebuffer,
float  size,
const glut::render_context_t rc,
poly_request_t *  pr 
) [static]

Definition at line 56 of file light-path.cpp.

static int glut::compareSegments ( const void *  p1,
const void *  p2 
) throw () [static]

Definition at line 244 of file light-path.cpp.

void glut::drawTransparentPath ( const point3d_t pointArray,
int *  textureArray,
int  nSegments,
Framebuffer *  framebuffer,
float  size,
int  textureId,
const render_context_t &  rc,
RenderQueue *  rq 
)

draws a path, creating a texture normal to the viewer along each segment.

The texture is assumed to be transparent so is added to the render queue.

Parameters:
pointArray nSegments + 1
textureArray nSegments in size
static float glut::randomX ( float  x  )  [static]

Definition at line 48 of file sphere.cpp.

static void glut::jitter ( point3d_t p,
float  dx 
) throw () [static]

Definition at line 59 of file sphere.cpp.

static void glut::drawLightningRing ( float  radius,
const point3d_t axis,
float  phi,
const glut_color_t color 
) throw () [static]

Definition at line 100 of file sphere.cpp.

smart_ptr< glut::Renderable > glut::createTerrain ( hfield::Heightfield hfield  ) 

create a renderable heightfield model


Variable Documentation

const float glut::s_twoPi = 2.0 * M_PI [static]

Definition at line 41 of file camera.cpp.

const float glut::s_radiansPerDegree = M_PI / 180.0 [static]

Definition at line 39 of file wave-glut/lib/glut/frustum.cpp.

Definition at line 70 of file glut.cpp.

Definition at line 71 of file glut.cpp.

Definition at line 73 of file glut.cpp.

bool glut::s_fullscreen = false [static]

Definition at line 74 of file glut.cpp.

pthread_t glut::s_glutThreadId = 0 [static]

Definition at line 75 of file glut.cpp.

int glut::s_width = 0 [static]

Definition at line 78 of file glut.cpp.

int glut::s_height = 0 [static]

Definition at line 79 of file glut.cpp.

const int glut::s_maxBufferSize = 256 [static]

Definition at line 42 of file glut-demo.cpp.

const int glut::s_maxLighting = 3 [static]

Definition at line 43 of file glut-demo.cpp.

const float glut::s_dRot = 0.25 [static]

Definition at line 44 of file glut-demo.cpp.

const float glut::s_2 = sqrt(0.5) [static]

Definition at line 45 of file glut-demo.cpp.

const int glut::s_maxRGBA = 255 [static]

Definition at line 39 of file density-map.cpp.

const float glut::s_eps = 1.0e-6 [static]

Definition at line 40 of file light-path.cpp.