Added support for --tile-image-size <size>, --tile-terrain-size <size> and --comment <string>
command line options into osgTerrain::DataSet + osgdem.
This commit is contained in:
@@ -187,21 +187,21 @@ int main( int argc, char **argv )
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--cs <coordinates system string>","Set the coordinates system of source imagery, DEM or destination database. The string may be any of the usual GDAL/OGR forms, complete WKT, PROJ.4, EPS");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--wkt <WKT string>","Set the coordinates system of source imagery, DEM or destination database in WellKownText form.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--wkt-file <WKT file>","Set the coordinates system of source imagery, DEM or destination database by as file containing WellKownText definition.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--skirt-ratio <float>","Set the ratio of skirt height to tile size.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--skirt-ratio <float>","Set the ratio of skirt height to tile size");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--HEIGHT_FIELD","Create a height field database");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--POLYGONAL","Create a height field database");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--LOD","Create a LOD'd database");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--PagedLOD","Create a PagedLOD'd database");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("-v","Set the vertical multiplier");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--compressed","Use OpenGL compression on destination imagery");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--RGB_16","Use 16bit RGB destination imagery");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--RGB_24","Use 24bit RGB destination imagery");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--max_visible_distance_of_top_level","Set the maximum visible distance that the top most tile can be viewed at");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--radius_to_max_visible_distance_ratio","Set the maximum visible distance ratio for all tiles apart from the top most tile. The maximum visuble distance is computed from the ratio * tile radius.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--no_mip_mapping","Disable mip mapping of textures");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--mip_mapping_hardware","Use mip mapped textures, and generate the mipmaps in hardware when available.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--mip_mapping_imagery","Use mip mapped textures, and generate the mipmaps in imagery.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--max_anisotropy","Max anisotropy level to use when texturing, defaults to 1.0.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--RGB-16","Use 16bit RGB destination imagery");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--RGB-24","Use 24bit RGB destination imagery");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--max-visible-distance-of-top-level","Set the maximum visible distance that the top most tile can be viewed at");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--radius-to-max-visible-distance-ratio","Set the maximum visible distance ratio for all tiles apart from the top most tile. The maximum visuble distance is computed from the ratio * tile radius.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--no-mip-mapping","Disable mip mapping of textures");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--mip-mapping-hardware","Use mip mapped textures, and generate the mipmaps in hardware when available.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--mip-mapping-imagery","Use mip mapped textures, and generate the mipmaps in imagery.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--max-anisotropy","Max anisotropy level to use when texturing, defaults to 1.0.");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--bluemarble-east","");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--bluemarble-west","");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--whole-globe","");
|
||||
@@ -213,6 +213,9 @@ int main( int argc, char **argv )
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--yt","");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--zz","");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--zt","");
|
||||
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("--comment","Added a comment/description string to the top most node in the dataset");
|
||||
|
||||
// create DataSet.
|
||||
osg::ref_ptr<osgTerrain::DataSet> dataset = new osgTerrain::DataSet;
|
||||
@@ -245,19 +248,28 @@ int main( int argc, char **argv )
|
||||
}
|
||||
|
||||
while (arguments.read("--compressed")) { dataset->setTextureType(osgTerrain::DataSet::COMPRESSED_TEXTURE); }
|
||||
while (arguments.read("--RGB_16")) { dataset->setTextureType(osgTerrain::DataSet::RGB_16_BIT); }
|
||||
while (arguments.read("--RGB_24")) { dataset->setTextureType(osgTerrain::DataSet::RGB_24_BIT); }
|
||||
while (arguments.read("--RGB_16") || arguments.read("--RGB-16") ) { dataset->setTextureType(osgTerrain::DataSet::RGB_16_BIT); }
|
||||
while (arguments.read("--RGB_24") || arguments.read("--RGB-24") ) { dataset->setTextureType(osgTerrain::DataSet::RGB_24_BIT); }
|
||||
|
||||
while (arguments.read("--no_mip_mapping")) { dataset->setMipMappingMode(osgTerrain::DataSet::NO_MIP_MAPPING); }
|
||||
while (arguments.read("--mip_mapping_hardware")) { dataset->setMipMappingMode(osgTerrain::DataSet::MIP_MAPPING_HARDWARE); }
|
||||
while (arguments.read("--mip_mapping_imagery")) { dataset->setMipMappingMode(osgTerrain::DataSet::MIP_MAPPING_IMAGERY); }
|
||||
while (arguments.read("--no_mip_mapping") || arguments.read("--no-mip-mapping")) { dataset->setMipMappingMode(osgTerrain::DataSet::NO_MIP_MAPPING); }
|
||||
while (arguments.read("--mip_mapping_hardware") || arguments.read("--mip-mapping-hardware")) { dataset->setMipMappingMode(osgTerrain::DataSet::MIP_MAPPING_HARDWARE); }
|
||||
while (arguments.read("--mip_mapping_imagery") || arguments.read("--mip-mapping-imagery")) { dataset->setMipMappingMode(osgTerrain::DataSet::MIP_MAPPING_IMAGERY); }
|
||||
|
||||
float maxAnisotropy;
|
||||
while (arguments.read("--max_anisotropy",maxAnisotropy))
|
||||
while (arguments.read("--max_anisotropy",maxAnisotropy) || arguments.read("--max-anisotropy",maxAnisotropy))
|
||||
{
|
||||
dataset->setMaxAnisotropy(maxAnisotropy);
|
||||
}
|
||||
|
||||
unsigned int image_size;
|
||||
while (arguments.read("--tile-image-size",image_size)) { dataset->setMaximumTileImageSize(image_size); }
|
||||
|
||||
unsigned int terrain_size;
|
||||
while (arguments.read("--tile-terrain-size",terrain_size)) { dataset->setMaximumTileTerrainSize(terrain_size); }
|
||||
|
||||
std::string comment;
|
||||
while (arguments.read("--comment",comment)) { dataset->setCommentString(comment); }
|
||||
|
||||
|
||||
dataset->setDestinationTileBaseName("output");
|
||||
dataset->setDestinationTileExtension(".ive");
|
||||
@@ -279,13 +291,15 @@ int main( int argc, char **argv )
|
||||
}
|
||||
|
||||
float maxVisibleDistanceOfTopLevel;
|
||||
while (arguments.read("--max_visible_distance_of_top_level",maxVisibleDistanceOfTopLevel))
|
||||
while (arguments.read("--max_visible_distance_of_top_level",maxVisibleDistanceOfTopLevel) ||
|
||||
arguments.read("--max-visible-distance-of-top-level",maxVisibleDistanceOfTopLevel) )
|
||||
{
|
||||
dataset->setMaximumVisibleDistanceOfTopLevel(maxVisibleDistanceOfTopLevel);
|
||||
}
|
||||
|
||||
float radiusToMaxVisibleDistanceRatio;
|
||||
while (arguments.read("--radius_to_max_visible_distance_ratio",radiusToMaxVisibleDistanceRatio))
|
||||
while (arguments.read("--radius_to_max_visible_distance_ratio",radiusToMaxVisibleDistanceRatio) ||
|
||||
arguments.read("--radius-to-max-visible-distance-ratio",radiusToMaxVisibleDistanceRatio))
|
||||
{
|
||||
dataset->setRadiusToMaxVisibleDistanceRatio(radiusToMaxVisibleDistanceRatio);
|
||||
}
|
||||
|
||||
@@ -865,6 +865,12 @@ class OSGTERRAIN_EXPORT DataSet : public osg::Referenced
|
||||
|
||||
void loadSources();
|
||||
|
||||
void setMaximumTileImageSize(unsigned int size) { _maximumTileImageSize = size; }
|
||||
unsigned int getMaximumTileImageSize() const { return _maximumTileImageSize; }
|
||||
|
||||
void setMaximumTileTerrainSize(unsigned int size) { _maximumTileTerrainSize = size; }
|
||||
unsigned int getMaximumTileTerrainSize() const { return _maximumTileTerrainSize; }
|
||||
|
||||
void setMaximumVisibleDistanceOfTopLevel(float d) { _maximumVisiableDistanceOfTopLevel = d; }
|
||||
float getMaximumVisibleDistanceOfTopLevel() const { return _maximumVisiableDistanceOfTopLevel; }
|
||||
|
||||
@@ -951,7 +957,10 @@ class OSGTERRAIN_EXPORT DataSet : public osg::Referenced
|
||||
|
||||
void setDecorateGeneratedSceneGraphWithCoordinateSystemNode(bool flag) { _decorateWithCoordinateSystemNode = flag; }
|
||||
bool getDecorateGeneratedSceneGraphWithCoordinateSystemNode() const { return _decorateWithCoordinateSystemNode; }
|
||||
|
||||
|
||||
|
||||
void setCommentString(const std::string& comment) { _comment = comment; }
|
||||
const std::string& getCommentString() const { return _comment; }
|
||||
|
||||
|
||||
CompositeDestination* createDestinationGraph(CompositeDestination* parent,
|
||||
@@ -997,6 +1006,9 @@ class OSGTERRAIN_EXPORT DataSet : public osg::Referenced
|
||||
QuadMap _quadMap;
|
||||
|
||||
|
||||
|
||||
unsigned int _maximumTileImageSize;
|
||||
unsigned int _maximumTileTerrainSize;
|
||||
float _maximumVisiableDistanceOfTopLevel;
|
||||
float _radiusToMaxVisibleDistanceRatio;
|
||||
float _verticalScale;
|
||||
@@ -1023,6 +1035,8 @@ class OSGTERRAIN_EXPORT DataSet : public osg::Referenced
|
||||
|
||||
bool _decorateWithCoordinateSystemNode;
|
||||
|
||||
std::string _comment;
|
||||
|
||||
osg::ref_ptr<osg::Node> _rootNode;
|
||||
|
||||
};
|
||||
|
||||
@@ -2896,6 +2896,9 @@ DataSet::DataSet()
|
||||
{
|
||||
init();
|
||||
|
||||
_maximumTileImageSize = 256;
|
||||
_maximumTileTerrainSize = 64;
|
||||
|
||||
_maximumVisiableDistanceOfTopLevel = 1e10;
|
||||
|
||||
_radiusToMaxVisibleDistanceRatio = 7.0f;
|
||||
@@ -3266,15 +3269,11 @@ void DataSet::computeDestinationGraphFromSources(unsigned int numLevels)
|
||||
osg::notify(osg::INFO)<<" yMin()"<<extents.yMin()<<" "<<extents.yMax()<<std::endl;
|
||||
|
||||
// then create the destinate graph accordingly.
|
||||
|
||||
unsigned int imageSize = 256;
|
||||
unsigned int terrainSize = 64;
|
||||
|
||||
_destinationGraph = createDestinationGraph(0,
|
||||
_intermediateCoordinateSystem.get(),
|
||||
extents,
|
||||
imageSize,
|
||||
terrainSize,
|
||||
_maximumTileImageSize,
|
||||
_maximumTileTerrainSize,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
@@ -3534,6 +3533,12 @@ void DataSet::_writeRow(Row& row)
|
||||
node = decorateWithCoordinateSystemNode(node.get());
|
||||
}
|
||||
|
||||
|
||||
if (!_comment.empty())
|
||||
{
|
||||
node->addDescription(_comment);
|
||||
}
|
||||
|
||||
//std::string filename = cd->_name + _tileExtension;
|
||||
std::string filename = _tileBasename+_tileExtension;
|
||||
|
||||
@@ -3599,6 +3604,11 @@ void DataSet::writeDestination()
|
||||
_rootNode = decorateWithCoordinateSystemNode(_rootNode.get());
|
||||
}
|
||||
|
||||
if (!_comment.empty())
|
||||
{
|
||||
_rootNode->addDescription(_comment);
|
||||
}
|
||||
|
||||
osgDB::writeNodeFile(*_rootNode,filename);
|
||||
}
|
||||
else // _databaseType==PagedLOD_DATABASE
|
||||
|
||||
Reference in New Issue
Block a user