/usr/include/osgEarthDrivers/engine_mp/MPTerrainEngineNode is in libosgearth-dev 2.7.0+dfsg-2+b3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | /* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
* Copyright 2015 Pelican Mapping
* http://osgearth.org
*
* osgEarth is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>
*/
#ifndef OSGEARTH_DRIVERS_MP_TERRAIN_ENGINE_ENGINE_NODE_H
#define OSGEARTH_DRIVERS_MP_TERRAIN_ENGINE_ENGINE_NODE_H 1
#include <osgEarth/TerrainEngineNode>
#include <osgEarth/TextureCompositor>
#include <osgEarth/Map>
#include <osgEarth/Revisioning>
#include <osgEarth/ThreadingUtils>
#include <osgEarth/Containers>
#include "MPTerrainEngineOptions"
#include "KeyNodeFactory"
#include "TileModelFactory"
#include "TileModelCompiler"
#include "TileNodeRegistry"
#include <osg/Geode>
#include <osg/NodeCallback>
#include <osg/Uniform>
#include <osgUtil/RenderBin>
using namespace osgEarth;
namespace osgEarth { namespace Drivers { namespace MPTerrainEngine
{
class MPTerrainEngineNode : public TerrainEngineNode
{
public:
MPTerrainEngineNode();
META_Node(osgEarth,MPTerrainEngineNode);
virtual ~MPTerrainEngineNode();
public:
/** Creates a tile node that is set up to page in subtiles. */
osg::Node* createNode(const TileKey& key, ProgressCallback* progress =0L);
/** Creates a tile node with no support for paging in subtiles. */
osg::Node* createStandaloneNode(const TileKey& key, ProgressCallback* progress =0L);
public: // TerrainEngineNode
// for standalone tile creation outside of a terrain
osg::Node* createTile(const TileKey& key);
// when incremental update is enabled, forces regeneration of tiles
// in the given region.
void invalidateRegion(
const GeoExtent& extent,
unsigned minLevel,
unsigned maxLevel);
/** Access the stateset used to render the terrain. */
osg::StateSet* getTerrainStateSet();
/** Access the stateset used to render payload data. */
osg::StateSet* getPayloadStateSet();
public: // internal TerrainEngineNode
virtual void preInitialize( const Map* map, const TerrainOptions& options );
virtual void postInitialize( const Map* map, const TerrainOptions& options );
virtual const TerrainOptions& getTerrainOptions() const { return _terrainOptions; }
virtual osg::BoundingSphere computeBound() const;
public: // osg::Node
void traverse(osg::NodeVisitor& nv);
public: // MapCallback adapter functions
void onMapInfoEstablished( const MapInfo& mapInfo ); // not virtual!
void onMapModelChanged( const MapModelChange& change ); // not virtual!
UID getUID() const;
public: // statics
static void registerEngine( MPTerrainEngineNode* engineNode );
static void unregisterEngine( UID uid );
static void getEngineByUID( UID uid, osg::ref_ptr<MPTerrainEngineNode>& output );
public:
class ElevationChangedCallback : public ElevationLayerCallback
{
public:
ElevationChangedCallback( MPTerrainEngineNode* terrain );
virtual void onVisibleChanged( TerrainLayer* layer );
MPTerrainEngineNode* _terrain;
friend class MPTerrainEngineNode;
};
protected:
// override from TerrainEngineNode
virtual void updateTextureCombining() { updateState(); }
virtual void notifyExistingNodes(TerrainTileNodeCallback* cb);
private:
void init();
void syncMapModel();
// Reloads all the tiles in the terrain due to a data model change
void refresh(bool force =false);
virtual void dirtyTerrain();
void addImageLayer( ImageLayer* layer );
void addElevationLayer( ElevationLayer* layer );
void removeImageLayer( ImageLayer* layerRemoved );
void removeElevationLayer( ElevationLayer* layerRemoved );
void toggleElevationLayer( ElevationLayer* layer );
void moveImageLayer( unsigned int oldIndex, unsigned int newIndex );
void moveElevationLayer( unsigned int oldIndex, unsigned int newIndex );
void updateState();
private:
MPTerrainEngineOptions _terrainOptions;
class TerrainNode* _terrain;
UID _uid;
Revision _mapModelRev; // tracks revision changes int the map model
Revision _terrainRev; // the revisinon of the rendered terrain (slightly different)
Revision _shaderLibRev;
bool _batchUpdateInProgress;
bool _refreshRequired;
bool _stateUpdateRequired;
bool _rootTilesRegistered;
Threading::Mutex _rootTilesRegisteredMutex;
osg::ref_ptr< ElevationChangedCallback > _elevationCallback;
MapFrame* _update_mapf; // map frame for the main/update traversal thread
// node registry is shared across all threads.
osg::ref_ptr<TileNodeRegistry> _liveTiles; // tiles in the scene graph.
osg::ref_ptr<TileNodeRegistry> _deadTiles; // tiles that used to be in the scene graph.
PerThread< osg::ref_ptr<KeyNodeFactory> > _perThreadKeyNodeFactories;
KeyNodeFactory* getKeyNodeFactory();
osg::Timer _timer;
unsigned _tileCount;
double _tileCreationTime;
int _primaryUnit;
int _secondaryUnit;
int _elevationTextureUnit;
osg::Uniform* _verticalScaleUniform;
osg::ref_ptr< TileModelFactory > _tileModelFactory;
Threading::Mutex _renderBinMutex;
osg::ref_ptr<osgUtil::RenderBin> _terrainRenderBinPrototype;
osg::ref_ptr<osgUtil::RenderBin> _payloadRenderBinPrototype;
MPTerrainEngineNode( const MPTerrainEngineNode& rhs, const osg::CopyOp& op =osg::CopyOp::DEEP_COPY_ALL ) { }
};
} } } // namespace osgEarth::Drivers::MPTerrainEngine
#endif // OSGEARTH_DRIVERS_MP_TERRAIN_ENGINE_ENGINE_NODE_H
|