From 1ebddc2af7055c031f020e6881993d3efc728623 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 3 Oct 2001 07:56:33 +0000 Subject: [PATCH] Added missing EarthSky.cpp file to osg plguin. --- src/osgPlugins/osg/EarthSky.cpp | 80 +++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 src/osgPlugins/osg/EarthSky.cpp diff --git a/src/osgPlugins/osg/EarthSky.cpp b/src/osgPlugins/osg/EarthSky.cpp new file mode 100644 index 000000000..78baad509 --- /dev/null +++ b/src/osgPlugins/osg/EarthSky.cpp @@ -0,0 +1,80 @@ +#include "osg/EarthSky" + +#include "osgDB/Registry" +#include "osgDB/Input" +#include "osgDB/Output" + +using namespace osg; +using namespace osgDB; + +// forward declare functions to use later. +bool EarthSky_readLocalData(Object& obj, Input& fr); +bool EarthSky_writeLocalData(const Object& obj, Output& fw); + +// register the read and write functions with the osgDB::Registry. +RegisterDotOsgWrapperProxy g_EarthSkyProxy +( + new osg::EarthSky, + "EarthSky", + "Object Node EarthSky Group", + &EarthSky_readLocalData, + &EarthSky_writeLocalData +); + +bool EarthSky_readLocalData(Object& obj, Input& fr) +{ + bool iteratorAdvanced = false; + + EarthSky& es = static_cast(obj); + + if (fr.matchSequence("requiresClear")) + { + if (fr[1].matchWord("TRUE")) + { + es.setRequiresClear(true); + iteratorAdvanced = true; + fr+=2; + } + else if (fr[1].matchWord("FALSE")) + { + es.setRequiresClear(false); + iteratorAdvanced = true; + fr+=2; + } + } + + osg::Vec4 vec4(0.0f,0.0f,0.0f,1.0f); + + if (fr[0].matchWord("clearColor") && + fr[1].getFloat(vec4[0]) && + fr[2].getFloat(vec4[1]) && + fr[3].getFloat(vec4[2]) && + fr[4].getFloat(vec4[3])) + { + es.setClearColor(vec4); + fr+=5; + iteratorAdvanced = true; + } + + return iteratorAdvanced; +} + + +bool EarthSky_writeLocalData(const Object& obj, Output& fw) +{ + const EarthSky& es = static_cast(obj); + + fw.indent() << "requiresClear "; + if (es.getRequiresClear()) + { + fw<<"TRUE"<