glm.c File Reference

#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <esg/parser/glm.h>

Go to the source code of this file.

Defines

#define T(x)   (model->triangles[(x)])

Typedefs

typedef _GLMnode GLMnode

Functions

static GLfloat glmMax (GLfloat a, GLfloat b)
static GLfloat glmAbs (GLfloat f)
static GLfloat glmDot (GLfloat *u, GLfloat *v)
static GLvoid glmCross (GLfloat *u, GLfloat *v, GLfloat *n)
static GLvoid glmNormalize (GLfloat *v)
static GLboolean glmEqual (GLfloat *u, GLfloat *v, GLfloat epsilon)
GLfloat * glmWeldVectors (GLfloat *vectors, GLuint *numvectors, GLfloat epsilon)
GLMgroupglmFindGroup (GLMmodel *model, char *name)
GLMgroupglmAddGroup (GLMmodel *model, char *name)
GLuint glmFindMaterial (GLMmodel *model, char *name)
static char * glmDirName (char *path)
static GLvoid glmReadMTL (GLMmodel *model, char *name)
static GLvoid glmWriteMTL (GLMmodel *model, char *modelpath, char *mtllibname)
static GLvoid glmFirstPass (GLMmodel *model, FILE *file)
static GLvoid glmSecondPass (GLMmodel *model, FILE *file)
GLfloat glmUnitize (GLMmodel *model)
GLvoid glmDimensions (GLMmodel *model, GLfloat *dimensions)
GLvoid glmScale (GLMmodel *model, GLfloat scale)
GLvoid glmReverseWinding (GLMmodel *model)
GLvoid glmFacetNormals (GLMmodel *model)
GLvoid glmVertexNormals (GLMmodel *model, GLfloat angle)
GLvoid glmLinearTexture (GLMmodel *model)
GLvoid glmSpheremapTexture (GLMmodel *model)
GLvoid glmDelete (GLMmodel *model)
GLMmodelglmReadOBJ (const char *filename)
GLvoid glmWriteOBJ (GLMmodel *model, char *filename, GLuint mode)
GLvoid glmDraw (GLMmodel *model, GLuint mode)
GLuint glmList (GLMmodel *model, GLuint mode)
GLvoid glmWeld (GLMmodel *model, GLfloat epsilon)


Define Documentation

#define T  )     (model->triangles[(x)])
 

Definition at line 23 of file glm.c.

Referenced by glmDraw(), glmFacetNormals(), glmReverseWinding(), glmSecondPass(), glmVertexNormals(), and glmWeld().


Typedef Documentation

typedef struct _GLMnode GLMnode
 


Function Documentation

static GLfloat glmAbs GLfloat  f  )  [static]
 

Definition at line 46 of file glm.c.

Referenced by glmEqual(), and glmLinearTexture().

GLMgroup* glmAddGroup GLMmodel model,
char *  name
 

Definition at line 183 of file glm.c.

References glmFindGroup(), _GLMmodel::groups, _GLMgroup::material, _GLMgroup::name, _GLMgroup::next, _GLMmodel::numgroups, _GLMgroup::numtriangles, and _GLMgroup::triangles.

Referenced by glmFirstPass().

static GLvoid glmCross GLfloat *  u,
GLfloat *  v,
GLfloat *  n
[static]
 

Definition at line 73 of file glm.c.

Referenced by glmFacetNormals().

GLvoid glmDelete GLMmodel model  ) 
 

Definition at line 1269 of file glm.c.

References _GLMmodel::facetnorms, _GLMmodel::groups, _GLMmodel::materials, _GLMmodel::mtllibname, _GLMgroup::name, _GLMmaterial::name, _GLMgroup::next, _GLMmodel::normals, _GLMmodel::nummaterials, _GLMmodel::pathname, _GLMmodel::texcoords, _GLMgroup::triangles, _GLMmodel::triangles, and _GLMmodel::vertices.

GLvoid glmDimensions GLMmodel model,
GLfloat *  dimensions
 

Definition at line 838 of file glm.c.

References _GLMmodel::numvertices, and _GLMmodel::vertices.

Referenced by glmLinearTexture().

static char* glmDirName char *  path  )  [static]
 

Definition at line 233 of file glm.c.

Referenced by glmReadMTL(), and glmWriteMTL().

static GLfloat glmDot GLfloat *  u,
GLfloat *  v
[static]
 

Definition at line 59 of file glm.c.

GLvoid glmDraw GLMmodel model,
GLuint  mode
 

Definition at line 1580 of file glm.c.

References _GLMmaterial::ambient, _GLMmaterial::diffuse, _GLMmodel::facetnorms, _GLMtriangle::findex, GLM_COLOR, _GLMmodel::groups, _GLMgroup::material, _GLMmodel::materials, _GLMgroup::next, _GLMtriangle::nindices, _GLMmodel::normals, _GLMgroup::numtriangles, _GLMmaterial::shininess, _GLMmaterial::specular, T, _GLMmodel::texcoords, _GLMtriangle::tindices, _GLMgroup::triangles, _GLMmodel::vertices, and _GLMtriangle::vindices.

Referenced by glmList().

static GLboolean glmEqual GLfloat *  u,
GLfloat *  v,
GLfloat  epsilon
[static]
 

Definition at line 107 of file glm.c.

References glmAbs().

Referenced by glmWeldVectors().

GLvoid glmFacetNormals GLMmodel model  ) 
 

Definition at line 944 of file glm.c.

References _GLMmodel::facetnorms, _GLMtriangle::findex, glmCross(), glmNormalize(), _GLMmodel::numfacetnorms, _GLMmodel::numtriangles, T, _GLMmodel::triangles, and _GLMmodel::vertices.

Referenced by MayaParser::_init_model().

GLMgroup* glmFindGroup GLMmodel model,
char *  name
 

Definition at line 164 of file glm.c.

References _GLMmodel::groups, _GLMgroup::name, and _GLMgroup::next.

Referenced by glmAddGroup(), and glmSecondPass().

GLuint glmFindMaterial GLMmodel model,
char *  name
 

Definition at line 205 of file glm.c.

References _GLMmodel::materials, _GLMmaterial::name, and _GLMmodel::nummaterials.

Referenced by glmSecondPass().

static GLvoid glmFirstPass GLMmodel model,
FILE *  file
[static]
 

Definition at line 438 of file glm.c.

References glmAddGroup(), glmReadMTL(), _GLMmodel::groups, _GLMmodel::mtllibname, _GLMgroup::next, _GLMmodel::numnormals, _GLMmodel::numtexcoords, _GLMmodel::numtriangles, _GLMgroup::numtriangles, _GLMmodel::numvertices, and _GLMgroup::triangles.

Referenced by glmReadOBJ().

GLvoid glmLinearTexture GLMmodel model  ) 
 

Definition at line 1157 of file glm.c.

References glmAbs(), glmDimensions(), glmMax(), _GLMmodel::numtexcoords, _GLMmodel::numvertices, _GLMmodel::texcoords, and _GLMmodel::vertices.

GLuint glmList GLMmodel model,
GLuint  mode
 

Definition at line 1696 of file glm.c.

References glmDraw().

static GLfloat glmMax GLfloat  a,
GLfloat  b
[static]
 

Definition at line 37 of file glm.c.

Referenced by glmLinearTexture().

static GLvoid glmNormalize GLfloat *  v  )  [static]
 

Definition at line 87 of file glm.c.

Referenced by glmFacetNormals().

static GLvoid glmReadMTL GLMmodel model,
char *  name
[static]
 

Definition at line 256 of file glm.c.

References _GLMmaterial::ambient, _GLMmaterial::diffuse, glmDirName(), _GLMmodel::materials, _GLMmaterial::name, _GLMmodel::nummaterials, _GLMmodel::pathname, _GLMmaterial::shininess, and _GLMmaterial::specular.

Referenced by glmFirstPass().

GLMmodel* glmReadOBJ const char *  filename  ) 
 

Definition at line 1306 of file glm.c.

References _GLMmodel::facetnorms, glmFirstPass(), glmSecondPass(), _GLMmodel::groups, _GLMmodel::materials, _GLMmodel::mtllibname, _GLMmodel::normals, _GLMmodel::numfacetnorms, _GLMmodel::numgroups, _GLMmodel::nummaterials, _GLMmodel::numnormals, _GLMmodel::numtexcoords, _GLMmodel::numtriangles, _GLMmodel::numvertices, _GLMmodel::pathname, _GLMmodel::position, _GLMmodel::texcoords, _GLMmodel::triangles, and _GLMmodel::vertices.

Referenced by MayaParser::MayaParser().

GLvoid glmReverseWinding GLMmodel model  ) 
 

Definition at line 898 of file glm.c.

References _GLMmodel::numnormals, _GLMmodel::numtexcoords, _GLMmodel::numtriangles, swap, and T.

GLvoid glmScale GLMmodel model,
GLfloat  scale
 

Definition at line 880 of file glm.c.

References _GLMmodel::numvertices, and _GLMmodel::vertices.

static GLvoid glmSecondPass GLMmodel model,
FILE *  file
[static]
 

Definition at line 578 of file glm.c.

References glmFindGroup(), glmFindMaterial(), _GLMmodel::groups, _GLMgroup::material, _GLMmodel::normals, _GLMgroup::numtriangles, T, _GLMmodel::texcoords, _GLMgroup::triangles, and _GLMmodel::vertices.

Referenced by glmReadOBJ().

GLvoid glmSpheremapTexture GLMmodel model  ) 
 

Definition at line 1212 of file glm.c.

References _GLMmodel::normals, _GLMmodel::numnormals, _GLMmodel::numtexcoords, and _GLMmodel::texcoords.

Referenced by MayaParser::_init_model().

GLfloat glmUnitize GLMmodel model  ) 
 

Definition at line 774 of file glm.c.

References _GLMmodel::numvertices, and _GLMmodel::vertices.

Referenced by MayaParser::_init_model().

GLvoid glmVertexNormals GLMmodel model,
GLfloat  angle
 

Definition at line 1001 of file glm.c.

References _GLMmodel::facetnorms, M_PI, _GLMmodel::normals, _GLMmodel::numnormals, _GLMmodel::numtriangles, _GLMmodel::numvertices, and T.

Referenced by MayaParser::_init_model().

GLvoid glmWeld GLMmodel model,
GLfloat  epsilon
 

Definition at line 1717 of file glm.c.

References glmWeldVectors(), _GLMmodel::numtriangles, _GLMmodel::numvertices, T, and _GLMmodel::vertices.

GLfloat* glmWeldVectors GLfloat *  vectors,
GLuint *  numvectors,
GLfloat  epsilon
 

Definition at line 127 of file glm.c.

References glmEqual().

Referenced by glmWeld().

static GLvoid glmWriteMTL GLMmodel model,
char *  modelpath,
char *  mtllibname
[static]
 

Definition at line 383 of file glm.c.

References _GLMmaterial::ambient, _GLMmaterial::diffuse, glmDirName(), _GLMmodel::materials, _GLMmaterial::name, _GLMmodel::nummaterials, _GLMmaterial::shininess, and _GLMmaterial::specular.

Referenced by glmWriteOBJ().

GLvoid glmWriteOBJ GLMmodel model,
char *  filename,
GLuint  mode
 

Definition at line 1386 of file glm.c.

References _GLMmodel::facetnorms, GLM_COLOR, GLM_FLAT, GLM_MATERIAL, GLM_SMOOTH, GLM_TEXTURE, glmWriteMTL(), _GLMmodel::materials, _GLMmodel::mtllibname, _GLMmodel::normals, _GLMmodel::numvertices, _GLMmodel::texcoords, and _GLMmodel::vertices.


Generated on Wed Jun 28 12:24:33 2006 for esg by  doxygen 1.4.6