Matthew Hesher (hesher++at++nu.cs.fsu.edu)
Fri, 3 Dec 1999 17:44:24 -0500 (EST)
calais 148% myScene
PF Notice: pfdLoadFile_iv: /usr/people/hesher/Inventor/MODELS/IV/teapot.iv
PF Notice: Using 72Hz video rate.
// My second attempt at a Performer program
// compile this with "cc myScene.c++ -lpf"
// or with "make"
// Regular includes
#include <iostream.h>
// Performer includes
#include <Performer/pf/pfChannel.h>
#include <Performer/pf/pfLightSource.h>
#include <Performer/pfdu.h>
int main (int argc, char *argv[])
{
float time = 0.0f;
if(pfInit() == -1) {
cerr << "Error in pfInit. Exiting.\n";
pfExit();
exit(-1);
}
// Use default multiprocessing mode based on number of
// processors.
pfMultiprocess( PFMP_DEFAULT );
// Call pfdInitConverter before pfConfig
const char ext[] = "iv";
if(!pfdInitConverter(ext)) {
cerr << "Could not load DSO for " << ext << ". Exiting." << endl;
pfExit();
exit(-1);
}
// Fork App, Cull, Draw, and some other stuff
if(pfConfig() == -1) {
cerr << "Error in pfConfig. Exiting.\n";
pfExit();
exit(-1);
}
// Load a mesh
const char meshFile[80] = "/usr/people/hesher/Inventor/MODELS/IV/teapot.iv";
pfNode *myObject = pfdLoadFile(meshFile);
// Create the Scene
pfScene *scene = new pfScene;
scene -> addChild(myObject);
// Create a light and attach it to the scene
scene -> addChild(new pfLightSource);
// Create the Pipe
pfPipe *p = pfGetPipe(0);
pfPipeWindow *pw = new pfPipeWindow(p);
pw -> setWinType(PFPWIN_TYPE_X);
pw -> setOriginSize(0,0,512,512);
pw -> open();
// Create the Channel
pfChannel *chan = new pfChannel(p);
chan -> setScene(scene);
chan -> setFOV(135.0f, 0.0f);
//chan -> setAutoAspect(PFFRUST_CALC_HORIZ);
//chan -> setAutoAspect(PFFRUST_CALC_VERT);
// makePersp and makeOrtho disable setAutoAspect
//chan -> makePersp(-10.0f, 10.0f, -10.0f, 10.0f); //left, right, bottom, top
//chan -> drawStats();
pfVec3 position(0.0f, 5.0f, 0.0f);
pfVec3 orientation(0.0f, 0.0f, 0.0f);
chan -> setView(position, orientation);
// Determine the size of the bounding sphere
pfSphere bsphere;
myObject -> getBound(&bsphere);
chan -> setNearFar(1.0f, 10.0f * bsphere.radius);
while (time < 20.0f)
{
//pfSync(); //pfFrame will automatically call pfSync
pfFrame();
time += 0.1;
}
// Terminate parallel processes and exit
pfExit();
return 0;
}
This archive was generated by hypermail 2.0b2 on Fri Dec 03 1999 - 14:44:30 PST