Added Locator::s/getTransformScaledByResolution(bool) to assist with VPB integration

This commit is contained in:
Robert Osfield 2007-12-13 17:51:43 +00:00
parent 3bfa74222b
commit f7e91fa28e
3 changed files with 20 additions and 3 deletions

View File

@ -105,6 +105,9 @@ class OSGTERRAIN_EXPORT Locator : public osg::Object
void setDefinedInFile(bool flag) { _definedInFile = flag; } void setDefinedInFile(bool flag) { _definedInFile = flag; }
bool getDefinedInFile() const { return _definedInFile; } bool getDefinedInFile() const { return _definedInFile; }
void setTransformScaledByResolution(bool scaledByResolution) { _transformScaledByResolution = scaledByResolution; }
bool getTransformScaledByResolution() const { return _transformScaledByResolution; }
protected: protected:
@ -120,6 +123,7 @@ class OSGTERRAIN_EXPORT Locator : public osg::Object
osg::Matrixd _inverse; osg::Matrixd _inverse;
bool _definedInFile; bool _definedInFile;
bool _transformScaledByResolution;
}; };

View File

@ -79,6 +79,8 @@ osgTerrain::Layer* readLayer(osgDB::Input& fr, bool& itrAdvanced)
fr += 2; fr += 2;
localAdvanced = true; localAdvanced = true;
} }
if (fr.matchSequence("CoordinateSystem %w") || fr.matchSequence("CoordinateSystem %s") ) if (fr.matchSequence("CoordinateSystem %w") || fr.matchSequence("CoordinateSystem %s") )
@ -89,6 +91,13 @@ osgTerrain::Layer* readLayer(osgDB::Input& fr, bool& itrAdvanced)
localAdvanced = true; localAdvanced = true;
} }
if (fr.matchSequence("TransformScaledByResolution %w"))
{
locator->setTransformScaledByResolution(fr[1].matchWord("TRUE") || fr[1].matchWord("True") || fr[1].matchWord("true"));
fr += 2;
localAdvanced = true;
}
if (fr.matchSequence("Transform {")) if (fr.matchSequence("Transform {"))
{ {
int tansform_entry = fr[0].getNoNestedBrackets(); int tansform_entry = fr[0].getNoNestedBrackets();
@ -518,7 +527,9 @@ bool writeLocator(const osgTerrain::Locator& locator, osgDB::Output& fw)
fw<<"PROJECTED"<<std::endl; fw<<"PROJECTED"<<std::endl;
break; break;
} }
} }
fw.indent()<<"TransformScaledByResolution " << (locator.getTransformScaledByResolution() ? "TRUE":"FALSE") <<std::endl;
const osg::Matrixd& matrix = locator.getTransform(); const osg::Matrixd& matrix = locator.getTransform();
fw.indent() << "Transform {" << std::endl; fw.indent() << "Transform {" << std::endl;

View File

@ -25,7 +25,8 @@ using namespace osgTerrain;
Locator::Locator(): Locator::Locator():
_coordinateSystemType(PROJECTED), _coordinateSystemType(PROJECTED),
_ellipsoidModel(new osg::EllipsoidModel()), _ellipsoidModel(new osg::EllipsoidModel()),
_definedInFile(false) _definedInFile(false),
_transformScaledByResolution(false)
{ {
} }
@ -36,7 +37,8 @@ Locator::Locator(const Locator& locator,const osg::CopyOp& copyop):
_format(locator._format), _format(locator._format),
_cs(locator._cs), _cs(locator._cs),
_transform(locator._transform), _transform(locator._transform),
_definedInFile(locator._definedInFile) _definedInFile(locator._definedInFile),
_transformScaledByResolution(locator._transformScaledByResolution)
{ {
} }