Ground work for full .osg support for osg::TransferFunction*

This commit is contained in:
Robert Osfield
2009-02-01 12:38:55 +00:00
parent a13c6405d8
commit d6b0cd64f1
5 changed files with 93 additions and 1 deletions

View File

@@ -32,6 +32,12 @@ bool TransferFunctionProperty_readLocalData(osg::Object& obj, osgDB::Input &fr)
bool itrAdvanced = false;
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osg::TransferFunction>());
if (readObject.valid()) itrAdvanced = true;
osg::TransferFunction* tf = dynamic_cast<osg::TransferFunction*>(readObject.get());
if (tf) tfp.setTransferFunction(tf);
return itrAdvanced;
}
@@ -39,5 +45,8 @@ bool TransferFunctionProperty_writeLocalData(const osg::Object& obj, osgDB::Outp
{
const osgVolume::TransferFunctionProperty& tfp = static_cast<const osgVolume::TransferFunctionProperty&>(obj);
const osg::TransferFunction* tf = tfp.getTransferFunction();
if (tf) fw.writeObject(*tf);
return true;
}