Re: [Q] dynamic changes with pfFog

New Message Reply Date view Thread view Subject view Author view

Sylvain Mayer (mayer++at++poster.cae.ca)
Mon, 08 Dec 1997 10:19:36 -0500


Hi, you have to pfOverride every frame. Look the comments in code
below.

good luck

Gaertner, Michael wrote:
>
> I try to create a fog which is very close at the begin of the
> simulation and goes further out as the simulation goes on.
>
> I have this defined in the drawcallback:
>
> void DrawCallback(pfChannel *chan, void *data)
> {
> static int fogValue = 0;
>
> if (fogValue==0)
> {
> pfFog *fog = new pf Fog;
>
> fog->setRange(1.0, 2.0);
>
> fog->apply();
> pfEnable(PFEN_FOG);
> pfOverride(PFSTATE_FOG, | PFSTATE_ENFOG, PF_ON);
> }
> else
> {
> if(fogValue<200)
> {
> if(fogValue<199)
> {
> pfFog *fog = pfGetCurFog();
>
> fog->setRange(fogValue, 2.0f*fogValue);
> fog->apply();

You have to pfOverride every frame!!
I needed something like that in my app.

    pfOverride(PFSTATE_FOG | PFSTATE_ENFOG, PF_OFF);
    fog->apply();
    pfOverride(PFSTATE_FOG | PFSTATE_ENFOG, PF_ON);

> }
> else
> {
> pfOverride(PFSTATE_FOG | PFSTATE_ENFOG, PF_OFF);
> pfDisable(PFEN_FOG);
> }
> fogValue++;
> }
>
> }
>
> ...
> }
>
> with this function fog gets set once and stays at the same range
> til I turn it off after 200 frames.
>
> what do I do wrong ??? why doesnt the fog move out ?
> thanx for any help !
>
> Michael
> FASA Interactive
>

-- 
Sylvain Mayer, 3D Graphics Developer
CAE Electronics Ltd. (http://www.cae.ca)
=======================================================================
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:56:21 PDT

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