BOCCARA Michael (MICHAEL.BOCCARA++at++siege.aerospatiale.fr)
Thu, 4 Sep 1997 13:14:29 +0200
Considering your request of evaluating the active index of a LOD, you can do
it it a APPorCULLorDRAW callback, using the pfLOD::evaluate, and the curret
transformation matrix supplied by pTraverser :
lod->setTravFuncs(PFTRAV_APP, NULL, getInfo);
int
getInfo(pfTraverser* trav, void* )
(
pfMatrix mat;
trav->getMat(mat);
pfLOD *lod = (pfLOD*)trav->getNode();
float i = lod->evaluate(trav->getChan(), mat);
print(i);
)
is it what you are looking for ?
Mike
_______________________________________________________________________________
_
De: P=INTERNET; DDA.TYPE=RFC-822; DDA.VALUE=guest(a)holodeck.csd.sgi.com le
Jeu 4 Sep 1997 7:02
Objet: LOD and "selected" Callbacks
A: P=INTERNET; DDA.TYPE=RFC-822; DDA.VALUE=info-performer(a)sgi.com; BOCCARA
Michael
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
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:55:52 PDT