pfScene(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfScene(3pf)NAME
pfNewScene, pfGetSceneClassType, pfSceneGState, pfGetSceneGState,
pfSceneGStateIndex, pfGetSceneGStateIndex - Create a scene or root node,
set and get scene pfGeoState or pfGeoState index.
FUNCTION SPECIFICATION
#include <Performer/pf.h>
pfScene * pfNewScene(void);
pfType * pfGetSceneClassType(void);
void pfSceneGState(pfScene *scene, pfGeoState *gstate);
pfGeoState * pfGetSceneGState(const pfScene *scene);
void pfSceneGStateIndex(pfScene *scene, int index);
int pfGetSceneGStateIndex(const pfScene *scene);
PARENT CLASS FUNCTIONS
The OpenGL Performer class pfScene is derived from the parent class
pfGroup, so each of these member functions of class pfGroup are also
directly usable with objects of class pfScene. Casting an object of
class pfScene 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 pfScene 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
pfScene(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfScene(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 pfScene 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 pfScene 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
pfScene(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfScene(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
scene identifies a pfScene.
gstate identifies a pfGeoState.
DESCRIPTION
A pfScene is the root of a hierarchical database which may be drawn or
intersected with. pfScene is derived from pfGroup so it can use pfGroup
and pfNode API. A pfScene may have children like a pfGroup but it cannot
be a child of another node. Its special purpose is to serve as the root
node of a scene graph.
pfNewScene creates and returns a handle to a pfScene. Like other
pfNodes, pfScenes are always allocated from shared memory and can be
deleted using pfDelete.
pfGetSceneClassType returns the pfType* for the class pfScene. The
pfType* returned by pfGetSceneClassType is the same as the pfType*
returned by invoking pfGetType on any instance of class pfScene. 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.
OpenGL Performer will automatically carry out the APP, CULL, and DRAW
traversals on pfScenes which are attached to pfChannels by pfChanScene.
The CULL and DRAW traversals are directly or indirectly triggered by
pfFrame while the APP traversal is triggered by pfAppFrame.
Multiple pfChannels may reference the same pfScene but each pfChannel
references only a single pfScene.
pfSceneGState attaches gstate to scene. The pfGeoState of a pfScene
defines the "global state" which may be inherited by other pfGeoStates.
This state inheritance mechanism is further described in the pfGeoState
man page.
The scene pfGeoState is defined as the global state by pfLoadGState.
This pfGeoState will be loaded before the pfChannel DRAW callback (-
pfChanTravFunc) is invoked so any custom rendering in the callback will
inherit the state set by the scene pfGeoState. pfGetSceneGState returns
the directly referenced pfGeoState of scene or the appropriate pfGeoState
in the global table if scene indexes its pfGeoState or NULL if the index
cannot be resolved.
Page 3
pfScene(3pf) OpenGL Performer 3.2.2 libpf C Reference Pages pfScene(3pf)
The scene pfGeoState may be indexed through a global table by assigning
an index with pfSceneGStateIndex and specifying the table with
pfApplyGStateTable. Usually this table is provided by the pfChannel (-
pfChanGStateTable). pfGetSceneGStateIndex returns the pfGeoState index of
scene or -1 if scene directly references its pfGeoState.
It is not necessary to provide a scene pfGeoState, but it is a convenient
way to specify the default inheritable values for all pfGeoState elements
on a per-scene basis.
SEE ALSO
pfApplyGStateTable, pfChanScene, pfChanTravFunc, pfGeoState, pfGroup,
pfDelete
Page 4