Added support for ClipNode in the .osg plugin.
This commit is contained in:
@@ -110,6 +110,10 @@ SOURCE=..\..\..\src\osgPlugins\osg\ClipPlane.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\osg\ClipNode.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=..\..\..\src\osgPlugins\osg\ColorMask.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
52
src/osgPlugins/osg/ClipNode.cpp
Normal file
52
src/osgPlugins/osg/ClipNode.cpp
Normal file
@@ -0,0 +1,52 @@
|
||||
#include "osg/ClipNode"
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
|
||||
// forward declare functions to use later.
|
||||
bool ClipNode_readLocalData(Object& obj, Input& fr);
|
||||
bool ClipNode_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
RegisterDotOsgWrapperProxy g_ClipNodeProxy
|
||||
(
|
||||
new osg::ClipNode,
|
||||
"ClipNode",
|
||||
"Object Node ClipNode",
|
||||
&ClipNode_readLocalData,
|
||||
&ClipNode_writeLocalData
|
||||
);
|
||||
|
||||
bool ClipNode_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
ClipNode& clipnode = static_cast<ClipNode&>(obj);
|
||||
|
||||
StateAttribute* sa=0;
|
||||
while((sa=fr.readStateAttribute())!=0)
|
||||
{
|
||||
ClipPlane* clipplane = dynamic_cast<ClipPlane*>(sa);
|
||||
if (clipplane) clipnode.addClipPlane(clipplane);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool ClipNode_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const ClipNode& clipnode = static_cast<const ClipNode&>(obj);
|
||||
|
||||
for(unsigned int i=0;i<clipnode.getNumClipPlanes();++i)
|
||||
{
|
||||
fw.writeObject(*clipnode.getClipPlane(i));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -10,6 +10,7 @@ CXXFILES =\
|
||||
ColorMask.cpp\
|
||||
ConvexPlanarOccluder.cpp\
|
||||
CullFace.cpp\
|
||||
ClipNode.cpp\
|
||||
Depth.cpp\
|
||||
DOFTransform.cpp\
|
||||
Drawable.cpp\
|
||||
|
||||
Reference in New Issue
Block a user