pfSwitch(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages pfSwitch(3pf)NAMEpfSwitch - Create, modify, and query a switch node.
FUNCTION SPECIFICATION
#include <Performer/pf/pfSwitch.h>
pfSwitch::pfSwitch();
static pfType * pfSwitch::getClassType(void);
int pfSwitch::setVal(float val);
float pfSwitch::getVal(void);
int pfSwitch::setValFlux(pfFlux *flux);
pfFlux * pfSwitch::getValFlux(void);
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. This is also true for
ancestor classes of class pfGroup.
int pfGroup::addChild(pfNode *child);
int pfGroup::insertChild(int index, pfNode *child);
int pfGroup::replaceChild(pfNode *old, pfNode *new);
int pfGroup::removeChild(pfNode* child);
int pfGroup::searchChild(pfNode* child);
pfNode * pfGroup::getChild(int index);
int pfGroup::getNumChildren(void);
int pfGroup::bufferAddChild(pfNode *child);
int pfGroup::bufferRemoveChild(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 * 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);
Page 1
pfSwitch(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages pfSwitch(3pf)
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);
int pfNode::getTravMode(int which, int mode) const;
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* 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 pfSwitch 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();
Page 2
pfSwitch(3pf) OpenGL Performer 3.2.2 libpf C++ Reference Pages pfSwitch(3pf)
int pfMemory::getSize();
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.
new pfSwitch creates and returns a handle to a pfSwitch. Like other
pfNodes, pfSwitches are always allocated from shared memory and cannot be
created statically, on the stack or in arrays. pfSwitches should be
deleted using pfDelete rather than the delete operator.
pfSwitch::getClassType returns the pfType* for the class pfSwitch. The
pfType* returned by pfSwitch::getClassType is the same as the pfType*
returned by invoking the virtual function getType 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 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.
pfSwitch::setVal sets the switch value of the pfSwitch to val. val may
be a float ranging from 0 to N-1 with N being the number of children of
the pfSwitch 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. pfSwitch::getVal 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.
pfSwitch::setValFlux and pfSwitch::getValFlux 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 pfSwitch::setVal. A value flux should
contain a single float. The integer portion of the float will be used to
select the switch setting.
Calling pfSwitch::setVal on a pfSwitch with a non NULL value flux will
set the value flux. Calling pfSwitch::getVal on a pfSwitch with a non
NULL value flux will return the current data of the value flux.
NOTES
PF_ON and PF_OFF tokens will NOT work with pfSwitch::setVal.
SEE ALSO
pfGroup, pfNode, pfScene, pfDelete
Page 3