Ignore:
Timestamp:
Feb 25, 2011, 11:01:49 PM (13 years ago)
Author:
Torben Dannhauer
Message:

introduced abstract "terrainModficationTechnique" base class. this class will be derived by every terrainTechnique, e.g. ellipsoidTechnique

File:
1 edited

Legend:

Unmodified
Added
Removed
  • experimental/TerrainTest/ellipsoidTechnique.cpp

    r261 r262  
    55ellipsoidTechnique::ellipsoidTechnique()
    66{
     7        _height = 0.0;
    78}
    89
     
    1112}
    1213
    13 void ellipsoidTechnique::modifyHeightfield(osg::HeightField* h, double lat_min, double lat_max, double lon_min, double lon_max)
     14void ellipsoidTechnique::modifyHeightfield(osg::Vec4d& modificationROI, osg::HeightField* h, osg::Vec4d tileExtends)
    1415{
    1516        OSG_NOTIFY( osg::ALWAYS ) << "ellipsoidTechnique::modifyHeightfield()" << std::endl;
    16         OSG_NOTIFY( osg::ALWAYS ) << "LAT: " << lat_min << " | " << lat_max << std::endl;
    17         OSG_NOTIFY( osg::ALWAYS ) << "LON: " << lon_min << " | " << lon_max << std::endl;
    18 
    19         int rows = h->getNumRows();
    20         int cols = h->getNumColumns();
     17        OSG_NOTIFY( osg::ALWAYS ) << "LAT: " << tileExtends[0] << " | " << tileExtends[1] << std::endl;
     18        OSG_NOTIFY( osg::ALWAYS ) << "LON: " << tileExtends[2] << " | " << tileExtends[3] << std::endl;
    2119
    2220        // calculate colum start/end and row start/end of affected vertices
    23         int startX=0,startY=0,endX=cols,endY=rows;
     21        int startX=0, startY=0, endX=h->getNumColumns(), endY=h->getNumRows();
    2422
    25         double roi_lat_min = 48.336808;
    26         double roi_lat_max = 48.370467;
    27         double roi_lon_min = 11.736750;
    28         double roi_lon_max = 11.835322;
     23       
     24        // Dertermine loop variables..
     25        if(tileExtends[0]<modificationROI[0])
     26                startY = (modificationROI[0] - tileExtends[0]) / h->getYInterval();
     27        if(tileExtends[1]>modificationROI[1])
     28                endY = (modificationROI[1] - tileExtends[0]) / h->getYInterval();
    2929
    30         // dertermining loop variables
    31         if(lat_min<roi_lat_min)
    32                 startY = (roi_lat_min - lat_min) / h->getYInterval();
    33         if(lat_max>roi_lat_max)
    34                 endY = (roi_lat_max - lat_min) / h->getYInterval();
    35 
    36         if(lon_min<roi_lon_min)
    37                 startX = (roi_lon_min - lon_min) / h->getXInterval();
    38         if(lon_max>roi_lon_max)
    39                 endX = (roi_lon_max - lon_min) / h->getXInterval();
     30        if(tileExtends[2]<modificationROI[2])
     31                startX = (modificationROI[2] - tileExtends[2]) / h->getXInterval();
     32        if(tileExtends[3]>modificationROI[3])
     33                endX = (modificationROI[3] - tileExtends[2]) / h->getXInterval();
    4034
    4135
    42         // modify height value of affected vertices
     36        // Modify height value of affected vertices
    4337        for(int x=startX;x<endX;x++)
    4438        {
    4539                for(int y=startY;y<endY;y++)
    4640                {
    47                         h->setHeight( x, y, 550);
     41                        h->setHeight( x, y, _height);
    4842                }
    4943        }
    50 
    5144}
    5245
Note: See TracChangeset for help on using the changeset viewer.