This document (dated 1/11/96) hails from http://www.sgi.com/Technology/Performer/api.html
-- always reference the above link, for the most current, up-to-date version of this page.

SGI Logo

IRIS Performer 2.0 API

Silicon Graphics Computer Systems

"The Performer"

IRIS Performer Application Programming Interface (API)

These functions constitute the entirety of IRIS Performer. All libpf, libpr, and libpfutil functions have a complete description available via the IRIX man command. The following list is shows functions arranged by intended use and is provided for your use as both a quick reference and an API directory.

libpf Functions

Initialization

pfInit initializes all internal IRIS Performer data structures while pfExit cleans up before returning control to the application. The other functions provide support for multiprocessed execution. This involves configuring IRIS Performer for multiple processes and threads and multiple and multiplexed (hyper) pipes.

     int               pfInit(void);
     void              pfExit(void);
     int               pfMultipipe(int numPipes);
     int               pfGetMultipipe(void);
     int               pfHyperpipe(int numHyperPipes);
     int               pfGetHyperpipe(pfPipe *pipe);
     int               pfMultiprocess(int mpMode);
     int               pfGetMultiprocess(void);
     int               pfMultithread(int pipe, uint stage, int nprocs);
     int               pfGetMultithread(int pipe, uint stage);
     int               pfConfig(void);
     pid_t             pfGetPID(int pipe, uint stage);
     uint              pfGetStage(pid_t pid, int *pipe);
     void              pfStageConfigFunc(int pipe, uint stage, pfStageFuncType configFunc);
     pfStageFuncType   pfGetStageConfigFunc(int pipe, uint stage);
     int               pfConfigStage(int pipe, uint stage);

Frame Control

IRIS Performer is designed to run at a fixed frame rate. pfFrame, pfSync and associated functions set a frame rate the application should run at, initiate each new frame of IRIS Performer processing and synchronize the application process with the specified frame rate.

pfApp, pfCull, pfDraw and pfDBase trigger the default IRIS Performer processing for each stage of the graphics pipeline. User-defined callbacks can be specified for each of these stages using the pf*Func functions. Data can be allocated for each stage and also passed down the different stages of the pipeline.

The other functions in this set manipulate IRIS Performer memory (pfMemory) and its associated reference counts.

     void              pfAppFrame(void);
     int               pfSync(void);
     int               pfFrame(void);
     void              pfApp(void);
     void              pfCull(void);
     void              pfDraw(void);
     void              pfDrawBin(int bin);
     void              pfIsectFunc(pfIsectFuncType func);
     pfIsectFuncType   pfGetIsectFunc(void);
     void*             pfAllocIsectData(int bytes);
     void*             pfGetIsectData(void);
     void              pfPassIsectData(void);
     void              pfDBase(void);
     void              pfDBaseFunc(pfDBaseFuncType func);
     pfDBaseFuncType   pfGetDBaseFunc(void);
     void*             pfAllocDBaseData(int bytes);
     void*             pfGetDBaseData(void);
     void              pfPassDBaseData(void);
     void              pfPhase(int phase);
     int               pfGetPhase(void);
     void              pfVideoRate(float vrate);
     float             pfGetVideoRate(void);
     float             pfFrameRate(float rate);
     float             pfGetFrameRate(void);
     int               pfFieldRate(int fields);
     int               pfGetFieldRate(void);
     int               pfGetFrameCount(void);
     double            pfGetFrameTimeStamp(void);
     void              pfFrameTimeStamp(double t);
     int               pfGetId(void *mem);
     int               pfAsyncDelete(void *mem);
     int               pfCopy(void *dst, void *src);

pfPipe Functions

A pfPipe is a software rendering pipeline which renders one or more pfChannels into one or more pfPipeWindows. Typically one pfPipe is created for each hardware graphics pipeline.

     pfPipe*   pfGetPipe(int pipeNum);
     int       pfInitPipe(pfPipe *pipe, pfPipeFuncType configFunc);

pfPipe C API

These functions create and manipulate pfPipes. Control can be exercised over the hardware screen used by the pfPipe and the way a pfPipe swaps color buffers at the end of each frame.

     pfType*              pfGetPipeClassType(void);
     void                 pfPipeSwapFunc(pfPipe* pipe,
                            pfPipeSwapFuncType func);
     pfPipeSwapFuncType   pfGetPipeSwapFunc(const pfPipe* pipe);
     void                 pfGetPipeSize(const pfPipe* pipe, int *xs, int *ys);
     void                 pfPipeScreen(pfPipe* pipe, int scr);
     int                  pfGetPipeScreen(const pfPipe* pipe);
     void                 pfPipeWSConnectionName(pfPipe* pipe,
                            const char *name);
     const char*          pfGetPipeWSConnectionName(const pfPipe* pipe);
     pfChannel*           pfGetPipeChan(const pfPipe* pipe, int i);
     int                  pfGetPipeNumChans(const pfPipe* pipe);
     pfPipeWindow*        pfGetPipePWin(const pfPipe* pipe, int i);
     int                  pfGetPipeNumPWins(const pfPipe* pipe);
     int                  pfGetPipeHyperId(const pfPipe* pipe);
     int                  pfMovePWin(pfPipe* pipe, int where,
                            pfPipeWindow *pw);
     pfBuffer*            pfGetCurBuffer(void);

pfBuffer C API

The pfBuffer data structure logically encompasses libpf objects such as pfNodes. Newly created objects are automatically "attached" to the current pfBuffer specified by pfSelectBuffer. Later, any objects created in buf may be merged into the main IRIS Performer processing stream with pfMergeBuffer. In conjunction with a forked DBASE process (see pfMultiprocess and pfDBaseFunc), the pfBuffer mechanism supports asynchronous parallel creation and deletion of database objects. This is the foundation of a real-time database paging system.

     pfBuffer*   pfNewBuffer(void);
     void        pfBufferScope(pfBuffer* buffer, pfObject *obj, int scope);
     int         pfGetBufferScope(pfBuffer* buffer, pfObject *obj);
     void        pfMergeBuffer(void);
     int         pfUnrefDelete(void *mem);
     int         pfDelete(void *mem);
     int         pfBufferInsert(void *parent, int index, void *child);
     int         pfBufferRemove(void *parent, void *child);
     int         pfBufferAdd(void *parent, void *child);
     int         pfBufferReplace(void *parent, void *oldChild, void *newChild);
     void        pfSelectBuffer(pfBuffer* buffer);
     void        pfInitGfx(void);

pfPipeWindow C API

A pfPipeWindow creates a window on the screen managed by a given pfPipe. Programs render to a pfPipeWindow by attaching a pfChannel of that pfPipe to the pfPipeWindow. Various ways of controlling the behavior of pfPipeWindows are provided including specifying their position and size on the screen, specifying user-specified callbacks to configure them in the DRAW process, controlling lists of pfWindows that can draw into a singe pfPipewindow, and manipulating pfChannels assigned to the pfPipeWindows.

     pfPipeWindow*    pfNewPWin(pfPipe *p);
     pfType*          pfGetPWinClassType(void);
     void             pfPWinName(pfPipeWindow* pwin, const char *name);
     const char*      pfGetPWinName(pfPipeWindow* pwin);
     void             pfPWinWSConnectionName(pfPipeWindow* pwin,
                        const char *name);
     const char*      pfGetPWinWSConnectionName(pfPipeWindow* pwin);
     void             pfPWinMode(pfPipeWindow* pwin, int mode, int val);
     int              pfGetPWinMode(pfPipeWindow* pwin, int mode);
     void             pfPWinType(pfPipeWindow* pwin, uint type);
     uint             pfGetPWinType(pfPipeWindow* pwin);
     pfState*         pfGetPWinCurState(pfPipeWindow* pwin);
     void             pfPWinAspect(pfPipeWindow* pwin, int x, int y);
     void             pfGetPWinAspect(pfPipeWindow* pwin, int *x, int *y);
     void             pfPWinOriginSize(pfPipeWindow* pwin, int xo, int yo,
                        int xs, int ys);
     void             pfPWinOrigin(pfPipeWindow* pwin, int xo, int yo);
     void             pfGetPWinOrigin(pfPipeWindow* pwin, int *xo, int *yo);
     void             pfPWinSize(pfPipeWindow* pwin, int xs, int ys);
     void             pfGetPWinSize(pfPipeWindow* pwin, int *xs, int *ys);
     void             pfPWinFullScreen(pfPipeWindow* pwin);
     void             pfGetPWinCurOriginSize(pfPipeWindow* pwin, int *xo,
                        int *yo, int *xs, int *ys);
     void             pfGetPWinCurScreenOriginSize(pfPipeWindow* pwin,
                        int *xo, int *yo, int *xs, int *ys);
     void             pfPWinOverlayWin(pfPipeWindow* pwin, pfWindow *ow);
     pfWindow*        pfGetPWinOverlayWin(pfPipeWindow* pwin);
     void             pfPWinStatsWin(pfPipeWindow* pwin, pfWindow *sw);
     pfWindow*        pfGetPWinStatsWin(pfPipeWindow* pwin);
     void             pfPWinScreen(pfPipeWindow* pwin, int screen);
     int              pfGetPWinScreen(pfPipeWindow* pwin);
     void             pfPWinShare(pfPipeWindow* pwin, int mode);
     uint             pfGetPWinShare(pfPipeWindow* pwin);
     void             pfPWinWSWindow(pfPipeWindow* pwin, pfWSConnection dsp,
                        pfWSWindow wsw);
     Window           pfGetPWinWSWindow(pfPipeWindow* pwin);
     void             pfPWinWSDrawable(pfPipeWindow* pwin, pfWSConnection dsp,
                        pfWSDrawable gxw);
     pfWSDrawable     pfGetPWinWSDrawable(pfPipeWindow* pwin);
     pfWSDrawable     pfGetPWinCurWSDrawable(pfPipeWindow* pwin);
     void             pfPWinFBConfigData(pfPipeWindow* pwin, void *data);
     void*            pfGetPWinFBConfigData(pfPipeWindow* pwin);
     void             pfPWinFBConfigAttrs(pfPipeWindow* pwin, int *attr);
     int*             pfGetPWinFBConfigAttrs(pfPipeWindow* pwin);
     void             pfPWinFBConfig(pfPipeWindow* pwin, XVisualInfo *vis);
     XVisualInfo*     pfGetPWinFBConfig(pfPipeWindow* pwin);
     void             pfPWinFBConfigId(pfPipeWindow* pwin, int vId);
     int              pfGetPWinFBConfigId(pfPipeWindow* pwin);
     void             pfPWinIndex(pfPipeWindow* pwin, int index);
     int              pfGetPWinIndex(pfPipeWindow* pwin);
     pfWindow*        pfGetPWinSelect(pfPipeWindow* pwin);
     void             pfPWinGLCxt(pfPipeWindow* pwin, pfGLContext gc);
     pfGLContext      pfGetPWinGLCxt(pfPipeWindow* pwin);
     void             pfPWinList(pfPipeWindow* pwin, pfList *wl);
     pfList*          pfGetPWinList(const pfPipeWindow* pwin);
     int              pfAttachPWinWin(pfPipeWindow* pwin, pfWindow *w1);
     int              pfDetachPWinWin(pfPipeWindow* pwin, pfWindow *w1);
     int              pfAttachPWin(pfPipeWindow* pwin, pfPipeWindow *pw1);
     int              pfDetachPWin(pfPipeWindow* pwin, pfPipeWindow *pw1);
     pfWindow*        pfSelectPWin(pfPipeWindow* pwin);
     void             pfSwapPWinBuffers(pfPipeWindow* pwin);
     pfFBConfig       pfChoosePWinFBConfig(pfPipeWindow* pwin, int *attr);
     int              pfIsPWinOpen(pfPipeWindow* pwin);
     int              pfQueryPWin(pfPipeWindow* pwin, int which, int *dst);
     int              pfMQueryPWin(pfPipeWindow* pwin, int *which, int *dst);
     pfPipe*          pfGetPWinPipe(pfPipeWindow* pwin);
     int              pfGetPWinPipeIndex(const pfPipeWindow* pwin);
     void             pfPWinConfigFunc(pfPipeWindow* pwin,
                        pfPWinFuncType func);
     pfPWinFuncType   pfGetPWinConfigFunc(pfPipeWindow* pwin);
     int              pfGetPWinChanIndex(pfPipeWindow* pwin, pfChannel *chan);
     void             pfConfigPWin(pfPipeWindow* pwin);
     void             pfOpenPWin(pfPipeWindow* pwin);
     void             pfClosePWin(pfPipeWindow* pwin);
     void             pfClosePWinGL(pfPipeWindow* pwin);
     int              pfRemoveChan(pfPipeWindow* pwin, pfChannel *chan);
     void             pfAddChan(pfPipeWindow* pwin, pfChannel *chan);
     void             pfInsertChan(pfPipeWindow* pwin, int where,
                        pfChannel *chan);
     int              pfMoveChan(pfPipeWindow* pwin, int where,
                        pfChannel *chan);
     pfChannel*       pfGetChan(pfPipeWindow* pwin, int which);
     int              pfGetNumChans(const pfPipeWindow* pwin);
     void             pfNodePickSetup(pfNode* node);

pfChannel C API

A pfChannel's primary function is to define a viewing frustum which is used both for viewing and for culling. A pfChannel can be associated with a pfPipe with pfNewChan. All aspects of the pfChannel's viewing frustum, field of view (FOV), aspect ratio, view point and viewing direction can be modified. A custom culling volume for the pfChannel can be set (pfChanCullPtope).

Different queries can be made about the pfChannel (pfGetChan*) and user-defined traversal functions and mode can be set (pfChanTrav*). Functions are provided to control IRIS Performer's level-of-detail (LOD) behavior by specifying view position, field-of-view, and viewport pixel size (pfChanLOD*). pfChanStress can be used to specify when the system is at stress so that the LOD behavior is suitably modified.

The pfScene and the pfEarthSky that the pfChannel culls and draws are set using pfChanScene and pfChanESky, respectively. The pfChannel's pfGeoState and pfGeoStateTable can also be specified. Screen to world-space ray intersections on a pfChannel's scene can be performed using pfChanPick and related functions.

IRIS Performer can also sort the database into "bins" which are rendered in a user-specified order. In addition, geometry within a bin may be sorted by graphics state like texture or by range for front-to-back or back-to-front rendering. Functions are provided to achieve this behavior (pfChanBinSort and friends).

     pfChannel*       pfNewChan(pfPipe *p);
     pfType*          pfGetChanClassType(void);
     int              pfGetChanFrustType(const pfChannel* chan);
     void             pfChanAspect(pfChannel* chan, int which,
                        float xyaspect);
     float            pfGetChanAspect(pfChannel* chan);
     void             pfGetChanFOV(const pfChannel* chan, float *fovH,
                        float *fovV);
     void             pfChanNearFar(pfChannel* chan, float n, float f);
     void             pfGetChanNearFar(const pfChannel* chan, float *n,
                        float *f);
     void             pfGetChanNear(const pfChannel* chan, pfVec3 ll,
                        pfVec3 lr, pfVec3 ul, pfVec3 ur);
     void             pfGetChanFar(const pfChannel* chan, pfVec3 ll,
                        pfVec3 lr, pfVec3 ul, pfVec3 ur);
     void             pfGetChanPtope(const pfChannel* chan, pfPolytope *dst);
     int              pfGetChanEye(const pfChannel* chan, pfVec3 eye);
     void             pfMakePerspChan(pfChannel* chan, float l, float r,
                        float b, float t);
     void             pfMakeOrthoChan(pfChannel* chan, float l, float r,
                        float b, float t);
     void             pfMakeSimpleChan(pfChannel* chan, float fov);
     void             pfOrthoXformChan(pfChannel* chan, pfFrustum *fr,
                        const pfMatrix mat);
     int              pfChanContainsPt(const pfChannel* chan,
                        const pfVec3 pt);
     int              pfChanContainsSphere(const pfChannel* chan,
                        const pfSphere *sphere);
     int              pfChanContainsBox(const pfChannel* chan,
                        const pfBox *box);
     int              pfChanContainsCyl(const pfChannel* chan,
                        const pfCylinder *cyl);
     void             pfApplyChan(pfChannel* chan);
     pfPipe*          pfGetChanPipe(const pfChannel* chan);
     pfPipeWindow*    pfGetChanPWin(pfChannel* chan);
     int              pfGetChanPWinIndex(pfChannel* chan);
     void             pfChanFOV(pfChannel* chan, float fovH, float fovV);
     void             pfChanViewport(pfChannel* chan, float l, float r,
                        float b, float t);
     void             pfGetChanViewport(const pfChannel* chan, float *l,
                        float *r, float *b, float *t);
     void             pfGetChanOrigin(const pfChannel* chan, int *xo,
                        int *yo);
     void             pfGetChanSize(const pfChannel* chan, int *xs, int *ys);
     void             pfChanShare(pfChannel* chan, uint mask);
     uint             pfGetChanShare(const pfChannel* chan);
     void             pfChanAutoAspect(pfChannel* chan, int which);
     int              pfGetChanAutoAspect(const pfChannel* chan);
     void             pfGetChanBaseFrust(const pfChannel* chan,
                        pfFrustum *frust);
     void             pfChanViewOffsets(pfChannel* chan, pfVec3 xyz,
                        pfVec3 hpr);
     void             pfGetChanViewOffsets(const pfChannel* chan, pfVec3 xyz,
                        pfVec3 hpr);
     void             pfChanView(pfChannel* chan, pfVec3 vp, pfVec3 vd);
     void             pfGetChanView(pfChannel* chan, pfVec3 vp, pfVec3 vd);
     void             pfChanViewMat(pfChannel* chan, pfMatrix mat);
     void             pfGetChanViewMat(const pfChannel* chan, pfMatrix mat);
     void             pfGetChanOffsetViewMat(const pfChannel* chan,
                        pfMatrix mat);
     void             pfChanCullPtope(pfChannel* chan, const pfPolytope *vol);
     void             pfGetChanCullPtope(const pfChannel* chan,
                        pfPolytope *vol);
     void*            pfAllocChanData(pfChannel* chan, int size);
     void             pfChanData(pfChannel* chan, void *data, size_t size);
     void*            pfGetChanData(const pfChannel* chan);
     size_t           pfGetChanDataSize(const pfChannel* chan);
     void             pfChanTravFunc(pfChannel* chan, int trav,
                        pfChanFuncType func);
     pfChanFuncType   pfGetChanTravFunc(const pfChannel* chan, int trav);
     void             pfChanTravMode(pfChannel* chan, int trav, int mode);
     int              pfGetChanTravMode(const pfChannel* chan, int trav);
     void             pfChanTravMask(pfChannel* chan, int which, uint mask);
     uint             pfGetChanTravMask(const pfChannel* chan, int which);
     void             pfChanStressFilter(pfChannel* chan, float frac,
                        float low, float high, float s, float max);
     void             pfGetChanStressFilter(const pfChannel* chan,
                        float *frac, float *low, float *high, float *s,
                        float *max);
     void             pfChanStress(pfChannel* chan, float stress);
     float            pfGetChanStress(const pfChannel* chan);
     float            pfGetChanLoad(const pfChannel* chan);
     void             pfChanScene(pfChannel* chan, pfScene *s);
     pfScene*         pfGetChanScene(const pfChannel* chan);
     void             pfChanESky(pfChannel* chan, pfEarthSky *es);
     pfEarthSky*      pfGetChanESky(const pfChannel* chan);
     void             pfChanGState(pfChannel* chan, pfGeoState *gstate);
     pfGeoState*      pfGetChanGState(const pfChannel* chan);
     void             pfChanGStateTable(pfChannel* chan, pfList *list);
     pfList*          pfGetChanGStateTable(const pfChannel* chan);
     void             pfChanLODAttr(pfChannel* chan, int attr, float val);
     float            pfGetChanLODAttr(const pfChannel* chan, int attr);
     void             pfChanLODState(pfChannel* chan, const pfLODState *ls);
     void             pfGetChanLODState(const pfChannel* chan,
                        pfLODState *ls);
     void             pfChanLODStateList(pfChannel* chan, pfList *stateList);
     pfList*          pfGetChanLODStateList(const pfChannel* chan);
     int              pfChanStatsMode(pfChannel* chan, uint mode, uint val);
     pfFrameStats*    pfGetChanFStats(pfChannel* chan);
     void             pfChanBinSort(pfChannel* chan, int bin, int sortType,
                        int *sortOrders);
     int              pfGetChanBinSort(pfChannel* chan, int bin,
                        int *sortOrders);
     void             pfChanBinOrder(pfChannel* chan, int bin, int order);
     int              pfGetChanBinOrder(const pfChannel* chan, int bin);
     int              pfAttachChan(pfChannel* chan, pfChannel *chan1);
     int              pfDetachChan(pfChannel* chan, pfChannel *chan1);
     void             pfPassChanData(pfChannel* chan);
     int              pfChanPick(pfChannel* chan, int mode, float px,
                        float py, float radius, pfHit **pickList[]);
     void             pfClearChan(pfChannel* chan);
     void             pfDrawChanStats(pfChannel* chan);
     int              pfChanNodeIsectSegs(pfChannel* chan, pfNode *node,
                        pfSegSet *segSet, pfHit **hits[], pfMatrix *ma);

pfEarthSky C API

These functions provide a means to clear the frame and Z-buffer, draw a sky, horizon and ground plane, and to implement various weather effects like fog and clouds.

     pfEarthSky*   pfNewESky(void);
     pfType*       pfGetESkyClassType(void);
     void          pfESkyMode(pfEarthSky* esky, int mode, int val);
     int           pfGetESkyMode(pfEarthSky* esky, int mode);
     void          pfESkyAttr(pfEarthSky* esky, int mode, float val);
     float         pfGetESkyAttr(pfEarthSky* esky, int mode);
     void          pfESkyColor(pfEarthSky* esky, int which, float r, float g,
                     float b, float a);
     void          pfGetESkyColor(pfEarthSky* esky, int which, float *r,
                     float *g, float *b, float *a);
     void          pfESkyFog(pfEarthSky* esky, int which, pfFog *fog);
     pfFog*        pfGetESkyFog(pfEarthSky* esky, int which);

pfNode C API

A pfNode is an abstract type which cannot be explicitly created. The pfNode routines operate on the common aspects of other IRIS Performer node types which are derived from pfNode. IRIS Performer provides four major traversals of the scene graph: ISECT, APP, CULL, and DRAW. These functions (pfNodeTrav*) can be used to set which nodes are traversed, the functions to be invoked during the traversal, when the traversal is initiated and what data is provided to the traversal.

     pfType*       pfGetNodeClassType(void);
     void          pfNodeTravMask(pfNode* node, int which, uint mask,
                     int setMode, int bitOp);
     pfNode*       pfFindNode(pfNode* node, const char *name, pfType *type);
     int           pfNodeName(pfNode* node, const char *name);
     const char*   pfGetNodeName(const pfNode* node);
     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);
     uint          pfGetNodeTravMask(const pfNode* node, int which);
     void          pfNodeBufferMode(pfNode* node, int mode, int val);
     int           pfGetNodeBufferMode(const pfNode* node, int mode);
     pfGroup*      pfGetParent(const pfNode* node, int i);
     int           pfGetNumParents(const pfNode* node);
     void          pfNodeBSphere(pfNode* node, pfSphere *sph, int mode);
     int           pfGetNodeBSphere(pfNode* node, pfSphere *sph);
     pfNode*       pfLookupNode(const char *name, pfType* type);
     int           pfNodeIsectSegs(pfNode* node, pfSegSet *segSet,
                     pfHit **hits[]);
     int           pfFlatten(pfNode* node, int mode);
     pfNode*       pfClone(pfNode* node, int mode);
     pfNode*       pfBufferClone(pfNode* node, int mode, pfBuffer *buf);

pfGroup C API

A pfGroup is the internal node type of the IRIS Performer hierarchy and is derived from pfNode. The functions allow children to be added to and deleted from a pfGroup node and queries to be made about a pfGroup node's children.

     pfGroup*   pfNewGroup(void);
     pfType*    pfGetGroupClassType(void);
     int        pfAddChild(pfGroup* group, pfNode *child);
     int        pfInsertChild(pfGroup* group, int index, pfNode *child);
     int        pfRemoveChild(pfGroup* group, pfNode *child);
     int        pfReplaceChild(pfGroup* group, pfNode *oldn, pfNode *newn);
     int        pfBufferAddChild(pfGroup* group, pfNode *child);
     int        pfBufferRemoveChild(pfGroup* group, pfNode *child);
     pfNode*    pfGetChild(const pfGroup* group, int i);
     int        pfGetNumChildren(const pfGroup* group);
     int        pfSearchChild(const pfGroup* group, pfNode *n);

pfScene C API

A pfScene is the root of a hierarchical database which may be drawn or intersected with. pfGeoStates can be attached to and removed from a pfScene.

     pfScene*      pfNewScene(void);
     pfType*       pfGetSceneClassType(void);
     void          pfSceneGState(pfScene* scene, pfGeoState *gs);
     pfGeoState*   pfGetSceneGState(const pfScene* scene);
     void          pfSceneGStateIndex(pfScene* scene, int gs);
     int           pfGetSceneGStateIndex(const pfScene* scene);

pfSCS C API

These functions manipulate the matrix associated with a pfSCS node. A pfSCS node represents a static coordinate system -- a modeling transform that cannot be changed once created.

     pfSCS*            pfNewSCS(pfMatrix m);
     pfType*           pfGetSCSClassType(void);
     void              pfGetSCSMat(pfSCS* scs, pfMatrix m);
     const pfMatrix*   pfGetSCSMatPtr(pfSCS* scs);

pfDCS C API

These functions manipulate the matrix associated with a pfDCS node. A pfDCS node represents a dynamic coordinate system -- a modeling transform that can be changed after it is created.

     pfDCS*            pfNewDCS(void);
     pfType*           pfGetDCSClassType(void);
     void              pfGetDCSMat(pfDCS* dcs, pfMatrix m);
     const pfMatrix*   pfGetDCSMatPtr(pfDCS* dcs);
     void              pfDCSMatType(pfDCS* dcs, uint val);
     uint              pfGetDCSMatType(const pfDCS* dcs);
     void              pfDCSMat(pfDCS* dcs, pfMatrix m);
     void              pfDCSCoord(pfDCS* dcs, pfCoord *c);
     void              pfDCSRot(pfDCS* dcs, float h, float p, float r);
     void              pfDCSTrans(pfDCS* dcs, float x, float y, float z);
     void              pfDCSScale(pfDCS* dcs, float s);
     void              pfDCSScaleXYZ(pfDCS* dcs, float xs, float ys,
                         float zs);

pfLODState C API

A pfLODState is a definition of how an LOD or group of LODs should respond to range and stress. The functions form an interface to create LOD states, set their attributes and give them names.

     pfLODState*   pfNewLODState(void);
     pfType*       pfGetLODStateClassType(void);
     void          pfLODStateAttr(pfLODState* lodstate, int attr, float val);
     float         pfGetLODStateAttr(pfLODState* lodstate, int attr);
     int           pfLODStateName(pfLODState* lodstate, const char *name);
     const char*   pfGetLODStateName(const pfLODState* lodstate);
     pfLODState*   pfFindLODState(const char *findName);

pfLOD C API

Level-of-detail is a technique for manipulating model complexity based on image quality and rendering speed. IRIS Performer uses range-based LOD and adjusts for field-of-view and viewport pixel size. Each pfLOD node has the different levels-of-detail as its children. The pfGroup API can be used to manipulate this child list. A particular LOD is picked based on a transition range. These transition ranges can be set by pfLODRange and pfLODTransition to ensure smooth transitions between different LODs. A given pfLOD can also be associated with a pfLODState.

     pfLOD*        pfNewLOD(void);
     pfType*       pfGetLODClassType(void);
     void          pfLODCenter(pfLOD* lod, pfVec3 c);
     void          pfGetLODCenter(const pfLOD* lod, pfVec3 c);
     void          pfLODRange(pfLOD* lod, int index, float range);
     int           pfGetLODNumRanges(const pfLOD* lod);
     float         pfGetLODRange(const pfLOD* lod, int index);
     void          pfLODTransition(pfLOD* lod, int index, float delta);
     int           pfGetLODNumTransitions(const pfLOD* lod);
     float         pfGetLODTransition(const pfLOD* lod, int index);
     void          pfLODLODState(pfLOD* lod, pfLODState *ls);
     pfLODState*   pfGetLODLODState(const pfLOD* lod);
     void          pfLODLODStateIndex(pfLOD* lod, int index);
     int           pfGetLODLODStateIndex(const pfLOD* lod);
     float         pfEvaluateLOD(pfLOD* lod, const pfChannel *chan,
                     const pfMatrix *offset);

pfSwitch C API

The functions manipulate pfSwitch nodes which are interior nodes in the IRIS Performer node hierarchy that select one, all, or none of their children. The mode of selection is set by pfSwitchVal.

     pfSwitch*   pfNewSwitch(void);
     pfType*     pfGetSwitchClassType(void);
     int         pfSwitchVal(pfSwitch* switch, int val);
     int         pfGetSwitchVal(const pfSwitch* switch);

pfMorph C API

A pfMorph node manipulates the geometric attributes of pfGeoSets and other geometric primitives. Its primary use is for geometric morphing where the colors, normals, texture coordinates and coordinates of geometry are smoothly changed over time to simulate actions such as facial and skeletal animation, ocean waves, morph level-of-detail, and special effects. The attributes of a pfMorph node, the method of accessing the source arrays of a pfMorph attribute (non-indexed or indexed) and the weights attached to these attributes can be set and queried by these functions.

     pfMorph*   pfNewMorph(void);
     pfType*    pfGetMorphClassType(void);
     int        pfMorphAttr(pfMorph* morph, int index, int attr, int nelts,
                  void *dst, int nsrcs, float *alist[], ushort *ilist[],
                  int n[]);
     int        pfGetMorphNumAttrs(const pfMorph* morph);
     int        pfGetMorphSrc(const pfMorph* morph, int index, int src,
                  float **alist, ushort **ilist, int *n);
     int        pfGetMorphNumSrcs(const pfMorph* morph, int index);
     void*      pfGetMorphDst(const pfMorph* morph, int index);
     int        pfMorphWeights(pfMorph* morph, int index, float *weights);
     int        pfGetMorphWeights(const pfMorph* morph, int index,
                  float *weights);
     void       pfEvaluateMorph(pfMorph* morph);

pfSequence C API

A pfSequence node is a pfGroup node that sequences through a range of its children, drawing each child for a certain length of time. Children are added to a pfSequence using normal pfGroup API. The length of time to draw each child and the range of children to sequence through are set by these functions.

     pfSequence*   pfNewSeq(void);
     pfType*       pfGetSeqClassType(void);
     void          pfSeqDuration(pfSequence* seq, float sp, int nRep);
     void          pfGetSeqDuration(const pfSequence* seq, float *sp,
                     int *nRep);
     void          pfSeqInterval(pfSequence* seq, int imode, int beg, int e);
     void          pfGetSeqInterval(const pfSequence* seq, int *imode,
                     int *beg, int *e);
     void          pfSeqMode(pfSequence* seq, int m);
     int           pfGetSeqMode(const pfSequence* seq);
     void          pfSeqTime(pfSequence* seq, int index, double time);
     double        pfGetSeqTime(const pfSequence* seq, int index);
     int           pfGetSeqFrame(const pfSequence* seq, int *rep);

pfLayer C API

A pfLayer is a node derived from pfGroup that supports proper drawing of coplanar geometry on IRIS platforms so as to prevent distracting artifacts caused by numerical precision when rendering coplanar geometry on Z-buffer based machines. These functions create pfLayers and define the base layer and the other (decal) layers.

     pfLayer*   pfNewLayer(void);
     pfType*    pfGetLayerClassType(void);
     void       pfLayerBase(pfLayer* layer, pfNode *n);
     pfNode*    pfGetLayerBase(const pfLayer* layer);
     void       pfLayerDecal(pfLayer* layer, pfNode *n);
     pfNode*    pfGetLayerDecal(const pfLayer* layer);
     void       pfLayerMode(pfLayer* layer, int mode);
     int        pfGetLayerMode(const pfLayer* layer);

pfPartition C API

A pfPartition node is a type of pfGroup node which organizes the scene graphs of its children into a static data structure which can be more efficient for intersections. pfBuildPart constructs a spatial partitioning based on the value of type. The other functions update a partition and control the values of its attributes.

     pfPartition*   pfNewPart(void);
     pfType*        pfGetPartClassType(void);
     void           pfPartVal(pfPartition* part, int which, float val);
     float          pfGetPartVal(pfPartition* part, int which);
     void           pfPartAttr(pfPartition* part, int which, void *attr);
     void*          pfGetPartAttr(pfPartition* part, int which);
     void           pfBuildPart(pfPartition* part);
     void           pfUpdatePart(pfPartition* part);

pfLightPoint C API

A pfLightPoint is a pfNode that contains one or more light points. A light point is visible as one or more self-illuminated small points but does not illuminate surrounding objects. These functions form an interface to create light points and control various light point parameters like size, number, shape, direction, color, position and intensity in a fog.

     pfLightPoint*   pfNewLPoint(int n);
     pfType*         pfGetLPointClassType(void);
     int             pfGetNumLPoints(const pfLightPoint* lpoint);
     void            pfLPointSize(pfLightPoint* lpoint, float s);
     float           pfGetLPointSize(const pfLightPoint* lpoint);
     void            pfLPointFogScale(pfLightPoint* lpoint, float onset,
                       float opaque);
     void            pfGetLPointFogScale(const pfLightPoint* lpoint,
                       float *onset, float *opaque);
     void            pfLPointRot(pfLightPoint* lpoint, float azim, float elev,
                       float roll);
     void            pfGetLPointRot(const pfLightPoint* lpoint, float *azim,
                       float *elev, float *roll);
     void            pfLPointShape(pfLightPoint* lpoint, int dir, float he,
                       float ve, float f);
     void            pfGetLPointShape(const pfLightPoint* lpoint, int *dir,
                       float *he, float *ve, float *f);
     pfGeoSet*       pfGetLPointGSet(const pfLightPoint* lpoint);
     void            pfLPointPos(pfLightPoint* lpoint, int i, pfVec3 p);
     void            pfGetLPointPos(const pfLightPoint* lpoint, int i,
                       pfVec3 p);
     void            pfLPointColor(pfLightPoint* lpoint, int i, pfVec4 clr);
     void            pfGetLPointColor(const pfLightPoint* lpoint, int i,
                       pfVec4 clr);

pfLightSource C API

A pfLightSource is a pfNode which can illuminate geometry in a pfScene. The pfLightSource routines create pfLightSources,

     pfLightSource*   pfNewLSource(void);
     pfType*          pfGetLSourceClassType(void);
     void             pfLSourceColor(pfLightSource* lsource, int which,
                        float r, float g, float b);
     void             pfGetLSourceColor(pfLightSource* lsource, int which,
                        float* r, float* g, float* b);
     void             pfLSourceAmbient(pfLightSource* lsource, float r,
                        float g, float b);
     void             pfGetLSourceAmbient(pfLightSource* lsource, float* r,
                        float* g, float* b);
     void             pfLSourcePos(pfLightSource* lsource, float x, float y,
                        float z, float w);
     void             pfGetLSourcePos(pfLightSource* lsource, float* x,
                        float* y, float* z, float* w);
     void             pfLSourceAtten(pfLightSource* lsource, float a0,
                        float a1, float a2);
     void             pfGetLSourceAtten(pfLightSource* lsource, float* a0,
                        float* a1, float* a2);
     void             pfSpotLSourceDir(pfLightSource* lsource, float x,
                        float y, float z);
     void             pfGetSpotLSourceDir(pfLightSource* lsource, float* x,
                        float* y, float* z);
     void             pfSpotLSourceCone(pfLightSource* lsource, float f1,
                        float f2);
     void             pfGetSpotLSourceCone(pfLightSource* lsource, float* f1,
                        float* f2);
     void             pfLSourceOn(pfLightSource* lsource);
     void             pfLSourceOff(pfLightSource* lsource);
     int              pfIsLSourceOn(pfLightSource* lsource);
     void             pfLSourceMode(pfLightSource* lsource, int mode,
                        int val);
     int              pfGetLSourceMode(const pfLightSource* lsource,
                        int mode);
     void             pfLSourceVal(pfLightSource* lsource, int mode,
                        float val);
     float            pfGetLSourceVal(const pfLightSource* lsource, int mode);
     void             pfLSourceAttr(pfLightSource* lsource, int attr,
                        void *obj);
     void*            pfGetLSourceAttr(const pfLightSource* lsource,
                        int attr);

pfGeode C API

A pfGeode is a leaf node in the IRIS Performer scene graph hierarchy. It is a list of pfGeoSets which it draws and intersects with. Functions are provided to creates pfGeode and manipulate the list of pfGeoStates attached to them.

     pfGeode*    pfNewGeode(void);
     pfType*     pfGetGeodeClassType(void);
     int         pfAddGSet(pfGeode* geode, pfGeoSet *gset);
     int         pfInsertGSet(pfGeode* geode, int index, pfGeoSet *gset);
     int         pfReplaceGSet(pfGeode* geode, pfGeoSet *oldgs,
                   pfGeoSet *newgs);
     int         pfRemoveGSet(pfGeode* geode, pfGeoSet *gset);
     pfGeoSet*   pfGetGSet(const pfGeode* geode, int i);
     int         pfGetNumGSets(const pfGeode* geode);

pfText C API

A pfText node is a list of pfStrings much as a pfGeode is a list of pfGeoSets. The two APIs are also similar - a new pfText node can be created and the list of pfStrings attached to it can be manipulated by addition, insertion, removal or replacement.

     pfText*     pfNewText(void);
     pfType*     pfGetTextClassType(void);
     int         pfAddString(pfText* text, pfString *str);
     int         pfInsertString(pfText* text, int index, pfString *str);
     int         pfReplaceString(pfText* text, pfString *oldgs,
                   pfString *newgs);
     int         pfRemoveString(pfText* text, pfString *str);
     pfString*   pfGetString(const pfText* text, int i);
     int         pfGetNumStrings(const pfText* text);

pfBillboard C API

A pfBillboard is a pfGeode in which each pfGeoSet rotates to follow the eyepoint. Billboards are useful for representing complex objects which are roughly symmetrical about one or more axes. A pfBillboard can contain any number of pfGeoSets which can be added to and removed from the pfBillboard using pfGeode API. Further, the position, mode and axis of rotation of a pfBillboard can also be manipulated.

     pfBillboard*   pfNewBboard(void);
     pfType*        pfGetBboardClassType(void);
     void           pfBboardAxis(pfBillboard* bboard, const pfVec3 axis);
     void           pfGetBboardAxis(pfBillboard* bboard, pfVec3 axis);
     void           pfBboardMode(pfBillboard* bboard, int mode, int val);
     int            pfGetBboardMode(pfBillboard* bboard, int mode);
     void           pfBboardPos(pfBillboard* bboard, int i, const pfVec3 pos);
     void           pfGetBboardPos(pfBillboard* bboard, int i, pfVec3 pos);

pfPath C API

A pfPath is a dynamically-sized array of pfNode pointers that defines a specific path or chain of nodes through a scene graph. pfNewPath creates a new path.

     pfPath*   pfNewPath(void);
     pfType*   pfGetPathClassType(void);
     void      pfCullResult(int result);
     int       pfGetParentCullResult(void);
     int       pfGetCullResult(void);
     int       pfCullPath(pfPath *path, pfNode *root, int mode);

pfTraverser C API

These functions are provided as a means to obtain information about the behavior of the IRIS Performer traversal routines. They can be used to determine the pfChannel or pfNode currently being culled or drawn, set the matrix for the current traversal, determine the path from the root of the scene graph to the node currently being traversed and the results of culling the node currently being traversed and the parent of the current node.

     pfChannel*      pfGetTravChan(const pfTraverser* trav);
     pfNode*         pfGetTravNode(const pfTraverser* trav);
     void            pfGetTravMat(const pfTraverser* trav, pfMatrix mat);
     int             pfGetTravIndex(const pfTraverser* trav);
     const pfPath*   pfGetTravPath(const pfTraverser* trav);

pfFrameStats C API

A pfFrameStats structure contains a pfStats class as well as additional statistics classes and support for tracking frame related tasks. Many of the functions correspond directly to similar functions for the pfStats class.

     pfFrameStats*   pfNewFStats(void);
     pfType*         pfGetFStatsClassType(void);
     uint            pfFStatsClass(pfFrameStats *fstats, uint mask, int val);
     uint            pfGetFStatsClass(pfFrameStats *fstats, uint emask);
     uint            pfFStatsClassMode(pfFrameStats *fstats, int class,
                       uint mask, int val);
     uint            pfGetFStatsClassMode(pfFrameStats *fstats, int class);
     void            pfFStatsAttr(pfFrameStats *fstats, int attr, float val);
     float           pfGetFStatsAttr(pfFrameStats *fstats, int attr);
     uint            pfGetOpenFStats(pfFrameStats *fstats, uint emask);
     uint            pfOpenFStats(pfFrameStats *fstats, uint enmask);
     uint            pfCloseFStats(uint enmask);
     void            pfResetFStats(pfFrameStats *fstats);
     void            pfClearFStats(pfFrameStats *fstats, uint which);
     void            pfAccumulateFStats(pfFrameStats *fstats,
                       pfFrameStats* src, uint which);
     void            pfAverageFStats(pfFrameStats *fstats, pfFrameStats* src,
                       uint which, int num);
     void            pfFStatsCountGSet(pfFrameStats *fstats, pfGeoSet *gset);
     int             pfQueryFStats(pfFrameStats *fstats, uint which,
                       void *dst, int size);
     int             pfMQueryFStats(pfFrameStats *fstats, uint *which,
                       void *dst, int size);
     void            pfDrawFStats(pfFrameStats *fstats, pfChannel *chan);
     void            pfFStatsCountNode(pfFrameStats *fstats, int class,
                       uint mode, pfNode * node);


libpr Functions

Initialization Routines

These routines initialize and configure Performer to use multiple processors and graphics pipelines. All libpf appliciations must call pfInit and pfConfig before creating a scene graph or initiating rendering with pfFrame. pfInit initializes shared memory and the clock. pfConfig creates multiple processes based on the requested configuration and sets up internal data structures for frame-accurate propagation of data between the processes.

     void   prInit(void);
     void   prExit(void);

Shared Memory

This is an interface to creating and manipulating a shared memory area to house the data structures shared by the different IRIS Performer processes. pfInitArenas creates a shared memory arena that can be used to allocate memory, locks and semaphores from. The other functions free this arena, control the directory where it is created, return handles to the shared memory and the semaphore memory and set the base address and size of these shared memory areas.

     int            pfInitArenas(void);
     int            pfFreeArenas(void);
     PF_USPTR_T*    pfGetSemaArena(void);
     void           pfSemaArenaSize(size_t size);
     size_t         pfGetSemaArenaSize(void);
     void           pfSemaArenaBase(void *base);
     void*          pfGetSemaArenaBase(void);
     void*          pfGetSharedArena(void);
     void           pfSharedArenaSize(size_t size);
     size_t         pfGetSharedArenaSize(void);
     void           pfSharedArenaBase(void *base);
     void*          pfGetSharedArenaBase(void);
     void           pfTmpDir(char *dir);
     const char *   pfGetTmpDir(void);

Draw Modes

IRIS Performer supports a large number of drawing modes like shading, transparency, anti-aliasing and coplanar geometry. These functions define these modes and enable and disable them.

     void    pfShadeModel(int model);
     int     pfGetShadeModel(void);
     void    pfTransparency(int type);
     int     pfGetTransparency(void);
     void    pfAlphaFunc(float ref, int func);
     void    pfGetAlphaFunc(float* ref, int* func);
     void    pfAntialias(int type);
     int     pfGetAntialias(void);
     void    pfDecal(int mode);
     int     pfGetDecal(void);
     void    pfCullFace(int cull);
     int     pfGetCullFace(void);
     void    pfEnable(int target);
     void    pfDisable(int target);
     int     pfGetEnable(int target);
     void    pfClear(int which, const pfVec4 col);
     void    pfClear(int which, const pfVec4 *col);
     void    pfGLOverride(int mode, float val);
     float   pfGetGLOverride(int mode);

GL Matrix Stack

These functions operate on the graphics library matrix stack. Various standard operations on matrices are supported.

     void   pfScale(float x, float y, float z);
     void   pfTranslate(float x, float y, float z);
     void   pfRotate(int axis, float degrees);
     void   pfPushMatrix(void);
     void   pfPushIdentMatrix(void);
     void   pfPopMatrix(void);
     void   pfLoadMatrix(const pfMatrix m);
     void   pfMultMatrix(const pfMatrix m);

Notification

These functions provide a general purpose error message and notification handling facility for applications using IRIS Performer. User-defined functions can be used as notifiers.

     void               pfNotifyHandler(pfNotifyFuncType handler);
     pfNotifyFuncType   pfGetNotifyHandler(void);
     void               pfDefaultNotifyHandler(pfNotifyData *notice);
     void               pfNotifyLevel(int severity);
     int                pfGetNotifyLevel(void);
     void               pfNotify(int severity, int error, char *format,

Clock Routines

These routines provide a simple and consistent interface to the high resolution hardware-specific timers available on most SGI platforms.

     double        pfGetTime(void);
     pid_t         pfInitClock(double time);
     void          pfWrapClock(void);
     void          pfClockName(char *name);
     const char*   pfGetClockName(void);
     void          pfClockMode(int mode);
     int           pfGetClockMode(void);

File Paths

These functions can be used to specify a UNIX-style file path to search for files in and to find files in such a path.

     void          pfFilePath(const char* path);
     const char*   pfGetFilePath(void);
     int           pfFindFile(const char* file, char path[PF_MAXSTRING],
                     int amode);

Video Clock Routines

These functions provide an interface to the video retrace clock attached to each graphics pipeline. Once a video clock is initialised, its current value can be determined and it can be used to synchronize a process with a time barrier.

     int    pfStartVClock(void);
     void   pfStopVClock(void);
     void   pfInitVClock(int ticks);
     void   pfVClockOffset(int offset);
     int    pfGetVClockOffset(void);
     int    pfGetVClock(void);
     int    pfVClockSync(int rate, int offset);

pfWindow Routines

IRIS Performer provides a system-independent window paradigm. The prInitGfx function may be called to initialize the graphics subsystem and acquire the graphics attributes Performer requires. Use pfGetCurWin to gain access to the current window.

     void         prInitGfx(void);
     pfWindow *   pfGetCurWin(void);

Window System Routines

The pfWSConnection data structure encapsulates the workstation- independent frame-buffer (window) facility in IRIS Performer. These functions serve to define specific windowing attributes necessary for the application, to open and close windows, and to manipulate the window parameters.

     void             pfCloseWSConnection(pfWSConnection dsp);
     pfFBConfig       pfChooseFBConfig(pfWSConnection dsp, int screen,
                        int *attr);
     pfFBConfig       pfChooseFBConfigData(void **dst, pfWSConnection dsp,
                        int screen, int *attr, void *arena);
     void             pfSelectWSConnection(pfWSConnection);
     pfWSConnection   pfOpenWSConnection(const char *str, int shared);
     pfWSConnection   pfOpenScreen(int screen, int shared);
     pfWSConnection   pfGetCurWSConnection(void);
     const char*      pfGetWSConnectionName(pfWSConnection);
     void             pfGetScreenSize(int screen, int *x, int *y);

Query Features

Use the QueryFeature routines to determine the presence, absence, or limitations of features in the underlying graphics implementation, like the availability of attenuation in the lighting model or the availability of multiple graphics pipes.

     int    pfQueryFeature(int which, int *dst);
     int    pfMQueryFeature(int *which, int *dst);
     void   pfFeature(int which, int val);

Query System

Use the QuerySys routines to determine the capacity and limitations of the underlying graphics implementation, like the size of texture memory or the number of stencil planes available.

     int   pfQuerySys(int which, int *dst);
     int   pfMQuerySys(int *which, int *dst);

pfObject C API

A pfObject is the abstract data type from which the major IRIS Performer data structures are derived. Although pfObjects cannot be created directly, most IRIS Performer data structures are derived from them and thus inherit the functionality of the pfObject routines and those for pfMemory.

     pfType*            pfGetObjectClassType(void);
     void               pfCopyFunc(pfCopyFuncType func);
     pfCopyFuncType     pfGetCopyFunc(void);
     void               pfDeleteFunc(pfDeleteFuncType func);
     pfMergeFuncType    pfGetMergeFunc(void);
     void               pfMergeFunc(pfMergeFuncType func);
     pfDeleteFuncType   pfGetDeleteFunc(void);
     void               pfPrintFunc(pfPrintFuncType func);
     pfPrintFuncType    pfGetPrintFunc(void);
     int                pfGetGLHandle(const pfObject *obj);
     void               pfUserData(pfObject* obj, void* data);
     void*              pfGetUserData(pfObject* obj);

pfType C API

All IRIS Performer data types that derive from pfObject/pfMemory have an associated pfType. The pfType can be used to determine the class ancestory of both built-in and add-on data types.

     pfType*   pfNewType(pfType *parent, char *name);
     pfType*   pfGetTypeParent(pfType* type);
     int       pfIsDerivedFrom(pfType* type, pfType *ancestor);
     void      pfMaxTypes(int n);
     pfFog*    pfGetCurFog(void);

pfFog C API

pfFog is used to simulate atmospheric phenomena such as fog and haze and for depthcueing. The fog color is blended with the color that is com- puted for rendered geometry based on the geometry's range from the eyepoint. IRIS Performer provides functions for defining fog color, ranges, and other attributes.

     pfFog*          pfNewFog(void *arena);
     pfType*         pfGetFogClassType(void);
     void            pfFogType(pfFog* fog, int type);
     int             pfGetFogType(const pfFog* fog);
     void            pfFogRange(pfFog* fog, float onset, float opaque);
     void            pfGetFogRange(const pfFog* fog, float* onset,
                       float* opaque);
     void            pfFogOffsets(pfFog* fog, float onset, float opaque);
     void            pfGetFogOffsets(const pfFog* fog, float *onset,
                       float *opaque);
     void            pfFogRamp(pfFog* fog, int points, float* range,
                       float* density, float bias);
     void            pfGetFogRamp(const pfFog* fog, int* points, float* range,
                       float* density, float* bias);
     void            pfFogColor(pfFog* fog, float r, float g, float b);
     void            pfGetFogColor(const pfFog* fog, float* r, float* g,
                       float* b);
     float           pfGetFogDensity(const pfFog* fog, float range);
     void            pfApplyFog(pfFog* fog);
     pfColortable*   pfGetCurCtab(void);

pfColortable C API

A pfColortable is a 'color indexing' mechanism used by pfGeoSets. pfGeoSets can be drawn with the colors defined in the current globally active pfColortable rather than by using the pfGeoset's own local color list. This facility can be used for instant large-scale color manipulation of geometry in a scene.

     pfColortable*   pfNewCtab(int size, void *arena);
     pfType*         pfGetCtabClassType(void);
     int             pfGetCtabSize(const pfColortable* ctab);
     int             pfCtabColor(pfColortable* ctab, int index,
                       pfVec4 acolor);
     int             pfGetCtabColor(const pfColortable* ctab, int index,
                       pfVec4 acolor);
     pfVec4*         pfGetCtabColors(const pfColortable* ctab);
     void            pfApplyCtab(pfColortable* ctab);

pfDataPool C API

A pfDataPool is similar to a shared memory malloc arena but adds the ability to lock/unlock pfDataPool memory for multiprocessing applications. The pfDataPool functions allow related or unrelated processes to share data and provide a means for locking data blocks to eliminate data collision.

     pfDataPool*      pfCreateDPool(uint size, char* name);
     pfDataPool*      pfAttachDPool(char* name);
     pfType*          pfGetDPoolClassType(void);
     const char*      pfGetDPoolName(pfDataPool* dpool);
     void             pfDPoolAttachAddr(void *addr);
     void*            pfGetDPoolAttachAddr(void);
     int              pfGetDPoolSize(pfDataPool* dpool);
     volatile void*   pfDPoolAlloc(pfDataPool* dpool, uint size, int id);
     volatile void*   pfDPoolFind(pfDataPool* dpool, int id);
     int              pfDPoolFree(pfDataPool* dpool, void* dpmem);
     int              pfReleaseDPool(pfDataPool* dpool);
     int              pfDPoolLock(void* dpmem);
     int              pfDPoolSpinLock(void* dpmem, int spins, int block);
     void             pfDPoolUnlock(void* dpmem);
     int              pfDPoolTest(void* dpmem);


pfDispList C API

A pfDispList is a display list that once open, captures certain libpr commands, such as pfTransparency, pfApplyTex, or pfDrawGSet. After it is closed, it may be executed through Performer to perform the recorded commands. pfDispLists are designed for multiprocessing, where one process builds a display list of the visible scene and another process draws it.

     pfDispList*   pfNewDList(int type, int size, void *arena);
     pfType*       pfGetDListClassType(void);
     int           pfGetDListSize(const pfDispList* dlist);
     int           pfGetDListType(const pfDispList* dlist);
     int           pfDrawDList(pfDispList* dlist);
     void          pfOpenDList(pfDispList* dlist);
     void          pfCloseDList(void);
     void          pfResetDList(pfDispList* dlist);
     void          pfAddDListCmd(int cmd);
     void          pfDListCallback(pfDListFuncType callback, int bytes,
                     void* data);
     pfDispList*   pfGetCurDList(void);
     void          pfDrawGLObj(GLOBJECT obj);

pfFont C API

The pfFont facility provides the capability to load fonts for 3-D rendering with the string drawing routines from pfString and pfText. IRIS Performer uses this facility to provide wireframe, flat, extruded, and textured-quad fonts in three dimensions.

     pfFont*         pfNewFont(void *arena);
     pfType*         pfGetFontClassType(void);
     void            pfFontCharGSet(pfFont* font, int ascii, pfGeoSet *gset);
     pfGeoSet*       pfGetFontCharGSet(pfFont* font, int ascii);
     void            pfFontCharSpacing(pfFont* font, int ascii,
                       pfVec3 spacing);
     const pfVec3*   pfGetFontCharSpacing(pfFont* font, int ascii);
     void            pfFontAttr(pfFont* font, int which, void *attr);
     void*           pfGetFontAttr(pfFont* font, int which);
     void            pfFontVal(pfFont* font, int which, float val);
     float           pfGetFontVal(pfFont* font, int which);
     void            pfFontMode(pfFont* font, int mode, int val);
     int             pfGetFontMode(pfFont* font, int mode);

pfGeoSet C API

The pfGeoSet (short for "Geometry Set") is a fundamental IRIS Performer data structure. Each pfGeoSet is a collection of geometry with one primitive type, such as points, lines, triangles, and homogeneous attribute bindings, such as "untextured with colors per vertex and normals per primitive," so that each pfGeoSet may be presented to the graphics subsystem with as little overhead as possible, using an optimized draw routine, one for each type of pfGeoSet.

     pfGeoSet*      pfNewGSet(void *arena);
     pfType*        pfGetGSetClassType(void);
     void           pfGSetNumPrims(pfGeoSet* gset, int n);
     int            pfGetGSetNumPrims(const pfGeoSet* gset);
     void           pfGSetPrimType(pfGeoSet* gset, int type);
     int            pfGetGSetPrimType(const pfGeoSet* gset);
     void           pfGSetPrimLengths(pfGeoSet* gset, int *lengths);
     int*           pfGetGSetPrimLengths(const pfGeoSet* gset);
     void           pfGSetAttr(pfGeoSet* gset, int attr, int bind,
                      void* alist, ushort* ilist);
     int            pfGetGSetAttrBind(const pfGeoSet* gset, int attr);
     void           pfGetGSetAttrLists(const pfGeoSet* gset, int attr,
                      void** alist, ushort** ilist);
     int            pfGetGSetAttrRange(const pfGeoSet* gset, int attr,
                      int *min, int *max);
     void           pfGSetDrawMode(pfGeoSet* gset, int mode, int val);
     int            pfGetGSetDrawMode(const pfGeoSet* gset, int mode);
     void           pfGSetGState(pfGeoSet* gset, pfGeoState *gstate);
     pfGeoState*    pfGetGSetGState(const pfGeoSet* gset);
     void           pfGSetGStateIndex(pfGeoSet* gset, int id);
     int            pfGetGSetGStateIndex(const pfGeoSet* gset);
     void           pfGSetHlight(pfGeoSet* gset, pfHighlight *hlight);
     pfHighlight*   pfGetGSetHlight(const pfGeoSet* gset);
     void           pfGSetLineWidth(pfGeoSet* gset, float width);
     float          pfGetGSetLineWidth(const pfGeoSet* gset);
     void           pfGSetPntSize(pfGeoSet* gset, float s);
     float          pfGetGSetPntSize(const pfGeoSet* gset);
     void           pfGSetIsectMask(pfGeoSet* gset, uint mask, int setMode,
                      int bitOp);
     uint           pfGetGSetIsectMask(const pfGeoSet* gset);
     void           pfGSetDrawBin(pfGeoSet* gset, short bin);
     int            pfGetGSetDrawBin(const pfGeoSet* gset);
     void           pfGSetBBox(pfGeoSet* gset, pfBox* box, int mode);
     int            pfGetGSetBBox(pfGeoSet* gset, pfBox* box);
     void           pfDrawGSet(pfGeoSet* gset);
     int            pfQueryGSet(const pfGeoSet* gset, uint which, void *dst);
     int            pfMQueryGSet(const pfGeoSet* gset, uint *which,
                      void *dst);
     int            pfGSetIsectSegs(pfGeoSet* gset, pfSegSet *segSet,
                      pfHit **hits[]);
     void           pfDrawHlightedGSet(pfGeoSet* gset);
     void           pfGSetPassFilter(uint mask);
     uint           pfGetGSetPassFilter(void);

pfHit C API

These routines support the testing of intersections of line segments with geometry in pfGeoSets.

     pfType*       pfGetHitClassType(void);
     int           pfQueryHit(const pfHit* hit, uint which, void *dst);
     int           pfMQueryHit(const pfHit* hit, uint *which, void *dst);
     pfGeoState*   pfGetCurGState(void);
     pfGeoState*   pfGetCurIndexedGState(int index);
     pfList*       pfGetCurGStateTable(void);

pfGeoState C API

pfGeoState is an encapsulation of libpr graphics modes and attributes, and is normally bound to pfGeoSets. The pfGeoState represents a complete graphics state, allowing IRIS Performer to draw pfGeoSets in an arbitrary order and evaluate state changes in a lazy fashion to reduce overhead caused by changing graphics state.

     pfGeoState*     pfNewGState(void *arena);
     pfType*         pfGetGStateClassType(void);
     void            pfGStateMode(pfGeoState* gstate, int attr, int a);
     int             pfGetGStateMode(const pfGeoState* gstate, int attr);
     int             pfGetGStateCurMode(const pfGeoState* gstate, int attr);
     int             pfGetGStateCombinedMode(const pfGeoState* gstate,
                       int attr, const pfGeoState *combState);
     void            pfGStateVal(pfGeoState* gstate, int attr, float a);
     float           pfGetGStateVal(const pfGeoState* gstate, int attr);
     float           pfGetGStateCurVal(const pfGeoState* gstate, int attr);
     float           pfGetGStateCombinedVal(const pfGeoState* gstate,
                       int attr, const pfGeoState *combState);
     void            pfGStateInherit(pfGeoState* gstate, uint mask);
     uint            pfGetGStateInherit(const pfGeoState* gstate);
     void            pfGStateAttr(pfGeoState* gstate, int attr, void* a);
     void*           pfGetGStateAttr(const pfGeoState* gstate, int attr);
     void*           pfGetGStateCurAttr(const pfGeoState* gstate, int attr);
     void*           pfGetGStateCombinedAttr(const pfGeoState* gstate,
                       int attr, const pfGeoState *combState);
     void            pfLoadGState(pfGeoState* gstate);
     void            pfApplyGState(pfGeoState* gstate);
     void            pfMakeBasicGState(pfGeoState* gstate);
     void            pfApplyGStateTable(pfList *gstab);
     pfHighlight *   pfGetCurHlight(void);

pfHighlight C API

IRIS Performer supports a mechanism for highlighting individual objects in a scene with a variety of special drawing styles that are activated by applying a pfHighlight state structure. Highlighting makes use of outlining of lines and polygons and of filling polygons with patterned or textured overlays.

     pfHighlight*   pfNewHlight(void *arena);
     pfType*        pfGetHlightClassType(void);
     void           pfHlightMode(pfHighlight* hlight, uint mode);
     uint           pfGetHlightMode(const pfHighlight* hlight);
     pfGeoState*    pfGetHlightGState(const pfHighlight* hlight);
     void           pfHlightGState(pfHighlight* hlight, pfGeoState *gstate);
     void           pfHlightGStateIndex(pfHighlight* hlight, int id);
     int            pfGetHlightGStateIndex(const pfHighlight* hlight);
     void           pfHlightColor(pfHighlight* hlight, uint which, float r,
                      float g, float b);
     void           pfGetHlightColor(const pfHighlight* hlight, uint which,
                      float *r, float *g, float *b);
     void           pfHlightAlpha(pfHighlight* hlight, float a);
     float          pfGetHlightAlpha(const pfHighlight* hlight);
     void           pfHlightNormalLength(pfHighlight* hlight, float len,
                      float bboxScale);
     void           pfGetHlightNormalLength(const pfHighlight* hlight,
                      float *len, float *bboxScale);
     void           pfHlightLineWidth(pfHighlight* hlight, float width );
     float          pfGetHlightLineWidth(const pfHighlight* hlight);
     void           pfHlightPntSize(pfHighlight* hlight, float size );
     float          pfGetHlightPntSize(const pfHighlight* hlight);
     void           pfHlightLinePat(pfHighlight* hlight, int which,
                      ushort pat);
     ushort         pfGetHlightLinePat(const pfHighlight* hlight, int which);
     void           pfHlightFillPat(pfHighlight* hlight, int which,
                      uint *fillPat );
     void           pfGetHlightFillPat(const pfHighlight* hlight, int which,
                      uint *pat);
     void           pfHlightTex(pfHighlight* hlight, pfTexture *tex);
     pfTexture*     pfGetHlightTex(const pfHighlight* hlight);
     void           pfHlightTEnv(pfHighlight* hlight, pfTexEnv *tev);
     pfTexEnv*      pfGetHlightTEnv(const pfHighlight* hlight);
     void           pfHlightTGen(pfHighlight* hlight, pfTexGen *tgen);
     pfTexGen*      pfGetHlightTGen(const pfHighlight* hlight);
     void           pfApplyHlight(pfHighlight* hlight);
     int            pfGetCurLights(pfLight *lights[PF_MAX_LIGHTS]);

pfLight C API

A pfLight is a light source that illuminates scene geometry, generating realistic shading effects. A pfLight cannot itself be seen but attributes such as color, spotlight direction, and position can be set to provide illuminative effects on scene geometry.

     pfLight*        pfNewLight(void *arena);
     pfType*         pfGetLightClassType(void);
     void            pfLightColor(pfLight* light, int which, float r, float g,
                       float b);
     void            pfGetLightColor(const pfLight* light, int which,
                       float* r, float* g, float* b);
     void            pfLightAmbient(pfLight* light, float r, float g,
                       float b);
     void            pfGetLightAmbient(const pfLight* light, float* r,
                       float* g, float* b);
     void            pfLightPos(pfLight* light, float x, float y, float z,
                       float w);
     void            pfGetLightPos(const pfLight* light, float* x, float* y,
                       float* z, float* w);
     void            pfLightAtten(pfLight* light, float a0, float a1,
                       float a2);
     void            pfGetLightAtten(const pfLight* light, float* a0,
                       float* a1, float* a2);
     void            pfSpotLightDir(pfLight* light, float x, float y,
                       float z);
     void            pfGetSpotLightDir(const pfLight* light, float* x,
                       float* y, float* z);
     void            pfSpotLightCone(pfLight* light, float f1, float f2);
     void            pfGetSpotLightCone(const pfLight* light, float* f1,
                       float* f2);
     void            pfLightOn(pfLight* light);
     void            pfLightOff(pfLight* light);
     int             pfIsLightOn(pfLight* light);
     pfLightModel*   pfGetCurLModel(void);

pfLightModel C API

A pfLightModel defines characteristics of the hardware lighting model used to illuminate geometry, such as attenuation, local vs. global lighting model, and ambient energy.

     pfLightModel*    pfNewLModel(void *arena);
     pfType*          pfGetLModelClassType(void);
     void             pfLModelLocal(pfLightModel* lmodel, int l);
     int              pfGetLModelLocal(const pfLightModel* lmodel);
     void             pfLModelTwoSide(pfLightModel* lmodel, int t);
     int              pfGetLModelTwoSide(const pfLightModel* lmodel);
     void             pfLModelAmbient(pfLightModel* lmodel, float r, float g,
                        float b);
     void             pfGetLModelAmbient(const pfLightModel* lmodel, float* r,
                        float* g, float* b);
     void             pfLModelAtten(pfLightModel* lmodel, float a0, float a1,
                        float a2);
     void             pfGetLModelAtten(const pfLightModel* lmodel, float* a0,
                        float* a1, float* a2);
     void             pfApplyLModel(pfLightModel* lmodel);
     pfLPointState*   pfGetCurLPState(void);

pfLPointState C API

A pfLPointState is a libpr data structure which, in conjunction with a pfGeoSet of type PFGS_POINTS, supports a sophisticated light point primitive type. Examples of light points are stars, beacons, strobes, and taxiway lights. Light points are different from light sources in that a pfLight is not itself visible but illuminates scene geometry, whereas a light point is visible as a self-illuminated small point that does not illuminate surrounding objects.

     pfLPointState*   pfNewLPState(void *arena);
     pfType*          pfGetLPStateClassType(void);
     void             pfLPStateMode(pfLPointState* lpstate, int mode,
                        int val);
     int              pfGetLPStateMode(const pfLPointState* lpstate,
                        int mode);
     void             pfLPStateVal(pfLPointState* lpstate, int attr,
                        float val);
     float            pfGetLPStateVal(const pfLPointState* lpstate, int attr);
     void             pfLPStateShape(pfLPointState* lpstate, float horiz,
                        float vert, float roll, float falloff,
                        float ambient);
     void             pfGetLPStateShape(const pfLPointState* lpstate,
                        float *horiz, float *vert, float *roll,
                        float *falloff, float *ambient);
     void             pfLPStateBackColor(pfLPointState* lpstate, float r,
                        float g, float b, float a);
     void             pfGetLPStateBackColor(pfLPointState* lpstate, float *r,
                        float *g, float *b, float *a);
     void             pfApplyLPState(pfLPointState* lpstate);
     void             pfMakeLPStateRangeTex(pfLPointState* lpstate,
                        pfTexture *tex, int size, pfFog* fog);
     void             pfMakeLPStateShapeTex(pfLPointState* lpstate,
                        pfTexture *tex, int size);
     pfMaterial*      pfGetCurMtl(int side);

pfMaterial C API

In conjunction with other lighting parameters, a pfMaterial defines the appearance of illuminated geometry. A pfMaterial defines the reflectance characteristics of surfaces such as diffuse color and shininess.

     pfMaterial*   pfNewMtl(void *arena);
     pfType*       pfGetMtlClassType(void);
     void          pfMtlSide(pfMaterial* mtl, int side);
     int           pfGetMtlSide(pfMaterial* mtl);
     void          pfMtlAlpha(pfMaterial* mtl, float alpha);
     float         pfGetMtlAlpha(pfMaterial* mtl);
     void          pfMtlShininess(pfMaterial* mtl, float shininess);
     float         pfGetMtlShininess(pfMaterial* mtl);
     void          pfMtlColor(pfMaterial* mtl, int acolor, float r, float g,
                     float b);
     void          pfGetMtlColor(pfMaterial* mtl, int acolor, float* r,
                     float* g, float* b);
     void          pfMtlColorMode(pfMaterial* mtl, int side, int mode);
     int           pfGetMtlColorMode(pfMaterial* mtl, int side);
     void          pfApplyMtl(pfMaterial* mtl);
     pfSprite*     pfGetCurSprite(void);

pfSprite C API

pfSprite is an intelligent transformation and is logically grouped with other libpr transformation primitives like pfMultMatrix. pfSprite rotates geometry orthogonal to the viewer, so the viewer only sees the "front" of the model. As a result, complexity is saved in the model by omitting the "back" geometry. A further performance enhancement is to incorporate visual complexity in a texture map rather than in geometry. Thus, on machines with fast texture mapping, sprites can present very complex images with very little geometry. Classic examples of textured sprites use a single quadrilateral that when rotated about a vertical axis simulate trees and when rotated about a point simulate clouds or puffs of smoke.

     pfSprite*   pfNewSprite(void *arena);
     pfType*     pfGetSpriteClassType(void);
     void        pfSpriteMode(pfSprite* sprite, int which, int val);
     int         pfGetSpriteMode(const pfSprite* sprite, int which);
     void        pfSpriteAxis(pfSprite* sprite, float x, float y, float z);
     void        pfGetSpriteAxis(pfSprite* sprite, float *x, float *y,
                   float *z);
     void        pfBeginSprite(pfSprite* sprite);
     void        pfEndSprite(void);
     void        pfPositionSprite(float x, float y, float z);
     void        pfInitState(usptr_t* arena);
     pfState*    pfGetCurState(void);
     void        pfPushState(void);
     void        pfPopState(void);
     void        pfGetState(pfGeoState *gstate);
     void        pfFlushState(void);
     void        pfBasicState(void);
     void        pfOverride(uint mask, int val);
     uint        pfGetOverride(void);
     void        pfModelMat(pfMatrix mat);
     void        pfGetModelMat(pfMatrix mat);
     void        pfViewMat(pfMatrix mat);
     void        pfGetViewMat(pfMatrix mat);
     void        pfTexMat(pfMatrix mat);
     void        pfGetTexMat(pfMatrix mat);
     void        pfInvModelMat(pfMatrix mat);
     void        pfGetInvModelMat(pfMatrix mat);
     void        pfNearPixDist(float pd);
     float       pfGetNearPixDist(void);

pfState C API

IRIS Performer manages a subset of the graphics library state for convenience and improved performance, and thus provides its own API for manipulating graphics state such as transparency, antialiasing, or fog. Attributes not set within a pfGeoState are inherited from the pfState.

     pfState*   pfNewState(void);
     pfType*    pfGetStateClassType(void);
     void       pfSelectState(pfState* state);
     void       pfLoadState(pfState* state);
     void       pfAttachState(pfState* state, pfState *state1);

pfString C API

pfString provides a pfGeoSet like facility for encapsulating geometry to display a string in 3-D with attributes such as color, arbitrary transformation matrix, and font (see pfFont).

     pfString*           pfNewString(void *arena);
     pfType*             pfGetStringClassType(void);
     int                 pfGetStringStringLength(const pfString* string);
     void                pfStringMode(pfString* string, int mode, int val);
     int                 pfGetStringMode(const pfString* string, int mode);
     void                pfStringFont(pfString* string, pfFont* fnt);
     pfFont*             pfGetStringFont(const pfString* string);
     void                pfStringString(pfString* string, const char* cstr);
     const char*         pfGetStringString(const pfString* string);
     const pfGeoSet*     pfGetStringCharGSet(const pfString* string,
                           int index);
     const pfVec3*       pfGetStringCharPos(const pfString* string,
                           int index);
     void                pfStringSpacingScale(pfString* string, float sx,
                           float sy, float sz);
     void                pfGetStringSpacingScale(const pfString* string,
                           float *sx, float *sy, float *sz);
     void                pfStringGState(pfString* string, pfGeoState *gs);
     const pfGeoState*   pfGetStringGState(const pfString* string);
     void                pfStringColor(pfString* string, float r, float g,
                           float b, float a);
     void                pfGetStringColor(const pfString* string, float *r,
                           float *g, float *b, float *a);
     void                pfStringBBox(pfString* string, const pfBox* newbox);
     const pfBox*        pfGetStringBBox(const pfString* string);
     void                pfStringMat(pfString* string, const pfMatrix mat);
     void                pfGetStringMat(const pfString* string, pfMatrix mat);
     void                pfStringIsectMask(pfString* string, uint mask,
                           int setMode, int bitOp);
     uint                pfGetStringIsectMask(const pfString* string);
     void                pfDrawString(pfString* string);
     void                pfFlattenString(pfString* string);
     int                 pfStringIsectSegs(pfString* string, pfSegSet *segSet,
                           pfHit **hits[]);
     pfTexture*          pfGetCurTex(void);

pfTexture C API

pfTexture encapsulates texturing data and attributes such as the texture image itself, the texture data format and the filters for proximity and distance.

     pfTexture*    pfNewTex(void *arena);
     pfType*       pfGetTexClassType(void);
     void          pfTexName(pfTexture* tex, const char *name);
     const char*   pfGetTexName(const pfTexture* tex);
     void          pfTexImage(pfTexture* tex, uint* image, int comp, int sx,
                     int sy, int sz);
     void          pfGetTexImage(const pfTexture* tex, uint** image,
                     int* comp, int* sx, int* sy, int* sz);
     void          pfTexLoadImage(pfTexture* tex, uint* image);
     uint*         pfGetTexLoadImage(const pfTexture* tex);
     void          pfTexBorderColor(pfTexture* tex, pfVec4 clr);
     void          pfGetTexBorderColor(pfTexture* tex, pfVec4 *clr);
     void          pfTexBorderType(pfTexture* tex, int type);
     int           pfGetTexBorderType(pfTexture* tex);
     void          pfTexFormat(pfTexture* tex, int format, int type);
     int           pfGetTexFormat(const pfTexture* tex, int format);
     void          pfTexFilter(pfTexture* tex, int filt, int type);
     int           pfGetTexFilter(const pfTexture* tex, int filt);
     void          pfTexRepeat(pfTexture* tex, int wrap, int type);
     int           pfGetTexRepeat(const pfTexture* tex, int wrap);
     void          pfTexSpline(pfTexture* tex, int type, pfVec2 *pts,
                     float clamp);
     void          pfGetTexSpline(const pfTexture* tex, int type, pfVec2 *pts,
                     float *clamp);
     void          pfTexDetail(pfTexture* tex, int l, pfTexture *detail);
     void          pfGetTexDetail(const pfTexture* tex, int *l,
                     pfTexture **detail);
     pfTexture*    pfGetTexDetailTex(const pfTexture* tex);
     void          pfDetailTexTile(pfTexture* tex, int j, int k, int m, int n,
                     int scram);
     void          pfGetDetailTexTile(const pfTexture* tex, int *j, int *k,
                     int *m, int *n, int *scram);
     void          pfTexList(pfTexture* tex, pfList *list);
     pfList*       pfGetTexList(const pfTexture* tex);
     void          pfTexFrame(pfTexture* tex, float frame);
     float         pfGetTexFrame(const pfTexture* tex);
     void          pfTexLoadMode(pfTexture* tex, int mode, int val);
     int           pfGetTexLoadMode(const pfTexture* tex, int mode);
     void          pfTexLevel(pfTexture* tex, int level, pfTexture* ltex);
     pfTexture*    pfGetTexLevel(pfTexture* tex, int level);
     void          pfTexLoadOrigin(pfTexture* tex, int which, int xo, int yo);
     void          pfGetTexLoadOrigin(pfTexture* tex, int which, int *xo,
                     int *yo);
     void          pfTexLoadSize(pfTexture* tex, int xs, int ys);
     void          pfGetTexLoadSize(const pfTexture* tex, int *xs, int *ys);
     void          pfApplyTex(pfTexture* tex);
     void          pfFormatTex(pfTexture* tex);
     void          pfLoadTex(pfTexture* tex);
     void          pfLoadTexLevel(pfTexture* tex, int level);
     void          pfSubloadTex(pfTexture* tex, int source, uint *image,
                     int xsrc, int ysrc, int xdst, int ydst, int xsize,
                     int ysize);
     void          pfSubloadTexLevel(pfTexture* tex, int source, uint *image,
                     int xsrc, int ysrc, int xdst, int ydst, int xsize,
                     int ysize, int level);
     int           pfLoadTexFile(pfTexture* tex, char* fname);
     void          pfFreeTexImage(pfTexture* tex);
     void          pfIdleTex(pfTexture* tex);
     int           pfIsTexLoaded(const pfTexture* tex);
     int           pfIsTexFormatted(const pfTexture* tex);
     pfTexEnv*     pfGetCurTEnv(void);

pfTexEnv C API

pfTexEnv encapsulates the texture environment and how the texture should interact with the colors of the geometry to which it is bound, i.e. how graphics coordinates are transformed into texture coordinates.

     pfTexEnv*   pfNewTEnv(void *arena);
     pfType*     pfGetTEnvClassType(void);
     void        pfTEnvMode(pfTexEnv* tenv, int mode);
     int         pfGetTEnvMode(const pfTexEnv* tenv);
     void        pfTEnvComponent(pfTexEnv* tenv, int comp);
     int         pfGetTEnvComponent(const pfTexEnv* tenv);
     void        pfTEnvBlendColor(pfTexEnv* tenv, float r, float g, float b,
                   float a);
     void        pfGetTEnvBlendColor(pfTexEnv* tenv, float* r, float* g,
                   float* b, float* a);
     void        pfApplyTEnv(pfTexEnv* tenv);
     pfTexGen*   pfGetCurTGen(void);

pfTexGen C API

The pfTexGen capability is used to automatically generate texture coordinates for geometry, typically for special effects like projected texture, reflection mapping, and lightpoints (see pfLPointState).

     pfTexGen*   pfNewTGen(void *arena);
     pfType*     pfGetTGenClassType(void);
     void        pfTGenMode(pfTexGen* tgen, int texCoord, int mode);
     int         pfGetTGenMode(const pfTexGen* tgen, int texCoord);
     void        pfTGenPlane(pfTexGen* tgen, int texCoord, float x, float y,
                   float z, float d);
     void        pfGetTGenPlane(pfTexGen* tgen, int texCoord, float* x,
                   float* y, float* z, float* d);
     void        pfApplyTGen(pfTexGen* tgen);

pfCycleMemory C API

The pfCycleMemory data type is the low-level memory object used by pfCycleBuffers to provide the illusion of a single block of memory that can have a different value for each process that references it at one instant in time. For example, a pfGeoSet might have vertex position, normal, color, or texture arrays that are being morphed in process A, culled in process B, drawn in process C, and intersected with in process D, all with different values due to temporal reasons. Refer to the pfCycleBuffer overview for a description of how the two features work in concert.

     pfType*          pfGetCMemClassType(void);
     pfCycleBuffer*   pfGetCMemCBuffer(pfCycleMemory* cmem);
     int              pfGetCMemFrame(const pfCycleMemory* cmem);

pfCycleBuffer C API

pfCycleBuffer supports efficient management of dynamically modified data in a multi-stage multiprocessed pipeline. A pfCycleBuffer logically contains multiple pfCycleMemorys. Each process has a global index which selects the currently active pfCycleMemory in each pfCycleBuffer. This index can be advanced once a frame by pfCurCBufferIndex so that the buffers "cycle". By advancing the index appropriately in each pipeline stage, dynamic data can be frame-accurately propagated down the pipeline.

     pfCycleBuffer*   pfNewCBuffer(size_t nbytes, void *arena);
     pfType*          pfGetCBufferClassType(void);
     pfCycleMemory*   pfGetCBufferCMem(const pfCycleBuffer* cBuf, int index);
     void*            pfGetCurCBufferData(const pfCycleBuffer* cBuf);
     void             pfCBufferChanged(pfCycleBuffer* cBuf);
     void             pfInitCBuffer(pfCycleBuffer* cBuf, void *data);
     int              pfCBufferConfig(int numBuffers);
     int              pfGetCBufferConfig(void);
     int              pfCBufferFrame(void);
     int              pfGetCBufferFrameCount(void);
     int              pfGetCurCBufferIndex(void);
     void             pfCurCBufferIndex(int index);
     pfCycleBuffer*   pfGetCBuffer(void *data);

pfMemory C API

A pfMemory is the data type from which the major IRIS Performer types are derived and also provides the primary mechanism for allocating memory used by pfMalloc.

     pfType*       pfGetMemoryClassType(void);
     void*         pfMalloc(size_t nbytes, void *arena);
     void*         pfCalloc(size_t numelem, size_t elsize, void *arena);
     char*         pfStrdup(const char *str, void *arena);
     void*         pfRealloc(void *data, size_t nbytes);
     size_t        pfGetSize(void *data);
     void*         pfGetArena(void *data);
     void          pfFree(void *data);
     void*         pfGetData(const void *data);
     pfMemory*     pfGetMemory(const void *data);
     const char*   pfGetTypeName(const void *data);
     pfType*       pfGetType(const void *data);
     int           pfIsOfType(const void *data, pfType *type);
     int           pfIsExactType(const void *data, pfType *type);
     int           pfRef(void* mem);
     int           pfUnref(void* mem);
     ushort        pfGetRef(const void* mem);
     int           pfCompare(const void* mem1, const void* mem2);
     int           pfPrint(const void* mem, uint travMode, uint verbose,
                     FILE* file);
     int           prDelete(void* mem);
     int           prUnrefDelete(void* mem);
     int           prCopy(void* dst, const void* src);
     pfFile*       pfOpenFile(char* fname, int oflag,

pfFile C API

pfFile provides a non-blocking, multiprocessing mechanism for file I/O with a similar interface to the standard UNIX file I/O functions. The difference is that these routines return immediately without blocking while the physical file-system access operation completes and also that instead of an integer file descriptor, a pfFile handle is used.

     pfFile*   pfCreateFile(char* fname, mode_t mode);
     pfType*   pfGetFileClassType(void);
     int       pfGetFileStatus(const pfFile* file, int attr);
     int       pfReadFile(pfFile* file, char* buf, int nbyte);
     int       pfWriteFile(pfFile* file, char* buf, int nbyte);
     off_t     pfSeekFile(pfFile* file, off_t off, int whence);
     int       pfCloseFile(pfFile* file);

pfList C API

A pfList is a dynamically-sized array of arbitrary, but homogeneously sized, elements. IRIS Performer provides the facility to create, manipulate, and search a pfList.

     pfList*   pfNewList(int eltSize, int listLength, void *arena);
     pfType*   pfGetListClassType(void);
     int       pfGetListEltSize(const pfList* list);
     void**    pfGetListArray(const pfList* list);
     void      pfListArrayLen(pfList* list, int alen);
     int       pfGetListArrayLen(const pfList* list);
     void      pfNum(pfList* list, int newNum);
     int       pfGetNum(const pfList* list);
     void      pfSet(pfList* list, int index, void *elt);
     void*     pfGet(const pfList* list, int index);
     void      pfResetList(pfList* list);
     void      pfCombineLists(pfList* lists, const pfList *a,
                 const pfList *b);
     void      pfAdd(pfList* lists, void *elt);
     void      pfInsert(pfList* lists, int index, void *elt);
     int       pfSearch(const pfList* lists, void *elt);
     int       pfRemove(pfList* lists, void *elt);
     void      pfRemoveIndex(pfList* lists, int index);
     int       pfMove(pfList* lists, int index, void *elt);
     int       pfFastRemove(pfList* lists, void *elt);
     void      pfFastRemoveIndex(pfList* lists, int index);
     int       pfReplace(pfList* lists, void *oldElt, void *newElt);

pfWindow C API

These functions provide a single API for creating and managing windows that works across the IRIS GL, IRIS GLX Mixed Mode, and OpenGL-X environments. Window system independent types have been provided to match the X Window System types to provide complete portability between the IRIS GL and OpenGL-X windowing environments.

     pfWindow*      pfNewWin(void *arena);
     pfType*        pfGetWinClassType(void);
     void           pfWinName(pfWindow* win, const char *name);
     const char*    pfGetWinName(const pfWindow* win);
     void           pfWinMode(pfWindow* win, int mode, int val);
     int            pfGetWinMode(const pfWindow* win, int mode);
     void           pfWinType(pfWindow* win, uint type);
     uint           pfGetWinType(const pfWindow* win);
     pfState*       pfGetWinCurState(const pfWindow* win);
     void           pfWinAspect(pfWindow* win, int x, int y);
     void           pfGetWinAspect(const pfWindow* win, int *x, int *y);
     void           pfWinOriginSize(pfWindow* win, int xo, int yo, int xs,
                      int ys);
     void           pfWinOrigin(pfWindow* win, int xo, int yo);
     void           pfGetWinOrigin(const pfWindow* win, int *xo, int *yo);
     void           pfWinSize(pfWindow* win, int xs, int ys);
     void           pfGetWinSize(const pfWindow* win, int *xs, int *ys);
     void           pfWinFullScreen(pfWindow* win);
     void           pfGetWinCurOriginSize(pfWindow* win, int *xo, int *yo,
                      int *xs, int *ys);
     void           pfGetWinCurScreenOriginSize(pfWindow* win, int *xo,
                      int *yo, int *xs, int *ys);
     void           pfWinOverlayWin(pfWindow* win, pfWindow *ow);
     pfWindow*      pfGetWinOverlayWin(const pfWindow* win);
     void           pfWinStatsWin(pfWindow* win, pfWindow *ow);
     pfWindow*      pfGetWinStatsWin(const pfWindow* win);
     void           pfWinScreen(pfWindow* win, int s);
     int            pfGetWinScreen(const pfWindow* win);
     void           pfWinShare(pfWindow* win, uint mode);
     uint           pfGetWinShare(const pfWindow* win);
     void           pfWinWSWindow(pfWindow* win, pfWSConnection dsp,
                      pfWSWindow wsWin);
     pfWSWindow     pfGetWinWSWindow(const pfWindow* win);
     void           pfWinWSDrawable(pfWindow* win, pfWSConnection dsp,
                      pfWSDrawable wsWin);
     pfWSDrawable   pfGetWinWSDrawable(const pfWindow* win);
     pfWSDrawable   pfGetWinCurWSDrawable(const pfWindow* win);
     void           pfWinWSConnectionName(pfWindow* win, const char *name);
     const char*    pfGetWinWSConnectionName(const pfWindow* win);
     void           pfWinFBConfigData(pfWindow* win, void *data);
     void*          pfGetWinFBConfigData(pfWindow* win);
     void           pfWinFBConfigAttrs(pfWindow* win, int *attr);
     int*           pfGetWinFBConfigAttrs(const pfWindow* win);
     void           pfWinFBConfig(pfWindow* win, pfFBConfig vInfo);
     pfFBConfig     pfGetWinFBConfig(const pfWindow* win);
     void           pfWinFBConfigId(pfWindow* win, int vId);
     int            pfGetWinFBConfigId(const pfWindow* win);
     void           pfWinIndex(pfWindow* win, int index);
     int            pfGetWinIndex(const pfWindow* win);
     pfWindow*      pfGetWinSelect(pfWindow* win);
     void           pfWinGLCxt(pfWindow* win, pfGLContext gCxt);
     pfGLContext    pfGetWinGLCxt(const pfWindow* win);
     void           pfWinList(pfWindow* win, pfList *wl);
     pfList*        pfGetWinList(const pfWindow* win);
     void           pfOpenWin(pfWindow* win);
     void           pfCloseWin(pfWindow* win);
     void           pfCloseWinGL(pfWindow* win);
     int            pfAttachWin(pfWindow* win, pfWindow *w1);
     int            pfDetachWin(pfWindow* win, pfWindow *w1);
     pfWindow*      pfSelectWin(pfWindow* win);
     void           pfSwapWinBuffers(pfWindow* win);
     pfFBConfig     pfChooseWinFBConfig(pfWindow* win, int *attr);
     int            pfIsWinOpen(const pfWindow* win);
     int            pfQueryWin(pfWindow* win, int which, int *dst);
     int            pfMQueryWin(pfWindow* win, int *which, int *dst);
     pfWindow*      pfOpenNewNoPortWin(const char *name, int screen);
     pfStats*       pfGetCurStats(void);

pfStats C API

These functions are used to collect, manipulate, print, and query statistics on state operations, geometry, and graphics and system operations. IRIS Performer has the ability to keep many types of statistics. Some statistics can be expensive to gather and might possibly influence other statistics. To alleviate this problem, statistics are divided into different classes based on the tasks that they monitor. The specific statistics classes of interest may be selected with pfStatsClass.

     pfStats*   pfNewStats(void *arena);
     pfType*    pfGetStatsClassType(void);
     uint       pfStatsClassMode(pfStats* stats, int class, uint mask,
                  int val);
     uint       pfGetStatsClassMode(pfStats* stats, int class);
     void       pfStatsAttr(pfStats* stats, int attr, float val);
     float      pfGetStatsAttr(pfStats* stats, int attr);
     uint       pfStatsClass(pfStats* stats, uint enmask, int val);
     uint       pfGetStatsClass(pfStats* stats, uint enmask);
     uint       pfGetOpenStats(pfStats* stats, uint enmask);
     uint       pfOpenStats(pfStats* stats, uint enmask);
     uint       pfCloseStats(uint enmask);
     void       pfResetStats(pfStats* stats);
     void       pfClearStats(pfStats* stats, uint which);
     void       pfAccumulateStats(pfStats* stats, pfStats* src, uint which);
     void       pfAverageStats(pfStats* stats, pfStats* src, uint which,
                  int num);
     void       pfCopyStats(pfStats* stats, const pfStats *src, uint which);
     void       pfStatsCountGSet(pfStats* stats, pfGeoSet * gset);
     int        pfQueryStats(pfStats* stats, uint which, void *dst, int size);
     int        pfMQueryStats(pfStats* stats, uint * which, void *dst,
                  int size);
     void       pfStatsHwAttr(int attr, float val);
     float      pfGetStatsHwAttr(int attr);
     void       pfEnableStatsHw(uint which);
     void       pfDisableStatsHw(uint which);
     uint       pfGetStatsHwEnable(uint which);
     void       pfFPConfig(int which, float val);
     float      pfGetFPConfig(int which);
     void       pfSinCos(float arg, float* s, float* c);
     float      pfTan(float arg);
     float      pfArcTan2(float y, float x);
     float      pfArcSin(float arg);
     float      pfArcCos(float arg);
     float      pfSqrt(float arg);

pfVec2 C API

Math functions for 2-component vectors. Most of these routines have macro equivalents which are described in the pfVec2 man page.

     void    pfSetVec2(pfVec2 vec2, float x, float y);
     void    pfCopyVec2(pfVec2 vec2, const pfVec2 v);
     int     pfEqualVec2(const pfVec2 vec2, const pfVec2 v);
     int     pfAlmostEqualVec2(const pfVec2 vec2, const pfVec2 v, float tol);
     void    pfNegateVec2(pfVec2 vec2, const pfVec2 v);
     float   pfDotVec2(const pfVec2 vec2, const pfVec2 v);
     void    pfAddVec2(pfVec2 vec2, const pfVec2 v1, const pfVec2 v2);
     void    pfSubVec2(pfVec2 vec2, const pfVec2 v1, const pfVec2 v2);
     void    pfScaleVec2(pfVec2 vec2, float s, const pfVec2 v);
     void    pfAddScaledVec2(pfVec2 vec2, const pfVec2 v1, float s,
               const pfVec2 v2);
     void    pfCombineVec2(pfVec2 vec2, float a, const pfVec2 v1, float b,
               const pfVec2 v2);
     float   pfSqrDistancePt2(const pfVec2 vec2, const pfVec2 v);
     float   pfNormalizeVec2(pfVec2 vec2);
     float   pfLengthVec2(const pfVec2 vec2);
     float   pfDistancePt2(const pfVec2 vec2, const pfVec2 v);

pfVec3 C API

Math functions for 3-component vectors. Most of these routines have macro equivalents which are described in the pfVec3 man page.

     void    pfSetVec3(pfVec3 vec3, float x, float y, float z);
     void    pfCopyVec3(pfVec3 vec3, const pfVec3 v);
     int     pfEqualVec3(const pfVec3 vec3, const pfVec3 v);
     int     pfAlmostEqualVec3(const pfVec3 vec3, const pfVec3 v, float tol);
     void    pfNegateVec3(pfVec3 vec3, const pfVec3 v);
     float   pfDotVec3(const pfVec3 vec3, const pfVec3 v);
     void    pfAddVec3(pfVec3 vec3, const pfVec3 v1, const pfVec3 v2);
     void    pfSubVec3(pfVec3 vec3, const pfVec3 v1, const pfVec3 v2);
     void    pfScaleVec3(pfVec3 vec3, float s, const pfVec3 v);
     void    pfAddScaledVec3(pfVec3 vec3, const pfVec3 v1, float s,
               const pfVec3 v2);
     void    pfCombineVec3(pfVec3 vec3, float a, const pfVec3 v1, float b,
               const pfVec3 v2);
     float   pfSqrDistancePt3(const pfVec3 vec3, const pfVec3 v);
     float   pfNormalizeVec3(pfVec3 vec3);
     float   pfLengthVec3(const pfVec3 vec3);
     float   pfDistancePt3(const pfVec3 vec3, const pfVec3 v);
     void    pfCrossVec3(pfVec3 vec3, const pfVec3 v1, const pfVec3 v2);
     void    pfXformVec3(pfVec3 vec3, const pfVec3 v, const pfMatrix m);
     void    pfXformPt3(pfVec3 vec3, const pfVec3 v, const pfMatrix m);
     void    pfFullXformPt3(pfVec3 vec3, const pfVec3 v, const pfMatrix m);

pfVec4 C API

Math functions for 4-component vectors. Most of these routines have macro equivalents which are described in the pfVec4 man page.

     void    pfSetVec4(pfVec4 vec4, float x, float y, float z, float w);
     void    pfCopyVec4(pfVec4 vec4, const pfVec4 v);
     int     pfEqualVec4(const pfVec4 vec4, const pfVec4 v);
     int     pfAlmostEqualVec4(const pfVec4 vec4, const pfVec4 v, float tol);
     void    pfNegateVec4(pfVec4 vec4, const pfVec4 v);
     float   pfDotVec4(const pfVec4 vec4, const pfVec4 v);
     void    pfAddVec4(pfVec4 vec4, const pfVec4 v1, const pfVec4 v2);
     void    pfSubVec4(pfVec4 vec4, const pfVec4 v1, const pfVec4 v2);
     void    pfScaleVec4(pfVec4 vec4, float s, const pfVec4 v);
     void    pfAddScaledVec4(pfVec4 vec4, const pfVec4 v1, float s,
               const pfVec4 v2);
     void    pfCombineVec4(pfVec4 vec4, float a, const pfVec4 v1, float b,
               const pfVec4 v2);
     float   pfSqrDistancePt4(const pfVec4 vec4, const pfVec4 v);
     float   pfNormalizeVec4(pfVec4 vec4);
     float   pfLengthVec4(const pfVec4 vec4);
     float   pfDistancePt4(const pfVec4 vec4, const pfVec4 v);
     void    pfXformVec4(pfVec4 vec4, const pfVec4 v, const pfMatrix m);

pfMatrix C API

The pfMatrix data type represents a complete 4x4 real matrix. These routines create transformation matrices based on multiplying a row vector by a matrix on the right, i.e. the vector v transformed by m is v * m. Many actions will go considerably faster if the last column is (0,0,0,1).

Some of these routines have macro equivalents which are described in the pfMatrix man page.

     void   pfSetMat(pfMatrix mat, float *m);
     int    pfGetMatType(const pfMatrix mat);
     void   pfSetMatRowVec3(pfMatrix mat, int r, const pfVec3 v);
     void   pfSetMatRow(pfMatrix mat, int r, float x, float y, float z,
              float w);
     void   pfGetMatRowVec3(pfMatrix mat, int r, pfVec3 dst);
     void   pfGetMatRow(pfMatrix mat, int r, float *x, float *y, float *z,
              float *w);
     void   pfSetMatColVec3(pfMatrix mat, int c, const pfVec3 v);
     void   pfSetMatCol(pfMatrix mat, int c, float x, float y, float z,
              float w);
     void   pfGetMatColVec3(pfMatrix mat, int c, pfVec3 dst);
     void   pfGetMatCol(pfMatrix mat, int c, float *x, float *y, float *z,
              float *w);
     void   pfGetOrthoMatCoord(pfMatrix mat, pfCoord* dst);
     void   pfMakeIdentMat(pfMatrix mat);
     void   pfMakeEulerMat(pfMatrix mat, float hdeg, float pdeg, float rdeg);
     void   pfMakeRotMat(pfMatrix mat, float degrees, float x, float y,
              float z);
     void   pfMakeTransMat(pfMatrix mat, float x, float y, float z);
     void   pfMakeScaleMat(pfMatrix mat, float x, float y, float z);
     void   pfMakeVecRotVecMat(pfMatrix mat, const pfVec3 v1,
              const pfVec3 v2);
     void   pfMakeCoordMat(pfMatrix mat, const pfCoord* c);
     void   pfGetOrthoMatQuat(pfMatrix mat, pfQuat dst);
     void   pfMakeQuatMat(pfMatrix mat, const pfQuat q);
     void   pfCopyMat(pfMatrix mat, const pfMatrix v);
     int    pfEqualMat(const pfMatrix mat, const pfMatrix m);
     int    pfAlmostEqualMat(const pfMatrix mat, const pfMatrix m2,
              float tol);
     void   pfTransposeMat(pfMatrix mat, pfMatrix m);
     void   pfMultMat(pfMatrix mat, const pfMatrix m1, const pfMatrix m2);
     void   pfAddMat(pfMatrix mat, const pfMatrix m1, const pfMatrix m2);
     void   pfSubMat(pfMatrix mat, const pfMatrix m1, const pfMatrix m2);
     void   pfScaleMat(pfMatrix mat, float s, const pfMatrix m);
     void   pfPostMultMat(pfMatrix mat, const pfMatrix m);
     void   pfPreMultMat(pfMatrix mat, const pfMatrix m);
     int    pfInvertFullMat(pfMatrix mat, pfMatrix m);
     void   pfInvertAffMat(pfMatrix mat, const pfMatrix m);
     void   pfInvertOrthoMat(pfMatrix mat, const pfMatrix m);
     void   pfInvertOrthoNMat(pfMatrix mat, pfMatrix m);
     void   pfInvertIdentMat(pfMatrix mat, const pfMatrix m);
     void   pfPreTransMat(pfMatrix mat, float x, float y, float z,
              pfMatrix m);
     void   pfPostTransMat(pfMatrix mat, const pfMatrix m, float x, float y,
              float z);
     void   pfPreRotMat(pfMatrix mat, float degrees, float x, float y,
              float z, pfMatrix m);
     void   pfPostRotMat(pfMatrix mat, const pfMatrix m, float degrees,
              float x, float y, float z);
     void   pfPreScaleMat(pfMatrix mat, float xs, float ys, float zs,
              pfMatrix m);
     void   pfPostScaleMat(pfMatrix mat, const pfMatrix m, float xs, float ys,
              float zs);

pfQuat C API

pfQuat represents a quaternion as the four floating point values (x, y, z, w) of a pfVec4. Some of these routines have macro equivalents which are described in the pfMatrix man page.

     void    pfGetQuatRot(pfQuat quat, float *angle, float *x, float *y,
               float *z);
     void    pfMakeRotQuat(pfQuat quat, float angle, float x, float y,
               float z);
     void    pfConjQuat(pfQuat quat, const pfQuat v);
     float   pfLengthQuat(const pfQuat quat);
     void    pfMultQuat(pfQuat quat, const pfQuat q1, const pfQuat q2);
     void    pfDivQuat(pfQuat quat, const pfQuat q1, const pfQuat q2);
     void    pfInvertQuat(pfQuat quat, const pfQuat q1);
     void    pfExpQuat(pfQuat quat, const pfQuat q);
     void    pfLogQuat(pfQuat quat, const pfQuat q);
     void    pfSlerpQuat(pfQuat quat, float t, const pfQuat q1,
               const pfQuat q2);
     void    pfSquadQuat(pfQuat quat, float t, const pfQuat q1,
               const pfQuat q2, const pfQuat a, const pfQuat b);
     void    pfQuatMeanTangent(pfQuat quat, const pfQuat q1, const pfQuat q2,
               const pfQuat q3);

pfMatStack C API

These routines allow the creation and manipulation of a stack of 4x4 matrices.

     pfMatStack*   pfNewMStack(int size, void *arena);
     pfType*       pfGetMStackClassType(void);
     void          pfGetMStack(const pfMatStack* mst, pfMatrix m);
     pfMatrix*     pfGetMStackTop(const pfMatStack* mst);
     int           pfGetMStackDepth(const pfMatStack* mst);
     void          pfResetMStack(pfMatStack* mst);
     int           pfPushMStack(pfMatStack* mst);
     int           pfPopMStack(pfMatStack* mst);
     void          pfLoadMStack(pfMatStack* mst, const pfMatrix m);
     void          pfPreMultMStack(pfMatStack* mst, const pfMatrix m);
     void          pfPostMultMStack(pfMatStack* mst, const pfMatrix m);
     void          pfPreTransMStack(pfMatStack* mst, float x, float y,
                     float z);
     void          pfPostTransMStack(pfMatStack* mst, float x, float y,
                     float z);
     void          pfPreRotMStack(pfMatStack* mst, float degrees, float x,
                     float y, float z);
     void          pfPostRotMStack(pfMatStack* mst, float degrees, float x,
                     float y, float z);
     void          pfPreScaleMStack(pfMatStack* mst, float xs, float ys,
                     float zs);
     void          pfPostScaleMStack(pfMatStack* mst, float xs, float ys,
                     float zs);

pfSeg C API

A pfSeg represents a line segment starting at pos, extending for a length length in the direction dir. The routines assume that dir is of unit length, otherwise the results are undefined. pfSeg is a public struct whose data members pos, dir and length may be operated on directly.

     void   pfMakePtsSeg(pfSeg* seg, const pfVec3 p1, const pfVec3 p2);
     void   pfMakePolarSeg(pfSeg* seg, const pfVec3 pos, float azi,
              float elev, float len);
     void   pfClipSeg(pfSeg* seg, const pfSeg *seg, float d1, float d2);
     int    pfClosestPtsOnSeg(const pfSeg* seg, const pfSeg *seg, pfVec3 dst1,
              pfVec3 dst2);

pfPlane C API

A pfPlane represents an infinite 2D plane as a normal and a distance offset from the origin in the normal direction. A point on the plane satisfies the equation normal dot (x, y, z) = offset. pfPlane is a public struct whose data members normal and offset may be operated on directly.

     void   pfMakePtsPlane(pfPlane* plane, const pfVec3 p1, const pfVec3 p2,
              const pfVec3 p3);
     void   pfMakeNormPtPlane(pfPlane* plane, const pfVec3 norm,
              const pfVec3 pos);
     void   pfDisplacePlane(pfPlane* plane, float d);
     int    pfHalfSpaceContainsBox(const pfPlane* plane, const pfBox *box);
     int    pfHalfSpaceContainsSphere(const pfPlane* plane,
              const pfSphere *sph);
     int    pfHalfSpaceContainsCyl(const pfPlane* plane,
              const pfCylinder *cyl);
     int    pfHalfSpaceContainsPt(const pfPlane* plane, const pfVec3 pt);
     void   pfOrthoXformPlane(pfPlane* plane, const pfPlane *pln,
              const pfMatrix m);
     void   pfClosestPtOnPlane(const pfPlane* plane, const pfVec3 pt,
              pfVec3 dst);
     int    pfPlaneIsectSeg(const pfPlane* plane, const pfSeg *seg, float *d);
     int    pfHalfSpaceIsectSeg(const pfPlane* plane, const pfSeg *seg,
              float *d1, float *d2);

pfSphere C API

pfSpheres are typically used as bounding volumes in a scene graph. These routines allow bounding spheres to be created and manipulated.

     void   pfMakeEmptySphere(pfSphere* sphere);
     int    pfSphereContainsPt(const pfSphere* sphere, const pfVec3 pt);
     int    pfSphereContainsSphere(const pfSphere* sphere,
              const pfSphere *sph);
     int    pfSphereContainsCyl(const pfSphere* sphere,
              const pfCylinder *cyl);
     void   pfSphereAroundPts(pfSphere* sphere, const pfVec3* pts, int npt);
     void   pfSphereAroundSpheres(pfSphere* sphere, const pfSphere **sphs,
              int nsph);
     void   pfSphereAroundBoxes(pfSphere* sphere, const pfBox **boxes,
              int nbox);
     void   pfSphereAroundCyls(pfSphere* sphere, const pfCylinder **cyls,
              int ncyl);
     void   pfSphereExtendByPt(pfSphere* sphere, const pfVec3 pt);
     void   pfSphereExtendBySphere(pfSphere* sphere, const pfSphere *sph);
     void   pfSphereExtendByCyl(pfSphere* sphere, const pfCylinder *cyl);
     void   pfOrthoXformSphere(pfSphere* sphere, const pfSphere *sph,
              const pfMatrix m);
     int    pfSphereIsectSeg(const pfSphere* sphere, const pfSeg *seg,
              float *d1, float *d2);

pfCylinder C API

A pfCylinder represents a cylinder of finite length. The routines listed here provide means of creating and extending cylinders for use as bounding geometry around groups of line segments. The cylinder is defined by its center, radius, axis and halfLength. The routines assume axis is a vector of unit length, otherwise results are undefined. pfCylinder is a public struct whose data members center, radius, axis and halfLength may be operated on directly.

     void   pfMakeEmptyCyl(pfCylinder* cyl);
     int    pfCylContainsPt(const pfCylinder* cyl, const pfVec3 pt);
     void   pfOrthoXformCyl(pfCylinder* cyl, const pfCylinder *cyl,
              const pfMatrix m);
     void   pfCylAroundPts(pfCylinder* cyl, const pfVec3 *pts, int npt);
     void   pfCylAroundSegs(pfCylinder* cyl, const pfSeg **segs, int nseg);
     void   pfCylAroundSpheres(pfCylinder* cyl, const pfSphere **sphs,
              int nsph);
     void   pfCylAroundBoxes(pfCylinder* cyl, const pfBox **boxes, int nbox);
     void   pfCylExtendBySphere(pfCylinder* cyl, const pfSphere *sph);
     void   pfCylExtendByCyl(pfCylinder* cyl, const pfCylinder *cyl);
     void   pfCylExtendByBox(pfCylinder* cyl, const pfVec3 pt);
     int    pfCylIsectSeg(const pfCylinder* cyl, const pfSeg *seg, float *d1,
              float *d2);

pfBox C API

A pfBox is an axis-aligned box which can be used for intersection tests and for maintaining bounding information about geometry. A box represents the axis-aligned hexahedral volume: (x, y, z) where min[0] <= x <= max[0], min[1] <= y <= max[1] and min[2] <= z <= max[2]. pfBox is a public struct whose data members min and max may be operated on directly.

     void   pfMakeEmptyBox(pfBox* box);
     int    pfBoxContainsPt(const pfBox* box, const pfVec3 pt);
     int    pfBoxContainsBox(pfBox* box, const pfBox *inbox);
     void   pfXformBox(pfBox* box, const pfBox *box, const pfMatrix xform);
     void   pfBoxAroundPts(pfBox* box, const pfVec3 *pts, int npt);
     void   pfBoxAroundSpheres(pfBox* box, const pfSphere **sphs, int nsph);
     void   pfBoxAroundBoxes(pfBox* box, const pfBox **boxes, int nbox);
     void   pfBoxAroundCyls(pfBox* box, const pfCylinder **cyls, int ncyl);
     void   pfBoxExtendByPt(pfBox* box, const pfVec3 pt);
     void   pfBoxExtendByBox(pfBox* box, const pfBox *box);
     int    pfBoxIsectSeg(const pfBox* box, const pfSeg *seg, float *d1,
              float *d2);

pfPolytope C API

A pfPolytope is a set of half spaces whose intersection defines a convex, possibly semi-infinite, volume which may be used for culling and other intersection testing where a tighter bound than a pfBox, pfSphere, or pfCylinder is of benefit.

     pfPolytope*   pfNewPtope(void *arena);
     pfType*       pfGetPtopeClassType(void);
     int           pfGetPtopeNumFacets(pfPolytope* ptp);
     int           pfPtopeFacet(pfPolytope* ptp, int i, const pfPlane *p);
     int           pfGetPtopeFacet(pfPolytope* ptp, int i, pfPlane *p);
     int           pfRemovePtopeFacet(pfPolytope* ptp, int i);
     void          pfOrthoXformPtope(pfPolytope* ptp, const pfPolytope *src,
                     const pfMatrix mat);
     int           pfPtopeContainsPt(const pfPolytope* ptp, const pfVec3 pt);
     int           pfPtopeContainsSphere(const pfPolytope* ptp,
                     const pfSphere *sphere);
     int           pfPtopeContainsBox(const pfPolytope* ptp,
                     const pfBox *box);
     int           pfPtopeContainsCyl(const pfPolytope* ptp,
                     const pfCylinder *cyl);
     int           pfPtopeContainsPtope(const pfPolytope* ptp,
                     const pfPolytope *ptope);

pfFrustum C API

A pfFrustum represents a viewing and or culling volume bounded by left, right, top, bottom, near and far planes.

     pfFrustum*   pfNewFrust(void *arena);
     pfType*      pfGetFrustClassType(void);
     int          pfGetFrustType(const pfFrustum* fr);
     void         pfFrustAspect(pfFrustum* fr, int which,
                    float widthHeightRatio);
     float        pfGetFrustAspect(const pfFrustum* fr);
     void         pfGetFrustFOV(const pfFrustum* fr, float* fovh,
                    float* fovv);
     void         pfFrustNearFar(pfFrustum* fr, float nearDist,
                    float farDist);
     void         pfGetFrustNearFar(const pfFrustum* fr, float* nearDist,
                    float* farDist);
     void         pfGetFrustNear(const pfFrustum* fr, pfVec3 ll, pfVec3 lr,
                    pfVec3 ul, pfVec3 ur);
     void         pfGetFrustFar(const pfFrustum* fr, pfVec3 ll, pfVec3 lr,
                    pfVec3 ul, pfVec3 ur);
     void         pfGetFrustPtope(const pfFrustum* fr, pfPolytope *dst);
     void         pfGetFrustGLProjMat(const pfFrustum* fr, pfMatrix mat);
     int          pfGetFrustEye(const pfFrustum* fr, pfVec3 eye);
     void         pfMakePerspFrust(pfFrustum* fr, float left, float right,
                    float bot, float top);
     void         pfMakeOrthoFrust(pfFrustum* fr, float left, float right,
                    float bot, float top);
     void         pfMakeSimpleFrust(pfFrustum* fr, float fov);
     void         pfOrthoXformFrust(pfFrustum* fr, const pfFrustum* fr2,
                    const pfMatrix mat);
     int          pfFrustContainsPt(const pfFrustum* fr, const pfVec3 pt);
     int          pfFrustContainsSphere(const pfFrustum* fr,
                    const pfSphere *sphere);
     int          pfFrustContainsBox(const pfFrustum* fr, const pfBox *box);
     int          pfFrustContainsCyl(const pfFrustum* fr,
                    const pfCylinder *cyl);
     void         pfApplyFrust(const pfFrustum* fr);

Triangle Intersection

This routine returns the intersection of a triangle with a line segment and is the basis for Performer's performing intersection testing and picking against geometry contained in pfGeoSets.

     int   pfTriIsectSeg(const pfVec3 pt1, const pfVec3 pt2, const pfVec3 pt3,
             const pfSeg* seg, float* d);


libpfdu Functions

Database Conversions

IRIS Performer provides an extensive array of converters which load file-based geometry formats into a pfScene hierarchical scene graph. These functions also provide the capability to set attributes which modify the behavior of individual loaders.

     pfNode*   pfdLoadFile(const char *file);
     int       pfdStoreFile(pfNode *root, const char *file);
     pfNode*   pfdConvertFrom(void *root, const char *ext);
     void*     pfdConvertTo(pfNode* root, const char *ext);
     int       pfdInitConverter(const char *ext);
     int       pfdExitConverter(const char *ext);
     FILE*     pfdOpenFile(const char *file);
     void      pfdAddExtAlias(const char *ext, const char *alias);
     void      pfdConverterMode(const char *ext, int mode, int value);
     int       pfdGetConverterMode(const char *ext, int mode);
     void      pfdConverterAttr(const char *ext, int which, void *attr);
     void*     pfdGetConverterAttr(const char *ext, int which);
     void      pfdConverterVal(const char *ext, int which, float val);
     float     pfdGetConverterVal(const char *ext, int which);
     void      pfdPrintSceneGraphStats(pfNode *node, double elapsedTime);

Generate pfGeoSets

These routines are provided to conveniently construct pfGeoSets for various geometric objects. The resulting objects are always positioned and sized in canonical ways. The user can then apply a transformation to these pfGeoSets to achieve the desired shape and position.

     pfGeoSet *   pfdNewCube(void *arena);
     pfGeoSet *   pfdNewSphere(int ntris, void *arena);
     pfGeoSet *   pfdNewCylinder(int ntris, void *arena);
     pfGeoSet *   pfdNewCone(int ntris, void *arena);
     pfGeoSet *   pfdNewPipe(float botRadius, float topRadius, int ntris,
                    void *arena);
     pfGeoSet *   pfdNewPyramid(void *arena);
     pfGeoSet *   pfdNewArrow(int ntris, void *arena);
     pfGeoSet *   pfdNewDoubleArrow(int ntris, void *arena);
     pfGeoSet *   pfdNewCircle(int ntris, void *arena);
     pfGeoSet *   pfdNewRing(int ntris, void *arena);
     void         pfdXformGSet(pfGeoSet *gset, pfMatrix mat);
     void         pfdGSetColor(pfGeoSet *gset, float r, float g, float b,
                    float a);

Mesh Triangles

Forming independent triangles into triangle strips (or meshes) can significantly improve rendering performance on IRIS systems. Strips reduce the amount of work required by the CPU, bus, and graphics subsystem. IRIS Performer provides this utility facility for converting independent triangles into strips.

     pfGeoSet*   pfdMeshGSet(pfGeoSet *gset);
     void        pfdMesherMode(int mode, int val);
     int         pfdGetMesherMode(int mode);
     void        pfdShowStrips(pfGeoSet *gset);

Optimize Scene Graphs

pfdCleanTree and pfdStaticize optimize the scene graph. pfdCleanTree removes pfGroups with one or fewer child and pfSCSes with identity transformations. pfdStaticize conditionally converts pfDCSes to pfSCSes, usually in preparation for pfFlatten.

     pfNode*   pfdCleanTree(pfNode *node, pfuTravFuncType doitfunc);
     void      pfdReplaceNode(pfNode *oldn, pfNode *newn);
     void      pfdInsertGroup(pfNode *oldn, pfGroup *grp);
     void      pfdRemoveGroup(pfGroup *oldn);
     pfNode*   pfdFreezeTransforms(pfNode *node, pfuTravFuncType doitfunc);

Breakup Scene Graphs

pfdBreakup is provided as a utility to break unstructured scene geometry into a spacially subdivided scene hierarchy. Spacially subdivided geometry is more easily culled and less time is spent drawing geometry which does not contribute to the final image.

     pfNode*   pfdBreakup(pfGeode *geode, float geodeSize, int stripLength,
                 int geodeChild);

Generate Hierarchies

For performance reasons, it is desirable that the geometry in a scene be organized into a spatial hierarchy. However, it is often easiest to model geometry using logical, rather than spatial, divisions. pfdTravGetGSets and pfdSpatialize can be used to partition an already constructed scene.

     pfList *   pfdTravGetGSets(pfNode *node);
     pfGroup*   pfdSpatialize(pfGroup *group, float maxGeodeSize,
                  int maxGeoSets);

Share pfGeoStates

It is obviously desirable to share state between database objects in IRIS Performer whenever possible. The notion of pervasive state sharing underpins the entire pfGeoState mechanism. Common data such as texture, materials, and lighting models are often duplicated in many different objects throughout a database. This collection of functions provides the means necessary to easily achieve sharing among these objects by automatically producing a non-redundant set of states.

     pfdShare*   pfdNewShare(void);
     int         pfdCleanShare(pfdShare *share);
     void        pfdDelShare(pfdShare *share, int deepDelete);
     void        pfdPrintShare(pfdShare *share);
     int         pfdCountShare(pfdShare *share);
     pfList*     pfdGetSharedList(pfdShare *share, pfType* type);
     pfObject*   pfdNewSharedObject(pfdShare *share, pfObject *object);
     pfObject*   pfdFindSharedObject(pfdShare *share, pfObject *object);
     int         pfdAddSharedObject(pfdShare *share, pfObject *object);
     void        pfdMakeShared(pfNode *node);
     void        pfdMakeSharedScene(pfScene *scene);
     int         pfdCleanShare(pfdShare *share);
     int         pfdRemoveSharedObject(pfdShare *share, pfObject *object);
     pfList*     pfdGetNodeGStateList(pfNode *node);

Combine pfLayers

When multiple sibling layer nodes have been created, efficiency will be improved by combining them together. pfdCombineLayers provides for exactly this kind of optimization.

     void   pfdCombineLayers(pfNode *node);

Combine pfBillboards

The performance of pfBillboard nodes is enhanced when they contain several pfGeoSets each as opposed to a scene graph with a large number of single pfGeoSet pfBillboards. The pfdCombineBillboards() traversal creates this efficient situation by traversing a scene graph and combining the pfGeoSets of sibling pfBillboard nodes into a single pfBillboard node.

     void   pfdCombineBillboards(pfNode *node, int sizeLimit);

The Geometry Builder

It is seldom the case that database models are expressed directly in internal Performer structures (pfGeoSets). Instead, models are generally described in geometric constructs defined by the modeller. The Performer GeoBuilder is meant to simplify the task of translating model geometry into Performer geometry structures. The GeoBuilder can also create many kinds of polygon mesh (e.g. triangle-strips) pfGeoSets, which can significantly improve performance.

     pfdGeom*         pfdNewGeom(int numV);
     void             pfdResizeGeom(pfdGeom *geom, int numV);
     void             pfdDelGeom(pfdGeom *geom);
     int              pfdReverseGeom(pfdGeom *geom);
     pfdGeoBuilder*   pfdNewGeoBldr(void);
     void             pfdDelGeoBldr(pfdGeoBuilder* bldr);
     void             pfdGeoBldrMode(pfdGeoBuilder* bldr, int mode, int val);
     int              pfdGetGeoBldrMode(pfdGeoBuilder* bldr, int mode);
     int              pfdTriangulatePoly(pfdGeom *pgon, pfdPrim *triList);
     void             pfdAddGeom(pfdGeoBuilder *bldr, pfdGeom *Geom, int num);
     void             pfdAddLineStrips(pfdGeoBuilder *bldr,
                        pfdGeom *lineStrips, int num);
     void             pfdAddLines(pfdGeoBuilder *bldr, pfdGeom *lines);
     void             pfdAddPoints(pfdGeoBuilder *bldr, pfdGeom *points);
     void             pfdAddPoly(pfdGeoBuilder *bldr, pfdGeom *poly);
     void             pfdAddIndexedLineStrips(pfdGeoBuilder *bldr,
                        pfdGeom *lines, int num);
     void             pfdAddIndexedLines(pfdGeoBuilder *bldr, pfdGeom *lines);
     void             pfdAddIndexedPoints(pfdGeoBuilder *bldr,
                        pfdGeom *points);
     void             pfdAddIndexedPoly(pfdGeoBuilder *bldr, pfdGeom *poly);
     void             pfdAddIndexedTri(pfdGeoBuilder *bldr, pfdPrim *tri);
     void             pfdAddLine(pfdGeoBuilder *bldr, pfdPrim *line);
     void             pfdAddPoint(pfdGeoBuilder *bldr, pfdPrim *Point);
     void             pfdAddTri(pfdGeoBuilder *bldr, pfdPrim *tri);
     int              pfdGetNumTris(pfdGeoBuilder *bldr);
     const pfList*    pfdBuildGSets(pfdGeoBuilder *bldr);
     void             pfdPrintGSet(pfGeoSet *gset);

The Scene Builder

The Performer Builder is meant to manage most of the details of constructing efficient runtime structures from input models. It provides a simple and convenient interface for bringing scene data into the application without the need for considering how best to structure that data for efficient rendering in Performer. The Builder provides a comprehensive interface between model input code (such as database file parsers) and the internal mechanisms of scene representation in Performer. In addition to handling input geometry, as the GeoBuilder does, the Builder also manages the associated graphics state.

     void                 pfdInitBldr(void);
     void                 pfdExitBldr(void);
     pfdBuilder *         pfdNewBldr(void);
     void                 pfdDelBldr(pfdBuilder *bldr);
     void                 pfdSelectBldr(pfdBuilder *bldr);
     pfdBuilder *         pfdGetCurBldr(void);
     void                 pfdBldrDeleteNode(pfNode *node);
     void                 pfdBldrMode(int mode, int val);
     int                  pfdGetBldrMode(int mode);
     void                 pfdBldrAttr(int which, void *attr);
     void *               pfdGetBldrAttr(int which);
     pfObject *           pfdGetTemplateObject(pfType *type);
     void                 pfdResetObject(pfObject *obj);
     void                 pfdResetAllTemplateObjects(void);
     void                 pfdMakeDefaultObject(pfObject *obj);
     void                 pfdResetBldrGeometry(void);
     void                 pfdResetBldrShare(void);
     void                 pfdCleanBldrShare(void);
     void                 pfdCaptureDefaultBldrState(void);
     void                 pfdResetBldrState(void);
     void                 pfdPushBldrState(void);
     void                 pfdPopBldrState(void);
     void                 pfdSaveBldrState(void *name);
     void                 pfdLoadBldrState(void *name);
     void                 pfdBldrGState(const pfGeoState *gstate);
     const pfGeoState *   pfdGetBldrGState(void);
     void                 pfdBldrStateVal(int which, float val);
     float                pfdGetBldrStateVal(int which);
     void                 pfdBldrStateMode(int mode, int val);
     int                  pfdGetBldrStateMode(int mode);
     void                 pfdBldrStateAttr(int which, const void *attr);
     const void *         pfdGetBldrStateAttr(int attr);
     void                 pfdBldrStateInherit(uint mask);
     uint                 pfdGetBldrStateInherit(void);
     void                 pfdSelectBldrName(void *name);
     void *               pfdGetCurBldrName(void);
     void                 pfdAddBldrGeom(pfdGeom *p, int n);
     void                 pfdAddIndexedBldrGeom(pfdGeom *p, int n);
     pfNode *             pfdBuild(void);
     pfNode *             pfdBuildNode(void *name);
     void                 pfdDefaultGState(pfGeoState *def);
     const pfGeoState*    pfdGetDefaultGState(void);
     void pfdMakeSceneGState(pfGeoState *sceneGState,
     void pfdOptimizeGStateList(pfList *gstateList,

Haeberli Font Extensions

This is Paul Haeberli's cool font extension header file - Performer uses Paul's font library to load fonts into pfFont structures.

     pfFont*   pfdLoadFont(const char *ftype, const char *name, int style);
     pfFont*   pfdLoadFont_type1(const char *name, int style);

Texture Callbacks

These routines are now obsolete in that Performer now supports the notion of texture coordinate generation in pfGeoStates via the pfTexGen pfObject. However, these routines are still a good example of how to implement functionality in the draw process through callbacks. Similarly this set of routines also fits into the builder state extension mechanism - see the pfdBuilder man pages.

     int    pfdPreDrawTexgenExt(pfTraverser *trav, void *data);
     int    pfdPostDrawTexgenExt(pfTraverser *trav, void *data);
     int    pfdPreDrawReflMap(pfTraverser *trav, void *data);
     int    pfdPostDrawReflMap(pfTraverser *trav, void *data);
     int    pfdPreDrawContourMap(pfTraverser *trav, void *data);
     int    pfdPostDrawContourMap(pfTraverser *trav, void *data);
     int    pfdPreDrawLinearMap(pfTraverser *trav, void *data);
     int    pfdPostDrawLinearMap(pfTraverser *trav, void *data);
     void   pfdTexgenParams(const float *newParamsX, const float *newParamsY);

Function Extensors

pfdExtensors provide a framework for extending application functionality. They allow generalized callbacks to be attached to the model database. These callbacks can be called from any Performer traversal. The following functions are used to manipulate and install extensors.

     int                  pfdAddState(void *name, long dataSize,
                            void (*initialize)(void *data),
                            void (*deletor)(void *data),
                            int (*compare)(void *data1, void *data2),
                            long (*copy)(void *dst, void *src), int token);
     void                 pfdStateCallback(int stateToken, int whichCBack,
                            pfNodeTravFuncType callback);
     pfNodeTravFuncType   pfdGetStateCallback(int stateToken, int which);
     int                  pfdGetStateToken(void *name);
     int                  pfdGetUniqueStateToken(void);
     pfdExtensor*         pfdNewExtensor(int which);
     pfdExtensorType*     pfdNewExtensorType(int token);
     int                  pfdCompareExtensor(void *a, void *b);
     int                  pfdCompareExtraStates(void *lista, void *listb);
     void                 pfdCopyExtraStates(pfList *dst, pfList *src);
     pfdExtensor*         pfdGetExtensor(int token);
     pfdExtensorType*     pfdGetExtensorType(int token);
     void *               pfdUniqifyData(pfList *dataList, const void *data,
                            long dataSize, void *(*newData)(long),
                            int (*compare)(void *, void *),
                            long (*copy)(void *, void *),
                            int *compareResult);

libpfui Functions

     void   pfiInit(void);

pfiMotionCoord

     pfType*            pfiGetMotionCoordClassType(void);
     pfiMotionCoord *   pfiNewMotionCoord(void *arena);

pfiInputCoord

     pfType*           pfiGetInputCoordClassType(void);
     pfiInputCoord *   pfiNewInputCoord(void *arena);
     void              pfiInputCoordVec(pfiInputCoord *ic, float *vec);
     void              pfiGetInputCoordVec(pfiInputCoord *ic, float *vec);

pfiInputXform

Building user interfaces requires managing user input events. These functions provide a window system independent means of handling event streams.

     pfiInput *                 pfiNewInput(void *arena);
     void                       pfiInputName(pfiInput *in, const char *name);
     const char *               pfiIsIXGetName(pfiInput *in);
     void                       pfiInputFocus(pfiInput *in, int focus);
     int                        pfiGetInputFocus(pfiInput *in);
     void                       pfiInputEventMask(pfiInput *in, int emask);
     int                        pfiGetInputEventMask(pfiInput *in);
     void                       pfiInputEventStreamCollector(pfiInput *in,
                                  pfiEventStreamHandlerType func,
                                  void *data);
     void                       pfiGetInputEventStreamCollector(pfiInput *in,
                                  pfiEventStreamHandlerType *func,
                                  void **data);
     void                       pfiInputEventStreamProcessor(pfiInput *in,
                                  pfiEventStreamHandlerType func,
                                  void *data);
     void                       pfiGetInputEventStreamProcessor(pfiInput *in,
                                  pfiEventStreamHandlerType *func,
                                  void **data);
     void                       pfiInputEventHandler(pfiInput *in,
                                  pfuEventHandlerFuncType func, void *data);
     void                       pfiGetInputEventHandler(pfiInput *in,
                                  pfuEventHandlerFuncType *func,
                                  void **data);
     void                       pfiResetInput(pfiInput *in);
     void                       pfiCollectInputEvents(pfiInput *in);
     void                       pfiProcessInputEvents(pfiInput *in);
     int                        pfiHaveFastMouseClick(pfuMouse *mouse,
                                  int button, float msecs);
     pfiInputXform *            pfiNewIXform(void *arena);
     void                       pfiIXformFocus(pfiInputXform *in, int focus);
     int                        pfiIsIXformInMotion(pfiInputXform *ix);
     void                       pfiStopIXform(pfiInputXform *ix);
     void                       pfiResetIXform(pfiInputXform *ix);
     void                       pfiUpdateIXform(pfiInputXform *ix);
     void                       pfiIXformMode(pfiInputXform *ix, int mode,
                                  int val);
     int                        pfiGetIXformMode(pfiInputXform *ix, int mode);
     void                       pfiResetIXformPosition(pfiInputXform *ix);
     void                       pfiIXformMat(pfiInputXform *ix, pfMatrix mat);
     void                       pfiGetIXformMat(pfiInputXform *ix,
                                  pfMatrix mat);
     void                       pfiIXformInput(pfiInputXform *ix,
                                  pfiInput *in);
     pfiInput*                  pfiGetIXformInput(pfiInputXform *ix);
     void                       pfiIXformInputCoordPtr(pfiInputXform *ix,
                                  pfiInputCoord *xcoord);
     pfiInputCoord*             pfiGetIXformInputCoordPtr(pfiInputXform *ix);
     void                       pfiIXformMotionCoord(pfiInputXform *ix,
                                  pfiMotionCoord *xcoord);
     void                       pfiGetIXformMotionCoord(pfiInputXform *ix,
                                  pfiMotionCoord *xcoord);
     void                       pfiIXformResetCoord(pfiInputXform *ix,
                                  pfCoord *resetPos);
     void                       pfiGetIXformResetCoord(pfiInputXform *ix,
                                  pfCoord *resetPos);
     void                       pfiIXformCoord(pfiInputXform *ix,
                                  pfCoord *coord);
     void                       pfiGetIXformCoord(pfiInputXform *ix,
                                  pfCoord *coord);
     void                       pfiIXformStartMotion(pfiInputXform *xf,
                                  float startSpeed, float startAccel);
     void                       pfiGetIXformStartMotion(pfiInputXform *xf,
                                  float *startSpeed, float *startAccel);
     void                       pfiIXformMotionLimits(pfiInputXform *xf,
                                  float maxSpeed, float angularVel,
                                  float maxAccel);
     void                       pfiGetIXformMotionLimits(pfiInputXform *xf,
                                  float *maxSpeed, float *angularVel,
                                  float *maxAccel);
     void                       pfiIXformDBLimits(pfiInputXform *xf,
                                  pfBox *dbLimits);
     void                       pfiGetIXformDBLimits(pfiInputXform *xf,
                                  pfBox *dbLimits);
     void                       pfiIXformBSphere(pfiInputXform *xf,
                                  pfSphere *sphere);
     void                       pfiGetIXformBSphere(pfiInputXform *xf,
                                  pfSphere *sphere);
     void                       pfiIXformUpudateFunc(pfiInputXform *ix,
                                  pfiInputXformUpdateFuncType func,
                                  void *data);
     void                       pfiGetIXformUpudateFunc(pfiInputXform *ix,
                                  pfiInputXformUpdateFuncType *func,
                                  void **data);

     void                       pfiIXformMotionFuncs(pfiInputXform *ix,
                                  pfiInputXformFuncType start,
                                  pfiInputXformFuncType stop, void *data);
     void                       pfiGetIXformMotionFuncs(pfiInputXform *ix,
                                  pfiInputXformFuncType *start,
                                  pfiInputXformFuncType *stop, void **data);
     pfiInputXformTrackball *   pfiNewIXformTrackball(void *arena);
     void                       pfiIXformTrackballMode(pfiInputXformTrackball *tb,
                                  int mode, int val);
     int                        pfiGetIXformTrackballMode(pfiInputXformTrackball *tb,
                                  int mode);
     pfiInputXformTrackball *   pfiCreate2DIXformTrackball(void *arena);
     int                        pfiUpdate2DIXformTrackball(pfiInputXform *tb,
                                  pfiInputCoord *icoord, void *data);
     pfType *                   pfiGetIXformTravelClassType(void);
     pfType *                   pfiGetIXformDriveClassType(void);
     pfType *                   pfiGetIXformFlyClassType(void);
     pfType *                   pfiGetIXformTrackballClassType(void);
     pfiInputXformDrive *       pfiNewIXformDrive(void *arena);
     void                       pfiIXformDriveMode(pfiInputXformDrive *drive,
                                  int mode, int val);
     int                        pfiGetIXformDriveMode(pfiInputXformDrive *drive,
                                  int mode);
     void                       pfiIXformDriveHeight(pfiInputXformDrive* drive,
                                  float height);
     float                      pfiGetIXformDriveHeight(pfiInputXformDrive* drive);
     pfiInputXformDrive *       pfiCreate2DIXformDrive(void *arena);
     int                        pfiUpdate2DIXformDrive(pfiInputXform *drive,
                                  pfiInputCoord *icoord, void *data);
     pfiInputXformFly *         pfiNewIXFly(void *arena);
     void                       pfiIXformFlyMode(pfiInputXformFly *fly,
                                  int mode, int val);
     int                        pfiGetIXformFlyMode(pfiInputXformFly *fly,
                                  int mode);
     pfiInputXformFly *         pfiCreate2DIXformFly(void *arnea);
     int                        pfiUpdate2DIXformFly(pfiInputXform *fly,
                                  pfiInputCoord *icoord, void *data);

pfiCollide

For realistic motion through a scene, an application must detect collisions between the viewer and the scene. These functions provide that functionality. Typical uses of these utilities are to prevent movement through walls and to maintain a constant "driving" distance above the ground.

     pfType *       pfiGetCollideClassType(void);
     pfiCollide *   pfiNewCollide(void *arena);
     void           pfiEnableCollide(pfiCollide *collide);
     void           pfiDisableCollide(pfiCollide *collide);
     int            pfiGetCollideEnable(pfiCollide *collide);
     void           pfiCollideMode(pfiCollide *collide, int mode, int val);
     int            pfiGetCollideMode(pfiCollide *collide, int mode);
     void           pfiCollideStatus(pfiCollide *collide, int status);
     int            pfiGetCollideStatus(pfiCollide *collide);
     void           pfiCollideDist(pfiCollide *collide, float dist);
     float          pfiGetCollideDist(pfiCollide *collide);
     void           pfiCollideHeightAboveGrnd(pfiCollide *collide,
                      float dist);
     float          pfiGetCollideHeightAboveGrnd(pfiCollide *collide);
     void           pfiCollideGroundNode(pfiCollide *collide, pfNode* ground);
     pfNode *       pfiGetCollideGroundNode(pfiCollide *collide);
     void           pfiCollideObjNode(pfiCollide *collide, pfNode* db);
     pfNode *       pfiGetCollideObjNode(pfiCollide *collide);
     void           pfiGetCollideMotionCoord(pfiCollide *collide,
                      pfiMotionCoord* xcoord);
     void           pfiCollideFunc(pfiCollide *collide,
                      pfiCollideFuncType func, void *data);
     void           pfiGetCollisionFunc(pfiCollide *collide,
                      pfiCollideFuncType *func, void **data);
     int            pfiUpdateCollide(pfiCollide *collide);

pfiPick

The pfiPick utility facilitates user interaction and manipulation of a scene. It provides a means to translate mouse locations on the screen into the coordinate space of the world being viewed. Having done this, it can also determine what objects are being pointed to by the mouse.

     pfType *     pfiGetPickClassType(void);
     pfiPick *    pfiNewPick(void *arena);
     void         pfiPickMode(pfiPick *pick, int mode, int val);
     int          pfiGetPickMode(pfiPick *pick, int mode);
     void         pfiPickHitFunc(pfiPick *pick, pfiPickFuncType func,
                    void *data);
     void         pfiGetPicktHitFunc(pfiPick *pick, pfiPickFuncType *func,
                    void **data);
     void         pfiAddPickChan(pfiPick *pick, pfChannel *chan);
     void         pfiInsertPickChan(pfiPick *pick, int index,
                    pfChannel *chan);
     void         pfiRemovePickChan(pfiPick *pick, pfChannel *chan);
     int          pfiGetPickNumHits(pfiPick *pick);
     pfNode *     pfiGetPickNode(pfiPick *pick);
     pfGeoSet *   pfiGetPickGSet(pfiPick *pick);
     void         pfiSetupPickChans(pfiPick *pick);
     int          pfiDoPick(pfiPick *pick, int x, int y);
     void         pfiResetPick(pfiPick *pick);

pfiXformer

pfiXformer objects provide a simple means for user-controlled motion in a scene. The pfiXformer updates a transformation matrix based on a selected motion model and user input. This transformation matrix can be used by the application for whatever purposes it desires. In particular, the matrix can be used to update the viewpoint defined for a pfChannel or the transformation of a pfDCS node.

     pfType*                    pfiGetXformerClassType(void);
     pfiXformer *               pfiNewXformer(void* arena);
     void                       pfiXformerModel(pfiXformer* xf, int index,
                                  pfiInputXform* model);
     void                       pfiSelectXformerModel(pfiXformer* xf,
                                  int which);
     pfiInputXform*             pfiGetXformerCurModel(pfiXformer* xf);
     int                        pfiGetXformerCurModelIndex(pfiXformer* xf);
     int                        pfiRemoveXformerModel(pfiXformer* xf,
                                  int index);
     int                        pfiRemoveXformerModelIndex(pfiXformer* xf,
                                  pfiInputXform* model);
     void                       pfiStopXformer(pfiXformer* xf);
     void                       pfiResetXformer(pfiXformer* xf);
     void                       pfiResetXformerPosition(pfiXformer* xf);
     void                       pfiCenterXformer(pfiXformer* xf);
     void                       pfiXformerAutoInput(pfiXformer* xf,
                                  pfChannel* chan, pfuMouse* mouse,
                                  pfuEventStream* events);
     void                       pfiXformerMat(pfiXformer* xf, pfMatrix mat);
     void                       pfiGetXformerMat(pfiXformer* xf,
                                  pfMatrix mat);
     void                       pfiXformerModelMat(pfiXformer* xf,
                                  pfMatrix mat);
     void                       pfiGetXformerModelMat(pfiXformer* xf,
                                  pfMatrix mat);
     void                       pfiXformerCoord(pfiXformer* xf,
                                  pfCoord *coord);
     void                       pfiGetXformerCoord(pfiXformer* xf,
                                  pfCoord *coord);
     void                       pfiXformerResetCoord(pfiXformer* xf,
                                  pfCoord *resetPos);
     void                       pfiGetXformerResetCoord(pfiXformer* xf,
                                  pfCoord *resetPos);
     void                       pfiXformerNode(pfiXformer* xf, pfNode *node);
     pfNode *                   pfiGetXformerNode(pfiXformer* xf);
     void                       pfiXformerAutoPosition(pfiXformer* xf,
                                  pfChannel *chan, pfDCS *dcs);
     void                       pfiGetXformerAutoPosition(pfiXformer* xf,
                                  pfChannel **chan, pfDCS **dcs);
     void                       pfiXformerLimits(pfiXformer* xf,
                                  float maxSpeed, float angularVel,
                                  float maxAccel, pfBox* dbLimits);
     void                       pfiGetXformerLimits(pfiXformer* xf,
                                  float *maxSpeed, float *angularVel,
                                  float *maxAccel, pfBox* dbLimits);
     void                       pfiEnableXformerCollision(pfiXformer* xf);
     void                       pfiDisableXformerCollision(pfiXformer* xf);
     int                        pfiGetXformerCollisionEnable(pfiXformer* xf);
     void                       pfiXformerCollision(pfiXformer* xf, int mode,
                                  float val, pfNode* node);
     int                        pfiGetXformerCollisionStatus(pfiXformer* xf);
     void                       pfiUpdateXformer(pfiXformer* xf);
     int                        pfiCollideXformer(pfiXformer* xf);
     pfType*                    pfiGetTDFXformerClassType(void);
     pfiTDFXformer *            pfiNewTDFXformer(void* arena);
     pfiXformer *               pfiCreateTDFXformer( pfiInputXformTrackball *tb,
                                  pfiInputXformDrive *drive,
                                  pfiInputXformFly *fly, void *arena);
     void                       pfiTDFXformerStartMotion(pfiTDFXformer* xf,
                                  float startSpeed, float startAccel,
                                  float accelMult);
     void                       pfiGetTDFXformerStartMotion(pfiTDFXformer* xf,
                                  float *startSpeed, float *startAccel,
                                  float *accelMult);
     void                       pfiTDFXformerFastClickTime(pfiTDFXformer* xf,
                                  float time);
     float                      pfiGetTDFXformerFastClickTime(pfiXformer* xf);
     void                       pfiTDFXformerTrackball(pfiTDFXformer *xf,
                                  pfiInputXformTrackball *tb);
     pfiInputXformTrackball *   pfiGetTDFXformerTrackball(pfiTDFXformer *xf);
     void                       pfiTDFXformerDrive(pfiTDFXformer *xf,
                                  pfiInputXformDrive *tb);
     pfiInputXformFly *         pfiGetTDFXformerFly(pfiTDFXformer *xf);
     void                       pfiTDFXformerFly(pfiTDFXformer *xf,
                                  pfiInputXformFly *tb);
     pfiInputXformDrive *       pfiGetTDFXformerDrive(pfiTDFXformer *xf);
     int                        pfiProcessTDFXformerMouseEvents(pfiInput *,
                                  pfuEventStream *, void *data);
     void                       pfiProcessTDFXformerMouse(pfiTDFXformer *xf,
                                  pfuMouse *mouse, pfChannel *inputChan);
     void                       pfiProcessTDFTrackballMouse(pfiTDFXformer *xf,
                                  pfiInputXformTrackball *trackball,
                                  pfuMouse *mouse);
     void                       pfiProcessTDFTravelMouse(pfiTDFXformer *xf,
                                  pfiInputXformTravel *tr, pfuMouse *mouse);

libpfutil Functions

libpfutil Management

Before using any libpfutil utilities, the library must be initialized. These functions provide for proper initialization and control of libpfutil.

     void             pfuInitUtil(void);
     pfDataPool*      pfuGetUtilDPool(void);
     void             pfuExitUtil(void);
     void             pfuDPoolSize(long size);
     long             pfuGetDPoolSize(void);
     volatile void*   pfuFindUtilDPData(int id);

Processor Control

In certain circumstances, users may wish to control which CPU a particular IRIS Performer subprocess runs on. They might even wish to exclusively devote a particular processor to a given subprocess. These functions provide control of the scheduling of IRIS Performer subprocesses on a machine's processors.

     int   pfuFreeCPUs(void);
     int   pfuRunProcOn(int cpu);
     int   pfuLockDownProc(int cpu);
     int   pfuLockDownApp(void);
     int   pfuLockDownCull(pfPipe *);
     int   pfuLockDownDraw(pfPipe *);
     int   pfuPrioritizeProcs(int onOff);

Multiprocess Rendezvous

These rendezvous functions provide the functionality necessary for synchronizing master and slave processes in a multiprocessing environment.

     void   pfuInitRendezvous(pfuRendezvous *rvous, int numSlaves);
     void   pfuMasterRendezvous(pfuRendezvous *rvous);
     void   pfuSlaveRendezvous(pfuRendezvous *rvous, int id);

GLX Mixed Mode

The libpfutil GLX routines are now provided for compatibility with previous versions of Performer. New development should be done based on the pfWindow and pfPipeWindow API that provides a single API for managing IrisGL, Mixed Mode, and OpenGL windows.

     pfuXDisplay *    pfuOpenXDisplay(int screen);
     pfuGLXWindow *   pfuGLXWinopen(pfPipe *p, pfPipeWindow *pw,
                        const char *name);
     void             pfuGetGLXWin(pfPipe *pipe, pfuGLXWindow *glxWin);
     const char *     pfuGetGLXDisplayString(pfPipe *pipe);
     void             pfuGLMapcolors(pfVec3 *clrs, int start, int num);
     int              pfuGLXAllocColormap(pfuXDisplay *dsp, pfuXWindow w);
     void             pfuGLXMapcolors(pfuXDisplay *dsp, pfuXWindow w,
                        pfVec3 *clrs, int loc, int num);
     void             pfuMapWinColors(pfWindow *w, pfVec3 *clrs, int start,
                        int num);
     void             pfuMapPWinColors(pfPipeWindow *pwin, pfVec3 *clrs,
                        int start, int num);
     void             pfuPrintWinFBConfig(pfWindow *win, FILE *file);
     void             pfuPrintPWinFBConfig(pfPipeWindow *pwin, FILE *file);
     pfFBConfig       pfuChooseFBConfig(Display *dsp, int screen,
                        int *constraints, void *arena);

Input Handling

These functions provide an interface for managing X and GL event streams.

     pfuEventQueue *    pfuNewEventQ(pfDataPool *dp, int id);
     void               pfuResetEventStream(pfuEventStream *es);
     void               pfuResetEventQ(pfuEventQueue *eq);
     void               pfuAppendEventQ(pfuEventQueue *eq0,
                          pfuEventQueue *eq1);
     void               pfuAppendEventQStream(pfuEventQueue *eq,
                          pfuEventStream *es);
     void               pfuEventQStream(pfuEventQueue *eq,
                          pfuEventStream *es);
     pfuEventStream *   pfuGetEventQStream(pfuEventQueue *eq);
     void               pfuGetEventQEvents(pfuEventStream *events,
                          pfuEventQueue *eq);
     void               pfuIncEventQFrame(pfuEventQueue *eq);
     void               pfuEventQFrame(pfuEventQueue *eq, int val);
     int                pfuGetEventQFrame(pfuEventQueue *eq);
     void               pfuIncEventStreamFrame(pfuEventStream *es);
     void               pfuEventStreamFrame(pfuEventStream *es, int val);
     int                pfuGetEventStreamFrame(pfuEventStream *es);
     void               pfuInitInput(pfPipeWindow *pw, int mode);
     void               pfuExitInput(void);
     int                pfuMapMouseToChan(pfuMouse *mouse, pfChannel *chan);
     int                pfuMouseInChan(pfuMouse *mouse, pfChannel *chan);
     void               pfuCollectInput(void);
     void               pfuCollectGLEventStream(pfuEventStream *events,
                          pfuMouse *mouse, int handlerMask,
                          pfuEventHandlerFuncType handlerFunc);
     void               pfuCollectXEventStream(pfWSConnection dsp,
                          pfuEventStream *events, pfuMouse *mouse,
                          int handlerMask,
                          pfuEventHandlerFuncType handlerFunc);
     void               pfuGetMouse(pfuMouse *mouse);
     void               pfuGetEvents(pfuEventStream *events);
     void               pfuInputHandler(pfuEventHandlerFuncType userFunc,
                          uint mask);
     void pfuMouseButtonClick(pfuMouse *mouse,
     void pfuMouseButtonRelease(pfuMouse *mouse,
     double             pfuMapXTime(double xtime);

Cursor Control

Each window managed by Performer, both pfWindows and pfPipeWindows, can have an associated cursor. These functions can be used to manage the various cursors desired by an application.

     Cursor   pfuGetInvisibleCursor(void);
     void     pfuLoadPWinCursor(pfPipeWindow *w, Cursor c);
     void     pfuLoadWinCursor(pfWindow *w, Cursor c);
     Cursor   pfuCreateDftCursor(int index);
     void     pfuCursor(Cursor c, int index);
     Cursor   pfuGetCursor(int index);
     void     pfuInitGUICursors(void);
     void     pfuGUICursor(int target, Cursor c);
     Cursor   pfuGetGUICursor(int target);
     void     pfuGUICursorSel(Cursor sel);
     Cursor   pfuGetGUICursorSel(void);
     void     pfuUpdateGUICursor(void);

OpenGL X Fonts

It is convenient to be able to draw text in Performer windows. When programming with OpenGL, an application must use X fonts for this purpose. These functions simplify the use of X fonts for this purpose by hiding much of the low-level font management.

     void   pfuLoadXFont(char *fontName, pfuXFont *fnt);
     void   pfuMakeXFontBitmaps(pfuXFont *fnt);
     void   pfuMakeRasterXFont(char *fontName, pfuXFont *font);
     void   pfuSetXFont(pfuXFont *);
     void   pfuGetCurXFont(pfuXFont *);
     int    pfuGetXFontWidth(pfuXFont *, const char *);
     int    pfuGetXFontHeight(pfuXFont *);
     void   pfuCharPos(float x, float y, float z);
     void   pfuDrawString(const char *s);
     void   pfuDrawStringPos(const char *s, float x, float y, float z);

Simple GUI

Many applications require a simple user interface. Their needs are often far more restricted than the functionality provided by user interface libraries such as Motif. For those cases in which a simple and efficient user interface is required, these functions can be used to provide one.

     void                      pfuInitGUI(pfPipeWindow *pw);
     void                      pfuExitGUI(void);
     void                      pfuEnableGUI(int en);
     void                      pfuUpdateGUI(pfuMouse *mouse);
     void                      pfuRedrawGUI(void);
     void                      pfuGUIViewport(float l, float r, float b,
                                 float t);
     void                      pfuGetGUIViewport(float *l, float *r, float *b,
                                 float *t);
     int                       pfuInGUI(int x, int y);
     void                      pfuFitWidgets(int val);
     void                      pfuGetGUIScale(float *x, float *y);
     void                      pfuGetGUITranslation(float *x, float *y);
     void                      pfuGUIHlight(pfHighlight *hlight);
     pfHighlight *             pfuGetGUIHlight(void);
     pfuPanel*                 pfuNewPanel(void);
     void                      pfuEnablePanel(pfuPanel *p);
     void                      pfuDisablePanel(pfuPanel *p);
     void                      pfuGetPanelOriginSize(pfuPanel *p, float *xo,
                                 float *yo, float *xs, float *ys);
     pfuWidget *               pfuNewWidget(pfuPanel *p, int type, int id);
     int                       pfuGetWidgetType(pfuWidget *w);
     void                      pfuEnableWidget(pfuWidget *w);
     void                      pfuDisableWidget(pfuWidget *w);
     int                       pfuGetWidgetId(pfuWidget *w);
     void                      pfuWidgetDim(pfuWidget *w, int xo, int yo,
                                 int xs, int ys);
     void                      pfuGetWidgetDim(pfuWidget *w, int *xo, int *yo,
                                 int *xs, int *ys);
     void                      pfuWidgetLabel(pfuWidget *w,
                                 const char *label);
     int                       pfuGetWidgetLabelWidth(pfuWidget *w);
     const char *              pfuGetWidgetLabel(pfuWidget *w);
     void                      pfuWidgetRange(pfuWidget *w, int mode,
                                 float min, float max, float val);
     void                      pfuWidgetValue(pfuWidget *w, float val);
     float                     pfuGetWidgetValue(pfuWidget *w);
     void                      pfuWidgetDefaultValue(pfuWidget *w, float val);
     void                      pfuWidgetDrawFunc(pfuWidget *w,
                                 pfuWidgetDrawFuncType func);
     void                      pfuWidgetSelectFunc(pfuWidget *w,
                                 pfuWidgetSelectFuncType func);
     void                      pfuWidgetActionFunc(pfuWidget *w,
                                 pfuWidgetActionFuncType func);
     pfuWidgetActionFuncType   pfuGetWidgetActionFunc(pfuWidget *w);
     pfuWidgetSelectFuncType   pfuGetWidgetSelectFunc(pfuWidget *w);
     pfuWidgetDrawFuncType     pfuGetWidgetDrawFunc(pfuWidget *w);
     void                      pfuWidgetSelections(pfuWidget *w,
                                 pfuGUIString *attrList, int *valList,
                                 void (**funcList)(pfuWidget *w),
                                 int numSelections);
     void                      pfuWidgetSelection(pfuWidget *w, int index);
     int                       pfuGetWidgetSelection(pfuWidget *w);
     void                      pfuWidgetDefaultSelection(pfuWidget *w,
                                 int index);
     void                      pfuWidgetDefaultOnOff(pfuWidget * w, int on);
     void                      pfuWidgetOnOff(pfuWidget *w, int on);
     int                       pfuIsWidgetOn(pfuWidget *w);
     void                      pfuResetGUI(void);
     void                      pfuResetPanel(pfuPanel *p);
     void                      pfuResetWidget(pfuWidget *w);
     void                      pfuDrawTree(pfChannel *chan, pfNode *node,
                                 pfVec3 panXYScale);
     void                      pfuDrawMessage(pfChannel *chan,
                                 const char *msg, int rel, int just,
                                 float x, float y, int size, int cmode);
     void                      pfuDrawMessageCI(pfChannel *chan,
                                 const char *msg, int rel, int just,
                                 float x, float y, int size, int textClr,
                                 int shadowClr);
     void                      pfuDrawMessageRGB(pfChannel *chan,
                                 const char *msg, int rel, int just,
                                 float x, float y, int size, pfVec4 textClr,
                                 pfVec4 shadowClr);

Scene Graph Traversal

Traversals are widely applicable to many tasks required in Performer applications. These functions provide a customizable, recursive traversal of an IRIS Performer scene graph.

     int    pfuTravCountNumVerts(pfNode *node);
     int    pfuTraverse(pfNode *node, pfuTraverser *trav);
     void   pfuInitTraverser(pfuTraverser *trav);
     void   pfuTravCalcBBox(pfNode *node, pfBox *box);
     void   pfuTravCountDB(pfNode *node, pfFrameStats *fstats);
     void   pfuTravGLProf(pfNode *node, int mode);
     void   pfuTravNodeAttrBind(pfNode *node, uint attr, uint bind);
     void   pfuTravNodeHlight(pfNode *node, pfHighlight *hl);
     void   pfuTravPrintNodes(pfNode *node, const char *fname);
     int    pfuCalcDepth(pfNode *node);
     void   pfuTravCachedCull(pfNode* node, int numChans);

MultiChannel Option

These functions serve as a generic way of initializing channels when using the Multi-Channel Option (MCO) available on RealityEngine graphics systems.

     void   pfuTileChans(pfChannel **chn, int nChans, int ntilesx,
              int ntilesy);
     void   pfuConfigMCO(pfChannel **chn, int nChans);
     int    pfuGetMCOChannels(pfPipe *p);
     void   pfuTileChan(pfChannel **chn, int thisChan, int nChans, float l,
              float r, float b, float t);

MultiPipe Statistics

pfuManageMPipeStats provides a simple mechanism for acquiring frame timing statistics over a period of time and saving them to a disk file.

     int   pfuManageMPipeStats(int nFrames, int nSampledPipes);

Path Following

Automated path following can greatly simplify the construction of interactive walkthrough applications. These functions provide the means for creating and using automated paths.

     pfuPath *   pfuNewPath(void);
     pfuPath *   pfuSharePath(pfuPath *path);
     pfuPath *   pfuCopyPath(pfuPath *path);
     pfuPath *   pfuClosePath(pfuPath *path);
     int         pfuFollowPath(pfuPath *path, float seconds, pfVec3 where,
                   pfVec3 orient);
     int         pfuPrintPath(pfuPath *path);
     int         pfuAddPath(pfuPath *path, pfVec3 first, pfVec3 final);
     int         pfuAddArc(pfuPath *path, pfVec3 center, float radius,
                   pfVec2 angles);
     int         pfuAddFillet(pfuPath *path, float radius);
     int         pfuAddSpeed(pfuPath *path, float desired, float rate);
     int         pfuAddDelay(pfuPath *path, float delay);
     int         pfuAddFile(pfuPath *path, char *name);

Collision Detection

This is the old utility for collision detection. These functions are provided to ease the transition of existing Performer-based applications to the new API. They should not be used in developing new software and are likely to be removed in a future release. Refer to the reference pages for more information.

     void         pfuCollisionChan(pfChannel *chan);
     pfChannel*   pfuGetCollisionChan(void);
     void         pfuCollideSetup(pfNode *node, int mode, int mask);
     int          pfuCollideGrnd(pfCoord *coord, pfNode *node, pfVec3 zpr);
     int          pfuCollideGrndObj(pfCoord *coord, pfNode *grndNode,
                    pfVec3 zpr, pfSeg *seg, pfNode *objNode, pfVec3 hitPos,
                    pfVec3 hitNorm);
     int          pfuCollideObj(pfSeg *seg, pfNode *objNode, pfVec3 hitPos,
                    pfVec3 hitNorm);

Timer Control

Tracking the passage of time is essential for interactive applications. Performer provides pfuTimer objects, which are both real-time and independent of frame rate.

     pfuTimer*   pfuNewTimer(void *arena, int size);
     void        pfuInitTimer(pfuTimer *timer, double start, double delta,
                   void (*func)(pfuTimer*), void *data);
     void        pfuStartTimer(pfuTimer *timer);
     void        pfuStopTimer(pfuTimer *timer);
     void        pfuEvalTimers(void);
     int         pfuEvalTimer(pfuTimer *timer);
     int         pfuActiveTimer(pfuTimer * timer);

Hash Tables

Hash tables are an ubiquitous data structure. They are used internally by Performer, and many Performer applications will find them very useful. These functions provide a simple hash table facility to all Performer-based systems.

     pfuHashTable*   pfuNewHTable(int numb, int eltsize, void* arena);
     void            pfuDelHTable(pfuHashTable* ht);
     void            pfuResetHTable(pfuHashTable* ht);
     pfuHashElt*     pfuEnterHash(pfuHashTable* ht, pfuHashElt* elt);
     int             pfuRemoveHash(pfuHashTable* ht, pfuHashElt* elt);
     int             pfuFindHash(pfuHashTable* ht, pfuHashElt* elt);
     int             pfuHashGSetVerts(pfGeoSet *gset);
     int             pfuCalcHashSize(int size);

Geometric Simplification

These functions can be used to automatically generate very simple level-of-detail representations of a subgraph from the bounding boxes of the geometric objects contained in that subgraph.

     pfLOD*      pfuBoxLOD(pfGroup *grp, int flat, pfVec4* clr);
     pfGeoSet*   pfuMakeBoxGSet(pfBox *box, pfVec4 clr, int flat);

Texture Loading

These functions assist in the sharing and downloading of textures, both of which are important for performance. Sharing of texture data reduces memory requirements and can subsequently increase efficiency. For consistent frame rates, it is also very important to download textures into the graphics pipeline's physical texture memory before beginning simulation.

     pfTexture*   pfuNewSharedTex(const char *filename, void *arena);
     pfList*      pfuGetSharedTexList(void);
     pfList *     pfuMakeTexList(pfNode *node);
     pfList *     pfuMakeSceneTexList(pfScene *node);
     void         pfuDownloadTexList(pfList *list, int style);
     int          pfuGetTexSize(pfTexture *tex);

Texture Animation

It may be necessary to animate textures to achieve specific visual effects. These functions allow the application to setup sequences of textures which define an animation.

     void           pfuNewTexList(pfTexture *tex);
     pfList *       pfuLoadTexListFiles(pfList *movieTexList,
                      char nameList[][PF_MAXSTRING], int len);
     pfList *       pfuLoadTexListFmt(pfList *movieTexList,
                      const char *fmtStr, int start, int end);
     pfSequence *   pfuNewProjector(pfTexture *handle);
     int            pfuProjectorPreDrawCB(pfTraverser *trav, void *travData);

Random Numbers

Generating good random numbers is very important for many simulation tasks. These functions provide a portable interface to the system random number generator which is somewhat more convenient than random.

     void    pfuRandomize(int seed);
     long    pfuRandomLong(void);
     float   pfuRandomFloat(void);
     void    pfuRandomColor(pfVec4 rgba, float minColor, float maxColor);

Flybox Control

These routines provide a simple interface to the BG Systems flybox but do not provide a flight model based on the flybox.

     int   pfuOpenFlybox(char *p);
     int   pfuReadFlybox(int *dioval, float *inbuf);
     int   pfuGetFlybox(float *analog, int *but);
     int   pfuGetFlyboxActive(void);
     int   pfuInitFlybox(void);

Smoke Simulation

These functions simulate the appearance of smoke and fire. They are included both as a utility in simulations as well as a demonstration of how to model such phenomena.

     void         pfuInitSmokes(void);
     pfuSmoke *   pfuNewSmoke(void);
     void         pfuSmokeType(pfuSmoke *smoke, int type);
     void         pfuSmokeOrigin(pfuSmoke* smoke, pfVec3 origin,
                    float radius);
     void         pfuSmokeDir(pfuSmoke* smoke, pfVec3 dir);
     void         pfuSmokeVelocity(pfuSmoke* smoke, float turbulence,
                    float speed);
     void         pfuGetSmokeVelocity(pfuSmoke* smoke, float *turbulence,
                    float *speed);
     void         pfuSmokeMode(pfuSmoke* smoke, int mode);
     void         pfuDrawSmokes(pfVec3 eye);
     void         pfuSmokeTex(pfuSmoke* smoke, pfTexture* tex);
     void         pfuSmokeDuration(pfuSmoke* smoke, float dur);
     void         pfuSmokeDensity(pfuSmoke* smoke, float dens, float diss,
                    float expansion);
     void         pfuGetSmokeDensity(pfuSmoke* smoke, float *dens,
                    float *diss, float *expansion);
     void         pfuSmokeColor(pfuSmoke* smoke, pfVec3 bgn, pfVec3 end);

LightPointState Utilities

These functions can derive a texture image from a pfLightPoint specification.

     void   pfuMakeLPStateShapeTex(pfLPointState *lps, pfTexture *tex,
              int size);
     void   pfuMakeLPStateRangeTex(pfLPointState *lps, pfTexture *tex,
              int size, pfFog *fog);

Draw Styles

These functions demonstrate how to use multi-pass rendering to achieve various special drawing effects. Hidden line elimination and haloed lines are two examples of effects which can be created using these functions.

     void   pfuPreDrawStyle(int style, pfVec4 scribeColor);
     void   pfuPostDrawStyle(int style);
     void   pfuCalcNormalizedChanXY(float* px, float* py, pfChannel* chan,
              int xpos, int ypos);
     int    pfuSaveImage(char* name, int xorg, int yorg, int xsize, int ysize,
              int saveAlpha);

Compiled by: Allan Schaffer


Copyright © 1995, Silicon Graphics, Inc.