golib  0.5
goGL::MeshObject Class Reference

A mesh object for OpenGL. More...

#include <meshobject.h>

Public Member Functions

 MeshObject (const MeshObject &o)
 
MeshObjectoperator= (const MeshObject &o)
 
virtual bool operator() () const
 Calls everything necessary for OpenGL to draw this object. More...
 
virtual bool draw () const
 
virtual bool init ()
 Calculate normals, create display list. More...
 
goAutoPtr< goVectorfgetMin () const
 Get the minimum coordinates of all vertices. More...
 
goAutoPtr< goVectorfgetMax () const
 Get the maximum coordinates of all vertices. More...
 
goMatrixf & getVertices ()
 Get the matrix with the vertices of this object. More...
 
goFixedArray< goVector< int > > & getFaces ()
 Get the faces of this object. More...
 
const goMatrixf & getVertices () const
 See non-const version.
 
const goFixedArray< goVector< int > > & getFaces () const
 See non-const version.
 
void getAdjacencyLists (goFixedArray< goList< int > > &ret) const
 Build adjacency lists for all vertices of this object. More...
 
void getAdjacentFaces (goFixedArray< goList< int > > &ret) const
 For each vertex, compute the list of faces it is contained in. More...
 
goMatrixf & getNormals ()
 
goMatrixf & getFaceNormals ()
 
const goMatrixf & getNormals () const
 
const goMatrixf & getFaceNormals () const
 
void calculateNormals ()
 
void calculateNormals (goMatrixf &normals, goMatrixf &face_normals) const
 Calculate normals for all vertices and faces. More...
 
void calculateFaceNormals (goMatrixf &face_normals) const
 Calculate a normal for each face. More...
 
bool removeDoubles ()
 Searches for faces containing double vertices and and removes the bad faces. More...
 
void setFilename (const char *filename)
 Set a filename that will be stored with writeASCII(). More...
 
const char * getFilename () const
 Get the filename that will be stored with writeASCII().
 
virtual bool writeASCII (FILE *f) const
 
virtual bool readASCII (FILE *f)
 
- Public Member Functions inherited from goGL::DrawableObject
virtual bool setRenderParameters () const
 Sets lighting and shade model. More...
 
void setMaterial (const goGL::Material &mat)
 
goGL::MaterialgetMaterial ()
 
const goGL::MaterialgetMaterial () const
 
void setLighting (bool l)
 
void setShadeModel (GLenum m)
 
bool getLighting () const
 
GLenum getShadeModel () const
 
bool toList (int listName)
 
DrawableObjectoperator= (const DrawableObject &o)
 
- Public Member Functions inherited from goGL::Object
 Object (const Object &o)
 
Objectoperator= (const Object &o)
 
void setRotation (goFloat angle, goFloat x, goFloat y, goFloat z)
 
void setRotation (const goVectorf &r)
 
void setRotation (goFloat angle, const goVectorf &n)
 
void setScale (goFloat x, goFloat y, goFloat z)
 
void setScale (const goVectorf &t)
 
void setTranslation (goFloat x, goFloat y, goFloat z)
 
void setTranslation (const goVectorf &t)
 
const goVectorfgetRotation () const
 
const goVectorfgetScale () const
 
const goVectorfgetTranslation () const
 
virtual bool writeASCII (const char *filename) const
 
virtual bool readASCII (const char *filename)
 
- Public Member Functions inherited from goObjectBase
 goObjectBase ()
 Constructor.
 
virtual ~goObjectBase ()
 Destructor. More...
 
const char * getClassName () const
 Returns the class name. More...
 
int getClassID () const
 
virtual goSize_t memoryUsage () const
 Returns the size of this object or some measure of its memory consumption. More...
 
void setObjectName (const char *name)
 Set name string for an object. More...
 
void setObjectName (const goString &name)
 Set name string for an object. More...
 
const goStringgetObjectName () const
 Get the object name. More...
 
virtual bool writeObjectFile (FILE *) const
 Write object to a file. More...
 
virtual bool readObjectFile (FILE *)
 Read object from a file. More...
 
void connectObject (goObjectBase *object)
 Connects an object to this object. More...
 
void disconnectObject (const goObjectBase *object)
 Disconnects an object from this object.
 
virtual bool callObjectMethod (int methodID, goObjectMethodParameters *param=NULL)
 Call an object method by identifier. More...
 
virtual bool queueObjectMethod (int methodID, goObjectMethodParameters *param=NULL, bool blocking=false)
 Enqueue a method call to an internal list of methods. More...
 
bool callQueuedMethods ()
 Call all queued methods. More...
 

Additional Inherited Members

- Protected Member Functions inherited from goGL::DrawableObject
 DrawableObject (const DrawableObject &o)
 
- Protected Member Functions inherited from goObjectBase
void setClassID (int id)
 Sets the class name.
 
void printClassMessage (const char *msg)
 Sets the class name. More...
 
void printClassMessage (goString &msg)
 Prints an informational message to the calling console. More...
 
void sendObjectMessage (int messageID, void *data=NULL)
 Sends a message to all connected objects.
 
void sendObjectMessage (goObjectBase *object, int messageID, void *data=NULL)
 Sends a message to a specific object.
 
virtual void receiveObjectMessage (const goObjectMessage &message)
 Receive a message. More...
 

Detailed Description

A mesh object for OpenGL.

Member Function Documentation

◆ calculateFaceNormals()

void goGL::MeshObject::calculateFaceNormals ( goMatrixf &  face_normals) const

Calculate a normal for each face.

Parameters
face_normalsContains the face normals, on return.

◆ calculateNormals()

void goGL::MeshObject::calculateNormals ( goMatrixf &  normals,
goMatrixf &  face_normals 
) const

Calculate normals for all vertices and faces.

Parameters
normalsNormals for each vertex.
face_normalsNormals for each face.

◆ getAdjacencyLists()

void goGL::MeshObject::getAdjacencyLists ( goFixedArray< goList< int > > &  ret) const

Build adjacency lists for all vertices of this object.

◆ getAdjacentFaces()

void goGL::MeshObject::getAdjacentFaces ( goFixedArray< goList< int > > &  ret) const

For each vertex, compute the list of faces it is contained in.

Parameters
retFor each vertex, contains the list of faces the vertex is contained in.

◆ getFaces()

goFixedArray< goVector< int > > & goGL::MeshObject::getFaces ( )

Get the faces of this object.

Returns
Array containing the indices of vertices for each face.

◆ getMax()

goAutoPtr< goVectorf > goGL::MeshObject::getMax ( ) const

Get the maximum coordinates of all vertices.

Returns
goVectorf pointer, containing the maximum coordinates.

◆ getMin()

goAutoPtr< goVectorf > goGL::MeshObject::getMin ( ) const

Get the minimum coordinates of all vertices.

Returns
goVectorf pointer, containing the minimum coordinates.

◆ getVertices()

goMatrixf & goGL::MeshObject::getVertices ( )

Get the matrix with the vertices of this object.

Returns
Matrix containing a vertex per row.

◆ init()

bool goGL::MeshObject::init ( )
virtual

Calculate normals, create display list.

Returns
True if successful, false otherwise.

Implements goGL::DrawableObject.

◆ operator()()

bool goGL::MeshObject::operator() ( ) const
virtual

Calls everything necessary for OpenGL to draw this object.

Returns
True if successful, false otherwise.

Implements goGL::DrawableObject.

◆ removeDoubles()

bool goGL::MeshObject::removeDoubles ( )

Searches for faces containing double vertices and and removes the bad faces.

Returns
True if successful, false otherwise.

◆ setFilename()

void goGL::MeshObject::setFilename ( const char *  filename)

Set a filename that will be stored with writeASCII().

Parameters
filename

The documentation for this class was generated from the following files: