source: experimental/TerrainTest/ellipsoidTechnique.cpp @ 263

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