pfMesh(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages pfMesh(3pf)NAMEpfMesh - Keeps track of topology of an object
FUNCTION SPECIFICATION
#include <Performer/pf/pfMesh.h>
pfMesh * pfMesh::pfMesh();
void pfMesh::setFlags(int which, int value);
int pfMesh::getFlags(int which);
void pfMesh::setVal(int which, float val);
void pfMesh::getVal(int which, float *val);
void pfMesh::setAttr(int which, void *attr);
void pfMesh::getAttr(int which, void **attr);
int pfMesh::getNumVertices(void);
void pfMesh::setNumVertices(int num);
pfMeshVertex * pfMesh::getVertex(int i);
pfVec3 * pfMesh::getVertexCoords(int i);
int pfMesh::getEdgeType(int v, int v1);
int pfMesh::getNumFaces(void);
void pfMesh::setNumFaces(int num);
void pfMesh::addGeoSet(pfGeoSet *gset, int currentPart,
pfMatrix *xform);
int pfMesh::addTriangle(pfVec3 *v1, pfVec3 *v2, pfVec3 *v3,
pfMatrix *xform, int part, pfGeoState *gstate);
int pfMesh::addFace(pfVec3 **verts, int num,
pfMatrix *xform, int part, pfGeoState *gstate);
void pfMesh::getTriangle(int t, int *v1, int *v2, int *v3);
pfMeshFace * pfMesh::getFace(int t);
pfBox * pfMesh::getBBox(void);
void pfMesh::setBBox(pfBox *b);
Page 1
pfMesh(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages pfMesh(3pf)
pfSphere * pfMesh::getGridBsphere(void);
void pfMesh::setGridBsphere(pfSphere *b);
void pfMesh::splitVertices(void);
void pfMesh::updateMesh(void);
PARENT CLASS FUNCTIONS
The OpenGL Performer class pfMesh is derived from the parent class
pfObject, so each of these member functions of class pfObject are also
directly usable with objects of class pfMesh. This is also true for
ancestor classes of class pfObject.
void* pfObject::operator new(size_t);
void* pfObject::operator new(size_t, pfFluxMemory *fmem);
void pfObject::setUserData(void *data);
void pfObject::setUserData(int slot, void *data);
void* pfObject::getUserData(pfObject *obj);
void* pfObject::getUserData(pfObject *obj, int slot);
int pfObject::getNumUserData();
Since the class pfObject is itself derived from the parent class
pfMemory, objects of class pfMesh can also be used with these functions
designed for objects of class pfMemory.
void* pfMemory::getData(const void *ptr);
pfType * pfMemory::getType();
int pfMemory::isOfType(pfType *type);
int pfMemory::isExactType(pfType *type);
const char * pfMemory::getTypeName();
int pfMemory::copy(pfMemory *src);
int pfMemory::compare(const pfMemory *mem);
void pfMemory::print(uint which, uint verbose, char *prefix,
FILE *file);
int pfMemory::getArena(void *ptr);
void* pfMemory::getArena();
int pfMemory::ref();
int pfMemory::unref();
int pfMemory::unrefDelete();
int pfMemory::unrefGetRef();
int pfMemory::getRef();
int pfMemory::checkDelete();
int pfMemory::isFluxed();
void * pfMemory::getArena();
int pfMemory::getSize();
DESCRIPTION
A pfMesh is a high level OpenGL Performer class, it is derived from a
pfObject for memory allocation purposes. A pfMesh is used to store the
information about a topology of an object. A pfMesh stores the object as
Page 2
pfMesh(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages pfMesh(3pf)
a collection of pfMeshVertices and flat pfMeshFaces (these two classes
are described their corresponding man pages). It is possible to query the
mesh to determine the information about neighbors of a given vertex or a
face. This information is required by various algorithms, for example,
for evaluating subdivision surfaces or for simplification of objects.
You can build a pfMesh for a given object in several ways. First, you
can use the function pfdAffNodeToMesh that parses a given node and adds
all its geometry to the mesh. Second, you can write your own traverser
and for each pfGeoSet you can call the function pfMesh::addGeoSet.
Third, you can call the function pfMesh::addTriangle or pfMesh::addFace
and add each face separately. Fourth, in case you would like to have
full control over the topology stored in the pfMesh you can directly set
the array of faces and vertices. To do that you can create the
corresponding arrays by calling pfMesh::setNumFaces and
pfMesh::setNumVertices and then set each face and vertex separately. You
can get the pointer to the array item by calling the function
pfMesh::getVertex and pfMesh::getFace, respectively.
When using function pfMesh::addGeoSet you can specify the pfGeoSet, the
number of a mesh part and the current transformation. The information
about parts can be used to mark edges. Each edge is automatically marked
as
PFM_EDGE_NORMAL edge with two adjacent faces.
+PFM_EDGE_BOUNDARY edge with one adjacent face to the left of the
edge -PFM_EDGE_BOUNDARY edge with one adjacent
face to the right of the edge
PFM_EDGE_SPLIT edge with more than one adjacent face (it can
happen in case of non-manifold surfaces).
You can mark edges between different parts as PFM_EDGE_CREASE, if flag
PFM_FLAG_CREASES_BETWEEN_PARTS is set (see below). Note, that also edges
between faces with different pfGeoState are usually marked as creases.
The part index and the transformation is also provided to functions
pfMesh::addTriangle and pfMesh::addFace. In addition, you need to set
also the pfGeoState of the triangle or face.
When setting vertices and faces directly and accessing them through a
pointer you need to set all vertex and face parameters. See man page for
pfMeshFace and pfMeshVertex.
The function pfMesh::splitVertices has to be called after all vertices
are set, regardless which of the four methods is used. This functions
performs extra post-processing that cleans the mesh in cases the object
is not a manifold (see man page for pfMeshVertex for more details).
The following flags can be set to 0 or 1:
Page 3
pfMesh(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages pfMesh(3pf)
PFM_FLAG_TRIANGULATE if this flag is set quads and polygon
processed in pfMesh::addGeoSet are
triangulated. Used, for example, for Loop
subdivision. It is off by default.
PFM_FLAG_TEST_ORIENTATION
if set the normal at the first vertex of a
face is compared with the face normal and
if they point in the opposite directions
the order of vertices is is changed. Off by
default.
PFM_FLAG_CREASES_BETWEEN_PARTS
automatically mark edges between different
parts as creases. On by default.
PFM_FLAG_CREASES_BETWEEN_GEOSTATES
automatically mark edges between pfGeoSets
with different pfGeoStates. On by default.
PFM_FLAG_QUAD_TSTRIPS if set set triangle strips processed in
pfMesh::addGeoSet are converted to quads,
even if the quads are not planar. Off by
default.
PFM_FLAG_USE_VERTEX_GRID if set a grid is used when adding faces and
checking for existing vertices. You have
to set the bounding sphere of the mesh to
be able to used the grid
pfMesh::setGridBsphere. Off by default.
The following values can be set:
PFM_EPSILON the epsilon is used when comparing vertices.
The default is 1e-6 or if the grid is
defined, 1e-6 multiplied by a ratio of grid
diameter to grid resolution along x axis.
PFM_VERTEX_GRID_SIZE_X
PFM_VERTEX_GRID_SIZE_Y
PFM_VERTEX_GRID_SIZE_Z
Page 4
pfMesh(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages pfMesh(3pf)
PFM_VERTEX_GRID_SIZE set the resolution of the grid used for
comparing vertices. Either one value at the
time, or all three at once. The default
grid size is 32x32x32.
You can also query the bounding box of the mesh using pfMesh::getBBox.
This bounding box is computed automatically around the mesh vertices.
You can use the function pfMesh::updateMesh to automatically detect which
vertices have been changed and marked them and the corresponding faces.
This can be used in case of dynamic control meshes (see man page for
pfSubdivSurface for an example). Since each vertex stores both the
pointer to the original vertex location and the vertex coordinates any
changes can be easily detected by comparing these values.
SEE ALSO
pfMeshFace, pfMeshVertex, pfdAddNodeToMesh, pfSubdivSurface, pfObject,
pfNode
Page 5