Highlighting a pfPath

New Message Reply Date view Thread view Subject view Author view

Michael Boccara (boccara++at++MIT.EDU)
Mon, 15 Feb 1999 21:50:57 -0800


Hello again,

Thanks to Paul and Joseph for answering my previous question.
Here is another :
  
I have a pfNode which is multiple referenced by several pfDCS in my in my
pfScene graph, like that :

scene
|______
| \
dcs_1 dcs_2
| /
| /
| /
 node

I want to pfHighlight a picked pfPath descendind to the leaf node.

pfNodeTravHighlight is not of much help because it modifies the pfGeoStates
under the level of node.

I guess I should use a draw pre- and post- callback on the dcs_i, but I'm having
a hard time with the bin-stuff re-sorting of the scene graph in the DRAW
process.

How can I ensure that the dcs_i for which I will have set a highlighting draw
callback will really highlight only its children and none of its neighbors ?

I tried the follwing piece of code, but it highlights both my 2 dcs :

int
preDrawHighlight(pfTraverser* , void* )
{
  pfEnable(PFEN_HIGHLIGHTING);
  pfOverride(PFSTATE_ENHIGHLIGHTING, 1);
  Global->hl->apply();
  return PFTRAV_CONT;
}

int
postDrawHighlight(pfTraverser* , void* )
{
  pfDisable(PFEN_HIGHLIGHTING);
  pfOverride(PFSTATE_ENHIGHLIGHTING, 1);
  return PFTRAV_CONT;
}

void
highlightNode(pfNode* node, int val)
{
  if(val)
    node->setTravFuncs(PFTRAV_DRAW, preDrawHighlight, postDrawHighlight);
  else
    node->setTravFuncs(PFTRAV_DRAW, NULL, NULL);
}

main()
{
...
 scene->addChild(dcs1);
 scene->addChild(dcs2);
 dcs1->addChild(node);
 dcs2->addChild(node);
...
 highlightNode(dcs1, 1);
...
}

Is there something wrong ?

Michael

-- 
Michael Boccara  | boccara++at++mit.edu | (617) 253 0005
Massachusetts Institute of Technology  
Virtual Environment Technologies for Training
http://www.mit.edu/~boccara

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Feb 15 1999 - 18:49:35 PST

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