Re: Missile Trails

New Message Reply Date view Thread view Subject view Author view

Liu Xiaoyan (liuxy++at++ihpc.nus.edu.sg)
Thu, 07 May 1998 11:24:18 +0800


> Would anyone be kind enough to provide a block of code illustrating how to
> correctly setup pfuSmoke to produce missile trails? I have been trying on
> and off now for a few weeks and have not had any luck. After setting the
> basic parameters and starting the smoke, I simply see no visual results. It
> looks pretty straight forward, but a kick start from knowledgeable minds
> would be most appreciated.

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


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:57:22 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.