Added support for reading and writing the Terrain's Locator

This commit is contained in:
Robert Osfield 2008-01-08 16:09:01 +00:00
parent dc79b6bb4d
commit d7d1b382b7
3 changed files with 9 additions and 3 deletions

View File

@ -20,7 +20,7 @@ osgDB::RegisterDotOsgWrapperProxy HeightFieldLayer_Proxy
(
new osgTerrain::HeightFieldLayer,
"HeightFieldLayer",
"Object HeightFieldLayer Layer",
"Object Layer HeightFieldLayer",
HeightFieldLayer_readLocalData,
HeightFieldLayer_writeLocalData
);

View File

@ -20,7 +20,7 @@ osgDB::RegisterDotOsgWrapperProxy ImageLayer_Proxy
(
new osgTerrain::ImageLayer,
"ImageLayer",
"Object ImageLayer Layer",
"Object Layer ImageLayer",
ImageLayer_readLocalData,
ImageLayer_writeLocalData
);

View File

@ -118,6 +118,12 @@ bool Terrain_readLocalData(osg::Object& obj, osgDB::Input &fr)
bool itrAdvanced = false;
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgTerrain::Locator>());
if (readObject.valid()) itrAdvanced = true;
osgTerrain::Locator* locator = dynamic_cast<osgTerrain::Locator*>(readObject.get());
if (locator) terrain.setLocator(locator);
if (fr.matchSequence("ElevationLayer {"))
{
int entry = fr[0].getNoNestedBrackets();
@ -289,7 +295,7 @@ bool Terrain_readLocalData(osg::Object& obj, osgDB::Input &fr)
itrAdvanced = true;
}
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgTerrain::TerrainTechnique>());
readObject = fr.readObjectOfType(osgDB::type_wrapper<osgTerrain::TerrainTechnique>());
if (readObject.valid())
{
terrain.setTerrainTechnique(dynamic_cast<osgTerrain::TerrainTechnique*>(readObject.get()));