pfPath(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages pfPath(3pf)NAME
pfPath, pfCullPath - Create, modify, and maintain a node path.
FUNCTION SPECIFICATION
#include <Performer/pf/pfTraverser.h>
pfPath::pfPath();
static pfType * pfPath::getClassType(void);
int pfCullPath(pfPath *path, pfNode *node, int mode);
PARENT CLASS FUNCTIONS
The OpenGL Performer class pfPath is derived from the parent class
pfList, so each of these member functions of class pfList are also
directly usable with objects of class pfPath. This is also true for
ancestor classes of class pfList.
void pfList::add(void* elt);
void pfList::combine(const pfList *a, const pfList *b);
int pfList::fastRemove(void* elt);
void pfList::fastRemoveIndex(int index);
void * pfList::get(int index);
const void ** pfList::getArray(void);
int pfList::getArrayLen(void);
int pfList::getEltSize(void);
int pfList::getNum(void);
void pfList::insert(int index, void* elt);
void pfList::move(int index, void *elt);
void pfList::setArrayLen(int len);
void pfList::setNum(int num);
int pfList::remove(void* elt);
void pfList::removeIndex(int index);
int pfList::replace(void* old, void* new);
void pfList::reset(void);
int pfList::search(void* elt);
void pfList::set(int index, void *elt);
Since the class pfList is itself derived from the parent class pfObject,
objects of class pfPath 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();
Page 1
pfPath(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages pfPath(3pf)
Since the class pfObject is itself derived from the parent class
pfMemory, objects of class pfPath 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 pfPath is a dynamically-sized array of pointers. A pfPath consisting
of pfNode pointers can define a specific path or chain of nodes through a
scene graph.
new pfPath creates and returns a handle to a pfPath. pfPaths are usually
allocated from shared memory. The path element size is sizeof(void*) and
the initial number of elements in the path is 4. pfPaths can be deleted
using pfDelete.
pfPath::getClassType returns the pfType* for the class pfPath. The
pfType* returned by pfPath::getClassType is the same as the pfType*
returned by invoking the virtual function getType on any instance of
class pfPath. 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.
pfCullPath traverses and culls the chain of nodes specified in path,
beginning at root. If path is NULL, then root will be traversed in-
order. If root is NULL, then the exact chain of nodes specified in path
will be traversed. If neither root nor path is NULL, then the paths
traversed will be all paths emanating from root which reach the first
node in path and then continue down the nodes specified in path.
mode is a bitmask indicating which type of "switching" nodes (pfLOD,
Page 2
pfPath(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages pfPath(3pf)
pfSequence, pfSwitch) to evaluate and may be either:
PFPATH_IGNORE_SWITCHES
Do not evaluate any switches in the node path.
or else it is the bitwise OR of the following:
PFPATH_EVAL_LOD
Evaluate any pfLOD nodes in the node path.
PFPATH_EVAL_SEQUENCE
Evaluate any pfSequence nodes in the node path.
PFPATH_EVAL_SWITCH
Evaluate any pfSwitch nodes in the node path.
When an enabled switch node is encountered, traversal will terminate if
the next node in the path is not one selected by the switch. As a
convenience, PFPATH_EVAL_SWITCHES is defined to enable all three of these
switchs (PFPATH_EVAL_LOD, PFPATH_EVAL_SWITCH, and PFPATH_EVAL_SEQUENCE).
Example 1: Path culling
scene
/ \ \
/ scs0 group0
\ / \
switch0 geode2
/ \
/ \
geode0 geode1
path = new pfPath;
path->add(switch0);
path->add(geode1);
:
/*
* In cull callback. This will cull the following paths:
*
* scene -> switch0 -> geode1
* scene -> scs0 -> switch0 -> geode1
*
* Note that both path traversals will terminate at switch0
* if the pfSwitch's switch value is not 1.
*/
pfCullPath(path, scene, PFPATH_EVAL_SWITCHES);
Page 3
pfPath(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages pfPath(3pf)
pfCullPath should only be called in the cull callback function set by
pfChannel::setTravFunc. The pfChannel passed to the cull callback will
be used to traverse the path, that is its LOD attributes will affect the
pfLODs traversed and nodes will be culled to its viewing frustum.
SEE ALSO
pfChannel, pfCull, pfList
Page 4