Liu Xiaoyan (liuxy++at++ihpc.nus.edu.sg)
Thu, 07 May 1998 11:24:18 +0800
The following code can give you a very simple visual effect. The smoke
structure is attached to a pfGeode and drawn in the DRAW callback.
But, I don't how to disable or delete fires that should not be drawn
after
time is over. When I have multiple fire sturctures, they are all
displayed
even the time for that one expires.
****************************************************************
pfuInitSmokes(); // call before pfConfig
int smoke_draw(pfTraverser *,void *)
{
pfVec3 eye;
CAVEGetPosition(CAVEEye,eye.vec);
pfuDrawSmokes(eye);
return PFTRAV_CONT;
}
pfDCS * create_scene(pfChannel *chan)
{
pfScene *scene = new pfScene;
pfGeoState *gstate = new pfGeoState;
pfDCS *dcs = new pfDCS;
gstate->setMode(PFSTATE_ENLIGHTING, PF_ON);
gstate->setMode(PFSTATE_CULLFACE, PFCF_OFF);
scene->setGState(gstate);
scene->addChild(new pfLightSource);
scene->addChild(dcs);
chan->setScene(scene);
create_smoke(dcs);
return dcs;
}
void create_smoke(pfGroup *parent)
{
pfuSmoke *smoke;
pfVec3 origin, dir;
pfGeode *node;
pfSphere bsph;
origin[0] = origin[2] = 0; origin[1] = 5;
dir[0] = dir[2] = 1; dir[1] = 1;
smoke = pfuNewSmoke();
pfuSmokeType(smoke,PFUSMOKE_DUST); //SMOKE);
pfuSmokeOrigin(smoke,origin,1.0f);
pfuSmokeVelocity(smoke,3.0f,2.0f);
pfuSmokeDir(smoke,dir);
pfuSmokeMode(smoke,PFUSMOKE_START);
pfuSmokeDuration(smoke,15.0f);
node = new pfGeode;
parent->addChild(node);
bsph.radius = 10.0f;
bsph.center = origin;
node->setBound(&bsph,PFBOUND_STATIC);
node->setTravFuncs(PFTRAV_DRAW,smoke_draw,NULL);
node->setTravData(PFTRAV_DRAW,smoke);
}
***********************************************************************
Liu Xiaoyan Institute of High Performance Computing
Data Visualisation Group http://www.ihpc.nus.edu.sg Tel:(65)7709267
***********************************************************************
=======================================================================
List Archives, FAQ, FTP: http://www.sgi.com/Technology/Performer/
Submissions: info-performer++at++sgi.com
Admin. requests: info-performer-request++at++sgi.com
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:57:22 PDT