|
From: <luc...@li...> - 2001-08-03 17:44:13
|
After some more investigation i found that the member variable d_v in
a VrmlMFNode object should contain a list of pointers to its sons.
This member is private so it is not accessible from client programmers.
Should i add a method to the VrmlMFNode to return its sons or is there
another way to get access to a Node' sons?
Thanks
Luca
Ur Answer is clearing some points and is very
helpful.
Anyway probably my first question is not well
formulated: I should have the ability to parse
all nodes in the Vrml scene graph , not just
DEFined nodes.
Taking a look at this code:
VrmlMFNode * VrmlScene::readWrl(Doc2 * tryUrl,
VrmlNamespace * ns)
{
VrmlMFNode * result =3D 0;
theSystem->debug("readWRL %s\n", tryUrl->url
());
// Should verify MIME type...
istream & istm =3D tryUrl->inputStream();
if (istm) {
Vrml97Scanner scanner(istm);
Vrml97Parser parser(scanner);
//
// If the caller is not interested in
PROTO defs, use a local namespace.
//
// Note: Can we displace the
responsibility for this to the caller? Here
// we instantiate a VrmlNamespace whether
or not we need it. That could
// be avoided with new/delete, but the
resulting code would be awkward
// and hard to follow. Why not instead
have the caller pass in a
// reference to a namespace, and let the
caller decide whether or not a
// new namespace should be instantiated?
// -- Braden McDaniel
<<EMAIL: PROTECTED>>, 30 Mar, 2000
//
VrmlNamespace nodeDefs;
VrmlNamespace * rootNamespace =3D ns ? ns :
&nodeDefs;
result =3D new VrmlMFNode();
try {
parser.vrmlScene(*result,
*rootNamespace, tryUrl);
} catch (std::exception & ex) {
cerr < ex.what() < endl;
}
}
return result;
}
it seems to me that all the parsed scene graph is
collected in VrmlMFNode * result so i would like
to know how to parse the resulting tree.
I dont know if i am right since i didnt have the
time to dig deeply in the library code ( and this
is an hard task given the amount of code ) but to
me this ipothesis makes sense even if probably i
am wrong.
So put in a few word the question is:
if i run something like this:
parser.vrmlScene(*result, *rootNamespace, tryUrl);
is all the World scene graph returned in *result?
How to traverse the resulting object graph?
Greets
Luca
|