Hi,
I have being doing some work on getting my VPB generated terrains working from
within an archive. In doing so I discovered that the new formats do not work
with the current archive mechanism.
The reason for this is the fact that when the Registry loads a file from an
archive it always calls the readObject method regardless of wether a node or
image etc is being loaded. The relevent code is in Registry.cpp, ln 977
ReaderWriter::ReadResult Registry::read(const ReadFunctor& readFunctor) {
...
.. if an archive is found
return archive->readObject(fileName,options.get());
}
This case seems to be handled in most of the other ReaderWriters, for example,
in the .ive ReaderWriter:
virtual ReadResult readObject(const std::string& file, const Options* options)
const {
return readNode(file, options);
}
and in the .dds ReaderWriter:
virtual ReadResult readObject(std::istream& fin, const Options* options) const {
return readImage(fin,options);
}
My first thought is that the code in Registry should be changed so it respects
the type of the ReadFunctor it is passed and calls the appropritae method.
While this is probably worth doing, I see no reason why the new serializer
ReaderWriter shouldnt handle all cases from its read/write object calls. I have
had a quick look at the code and it seems like it should be an easy fix as we
can tell the object type from the header (at least in the case of reads).
Making these changes to the ReaderWriter would also greatly increase the ease
of writing a tool to archive a selection of files such as osgarchive. In this
situation you will not know the type of file (node, image etc) that you are
reading.
For my current work, I know know the file type I am adding to an archive from
its extension so I have hard coded the correct calls to readNode/readImage but
this is not a good approach.
My main concern is somehow breaking the extensablility/flexablity of the new
serializers with these changes.
Are there any thoughts on this? Are both changes worth while, or just one or
the other?
Cheers,
Brad
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=34233#34233
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org