From Luigi Calori, "In order to effectively use --image-ext and to add -O "plugin options",

some fix to osgdem.cpp and osgTerrain/DataSet.cpp

These mods should allow to build terrains controlling  jpeg compressed
imagery embedded in ive files,  using something like:

osgdemd  --image-ext jpeg --RGB_24 -O "JPEG_QUALITY 20
compressImageData" ......."
This commit is contained in:
Robert Osfield 2006-12-07 10:16:43 +00:00
parent 1a7a1704fd
commit db163de91c
2 changed files with 16 additions and 5 deletions

View File

@ -210,7 +210,7 @@ int main( int argc, char **argv )
arguments.getApplicationUsage()->addCommandLineOption("--tile-image-size","Set the tile maximum image size"); arguments.getApplicationUsage()->addCommandLineOption("--tile-image-size","Set the tile maximum image size");
arguments.getApplicationUsage()->addCommandLineOption("--tile-terrain-size","Set the tile maximum terrain size"); arguments.getApplicationUsage()->addCommandLineOption("--tile-terrain-size","Set the tile maximum terrain size");
arguments.getApplicationUsage()->addCommandLineOption("--comment","Added a comment/description string to the top most node in the dataset"); arguments.getApplicationUsage()->addCommandLineOption("--comment","Added a comment/description string to the top most node in the dataset");
arguments.getApplicationUsage()->addCommandLineOption("-O","string option to pass to write plugins, use \" \" for multiple options");
// create DataSet. // create DataSet.
osg::ref_ptr<osgTerrain::DataSet> dataset = new osgTerrain::DataSet; osg::ref_ptr<osgTerrain::DataSet> dataset = new osgTerrain::DataSet;
@ -341,6 +341,12 @@ int main( int argc, char **argv )
} }
} }
if (arguments.read("-O",str))
{
osgDB::ReaderWriter::Options* options = new osgDB::ReaderWriter::Options;
options->setOptionString(str);
osgDB::Registry::instance()->setOptions(options);
}
// if user request help write it out to cout. // if user request help write it out to cout.
if (arguments.read("-h") || arguments.read("--help")) if (arguments.read("-h") || arguments.read("--help"))

View File

@ -2339,7 +2339,8 @@ osg::StateSet* DataSet::DestinationTile::createStateSet()
osg::Image* image = imageData._imagery->_image.get(); osg::Image* image = imageData._imagery->_image.get();
std::string imageExension(".dds"); // ".rgb" std::string imageExension(_dataSet->_imageExtension);
//std::string imageExension(".dds"); // ".rgb"
//std::string imageExension(".jp2"); // ".rgb" //std::string imageExension(".jp2"); // ".rgb"
std::string imageName = _name; std::string imageName = _name;
if (layerNum>0) if (layerNum>0)
@ -4758,8 +4759,12 @@ void DataSet::_buildDestination(bool writeToDisk)
if (!_state) _state = new osg::State; if (!_state) _state = new osg::State;
osg::ref_ptr<osgDB::ReaderWriter::Options> previous_options = osgDB::Registry::instance()->getOptions(); osg::ref_ptr<osgDB::ReaderWriter::Options> previous_options = osgDB::Registry::instance()->getOptions();
if(previous_options.get()) {
osg::notify(osg::NOTICE) << "osgTerrain: adding optionstring" << previous_options->getOptionString() << std::endl;
osgDB::Registry::instance()->setOptions(new osgDB::ReaderWriter::Options(std::string("precision 16") + std::string(" ") + previous_options->getOptionString()) );
} else {
osgDB::Registry::instance()->setOptions(new osgDB::ReaderWriter::Options("precision 16")); osgDB::Registry::instance()->setOptions(new osgDB::ReaderWriter::Options("precision 16"));
}
if (!_archive && !_archiveName.empty()) if (!_archive && !_archiveName.empty())
{ {
unsigned int indexBlockSizeHint=4096; unsigned int indexBlockSizeHint=4096;