14#ifndef OSGTERRAIN_GEOMETRYPOOL
15#define OSGTERRAIN_GEOMETRYPOOL 1
21#include <OpenThreads/Mutex>
114 if (
sx<rhs.
sx)
return true;
115 if (
sx>rhs.
sx)
return false;
117 if (
sx<rhs.
sx)
return true;
118 if (
sx>rhs.
sx)
return false;
120 if (
y<rhs.
y)
return true;
121 if (
y>rhs.
y)
return false;
123 if (
nx<rhs.
nx)
return true;
124 if (
nx>rhs.
nx)
return false;
137 typedef std::map< GeometryKey, osg::ref_ptr<SharedGeometry> >
GeometryMap;
149 typedef std::map<LayerTypes, osg::ref_ptr<osg::Program> >
ProgramMap;
TemplateArray< Vec3, Array::Vec3ArrayType, 3, GL_FLOAT > Vec3Array
Definition Array:449
The osgTerrain library is a NodeKit that provides geospecifc terrain rendering support.
Definition Node:29
OSGTERRAIN_EXPORT const osgTerrain::Locator * computeMasterLocator(const osgTerrain::TerrainTile *tile)
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
Pure virtual base class for drawable geometry.
Definition Drawable:89
A PrimitiveFunctor is used (in conjunction with osg::Drawable::accept (PrimitiveFunctor&)) to get acc...
Definition PrimitiveSet:54
Definition PrimitiveSet:103
Definition PrimitiveSet:337
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
Base class for providing reference counted objects.
Definition Referenced:44
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
Stores a set of modes and attributes which represent a set of OpenGL state.
Definition StateSet:46
Definition VertexArrayState:25
Definition GeometryPool:32
osg::Array * getColorArray()
Definition GeometryPool:49
virtual bool supports(const osg::PrimitiveIndexFunctor &) const
Return true if the Drawable subclass supports accept(PrimitiveIndexFunctor&).
Definition GeometryPool:87
osg::ref_ptr< osg::Array > _vertexArray
Definition GeometryPool:94
const osg::Array * getTexCoordArray() const
Definition GeometryPool:54
virtual void accept(osg::Drawable::ConstAttributeFunctor &) const
Accept an AttributeFunctor and call its methods to tell it about the internal attributes that this Dr...
void setColorArray(osg::Array *array)
Definition GeometryPool:48
osg::VertexArrayState * createVertexArrayStateImplementation(osg::RenderInfo &renderInfo) const
Implementation of Create the VertexArrayState object.
std::vector< unsigned int > VertexToHeightFieldMapping
Definition GeometryPool:61
void releaseGLObjects(osg::State *state) const
If State is non-zero, this function releases OpenGL objects for the specified graphics context.
osg::ref_ptr< osg::Array > _normalArray
Definition GeometryPool:95
void setNormalArray(osg::Array *array)
Definition GeometryPool:44
SharedGeometry(const SharedGeometry &, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY)
VertexToHeightFieldMapping _vertexToHeightFieldMapping
Definition GeometryPool:100
void resizeGLObjectBuffers(unsigned int maxSize)
Resize any per context GLObject buffers to specified size.
virtual bool supports(const osg::PrimitiveFunctor &) const
Return true if the Drawable subclass supports accept(PrimitiveFunctor&).
Definition GeometryPool:84
osg::Array * getVertexArray()
Definition GeometryPool:41
const osg::Array * getColorArray() const
Definition GeometryPool:50
const osg::Array * getVertexArray() const
Definition GeometryPool:42
void setVertexToHeightFieldMapping(const VertexToHeightFieldMapping &vthfm)
Definition GeometryPool:63
void drawImplementation(osg::RenderInfo &renderInfo) const
drawImplementation(RenderInfo&) is a pure virtual method for the actual implementation of OpenGL draw...
void setDrawElements(osg::DrawElements *array)
Definition GeometryPool:56
virtual bool supports(const osg::Drawable::ConstAttributeFunctor &) const
Return true if the Drawable subclass supports accept(ConstAttributeFunctor&).
Definition GeometryPool:81
META_Node(osgTerrain, SharedGeometry)
virtual void accept(osg::PrimitiveIndexFunctor &) const
Accept a PrimitiveIndexFunctor and call its methods to tell it about the internal primitives that thi...
virtual ~SharedGeometry()
osg::Array * getNormalArray()
Definition GeometryPool:45
osg::ref_ptr< osg::DrawElements > _drawElements
Definition GeometryPool:98
void setTexCoordArray(osg::Array *array)
Definition GeometryPool:52
const VertexToHeightFieldMapping & getVertexToHeightFieldMapping() const
Definition GeometryPool:66
osg::ref_ptr< osg::Array > _colorArray
Definition GeometryPool:96
virtual bool supports(const osg::Drawable::AttributeFunctor &) const
Return true if the Drawable subclass supports accept(AttributeFunctor&).
Definition GeometryPool:78
virtual void accept(osg::PrimitiveFunctor &) const
Accept a PrimitiveFunctor and call its methods to tell it about the internal primitives that this Dra...
void setVertexArray(osg::Array *array)
Definition GeometryPool:40
const osg::Array * getNormalArray() const
Definition GeometryPool:46
osg::Array * getTexCoordArray()
Definition GeometryPool:53
const osg::DrawElements * getDrawElements() const
Definition GeometryPool:58
virtual void accept(osg::Drawable::AttributeFunctor &)
accept an AttributeFunctor and call its methods to tell it about the internal attributes that this Dr...
osg::DrawElements * getDrawElements()
Definition GeometryPool:57
void compileGLObjects(osg::RenderInfo &renderInfo) const
Immediately compile this Drawable into an OpenGL Display List/VertexBufferObjects.
VertexToHeightFieldMapping & getVertexToHeightFieldMapping()
Definition GeometryPool:65
osg::ref_ptr< osg::Array > _texcoordArray
Definition GeometryPool:97
ProgramMap _programMap
Definition GeometryPool:168
osg::StateSet * getRootStateSetForTerrain(Terrain *terrain)
std::map< GeometryKey, osg::ref_ptr< SharedGeometry > > GeometryMap
Definition GeometryPool:137
osg::ref_ptr< osg::StateSet > _rootStateSet
Definition GeometryPool:170
std::map< LayerTypes, osg::ref_ptr< osg::Program > > ProgramMap
Definition GeometryPool:149
OpenThreads::Mutex _geometryMapMutex
Definition GeometryPool:164
virtual osg::ref_ptr< osg::MatrixTransform > getTileSubgraph(osgTerrain::TerrainTile *tile)
bool _rootStateSetAssigned
Definition GeometryPool:171
std::vector< LayerType > LayerTypes
Definition GeometryPool:148
virtual bool createKeyForTile(TerrainTile *tile, GeometryKey &key)
virtual osg::ref_ptr< SharedGeometry > getOrCreateGeometry(osgTerrain::TerrainTile *tile)
virtual void applyLayers(osgTerrain::TerrainTile *tile, osg::StateSet *stateset)
virtual osg::ref_ptr< osg::Program > getOrCreateProgram(LayerTypes &layerTypes)
LayerType
Definition GeometryPool:142
@ HEIGHTFIELD_LAYER
Definition GeometryPool:143
@ COLOR_LAYER
Definition GeometryPool:144
@ CONTOUR_LAYER
Definition GeometryPool:145
OpenThreads::Mutex _programMapMutex
Definition GeometryPool:167
GeometryMap _geometryMap
Definition GeometryPool:165
Definition GeometryPool:109
double sy
Definition GeometryPool:130
double y
Definition GeometryPool:131
double sx
Definition GeometryPool:129
int ny
Definition GeometryPool:134
int nx
Definition GeometryPool:133
GeometryKey()
Definition GeometryPool:110
virtual void accept(osg::Drawable::ConstAttributeFunctor &) const
Accept an AttributeFunctor and call its methods to tell it about the internal attributes that this Dr...
SharedGeometry * getGeometry()
Definition GeometryPool:189
virtual void accept(osg::PrimitiveFunctor &) const
Accept a PrimitiveFunctor and call its methods to tell it about the internal primitives that this Dra...
void setHeightField(osg::HeightField *hf)
Definition GeometryPool:184
const osg::Vec3Array * getVertices() const
Definition GeometryPool:194
virtual void drawImplementation(osg::RenderInfo &renderInfo) const
drawImplementation(RenderInfo&) is a pure virtual method for the actual implementation of OpenGL draw...
osg::ref_ptr< osg::Vec3Array > _vertices
Definition GeometryPool:220
virtual ~HeightFieldDrawable()
osg::Vec3Array * getVertices()
Definition GeometryPool:193
virtual bool supports(const osg::Drawable::ConstAttributeFunctor &) const
Return true if the Drawable subclass supports accept(ConstAttributeFunctor&).
Definition GeometryPool:205
const SharedGeometry * getGeometry() const
Definition GeometryPool:190
META_Node(osgTerrain, HeightFieldDrawable)
virtual void resizeGLObjectBuffers(unsigned int maxSize)
Resize any per context GLObject buffers to specified size.
const osg::HeightField * getHeightField() const
Definition GeometryPool:186
HeightFieldDrawable(const HeightFieldDrawable &, const osg::CopyOp ©op=osg::CopyOp::SHALLOW_COPY)
virtual void releaseGLObjects(osg::State *state=0) const
If State is non-zero, this function releases OpenGL objects for the specified graphics context.
osg::HeightField * getHeightField()
Definition GeometryPool:185
virtual bool supports(const osg::PrimitiveIndexFunctor &) const
Return true if the Drawable subclass supports accept(PrimitiveIndexFunctor&).
Definition GeometryPool:211
osg::ref_ptr< SharedGeometry > _geometry
Definition GeometryPool:219
virtual bool supports(const osg::PrimitiveFunctor &) const
Return true if the Drawable subclass supports accept(PrimitiveFunctor&).
Definition GeometryPool:208
virtual bool supports(const osg::Drawable::AttributeFunctor &) const
Return true if the Drawable subclass supports accept(AttributeFunctor&).
Definition GeometryPool:202
void setVertices(osg::Vec3Array *vertices)
Definition GeometryPool:192
osg::ref_ptr< osg::HeightField > _heightField
Definition GeometryPool:218
virtual void compileGLObjects(osg::RenderInfo &renderInfo) const
Immediately compile this Drawable into an OpenGL Display List/VertexBufferObjects.
virtual void accept(osg::Drawable::AttributeFunctor &)
accept an AttributeFunctor and call its methods to tell it about the internal attributes that this Dr...
virtual void accept(osg::PrimitiveIndexFunctor &) const
Accept a PrimitiveIndexFunctor and call its methods to tell it about the internal primitives that thi...
void setGeometry(SharedGeometry *geom)
Definition GeometryPool:188
Terrain provides a framework for loosely coupling height field data with height rendering algorithms.
Definition Terrain:28
Terrain provides a framework for loosely coupling height field data with height rendering algorithms.
Definition TerrainTile:68
#define OSGTERRAIN_EXPORT
Definition Export:39