Changeset 269 for experimental/TerrainTest/rampedEllipsoidTechnique.cpp
- Timestamp:
- Mar 7, 2011, 9:52:06 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
experimental/TerrainTest/rampedEllipsoidTechnique.cpp
r266 r269 13 13 } 14 14 15 void rampedEllipsoidTechnique::modifyHeightfield( osg::Vec4d& modificationROI, osg::HeightField* h, osg::Vec4dtileExtends)15 void rampedEllipsoidTechnique::modifyHeightfield(region& modificationROI, osg::HeightField* h, region tileExtends) 16 16 { 17 17 //OSG_NOTIFY( osg::ALWAYS ) << "rampedEllipsoidTechnique::modifyHeightfield()" << std::endl; 18 //OSG_NOTIFY( osg::ALWAYS ) << "LAT: " << tileExtends [0] << " | " << tileExtends[1]<< std::endl;19 //OSG_NOTIFY( osg::ALWAYS ) << "LON: " << tileExtends [2] << " | " << tileExtends[3]<< std::endl;18 //OSG_NOTIFY( osg::ALWAYS ) << "LAT: " << tileExtends._lat_min << " | " << tileExtends._lat_max << std::endl; 19 //OSG_NOTIFY( osg::ALWAYS ) << "LON: " << tileExtends._lon_min << " | " << tileExtends._lon_max << std::endl; 20 20 21 21 // Determine modificationROI without ramp 22 double deltaLatPerSide = (modificationROI[1] - modificationROI[0]) * _rampWidthFactor / 2.0;23 double deltaLonPerSide = (modificationROI[3] - modificationROI[2]) * _rampWidthFactor / 2.0;24 osg::Vec4dcoreROI = modificationROI;25 coreROI [0]+=deltaLatPerSide;26 coreROI [1]-=deltaLatPerSide;27 coreROI [2]+=deltaLonPerSide;28 coreROI [3]-=deltaLonPerSide;22 double deltaLatPerSide = modificationROI.delta_lat() * _rampWidthFactor / 2.0; 23 double deltaLonPerSide = modificationROI.delta_lon() * _rampWidthFactor / 2.0; 24 region coreROI = modificationROI; 25 coreROI._lat_min+=deltaLatPerSide; 26 coreROI._lat_max-=deltaLatPerSide; 27 coreROI._lon_min+=deltaLonPerSide; 28 coreROI._lon_max-=deltaLonPerSide; 29 29 30 30 // Calculate colum start/end and row start/end of affected vertices … … 33 33 34 34 // Lat 35 Y_startRamp = round((modificationROI [0]-tileExtends[0]) / h->getYInterval());36 Y_startCore = round((coreROI [0]-tileExtends[0]) / h->getYInterval());37 Y_endCore = round((coreROI [1]-tileExtends[0]) / h->getYInterval());38 Y_endRamp = round((modificationROI [1]-tileExtends[0]) / h->getYInterval());35 Y_startRamp = round((modificationROI._lat_min-tileExtends._lat_min) / h->getYInterval()); 36 Y_startCore = round((coreROI._lat_min-tileExtends._lat_min) / h->getYInterval()); 37 Y_endCore = round((coreROI._lat_max-tileExtends._lat_min) / h->getYInterval()); 38 Y_endRamp = round((modificationROI._lat_max-tileExtends._lat_min) / h->getYInterval()); 39 39 40 40 clampValue(Y_startRamp, Y_start, Y_end); … … 44 44 45 45 // Lon 46 X_startRamp = round((modificationROI [2]-tileExtends[2]) / h->getXInterval());47 X_startCore = round((coreROI [2]-tileExtends[2]) / h->getXInterval());48 X_endCore = round((coreROI [3]-tileExtends[2]) / h->getXInterval());49 X_endRamp = round((modificationROI [3]-tileExtends[2]) / h->getXInterval());46 X_startRamp = round((modificationROI._lon_min-tileExtends._lon_min) / h->getXInterval()); 47 X_startCore = round((coreROI._lon_min-tileExtends._lon_min) / h->getXInterval()); 48 X_endCore = round((coreROI._lon_max-tileExtends._lon_min) / h->getXInterval()); 49 X_endRamp = round((modificationROI._lon_max-tileExtends._lon_min) / h->getXInterval()); 50 50 51 51 clampValue(X_startRamp, X_start, X_end); … … 61 61 { 62 62 // Calculate vertex position in global coordinate system (lat/lon) 63 double vertex_lat = y*h->getYInterval()+tileExtends [0];64 double vertex_lon = x*h->getXInterval()+tileExtends [2];63 double vertex_lat = y*h->getYInterval()+tileExtends._lat_min; 64 double vertex_lon = x*h->getXInterval()+tileExtends._lon_min; 65 65 // Calculate vertex delta h: h_dest - h_org 66 66 double height_org = h->getHeight(x,y); … … 77 77 if(Y_startRamp<=y && y<Y_startCore) // Vertex is inside Y start ramp 78 78 { 79 double delta_s = abs(modificationROI [0]-vertex_lat);79 double delta_s = abs(modificationROI._lat_min-vertex_lat); 80 80 double gradient = delta_h/deltaLatPerSide; 81 81 double dest = delta_s*gradient + height_org; … … 85 85 if(X_startRamp<=x && x<X_startCore) // Vertex is inside X start ramp 86 86 { 87 double delta_s = abs(modificationROI [2]-vertex_lon);87 double delta_s = abs(modificationROI._lon_min-vertex_lon); 88 88 double gradient = delta_h/deltaLonPerSide; 89 89 double dest = delta_s*gradient + height_org; … … 93 93 if(Y_endCore<=y && y<Y_endRamp) // Vertex is inside Y end ramp 94 94 { 95 double delta_s = abs(modificationROI [1]-vertex_lat);95 double delta_s = abs(modificationROI._lat_max-vertex_lat); 96 96 double gradient = delta_h/deltaLatPerSide; 97 97 double dest = delta_s*gradient + height_org; … … 101 101 if (X_endCore<=x && x<X_endRamp) // Vertex is inside X end ramp 102 102 { 103 double delta_s = abs(modificationROI [3]-vertex_lon);103 double delta_s = abs(modificationROI._lon_max-vertex_lon); 104 104 double gradient = delta_h/deltaLonPerSide; 105 105 double dest = delta_s*gradient + height_org;
Note: See TracChangeset
for help on using the changeset viewer.