Added support for min to max level ranges for Layers in support of VirtualPlanetBuilder usage of this.
This commit is contained in:
parent
2c0842c7b7
commit
2cab28c3b8
@ -23,6 +23,8 @@
|
||||
|
||||
namespace osgTerrain {
|
||||
|
||||
#define MAXIMUM_NUMBER_OF_LEVELS 30
|
||||
|
||||
class OSGTERRAIN_EXPORT Layer : public osg::Object
|
||||
{
|
||||
public:
|
||||
@ -40,6 +42,12 @@ class OSGTERRAIN_EXPORT Layer : public osg::Object
|
||||
void setLocator(Locator* locator) { _locator = locator; }
|
||||
Locator* getLocator() { return _locator.get(); }
|
||||
const Locator* getLocator() const { return _locator.get(); }
|
||||
|
||||
void setMinLevel(unsigned int minLevel) { _minLevel = minLevel; }
|
||||
unsigned int getMinLevel() const { return _minLevel; }
|
||||
|
||||
void setMaxLevel(unsigned int maxLevel) { _maxLevel = maxLevel; }
|
||||
unsigned int getMaxLevel() const { return _maxLevel; }
|
||||
|
||||
void setValidDataOperator(ValidDataOperator* validDataOp) { _validDataOperator = validDataOp; }
|
||||
ValidDataOperator* getValidDataOperator() { return _validDataOperator.get(); }
|
||||
@ -160,6 +168,8 @@ class OSGTERRAIN_EXPORT Layer : public osg::Object
|
||||
|
||||
std::string _filename;
|
||||
osg::ref_ptr<Locator> _locator;
|
||||
unsigned int _minLevel;
|
||||
unsigned int _maxLevel;
|
||||
osg::ref_ptr<ValidDataOperator> _validDataOperator;
|
||||
osg::Vec4 _defaultValue;
|
||||
|
||||
|
@ -185,6 +185,18 @@ osgTerrain::Layer* readLayer(osgDB::Input& fr, bool& itrAdvanced)
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
unsigned int minLevel=0;
|
||||
if (fr.read("MinLevel",minLevel))
|
||||
{
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
unsigned int maxLevel = MAXIMUM_NUMBER_OF_LEVELS;
|
||||
if (fr.read("MaxLevel",maxLevel))
|
||||
{
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
|
||||
if (fr.matchSequence("CompositeLayer {"))
|
||||
{
|
||||
@ -291,6 +303,9 @@ osgTerrain::Layer* readLayer(osgDB::Input& fr, bool& itrAdvanced)
|
||||
layer->setLocator(locator.get());
|
||||
}
|
||||
|
||||
layer->setMinLevel(minLevel);
|
||||
layer->setMaxLevel(maxLevel);
|
||||
|
||||
return layer.release();
|
||||
}
|
||||
|
||||
@ -554,6 +569,16 @@ bool writeLayer(const osgTerrain::Layer& layer, osgDB::Output& fw)
|
||||
writeLocator(*layer.getLocator(),fw);
|
||||
}
|
||||
|
||||
if (layer.getMinLevel()!=0)
|
||||
{
|
||||
fw.indent()<<"MinLevel "<<layer.getMinLevel()<<std::endl;
|
||||
}
|
||||
|
||||
if (layer.getMinLevel()!=MAXIMUM_NUMBER_OF_LEVELS)
|
||||
{
|
||||
fw.indent()<<"MaxLevel "<<layer.getMaxLevel()<<std::endl;
|
||||
}
|
||||
|
||||
const osgTerrain::ProxyLayer* proxyLayer = dynamic_cast<const osgTerrain::ProxyLayer*>(&layer);
|
||||
if (proxyLayer)
|
||||
{
|
||||
|
@ -16,13 +16,17 @@
|
||||
|
||||
using namespace osgTerrain;
|
||||
|
||||
Layer::Layer()
|
||||
Layer::Layer():
|
||||
_minLevel(0),
|
||||
_maxLevel(MAXIMUM_NUMBER_OF_LEVELS)
|
||||
{
|
||||
}
|
||||
|
||||
Layer::Layer(const Layer& layer,const osg::CopyOp& copyop):
|
||||
osg::Object(layer,copyop),
|
||||
_filename(layer._filename)
|
||||
_filename(layer._filename),
|
||||
_minLevel(layer._minLevel),
|
||||
_maxLevel(layer._maxLevel)
|
||||
{
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user