OpenSceneGraph 3.6.5
Terrain
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSGTerrain
15#define OSGTerrain 1
16
18#include <OpenThreads/ReentrantMutex>
19
22
23namespace osgTerrain {
24
28{
29 public:
30
32
35
37
38 virtual void traverse(osg::NodeVisitor& nv);
39
40 virtual osgTerrain::Terrain* asTerrain() { return this; }
41 virtual const osgTerrain::Terrain* asTerrain() const { return this; }
42
43
46 void setSampleRatio(float ratio);
47
49 float getSampleRatio() const { return _sampleRatio; }
50
51
53 void setVerticalScale(float scale);
54
56 float getVerticalScale() const { return _verticalScale; }
57
58
64
67
72 void setEqualizeBoundaries(bool equalizeBoundaries);
73
76
77
80
83
85 const GeometryPool* getGeometryPool() const { return _geometryPool.get(); }
86
87
88
90 TerrainTile* getTile(const TileID& tileID);
91
93 const TerrainTile* getTile(const TileID& tileID) const;
94
97
100
103
106
107 protected:
108
109 virtual ~Terrain();
110
111 friend class TerrainTile;
112
114
117
118 typedef std::map< TileID, TerrainTile* > TerrainTileMap;
119 typedef std::set< TerrainTile* > TerrainTileSet;
120
126
127 mutable OpenThreads::ReentrantMutex _mutex;
131
133};
134
135}
136
137#endif
The osgTerrain library is a NodeKit that provides geospecifc terrain rendering support.
Definition Node:29
CoordinateSystem encapsulate the coordinate system that is associated with objects in a scene.
Definition CoordinateSystemNode:96
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Visitor for type safe operations on osg::Nodes.
Definition NodeVisitor:82
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
Definition GeometryPool:104
Terrain provides a framework for loosely coupling height field data with height rendering algorithms.
Definition Terrain:28
TerrainTechnique * getTerrainTechniquePrototype()
Get the TerrainTechnique prototype.
Definition Terrain:99
float _sampleRatio
Definition Terrain:121
float getSampleRatio() const
Get the sample ratio hint.
Definition Terrain:49
void setSampleRatio(float ratio)
Set the sample ratio hint that TerrainTile should use when building geometry.
OpenThreads::ReentrantMutex _mutex
Definition Terrain:127
bool _equalizeBoundaries
Definition Terrain:124
void registerTerrainTile(TerrainTile *tile)
osg::ref_ptr< TerrainTechnique > _terrainTechnique
Definition Terrain:132
bool getEqualizeBoundaries() const
If true the boundaries between adjacent tiles will be equalized.
Definition Terrain:75
float _verticalScale
Definition Terrain:122
TerrainTile::BlendingPolicy _blendingPolicy
Definition Terrain:123
TerrainTile * getTile(const TileID &tileID)
Get the TerrainTile for a given TileID.
friend class TerrainTile
Definition Terrain:111
GeometryPool * getGeometryPool()
Get the GeometryPool.
Definition Terrain:82
void setGeometryPool(GeometryPool *gp)
Set a custom GeometryPool to be used by TerrainTechniques that share geometry.
Definition Terrain:79
void setBlendingPolicy(TerrainTile::BlendingPolicy policy)
Set the default policy to use when deciding whether to enable/disable blending and use of transparent...
TerrainTileSet _updateTerrainTileSet
Definition Terrain:130
void dirtyRegisteredTiles(int dirtyMask=TerrainTile::ALL_DIRTY)
virtual void traverse(osg::NodeVisitor &nv)
Traverse downwards : calls children's accept method with NodeVisitor.
const TerrainTechnique * getTerrainTechniquePrototype() const
Get the const TerrainTechnique protype.
Definition Terrain:102
void updateTerrainTileOnNextFrame(TerrainTile *terrainTile)
Tell the Terrain node to call the terrainTile's TerrainTechnique on the next update traversal.
std::set< TerrainTile * > TerrainTileSet
Definition Terrain:119
META_Node(osgTerrain, Terrain)
void unregisterTerrainTile(TerrainTile *tile)
const GeometryPool * getGeometryPool() const
Get the const GeometryPool.
Definition Terrain:85
void setVerticalScale(float scale)
Set the vertical scale hint.
TerrainTileSet _terrainTileSet
Definition Terrain:128
std::map< TileID, TerrainTile * > TerrainTileMap
Definition Terrain:118
void setTerrainTechniquePrototype(TerrainTechnique *technique)
Set the TerrainTechnique prototype from which TerrainTiles can clone the techniques from.
Definition Terrain:96
float getVerticalScale() const
Get the vertical scale hint.
Definition Terrain:56
Terrain(const Terrain &, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
Copy constructor using CopyOp to manage deep vs shallow copy.
virtual const osgTerrain::Terrain * asTerrain() const
convert 'const this' into a const Terrain pointer if Node is a Terrain, otherwise return 0.
Definition Terrain:41
virtual osgTerrain::Terrain * asTerrain()
Convert 'this' into a Transform pointer if Node is a Terrain, otherwise return 0.
Definition Terrain:40
TerrainTile::BlendingPolicy getBlendingPolicy() const
Get the default policy to use when deciding whether to enable/disable blending and use of transparent...
Definition Terrain:66
void setEqualizeBoundaries(bool equalizeBoundaries)
If set to true the boundaries between adjacent tiles should be equalized.
const TerrainTile * getTile(const TileID &tileID) const
Get the const TerrainTile for a given TileID.
osg::ref_ptr< GeometryPool > _geometryPool
Definition Terrain:125
TerrainTileMap _terrainTileMap
Definition Terrain:129
Definition TerrainTechnique:53
Definition TerrainTile:31
@ ALL_DIRTY
Definition TerrainTile:197
BlendingPolicy
Definition TerrainTile:168
#define OSGTERRAIN_EXPORT
Definition Export:39

osg logo
Generated at Sun Jul 27 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.