Classes | Functions | Variables

Glut 3D Model Library
[3D Model Formats]

A homegrown 3D model format. More...

Collaboration diagram for Glut 3D Model Library:

Classes

struct  glut::material_t
 material (used for rendering polygons) More...
class  glut::MaterialRegistry
 Clients of the parsing APIs must implement this interface themselves. More...
struct  glut::polygon_t
 polygon object. More...
class  glut::model_t
 model object. More...
struct  glut::lod_entry_t
 level-of-detail entry. contains a model and distance information More...
struct  glut::lod_model_t
 level-of-detail model. Contains multiple level-of-detail entries (models) More...

Functions

 glut::material_t::~material_t (void) throw ()
void glut::material_t::clear (void) throw ()
virtual smart_ptr< material_t > glut::MaterialRegistry::getMaterial (const char *id)=0
 glut::polygon_t::~polygon_t (void) throw ()
void glut::polygon_t::clear (void) throw ()
 glut::model_t::~model_t (void) throw ()
void glut::model_t::clear (void) throw ()
void glut::model_t::render (const render_context_t &rc, RenderQueue *rq)
 this method is called to actually draw the object.
rect3d_t glut::model_t::getBoundingBox (void) const throw ()
 here the object must provide a bounding box.
 glut::lod_model_t::~lod_model_t (void) throw ()
void glut::lod_model_t::clear (void) throw ()
void glut::lod_model_t::render (const render_context_t &rc, RenderQueue *rq)
 this method is called to actually draw the object.
rect3d_t glut::lod_model_t::getBoundingBox (void) const throw ()
 here the object must provide a bounding box.
void glut::parseColor (std::istream &stream, img_color_t &color)
void glut::parseMaterial (std::istream &stream, const char *parentDir, material_t &material)
void glut::parsePolygon (MaterialRegistry *mreg, std::istream &stream, polygon_t &polygon)
void glut::parseModel (MaterialRegistry *mreg, std::istream &stream, model_t &model)
void glut::parseLodEntry (MaterialRegistry *mreg, std::istream &stream, lod_entry_t &entry)
void glut::parseLodModel (MaterialRegistry *mreg, std::istream &stream, lod_model_t &lod_model)
smart_ptr< MaterialRegistry > glut::getSimpleRegistry (const char *materialDir)
 get a simple implementation of a material registry.
smart_ptr< Renderable > glut::loadModel (const char *filename, MaterialRegistry *reg)
 load a model from a Wavepacket Glut Model file (.wgm extension, normally)
void glut::writeModelToStream (std::ostream &stream, const model_t &model)
 assumes you have already written the key name, this will write the opening and closing brackets

Variables

int glut::material_t::texture_id
 openGL texture if nonzero
bool glut::material_t::isTransparent
 does texture contain non-1 alpha?
glut_color_t glut::material_t::color
 use color if no texture ID
int glut::polygon_t::nVertices
 number of vertices in the polygon
int * glut::polygon_t::indices
 array of vertex indices
float * glut::polygon_t::u
 array of vertex texture u-coords
float * glut::polygon_t::v
 array of vertex texture v-coords
smart_ptr< material_t > glut::polygon_t::material
 material (texture etc)
point3d_t glut::polygon_t::normal
 polygon normal
int glut::model_t::nVertices
 number of vertices in model
point3d_tglut::model_t::vertices
 array of vertices
int glut::model_t::nPolygons
 number of polygons in model
polygon_t * glut::model_t::polygons
 array of polygons
rect3d_t glut::model_t::boundingBox
 bounding box
model_t glut::lod_entry_t::model
 model to use for this entry
float glut::lod_entry_t::distance
 distance at which to use model
int glut::lod_model_t::nEntries
 number of level-of-detail entries
lod_entry_t * glut::lod_model_t::entries
 array of level-of-detail entries
rect3d_t glut::lod_model_t::boundingBox
 bounding box

Detailed Description

A homegrown 3D model format.

This is a simple reference implementation of OpenGL-enabled 3D models.


Function Documentation

glut::material_t::~material_t ( void   )  throw () [inline, inherited]

Definition at line 71 of file glut-model.h.

void glut::material_t::clear ( void   )  throw () [inline, inherited]

Definition at line 72 of file glut-model.h.

virtual smart_ptr<material_t> glut::MaterialRegistry::getMaterial ( const char *  id  )  [pure virtual, inherited]
glut::polygon_t::~polygon_t ( void   )  throw () [inline, inherited]

Definition at line 111 of file glut-model.h.

void glut::polygon_t::clear ( void   )  throw () [inline, inherited]

Definition at line 112 of file glut-model.h.

glut::model_t::~model_t ( void   )  throw () [inline, inherited]

Definition at line 147 of file glut-model.h.

void glut::model_t::clear ( void   )  throw () [inline, inherited]

Definition at line 148 of file glut-model.h.

void glut::model_t::render ( const render_context_t rc,
RenderQueue rq 
) [virtual, inherited]

this method is called to actually draw the object.

The object can assume that all necessary transforms (translation, rotation, scaling, etc.) have already been applied. There is no default implementation since this method is the whole point of the interface!

Implements glut::Renderable.

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

rect3d_t glut::model_t::getBoundingBox ( void   )  const throw () [inline, virtual, inherited]

here the object must provide a bounding box.

This is a bounding box in model-relative coordinates, not world coordinates. So this bounding box does not depend on where the model is positioned or how it is rotated, for instance. There is no default implementation since an accurate bounding box is critical for performance when rendering.

Implements glut::Renderable.

Definition at line 164 of file glut-model.h.

glut::lod_model_t::~lod_model_t ( void   )  throw () [inline, inherited]

Definition at line 195 of file glut-model.h.

void glut::lod_model_t::clear ( void   )  throw () [inline, inherited]

Definition at line 196 of file glut-model.h.

void glut::lod_model_t::render ( const render_context_t rc,
RenderQueue rq 
) [virtual, inherited]

this method is called to actually draw the object.

The object can assume that all necessary transforms (translation, rotation, scaling, etc.) have already been applied. There is no default implementation since this method is the whole point of the interface!

Implements glut::Renderable.

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

rect3d_t glut::lod_model_t::getBoundingBox ( void   )  const throw () [inline, virtual, inherited]

here the object must provide a bounding box.

This is a bounding box in model-relative coordinates, not world coordinates. So this bounding box does not depend on where the model is positioned or how it is rotated, for instance. There is no default implementation since an accurate bounding box is critical for performance when rendering.

Implements glut::Renderable.

Definition at line 208 of file glut-model.h.

void glut::parseColor ( std::istream &  stream,
img_color_t color 
)

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

void glut::parseMaterial ( std::istream &  stream,
const char *  parentDir,
material_t &  material 
)

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

void glut::parsePolygon ( MaterialRegistry *  mreg,
std::istream &  stream,
polygon_t &  polygon 
)

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

void glut::parseModel ( MaterialRegistry *  mreg,
std::istream &  stream,
model_t &  model 
)

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

void glut::parseLodEntry ( MaterialRegistry *  mreg,
std::istream &  stream,
lod_entry_t &  entry 
)

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

void glut::parseLodModel ( MaterialRegistry *  mreg,
std::istream &  stream,
lod_model_t &  lod_model 
)

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

smart_ptr< MaterialRegistry > glut::getSimpleRegistry ( const char *  materialDir  ) 

get a simple implementation of a material registry.

Intended for testing only. Caller must provide root of material directory tree.

Definition at line 101 of file simple-registry.cpp.

smart_ptr< Renderable > glut::loadModel ( const char *  filename,
MaterialRegistry *  reg 
)

load a model from a Wavepacket Glut Model file (.wgm extension, normally)

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

void glut::writeModelToStream ( std::ostream &  stream,
const model_t &  model 
)

assumes you have already written the key name, this will write the opening and closing brackets

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


Variable Documentation

openGL texture if nonzero

Definition at line 81 of file glut-model.h.

does texture contain non-1 alpha?

Definition at line 82 of file glut-model.h.

use color if no texture ID

Definition at line 83 of file glut-model.h.

int glut::polygon_t::nVertices [inherited]

number of vertices in the polygon

Definition at line 130 of file glut-model.h.

int* glut::polygon_t::indices [inherited]

array of vertex indices

Definition at line 131 of file glut-model.h.

float* glut::polygon_t::u [inherited]

array of vertex texture u-coords

Definition at line 132 of file glut-model.h.

float* glut::polygon_t::v [inherited]

array of vertex texture v-coords

Definition at line 133 of file glut-model.h.

smart_ptr<material_t> glut::polygon_t::material [inherited]

material (texture etc)

Definition at line 134 of file glut-model.h.

polygon normal

Definition at line 135 of file glut-model.h.

int glut::model_t::nVertices [inherited]

number of vertices in model

Definition at line 167 of file glut-model.h.

array of vertices

Definition at line 168 of file glut-model.h.

int glut::model_t::nPolygons [inherited]

number of polygons in model

Definition at line 169 of file glut-model.h.

polygon_t* glut::model_t::polygons [inherited]

array of polygons

Definition at line 170 of file glut-model.h.

bounding box

Definition at line 171 of file glut-model.h.

model_t glut::lod_entry_t::model [inherited]

model to use for this entry

Definition at line 184 of file glut-model.h.

float glut::lod_entry_t::distance [inherited]

distance at which to use model

Definition at line 185 of file glut-model.h.

int glut::lod_model_t::nEntries [inherited]

number of level-of-detail entries

Definition at line 211 of file glut-model.h.

lod_entry_t* glut::lod_model_t::entries [inherited]

array of level-of-detail entries

Definition at line 212 of file glut-model.h.

bounding box

Definition at line 213 of file glut-model.h.