source: experimental/TerrainTest/ellipsoidTechnique.cpp @ 264

Last change on this file since 264 was 264, checked in by Torben Dannhauer, 13 years ago
  • Property svn:eol-style set to native
File size: 1.3 KB
RevLine 
[258]1#include "ellipsoidTechnique.h"
2
3
4ellipsoidTechnique::ellipsoidTechnique()
5{
[262]6        _height = 0.0;
[258]7}
8
9ellipsoidTechnique::~ellipsoidTechnique()
10{
11}
12
[262]13void ellipsoidTechnique::modifyHeightfield(osg::Vec4d& modificationROI, osg::HeightField* h, osg::Vec4d tileExtends)
[258]14{
[263]15        //OSG_NOTIFY( osg::ALWAYS ) << "ellipsoidTechnique::modifyHeightfield()" << std::endl;
16        //OSG_NOTIFY( osg::ALWAYS ) << "LAT: " << tileExtends[0] << " | " << tileExtends[1] << std::endl;
17        //OSG_NOTIFY( osg::ALWAYS ) << "LON: " << tileExtends[2] << " | " << tileExtends[3] << std::endl;
[258]18
19        // calculate colum start/end and row start/end of affected vertices
[262]20        int startX=0, startY=0, endX=h->getNumColumns(), endY=h->getNumRows();
[258]21
[262]22       
23        // Dertermine loop variables..
24        if(tileExtends[0]<modificationROI[0])
25                startY = (modificationROI[0] - tileExtends[0]) / h->getYInterval();
26        if(tileExtends[1]>modificationROI[1])
27                endY = (modificationROI[1] - tileExtends[0]) / h->getYInterval();
[258]28
[262]29        if(tileExtends[2]<modificationROI[2])
30                startX = (modificationROI[2] - tileExtends[2]) / h->getXInterval();
31        if(tileExtends[3]>modificationROI[3])
32                endX = (modificationROI[3] - tileExtends[2]) / h->getXInterval();
[260]33
34
[262]35        // Modify height value of affected vertices
[260]36        for(int x=startX;x<endX;x++)
37        {
38                for(int y=startY;y<endY;y++)
39                {
[262]40                        h->setHeight( x, y, _height);
[260]41                }
42        }
[258]43}
44
Note: See TracBrowser for help on using the repository browser.