/usr/include/osgEarth/TerrainTileModel is in libosgearth-dev 2.9.0+dfsg-1.
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 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | /* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
* Copyright 2008-2014 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_TILE_MODEL_H
#define OSGEARTH_TERRAIN_TILE_MODEL_H 1
#include <osgEarth/Common>
#include <osgEarth/TileKey>
#include <osgEarth/ImageLayer>
#include <osgEarth/PatchLayer>
#include <osgEarth/Revisioning>
#include <osgEarth/MapInfo>
#include <osgEarth/Locators>
#include <osgEarth/HeightFieldUtils>
#include <osgEarth/TileKeyDataStore>
#include <osg/Texture>
#include <osg/Matrix>
namespace osgEarth
{
//! @deprecated
class TerrainData : public osg::Referenced
{
public:
enum Type
{
TYPE_IMAGE,
TYPE_ELEVATION,
TYPE_NORMAL,
TYPE_MATERIAL,
TYPE_VECTOR,
TYPE_UNKNOWN
};
void setType(Type type) { _type = type; }
const Type& getType() const { return _type; }
protected:
Type _type;
TerrainData() : _type(TYPE_UNKNOWN) { }
virtual ~TerrainData() { }
};
//! @deprecated
class OSGEARTH_EXPORT TerrainRaster : public TerrainData
{
public:
TerrainRaster() : TerrainData() { }
/** Raster image. */
void setImage(osg::Image* image) { _image = image; }
osg::Image* getImage() const { return _image.get(); }
void setLayer(Layer* layer) { _layer = layer; }
Layer* getLayer() const { return _layer.get(); }
protected:
virtual ~TerrainRaster() { }
osg::ref_ptr<osg::Image> _image;
osg::ref_ptr<Layer> _layer;
};
//...start old stuff
/**
* Data model backing an individual layer of a terrain tile.
*/
class OSGEARTH_EXPORT TerrainTileLayerModel : public osg::Referenced
{
public:
/** Name */
void setName(const std::string& name) { _name = name; }
const std::string& getName() const { return _name; }
/** Texture to use for rendering this layer */
void setTexture(osg::Texture* texture) { _texture = texture; }
osg::Texture* getTexture() const { return _texture.get(); }
/** Texture matrix to scale/bias the texture for the corresponding tile key */
void setMatrix(osg::RefMatrixf* matrix) { _matrix = matrix; }
osg::RefMatrixf* getMatrix() const { return _matrix.get(); }
public:
TerrainTileLayerModel();
protected:
virtual ~TerrainTileLayerModel() { }
std::string _name;
osg::ref_ptr<osg::Texture> _texture;
osg::ref_ptr<osg::RefMatrixf> _matrix;
};
typedef std::vector< osg::ref_ptr<TerrainTileLayerModel> > TerrainTileLayerModelVector;
/**
* Layer based on a color layer (ImageLayer or any other RENDERTYPE_TILE layer)
*/
class OSGEARTH_EXPORT TerrainTileColorLayerModel : public TerrainTileLayerModel
{
public:
TerrainTileColorLayerModel() : TerrainTileLayerModel() { }
void setLayer(Layer* layer) { _layer = layer; }
Layer* getLayer() const { return _layer.get(); }
protected:
virtual ~TerrainTileColorLayerModel() { }
osg::ref_ptr<Layer> _layer;
};
typedef std::vector< osg::ref_ptr<TerrainTileColorLayerModel> > TerrainTileColorLayerModelVector;
/**
* Layer based on an ImageLayer from the map.
*/
class OSGEARTH_EXPORT TerrainTileImageLayerModel : public TerrainTileColorLayerModel
{
public:
TerrainTileImageLayerModel() : TerrainTileColorLayerModel() { }
public:
/** Source layer */
void setImageLayer(ImageLayer* layer) { _imageLayer = layer; setLayer(layer); }
const ImageLayer* getImageLayer() const { return _imageLayer.get(); }
protected:
virtual ~TerrainTileImageLayerModel() { }
osg::ref_ptr<ImageLayer> _imageLayer;
osg::ref_ptr<osg::Node> _node;
};
typedef std::vector< osg::ref_ptr<TerrainTileImageLayerModel> > TerrainTileImageLayerModelVector;
/**
* Layer based on an Layer with RENDERTYPE_PATCH from the map.
*/
class OSGEARTH_EXPORT TerrainTilePatchLayerModel : public TerrainTileLayerModel
{
public:
TerrainTilePatchLayerModel() { }
public:
/** Source layer */
void setPatchLayer(PatchLayer* layer) { _layer = layer; }
const PatchLayer* getPatchLayer() const { return _layer.get(); }
/** Patch data */
void setTileData(PatchLayer::TileData* data) { _tileData = data; }
PatchLayer::TileData* getTileData() const { return _tileData.get(); }
protected:
virtual ~TerrainTilePatchLayerModel() { }
osg::ref_ptr<PatchLayer> _layer;
osg::ref_ptr<PatchLayer::TileData> _tileData;
};
typedef std::vector< osg::ref_ptr<TerrainTilePatchLayerModel> > TerrainTilePatchLayerModelVector;
/**
* Layer based on aggregated elevation data.
*/
class OSGEARTH_EXPORT TerrainTileElevationModel : public TerrainTileLayerModel
{
public:
/** Constructor */
TerrainTileElevationModel();
void setHeightField(const osg::HeightField* value) { _heightField = value; }
const osg::HeightField* getHeightField() const { return _heightField.get(); }
/** Minimum height in the tile */
void setMinHeight(float value) { _minHeight = value; }
float getMinHeight() const { return _minHeight; }
/** Maximum height in the tile */
void setMaxHeight(float value) { _maxHeight = value; }
float getMaxHeight() const { return _maxHeight; }
protected:
virtual ~TerrainTileElevationModel() { }
osg::ref_ptr<const osg::HeightField> _heightField;
float _minHeight, _maxHeight;
};
/**
* Data model backing an individual terrain tile.
*/
class OSGEARTH_EXPORT TerrainTileModel : public osg::Referenced
{
public:
/** Constructor */
TerrainTileModel(
const TileKey& key,
const Revision& revision);
/** Map model revision from which this model was created */
const Revision& getRevision() const { return _revision; }
/** TileKey corresponding to this model */
const TileKey& getKey() const { return _key; }
/** Color layers (rendered one at a time in order) */
TerrainTileColorLayerModelVector& colorLayers() { return _colorLayers; }
const TerrainTileColorLayerModelVector& colorLayers() const { return _colorLayers; }
TerrainTilePatchLayerModelVector& patchLayers() { return _patchLayers; }
const TerrainTilePatchLayerModelVector& patchLayers() const { return _patchLayers; }
/** Elevation Layer model (one) */
osg::ref_ptr<TerrainTileElevationModel>& elevationModel() { return _elevationLayer; }
const osg::ref_ptr<TerrainTileElevationModel>& elevationModel() const { return _elevationLayer; }
/** Normal model (one) */
osg::ref_ptr<TerrainTileLayerModel>& normalModel() { return _normalLayer; }
const osg::ref_ptr<TerrainTileLayerModel>& normalModel() const { return _normalLayer; }
/** Shared raster layers (bound for all rendering) */
TerrainTileImageLayerModelVector& sharedLayers() { return _sharedLayers; }
const TerrainTileImageLayerModelVector& sharedLayers() const { return _sharedLayers; }
/** Height field neighborhood surrounding the tile */
/** TODO: does this need to be in the model itself? probably not */
HeightFieldNeighborhood& heightFields() { return _heightFields; }
const HeightFieldNeighborhood& heightFields() const { return _heightFields; }
/** Whether a tile created from this model requires an update traversal. */
void setRequiresUpdateTraverse(bool value) { _requiresUpdateTraverse = value; }
bool requiresUpdateTraverse() const { return _requiresUpdateTraverse; }
public: // convenience getters.
osg::Texture* getNormalTexture() const;
osg::RefMatrixf* getNormalTextureMatrix() const;
osg::Texture* getElevationTexture() const;
osg::RefMatrixf* getElevationTextureMatrix() const;
protected:
TileKey _key;
Revision _revision;
TerrainTileColorLayerModelVector _colorLayers;
TerrainTilePatchLayerModelVector _patchLayers;
TerrainTileImageLayerModelVector _sharedLayers;
osg::ref_ptr<TerrainTileElevationModel> _elevationLayer;
osg::ref_ptr<TerrainTileLayerModel> _normalLayer;
HeightFieldNeighborhood _heightFields;
bool _requiresUpdateTraverse;
};
/**
* Data store that references TerrainTileModel by TileKey.
*/
typedef TileKeyDataStore<const TerrainTileModel> TerrainTileModelStore;
}
#endif // OSGEARTH_TERRAIN_TILE_MODEL_H
|