Changeset 258


Ignore:
Timestamp:
Feb 23, 2011, 8:28:20 AM (13 years ago)
Author:
Torben Dannhauer
Message:
 
Location:
experimental/TerrainTest
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • experimental/TerrainTest/ModificationVisitor.cpp

    r257 r258  
    66{
    77        setTraversalMode( osg::NodeVisitor::TRAVERSE_ALL_CHILDREN );
     8        technique = new ellipsoidTechnique();
    89}
    910
     
    4344void ModificationVisitor::modifyTile(osgTerrain::TerrainTile* tile)
    4445{
    45         //OSG_NOTIFY( osg::ALWAYS ) << "ModificationVisitor::modifyTile()" << std::endl;
     46        //OSG_NOTIFY( osg::ALWAYS ) << "ModificationVisitor::modifyTile() : Checking if tile is affected.." << std::endl;
    4647        HeightFieldLayer* hfl = dynamic_cast<HeightFieldLayer*>(tile->getElevationLayer());
    4748        osg::HeightField* h = hfl->getHeightField();
     
    5455
    5556        // Determine extend of the tile.
    56         int rows = h->getNumRows();
    57         int cols = h->getNumColumns();
    5857        double lat_min = h->getOrigin()[1];
    59         double lat_max = lat_min + rows * h->getYInterval();
     58        double lat_max = lat_min + h->getNumRows() * h->getYInterval();
    6059        double lon_min = h->getOrigin()[0];
    61         double lon_max = lon_min + cols * h->getXInterval();
     60        double lon_max = lon_min + h->getNumColumns() * h->getXInterval();
    6261
    6362        // Check if tile is fully or partially inside ROI:
     
    6564                && lon_max>dest_lon_min && lon_min<dest_lon_max )       // lon inside ROI
    6665        {
    67                 OSG_NOTIFY( osg::ALWAYS ) << "ModificationVisitor::modifyTile() :: affected Tile" << std::endl;
    68                 OSG_NOTIFY( osg::ALWAYS ) << "LAT: " << lat_min << " | " << lat_max << std::endl;
    69                 OSG_NOTIFY( osg::ALWAYS ) << "LON: " << lon_min << " | " << lon_max << std::endl;
    70 
    71 
    72                 // calculate colum start/end and row start/end of affected vertices
    73                 int startX=0,startY=0,endX=cols,endY=rows;
    74 
    75 
    76                 // modify height value of affected vertices
    77                 h->setHeight( 0,0, 600);
    78 
     66                technique->modifyHeightfield(h, lat_min, lat_max, lon_min, lon_max);
    7967        }
    80 
    81 
    82 
    83 
    84 
    85 
    86 
    87         //OSG_NOTIFY( osg::ALWAYS ) << "Origin: " << h->getOrigin()[0] << " | " << h->getOrigin()[1] << std::endl;
    88         //OSG_NOTIFY( osg::ALWAYS ) << "X-Intervall: " << h->getXInterval() << std::endl;
    89         //OSG_NOTIFY( osg::ALWAYS ) << "Y-Intervall: " << h->getYInterval() << std::endl;
    90         //if(dest_lat_min<=lat_min && lat_max<=dest_lat_max && dest_lon_min<=lon_min && lon_max<=dest_lon_max)
    91         //{
    92         //      OSG_NOTIFY( osg::ALWAYS ) << "ModificationVisitor::modifyTile() :: affected Tile" << std::endl;
    93         //      OSG_NOTIFY( osg::ALWAYS ) << "LAT: " << lat_min << " | " << lat_max << std::endl;
    94         //      OSG_NOTIFY( osg::ALWAYS ) << "LON: " << lon_min << " | " << lon_max << std::endl;
    95 
    96         //      h->setHeight( 0,0, 1000);
    97         //}
    98         //OpenThreads::Thread::microSleep( 50000 );
    9968}
  • experimental/TerrainTest/ModificationVisitor.h

    r256 r258  
    66#include <osgTerrain/TerrainTile>
    77#include <osgTerrain/Layer>
     8
     9#include "ellipsoidTechnique.h"
    810
    911
     
    1820        void modifyTile(osgTerrain::TerrainTile* tile);
    1921        std::string _extensionToSet;
     22
     23        ellipsoidTechnique* technique;
    2024};
  • experimental/TerrainTest/Plugins terrainmod/Plugins terrainmod.vcproj

    r256 r258  
    180180                        >
    181181                        <File
     182                                RelativePath="..\ellipsoidTechnique.cpp"
     183                                >
     184                        </File>
     185                        <File
    182186                                RelativePath="..\ModificationVisitor.cpp"
    183187                                >
     
    194198                        >
    195199                        <File
     200                                RelativePath="..\ellipsoidTechnique.h"
     201                                >
     202                        </File>
     203                        <File
    196204                                RelativePath="..\ModificationVisitor.h"
    197205                                >
Note: See TracChangeset for help on using the changeset viewer.