OpenSceneGraph/src/osgPlugins/osg/OccluderNode.cpp
Robert Osfield 00cc3a1833 Converted the instance of osgNew and osgDelete back to new and delete as part
of depecating the include/osg/MemoryManager
2002-12-16 13:40:58 +00:00

55 lines
1.3 KiB
C++

#include "osg/OccluderNode"
#include "osgDB/Registry"
#include "osgDB/Input"
#include "osgDB/Output"
using namespace osg;
using namespace osgDB;
// forward declare functions to use later.
bool OccluderNode_readLocalData(Object& obj, Input& fr);
bool OccluderNode_writeLocalData(const Object& obj, Output& fw);
// register the read and write functions with the osgDB::Registry.
RegisterDotOsgWrapperProxy g_OccluderNodeProxy
(
new osg::OccluderNode,
"OccluderNode",
"Object Node OccluderNode Group",
&OccluderNode_readLocalData,
&OccluderNode_writeLocalData
);
bool OccluderNode_readLocalData(Object& obj, Input& fr)
{
bool iteratorAdvanced = false;
OccluderNode& occludernode = static_cast<OccluderNode&>(obj);
static ref_ptr<ConvexPlanarOccluder> s_occluder = new ConvexPlanarOccluder;
ConvexPlanarOccluder* tmpOccluder = static_cast<ConvexPlanarOccluder*>(fr.readObjectOfType(*s_occluder));
if (tmpOccluder)
{
occludernode.setOccluder(tmpOccluder);
iteratorAdvanced = true;
}
return iteratorAdvanced;
}
bool OccluderNode_writeLocalData(const Object& obj, Output& fw)
{
const OccluderNode& occludernode = static_cast<const OccluderNode&>(obj);
if (occludernode.getOccluder())
{
fw.writeObject(*occludernode.getOccluder());
}
return true;
}