Added support in osgTerrain/osgdem for setting the image format to use when writing tiles out to disk
This commit is contained in:
parent
d58487c763
commit
e404b95dc3
@ -164,6 +164,7 @@ int main( int argc, char **argv )
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-a <archivename>","Specify the archive to place the generated database");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-o <outputfile>","Specify the output master file to generate");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-l <numOfLevels>","Specify the number of PagedLOD levels to generate");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--image-ext <ext>","Specify the Image format to output to via its plugin name, i.e. rgb, dds, jp2, jpeg.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--levels <begin_level> <end_level>","Specify the range of lavels that the next source Texture or DEM will contribute to.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--layer <layer_num>","Specify the layer that the next source Texture will contribute to..");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-e <x> <y> <w> <h>","Extents of the model to generate");
|
||||
@ -296,6 +297,26 @@ int main( int argc, char **argv )
|
||||
dataset->setRadiusToMaxVisibleDistanceRatio(radiusToMaxVisibleDistanceRatio);
|
||||
}
|
||||
|
||||
std::string image_ext;
|
||||
while (arguments.read("--image-ext",image_ext))
|
||||
{
|
||||
std::string::size_type dot = image_ext.find_last_of('.');
|
||||
if (dot!=std::string::npos) image_ext.erase(0,dot+1);
|
||||
|
||||
osgDB::ReaderWriter* rw = osgDB::Registry::instance()->getReaderWriterForExtension(image_ext);
|
||||
if (rw)
|
||||
{
|
||||
image_ext.insert(0,".");
|
||||
dataset->setDestinationImageExtension(image_ext);
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cout<<"Error: can not find plugin to write out image with extension '"<<image_ext<<"'"<<std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if user request help write it out to cout.
|
||||
if (arguments.read("-h") || arguments.read("--help"))
|
||||
|
@ -982,6 +982,9 @@ class OSGTERRAIN_EXPORT DataSet : public osg::Referenced
|
||||
|
||||
void setDestinationTileExtension(const std::string& extension) { _tileExtension = extension; }
|
||||
const std::string& getDestinationTileExtension() const { return _tileExtension; }
|
||||
|
||||
void setDestinationImageExtension(const std::string& extension) { _imageExtension = extension; }
|
||||
const std::string& getDestinationImageExtension() const { return _imageExtension; }
|
||||
|
||||
enum DatabaseType
|
||||
{
|
||||
@ -1125,6 +1128,7 @@ class OSGTERRAIN_EXPORT DataSet : public osg::Referenced
|
||||
osg::ref_ptr<osgDB::Archive> _archive;
|
||||
std::string _tileBasename;
|
||||
std::string _tileExtension;
|
||||
std::string _imageExtension;
|
||||
osg::Vec4 _defaultColor;
|
||||
DatabaseType _databaseType;
|
||||
GeometryType _geometryType;
|
||||
|
@ -1508,9 +1508,7 @@ void DataSet::DestinationTile::allocate()
|
||||
|
||||
imageData._imagery->_image = new osg::Image;
|
||||
|
||||
std::string imageExension(".dds"); // ".rgb"
|
||||
//std::string imageExension(".jp2"); // ".rgb"
|
||||
std::string imageName(_name+imageExension);
|
||||
std::string imageName(_name+_dataSet->getDestinationImageExtension());
|
||||
imageData._imagery->_image->setFileName(imageName.c_str());
|
||||
|
||||
imageData._imagery->_image->allocateImage(texture_numColumns,texture_numRows,1,_pixelFormat,GL_UNSIGNED_BYTE);
|
||||
@ -3705,6 +3703,11 @@ DataSet::DataSet()
|
||||
|
||||
_convertFromGeographicToGeocentric = false;
|
||||
|
||||
_tileBasename = "output";
|
||||
_tileExtension = ".ive";
|
||||
_imageExtension = ".dds";
|
||||
|
||||
|
||||
_defaultColor.set(0.5f,0.5f,1.0f,1.0f);
|
||||
_databaseType = PagedLOD_DATABASE;
|
||||
_geometryType = POLYGONAL;
|
||||
|
Loading…
Reference in New Issue
Block a user