Added support for generating RGBA, RGBA-16 and RGBA-compressed texture databases
This commit is contained in:
parent
991feca6cc
commit
015c9a9765
@ -177,9 +177,12 @@ int main( int argc, char **argv )
|
||||
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("--compressed","Use OpenGL compression on RGB destination imagery");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--RGBA-compressed","Use OpenGL compression on RGBA 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("--RGBA-24","Use 24bit RGB destination imagery");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--RGB-16","Use 16bit RGBA destination imagery");
|
||||
arguments.getApplicationUsage()->addCommandLineOption("--RGBA","Use 32bit RGBA 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");
|
||||
@ -232,8 +235,11 @@ int main( int argc, char **argv )
|
||||
}
|
||||
|
||||
while (arguments.read("--compressed")) { dataset->setTextureType(osgTerrain::DataSet::COMPRESSED_TEXTURE); }
|
||||
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("--RGBA-compressed")) { dataset->setTextureType(osgTerrain::DataSet::COMPRESSED_RGBA_TEXTURE); }
|
||||
while (arguments.read("--RGB_16") || arguments.read("--RGB-16") ) { dataset->setTextureType(osgTerrain::DataSet::RGB_16); }
|
||||
while (arguments.read("--RGBA_16") || arguments.read("--RGBA-16") ) { dataset->setTextureType(osgTerrain::DataSet::RGBA_16); }
|
||||
while (arguments.read("--RGB_24") || arguments.read("--RGB-24") ) { dataset->setTextureType(osgTerrain::DataSet::RGB_24); }
|
||||
while (arguments.read("--RGBA") || arguments.read("--RGBA") ) { dataset->setTextureType(osgTerrain::DataSet::RGBA); }
|
||||
|
||||
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); }
|
||||
|
@ -997,9 +997,12 @@ class OSGTERRAIN_EXPORT DataSet : public osg::Referenced
|
||||
|
||||
enum TextureType
|
||||
{
|
||||
RGB_24_BIT,
|
||||
RGB_16_BIT,
|
||||
COMPRESSED_TEXTURE
|
||||
RGB_24,
|
||||
RGBA,
|
||||
RGB_16,
|
||||
RGBA_16,
|
||||
COMPRESSED_TEXTURE,
|
||||
COMPRESSED_RGBA_TEXTURE
|
||||
};
|
||||
void setTextureType(TextureType type) { _textureType = type; }
|
||||
TextureType getTextureType() const { return _textureType; }
|
||||
|
@ -753,6 +753,8 @@ void DataSet::SourceData::readImage(DestinationData& destination)
|
||||
destinationColumnPtr[1] = (int)(rd * (float)destinationColumnPtr[1] + rs * (float)sourceColumnPtr[1]);
|
||||
destinationColumnPtr[2] = (int)(rd * (float)destinationColumnPtr[2] + rs * (float)sourceColumnPtr[2]);
|
||||
|
||||
if (destination_hasAlpha)
|
||||
destinationColumnPtr[3] = osg::maximum(destinationColumnPtr[3],sourceColumnPtr[3]);
|
||||
|
||||
}
|
||||
}
|
||||
@ -2224,7 +2226,7 @@ osg::StateSet* DataSet::DestinationTile::createStateSet()
|
||||
|
||||
if (compressedImageSupported &&
|
||||
image->s()>=minumCompressedTextureSize && image->t()>=minumCompressedTextureSize &&
|
||||
_dataSet->getTextureType()==COMPRESSED_TEXTURE &&
|
||||
(_dataSet->getTextureType()==COMPRESSED_TEXTURE || _dataSet->getTextureType()==COMPRESSED_RGBA_TEXTURE) &&
|
||||
(image->getPixelFormat()==GL_RGB || image->getPixelFormat()==GL_RGBA))
|
||||
{
|
||||
|
||||
@ -2258,10 +2260,14 @@ osg::StateSet* DataSet::DestinationTile::createStateSet()
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_dataSet->getTextureType()==RGB_16_BIT && image->getPixelFormat()==GL_RGB)
|
||||
if (_dataSet->getTextureType()==RGB_16 && image->getPixelFormat()==GL_RGB)
|
||||
{
|
||||
image->scaleImage(image->s(),image->t(),image->r(),GL_UNSIGNED_SHORT_5_6_5);
|
||||
}
|
||||
else if (_dataSet->getTextureType()==RGBA_16 && image->getPixelFormat()==GL_RGBA)
|
||||
{
|
||||
image->scaleImage(image->s(),image->t(),image->r(),GL_UNSIGNED_SHORT_5_5_5_1);
|
||||
}
|
||||
|
||||
if (mipmapImageSupported && _dataSet->getMipMappingMode()==DataSet::MIP_MAPPING_IMAGERY)
|
||||
{
|
||||
@ -3538,6 +3544,9 @@ DataSet::CompositeDestination* DataSet::createDestinationGraph(CompositeDestinat
|
||||
tile->_dataSet = this;
|
||||
tile->_cs = cs;
|
||||
tile->_extents = extents;
|
||||
tile->_pixelFormat = (getTextureType()==COMPRESSED_RGBA_TEXTURE||
|
||||
getTextureType()==RGBA ||
|
||||
getTextureType()==RGBA_16) ? GL_RGBA : GL_RGB;
|
||||
tile->setMaximumImagerySize(maxImageSize,maxImageSize);
|
||||
tile->setMaximumTerrainSize(maxTerrainSize,maxTerrainSize);
|
||||
tile->computeMaximumSourceResolution(_sourceGraph.get());
|
||||
|
Loading…
Reference in New Issue
Block a user