From Mike Weiblen, with mods of using references by Robert Osfield for efficiency. Submission notes from Mike:

"By repurpose, I'm creating a new plugin that uses much of the .osg fileformat,
but with some changes.  Specifically, I'm creating a ".osgfs" plugin, which
represents the scenegraph hierarchy as a filesystem of nested subdirectories and
individual files for each node, rather than nested braces with everything in a
single monolithic file.  I intend to incorporate file alteration monitor events
to watch the filesystem for modifications and automatically reload.

The problem I'm running into is osgDB is too tightly coupled to the .osg format.
osgDB::Output::writeObject() contains literal .osg format-specific strings like
"{" to represent the Object hierarchy at too low a semantic level.  I propose
using virtual methods; my plugin can then derive from osgDB::Output and
represent Object hiearchy differently.
"
This commit is contained in:
Robert Osfield
2007-05-09 10:01:15 +00:00
parent 790a1ea66f
commit 5d23bf7739
3 changed files with 38 additions and 16 deletions

View File

@@ -62,7 +62,10 @@ class OSGDB_EXPORT Output : public std::ofstream
void moveOut();
virtual bool writeObject(const osg::Object& obj);
virtual void writeBeginObject(const std::string& name);
virtual void writeEndObject();
virtual void writeUseID(const std::string& id);
virtual void writeUniqueID(const std::string& id);
bool getUniqueIDForObject(const osg::Object* obj,std::string& uniqueID);
bool createUniqueIDForObject(const osg::Object* obj,std::string& uniqueID);