pfSwitch(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfSwitch(3pf)NAME
pfNewSwitch, pfGetSwitchClassType, pfSwitchVal, pfGetSwitchVal,
pfSwitchValFlux, pfGetSwitchValFlux - Create, modify, and query a switch
node.
FUNCTION SPECIFICATION
#include <Performer/pf.h>
pfSwitch * pfNewSwitch(void);
pfType * pfGetSwitchClassType(void);
int pfSwitchVal(pfSwitch *sw, float val);
float pfGetSwitchVal(const pfSwitch *sw);
int pfSwitchValFlux(pfSwitch *sw, pfFlux *flux);
pfFlux * pfGetSwitchValFlux(const pfSwitch *sw);
PARENT CLASS FUNCTIONS
The OpenGL Performer class pfSwitch is derived from the parent class
pfGroup, so each of these member functions of class pfGroup are also
directly usable with objects of class pfSwitch. Casting an object of
class pfSwitch to an object of class pfGroup is taken care of
automatically. This is also true for casts to objects of ancestor
classes of class pfGroup.
int pfAddChild(pfGroup *group, pfNode *child);
int pfInsertChild(pfGroup *group, int index, pfNode *child);
int pfReplaceChild(pfGroup *group, pfNode *old, pfNode *new);
int pfRemoveChild(pfGroup *group, pfNode* child);
int pfSearchChild(pfGroup *group, pfNode* child);
pfNode * pfGetChild(const pfGroup *group, int index);
int pfGetNumChildren(const pfGroup *group);
int pfBufferAddChild(pfGroup *group, pfNode *child);
int pfBufferRemoveChild(pfGroup *group, pfNode *child);
Since the class pfGroup is itself derived from the parent class pfNode,
objects of class pfSwitch can also be used with these functions designed
for objects of class pfNode.
pfGroup * pfGetParent(const pfNode *node, int i);
int pfGetNumParents(const pfNode *node);
void pfNodeBSphere(pfNode *node, pfSphere *bsph, int mode);
int pfGetNodeBSphere(pfNode *node, pfSphere *bsph);
pfNode* pfClone(pfNode *node, int mode);
pfNode* pfBufferClone(pfNode *node, int mode, pfBuffer *buf);
int pfFlatten(pfNode *node, int mode);
Page 1
pfSwitch(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfSwitch(3pf)
int pfNodeName(pfNode *node, const char *name);
const char * pfGetNodeName(const pfNode *node);
pfNode* pfFindNode(pfNode *node, const char *pathName,
pfType *type);
pfNode* pfLookupNode(const char *name, pfType* type);
int pfNodeIsectSegs(pfNode *node, pfSegSet *segSet,
pfHit **hits[]);
void pfNodeTravMask(pfNode *node, int which, uint mask,
int setMode, int bitOp);
uint pfGetNodeTravMask(const pfNode *node, int which);
void pfNodeTravFuncs(pfNode* node, int which,
pfNodeTravFuncType pre, pfNodeTravFuncType post);
void pfGetNodeTravFuncs(const pfNode* node, int which,
pfNodeTravFuncType *pre, pfNodeTravFuncType *post);
void pfNodeTravData(pfNode *node, int which, void *data);
void * pfGetNodeTravData(const pfNode *node, int which);
void pfNodeTravMode(pfNode* node, int which, int mode,
int val);
int pfGetNodeTravMode(const pfNode* node, int which,
int mode);
Since the class pfNode is itself derived from the parent class pfObject,
objects of class pfSwitch 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);
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 pfSwitch 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);
Page 2
pfSwitch(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfSwitch(3pf)
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);
PARAMETERS
sw identifies a pfSwitch.
DESCRIPTION
A pfSwitch is an interior node in the OpenGL Performer node hierarchy
that selects one, all, or none of its children. It is derived from
pfGroup so it can use pfGroup API to manipulate its child list.
pfNewSwitch creates and returns a handle to a pfSwitch. Like other
pfNodes, pfSwitches are always allocated from shared memory and can be
deleted using pfDelete.
pfGetSwitchClassType returns the pfType* for the class pfSwitch. The
pfType* returned by pfGetSwitchClassType is the same as the pfType*
returned by invoking pfGetType on any instance of class pfSwitch.
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.
pfSwitchVal sets the switch value of sw to val. val may be a float
ranging from 0 to N-1 with N being the number of children of sw or it may
be a symbolic token: PFSWITCH_ON or PFSWITCH_OFF in which case all
children or no children are selected. pfSwitch uses the integer portion
of val. pfGetSwitchVal returns the current switch value.
The validity of the switch value delayed until the switch is actually
evaluated (usually by a traversal such as CULL). For example, it is legal
to set a switch value of 2 on a pfSwitch node with no children, provided
at least 2 children are added before the pfSwitch is evaluated.
pfSwitchValFlux and pfGetSwitchValFlux set and get a pfFlux to be used
for controling a pfSwitch. This is an alternate method of contoling a
pfSwitch. If the value flux of a pfSwitch is NULL, the switch will be
contorlled by the value set with pfSwitchVal. A value flux should
contain a single float. The integer portion of the float will be used to
select the switch setting.
Calling pfSwitchVal on a pfSwitch with a non NULL value flux will set the
value flux. Calling pfGetSwitchVal on a pfSwitch with a non NULL value
flux will return the current data of the value flux.
Page 3
pfSwitch(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfSwitch(3pf)NOTES
PF_ON and PF_OFF tokens will NOT work with pfSwitchVal.
SEE ALSO
pfGroup, pfLookupNode, pfNode, pfScene, pfDelete
Page 4