|
From: Peter M. <me...@iw...> - 2001-08-03 12:48:54
|
-------- Original Message -------- Subject: RE: [Openvrml-develop] Using OpenVrml for a simulation Date: Wed, 1 Aug 2001 06:24:19 -0700 From: "luca regini" <luc...@li...> Reply-To: "luca regini" <luc...@li...> To: me...@iw... This message was sent from Geocrawler.com by "luca regini" <luc...@li...> 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 = 0; theSystem->debug("readWRL %s\n", tryUrl->url ()); // Should verify MIME type... istream & istm = 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 <br...@en...>, 30 Mar, 2000 // VrmlNamespace nodeDefs; VrmlNamespace * rootNamespace = ns ? ns : &nodeDefs; result = 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 |