/
osgarchive is a utility program that creates and reads database archives. These archives can then be used at runtime with standard OSG applications such as osgviewer.
Creating a new archive
To create an archive you have to specify the archive filename, including extension, via the -a <filename> switch, and the insert 3d database and imagery files into the archive vie the -i <filename> [ <filename> ..] syntax such as:
osgarchive -a archive.osga -i cow.osg glider.osg
You may also insert the contents of whole directories using the same syntanx.
osgarchive -a archive.osga -i mydirectory
The .osga format also has support for a master file, which is set to the first file inserted into the archive.
Listing files contained in the archive
To list all the files contained specify the archive, then use the -l switch:
osgarchive -a archive.osga -l
This will print out the list of files contained within the archive.
Extracting files from an archive
To extract files from the archive specify the archive, then use the -e <filename> [<filename>...] syntanx:
osgarchive -a archive.osga -e cow.osg
Archive files can be read just like normal OSG files, with the file extraction happening transparently with osgDB. To load the archive's master file simple load the archive itself:
osgviewer archive.osga
Or to load a specific file within the archive:
osgviewer archive.osga/glider.osg
Or programmatically:
osg::ref_ptr<osg::Node> masterNode = osgDB::readNodeFile("archive.osga"); osg::ref_ptr<osg::Node> gliderNode = osgDB::readNodeFile("archive.osga/glider.osg");
The osgdem utility program also has support for generating .osga archives, simply by specify -a <filename> its possible to put all osgdem generated tiles into a single archive file.
The OpenSceneGraph mechanism for archive support uses istream and ostreams for streaming data in and out of the archive, and not all 3d database and image file formats supported by the OpenSceneGraph also support istream and ostreams. Follows are is a list of formats that are currently supported: