diff --git a/src/osgDB/Registry.cpp b/src/osgDB/Registry.cpp index f8b86754a..744d66a10 100644 --- a/src/osgDB/Registry.cpp +++ b/src/osgDB/Registry.cpp @@ -912,7 +912,11 @@ osg::Object* Registry::readObjectOfType(const basic_type_wrapper &btw,Input& fr) if (loadLibrary(nodeKitLibraryName)==LOADED) return readObjectOfType(btw,fr); // otherwise try the osgdb_ plugin library. - std::string pluginLibraryName = createLibraryNameForExtension(libraryName); + std::string pluginLibraryName = createLibraryNameForExtension(std::string("deprecated_")+libraryName); + if (loadLibrary(pluginLibraryName)==LOADED) return readObjectOfType(btw,fr); + + // otherwise try the osgdb_ plugin library. + pluginLibraryName = createLibraryNameForExtension(libraryName); if (loadLibrary(pluginLibraryName)==LOADED) return readObjectOfType(btw,fr); } } diff --git a/src/osgPlugins/CMakeLists.txt b/src/osgPlugins/CMakeLists.txt index 908aea3e0..aaf671d02 100644 --- a/src/osgPlugins/CMakeLists.txt +++ b/src/osgPlugins/CMakeLists.txt @@ -36,22 +36,15 @@ SET(TARGET_COMMON_LIBRARIES # # NodeKit/Psudo loader plugins # -ADD_SUBDIRECTORY(osgAnimation) -ADD_SUBDIRECTORY(osgFX) -ADD_SUBDIRECTORY(osgParticle) -ADD_SUBDIRECTORY(osgSim) -ADD_SUBDIRECTORY(osgText) -ADD_SUBDIRECTORY(osgViewer) -ADD_SUBDIRECTORY(osgShadow) -ADD_SUBDIRECTORY(osgTerrain) -ADD_SUBDIRECTORY(osgVolume) -ADD_SUBDIRECTORY(osgWidget) ADD_SUBDIRECTORY(osga) ADD_SUBDIRECTORY(rot) ADD_SUBDIRECTORY(scale) ADD_SUBDIRECTORY(trans) ADD_SUBDIRECTORY(normals) ADD_SUBDIRECTORY(revisions) +ADD_SUBDIRECTORY(view) +ADD_SUBDIRECTORY(shadow) +ADD_SUBDIRECTORY(terrain) ############################################################ # diff --git a/src/osgPlugins/osg/AlphaFunc.cpp b/src/osgPlugins/osg/AlphaFunc.cpp deleted file mode 100644 index cb4175244..000000000 --- a/src/osgPlugins/osg/AlphaFunc.cpp +++ /dev/null @@ -1,94 +0,0 @@ -#include "osg/AlphaFunc" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -#include - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool AlphaFunc_readLocalData(Object& obj, Input& fr); -bool AlphaFunc_writeLocalData(const Object& obj, Output& fw); -bool AlphaFunc_matchFuncStr(const char* str,AlphaFunc::ComparisonFunction& func); -const char* AlphaFunc_getFuncStr(AlphaFunc::ComparisonFunction func); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(AlphaFunc) -( - new osg::AlphaFunc, - "AlphaFunc", - "Object StateAttribute AlphaFunc", - &AlphaFunc_readLocalData, - &AlphaFunc_writeLocalData -); - - -bool AlphaFunc_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - AlphaFunc& alphaFunc = static_cast(obj); - - AlphaFunc::ComparisonFunction func = alphaFunc.getFunction(); - if (fr[0].matchWord("comparisonFunc") && AlphaFunc_matchFuncStr(fr[1].getStr(),func)) - { - fr+=2; - iteratorAdvanced = true; - } - - float ref = alphaFunc.getReferenceValue(); - if (fr[0].matchWord("referenceValue") && fr[1].getFloat(ref)) - { - fr+=2; - iteratorAdvanced = true; - } - - if (iteratorAdvanced) alphaFunc.setFunction(func,ref); - - return iteratorAdvanced; -} - - -bool AlphaFunc_writeLocalData(const Object& obj,Output& fw) -{ - const AlphaFunc& alphaFunc = static_cast(obj); - - fw.indent() << "comparisonFunc " << AlphaFunc_getFuncStr(alphaFunc.getFunction()) << std::endl; - fw.indent() << "referenceValue " << alphaFunc.getReferenceValue() << std::endl; - return true; -} - - -bool AlphaFunc_matchFuncStr(const char* str,AlphaFunc::ComparisonFunction& func) -{ - if (strcmp(str,"NEVER")==0) func = AlphaFunc::NEVER; - else if (strcmp(str,"LESS")==0) func = AlphaFunc::LESS; - else if (strcmp(str,"EQUAL")==0) func = AlphaFunc::EQUAL; - else if (strcmp(str,"LEQUAL")==0) func = AlphaFunc::LEQUAL; - else if (strcmp(str,"GREATER")==0) func = AlphaFunc::GREATER; - else if (strcmp(str,"NOTEQUAL")==0) func = AlphaFunc::NOTEQUAL; - else if (strcmp(str,"GEQUAL")==0) func = AlphaFunc::GEQUAL; - else if (strcmp(str,"ALWAYS")==0) func = AlphaFunc::ALWAYS; - else return false; - return true; -} - - -const char* AlphaFunc_getFuncStr(AlphaFunc::ComparisonFunction func) -{ - switch(func) - { - case(AlphaFunc::NEVER): return "NEVER"; - case(AlphaFunc::LESS): return "LESS"; - case(AlphaFunc::EQUAL): return "EQUAL"; - case(AlphaFunc::LEQUAL): return "LEQUAL"; - case(AlphaFunc::GREATER): return "GREATER"; - case(AlphaFunc::NOTEQUAL): return "NOTEQUAL"; - case(AlphaFunc::GEQUAL): return "GEQUAL"; - case(AlphaFunc::ALWAYS): return "ALWAYS"; - } - return ""; -} diff --git a/src/osgPlugins/osg/AnimationPath.cpp b/src/osgPlugins/osg/AnimationPath.cpp deleted file mode 100644 index 5af82eaba..000000000 --- a/src/osgPlugins/osg/AnimationPath.cpp +++ /dev/null @@ -1,232 +0,0 @@ -#include -#include -#include -#include - -#include -#include -#include - -using namespace osg; -using namespace osgDB; - - -// forward declare functions to use later. -bool AnimationPath_readLocalData(osg::Object &obj, osgDB::Input &fr); -bool AnimationPath_writeLocalData(const osg::Object &obj, osgDB::Output &fw); - - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(AnimationPath) -( - new osg::AnimationPath, - "AnimationPath", - "Object AnimationPath", - AnimationPath_readLocalData, - AnimationPath_writeLocalData, - DotOsgWrapper::READ_AND_WRITE -); - - -bool AnimationPath_readLocalData(osg::Object &obj, osgDB::Input &fr) -{ - osg::AnimationPath *ap = dynamic_cast(&obj); - if (!ap) return false; - - - bool itAdvanced = false; - - if (fr[0].matchWord("LoopMode")) - { - if (fr[1].matchWord("SWING")) - { - ap->setLoopMode(AnimationPath::SWING); - fr += 2; - itAdvanced = true; - } - else if (fr[1].matchWord("LOOP")) - { - ap->setLoopMode(AnimationPath::LOOP); - fr += 2; - itAdvanced = true; - } - else if (fr[1].matchWord("NO_LOOPING")) - { - ap->setLoopMode(AnimationPath::NO_LOOPING); - fr += 2; - itAdvanced = true; - } - } - - - - if (fr.matchSequence("ControlPoints {")) - { - int entry = fr[0].getNoNestedBrackets(); - - fr += 2; - - - double time; - Vec3d position,scale; - Quat rotation; - - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - if (fr[0].getFloat(time) && - fr[1].getFloat(position[0]) && - fr[2].getFloat(position[1]) && - fr[3].getFloat(position[2]) && - fr[4].getFloat(rotation[0]) && - fr[5].getFloat(rotation[1]) && - fr[6].getFloat(rotation[2]) && - fr[7].getFloat(rotation[3]) && - fr[8].getFloat(scale[0]) && - fr[9].getFloat(scale[1]) && - fr[10].getFloat(scale[2])) - { - - - osg::AnimationPath::ControlPoint ctrlPoint(position,rotation,scale); - ap->insert(time, ctrlPoint); - - fr+=11; - } - else fr.advanceOverCurrentFieldOrBlock(); - - } - - itAdvanced = true; - - } - - return itAdvanced; -} - - -bool AnimationPath_writeLocalData(const osg::Object &obj, osgDB::Output &fw) -{ - const osg::AnimationPath* ap = dynamic_cast(&obj); - if (!ap) return false; - - fw.indent() << "LoopMode "; - switch(ap->getLoopMode()) - { - case AnimationPath::SWING: - fw << "SWING" <getTimeControlPointMap(); - - fw.indent() << "ControlPoints {"<< std::endl; - fw.moveIn(); - - int prec = fw.precision(); - fw.precision(15); - - for (AnimationPath::TimeControlPointMap::const_iterator itr=tcpm.begin(); - itr!=tcpm.end(); - ++itr) - { - fw.indent() << itr->first << " " << itr->second.getPosition() << " " << itr->second.getRotation() << " " <second.getScale() << std::endl; - - } - - fw.precision(prec); - - fw.moveOut(); - fw.indent() << "}"<< std::endl; - - return true; -} - - -// forward declare functions to use later. -bool AnimationPathCallback_readLocalData(osg::Object &obj, osgDB::Input &fr); -bool AnimationPathCallback_writeLocalData(const osg::Object &obj, osgDB::Output &fw); - - -// register the read and write functions with the osgDB::Registry. -osgDB::RegisterDotOsgWrapperProxy AnimationPathCallback_Proxy -( - new osg::AnimationPathCallback, - "AnimationPathCallback", - "Object AnimationPathCallback", - AnimationPathCallback_readLocalData, - AnimationPathCallback_writeLocalData, - DotOsgWrapper::READ_AND_WRITE -); - -bool AnimationPathCallback_readLocalData(osg::Object &obj, osgDB::Input &fr) -{ - osg::AnimationPathCallback *apc = dynamic_cast(&obj); - if (!apc) return false; - - bool iteratorAdvanced = false; - - if (fr.matchSequence("pivotPoint %f %f %f")) - { - osg::Vec3 pivot; - fr[1].getFloat(pivot[0]); - fr[2].getFloat(pivot[1]); - fr[3].getFloat(pivot[2]); - - apc->setPivotPoint(pivot); - - fr += 4; - iteratorAdvanced = true; - } - - if (fr.matchSequence("timeOffset %f")) - { - fr[1].getFloat(apc->_timeOffset); - fr+=2; - iteratorAdvanced = true; - } - - else if(fr.matchSequence("timeMultiplier %f")) - { - fr[1].getFloat(apc->_timeMultiplier); - fr+=2; - iteratorAdvanced = true; - } - - static osg::ref_ptr s_path = new osg::AnimationPath; - ref_ptr object = fr.readObjectOfType(*s_path); - if (object.valid()) - { - osg::AnimationPath* animpath = dynamic_cast(object.get()); - if (animpath) apc->setAnimationPath(animpath); - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - - -bool AnimationPathCallback_writeLocalData(const osg::Object &obj, osgDB::Output &fw) -{ - - - const osg::AnimationPathCallback* apc = dynamic_cast(&obj); - if (!apc) return false; - - - fw.indent() <<"pivotPoint " <getPivotPoint()<_timeOffset<_timeMultiplier << std::endl; - - if (apc->getAnimationPath()) - { - fw.writeObject(*(apc->getAnimationPath())); - } - - return true; -} diff --git a/src/osgPlugins/osg/AutoTransform.cpp b/src/osgPlugins/osg/AutoTransform.cpp deleted file mode 100644 index 0270bc1fb..000000000 --- a/src/osgPlugins/osg/AutoTransform.cpp +++ /dev/null @@ -1,191 +0,0 @@ -#include -#include - -#include -#include -#include - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool AutoTransform_readLocalData(Object& obj, Input& fr); -bool AutoTransform_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(AutoTransform) -( - new osg::AutoTransform, - "AutoTransform", - "Object Node Transform AutoTransform Group", - &AutoTransform_readLocalData, - &AutoTransform_writeLocalData, - DotOsgWrapper::READ_AND_WRITE -); - -bool AutoTransform_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - AutoTransform& transform = static_cast(obj); - - if (fr.matchSequence("position %f %f %f")) - { - osg::Vec3 pos; - fr[1].getFloat(pos[0]); - fr[2].getFloat(pos[1]); - fr[3].getFloat(pos[2]); - - transform.setPosition(pos); - - fr += 4; - iteratorAdvanced = true; - } - - if (fr.matchSequence("rotation %f %f %f %f")) - { - osg::Quat att; - fr[1].getFloat(att[0]); - fr[2].getFloat(att[1]); - fr[3].getFloat(att[2]); - fr[4].getFloat(att[3]); - - transform.setRotation(att); - - fr += 5; - iteratorAdvanced = true; - } - - if (fr.matchSequence("scale %f %f %f")) - { - osg::Vec3 scale; - fr[1].getFloat(scale[0]); - fr[2].getFloat(scale[1]); - fr[3].getFloat(scale[2]); - - transform.setScale(scale); - - fr += 4; - iteratorAdvanced = true; - } - - if (fr.matchSequence("minimumScale %f")) - { - float scale; - fr[1].getFloat(scale); - - transform.setMinimumScale(scale); - - fr += 2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("maximumScale %f")) - { - float scale; - fr[1].getFloat(scale); - - transform.setMaximumScale(scale); - - fr += 2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("pivotPoint %f %f %f")) - { - osg::Vec3 pivot; - fr[1].getFloat(pivot[0]); - fr[2].getFloat(pivot[1]); - fr[3].getFloat(pivot[2]); - - transform.setPivotPoint(pivot); - - fr += 4; - iteratorAdvanced = true; - } - - if (fr.matchSequence("autoUpdateEyeMovementTolerance %f")) - { - float f; - fr[1].getFloat(f); - transform.setAutoUpdateEyeMovementTolerance(f); - fr += 2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("autoRotateToScreen %w")) - { - std::string w(fr[1].getStr()); - transform.setAutoRotateMode((w == "TRUE") ? osg::AutoTransform::ROTATE_TO_SCREEN : osg::AutoTransform::NO_ROTATION); - fr += 2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("autoRotateMode %w")) - { - std::string w(fr[1].getStr()); - if (w=="ROTATE_TO_SCREEN") transform.setAutoRotateMode(osg::AutoTransform::ROTATE_TO_SCREEN); - else if (w=="ROTATE_TO_CAMERA") transform.setAutoRotateMode(osg::AutoTransform::ROTATE_TO_CAMERA); - else if (w=="NO_ROTATION") transform.setAutoRotateMode(osg::AutoTransform::NO_ROTATION); - - fr += 2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("autoScaleToScreen %w")) - { - std::string w(fr[1].getStr()); - transform.setAutoScaleToScreen(w == "TRUE"); - fr += 2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("autoScaleTransistionWidthRatio %f") || - fr.matchSequence("autoScaleTransitionWidthRatio %f")) - { - float ratio; - fr[1].getFloat(ratio); - - transform.setAutoScaleTransitionWidthRatio(ratio); - - fr += 2; - iteratorAdvanced = true; - } - - - return iteratorAdvanced; -} - - -bool AutoTransform_writeLocalData(const Object& obj, Output& fw) -{ - const AutoTransform& transform = static_cast(obj); - - fw.indent()<<"position "<0.0) fw.indent()<<"minimumScale "<(obj); - - if (fr[0].matchWord("Mode")) - { - if (fr[1].matchWord("AXIAL_ROT")) - { - billboard.setMode(Billboard::AXIAL_ROT); - fr+=2; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("POINT_ROT_EYE")) - { - billboard.setMode(Billboard::POINT_ROT_EYE); - fr+=2; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("POINT_ROT_WORLD")) - { - billboard.setMode(Billboard::POINT_ROT_WORLD); - fr+=2; - iteratorAdvanced = true; - } - } - - if (fr[0].matchWord("Axis")) - { - float x,y,z; - if (fr[1].getFloat(x) && fr[2].getFloat(y) && fr[3].getFloat(z)) - { - billboard.setAxis(Vec3(x,y,z)); - fr+=4; - iteratorAdvanced = true; - } - } - - if (fr[0].matchWord("Normal")) - { - float x,y,z; - if (fr[1].getFloat(x) && fr[2].getFloat(y) && fr[3].getFloat(z)) - { - billboard.setNormal(Vec3(x,y,z)); - fr+=4; - iteratorAdvanced = true; - } - } - - - // read the position data. - bool matchFirst = false; - if ((matchFirst=fr.matchSequence("Positions {")) || fr.matchSequence("Positions %i {")) - { - - // set up coordinates. - int entry = fr[0].getNoNestedBrackets(); - - Billboard::PositionList& positionList = billboard.getPositionList(); - positionList.clear(); - - if (matchFirst) - { - fr += 2; - } - else - { - //positionList.(capacity); - fr += 3; - } - - Vec3 pos; - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - if (fr[0].getFloat(pos[0]) && fr[1].getFloat(pos[1]) && fr[2].getFloat(pos[2])) - { - fr += 3; - positionList.push_back(pos); - } - else - { - ++fr; - } - } - - iteratorAdvanced = true; - ++fr; - - } - - return iteratorAdvanced; -} - - -bool Billboard_writeLocalData(const Object& obj, Output& fw) -{ - - const Billboard& billboard = static_cast(obj); - - switch(billboard.getMode()) - { - case(Billboard::AXIAL_ROT): fw.indent() << "Mode AXIAL_ROT"< -#include - -#include -#include -#include - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool BlendColor_readLocalData(Object& obj, Input& fr); -bool BlendColor_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. - -REGISTER_DOTOSGWRAPPER(BlendColor) -( - new osg::BlendColor, - "BlendColor", - "Object StateAttribute BlendColor", - &BlendColor_readLocalData, - &BlendColor_writeLocalData -); - -bool BlendColor_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - BlendColor& bc = static_cast(obj); - - if (fr.matchSequence("constantColor %f %f %f %f")) - { - osg::Vec4 color; - fr[1].getFloat(color[0]); - fr[2].getFloat(color[1]); - fr[3].getFloat(color[2]); - fr[4].getFloat(color[3]); - - bc.setConstantColor(color); - fr+=5; - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - -bool BlendColor_writeLocalData(const Object& obj, Output& fw) -{ - const BlendColor& bc = static_cast(obj); - - fw.indent() << "constantColor " << bc.getConstantColor() << std::endl; - - return true; -} - - diff --git a/src/osgPlugins/osg/BlendEquation.cpp b/src/osgPlugins/osg/BlendEquation.cpp deleted file mode 100644 index 32221eb3c..000000000 --- a/src/osgPlugins/osg/BlendEquation.cpp +++ /dev/null @@ -1,108 +0,0 @@ -#include "osg/BlendEquation" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -#include - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool BlendEquation_readLocalData(Object& obj, Input& fr); -bool BlendEquation_writeLocalData(const Object& obj, Output& fw); - -bool BlendEquation_matchModeStr(const char* str,int& mode); -const char* BlendEquation_getModeStr(int value); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(BlendEquation) -( - new osg::BlendEquation, - "BlendEquation", - "Object StateAttribute BlendEquation", - &BlendEquation_readLocalData, - &BlendEquation_writeLocalData -); - -bool BlendEquation_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - BlendEquation& blendeq = static_cast(obj); - - int mode; - if (fr[0].matchWord("equation") && BlendEquation_matchModeStr(fr[1].getStr(),mode)) - { - blendeq.setEquation(osg::BlendEquation::Equation(mode)); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("equationRGB") && BlendEquation_matchModeStr(fr[1].getStr(),mode)) - { - blendeq.setEquationRGB(osg::BlendEquation::Equation(mode)); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("equationAlpha") && BlendEquation_matchModeStr(fr[1].getStr(),mode)) - { - blendeq.setEquationAlpha(osg::BlendEquation::Equation(mode)); - fr+=2; - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - -bool BlendEquation_writeLocalData(const Object& obj, Output& fw) -{ - const BlendEquation& blendeq = static_cast(obj); - - if (blendeq.getEquationRGB()==blendeq.getEquationAlpha()) - { - fw.indent() << "equation " << BlendEquation_getModeStr(blendeq.getEquation()) << std::endl; - } - else - { - fw.indent() << "equationRGB " << BlendEquation_getModeStr(blendeq.getEquationRGB()) << std::endl; - fw.indent() << "equationAlpha " << BlendEquation_getModeStr(blendeq.getEquationAlpha()) << std::endl; - } - - return true; -} - - - -bool BlendEquation_matchModeStr(const char* str,int& mode) -{ - if (strcmp(str,"RGBA_MIN")==0) mode = BlendEquation::RGBA_MIN; - else if (strcmp(str,"RGBA_MAX")==0) mode = BlendEquation::RGBA_MAX; - else if (strcmp(str,"ALPHA_MIN")==0) mode = BlendEquation::ALPHA_MIN; - else if (strcmp(str,"ALPHA_MAX")==0) mode = BlendEquation::ALPHA_MAX; - else if (strcmp(str,"LOGIC_OP")==0) mode = BlendEquation::LOGIC_OP; - else if (strcmp(str,"FUNC_ADD")==0) mode = BlendEquation::FUNC_ADD; - else if (strcmp(str,"FUNC_SUBTRACT")==0) mode = BlendEquation::FUNC_SUBTRACT; - else if (strcmp(str,"FUNC_REVERSE_SUBTRACT")==0) mode = BlendEquation::FUNC_REVERSE_SUBTRACT; - else return false; - return true; - -} -const char* BlendEquation_getModeStr(int value) -{ - switch(value) - { - case(BlendEquation::RGBA_MIN) : return "RGBA_MIN"; - case(BlendEquation::RGBA_MAX) : return "RGBA_MAX"; - case(BlendEquation::ALPHA_MIN) : return "ALPHA_MIN"; - case(BlendEquation::ALPHA_MAX) : return "ALPHA_MAX"; - case(BlendEquation::LOGIC_OP) : return "LOGIC_OP"; - case(BlendEquation::FUNC_ADD) : return "FUNC_ADD"; - case(BlendEquation::FUNC_SUBTRACT) : return "FUNC_SUBTRACT"; - case(BlendEquation::FUNC_REVERSE_SUBTRACT) : return "FUNC_REVERSE_SUBTRACT"; - } - - return NULL; -} diff --git a/src/osgPlugins/osg/BlendFunc.cpp b/src/osgPlugins/osg/BlendFunc.cpp deleted file mode 100644 index 9080a6472..000000000 --- a/src/osgPlugins/osg/BlendFunc.cpp +++ /dev/null @@ -1,143 +0,0 @@ -#include "osg/BlendFunc" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -#include - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool BlendFunc_readLocalData(Object& obj, Input& fr); -bool BlendFunc_writeLocalData(const Object& obj, Output& fw); - -bool BlendFunc_matchModeStr(const char* str,int& mode); -const char* BlendFunc_getModeStr(int value); - -// register the read and write functions with the osgDB::Registry. - -REGISTER_DOTOSGWRAPPER(Transparency) -( - new osg::BlendFunc, - "Transparency", - "Object StateAttribute Transparency", - &BlendFunc_readLocalData, - &BlendFunc_writeLocalData -); - -REGISTER_DOTOSGWRAPPER(BlendFunc) -( - new osg::BlendFunc, - "BlendFunc", - "Object StateAttribute BlendFunc", - &BlendFunc_readLocalData, - &BlendFunc_writeLocalData -); - -bool BlendFunc_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - BlendFunc& transparency = static_cast(obj); - - int mode; - if (fr[0].matchWord("source") && BlendFunc_matchModeStr(fr[1].getStr(),mode)) - { - transparency.setSource(mode); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("destination") && BlendFunc_matchModeStr(fr[1].getStr(),mode)) - { - transparency.setDestination(mode); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("sourceAlpha") && BlendFunc_matchModeStr(fr[1].getStr(),mode)) - { - transparency.setSourceAlpha(mode); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("destinationAlpha") && BlendFunc_matchModeStr(fr[1].getStr(),mode)) - { - transparency.setDestinationAlpha(mode); - fr+=2; - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - -bool BlendFunc_writeLocalData(const Object& obj, Output& fw) -{ - const BlendFunc& transparency = static_cast(obj); - - fw.indent() << "source " << BlendFunc_getModeStr(transparency.getSource()) << std::endl; - fw.indent() << "destination " << BlendFunc_getModeStr(transparency.getDestination()) << std::endl; - - if (transparency.getSource() != transparency.getSourceAlpha()) - { - fw.indent() << "sourceAlpha " << BlendFunc_getModeStr(transparency.getSourceAlpha()) << std::endl; - } - - if (transparency.getDestination() != transparency.getDestinationAlpha()) - { - fw.indent() << "destinationAlpha " << BlendFunc_getModeStr(transparency.getDestinationAlpha()) << std::endl; - } - - return true; -} - - - -bool BlendFunc_matchModeStr(const char* str,int& mode) -{ - if (strcmp(str,"DST_ALPHA")==0) mode = BlendFunc::DST_ALPHA; - else if (strcmp(str,"DST_COLOR")==0) mode = BlendFunc::DST_COLOR; - else if (strcmp(str,"ONE")==0) mode = BlendFunc::ONE; - else if (strcmp(str,"ONE_MINUS_DST_ALPHA")==0) mode = BlendFunc::ONE_MINUS_DST_ALPHA; - else if (strcmp(str,"ONE_MINUS_DST_COLOR")==0) mode = BlendFunc::ONE_MINUS_DST_COLOR; - else if (strcmp(str,"ONE_MINUS_SRC_ALPHA")==0) mode = BlendFunc::ONE_MINUS_SRC_ALPHA; - else if (strcmp(str,"ONE_MINUS_SRC_COLOR")==0) mode = BlendFunc::ONE_MINUS_SRC_COLOR; - else if (strcmp(str,"SRC_ALPHA")==0) mode = BlendFunc::SRC_ALPHA; - else if (strcmp(str,"SRC_ALPHA_SATURATE")==0) mode = BlendFunc::SRC_ALPHA_SATURATE; - else if (strcmp(str,"SRC_COLOR")==0) mode = BlendFunc::SRC_COLOR; - else if (strcmp(str,"ZERO")==0) mode = BlendFunc::ZERO; - else if (strcmp(str,"CONSTANT_ALPHA")==0) mode = BlendFunc::CONSTANT_ALPHA; - else if (strcmp(str,"ONE_MINUS_CONSTANT_ALPHA")==0) mode = BlendFunc::ONE_MINUS_CONSTANT_ALPHA; - else if (strcmp(str,"CONSTANT_COLOR")==0) mode = BlendFunc::CONSTANT_COLOR; - else if (strcmp(str,"ONE_MINUS_CONSTANT_COLOR")==0) mode = BlendFunc::ONE_MINUS_CONSTANT_COLOR; - else return false; - return true; - -} - -const char* BlendFunc_getModeStr(int value) -{ - switch(value) - { - case(BlendFunc::DST_ALPHA) : return "DST_ALPHA"; - case(BlendFunc::DST_COLOR) : return "DST_COLOR"; - case(BlendFunc::ONE) : return "ONE"; - case(BlendFunc::ONE_MINUS_DST_ALPHA) : return "ONE_MINUS_DST_ALPHA"; - case(BlendFunc::ONE_MINUS_DST_COLOR) : return "ONE_MINUS_DST_COLOR"; - case(BlendFunc::ONE_MINUS_SRC_ALPHA) : return "ONE_MINUS_SRC_ALPHA"; - case(BlendFunc::ONE_MINUS_SRC_COLOR) : return "ONE_MINUS_SRC_COLOR"; - case(BlendFunc::SRC_ALPHA) : return "SRC_ALPHA"; - case(BlendFunc::SRC_ALPHA_SATURATE) : return "SRC_ALPHA_SATURATE"; - case(BlendFunc::SRC_COLOR) : return "SRC_COLOR"; - case(BlendFunc::ZERO) : return "ZERO"; - case(BlendFunc::CONSTANT_ALPHA) : return "CONSTANT_ALPHA"; - case(BlendFunc::ONE_MINUS_CONSTANT_ALPHA): return "ONE_MINUS_CONSTANT_ALPHA"; - case(BlendFunc::CONSTANT_COLOR) : return "CONSTANT_COLOR"; - case(BlendFunc::ONE_MINUS_CONSTANT_COLOR): return "ONE_MINUS_CONSTANT_COLOR"; - } - - return NULL; -} diff --git a/src/osgPlugins/osg/Box.cpp b/src/osgPlugins/osg/Box.cpp deleted file mode 100644 index 870977814..000000000 --- a/src/osgPlugins/osg/Box.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include -#include -#include - -#include -#include -#include - -using namespace osg; -using namespace osgDB; - - -////////////////////////////////////////////////////////////////////////////// -// forward declare functions to use later. -bool Box_readLocalData(Object& obj, Input& fr); -bool Box_writeLocalData(const Object& obj, Output& fw); - -//register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Box) -( - new osg::Box, - "Box", - "Object Box", - &Box_readLocalData, - &Box_writeLocalData, - DotOsgWrapper::READ_AND_WRITE -); - -bool Box_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - Box& box = static_cast(obj); - - if (fr.matchSequence("Center %f %f %f")) - { - osg::Vec3 center; - fr[1].getFloat(center.x()); - fr[2].getFloat(center.y()); - fr[3].getFloat(center.z()); - box.setCenter(center); - fr+=4; - iteratorAdvanced = true; - } - - if (fr.matchSequence("HalfLengths %f %f %f")) - { - osg::Vec3 lenghts; - fr[1].getFloat(lenghts.x()); - fr[2].getFloat(lenghts.y()); - fr[3].getFloat(lenghts.z()); - box.setHalfLengths(lenghts); - fr+=4; - iteratorAdvanced = true; - } - - if (fr.matchSequence("Rotation %f %f %f %f")) - { - osg::Quat rotation; - fr[1].getFloat(rotation.x()); - fr[2].getFloat(rotation.y()); - fr[3].getFloat(rotation.z()); - fr[4].getFloat(rotation.w()); - box.setRotation(rotation); - fr+=5; - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - -bool Box_writeLocalData(const Object& obj, Output& fw) -{ - const Box& box = static_cast(obj); - - fw.indent()<<"Center "< -#include -#include - -#include -#include -#include - -#include "Matrix.h" - -#include - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool Camera_readLocalData(Object& obj, Input& fr); -bool Camera_writeLocalData(const Object& obj, Output& fw); - -bool Camera_matchBufferComponentStr(const char* str,Camera::BufferComponent& buffer); -const char* Camera_getBufferComponentStr(Camera::BufferComponent buffer); - - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Camera) -( - new osg::Camera, - "Camera", - "Object Node Transform Camera Group", - &Camera_readLocalData, - &Camera_writeLocalData, - DotOsgWrapper::READ_AND_WRITE -); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(CameraNode) -( - new osg::Camera, - "CameraNode", - "Object Node Transform CameraNode Group", - &Camera_readLocalData, - &Camera_writeLocalData, - DotOsgWrapper::READ_AND_WRITE -); - -bool Camera_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - Camera& camera = static_cast(obj); - - if (fr.matchSequence("clearColor %f %f %f %f")) - { - Vec4 color; - fr[1].getFloat(color[0]); - fr[2].getFloat(color[1]); - fr[3].getFloat(color[2]); - fr[4].getFloat(color[3]); - camera.setClearColor(color); - fr +=5 ; - iteratorAdvanced = true; - }; - - if (fr.matchSequence("clearMask %i")) - { - unsigned int value; - fr[1].getUInt(value); - camera.setClearMask(value); - fr += 2; - iteratorAdvanced = true; - } - - osg::ref_ptr attribute; - while((attribute=fr.readStateAttribute())!=NULL) - { - osg::Viewport* viewport = dynamic_cast(attribute.get()); - if (viewport) camera.setViewport(viewport); - else - { - osg::ColorMask* colormask = dynamic_cast(attribute.get()); - camera.setColorMask(colormask); - } - } - - if (fr.matchSequence("transformOrder %w")) - { - if (fr[1].matchWord("PRE_MULTIPLY")) camera.setTransformOrder(osg::Camera::PRE_MULTIPLY); - else if (fr[1].matchWord("POST_MULTIPLY")) camera.setTransformOrder(osg::Camera::POST_MULTIPLY); - // the following are for backwards compatibility. - else if (fr[1].matchWord("PRE_MULTIPLE")) camera.setTransformOrder(osg::Camera::PRE_MULTIPLY); - else if (fr[1].matchWord("POST_MULTIPLE")) camera.setTransformOrder(osg::Camera::POST_MULTIPLY); - - fr += 2; - iteratorAdvanced = true; - } - - Matrix matrix; - if (readMatrix(matrix,fr,"ProjectionMatrix")) - { - camera.setProjectionMatrix(matrix); - iteratorAdvanced = true; - } - - if (readMatrix(matrix,fr,"ViewMatrix")) - { - camera.setViewMatrix(matrix); - iteratorAdvanced = true; - } - - if (fr.matchSequence("renderOrder %w")) - { - if (fr[1].matchWord("PRE_RENDER")) camera.setRenderOrder(osg::Camera::PRE_RENDER); - else if (fr[1].matchWord("NESTED_RENDER")) camera.setRenderOrder(osg::Camera::NESTED_RENDER); - else if (fr[1].matchWord("POST_RENDER")) camera.setRenderOrder(osg::Camera::POST_RENDER); - - fr += 2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("renderTargetImplementation %w")) - { - osg::Camera::RenderTargetImplementation implementation = osg::Camera::FRAME_BUFFER; - - if (fr[1].matchWord("FRAME_BUFFER_OBJECT")) implementation = osg::Camera::FRAME_BUFFER_OBJECT; - else if (fr[1].matchWord("PIXEL_BUFFER_RTT")) implementation = osg::Camera::PIXEL_BUFFER_RTT; - else if (fr[1].matchWord("PIXEL_BUFFER")) implementation = osg::Camera::PIXEL_BUFFER; - else if (fr[1].matchWord("FRAME_BUFFER")) implementation = osg::Camera::FRAME_BUFFER; - else if (fr[1].matchWord("SEPERATE_WINDOW")) implementation = osg::Camera::SEPERATE_WINDOW; - - camera.setRenderTargetImplementation(implementation); - - fr += 2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("renderTargetImplementation %w")) - { - osg::Camera::RenderTargetImplementation fallback = camera.getRenderTargetFallback(); - - if (fr[1].matchWord("FRAME_BUFFER_OBJECT")) fallback = osg::Camera::FRAME_BUFFER_OBJECT; - else if (fr[1].matchWord("PIXEL_BUFFER_RTT")) fallback = osg::Camera::PIXEL_BUFFER_RTT; - else if (fr[1].matchWord("PIXEL_BUFFER")) fallback = osg::Camera::PIXEL_BUFFER; - else if (fr[1].matchWord("FRAME_BUFFER")) fallback = osg::Camera::FRAME_BUFFER; - else if (fr[1].matchWord("SEPERATE_WINDOW")) fallback = osg::Camera::SEPERATE_WINDOW; - - camera.setRenderTargetImplementation(camera.getRenderTargetImplementation(), fallback); - - fr += 2; - iteratorAdvanced = true; - } - - - if (fr.matchSequence("bufferComponent %w {")) - { - int entry = fr[1].getNoNestedBrackets(); - - Camera::BufferComponent buffer; - Camera_matchBufferComponentStr(fr[1].getStr(),buffer); - - fr += 3; - - Camera::Attachment& attachment = camera.getBufferAttachmentMap()[buffer]; - - // read attachment data. - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - bool localAdvance = false; - - if (fr.matchSequence("internalFormat %i")) - { - // In their infinite wisdom, the Apple engineers changed the type - // of GLenum from 'unsigned int' to 'unsigned long', thus breaking - // the call by reference of getUInt. - unsigned int format; - fr[1].getUInt(format); - attachment._internalFormat = format; - fr += 2; - localAdvance = true; - } - - osg::ref_ptr attribute; - while((attribute=fr.readObject())!=NULL) - { - localAdvance = true; - - osg::Texture* texture = dynamic_cast(attribute.get()); - if (texture) attachment._texture = texture; - else - { - osg::Image* image = dynamic_cast(attribute.get()); - attachment._image = image; - } - - } - - if (fr.matchSequence("level %i")) - { - fr[1].getUInt(attachment._level); - fr += 2; - localAdvance = true; - } - - if (fr.matchSequence("face %i")) - { - fr[1].getUInt(attachment._face); - fr += 2; - localAdvance = true; - } - - if (fr.matchSequence("mipMapGeneration TRUE")) - { - attachment._mipMapGeneration = true; - fr += 2; - localAdvance = true; - } - - if (fr.matchSequence("mipMapGeneration FALSE")) - { - attachment._mipMapGeneration = false; - fr += 2; - localAdvance = true; - } - - if (!localAdvance) ++fr; - } - - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - - -bool Camera_writeLocalData(const Object& obj, Output& fw) -{ - const Camera& camera = static_cast(obj); - - fw.indent()<<"clearColor "<second; - fw.indent()<<"bufferComponent "<first)<<" {"< -#include -#include - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool CameraView_readLocalData(Object& obj, Input& fr); -bool CameraView_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(CameraView) -( - new osg::CameraView, - "CameraView", - "Object Node Transform CameraView Group", - &CameraView_readLocalData, - &CameraView_writeLocalData, - DotOsgWrapper::READ_AND_WRITE -); - -bool CameraView_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - CameraView& cameraview = static_cast(obj); - - if (fr.matchSequence("position %f %f %f")) - { - osg::Vec3d pos; - fr[1].getFloat(pos[0]); - fr[2].getFloat(pos[1]); - fr[3].getFloat(pos[2]); - - cameraview.setPosition(pos); - - fr += 4; - iteratorAdvanced = true; - } - - if (fr.matchSequence("attitude %f %f %f %f")) - { - osg::Quat att; - fr[1].getFloat(att[0]); - fr[2].getFloat(att[1]); - fr[3].getFloat(att[2]); - fr[4].getFloat(att[3]); - - cameraview.setAttitude(att); - - fr += 5; - iteratorAdvanced = true; - } - - if (fr.matchSequence("fieldOfView %f")) - { - double fov; - fr[1].getFloat(fov); - cameraview.setFieldOfView(fov); - - fr += 2; - iteratorAdvanced = true; - } - - - if (fr.matchSequence("fieldOfViewMode %w")) - { - if (fr[1].matchWord("UNCONSTRAINED")) cameraview.setFieldOfViewMode(osg::CameraView::UNCONSTRAINED); - else if (fr[1].matchWord("HORIZONTAL")) cameraview.setFieldOfViewMode(osg::CameraView::HORIZONTAL); - else if (fr[1].matchWord("VERTICAL")) cameraview.setFieldOfViewMode(osg::CameraView::VERTICAL); - - fr += 2; - iteratorAdvanced = true; - } - - - if (fr.matchSequence("focalLength %f")) - { - double fl; - fr[1].getFloat(fl); - cameraview.setFocalLength(fl); - - fr += 2; - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - - -bool CameraView_writeLocalData(const Object& obj, Output& fw) -{ - const CameraView& cameraview = static_cast(obj); - - fw.indent()<<"position "< -#include -#include - -#include -#include -#include - -using namespace osg; -using namespace osgDB; - - -////////////////////////////////////////////////////////////////////////////// -// forward declare functions to use later. -bool Capsule_readLocalData(Object& obj, Input& fr); -bool Capsule_writeLocalData(const Object& obj, Output& fw); - -//register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Capsule) -( - new osg::Capsule, - "Capsule", - "Object Capsule", - &Capsule_readLocalData, - &Capsule_writeLocalData, - DotOsgWrapper::READ_AND_WRITE -); - -bool Capsule_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - Capsule& capsule = static_cast(obj); - - if (fr.matchSequence("Center %f %f %f")) - { - osg::Vec3 center; - fr[1].getFloat(center.x()); - fr[2].getFloat(center.y()); - fr[3].getFloat(center.z()); - capsule.setCenter(center); - fr+=4; - iteratorAdvanced = true; - } - - if (fr.matchSequence("Radius %f")) - { - float radius; - fr[1].getFloat(radius); - capsule.setRadius(radius); - fr+=2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("Height %f")) - { - float height; - fr[1].getFloat(height); - capsule.setHeight(height); - fr+=2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("Rotation %f %f %f %f")) - { - osg::Quat rotation; - fr[1].getFloat(rotation.x()); - fr[2].getFloat(rotation.y()); - fr[3].getFloat(rotation.z()); - fr[4].getFloat(rotation.w()); - capsule.setRotation(rotation); - fr+=5; - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - -bool Capsule_writeLocalData(const Object& obj, Output& fw) -{ - const Capsule& capsule = static_cast(obj); - - fw.indent()<<"Center "< -#include - -#include -#include -#include - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool ClearNode_readLocalData(Object& obj, Input& fr); -bool ClearNode_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. - -REGISTER_DOTOSGWRAPPER(EarthSky) -( - new osg::ClearNode, - "EarthSky", - "Object Node EarthSky Group", - &ClearNode_readLocalData, - &ClearNode_writeLocalData -); - -REGISTER_DOTOSGWRAPPER(ClearNode) -( - new osg::ClearNode, - "ClearNode", - "Object Node ClearNode Group", - &ClearNode_readLocalData, - &ClearNode_writeLocalData -); - -bool ClearNode_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - ClearNode& 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; - } - - if (fr[0].matchWord("clearMask")) - { - if (fr[1].isUInt()) - { - unsigned int value=0; - fr[1].getUInt(value); - es.setClearMask(static_cast(value)); - iteratorAdvanced = true; - fr+=2; - } - } - - return iteratorAdvanced; -} - - -bool ClearNode_writeLocalData(const Object& obj, Output& fw) -{ - const ClearNode& es = static_cast(obj); - - fw.indent() << "requiresClear "; - if (es.getRequiresClear()) - { - fw<<"TRUE"<< std::endl; - } - else - { - fw<<"FALSE"<< std::endl; - } - - fw.indent() << "clearColor "<(es.getClearMask())<< std::endl; - - return true; -} diff --git a/src/osgPlugins/osg/ClipNode.cpp b/src/osgPlugins/osg/ClipNode.cpp deleted file mode 100644 index c8a602064..000000000 --- a/src/osgPlugins/osg/ClipNode.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#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. -REGISTER_DOTOSGWRAPPER(ClipNode) -( - new osg::ClipNode, - "ClipNode", - "Object Node ClipNode Group", - &ClipNode_readLocalData, - &ClipNode_writeLocalData -); - -bool ClipNode_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - ClipNode& clipnode = static_cast(obj); - - if (fr[0].matchWord("referenceFrame")) - { - if (fr[1].matchWord("ABSOLUTE")) - { - clipnode.setReferenceFrame(ClipNode::ABSOLUTE_RF); - fr += 2; - iteratorAdvanced = true; - } - if (fr[1].matchWord("RELATIVE")) - { - clipnode.setReferenceFrame(ClipNode::RELATIVE_RF); - fr += 2; - iteratorAdvanced = true; - } - } - - osg::ref_ptr sa=0; - while((sa=fr.readStateAttribute())!=0) - { - ClipPlane* clipplane = dynamic_cast(sa.get()); - if (clipplane) clipnode.addClipPlane(clipplane); - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - - -bool ClipNode_writeLocalData(const Object& obj, Output& fw) -{ - const ClipNode& clipnode = static_cast(obj); - - fw.indent() << "referenceFrame "; - switch (clipnode.getReferenceFrame()) - { - case ClipNode::ABSOLUTE_RF: - fw << "ABSOLUTE\n"; - break; - case ClipNode::RELATIVE_RF: - default: - fw << "RELATIVE\n"; - }; - - for(unsigned int i=0;i -#include - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool ClipPlane_readLocalData(Object& obj, Input& fr); -bool ClipPlane_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(ClipPlane) -( - new osg::ClipPlane, - "ClipPlane", - "Object StateAttribute ClipPlane", - &ClipPlane_readLocalData, - &ClipPlane_writeLocalData -); - - -bool ClipPlane_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - ClipPlane& clipplane = static_cast(obj); - - if (fr.matchSequence("clipPlaneNum %i")) - { - unsigned int num; - fr[1].getUInt(num); - clipplane.setClipPlaneNum(num); - - fr+=2; - iteratorAdvanced = true; - } - - - if (fr.matchSequence("plane %f %f %f %f")) - { - double plane[4]; - fr[1].getFloat(plane[0]); - fr[2].getFloat(plane[1]); - fr[3].getFloat(plane[2]); - fr[4].getFloat(plane[3]); - clipplane.setClipPlane(plane[0],plane[1],plane[2],plane[3]); - - fr+=5; - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - - -bool ClipPlane_writeLocalData(const Object& obj,Output& fw) -{ - const ClipPlane& clipplane = static_cast(obj); - - fw.indent() << "clipPlaneNum " << clipplane.getClipPlaneNum() < -#include - -#include -#include -#include - -using namespace osg; -using namespace osgDB; - -bool ClusterCullingCallback_readLocalData(osg::Object &obj, osgDB::Input &fr); -bool ClusterCullingCallback_writeLocalData(const osg::Object &obj, osgDB::Output &fw); // register the read and write functions with the osgDB::Registry. - -REGISTER_DOTOSGWRAPPER(ClusterCullingCallback) -( - new ClusterCullingCallback, - "ClusterCullingCallback", - "Object ClusterCullingCallback", - &ClusterCullingCallback_readLocalData, - &ClusterCullingCallback_writeLocalData -); - -bool ClusterCullingCallback_readLocalData(osg::Object &obj, osgDB::Input &fr) -{ - ClusterCullingCallback* ccc = dynamic_cast(&obj); - if (!ccc) return false; - - bool iteratorAdvanced = false; - - osg::Vec3 vec; - if (fr[0].matchWord("controlPoint") && - fr[1].getFloat(vec[0]) && fr[2].getFloat(vec[1]) && fr[3].getFloat(vec[2])) - { - ccc->setControlPoint(vec); - fr += 4; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("normal") && - fr[1].getFloat(vec[0]) && fr[2].getFloat(vec[1]) && fr[3].getFloat(vec[2])) - { - ccc->setNormal(vec); - fr += 4; - iteratorAdvanced = true; - } - - float value; - if (fr[0].matchWord("radius") && fr[1].getFloat(value)) - { - ccc->setRadius(value); - fr += 2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("deviation") && fr[1].getFloat(value)) - { - ccc->setDeviation(value); - fr += 2; - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - -bool ClusterCullingCallback_writeLocalData(const osg::Object &obj, osgDB::Output &fw) -{ - const ClusterCullingCallback* ccc = dynamic_cast(&obj); - if (!ccc) return false; - - int prec = fw.precision(); - fw.precision(15); - - fw.indent() << "controlPoint " << ccc->getControlPoint() << std::endl; - fw.indent() << "normal " << ccc->getNormal() << std::endl; - fw.indent() << "radius " << ccc->getRadius() << std::endl; - fw.indent() << "deviation " << ccc->getDeviation() << std::endl; - - fw.precision(prec); - - return true; -} diff --git a/src/osgPlugins/osg/ColorMask.cpp b/src/osgPlugins/osg/ColorMask.cpp deleted file mode 100644 index 4c304dc5e..000000000 --- a/src/osgPlugins/osg/ColorMask.cpp +++ /dev/null @@ -1,99 +0,0 @@ -#include "osg/ColorMask" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -#include - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool ColorMask_readLocalData(Object& obj, Input& fr); -bool ColorMask_writeLocalData(const Object& obj, Output& fw); -bool ColorMask_matchModeStr(const char* str,bool& mode); -const char* ColorMask_getModeStr(bool mode); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(ColorMask) -( - new osg::ColorMask, - "ColorMask", - "Object StateAttribute ColorMask", - &ColorMask_readLocalData, - &ColorMask_writeLocalData -); - - -bool ColorMask_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - ColorMask& colormask = static_cast(obj); - - bool redMask=colormask.getRedMask(); - if (fr[0].matchWord("redMask") && ColorMask_matchModeStr(fr[1].getStr(),redMask)) - { - fr+=2; - iteratorAdvanced = true; - } - - bool greenMask=colormask.getGreenMask(); - if (fr[0].matchWord("greenMask") && ColorMask_matchModeStr(fr[1].getStr(),greenMask)) - { - fr+=2; - iteratorAdvanced = true; - } - - bool blueMask=colormask.getBlueMask(); - if (fr[0].matchWord("blueMask") && ColorMask_matchModeStr(fr[1].getStr(),blueMask)) - { - fr+=2; - iteratorAdvanced = true; - } - - bool alphaMask=colormask.getAlphaMask(); - if (fr[0].matchWord("alphaMask") && ColorMask_matchModeStr(fr[1].getStr(),alphaMask)) - { - fr+=2; - iteratorAdvanced = true; - } - - if (iteratorAdvanced) - { - colormask.setMask(redMask,greenMask,blueMask,alphaMask); - } - - return iteratorAdvanced; -} - - -bool ColorMask_writeLocalData(const Object& obj,Output& fw) -{ - const ColorMask& colormask = static_cast(obj); - - fw.indent() << "redMask " << ColorMask_getModeStr(colormask.getRedMask()) < - -#include -#include -#include - -#include "Matrix.h" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool ColorMatrix_readLocalData(Object& obj, Input& fr); -bool ColorMatrix_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(ColorMatrix) -( - new osg::ColorMatrix, - "ColorMatrix", - "Object StateAttribute ColorMatrix", - &ColorMatrix_readLocalData, - &ColorMatrix_writeLocalData -); - - -bool ColorMatrix_readLocalData(Object& obj, Input& fr) -{ - ColorMatrix& colorMatrix = static_cast(obj); - return readMatrix(colorMatrix.getMatrix(), fr); -} - - -bool ColorMatrix_writeLocalData(const Object& obj, Output& fw) -{ - const ColorMatrix& colorMatrix = static_cast(obj); - return writeMatrix(colorMatrix.getMatrix(), fw); -} diff --git a/src/osgPlugins/osg/CompositeShape.cpp b/src/osgPlugins/osg/CompositeShape.cpp deleted file mode 100644 index 87257b5ab..000000000 --- a/src/osgPlugins/osg/CompositeShape.cpp +++ /dev/null @@ -1,75 +0,0 @@ -#include -#include -#include - -#include -#include -#include - -using namespace osg; -using namespace osgDB; - - -////////////////////////////////////////////////////////////////////////////// -// forward declare functions to use later. -bool CompositeShape_readLocalData(Object& obj, Input& fr); -bool CompositeShape_writeLocalData(const Object& obj, Output& fw); - -//register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(CompositeShape) -( - new osg::CompositeShape, - "CompositeShape", - "Object CompositeShape", - &CompositeShape_readLocalData, - &CompositeShape_writeLocalData, - DotOsgWrapper::READ_AND_WRITE -); - -bool CompositeShape_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - CompositeShape& composite = static_cast(obj); - - ref_ptr readObject; - if (fr[0].matchWord("Shape")) - { - readObject = fr.readObject(); - if (readObject.valid()) - { - osg::Shape* shape = dynamic_cast(readObject.get()); - if (shape) composite.setShape(shape); - else notify(WARN)<<"Warning:: "<className()<<" loaded but cannot not be attached to Drawable."<())).valid()) - { - osg::Shape* shape = static_cast(readObject.get()); - composite.addChild(shape); - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - -bool CompositeShape_writeLocalData(const Object& obj, Output& fw) -{ - const CompositeShape& composite = static_cast(obj); - - if (composite.getShape()) - { - fw.indent() << "Shape "; - fw.writeObject(*composite.getShape()); - } - - for(unsigned int i=0;i -#include -#include - -#include -#include -#include - -using namespace osg; -using namespace osgDB; - - -////////////////////////////////////////////////////////////////////////////// -// forward declare functions to use later. -bool Cone_readLocalData(Object& obj, Input& fr); -bool Cone_writeLocalData(const Object& obj, Output& fw); - -//register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Cone) -( - new osg::Cone, - "Cone", - "Object Cone", - &Cone_readLocalData, - &Cone_writeLocalData, - DotOsgWrapper::READ_AND_WRITE -); - -bool Cone_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - Cone& cone = static_cast(obj); - - if (fr.matchSequence("Center %f %f %f")) - { - osg::Vec3 center; - fr[1].getFloat(center.x()); - fr[2].getFloat(center.y()); - fr[3].getFloat(center.z()); - cone.setCenter(center); - fr+=4; - iteratorAdvanced = true; - } - - if (fr.matchSequence("Radius %f")) - { - float radius; - fr[1].getFloat(radius); - cone.setRadius(radius); - fr+=2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("Height %f")) - { - float height; - fr[1].getFloat(height); - cone.setHeight(height); - fr+=2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("Rotation %f %f %f %f")) - { - osg::Quat rotation; - fr[1].getFloat(rotation.x()); - fr[2].getFloat(rotation.y()); - fr[3].getFloat(rotation.z()); - fr[4].getFloat(rotation.w()); - cone.setRotation(rotation); - fr+=5; - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - -bool Cone_writeLocalData(const Object& obj, Output& fw) -{ - const Cone& cone = static_cast(obj); - - fw.indent()<<"Center "<(obj); - - - bool matchFirst; - if ((matchFirst=fr.matchSequence("Occluder {")) || fr.matchSequence("Occluder %i {")) - { - - ConvexPlanarPolygon& cpp = cpo.getOccluder(); - ConvexPlanarPolygon::VertexList& vertexList = cpp.getVertexList(); - - // set up coordinates. - int entry = fr[0].getNoNestedBrackets(); - - if (matchFirst) - { - fr += 2; - } - else - { - int capacity; - fr[1].getInt(capacity); - - vertexList.reserve(capacity); - - fr += 3; - } - - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - Vec3 v; - if (fr[0].getFloat(v.x()) && fr[1].getFloat(v.y()) && fr[2].getFloat(v.z())) - { - fr += 3; - vertexList.push_back(v); - } - else - { - ++fr; - } - } - iteratorAdvanced = true; - ++fr; - - } - - ConvexPlanarOccluder::HoleList& holeList = cpo.getHoleList(); - - while ((matchFirst=fr.matchSequence("Hole {")) || fr.matchSequence("Hole %i {")) - { - holeList.push_back(ConvexPlanarPolygon()); - - ConvexPlanarPolygon& cpp = holeList.back(); - ConvexPlanarPolygon::VertexList& vertexList = cpp.getVertexList(); - - // set up coordinates. - int entry = fr[0].getNoNestedBrackets(); - - if (matchFirst) - { - fr += 2; - } - else - { - int capacity; - fr[1].getInt(capacity); - - vertexList.reserve(capacity); - - fr += 3; - } - - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - Vec3 v; - if (fr[0].getFloat(v.x()) && fr[1].getFloat(v.y()) && fr[2].getFloat(v.z())) - { - fr += 3; - vertexList.push_back(v); - } - else - { - ++fr; - } - } - iteratorAdvanced = true; - ++fr; - - } - - return iteratorAdvanced; -} - - -bool ConvexPlanarOccluder_writeLocalData(const Object& obj, Output& fw) -{ - const ConvexPlanarOccluder& cpo = static_cast(obj); - - // write out the occluder polygon. - { - const ConvexPlanarPolygon::VertexList& vertexList = cpo.getOccluder().getVertexList(); - - fw.indent() << "Occluder " << vertexList.size()<< "{"<< std::endl; - fw.moveIn(); - - for(ConvexPlanarPolygon::VertexList::const_iterator itr=vertexList.begin(); - itr!=vertexList.end(); - ++itr) - { - fw.indent() << (*itr)[0] << ' ' << (*itr)[1] << ' ' << (*itr)[2] << std::endl; - } - - fw.moveOut(); - fw.indent()<<"}"<< std::endl; - } - - // write out any holes. - const ConvexPlanarOccluder::HoleList& holeList = cpo.getHoleList(); - for(ConvexPlanarOccluder::HoleList::const_iterator holeItr=holeList.begin(); - holeItr!=holeList.end(); - ++holeItr) - { - const ConvexPlanarPolygon::VertexList& vertexList = holeItr->getVertexList(); - - fw.indent() << "Hole " << vertexList.size() << "{"<< std::endl; - fw.moveIn(); - - for(ConvexPlanarPolygon::VertexList::const_iterator itr=vertexList.begin(); - itr!=vertexList.end(); - ++itr) - { - fw.indent() << (*itr)[0] << ' ' << (*itr)[1] << ' ' << (*itr)[2] << std::endl; - } - - fw.moveOut(); - fw.indent()<<"}"<< std::endl; - } - - - return true; -} diff --git a/src/osgPlugins/osg/CoordinateSystemNode.cpp b/src/osgPlugins/osg/CoordinateSystemNode.cpp deleted file mode 100644 index 4b9506b63..000000000 --- a/src/osgPlugins/osg/CoordinateSystemNode.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include "osg/CoordinateSystemNode" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool CoordinateSystemNode_readLocalData(Object& obj, Input& fr); -bool CoordinateSystemNode_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(CoordinateSystemNode) -( - new osg::CoordinateSystemNode, - "CoordinateSystemNode", - "Object Node CoordinateSystemNode Group", - &CoordinateSystemNode_readLocalData, - &CoordinateSystemNode_writeLocalData -); - -bool CoordinateSystemNode_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - CoordinateSystemNode& csn = static_cast(obj); - - if (fr.matchSequence("Format %s")) - { - const char* str = fr[1].getStr(); - if (str) csn.setFormat(str); - - iteratorAdvanced = true; - fr+=2; - } - - if (fr.matchSequence("CoordinateSystem %s")) - { - const char* str = fr[1].getStr(); - if (str) csn.setCoordinateSystem(str); - - iteratorAdvanced = true; - fr+=2; - } - - static ref_ptr s_ellipsoidModel = new EllipsoidModel; - - EllipsoidModel* em = static_cast(fr.readObjectOfType(*s_ellipsoidModel)); - if (em) csn.setEllipsoidModel(em); - - return iteratorAdvanced; -} - - -bool CoordinateSystemNode_writeLocalData(const Object& obj, Output& fw) -{ - const CoordinateSystemNode& csn = static_cast(obj); - - fw.indent()<<"Format "<(obj); - - if (fr[0].matchWord("mode")) - { - if (fr[1].matchWord("FRONT")) - { - cullface.setMode(CullFace::FRONT); - fr+=2; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("BACK")) - { - cullface.setMode(CullFace::BACK); - fr+=2; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("FRONT_AND_BACK")) - { - cullface.setMode(CullFace::FRONT_AND_BACK); - fr+=2; - iteratorAdvanced = true; - } - } - - return iteratorAdvanced; -} - - -bool CullFace_writeLocalData(const Object& obj, Output& fw) -{ - - const CullFace& cullface = static_cast(obj); - - switch(cullface.getMode()) - { - case(CullFace::FRONT): fw.indent() << "mode FRONT" < -#include -#include - -#include -#include -#include - -using namespace osg; -using namespace osgDB; - - -////////////////////////////////////////////////////////////////////////////// -// forward declare functions to use later. -bool Cylinder_readLocalData(Object& obj, Input& fr); -bool Cylinder_writeLocalData(const Object& obj, Output& fw); - -//register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Cylinder) -( - new osg::Cylinder, - "Cylinder", - "Object Cylinder", - &Cylinder_readLocalData, - &Cylinder_writeLocalData, - DotOsgWrapper::READ_AND_WRITE -); - -bool Cylinder_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - Cylinder& cylinder = static_cast(obj); - - if (fr.matchSequence("Center %f %f %f")) - { - osg::Vec3 center; - fr[1].getFloat(center.x()); - fr[2].getFloat(center.y()); - fr[3].getFloat(center.z()); - cylinder.setCenter(center); - fr+=4; - iteratorAdvanced = true; - } - - if (fr.matchSequence("Radius %f")) - { - float radius; - fr[1].getFloat(radius); - cylinder.setRadius(radius); - fr+=2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("Height %f")) - { - float height; - fr[1].getFloat(height); - cylinder.setHeight(height); - fr+=2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("Rotation %f %f %f %f")) - { - osg::Quat rotation; - fr[1].getFloat(rotation.x()); - fr[2].getFloat(rotation.y()); - fr[3].getFloat(rotation.z()); - fr[4].getFloat(rotation.w()); - cylinder.setRotation(rotation); - fr+=5; - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - -bool Cylinder_writeLocalData(const Object& obj, Output& fw) -{ - const Cylinder& cylinder = static_cast(obj); - - fw.indent()<<"Center "< - -#include - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool Depth_readLocalData(Object& obj, Input& fr); -bool Depth_writeLocalData(const Object& obj, Output& fw); - -bool Depth_matchFuncStr(const char* str,Depth::Function& func); -const char* Depth_getFuncStr(Depth::Function func); - - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Depth) -( - new osg::Depth, - "Depth", - "Object StateAttribute Depth", - &Depth_readLocalData, - &Depth_writeLocalData -); - - -bool Depth_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - Depth& depth = static_cast(obj); - - Depth::Function func; - if (fr[0].matchWord("function") && Depth_matchFuncStr(fr[1].getStr(),func)) - { - depth.setFunction(func); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("writeMask")) - { - if (fr[1].matchWord("TRUE") || fr[1].matchWord("ON")) - { - depth.setWriteMask(true); - fr+=2; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("FALSE") || fr[1].matchWord("OFF")) - { - depth.setWriteMask(false); - fr+=2; - iteratorAdvanced = true; - } - } - - double znear,zfar; - if (fr[0].matchWord("range") && fr[1].getFloat(znear) && fr[2].getFloat(zfar)) - { - depth.setRange(znear,zfar); - fr+=2; - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - - -bool Depth_writeLocalData(const Object& obj,Output& fw) -{ - const Depth& depth = static_cast(obj); - - fw.indent() << "function " << Depth_getFuncStr(depth.getFunction()) << std::endl; - - fw.indent() << "writeMask "; - if (depth.getWriteMask()) fw << "TRUE" << std::endl; - else fw << "FALSE" << std::endl; - - fw.indent() << "range " << depth.getZNear() << " " << depth.getZFar() << std::endl; - - return true; -} - - -bool Depth_matchFuncStr(const char* str,Depth::Function& func) -{ - if (strcmp(str,"NEVER")==0) func = Depth::NEVER; - else if (strcmp(str,"LESS")==0) func = Depth::LESS; - else if (strcmp(str,"EQUAL")==0) func = Depth::EQUAL; - else if (strcmp(str,"LEQUAL")==0) func = Depth::LEQUAL; - else if (strcmp(str,"GREATER")==0) func = Depth::GREATER; - else if (strcmp(str,"NOTEQUAL")==0) func = Depth::NOTEQUAL; - else if (strcmp(str,"GEQUAL")==0) func = Depth::GEQUAL; - else if (strcmp(str,"ALWAYS")==0) func = Depth::ALWAYS; - else return false; - return true; -} - - -const char* Depth_getFuncStr(Depth::Function func) -{ - switch(func) - { - case(Depth::NEVER): return "NEVER"; - case(Depth::LESS): return "LESS"; - case(Depth::EQUAL): return "EQUAL"; - case(Depth::LEQUAL): return "LEQUAL"; - case(Depth::GREATER): return "GREATER"; - case(Depth::NOTEQUAL): return "NOTEQUAL"; - case(Depth::GEQUAL): return "GEQUAL"; - case(Depth::ALWAYS): return "ALWAYS"; - } - return ""; -} diff --git a/src/osgPlugins/osg/Drawable.cpp b/src/osgPlugins/osg/Drawable.cpp deleted file mode 100644 index 84045119b..000000000 --- a/src/osgPlugins/osg/Drawable.cpp +++ /dev/null @@ -1,202 +0,0 @@ -#include "osg/Drawable" -#include "osg/Notify" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool Drawable_readLocalData(Object& obj, Input& fr); -bool Drawable_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Drawable) -( NULL, - "Drawable", - "Object Drawable", - &Drawable_readLocalData, - &Drawable_writeLocalData -); - -bool Drawable_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - Drawable& drawable = static_cast(obj); - - static ref_ptr s_drawstate = new osg::StateSet; - if (StateSet* readState = static_cast(fr.readObjectOfType(*s_drawstate))) - { - drawable.setStateSet(readState); - iteratorAdvanced = true; - } - - Shape* shape = static_cast(fr.readObjectOfType(type_wrapper())); - if (shape) - { - drawable.setShape(shape); - iteratorAdvanced = true; - } - - Drawable::UpdateCallback* uc = dynamic_cast(fr.readObjectOfType(type_wrapper())); - if (uc) - { - drawable.setUpdateCallback(uc); - iteratorAdvanced = true; - } - - Drawable::CullCallback* cc = dynamic_cast(fr.readObjectOfType(type_wrapper())); - if (cc) - { - drawable.setCullCallback(cc); - iteratorAdvanced = true; - } - - Drawable::DrawCallback* dc = dynamic_cast(fr.readObjectOfType(type_wrapper())); - if (dc) - { - drawable.setDrawCallback(dc); - iteratorAdvanced = true; - } - - if (fr.matchSequence("initialBound %f %f %f %f %f %f")) - { - BoundingBox bb; - fr[1].getFloat(bb.xMin()); - fr[2].getFloat(bb.yMin()); - fr[3].getFloat(bb.zMin()); - fr[4].getFloat(bb.xMax()); - fr[5].getFloat(bb.yMax()); - fr[6].getFloat(bb.zMax()); - drawable.setInitialBound(bb); - fr += 7; - iteratorAdvanced = true; - } - - Drawable::ComputeBoundingBoxCallback* cbc = dynamic_cast(fr.readObjectOfType(type_wrapper())); - if (cbc) - { - drawable.setComputeBoundingBoxCallback(cbc); - iteratorAdvanced = true; - } - - if (fr[0].matchWord("supportsDisplayList")) - { - if (fr[1].matchWord("TRUE")) - { - drawable.setSupportsDisplayList(true); - fr+=2; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("FALSE")) - { - drawable.setSupportsDisplayList(false); - fr+=2; - iteratorAdvanced = true; - } - } - - if (fr[0].matchWord("useDisplayList")) - { - if (fr[1].matchWord("TRUE")) - { - drawable.setUseDisplayList(true); - fr+=2; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("FALSE")) - { - drawable.setUseDisplayList(false); - fr+=2; - iteratorAdvanced = true; - } - } - - if (fr[0].matchWord("useVertexBufferObjects")) - { - if (fr[1].matchWord("TRUE")) - { - drawable.setUseVertexBufferObjects(true); - fr+=2; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("FALSE")) - { - drawable.setUseVertexBufferObjects(false); - fr+=2; - iteratorAdvanced = true; - } - } - - return iteratorAdvanced; -} - - -bool Drawable_writeLocalData(const Object& obj, Output& fw) -{ - const Drawable& drawable = static_cast(obj); - - if (drawable.getStateSet()) - { - fw.writeObject(*drawable.getStateSet()); - } - - if (drawable.getShape()) - { - fw.writeObject(*drawable.getShape()); - } - - if (drawable.getUpdateCallback()) - { - fw.writeObject(*drawable.getUpdateCallback()); - } - - if (drawable.getEventCallback()) - { - fw.writeObject(*drawable.getEventCallback()); - } - - if (drawable.getCullCallback()) - { - fw.writeObject(*drawable.getCullCallback()); - } - - if (drawable.getDrawCallback()) - { - fw.writeObject(*drawable.getDrawCallback()); - } - - - if (drawable.getInitialBound().valid()) - { - const osg::BoundingBox& bb = drawable.getInitialBound(); - fw.indent()<<"initialBound "<(obj); - - if (fr.matchSequence("RadiusEquator %f")) - { - double radius; - fr[1].getFloat(radius); - em.setRadiusEquator(radius); - fr += 2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("RadiusPolar %f")) - { - double radius; - fr[1].getFloat(radius); - em.setRadiusPolar(radius); - fr += 2; - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - - -bool EllipsoidModel_writeLocalData(const Object& obj, Output& fw) -{ - const EllipsoidModel& em = static_cast(obj); - - int prec = fw.precision(); - fw.precision(15); - - fw.indent()<<"RadiusEquator "< -#include - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -#include - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool Fog_readLocalData(Object& obj, Input& fr); -bool Fog_writeLocalData(const Object& obj, Output& fw); -bool Fog_matchModeStr(const char* str,Fog::Mode& mode); -const char* Fog_getModeStr(Fog::Mode mode); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Fog) -( - new osg::Fog, - "Fog", - "Object StateAttribute Fog", - &Fog_readLocalData, - &Fog_writeLocalData -); - - -bool Fog_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - Fog& fog = static_cast(obj); - - Fog::Mode mode; - if (fr[0].matchWord("mode") && Fog_matchModeStr(fr[1].getStr(),mode)) - { - fog.setMode(mode); - fr+=2; - iteratorAdvanced = true; - } - - float value; - if (fr[0].matchWord("density") && fr[1].getFloat(value)) - { - fog.setDensity(value); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("start") && fr[1].getFloat(value)) - { - fog.setStart(value); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("end") && fr[1].getFloat(value)) - { - fog.setEnd(value); - fr+=2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("color %f %f %f %f")) - { - osg::Vec4 color; - fr[1].getFloat(color[0]); - fr[2].getFloat(color[1]); - fr[3].getFloat(color[2]); - fr[4].getFloat(color[3]); - fog.setColor(color); - fr+=5; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("fogCoordinateSource")) - { - if (fr[1].matchWord("FOG_COORDINATE")) - { - fog.setFogCoordinateSource(osg::Fog::FOG_COORDINATE); - fr+=2; - iteratorAdvanced = true; - } else if (fr[1].matchWord("FRAGMENT_DEPTH")) - { - fog.setFogCoordinateSource(osg::Fog::FRAGMENT_DEPTH); - fr+=2; - iteratorAdvanced = true; - } - } - - return iteratorAdvanced; -} - - -bool Fog_writeLocalData(const Object& obj,Output& fw) -{ - const Fog& fog = static_cast(obj); - - fw.indent() << "mode " << Fog_getModeStr(fog.getMode()) << std::endl; - fw.indent() << "density " << fog.getDensity() << std::endl; - fw.indent() << "start " << fog.getStart() << std::endl; - fw.indent() << "end " << fog.getEnd() << std::endl; - fw.indent() << "color " << fog.getColor() << std::endl; - switch(fog.getFogCoordinateSource()) - { - case(Fog::FOG_COORDINATE): - fw.indent() << "fogCoordinateSource FOG_COORDINATE" << std::endl; - break; - case(Fog::FRAGMENT_DEPTH): - fw.indent() << "fogCoordinateSource FRAGMENT_DEPTH" << std::endl; - break; - default: - // unrecognized source type. - break; - } - return true; -} - - -bool Fog_matchModeStr(const char* str,Fog::Mode& mode) -{ - if (strcmp(str,"LINEAR")==0) mode = Fog::LINEAR; - else if (strcmp(str,"EXP")==0) mode = Fog::EXP; - else if (strcmp(str,"EXP2")==0) mode = Fog::EXP2; - else return false; - return true; -} - - -const char* Fog_getModeStr(Fog::Mode mode) -{ - switch(mode) - { - case(Fog::LINEAR): return "LINEAR"; - case(Fog::EXP): return "EXP"; - case(Fog::EXP2): return "EXP2"; - } - return ""; -} diff --git a/src/osgPlugins/osg/FragmentProgram.cpp b/src/osgPlugins/osg/FragmentProgram.cpp deleted file mode 100644 index 62b8b0a69..000000000 --- a/src/osgPlugins/osg/FragmentProgram.cpp +++ /dev/null @@ -1,144 +0,0 @@ -#include -#include - -#include -#include -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" -#include "osgDB/fstream" - -#include "Matrix.h" - -using namespace osg; -using namespace osgDB; -using namespace std; - -// forward declare functions to use later. -bool FragmentProgram_readLocalData(Object& obj, Input& fr); -bool FragmentProgram_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(FragmentProgram) -( - new osg::FragmentProgram, - "FragmentProgram", - "Object StateAttribute FragmentProgram", - &FragmentProgram_readLocalData, - &FragmentProgram_writeLocalData -); - - -bool FragmentProgram_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - FragmentProgram& fragmentProgram = static_cast(obj); - - if (fr[0].matchWord("ProgramLocalParameter")) - { - int index; - Vec4 vec; - fr[1].getInt(index); - fr[2].getFloat(vec[0]); - fr[3].getFloat(vec[1]); - fr[4].getFloat(vec[2]); - fr[5].getFloat(vec[3]); - fr += 6; - iteratorAdvanced = true; - fragmentProgram.setProgramLocalParameter(index, vec); - } - - if (fr[0].matchWord("Matrix")) - { - int index; - fr[1].getInt(index); - fr += 2; - osg::Matrix matrix; - if (readMatrix(matrix,fr)) - { - fragmentProgram.setMatrix(index, matrix); - } - iteratorAdvanced = true; - } - - if (fr.matchSequence("code {")) - { - std::string code; - fr += 2; - iteratorAdvanced = true; - int entry = fr[0].getNoNestedBrackets(); - while (!fr.eof() && fr[0].getNoNestedBrackets() >= entry) { - if (fr[0].getStr()) { - code.append(std::string(fr[0].getStr())); - code += '\n'; - } - ++fr; - } - fragmentProgram.setFragmentProgram(code); - } - - if( fr.matchSequence("file %s")) - { - std::string filename = fr[1].getStr(); - fr += 2; - iteratorAdvanced = true; - - osgDB::ifstream vfstream( filename.c_str() ); - - if( vfstream ) { - ostringstream vstream; - char ch; - - /* xxx better way to transfer a ifstream to a string?? */ - while( vfstream.get(ch)) vstream.put(ch); - - fragmentProgram.setFragmentProgram( vstream.str() ); - } - } - - return iteratorAdvanced; -} - - -bool FragmentProgram_writeLocalData(const Object& obj,Output& fw) -{ - const FragmentProgram& fragmentProgram = static_cast(obj); - - const FragmentProgram::LocalParamList& lpl = fragmentProgram.getLocalParameters(); - FragmentProgram::LocalParamList::const_iterator i; - for(i=lpl.begin(); i!=lpl.end(); i++) - { - fw.indent() << "ProgramLocalParameter " << (*i).first << " " << (*i).second << std::endl; - } - - const FragmentProgram::MatrixList& mpl = fragmentProgram.getMatrices(); - FragmentProgram::MatrixList::const_iterator mi; - for(mi=mpl.begin(); mi!=mpl.end(); mi++) - { - fw.indent() << "Matrix " << (*mi).first << " "; - writeMatrix((*mi).second,fw); - } - - std::vector lines; - std::istringstream iss(fragmentProgram.getFragmentProgram()); - std::string line; - while (std::getline(iss, line)) - { - lines.push_back(line); - } - - fw.indent() << "code {\n"; - fw.moveIn(); - - std::vector::const_iterator j; - for (j=lines.begin(); j!=lines.end(); ++j) - { - fw.indent() << "\"" << *j << "\"\n"; - } - - fw.moveOut(); - fw.indent() << "}\n"; - - return true; -} diff --git a/src/osgPlugins/osg/FrontFace.cpp b/src/osgPlugins/osg/FrontFace.cpp deleted file mode 100644 index b689f64e8..000000000 --- a/src/osgPlugins/osg/FrontFace.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "osg/FrontFace" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool FrontFace_readLocalData(Object& obj, Input& fr); -bool FrontFace_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(FrontFace) -( - new osg::FrontFace, - "FrontFace", - "Object StateAttribute FrontFace", - &FrontFace_readLocalData, - &FrontFace_writeLocalData -); - -bool FrontFace_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - FrontFace& frontface = static_cast(obj); - - if (fr[0].matchWord("mode")) - { - if (fr[1].matchWord("CLOCKWISE")) - { - frontface.setMode(FrontFace::CLOCKWISE); - fr+=2; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("COUNTER_CLOCKWISE")) - { - frontface.setMode(FrontFace::COUNTER_CLOCKWISE); - fr+=2; - iteratorAdvanced = true; - } - } - - return iteratorAdvanced; -} - - -bool FrontFace_writeLocalData(const Object& obj, Output& fw) -{ - const FrontFace& frontface = static_cast(obj); - - switch(frontface.getMode()) - { - case(FrontFace::CLOCKWISE): fw.indent() << "mode CLOCKWISE" << std::endl; break; - case(FrontFace::COUNTER_CLOCKWISE): fw.indent() << "mode COUNTER_CLOCKWISE" << std::endl; break; - } - return true; -} diff --git a/src/osgPlugins/osg/Geode.cpp b/src/osgPlugins/osg/Geode.cpp deleted file mode 100644 index 88c07a74b..000000000 --- a/src/osgPlugins/osg/Geode.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "osg/Geode" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool Geode_readLocalData(Object& obj, Input& fr); -bool Geode_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Geode) -( - new osg::Geode, - "Geode", - "Object Node Geode", - &Geode_readLocalData, - &Geode_writeLocalData -); - -bool Geode_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - Geode& geode = static_cast(obj); - - int num_drawables; - if ((fr[0].matchWord("num_drawables") || fr[0].matchWord("num_geosets")) && - fr[1].getInt(num_drawables)) - { - // could allocate space for children here... - fr+=2; - iteratorAdvanced = true; - } - - Drawable* drawable = NULL; - while((drawable=fr.readDrawable())!=NULL) - { - geode.addDrawable(drawable); - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - - -bool Geode_writeLocalData(const osg::Object& obj, Output& fw) -{ - const Geode& geode = static_cast(obj); - - fw.indent() << "num_drawables " << geode.getNumDrawables() << std::endl; - - for(unsigned int i=0;i -#include -#include - -#include -#include -#include - -#include - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool Geometry_readLocalData(Object& obj, Input& fr); -bool Geometry_writeLocalData(const Object& obj, Output& fw); - -bool Geometry_matchBindingTypeStr(const char* str,Geometry::AttributeBinding& mode); -const char* Geometry_getBindingTypeStr(Geometry::AttributeBinding mode); - -bool Geometry_matchPrimitiveModeStr(const char* str,GLenum& mode); -const char* Geometry_getPrimitiveModeStr(GLenum mode); - -Array* Array_readLocalData(Input& fr); - -bool Primitive_readLocalData(Input& fr,osg::Geometry& geom); - -//register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Geometry) -( - new osg::Geometry, - "Geometry", - "Object Drawable Geometry", - &Geometry_readLocalData, - &Geometry_writeLocalData, - DotOsgWrapper::READ_AND_WRITE -); - -bool Geometry_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - Geometry& geom = static_cast(obj); - - if (fr.matchSequence("Primitives %i {") || fr.matchSequence("PrimitiveSets %i {") ) - { - int entry = fr[1].getNoNestedBrackets(); - - int capacity; - fr[1].getInt(capacity); - - Geometry::PrimitiveSetList& primitives = geom.getPrimitiveSetList(); - if (capacity>0) primitives.reserve(capacity); - - - fr += 3; - - - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - if (!Primitive_readLocalData(fr,geom)) fr.advanceOverCurrentFieldOrBlock(); - } - - ++fr; - - iteratorAdvanced = true; - - } - - if (fr[0].matchWord("VertexArray")) - { - if (fr.matchSequence("VertexArray %i {")) - { - - int entry = fr[0].getNoNestedBrackets(); - - int capacity; - fr[1].getInt(capacity); - - Vec3Array* vertices = new Vec3Array; - vertices->reserve(capacity); - - fr += 3; - - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - Vec3 v; - if (fr[0].getFloat(v.x()) && fr[1].getFloat(v.y()) && fr[2].getFloat(v.z())) - { - fr += 3; - vertices->push_back(v); - } - else - { - ++fr; - } - } - - geom.setVertexArray(vertices); - - iteratorAdvanced = true; - ++fr; - - } - else - { - // post 0.9.3 releases. - ++fr; - Array* vertices = Array_readLocalData(fr); - if (vertices) - { - geom.setVertexArray(vertices); - } - iteratorAdvanced = true; - } - } - - if (fr[0].matchWord("VertexIndices")) - { - ++fr; - - IndexArray* indices = dynamic_cast(Array_readLocalData(fr)); - if (indices) - { - geom.setVertexIndices(indices); - } - - iteratorAdvanced = true; - } - - - Geometry::AttributeBinding normalBinding=Geometry::BIND_OFF; - if (fr[0].matchWord("NormalBinding") && Geometry_matchBindingTypeStr(fr[1].getStr(),normalBinding)) - { - geom.setNormalBinding(normalBinding); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("NormalArray")) - { - if (fr.matchSequence("NormalArray %i {")) - { - // pre 0.9.3 releases.. - int entry = fr[0].getNoNestedBrackets(); - - int capacity; - fr[1].getInt(capacity); - - Vec3Array* normals = new Vec3Array; - normals->reserve(capacity); - - fr += 3; - - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - Vec3 v; - if (fr[0].getFloat(v.x()) && fr[1].getFloat(v.y()) && fr[2].getFloat(v.z())) - { - fr += 3; - normals->push_back(v); - } - else - { - ++fr; - } - } - - geom.setNormalArray(normals); - - iteratorAdvanced = true; - ++fr; - } - else - { - // post 0.9.3 releases. - ++fr; - Array* normals = Array_readLocalData(fr); - if (normals) - { - geom.setNormalArray(normals); - } - iteratorAdvanced = true; - } - } - if (fr[0].matchWord("NormalIndices")) - { - ++fr; - IndexArray* indices = dynamic_cast(Array_readLocalData(fr)); - if (indices) - { - geom.setNormalIndices(indices); - } - iteratorAdvanced = true; - } - - Geometry::AttributeBinding colorBinding=Geometry::BIND_OFF; - if (fr[0].matchWord("ColorBinding") && Geometry_matchBindingTypeStr(fr[1].getStr(),colorBinding)) - { - geom.setColorBinding(colorBinding); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("ColorArray")) - { - ++fr; - Array* colors = Array_readLocalData(fr); - if (colors) - { - geom.setColorArray(colors); - } - iteratorAdvanced = true; - } - - if (fr[0].matchWord("ColorIndices")) - { - ++fr; - IndexArray* indices = dynamic_cast(Array_readLocalData(fr)); - if (indices) - { - geom.setColorIndices(indices); - } - iteratorAdvanced = true; - } - - - Geometry::AttributeBinding secondaryColorBinding=Geometry::BIND_OFF; - if (fr[0].matchWord("SecondaryColorBinding") && Geometry_matchBindingTypeStr(fr[1].getStr(),secondaryColorBinding)) - { - geom.setSecondaryColorBinding(secondaryColorBinding); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("SecondaryColorArray")) - { - ++fr; - Array* colors = Array_readLocalData(fr); - if (colors) - { - geom.setSecondaryColorArray(colors); - } - iteratorAdvanced = true; - } - - if (fr[0].matchWord("SecondaryColorIndices")) - { - ++fr; - IndexArray* indices = dynamic_cast(Array_readLocalData(fr)); - if (indices) - { - geom.setSecondaryColorIndices(indices); - } - iteratorAdvanced = true; - } - - - Geometry::AttributeBinding fogCoordBinding=Geometry::BIND_OFF; - if (fr[0].matchWord("FogCoordBinding") && Geometry_matchBindingTypeStr(fr[1].getStr(),fogCoordBinding)) - { - geom.setFogCoordBinding(fogCoordBinding); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("FogCoordArray")) - { - ++fr; - Array* fogcoords = Array_readLocalData(fr); - if (fogcoords) - { - geom.setFogCoordArray(fogcoords); - } - iteratorAdvanced = true; - } - - if (fr[0].matchWord("FogCoordIndices")) - { - ++fr; - IndexArray* indices = dynamic_cast(Array_readLocalData(fr)); - if (indices) - { - geom.setFogCoordIndices(indices); - } - iteratorAdvanced = true; - } - - - if (fr.matchSequence("TexCoordArray %i")) - { - int unit=0; - fr[1].getInt(unit); - - fr+=2; - Array* texcoords = Array_readLocalData(fr); - if (texcoords) - { - geom.setTexCoordArray(unit,texcoords); - } - iteratorAdvanced = true; - - } - - if (fr.matchSequence("TexCoordIndices %i")) - { - int unit=0; - fr[1].getInt(unit); - - fr+=2; - IndexArray* indices = dynamic_cast(Array_readLocalData(fr)); - if (indices) - { - geom.setTexCoordIndices(unit,indices); - } - iteratorAdvanced = true; - } - - Geometry::AttributeBinding vertexAttribBinding=Geometry::BIND_OFF; - if (fr.matchSequence("VertexAttribBinding %i %w") && Geometry_matchBindingTypeStr(fr[2].getStr(),vertexAttribBinding)) - { - int unit=0; - fr[1].getInt(unit); - geom.setVertexAttribBinding(unit,vertexAttribBinding); - fr+=3; - iteratorAdvanced = true; - } - - if (fr.matchSequence("VertexAttribNormalize %i %w")) - { - int unit=0; - fr[1].getInt(unit); - - if (fr[2].matchString("TRUE")) - geom.setVertexAttribNormalize(unit,GL_TRUE); - else - geom.setVertexAttribNormalize(unit,GL_FALSE); - - fr+=3; - iteratorAdvanced = true; - } - - if (fr.matchSequence("VertexAttribArray %i")) - { - int unit=0; - fr[1].getInt(unit); - - fr+=2; - Array* vertexattrib = Array_readLocalData(fr); - if (vertexattrib) - { - geom.setVertexAttribArray(unit,vertexattrib); - } - iteratorAdvanced = true; - - } - - if (fr.matchSequence("VertexAttribIndices %i")) - { - int unit=0; - fr[1].getInt(unit); - - fr+=2; - IndexArray* indices = dynamic_cast(Array_readLocalData(fr)); - if (indices) - { - geom.setVertexAttribIndices(unit,indices); - } - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - - -Array* Array_readLocalData(Input& fr) -{ - if (fr[0].matchWord("Use")) - { - if (fr[1].isString()) - { - Object* obj = fr.getObjectForUniqueID(fr[1].getStr()); - if (obj) - { - fr+=2; - return dynamic_cast(obj); - } - } - - osg::notify(osg::WARN)<<"Warning: invalid uniqueID found in file."<reserve(capacity); - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - int int_value; - if (fr[0].getInt(int_value)) - { - ++fr; - array->push_back(int_value); - } - else ++fr; - } - ++fr; - - return_array = array; - } - else if (strcmp(arrayName,"ShortArray")==0) - { - ShortArray* array = new ShortArray; - array->reserve(capacity); - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - int int_value; - if (fr[0].getInt(int_value)) - { - ++fr; - array->push_back(int_value); - } - else ++fr; - } - ++fr; - return_array = array; - } - else if (strcmp(arrayName,"IntArray")==0) - { - IntArray* array = new IntArray; - array->reserve(capacity); - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - int int_value; - if (fr[0].getInt(int_value)) - { - ++fr; - array->push_back(int_value); - } - else ++fr; - } - ++fr; - return_array = array; - } - else if (strcmp(arrayName,"UByteArray")==0) - { - UByteArray* array = new UByteArray; - array->reserve(capacity); - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - unsigned int uint_value; - if (fr[0].getUInt(uint_value)) - { - ++fr; - array->push_back(uint_value); - } - else ++fr; - } - ++fr; - return_array = array; - } - else if (strcmp(arrayName,"UShortArray")==0) - { - UShortArray* array = new UShortArray; - array->reserve(capacity); - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - unsigned int uint_value; - if (fr[0].getUInt(uint_value)) - { - ++fr; - array->push_back(uint_value); - } - else ++fr; - } - ++fr; - return_array = array; - } - else if (strcmp(arrayName,"UIntArray")==0) - { - UIntArray* array = new UIntArray; - array->reserve(capacity); - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - unsigned int uint_value; - if (fr[0].getUInt(uint_value)) - { - ++fr; - array->push_back(uint_value); - } - else ++fr; - } - ++fr; - return_array = array; - } - else if (strcmp(arrayName,"UVec4bArray")==0 || strcmp(arrayName,"Vec4ubArray")==0) - { - Vec4ubArray* array = new Vec4ubArray; - array->reserve(capacity); - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - unsigned int r,g,b,a; - if (fr[0].getUInt(r) && - fr[1].getUInt(g) && - fr[2].getUInt(b) && - fr[3].getUInt(a)) - { - fr+=4; - array->push_back(osg::Vec4ub(r,g,b,a)); - } - else ++fr; - } - ++fr; - return_array = array; - } - else if (strcmp(arrayName,"FloatArray")==0) - { - FloatArray* array = new FloatArray; - array->reserve(capacity); - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - float float_value; - if (fr[0].getFloat(float_value)) - { - ++fr; - array->push_back(float_value); - } - else ++fr; - } - ++fr; - return_array = array; - } - else if (strcmp(arrayName,"DoubleArray")==0) - { - DoubleArray* array = new DoubleArray; - array->reserve(capacity); - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - double double_value; - if (fr[0].getFloat(double_value)) - { - ++fr; - array->push_back(double_value); - } - else ++fr; - } - ++fr; - return_array = array; - } - else if (strcmp(arrayName,"Vec2Array")==0) - { - Vec2Array* array = new Vec2Array; - array->reserve(capacity); - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - Vec2 v; - if (fr[0].getFloat(v.x()) && fr[1].getFloat(v.y())) - { - fr += 2; - array->push_back(v); - } - else ++fr; - } - ++fr; - return_array = array; - } - else if (strcmp(arrayName,"Vec2dArray")==0) - { - Vec2dArray* array = new Vec2dArray; - array->reserve(capacity); - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - Vec2d v; - if (fr[0].getFloat(v.x()) && fr[1].getFloat(v.y())) - { - fr += 2; - array->push_back(v); - } - else ++fr; - } - ++fr; - return_array = array; - } - else if (strcmp(arrayName,"Vec3Array")==0) - { - Vec3Array* array = new Vec3Array; - array->reserve(capacity); - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - Vec3 v; - if (fr[0].getFloat(v.x()) && fr[1].getFloat(v.y()) && fr[2].getFloat(v.z())) - { - fr += 3; - array->push_back(v); - } - else ++fr; - } - ++fr; - return_array = array; - } - else if (strcmp(arrayName,"Vec3dArray")==0) - { - Vec3dArray* array = new Vec3dArray; - array->reserve(capacity); - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - Vec3d v; - if (fr[0].getFloat(v.x()) && fr[1].getFloat(v.y()) && fr[2].getFloat(v.z())) - { - fr += 3; - array->push_back(v); - } - else ++fr; - } - ++fr; - return_array = array; - } - else if (strcmp(arrayName,"Vec4Array")==0) - { - Vec4Array* array = new Vec4Array; - array->reserve(capacity); - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - Vec4 v; - if (fr[0].getFloat(v.x()) && fr[1].getFloat(v.y()) && fr[2].getFloat(v.z()) && fr[3].getFloat(v.w())) - { - fr += 4; - array->push_back(v); - } - else ++fr; - } - ++fr; - return_array = array; - } - else if (strcmp(arrayName,"Vec4dArray")==0) - { - Vec4dArray* array = new Vec4dArray; - array->reserve(capacity); - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - Vec4d v; - if (fr[0].getFloat(v.x()) && fr[1].getFloat(v.y()) && fr[2].getFloat(v.z()) && fr[3].getFloat(v.w())) - { - fr += 4; - array->push_back(v); - } - else ++fr; - } - ++fr; - return_array = array; - } - else if (strcmp(arrayName,"Vec2bArray")==0) - { - Vec2bArray* array = new Vec2bArray; - array->reserve(capacity); - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - unsigned int r,g; - if (fr[0].getUInt(r) && - fr[1].getUInt(g)) - { - fr+=2; - array->push_back(osg::Vec2b(r,g)); - } - else ++fr; - } - ++fr; - return_array = array; - } - else if (strcmp(arrayName,"Vec3bArray")==0) - { - Vec3bArray* array = new Vec3bArray; - array->reserve(capacity); - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - unsigned int r,g,b; - if (fr[0].getUInt(r) && - fr[1].getUInt(g) && - fr[2].getUInt(b)) - { - fr+=3; - array->push_back(osg::Vec3b(r,g,b)); - } - else ++fr; - } - ++fr; - return_array = array; - } - else if (strcmp(arrayName,"Vec4bArray")==0) - { - Vec4bArray* array = new Vec4bArray; - array->reserve(capacity); - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - unsigned int r,g,b,a; - if (fr[0].getUInt(r) && - fr[1].getUInt(g) && - fr[2].getUInt(b) && - fr[3].getUInt(a)) - { - fr+=4; - array->push_back(osg::Vec4b(r,g,b,a)); - } - else ++fr; - } - ++fr; - return_array = array; - } - else if (strcmp(arrayName,"Vec2sArray")==0) - { - Vec2sArray* array = new Vec2sArray; - array->reserve(capacity); - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - unsigned int r,g; - if (fr[0].getUInt(r) && - fr[1].getUInt(g)) - { - fr+=2; - array->push_back(osg::Vec2s(r,g)); - } - else ++fr; - } - ++fr; - return_array = array; - } - else if (strcmp(arrayName,"Vec3sArray")==0) - { - Vec3sArray* array = new Vec3sArray; - array->reserve(capacity); - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - unsigned int r,g,b; - if (fr[0].getUInt(r) && - fr[1].getUInt(g) && - fr[2].getUInt(b)) - { - fr+=3; - array->push_back(osg::Vec3s(r,g,b)); - } - else ++fr; - } - ++fr; - return_array = array; - } - else if (strcmp(arrayName,"Vec4sArray")==0) - { - Vec4sArray* array = new Vec4sArray; - array->reserve(capacity); - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - unsigned int r,g,b,a; - if (fr[0].getUInt(r) && - fr[1].getUInt(g) && - fr[2].getUInt(b) && - fr[3].getUInt(a)) - { - fr+=4; - array->push_back(osg::Vec4s(r,g,b,a)); - } - else ++fr; - } - ++fr; - return_array = array; - } - - if (return_array) - { - if (!uniqueID.empty()) fr.registerUniqueIDForObject(uniqueID.c_str(),return_array); - } - - return return_array; -} - - -bool Array_writeLocalData(const Array& array,Output& fw) -{ - if (array.referenceCount()>1) - { - std::string uniqueID; - if (fw.getUniqueIDForObject(&array,uniqueID)) - { - fw << "Use " << uniqueID << std::endl; - return true; - } - else - { - std::string uniqueID; - fw.createUniqueIDForObject(&array,uniqueID); - fw.registerUniqueIDForObject(&array,uniqueID); - fw << "UniqueID " << uniqueID << " "; - } - } - - - switch(array.getType()) - { - case(Array::ByteArrayType): - { - const ByteArray& carray = static_cast(array); - fw<(array); - fw<(array); - fw<(array); - fw<(array); - fw<(array); - fw<(array); - fw<(array); - fw<(array); - fw<(array); - fw<(array); - fw<(array); - fw<(array); - fw<(array); - fw<(array); - fw<(array); - fw<(array); - fw<(array); - fw<(array); - fw<(array); - fw<(array); - fw<setMode(mode); - prim->setNumInstances(numInstances); - prim->setFirst(first); - prim->reserve(capacity); - - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - unsigned int i; - if (fr[0].getUInt(i)) - { - prim->push_back(i); - ++fr; - } - } - ++fr; - - geom.addPrimitiveSet(prim); - - iteratorAdvanced = true; - } - else if ((firstMatched = fr.matchSequence("DrawElementsUByte %w %i %i {")) || - fr.matchSequence("DrawElementsUByte %w %i {")) - { - int entry = fr[1].getNoNestedBrackets(); - - GLenum mode; - Geometry_matchPrimitiveModeStr(fr[1].getStr(),mode); - - int capacity; - fr[2].getInt(capacity); - - int numInstances = 0; - if (firstMatched) - { - fr[3].getInt(numInstances); - fr += 5; - } - else - { - fr += 4; - } - - DrawElementsUByte* prim = new DrawElementsUByte; - prim->setMode(mode); - prim->setNumInstances(numInstances); - prim->reserve(capacity); - - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - unsigned int i; - if (fr[0].getUInt(i)) - { - prim->push_back(i); - ++fr; - } - } - ++fr; - - geom.addPrimitiveSet(prim); - - iteratorAdvanced = true; - } - else if ((firstMatched = fr.matchSequence("DrawElementsUShort %w %i %i {")) || - fr.matchSequence("DrawElementsUShort %w %i {")) - { - int entry = fr[1].getNoNestedBrackets(); - - GLenum mode; - Geometry_matchPrimitiveModeStr(fr[1].getStr(),mode); - - int capacity; - fr[2].getInt(capacity); - - int numInstances = 0; - if (firstMatched) - { - fr[3].getInt(numInstances); - fr += 5; - } - else - { - fr += 4; - } - - DrawElementsUShort* prim = new DrawElementsUShort; - prim->setMode(mode); - prim->setNumInstances(numInstances); - prim->reserve(capacity); - - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - unsigned int i; - if (fr[0].getUInt(i)) - { - prim->push_back(i); - ++fr; - } - } - ++fr; - - geom.addPrimitiveSet(prim); - - iteratorAdvanced = true; - } - else if ((firstMatched = fr.matchSequence("DrawElementsUInt %w %i %i {")) || - fr.matchSequence("DrawElementsUInt %w %i {")) - { - int entry = fr[1].getNoNestedBrackets(); - - GLenum mode; - Geometry_matchPrimitiveModeStr(fr[1].getStr(),mode); - - int capacity; - fr[2].getInt(capacity); - - int numInstances = 0; - if (firstMatched) - { - fr[3].getInt(numInstances); - fr += 5; - } - else - { - fr += 4; - } - - DrawElementsUInt* prim = new DrawElementsUInt; - prim->setMode(mode); - prim->setNumInstances(numInstances); - prim->reserve(capacity); - - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - unsigned int i; - if (fr[0].getUInt(i)) - { - prim->push_back(i); - ++fr; - } - } - ++fr; - - geom.addPrimitiveSet(prim); - - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - -bool Primitive_writeLocalData(const PrimitiveSet& prim,Output& fw) -{ - - switch(prim.getType()) - { - case(PrimitiveSet::DrawArraysPrimitiveType): - { - const DrawArrays& cprim = static_cast(prim); - fw<0) fw<<" "<(prim); - fw<0) fw<<" "<(prim); - fw<0) fw<<" "<(prim); - fw<0) fw<<" "<(prim); - fw<0) fw<<" "<(obj); - - const Geometry::PrimitiveSetList& primitives = geom.getPrimitiveSetList(); - if (!primitives.empty()) - { - fw.indent() << "PrimitiveSets "<(obj); - - int num_children; - if (fr[0].matchWord("num_children") && - fr[1].getInt(num_children)) - { - // could allocate space for children here... - fr+=2; - iteratorAdvanced = true; - } - - Node* node = NULL; - while((node=fr.readNode())!=NULL) - { - group.addChild(node); - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - - -bool Group_writeLocalData(const Object& obj, Output& fw) -{ - const Group& group = static_cast(obj); - - if (group.getNumChildren()!=0) fw.indent() << "num_children " << group.getNumChildren() << std::endl; - - for(unsigned int i=0;i -#include -#include - -#include -#include -#include - -using namespace osg; -using namespace osgDB; - - -////////////////////////////////////////////////////////////////////////////// -// forward declare functions to use later. -bool HeightField_readLocalData(Object& obj, Input& fr); -bool HeightField_writeLocalData(const Object& obj, Output& fw); - -//register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(HeightField) -( - new osg::HeightField, - "HeightField", - "Object HeightField", - &HeightField_readLocalData, - &HeightField_writeLocalData, - DotOsgWrapper::READ_AND_WRITE -); - -//register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Grid) -( - new osg::HeightField, - "Grid", - "Object HeightField", - 0, - 0, - DotOsgWrapper::READ_AND_WRITE -); - -bool HeightField_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - HeightField& heightfield = static_cast(obj); - - if (fr.matchSequence("Origin %f %f %f")) - { - osg::Vec3 origin; - fr[1].getFloat(origin.x()); - fr[2].getFloat(origin.y()); - fr[3].getFloat(origin.z()); - heightfield.setOrigin(origin); - fr+=4; - } - - if (fr.matchSequence("XInterval %f")) - { - float interval; - fr[1].getFloat(interval); - heightfield.setXInterval(interval); - fr+=2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("YInterval %f")) - { - float interval; - fr[1].getFloat(interval); - heightfield.setYInterval(interval); - fr+=2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("SkirtHeight %f")) - { - float height; - fr[1].getFloat(height); - heightfield.setSkirtHeight(height); - fr+=2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("BorderWidth %i")) - { - unsigned int width; - fr[1].getUInt(width); - heightfield.setBorderWidth(width); - fr+=2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("Rotation %f %f %f %f")) - { - osg::Quat rotation; - fr[1].getFloat(rotation.x()); - fr[2].getFloat(rotation.y()); - fr[3].getFloat(rotation.z()); - fr[4].getFloat(rotation.w()); - heightfield.setRotation(rotation); - fr+=5; - iteratorAdvanced = true; - } - - if (fr.matchSequence("NumColumnsAndRows %i %i")) - { - int numcolumns,numrows; - fr[1].getInt(numcolumns); - fr[2].getInt(numrows); - heightfield.allocate(numcolumns,numrows); - fr+=3; - iteratorAdvanced = true; - } - - if (fr.matchSequence("Heights {")) - { - - int entry = fr[0].getNoNestedBrackets(); - - fr += 2; - - float height; - unsigned int row = 0; - unsigned int column = 0; - - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - if (fr.readSequence(height)) - { - heightfield.setHeight(column,row,height); - ++column; - if (column>=heightfield.getNumColumns()) - { - column = 0; - ++row; - } - } - else - { - ++fr; - } - } - - iteratorAdvanced = true; - ++fr; - - } - - return iteratorAdvanced; -} - -bool HeightField_writeLocalData(const Object& obj, Output& fw) -{ - const HeightField& heightfield = static_cast(obj); - - int prec = fw.precision(); - fw.precision(15); - fw.indent()<<"Origin "<(obj); - - // no current image reading code - // as it is all handled by osg::Registry::readImage() via plugins. - - return iteratorAdvanced; -} - - -bool Image_writeLocalData(const Object& /*obj*/, Output& /*fw*/) -{ - // const Image& image = static_cast(obj); - - // no current image writing code here - // as it is all handled by osg::Registry::writeImage() via plugins. - - return true; -} diff --git a/src/osgPlugins/osg/ImageSequence.cpp b/src/osgPlugins/osg/ImageSequence.cpp deleted file mode 100644 index 17a25d439..000000000 --- a/src/osgPlugins/osg/ImageSequence.cpp +++ /dev/null @@ -1,144 +0,0 @@ -#include "osg/ImageSequence" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool ImageSequence_readLocalData(Object& obj, Input& fr); -bool ImageSequence_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(ImageSequence) -( - new osg::ImageSequence, - "ImageSequence", - "Object ImageSequence", - &ImageSequence_readLocalData, - &ImageSequence_writeLocalData -); - -bool ImageSequence_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - ImageSequence& is = static_cast(obj); - - std::string modeStr; - if (fr.read("Mode",modeStr)) - { - if (modeStr=="PRE_LOAD_ALL_IMAGES") - { - is.setMode(osg::ImageSequence::PRE_LOAD_ALL_IMAGES); - } - else if (modeStr=="PAGE_AND_RETAIN_IMAGES") - { - is.setMode(osg::ImageSequence::PAGE_AND_RETAIN_IMAGES); - } - else if (modeStr=="PAGE_AND_DISCARD_USED_IMAGES") - { - is.setMode(osg::ImageSequence::PAGE_AND_DISCARD_USED_IMAGES); - } - } - - double length; - if (fr.read("Duration", length) || fr.read("Length", length) ) - { - is.setLength(length); - } - - if (fr.matchSequence("FileNames {")) - { - fr += 2; - iteratorAdvanced = true; - int entry = fr[0].getNoNestedBrackets(); - while (!fr.eof() && fr[0].getNoNestedBrackets() >= entry) - { - if (fr[0].getStr()) - { - is.addImageFile(fr[0].getStr()); - } - ++fr; - } - } - - if (fr.matchSequence("Images {")) - { - fr += 2; - iteratorAdvanced = true; - int entry = fr[0].getNoNestedBrackets(); - while (!fr.eof() && fr[0].getNoNestedBrackets() >= entry) - { - if (fr[0].getStr()) - { - osg::ref_ptr image = fr.readImage(fr[0].getStr()); - if (image.valid()) is.addImage(image.get()); - } - ++fr; - } - } - - return iteratorAdvanced; -} - - -bool ImageSequence_writeLocalData(const Object& obj, Output& fw) -{ - const ImageSequence& is = static_cast(obj); - - // no current image writing code here - // as it is all handled by osg::Registry::writeImage() via plugins. - - switch(is.getMode()) - { - case(osg::ImageSequence::PRE_LOAD_ALL_IMAGES): - fw.indent()<<"Mode PRE_LOAD_ALL_IMAGES"<getFileName().empty()) fw.indent()<getFileName())< - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool LOD_readLocalData(Object& obj, Input& fr); -bool LOD_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(LOD) -( - new osg::LOD, - "LOD", - "Object Node LOD Group", - &LOD_readLocalData, - &LOD_writeLocalData -); - -bool LOD_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - LOD& lod = static_cast(obj); - - if (fr.matchSequence("Center %f %f %f")) - { - Vec3 center; - fr[1].getFloat(center[0]); - fr[2].getFloat(center[1]); - fr[3].getFloat(center[2]); - lod.setCenter(center); - - iteratorAdvanced = true; - fr+=4; - } - - float radius; - if (fr[0].matchWord("Radius") && fr[1].getFloat(radius)) - { - lod.setRadius(radius); - fr+=2; - iteratorAdvanced = true; - } - - - if(fr[0].matchWord("RangeMode")){ - if(fr[1].matchWord("DISTANCE_FROM_EYE_POINT")){ - lod.setRangeMode(osg::LOD::DISTANCE_FROM_EYE_POINT); - } - else { - lod.setRangeMode(osg::LOD::PIXEL_SIZE_ON_SCREEN); - } - fr+=2; - iteratorAdvanced = true; - } - - - - // For backwards compatibility with old style LOD's (pre October 2002). - bool matchFirst = false; - if ((matchFirst=fr.matchSequence("Ranges {")) || fr.matchSequence("Ranges %i {")) - { - - // set up coordinates. - int entry = fr[0].getNoNestedBrackets(); - if (matchFirst) - { - fr += 2; - } - else - { - fr += 3; - } - - float minRange=0.0; - float maxRange=0.0; - unsigned int i=0; - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - if (fr[0].getFloat(maxRange)) - { - if (i>0) lod.setRange(i-1,minRange,maxRange); - ++fr; - ++i; - minRange = maxRange; - } - else - { - ++fr; - } - } - - iteratorAdvanced = true; - ++fr; - - } - - if ((matchFirst=fr.matchSequence("RangeList {")) || fr.matchSequence("RangeList %i {")) - { - - // set up coordinates. - int entry = fr[0].getNoNestedBrackets(); - if (matchFirst) - { - fr += 2; - } - else - { - fr += 3; - } - - float minRange=0.0; - float maxRange=0.0; - unsigned int i=0; - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - if (fr[0].getFloat(minRange) && fr[1].getFloat(maxRange) ) - { - lod.setRange(i,minRange,maxRange); - fr+=2; - ++i; - } - else - { - ++fr; - } - } - - iteratorAdvanced = true; - ++fr; - - } - return iteratorAdvanced; -} - - -bool LOD_writeLocalData(const Object& obj, Output& fw) -{ - const LOD& lod = static_cast(obj); - - if (lod.getCenterMode()==osg::LOD::USER_DEFINED_CENTER) fw.indent() << "Center "<< lod.getCenter() << std::endl; - - fw.indent() << "Radius "< - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool Light_readLocalData(Object& obj, Input& fr); -bool Light_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Light) -( - new osg::Light, - "Light", - "Object StateAttribute Light", - &Light_readLocalData, - &Light_writeLocalData -); - - -bool Light_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - Light& light = static_cast(obj); - - if (fr[0].matchWord("light_num")) - { - int lightnum=0; - if (fr[1].getInt(lightnum)) - { - light.setLightNum(lightnum); - fr += 2; - iteratorAdvanced = true; - } - } - -#define ReadVec4(A,B) { \ - if (fr[0].matchWord(B) && \ - fr[1].getFloat(vec4[0]) && \ - fr[2].getFloat(vec4[1]) && \ - fr[3].getFloat(vec4[2]) && \ - fr[4].getFloat(vec4[3])) \ - { \ - light.A(vec4); \ - fr+=5; \ - iteratorAdvanced = true; \ - } \ -} - -#define ReadVec3(A,B) { \ - if (fr[0].matchWord(B) && \ - fr[1].getFloat(vec3[0]) && \ - fr[2].getFloat(vec3[1]) && \ - fr[3].getFloat(vec3[2])) \ - { \ - light.A(vec3); \ - fr+=4; \ - iteratorAdvanced = true; \ - } \ -} - -#define ReadFloat(A,B) { \ - if (fr[0].matchWord(B) && \ - fr[1].getFloat(value)) \ - { \ - light.A(value); \ - fr+=2; \ - iteratorAdvanced = true; \ - } \ -} - - Vec4 vec4; - ReadVec4(setAmbient,"ambient") - ReadVec4(setDiffuse,"diffuse") - ReadVec4(setSpecular,"specular") - ReadVec4(setPosition,"position") - - Vec3 vec3; - ReadVec3(setDirection,"direction") - - float value; - ReadFloat(setConstantAttenuation,"constant_attenuation") - ReadFloat(setLinearAttenuation,"linear_attenuation") - ReadFloat(setQuadraticAttenuation,"quadratic_attenuation") - ReadFloat(setSpotExponent,"spot_exponent") - ReadFloat(setSpotCutoff,"spot_cutoff") - -#undef ReadVec4 -#undef ReadVec3 -#undef ReadFloat - - return iteratorAdvanced; -} - - -bool Light_writeLocalData(const Object& obj,Output& fw) -{ - const Light& light = static_cast(obj); - - fw.indent() << "light_num " << light.getLightNum() << std::endl; - - // Vec4's - fw.indent() << "ambient " << light.getAmbient() << std::endl; - fw.indent() << "diffuse " << light.getDiffuse() << std::endl; - fw.indent() << "specular " << light.getSpecular() << std::endl; - fw.indent() << "position " << light.getPosition() << std::endl; - - // Vec3's - fw.indent() << "direction " << light.getDirection() << std::endl; - - // float's - fw.indent() << "constant_attenuation " << light.getConstantAttenuation() << std::endl; - fw.indent() << "linear_attenuation " << light.getLinearAttenuation () << std::endl; - fw.indent() << "quadratic_attenuation " << light.getQuadraticAttenuation() << std::endl; - fw.indent() << "spot_exponent " << light.getSpotExponent() << std::endl; - fw.indent() << "spot_cutoff " << light.getSpotCutoff() << std::endl; - - return true; -} diff --git a/src/osgPlugins/osg/LightModel.cpp b/src/osgPlugins/osg/LightModel.cpp deleted file mode 100644 index a708b1b66..000000000 --- a/src/osgPlugins/osg/LightModel.cpp +++ /dev/null @@ -1,116 +0,0 @@ -#include -#include - -#include -#include -#include - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool LightModel_readLocalData(Object& obj, Input& fr); -bool LightModel_writeLocalData(const Object& obj, Output& fw); - - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(LightModel) -( - new osg::LightModel, - "LightModel", - "Object StateAttribute LightModel", - &LightModel_readLocalData, - &LightModel_writeLocalData -); - - -bool LightModel_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - LightModel& lightmodel = static_cast(obj); - - osg::Vec4 ambient; - if (fr[0].matchWord("ambientIntensity") && - fr[1].getFloat(ambient[0]) && - fr[2].getFloat(ambient[1]) && - fr[3].getFloat(ambient[2]) && - fr[4].getFloat(ambient[3])) - { - lightmodel.setAmbientIntensity(ambient); - fr+=5; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("colorControl")) - { - if (fr[1].matchWord("SEPARATE_SPECULAR_COLOR")) - { - lightmodel.setColorControl(osg::LightModel::SEPARATE_SPECULAR_COLOR); - } - else if (fr[1].matchWord("SINGLE_COLOR")) - { - lightmodel.setColorControl(osg::LightModel::SINGLE_COLOR); - } - } - - int result; - if (fr[0].matchWord("localViewer") && fr[1].getInt(result)) - { - if (fr[1].matchWord("TRUE")) - { - lightmodel.setLocalViewer(true); - fr+=2; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("FALSE")) - { - lightmodel.setLocalViewer(false); - fr+=2; - iteratorAdvanced = true; - } - } - - if (fr[0].matchWord("twoSided")) - { - if (fr[1].matchWord("TRUE")) - { - lightmodel.setTwoSided(true); - fr+=2; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("FALSE")) - { - lightmodel.setTwoSided(false); - fr+=2; - iteratorAdvanced = true; - } - } - - return iteratorAdvanced; -} - -bool LightModel_writeLocalData(const Object& obj,Output& fw) -{ - const LightModel& lightmodel = static_cast(obj); - - fw.indent() << "ambientIntensity " << lightmodel.getAmbientIntensity() << std::endl; - - if (lightmodel.getColorControl()==osg::LightModel::SEPARATE_SPECULAR_COLOR) - fw.indent() << "colorControl SEPARATE_SPECULAR_COLOR" << std::endl; - else - fw.indent() << "colorControl SINGLE_COLOR" << std::endl; - - if (lightmodel.getLocalViewer()) - fw.indent() << "localViewer TRUE"<< std::endl; - else - fw.indent() << "localViewer FALSE"<< std::endl; - - if (lightmodel.getTwoSided()) - fw.indent() << "twoSided TRUE"<< std::endl; - else - fw.indent() << "twoSided FALSE"<< std::endl; - - return true; -} - diff --git a/src/osgPlugins/osg/LightSource.cpp b/src/osgPlugins/osg/LightSource.cpp deleted file mode 100644 index d582f4d1d..000000000 --- a/src/osgPlugins/osg/LightSource.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "osg/LightSource" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool LightSource_readLocalData(Object& obj, Input& fr); -bool LightSource_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(LightSource) -( - new osg::LightSource, - "LightSource", - "Object Node LightSource Group", - &LightSource_readLocalData, - &LightSource_writeLocalData -); - -bool LightSource_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - LightSource& lightsource = static_cast(obj); - - if (fr[0].matchWord("referenceFrame")) - { - bool cullingActiveBefore = lightsource.getCullingActive(); - - if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE") || fr[1].matchWord("ABSOLUTE")) - { - lightsource.setReferenceFrame(LightSource::ABSOLUTE_RF); - fr += 2; - iteratorAdvanced = true; - } - if (fr[1].matchWord("RELATIVE_TO_PARENTS") || fr[1].matchWord("RELATIVE")) - { - lightsource.setReferenceFrame(LightSource::RELATIVE_RF); - fr += 2; - iteratorAdvanced = true; - } - - // if culling wasn't before reset it to off. - if (!cullingActiveBefore && lightsource.getCullingActive()) - { - lightsource.setCullingActive(cullingActiveBefore); - } - } - - osg::ref_ptr sa=fr.readStateAttribute(); - osg::Light* light = dynamic_cast(sa.get()); - if (light) - { - lightsource.setLight(light); - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - - -bool LightSource_writeLocalData(const Object& obj, Output& fw) -{ - const LightSource& lightsource = static_cast(obj); - - fw.indent() << "referenceFrame "; - switch (lightsource.getReferenceFrame()) - { - case LightSource::ABSOLUTE_RF: - fw << "ABSOLUTE\n"; - break; - case LightSource::RELATIVE_RF: - default: - fw << "RELATIVE\n"; - }; - - if (lightsource.getLight()) fw.writeObject(*lightsource.getLight()); - - return true; -} diff --git a/src/osgPlugins/osg/LineStipple.cpp b/src/osgPlugins/osg/LineStipple.cpp deleted file mode 100644 index 5558603e1..000000000 --- a/src/osgPlugins/osg/LineStipple.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include - -#include -#include -#include - -using namespace osg; -using namespace osgDB; -using namespace std; - -// forward declare functions to use later. -bool LineStipple_readLocalData(Object& obj, Input& fr); -bool LineStipple_writeLocalData(const Object& obj, Output& fw); - - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(LineStipple) -( - new osg::LineStipple, - "LineStipple", - "Object StateAttribute LineStipple", - &LineStipple_readLocalData, - &LineStipple_writeLocalData -); - - -bool LineStipple_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - LineStipple& linestipple = static_cast(obj); - - int ref = linestipple.getFactor(); - if (fr[0].matchWord("factor") && fr[1].getInt(ref)) - { - linestipple.setFactor(ref); - fr+=2; - iteratorAdvanced = true; - } - - unsigned int mask = linestipple.getPattern(); - if (fr[0].matchWord("pattern") && fr[1].getUInt(mask)) - { - linestipple.setPattern(mask); - fr+=2; - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - -bool LineStipple_writeLocalData(const Object& obj,Output& fw) -{ - const LineStipple& linestipple = static_cast(obj); - - fw.indent() << "factor " << linestipple.getFactor() << std::endl; - fw.indent() << "pattern 0x" << hex << linestipple.getPattern() << dec << std::endl; - - return true; -} - diff --git a/src/osgPlugins/osg/LineWidth.cpp b/src/osgPlugins/osg/LineWidth.cpp deleted file mode 100644 index 5849618b7..000000000 --- a/src/osgPlugins/osg/LineWidth.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#if defined(_MSC_VER) - #pragma warning( disable : 4786 ) -#endif - -#include - -#include -#include -#include - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool LineWidth_readLocalData(Object& obj, Input& fr); -bool LineWidth_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(LineWidth) -( - new osg::LineWidth, - "LineWidth", - "Object StateAttribute LineWidth", - &LineWidth_readLocalData, - &LineWidth_writeLocalData -); - - -bool LineWidth_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - LineWidth& lineWidth = static_cast(obj); - - float data; - if (fr[0].matchWord("width") && fr[1].getFloat(data)) - { - - lineWidth.setWidth(data); - fr+=2; - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - - -bool LineWidth_writeLocalData(const Object& obj, Output& fw) -{ - const LineWidth& lineWidth = static_cast(obj); - - fw.indent() << "width " << lineWidth.getWidth() << std::endl; - return true; -} diff --git a/src/osgPlugins/osg/Material.cpp b/src/osgPlugins/osg/Material.cpp deleted file mode 100644 index e2664cc3f..000000000 --- a/src/osgPlugins/osg/Material.cpp +++ /dev/null @@ -1,254 +0,0 @@ -#if defined(_MSC_VER) - #pragma warning( disable : 4786 ) -#endif - -#include "osg/Material" -#include - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool Material_readLocalData(Object& obj, Input& fr); -bool Material_writeLocalData(const Object& obj, Output& fw); -bool Material_matchFaceAndColor(Input& fr,const char* name,Material::Face& mf,Vec4& color); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Material) -( - new osg::Material, - "Material", - "Object StateAttribute Material", - &Material_readLocalData, - &Material_writeLocalData -); - - -bool Material_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - Material& material = static_cast(obj); - - Vec4 data(0.0f, 0.0f, 0.0f, 1.0f); - Material::Face mf = Material::FRONT_AND_BACK; - - if (fr[0].matchWord("ColorMode")) - { - if (fr[1].matchWord("AMBIENT")) - { - material.setColorMode(Material::AMBIENT); - fr+=2; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("DIFFUSE")) - { - material.setColorMode(Material::DIFFUSE); - fr+=2; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("SPECULAR")) - { - material.setColorMode(Material::SPECULAR); - fr+=2; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("EMISSION")) - { - material.setColorMode(Material::EMISSION); - fr+=2; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("AMBIENT_AND_DIFFUSE")) - { - material.setColorMode(Material::AMBIENT_AND_DIFFUSE); - fr+=2; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("OFF")) - { - material.setColorMode(Material::OFF); - fr+=2; - iteratorAdvanced = true; - } - - } - - if (Material_matchFaceAndColor(fr,"ambientColor",mf,data)) - { - material.setAmbient(mf,data); - iteratorAdvanced = true; - } - - if (Material_matchFaceAndColor(fr,"diffuseColor",mf,data)) - { - material.setDiffuse(mf,data); - iteratorAdvanced = true; - } - - if (Material_matchFaceAndColor(fr,"specularColor",mf,data)) - { - material.setSpecular(mf,data); - iteratorAdvanced = true; - } - - if (Material_matchFaceAndColor(fr,"emissionColor",mf,data) || - Material_matchFaceAndColor(fr,"emissiveColor",mf,data)) - { - material.setEmission(mf,data); - iteratorAdvanced = true; - } - - if (Material_matchFaceAndColor(fr,"ambientColor",mf,data)) - { - material.setAmbient(mf,data); - iteratorAdvanced = true; - } - - float shininess = 0.0f; - if (fr[0].matchWord("shininess")) - { - - mf = Material::FRONT_AND_BACK; - int fr_inc = 1; - - if (fr[1].matchWord("FRONT")) - { - mf = Material::FRONT; - ++fr_inc; - } - else if (fr[1].matchWord("BACK")) - { - mf = Material::BACK; - ++fr_inc; - } - - if (fr[fr_inc].getFloat(shininess)) - { - fr+=(fr_inc+1); - material.setShininess(mf,shininess); - iteratorAdvanced = true; - } - - } - - float transparency = 0.0f; - if (fr[0].matchWord("transparency") && fr[1].getFloat(transparency)) - { - - material.setTransparency(Material::FRONT_AND_BACK,transparency); - - fr+=2; - iteratorAdvanced = true; - } - - return iteratorAdvanced; - -} - -bool Material_matchFaceAndColor(Input& fr,const char* name,Material::Face& mf,Vec4& color) -{ - bool iteratorAdvanced = false; - - if (fr[0].matchWord(name)) - { - int fr_inc = 1; - if (fr[1].matchWord("FRONT")) - { - mf = Material::FRONT; - ++fr_inc; - } - else if (fr[1].matchWord("BACK")) - { - mf = Material::BACK; - ++fr_inc; - } - - if (fr[fr_inc].getFloat(color[0]) && fr[fr_inc+1].getFloat(color[1]) && fr[fr_inc+2].getFloat(color[2])) - { - fr_inc += 3; - - if (fr[fr_inc].getFloat(color[3])) ++fr_inc; - else color[3] = 1.0f; - - fr+=fr_inc; - - iteratorAdvanced = true; - } - } - - return iteratorAdvanced; -} - - -bool Material_writeLocalData(const Object& obj, Output& fw) -{ - - const Material& material = static_cast(obj); - - switch(material.getColorMode()) - { - case(Material::AMBIENT): fw.indent() << "ColorMode AMBIENT" << std::endl; break; - case(Material::DIFFUSE): fw.indent() << "ColorMode DIFFUSE" << std::endl; break; - case(Material::SPECULAR): fw.indent() << "ColorMode SPECULAR" << std::endl; break; - case(Material::EMISSION): fw.indent() << "ColorMode EMISSION" << std::endl; break; - case(Material::AMBIENT_AND_DIFFUSE): fw.indent() << "ColorMode AMBIENT_AND_DIFFUSE" << std::endl; break; - case(Material::OFF): fw.indent() << "ColorMode OFF" << std::endl; break; - } - - if (material.getAmbientFrontAndBack()) - { - fw.indent() << "ambientColor " << material.getAmbient(Material::FRONT) << std::endl; - } - else - { - fw.indent() << "ambientColor FRONT " << material.getAmbient(Material::FRONT) << std::endl; - fw.indent() << "ambientColor BACK " << material.getAmbient(Material::BACK) << std::endl; - } - - if (material.getDiffuseFrontAndBack()) - { - fw.indent() << "diffuseColor " << material.getDiffuse(Material::FRONT) << std::endl; - } - else - { - fw.indent() << "diffuseColor FRONT " << material.getDiffuse(Material::FRONT) << std::endl; - fw.indent() << "diffuseColor BACK " << material.getDiffuse(Material::BACK) << std::endl; - } - - if (material.getSpecularFrontAndBack()) - { - fw.indent() << "specularColor " << material.getSpecular(Material::FRONT) << std::endl; - } - else - { - fw.indent() << "specularColor FRONT " << material.getSpecular(Material::FRONT) << std::endl; - fw.indent() << "specularColor BACK " << material.getSpecular(Material::BACK) << std::endl; - } - - if (material.getEmissionFrontAndBack()) - { - fw.indent() << "emissionColor " << material.getEmission(Material::FRONT) << std::endl; - } - else - { - fw.indent() << "emissionColor FRONT " << material.getEmission(Material::FRONT) << std::endl; - fw.indent() << "emissionColor BACK " << material.getEmission(Material::BACK) << std::endl; - } - - if (material.getShininessFrontAndBack()) - { - fw.indent() << "shininess " << material.getShininess(Material::FRONT) << std::endl; - } - else - { - fw.indent() << "shininess FRONT " << material.getShininess(Material::FRONT) << std::endl; - fw.indent() << "shininess BACK " << material.getShininess(Material::BACK) << std::endl; - } - - return true; -} diff --git a/src/osgPlugins/osg/Matrix.cpp b/src/osgPlugins/osg/Matrix.cpp deleted file mode 100644 index bb36713a9..000000000 --- a/src/osgPlugins/osg/Matrix.cpp +++ /dev/null @@ -1,51 +0,0 @@ -#include "Matrix.h" - - -bool readMatrix(osg::Matrix& matrix, osgDB::Input& fr, const char* keyword) -{ - bool iteratorAdvanced = false; - - if (fr[0].matchWord(keyword) && fr[1].isOpenBracket()) - { - int entry = fr[0].getNoNestedBrackets(); - - fr += 2; - - int row=0; - int col=0; - double v; - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - if (fr[0].getFloat(v)) - { - matrix(row,col)=v; - ++col; - if (col>=4) - { - col = 0; - ++row; - } - ++fr; - } - else fr.advanceOverCurrentFieldOrBlock(); - } - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - - -bool writeMatrix(const osg::Matrix& matrix, osgDB::Output& fw, const char* keyword) -{ - fw.indent() << keyword <<" {" << std::endl; - fw.moveIn(); - fw.indent() << matrix(0,0) << " " << matrix(0,1) << " " << matrix(0,2) << " " << matrix(0,3) << std::endl; - fw.indent() << matrix(1,0) << " " << matrix(1,1) << " " << matrix(1,2) << " " << matrix(1,3) << std::endl; - fw.indent() << matrix(2,0) << " " << matrix(2,1) << " " << matrix(2,2) << " " << matrix(2,3) << std::endl; - fw.indent() << matrix(3,0) << " " << matrix(3,1) << " " << matrix(3,2) << " " << matrix(3,3) << std::endl; - fw.moveOut(); - fw.indent() << "}"<< std::endl; - return true; -} - diff --git a/src/osgPlugins/osg/Matrix.h b/src/osgPlugins/osg/Matrix.h deleted file mode 100644 index e5fa46724..000000000 --- a/src/osgPlugins/osg/Matrix.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef DOTOSG_MATRIX -#define DOTOSG_MATRIX - -#include - -#include -#include - -extern bool readMatrix(osg::Matrix& matrix, osgDB::Input& fr, const char* keyword="Matrix"); - -extern bool writeMatrix(const osg::Matrix& matrix, osgDB::Output& fw, const char* keyword="Matrix"); - -#endif diff --git a/src/osgPlugins/osg/MatrixTransform.cpp b/src/osgPlugins/osg/MatrixTransform.cpp deleted file mode 100644 index abb082876..000000000 --- a/src/osgPlugins/osg/MatrixTransform.cpp +++ /dev/null @@ -1,79 +0,0 @@ -#include - -#include -#include -#include - -#include "Matrix.h" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool MatrixTransform_readLocalData(Object& obj, Input& fr); -bool MatrixTransform_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(MatrixTransform) -( - new osg::MatrixTransform, - "MatrixTransform", - "Object Node Transform MatrixTransform Group", - &MatrixTransform_readLocalData, - &MatrixTransform_writeLocalData, - DotOsgWrapper::READ_AND_WRITE -); - -// register old style 'DCS' read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(DCS) -( - new osg::MatrixTransform, - "DCS", - "Object Node Group DCS", - &MatrixTransform_readLocalData, - NULL, - DotOsgWrapper::READ_ONLY -); - -bool MatrixTransform_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - MatrixTransform& transform = static_cast(obj); - - if (fr[0].matchWord("Type")) - { - if (fr[1].matchWord("DYNAMIC")) - { - transform.setDataVariance(osg::Object::DYNAMIC); - fr +=2 ; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("STATIC")) - { - transform.setDataVariance(osg::Object::STATIC); - fr +=2 ; - iteratorAdvanced = true; - } - - } - - Matrix matrix; - if (readMatrix(matrix,fr)) - { - transform.setMatrix(matrix); - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - - -bool MatrixTransform_writeLocalData(const Object& obj, Output& fw) -{ - const MatrixTransform& transform = static_cast(obj); - - writeMatrix(transform.getMatrix(),fw); - - return true; -} diff --git a/src/osgPlugins/osg/Node.cpp b/src/osgPlugins/osg/Node.cpp deleted file mode 100644 index 4b523b422..000000000 --- a/src/osgPlugins/osg/Node.cpp +++ /dev/null @@ -1,262 +0,0 @@ -#include "osg/Node" -#include "osg/io_utils" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; -using namespace std; - -// forward declare functions to use later. -bool Node_readLocalData(Object& obj, Input& fr); -bool Node_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Node) -( - new osg::Node, - "Node", - "Object Node", - &Node_readLocalData, - &Node_writeLocalData -); - -bool Node_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - Node& node = static_cast(obj); - - unsigned int mask = node.getNodeMask(); - if (fr[0].matchWord("nodeMask") && fr[1].getUInt(mask)) - { - node.setNodeMask(mask); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("cullingActive")) - { - if (fr[1].matchWord("FALSE")) - { - node.setCullingActive(false); - iteratorAdvanced = true; - fr+=2; - } - else if (fr[1].matchWord("TRUE")) - { - node.setCullingActive(true); - iteratorAdvanced = true; - fr+=2; - } - } - - while (fr.matchSequence("description {")) - { - int entry = fr[0].getNoNestedBrackets(); - fr += 2; - - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - if (fr[0].getStr()) node.addDescription(std::string(fr[0].getStr())); - ++fr; - } - iteratorAdvanced = true; - - } - - while (fr.matchSequence("description %s")) - { - if (fr[1].getStr()) node.addDescription(fr[1].getStr()); - fr+=2; - iteratorAdvanced = true; - } - - static ref_ptr s_drawstate = new osg::StateSet; - if (StateSet* readState = static_cast(fr.readObjectOfType(*s_drawstate))) - { - node.setStateSet(readState); - iteratorAdvanced = true; - } - - - static ref_ptr s_nodecallback = new osg::NodeCallback; - while (fr.matchSequence("UpdateCallback {")) - { - int entry = fr[0].getNoNestedBrackets(); - fr += 2; - - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - NodeCallback* nodecallback = dynamic_cast(fr.readObjectOfType(*s_nodecallback)); - if (nodecallback) { - if (node.getUpdateCallback() == NULL) { - node.setUpdateCallback(nodecallback); - } else { - node.getUpdateCallback()->addNestedCallback(nodecallback); - } - } - else ++fr; - } - iteratorAdvanced = true; - - } - - while (fr.matchSequence("EventCallback {")) - { - int entry = fr[0].getNoNestedBrackets(); - fr += 2; - - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - NodeCallback* nodecallback = dynamic_cast(fr.readObjectOfType(*s_nodecallback)); - if (nodecallback) { - if (node.getEventCallback() == NULL) { - node.setEventCallback(nodecallback); - } else { - node.getEventCallback()->addNestedCallback(nodecallback); - } - } - else ++fr; - } - iteratorAdvanced = true; - - } - - while (fr.matchSequence("CullCallbacks {")) - { - int entry = fr[0].getNoNestedBrackets(); - fr += 2; - - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - NodeCallback* nodecallback = dynamic_cast(fr.readObjectOfType(*s_nodecallback)); - if (nodecallback) { - if (node.getCullCallback() == NULL) { - node.setCullCallback(nodecallback); - } else { - node.getCullCallback()->addNestedCallback(nodecallback); - } - } - else ++fr; - } - iteratorAdvanced = true; - - } - - if (fr.matchSequence("initialBound %f %f %f %f")) - { - BoundingSphere bs; - fr[1].getFloat(bs.center().x()); - fr[2].getFloat(bs.center().y()); - fr[3].getFloat(bs.center().z()); - fr[4].getFloat(bs.radius()); - node.setInitialBound(bs); - fr += 5; - iteratorAdvanced = true; - } - - while (fr.matchSequence("ComputeBoundingSphereCallback {")) - { - int entry = fr[0].getNoNestedBrackets(); - fr += 2; - - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - Node::ComputeBoundingSphereCallback* callback = dynamic_cast(fr.readObjectOfType(type_wrapper())); - if (callback) { - node.setComputeBoundingSphereCallback(callback); - } - else ++fr; - } - iteratorAdvanced = true; - - } - - return iteratorAdvanced; -} - - -bool Node_writeLocalData(const Object& obj, Output& fw) -{ - const Node& node = static_cast(obj); - - fw.indent() << "nodeMask 0x" << hex << node.getNodeMask() << dec << std::endl; - - fw.indent() << "cullingActive "; - if (node.getCullingActive()) fw << "TRUE"<< std::endl; - else fw << "FALSE"<< std::endl; - - - if (!node.getDescriptions().empty()) - { - if (node.getDescriptions().size()==1) - { - fw.indent() << "description "< - -#include - -#include -#include -#include - -using namespace osg; -using namespace osgDB; - -bool NodeCallback_readLocalData(osg::Object &obj, osgDB::Input &fr); -bool NodeCallback_writeLocalData(const osg::Object &obj, osgDB::Output &fw); // register the read and write functions with the osgDB::Registry. - -REGISTER_DOTOSGWRAPPER(NodeCallback) -( - new NodeCallback, - "NodeCallback", - "Object NodeCallback", - &NodeCallback_readLocalData, - &NodeCallback_writeLocalData -); - -bool NodeCallback_readLocalData(osg::Object &obj, osgDB::Input &fr) -{ - NodeCallback& nc = dynamic_cast(obj); - if (!(&nc)) return false; - - bool itrAdvanced = false; - - static osg::ref_ptr s_nc = new NodeCallback; - osg::ref_ptr object = fr.readObjectOfType(*s_nc); - if (object.valid()) - { - NodeCallback* ncc = dynamic_cast(object.get()); - if (ncc) nc.setNestedCallback(ncc); - itrAdvanced = true; - } - - return itrAdvanced; -} - -bool NodeCallback_writeLocalData(const osg::Object &obj, osgDB::Output &fw) -{ - const NodeCallback* nc = dynamic_cast(&obj); - if (!nc) return false; - - NodeCallback* nnc = (NodeCallback*) nc; - - if (nnc->getNestedCallback()) - { - fw.writeObject(*(nnc->getNestedCallback())); - } - - return true; -} diff --git a/src/osgPlugins/osg/Object.cpp b/src/osgPlugins/osg/Object.cpp deleted file mode 100644 index 409a8dd55..000000000 --- a/src/osgPlugins/osg/Object.cpp +++ /dev/null @@ -1,104 +0,0 @@ -#include "osg/Object" -#include "osg/Notify" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool Object_readLocalData(Object& obj, Input& fr); -bool Object_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -// note, Object doesn't currently require any read and write. -REGISTER_DOTOSGWRAPPER(Object) -( - /*new osg::Object*/NULL, - "Object", - "Object", - &Object_readLocalData, - &Object_writeLocalData -); - -bool Object_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - if (fr[0].matchWord("DataVariance")) - { - if (fr[1].matchWord("DYNAMIC")) - { - obj.setDataVariance(osg::Object::DYNAMIC); - fr +=2 ; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("STATIC")) - { - obj.setDataVariance(osg::Object::STATIC); - fr +=2 ; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("UNSPECIFIED")) - { - obj.setDataVariance(osg::Object::UNSPECIFIED); - fr +=2 ; - iteratorAdvanced = true; - } - } - - if (fr.matchSequence("name %s")) - { - obj.setName(fr[1].getStr()); - fr+=2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("UserData {")) - { - osg::notify(osg::DEBUG_INFO) << "Matched UserData {"<< std::endl; - int entry = fr[0].getNoNestedBrackets(); - fr += 2; - - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - Object* object = fr.readObject(); - if (object) obj.setUserData(object); - osg::notify(osg::DEBUG_INFO) << "read "<(obj.getUserData()); - if (object) - { - fw.indent() << "UserData {"<< std::endl; - fw.moveIn(); - fw.writeObject(*object); - fw.moveOut(); - fw.indent() << "}"<< std::endl; - } - } - - return true; -} diff --git a/src/osgPlugins/osg/OccluderNode.cpp b/src/osgPlugins/osg/OccluderNode.cpp deleted file mode 100644 index d6f8b2c26..000000000 --- a/src/osgPlugins/osg/OccluderNode.cpp +++ /dev/null @@ -1,54 +0,0 @@ -#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. -REGISTER_DOTOSGWRAPPER(OccluderNode) -( - 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(obj); - - static ref_ptr s_occluder = new ConvexPlanarOccluder; - - ConvexPlanarOccluder* tmpOccluder = static_cast(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(obj); - - if (occludernode.getOccluder()) - { - fw.writeObject(*occludernode.getOccluder()); - } - - return true; -} diff --git a/src/osgPlugins/osg/OcclusionQueryNode.cpp b/src/osgPlugins/osg/OcclusionQueryNode.cpp deleted file mode 100644 index 17647505e..000000000 --- a/src/osgPlugins/osg/OcclusionQueryNode.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// -// Copyright (C) 2007 Skew Matrix Software LLC (http://www.skew-matrix.com) -// -// This library is open source and may be redistributed and/or modified under -// the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or -// (at your option) any later version. The full license is in LICENSE file -// included with this distribution, and on the openscenegraph.org website. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// OpenSceneGraph Public License for more details. -// - -#include - -#include -#include -#include - -#include - -#include -#include -#include -#include - -bool OQN_readLocalData( osg::Object &obj, osgDB::Input &fr ); -bool OQN_writeLocalData( const osg::Object &obj, osgDB::Output &fw ); - -REGISTER_DOTOSGWRAPPER(OcclusionQueryNode) -( - new osg::OcclusionQueryNode, - "OcclusionQueryNode", - "Object Node OcclusionQueryNode Group", - OQN_readLocalData, - OQN_writeLocalData -); - -bool OQN_readLocalData( osg::Object &obj, osgDB::Input &fr ) -{ - osg::OcclusionQueryNode& oqn = static_cast( obj ); - bool advanced( false ); - int param; - if (fr[0].matchWord( "QueriesEnabled" )) - { - bool enable( fr[1].getStr() == std::string("TRUE") ); - oqn.setQueriesEnabled( enable ); - fr+=2; - advanced = true; - } - if (fr.matchSequence( "VisibilityThreshold %i" )) - { - fr[1].getInt( param ); - oqn.setVisibilityThreshold( param ); - fr+=2; - advanced = true; - } - if (fr.matchSequence( "QueryFrameCount %i" )) - { - fr[1].getInt( param ); - oqn.setQueryFrameCount( param ); - fr+=2; - advanced = true; - } - if (fr[0].matchWord( "DebugDisplay" )) - { - bool enable( fr[1].getStr() == std::string("TRUE") ); - oqn.setDebugDisplay( enable ); - fr+=2; - advanced = true; - } - - return advanced; -} - -bool OQN_writeLocalData( const osg::Object &obj, osgDB::Output &fw ) -{ - const osg::OcclusionQueryNode& oqn = static_cast( obj ); - - //fw.writeObject( oqn.getOQN(i)); - - fw.indent() << "QueriesEnabled " << - (oqn.getQueriesEnabled() ? "TRUE" : "FALSE") - << std::endl; - fw.indent() << "VisibilityThreshold " << - oqn.getVisibilityThreshold() << std::endl; - fw.indent() << "QueryFrameCount " << - oqn.getQueryFrameCount() << std::endl; - fw.indent() << "DebugDisplay " << - (oqn.getDebugDisplay() ? "TRUE" : "FALSE") - << std::endl; - - return true; -} diff --git a/src/osgPlugins/osg/PagedLOD.cpp b/src/osgPlugins/osg/PagedLOD.cpp deleted file mode 100644 index 88b271384..000000000 --- a/src/osgPlugins/osg/PagedLOD.cpp +++ /dev/null @@ -1,166 +0,0 @@ -#include "osg/PagedLOD" -#include "osg/Notify" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool PagedLOD_readLocalData(Object& obj, Input& fr); -bool PagedLOD_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(PagedLOD) -( - new osg::PagedLOD, - "PagedLOD", - "Object Node LOD PagedLOD", - &PagedLOD_readLocalData, - &PagedLOD_writeLocalData -); - -bool PagedLOD_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - PagedLOD& lod = static_cast(obj); - - std::string path; - if (fr.read("DatabasePath",path)) - { - lod.setDatabasePath(path); - } - else - { - if (lod.getDatabasePath().empty() && fr.getOptions() && !fr.getOptions()->getDatabasePathList().empty()) - { - const std::string& path = fr.getOptions()->getDatabasePathList().front(); - if (!path.empty()) - { - lod.setDatabasePath(path); - } - } - } - - unsigned int num; - if (fr[0].matchWord("NumChildrenThatCannotBeExpired") && fr[1].getUInt(num)) - { - lod.setNumChildrenThatCannotBeExpired(num); - fr+=2; - iteratorAdvanced = true; - } - - bool flag; - if (fr.read("DisableExternalChildrenPaging", flag)) - { - lod.setDisableExternalChildrenPaging(flag); - iteratorAdvanced = true; - } - - bool matchFirst; - if ((matchFirst=fr.matchSequence("FileNameList {")) || fr.matchSequence("FileNameList %i {")) - { - - // set up coordinates. - int entry = fr[0].getNoNestedBrackets(); - if (matchFirst) - { - fr += 2; - } - else - { - fr += 3; - } - - unsigned int i=0; - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - if (fr[0].isString() || fr[0].isQuotedString()) - { - if (fr[0].getStr()) lod.setFileName(i,fr[0].getStr()); - else lod.setFileName(i,""); - - ++fr; - ++i; - } - else - { - ++fr; - } - } - - iteratorAdvanced = true; - ++fr; - - } - - int num_children; - if (fr[0].matchWord("num_children") && - fr[1].getInt(num_children)) - { - // could allocate space for children here... - fr+=2; - iteratorAdvanced = true; - } - - Node* node = NULL; - while((node=fr.readNode())!=NULL) - { - lod.addChild(node); - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - - -bool PagedLOD_writeLocalData(const Object& obj, Output& fw) -{ - const PagedLOD& lod = static_cast(obj); - - - if (!lod.getDatabasePath().empty()) - { - fw.indent() << "DatabasePath "< - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool Point_readLocalData(Object& obj, Input& fr); -bool Point_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Point) -( - new osg::Point, - "Point", - "Object StateAttribute Point", - &Point_readLocalData, - &Point_writeLocalData -); - - -bool Point_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - Point& point = static_cast(obj); - - float data; - if (fr[0].matchWord("size") && fr[1].getFloat(data)) - { - - point.setSize(data); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("fade_threshold_size") && fr[1].getFloat(data)) - { - - point.setFadeThresholdSize(data); - fr+=2; - iteratorAdvanced = true; - } - - Vec3 distAtten; - if (fr[0].matchWord("distance_attenuation") && - fr[1].getFloat(distAtten[0]) && fr[2].getFloat(distAtten[1]) && fr[3].getFloat(distAtten[2])) - { - - point.setDistanceAttenuation(distAtten); - fr+=4; - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - - -bool Point_writeLocalData(const Object& obj, Output& fw) -{ - const Point& point = static_cast(obj); - - fw.indent() << "size " << point.getSize() << std::endl; - fw.indent() << "fade_threshold_size " << point.getFadeThresholdSize() << std::endl; - fw.indent() << "distance_attenuation " << point.getDistanceAttenuation() << std::endl; - return true; -} diff --git a/src/osgPlugins/osg/PointSprite.cpp b/src/osgPlugins/osg/PointSprite.cpp deleted file mode 100644 index c05424224..000000000 --- a/src/osgPlugins/osg/PointSprite.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#if defined(_MSC_VER) - #pragma warning( disable : 4786 ) -#endif - -#include "osg/PointSprite" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool PointSprite_readLocalData(Object& obj, Input& fr); -bool PointSprite_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(PointSprite) -( - new osg::PointSprite, - "PointSprite", - "Object StateAttribute PointSprite", - &PointSprite_readLocalData, - &PointSprite_writeLocalData -); - - -bool PointSprite_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - PointSprite& ps = static_cast(obj); - - if (fr[0].matchWord("coordOriginMode")) - { - if (fr[1].matchWord("UPPER_LEFT")) - { - ps.setCoordOriginMode(PointSprite::UPPER_LEFT); - fr+=2; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("LOWER_LEFT")) - { - ps.setCoordOriginMode(PointSprite::LOWER_LEFT); - fr+=2; - iteratorAdvanced = true; - } - } - - return iteratorAdvanced; -} - - -bool PointSprite_writeLocalData(const Object& obj, Output& fw) -{ - const PointSprite& ps = static_cast(obj); - - switch(ps.getCoordOriginMode()) - { - case(PointSprite::UPPER_LEFT): fw.indent() << "coordOriginMode UPPER_LEFT" << std::endl; break; - case(PointSprite::LOWER_LEFT): fw.indent() << "coordOriginMode LOWER_LEFT" << std::endl; break; - } - return true; -} diff --git a/src/osgPlugins/osg/PolygonMode.cpp b/src/osgPlugins/osg/PolygonMode.cpp deleted file mode 100644 index 5a6807637..000000000 --- a/src/osgPlugins/osg/PolygonMode.cpp +++ /dev/null @@ -1,90 +0,0 @@ -#include "osg/PolygonMode" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool PolygonMode_readLocalData(Object& obj, Input& fr); -bool PolygonMode_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(PolygonMode) -( - new osg::PolygonMode, - "PolygonMode", - "Object StateAttribute PolygonMode", - &PolygonMode_readLocalData, - &PolygonMode_writeLocalData -); - - -bool PolygonMode_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - PolygonMode& polygonmode = static_cast(obj); - - if (fr[0].matchWord("mode")) - { - PolygonMode::Face face = PolygonMode::FRONT_AND_BACK; - bool readFace = true; - if (fr[1].matchWord("FRONT")) face = PolygonMode::FRONT; - else if (fr[1].matchWord("BACK")) face = PolygonMode::BACK; - else if (fr[1].matchWord("FRONT_AND_BACK")) face = PolygonMode::FRONT_AND_BACK; - else readFace = false; - if (readFace) - { - PolygonMode::Mode mode = PolygonMode::FILL; - bool readMode = true; - if (fr[2].matchWord("POINT")) mode = PolygonMode::POINT; - else if (fr[2].matchWord("LINE")) mode = PolygonMode::LINE; - else if (fr[2].matchWord("FILL")) mode = PolygonMode::FILL; - else readMode = false; - if (readMode) - { - polygonmode.setMode(face,mode); - fr+=3; - iteratorAdvanced = true; - } - } - } - - return iteratorAdvanced; -} - - -bool PolygonMode_writeLocalData(const Object& obj, Output& fw) -{ - const PolygonMode& polygonmode = static_cast(obj); - - if (polygonmode.getFrontAndBack()) - { - switch(polygonmode.getMode(PolygonMode::FRONT)) - { - case(PolygonMode::POINT): fw.indent() << "mode FRONT_AND_BACK POINT" << std::endl; break; - case(PolygonMode::LINE): fw.indent() << "mode FRONT_AND_BACK LINE" << std::endl; break; - case(PolygonMode::FILL): fw.indent() << "mode FRONT_AND_BACK FILL" << std::endl; break; - } - } - else - { - switch(polygonmode.getMode(PolygonMode::FRONT)) - { - case(PolygonMode::POINT): fw.indent() << "mode FRONT POINT" << std::endl; break; - case(PolygonMode::LINE): fw.indent() << "mode FRONT LINE" << std::endl; break; - case(PolygonMode::FILL): fw.indent() << "mode FRONT FILL" << std::endl; break; - } - switch(polygonmode.getMode(PolygonMode::BACK)) - { - case(PolygonMode::POINT): fw.indent() << "mode BACK POINT" << std::endl; break; - case(PolygonMode::LINE): fw.indent() << "mode BACK LINE" << std::endl; break; - case(PolygonMode::FILL): fw.indent() << "mode BACK FILL" << std::endl; break; - } - } - - return true; -} diff --git a/src/osgPlugins/osg/PolygonOffset.cpp b/src/osgPlugins/osg/PolygonOffset.cpp deleted file mode 100644 index 4f9c96310..000000000 --- a/src/osgPlugins/osg/PolygonOffset.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "osg/PolygonOffset" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool PolygonOffset_readLocalData(Object& obj, Input& fr); -bool PolygonOffset_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(PolygonOffset) -( - new osg::PolygonOffset, - "PolygonOffset", - "Object StateAttribute PolygonOffset", - &PolygonOffset_readLocalData, - &PolygonOffset_writeLocalData -); - - -bool PolygonOffset_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - PolygonOffset& polygonoffset = static_cast(obj); - - float data; - if (fr[0].matchWord("factor") && fr[1].getFloat(data)) - { - - polygonoffset.setFactor(data); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("units") && fr[1].getFloat(data)) - { - - polygonoffset.setUnits(data); - fr+=2; - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - - -bool PolygonOffset_writeLocalData(const Object& obj, Output& fw) -{ - const PolygonOffset& polygonoffset = static_cast(obj); - - fw.indent() << "factor " << polygonoffset.getFactor() << std::endl; - fw.indent() << "units " << polygonoffset.getUnits() << std::endl; - return true; -} diff --git a/src/osgPlugins/osg/PositionAttitudeTransform.cpp b/src/osgPlugins/osg/PositionAttitudeTransform.cpp deleted file mode 100644 index 726c7a57c..000000000 --- a/src/osgPlugins/osg/PositionAttitudeTransform.cpp +++ /dev/null @@ -1,100 +0,0 @@ -#include "osg/PositionAttitudeTransform" -#include - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool PositionAttitudeTransform_readLocalData(Object& obj, Input& fr); -bool PositionAttitudeTransform_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(PositionAttitudeTransform) -( - new osg::PositionAttitudeTransform, - "PositionAttitudeTransform", - "Object Node Transform PositionAttitudeTransform Group", - &PositionAttitudeTransform_readLocalData, - &PositionAttitudeTransform_writeLocalData, - DotOsgWrapper::READ_AND_WRITE -); - -bool PositionAttitudeTransform_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - PositionAttitudeTransform& transform = static_cast(obj); - - if (fr.matchSequence("position %f %f %f")) - { - osg::Vec3d pos; - fr[1].getFloat(pos[0]); - fr[2].getFloat(pos[1]); - fr[3].getFloat(pos[2]); - - transform.setPosition(pos); - - fr += 4; - iteratorAdvanced = true; - } - - if (fr.matchSequence("attitude %f %f %f %f")) - { - osg::Quat att; - fr[1].getFloat(att[0]); - fr[2].getFloat(att[1]); - fr[3].getFloat(att[2]); - fr[4].getFloat(att[3]); - - transform.setAttitude(att); - - fr += 5; - iteratorAdvanced = true; - } - - if (fr.matchSequence("scale %f %f %f")) - { - osg::Vec3d scale; - fr[1].getFloat(scale[0]); - fr[2].getFloat(scale[1]); - fr[3].getFloat(scale[2]); - - transform.setScale(scale); - - fr += 4; - iteratorAdvanced = true; - } - - if (fr.matchSequence("pivotPoint %f %f %f")) - { - osg::Vec3d pivot; - fr[1].getFloat(pivot[0]); - fr[2].getFloat(pivot[1]); - fr[3].getFloat(pivot[2]); - - transform.setPivotPoint(pivot); - - fr += 4; - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - - -bool PositionAttitudeTransform_writeLocalData(const Object& obj, Output& fw) -{ - const PositionAttitudeTransform& transform = static_cast(obj); - - fw.indent()<<"position "<(obj); - - if(fr.matchSequence("GeometryVerticesOut %i")) - { - unsigned int verticesOut; - fr[1].getUInt(verticesOut); - program.setParameter(GL_GEOMETRY_VERTICES_OUT_EXT, verticesOut); - fr += 2; - iteratorAdvanced = true; - } - - if(fr.matchSequence("GeometryInputType %w")) - { - std::string primitiveMode = fr[1].getStr(); - GLenum mode; - if(Geometry_matchPrimitiveModeStr(primitiveMode.c_str(), mode)) - program.setParameter(GL_GEOMETRY_INPUT_TYPE_EXT, mode); - fr += 2; - iteratorAdvanced = true; - } - - if(fr.matchSequence("GeometryOutputType %w")) - { - std::string primitiveMode = fr[1].getStr(); - GLenum mode; - if(Geometry_matchPrimitiveModeStr(primitiveMode.c_str(), mode)) - program.setParameter(GL_GEOMETRY_OUTPUT_TYPE_EXT, mode); - fr += 2; - iteratorAdvanced = true; - } - - while(fr.matchSequence("AttribBindingLocation %i %w")) - { - unsigned int index; - fr[1].getUInt(index); - program.addBindAttribLocation(fr[2].getStr(), index); - fr += 3; - iteratorAdvanced = true; - } - - - while(fr.matchSequence("AttribBindingLocation %w %i")) - { - unsigned int index; - fr[2].getUInt(index); - program.addBindAttribLocation(fr[1].getStr(), index); - fr += 3; - iteratorAdvanced = true; - } - - int num_shaders; - if (fr[0].matchWord("num_shaders") && - fr[1].getInt(num_shaders)) - { - // could allocate space for shaders here... - fr+=2; - iteratorAdvanced = true; - } - - Object* object = NULL; - while((object=fr.readObject())!=NULL) - { - program.addShader(dynamic_cast(object)); - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - - -bool Program_writeLocalData(const Object& obj,Output& fw) -{ - const Program& program = static_cast(obj); - - fw.indent() << "GeometryVerticesOut " << program.getParameter(GL_GEOMETRY_VERTICES_OUT_EXT) << std::endl; - fw.indent() << "GeometryInputType " << Geometry_getPrimitiveModeStr(program.getParameter(GL_GEOMETRY_INPUT_TYPE_EXT)) << std::endl; - fw.indent() << "GeometryOutputType " << Geometry_getPrimitiveModeStr(program.getParameter(GL_GEOMETRY_OUTPUT_TYPE_EXT)) << std::endl; - - const Program::AttribBindingList& abl = program.getAttribBindingList(); - Program::AttribBindingList::const_iterator i; - for(i=abl.begin(); i!=abl.end(); i++) - { - fw.indent() << "AttribBindingLocation " << (*i).first << " " << (*i).second << std::endl; - } - - fw.indent() << "num_shaders " << program.getNumShaders() << std::endl; - for(unsigned int ic=0;ic -#include - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -#include "Matrix.h" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool Projection_readLocalData(Object& obj, Input& fr); -bool Projection_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Projection) -( - new osg::Projection, - "Projection", - "Object Node Group Projection", - &Projection_readLocalData, - &Projection_writeLocalData -); - -bool Projection_readLocalData(Object& obj, Input& fr) -{ - Projection &myobj = static_cast(obj); - bool iteratorAdvanced = false; - - Matrix matrix; - if (readMatrix(matrix,fr)) - { - myobj.setMatrix(matrix); - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - - -bool Projection_writeLocalData(const Object& obj, Output& fw) -{ - const Projection& myobj = static_cast(obj); - - writeMatrix(myobj.getMatrix(),fw); - - return true; -} diff --git a/src/osgPlugins/osg/ProxyNode.cpp b/src/osgPlugins/osg/ProxyNode.cpp deleted file mode 100644 index 25268bd4f..000000000 --- a/src/osgPlugins/osg/ProxyNode.cpp +++ /dev/null @@ -1,274 +0,0 @@ -#include "osg/ProxyNode" -#include "osg/Notify" -#include - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" -#include -#include -#include -#include - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool ProxyNode_readLocalData(Object& obj, Input& fr); -bool ProxyNode_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(ProxyNode) -( - new osg::ProxyNode, - "ProxyNode", - "Object Node ProxyNode", - &ProxyNode_readLocalData, - &ProxyNode_writeLocalData -); - -bool ProxyNode_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - ProxyNode& proxyNode = static_cast(obj); - - if (fr.matchSequence("Center %f %f %f")) - { - Vec3 center; - fr[1].getFloat(center[0]); - fr[2].getFloat(center[1]); - fr[3].getFloat(center[2]); - proxyNode.setCenter(center); - - iteratorAdvanced = true; - fr+=4; - } - else - proxyNode.setCenterMode(osg::ProxyNode::USE_BOUNDING_SPHERE_CENTER); - - if (fr.matchSequence("ExtRefMode %s") || fr.matchSequence("ExtRefMode %w")) - { - if (fr[1].matchWord("LOAD_IMMEDIATELY")) - proxyNode.setLoadingExternalReferenceMode(ProxyNode::LOAD_IMMEDIATELY); - else if (fr[1].matchWord("DEFER_LOADING_TO_DATABASE_PAGER")) - proxyNode.setLoadingExternalReferenceMode(ProxyNode::DEFER_LOADING_TO_DATABASE_PAGER); - else if (fr[1].matchWord("NO_AUTOMATIC_LOADING")) - proxyNode.setLoadingExternalReferenceMode(ProxyNode::NO_AUTOMATIC_LOADING); - - fr+=2; - iteratorAdvanced = true; - } - - float radius; - if (fr[0].matchWord("Radius") && fr[1].getFloat(radius)) - { - proxyNode.setRadius(radius); - fr+=2; - iteratorAdvanced = true; - } - - if (fr.getOptions() && !fr.getOptions()->getDatabasePathList().empty()) - { - const std::string& path = fr.getOptions()->getDatabasePathList().front(); - if (!path.empty()) - { - proxyNode.setDatabasePath(path); - } - } - - bool matchFirst; - if ((matchFirst=fr.matchSequence("FileNameList {")) || fr.matchSequence("FileNameList %i {")) - { - - // set up coordinates. - int entry = fr[0].getNoNestedBrackets(); - if (matchFirst) - { - fr += 2; - } - else - { - fr += 3; - } - - unsigned int i=0; - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - if (fr[0].isString() || fr[0].isQuotedString()) - { - if (fr[0].getStr()) proxyNode.setFileName(i,fr[0].getStr()); - else proxyNode.setFileName(i,""); - - ++fr; - ++i; - } - else - { - ++fr; - } - } - - iteratorAdvanced = true; - ++fr; - - } - - unsigned int num_children = 0; - if (fr[0].matchWord("num_children") && - fr[1].getUInt(num_children)) - { - // could allocate space for children here... - fr+=2; - iteratorAdvanced = true; - } - - unsigned int i; - for(i=0; igetDatabasePathList(); - fpl.push_front( fpl.empty() ? osgDB::getFilePath(proxyNode.getFileName(i)) : fpl.front()+'/'+ osgDB::getFilePath(proxyNode.getFileName(i))); - Node* node = NULL; - if((node=fr.readNode())!=NULL) - { - proxyNode.addChild(node); - iteratorAdvanced = true; - } - fpl.pop_front(); - } - - if(proxyNode.getLoadingExternalReferenceMode() == ProxyNode::LOAD_IMMEDIATELY) - { - for(i=0; i=proxyNode.getNumChildren() && !proxyNode.getFileName(i).empty()) - { - osgDB::FilePathList& fpl = ((osgDB::ReaderWriter::Options*)fr.getOptions())->getDatabasePathList(); - fpl.push_front( fpl.empty() ? osgDB::getFilePath(proxyNode.getFileName(i)) : fpl.front()+'/'+ osgDB::getFilePath(proxyNode.getFileName(i))); - osg::Node *node = osgDB::readNodeFile(proxyNode.getFileName(i), fr.getOptions()); - fpl.pop_front(); - if(node) - { - proxyNode.insertChild(i, node); - } - } - } - } - - return iteratorAdvanced; -} - - -bool ProxyNode_writeLocalData(const Object& obj, Output& fw) -{ - bool includeExternalReferences = false; - bool useOriginalExternalReferences = true; - bool writeExternalReferenceFiles = false; - if (fw.getOptions()) - { - std::string optionsString = fw.getOptions()->getOptionString(); - includeExternalReferences = optionsString.find("includeExternalReferences")!=std::string::npos; - bool newExternals = optionsString.find("writeExternalReferenceFiles")!=std::string::npos; - if (newExternals) - { - useOriginalExternalReferences = false; - writeExternalReferenceFiles = true; - } - } - const ProxyNode& proxyNode = static_cast(obj); - - if (proxyNode.getCenterMode()==osg::ProxyNode::USER_DEFINED_CENTER) fw.indent() << "Center "<< proxyNode.getCenter() << std::endl; - - fw.indent() << "ExtRefMode "; - - switch(proxyNode.getLoadingExternalReferenceMode()) - { - case ProxyNode::LOAD_IMMEDIATELY: - fw.indent() << "LOAD_IMMEDIATELY" <getIncludeExternalReferences()) // inlined mode - { - fw.indent() << "num_children " << proxyNode.getNumChildren() << std::endl; - for(unsigned int i=0; igetWriteExternalReferenceFiles()) - { - if(useOriginalExternalReferences) //out->getUseOriginalExternalReferences()) - { - std::string origname = proxyNode.getFileName(i); - if (!fw.getExternalFileWritten(origname)) - { - osgDB::writeNodeFile(*proxyNode.getChild(i), origname); - fw.setExternalFileWritten(origname, true); - } - } - else - { - std::string path = osgDB::getFilePath(fw.getFileName()); - std::string new_filename = osgDB::getStrippedName(proxyNode.getFileName(i)) +".osg"; - std::string osgname = path.empty() ? new_filename : (path +"/"+ new_filename) ; - if (!fw.getExternalFileWritten(osgname)) - { - osgDB::writeNodeFile(*proxyNode.getChild(i), osgname); - fw.setExternalFileWritten(osgname, true); - } - } - } - } - } - - return true; -} diff --git a/src/osgPlugins/osg/README b/src/osgPlugins/osg/README deleted file mode 100644 index 73ff536ad..000000000 --- a/src/osgPlugins/osg/README +++ /dev/null @@ -1,9 +0,0 @@ -Notes -===== - -The support in Image.cpp is also not full functional and should be rewritten -in the future to support inline images. Currently osg::Images are supported -via the osgDB::Registry::read/writeImage methods and plugins. - -Robert Osfield, -March 2001. diff --git a/src/osgPlugins/osg/ReaderWriterOSG.cpp b/src/osgPlugins/osg/ReaderWriterOSG.cpp index f9b290f68..e0e50dd28 100644 --- a/src/osgPlugins/osg/ReaderWriterOSG.cpp +++ b/src/osgPlugins/osg/ReaderWriterOSG.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -14,6 +15,8 @@ using namespace osg; using namespace osgDB; + +#if 0 // pull in symbols from individual .o's to enable the static build to work USE_DOTOSGWRAPPER(AlphaFunc) USE_DOTOSGWRAPPER(AnimationPath) @@ -99,6 +102,7 @@ USE_DOTOSGWRAPPER(Transform) USE_DOTOSGWRAPPER(Uniform) USE_DOTOSGWRAPPER(VertexProgram) USE_DOTOSGWRAPPER(Viewport) +#endif class OSGReaderWriter : public ReaderWriter { @@ -106,12 +110,24 @@ class OSGReaderWriter : public ReaderWriter OSGReaderWriter() { + supportsExtension("osg","OpenSceneGraph Ascii file format"); supportsExtension("osgs","Psuedo OpenSceneGraph file loaded, with file encoded in filename string"); supportsOption("precision","Set the floating point precision when writing out files"); supportsOption("OutputTextureFiles","Write out the texture images to file"); supportsOption("includeExternalReferences","Export option"); supportsOption("writeExternalReferenceFiles","Export option"); + + std::string filename = osgDB::Registry::instance()->createLibraryNameForExtension("deprecated_osg"); + if (osgDB::Registry::instance()->loadLibrary(filename)==osgDB::Registry::LOADED) + { + osg::notify(osg::NOTICE)<<"Constructor OSGReaderWriter - loaded OK"<(obj); - scissor.setScissor( x, y, width, height ); - return iteratorAdvanced; -} - - -bool Scissor_writeLocalData(const Object& obj, Output& fw) -{ - const Scissor& scissor = static_cast(obj); - - fw.indent() << "x " << scissor.x() << std::endl; - fw.indent() << "y " << scissor.y() << std::endl; - fw.indent() << "width " << scissor.width() << std::endl; - fw.indent() << "height " << scissor.height() << std::endl; - - return true; -} diff --git a/src/osgPlugins/osg/Sequence.cpp b/src/osgPlugins/osg/Sequence.cpp deleted file mode 100644 index ee4485367..000000000 --- a/src/osgPlugins/osg/Sequence.cpp +++ /dev/null @@ -1,238 +0,0 @@ -#include "osg/Sequence" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -#include - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool Sequence_readLocalData(Object& obj, Input& fr); -bool Sequence_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Sequence) -( - new osg::Sequence, - "Sequence", - "Object Node Sequence Group", - &Sequence_readLocalData, - &Sequence_writeLocalData -); - -static bool Sequence_matchLoopMode(const char* str, - Sequence::LoopMode& mode) -{ - if (strcmp(str, "LOOP") == 0) - { - mode = Sequence::LOOP; - } - else if (strcmp(str, "SWING") == 0) - { - mode = Sequence::SWING; - } - else - { - return false; - } - - return true; -} - -static const char* Sequence_getLoopMode(Sequence::LoopMode mode) -{ - switch (mode) { - case Sequence::SWING: - return "SWING"; - case Sequence::LOOP: - default: - return "LOOP"; - } -} - -// only storing 'START' and 'STOP' since 'PAUSE' doesn't make sense to me -static bool Sequence_matchSeqMode(const char* str, - Sequence::SequenceMode& mode) -{ - if (strcmp(str, "START") == 0) - { - mode = Sequence::START; - } - else if (strcmp(str, "STOP") == 0) - { - mode = Sequence::STOP; - } - else - { - return false; - } - - return true; -} - -static const char* Sequence_getSeqMode(Sequence::SequenceMode mode) -{ - switch (mode) { - case Sequence::START: - return "START"; - default: - return "STOP"; - } -} - -bool Sequence_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - Sequence& sw = static_cast(obj); - - if (fr.matchSequence("defaultTime")) - { - if (fr[1].isFloat()) - { - float t; - fr[1].getFloat(t) ; - sw.setDefaultTime(t) ; - iteratorAdvanced = true; - fr += 2; - } - } - else if (fr.matchSequence("frameTime {")) - { - int entry = fr[0].getNoNestedBrackets(); - fr += 2; - - int i = 0; - while (!fr.eof() && fr[0].getNoNestedBrackets() > entry) - { - float t; - if (fr[0].getFloat(t)) - { - sw.setTime(i, t); - ++fr; - i++; - } - } - - iteratorAdvanced = true; - ++fr; - } - else if (fr.matchSequence("lastFrameTime")) - { - if (fr[1].isFloat()) - { - float t; - fr[1].getFloat(t) ; - sw.setLastFrameTime(t) ; - iteratorAdvanced = true; - fr += 2; - } - } - else if (fr.matchSequence("interval")) - { - Sequence::LoopMode mode; - int begin, end; - if (Sequence_matchLoopMode(fr[1].getStr(), mode) && - fr[2].getInt(begin) && fr[3].getInt(end)) - { - sw.setInterval(mode, begin, end); - iteratorAdvanced = true; - fr += 4; - } - } - else if (fr.matchSequence("duration")) - { - if (fr[1].isFloat() && fr[2].isInt()) - { - float speed; - int nreps; - fr[1].getFloat(speed); - fr[2].getInt(nreps); - sw.setDuration(speed, nreps); - iteratorAdvanced = true; - fr += 3; - } - } - else if (fr.matchSequence("mode")) - { - Sequence::SequenceMode mode; - if (Sequence_matchSeqMode(fr[1].getStr(), mode)) - { - sw.setMode(mode); - iteratorAdvanced = true; - fr += 2; - } - } - else if (fr.matchSequence("sync")) - { - if (fr[1].isInt()) - { - int sync ; - fr[1].getInt(sync) ; - sw.setSync(sync!=0) ; - iteratorAdvanced = true; - fr += 2; - } - } - else if (fr.matchSequence("clearOnStop")) - { - if (fr[1].isInt()) - { - int clearOnStop ; - fr[1].getInt(clearOnStop) ; - sw.setClearOnStop(clearOnStop!=0) ; - iteratorAdvanced = true; - fr += 2; - } - } - - return iteratorAdvanced; -} - -bool Sequence_writeLocalData(const Object& obj, Output& fw) -{ - const Sequence& sw = static_cast(obj); - - // default frame time - fw.indent() << "defaultTime " << sw.getDefaultTime() << std::endl; - - // frame times - fw.indent() << "frameTime {" << std::endl; - fw.moveIn(); - for (unsigned int i = 0; i < sw.getNumChildren(); i++) - { - fw.indent() << sw.getTime(i) << std::endl; - } - - fw.moveOut(); - fw.indent() << "}" << std::endl; - - // last frame time - fw.indent() << "lastFrameTime " << sw.getLastFrameTime() << std::endl; - - // loop mode & interval - Sequence::LoopMode mode; - int begin, end; - sw.getInterval(mode, begin, end); - fw.indent() << "interval " << Sequence_getLoopMode(mode) << " " << begin << " " << end << std::endl; - - // duration - float speed; - int nreps; - sw.getDuration(speed, nreps); - fw.indent() << "duration " << speed << " " << nreps << std::endl; - - // sequence mode - fw.indent() << "mode " << Sequence_getSeqMode(sw.getMode()) << std::endl; - - // sync - fw.indent() << "sync " << (int) sw.getSync() << std::endl; - - // clearOnStop - fw.indent() << "clearOnStop " << (int) sw.getClearOnStop() << std::endl; - - return true; -} diff --git a/src/osgPlugins/osg/ShadeModel.cpp b/src/osgPlugins/osg/ShadeModel.cpp deleted file mode 100644 index 0123019ce..000000000 --- a/src/osgPlugins/osg/ShadeModel.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "osg/ShadeModel" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool ShadeModel_readLocalData(Object& obj, Input& fr); -bool ShadeModel_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(ShadeModel) -( - new osg::ShadeModel, - "ShadeModel", - "Object StateAttribute ShadeModel", - &ShadeModel_readLocalData, - &ShadeModel_writeLocalData -); - - -bool ShadeModel_readLocalData(Object& obj,Input& fr) -{ - bool iteratorAdvanced = false; - - ShadeModel& shademodel = static_cast(obj); - - if (fr[0].matchWord("mode")) - { - if (fr[1].matchWord("FLAT")) - { - shademodel.setMode(ShadeModel::FLAT); - fr+=2; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("SMOOTH")) - { - shademodel.setMode(ShadeModel::SMOOTH); - fr+=2; - iteratorAdvanced = true; - } - } - - return iteratorAdvanced; -} - - -bool ShadeModel_writeLocalData(const Object& obj, Output& fw) -{ - - const ShadeModel& shademodel = static_cast(obj); - - switch(shademodel.getMode()) - { - case(ShadeModel::FLAT): fw.indent() << "mode FLAT" < -#include - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" -#include "osgDB/FileUtils" -#include "osgDB/WriteFile" - -using namespace osg; -using namespace osgDB; -using namespace std; - -// forward declare functions to use later. -bool Shader_readLocalData(Object& obj, Input& fr); -bool Shader_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Shader) -( - new osg::Shader, - "Shader", - "Object Shader", - &Shader_readLocalData, - &Shader_writeLocalData -); - - -bool Shader_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - Shader& shader = static_cast(obj); - - if (fr.matchSequence("type %w")) - { - shader.setType( Shader::getTypeId(fr[1].getStr()) ); - fr+=2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("file %w") || fr.matchSequence("file %s") ) - { - std::string fileName = osgDB::findDataFile(fr[1].getStr()); - if (!fileName.empty()) - { - shader.loadShaderSourceFromFile( fileName.c_str() ); - } - else - { - osg::notify(osg::NOTICE)<<"Warning: could not find shader file \""<= entry) - { - if (fr[0].getStr()) { - code.append(std::string(fr[0].getStr())); - code += '\n' ; - } - ++fr; - } - shader.setShaderSource(code.c_str()); - } - - return iteratorAdvanced; -} - - -bool Shader_writeLocalData(const Object& obj,Output& fw) -{ - const Shader& shader = static_cast(obj); - - fw.indent() << "type " << shader.getTypename() << std::endl; - - // osg::notify(osg::NOTICE)<<"fw.getOutputShaderFiles()="< lines; - std::istringstream iss(shader.getShaderSource()); - std::string line; - while (std::getline(iss, line)) { - lines.push_back(line); - } - - fw.indent() << "code {\n"; - fw.moveIn(); - - std::vector::const_iterator j; - for (j=lines.begin(); j!=lines.end(); ++j) { - fw.indent() << fw.wrapString(*j) << "\n"; - } - - fw.moveOut(); - fw.indent() << "}\n"; - } - - return true; -} diff --git a/src/osgPlugins/osg/ShapeDrawable.cpp b/src/osgPlugins/osg/ShapeDrawable.cpp deleted file mode 100644 index 252827a34..000000000 --- a/src/osgPlugins/osg/ShapeDrawable.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include -#include -#include - -#include -#include -#include - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool ShapeDrawable_readLocalData(Object& obj, Input& fr); -bool ShapeDrawable_writeLocalData(const Object& obj, Output& fw); - -REGISTER_DOTOSGWRAPPER(ShapeDrawable) -( - new osg::ShapeDrawable, - "ShapeDrawable", - "Object Drawable ShapeDrawable", - &ShapeDrawable_readLocalData, - &ShapeDrawable_writeLocalData, - DotOsgWrapper::READ_AND_WRITE -); - -bool ShapeDrawable_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - ShapeDrawable& geom = static_cast(obj); - - if (fr.matchSequence("color %f %f %f %f")) - { - osg::Vec4 color; - fr[1].getFloat(color[0]); - fr[2].getFloat(color[1]); - fr[3].getFloat(color[2]); - fr[4].getFloat(color[3]); - - geom.setColor(color); - - fr+=5; - iteratorAdvanced = true; - } - - ref_ptr readObject = fr.readObjectOfType(type_wrapper()); - if (readObject.valid()) { - TessellationHints* hints = static_cast(readObject.get()); - geom.setTessellationHints(hints); - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - -bool ShapeDrawable_writeLocalData(const Object& obj, Output& fw) -{ - const ShapeDrawable& geom = static_cast(obj); - - fw.indent() << "color " << geom.getColor() << std::endl; - - const TessellationHints* hints = geom.getTessellationHints(); - if (hints) - fw.writeObject(*hints); - - return true; -} diff --git a/src/osgPlugins/osg/Sphere.cpp b/src/osgPlugins/osg/Sphere.cpp deleted file mode 100644 index 0a2b98b93..000000000 --- a/src/osgPlugins/osg/Sphere.cpp +++ /dev/null @@ -1,69 +0,0 @@ -#include -#include -#include - -#include -#include -#include - -using namespace osg; -using namespace osgDB; - - -////////////////////////////////////////////////////////////////////////////// - -// forward declare functions to use later. -bool Sphere_readLocalData(Object& obj, Input& fr); -bool Sphere_writeLocalData(const Object& obj, Output& fw); - -//register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Sphere) -( - new osg::Sphere, - "Sphere", - "Object Sphere", - &Sphere_readLocalData, - &Sphere_writeLocalData, - DotOsgWrapper::READ_AND_WRITE -); - -bool Sphere_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - Sphere& sphere = static_cast(obj); - - if (fr.matchSequence("Center %f %f %f")) - { - osg::Vec3 center; - fr[1].getFloat(center.x()); - fr[2].getFloat(center.y()); - fr[3].getFloat(center.z()); - sphere.setCenter(center); - fr+=4; - iteratorAdvanced = true; - } - - if (fr.matchSequence("Radius %f")) - { - float radius; - fr[1].getFloat(radius); - sphere.setRadius(radius); - fr+=2; - iteratorAdvanced = true; - } - - - return iteratorAdvanced; -} - -bool Sphere_writeLocalData(const Object& obj, Output& fw) -{ - const Sphere& sphere = static_cast(obj); - - fw.indent()<<"Center "<(obj); - - static ref_ptr s_callback = new osg::StateAttributeCallback; - while (fr.matchSequence("UpdateCallback {")) - { - //int entry = fr[0].getNoNestedBrackets(); - fr += 2; - StateAttributeCallback* callback = dynamic_cast(fr.readObjectOfType(*s_callback)); - if (callback) { - stateAttribute.setUpdateCallback(callback); - } - iteratorAdvanced = true; - } - - while (fr.matchSequence("EventCallback {")) - { - //int entry = fr[0].getNoNestedBrackets(); - fr += 2; - StateAttributeCallback* callback = dynamic_cast(fr.readObjectOfType(*s_callback)); - if (callback) { - stateAttribute.setEventCallback(callback); - } - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - -bool StateAttribute_writeLocalData(const Object& obj,Output& fw) -{ - const StateAttribute& stateAttribute = static_cast(obj); - - if (stateAttribute.getUpdateCallback()) - { - fw.indent() << "UpdateCallback {" << std::endl; - fw.moveIn(); - fw.writeObject(*stateAttribute.getUpdateCallback()); - fw.moveOut(); - fw.indent() << "}" << std::endl; - } - - if (stateAttribute.getEventCallback()) - { - fw.indent() << "EventCallback {" << std::endl; - fw.moveIn(); - fw.writeObject(*stateAttribute.getEventCallback()); - fw.moveOut(); - fw.indent() << "}" << std::endl; - } - - return true; -} diff --git a/src/osgPlugins/osg/StateSet.cpp b/src/osgPlugins/osg/StateSet.cpp deleted file mode 100644 index d0a827e06..000000000 --- a/src/osgPlugins/osg/StateSet.cpp +++ /dev/null @@ -1,727 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include -#include - -using namespace osg; -using namespace osgDB; -using namespace std; - -// forward declare functions to use later. -bool GeoState_readLocalData(Object& obj, Input& fr); - -bool StateSet_readLocalData(Object& obj, Input& fr); -bool StateSet_writeLocalData(const Object& obj, Output& fw); - -bool StateSet_matchModeStr(const char* str,StateAttribute::GLModeValue& mode); -const char* StateSet_getModeStr(StateAttribute::GLModeValue mode); - -bool StateSet_matchRenderBinModeStr(const char* str,StateSet::RenderBinMode& mode); -const char* StateSet_getRenderBinModeStr(StateSet::RenderBinMode mode); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(StateSet) -( - new osg::StateSet, - "StateSet", - "Object StateSet", - &StateSet_readLocalData, - &StateSet_writeLocalData, - DotOsgWrapper::READ_AND_WRITE -); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(GeoState) -( - new osg::StateSet, - "GeoState", - "Object GeoState", - &GeoState_readLocalData, - NULL, - DotOsgWrapper::READ_ONLY -); - -// -// Set up the maps from name to GLMode and visa versa. -// -typedef std::map GLNameToGLModeMap; -typedef std::map GLModeToGLNameMap; -typedef std::set TextureGLModeSet; - -GLNameToGLModeMap s_GLNameToGLModeMap; -GLModeToGLNameMap s_GLModeToGLNameMap; -TextureGLModeSet s_TextureGLModeSet; - -#define ADD_NAME(name,mode) s_GLNameToGLModeMap[name]=mode; s_GLModeToGLNameMap[mode]=name; - -void initGLNames() -{ - static bool first_time = true; - if (!first_time) return; - - static OpenThreads::Mutex s_initGLNames; - OpenThreads::ScopedLock lock(s_initGLNames); - - if (!first_time) return; - - ADD_NAME("GL_ALPHA_TEST",GL_ALPHA_TEST) - ADD_NAME("GL_BLEND",GL_BLEND) - ADD_NAME("GL_COLOR_MATERIAL",GL_COLOR_MATERIAL) - ADD_NAME("GL_CULL_FACE",GL_CULL_FACE) - ADD_NAME("GL_DEPTH_TEST",GL_DEPTH_TEST) - ADD_NAME("GL_FOG",GL_FOG) - ADD_NAME("GL_LIGHTING",GL_LIGHTING) - ADD_NAME("GL_POINT_SMOOTH",GL_POINT_SMOOTH) - ADD_NAME("GL_LINE_STIPPLE",GL_LINE_STIPPLE) - ADD_NAME("GL_POLYGON_OFFSET_FILL",GL_POLYGON_OFFSET_FILL) - ADD_NAME("GL_POLYGON_OFFSET_LINE",GL_POLYGON_OFFSET_LINE) - ADD_NAME("GL_POLYGON_OFFSET_POINT",GL_POLYGON_OFFSET_POINT) - ADD_NAME("GL_COLOR_SUM",GL_COLOR_SUM); - ADD_NAME("GL_NORMALIZE",GL_NORMALIZE); - ADD_NAME("GL_RESCALE_NORMAL",GL_RESCALE_NORMAL); - - ADD_NAME("GL_TEXTURE_1D",GL_TEXTURE_1D) - ADD_NAME("GL_TEXTURE_2D",GL_TEXTURE_2D) - ADD_NAME("GL_TEXTURE_3D",GL_TEXTURE_3D) - - ADD_NAME("GL_TEXTURE_CUBE_MAP",GL_TEXTURE_CUBE_MAP); - ADD_NAME("GL_TEXTURE_RECTANGLE",GL_TEXTURE_RECTANGLE); - - ADD_NAME("GL_TEXTURE_GEN_Q",GL_TEXTURE_GEN_Q) - ADD_NAME("GL_TEXTURE_GEN_R",GL_TEXTURE_GEN_R) - ADD_NAME("GL_TEXTURE_GEN_S",GL_TEXTURE_GEN_S) - ADD_NAME("GL_TEXTURE_GEN_T",GL_TEXTURE_GEN_T) - - ADD_NAME("GL_STENCIL_TEST",GL_STENCIL_TEST) - - ADD_NAME("GL_CLIP_PLANE0",GL_CLIP_PLANE0); - ADD_NAME("GL_CLIP_PLANE1",GL_CLIP_PLANE1); - ADD_NAME("GL_CLIP_PLANE2",GL_CLIP_PLANE2); - ADD_NAME("GL_CLIP_PLANE3",GL_CLIP_PLANE3); - ADD_NAME("GL_CLIP_PLANE4",GL_CLIP_PLANE4); - ADD_NAME("GL_CLIP_PLANE5",GL_CLIP_PLANE5); - - ADD_NAME("GL_LIGHT0",GL_LIGHT0); - ADD_NAME("GL_LIGHT1",GL_LIGHT1); - ADD_NAME("GL_LIGHT2",GL_LIGHT2); - ADD_NAME("GL_LIGHT3",GL_LIGHT3); - ADD_NAME("GL_LIGHT4",GL_LIGHT4); - ADD_NAME("GL_LIGHT5",GL_LIGHT5); - ADD_NAME("GL_LIGHT6",GL_LIGHT6); - ADD_NAME("GL_LIGHT7",GL_LIGHT7); - -#if defined(OSG_GL3_AVAILABLE) - #define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642 - #define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643 -#endif - ADD_NAME("GL_VERTEX_PROGRAM_POINT_SIZE", GL_VERTEX_PROGRAM_POINT_SIZE) - ADD_NAME("GL_VERTEX_PROGRAM_TWO_SIDE", GL_VERTEX_PROGRAM_TWO_SIDE) - - s_TextureGLModeSet.insert(GL_TEXTURE_1D); - s_TextureGLModeSet.insert(GL_TEXTURE_2D); - s_TextureGLModeSet.insert(GL_TEXTURE_3D); - - s_TextureGLModeSet.insert(GL_TEXTURE_CUBE_MAP); - s_TextureGLModeSet.insert(GL_TEXTURE_RECTANGLE); - - s_TextureGLModeSet.insert(GL_TEXTURE_GEN_Q); - s_TextureGLModeSet.insert(GL_TEXTURE_GEN_R); - s_TextureGLModeSet.insert(GL_TEXTURE_GEN_S); - s_TextureGLModeSet.insert(GL_TEXTURE_GEN_T); - - -// for(GLNameToGLModeMap::iterator itr=s_GLNameToGLModeMap.begin(); -// itr!=s_GLNameToGLModeMap.end(); -// ++itr) -// { -// cout << "Name ["<first<<","<second<<"]"<< std::endl; -// } - - first_time = false; -} - - -////////////////////////////////////////////////////////////////////// - -bool GeoState_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - // note, StateSet replaced GeoState April 2001. - StateSet& statset = static_cast(obj); - - statset.setRenderingHint(StateSet::OPAQUE_BIN); - - StateAttribute::GLModeValue mode; - if (fr[0].matchWord("transparency") && StateSet_matchModeStr(fr[1].getStr(),mode)) - { - if (mode&StateAttribute::ON) - { - statset.setRenderingHint(StateSet::TRANSPARENT_BIN); - } - statset.setMode(GL_BLEND,mode); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("antialiasing") && StateSet_matchModeStr(fr[1].getStr(),mode)) - { - // what is the OpenGL modes for antialissing, need to look up. - // statset.setMode(GeoState::ANTIALIAS,mode); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("face_culling") && StateSet_matchModeStr(fr[1].getStr(),mode)) - { - statset.setMode(GL_CULL_FACE,mode); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("lighting") && StateSet_matchModeStr(fr[1].getStr(),mode)) - { - statset.setMode(GL_LIGHTING,mode); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("texturing") && StateSet_matchModeStr(fr[1].getStr(),mode)) - { - statset.setTextureMode(0,GL_TEXTURE_2D,mode); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("fogging") && StateSet_matchModeStr(fr[1].getStr(),mode)) - { - statset.setMode(GL_FOG,mode); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("colortable") && StateSet_matchModeStr(fr[1].getStr(),mode)) - { - // what is the OpenGL modes for colortable, need to look up... - // statset.setMode(GeoState::COLORTABLE,mode); - fr+=2; - iteratorAdvanced = true; - } - - StateAttribute::GLModeValue texgening = StateAttribute::OFF; - if (fr[0].matchWord("texgening") && StateSet_matchModeStr(fr[1].getStr(),mode)) - { - // leave up to a tex gen object to set modes associated with TexGen - // as there are mutiple modes associated with TexGen. See below - // attribute reading code. - texgening = mode; - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("point_smoothing") && StateSet_matchModeStr(fr[1].getStr(),mode)) - { - statset.setMode(GL_POINT_SMOOTH,mode); - fr+=2; - iteratorAdvanced = true; - } - - - if (fr[0].matchWord("polygon_offset") && StateSet_matchModeStr(fr[1].getStr(),mode)) - { - // no GL mode associated with polygon offset so commenting out. - // statset.setMode(GeoState::POLYGON_OFFSET,mode); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("alpha_test") && StateSet_matchModeStr(fr[1].getStr(),mode)) - { - statset.setMode(GL_ALPHA_TEST,mode); - fr+=2; - iteratorAdvanced = true; - } - - - // new code using osg::Registry's list of prototypes to loaded attributes. - StateAttribute* attribute = NULL; - while((attribute=fr.readStateAttribute())!=NULL) - { - if (attribute->isTextureAttribute()) - { - // remap to be a texture attribute - statset.setTextureAttribute(0,attribute); - } - else - { - statset.setAttribute(attribute); - } - - if (attribute->getType()==StateAttribute::TEXGEN) - statset.setAssociatedModes(attribute,texgening); - - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - -bool StateSet_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - // note, StateSet replaced GeoState April 2001. - StateSet& stateset = static_cast(obj); - - initGLNames(); - - // read the rendering hint value. - if (fr[0].matchWord("rendering_hint")) - { - if (fr[1].matchWord("DEFAULT_BIN")) - { - stateset.setRenderingHint(StateSet::DEFAULT_BIN); - fr+=2; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("OPAQUE_BIN")) - { - stateset.setRenderingHint(StateSet::OPAQUE_BIN); - fr+=2; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("TRANSPARENT_BIN")) - { - stateset.setRenderingHint(StateSet::TRANSPARENT_BIN); - fr+=2; - iteratorAdvanced = true; - } - else if (fr[1].isInt()) - { - int value; - fr[1].getInt(value); - stateset.setRenderingHint(value); - fr+=2; - iteratorAdvanced = true; - } - } - - bool setRenderBinDetails=false; - StateSet::RenderBinMode rbmode = stateset.getRenderBinMode(); - if (fr[0].matchWord("renderBinMode") && StateSet_matchRenderBinModeStr(fr[1].getStr(),rbmode)) - { - setRenderBinDetails=true; - fr+=2; - iteratorAdvanced = true; - } - - int binNumber = stateset.getBinNumber(); - if (fr[0].matchWord("binNumber") && fr[1].getInt(binNumber)) - { - setRenderBinDetails=true; - fr+=2; - iteratorAdvanced = true; - } - - std::string binName = stateset.getBinName(); - if (fr[0].matchWord("binName")) - { - setRenderBinDetails=true; - binName = fr[1].getStr(); - - fr+=2; - iteratorAdvanced = true; - } - - if (setRenderBinDetails) - { - stateset.setRenderBinDetails(binNumber,binName,rbmode); - } - - static ref_ptr s_callback = new osg::StateSet::Callback; - while (fr.matchSequence("UpdateCallback {")) - { - // int entry = fr[0].getNoNestedBrackets(); - fr += 2; - StateSet::Callback* callback = dynamic_cast(fr.readObjectOfType(*s_callback)); - if (callback) { - stateset.setUpdateCallback(callback); - } - iteratorAdvanced = true; - } - - while (fr.matchSequence("EventCallback {")) - { - //int entry = fr[0].getNoNestedBrackets(); - fr += 2; - StateSet::Callback* callback = dynamic_cast(fr.readObjectOfType(*s_callback)); - if (callback) { - stateset.setEventCallback(callback); - } - iteratorAdvanced = true; - } - - bool readingMode = true; - StateAttribute::GLModeValue value; - while (readingMode) - { - - readingMode=false; - if (fr[0].isInt()) - { - if (StateSet_matchModeStr(fr[1].getStr(),value)) - { - int mode; - fr[0].getInt(mode); - - if (s_TextureGLModeSet.find(mode)!=s_TextureGLModeSet.end()) - { - // remap to a texture unit. - stateset.setTextureMode(0,(StateAttribute::GLMode)mode,value); - } - else - { - stateset.setMode((StateAttribute::GLMode)mode,value); - } - fr+=2; - iteratorAdvanced = true; - readingMode=true; - } - } - else - if (fr[0].getStr()) - { - if (StateSet_matchModeStr(fr[1].getStr(),value)) - { - GLNameToGLModeMap::iterator nitr = s_GLNameToGLModeMap.find(fr[0].getStr()); - if (nitr!=s_GLNameToGLModeMap.end()) - { - StateAttribute::GLMode mode = nitr->second; - if (s_TextureGLModeSet.find(mode)!=s_TextureGLModeSet.end()) - { - // remap to a texture unit. - stateset.setTextureMode(0,mode,value); - } - else - { - stateset.setMode(mode,value); - } - fr+=2; - iteratorAdvanced = true; - readingMode=true; - } - } - } - } - - // new code using osg::Registry's list of prototypes to loaded attributes. - Uniform* uniform = NULL; - while((uniform=fr.readUniform())!=NULL) - { - stateset.addUniform(uniform); - iteratorAdvanced = true; - } - - - // new code using osg::Registry's list of prototypes to loaded attributes. - StateAttribute* attribute = NULL; - while((attribute=fr.readStateAttribute())!=NULL) - { - if (attribute->isTextureAttribute()) - { - // remap to be a texture attribute - stateset.setTextureAttribute(0,attribute); - } - else - { - stateset.setAttribute(attribute); - } - iteratorAdvanced = true; - } - - while(fr.matchSequence("textureUnit %i {")) - { - int entry = fr[0].getNoNestedBrackets(); - - unsigned int unit=0; - fr[1].getUInt(unit); - fr+=3; - - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - bool localIteratorAdvanced = false; - - bool readingMode = true; - StateAttribute::GLModeValue value; - while (readingMode) - { - readingMode=false; - if (fr[0].isInt()) - { - if (StateSet_matchModeStr(fr[1].getStr(),value)) - { - int mode; - fr[0].getInt(mode); - stateset.setTextureMode(unit,(StateAttribute::GLMode)mode,value); - fr+=2; - localIteratorAdvanced = true; - readingMode=true; - } - } - else - if (fr[0].getStr()) - { - if (StateSet_matchModeStr(fr[1].getStr(),value)) - { - GLNameToGLModeMap::iterator nitr = s_GLNameToGLModeMap.find(fr[0].getStr()); - if (nitr!=s_GLNameToGLModeMap.end()) - { - StateAttribute::GLMode mode = nitr->second; - stateset.setTextureMode(unit,mode,value); - fr+=2; - localIteratorAdvanced = true; - readingMode=true; - } - } - } - } - - StateAttribute* attribute = NULL; - while((attribute=fr.readStateAttribute())!=NULL) - { - stateset.setTextureAttribute(unit,attribute); - localIteratorAdvanced = true; - } - - if (!localIteratorAdvanced) - fr.advanceOverCurrentFieldOrBlock(); - } - - // skip over trailing '}' - ++fr; - - iteratorAdvanced = true; - - } - - - - - return iteratorAdvanced; -} - -// visual studio 6.0 doesn't appear to define std::max?!? So do our own here.. -template -T mymax(const T& a,const T& b) -{ - return (((a) > (b)) ? (a) : (b)); -} - -bool StateSet_writeLocalData(const Object& obj, Output& fw) -{ - - const StateSet& stateset = static_cast(obj); - - initGLNames(); - - // write the rendering hint value. - fw.indent()<<"rendering_hint "; - switch(stateset.getRenderingHint()) - { - case(StateSet::DEFAULT_BIN): - fw<<"DEFAULT_BIN"<< std::endl; - break; - case(StateSet::OPAQUE_BIN): - fw<<"OPAQUE_BIN"<< std::endl; - break; - case(StateSet::TRANSPARENT_BIN): - fw<<"TRANSPARENT_BIN"<< std::endl; - break; - default: - fw<first); - if (nitr!=s_GLModeToGLNameMap.end()) - { - fw.indent() << nitr->second << " " << StateSet_getModeStr(mitr->second) << std::endl; - } - else - { - // no name defined for GLMode so just pass its value to fw. - fw.indent() << "0x" << hex << (unsigned int)mitr->first << dec <<" " << StateSet_getModeStr(mitr->second) << std::endl; - } - } - - const StateSet::UniformList& ul = stateset.getUniformList(); - for(StateSet::UniformList::const_iterator uitr=ul.begin(); - uitr!=ul.end(); - ++uitr) - { - fw.writeObject(*(uitr->second.first)); - } - - const StateSet::AttributeList& sl = stateset.getAttributeList(); - for(StateSet::AttributeList::const_iterator sitr=sl.begin(); - sitr!=sl.end(); - ++sitr) - { - fw.writeObject(*(sitr->second.first)); - } - - - const StateSet::TextureModeList& tml = stateset.getTextureModeList(); - const StateSet::TextureAttributeList& tal = stateset.getTextureAttributeList(); - unsigned int maxUnit = mymax(tml.size(),tal.size()); - for(unsigned int unit=0;unitfirst); - if (nitr!=s_GLModeToGLNameMap.end()) - { - fw.indent() << nitr->second << " " << StateSet_getModeStr(mitr->second) << std::endl; - } - else - { - // no name defined for GLMode so just pass its value to fw. - fw.indent() << "0x" << hex << (unsigned int)mitr->first << dec <<" " << StateSet_getModeStr(mitr->second) << std::endl; - } - } - } - - if (unitsecond.first)); - } - } - - fw.moveOut(); - fw.indent()<<"}"<< std::endl; - } - - if (stateset.getUpdateCallback()) - { - fw.indent() << "UpdateCallback {" << std::endl; - fw.moveIn(); - fw.writeObject(*stateset.getUpdateCallback()); - fw.moveOut(); - fw.indent() << "}" << std::endl; - } - - if (stateset.getEventCallback()) - { - fw.indent() << "EventCallback {" << std::endl; - fw.moveIn(); - fw.writeObject(*stateset.getEventCallback()); - fw.moveOut(); - fw.indent() << "}" << std::endl; - } - - return true; -} - - -bool StateSet_matchModeStr(const char* str,StateAttribute::GLModeValue& mode) -{ - if (strcmp(str,"INHERIT")==0) mode = StateAttribute::INHERIT; - else if (strcmp(str,"ON")==0) mode = StateAttribute::ON; - else if (strcmp(str,"OFF")==0) mode = StateAttribute::OFF; - else if (strcmp(str,"OVERRIDE_ON")==0) mode = StateAttribute::OVERRIDE|StateAttribute::ON; - else if (strcmp(str,"OVERRIDE_OFF")==0) mode = StateAttribute::OVERRIDE|StateAttribute::OFF; - else if (strcmp(str,"OVERRIDE|ON")==0) mode = StateAttribute::OVERRIDE|StateAttribute::ON; - else if (strcmp(str,"OVERRIDE|OFF")==0) mode = StateAttribute::OVERRIDE|StateAttribute::OFF; - else if (strcmp(str,"PROTECTED|ON")==0) mode = StateAttribute::PROTECTED|StateAttribute::ON; - else if (strcmp(str,"PROTECTED|OFF")==0) mode = StateAttribute::PROTECTED|StateAttribute::OFF; - else if (strcmp(str,"PROTECTED|OVERRIDE|ON")==0) mode = StateAttribute::PROTECTED|StateAttribute::OVERRIDE|StateAttribute::ON; - else if (strcmp(str,"PROTECTED|OVERRIDE|OFF")==0) mode = StateAttribute::PROTECTED|StateAttribute::OVERRIDE|StateAttribute::OFF; - else return false; - return true; -} - - -const char* StateSet_getModeStr(StateAttribute::GLModeValue value) -{ - switch(value) - { - case(StateAttribute::INHERIT): return "INHERIT"; - case(StateAttribute::ON): return "ON"; - case(StateAttribute::OFF): return "OFF"; - case(StateAttribute::OVERRIDE|StateAttribute::ON): return "OVERRIDE|ON"; - case(StateAttribute::OVERRIDE|StateAttribute::OFF): return "OVERRIDE|OFF"; - case(StateAttribute::PROTECTED|StateAttribute::ON): return "PROTECTED|ON"; - case(StateAttribute::PROTECTED|StateAttribute::OFF): return "PROTECTED|OFF"; - case(StateAttribute::PROTECTED|StateAttribute::OVERRIDE|StateAttribute::ON): return "PROTECTED|OVERRIDE|ON"; - case(StateAttribute::PROTECTED|StateAttribute::OVERRIDE|StateAttribute::OFF): return "PROTECTED|OVERRIDE|OFF"; - } - return ""; -} - -bool StateSet_matchRenderBinModeStr(const char* str,StateSet::RenderBinMode& mode) -{ - if (strcmp(str,"INHERIT")==0) mode = StateSet::INHERIT_RENDERBIN_DETAILS; - else if (strcmp(str,"USE")==0) mode = StateSet::USE_RENDERBIN_DETAILS; - else if (strcmp(str,"OVERRIDE")==0) mode = StateSet::OVERRIDE_RENDERBIN_DETAILS; - else if (strcmp(str,"ENCLOSE")==0) mode = StateSet::USE_RENDERBIN_DETAILS; - else return false; - return true; -} - -const char* StateSet_getRenderBinModeStr(StateSet::RenderBinMode mode) -{ - switch(mode) - { - case(StateSet::INHERIT_RENDERBIN_DETAILS): return "INHERIT"; - case(StateSet::USE_RENDERBIN_DETAILS): return "USE"; - case(StateSet::OVERRIDE_RENDERBIN_DETAILS): return "OVERRIDE"; - } - return ""; -} diff --git a/src/osgPlugins/osg/Stencil.cpp b/src/osgPlugins/osg/Stencil.cpp deleted file mode 100644 index cd375b2e5..000000000 --- a/src/osgPlugins/osg/Stencil.cpp +++ /dev/null @@ -1,184 +0,0 @@ -#include "osg/Stencil" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -#include - -using namespace osg; -using namespace osgDB; -using namespace std; - -// forward declare functions to use later. -bool Stencil_readLocalData(Object& obj, Input& fr); -bool Stencil_writeLocalData(const Object& obj, Output& fw); - -bool Stencil_matchFuncStr(const char* str,Stencil::Function& func); -const char* Stencil_getFuncStr(Stencil::Function func); -bool Stencil_matchOperationStr(const char* str,Stencil::Operation& op); -const char* Stencil_getOperationStr(Stencil::Operation op); - - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Stencil) -( - new osg::Stencil, - "Stencil", - "Object StateAttribute Stencil", - &Stencil_readLocalData, - &Stencil_writeLocalData -); - - -bool Stencil_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - Stencil& stencil = static_cast(obj); - - bool setFunction = false; - Stencil::Function func = stencil.getFunction(); - if (fr[0].matchWord("function") && Stencil_matchFuncStr(fr[1].getStr(),func)) - { - setFunction = true; - fr+=2; - iteratorAdvanced = true; - } - - int ref = stencil.getFunctionRef(); - if (fr[0].matchWord("functionRef") && fr[1].getInt(ref)) - { - setFunction = true; - fr+=2; - iteratorAdvanced = true; - } - - unsigned int mask = stencil.getFunctionMask(); - if (fr[0].matchWord("functionMask") && fr[1].getUInt(mask)) - { - setFunction = true; - fr+=2; - iteratorAdvanced = true; - } - - if (setFunction) stencil.setFunction(func,ref,mask); - - bool setOperation = false; - osg::Stencil::Operation sfail = stencil.getStencilFailOperation(); - if (fr[0].matchWord("stencilFailOperation") && Stencil_matchOperationStr(fr[1].getStr(),sfail)) - { - setOperation = true; - fr+=2; - iteratorAdvanced = true; - } - - osg::Stencil::Operation zfail = stencil.getStencilPassAndDepthFailOperation(); - if (fr[0].matchWord("stencilPassAndDepthFailOperation") && Stencil_matchOperationStr(fr[1].getStr(),zfail)) - { - setOperation = true; - fr+=2; - iteratorAdvanced = true; - } - - osg::Stencil::Operation zpass = stencil.getStencilPassAndDepthPassOperation(); - if (fr[0].matchWord("stencilPassAndDepthPassOperation") && Stencil_matchOperationStr(fr[1].getStr(),zpass)) - { - setOperation = true; - fr+=2; - iteratorAdvanced = true; - } - - if (setOperation) stencil.setOperation(sfail, zfail, zpass); - - - if (fr[0].matchWord("writeMask") && fr[1].getUInt(mask)) - { - stencil.setWriteMask(mask); - fr+=2; - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - - -bool Stencil_writeLocalData(const Object& obj,Output& fw) -{ - const Stencil& stencil = static_cast(obj); - - fw.indent() << "function " << Stencil_getFuncStr(stencil.getFunction()) << std::endl; - fw.indent() << "functionRef " << stencil.getFunctionRef() << std::endl; - fw.indent() << "functionMask 0x" << hex << stencil.getFunctionMask() << dec << std::endl; - - fw.indent() << "stencilFailOperation " << Stencil_getOperationStr(stencil.getStencilFailOperation()) << std::endl; - fw.indent() << "stencilPassAndDepthFailOperation " << Stencil_getOperationStr(stencil.getStencilPassAndDepthFailOperation()) << std::endl; - fw.indent() << "stencilPassAndDepthPassOperation " << Stencil_getOperationStr(stencil.getStencilPassAndDepthPassOperation()) << std::endl; - - fw.indent() << "writeMask 0x" << hex << stencil.getWriteMask() << dec << std::endl; - - return true; -} - - -bool Stencil_matchFuncStr(const char* str,Stencil::Function& func) -{ - if (strcmp(str,"NEVER")==0) func = Stencil::NEVER; - else if (strcmp(str,"LESS")==0) func = Stencil::LESS; - else if (strcmp(str,"EQUAL")==0) func = Stencil::EQUAL; - else if (strcmp(str,"LEQUAL")==0) func = Stencil::LEQUAL; - else if (strcmp(str,"GREATER")==0) func = Stencil::GREATER; - else if (strcmp(str,"NOTEQUAL")==0) func = Stencil::NOTEQUAL; - else if (strcmp(str,"GEQUAL")==0) func = Stencil::GEQUAL; - else if (strcmp(str,"ALWAYS")==0) func = Stencil::ALWAYS; - else return false; - return true; -} - - -const char* Stencil_getFuncStr(Stencil::Function func) -{ - switch(func) - { - case(Stencil::NEVER): return "NEVER"; - case(Stencil::LESS): return "LESS"; - case(Stencil::EQUAL): return "EQUAL"; - case(Stencil::LEQUAL): return "LEQUAL"; - case(Stencil::GREATER): return "GREATER"; - case(Stencil::NOTEQUAL): return "NOTEQUAL"; - case(Stencil::GEQUAL): return "GEQUAL"; - case(Stencil::ALWAYS): return "ALWAYS"; - } - return ""; -} - -bool Stencil_matchOperationStr(const char* str,Stencil::Operation& op) -{ - if (strcmp(str,"KEEP")==0) op = Stencil::KEEP; - else if (strcmp(str,"ZERO")==0) op = Stencil::ZERO; - else if (strcmp(str,"REPLACE")==0) op = Stencil::REPLACE; - else if (strcmp(str,"INCR")==0) op = Stencil::INCR; - else if (strcmp(str,"DECR")==0) op = Stencil::DECR; - else if (strcmp(str,"INVERT")==0) op = Stencil::INVERT; - else if (strcmp(str,"INCR_WRAP")==0) op = Stencil::INCR_WRAP; - else if (strcmp(str,"DECR_WRAP")==0) op = Stencil::DECR_WRAP; - else return false; - return true; -} - -const char* Stencil_getOperationStr(Stencil::Operation op) -{ - switch(op) - { - case(Stencil::KEEP): return "KEEP"; - case(Stencil::ZERO): return "ZERO"; - case(Stencil::REPLACE): return "REPLACE"; - case(Stencil::INCR): return "INCR"; - case(Stencil::DECR): return "DECR"; - case(Stencil::INVERT): return "INVERT"; - case(Stencil::INCR_WRAP): return "INCR_WRAP"; - case(Stencil::DECR_WRAP): return "DECR_WRAP"; - } - return ""; -} - diff --git a/src/osgPlugins/osg/Switch.cpp b/src/osgPlugins/osg/Switch.cpp deleted file mode 100644 index 5740474a1..000000000 --- a/src/osgPlugins/osg/Switch.cpp +++ /dev/null @@ -1,127 +0,0 @@ -#include "osg/Switch" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool Switch_readLocalData(Object& obj, Input& fr); -bool Switch_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Switch) -( - new osg::Switch, - "Switch", - "Object Node Switch Group", - &Switch_readLocalData, - &Switch_writeLocalData -); - -bool Switch_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - Switch& sw = static_cast(obj); - - if (fr.matchSequence("value")) - { - if (fr[1].matchWord("ALL_CHILDREN_ON")) - { - sw.setAllChildrenOn(); - iteratorAdvanced = true; - fr+=2; - } - else if (fr[1].matchWord("ALL_CHILDREN_OFF")) - { - sw.setAllChildrenOff(); - iteratorAdvanced = true; - fr+=2; - } - else if (fr[1].isInt()) - { - unsigned int value; - fr[1].getUInt(value); - sw.setSingleChildOn(value); - iteratorAdvanced = true; - fr+=2; - } - } - - if (fr[0].matchWord("NewChildDefaultValue")) - { - if (fr[1].matchWord("TRUE")) - { - sw.setNewChildDefaultValue(true); - iteratorAdvanced = true; - fr += 2; - } - else if (fr[1].matchWord("FALSE")) - { - sw.setNewChildDefaultValue(false); - iteratorAdvanced = true; - fr += 2; - } - else if (fr[1].isInt()) - { - int value; - fr[1].getInt(value); - sw.setNewChildDefaultValue(value!=0); - iteratorAdvanced = true; - fr += 2; - } - } - - if (fr.matchSequence("ValueList {")) - { - int entry = fr[0].getNoNestedBrackets(); - - // move inside the brakets. - fr += 2; - - unsigned int pos=0; - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - int value; - if (fr[0].getInt(value)) - { - sw.setValue(pos,value!=0); - ++pos; - } - ++fr; - } - - ++fr; - - iteratorAdvanced = true; - - } - - return iteratorAdvanced; -} - - -bool Switch_writeLocalData(const Object& obj, Output& fw) -{ - const Switch& sw = static_cast(obj); - - - fw.indent()<<"NewChildDefaultValue "< - -#include -#include -#include - -using namespace osg; -using namespace osgDB; - - -// forward declare functions to use later. -bool TessellationHints_readLocalData(Object& obj, Input& fr); -bool TessellationHints_writeLocalData(const Object& obj, Output& fw); - -REGISTER_DOTOSGWRAPPER(TessellationHints) -( - new osg::TessellationHints, - "TessellationHints", - "Object TessellationHints", - &TessellationHints_readLocalData, - &TessellationHints_writeLocalData, - DotOsgWrapper::READ_AND_WRITE -); - -bool TessellationHints_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - TessellationHints& hints = static_cast(obj); - - if (fr.matchSequence("detailRatio %f")) { - float ratio = 1.0f; - fr[1].getFloat(ratio); - hints.setDetailRatio(ratio); - fr += 2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("createFaces")) { - hints.setCreateFrontFace(fr[1].matchWord("TRUE")); - hints.setCreateBackFace(fr[2].matchWord("TRUE")); - fr += 3; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("createNormals")) { - hints.setCreateNormals(fr[1].matchWord("TRUE")); - fr += 2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("createTextureCoords")) { - hints.setCreateTextureCoords(fr[1].matchWord("TRUE")); - fr += 2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("createParts")) { - hints.setCreateTop(fr[1].matchWord("TRUE")); - hints.setCreateBody(fr[2].matchWord("TRUE")); - hints.setCreateBottom(fr[3].matchWord("TRUE")); - fr += 4; - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - -bool TessellationHints_writeLocalData(const Object& obj, Output& fw) -{ - const TessellationHints& hints = static_cast(obj); - - fw.indent() << "detailRatio " << hints.getDetailRatio() << std::endl; - - fw.indent() << "createFaces " << (hints.getCreateFrontFace() ? "TRUE" : "FALSE") << " " << (hints.getCreateBackFace() ? "TRUE" : "FALSE") << std::endl; - - fw.indent() << "createNormals " << (hints.getCreateNormals() ? "TRUE" : "FALSE") << std::endl; - fw.indent() << "createTextureCoords " << (hints.getCreateTextureCoords() ? "TRUE" : "FALSE") << std::endl; - - fw.indent() << "createParts " << (hints.getCreateTop() ? "TRUE" : "FALSE" ) << " " << (hints.getCreateBody() ? "TRUE" : "FALSE") << " " << (hints.getCreateBottom() ? "TRUE" : "FALSE") << std::endl; - - return true; -} diff --git a/src/osgPlugins/osg/TexEnv.cpp b/src/osgPlugins/osg/TexEnv.cpp deleted file mode 100644 index b6a01d87e..000000000 --- a/src/osgPlugins/osg/TexEnv.cpp +++ /dev/null @@ -1,107 +0,0 @@ -#include "osg/TexEnv" -#include - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -#include - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool TexEnv_readLocalData(Object& obj, Input& fr); -bool TexEnv_writeLocalData(const Object& obj, Output& fw); -bool TexEnv_matchModeStr(const char* str,TexEnv::Mode& mode); -const char* TexEnv_getModeStr(TexEnv::Mode mode); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(TexEnv) -( - new osg::TexEnv, - "TexEnv", - "Object StateAttribute TexEnv", - &TexEnv_readLocalData, - &TexEnv_writeLocalData -); - - -bool TexEnv_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - TexEnv& texenv = static_cast(obj); - - TexEnv::Mode mode; - if (fr[0].matchWord("mode") && TexEnv_matchModeStr(fr[1].getStr(),mode)) - { - texenv.setMode(mode); - fr+=2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("color %f %f %f %f")) - { - osg::Vec4 color; - fr[1].getFloat(color[0]); - fr[2].getFloat(color[1]); - fr[3].getFloat(color[2]); - fr[4].getFloat(color[3]); - - texenv.setColor(color); - - fr+=5; - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - -bool TexEnv_writeLocalData(const Object& obj, Output& fw) -{ - const TexEnv& texenv = static_cast(obj); - - fw.indent() << "mode " << TexEnv_getModeStr(texenv.getMode()) << std::endl; - - switch(texenv.getMode()) - { - case(TexEnv::DECAL): - case(TexEnv::MODULATE): - case(TexEnv::REPLACE): - case(TexEnv::ADD): - break; - case(TexEnv::BLEND): - default: - fw.indent() << "color " << texenv.getColor() << std::endl; - break; - } - - return true; -} - -bool TexEnv_matchModeStr(const char* str,TexEnv::Mode& mode) -{ - if (strcmp(str,"DECAL")==0) mode = TexEnv::DECAL; - else if (strcmp(str,"MODULATE")==0) mode = TexEnv::MODULATE; - else if (strcmp(str,"BLEND")==0) mode = TexEnv::BLEND; - else if (strcmp(str,"REPLACE")==0) mode = TexEnv::REPLACE; - else if (strcmp(str,"ADD")==0) mode = TexEnv::ADD; - else return false; - return true; -} - - -const char* TexEnv_getModeStr(TexEnv::Mode mode) -{ - switch(mode) - { - case(TexEnv::DECAL): return "DECAL"; - case(TexEnv::MODULATE): return "MODULATE"; - case(TexEnv::BLEND): return "BLEND"; - case(TexEnv::REPLACE): return "REPLACE"; - case(TexEnv::ADD): return "ADD"; - } - return ""; -} - diff --git a/src/osgPlugins/osg/TexEnvCombine.cpp b/src/osgPlugins/osg/TexEnvCombine.cpp deleted file mode 100644 index 217965e2d..000000000 --- a/src/osgPlugins/osg/TexEnvCombine.cpp +++ /dev/null @@ -1,289 +0,0 @@ -#include "osg/TexEnvCombine" -#include - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -#include - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool TexEnvCombine_readLocalData(Object& obj, Input& fr); -bool TexEnvCombine_writeLocalData(const Object& obj, Output& fw); - -bool TexEnvCombine_matchCombineParamStr(const char* str,GLint& value); -const char* TexEnvCombine_getCombineParamStr(GLint value); - -bool TexEnvCombine_matchSourceParamStr(const char* str,GLint& value); -const char* TexEnvCombine_getSourceParamStr(GLint value); - -bool TexEnvCombine_matchOperandParamStr(const char* str,GLint& value); -const char* TexEnvCombine_getOperandParamStr(GLint value); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(TexEnvCombine) -( - new osg::TexEnvCombine, - "TexEnvCombine", - "Object StateAttribute TexEnvCombine", - &TexEnvCombine_readLocalData, - &TexEnvCombine_writeLocalData -); - - -bool TexEnvCombine_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - TexEnvCombine& texenv = static_cast(obj); - - GLint value; - if (fr[0].matchWord("combine_RGB") && TexEnvCombine_matchCombineParamStr(fr[1].getStr(),value)) - { - texenv.setCombine_RGB(value); - fr+=2; - iteratorAdvanced = true; - } - if (fr[0].matchWord("combine_Alpha") && TexEnvCombine_matchCombineParamStr(fr[1].getStr(),value)) - { - texenv.setCombine_Alpha(value); - fr+=2; - iteratorAdvanced = true; - } - - - if (fr[0].matchWord("source0_RGB") && TexEnvCombine_matchSourceParamStr(fr[1].getStr(),value)) - { - texenv.setSource0_RGB(value); - fr+=2; - iteratorAdvanced = true; - } - if (fr[0].matchWord("source1_RGB") && TexEnvCombine_matchSourceParamStr(fr[1].getStr(),value)) - { - texenv.setSource1_RGB(value); - fr+=2; - iteratorAdvanced = true; - } - if (fr[0].matchWord("source2_RGB") && TexEnvCombine_matchSourceParamStr(fr[1].getStr(),value)) - { - texenv.setSource2_RGB(value); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("source0_Alpha") && TexEnvCombine_matchSourceParamStr(fr[1].getStr(),value)) - { - texenv.setSource0_Alpha(value); - fr+=2; - iteratorAdvanced = true; - } - if (fr[0].matchWord("source1_Alpha") && TexEnvCombine_matchSourceParamStr(fr[1].getStr(),value)) - { - texenv.setSource1_Alpha(value); - fr+=2; - iteratorAdvanced = true; - } - if (fr[0].matchWord("source2_Alpha") && TexEnvCombine_matchSourceParamStr(fr[1].getStr(),value)) - { - texenv.setSource2_Alpha(value); - fr+=2; - iteratorAdvanced = true; - } - - - - if (fr[0].matchWord("operand0_RGB") && TexEnvCombine_matchOperandParamStr(fr[1].getStr(),value)) - { - texenv.setOperand0_RGB(value); - fr+=2; - iteratorAdvanced = true; - } - if (fr[0].matchWord("operand1_RGB") && TexEnvCombine_matchOperandParamStr(fr[1].getStr(),value)) - { - texenv.setOperand1_RGB(value); - fr+=2; - iteratorAdvanced = true; - } - if (fr[0].matchWord("operand2_RGB") && TexEnvCombine_matchOperandParamStr(fr[1].getStr(),value)) - { - texenv.setOperand2_RGB(value); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("operand0_Alpha") && TexEnvCombine_matchOperandParamStr(fr[1].getStr(),value)) - { - texenv.setOperand0_Alpha(value); - fr+=2; - iteratorAdvanced = true; - } - if (fr[0].matchWord("operand1_Alpha") && TexEnvCombine_matchOperandParamStr(fr[1].getStr(),value)) - { - texenv.setOperand1_Alpha(value); - fr+=2; - iteratorAdvanced = true; - } - if (fr[0].matchWord("operand2_Alpha") && TexEnvCombine_matchOperandParamStr(fr[1].getStr(),value)) - { - texenv.setOperand2_Alpha(value); - fr+=2; - iteratorAdvanced = true; - } - - float scale; - if (fr[0].matchWord("scale_RGB") && fr[1].getFloat(scale)) - { - texenv.setScale_RGB(scale); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("scale_Alpha") && fr[1].getFloat(scale)) - { - texenv.setScale_Alpha(scale); - fr+=2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("constantColor %f %f %f %f")) - { - osg::Vec4 color; - fr[1].getFloat(color[0]); - fr[2].getFloat(color[1]); - fr[3].getFloat(color[2]); - fr[4].getFloat(color[3]); - - texenv.setConstantColor(color); - - fr+=5; - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - -bool TexEnvCombine_writeLocalData(const Object& obj, Output& fw) -{ - const TexEnvCombine& texenv = static_cast(obj); - - fw.indent() << "combine_RGB " << TexEnvCombine_getCombineParamStr(texenv.getCombine_RGB()) << std::endl; - fw.indent() << "combine_Alpha " << TexEnvCombine_getCombineParamStr(texenv.getCombine_Alpha()) << std::endl; - - fw.indent() << "source0_RGB " << TexEnvCombine_getSourceParamStr(texenv.getSource0_RGB()) << std::endl; - fw.indent() << "source1_RGB " << TexEnvCombine_getSourceParamStr(texenv.getSource1_RGB()) << std::endl; - fw.indent() << "source2_RGB " << TexEnvCombine_getSourceParamStr(texenv.getSource2_RGB()) << std::endl; - - fw.indent() << "source0_Alpha " << TexEnvCombine_getSourceParamStr(texenv.getSource0_Alpha()) << std::endl; - fw.indent() << "source1_Alpha " << TexEnvCombine_getSourceParamStr(texenv.getSource1_Alpha()) << std::endl; - fw.indent() << "source2_Alpha " << TexEnvCombine_getSourceParamStr(texenv.getSource2_Alpha()) << std::endl; - - fw.indent() << "operand0_RGB " << TexEnvCombine_getOperandParamStr(texenv.getOperand0_RGB()) << std::endl; - fw.indent() << "operand1_RGB " << TexEnvCombine_getOperandParamStr(texenv.getOperand1_RGB()) << std::endl; - fw.indent() << "operand2_RGB " << TexEnvCombine_getOperandParamStr(texenv.getOperand2_RGB()) << std::endl; - - fw.indent() << "operand0_Alpha " << TexEnvCombine_getOperandParamStr(texenv.getOperand0_Alpha()) << std::endl; - fw.indent() << "operand1_Alpha " << TexEnvCombine_getOperandParamStr(texenv.getOperand1_Alpha()) << std::endl; - fw.indent() << "operand2_Alpha " << TexEnvCombine_getOperandParamStr(texenv.getOperand2_Alpha()) << std::endl; - - fw.indent() << "scale_RGB " << texenv.getScale_RGB() << std::endl; - fw.indent() << "scale_Alpha " << texenv.getScale_Alpha() << std::endl; - - fw.indent() << "constantColor " << texenv.getConstantColor() << std::endl; - - return true; -} - - -bool TexEnvCombine_matchCombineParamStr(const char* str,GLint& value) -{ - if (strcmp(str,"REPLACE")==0) value = TexEnvCombine::REPLACE; - else if (strcmp(str,"MODULATE")==0) value = TexEnvCombine::MODULATE; - else if (strcmp(str,"ADD")==0) value = TexEnvCombine::ADD; - else if (strcmp(str,"ADD_SIGNED")==0) value = TexEnvCombine::ADD_SIGNED; - else if (strcmp(str,"INTERPOLATE")==0) value = TexEnvCombine::INTERPOLATE; - else if (strcmp(str,"SUBTRACT")==0) value = TexEnvCombine::SUBTRACT; - else if (strcmp(str,"DOT3_RGB")==0) value = TexEnvCombine::DOT3_RGB; - else if (strcmp(str,"DOT3_RGBA")==0) value = TexEnvCombine::DOT3_RGBA; - else return false; - return true; -} - -const char* TexEnvCombine_getCombineParamStr(GLint value) -{ - switch(value) - { - case(TexEnvCombine::REPLACE): return "REPLACE"; - case(TexEnvCombine::MODULATE): return "MODULATE"; - case(TexEnvCombine::ADD): return "ADD"; - case(TexEnvCombine::ADD_SIGNED): return "ADD_SIGNED"; - case(TexEnvCombine::INTERPOLATE): return "INTERPOLATE"; - case(TexEnvCombine::SUBTRACT): return "SUBTRACT"; - case(TexEnvCombine::DOT3_RGB): return "DOT3_RGB"; - case(TexEnvCombine::DOT3_RGBA): return "DOT3_RGBA"; - } - return ""; -} - -bool TexEnvCombine_matchSourceParamStr(const char* str,GLint& value) -{ - if (strcmp(str,"CONSTANT")==0) value = TexEnvCombine::CONSTANT; - else if (strcmp(str,"PRIMARY_COLOR")==0) value = TexEnvCombine::PRIMARY_COLOR; - else if (strcmp(str,"PREVIOUS")==0) value = TexEnvCombine::PREVIOUS; - else if (strcmp(str,"TEXTURE")==0) value = TexEnvCombine::TEXTURE; - else if (strcmp(str,"TEXTURE0")==0) value = TexEnvCombine::TEXTURE0; - else if (strcmp(str,"TEXTURE1")==0) value = TexEnvCombine::TEXTURE1; - else if (strcmp(str,"TEXTURE2")==0) value = TexEnvCombine::TEXTURE2; - else if (strcmp(str,"TEXTURE3")==0) value = TexEnvCombine::TEXTURE3; - else if (strcmp(str,"TEXTURE4")==0) value = TexEnvCombine::TEXTURE4; - else if (strcmp(str,"TEXTURE5")==0) value = TexEnvCombine::TEXTURE5; - else if (strcmp(str,"TEXTURE6")==0) value = TexEnvCombine::TEXTURE6; - else if (strcmp(str,"TEXTURE7")==0) value = TexEnvCombine::TEXTURE7; - else return false; - return true; -} - -const char* TexEnvCombine_getSourceParamStr(GLint value) -{ - switch(value) - { - case(TexEnvCombine::CONSTANT): return "CONSTANT"; - case(TexEnvCombine::PRIMARY_COLOR): return "PRIMARY_COLOR"; - case(TexEnvCombine::PREVIOUS): return "PREVIOUS"; - case(TexEnvCombine::TEXTURE): return "TEXTURE"; - case(TexEnvCombine::TEXTURE0): return "TEXTURE0"; - case(TexEnvCombine::TEXTURE1): return "TEXTURE1"; - case(TexEnvCombine::TEXTURE2): return "TEXTURE2"; - case(TexEnvCombine::TEXTURE3): return "TEXTURE3"; - case(TexEnvCombine::TEXTURE4): return "TEXTURE4"; - case(TexEnvCombine::TEXTURE5): return "TEXTURE5"; - case(TexEnvCombine::TEXTURE6): return "TEXTURE6"; - case(TexEnvCombine::TEXTURE7): return "TEXTURE7"; - } - return ""; -} - -bool TexEnvCombine_matchOperandParamStr(const char* str,GLint& value) -{ - if (strcmp(str,"SRC_COLOR")==0) value = TexEnvCombine::SRC_COLOR; - else if (strcmp(str,"ONE_MINUS_SRC_COLOR")==0) value = TexEnvCombine::ONE_MINUS_SRC_COLOR; - else if (strcmp(str,"SRC_ALPHA")==0) value = TexEnvCombine::SRC_ALPHA; - else if (strcmp(str,"ONE_MINUS_SRC_ALPHA")==0) value = TexEnvCombine::ONE_MINUS_SRC_ALPHA; - else return false; - return true; -} - -const char* TexEnvCombine_getOperandParamStr(GLint value) -{ - switch(value) - { - case(TexEnvCombine::SRC_COLOR): return "SRC_COLOR"; - case(TexEnvCombine::ONE_MINUS_SRC_COLOR): return "ONE_MINUS_SRC_COLOR"; - case(TexEnvCombine::SRC_ALPHA): return "SRC_ALPHA"; - case(TexEnvCombine::ONE_MINUS_SRC_ALPHA): return "ONE_MINUS_SRC_ALPHA"; - } - return ""; -} - diff --git a/src/osgPlugins/osg/TexEnvFilter.cpp b/src/osgPlugins/osg/TexEnvFilter.cpp deleted file mode 100644 index 2d495b9dc..000000000 --- a/src/osgPlugins/osg/TexEnvFilter.cpp +++ /dev/null @@ -1,49 +0,0 @@ -#include "osg/TexEnvFilter" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool TexEnvFilter_readLocalData(Object& obj, Input& fr); -bool TexEnvFilter_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(TexEnvFilter) -( - new TexEnvFilter, - "TexEnvFilter", - "Object StateAttribute TexEnvFilter", - &TexEnvFilter_readLocalData, - &TexEnvFilter_writeLocalData -); - - -bool TexEnvFilter_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - TexEnvFilter& texenvfilter = static_cast(obj); - - float lodBias = 0.0f; - if (fr[0].matchWord("lodBias") && fr[1].getFloat(lodBias)) - { - fr += 2; - texenvfilter.setLodBias(lodBias); - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - -bool TexEnvFilter_writeLocalData(const Object& obj, Output& fw) -{ - const TexEnvFilter& texenvfilter = static_cast(obj); - - fw.indent() << "lodBias " << texenvfilter.getLodBias() << std::endl; - - return true; -} diff --git a/src/osgPlugins/osg/TexGen.cpp b/src/osgPlugins/osg/TexGen.cpp deleted file mode 100644 index 73c33290a..000000000 --- a/src/osgPlugins/osg/TexGen.cpp +++ /dev/null @@ -1,135 +0,0 @@ -#if defined(_MSC_VER) - #pragma warning( disable : 4786 ) -#endif - -#include "osg/TexGen" -#include "osg/io_utils" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -#include - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool TexGen_readLocalData(Object& obj, Input& fr); -bool TexGen_writeLocalData(const Object& obj, Output& fw); -bool TexGen_matchModeStr(const char* str,TexGen::Mode& mode); -const char* TexGen_getModeStr(TexGen::Mode mode); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(TexGen) -( - new osg::TexGen, - "TexGen", - "Object StateAttribute TexGen", - &TexGen_readLocalData, - &TexGen_writeLocalData -); - - -bool TexGen_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - TexGen& texgen = static_cast(obj); - - TexGen::Mode mode; - - if (fr[0].matchWord("mode") && TexGen_matchModeStr(fr[1].getStr(),mode)) - { - texgen.setMode(mode); - fr+=2; - iteratorAdvanced = true; - } - - osg::Plane plane; - if (fr[0].matchWord("plane_s")) - { - if (fr[1].getFloat(plane[0]) && fr[2].getFloat(plane[1]) && - fr[3].getFloat(plane[2]) && fr[4].getFloat(plane[3])) - { - texgen.setPlane(TexGen::S,plane); - fr+=5; - iteratorAdvanced = true; - } - } - if (fr[0].matchWord("plane_t")) - { - if (fr[1].getFloat(plane[0]) && fr[2].getFloat(plane[1]) && - fr[3].getFloat(plane[2]) && fr[4].getFloat(plane[3])) - { - texgen.setPlane(TexGen::T,plane); - fr+=5; - iteratorAdvanced = true; - } - } - if (fr[0].matchWord("plane_r")) - { - if (fr[1].getFloat(plane[0]) && fr[2].getFloat(plane[1]) && - fr[3].getFloat(plane[2]) && fr[4].getFloat(plane[3])) - { - texgen.setPlane(TexGen::R,plane); - fr+=5; - iteratorAdvanced = true; - } - } - if (fr[0].matchWord("plane_q")) - { - if (fr[1].getFloat(plane[0]) && fr[2].getFloat(plane[1]) && - fr[3].getFloat(plane[2]) && fr[4].getFloat(plane[3])) - { - texgen.setPlane(TexGen::Q,plane); - fr+=5; - iteratorAdvanced = true; - } - } - - return iteratorAdvanced; -} - - -bool TexGen_matchModeStr(const char* str,TexGen::Mode& mode) -{ - if (strcmp(str,"EYE_LINEAR")==0) mode = TexGen::EYE_LINEAR; - else if (strcmp(str,"OBJECT_LINEAR")==0) mode = TexGen::OBJECT_LINEAR; - else if (strcmp(str,"SPHERE_MAP")==0) mode = TexGen::SPHERE_MAP; - else if (strcmp(str,"NORMAL_MAP")==0) mode = TexGen::NORMAL_MAP; - else if (strcmp(str,"REFLECTION_MAP")==0) mode = TexGen::REFLECTION_MAP; - else return false; - return true; -} - - -const char* TexGen_getModeStr(TexGen::Mode mode) -{ - switch(mode) - { - case(TexGen::EYE_LINEAR): return "EYE_LINEAR"; - case(TexGen::OBJECT_LINEAR): return "OBJECT_LINEAR"; - case(TexGen::SPHERE_MAP): return "SPHERE_MAP"; - case(TexGen::NORMAL_MAP): return "NORMAL_MAP"; - case(TexGen::REFLECTION_MAP): return "REFLECTION_MAP"; - } - return ""; -} - - -bool TexGen_writeLocalData(const Object& obj, Output& fw) -{ - const TexGen& texgen = static_cast(obj); - - fw.indent() << "mode " << TexGen_getModeStr(texgen.getMode()) << std::endl; - if (texgen.getMode() == TexGen::OBJECT_LINEAR || texgen.getMode() == TexGen::EYE_LINEAR) - { - fw.indent() << "plane_s " << texgen.getPlane(TexGen::S) << std::endl; - fw.indent() << "plane_t " << texgen.getPlane(TexGen::T) << std::endl; - fw.indent() << "plane_r " << texgen.getPlane(TexGen::R) << std::endl; - fw.indent() << "plane_q " << texgen.getPlane(TexGen::Q) << std::endl; - } - - return true; -} diff --git a/src/osgPlugins/osg/TexGenNode.cpp b/src/osgPlugins/osg/TexGenNode.cpp deleted file mode 100644 index ca3926089..000000000 --- a/src/osgPlugins/osg/TexGenNode.cpp +++ /dev/null @@ -1,65 +0,0 @@ -#include "osg/TexGenNode" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool TexGenNode_readLocalData(Object& obj, Input& fr); -bool TexGenNode_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(TexGenNode) -( - new osg::TexGenNode, - "TexGenNode", - "Object Node TexGenNode Group", - &TexGenNode_readLocalData, - &TexGenNode_writeLocalData -); - -bool TexGenNode_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - TexGenNode& texGenNode = static_cast(obj); - - unsigned int textureUnit = 0; - if (fr[0].matchWord("TextureUnit") && fr[1].getUInt(textureUnit)) - { - - texGenNode.setTextureUnit(textureUnit); - - fr+=2; - iteratorAdvanced = true; - } - - - osg::ref_ptr sa=0; - while((sa=fr.readStateAttribute())!=0) - { - TexGen* texgen = dynamic_cast(sa.get()); - if (texgen) texGenNode.setTexGen(texgen); - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - - -bool TexGenNode_writeLocalData(const Object& obj, Output& fw) -{ - const TexGenNode& texGenNode = static_cast(obj); - - fw.indent()<<"TextureUnit "< - -#include -#include -#include - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool TexMat_readLocalData(Object& obj, Input& fr); -bool TexMat_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(TexMat) -( - new osg::TexMat, - "TexMat", - "Object StateAttribute TexMat", - &TexMat_readLocalData, - &TexMat_writeLocalData -); - - -bool TexMat_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - TexMat& texmat = static_cast(obj); - - bool matched = true; - for(int k=0;k<16 && matched;++k) - { - matched = fr[k].isFloat(); - } - if (matched) - { - - Matrix& matrix = texmat.getMatrix(); - - int k=0; - double v; - for(int i=0;i<4;++i) - { - for(int j=0;j<4;++j) - { - fr[k].getFloat(v); - matrix(i,j)=v; - k++; - } - } - fr += 16; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("scaleByTextureRectangleSize")) - { - if (fr[1].matchWord("TRUE")) - { - texmat.setScaleByTextureRectangleSize(true); - fr +=2 ; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("FALSE")) - { - texmat.setScaleByTextureRectangleSize(false); - fr +=2 ; - iteratorAdvanced = true; - } - } - - return iteratorAdvanced; -} - - -bool TexMat_writeLocalData(const Object& obj, Output& fw) -{ - const TexMat& texmat = static_cast(obj); - const Matrix& matrix = texmat.getMatrix(); - fw.indent() << matrix(0,0) << " " << matrix(0,1) << " " << matrix(0,2) << " " << matrix(0,3) << std::endl; - fw.indent() << matrix(1,0) << " " << matrix(1,1) << " " << matrix(1,2) << " " << matrix(1,3) << std::endl; - fw.indent() << matrix(2,0) << " " << matrix(2,1) << " " << matrix(2,2) << " " << matrix(2,3) << std::endl; - fw.indent() << matrix(3,0) << " " << matrix(3,1) << " " << matrix(3,2) << " " << matrix(3,3) << std::endl; - - if (texmat.getScaleByTextureRectangleSize()) - { - fw.indent() << "scaleByTextureRectangleSize TRUE"< -#include -#include - -#include -#include -#include - -#include -#include - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool Texture_readLocalData(Object& obj, Input& fr); -bool Texture_writeLocalData(const Object& obj, Output& fw); - -bool Texture_matchWrapStr(const char* str,Texture::WrapMode& wrap); -const char* Texture_getWrapStr(Texture::WrapMode wrap); -bool Texture_matchFilterStr(const char* str,Texture::FilterMode& filter); -const char* Texture_getFilterStr(Texture::FilterMode filter); -bool Texture_matchInternalFormatModeStr(const char* str,Texture::InternalFormatMode& mode); -const char* Texture_getInternalFormatModeStr(Texture::InternalFormatMode mode); -bool Texture_matchInternalFormatStr(const char* str,int& value); -const char* Texture_getInternalFormatStr(int value); -bool Texture_matchSourceTypeStr(const char* str,int& value); -const char* Texture_getSourceTypeStr(int value); -bool Texture_matchShadowCompareFuncStr(const char* str,Texture::ShadowCompareFunc& value); -const char* Texture_getShadowCompareFuncStr(Texture::ShadowCompareFunc value); -bool Texture_matchShadowTextureModeStr(const char* str,Texture::ShadowTextureMode& value); -const char* Texture_getShadowTextureModeStr(Texture::ShadowTextureMode value); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Texture) -( - 0, - "TextureBase", - "Object StateAttribute TextureBase", - &Texture_readLocalData, - &Texture_writeLocalData -); - - -bool Texture_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - Texture& texture = static_cast(obj); - - Texture::WrapMode wrap; - if (fr[0].matchWord("wrap_s") && Texture_matchWrapStr(fr[1].getStr(),wrap)) - { - texture.setWrap(Texture::WRAP_S,wrap); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("wrap_t") && Texture_matchWrapStr(fr[1].getStr(),wrap)) - { - texture.setWrap(Texture::WRAP_T,wrap); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("wrap_r") && Texture_matchWrapStr(fr[1].getStr(),wrap)) - { - texture.setWrap(Texture::WRAP_R,wrap); - fr+=2; - iteratorAdvanced = true; - } - - Texture::FilterMode filter; - if (fr[0].matchWord("min_filter") && Texture_matchFilterStr(fr[1].getStr(),filter)) - { - texture.setFilter(Texture::MIN_FILTER,filter); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("mag_filter") && Texture_matchFilterStr(fr[1].getStr(),filter)) - { - texture.setFilter(Texture::MAG_FILTER,filter); - fr+=2; - iteratorAdvanced = true; - } - - if (fr.matchSequence("maxAnisotropy %f")) - { - float anis=1.0f; - fr[1].getFloat(anis); - texture.setMaxAnisotropy(anis); - fr +=2 ; - iteratorAdvanced = true; - } - - if (fr.matchSequence("borderColor %f %f %f %f")) - { - Vec4 color; - fr[1].getFloat(color[0]); - fr[2].getFloat(color[1]); - fr[3].getFloat(color[2]); - fr[4].getFloat(color[3]); - texture.setBorderColor(color); - fr +=5 ; - iteratorAdvanced = true; - } - - if (fr.matchSequence("borderWidth %i")) - { - int width=0; - fr[1].getInt(width); - texture.setBorderWidth(width); - fr +=2 ; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("useHardwareMipMapGeneration")) - { - if (fr[1].matchWord("TRUE")) - { - texture.setUseHardwareMipMapGeneration(true); - fr +=2 ; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("FALSE")) - { - texture.setUseHardwareMipMapGeneration(false); - fr +=2 ; - iteratorAdvanced = true; - } - } - - if (fr[0].matchWord("unRefImageDataAfterApply")) - { - if (fr[1].matchWord("TRUE")) - { - texture.setUnRefImageDataAfterApply(true); - fr +=2 ; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("FALSE")) - { - texture.setUnRefImageDataAfterApply(false); - fr +=2 ; - iteratorAdvanced = true; - } - } - - - Texture::InternalFormatMode mode; - if (fr[0].matchWord("internalFormatMode") && Texture_matchInternalFormatModeStr(fr[1].getStr(),mode)) - { - texture.setInternalFormatMode(mode); - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("internalFormat")) - { - int value; - if (Texture_matchInternalFormatStr(fr[1].getStr(),value) || fr[1].getInt(value)) - { - texture.setInternalFormat(value); - fr+=2; - iteratorAdvanced = true; - } - } - - if (fr[0].matchWord("sourceFormat")) - { - int value; - if (Texture_matchInternalFormatStr(fr[1].getStr(),value) || fr[1].getInt(value)) - { - texture.setSourceFormat(value); - fr+=2; - iteratorAdvanced = true; - } - } - - if (fr[0].matchWord("sourceType")) - { - int value; - if (Texture_matchInternalFormatStr(fr[1].getStr(),value) || fr[1].getInt(value)) - { - texture.setSourceType(value); - fr+=2; - iteratorAdvanced = true; - } - } - - if (fr[0].matchWord("resizeNonPowerOfTwo")) - { - if (fr[1].matchWord("TRUE")) - { - texture.setResizeNonPowerOfTwoHint(true); - fr +=2 ; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("FALSE")) - { - texture.setResizeNonPowerOfTwoHint(false); - fr +=2 ; - iteratorAdvanced = true; - } - } - - if (fr[0].matchWord("shadowComparison")) - { - if (fr[1].matchWord("TRUE")) - { - texture.setShadowComparison(true); - fr +=2 ; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("FALSE")) - { - texture.setShadowComparison(false); - fr +=2 ; - iteratorAdvanced = true; - } - } - - if (fr[0].matchWord("shadowCompareFunc")) - { - Texture::ShadowCompareFunc value; - if (Texture_matchShadowCompareFuncStr(fr[1].getStr(),value)) - { - texture.setShadowCompareFunc(value); - fr+=2; - iteratorAdvanced = true; - } - } - - if (fr[0].matchWord("shadowTextureMode")) - { - Texture::ShadowTextureMode value; - if (Texture_matchShadowTextureModeStr(fr[1].getStr(),value)) - { - texture.setShadowTextureMode(value); - fr+=2; - iteratorAdvanced = true; - } - } - - return iteratorAdvanced; -} - - -bool Texture_writeLocalData(const Object& obj, Output& fw) -{ - const Texture& texture = static_cast(obj); - - fw.indent() << "wrap_s " << Texture_getWrapStr(texture.getWrap(Texture::WRAP_S)) << std::endl; - fw.indent() << "wrap_t " << Texture_getWrapStr(texture.getWrap(Texture::WRAP_T)) << std::endl; - fw.indent() << "wrap_r " << Texture_getWrapStr(texture.getWrap(Texture::WRAP_R)) << std::endl; - - fw.indent() << "min_filter " << Texture_getFilterStr(texture.getFilter(Texture::MIN_FILTER)) << std::endl; - fw.indent() << "mag_filter " << Texture_getFilterStr(texture.getFilter(Texture::MAG_FILTER)) << std::endl; - fw.indent() << "maxAnisotropy " << texture.getMaxAnisotropy() << std::endl; - - fw.indent() << "borderColor " << texture.getBorderColor() << std::endl; - fw.indent() << "borderWidth " << texture.getBorderWidth() << std::endl; - - fw.indent() << "useHardwareMipMapGeneration "<< (texture.getUseHardwareMipMapGeneration()?"TRUE":"FALSE") << std::endl; - fw.indent() << "unRefImageDataAfterApply "<< (texture.getUnRefImageDataAfterApply()?"TRUE":"FALSE") << std::endl; - - fw.indent() << "internalFormatMode " << Texture_getInternalFormatModeStr(texture.getInternalFormatMode()) << std::endl; - if (texture.getInternalFormatMode()==Texture::USE_USER_DEFINED_FORMAT) - { - - const char* str = Texture_getInternalFormatStr(texture.getInternalFormat()); - - if (str) fw.indent() << "internalFormat " << str << std::endl; - else fw.indent() << "internalFormat " << texture.getInternalFormat() << std::endl; - - } - - if (texture.getSourceFormat()) - { - const char* str = Texture_getInternalFormatStr(texture.getSourceFormat()); - - if (str) fw.indent() << "sourceFormat " << str << std::endl; - else fw.indent() << "sourceFormat " << texture.getSourceFormat() << std::endl; - - } - - if (texture.getSourceType()) - { - const char* str = Texture_getSourceTypeStr(texture.getSourceType()); - - if (str) fw.indent() << "sourceType " << str << std::endl; - else fw.indent() << "sourceType " << texture.getSourceType() << std::endl; - - } - - fw.indent() << "resizeNonPowerOfTwo "<< (texture.getResizeNonPowerOfTwoHint()?"TRUE":"FALSE") << std::endl; - - fw.indent() << "shadowComparison "<< (texture.getShadowComparison()?"TRUE":"FALSE") << std::endl; - - fw.indent() << "shadowCompareFunc " << Texture_getShadowCompareFuncStr(texture.getShadowCompareFunc()) << std::endl; - - fw.indent() << "shadowTextureMode " << Texture_getShadowTextureModeStr(texture.getShadowTextureMode()) << std::endl; - - return true; -} - - -bool Texture_matchWrapStr(const char* str,Texture::WrapMode& wrap) -{ - if (strcmp(str,"CLAMP")==0) wrap = Texture::CLAMP; - else if (strcmp(str,"CLAMP_TO_EDGE")==0) wrap = Texture::CLAMP_TO_EDGE; - else if (strcmp(str,"CLAMP_TO_BORDER")==0) wrap = Texture::CLAMP_TO_BORDER; - else if (strcmp(str,"REPEAT")==0) wrap = Texture::REPEAT; - else if (strcmp(str,"MIRROR")==0) wrap = Texture::MIRROR; - else return false; - return true; -} - - -const char* Texture_getWrapStr(Texture::WrapMode wrap) -{ - switch(wrap) - { - case(Texture::CLAMP): return "CLAMP"; - case(Texture::CLAMP_TO_EDGE): return "CLAMP_TO_EDGE"; - case(Texture::CLAMP_TO_BORDER): return "CLAMP_TO_BORDER"; - case(Texture::REPEAT): return "REPEAT"; - case(Texture::MIRROR): return "MIRROR"; - } - return ""; -} - - -bool Texture_matchFilterStr(const char* str,Texture::FilterMode& filter) -{ - if (strcmp(str,"NEAREST")==0) filter = Texture::NEAREST; - else if (strcmp(str,"LINEAR")==0) filter = Texture::LINEAR; - else if (strcmp(str,"NEAREST_MIPMAP_NEAREST")==0) filter = Texture::NEAREST_MIPMAP_NEAREST; - else if (strcmp(str,"LINEAR_MIPMAP_NEAREST")==0) filter = Texture::LINEAR_MIPMAP_NEAREST; - else if (strcmp(str,"NEAREST_MIPMAP_LINEAR")==0) filter = Texture::NEAREST_MIPMAP_LINEAR; - else if (strcmp(str,"LINEAR_MIPMAP_LINEAR")==0) filter = Texture::LINEAR_MIPMAP_LINEAR; - else if (strcmp(str,"ANISOTROPIC")==0) filter = Texture::LINEAR; - else return false; - return true; -} - - -const char* Texture_getFilterStr(Texture::FilterMode filter) -{ - switch(filter) - { - case(Texture::NEAREST): return "NEAREST"; - case(Texture::LINEAR): return "LINEAR"; - case(Texture::NEAREST_MIPMAP_NEAREST): return "NEAREST_MIPMAP_NEAREST"; - case(Texture::LINEAR_MIPMAP_NEAREST): return "LINEAR_MIPMAP_NEAREST"; - case(Texture::NEAREST_MIPMAP_LINEAR): return "NEAREST_MIPMAP_LINEAR"; - case(Texture::LINEAR_MIPMAP_LINEAR): return "LINEAR_MIPMAP_LINEAR"; - } - return ""; -} - -bool Texture_matchInternalFormatModeStr(const char* str,Texture::InternalFormatMode& mode) -{ - if (strcmp(str,"USE_IMAGE_DATA_FORMAT")==0) mode = Texture::USE_IMAGE_DATA_FORMAT; - else if (strcmp(str,"USE_USER_DEFINED_FORMAT")==0) mode = Texture::USE_USER_DEFINED_FORMAT; - else if (strcmp(str,"USE_ARB_COMPRESSION")==0) mode = Texture::USE_ARB_COMPRESSION; - else if (strcmp(str,"USE_S3TC_DXT1_COMPRESSION")==0) mode = Texture::USE_S3TC_DXT1_COMPRESSION; - else if (strcmp(str,"USE_S3TC_DXT3_COMPRESSION")==0) mode = Texture::USE_S3TC_DXT3_COMPRESSION; - else if (strcmp(str,"USE_S3TC_DXT5_COMPRESSION")==0) mode = Texture::USE_S3TC_DXT5_COMPRESSION; - else return false; - return true; -} - - -const char* Texture_getInternalFormatModeStr(Texture::InternalFormatMode mode) -{ - switch(mode) - { - case(Texture::USE_IMAGE_DATA_FORMAT): return "USE_IMAGE_DATA_FORMAT"; - case(Texture::USE_USER_DEFINED_FORMAT): return "USE_USER_DEFINED_FORMAT"; - case(Texture::USE_ARB_COMPRESSION): return "USE_ARB_COMPRESSION"; - case(Texture::USE_S3TC_DXT1_COMPRESSION): return "USE_S3TC_DXT1_COMPRESSION"; - case(Texture::USE_S3TC_DXT3_COMPRESSION): return "USE_S3TC_DXT3_COMPRESSION"; - case(Texture::USE_S3TC_DXT5_COMPRESSION): return "USE_S3TC_DXT5_COMPRESSION"; - } - return ""; -} - - -bool Texture_matchInternalFormatStr(const char* str,int& value) -{ - if ( strcmp(str,"GL_INTENSITY")==0) value = GL_INTENSITY; - else if (strcmp(str,"GL_LUMINANCE")==0) value = GL_LUMINANCE; - else if (strcmp(str,"GL_ALPHA")==0) value = GL_ALPHA; - else if (strcmp(str,"GL_LUMINANCE_ALPHA")==0) value = GL_LUMINANCE_ALPHA; - else if (strcmp(str,"GL_RGB")==0) value = GL_RGB; - else if (strcmp(str,"GL_RGBA")==0) value = GL_RGBA; - else if (strcmp(str,"GL_COMPRESSED_ALPHA_ARB")==0) value = GL_COMPRESSED_ALPHA_ARB; - else if (strcmp(str,"GL_COMPRESSED_LUMINANCE_ARB")==0) value = GL_COMPRESSED_LUMINANCE_ARB; - else if (strcmp(str,"GL_COMPRESSED_INTENSITY_ARB")==0) value = GL_COMPRESSED_INTENSITY_ARB; - else if (strcmp(str,"GL_COMPRESSED_LUMINANCE_ALPHA_ARB")==0) value = GL_COMPRESSED_LUMINANCE_ALPHA_ARB; - else if (strcmp(str,"GL_COMPRESSED_RGB_ARB")==0) value = GL_COMPRESSED_RGB_ARB; - else if (strcmp(str,"GL_COMPRESSED_RGBA_ARB")==0) value = GL_COMPRESSED_RGBA_ARB; - else if (strcmp(str,"GL_COMPRESSED_RGB_S3TC_DXT1_EXT")==0) value = GL_COMPRESSED_RGB_S3TC_DXT1_EXT; - else if (strcmp(str,"GL_COMPRESSED_RGBA_S3TC_DXT1_EXT")==0) value = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; - else if (strcmp(str,"GL_COMPRESSED_RGBA_S3TC_DXT3_EXT")==0) value = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; - else if (strcmp(str,"GL_COMPRESSED_RGBA_S3TC_DXT5_EXT")==0) value = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; - else - { - osgDB::Field::FieldType type = osgDB::Field::calculateFieldType(str); - if (type==osgDB::Field::INTEGER) - { - value = atoi(str); - return true; - } - else - { - return false; - } - } - - return true; -} - - -const char* Texture_getInternalFormatStr(int value) -{ - switch(value) - { - case(GL_INTENSITY): return "GL_INTENSITY"; - case(GL_LUMINANCE): return "GL_LUMINANCE"; - case(GL_ALPHA): return "GL_ALPHA"; - case(GL_LUMINANCE_ALPHA): return "GL_LUMINANCE_ALPHA"; - case(GL_RGB): return "GL_RGB"; - case(GL_RGBA): return "GL_RGBA"; - case(GL_COMPRESSED_ALPHA_ARB): return "GL_COMPRESSED_ALPHA_ARB"; - case(GL_COMPRESSED_LUMINANCE_ARB): return "GL_COMPRESSED_LUMINANCE_ARB"; - case(GL_COMPRESSED_INTENSITY_ARB): return "GL_COMPRESSED_INTENSITY_ARB"; - case(GL_COMPRESSED_LUMINANCE_ALPHA_ARB): return "GL_COMPRESSED_LUMINANCE_ALPHA_ARB"; - case(GL_COMPRESSED_RGB_ARB): return "GL_COMPRESSED_RGB_ARB"; - case(GL_COMPRESSED_RGBA_ARB): return "GL_COMPRESSED_RGBA_ARB"; - case(GL_COMPRESSED_RGB_S3TC_DXT1_EXT): return "GL_COMPRESSED_RGB_S3TC_DXT1_EXT"; - case(GL_COMPRESSED_RGBA_S3TC_DXT1_EXT): return "GL_COMPRESSED_RGBA_S3TC_DXT1_EXT"; - case(GL_COMPRESSED_RGBA_S3TC_DXT3_EXT): return "GL_COMPRESSED_RGBA_S3TC_DXT3_EXT"; - case(GL_COMPRESSED_RGBA_S3TC_DXT5_EXT): return "GL_COMPRESSED_RGBA_S3TC_DXT5_EXT"; - } - return NULL; -} - -bool Texture_matchSourceTypeStr(const char* str,int& value) -{ - if ( strcmp(str,"GL_BYTE")==0) value = GL_BYTE; - else if (strcmp(str,"GL_SHORT")==0) value = GL_SHORT; - else if (strcmp(str,"GL_INT")==0) value = GL_INT; - else if (strcmp(str,"GL_UNSIGNED_BYTE")==0) value = GL_UNSIGNED_BYTE; - else if (strcmp(str,"GL_UNSIGNED_SHORT")==0) value = GL_UNSIGNED_SHORT; - else if (strcmp(str,"GL_UNSIGNED_INT")==0) value = GL_UNSIGNED_INT; - else if (strcmp(str,"GL_FLOAT")==0) value = GL_FLOAT; - else - { - osgDB::Field::FieldType type = osgDB::Field::calculateFieldType(str); - if (type==osgDB::Field::INTEGER) - { - value = atoi(str); - return true; - } - else - { - return false; - } - } - - return true; -} - -const char* Texture_getSourceTypeStr(int value) -{ - switch(value) - { - case(GL_BYTE): return "GL_BYTE"; - case(GL_SHORT): return "GL_SHORT"; - case(GL_INT): return "GL_INT"; - case(GL_FLOAT): return "GL_FLOAT"; - case(GL_UNSIGNED_BYTE): return "GL_UNSIGNED_BYTE"; - case(GL_UNSIGNED_SHORT): return "GL_UNSIGNED_SHORT"; - case(GL_UNSIGNED_INT): return "GL_UNSIGNED_INT"; - } - return NULL; -} - -bool Texture_matchShadowCompareFuncStr(const char* str, Texture::ShadowCompareFunc& value) -{ - if ( strcmp(str,"GL_NEVER")==0) value = Texture::NEVER; - else if (strcmp(str,"GL_LESS")==0) value = Texture::LESS; - else if (strcmp(str,"GL_EQUAL")==0) value = Texture::EQUAL; - else if (strcmp(str,"GL_LEQUAL")==0) value = Texture::LEQUAL; - else if (strcmp(str,"GL_GREATER")==0) value = Texture::GREATER; - else if (strcmp(str,"GL_NOTEQUAL")==0) value = Texture::NOTEQUAL; - else if (strcmp(str,"GL_GEQUAL")==0) value = Texture::GEQUAL; - else if (strcmp(str,"GL_ALWAYS")==0) value = Texture::ALWAYS; - else return false; - - return true; -} - -const char* Texture_getShadowCompareFuncStr(Texture::ShadowCompareFunc value) -{ - switch(value) - { - case(Texture::NEVER): return "GL_NEVER"; - case(Texture::LESS): return "GL_LESS"; - case(Texture::EQUAL): return "GL_EQUAL"; - case(Texture::LEQUAL): return "GL_LEQUAL"; - case(Texture::GREATER): return "GL_GREATER"; - case(Texture::NOTEQUAL): return "GL_NOTEQUAL"; - case(Texture::GEQUAL): return "GL_GEQUAL"; - case(Texture::ALWAYS): return "GL_ALWAYS"; - } - return NULL; -} - -bool Texture_matchShadowTextureModeStr(const char* str,Texture::ShadowTextureMode& value) -{ - if ( strcmp(str,"GL_LUMINANCE")==0) value = Texture::LUMINANCE; - else if (strcmp(str,"GL_INTENSITY")==0) value = Texture::INTENSITY; - else if (strcmp(str,"GL_ALPHA")==0) value = Texture::ALPHA; - else return false; - - return true; -} - -const char* Texture_getShadowTextureModeStr(Texture::ShadowTextureMode value) -{ - switch(value) - { - case( Texture::LUMINANCE ): return "GL_LUMINANCE"; - case( Texture::INTENSITY ): return "GL_INTENSITY"; - case( Texture::ALPHA ): return "GL_ALPHA"; - } - return NULL; -} diff --git a/src/osgPlugins/osg/Texture1D.cpp b/src/osgPlugins/osg/Texture1D.cpp deleted file mode 100644 index f61d3bf8a..000000000 --- a/src/osgPlugins/osg/Texture1D.cpp +++ /dev/null @@ -1,99 +0,0 @@ -#include "osg/Texture1D" -#include "osg/ImageSequence" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" -#include "osgDB/WriteFile" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool Texture1D_readLocalData(Object& obj, Input& fr); -bool Texture1D_writeLocalData(const Object& obj, Output& fw); - -bool Texture1D_matchWrapStr(const char* str,Texture1D::WrapMode& wrap); -const char* Texture1D_getWrapStr(Texture1D::WrapMode wrap); -bool Texture1D_matchFilterStr(const char* str,Texture1D::FilterMode& filter); -const char* Texture1D_getFilterStr(Texture1D::FilterMode filter); -bool Texture1D_matchInternalFormatModeStr(const char* str,Texture1D::InternalFormatMode& mode); -const char* Texture1D_getInternalFormatModeStr(Texture1D::InternalFormatMode mode); -bool Texture1D_matchInternalFormatStr(const char* str,int& value); -const char* Texture1D_getInternalFormatStr(int value); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Texture1D) -( - new osg::Texture1D, - "Texture1D", - "Object StateAttribute Texture1D TextureBase", - &Texture1D_readLocalData, - &Texture1D_writeLocalData -); - -bool Texture1D_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - Texture1D& texture = static_cast(obj); - - if (fr[0].matchWord("file") && fr[1].isString()) - { - std::string filename = fr[1].getStr(); - Image* image = fr.readImage(filename.c_str()); - if (image) - { - // name will have already been set by the image plugin, - // but it will have absolute path, so will override it - // here to keep the original name intact. - //image->setFileName(filename); - texture.setImage(image); - } - - fr += 2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("ImageSequence") || fr[0].matchWord("Image")) - { - osg::Image* image = fr.readImage(); - if (image) texture.setImage(image); - } - - return iteratorAdvanced; -} - - -bool Texture1D_writeLocalData(const Object& obj, Output& fw) -{ - const Texture1D& texture = static_cast(obj); - - if (texture.getImage()) - { - const osg::ImageSequence* is = dynamic_cast(texture.getImage()); - if (is) - { - fw.writeObject(*is); - } - else - { - std::string fileName = texture.getImage()->getFileName(); - if (fw.getOutputTextureFiles()) - { - if (fileName.empty()) - { - fileName = fw.getTextureFileNameForOutput(); - } - osgDB::writeImageFile(*texture.getImage(), fileName); - } - - if (!fileName.empty()) - { - fw.indent() << "file "<(obj); - - if (fr[0].matchWord("file") && fr[1].isString()) - { - std::string filename = fr[1].getStr(); - Image* image = fr.readImage(filename.c_str()); - if (image) - { - // name will have already been set by the image plugin, - // but it will have absolute path, so will override it - // here to keep the original name intact. - //image->setFileName(filename); - texture.setImage(image); - } - - fr += 2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("ImageSequence") || fr[0].matchWord("Image")) - { - osg::Image* image = fr.readImage(); - if (image) texture.setImage(image); - } - - return iteratorAdvanced; -} - -bool Texture2D_writeLocalData(const Object& obj, Output& fw) -{ - const Texture2D& texture = static_cast(obj); - - if (texture.getImage()) - { - const osg::ImageSequence* is = dynamic_cast(texture.getImage()); - if (is) - { - fw.writeObject(*is); - } - else - { - std::string fileName = texture.getImage()->getFileName(); - if (fw.getOutputTextureFiles()) - { - if (fileName.empty()) - { - fileName = fw.getTextureFileNameForOutput(); - } - osgDB::writeImageFile(*texture.getImage(), fileName); - } - - if (!fileName.empty()) - { - fw.indent() << "file "<(obj); - - if (fr[0].matchWord("file") && fr[1].isString()) - { - std::string filename = fr[1].getStr(); - Image* image = fr.readImage(filename.c_str()); - if (image) - { - // name will have already been set by the image plugin, - // but it will have absolute path, so will override it - // here to keep the original name intact. - //image->setFileName(filename); - texture.setImage(image); - } - - fr += 2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("ImageSequence") || fr[0].matchWord("Image")) - { - osg::Image* image = fr.readImage(); - if (image) texture.setImage(image); - } - - return iteratorAdvanced; -} - -bool Texture3D_writeLocalData(const Object& obj, Output& fw) -{ - const Texture3D& texture = static_cast(obj); - - if (texture.getImage()) - { - const osg::ImageSequence* is = dynamic_cast(texture.getImage()); - if (is) - { - fw.writeObject(*is); - } - else - { - std::string fileName = texture.getImage()->getFileName(); - if (fw.getOutputTextureFiles()) - { - if (fileName.empty()) - { - fileName = fw.getTextureFileNameForOutput(); - } - osgDB::writeImageFile(*texture.getImage(), fileName); - } - - if (!fileName.empty()) - { - fw.indent() << "file "<(obj); - - bool matched=true; - while (fr[0].matchWord("image") && matched) - { - READ_IMAGE(POSITIVE_X) - else READ_IMAGE(NEGATIVE_X) - else READ_IMAGE(POSITIVE_Y) - else READ_IMAGE(NEGATIVE_Y) - else READ_IMAGE(POSITIVE_Z) - else READ_IMAGE(NEGATIVE_Z) - } - - return iteratorAdvanced; -} - - -#define WRITE_IMAGE(FACE) \ - {\ - const osg::Image* image = texture.getImage(osg::TextureCubeMap::FACE);\ - if (image)\ - {\ - const osg::ImageSequence* is = dynamic_cast(image); \ - if (is) \ - { \ - fw.indent() << "image "<<#FACE<getFileName();\ - if (fw.getOutputTextureFiles())\ - {\ - if (fileName.empty())\ - {\ - fileName = fw.getTextureFileNameForOutput();\ - }\ - osgDB::writeImageFile(*image, fileName);\ - }\ - if (!fileName.empty())\ - {\ - fw.indent() << "image "<<#FACE<<" "<(obj); - - WRITE_IMAGE(POSITIVE_X) - WRITE_IMAGE(NEGATIVE_X) - WRITE_IMAGE(POSITIVE_Y) - WRITE_IMAGE(NEGATIVE_Y) - WRITE_IMAGE(POSITIVE_Z) - WRITE_IMAGE(NEGATIVE_Z) - - return true; -} - - diff --git a/src/osgPlugins/osg/TextureRectangle.cpp b/src/osgPlugins/osg/TextureRectangle.cpp deleted file mode 100644 index bc5420b7c..000000000 --- a/src/osgPlugins/osg/TextureRectangle.cpp +++ /dev/null @@ -1,99 +0,0 @@ -#include "osg/TextureRectangle" -#include "osg/ImageSequence" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" -#include "osgDB/WriteFile" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool TextureRectangle_readLocalData(Object& obj, Input& fr); -bool TextureRectangle_writeLocalData(const Object& obj, Output& fw); - -bool TextureRectangle_matchWrapStr(const char* str,TextureRectangle::WrapMode& wrap); -const char* TextureRectangle_getWrapStr(TextureRectangle::WrapMode wrap); -bool TextureRectangle_matchFilterStr(const char* str,TextureRectangle::FilterMode& filter); -const char* TextureRectangle_getFilterStr(TextureRectangle::FilterMode filter); -bool TextureRectangle_matchInternalFormatModeStr(const char* str,TextureRectangle::InternalFormatMode& mode); -const char* TextureRectangle_getInternalFormatModeStr(TextureRectangle::InternalFormatMode mode); -bool TextureRectangle_matchInternalFormatStr(const char* str,int& value); -const char* TextureRectangle_getInternalFormatStr(int value); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(TextureRectangle) -( - new osg::TextureRectangle, - "TextureRectangle", - "Object StateAttribute TextureRectangle TextureBase", - &TextureRectangle_readLocalData, - &TextureRectangle_writeLocalData -); - -bool TextureRectangle_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - TextureRectangle& texture = static_cast(obj); - - if (fr[0].matchWord("file") && fr[1].isString()) - { - std::string filename = fr[1].getStr(); - Image* image = fr.readImage(filename.c_str()); - if (image) - { - // name will have already been set by the image plugin, - // but it will have absolute path, so will override it - // here to keep the original name intact. - //image->setFileName(filename); - texture.setImage(image); - } - - fr += 2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("ImageSequence") || fr[0].matchWord("Image")) - { - osg::Image* image = fr.readImage(); - if (image) texture.setImage(image); - } - - return iteratorAdvanced; -} - - -bool TextureRectangle_writeLocalData(const Object& obj, Output& fw) -{ - const TextureRectangle& texture = static_cast(obj); - - if (texture.getImage()) - { - const osg::ImageSequence* is = dynamic_cast(texture.getImage()); - if (is) - { - fw.writeObject(*is); - } - else - { - std::string fileName = texture.getImage()->getFileName(); - if (fw.getOutputTextureFiles()) - { - if (fileName.empty()) - { - fileName = fw.getTextureFileNameForOutput(); - } - osgDB::writeImageFile(*texture.getImage(), fileName); - } - - if (!fileName.empty()) - { - fw.indent() << "file "< - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -bool TransferFunction1D_readLocalData(osg::Object &obj, osgDB::Input &fr); -bool TransferFunction1D_writeLocalData(const osg::Object &obj, osgDB::Output &fw); - -osgDB::RegisterDotOsgWrapperProxy TransferFunction1D_Proxy -( - new osg::TransferFunction1D, - "TransferFunction1D", - "Object TransferFunction1D", - TransferFunction1D_readLocalData, - TransferFunction1D_writeLocalData -); - - -bool TransferFunction1D_readLocalData(osg::Object& obj, osgDB::Input &fr) -{ - osg::TransferFunction1D& tf = static_cast(obj); - - bool itrAdvanced = false; - - unsigned int numCells; - if (fr.read("NumberImageCells ",numCells)) - { - tf.allocate(numCells); - itrAdvanced = true; - } - - if (fr.matchSequence("Colours {")) - { - int entry = fr[0].getNoNestedBrackets(); - - fr += 2; - - float v; - osg::Vec4 color; - osg::TransferFunction1D::ColorMap colorMap; - - while (!fr.eof() && fr[0].getNoNestedBrackets()>entry) - { - if (fr.read(v, color.r(), color.g(), color.b(), color.a())) - { - colorMap[v] = color; - } - else - { - ++fr; - } - } - - tf.assign(colorMap); - - itrAdvanced = true; - } - - - return itrAdvanced; -} - -bool TransferFunction1D_writeLocalData(const osg::Object& obj, osgDB::Output& fw) -{ - const osg::TransferFunction1D& tf = static_cast(obj); - const osg::TransferFunction1D::ColorMap& colorMap = tf.getColorMap(); - - fw.indent()<<"NumberImageCells "<second; - fw.indent()<first<<" "<(obj); - - if (fr[0].matchWord("Type")) - { - if (fr[1].matchWord("DYNAMIC")) - { - transform.setDataVariance(osg::Object::DYNAMIC); - fr +=2 ; - iteratorAdvanced = true; - } - else if (fr[1].matchWord("STATIC")) - { - transform.setDataVariance(osg::Object::STATIC); - fr +=2 ; - iteratorAdvanced = true; - } - - } - - if (fr[0].matchWord("referenceFrame")) - { - if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE") || fr[1].matchWord("ABSOLUTE") || fr[1].matchWord("ABSOLUTE_RF")) - { - transform.setReferenceFrame(Transform::ABSOLUTE_RF); - fr += 2; - iteratorAdvanced = true; - } - if (fr[1].matchWord("RELATIVE_TO_ABSOLUTE") || fr[1].matchWord("ABSOLUTE_RF_INHERIT_VIEWPOINT") ) - { - transform.setReferenceFrame(Transform::ABSOLUTE_RF_INHERIT_VIEWPOINT); - fr += 2; - iteratorAdvanced = true; - } - if (fr[1].matchWord("RELATIVE_TO_PARENTS") || fr[1].matchWord("RELATIVE") || fr[1].matchWord("RELATIVE_RF")) - { - transform.setReferenceFrame(Transform::RELATIVE_RF); - fr += 2; - iteratorAdvanced = true; - } - } - - return iteratorAdvanced; -} - - -bool Transform_writeLocalData(const Object& obj, Output& fw) -{ - const Transform& transform = static_cast(obj); - - fw.indent() << "referenceFrame "; - switch (transform.getReferenceFrame()) - { - case Transform::ABSOLUTE_RF: - fw << "ABSOLUTE\n"; - break; - case Transform::ABSOLUTE_RF_INHERIT_VIEWPOINT: - fw << "ABSOLUTE_RF_INHERIT_VIEWPOINT\n"; - break; - case Transform::RELATIVE_RF: - default: - fw << "RELATIVE\n"; - }; - - return true; -} diff --git a/src/osgPlugins/osg/Uniform.cpp b/src/osgPlugins/osg/Uniform.cpp deleted file mode 100644 index 85e2007c6..000000000 --- a/src/osgPlugins/osg/Uniform.cpp +++ /dev/null @@ -1,270 +0,0 @@ - -// Mike Weiblen 2006-05-14 - -#include "osg/Uniform" -#include "osg/io_utils" -#include "osg/Notify" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -#include "Matrix.h" - -using namespace osg; -using namespace osgDB; -using namespace std; - -// reuse from Geometry.cpp -bool Array_writeLocalData(const Array& array,Output& fw); -Array* Array_readLocalData(Input& fr); - -// forward declare functions to use later. -bool Uniform_readLocalData(Object& obj, Input& fr); -bool Uniform_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Uniform) -( - new osg::Uniform, - "Uniform", - "Object Uniform", - &Uniform_readLocalData, - &Uniform_writeLocalData -); - - -bool Uniform_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - Uniform& uniform = static_cast(obj); - - if (fr[0].matchWord("type")) - { - // post-May 2006 format (OSG versions > 1.0) - - ++fr; - - if (fr.matchSequence("unsigned int")) - { - uniform.setType( Uniform::getTypeId( "unsigned int" ) ); - fr += 2; - } - else - { - uniform.setType( Uniform::getTypeId( fr[0].getStr() ) ); - ++fr; - } - - unsigned int numElements; - fr[0].getUInt(numElements); - uniform.setNumElements( numElements ); - - ++fr; - iteratorAdvanced = true; - - Array* data = Array_readLocalData(fr); - uniform.setArray( dynamic_cast(data) ); - uniform.setArray( dynamic_cast(data) ); - uniform.setArray( dynamic_cast(data) ); - } -#if 1 //[ -// Deprecated; for backwards compatibility only. -// when can we safely delete this code, I wonder... - else - { - // pre-May 2006 format (OSG versions <= 1.0) - uniform.setType( Uniform::getTypeId(fr[0].getStr()) ); - fr+=1; - iteratorAdvanced = true; - - switch( Uniform::getGlApiType(uniform.getType()) ) - { - case(osg::Uniform::FLOAT): - { - float value; - if (fr[0].getFloat(value)) - { - uniform.set(value); - fr+=1; - iteratorAdvanced = true; - } - break; - } - case(osg::Uniform::FLOAT_VEC2): - { - osg::Vec2 value; - if (fr[0].getFloat(value[0]) && fr[1].getFloat(value[1])) - { - uniform.set(value); - fr+=2; - iteratorAdvanced = true; - } - break; - } - case(osg::Uniform::FLOAT_VEC3): - { - osg::Vec3 value; - if (fr[0].getFloat(value[0]) && fr[1].getFloat(value[1]) && fr[2].getFloat(value[2])) - { - uniform.set(value); - fr+=3; - iteratorAdvanced = true; - } - break; - } - case(osg::Uniform::FLOAT_VEC4): - { - osg::Vec4 value; - if (fr[0].getFloat(value[0]) && fr[1].getFloat(value[1]) && fr[2].getFloat(value[2]) && fr[3].getFloat(value[3])) - { - uniform.set(value); - fr+=4; - iteratorAdvanced = true; - } - break; - } - case(osg::Uniform::INT): - { - int value; - if (fr[0].getInt(value)) - { - uniform.set(value); - fr+=1; - iteratorAdvanced = true; - } - break; - } - case(osg::Uniform::INT_VEC2): - { - int value[2]; - if (fr[0].getInt(value[0]) && fr[1].getInt(value[1])) - { - uniform.set(value[0],value[1]); - fr+=2; - iteratorAdvanced = true; - } - break; - } - case(osg::Uniform::INT_VEC3): - { - int value[3]; - if (fr[0].getInt(value[0]) && fr[1].getInt(value[1]) && fr[2].getInt(value[2])) - { - uniform.set(value[0],value[1],value[2]); - fr+=3; - iteratorAdvanced = true; - } - break; - } - case(osg::Uniform::INT_VEC4): - { - int value[4]; - if (fr[0].getInt(value[0]) && fr[1].getInt(value[1]) && fr[2].getInt(value[2]) && fr[3].getInt(value[3])) - { - uniform.set(value[0],value[1],value[2],value[3]); - fr+=4; - iteratorAdvanced = true; - } - break; - } - case(osg::Uniform::FLOAT_MAT2): - { - osg::Matrix2 value; - if (fr[0].getFloat(value[0]) && fr[1].getFloat(value[1]) && - fr[2].getFloat(value[2]) && fr[3].getFloat(value[3])) - { - uniform.set(value); - fr+=4; - iteratorAdvanced = true; - } - break; - } - case(osg::Uniform::FLOAT_MAT3): - { - osg::Matrix3 value; - if (fr[0].getFloat(value[0]) && fr[1].getFloat(value[1]) && fr[2].getFloat(value[2]) && - fr[3].getFloat(value[3]) && fr[4].getFloat(value[4]) && fr[5].getFloat(value[5]) && - fr[6].getFloat(value[6]) && fr[7].getFloat(value[7]) && fr[8].getFloat(value[8])) - { - uniform.set(value); - fr+=9; - iteratorAdvanced = true; - } - break; - } - case(osg::Uniform::FLOAT_MAT4): - { - Matrix value; - if( readMatrix(value,fr) ) - { - uniform.set(value); - iteratorAdvanced = true; - } - break; - } - default: - break; - } - } -#endif //] - - static ref_ptr s_callback = new osg::Uniform::Callback; - while (fr.matchSequence("UpdateCallback {")) - { - //int entry = fr[0].getNoNestedBrackets(); - fr += 2; - Uniform::Callback* callback = dynamic_cast(fr.readObjectOfType(*s_callback)); - if (callback) { - uniform.setUpdateCallback(callback); - } - iteratorAdvanced = true; - } - - while (fr.matchSequence("EventCallback {")) - { - //int entry = fr[0].getNoNestedBrackets(); - fr += 2; - Uniform::Callback* callback = dynamic_cast(fr.readObjectOfType(*s_callback)); - if (callback) { - uniform.setEventCallback(callback); - } - iteratorAdvanced = true; - } - - return iteratorAdvanced; -} - -bool Uniform_writeLocalData(const Object& obj,Output& fw) -{ - const Uniform& uniform = static_cast(obj); - - // post-May 2006 format (OSG versions > 1.0) - fw.indent() << "type " - << Uniform::getTypename( uniform.getType() ) << " " - << uniform.getNumElements() << " "; - - if( uniform.getFloatArray() ) Array_writeLocalData( *uniform.getFloatArray(), fw ); - if( uniform.getIntArray() ) Array_writeLocalData( *uniform.getIntArray(), fw ); - if( uniform.getUIntArray() ) Array_writeLocalData( *uniform.getUIntArray(), fw ); - - if (uniform.getUpdateCallback()) - { - fw.indent() << "UpdateCallback {" << std::endl; - fw.moveIn(); - fw.writeObject(*uniform.getUpdateCallback()); - fw.moveOut(); - fw.indent() << "}" << std::endl; - } - - if (uniform.getEventCallback()) - { - fw.indent() << "EventCallback {" << std::endl; - fw.moveIn(); - fw.writeObject(*uniform.getEventCallback()); - fw.moveOut(); - fw.indent() << "}" << std::endl; - } - - return true; -} diff --git a/src/osgPlugins/osg/VertexProgram.cpp b/src/osgPlugins/osg/VertexProgram.cpp deleted file mode 100644 index 412b44f1e..000000000 --- a/src/osgPlugins/osg/VertexProgram.cpp +++ /dev/null @@ -1,146 +0,0 @@ -#include "osg/VertexProgram" -#include - -#include -#include -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" -#include "osgDB/fstream" - -#include "Matrix.h" - -using namespace osg; -using namespace osgDB; -using namespace std; - -// forward declare functions to use later. -bool VertexProgram_readLocalData(Object& obj, Input& fr); -bool VertexProgram_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(VertexProgram) -( - new osg::VertexProgram, - "VertexProgram", - "Object StateAttribute VertexProgram", - &VertexProgram_readLocalData, - &VertexProgram_writeLocalData -); - - -bool VertexProgram_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - - VertexProgram& vertexProgram = static_cast(obj); - - if (fr[0].matchWord("ProgramLocalParameter")) - { - int index; - Vec4 vec; - fr[1].getInt(index); - fr[2].getFloat(vec[0]); - fr[3].getFloat(vec[1]); - fr[4].getFloat(vec[2]); - fr[5].getFloat(vec[3]); - fr += 6; - iteratorAdvanced = true; - vertexProgram.setProgramLocalParameter(index, vec); - } - - if (fr[0].matchWord("Matrix")) - { - int index; - fr[1].getInt(index); - fr += 2; - osg::Matrix matrix; - if (readMatrix(matrix,fr)) - { - vertexProgram.setMatrix(index, matrix); - } - iteratorAdvanced = true; - } - - if (fr.matchSequence("code {")) { - std::string code; - fr += 2; - iteratorAdvanced = true; - int entry = fr[0].getNoNestedBrackets(); - while (!fr.eof() && fr[0].getNoNestedBrackets() >= entry) - { - if (fr[0].getStr()) - { - code.append(std::string(fr[0].getStr())); - code += '\n'; - } - ++fr; - } - vertexProgram.setVertexProgram(code); - } - - if( fr.matchSequence("file %s")) - { - std::string filename = fr[1].getStr(); - - fr+=2; - iteratorAdvanced = true; - - osgDB::ifstream vfstream( filename.c_str() ); - - if( vfstream ) - { - ostringstream vstream; - char ch; - - /* xxx better way to transfer a ifstream to a string?? */ - while( vfstream.get(ch)) vstream.put(ch); - - vertexProgram.setVertexProgram( vstream.str() ); - } - } - - return iteratorAdvanced; -} - - -bool VertexProgram_writeLocalData(const Object& obj,Output& fw) -{ - const VertexProgram& vertexProgram = static_cast(obj); - - const VertexProgram::LocalParamList& lpl = vertexProgram.getLocalParameters(); - VertexProgram::LocalParamList::const_iterator i; - for(i=lpl.begin(); i!=lpl.end(); i++) - { - fw.indent() << "ProgramLocalParameter " << (*i).first << " " << (*i).second << std::endl; - } - - const VertexProgram::MatrixList& mpl = vertexProgram.getMatrices(); - VertexProgram::MatrixList::const_iterator mi; - for(mi=mpl.begin(); mi!=mpl.end(); mi++) - { - fw.indent() << "Matrix " << (*mi).first << " "; - writeMatrix((*mi).second,fw); - } - - - std::vector lines; - std::istringstream iss(vertexProgram.getVertexProgram()); - std::string line; - while (std::getline(iss, line)) { - lines.push_back(line); - } - - fw.indent() << "code {\n"; - fw.moveIn(); - - std::vector::const_iterator j; - for (j=lines.begin(); j!=lines.end(); ++j) { - fw.indent() << "\"" << *j << "\"\n"; - } - - fw.moveOut(); - fw.indent() << "}\n"; - - return true; -} diff --git a/src/osgPlugins/osg/Viewport.cpp b/src/osgPlugins/osg/Viewport.cpp deleted file mode 100644 index 3cc3a0d7f..000000000 --- a/src/osgPlugins/osg/Viewport.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include "osg/Viewport" - -#include "osgDB/Registry" -#include "osgDB/Input" -#include "osgDB/Output" - -using namespace osg; -using namespace osgDB; - -// forward declare functions to use later. -bool Viewport_readLocalData(Object& obj, Input& fr); -bool Viewport_writeLocalData(const Object& obj, Output& fw); - -// register the read and write functions with the osgDB::Registry. -REGISTER_DOTOSGWRAPPER(Viewport) -( - new osg::Viewport, - "Viewport", - "Object StateAttribute Viewport", - &Viewport_readLocalData, - &Viewport_writeLocalData -); - - -bool Viewport_readLocalData(Object& obj, Input& fr) -{ - bool iteratorAdvanced = false; - double x = 0, y = 0, width = 0, height = 0; - - if (fr[0].matchWord("x") && fr[1].getFloat(x)) - { - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("y") && fr[1].getFloat(y)) - { - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("width") && fr[1].getFloat(width)) - { - fr+=2; - iteratorAdvanced = true; - } - - if (fr[0].matchWord("height") && fr[1].getFloat(height)) - { - fr+=2; - iteratorAdvanced = true; - } - - Viewport& viewport = static_cast(obj); - viewport.setViewport( x, y, width, height ); - return iteratorAdvanced; -} - - -bool Viewport_writeLocalData(const Object& obj, Output& fw) -{ - const Viewport& viewport = static_cast(obj); - - fw.indent() << "x " << viewport.x() << std::endl; - fw.indent() << "y " << viewport.y() << std::endl; - fw.indent() << "width " << viewport.width() << std::endl; - fw.indent() << "height " << viewport.height() << std::endl; - - return true; -} diff --git a/src/osgPlugins/shadow/CMakeLists.txt b/src/osgPlugins/shadow/CMakeLists.txt new file mode 100644 index 000000000..aebfae343 --- /dev/null +++ b/src/osgPlugins/shadow/CMakeLists.txt @@ -0,0 +1,7 @@ +SET(TARGET_SRC + ReaderWriterOsgShadow.cpp +) +SET(TARGET_ADDED_LIBRARIES osgShadow ) + +#### end var setup ### +SETUP_PLUGIN(osgshadow) diff --git a/src/osgPlugins/osgShadow/ReaderWriterOsgShadow.cpp b/src/osgPlugins/shadow/ReaderWriterOsgShadow.cpp similarity index 100% rename from src/osgPlugins/osgShadow/ReaderWriterOsgShadow.cpp rename to src/osgPlugins/shadow/ReaderWriterOsgShadow.cpp diff --git a/src/osgPlugins/terrain/CMakeLists.txt b/src/osgPlugins/terrain/CMakeLists.txt new file mode 100644 index 000000000..a383e2ac4 --- /dev/null +++ b/src/osgPlugins/terrain/CMakeLists.txt @@ -0,0 +1,9 @@ +SET(TARGET_SRC + ReaderWriterOsgTerrain.cpp +) + +SET(TARGET_ADDED_LIBRARIES osgTerrain ) +#### end var setup ### +SETUP_PLUGIN(osgterrain) + + diff --git a/src/osgPlugins/osgTerrain/ReaderWriterOsgTerrain.cpp b/src/osgPlugins/terrain/ReaderWriterOsgTerrain.cpp similarity index 100% rename from src/osgPlugins/osgTerrain/ReaderWriterOsgTerrain.cpp rename to src/osgPlugins/terrain/ReaderWriterOsgTerrain.cpp diff --git a/src/osgPlugins/view/CMakeLists.txt b/src/osgPlugins/view/CMakeLists.txt new file mode 100644 index 000000000..1955b24b6 --- /dev/null +++ b/src/osgPlugins/view/CMakeLists.txt @@ -0,0 +1,8 @@ + +SET(TARGET_SRC + ReaderWriterOsgViewer.cpp +) +SET(TARGET_ADDED_LIBRARIES osgViewer ) + +#### end var setup ### +SETUP_PLUGIN(osgviewer) diff --git a/src/osgPlugins/osgViewer/ReaderWriterOsgViewer.cpp b/src/osgPlugins/view/ReaderWriterOsgViewer.cpp similarity index 100% rename from src/osgPlugins/osgViewer/ReaderWriterOsgViewer.cpp rename to src/osgPlugins/view/ReaderWriterOsgViewer.cpp diff --git a/src/osgPlugins/osgAnimation/CMakeLists.txt b/src/osgWrappers/deprecated-dotosg/osgAnimation/CMakeLists.txt similarity index 100% rename from src/osgPlugins/osgAnimation/CMakeLists.txt rename to src/osgWrappers/deprecated-dotosg/osgAnimation/CMakeLists.txt diff --git a/src/osgPlugins/osgAnimation/ReaderWriter.cpp b/src/osgWrappers/deprecated-dotosg/osgAnimation/ReaderWriter.cpp similarity index 100% rename from src/osgPlugins/osgAnimation/ReaderWriter.cpp rename to src/osgWrappers/deprecated-dotosg/osgAnimation/ReaderWriter.cpp diff --git a/src/osgPlugins/osgFX/CMakeLists.txt b/src/osgWrappers/deprecated-dotosg/osgFX/CMakeLists.txt similarity index 100% rename from src/osgPlugins/osgFX/CMakeLists.txt rename to src/osgWrappers/deprecated-dotosg/osgFX/CMakeLists.txt diff --git a/src/osgPlugins/osgFX/IO_AnisotropicLighting.cpp b/src/osgWrappers/deprecated-dotosg/osgFX/IO_AnisotropicLighting.cpp similarity index 100% rename from src/osgPlugins/osgFX/IO_AnisotropicLighting.cpp rename to src/osgWrappers/deprecated-dotosg/osgFX/IO_AnisotropicLighting.cpp diff --git a/src/osgPlugins/osgFX/IO_BumpMapping.cpp b/src/osgWrappers/deprecated-dotosg/osgFX/IO_BumpMapping.cpp similarity index 100% rename from src/osgPlugins/osgFX/IO_BumpMapping.cpp rename to src/osgWrappers/deprecated-dotosg/osgFX/IO_BumpMapping.cpp diff --git a/src/osgPlugins/osgFX/IO_Cartoon.cpp b/src/osgWrappers/deprecated-dotosg/osgFX/IO_Cartoon.cpp similarity index 100% rename from src/osgPlugins/osgFX/IO_Cartoon.cpp rename to src/osgWrappers/deprecated-dotosg/osgFX/IO_Cartoon.cpp diff --git a/src/osgPlugins/osgFX/IO_Effect.cpp b/src/osgWrappers/deprecated-dotosg/osgFX/IO_Effect.cpp similarity index 100% rename from src/osgPlugins/osgFX/IO_Effect.cpp rename to src/osgWrappers/deprecated-dotosg/osgFX/IO_Effect.cpp diff --git a/src/osgPlugins/osgFX/IO_MultiTextureControl.cpp b/src/osgWrappers/deprecated-dotosg/osgFX/IO_MultiTextureControl.cpp similarity index 100% rename from src/osgPlugins/osgFX/IO_MultiTextureControl.cpp rename to src/osgWrappers/deprecated-dotosg/osgFX/IO_MultiTextureControl.cpp diff --git a/src/osgPlugins/osgFX/IO_Outline.cpp b/src/osgWrappers/deprecated-dotosg/osgFX/IO_Outline.cpp similarity index 100% rename from src/osgPlugins/osgFX/IO_Outline.cpp rename to src/osgWrappers/deprecated-dotosg/osgFX/IO_Outline.cpp diff --git a/src/osgPlugins/osgFX/IO_Scribe.cpp b/src/osgWrappers/deprecated-dotosg/osgFX/IO_Scribe.cpp similarity index 100% rename from src/osgPlugins/osgFX/IO_Scribe.cpp rename to src/osgWrappers/deprecated-dotosg/osgFX/IO_Scribe.cpp diff --git a/src/osgPlugins/osgFX/IO_SpecularHighlights.cpp b/src/osgWrappers/deprecated-dotosg/osgFX/IO_SpecularHighlights.cpp similarity index 100% rename from src/osgPlugins/osgFX/IO_SpecularHighlights.cpp rename to src/osgWrappers/deprecated-dotosg/osgFX/IO_SpecularHighlights.cpp diff --git a/src/osgPlugins/osgParticle/CMakeLists.txt b/src/osgWrappers/deprecated-dotosg/osgParticle/CMakeLists.txt similarity index 100% rename from src/osgPlugins/osgParticle/CMakeLists.txt rename to src/osgWrappers/deprecated-dotosg/osgParticle/CMakeLists.txt diff --git a/src/osgPlugins/osgParticle/IO_AccelOperator.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_AccelOperator.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_AccelOperator.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_AccelOperator.cpp diff --git a/src/osgPlugins/osgParticle/IO_AngularAccelOperator.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_AngularAccelOperator.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_AngularAccelOperator.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_AngularAccelOperator.cpp diff --git a/src/osgPlugins/osgParticle/IO_BoxPlacer.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_BoxPlacer.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_BoxPlacer.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_BoxPlacer.cpp diff --git a/src/osgPlugins/osgParticle/IO_CenteredPlacer.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_CenteredPlacer.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_CenteredPlacer.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_CenteredPlacer.cpp diff --git a/src/osgPlugins/osgParticle/IO_ConnectedParticleSystem.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ConnectedParticleSystem.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_ConnectedParticleSystem.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_ConnectedParticleSystem.cpp diff --git a/src/osgPlugins/osgParticle/IO_ConstantRateCounter.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ConstantRateCounter.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_ConstantRateCounter.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_ConstantRateCounter.cpp diff --git a/src/osgPlugins/osgParticle/IO_Emitter.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_Emitter.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_Emitter.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_Emitter.cpp diff --git a/src/osgPlugins/osgParticle/IO_ExplosionDebrisEffect.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ExplosionDebrisEffect.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_ExplosionDebrisEffect.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_ExplosionDebrisEffect.cpp diff --git a/src/osgPlugins/osgParticle/IO_ExplosionEffect.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ExplosionEffect.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_ExplosionEffect.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_ExplosionEffect.cpp diff --git a/src/osgPlugins/osgParticle/IO_FireEffect.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_FireEffect.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_FireEffect.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_FireEffect.cpp diff --git a/src/osgPlugins/osgParticle/IO_FluidFrictionOperator.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_FluidFrictionOperator.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_FluidFrictionOperator.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_FluidFrictionOperator.cpp diff --git a/src/osgPlugins/osgParticle/IO_FluidProgram.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_FluidProgram.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_FluidProgram.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_FluidProgram.cpp diff --git a/src/osgPlugins/osgParticle/IO_ForceOperator.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ForceOperator.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_ForceOperator.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_ForceOperator.cpp diff --git a/src/osgPlugins/osgParticle/IO_LinearInterpolator.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_LinearInterpolator.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_LinearInterpolator.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_LinearInterpolator.cpp diff --git a/src/osgPlugins/osgParticle/IO_ModularEmitter.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ModularEmitter.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_ModularEmitter.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_ModularEmitter.cpp diff --git a/src/osgPlugins/osgParticle/IO_ModularProgram.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ModularProgram.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_ModularProgram.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_ModularProgram.cpp diff --git a/src/osgPlugins/osgParticle/IO_MultiSegmentPlacer.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_MultiSegmentPlacer.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_MultiSegmentPlacer.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_MultiSegmentPlacer.cpp diff --git a/src/osgPlugins/osgParticle/IO_Particle.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_Particle.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_Particle.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_Particle.cpp diff --git a/src/osgPlugins/osgParticle/IO_ParticleEffect.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ParticleEffect.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_ParticleEffect.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_ParticleEffect.cpp diff --git a/src/osgPlugins/osgParticle/IO_ParticleProcessor.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ParticleProcessor.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_ParticleProcessor.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_ParticleProcessor.cpp diff --git a/src/osgPlugins/osgParticle/IO_ParticleSystem.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ParticleSystem.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_ParticleSystem.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_ParticleSystem.cpp diff --git a/src/osgPlugins/osgParticle/IO_ParticleSystemUpdater.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_ParticleSystemUpdater.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_ParticleSystemUpdater.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_ParticleSystemUpdater.cpp diff --git a/src/osgPlugins/osgParticle/IO_PointPlacer.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_PointPlacer.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_PointPlacer.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_PointPlacer.cpp diff --git a/src/osgPlugins/osgParticle/IO_Program.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_Program.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_Program.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_Program.cpp diff --git a/src/osgPlugins/osgParticle/IO_RadialShooter.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_RadialShooter.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_RadialShooter.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_RadialShooter.cpp diff --git a/src/osgPlugins/osgParticle/IO_RandomRateCounter.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_RandomRateCounter.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_RandomRateCounter.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_RandomRateCounter.cpp diff --git a/src/osgPlugins/osgParticle/IO_SectorPlacer.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_SectorPlacer.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_SectorPlacer.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_SectorPlacer.cpp diff --git a/src/osgPlugins/osgParticle/IO_SegmentPlacer.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_SegmentPlacer.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_SegmentPlacer.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_SegmentPlacer.cpp diff --git a/src/osgPlugins/osgParticle/IO_SmokeEffect.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_SmokeEffect.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_SmokeEffect.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_SmokeEffect.cpp diff --git a/src/osgPlugins/osgParticle/IO_SmokeTrailEffect.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_SmokeTrailEffect.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_SmokeTrailEffect.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_SmokeTrailEffect.cpp diff --git a/src/osgPlugins/osgParticle/IO_VariableRateCounter.cpp b/src/osgWrappers/deprecated-dotosg/osgParticle/IO_VariableRateCounter.cpp similarity index 100% rename from src/osgPlugins/osgParticle/IO_VariableRateCounter.cpp rename to src/osgWrappers/deprecated-dotosg/osgParticle/IO_VariableRateCounter.cpp diff --git a/src/osgPlugins/osgShadow/CMakeLists.txt b/src/osgWrappers/deprecated-dotosg/osgShadow/CMakeLists.txt similarity index 87% rename from src/osgPlugins/osgShadow/CMakeLists.txt rename to src/osgWrappers/deprecated-dotosg/osgShadow/CMakeLists.txt index 4b6eae664..11d517412 100644 --- a/src/osgPlugins/osgShadow/CMakeLists.txt +++ b/src/osgWrappers/deprecated-dotosg/osgShadow/CMakeLists.txt @@ -1,6 +1,5 @@ SET(TARGET_SRC - ReaderWriterOsgShadow.cpp ShadowedScene.cpp ShadowMap.cpp ShadowTechnique.cpp diff --git a/src/osgPlugins/osgShadow/ShadowMap.cpp b/src/osgWrappers/deprecated-dotosg/osgShadow/ShadowMap.cpp similarity index 100% rename from src/osgPlugins/osgShadow/ShadowMap.cpp rename to src/osgWrappers/deprecated-dotosg/osgShadow/ShadowMap.cpp diff --git a/src/osgPlugins/osgShadow/ShadowTechnique.cpp b/src/osgWrappers/deprecated-dotosg/osgShadow/ShadowTechnique.cpp similarity index 100% rename from src/osgPlugins/osgShadow/ShadowTechnique.cpp rename to src/osgWrappers/deprecated-dotosg/osgShadow/ShadowTechnique.cpp diff --git a/src/osgPlugins/osgShadow/ShadowTexture.cpp b/src/osgWrappers/deprecated-dotosg/osgShadow/ShadowTexture.cpp similarity index 100% rename from src/osgPlugins/osgShadow/ShadowTexture.cpp rename to src/osgWrappers/deprecated-dotosg/osgShadow/ShadowTexture.cpp diff --git a/src/osgPlugins/osgShadow/ShadowVolume.cpp b/src/osgWrappers/deprecated-dotosg/osgShadow/ShadowVolume.cpp similarity index 100% rename from src/osgPlugins/osgShadow/ShadowVolume.cpp rename to src/osgWrappers/deprecated-dotosg/osgShadow/ShadowVolume.cpp diff --git a/src/osgPlugins/osgShadow/ShadowedScene.cpp b/src/osgWrappers/deprecated-dotosg/osgShadow/ShadowedScene.cpp similarity index 100% rename from src/osgPlugins/osgShadow/ShadowedScene.cpp rename to src/osgWrappers/deprecated-dotosg/osgShadow/ShadowedScene.cpp diff --git a/src/osgPlugins/osgSim/CMakeLists.txt b/src/osgWrappers/deprecated-dotosg/osgSim/CMakeLists.txt similarity index 100% rename from src/osgPlugins/osgSim/CMakeLists.txt rename to src/osgWrappers/deprecated-dotosg/osgSim/CMakeLists.txt diff --git a/src/osgPlugins/osgSim/IO_BlinkSequence.cpp b/src/osgWrappers/deprecated-dotosg/osgSim/IO_BlinkSequence.cpp similarity index 100% rename from src/osgPlugins/osgSim/IO_BlinkSequence.cpp rename to src/osgWrappers/deprecated-dotosg/osgSim/IO_BlinkSequence.cpp diff --git a/src/osgPlugins/osgSim/IO_DOFTransform.cpp b/src/osgWrappers/deprecated-dotosg/osgSim/IO_DOFTransform.cpp similarity index 100% rename from src/osgPlugins/osgSim/IO_DOFTransform.cpp rename to src/osgWrappers/deprecated-dotosg/osgSim/IO_DOFTransform.cpp diff --git a/src/osgPlugins/osgSim/IO_Impostor.cpp b/src/osgWrappers/deprecated-dotosg/osgSim/IO_Impostor.cpp similarity index 100% rename from src/osgPlugins/osgSim/IO_Impostor.cpp rename to src/osgWrappers/deprecated-dotosg/osgSim/IO_Impostor.cpp diff --git a/src/osgPlugins/osgSim/IO_LightPoint.cpp b/src/osgWrappers/deprecated-dotosg/osgSim/IO_LightPoint.cpp similarity index 100% rename from src/osgPlugins/osgSim/IO_LightPoint.cpp rename to src/osgWrappers/deprecated-dotosg/osgSim/IO_LightPoint.cpp diff --git a/src/osgPlugins/osgSim/IO_LightPoint.h b/src/osgWrappers/deprecated-dotosg/osgSim/IO_LightPoint.h similarity index 100% rename from src/osgPlugins/osgSim/IO_LightPoint.h rename to src/osgWrappers/deprecated-dotosg/osgSim/IO_LightPoint.h diff --git a/src/osgPlugins/osgSim/IO_LightPointNode.cpp b/src/osgWrappers/deprecated-dotosg/osgSim/IO_LightPointNode.cpp similarity index 100% rename from src/osgPlugins/osgSim/IO_LightPointNode.cpp rename to src/osgWrappers/deprecated-dotosg/osgSim/IO_LightPointNode.cpp diff --git a/src/osgPlugins/osgSim/IO_MultiSwitch.cpp b/src/osgWrappers/deprecated-dotosg/osgSim/IO_MultiSwitch.cpp similarity index 100% rename from src/osgPlugins/osgSim/IO_MultiSwitch.cpp rename to src/osgWrappers/deprecated-dotosg/osgSim/IO_MultiSwitch.cpp diff --git a/src/osgPlugins/osgSim/IO_ObjectRecordData.cpp b/src/osgWrappers/deprecated-dotosg/osgSim/IO_ObjectRecordData.cpp similarity index 100% rename from src/osgPlugins/osgSim/IO_ObjectRecordData.cpp rename to src/osgWrappers/deprecated-dotosg/osgSim/IO_ObjectRecordData.cpp diff --git a/src/osgPlugins/osgSim/IO_OverlayNode.cpp b/src/osgWrappers/deprecated-dotosg/osgSim/IO_OverlayNode.cpp similarity index 100% rename from src/osgPlugins/osgSim/IO_OverlayNode.cpp rename to src/osgWrappers/deprecated-dotosg/osgSim/IO_OverlayNode.cpp diff --git a/src/osgPlugins/osgSim/IO_Sector.cpp b/src/osgWrappers/deprecated-dotosg/osgSim/IO_Sector.cpp similarity index 100% rename from src/osgPlugins/osgSim/IO_Sector.cpp rename to src/osgWrappers/deprecated-dotosg/osgSim/IO_Sector.cpp diff --git a/src/osgPlugins/osgSim/IO_ShapeAttribute.cpp b/src/osgWrappers/deprecated-dotosg/osgSim/IO_ShapeAttribute.cpp similarity index 100% rename from src/osgPlugins/osgSim/IO_ShapeAttribute.cpp rename to src/osgWrappers/deprecated-dotosg/osgSim/IO_ShapeAttribute.cpp diff --git a/src/osgPlugins/osgSim/IO_VisibilityGroup.cpp b/src/osgWrappers/deprecated-dotosg/osgSim/IO_VisibilityGroup.cpp similarity index 100% rename from src/osgPlugins/osgSim/IO_VisibilityGroup.cpp rename to src/osgWrappers/deprecated-dotosg/osgSim/IO_VisibilityGroup.cpp diff --git a/src/osgPlugins/osgTerrain/CMakeLists.txt b/src/osgWrappers/deprecated-dotosg/osgTerrain/CMakeLists.txt similarity index 90% rename from src/osgPlugins/osgTerrain/CMakeLists.txt rename to src/osgWrappers/deprecated-dotosg/osgTerrain/CMakeLists.txt index b75b662fb..4df77149a 100644 --- a/src/osgPlugins/osgTerrain/CMakeLists.txt +++ b/src/osgWrappers/deprecated-dotosg/osgTerrain/CMakeLists.txt @@ -8,7 +8,6 @@ SET(TARGET_SRC Terrain.cpp TerrainTile.cpp GeometryTechnique.cpp - ReaderWriterOsgTerrain.cpp ) SET(TARGET_ADDED_LIBRARIES osgTerrain ) diff --git a/src/osgPlugins/osgTerrain/CompositeLayer.cpp b/src/osgWrappers/deprecated-dotosg/osgTerrain/CompositeLayer.cpp similarity index 100% rename from src/osgPlugins/osgTerrain/CompositeLayer.cpp rename to src/osgWrappers/deprecated-dotosg/osgTerrain/CompositeLayer.cpp diff --git a/src/osgPlugins/osgTerrain/GeometryTechnique.cpp b/src/osgWrappers/deprecated-dotosg/osgTerrain/GeometryTechnique.cpp similarity index 100% rename from src/osgPlugins/osgTerrain/GeometryTechnique.cpp rename to src/osgWrappers/deprecated-dotosg/osgTerrain/GeometryTechnique.cpp diff --git a/src/osgPlugins/osgTerrain/HeightFieldLayer.cpp b/src/osgWrappers/deprecated-dotosg/osgTerrain/HeightFieldLayer.cpp similarity index 100% rename from src/osgPlugins/osgTerrain/HeightFieldLayer.cpp rename to src/osgWrappers/deprecated-dotosg/osgTerrain/HeightFieldLayer.cpp diff --git a/src/osgPlugins/osgTerrain/ImageLayer.cpp b/src/osgWrappers/deprecated-dotosg/osgTerrain/ImageLayer.cpp similarity index 100% rename from src/osgPlugins/osgTerrain/ImageLayer.cpp rename to src/osgWrappers/deprecated-dotosg/osgTerrain/ImageLayer.cpp diff --git a/src/osgPlugins/osgTerrain/Layer.cpp b/src/osgWrappers/deprecated-dotosg/osgTerrain/Layer.cpp similarity index 100% rename from src/osgPlugins/osgTerrain/Layer.cpp rename to src/osgWrappers/deprecated-dotosg/osgTerrain/Layer.cpp diff --git a/src/osgPlugins/osgTerrain/Locator.cpp b/src/osgWrappers/deprecated-dotosg/osgTerrain/Locator.cpp similarity index 100% rename from src/osgPlugins/osgTerrain/Locator.cpp rename to src/osgWrappers/deprecated-dotosg/osgTerrain/Locator.cpp diff --git a/src/osgPlugins/osgTerrain/SwitchLayer.cpp b/src/osgWrappers/deprecated-dotosg/osgTerrain/SwitchLayer.cpp similarity index 100% rename from src/osgPlugins/osgTerrain/SwitchLayer.cpp rename to src/osgWrappers/deprecated-dotosg/osgTerrain/SwitchLayer.cpp diff --git a/src/osgPlugins/osgTerrain/Terrain.cpp b/src/osgWrappers/deprecated-dotosg/osgTerrain/Terrain.cpp similarity index 100% rename from src/osgPlugins/osgTerrain/Terrain.cpp rename to src/osgWrappers/deprecated-dotosg/osgTerrain/Terrain.cpp diff --git a/src/osgPlugins/osgTerrain/TerrainTile.cpp b/src/osgWrappers/deprecated-dotosg/osgTerrain/TerrainTile.cpp similarity index 100% rename from src/osgPlugins/osgTerrain/TerrainTile.cpp rename to src/osgWrappers/deprecated-dotosg/osgTerrain/TerrainTile.cpp diff --git a/src/osgPlugins/osgText/CMakeLists.txt b/src/osgWrappers/deprecated-dotosg/osgText/CMakeLists.txt similarity index 100% rename from src/osgPlugins/osgText/CMakeLists.txt rename to src/osgWrappers/deprecated-dotosg/osgText/CMakeLists.txt diff --git a/src/osgPlugins/osgText/IO_Text.cpp b/src/osgWrappers/deprecated-dotosg/osgText/IO_Text.cpp similarity index 100% rename from src/osgPlugins/osgText/IO_Text.cpp rename to src/osgWrappers/deprecated-dotosg/osgText/IO_Text.cpp diff --git a/src/osgPlugins/osgText/IO_Text3D.cpp b/src/osgWrappers/deprecated-dotosg/osgText/IO_Text3D.cpp similarity index 100% rename from src/osgPlugins/osgText/IO_Text3D.cpp rename to src/osgWrappers/deprecated-dotosg/osgText/IO_Text3D.cpp diff --git a/src/osgPlugins/osgText/IO_TextBase.cpp b/src/osgWrappers/deprecated-dotosg/osgText/IO_TextBase.cpp similarity index 100% rename from src/osgPlugins/osgText/IO_TextBase.cpp rename to src/osgWrappers/deprecated-dotosg/osgText/IO_TextBase.cpp diff --git a/src/osgPlugins/osgViewer/CMakeLists.txt b/src/osgWrappers/deprecated-dotosg/osgViewer/CMakeLists.txt similarity index 83% rename from src/osgPlugins/osgViewer/CMakeLists.txt rename to src/osgWrappers/deprecated-dotosg/osgViewer/CMakeLists.txt index b45318752..906d0030c 100644 --- a/src/osgPlugins/osgViewer/CMakeLists.txt +++ b/src/osgWrappers/deprecated-dotosg/osgViewer/CMakeLists.txt @@ -3,7 +3,6 @@ SET(TARGET_SRC View.cpp Viewer.cpp CompositeViewer.cpp - ReaderWriterOsgViewer.cpp ) SET(TARGET_ADDED_LIBRARIES osgViewer ) diff --git a/src/osgPlugins/osgViewer/CompositeViewer.cpp b/src/osgWrappers/deprecated-dotosg/osgViewer/CompositeViewer.cpp similarity index 100% rename from src/osgPlugins/osgViewer/CompositeViewer.cpp rename to src/osgWrappers/deprecated-dotosg/osgViewer/CompositeViewer.cpp diff --git a/src/osgPlugins/osgViewer/View.cpp b/src/osgWrappers/deprecated-dotosg/osgViewer/View.cpp similarity index 100% rename from src/osgPlugins/osgViewer/View.cpp rename to src/osgWrappers/deprecated-dotosg/osgViewer/View.cpp diff --git a/src/osgPlugins/osgViewer/Viewer.cpp b/src/osgWrappers/deprecated-dotosg/osgViewer/Viewer.cpp similarity index 100% rename from src/osgPlugins/osgViewer/Viewer.cpp rename to src/osgWrappers/deprecated-dotosg/osgViewer/Viewer.cpp diff --git a/src/osgPlugins/osgVolume/CMakeLists.txt b/src/osgWrappers/deprecated-dotosg/osgVolume/CMakeLists.txt similarity index 100% rename from src/osgPlugins/osgVolume/CMakeLists.txt rename to src/osgWrappers/deprecated-dotosg/osgVolume/CMakeLists.txt diff --git a/src/osgPlugins/osgVolume/CompositeProperty.cpp b/src/osgWrappers/deprecated-dotosg/osgVolume/CompositeProperty.cpp similarity index 100% rename from src/osgPlugins/osgVolume/CompositeProperty.cpp rename to src/osgWrappers/deprecated-dotosg/osgVolume/CompositeProperty.cpp diff --git a/src/osgPlugins/osgVolume/FixedFunctionTechnique.cpp b/src/osgWrappers/deprecated-dotosg/osgVolume/FixedFunctionTechnique.cpp similarity index 100% rename from src/osgPlugins/osgVolume/FixedFunctionTechnique.cpp rename to src/osgWrappers/deprecated-dotosg/osgVolume/FixedFunctionTechnique.cpp diff --git a/src/osgPlugins/osgVolume/ImageLayer.cpp b/src/osgWrappers/deprecated-dotosg/osgVolume/ImageLayer.cpp similarity index 100% rename from src/osgPlugins/osgVolume/ImageLayer.cpp rename to src/osgWrappers/deprecated-dotosg/osgVolume/ImageLayer.cpp diff --git a/src/osgPlugins/osgVolume/Layer.cpp b/src/osgWrappers/deprecated-dotosg/osgVolume/Layer.cpp similarity index 100% rename from src/osgPlugins/osgVolume/Layer.cpp rename to src/osgWrappers/deprecated-dotosg/osgVolume/Layer.cpp diff --git a/src/osgPlugins/osgVolume/Locator.cpp b/src/osgWrappers/deprecated-dotosg/osgVolume/Locator.cpp similarity index 100% rename from src/osgPlugins/osgVolume/Locator.cpp rename to src/osgWrappers/deprecated-dotosg/osgVolume/Locator.cpp diff --git a/src/osgPlugins/osgVolume/Property.cpp b/src/osgWrappers/deprecated-dotosg/osgVolume/Property.cpp similarity index 100% rename from src/osgPlugins/osgVolume/Property.cpp rename to src/osgWrappers/deprecated-dotosg/osgVolume/Property.cpp diff --git a/src/osgPlugins/osgVolume/PropertyAdjustmentCallback.cpp b/src/osgWrappers/deprecated-dotosg/osgVolume/PropertyAdjustmentCallback.cpp similarity index 100% rename from src/osgPlugins/osgVolume/PropertyAdjustmentCallback.cpp rename to src/osgWrappers/deprecated-dotosg/osgVolume/PropertyAdjustmentCallback.cpp diff --git a/src/osgPlugins/osgVolume/RayTracedTechnique.cpp b/src/osgWrappers/deprecated-dotosg/osgVolume/RayTracedTechnique.cpp similarity index 100% rename from src/osgPlugins/osgVolume/RayTracedTechnique.cpp rename to src/osgWrappers/deprecated-dotosg/osgVolume/RayTracedTechnique.cpp diff --git a/src/osgPlugins/osgVolume/ScalarProperty.cpp b/src/osgWrappers/deprecated-dotosg/osgVolume/ScalarProperty.cpp similarity index 100% rename from src/osgPlugins/osgVolume/ScalarProperty.cpp rename to src/osgWrappers/deprecated-dotosg/osgVolume/ScalarProperty.cpp diff --git a/src/osgPlugins/osgVolume/SwitchProperty.cpp b/src/osgWrappers/deprecated-dotosg/osgVolume/SwitchProperty.cpp similarity index 100% rename from src/osgPlugins/osgVolume/SwitchProperty.cpp rename to src/osgWrappers/deprecated-dotosg/osgVolume/SwitchProperty.cpp diff --git a/src/osgPlugins/osgVolume/TransferFunctionProperty.cpp b/src/osgWrappers/deprecated-dotosg/osgVolume/TransferFunctionProperty.cpp similarity index 100% rename from src/osgPlugins/osgVolume/TransferFunctionProperty.cpp rename to src/osgWrappers/deprecated-dotosg/osgVolume/TransferFunctionProperty.cpp diff --git a/src/osgPlugins/osgVolume/Volume.cpp b/src/osgWrappers/deprecated-dotosg/osgVolume/Volume.cpp similarity index 100% rename from src/osgPlugins/osgVolume/Volume.cpp rename to src/osgWrappers/deprecated-dotosg/osgVolume/Volume.cpp diff --git a/src/osgPlugins/osgVolume/VolumeTile.cpp b/src/osgWrappers/deprecated-dotosg/osgVolume/VolumeTile.cpp similarity index 100% rename from src/osgPlugins/osgVolume/VolumeTile.cpp rename to src/osgWrappers/deprecated-dotosg/osgVolume/VolumeTile.cpp diff --git a/src/osgPlugins/osgWidget/Box.cpp b/src/osgWrappers/deprecated-dotosg/osgWidget/Box.cpp similarity index 100% rename from src/osgPlugins/osgWidget/Box.cpp rename to src/osgWrappers/deprecated-dotosg/osgWidget/Box.cpp diff --git a/src/osgPlugins/osgWidget/CMakeLists.txt b/src/osgWrappers/deprecated-dotosg/osgWidget/CMakeLists.txt similarity index 100% rename from src/osgPlugins/osgWidget/CMakeLists.txt rename to src/osgWrappers/deprecated-dotosg/osgWidget/CMakeLists.txt diff --git a/src/osgPlugins/osgWidget/EmbeddedWindow.cpp b/src/osgWrappers/deprecated-dotosg/osgWidget/EmbeddedWindow.cpp similarity index 100% rename from src/osgPlugins/osgWidget/EmbeddedWindow.cpp rename to src/osgWrappers/deprecated-dotosg/osgWidget/EmbeddedWindow.cpp diff --git a/src/osgPlugins/osgWidget/Frame.cpp b/src/osgWrappers/deprecated-dotosg/osgWidget/Frame.cpp similarity index 100% rename from src/osgPlugins/osgWidget/Frame.cpp rename to src/osgWrappers/deprecated-dotosg/osgWidget/Frame.cpp diff --git a/src/osgPlugins/osgWidget/Input.cpp b/src/osgWrappers/deprecated-dotosg/osgWidget/Input.cpp similarity index 100% rename from src/osgPlugins/osgWidget/Input.cpp rename to src/osgWrappers/deprecated-dotosg/osgWidget/Input.cpp diff --git a/src/osgPlugins/osgWidget/Label.cpp b/src/osgWrappers/deprecated-dotosg/osgWidget/Label.cpp similarity index 100% rename from src/osgPlugins/osgWidget/Label.cpp rename to src/osgWrappers/deprecated-dotosg/osgWidget/Label.cpp diff --git a/src/osgPlugins/osgWidget/Table.cpp b/src/osgWrappers/deprecated-dotosg/osgWidget/Table.cpp similarity index 100% rename from src/osgPlugins/osgWidget/Table.cpp rename to src/osgWrappers/deprecated-dotosg/osgWidget/Table.cpp diff --git a/src/osgPlugins/osgWidget/Widget.cpp b/src/osgWrappers/deprecated-dotosg/osgWidget/Widget.cpp similarity index 100% rename from src/osgPlugins/osgWidget/Widget.cpp rename to src/osgWrappers/deprecated-dotosg/osgWidget/Widget.cpp diff --git a/src/osgPlugins/osgWidget/WindowManager.cpp b/src/osgWrappers/deprecated-dotosg/osgWidget/WindowManager.cpp similarity index 100% rename from src/osgPlugins/osgWidget/WindowManager.cpp rename to src/osgWrappers/deprecated-dotosg/osgWidget/WindowManager.cpp