Renamed Terrain to TerrainTile
This commit is contained in:
parent
a9d283ca73
commit
35c5bd2c92
@ -47,7 +47,7 @@
|
||||
#include <osgGA/AnimationPathManipulator>
|
||||
#include <osgGA/TerrainManipulator>
|
||||
|
||||
#include <osgTerrain/Terrain>
|
||||
#include <osgTerrain/TerrainTile>
|
||||
#include <osgTerrain/GeometryTechnique>
|
||||
#include <osgTerrain/Layer>
|
||||
|
||||
@ -634,7 +634,7 @@ int main(int argc, char** argv)
|
||||
}
|
||||
|
||||
|
||||
osg::ref_ptr<osgTerrain::Terrain> terrain = new osgTerrain::Terrain;
|
||||
osg::ref_ptr<osgTerrain::TerrainTile> terrainTile = new osgTerrain::TerrainTile;
|
||||
osg::ref_ptr<osgTerrain::Locator> locator = new osgTerrain::Locator;
|
||||
osg::ref_ptr<osgTerrain::ValidDataOperator> validDataOperator = new osgTerrain::NoDataValue(0.0);
|
||||
osg::ref_ptr<osgTerrain::Layer> lastAppliedLayer;
|
||||
@ -667,7 +667,7 @@ int main(int argc, char** argv)
|
||||
|
||||
else if (arguments.read(pos, "-b"))
|
||||
{
|
||||
terrain->setTreatBoundariesToValidDataAsDefaultValue(true);
|
||||
terrainTile->setTreatBoundariesToValidDataAsDefaultValue(true);
|
||||
}
|
||||
|
||||
else if (arguments.read(pos, "-e",x,y,w,h))
|
||||
@ -712,7 +712,7 @@ int main(int argc, char** argv)
|
||||
hfl->transform(offset,scale);
|
||||
}
|
||||
|
||||
terrain->setElevationLayer(hfl.get());
|
||||
terrainTile->setElevationLayer(hfl.get());
|
||||
|
||||
lastAppliedLayer = hfl.get();
|
||||
|
||||
@ -747,7 +747,7 @@ int main(int argc, char** argv)
|
||||
imageLayer->transform(offset,scale);
|
||||
}
|
||||
|
||||
terrain->setElevationLayer(imageLayer.get());
|
||||
terrainTile->setElevationLayer(imageLayer.get());
|
||||
|
||||
lastAppliedLayer = imageLayer.get();
|
||||
|
||||
@ -782,7 +782,7 @@ int main(int argc, char** argv)
|
||||
imageLayer->transform(offset,scale);
|
||||
}
|
||||
|
||||
terrain->setColorLayer(layerNum, imageLayer.get());
|
||||
terrainTile->setColorLayer(layerNum, imageLayer.get());
|
||||
|
||||
lastAppliedLayer = imageLayer.get();
|
||||
|
||||
@ -817,9 +817,9 @@ int main(int argc, char** argv)
|
||||
osg::notify(osg::NOTICE)<<"--filter "<<filterName<<" unrecognized filter name, please use LINEAER or NEAREST."<<std::endl;
|
||||
}
|
||||
|
||||
if (terrain->getColorLayer(layerNum))
|
||||
if (terrainTile->getColorLayer(layerNum))
|
||||
{
|
||||
terrain->getColorLayer(layerNum)->setFilter(filter);
|
||||
terrainTile->getColorLayer(layerNum)->setFilter(filter);
|
||||
}
|
||||
|
||||
}
|
||||
@ -842,7 +842,7 @@ int main(int argc, char** argv)
|
||||
|
||||
osg::notify(osg::NOTICE)<<"--tf "<<minValue<<" "<<maxValue<<std::endl;
|
||||
|
||||
terrain->setColorLayer(layerNum, new osgTerrain::ContourLayer(tf.get()));
|
||||
terrainTile->setColorLayer(layerNum, new osgTerrain::ContourLayer(tf.get()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -854,14 +854,14 @@ int main(int argc, char** argv)
|
||||
|
||||
osg::ref_ptr<osg::Group> scene = new osg::Group;
|
||||
|
||||
if (terrain.valid() && (terrain->getElevationLayer() || terrain->getColorLayer(0)))
|
||||
if (terrainTile.valid() && (terrainTile->getElevationLayer() || terrainTile->getColorLayer(0)))
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Terrain created"<<std::endl;
|
||||
|
||||
scene->addChild(terrain.get());
|
||||
scene->addChild(terrainTile.get());
|
||||
|
||||
osg::ref_ptr<osgTerrain::GeometryTechnique> geometryTechnique = new osgTerrain::GeometryTechnique;
|
||||
terrain->setTerrainTechnique(geometryTechnique.get());
|
||||
terrainTile->setTerrainTechnique(geometryTechnique.get());
|
||||
viewer.addEventHandler(new FilterHandler(geometryTechnique.get()));
|
||||
viewer.addEventHandler(new LayerHandler(lastAppliedLayer.get()));
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
#include <osg/Group>
|
||||
#include <osg/CoordinateSystemNode>
|
||||
|
||||
#include <osgTerrain/Terrain>
|
||||
#include <osgTerrain/TerrainTile>
|
||||
|
||||
namespace osgTerrain {
|
||||
|
||||
@ -50,14 +50,8 @@ class OSGTERRAIN_EXPORT TerrainSystem : public osg::Group
|
||||
|
||||
virtual ~TerrainSystem();
|
||||
|
||||
friend class TerrainManager;
|
||||
|
||||
void registerPotentialMember(Terrain* terrain);
|
||||
|
||||
osg::ref_ptr<TerrainTechnique> _terrainTechnique;
|
||||
|
||||
typedef std::list< osg::observer_ptr<Terrain> > TerrainList;
|
||||
TerrainList _incomingTerrain;
|
||||
|
||||
|
||||
};
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
namespace osgTerrain {
|
||||
|
||||
class Terrain;
|
||||
class TerrainTile;
|
||||
|
||||
class OSGTERRAIN_EXPORT TerrainTechnique : public osg::Object
|
||||
{
|
||||
@ -36,8 +36,8 @@ class OSGTERRAIN_EXPORT TerrainTechnique : public osg::Object
|
||||
|
||||
META_Object(osgTerrain, TerrainTechnique);
|
||||
|
||||
Terrain* getTerrain() { return _terrain; }
|
||||
const Terrain* getTerrain() const { return _terrain; }
|
||||
TerrainTile* getTerrainTile() { return _terrain; }
|
||||
const TerrainTile* getTerrainTile() const { return _terrain; }
|
||||
|
||||
virtual void init();
|
||||
|
||||
@ -61,9 +61,9 @@ class OSGTERRAIN_EXPORT TerrainTechnique : public osg::Object
|
||||
|
||||
virtual ~TerrainTechnique();
|
||||
|
||||
friend class osgTerrain::Terrain;
|
||||
friend class osgTerrain::TerrainTile;
|
||||
|
||||
Terrain* _terrain;
|
||||
TerrainTile* _terrain;
|
||||
bool _dirty;
|
||||
|
||||
};
|
||||
|
@ -11,8 +11,8 @@
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSGTERRAIN_TERRAIN
|
||||
#define OSGTERRAIN_TERRAIN 1
|
||||
#ifndef OSGTERRAIN_TERRAINTILE
|
||||
#define OSGTERRAIN_TERRAINTILE 1
|
||||
|
||||
#include <osg/Group>
|
||||
#include <osg/CoordinateSystemNode>
|
||||
@ -56,16 +56,16 @@ class TileID
|
||||
|
||||
/** Terrain provides a framework for loosely coupling height field data with height rendering algorithms.
|
||||
* This allows TerrainTechnique's to be plugged in at runtime.*/
|
||||
class OSGTERRAIN_EXPORT Terrain : public osg::Group
|
||||
class OSGTERRAIN_EXPORT TerrainTile : public osg::Group
|
||||
{
|
||||
public:
|
||||
|
||||
Terrain();
|
||||
TerrainTile();
|
||||
|
||||
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
||||
Terrain(const Terrain&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
|
||||
TerrainTile(const TerrainTile&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
|
||||
|
||||
META_Node(osgTerrain, Terrain);
|
||||
META_Node(osgTerrain, TerrainTile);
|
||||
|
||||
virtual void traverse(osg::NodeVisitor& nv);
|
||||
|
||||
@ -120,7 +120,7 @@ class OSGTERRAIN_EXPORT Terrain : public osg::Group
|
||||
|
||||
|
||||
/** Set a color layer with specified layer number.*/
|
||||
void setColorLayer(unsigned int i, osgTerrain::Layer* layer);
|
||||
void setColorLayer(unsigned int i, Layer* layer);
|
||||
|
||||
/** Get color layer with specified layer number.*/
|
||||
Layer* getColorLayer(unsigned int i) { return i<_colorLayers.size() ? _colorLayers[i].get() : 0; }
|
||||
@ -151,7 +151,7 @@ class OSGTERRAIN_EXPORT Terrain : public osg::Group
|
||||
|
||||
protected:
|
||||
|
||||
virtual ~Terrain();
|
||||
virtual ~TerrainTile();
|
||||
|
||||
typedef std::vector< osg::ref_ptr<Layer> > Layers;
|
||||
|
@ -14,7 +14,7 @@
|
||||
#ifndef OSGTERRAIN_TILESYSTEM
|
||||
#define OSGTERRAIN_TILESYSTEM 1
|
||||
|
||||
#include <osgTerrain/Terrain>
|
||||
#include <osgTerrain/TerrainTile>
|
||||
|
||||
#include <osg/Object>
|
||||
#include <osg/observer_ptr>
|
||||
@ -36,7 +36,7 @@ class OSGTERRAIN_EXPORT TileSystem : public osg::Object
|
||||
|
||||
virtual ~TileSystem();
|
||||
|
||||
typedef std::map< TileID, osg::observer_ptr<Terrain> > TileMap;
|
||||
typedef std::map< TileID, osg::observer_ptr<TerrainTile> > TileMap;
|
||||
|
||||
TileMap _tileMap;
|
||||
};
|
||||
|
@ -91,7 +91,7 @@ SET(TARGET_SRC
|
||||
Texture3D.cpp
|
||||
TextureCubeMap.cpp
|
||||
TextureRectangle.cpp
|
||||
Terrain.cpp
|
||||
TerrainTile.cpp
|
||||
Locator.cpp
|
||||
Layer.cpp
|
||||
HeightFieldLayer.cpp
|
||||
@ -194,7 +194,7 @@ SET(TARGET_H
|
||||
Texture3D.h
|
||||
TextureCubeMap.h
|
||||
TextureRectangle.h
|
||||
Terrain.h
|
||||
TerrainTile.h
|
||||
Transform.h
|
||||
Locator.h
|
||||
Layer.h
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef IVE_COMPOSITELAYER
|
||||
#define IVE_COMPOSITELAYER 1
|
||||
|
||||
#include <osgTerrain/Terrain>
|
||||
#include <osgTerrain/Layer>
|
||||
#include "ReadWrite.h"
|
||||
|
||||
namespace ive
|
||||
|
@ -89,7 +89,7 @@
|
||||
|
||||
#include "Text.h"
|
||||
|
||||
#include "Terrain.h"
|
||||
#include "TerrainTile.h"
|
||||
#include "Locator.h"
|
||||
#include "ImageLayer.h"
|
||||
#include "HeightFieldLayer.h"
|
||||
@ -1457,9 +1457,9 @@ osg::Node* DataInputStream::readNode()
|
||||
node = new osgFX::MultiTextureControl();
|
||||
((ive::MultiTextureControl*)(node))->read(this);
|
||||
}
|
||||
else if(nodeTypeID== IVETERRAIN){
|
||||
node = new osgTerrain::Terrain();
|
||||
((ive::Terrain*)(node))->read(this);
|
||||
else if(nodeTypeID== IVETERRAINTILE){
|
||||
node = new osgTerrain::TerrainTile();
|
||||
((ive::TerrainTile*)(node))->read(this);
|
||||
}
|
||||
else{
|
||||
throw Exception("Unknown node identification in DataInputStream::readNode()");
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <osg/Uniform>
|
||||
#include <osg/ref_ptr>
|
||||
|
||||
#include <osgTerrain/Terrain>
|
||||
#include <osgTerrain/TerrainTile>
|
||||
|
||||
#include <osgDB/ReaderWriter>
|
||||
|
||||
|
@ -90,7 +90,7 @@
|
||||
|
||||
#include "Text.h"
|
||||
|
||||
#include "Terrain.h"
|
||||
#include "TerrainTile.h"
|
||||
#include "Locator.h"
|
||||
#include "ImageLayer.h"
|
||||
#include "HeightFieldLayer.h"
|
||||
@ -1060,8 +1060,8 @@ void DataOutputStream::writeNode(const osg::Node* node)
|
||||
else if(dynamic_cast<const osgFX::MultiTextureControl*>(node)){
|
||||
((ive::MultiTextureControl*)(node))->write(this);
|
||||
}
|
||||
else if(dynamic_cast<const osgTerrain::Terrain*>(node)){
|
||||
((ive::Terrain*)(node))->write(this);
|
||||
else if(dynamic_cast<const osgTerrain::TerrainTile*>(node)){
|
||||
((ive::TerrainTile*)(node))->write(this);
|
||||
}
|
||||
else if(dynamic_cast<const osg::Group*>(node)){
|
||||
((ive::Group*)(node))->write(this);
|
||||
|
@ -16,7 +16,7 @@
|
||||
#include <osg/Uniform>
|
||||
#include <osgDB/ReaderWriter>
|
||||
|
||||
#include <osgTerrain/Terrain>
|
||||
#include <osgTerrain/TerrainTile>
|
||||
|
||||
#include "IveVersion.h"
|
||||
#include "DataTypeSize.h"
|
||||
|
@ -14,7 +14,7 @@
|
||||
#ifndef IVE_HEIGHTFIELDLAYER
|
||||
#define IVE_HEIGHTFIELDLAYER 1
|
||||
|
||||
#include <osgTerrain/Terrain>
|
||||
#include <osgTerrain/Layer>
|
||||
#include "ReadWrite.h"
|
||||
|
||||
namespace ive
|
||||
|
@ -14,7 +14,8 @@
|
||||
#ifndef IVE_IMAGELAYER
|
||||
#define IVE_IMAGELAYER 1
|
||||
|
||||
#include <osgTerrain/Terrain>
|
||||
#include <osgTerrain/Layer>
|
||||
|
||||
#include "ReadWrite.h"
|
||||
|
||||
namespace ive
|
||||
|
@ -14,7 +14,7 @@
|
||||
#ifndef IVE_LAYER
|
||||
#define IVE_LAYER 1
|
||||
|
||||
#include <osgTerrain/Terrain>
|
||||
#include <osgTerrain/Layer>
|
||||
#include "ReadWrite.h"
|
||||
|
||||
namespace ive
|
||||
|
@ -121,7 +121,7 @@ namespace ive {
|
||||
#define IVEDIRECTIONALSECTOR 0x0010000A
|
||||
|
||||
// osgTerrain classes
|
||||
#define IVETERRAIN 0x00200001
|
||||
#define IVETERRAINTILE 0x00200001
|
||||
#define IVELOCATOR 0x00200002
|
||||
#define IVELAYER 0x00200003
|
||||
#define IVEIMAGELAYER 0x00200004
|
||||
@ -130,6 +130,7 @@ namespace ive {
|
||||
#define IVEPROXYLAYER 0x00200007
|
||||
#define IVETERRAINTECHNIQUE 0x00200008
|
||||
#define IVEGEOMETRYTECHNIQUE 0x00200009
|
||||
//#define IVETERRAIN 0x0020000A
|
||||
|
||||
// osgFX classes
|
||||
#define IVEMULTITEXTURECONTROL 0x01000001
|
||||
|
@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
#include "Exception.h"
|
||||
#include "Terrain.h"
|
||||
#include "TerrainTile.h"
|
||||
#include "Group.h"
|
||||
#include "Layer.h"
|
||||
|
||||
@ -20,10 +20,10 @@
|
||||
|
||||
using namespace ive;
|
||||
|
||||
void Terrain::write(DataOutputStream* out)
|
||||
void TerrainTile::write(DataOutputStream* out)
|
||||
{
|
||||
// Write Terrain's identification.
|
||||
out->writeInt(IVETERRAIN);
|
||||
out->writeInt(IVETERRAINTILE);
|
||||
// If the osg class is inherited by any other class we should also write this to file.
|
||||
osg::Group* group = dynamic_cast<osg::Group*>(this);
|
||||
if(group)
|
||||
@ -69,11 +69,11 @@ void Terrain::write(DataOutputStream* out)
|
||||
|
||||
}
|
||||
|
||||
void Terrain::read(DataInputStream* in)
|
||||
void TerrainTile::read(DataInputStream* in)
|
||||
{
|
||||
// Peek on Terrain's identification.
|
||||
int id = in->peekInt();
|
||||
if (id != IVETERRAIN) throw Exception("Terrain::read(): Expected Terrain identification.");
|
||||
if (id != IVETERRAINTILE) throw Exception("TerrainTile::read(): Expected Terrain identification.");
|
||||
|
||||
// Read Terrain's identification.
|
||||
id = in->readInt();
|
||||
@ -121,7 +121,7 @@ void Terrain::read(DataInputStream* in)
|
||||
|
||||
}
|
||||
|
||||
void Terrain::writeTerrainTechnique(DataOutputStream* out, osgTerrain::TerrainTechnique* technique)
|
||||
void TerrainTile::writeTerrainTechnique(DataOutputStream* out, osgTerrain::TerrainTechnique* technique)
|
||||
{
|
||||
if (dynamic_cast<osgTerrain::GeometryTechnique*>(technique))
|
||||
{
|
||||
@ -134,7 +134,7 @@ void Terrain::writeTerrainTechnique(DataOutputStream* out, osgTerrain::TerrainTe
|
||||
}
|
||||
}
|
||||
|
||||
osgTerrain::TerrainTechnique* Terrain::readTerrainTechnique(DataInputStream* in)
|
||||
osgTerrain::TerrainTechnique* TerrainTile::readTerrainTechnique(DataInputStream* in)
|
||||
{
|
||||
bool hasTechnique = in->readBool();
|
||||
if (!hasTechnique) return 0;
|
@ -11,17 +11,17 @@
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef IVE_TERRAIN
|
||||
#define IVE_TERRAIN 1
|
||||
#ifndef IVE_TERRAINTILE
|
||||
#define IVE_TERRAINTILE 1
|
||||
|
||||
#include <osgTerrain/Terrain>
|
||||
#include <osgTerrain/TerrainTile>
|
||||
|
||||
#include "ReadWrite.h"
|
||||
|
||||
namespace ive
|
||||
{
|
||||
|
||||
class Terrain : public osgTerrain::Terrain, public ReadWrite
|
||||
class TerrainTile : public osgTerrain::TerrainTile, public ReadWrite
|
||||
{
|
||||
public:
|
||||
void write(DataOutputStream* out);
|
@ -7,7 +7,7 @@ SET(TARGET_SRC
|
||||
HeightFieldLayer.cpp
|
||||
CompositeLayer.cpp
|
||||
Layer.cpp
|
||||
Terrain.cpp
|
||||
TerrainTile.cpp
|
||||
GeometryTechnique.cpp
|
||||
ReaderWriterOsgTerrain.cpp
|
||||
)
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <osgTerrain/Terrain>
|
||||
#include <osgTerrain/TerrainTile>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
#include <osgTerrain/Terrain>
|
||||
#include <osgTerrain/TerrainTile>
|
||||
|
||||
class ReaderWriterTerrain : public osgDB::ReaderWriter
|
||||
{
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include <osgTerrain/Terrain>
|
||||
#include <osgTerrain/TerrainTile>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
@ -13,16 +13,16 @@
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
bool Terrain_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool Terrain_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
bool TerrainTile_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool TerrainTile_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy Terrain_Proxy
|
||||
osgDB::RegisterDotOsgWrapperProxy TerrainTile_Proxy
|
||||
(
|
||||
new osgTerrain::Terrain,
|
||||
"Terrain",
|
||||
"Object Node Terrain Group",
|
||||
Terrain_readLocalData,
|
||||
Terrain_writeLocalData
|
||||
new osgTerrain::TerrainTile,
|
||||
"TerrainTile",
|
||||
"Object Node TerrainTile Group",
|
||||
TerrainTile_readLocalData,
|
||||
TerrainTile_writeLocalData
|
||||
);
|
||||
|
||||
osg::TransferFunction* readTransferFunction(osgDB::Input& fr)
|
||||
@ -112,9 +112,9 @@ osg::TransferFunction* readTransferFunction(osgDB::Input& fr)
|
||||
}
|
||||
|
||||
|
||||
bool Terrain_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
bool TerrainTile_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
osgTerrain::Terrain& terrain = static_cast<osgTerrain::Terrain&>(obj);
|
||||
osgTerrain::TerrainTile& terrainTile = static_cast<osgTerrain::TerrainTile&>(obj);
|
||||
|
||||
bool itrAdvanced = false;
|
||||
|
||||
@ -122,7 +122,7 @@ bool Terrain_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
if (readObject.valid()) itrAdvanced = true;
|
||||
|
||||
osgTerrain::Locator* locator = dynamic_cast<osgTerrain::Locator*>(readObject.get());
|
||||
if (locator) terrain.setLocator(locator);
|
||||
if (locator) terrainTile.setLocator(locator);
|
||||
|
||||
if (fr.matchSequence("ElevationLayer {"))
|
||||
{
|
||||
@ -158,7 +158,7 @@ bool Terrain_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
if (minLevel!=0) proxyLayer->setMinLevel(minLevel);
|
||||
if (maxLevel!=MAXIMUM_NUMBER_OF_LEVELS) proxyLayer->setMaxLevel(maxLevel);
|
||||
|
||||
terrain.setElevationLayer(proxyLayer);
|
||||
terrainTile.setElevationLayer(proxyLayer);
|
||||
|
||||
fr += 2;
|
||||
|
||||
@ -174,7 +174,7 @@ bool Terrain_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
if (minLevel!=0) readLayer->setMinLevel(minLevel);
|
||||
if (maxLevel!=MAXIMUM_NUMBER_OF_LEVELS) readLayer->setMaxLevel(maxLevel);
|
||||
|
||||
terrain.setElevationLayer(readLayer);
|
||||
terrainTile.setElevationLayer(readLayer);
|
||||
}
|
||||
|
||||
if (readObject.valid()) localAdvanced = true;
|
||||
@ -229,7 +229,7 @@ bool Terrain_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
if (minLevel!=0) proxyLayer->setMinLevel(minLevel);
|
||||
if (maxLevel!=MAXIMUM_NUMBER_OF_LEVELS) proxyLayer->setMaxLevel(maxLevel);
|
||||
|
||||
terrain.setColorLayer(layerNum, proxyLayer);
|
||||
terrainTile.setColorLayer(layerNum, proxyLayer);
|
||||
}
|
||||
|
||||
fr += 2;
|
||||
@ -246,7 +246,7 @@ bool Terrain_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
if (minLevel!=0) readLayer->setMinLevel(minLevel);
|
||||
if (maxLevel!=MAXIMUM_NUMBER_OF_LEVELS) readLayer->setMaxLevel(maxLevel);
|
||||
|
||||
terrain.setColorLayer(layerNum, readLayer);
|
||||
terrainTile.setColorLayer(layerNum, readLayer);
|
||||
}
|
||||
|
||||
if (readObject.valid()) localAdvanced = true;
|
||||
@ -262,7 +262,7 @@ bool Terrain_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
readObject = fr.readObjectOfType(osgDB::type_wrapper<osgTerrain::TerrainTechnique>());
|
||||
if (readObject.valid())
|
||||
{
|
||||
terrain.setTerrainTechnique(dynamic_cast<osgTerrain::TerrainTechnique*>(readObject.get()));
|
||||
terrainTile.setTerrainTechnique(dynamic_cast<osgTerrain::TerrainTechnique*>(readObject.get()));
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
@ -270,25 +270,25 @@ bool Terrain_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
return itrAdvanced;
|
||||
}
|
||||
|
||||
bool Terrain_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
bool TerrainTile_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
const osgTerrain::Terrain& terrain = static_cast<const osgTerrain::Terrain&>(obj);
|
||||
const osgTerrain::TerrainTile& terrainTile = static_cast<const osgTerrain::TerrainTile&>(obj);
|
||||
|
||||
int prec = fw.precision();
|
||||
fw.precision(15);
|
||||
|
||||
if (terrain.getLocator())
|
||||
if (terrainTile.getLocator())
|
||||
{
|
||||
fw.writeObject(*terrain.getLocator());
|
||||
fw.writeObject(*terrainTile.getLocator());
|
||||
}
|
||||
|
||||
if (terrain.getElevationLayer())
|
||||
if (terrainTile.getElevationLayer())
|
||||
{
|
||||
fw.indent()<<"ElevationLayer {"<<std::endl;
|
||||
|
||||
fw.moveIn();
|
||||
|
||||
const osgTerrain::ProxyLayer* proxyLayer = dynamic_cast<const osgTerrain::ProxyLayer*>(terrain.getElevationLayer());
|
||||
const osgTerrain::ProxyLayer* proxyLayer = dynamic_cast<const osgTerrain::ProxyLayer*>(terrainTile.getElevationLayer());
|
||||
if (proxyLayer)
|
||||
{
|
||||
if (!proxyLayer->getFileName().empty())
|
||||
@ -312,9 +312,9 @@ bool Terrain_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
fw.indent()<<"ProxyLayer "<<proxyLayer->getFileName()<<std::endl;
|
||||
}
|
||||
}
|
||||
else if (terrain.getElevationLayer())
|
||||
else if (terrainTile.getElevationLayer())
|
||||
{
|
||||
fw.writeObject(*terrain.getElevationLayer());
|
||||
fw.writeObject(*terrainTile.getElevationLayer());
|
||||
}
|
||||
|
||||
fw.moveOut();
|
||||
@ -322,9 +322,9 @@ bool Terrain_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
fw.indent()<<"}"<<std::endl;
|
||||
}
|
||||
|
||||
for(unsigned int i=0; i<terrain.getNumColorLayers(); ++i)
|
||||
for(unsigned int i=0; i<terrainTile.getNumColorLayers(); ++i)
|
||||
{
|
||||
const osgTerrain::Layer* layer = terrain.getColorLayer(i);
|
||||
const osgTerrain::Layer* layer = terrainTile.getColorLayer(i);
|
||||
if (layer)
|
||||
{
|
||||
if (i>0)
|
||||
@ -361,7 +361,7 @@ bool Terrain_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
}
|
||||
else if (layer)
|
||||
{
|
||||
fw.writeObject(*terrain.getColorLayer(i));
|
||||
fw.writeObject(*terrainTile.getColorLayer(i));
|
||||
}
|
||||
|
||||
fw.moveOut();
|
||||
@ -370,9 +370,9 @@ bool Terrain_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
}
|
||||
}
|
||||
|
||||
if (terrain.getTerrainTechnique())
|
||||
if (terrainTile.getTerrainTechnique())
|
||||
{
|
||||
fw.writeObject(*terrain.getTerrainTechnique());
|
||||
fw.writeObject(*terrainTile.getTerrainTechnique());
|
||||
}
|
||||
|
||||
fw.precision(prec);
|
@ -10,7 +10,7 @@ SET(LIB_PUBLIC_HEADERS
|
||||
${HEADER_PATH}/Export
|
||||
${HEADER_PATH}/Locator
|
||||
${HEADER_PATH}/Layer
|
||||
${HEADER_PATH}/Terrain
|
||||
${HEADER_PATH}/TerrainTile
|
||||
${HEADER_PATH}/TerrainTechnique
|
||||
${HEADER_PATH}/TerrainSystem
|
||||
${HEADER_PATH}/TileSystem
|
||||
@ -25,7 +25,7 @@ ADD_LIBRARY(${LIB_NAME}
|
||||
${LIB_PUBLIC_HEADERS}
|
||||
Layer.cpp
|
||||
Locator.cpp
|
||||
Terrain.cpp
|
||||
TerrainTile.cpp
|
||||
TerrainTechnique.cpp
|
||||
TerrainSystem.cpp
|
||||
TileSystem.cpp
|
||||
|
@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
#include <osgTerrain/GeometryTechnique>
|
||||
#include <osgTerrain/Terrain>
|
||||
#include <osgTerrain/TerrainTile>
|
||||
|
||||
#include <osgUtil/SmoothingVisitor>
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
*/
|
||||
|
||||
#include <osgTerrain/TerrainTechnique>
|
||||
#include <osgTerrain/Terrain>
|
||||
#include <osgTerrain/TerrainTile>
|
||||
|
||||
using namespace osgTerrain;
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#include <osgTerrain/Terrain>
|
||||
#include <osgTerrain/TerrainTile>
|
||||
#include <osgTerrain/TerrainSystem>
|
||||
|
||||
#include <osg/ClusterCullingCallback>
|
||||
@ -19,7 +19,7 @@
|
||||
using namespace osg;
|
||||
using namespace osgTerrain;
|
||||
|
||||
Terrain::Terrain():
|
||||
TerrainTile::TerrainTile():
|
||||
_terrainSystem(0),
|
||||
_hasBeenTraversal(false),
|
||||
_requiresNormals(true),
|
||||
@ -29,7 +29,7 @@ Terrain::Terrain():
|
||||
setThreadSafeRefUnref(true);
|
||||
}
|
||||
|
||||
Terrain::Terrain(const Terrain& terrain,const osg::CopyOp& copyop):
|
||||
TerrainTile::TerrainTile(const TerrainTile& terrain,const osg::CopyOp& copyop):
|
||||
Group(terrain,copyop),
|
||||
_terrainSystem(0),
|
||||
_hasBeenTraversal(false),
|
||||
@ -43,11 +43,11 @@ Terrain::Terrain(const Terrain& terrain,const osg::CopyOp& copyop):
|
||||
if (terrain.getTerrainTechnique()) setTerrainTechnique(dynamic_cast<TerrainTechnique*>(terrain.getTerrainTechnique()->cloneType()));
|
||||
}
|
||||
|
||||
Terrain::~Terrain()
|
||||
TerrainTile::~TerrainTile()
|
||||
{
|
||||
}
|
||||
|
||||
void Terrain::traverse(osg::NodeVisitor& nv)
|
||||
void TerrainTile::traverse(osg::NodeVisitor& nv)
|
||||
{
|
||||
if (!_hasBeenTraversal)
|
||||
{
|
||||
@ -63,7 +63,7 @@ void Terrain::traverse(osg::NodeVisitor& nv)
|
||||
osgTerrain::TerrainSystem* ts = dynamic_cast<TerrainSystem*>(*itr);
|
||||
if (ts)
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Assigning terrain system "<<ts<<std::endl;
|
||||
osg::notify(osg::INFO)<<"Assigning terrain system "<<ts<<std::endl;
|
||||
_terrainSystem = ts;
|
||||
}
|
||||
}
|
||||
@ -92,7 +92,7 @@ void Terrain::traverse(osg::NodeVisitor& nv)
|
||||
}
|
||||
}
|
||||
|
||||
void Terrain::init()
|
||||
void TerrainTile::init()
|
||||
{
|
||||
if (_terrainTechnique.valid() && _terrainTechnique->isDirty())
|
||||
{
|
||||
@ -100,8 +100,7 @@ void Terrain::init()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Terrain::setTerrainTechnique(osgTerrain::TerrainTechnique* terrainTechnique)
|
||||
void TerrainTile::setTerrainTechnique(TerrainTechnique* terrainTechnique)
|
||||
{
|
||||
if (_terrainTechnique == terrainTechnique) return;
|
||||
|
||||
@ -114,19 +113,19 @@ void Terrain::setTerrainTechnique(osgTerrain::TerrainTechnique* terrainTechnique
|
||||
}
|
||||
|
||||
|
||||
void Terrain::setElevationLayer(osgTerrain::Layer* layer)
|
||||
void TerrainTile::setElevationLayer(Layer* layer)
|
||||
{
|
||||
_elevationLayer = layer;
|
||||
}
|
||||
|
||||
void Terrain::setColorLayer(unsigned int i, osgTerrain::Layer* layer)
|
||||
void TerrainTile::setColorLayer(unsigned int i, Layer* layer)
|
||||
{
|
||||
if (_colorLayers.size() <= i) _colorLayers.resize(i+1);
|
||||
|
||||
_colorLayers[i] = layer;
|
||||
}
|
||||
|
||||
osg::BoundingSphere Terrain::computeBound() const
|
||||
osg::BoundingSphere TerrainTile::computeBound() const
|
||||
{
|
||||
osg::BoundingSphere bs;
|
||||
|
Loading…
Reference in New Issue
Block a user