Seperated out GeometryTechnique .osg support.

This commit is contained in:
Robert Osfield 2007-09-11 13:32:46 +00:00
parent c51e893ba4
commit 884b3b7aa2
4 changed files with 48 additions and 9 deletions

View File

@ -32,6 +32,8 @@ class OSGTERRAIN_EXPORT GeometryTechnique : public TerrainTechnique
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/ /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
GeometryTechnique(const GeometryTechnique&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY); GeometryTechnique(const GeometryTechnique&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
META_Object(osgTerrain, GeometryTechnique);
virtual void init(); virtual void init();
virtual Locator* computeMasterLocator(); virtual Locator* computeMasterLocator();

View File

@ -3,6 +3,7 @@
SET(TARGET_SRC SET(TARGET_SRC
Terrain.cpp Terrain.cpp
GeometryTechnique.cpp
ReaderWriterOsgTerrain.cpp ReaderWriterOsgTerrain.cpp
) )

View File

@ -0,0 +1,40 @@
#include <osgTerrain/GeometryTechnique>
#include <iostream>
#include <string>
#include <osg/Vec3>
#include <osg/Vec4>
#include <osg/io_utils>
#include <osgDB/ReadFile>
#include <osgDB/Registry>
#include <osgDB/Input>
#include <osgDB/Output>
#include <osgDB/ParameterOutput>
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<osgTerrain::GeometryTechnique&>(obj);
bool itrAdvanced = false;
return itrAdvanced;
}
bool GeometryTechnique_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
{
const osgTerrain::GeometryTechnique& gt = static_cast<const osgTerrain::GeometryTechnique&>(obj);
return true;
}

View File

@ -1,5 +1,4 @@
#include <osgTerrain/Terrain> #include <osgTerrain/Terrain>
#include <osgTerrain/GeometryTechnique>
#include <iostream> #include <iostream>
#include <string> #include <string>
@ -470,17 +469,14 @@ bool Terrain_readLocalData(osg::Object& obj, osgDB::Input &fr)
itrAdvanced = true; itrAdvanced = true;
} }
if (fr.matchSequence("TerrainTechnique %w") || fr.matchSequence("TerrainTechnique %s")) osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgTerrain::TerrainTechnique>());
if (readObject.valid())
{ {
if (fr[1].matchWord("GeometryTechnique")) terrain.setTerrainTechnique(dynamic_cast<osgTerrain::TerrainTechnique*>(readObject.get()));
{
terrain.setTerrainTechnique(new osgTerrain::GeometryTechnique);
}
fr += 2;
itrAdvanced = true; itrAdvanced = true;
} }
return itrAdvanced; return itrAdvanced;
} }
@ -635,7 +631,7 @@ bool Terrain_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
if (terrain.getTerrainTechnique()) if (terrain.getTerrainTechnique())
{ {
fw.indent()<<"TerrainTechnique "<<terrain.getTerrainTechnique()->className()<<std::endl; fw.writeObject(*terrain.getTerrainTechnique());
} }
fw.precision(prec); fw.precision(prec);