/usr/include/osgEarth/TerrainEngineNode is in libosgearth-dev 2.4.0+dfsg-6.
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 2008-2013 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_TERRAIN_ENGINE_NODE_H
#define OSGEARTH_TERRAIN_ENGINE_NODE_H 1
#include <osgEarth/Map>
#include <osgEarth/MapFrame>
#include <osgEarth/Terrain>
#include <osgEarth/TextureCompositor>
#include <osgEarth/ShaderUtils>
#include <osg/CoordinateSystemNode>
#include <osg/Geode>
#include <osg/NodeCallback>
namespace osgEarth
{
/**
* TerrainEngineNode is the base class and interface for map engine implementations.
*
* A map engine lives under a MapNode and is responsible for generating the
* actual geometry representing the Earth.
*/
class OSGEARTH_EXPORT TerrainEngineNode : public osg::CoordinateSystemNode
{
public:
/** Gets the map that this engine is rendering. */
const Map* getMap() const { return _map.get(); }
/** Gets the Terrain interface for interacting with the scene graph */
Terrain* getTerrain() { return _terrainInterface.get(); }
const Terrain* getTerrain() const { return _terrainInterface.get(); }
/** Gets the property set in use by this map engine. */
virtual const TerrainOptions& getTerrainOptions() const =0;
/** Accesses the compositor that controls the rendering of image layers */
TextureCompositor* getTextureCompositor() const;
public: // Runtime properties
/** Sets the scale factor to apply to elevation height values. Default is 1.0 */
void setVerticalScale( float value );
/** Gets the scale factor to apply to elevation height values. */
float getVerticalScale() const { return _verticalScale; }
/** Sets the sampling ratio for elevation grid data. Default is 1.0. */
void setElevationSamplingRatio( float value );
/** Gets the sampling ratio for elevation grid data. */
float getElevationSamplingRatio() const { return _elevationSamplingRatio; }
protected:
TerrainEngineNode();
//TerrainEngineNode( const TerrainEngineNode& rhs, const osg::CopyOp& op =osg::CopyOp::DEEP_COPY_ALL );
virtual ~TerrainEngineNode();
public: // osg::Node overrides
virtual osg::BoundingSphere computeBound() const;
virtual void traverse( osg::NodeVisitor& );
protected: // implementation events
virtual void onVerticalScaleChanged() { }
virtual void onElevationSamplingRatioChanged() { }
protected:
friend class MapNode;
friend class TerrainEngineNodeFactory;
virtual void validateTerrainOptions( TerrainOptions& options );
/** Attaches a map to the terrain engine and initialized it.*/
virtual void preInitialize( const Map* map, const TerrainOptions& options );
virtual void postInitialize( const Map* map, const TerrainOptions& options );
// signals that a redraw is needed because something changed.
virtual void dirty();
// allow subclasses direct access for convenience.
osg::ref_ptr<TextureCompositor> _texCompositor;
public: // utility
/**
* Utility function that will return an osg::Node representing the geometry
* for a tile key. The node is standalone; it has no ability to load children
* or receive updates.
*/
virtual osg::Node* createTile( const TileKey& key ) =0;
private:
friend struct TerrainEngineNodeCallbackProxy;
friend struct MapNodeMapLayerController;
void ctor();
void onMapInfoEstablished( const MapInfo& mapInfo ); // not virtual!
void onMapModelChanged( const MapModelChange& change );
void updateImageUniforms();
virtual void updateTextureCombining() { }
private:
struct ImageLayerController : public ImageLayerCallback
{
ImageLayerController( const Map* map, TerrainEngineNode* engine );
void onVisibleChanged( TerrainLayer* layer );
void onOpacityChanged( ImageLayer* layer );
void onColorFiltersChanged( ImageLayer* layer );
void onVisibleRangeChanged( ImageLayer* layer );
ArrayUniform _layerOpacityUniform;
ArrayUniform _layerVisibleUniform;
ArrayUniform _layerRangeUniform;
private:
MapFrame _mapf;
TerrainEngineNode* _engine;
friend class TerrainEngineNode;
};
osg::ref_ptr<ImageLayerController> _imageLayerController;
osg::ref_ptr<const Map> _map;
osg::ref_ptr<osg::Uniform> _startFrameTimeUniform;
osg::ref_ptr<osg::Uniform> _cameraElevationUniform;
bool _redrawRequired;
float _verticalScale;
float _elevationSamplingRatio;
osg::ref_ptr<Terrain> _terrainInterface;
unsigned _dirtyCount;
UpdateLightingUniformsHelper _updateLightingUniformsHelper;
enum InitStage {
INIT_NONE,
INIT_PREINIT_COMPLETE,
INIT_POSTINIT_COMPLETE
};
InitStage _initStage;
};
/**
* Factory class for creating terrain engine instances.
*/
class TerrainEngineNodeFactory
{
public:
static TerrainEngineNode* create( Map* map, const TerrainOptions& options );
};
/**
* Base class for a node that "decorates" the terrain engine node within a map node.
*/
class TerrainDecorator : public osg::Group
{
public:
virtual void onInstall( TerrainEngineNode* engine ) { }
virtual void onUninstall( TerrainEngineNode* engine ) { }
protected:
virtual ~TerrainDecorator() { }
};
} // namespace osgEarth
#endif // OSGEARTH_TERRAIN_ENGINE_NODE_H
|