Alf Ritter (alf++at++vr1.engin.umich.edu)
Mon, 19 Jun 1995 16:40:57 -0500 (EDT)
I traverse a Performer scene graph using pfuTraverse. Here are some
code fragments.
(1) setup traversal:
...
pfuTraverser traverser;
// init traverser struct
pfuInitTraverser (&traverser);
// assign callbacks
traverser.postFunc = postCallback;
traverser.preFunc = preCallback;
...
// start traversal
pfuTraverse ((pfNode*) pfRoot, &traverser);
(2) preCallback()
static long
preCallback (pfuTraverser *traverser)
{
...
// debugging messages
cerr << "preCallback(): " << pfGetTypeName ((pfObject *) traverser->node)
<< pfGetType (traverser->node);
...
}
(3) postCallback
static long
postCallback (pfuTraverser *traverser)
{
...
// debugging messages
cerr << "postCallback() " << pfGetTypeName ((pfObject *) traverser->node)
<< pfGetType (traverser->node);
...
}
The data I use (read as Inventor file) include several pfGroup's with
pfGeode's.
Everything works fine in the preCallback(), in the postCallback() the
traverser struct passed as a parameter seems to be wrong. This happens
as soon as the PostCallback() is called for a pfGroup. The
traverser->node member contains the same pointer as in the previous
call of the postCallback(), when it was called for the pfGeode, which
is contained in the pfGroup.
A pfuTravPrintNodes() output for a simple data example looks like this:
Node bird.iv: type: pfSCS = d0064
Node (null): type: pfGroup = 50064
Node (null): type: pfGeode = 30064
num GeoSets: 1
GeoSet 0: OVERALL - 2 prims, cbind=OVERALL, nbind=PER_VERT, tbind=OFF flatshade=1
GeoState: 0x2
Node (null): type: pfGeode = 30064
num GeoSets: 1
GeoSet 0: OVERALL - 1 prims, cbind=OVERALL, nbind=PER_VERT, tbind=OFF flatshade=1
GeoState: 0x2
Node (null): type: pfGeode = 30064
num GeoSets: 1
GeoSet 0: OVERALL - 1 prims, cbind=OVERALL, nbind=PER_VERT, tbind=OFF flatshade=1
GeoState: 0x2
Node (null): type: pfGroup = 50064
Node (null): type: pfGeode = 30064
num GeoSets: 1
GeoSet 0: OVERALL - 3 prims, cbind=OVERALL, nbind=PER_VERT, tbind=OFF flatshade=1
GeoState: 0x2
Node (null): type: pfGeode = 30064
num GeoSets: 1
GeoSet 0: OVERALL - 3 prims, cbind=OVERALL, nbind=PER_VERT, tbind=OFF flatshade=1
GeoState: 0x2
Node (null): type: pfGroup = 50064
Node (null): type: pfGeode = 30064
num GeoSets: 1
GeoSet 0: OVERALL - 3 prims, cbind=OVERALL, nbind=PER_VERT, tbind=OFF flatshade=1
GeoState: 0x2
Node (null): type: pfGeode = 30064
num GeoSets: 1
GeoSet 0: OVERALL - 3 prims, cbind=OVERALL, nbind=PER_VERT, tbind=OFF flatshade=1
GeoState: 0x2
The output coming from my debugging messages looks looks like this:
preCallback(): pfGroup 327780 group
preCallback(): pfGeode 196708 geode
postCallback() pfGeode 196708 geode
preCallback(): pfGeode 196708 geode
postCallback() pfGeode 196708 geode
preCallback(): pfGeode 196708 geode
postCallback() pfGeode 196708 geode
preCallback(): pfGroup 327780 group
preCallback(): pfGeode 196708 geode
postCallback() pfGeode 196708 geode
preCallback(): pfGeode 196708 geode
postCallback() pfGeode 196708 geode
postCallback() pfGeode 196708 geode
preCallback(): pfGroup 327780 group
preCallback(): pfGeode 196708 geode
postCallback() pfGeode 196708 geode
preCallback(): pfGeode 196708 geode
postCallback() pfGeode 196708 geode
postCallback() pfGeode 196708 geode
postCallback() pfGeode 196708 geode
postCallback() pfGeode 196708 geode
So the postCallback() gets a pfGeode instead of pfGroup or others.
Is this a bug or am I just doing something wrong?
Any help would be appreciated.
Alf
--
=============================================================================
Alf Ritter _/ _/ _/_/_/_/ alf++at++vr1.engin.umich.edu
University of Michigan _/_/ _/ _/ "Life would be so much easier
VR Laboratory _/ _/ _/ _/_/_/ if we could just look at the
_/_/_/_/ _/ _/ source code."
(313) 763-7798 _/ _/ _/_/_/ _/ http://www.engin.umich.edu/~aritter/
=============================================================================
This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:51:36 PDT