From 884b3b7aa2148535e9f5bcb48dc1bb1ed569ee17 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 11 Sep 2007 13:32:46 +0000 Subject: [PATCH] Seperated out GeometryTechnique .osg support. --- include/osgTerrain/GeometryTechnique | 2 + src/osgPlugins/osgTerrain/CMakeLists.txt | 1 + .../osgTerrain/GeometryTechnique.cpp | 40 +++++++++++++++++++ src/osgPlugins/osgTerrain/Terrain.cpp | 14 +++---- 4 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 src/osgPlugins/osgTerrain/GeometryTechnique.cpp diff --git a/include/osgTerrain/GeometryTechnique b/include/osgTerrain/GeometryTechnique index 3055f4558..03c21d208 100644 --- a/include/osgTerrain/GeometryTechnique +++ b/include/osgTerrain/GeometryTechnique @@ -32,6 +32,8 @@ class OSGTERRAIN_EXPORT GeometryTechnique : public TerrainTechnique /** Copy constructor using CopyOp to manage deep vs shallow copy.*/ GeometryTechnique(const GeometryTechnique&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); + META_Object(osgTerrain, GeometryTechnique); + virtual void init(); virtual Locator* computeMasterLocator(); diff --git a/src/osgPlugins/osgTerrain/CMakeLists.txt b/src/osgPlugins/osgTerrain/CMakeLists.txt index f94fc0af5..5a5d6889b 100644 --- a/src/osgPlugins/osgTerrain/CMakeLists.txt +++ b/src/osgPlugins/osgTerrain/CMakeLists.txt @@ -3,6 +3,7 @@ SET(TARGET_SRC Terrain.cpp + GeometryTechnique.cpp ReaderWriterOsgTerrain.cpp ) diff --git a/src/osgPlugins/osgTerrain/GeometryTechnique.cpp b/src/osgPlugins/osgTerrain/GeometryTechnique.cpp new file mode 100644 index 000000000..9307129d5 --- /dev/null +++ b/src/osgPlugins/osgTerrain/GeometryTechnique.cpp @@ -0,0 +1,40 @@ +#include + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +bool GeometryTechnique_readLocalData(osg::Object &obj, osgDB::Input &fr); +bool GeometryTechnique_writeLocalData(const osg::Object &obj, osgDB::Output &fw); + +osgDB::RegisterDotOsgWrapperProxy GeometryTechnique_Proxy +( + new osgTerrain::GeometryTechnique, + "GeometryTechnique", + "GeometryTechnique Object", + GeometryTechnique_readLocalData, + GeometryTechnique_writeLocalData +); + + +bool GeometryTechnique_readLocalData(osg::Object& obj, osgDB::Input &fr) +{ + osgTerrain::GeometryTechnique& gt = static_cast(obj); + bool itrAdvanced = false; + return itrAdvanced; +} + +bool GeometryTechnique_writeLocalData(const osg::Object& obj, osgDB::Output& fw) +{ + const osgTerrain::GeometryTechnique& gt = static_cast(obj); + return true; +} diff --git a/src/osgPlugins/osgTerrain/Terrain.cpp b/src/osgPlugins/osgTerrain/Terrain.cpp index 31c1712c1..a8e7a1563 100644 --- a/src/osgPlugins/osgTerrain/Terrain.cpp +++ b/src/osgPlugins/osgTerrain/Terrain.cpp @@ -1,5 +1,4 @@ #include -#include #include #include @@ -470,17 +469,14 @@ bool Terrain_readLocalData(osg::Object& obj, osgDB::Input &fr) itrAdvanced = true; } - if (fr.matchSequence("TerrainTechnique %w") || fr.matchSequence("TerrainTechnique %s")) + osg::ref_ptr readObject = fr.readObjectOfType(osgDB::type_wrapper()); + if (readObject.valid()) { - if (fr[1].matchWord("GeometryTechnique")) - { - terrain.setTerrainTechnique(new osgTerrain::GeometryTechnique); - } - - fr += 2; + terrain.setTerrainTechnique(dynamic_cast(readObject.get())); itrAdvanced = true; } + return itrAdvanced; } @@ -635,7 +631,7 @@ bool Terrain_writeLocalData(const osg::Object& obj, osgDB::Output& fw) if (terrain.getTerrainTechnique()) { - fw.indent()<<"TerrainTechnique "<className()<