[info-performer] How to use pfVolFog

New Message Reply Date view Thread view Subject view Author view

From: Chee Tzuon (CheeTzuon++at++stts.com.sg)
Date: 04/09/2003 02:28:28


Hi pfAll,

Have read all the man pages and the manual about patchy Fog. Managed to create layered fog with pfVolFog, but do not understand how to create patchy Fog.
Tried inserting the node part with a geoset of cube but still unable to see the results. Can anyone help?? The following is the part which i used to create the patchy fog
        
        pfDCS *fognode=new pfDCS;
        pfVec3 *scoords;
        pfCoord fogpos;

        fogpos.xyz.set(1100,3300,20);
        fogpos.hpr.set(0,0,0);

        void *arena=pfGetSharedArena();
        pfGeode *fogeode = new pfGeode;
        pfGeoSet *fogset=new pfGeoSet;
        pfGeoState *fogstate = new pfGeoState;

        fogstate->setMode(PFSTATE_CULLFACE,PFCF_OFF);
        fogstate->setMode(PFSTATE_ENLIGHTING, PF_ON);
        fogset->setPrimType(PFGS_QUADS);
        fogset->setNumPrims(6);

        scoords=(pfVec3*)pfMalloc(24*sizeof(pfVec3),arena);
        scoords[0].set(0.0,0.0,0.0);
        scoords[1].set(5.0,0.0,0.0);
        scoords[2].set(5.0,0.0,5.0);
        scoords[3].set(0.0,0.0,5.0);
        
        scoords[4].set(5.0,0.0,0.0);
        scoords[5].set(5.0,5.0,0.0);
        scoords[6].set(5.0,5.0,5.0);
        scoords[7].set(5.0,0.0,5.0);
        
        scoords[8].set(5.0,5.0,0.0);
        scoords[9].set(0.0,5.0,0.0);
        scoords[10].set(0.0,5.0,5.0);
        scoords[11].set(5.0,5.0,5.0);

        scoords[12].set(0.0,5.0,0.0);
        scoords[13].set(0.0,0.0,0.0);
        scoords[14].set(0.0,0.0,5.0);
        scoords[15].set(0.0,5.0,5.0);
        
        scoords[16].set(0.0,0.0,5.0);
        scoords[17].set(5.0,0.0,5.0);
        scoords[18].set(5.0,5.0,5.0);
        scoords[19].set(0.0,5.0,5.0);

        scoords[20].set(0.0,0.0,0.0);
        scoords[21].set(5.0,0.0,0.0);
        scoords[22].set(5.0,5.0,0.0);
        scoords[23].set(0.0,5.0,0.0);
        fogset->setAttr(PFGS_COORD3,PFGS_PER_VERTEX,scoords,NULL);

         fogset->setGState(fogstate);
        fogeode->addGSet(fogset);
        fognode->addChild(fogeode);
        fognode->setCoord(&fogpos);

        vFog->setVal(PFVFOG_PATCHY_MODE, PFVFOG_LINEAR);
        vFog->setColor(1,0,0);
        vFog->setDensity(1.0);
        vFog->addNode(fognode);
        scene->addChild(fognode);
        vFog->apply(scene);
        vFog->addChannel(chan);

        chan->setTravFunc(PFTRAV_DRAW,drawCall);


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Wed Apr 09 2003 - 02:29:25 PDT

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