Ignore:
Timestamp:
Jul 19, 2011, 9:47:13 PM (13 years ago)
Author:
Torben Dannhauer
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • osgVisual/trunk/src/util/terrainQuery.cpp

    r302 r305  
    2121#include <osgUtil/LineSegmentIntersector>
    2222
     23using namespace osgVisual;
    2324using namespace osgSim;
    2425
    25 HeightAboveTerrain::HeightAboveTerrain(bool loadHighestLOD)
     26terrainQuery::terrainQuery()
    2627{
    2728    _lowestHeight = -1000.0;
    2829   
    29         if(loadHighestLOD)
    30                 setDatabaseCacheReadCallback(new DatabaseCacheReadCallback);
     30        setDatabaseCacheReadCallback(new DatabaseCacheReadCallback);
    3131}
    3232
    33 void HeightAboveTerrain::clear()
     33void terrainQuery::clear()
    3434{
    3535    _HATList.clear();
    3636}
    3737
    38 unsigned int HeightAboveTerrain::addPoint(const osg::Vec3d& point)
     38unsigned int terrainQuery::addPoint(const osg::Vec3d& point)
    3939{
    4040    unsigned int index = _HATList.size();
     
    4343}
    4444
    45 void HeightAboveTerrain::computeIntersections(osg::Node* scene, osg::Node::NodeMask traversalMask)
     45void terrainQuery::computeIntersections(osg::Node* scene, osg::Node::NodeMask traversalMask)
    4646{
    4747    osg::CoordinateSystemNode* csn = dynamic_cast<osg::CoordinateSystemNode*>(scene);
     
    128128}
    129129
    130 double HeightAboveTerrain::computeHeightAboveTerrain(osg::Node* scene, const osg::Vec3d& point, bool loadHighestLOD, osg::Node::NodeMask traversalMask)
     130double terrainQuery::computeHeightAboveTerrain(osg::Node* scene, const osg::Vec3d& point, DataSource pagingBehaviour, osg::Node::NodeMask traversalMask)
    131131{
    132     HeightAboveTerrain hat(loadHighestLOD);
    133     unsigned int index = hat.addPoint(point);
    134     hat.computeIntersections(scene, traversalMask);
    135     return hat.getHeightAboveTerrain(index);
     132    terrainQuery qt;
     133        /*if(!loadHighestLOD)
     134                qt.setDatabaseCacheReadCallback(0);*/
     135    unsigned int index = qt.addPoint(point);
     136    qt.computeIntersections(scene, traversalMask);
     137    return qt.getHeightAboveTerrain(index);
    136138}
    137139
    138 double HeightAboveTerrain::computeHeightOfTerrain(osg::Node* scene, const osg::Vec3d& point, bool loadHighestLOD, osg::Node::NodeMask traversalMask)
     140double terrainQuery::computeHeightOfTerrain(osg::Node* scene, const osg::Vec3d& point, DataSource pagingBehaviour, osg::Node::NodeMask traversalMask)
    139141{
    140         HeightAboveTerrain hat(loadHighestLOD);
    141     unsigned int index = hat.addPoint(point);
    142     hat.computeIntersections(scene, traversalMask);
    143     return hat.getHeightOfTerrain(index);
     142        terrainQuery qt;
     143    unsigned int index = qt.addPoint(point);
     144    qt.computeIntersections(scene, traversalMask);
     145    return qt.getHeightOfTerrain(index);
    144146}
    145147
    146 void HeightAboveTerrain::setDatabaseCacheReadCallback(DatabaseCacheReadCallback* dcrc)
     148void terrainQuery::setDatabaseCacheReadCallback(DatabaseCacheReadCallback* dcrc)
    147149{
    148150    _dcrc = dcrc;
Note: See TracChangeset for help on using the changeset viewer.