osgEarth 2.1.1
|
00001 /* -*-c++-*- */ 00002 /* osgEarth - Dynamic map generation toolkit for OpenSceneGraph 00003 * Copyright 2008-2010 Pelican Mapping 00004 * http://osgearth.org 00005 * 00006 * osgEarth is free software; you can redistribute it and/or modify 00007 * it under the terms of the GNU Lesser General Public License as published by 00008 * the Free Software Foundation; either version 2 of the License, or 00009 * (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU Lesser General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU Lesser General Public License 00017 * along with this program. If not, see <http://www.gnu.org/licenses/> 00018 */ 00019 #ifndef OSGEARTH_ENGINE_DROAM_MAPNODE_H 00020 #define OSGEARTH_ENGINE_DROAM_MAPNODE_H 1 00021 00022 #include "MeshManager" 00023 #include <osg/CoordinateSystemNode> 00024 #include <osg/Geode> 00025 #include <osg/NodeVisitor> 00026 #include <osgEarth/Map> 00027 00060 class DRoamNode : public osg::CoordinateSystemNode 00061 { 00062 public: 00063 DRoamNode( Map* map =0L ); 00064 DRoamNode( const DRoamNode& rhs, const osg::CopyOp& op =osg::CopyOp::DEEP_COPY_ALL ); 00065 META_Node(osgEarth,DRoamNode); 00066 00067 private: 00068 osg::ref_ptr<osg::Geode> _geode; 00069 osg::ref_ptr<Manifold> _manifold; 00070 osg::ref_ptr<MeshManager> _mesh; 00071 osg::ref_ptr<osgEarth::Map> _map; 00072 00073 private: 00074 void update( osg::NodeVisitor* nv ); 00075 void cull( osg::NodeVisitor* nv ); 00076 00077 struct MyCullCallback : public osg::NodeCallback { 00078 void operator()( osg::Node* node, osg::NodeVisitor* nv ) { 00079 static_cast<DRoamNode*>(node)->cull( nv ); 00080 traverse( node, nv ); 00081 } 00082 }; 00083 friend struct MyCullCallback; 00084 00085 struct MyUpdateCallback : public osg::NodeCallback { 00086 void operator()( osg::Node* node, osg::NodeVisitor* nv ) { 00087 static_cast<DRoamNode*>(node)->update( nv ); 00088 traverse( node, nv ); 00089 } 00090 }; 00091 friend struct MyUpdateCallback; 00092 }; 00093 00094 #endif // OSGEARTH_ENGINE_DROAM_MAPNODE_H