Changeset 13041 for OpenSceneGraph/trunk/include/osgSim/LineOfSight
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
-
OpenSceneGraph/trunk/include/osgSim/LineOfSight (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osgSim/LineOfSight
r12701 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 */ … … 25 25 public: 26 26 DatabaseCacheReadCallback(); 27 27 28 28 void setMaximumNumOfFilesToCache(unsigned int maxNumFilesToCache) { _maxNumFilesToCache = maxNumFilesToCache; } 29 29 unsigned int getMaximumNumOfFilesToCache() const { return _maxNumFilesToCache; } 30 30 31 31 void clearDatabaseCache(); 32 32 33 33 void pruneUnusedDatabaseCache(); 34 34 35 35 virtual osg::Node* readNodeFile(const std::string& filename); 36 36 37 37 protected: 38 38 39 39 typedef std::map<std::string, osg::ref_ptr<osg::Node> > FileNameSceneMap; 40 40 41 41 unsigned int _maxNumFilesToCache; 42 42 OpenThreads::Mutex _mutex; … … 45 45 46 46 /** Helper class for setting up and acquiring line of sight intersections with terrain. 47 * By default assigns a osgSim::DatabaseCacheReadCallback that enables automatic loading 47 * By default assigns a osgSim::DatabaseCacheReadCallback that enables automatic loading 48 48 * of external PagedLOD tiles to ensure that the highest level of detail is used in intersections. 49 49 * This automatic loading of tiles is done by the intersection traversal that is done within … … 55 55 { 56 56 public : 57 57 58 58 LineOfSight(); 59 59 60 60 /** Clear the internal LOS List so it contains no line of sight tests.*/ 61 61 void clear(); 62 62 63 63 /** Add a line of sight test, consisting of start and end point. Returns the index number of the newly adding LOS test.*/ 64 64 unsigned int addLOS(const osg::Vec3d& start, const osg::Vec3d& end); 65 65 66 66 /** Get the number of line of sight tests.*/ 67 67 unsigned int getNumLOS() const { return _LOSList.size(); } 68 68 69 69 /** Set the start point of single line of sight test.*/ 70 70 void setStartPoint(unsigned int i, const osg::Vec3d& start) { _LOSList[i]._start = start; } … … 78 78 /** Get the end point of single line of sight test.*/ 79 79 const osg::Vec3d& getEndPoint(unsigned int i) const { return _LOSList[i]._end; } 80 80 81 81 typedef std::vector<osg::Vec3d> Intersections; 82 82 … … 90 90 /** Compute the intersection between the specified scene graph and a single LOS start,end pair. Returns an IntersectionList, of all the points intersected.*/ 91 91 static Intersections computeIntersections(osg::Node* scene, const osg::Vec3d& start, const osg::Vec3d& end, osg::Node::NodeMask traversalMask=0xffffffff); 92 93 92 93 94 94 /** Clear the database cache.*/ 95 95 void clearDatabaseCache() { if (_dcrc.valid()) _dcrc->clearDatabaseCache(); } … … 102 102 /** Get the ReadCallback that does the reading of external PagedLOD models, and caching of loaded subgraphs.*/ 103 103 DatabaseCacheReadCallback* getDatabaseCacheReadCallback() { return _dcrc.get(); } 104 104 105 105 protected : 106 106 107 107 struct LOS 108 108 { … … 110 110 _start(start), 111 111 _end(end) {} 112 113 112 113 114 114 osg::Vec3d _start; 115 115 osg::Vec3d _end; 116 116 Intersections _intersections; 117 117 }; 118 118 119 119 typedef std::vector<LOS> LOSList; 120 120 LOSList _LOSList; 121 121 122 122 osg::ref_ptr<DatabaseCacheReadCallback> _dcrc; 123 123 osgUtil::IntersectionVisitor _intersectionVisitor;
