Added osgVolume .osg plugin
This commit is contained in:
56
src/osgPlugins/osgVolume/Volume.cpp
Normal file
56
src/osgPlugins/osgVolume/Volume.cpp
Normal file
@@ -0,0 +1,56 @@
|
||||
#include <osgVolume/Volume>
|
||||
|
||||
#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 Volume_readLocalData(osg::Object &obj, osgDB::Input &fr);
|
||||
bool Volume_writeLocalData(const osg::Object &obj, osgDB::Output &fw);
|
||||
|
||||
osgDB::RegisterDotOsgWrapperProxy Volume_Proxy
|
||||
(
|
||||
new osgVolume::Volume,
|
||||
"Volume",
|
||||
"Object Node Volume Group",
|
||||
Volume_readLocalData,
|
||||
Volume_writeLocalData
|
||||
);
|
||||
|
||||
bool Volume_readLocalData(osg::Object& obj, osgDB::Input &fr)
|
||||
{
|
||||
osgVolume::Volume& volume = static_cast<osgVolume::Volume&>(obj);
|
||||
|
||||
bool itrAdvanced = false;
|
||||
|
||||
osg::ref_ptr<osg::Object> readObject = fr.readObjectOfType(osgDB::type_wrapper<osgVolume::VolumeTechnique>());
|
||||
if (readObject.valid())
|
||||
{
|
||||
volume.setVolumeTechnique(dynamic_cast<osgVolume::VolumeTechnique*>(readObject.get()));
|
||||
itrAdvanced = true;
|
||||
}
|
||||
|
||||
return itrAdvanced;
|
||||
}
|
||||
|
||||
bool Volume_writeLocalData(const osg::Object& obj, osgDB::Output& fw)
|
||||
{
|
||||
const osgVolume::Volume& volume = static_cast<const osgVolume::Volume&>(obj);
|
||||
|
||||
osg::notify(osg::NOTICE)<<"Volume write"<<std::endl;
|
||||
|
||||
if (volume.getVolumeTechnique())
|
||||
{
|
||||
fw.writeObject(*volume.getVolumeTechnique());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
Reference in New Issue
Block a user