LOD and "selected" Callbacks

New Message Reply Date view Thread view Subject view Author view

Tom Impelluso (verdi++at++piano.ucsd.edu)
Wed, 3 Sep 1997 14:37:47 -0700


I have created an LOD that, in turn, has 4 geodes as children. As with
normal LOD operation, different children are displayed, depending on
the camera object distance.

I have also attached to each geode, a callback:

    for( i = 1; i <= numLOD; i++)
    {
        geode[i] = pfNewGeode();
        gset = createTorusGSet(arena, numPieces, numPoints, 1.0f);
        pfAddGSet(geode[i], gset);
        pfAddChild(lod, geode[i]);
        if(i == 1)pfNodeTravFuncs(geode[i], PFTRAV_APP, printData1,NULL);
        if(i == 2)pfNodeTravFuncs(geode[i], PFTRAV_APP, printData2,NULL);
        if(i == 3)pfNodeTravFuncs(geode[i], PFTRAV_APP, printData3,NULL);
        if(i == 4)pfNodeTravFuncs(geode[i], PFTRAV_APP, printData4,NULL);

        /* etc */
    }

When I run the code and move the mouse, the correct image appears as
expected. Further, the correct function is called. However in addition
to the correct function being called, the first function, printData1(),
is ALWAYS called, regardless of which geode is being displayed.
Essentially,

if LOD-3 is displayed, printData3() and printData1() are both called.
if LOD-4 is displayed, printData4() and printData1() are both called.

Basically, what I want is for a different callback to be called depending
on which geode is displayed.

As an alternative...
It would be ideal if there was a function:

        (int) current_lod_index = pfGetCurrentLODIndex(lod)

that I could call as a LOD was being traversed. Then, based upon that
index, I call my appropriate function.

Naturally, the easiest way may be to calculate the LOD-center to Camera
distance, and call a function manually. However, it would be cleaner
if I could automate the process without an additional if test.

(and to be more direct, what I really want is for the function to be called
on LOD passage. Meaning, as LOD-1 is visible printData1() is called ONCE.
Upon passage to LOD-2, printData2() is called ONCE. Upon passage back to LOD-1,
printData1() is called ONCE. etc.).

Is this possible?

Tom
=======================================================================
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:55:52 PDT

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