Changeset 11259

Show
Ignore:
Timestamp:
03/19/10 18:09:30 (5 years ago)
Author:
robert
Message:

Added a minimum tiles size of 16 to prevent down sampling from being overly aggressive.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgTerrain/GeometryTechnique.cpp

    r11248 r11259  
    243243    // OSG_NOTICE<<"Sample ratio="<<sampleRatio<<std::endl; 
    244244 
    245     if (sampleRatio!=1.0f) 
    246     { 
    247      
     245    unsigned int minimumNumColumns = 16u; 
     246    unsigned int minimumNumRows = 16u; 
     247 
     248    if ((sampleRatio!=1.0f) && (numColumns>minimumNumColumns) && (numRows>minimumNumRows)) 
     249    { 
    248250        unsigned int originalNumColumns = numColumns; 
    249251        unsigned int originalNumRows = numRows; 
    250252     
    251         numColumns = std::max((unsigned int) (float(originalNumColumns)*sqrtf(sampleRatio)), 4u); 
    252         numRows = std::max((unsigned int) (float(originalNumRows)*sqrtf(sampleRatio)),4u); 
     253        numColumns = std::max((unsigned int) (float(originalNumColumns)*sqrtf(sampleRatio)), minimumNumColumns); 
     254        numRows = std::max((unsigned int) (float(originalNumRows)*sqrtf(sampleRatio)),minimumNumRows); 
    253255 
    254256        i_sampleFactor = double(originalNumColumns-1)/double(numColumns-1);