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

@@ -108,6 +108,27 @@ bool Output::writeObject(const osg::Object& obj)
return Registry::instance()->writeObject(obj,*this);
}
void Output::writeBeginObject(const std::string& name)
{
indent() << name << " {" << std::endl;
}
void Output::writeEndObject()
{
indent() << "}" << std::endl;
}
void Output::writeUseID(const std::string& id)
{
indent() << "Use " << id << std::endl;
}
void Output::writeUniqueID(const std::string& id)
{
indent() << "UniqueID " << id << std::endl;
}
bool Output::getUniqueIDForObject(const osg::Object* obj,std::string& uniqueID)
{
UniqueIDToLabelMapping::iterator fitr = _objectToUniqueIDMap.find(obj);