Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | File Members

MiniMesh Class Reference

minimal mesh structure, optimized for md2 models incl. animation More...

#include <MiniMesh.h>

Collaboration diagram for MiniMesh:

Collaboration graph
[legend]
List of all members.

Public Types

typedef std::vector< Vertex * > VertexList
typedef std::vector< Vertex
* >::iterator 
VertexListIterator
typedef std::vector< MiniFace * > FaceList
typedef std::vector< MiniFace
* >::iterator 
FaceListIterator
typedef std::vector< UVCoord * > UVCoordList
typedef std::vector< UVCoord
* >::iterator 
UVCoordListIterator
typedef std::vector< Vertex * > VertexNormalList
typedef std::vector< Vertex
** >::iterator 
VertexNormalListIterator
typedef std::vector< VertexList * > FrameList

Public Member Functions

 MiniMesh (void)
 constructor
virtual ~MiniMesh (void)
 destructor
void setFrameCount (int frameCount)
 add the needed empty frames to the framelist
int addVertex (float x, float y, float z, int frame=0)
 add a vertex to a specific frame
void setVertexNormal (int indexVertex, int indexNormal, int frame=0)
 set the vertex normal for a specified vertex and a specific frame
int addFace (int v1, int v2, int v3)
 add a face to the facelist taking three indices of vertices (counter-clockwise direction)
int addUVCoord (float u, float v)
 add a UVCoordinate to the UVCoordList
int addVertexNormal (float x, float y, float z)
 add a vertex normal to the vertexnormallist
void addFaceNormal (int face, float x, float y, float z)
 add a face normal to the facenormalList
void setTexCoordsForFace (int face, int stelle, int uvIndex)
 set the texture coordinates for a specific vertex of a face
size_t getVertexCount ()
size_t getFaceCount ()
size_t getUVCoordCount ()
size_t getVertexNormalCount ()
size_t getFrameCount ()
VertexgetVertex (int stelle, int frame)
 get a pointer to the vertex at a specific frame at a specific position in the vertex list
MiniFacegetFace (int stelle)
 get a pointer to the face at a specific index in the face list
UVCoordgetUVCoord (int stelle)
 get a pointer to uv coordinates at a specific index in the uv list
VertexgetVertexNormals (int stelle, int frame)
 get a pointer to the vertex normals of a vertex at a specific frame
VertexgetFaceNormals (int faceIndex)
 get a pointer to the face normals of a face
void createDisplayListFrame0 ()
void flipYUV ()
 flip the y-coordinate of the uv-coordinates
void doubleSided (bool)
 make the mesh doublesided
void showNormals (bool)
 show the normals or not
void switchTextureOnOff ()
void computeFaceNormals (int frameNumber=0)
 compute the face normals at a specific frame framenumber
void computeAllFaceNormals ()
void computeVertexNormals (int frameNumber=0)
void computeAllVertexNormals ()
void init ()
 initialize the minimesh, create display list for static objects, print useful information
void render ()
 call rendering method for static meshes and animated meshes
void playAnimation (bool)
 start/stop the animation
void setFrameRate (float newFrameRate)
 set the framerate of the animation
void getNextFrame ()
 get the next frame of the animation
void jumpToFrame (int framenumber)
 jump to a specific frame of the animation
void setTextureCount (int textureCount)
 set the number of textures for this mesh
void stopAnim ()
void startAnim ()

Public Attributes

unsigned int playFrame
FrameList frames
MotionmPtr

Private Member Functions

void prepareAnim (int framenumber)
 write necessary openGL commands to render an animated mesh, kann momentan nur EINE textur
void renderStatic ()
 write necessary openGL commands to render a static mesh
void renderAnim ()
 render the animated mesh

Private Attributes

bool stop
float frameInt
VertexList Frame0
FaceList fList
UVCoordList uvList
VertexNormalList vNormalList
std::vector< UINT32 > displayAnim
bool texture
bool faceNormals
bool showN
bool doubleS
bool flipY_UV
bool playAnim
float frameInterpolator
float frameRate
int textures
unsigned int meshListID

Detailed Description

minimal mesh structure, optimized for md2 models incl. animation

minimal mesh structure, optimized for md2 models incl. animation. supports only triangles. allows to set, get and render vertices, faces, texture coordinates, face normals and vertex normals. Also supports more frames and allows to jump to a specific frame or to the next frame


Member Typedef Documentation

typedef std::vector<MiniFace*> MiniMesh::FaceList
 

typedef std::vector<MiniFace*>::iterator MiniMesh::FaceListIterator
 

typedef std::vector<VertexList*> MiniMesh::FrameList
 

typedef std::vector<UVCoord*> MiniMesh::UVCoordList
 

typedef std::vector<UVCoord*>::iterator MiniMesh::UVCoordListIterator
 

typedef std::vector<Vertex*> MiniMesh::VertexList
 

typedef std::vector<Vertex*>::iterator MiniMesh::VertexListIterator
 

typedef std::vector<Vertex*> MiniMesh::VertexNormalList
 

typedef std::vector<Vertex**>::iterator MiniMesh::VertexNormalListIterator
 


Constructor & Destructor Documentation

MiniMesh::MiniMesh void   ) 
 

constructor

MiniMesh::~MiniMesh void   )  [virtual]
 

destructor


Member Function Documentation

int MiniMesh::addFace int  v1,
int  v2,
int  v3
 

add a face to the facelist taking three indices of vertices (counter-clockwise direction)

Parameters:
index of the first vertex
index of the second vertex
index of the third vertex
Returns:
index of the face in the facelist

void MiniMesh::addFaceNormal int  face,
float  x,
float  y,
float  z
 

add a face normal to the facenormalList

Parameters:
index of the face in the facelist to which the normal should be added
x-coordinate of the face normal
y-coordinate of the face normal
z-coordinate of the face normal

int MiniMesh::addUVCoord float  u,
float  v
 

add a UVCoordinate to the UVCoordList

Parameters:
u-coordinate of the texture coordinates
v-coordinate of the texture coordinates
Returns:
index of the added uv-coordinate in the UVCoordList

int MiniMesh::addVertex float  x,
float  y,
float  z,
int  frame = 0
 

add a vertex to a specific frame

Parameters:
x-coordinate of the vertex
y-coordinate of the vertex
z-coordinate of the vertex
frame in which the vertex should be added
Returns:
index of the vertexlist for the added vertex

int MiniMesh::addVertexNormal float  x,
float  y,
float  z
 

add a vertex normal to the vertexnormallist

Parameters:
x-coordinate of the vertex normal
y-coordinate of the vertex normal
z-coordinate of the vertex normal
Returns:
index of the added vertex-normal in the vertexnoramlList

void MiniMesh::computeAllFaceNormals  ) 
 

void MiniMesh::computeAllVertexNormals  ) 
 

void MiniMesh::computeFaceNormals int  frameNumber = 0  ) 
 

compute the face normals at a specific frame framenumber

void MiniMesh::computeVertexNormals int  frameNumber = 0  ) 
 

void MiniMesh::createDisplayListFrame0  ) 
 

void MiniMesh::doubleSided bool  sided  ) 
 

make the mesh doublesided

Parameters:
true-doublesided,false otherwise

void MiniMesh::flipYUV  ) 
 

flip the y-coordinate of the uv-coordinates

MiniMesh::MiniFace * MiniMesh::getFace int  stelle  ) 
 

get a pointer to the face at a specific index in the face list

Parameters:
index of the face in the face list
Returns:
pointer to the face

size_t MiniMesh::getFaceCount  )  [inline]
 

Vertex * MiniMesh::getFaceNormals int  faceIndex  ) 
 

get a pointer to the face normals of a face

Parameters:
index of the face in the index list
Returns:
pointer to the vertex

size_t MiniMesh::getFrameCount  )  [inline]
 

void MiniMesh::getNextFrame  ) 
 

get the next frame of the animation

MiniMesh::UVCoord * MiniMesh::getUVCoord int  stelle  ) 
 

get a pointer to uv coordinates at a specific index in the uv list

Parameters:
index of the uv coordinates in the UVCoordList
Returns:
pointer to uv coordinates

size_t MiniMesh::getUVCoordCount  )  [inline]
 

Vertex * MiniMesh::getVertex int  stelle,
int  frame
 

get a pointer to the vertex at a specific frame at a specific position in the vertex list

Parameters:
index of the vertex in the vertex list
framenumber 
Returns:
pointer to the vertex

size_t MiniMesh::getVertexCount  )  [inline]
 

size_t MiniMesh::getVertexNormalCount  )  [inline]
 

Vertex * MiniMesh::getVertexNormals int  stelle,
int  frame
 

get a pointer to the vertex normals of a vertex at a specific frame

Parameters:
index of the vertex in the vertex list
framenumber 
Returns:
pointer to the vertex normals

void MiniMesh::init  ) 
 

initialize the minimesh, create display list for static objects, print useful information

void MiniMesh::jumpToFrame int  framenumber  ) 
 

jump to a specific frame of the animation

Parameters:
framenumber of the target frame

void MiniMesh::playAnimation bool  play  ) 
 

start/stop the animation

Parameters:
true - play the animation of the model, false - stop

void MiniMesh::prepareAnim int  framenumber  )  [private]
 

write necessary openGL commands to render an animated mesh, kann momentan nur EINE textur

void MiniMesh::render  ) 
 

call rendering method for static meshes and animated meshes

void MiniMesh::renderAnim  )  [private]
 

render the animated mesh

void MiniMesh::renderStatic  )  [private]
 

write necessary openGL commands to render a static mesh

void MiniMesh::setFrameCount int  frameCount  ) 
 

add the needed empty frames to the framelist

Parameters:
number of frames of the model

void MiniMesh::setFrameRate float  newFr  ) 
 

set the framerate of the animation

Parameters:
new framerate

void MiniMesh::setTexCoordsForFace int  face,
int  stelle,
int  uvIndex
 

set the texture coordinates for a specific vertex of a face

Parameters:
index of the face in the face list
position of the vertex in the face (0-2)
index of the uv coordinates in the UVCoordList

void MiniMesh::setTextureCount int  textureCount  ) 
 

set the number of textures for this mesh

Parameters:
number of textures

void MiniMesh::setVertexNormal int  indexVertex,
int  indexNormal,
int  frame = 0
 

set the vertex normal for a specified vertex and a specific frame

Parameters:
index of the vertex in the indexlist
index of the normal in the normallist
frame in which the vertexnormal should be set

void MiniMesh::showNormals bool  s  ) 
 

show the normals or not

Parameters:
true if normals should be shown, false otherwise

void MiniMesh::startAnim  )  [inline]
 

void MiniMesh::stopAnim  )  [inline]
 

void MiniMesh::switchTextureOnOff  ) 
 


Member Data Documentation

std::vector<UINT32> MiniMesh::displayAnim [private]
 

bool MiniMesh::doubleS [private]
 

bool MiniMesh::faceNormals [private]
 

bool MiniMesh::flipY_UV [private]
 

FaceList MiniMesh::fList [private]
 

VertexList MiniMesh::Frame0 [private]
 

float MiniMesh::frameInt [private]
 

float MiniMesh::frameInterpolator [private]
 

float MiniMesh::frameRate [private]
 

FrameList MiniMesh::frames
 

unsigned int MiniMesh::meshListID [private]
 

Motion* MiniMesh::mPtr
 

bool MiniMesh::playAnim [private]
 

unsigned int MiniMesh::playFrame
 

bool MiniMesh::showN [private]
 

bool MiniMesh::stop [private]
 

bool MiniMesh::texture [private]
 

int MiniMesh::textures [private]
 

UVCoordList MiniMesh::uvList [private]
 

VertexNormalList MiniMesh::vNormalList [private]
 


The documentation for this class was generated from the following files:
Generated on Mon Jan 24 17:42:33 2005 for Loud and Proud by doxygen 1.3.8