Added support for boundary equalization to GeometryTechnique

This commit is contained in:
Robert Osfield 2010-04-01 21:06:56 +00:00
parent 15afc29018
commit a8bbf0a809
12 changed files with 927 additions and 284 deletions

View File

@ -38,16 +38,7 @@ class OSGTERRAIN_EXPORT GeometryTechnique : public TerrainTechnique
virtual Locator* computeMasterLocator(); virtual Locator* computeMasterLocator();
virtual osg::Vec3d computeCenterModel(Locator* masterLocator);
virtual void generateGeometry(Locator* masterLocator, const osg::Vec3d& centerModel);
virtual void applyColorLayers();
virtual void applyTransparency();
virtual void smoothGeometry();
virtual void update(osgUtil::UpdateVisitor* nv); virtual void update(osgUtil::UpdateVisitor* nv);
virtual void cull(osgUtil::CullVisitor* nv); virtual void cull(osgUtil::CullVisitor* nv);
@ -86,24 +77,32 @@ class OSGTERRAIN_EXPORT GeometryTechnique : public TerrainTechnique
virtual ~GeometryTechnique(); virtual ~GeometryTechnique();
struct BufferData class BufferData : public osg::Referenced
{ {
public:
BufferData() {}
osg::ref_ptr<osg::MatrixTransform> _transform; osg::ref_ptr<osg::MatrixTransform> _transform;
osg::ref_ptr<osg::Geode> _geode; osg::ref_ptr<osg::Geode> _geode;
osg::ref_ptr<osg::Geometry> _geometry; osg::ref_ptr<osg::Geometry> _geometry;
};
unsigned int _currentReadOnlyBuffer;
unsigned int _currentWriteBuffer;
BufferData _bufferData[2];
void swapBuffers();
inline BufferData& getReadOnlyBuffer() { return _bufferData[_currentReadOnlyBuffer]; } protected:
inline BufferData& getWriteBuffer() { return _bufferData[_currentWriteBuffer]; } ~BufferData() {}
};
virtual osg::Vec3d computeCenterModel(BufferData& buffer, Locator* masterLocator);
virtual void generateGeometry(BufferData& buffer, Locator* masterLocator, const osg::Vec3d& centerModel);
virtual void applyColorLayers(BufferData& buffer);
virtual void applyTransparency(BufferData& buffer);
OpenThreads::Mutex _writeBufferMutex;
osg::ref_ptr<BufferData> _currentBufferData;
osg::ref_ptr<BufferData> _newBufferData;
float _filterBias; float _filterBias;
osg::ref_ptr<osg::Uniform> _filterBiasUniform; osg::ref_ptr<osg::Uniform> _filterBiasUniform;
float _filterWidth; float _filterWidth;

View File

@ -91,6 +91,9 @@ class OSGTERRAIN_EXPORT Terrain : public osg::Group
/** Get the const TerrainTechnique protype*/ /** Get the const TerrainTechnique protype*/
const TerrainTechnique* getTerrainTechniquePrototype() const { return _terrainTechnique.get(); } 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: protected:
virtual ~Terrain(); virtual ~Terrain();
@ -112,6 +115,7 @@ class OSGTERRAIN_EXPORT Terrain : public osg::Group
mutable OpenThreads::Mutex _mutex; mutable OpenThreads::Mutex _mutex;
TerrainTileSet _terrainTileSet; TerrainTileSet _terrainTileSet;
TerrainTileMap _terrainTileMap; TerrainTileMap _terrainTileMap;
TerrainTileSet _updateTerrainTileSet;
osg::ref_ptr<TerrainTechnique> _terrainTechnique; osg::ref_ptr<TerrainTechnique> _terrainTechnique;
}; };

View File

@ -25,7 +25,31 @@ namespace osgTerrain {
class TerrainTile; class TerrainTile;
class OSGTERRAIN_EXPORT TerrainTechnique : public osg::Object class OSGTERRAIN_EXPORT TerrainNeighbours
{
public:
TerrainNeighbours();
~TerrainNeighbours();
void clear();
void addNeighbour(TerrainTile* tile);
void removeNeighbour(TerrainTile* tile);
bool containsNeighbour(TerrainTile* tile) const;
protected:
TerrainNeighbours(const TerrainNeighbours& tn) {}
TerrainNeighbours& operator = (const TerrainNeighbours& rhs) { return *this; }
typedef std::set<TerrainTile*> Neighbours;
mutable OpenThreads::Mutex _neighboursMutex;
Neighbours _neighbours;
};
class OSGTERRAIN_EXPORT TerrainTechnique : public osg::Object, public osg::Observer
{ {
public: public:
@ -33,7 +57,7 @@ class OSGTERRAIN_EXPORT TerrainTechnique : public osg::Object
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/ /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
TerrainTechnique(const TerrainTechnique&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); TerrainTechnique(const TerrainTechnique&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgTerrain, TerrainTechnique); META_Object(osgTerrain, TerrainTechnique);
TerrainTile* getTerrainTile() { return _terrainTile; } TerrainTile* getTerrainTile() { return _terrainTile; }
@ -56,15 +80,26 @@ class OSGTERRAIN_EXPORT TerrainTechnique : public osg::Object
* for all graphics contexts. */ * for all graphics contexts. */
virtual void releaseGLObjects(osg::State* = 0) const {} virtual void releaseGLObjects(osg::State* = 0) const {}
void addNeighbour(TerrainTile* tile) { _neighbours.addNeighbour(tile); }
void removeNeighbour(TerrainTile* tile) { _neighbours.removeNeighbour(tile); }
bool containsNeighbour(TerrainTile* tile) { return _neighbours.containsNeighbour(tile); }
TerrainNeighbours& getNeighbours() { return _neighbours; }
const TerrainNeighbours& getNeighbours() const { return _neighbours; }
protected: protected:
void setDirty(bool dirty);
virtual ~TerrainTechnique(); virtual ~TerrainTechnique();
void setTerrainTile(TerrainTile* tile);
void setDirty(bool dirty);
friend class osgTerrain::TerrainTile; friend class osgTerrain::TerrainTile;
TerrainTile* _terrainTile; TerrainTile* _terrainTile;
TerrainNeighbours _neighbours;
}; };

View File

@ -69,7 +69,7 @@ class OSGTERRAIN_EXPORT TerrainTile : public osg::Group
public: public:
TerrainTile(); TerrainTile();
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/ /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
TerrainTile(const TerrainTile&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); TerrainTile(const TerrainTile&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
@ -172,11 +172,32 @@ class OSGTERRAIN_EXPORT TerrainTile : public osg::Group
BlendingPolicy getBlendingPolicy() const { return _blendingPolicy; } BlendingPolicy getBlendingPolicy() const { return _blendingPolicy; }
enum DirtyMask
{
NOT_DIRTY = 0,
IMAGERY_DIRTY = 1<<0,
ELEVATION_DIRTY = 1<<1,
LEFT_EDGE_DIRTY = 1<<2,
RIGHT_EDGE_DIRTY = 1<<3,
TOP_EDGE_DIRTY = 1<<4,
BOTTOM_EDGE_DIRTY = 1<<5,
EDGES_DIRTY = LEFT_EDGE_DIRTY | RIGHT_EDGE_DIRTY | TOP_EDGE_DIRTY | BOTTOM_EDGE_DIRTY,
ALL_DIRTY = IMAGERY_DIRTY | ELEVATION_DIRTY | EDGES_DIRTY
};
/** Set the dirty flag on/off.*/ /** Set the dirty flag on/off.*/
void setDirty(bool dirty); void setDirty(bool dirty) { setDirtyMask(dirty ? ALL_DIRTY : NOT_DIRTY); }
/** return true if the any of the DirtyMask are set.*/
int getDirty() const { return _dirtyMask!=NOT_DIRTY; }
/** Set the dirty flag on/off.*/
void setDirtyMask(int dirtyMask);
/** return true if the tile is dirty and needs to be updated,*/ /** return true if the tile is dirty and needs to be updated,*/
bool getDirty() const { return _dirty; } int getDirtyMask() const { return _dirtyMask; }
/** Compute the bounding volume of the terrain by computing the union of the bounding volumes of all layers.*/ /** Compute the bounding volume of the terrain by computing the union of the bounding volumes of all layers.*/
virtual osg::BoundingSphere computeBound() const; virtual osg::BoundingSphere computeBound() const;
@ -207,7 +228,7 @@ class OSGTERRAIN_EXPORT TerrainTile : public osg::Group
Terrain* _terrain; Terrain* _terrain;
bool _dirty; int _dirtyMask;
bool _hasBeenTraversal; bool _hasBeenTraversal;
TileID _tileID; TileID _tileID;

File diff suppressed because it is too large Load Diff

View File

@ -13,6 +13,7 @@
#include <osgTerrain/Terrain> #include <osgTerrain/Terrain>
#include <osgTerrain/GeometryTechnique> #include <osgTerrain/GeometryTechnique>
#include <osgUtil/UpdateVisitor>
#include <OpenThreads/ScopedLock> #include <OpenThreads/ScopedLock>
@ -24,6 +25,7 @@ Terrain::Terrain():
_verticalScale(1.0), _verticalScale(1.0),
_blendingPolicy(TerrainTile::INHERIT) _blendingPolicy(TerrainTile::INHERIT)
{ {
setNumChildrenRequiringUpdateTraversal(1);
_terrainTechnique = new GeometryTechnique; _terrainTechnique = new GeometryTechnique;
} }
@ -34,6 +36,7 @@ Terrain::Terrain(const Terrain& ts, const osg::CopyOp& copyop):
_blendingPolicy(ts._blendingPolicy), _blendingPolicy(ts._blendingPolicy),
_terrainTechnique(ts._terrainTechnique) _terrainTechnique(ts._terrainTechnique)
{ {
setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1);
} }
@ -54,13 +57,40 @@ Terrain::~Terrain()
void Terrain::traverse(osg::NodeVisitor& nv) void Terrain::traverse(osg::NodeVisitor& nv)
{ {
if (nv.getVisitorType()==osg::NodeVisitor::UPDATE_VISITOR)
{
// need to check if any TerrainTechniques need to have their update called on them.
osgUtil::UpdateVisitor* uv = dynamic_cast<osgUtil::UpdateVisitor*>(&nv);
if (uv)
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
for(TerrainTileSet::iterator itr = _updateTerrainTileSet.begin();
itr != _updateTerrainTileSet.end();
++itr)
{
TerrainTile* tile = *itr;
if (tile->getTerrainTechnique()) tile->getTerrainTechnique()->update(uv);
}
_updateTerrainTileSet.clear();
}
}
Group::traverse(nv); Group::traverse(nv);
} }
void Terrain::updateTerrainTileOnNextFrame(TerrainTile* terrainTile)
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
_updateTerrainTileSet.insert(terrainTile);
}
TerrainTile* Terrain::getTile(const TileID& tileID) TerrainTile* Terrain::getTile(const TileID& tileID)
{ {
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex); OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
// OSG_NOTICE<<"Terrain::getTile("<<tileID.level<<", "<<tileID.x<<", "<<tileID.y<<")"<<std::endl;
TerrainTileMap::iterator itr = _terrainTileMap.find(tileID); TerrainTileMap::iterator itr = _terrainTileMap.find(tileID);
if (itr == _terrainTileMap.end()) return 0; if (itr == _terrainTileMap.end()) return 0;
@ -95,17 +125,18 @@ void Terrain::registerTerrainTile(TerrainTile* tile)
if (!tile) return; if (!tile) return;
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex); OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_mutex);
if (tile->getTileID().valid()) if (tile->getTileID().valid())
{ {
_terrainTileMap[tile->getTileID()] = tile; _terrainTileMap[tile->getTileID()] = tile;
} }
_terrainTileSet.insert(tile); _terrainTileSet.insert(tile);
if (_terrainTileSet.size() > s_maxNumTiles) s_maxNumTiles = _terrainTileSet.size(); if (_terrainTileSet.size() > s_maxNumTiles) s_maxNumTiles = _terrainTileSet.size();
// osg::notify(osg::NOTICE)<<"Terrain::registerTerrainTile "<<tile<<" total number of tile "<<_terrainTileSet.size()<<" max = "<<s_maxNumTiles<<std::endl; // OSG_NOTICE<<"Terrain::registerTerrainTile "<<tile<<" total number of tile "<<_terrainTileSet.size()<<" max = "<<s_maxNumTiles<<std::endl;
// OSG_NOTICE<<" tileID("<<tile->getTileID().level<<", "<<tile->getTileID().x<<", "<<tile->getTileID().y<<")"<<std::endl;
} }
void Terrain::unregisterTerrainTile(TerrainTile* tile) void Terrain::unregisterTerrainTile(TerrainTile* tile)
@ -120,6 +151,7 @@ void Terrain::unregisterTerrainTile(TerrainTile* tile)
} }
_terrainTileSet.erase(tile); _terrainTileSet.erase(tile);
_updateTerrainTileSet.erase(tile);
// osg::notify(osg::NOTICE)<<"Terrain::unregisterTerrainTile "<<tile<<" total number of tile "<<_terrainTileSet.size()<<" max = "<<s_maxNumTiles<<std::endl; // OSG_NOTICE<<"Terrain::unregisterTerrainTile "<<tile<<" total number of tile "<<_terrainTileSet.size()<<" max = "<<s_maxNumTiles<<std::endl;
} }

View File

@ -16,6 +16,48 @@
using namespace osgTerrain; using namespace osgTerrain;
/////////////////////////////////////////////////////////////////////////////////////
//
// TerrainNeighbours
//
TerrainNeighbours::TerrainNeighbours()
{
}
TerrainNeighbours::~TerrainNeighbours()
{
clear();
}
void TerrainNeighbours::addNeighbour(TerrainTile* tile)
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_neighboursMutex);
_neighbours.insert(tile);
}
void TerrainNeighbours::removeNeighbour(TerrainTile* tile)
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_neighboursMutex);
_neighbours.erase(tile);
}
void TerrainNeighbours::clear()
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_neighboursMutex);
_neighbours.clear();
}
bool TerrainNeighbours::containsNeighbour(TerrainTile* tile) const
{
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(_neighboursMutex);
return _neighbours.count(tile)!=0;
}
/////////////////////////////////////////////////////////////////////////////////////
//
// TerrainTechnique
//
TerrainTechnique::TerrainTechnique(): TerrainTechnique::TerrainTechnique():
_terrainTile(0) _terrainTile(0)
{ {
@ -32,6 +74,15 @@ TerrainTechnique::~TerrainTechnique()
{ {
} }
void TerrainTechnique::setTerrainTile(TerrainTile* tile)
{
if (_terrainTile==tile) return;
_neighbours.clear();
_terrainTile = tile;
}
void TerrainTechnique::init() void TerrainTechnique::init()
{ {
OSG_NOTIFY(osg::NOTICE)<<className()<<"::initialize(..) not implementated yet"<<std::endl; OSG_NOTIFY(osg::NOTICE)<<className()<<"::initialize(..) not implementated yet"<<std::endl;

View File

@ -58,7 +58,7 @@ osg::ref_ptr<TerrainTile::TileLoadedCallback>& TerrainTile::getTileLoadedCallbac
TerrainTile::TerrainTile(): TerrainTile::TerrainTile():
_terrain(0), _terrain(0),
_dirty(false), _dirtyMask(NOT_DIRTY),
_hasBeenTraversal(false), _hasBeenTraversal(false),
_requiresNormals(true), _requiresNormals(true),
_treatBoundariesToValidDataAsDefaultValue(false), _treatBoundariesToValidDataAsDefaultValue(false),
@ -70,7 +70,7 @@ TerrainTile::TerrainTile():
TerrainTile::TerrainTile(const TerrainTile& terrain,const osg::CopyOp& copyop): TerrainTile::TerrainTile(const TerrainTile& terrain,const osg::CopyOp& copyop):
Group(terrain,copyop), Group(terrain,copyop),
_terrain(0), _terrain(0),
_dirty(false), _dirtyMask(NOT_DIRTY),
_hasBeenTraversal(false), _hasBeenTraversal(false),
_elevationLayer(terrain._elevationLayer), _elevationLayer(terrain._elevationLayer),
_colorLayers(terrain._colorLayers), _colorLayers(terrain._colorLayers),
@ -86,6 +86,11 @@ TerrainTile::TerrainTile(const TerrainTile& terrain,const osg::CopyOp& copyop):
TerrainTile::~TerrainTile() TerrainTile::~TerrainTile()
{ {
if (_terrainTechnique.valid())
{
_terrainTechnique->setTerrainTile(0);
}
if (_terrain) setTerrain(0); if (_terrain) setTerrain(0);
} }
@ -134,9 +139,9 @@ void TerrainTile::traverse(osg::NodeVisitor& nv)
} }
} }
} }
init(); init();
_hasBeenTraversal = true; _hasBeenTraversal = true;
} }
@ -162,7 +167,7 @@ void TerrainTile::traverse(osg::NodeVisitor& nv)
void TerrainTile::init() void TerrainTile::init()
{ {
if (!_terrainTechnique) if (!_terrainTechnique)
{ {
if (_terrain && _terrain->getTerrainTechniquePrototype()) if (_terrain && _terrain->getTerrainTechniquePrototype())
{ {
osg::ref_ptr<osg::Object> object = _terrain->getTerrainTechniquePrototype()->clone(osg::CopyOp::DEEP_COPY_ALL); osg::ref_ptr<osg::Object> object = _terrain->getTerrainTechniquePrototype()->clone(osg::CopyOp::DEEP_COPY_ALL);
@ -177,45 +182,47 @@ void TerrainTile::init()
if (_terrainTechnique.valid() && getDirty()) if (_terrainTechnique.valid() && getDirty())
{ {
_terrainTechnique->init(); _terrainTechnique->init();
}
setDirty(false);
}
} }
void TerrainTile::setTerrainTechnique(TerrainTechnique* terrainTechnique) void TerrainTile::setTerrainTechnique(TerrainTechnique* terrainTechnique)
{ {
if (_terrainTechnique == terrainTechnique) return; if (_terrainTechnique == terrainTechnique) return;
int dirtyDelta = _dirty ? -1 : 0; int dirtyDelta = (_dirtyMask==NOT_DIRTY) ? 0 : -1;
if (_terrainTechnique.valid()) if (_terrainTechnique.valid())
{ {
_terrainTechnique->_terrainTile = 0; _terrainTechnique->setTerrainTile(0);
} }
_terrainTechnique = terrainTechnique; _terrainTechnique = terrainTechnique;
if (_terrainTechnique.valid()) if (_terrainTechnique.valid())
{ {
_terrainTechnique->_terrainTile = this; _terrainTechnique->setTerrainTile(this);
++dirtyDelta; ++dirtyDelta;
} }
if (dirtyDelta>0) setDirty(true); if (dirtyDelta>0) setDirtyMask(ALL_DIRTY);
else if (dirtyDelta<0) setDirty(false); else if (dirtyDelta<0) setDirtyMask(NOT_DIRTY);
} }
void TerrainTile::setDirty(bool dirty) void TerrainTile::setDirtyMask(int dirtyMask)
{ {
if (_dirty==dirty) return; if (_dirtyMask==dirtyMask) return;
_dirty = dirty; int dirtyDelta = (_dirtyMask==NOT_DIRTY) ? 0 : -1;
if (_dirty) _dirtyMask = dirtyMask;
if (_dirtyMask!=NOT_DIRTY) dirtyDelta += 1;
if (dirtyDelta>0)
{ {
setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1); setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()+1);
} }
else if (getNumChildrenRequiringUpdateTraversal()>0) else if (dirtyDelta<0 && getNumChildrenRequiringUpdateTraversal()>0)
{ {
setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()-1); setNumChildrenRequiringUpdateTraversal(getNumChildrenRequiringUpdateTraversal()-1);
} }

View File

@ -15,7 +15,6 @@
#include <osg/Object> #include <osg/Object>
#include <osg/State> #include <osg/State>
#include <osg/Uniform> #include <osg/Uniform>
#include <osg/Vec3d>
#include <osgTerrain/GeometryTechnique> #include <osgTerrain/GeometryTechnique>
#include <osgTerrain/Locator> #include <osgTerrain/Locator>
#include <osgUtil/CullVisitor> #include <osgUtil/CullVisitor>
@ -81,31 +80,6 @@ BEGIN_OBJECT_REFLECTOR(osgTerrain::GeometryTechnique)
__Locator_P1__computeMasterLocator, __Locator_P1__computeMasterLocator,
"", "",
""); "");
I_Method1(osg::Vec3d, computeCenterModel, IN, osgTerrain::Locator *, masterLocator,
Properties::VIRTUAL,
__osg_Vec3d__computeCenterModel__Locator_P1,
"",
"");
I_Method2(void, generateGeometry, IN, osgTerrain::Locator *, masterLocator, IN, const osg::Vec3d &, centerModel,
Properties::VIRTUAL,
__void__generateGeometry__Locator_P1__C5_osg_Vec3d_R1,
"",
"");
I_Method0(void, applyColorLayers,
Properties::VIRTUAL,
__void__applyColorLayers,
"",
"");
I_Method0(void, applyTransparency,
Properties::VIRTUAL,
__void__applyTransparency,
"",
"");
I_Method0(void, smoothGeometry,
Properties::VIRTUAL,
__void__smoothGeometry,
"",
"");
I_Method1(void, update, IN, osgUtil::UpdateVisitor *, nv, I_Method1(void, update, IN, osgUtil::UpdateVisitor *, nv,
Properties::VIRTUAL, Properties::VIRTUAL,
__void__update__osgUtil_UpdateVisitor_P1, __void__update__osgUtil_UpdateVisitor_P1,
@ -171,22 +145,28 @@ BEGIN_OBJECT_REFLECTOR(osgTerrain::GeometryTechnique)
__void__releaseGLObjects__osg_State_P1, __void__releaseGLObjects__osg_State_P1,
"If State is non-zero, this function releases any associated OpenGL objects for the specified graphics context. ", "If State is non-zero, this function releases any associated OpenGL objects for the specified graphics context. ",
"Otherwise, releases OpenGL objects for all graphics contexts. "); "Otherwise, releases OpenGL objects for all graphics contexts. ");
I_ProtectedMethod0(void, swapBuffers, I_ProtectedMethod2(osg::Vec3d, computeCenterModel, IN, osg::BufferData &, buffer, IN, osgTerrain::Locator *, masterLocator,
Properties::NON_VIRTUAL, Properties::VIRTUAL,
Properties::NON_CONST, Properties::NON_CONST,
__void__swapBuffers, __osg_Vec3d__computeCenterModel__BufferData_R1__Locator_P1,
"", "",
""); "");
I_ProtectedMethod0(osg::BufferData &, getReadOnlyBuffer, I_ProtectedMethod3(void, generateGeometry, IN, osg::BufferData &, buffer, IN, osgTerrain::Locator *, masterLocator, IN, const osg::Vec3d &, centerModel,
Properties::NON_VIRTUAL, Properties::VIRTUAL,
Properties::NON_CONST, Properties::NON_CONST,
__BufferData_R1__getReadOnlyBuffer, __void__generateGeometry__BufferData_R1__Locator_P1__C5_osg_Vec3d_R1,
"", "",
""); "");
I_ProtectedMethod0(osg::BufferData &, getWriteBuffer, I_ProtectedMethod1(void, applyColorLayers, IN, osg::BufferData &, buffer,
Properties::NON_VIRTUAL, Properties::VIRTUAL,
Properties::NON_CONST, Properties::NON_CONST,
__BufferData_R1__getWriteBuffer, __void__applyColorLayers__BufferData_R1,
"",
"");
I_ProtectedMethod1(void, applyTransparency, IN, osg::BufferData &, buffer,
Properties::VIRTUAL,
Properties::NON_CONST,
__void__applyTransparency__BufferData_R1,
"", "",
""); "");
I_SimpleProperty(float, FilterBias, I_SimpleProperty(float, FilterBias,

View File

@ -125,6 +125,11 @@ BEGIN_OBJECT_REFLECTOR(osgTerrain::Terrain)
__C5_TerrainTechnique_P1__getTerrainTechniquePrototype, __C5_TerrainTechnique_P1__getTerrainTechniquePrototype,
"Get the const TerrainTechnique protype. ", "Get the const TerrainTechnique protype. ",
""); "");
I_Method1(void, updateTerrainTileOnNextFrame, IN, osgTerrain::TerrainTile *, terrainTile,
Properties::NON_VIRTUAL,
__void__updateTerrainTileOnNextFrame__TerrainTile_P1,
"Tell the Terrain node to call the terrainTile's TerrainTechnique on the next update traversal. ",
"");
I_ProtectedMethod0(void, dirtyRegisteredTiles, I_ProtectedMethod0(void, dirtyRegisteredTiles,
Properties::NON_VIRTUAL, Properties::NON_VIRTUAL,
Properties::NON_CONST, Properties::NON_CONST,

View File

@ -27,9 +27,42 @@
#undef OUT #undef OUT
#endif #endif
BEGIN_VALUE_REFLECTOR(osgTerrain::TerrainNeighbours)
I_DeclaringFile("osgTerrain/TerrainTechnique");
I_Constructor0(____TerrainNeighbours,
"",
"");
I_Method0(void, clear,
Properties::NON_VIRTUAL,
__void__clear,
"",
"");
I_Method1(void, addNeighbour, IN, osgTerrain::TerrainTile *, tile,
Properties::NON_VIRTUAL,
__void__addNeighbour__TerrainTile_P1,
"",
"");
I_Method1(void, removeNeighbour, IN, osgTerrain::TerrainTile *, tile,
Properties::NON_VIRTUAL,
__void__removeNeighbour__TerrainTile_P1,
"",
"");
I_Method1(bool, containsNeighbour, IN, osgTerrain::TerrainTile *, tile,
Properties::NON_VIRTUAL,
__bool__containsNeighbour__TerrainTile_P1,
"",
"");
I_ProtectedConstructor1(IN, const osgTerrain::TerrainNeighbours &, tn,
Properties::NON_EXPLICIT,
____TerrainNeighbours__C5_TerrainNeighbours_R1,
"",
"");
END_REFLECTOR
BEGIN_OBJECT_REFLECTOR(osgTerrain::TerrainTechnique) BEGIN_OBJECT_REFLECTOR(osgTerrain::TerrainTechnique)
I_DeclaringFile("osgTerrain/TerrainTechnique"); I_DeclaringFile("osgTerrain/TerrainTechnique");
I_BaseType(osg::Object); I_BaseType(osg::Object);
I_BaseType(osg::Observer);
I_Constructor0(____TerrainTechnique, I_Constructor0(____TerrainTechnique,
"", "",
""); "");
@ -102,12 +135,46 @@ BEGIN_OBJECT_REFLECTOR(osgTerrain::TerrainTechnique)
__void__releaseGLObjects__osg_State_P1, __void__releaseGLObjects__osg_State_P1,
"If State is non-zero, this function releases any associated OpenGL objects for the specified graphics context. ", "If State is non-zero, this function releases any associated OpenGL objects for the specified graphics context. ",
"Otherwise, releases OpenGL objects for all graphics contexts. "); "Otherwise, releases OpenGL objects for all graphics contexts. ");
I_Method1(void, addNeighbour, IN, osgTerrain::TerrainTile *, tile,
Properties::NON_VIRTUAL,
__void__addNeighbour__TerrainTile_P1,
"",
"");
I_Method1(void, removeNeighbour, IN, osgTerrain::TerrainTile *, tile,
Properties::NON_VIRTUAL,
__void__removeNeighbour__TerrainTile_P1,
"",
"");
I_Method1(bool, containsNeighbour, IN, osgTerrain::TerrainTile *, tile,
Properties::NON_VIRTUAL,
__bool__containsNeighbour__TerrainTile_P1,
"",
"");
I_Method0(osgTerrain::TerrainNeighbours &, getNeighbours,
Properties::NON_VIRTUAL,
__TerrainNeighbours_R1__getNeighbours,
"",
"");
I_Method0(const osgTerrain::TerrainNeighbours &, getNeighbours,
Properties::NON_VIRTUAL,
__C5_TerrainNeighbours_R1__getNeighbours,
"",
"");
I_ProtectedMethod1(void, setTerrainTile, IN, osgTerrain::TerrainTile *, tile,
Properties::NON_VIRTUAL,
Properties::NON_CONST,
__void__setTerrainTile__TerrainTile_P1,
"",
"");
I_ProtectedMethod1(void, setDirty, IN, bool, dirty, I_ProtectedMethod1(void, setDirty, IN, bool, dirty,
Properties::NON_VIRTUAL, Properties::NON_VIRTUAL,
Properties::NON_CONST, Properties::NON_CONST,
__void__setDirty__bool, __void__setDirty__bool,
"", "",
""); "");
I_SimpleProperty(osgTerrain::TerrainNeighbours &, Neighbours,
__TerrainNeighbours_R1__getNeighbours,
0);
I_SimpleProperty(osgTerrain::TerrainTile *, TerrainTile, I_SimpleProperty(osgTerrain::TerrainTile *, TerrainTile,
__TerrainTile_P1__getTerrainTile, __TerrainTile_P1__getTerrainTile,
0); 0);

View File

@ -38,6 +38,19 @@ BEGIN_ENUM_REFLECTOR(osgTerrain::TerrainTile::BlendingPolicy)
I_EnumLabel(osgTerrain::TerrainTile::ENABLE_BLENDING_WHEN_ALPHA_PRESENT); I_EnumLabel(osgTerrain::TerrainTile::ENABLE_BLENDING_WHEN_ALPHA_PRESENT);
END_REFLECTOR END_REFLECTOR
BEGIN_ENUM_REFLECTOR(osgTerrain::TerrainTile::DirtyMask)
I_DeclaringFile("osgTerrain/TerrainTile");
I_EnumLabel(osgTerrain::TerrainTile::NOT_DIRTY);
I_EnumLabel(osgTerrain::TerrainTile::IMAGERY_DIRTY);
I_EnumLabel(osgTerrain::TerrainTile::ELEVATION_DIRTY);
I_EnumLabel(osgTerrain::TerrainTile::LEFT_EDGE_DIRTY);
I_EnumLabel(osgTerrain::TerrainTile::RIGHT_EDGE_DIRTY);
I_EnumLabel(osgTerrain::TerrainTile::TOP_EDGE_DIRTY);
I_EnumLabel(osgTerrain::TerrainTile::BOTTOM_EDGE_DIRTY);
I_EnumLabel(osgTerrain::TerrainTile::EDGES_DIRTY);
I_EnumLabel(osgTerrain::TerrainTile::ALL_DIRTY);
END_REFLECTOR
BEGIN_OBJECT_REFLECTOR(osgTerrain::TerrainTile) BEGIN_OBJECT_REFLECTOR(osgTerrain::TerrainTile)
I_DeclaringFile("osgTerrain/TerrainTile"); I_DeclaringFile("osgTerrain/TerrainTile");
I_BaseType(osg::Group); I_BaseType(osg::Group);
@ -213,9 +226,19 @@ BEGIN_OBJECT_REFLECTOR(osgTerrain::TerrainTile)
__void__setDirty__bool, __void__setDirty__bool,
"Set the dirty flag on/off. ", "Set the dirty flag on/off. ",
""); "");
I_Method0(bool, getDirty, I_Method0(int, getDirty,
Properties::NON_VIRTUAL, Properties::NON_VIRTUAL,
__bool__getDirty, __int__getDirty,
"return true if the any of the DirtyMask are set. ",
"");
I_Method1(void, setDirtyMask, IN, int, dirtyMask,
Properties::NON_VIRTUAL,
__void__setDirtyMask__int,
"Set the dirty flag on/off. ",
"");
I_Method0(int, getDirtyMask,
Properties::NON_VIRTUAL,
__int__getDirtyMask,
"return true if the tile is dirty and needs to be updated, ", "return true if the tile is dirty and needs to be updated, ",
""); "");
I_Method0(osg::BoundingSphere, computeBound, I_Method0(osg::BoundingSphere, computeBound,
@ -247,8 +270,11 @@ BEGIN_OBJECT_REFLECTOR(osgTerrain::TerrainTile)
0, 0,
0); 0);
I_SimpleProperty(bool, Dirty, I_SimpleProperty(bool, Dirty,
__bool__getDirty, 0,
__void__setDirty__bool); __void__setDirty__bool);
I_SimpleProperty(int, DirtyMask,
__int__getDirtyMask,
__void__setDirtyMask__int);
I_SimpleProperty(osgTerrain::Layer *, ElevationLayer, I_SimpleProperty(osgTerrain::Layer *, ElevationLayer,
__Layer_P1__getElevationLayer, __Layer_P1__getElevationLayer,
__void__setElevationLayer__Layer_P1); __void__setElevationLayer__Layer_P1);