Changeset 949

Show
Ignore:
Timestamp:
10/14/08 21:21:36
Author:
robert
Message:

Added support for control whether imagery is forced to be PowerOfTwo? or not.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/TODO.txt

    r741 r949  
    33Already completed: 
    44 1) Added vpbmaster better cancellation. 
     5 2) Progress reporting with estimated time to completion. 
     6 3) Better split level estimation 
    57 4) Incremental build - i.e. ability to rerun from an existing tasks file. 
     8 5) Automatic set up of reprojection task if required. 
    69 6) Handling of ten of thousands of input files (i.e. will currently break the number of permissable open file handles.) 
    710 
    811Items left to do: 
    9  2) Progress reporting with estimated time to completion. 
    10  3) Better split level estimation 
    11  5) Automatic set up of reprojection task if required. 
    1212 7) Write up on the VPB wiki website about use of distributed/incremental build. 
  • trunk/include/vpb/BuildOptions

    r940 r949  
    6363        void setDestinationImageExtension(const std::string& extension) { _imageExtension = extension; } 
    6464        const std::string& getDestinationImageExtension() const { return _imageExtension; } 
     65 
     66        void setPowerOfTwoImages(bool powerOfTwoImages) { _powerOfTwoImages = powerOfTwoImages; } 
     67        bool getPowerOfTwoImages() const { return _powerOfTwoImages; } 
    6568         
    6669        /** Set the Archive name if one is to be used.*/ 
     
    339342        bool                                        _outputTaskDirectories; 
    340343        std::string                                 _imageExtension; 
     344        bool                                        _powerOfTwoImages; 
    341345        std::string                                 _intermediateBuildName; 
    342346        std::string                                 _logFileName; 
  • trunk/src/vpb/BuildOptions.cpp

    r937 r949  
    4040    _geometryType = POLYGONAL; 
    4141    _imageExtension = ".dds"; 
     42    _powerOfTwoImages = true; 
    4243    _intermediateBuildName = ""; 
    4344    _logFileName = ""; 
     
    121122    _geometryType = rhs._geometryType; 
    122123    _imageExtension = rhs._imageExtension; 
     124    _powerOfTwoImages = rhs._powerOfTwoImages; 
    123125    _intermediateBuildName = rhs._intermediateBuildName; 
    124126    _logFileName = rhs._logFileName; 
  • trunk/src/vpb/BuildOptionsIO.cpp

    r941 r949  
    245245        ADD_STRING_PROPERTY(DestinationTileExtension); 
    246246        ADD_STRING_PROPERTY(DestinationImageExtension); 
     247        ADD_BOOL_PROPERTY(PowerOfTwoImages); 
    247248        ADD_STRING_PROPERTY(ArchiveName); 
    248249        ADD_STRING_PROPERTY(IntermediateBuildName); 
  • trunk/src/vpb/Commandline.cpp

    r944 r949  
    793793    } 
    794794 
     795    while (arguments.read("--npot")) { buildOptions->setPowerOfTwoImages(false); } 
     796    while (arguments.read("--pot")) { buildOptions->setPowerOfTwoImages(true); } 
     797 
    795798    while (arguments.read("--height-attribute",heightAttributeName)) {} 
    796799 
  • trunk/src/vpb/Destination.cpp

    r946 r949  
    248248        unsigned int numRowsRequired    = osg::minimum(_image_maxNumRows,numRowsAtFullRes); 
    249249 
    250         // use a minimum image size of 4x4 to avoid mipmap generation problems in OpenGL at sizes at 2x2.  
    251         numColumns = 4; 
    252         numRows = 4; 
    253  
    254         // round to nearest power of two above or equal to the required resolution 
    255         while (numColumns<numColumnsRequired) numColumns *= 2; 
    256         while (numRows<numRowsRequired) numRows *= 2; 
    257  
     250 
     251        if (_dataSet->getPowerOfTwoImages()) 
     252        { 
     253            // use a minimum image size of 4x4 to avoid mipmap generation problems in OpenGL at sizes at 2x2.  
     254            numColumns = 4; 
     255            numRows = 4; 
     256 
     257            // round to nearest power of two above or equal to the required resolution 
     258            while (numColumns<numColumnsRequired) numColumns *= 2; 
     259            while (numRows<numRowsRequired) numRows *= 2; 
     260        } 
     261        else 
     262        { 
     263            numColumns = osg::maximum(4u, numColumnsRequired); 
     264            numRows = osg::maximum(4u, numRowsRequired); 
     265             
     266            if (_dataSet->getDestinationImageExtension()==".dds") 
     267            { 
     268                // when doing compressed textures make sure that it's an multiple of four 
     269                if ((numColumns % 4)!=0) numColumns = ((numColumns>>2)<<2)+4; 
     270                if ((numRows % 4)!=0) numRows = ((numRows>>2)<<2)+4; 
     271            } 
     272             
     273            osg::notify(osg::NOTICE)<<"numColumnsAtFullRes = "<<numColumnsRequired<<"\tnumColumns = "<< numColumns<<std::endl; 
     274            osg::notify(osg::NOTICE)<<"numRowsAtFullRes = "<<numRowsRequired<<"\tnumRows = "<< numRows<<std::endl; 
     275        } 
     276         
    258277        // set up properly for vector and raster (previously always vector) 
    259278        // assume raster if _dataType not set (default for Destination Tile) 
     
    12151234            if (_dataSet->getMipMappingMode()==DataSet::MIP_MAPPING_HARDWARE) 
    12161235                texture->setFilter(osg::Texture::MIN_FILTER,osg::Texture::LINEAR); 
     1236 
     1237            // make sure the OSG doesn't rescale images if it doesn't need to. 
     1238            texture->setResizeNonPowerOfTwoHint(_dataSet->getPowerOfTwoImages()); 
     1239 
    12171240 
    12181241            // get OpenGL driver to create texture from image.