Changeset 13041 for OpenSceneGraph/trunk/src/osgSim/HeightAboveTerrain.cpp
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgSim/HeightAboveTerrain.cpp
r11487 r13041 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 2 2 * 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 3 * This library is open source and may be redistributed and/or modified under 4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or 5 5 * (at your option) any later version. The full license is in LICENSE file 6 6 * included with this distribution, and on the openscenegraph.org website. 7 * 7 * 8 8 * This library is distributed in the hope that it will be useful, 9 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 11 * OpenSceneGraph Public License for more details. 12 12 */ … … 23 23 { 24 24 _lowestHeight = -1000.0; 25 25 26 26 setDatabaseCacheReadCallback(new DatabaseCacheReadCallback); 27 27 } … … 52 52 if (em) 53 53 { 54 54 55 55 osg::Vec3d start = itr->_point; 56 56 osg::Vec3d upVector = em->computeLocalUpVector(start.x(), start.y(), start.z()); … … 58 58 double latitude, longitude, height; 59 59 em->convertXYZToLatLongHeight(start.x(), start.y(), start.z(), latitude, longitude, height); 60 osg::Vec3d end = start - upVector * (height - _lowestHeight); 61 60 osg::Vec3d end = start - upVector * (height - _lowestHeight); 61 62 62 itr->_hat = height; 63 63 … … 71 71 osg::Vec3d start = itr->_point; 72 72 osg::Vec3d upVector (0.0, 0.0, 1.0); 73 73 74 74 double height = start.z(); 75 osg::Vec3d end = start - upVector * (height - _lowestHeight); 75 osg::Vec3d end = start - upVector * (height - _lowestHeight); 76 76 77 77 itr->_hat = height; … … 81 81 } 82 82 } 83 83 84 84 _intersectionVisitor.reset(); 85 85 _intersectionVisitor.setTraversalMask(traversalMask); 86 86 _intersectionVisitor.setIntersector( intersectorGroup.get() ); 87 87 88 88 scene->accept(_intersectionVisitor); 89 89 90 90 unsigned int index = 0; 91 91 osgUtil::IntersectorGroup::Intersectors& intersectors = intersectorGroup->getIntersectors(); … … 107 107 } 108 108 } 109 109 110 110 } 111 111
