pfPath(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfPath(3pf)NAME
pfNewPath, pfGetPathClassType, pfCullPath - Create, modify, and maintain
a node path.
FUNCTION SPECIFICATION
#include <Performer/pf.h>
pfPath * pfNewPath(void);
pfType * pfGetPathClassType(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. Casting an object of class
pfPath to an object of class pfList is taken care of automatically. This
is also true for casts to objects of ancestor classes of class pfList.
void pfAdd(pfList* list, void* elt);
void pfCombineLists(pfList* dst, const pfList *a,
const pfList *b);
int pfFastRemove(pfList* list, void* elt);
void pfFastRemoveIndex(pfList* list, int index);
void * pfGet(const pfList* list, int index);
const void ** pfGetListArray(const pfList* list);
int pfGetListArrayLen(const pfList* len);
int pfGetListEltSize(const pfList* list);
int pfGetNum(const pfList* list);
void pfInsert(pfList* list, int index, void* elt);
int pfMove(pfList* lists, int index, void *elt);
void pfListArrayLen(pfList* list, int len);
void pfNum(pfList *list, int num);
int pfRemove(pfList* list, void* elt);
void pfRemoveIndex(pfList* list, int index);
int pfReplace(pfList* list, void* old, void* new);
void pfResetList(pfList* list);
int pfSearch(const pfList* list, void* elt);
void pfSet(pfList* list, 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 pfUserDataSlot(pfObject *obj, int slot, void *data);
void pfUserData(pfObject *obj, void *data);
void* pfGetUserDataSlot(pfObject *obj, int slot);
void* pfGetUserData(pfObject *obj);
Page 1
pfPath(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfPath(3pf)
int pfGetNumUserData(pfObject *obj);
int pfGetNamedUserDataSlot(const char *name);
const char* pfGetUserDataSlotName(int slot);
int pfGetNumNamedUserDataSlots(void);
int pfDeleteGLHandle(pfObject *obj);
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.
pfType * pfGetType(const void *ptr);
int pfIsOfType(const void *ptr, pfType *type);
int pfIsExactType(const void *ptr, pfType *type);
const char * pfGetTypeName(const void *ptr);
int pfRef(void *ptr);
int pfUnref(void *ptr);
int pfUnrefDelete(void *ptr);
int pfUnrefGetRef(void *ptr);
int pfGetRef(const void *ptr);
int pfCopy(void *dst, void *src);
int pfDelete(void *ptr);
int pfIsFluxed(void *ptr);
int pfCompare(const void *ptr1, const void *ptr2);
void pfPrint(const void *ptr, uint which, uint verbose,
FILE *file);
void * pfGetArena(void *ptr);
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.
pfNewPath 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.
pfGetPathClassType returns the pfType* for the class pfPath. The pfType*
returned by pfGetPathClassType is the same as the pfType* returned by
invoking pfGetType 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 pfIsOfType 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.
Page 2
pfPath(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfPath(3pf)
mode is a bitmask indicating which type of "switching" nodes (pfLOD,
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 = pfNewPath();
pfAdd(path, switch0);
pfAdd(path, 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
pfChanTravFunc. 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
pfChanTravFunc, pfCull, pfList
Page 4