From 319e84ceed018d6cd00d440ccc054c6dee6c82f2 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 13 Feb 2003 15:37:32 +0000 Subject: [PATCH] Added support for ClipNode in the .osg plugin. --- VisualStudio/osgPlugins/osg/dot_osg.dsp | 4 ++ src/osgPlugins/osg/ClipNode.cpp | 52 +++++++++++++++++++++++++ src/osgPlugins/osg/Makefile | 1 + 3 files changed, 57 insertions(+) create mode 100644 src/osgPlugins/osg/ClipNode.cpp diff --git a/VisualStudio/osgPlugins/osg/dot_osg.dsp b/VisualStudio/osgPlugins/osg/dot_osg.dsp index 582d51cc5..153f252b1 100755 --- a/VisualStudio/osgPlugins/osg/dot_osg.dsp +++ b/VisualStudio/osgPlugins/osg/dot_osg.dsp @@ -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 diff --git a/src/osgPlugins/osg/ClipNode.cpp b/src/osgPlugins/osg/ClipNode.cpp new file mode 100644 index 000000000..586cbdd1e --- /dev/null +++ b/src/osgPlugins/osg/ClipNode.cpp @@ -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(obj); + + StateAttribute* sa=0; + while((sa=fr.readStateAttribute())!=0) + { + ClipPlane* clipplane = dynamic_cast(sa); + if (clipplane) clipnode.addClipPlane(clipplane); + iteratorAdvanced = true; + } + + return iteratorAdvanced; +} + + +bool ClipNode_writeLocalData(const Object& obj, Output& fw) +{ + const ClipNode& clipnode = static_cast(obj); + + for(unsigned int i=0;i