[258] | 1 | #include "ellipsoidTechnique.h" |
---|
| 2 | #include <osgTerrain/TerrainTile> |
---|
| 3 | |
---|
| 4 | |
---|
| 5 | ellipsoidTechnique::ellipsoidTechnique() |
---|
| 6 | { |
---|
[262] | 7 | _height = 0.0; |
---|
[258] | 8 | } |
---|
| 9 | |
---|
| 10 | ellipsoidTechnique::~ellipsoidTechnique() |
---|
| 11 | { |
---|
| 12 | } |
---|
| 13 | |
---|
[262] | 14 | void ellipsoidTechnique::modifyHeightfield(osg::Vec4d& modificationROI, osg::HeightField* h, osg::Vec4d tileExtends) |
---|
[258] | 15 | { |
---|
[263] | 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; |
---|
[258] | 19 | |
---|
| 20 | // calculate colum start/end and row start/end of affected vertices |
---|
[262] | 21 | int startX=0, startY=0, endX=h->getNumColumns(), endY=h->getNumRows(); |
---|
[258] | 22 | |
---|
[262] | 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(); |
---|
[258] | 29 | |
---|
[262] | 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(); |
---|
[260] | 34 | |
---|
| 35 | |
---|
[262] | 36 | // Modify height value of affected vertices |
---|
[260] | 37 | for(int x=startX;x<endX;x++) |
---|
| 38 | { |
---|
| 39 | for(int y=startY;y<endY;y++) |
---|
| 40 | { |
---|
[262] | 41 | h->setHeight( x, y, _height); |
---|
[260] | 42 | } |
---|
| 43 | } |
---|
[258] | 44 | } |
---|
| 45 | |
---|