/usr/include/osgTerrain/Terrain is in libopenscenegraph-3.4-dev 3.4.1+dfsg1-3.
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 | /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library 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
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGTerrain
#define OSGTerrain 1
#include <osg/CoordinateSystemNode>
#include <OpenThreads/ReentrantMutex>
#include <osgTerrain/TerrainTile>
#include <osgTerrain/GeometryPool>
namespace osgTerrain {
/** Terrain provides a framework for loosely coupling height field data with height rendering algorithms.
* This allows TerrainTechniques to be plugged in at runtime.*/
class OSGTERRAIN_EXPORT Terrain : public osg::CoordinateSystemNode
{
public:
Terrain();
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
Terrain(const Terrain&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Node(osgTerrain, Terrain);
virtual void traverse(osg::NodeVisitor& nv);
virtual osgTerrain::Terrain* asTerrain() { return this; }
virtual const osgTerrain::Terrain* asTerrain() const { return this; }
/** Set the sample ratio hint that TerrainTile should use when building geometry.
* Defaults to 1.0, which means use all original sample points.*/
void setSampleRatio(float ratio);
/** Get the sample ratio hint.*/
float getSampleRatio() const { return _sampleRatio; }
/** Set the vertical scale hint.*/
void setVerticalScale(float scale);
/** Get the vertical scale hint.*/
float getVerticalScale() const { return _verticalScale; }
/** Set the default policy to use when deciding whether to enable/disable blending and use of transparent bin.
* Note, the Terrain::BlendingPolicy value only sets the value for the TerrainTiles it encloses for the
* TerrainTile's that have their policy set to INHERIT. INHERIT is the default BlendingPolicy for both
* Terrain and TerrainTile, and if both are left to INERHIT then the policy used is ENABLE_BLENDING_WHEN_ALPHA_PRESENT. */
void setBlendingPolicy(TerrainTile::BlendingPolicy policy);
/** Get the default policy to use when deciding whether to enable/disable blending and use of transparent bin.*/
TerrainTile::BlendingPolicy getBlendingPolicy() const { return _blendingPolicy; }
/** If set to true the boundaries between adjacent tiles should be equalized.
* Note, it is only possible to equalizae boundaries when the TerrainTile's contain properly assigned TileID's,
* databases built with VirtualPlanetBuilder-0.9.11 and older do not set the TileID, so databases must be
* built with later versions of VirtualPlanetBuilder to take advantage of boundary equalization. */
void setEqualizeBoundaries(bool equalizeBoundaries);
/** If true the boundaries between adjacent tiles will be equalized. */
bool getEqualizeBoundaries() const { return _equalizeBoundaries; }
/** Set a custom GeometryPool to be used by TerrainTechniques that share geometry.*/
void setGeometryPool(GeometryPool* gp) { _geometryPool = gp; }
/** Get the GeometryPool.*/
GeometryPool* getGeometryPool() { return _geometryPool.get(); }
/** Get the const GeometryPool.*/
const GeometryPool* getGeometryPool() const { return _geometryPool.get(); }
/** Get the TerrainTile for a given TileID.*/
TerrainTile* getTile(const TileID& tileID);
/** Get the const TerrainTile for a given TileID.*/
const TerrainTile* getTile(const TileID& tileID) const;
/** Set the TerrainTechnique prototype from which TerrainTiles can clone the techniques from.*/
void setTerrainTechniquePrototype(TerrainTechnique* technique) { _terrainTechnique = technique; }
/** Get the TerrainTechnique prototype */
TerrainTechnique* getTerrainTechniquePrototype() { return _terrainTechnique.get(); }
/** Get the const TerrainTechnique protype*/
const TerrainTechnique* getTerrainTechniquePrototype() const { return _terrainTechnique.get(); }
/** Tell the Terrain node to call the terrainTile's TerrainTechnique on the next update traversal.*/
void updateTerrainTileOnNextFrame(TerrainTile* terrainTile);
protected:
virtual ~Terrain();
friend class TerrainTile;
void dirtyRegisteredTiles(int dirtyMask = TerrainTile::ALL_DIRTY);
void registerTerrainTile(TerrainTile* tile);
void unregisterTerrainTile(TerrainTile* tile);
typedef std::map< TileID, TerrainTile* > TerrainTileMap;
typedef std::set< TerrainTile* > TerrainTileSet;
float _sampleRatio;
float _verticalScale;
TerrainTile::BlendingPolicy _blendingPolicy;
bool _equalizeBoundaries;
osg::ref_ptr<GeometryPool> _geometryPool;
mutable OpenThreads::ReentrantMutex _mutex;
TerrainTileSet _terrainTileSet;
TerrainTileMap _terrainTileMap;
TerrainTileSet _updateTerrainTileSet;
osg::ref_ptr<TerrainTechnique> _terrainTechnique;
};
}
#endif
|