pfGeode(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages pfGeode(3pf)NAMEpfGeode - Create, modify, and query a geometry node.
FUNCTION SPECIFICATION
#include <Performer/pf/pfGeode.h>
pfGeode::pfGeode();
static pfType * pfGeode::getClassType(void);
int pfGeode::addGSet(pfGeoSet* gset);
int pfGeode::removeGSet(pfGeoSet* gset);
int pfGeode::insertGSet(int index, pfGeoSet* gset);
int pfGeode::replaceGSet(pfGeoSet* old, pfGeoSet* new);
pfGeoSet * pfGeode::getGSet(int index);
int pfGeode::getNumGSets(void);
PARENT CLASS FUNCTIONS
The OpenGL Performer class pfGeode is derived from the parent class
pfNode, so each of these member functions of class pfNode are also
directly usable with objects of class pfGeode. This is also true for
ancestor classes of class pfNode.
pfGroup * pfNode::getParent(int i);
int pfNode::getNumParents(void);
void pfNode::setBound(pfSphere *bsph, int mode);
int pfNode::getBound(pfSphere *bsph);
pfNode* pfNode::clone(int mode);
pfNode* pfNode::bufferClone(int mode, pfBuffer *buf);
int pfNode::flatten(int mode);
int pfNode::setName(const char *name);
const char * pfNode::getName(void);
pfNode* pfNode::find(const char *pathName, pfType *type);
pfNode* pfNode::lookup(const char *name, pfType* type);
int pfNode::isect(pfSegSet *segSet, pfHit **hits[]);
void pfNode::setTravMask(int which, uint mask, int setMode,
int bitOp);
uint pfNode::getTravMask(int which);
void pfNode::setTravFuncs(int which, pfNodeTravFuncType pre,
pfNodeTravFuncType post);
void pfNode::getTravFuncs(int which, pfNodeTravFuncType *pre,
pfNodeTravFuncType *post);
void pfNode::setTravData(int which, void *data);
void * pfNode::getTravData(int which);
void pfNode::setTravMode(int which, int mode, int val);
Page 1
pfGeode(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages pfGeode(3pf)
int pfNode::getTravMode(int which, int mode) const;
Since the class pfNode is itself derived from the parent class pfObject,
objects of class pfGeode can also be used with these functions designed
for objects 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 pfGeode 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();
PARAMETERS
geode identifies a pfGeode.
DESCRIPTION
The name "pfGeode" is short for Geometry Node. A pfGeode is a leaf node
in the OpenGL Performer scene graph hierarchy and is derived from pfNode
so it can use pfNode API. A pfGeode is simply a list of pfGeoSets which
it draws and intersects with. A pfGeode is the smallest cullable unit
unless PFCULL_GSET is set by pfChannel::setTravMode in which case OpenGL
Performer will cull individual pfGeoSets within pfGeodes.
Page 2
pfGeode(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages pfGeode(3pf)
The bounding volume of a pfGeode is that which surrounds all its
pfGeoSets. Unless the bounding volume is considered static (see
pfNode::setBound), OpenGL Performer will compute a new volume when the
list of pfGeoSets is modified by pfGeode::addGSet, pfGeode::removeGSet,
pfGeode::insertGSet or pfGeode::replaceGSet. If the bounding box of a
child pfGeoSet changes, call pfNode::setBound to tell OpenGL Performer to
update the bounding volume of the pfGeode.
new pfGeode creates and returns a handle to a pfGeode. Like other
pfNodes, pfGeodes are always allocated from shared memory and cannot be
created statically, on the stack or in arrays. pfGeodes can be deleted
using pfDelete.
pfGeode::getClassType returns the pfType* for the class pfGeode. The
pfType* returned by pfGeode::getClassType is the same as the pfType*
returned by invoking the virtual function getType on any instance of
class pfGeode. Because OpenGL Performer allows subclassing of built-in
types, when decisions are made based on the type of an object, it is
usually better to use the member function isOfType to test if an object
is of a type derived from a Performer type rather than to test for strict
equality of the pfType*'s.
pfGeode::addGSet appends gset to the pfGeode's pfGeoSet list.
pfGeode::removeGSet removes gset from the list and shifts the list down
over the vacant spot. For example, if gset had index 0, then index 1
becomes index 0, index 2 becomes index 1 and so on. pfGeode::removeGSet
returns a 1 if gset was actually removed and 0 if it was not found in the
list. pfGeode::addGSet and pfGeode::removeGSet will cause OpenGL
Performer to recompute new bounding volumes for the pfGeode unless it is
configured to use static bounding volumes.
pfGeode::insertGSet will insert gset before the pfGeoSet with index
index. index must be within the range 0 to pfGeode::getNumGSets().
pfGeode::replaceGSet replaces old with new and returns 1 if the operation
was successful or 0 if old was not found in the list.
pfGeode::insertGSet and pfGeode::replaceGSet will cause OpenGL Performer
to recompute new bounding volumes for the pfGeode unless it is configured
to use static bounding volumes.
pfGeode::getNumGSets returns the number of pfGeoSets in the pfGeode.
pfGeode::getGSet returns a handle to the pfGeoSet with index index or
NULL if the index is out of range.
If database sorting is disabled, that is if the PFCULL_SORT mode of
pfChannel::setTravMode is not set, the pfGeoSets in a pfGeode will be
drawn in the order they appear on the list. If sorting is enabled, there
is no guarantee about the drawing order, since the reordering of GeoSets
for minimum state-changing overhead is one of the primary design
motivations of OpenGL Performer's libpf and libpr.
Page 3
pfGeode(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages pfGeode(3pf)NOTESpfGeode geometry is not multibuffered by OpenGL Performer when in
multiprocessing mode in order to save memory. Therefore there are some
restrictions on dynamic geometry. Modified vertex positions will be
culled properly only if a static bound is defined which surrounds all
possible excursions of the dynamic geometry. Since the draw process may
be drawing the geometry at the same time the application process is
modifying it, cracks may appear between polygons which share a dynamic
vertex. Creation and deletion of vertices are not currently supported by
OpenGL Performer. However, the application may handle its own
multibuffering of pfGeodes through mutual exclusion with locks or through
the use of parallel data structures and pfSwitch nodes to achieve any
kind of dynamic geometry.
The shifting behavior of pfGeode::removeGSet can cause some confusion.
The following sample code shows how to remove all pfGeoSets from geode:
int i;
int n = geode->getNumGSets();
for (i = 0; i < n; i++)
geode->removeGSet(geode->getGSet(0)); /* 0, not i */
Alternately, you can traverse the list from back to front, in which case
the shift never hits the fan.
int i;
int n = geode->getNumGSets();
for (i = n - 1; i >= 0; i--)
geode->removeGSet(geode->getGSet(i)); /* i, not 0 */
When sorting is enabled (see pfChannel::setTravMode and PFCULL_SORT),
transparent pfGeoSets are drawn last unless the pfGeode has a pre or post
draw callback (see pfNode::setTravFuncs). Drawing transparent pfGeoSets
after opaque geometry reduces artifacts when blended transparency (see
pfTransparency) is used and can improve fill rate performance.
SEE ALSO
pfChannel, pfGeoSet, pfNode, pfTransparency, pfDelete
Page 4