Refactored the old style .osg plugin support so that the DotOsgWrappers are placed in their own dedicated plugins found in src/osgWrappers/deprecated_osg
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
############################################################
|
||||
#
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
#include "osg/AlphaFunc"
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
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<AlphaFunc&>(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<const AlphaFunc&>(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 "";
|
||||
}
|
||||
@@ -1,232 +0,0 @@
|
||||
#include <osg/Notify>
|
||||
#include <osg/Geometry>
|
||||
#include <osg/AnimationPath>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
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<osg::AnimationPath*>(&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<const osg::AnimationPath*>(&obj);
|
||||
if (!ap) return false;
|
||||
|
||||
fw.indent() << "LoopMode ";
|
||||
switch(ap->getLoopMode())
|
||||
{
|
||||
case AnimationPath::SWING:
|
||||
fw << "SWING" <<std::endl;
|
||||
break;
|
||||
case AnimationPath::LOOP:
|
||||
fw << "LOOP"<<std::endl;
|
||||
break;
|
||||
case AnimationPath::NO_LOOPING:
|
||||
fw << "NO_LOOPING"<<std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
const AnimationPath::TimeControlPointMap& tcpm = ap->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() << " " <<itr->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<osg::AnimationPathCallback*>(&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<osg::AnimationPath> s_path = new osg::AnimationPath;
|
||||
ref_ptr<osg::Object> object = fr.readObjectOfType(*s_path);
|
||||
if (object.valid())
|
||||
{
|
||||
osg::AnimationPath* animpath = dynamic_cast<osg::AnimationPath*>(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<const osg::AnimationPathCallback*>(&obj);
|
||||
if (!apc) return false;
|
||||
|
||||
|
||||
fw.indent() <<"pivotPoint " <<apc->getPivotPoint()<<std::endl;
|
||||
fw.indent() <<"timeOffset " <<apc->_timeOffset<<std::endl;
|
||||
fw.indent() <<"timeMultiplier " <<apc->_timeMultiplier << std::endl;
|
||||
|
||||
if (apc->getAnimationPath())
|
||||
{
|
||||
fw.writeObject(*(apc->getAnimationPath()));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,191 +0,0 @@
|
||||
#include <osg/AutoTransform>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
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<AutoTransform&>(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<const AutoTransform&>(obj);
|
||||
|
||||
fw.indent()<<"position "<<transform.getPosition()<<std::endl;
|
||||
fw.indent()<<"rotation "<<transform.getRotation()<<std::endl;
|
||||
fw.indent()<<"scale "<<transform.getScale()<<std::endl;
|
||||
|
||||
if (transform.getMinimumScale()>0.0) fw.indent()<<"minimumScale "<<transform.getMinimumScale()<<std::endl;
|
||||
if (transform.getMaximumScale()<FLT_MAX) fw.indent()<<"maximumScale "<<transform.getMaximumScale()<<std::endl;
|
||||
|
||||
|
||||
fw.indent()<<"pivotPoint "<<transform.getPivotPoint()<<std::endl;
|
||||
fw.indent()<<"autoUpdateEyeMovementTolerance "<<transform.getAutoUpdateEyeMovementTolerance()<<std::endl;
|
||||
fw.indent()<<"autoRotateMode ";
|
||||
switch(transform.getAutoRotateMode())
|
||||
{
|
||||
case(osg::AutoTransform::ROTATE_TO_SCREEN): fw<<"ROTATE_TO_SCREEN"<<std::endl; break;
|
||||
case(osg::AutoTransform::ROTATE_TO_CAMERA): fw<<"ROTATE_TO_CAMERA"<<std::endl; break;
|
||||
case(osg::AutoTransform::NO_ROTATION):
|
||||
default: fw<<"NO_ROTATION"<<std::endl; break;
|
||||
}
|
||||
|
||||
fw.indent()<<"autoScaleToScreen "<<(transform.getAutoScaleToScreen()?"TRUE":"FALSE")<<std::endl;
|
||||
|
||||
if (transform.getAutoScaleTransitionWidthRatio()!=0.25)
|
||||
{
|
||||
fw.indent()<<"autoScaleTransitionWidthRatio "<<transform.getAutoScaleTransitionWidthRatio()<<std::endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
#include "osg/Billboard"
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
|
||||
// forward declare functions to use later.
|
||||
bool Billboard_readLocalData(Object& obj, Input& fr);
|
||||
bool Billboard_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
REGISTER_DOTOSGWRAPPER(Billboard)
|
||||
(
|
||||
new osg::Billboard,
|
||||
"Billboard",
|
||||
"Object Node Geode Billboard",
|
||||
&Billboard_readLocalData,
|
||||
&Billboard_writeLocalData
|
||||
);
|
||||
|
||||
bool Billboard_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
Billboard& billboard = static_cast<Billboard&>(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<const Billboard&>(obj);
|
||||
|
||||
switch(billboard.getMode())
|
||||
{
|
||||
case(Billboard::AXIAL_ROT): fw.indent() << "Mode AXIAL_ROT"<<std::endl; break;
|
||||
case(Billboard::POINT_ROT_EYE): fw.indent() << "Mode POINT_ROT_EYE"<<std::endl; break;
|
||||
case(Billboard::POINT_ROT_WORLD): fw.indent() << "Mode POINT_ROT_WORLD"<<std::endl; break;
|
||||
}
|
||||
|
||||
const Vec3& axis = billboard.getAxis();
|
||||
fw.indent() << "Axis " << axis[0] << " "<<axis[1]<<" "<<axis[2]<<std::endl;
|
||||
|
||||
const Vec3& normal = billboard.getNormal();
|
||||
fw.indent() << "Normal " << normal[0] << " "<<normal[1]<<" "<<normal[2]<<std::endl;
|
||||
|
||||
fw.indent() << "Positions {"<<std::endl;
|
||||
fw.moveIn();
|
||||
|
||||
|
||||
Billboard::PositionList positionList = billboard.getPositionList();
|
||||
for(Billboard::PositionList::iterator piter = positionList.begin();
|
||||
piter != positionList.end();
|
||||
++piter)
|
||||
{
|
||||
fw.indent() << (*piter)[0] << " "<<(*piter)[1]<<" "<<(*piter)[2]<<std::endl;
|
||||
}
|
||||
fw.moveOut();
|
||||
fw.indent() << "}"<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
#include <osg/BlendColor>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
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<BlendColor&>(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<const BlendColor&>(obj);
|
||||
|
||||
fw.indent() << "constantColor " << bc.getConstantColor() << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,108 +0,0 @@
|
||||
#include "osg/BlendEquation"
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
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<BlendEquation&>(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<const BlendEquation&>(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;
|
||||
}
|
||||
@@ -1,143 +0,0 @@
|
||||
#include "osg/BlendFunc"
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
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<BlendFunc&>(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<const BlendFunc&>(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;
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
#include <osg/Shape>
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
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<Box&>(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<const Box&>(obj);
|
||||
|
||||
fw.indent()<<"Center "<<box.getCenter()<<std::endl;
|
||||
fw.indent()<<"HalfLengths "<<box.getHalfLengths()<<std::endl;
|
||||
fw.indent()<<"Rotation "<<box.getRotation()<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,93 +1,6 @@
|
||||
SET(TARGET_SRC
|
||||
AlphaFunc.cpp
|
||||
AnimationPath.cpp
|
||||
AutoTransform.cpp
|
||||
Billboard.cpp
|
||||
BlendColor.cpp
|
||||
BlendEquation.cpp
|
||||
BlendFunc.cpp
|
||||
Box.cpp
|
||||
Camera.cpp
|
||||
CameraView.cpp
|
||||
Capsule.cpp
|
||||
ClearNode.cpp
|
||||
ClipNode.cpp
|
||||
ClipPlane.cpp
|
||||
ClusterCullingCallback.cpp
|
||||
ColorMask.cpp
|
||||
ColorMatrix.cpp
|
||||
CompositeShape.cpp
|
||||
Cone.cpp
|
||||
ConvexPlanarOccluder.cpp
|
||||
CoordinateSystemNode.cpp
|
||||
Cylinder.cpp
|
||||
CullFace.cpp
|
||||
Depth.cpp
|
||||
Drawable.cpp
|
||||
EllipsoidModel.cpp
|
||||
Fog.cpp
|
||||
FragmentProgram.cpp
|
||||
FrontFace.cpp
|
||||
Geode.cpp
|
||||
Geometry.cpp
|
||||
Group.cpp
|
||||
HeightField.cpp
|
||||
Image.cpp
|
||||
ImageSequence.cpp
|
||||
Light.cpp
|
||||
LightModel.cpp
|
||||
LightSource.cpp
|
||||
LineStipple.cpp
|
||||
LineWidth.cpp
|
||||
LOD.cpp
|
||||
Material.cpp
|
||||
Matrix.cpp
|
||||
MatrixTransform.cpp
|
||||
NodeCallback.cpp
|
||||
Node.cpp
|
||||
Object.cpp
|
||||
OccluderNode.cpp
|
||||
OcclusionQueryNode.cpp
|
||||
PagedLOD.cpp
|
||||
Point.cpp
|
||||
PointSprite.cpp
|
||||
PolygonMode.cpp
|
||||
PolygonOffset.cpp
|
||||
PositionAttitudeTransform.cpp
|
||||
Program.cpp
|
||||
Projection.cpp
|
||||
ProxyNode.cpp
|
||||
ReaderWriterOSG.cpp
|
||||
Scissor.cpp
|
||||
Sequence.cpp
|
||||
ShadeModel.cpp
|
||||
Shader.cpp
|
||||
ShapeDrawable.cpp
|
||||
Sphere.cpp
|
||||
StateAttribute.cpp
|
||||
StateSet.cpp
|
||||
Stencil.cpp
|
||||
Switch.cpp
|
||||
TessellationHints.cpp
|
||||
TexEnvCombine.cpp
|
||||
TexEnv.cpp
|
||||
TexEnvFilter.cpp
|
||||
TexGen.cpp
|
||||
TexGenNode.cpp
|
||||
TexMat.cpp
|
||||
Texture1D.cpp
|
||||
Texture2D.cpp
|
||||
Texture3D.cpp
|
||||
Texture.cpp
|
||||
TextureCubeMap.cpp
|
||||
TextureRectangle.cpp
|
||||
TransferFunction.cpp
|
||||
Transform.cpp
|
||||
Uniform.cpp
|
||||
VertexProgram.cpp
|
||||
Viewport.cpp
|
||||
)
|
||||
SET(TARGET_H Matrix.h )
|
||||
|
||||
#### end var setup ###
|
||||
SETUP_PLUGIN(osg)
|
||||
|
||||
@@ -1,372 +0,0 @@
|
||||
#include <osg/Camera>
|
||||
#include <osg/io_utils>
|
||||
#include <osg/Notify>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
#include "Matrix.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
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<Camera&>(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<osg::StateAttribute> attribute;
|
||||
while((attribute=fr.readStateAttribute())!=NULL)
|
||||
{
|
||||
osg::Viewport* viewport = dynamic_cast<osg::Viewport*>(attribute.get());
|
||||
if (viewport) camera.setViewport(viewport);
|
||||
else
|
||||
{
|
||||
osg::ColorMask* colormask = dynamic_cast<osg::ColorMask*>(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<osg::Object> attribute;
|
||||
while((attribute=fr.readObject())!=NULL)
|
||||
{
|
||||
localAdvance = true;
|
||||
|
||||
osg::Texture* texture = dynamic_cast<osg::Texture*>(attribute.get());
|
||||
if (texture) attachment._texture = texture;
|
||||
else
|
||||
{
|
||||
osg::Image* image = dynamic_cast<osg::Image*>(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<const Camera&>(obj);
|
||||
|
||||
fw.indent()<<"clearColor "<<camera.getClearColor()<<std::endl;
|
||||
fw.indent()<<"clearMask 0x"<<std::hex<<camera.getClearMask()<<std::endl;
|
||||
|
||||
if (camera.getColorMask())
|
||||
{
|
||||
fw.writeObject(*camera.getColorMask());
|
||||
}
|
||||
|
||||
if (camera.getViewport())
|
||||
{
|
||||
fw.writeObject(*camera.getViewport());
|
||||
}
|
||||
|
||||
fw.indent()<<"transformOrder ";
|
||||
switch(camera.getTransformOrder())
|
||||
{
|
||||
case(osg::Camera::PRE_MULTIPLY): fw <<"PRE_MULTIPLY"<<std::endl; break;
|
||||
case(osg::Camera::POST_MULTIPLY): fw <<"POST_MULTIPLY"<<std::endl; break;
|
||||
}
|
||||
|
||||
writeMatrix(camera.getProjectionMatrix(),fw,"ProjectionMatrix");
|
||||
writeMatrix(camera.getViewMatrix(),fw,"ViewMatrix");
|
||||
|
||||
fw.indent()<<"renderOrder ";
|
||||
switch(camera.getRenderOrder())
|
||||
{
|
||||
case(osg::Camera::PRE_RENDER): fw <<"PRE_RENDER"<<std::endl; break;
|
||||
case(osg::Camera::NESTED_RENDER): fw <<"NESTED_RENDER"<<std::endl; break;
|
||||
case(osg::Camera::POST_RENDER): fw <<"POST_RENDER"<<std::endl; break;
|
||||
}
|
||||
|
||||
fw.indent()<<"renderTargetImplementation ";
|
||||
switch(camera.getRenderTargetImplementation())
|
||||
{
|
||||
case(osg::Camera::FRAME_BUFFER_OBJECT): fw <<"FRAME_BUFFER_OBJECT"<<std::endl; break;
|
||||
case(osg::Camera::PIXEL_BUFFER_RTT): fw <<"PIXEL_BUFFER_RTT"<<std::endl; break;
|
||||
case(osg::Camera::PIXEL_BUFFER): fw <<"PIXEL_BUFFER"<<std::endl; break;
|
||||
case(osg::Camera::FRAME_BUFFER): fw <<"FRAME_BUFFER"<<std::endl; break;
|
||||
case(osg::Camera::SEPERATE_WINDOW): fw <<"SEPERATE_WINDOW"<<std::endl; break;
|
||||
}
|
||||
|
||||
fw.indent()<<"renderTargetFallback ";
|
||||
switch(camera.getRenderTargetFallback())
|
||||
{
|
||||
case(osg::Camera::FRAME_BUFFER_OBJECT): fw <<"FRAME_BUFFER_OBJECT"<<std::endl; break;
|
||||
case(osg::Camera::PIXEL_BUFFER_RTT): fw <<"PIXEL_BUFFER_RTT"<<std::endl; break;
|
||||
case(osg::Camera::PIXEL_BUFFER): fw <<"PIXEL_BUFFER"<<std::endl; break;
|
||||
case(osg::Camera::FRAME_BUFFER): fw <<"FRAME_BUFFER"<<std::endl; break;
|
||||
case(osg::Camera::SEPERATE_WINDOW): fw <<"SEPERATE_WINDOW"<<std::endl; break;
|
||||
}
|
||||
|
||||
fw.indent()<<"drawBuffer "<<std::hex<<camera.getDrawBuffer()<<std::endl;
|
||||
fw.indent()<<"readBuffer "<<std::hex<<camera.getReadBuffer()<<std::endl;
|
||||
|
||||
const osg::Camera::BufferAttachmentMap& bam = camera.getBufferAttachmentMap();
|
||||
if (!bam.empty())
|
||||
{
|
||||
for(osg::Camera::BufferAttachmentMap::const_iterator itr=bam.begin();
|
||||
itr!=bam.end();
|
||||
++itr)
|
||||
{
|
||||
const osg::Camera::Attachment& attachment = itr->second;
|
||||
fw.indent()<<"bufferComponent "<<Camera_getBufferComponentStr(itr->first)<<" {"<<std::endl;
|
||||
fw.moveIn();
|
||||
|
||||
fw.indent()<<"internalFormat "<<attachment._internalFormat<<std::endl;
|
||||
if (attachment._texture.valid())
|
||||
{
|
||||
fw.writeObject(*attachment._texture.get());
|
||||
}
|
||||
fw.indent()<<"level "<<attachment._level<<std::endl;
|
||||
fw.indent()<<"face "<<attachment._face<<std::endl;
|
||||
fw.indent()<<"mipMapGeneration "<<(attachment._mipMapGeneration ? "TRUE" : "FALSE")<<std::endl;
|
||||
|
||||
fw.moveOut();
|
||||
fw.indent()<<"}"<<std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Camera_matchBufferComponentStr(const char* str,Camera::BufferComponent& buffer)
|
||||
{
|
||||
if (strcmp(str,"DEPTH_BUFFER")==0) buffer = osg::Camera::DEPTH_BUFFER;
|
||||
else if (strcmp(str,"STENCIL_BUFFER")==0) buffer = osg::Camera::STENCIL_BUFFER;
|
||||
else if (strcmp(str,"PACKED_DEPTH_STENCIL_BUFFER")==0) buffer = osg::Camera::PACKED_DEPTH_STENCIL_BUFFER;
|
||||
else if (strcmp(str,"COLOR_BUFFER")==0) buffer = osg::Camera::COLOR_BUFFER;
|
||||
else if (strcmp(str,"COLOR_BUFFER0")==0) buffer = osg::Camera::COLOR_BUFFER0;
|
||||
else if (strcmp(str,"COLOR_BUFFER1")==0) buffer = osg::Camera::COLOR_BUFFER1;
|
||||
else if (strcmp(str,"COLOR_BUFFER2")==0) buffer = osg::Camera::COLOR_BUFFER2;
|
||||
else if (strcmp(str,"COLOR_BUFFER3")==0) buffer = osg::Camera::COLOR_BUFFER3;
|
||||
else if (strcmp(str,"COLOR_BUFFER4")==0) buffer = osg::Camera::COLOR_BUFFER4;
|
||||
else if (strcmp(str,"COLOR_BUFFER5")==0) buffer = osg::Camera::COLOR_BUFFER5;
|
||||
else if (strcmp(str,"COLOR_BUFFER6")==0) buffer = osg::Camera::COLOR_BUFFER6;
|
||||
else if (strcmp(str,"COLOR_BUFFER7")==0) buffer = osg::Camera::COLOR_BUFFER7;
|
||||
else if (strcmp(str,"COLOR_BUFFER8")==0) buffer = osg::Camera::COLOR_BUFFER8;
|
||||
else if (strcmp(str,"COLOR_BUFFER9")==0) buffer = osg::Camera::COLOR_BUFFER9;
|
||||
else if (strcmp(str,"COLOR_BUFFER10")==0) buffer = osg::Camera::COLOR_BUFFER10;
|
||||
else if (strcmp(str,"COLOR_BUFFER11")==0) buffer = osg::Camera::COLOR_BUFFER11;
|
||||
else if (strcmp(str,"COLOR_BUFFER12")==0) buffer = osg::Camera::COLOR_BUFFER12;
|
||||
else if (strcmp(str,"COLOR_BUFFER13")==0) buffer = osg::Camera::COLOR_BUFFER13;
|
||||
else if (strcmp(str,"COLOR_BUFFER14")==0) buffer = osg::Camera::COLOR_BUFFER14;
|
||||
else if (strcmp(str,"COLOR_BUFFER15")==0) buffer = osg::Camera::COLOR_BUFFER15;
|
||||
else return false;
|
||||
return true;
|
||||
}
|
||||
const char* Camera_getBufferComponentStr(Camera::BufferComponent buffer)
|
||||
{
|
||||
switch(buffer)
|
||||
{
|
||||
case (osg::Camera::DEPTH_BUFFER) : return "DEPTH_BUFFER";
|
||||
case (osg::Camera::STENCIL_BUFFER) : return "STENCIL_BUFFER";
|
||||
case (osg::Camera::PACKED_DEPTH_STENCIL_BUFFER) : return "PACKED_DEPTH_STENCIL_BUFFER";
|
||||
case (osg::Camera::COLOR_BUFFER) : return "COLOR_BUFFER";
|
||||
case (osg::Camera::COLOR_BUFFER0) : return "COLOR_BUFFER0";
|
||||
case (osg::Camera::COLOR_BUFFER1) : return "COLOR_BUFFER1";
|
||||
case (osg::Camera::COLOR_BUFFER2) : return "COLOR_BUFFER2";
|
||||
case (osg::Camera::COLOR_BUFFER3) : return "COLOR_BUFFER3";
|
||||
case (osg::Camera::COLOR_BUFFER4) : return "COLOR_BUFFER4";
|
||||
case (osg::Camera::COLOR_BUFFER5) : return "COLOR_BUFFER5";
|
||||
case (osg::Camera::COLOR_BUFFER6) : return "COLOR_BUFFER6";
|
||||
case (osg::Camera::COLOR_BUFFER7) : return "COLOR_BUFFER7";
|
||||
case (osg::Camera::COLOR_BUFFER8) : return "COLOR_BUFFER8";
|
||||
case (osg::Camera::COLOR_BUFFER9) : return "COLOR_BUFFER9";
|
||||
case (osg::Camera::COLOR_BUFFER10) : return "COLOR_BUFFER10";
|
||||
case (osg::Camera::COLOR_BUFFER11) : return "COLOR_BUFFER11";
|
||||
case (osg::Camera::COLOR_BUFFER12) : return "COLOR_BUFFER12";
|
||||
case (osg::Camera::COLOR_BUFFER13) : return "COLOR_BUFFER13";
|
||||
case (osg::Camera::COLOR_BUFFER14) : return "COLOR_BUFFER14";
|
||||
case (osg::Camera::COLOR_BUFFER15) : return "COLOR_BUFFER15";
|
||||
default : return "UnknownBufferComponent";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,115 +0,0 @@
|
||||
#include <osg/CameraView>
|
||||
#include <osg/io_utils>
|
||||
#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 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<CameraView&>(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<const CameraView&>(obj);
|
||||
|
||||
fw.indent()<<"position "<<cameraview.getPosition()<<std::endl;
|
||||
fw.indent()<<"attitude "<<cameraview.getAttitude()<<std::endl;
|
||||
|
||||
fw.indent()<<"fieldOfView "<<cameraview.getFieldOfView()<<std::endl;
|
||||
fw.indent()<<"fieldOfViewMode ";
|
||||
switch(cameraview.getFieldOfViewMode())
|
||||
{
|
||||
case(osg::CameraView::UNCONSTRAINED): fw <<"UNCONSTRAINED"<<std::endl; break;
|
||||
case(osg::CameraView::HORIZONTAL): fw <<"HORIZONTAL"<<std::endl; break;
|
||||
case(osg::CameraView::VERTICAL): fw <<"VERTICAL"<<std::endl; break;
|
||||
}
|
||||
|
||||
fw.indent()<<"focalLength "<<cameraview.getFocalLength()<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
#include <osg/Shape>
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
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<Capsule&>(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<const Capsule&>(obj);
|
||||
|
||||
fw.indent()<<"Center "<<capsule.getCenter()<<std::endl;
|
||||
fw.indent()<<"Radius "<<capsule.getRadius()<<std::endl;
|
||||
fw.indent()<<"Height "<<capsule.getHeight()<<std::endl;
|
||||
fw.indent()<<"Rotation "<<capsule.getRotation()<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
#include <osg/ClearNode>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
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<ClearNode&>(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<GLbitfield>(value));
|
||||
iteratorAdvanced = true;
|
||||
fr+=2;
|
||||
}
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool ClearNode_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const ClearNode& es = static_cast<const ClearNode&>(obj);
|
||||
|
||||
fw.indent() << "requiresClear ";
|
||||
if (es.getRequiresClear())
|
||||
{
|
||||
fw<<"TRUE"<< std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
fw<<"FALSE"<< std::endl;
|
||||
}
|
||||
|
||||
fw.indent() << "clearColor "<<es.getClearColor()<< std::endl;
|
||||
fw.indent() << "clearMask "<<static_cast<unsigned int>(es.getClearMask())<< std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -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<ClipNode&>(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<StateAttribute> sa=0;
|
||||
while((sa=fr.readStateAttribute())!=0)
|
||||
{
|
||||
ClipPlane* clipplane = dynamic_cast<ClipPlane*>(sa.get());
|
||||
if (clipplane) clipnode.addClipPlane(clipplane);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool ClipNode_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const ClipNode& clipnode = static_cast<const ClipNode&>(obj);
|
||||
|
||||
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<clipnode.getNumClipPlanes();++i)
|
||||
{
|
||||
fw.writeObject(*clipnode.getClipPlane(i));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( disable : 4786 )
|
||||
#endif
|
||||
|
||||
#include <osg/ClipPlane>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#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<ClipPlane&>(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<const ClipPlane&>(obj);
|
||||
|
||||
fw.indent() << "clipPlaneNum " << clipplane.getClipPlaneNum() <<std::endl;
|
||||
|
||||
fw.indent() << "plane " << clipplane.getClipPlane()<< std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
#include <osg/ClusterCullingCallback>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
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<ClusterCullingCallback*>(&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<const ClusterCullingCallback*>(&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;
|
||||
}
|
||||
@@ -1,99 +0,0 @@
|
||||
#include "osg/ColorMask"
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
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<ColorMask&>(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<const ColorMask&>(obj);
|
||||
|
||||
fw.indent() << "redMask " << ColorMask_getModeStr(colormask.getRedMask()) <<std::endl;
|
||||
fw.indent() << "greenMask " << ColorMask_getModeStr(colormask.getGreenMask()) <<std::endl;
|
||||
fw.indent() << "blueMask " << ColorMask_getModeStr(colormask.getBlueMask()) <<std::endl;
|
||||
fw.indent() << "alphaMask " << ColorMask_getModeStr(colormask.getAlphaMask()) <<std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ColorMask_matchModeStr(const char* str,bool& mode)
|
||||
{
|
||||
if (strcmp(str,"TRUE")==0) mode = true;
|
||||
else if (strcmp(str,"FALSE")==0) mode = false;
|
||||
else if (strcmp(str,"ON")==0) mode = true;
|
||||
else if (strcmp(str,"OFF")==0) mode = false;
|
||||
else return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const char* ColorMask_getModeStr(bool mode)
|
||||
{
|
||||
if (mode) return "ON";
|
||||
else return "OFF";
|
||||
}
|
||||
@@ -1,38 +0,0 @@
|
||||
#include <osg/ColorMatrix>
|
||||
|
||||
#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 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<ColorMatrix&>(obj);
|
||||
return readMatrix(colorMatrix.getMatrix(), fr);
|
||||
}
|
||||
|
||||
|
||||
bool ColorMatrix_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const ColorMatrix& colorMatrix = static_cast<const ColorMatrix&>(obj);
|
||||
return writeMatrix(colorMatrix.getMatrix(), fw);
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
#include <osg/Shape>
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
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<CompositeShape&>(obj);
|
||||
|
||||
ref_ptr<Object> readObject;
|
||||
if (fr[0].matchWord("Shape"))
|
||||
{
|
||||
readObject = fr.readObject();
|
||||
if (readObject.valid())
|
||||
{
|
||||
osg::Shape* shape = dynamic_cast<osg::Shape*>(readObject.get());
|
||||
if (shape) composite.setShape(shape);
|
||||
else notify(WARN)<<"Warning:: "<<readObject->className()<<" loaded but cannot not be attached to Drawable."<<std::endl;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
while((readObject=fr.readObjectOfType(type_wrapper<osg::Shape>())).valid())
|
||||
{
|
||||
osg::Shape* shape = static_cast<osg::Shape*>(readObject.get());
|
||||
composite.addChild(shape);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool CompositeShape_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const CompositeShape& composite = static_cast<const CompositeShape&>(obj);
|
||||
|
||||
if (composite.getShape())
|
||||
{
|
||||
fw.indent() << "Shape ";
|
||||
fw.writeObject(*composite.getShape());
|
||||
}
|
||||
|
||||
for(unsigned int i=0;i<composite.getNumChildren();++i)
|
||||
{
|
||||
fw.writeObject(*composite.getChild(i));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
#include <osg/Shape>
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
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<Cone&>(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<const Cone&>(obj);
|
||||
|
||||
fw.indent()<<"Center "<<cone.getCenter()<<std::endl;
|
||||
fw.indent()<<"Radius "<<cone.getRadius()<<std::endl;
|
||||
fw.indent()<<"Height "<<cone.getHeight()<<std::endl;
|
||||
fw.indent()<<"Rotation "<<cone.getRotation()<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,173 +0,0 @@
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( disable : 4786 )
|
||||
#endif
|
||||
|
||||
#include "osg/ConvexPlanarOccluder"
|
||||
#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 ConvexPlanarOccluder_readLocalData(Object& obj, Input& fr);
|
||||
bool ConvexPlanarOccluder_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
REGISTER_DOTOSGWRAPPER(ConvexPlanarOccluder)
|
||||
(
|
||||
new osg::ConvexPlanarOccluder,
|
||||
"ConvexPlanarOccluder",
|
||||
"Object ConvexPlanarOccluder",
|
||||
&ConvexPlanarOccluder_readLocalData,
|
||||
&ConvexPlanarOccluder_writeLocalData,
|
||||
DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool ConvexPlanarOccluder_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
ConvexPlanarOccluder& cpo = static_cast<ConvexPlanarOccluder&>(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<const ConvexPlanarOccluder&>(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;
|
||||
}
|
||||
@@ -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<CoordinateSystemNode&>(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<EllipsoidModel> s_ellipsoidModel = new EllipsoidModel;
|
||||
|
||||
EllipsoidModel* em = static_cast<EllipsoidModel*>(fr.readObjectOfType(*s_ellipsoidModel));
|
||||
if (em) csn.setEllipsoidModel(em);
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool CoordinateSystemNode_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const CoordinateSystemNode& csn = static_cast<const CoordinateSystemNode&>(obj);
|
||||
|
||||
fw.indent()<<"Format "<<fw.wrapString(csn.getFormat())<<std::endl;
|
||||
fw.indent()<<"CoordinateSystem "<<fw.wrapString(csn.getCoordinateSystem())<<std::endl;
|
||||
|
||||
if (csn.getEllipsoidModel())
|
||||
{
|
||||
fw.writeObject(*csn.getEllipsoidModel());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
#include "osg/CullFace"
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
|
||||
// forward declare functions to use later.
|
||||
bool CullFace_readLocalData(Object& obj, Input& fr);
|
||||
bool CullFace_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
REGISTER_DOTOSGWRAPPER(CullFace)
|
||||
(
|
||||
new osg::CullFace,
|
||||
"CullFace",
|
||||
"Object StateAttribute CullFace",
|
||||
&CullFace_readLocalData,
|
||||
&CullFace_writeLocalData
|
||||
);
|
||||
|
||||
|
||||
bool CullFace_readLocalData(Object& obj,Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
CullFace& cullface = static_cast<CullFace&>(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<const CullFace&>(obj);
|
||||
|
||||
switch(cullface.getMode())
|
||||
{
|
||||
case(CullFace::FRONT): fw.indent() << "mode FRONT" <<std::endl; break;
|
||||
case(CullFace::BACK): fw.indent() << "mode BACK" <<std::endl; break;
|
||||
case(CullFace::FRONT_AND_BACK): fw.indent() << "mode FRONT_AND_BACK" <<std::endl; break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
#include <osg/Shape>
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
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<Cylinder&>(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<const Cylinder&>(obj);
|
||||
|
||||
fw.indent()<<"Center "<<cylinder.getCenter()<<std::endl;
|
||||
fw.indent()<<"Radius "<<cylinder.getRadius()<<std::endl;
|
||||
fw.indent()<<"Height "<<cylinder.getHeight()<<std::endl;
|
||||
fw.indent()<<"Rotation "<<cylinder.getRotation()<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,120 +0,0 @@
|
||||
#include "osg/Depth"
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
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<Depth&>(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<const Depth&>(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 "";
|
||||
}
|
||||
@@ -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<Drawable&>(obj);
|
||||
|
||||
static ref_ptr<StateSet> s_drawstate = new osg::StateSet;
|
||||
if (StateSet* readState = static_cast<StateSet*>(fr.readObjectOfType(*s_drawstate)))
|
||||
{
|
||||
drawable.setStateSet(readState);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
Shape* shape = static_cast<Shape *>(fr.readObjectOfType(type_wrapper<Shape>()));
|
||||
if (shape)
|
||||
{
|
||||
drawable.setShape(shape);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
Drawable::UpdateCallback* uc = dynamic_cast<Drawable::UpdateCallback *>(fr.readObjectOfType(type_wrapper<Drawable::UpdateCallback>()));
|
||||
if (uc)
|
||||
{
|
||||
drawable.setUpdateCallback(uc);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
Drawable::CullCallback* cc = dynamic_cast<Drawable::CullCallback *>(fr.readObjectOfType(type_wrapper<Drawable::CullCallback>()));
|
||||
if (cc)
|
||||
{
|
||||
drawable.setCullCallback(cc);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
Drawable::DrawCallback* dc = dynamic_cast<Drawable::DrawCallback *>(fr.readObjectOfType(type_wrapper<Drawable::DrawCallback>()));
|
||||
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<Drawable::ComputeBoundingBoxCallback *>(fr.readObjectOfType(type_wrapper<Drawable::ComputeBoundingBoxCallback>()));
|
||||
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<const Drawable&>(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 "<<bb.xMin()<<" "<<bb.yMin()<<" "<<bb.zMin()<<" "
|
||||
<<bb.xMax()<<" "<<bb.yMax()<<" "<<bb.zMax()<<std::endl;
|
||||
}
|
||||
|
||||
if (drawable.getComputeBoundingBoxCallback())
|
||||
{
|
||||
fw.writeObject(*drawable.getComputeBoundingBoxCallback());
|
||||
}
|
||||
|
||||
|
||||
if (!drawable.getSupportsDisplayList())
|
||||
{
|
||||
fw.indent()<<"supportsDisplayList ";
|
||||
if (drawable.getSupportsDisplayList()) fw << "TRUE" << std::endl;
|
||||
else fw << "FALSE" << std::endl;
|
||||
}
|
||||
|
||||
fw.indent()<<"useDisplayList ";
|
||||
if (drawable.getUseDisplayList()) fw << "TRUE" << std::endl;
|
||||
else fw << "FALSE" << std::endl;
|
||||
|
||||
fw.indent()<<"useVertexBufferObjects ";
|
||||
if (drawable.getUseVertexBufferObjects()) fw << "TRUE" << std::endl;
|
||||
else fw << "FALSE" << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
#include "osg/CoordinateSystemNode"
|
||||
#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 EllipsoidModel_readLocalData(Object& obj, Input& fr);
|
||||
bool EllipsoidModel_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
REGISTER_DOTOSGWRAPPER(EllipsoidModel)
|
||||
(
|
||||
new osg::EllipsoidModel,
|
||||
"EllipsoidModel",
|
||||
"Object EllipsoidModel",
|
||||
&EllipsoidModel_readLocalData,
|
||||
&EllipsoidModel_writeLocalData,
|
||||
DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool EllipsoidModel_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
EllipsoidModel& em = static_cast<EllipsoidModel&>(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<const EllipsoidModel&>(obj);
|
||||
|
||||
int prec = fw.precision();
|
||||
fw.precision(15);
|
||||
|
||||
fw.indent()<<"RadiusEquator "<<em.getRadiusEquator()<<std::endl;
|
||||
fw.indent()<<"RadiusPolar "<<em.getRadiusPolar()<<std::endl;
|
||||
|
||||
fw.precision(prec);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( disable : 4786 )
|
||||
#endif
|
||||
|
||||
#include <osg/Fog>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
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<Fog&>(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<const Fog&>(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 "";
|
||||
}
|
||||
@@ -1,144 +0,0 @@
|
||||
#include <osg/FragmentProgram>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#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<FragmentProgram&>(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<const FragmentProgram&>(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<std::string> 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<std::string>::const_iterator j;
|
||||
for (j=lines.begin(); j!=lines.end(); ++j)
|
||||
{
|
||||
fw.indent() << "\"" << *j << "\"\n";
|
||||
}
|
||||
|
||||
fw.moveOut();
|
||||
fw.indent() << "}\n";
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -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<FrontFace&>(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<const FrontFace&>(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;
|
||||
}
|
||||
@@ -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<Geode&>(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<const Geode&>(obj);
|
||||
|
||||
fw.indent() << "num_drawables " << geode.getNumDrawables() << std::endl;
|
||||
|
||||
for(unsigned int i=0;i<geode.getNumDrawables();++i)
|
||||
{
|
||||
fw.writeObject(*geode.getDrawable(i));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,61 +0,0 @@
|
||||
#include "osg/Group"
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
|
||||
// forward declare functions to use later.
|
||||
bool Group_readLocalData(Object& obj, Input& fr);
|
||||
bool Group_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
REGISTER_DOTOSGWRAPPER(Group)
|
||||
(
|
||||
new osg::Group,
|
||||
"Group",
|
||||
"Object Node Group",
|
||||
&Group_readLocalData,
|
||||
&Group_writeLocalData
|
||||
);
|
||||
|
||||
bool Group_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
Group& group = static_cast<Group&>(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<const Group&>(obj);
|
||||
|
||||
if (group.getNumChildren()!=0) fw.indent() << "num_children " << group.getNumChildren() << std::endl;
|
||||
|
||||
for(unsigned int i=0;i<group.getNumChildren();++i)
|
||||
{
|
||||
fw.writeObject(*group.getChild(i));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1,183 +0,0 @@
|
||||
#include <osg/Shape>
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
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<HeightField&>(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<const HeightField&>(obj);
|
||||
|
||||
int prec = fw.precision();
|
||||
fw.precision(15);
|
||||
fw.indent()<<"Origin "<<heightfield.getOrigin().x()<<" "<<heightfield.getOrigin().y()<<" "<<heightfield.getOrigin().z()<<std::endl;
|
||||
fw.indent()<<"XInterval "<<heightfield.getXInterval()<<std::endl;
|
||||
fw.indent()<<"YInterval "<<heightfield.getYInterval()<<std::endl;
|
||||
fw.indent()<<"SkirtHeight "<<heightfield.getSkirtHeight()<<std::endl;
|
||||
fw.indent()<<"BorderWidth "<<heightfield.getBorderWidth()<<std::endl;
|
||||
fw.indent()<<"Rotation "<<heightfield.getRotation()<<std::endl;
|
||||
fw.precision(prec);
|
||||
|
||||
fw.indent()<<"NumColumnsAndRows "<<heightfield.getNumColumns()<<" "<<heightfield.getNumRows()<<std::endl;
|
||||
|
||||
fw.indent()<<"Heights"<<std::endl;
|
||||
|
||||
ParameterOutput po(fw);
|
||||
po.begin();
|
||||
for(unsigned int row=0;row<heightfield.getNumRows();++row)
|
||||
{
|
||||
for(unsigned int column=0;column<heightfield.getNumColumns();++column)
|
||||
{
|
||||
po.write(heightfield.getHeight(column,row));
|
||||
}
|
||||
po.newLine();
|
||||
}
|
||||
po.end();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
#include "osg/Image"
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
|
||||
// forward declare functions to use later.
|
||||
bool Image_readLocalData(Object& obj, Input& fr);
|
||||
bool Image_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
REGISTER_DOTOSGWRAPPER(Image)
|
||||
(
|
||||
new osg::Image,
|
||||
"Image",
|
||||
"Object Image",
|
||||
&Image_readLocalData,
|
||||
&Image_writeLocalData
|
||||
);
|
||||
|
||||
bool Image_readLocalData(Object& /*obj*/, Input& /*fr*/)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
// Image& image = static_cast<Image&>(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<const Image&>(obj);
|
||||
|
||||
// no current image writing code here
|
||||
// as it is all handled by osg::Registry::writeImage() via plugins.
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -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<ImageSequence&>(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<osg::Image> 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<const ImageSequence&>(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"<<std::endl;
|
||||
break;
|
||||
case(osg::ImageSequence::PAGE_AND_RETAIN_IMAGES):
|
||||
fw.indent()<<"Mode PAGE_AND_RETAIN_IMAGES"<<std::endl;
|
||||
break;
|
||||
case(osg::ImageSequence::PAGE_AND_DISCARD_USED_IMAGES):
|
||||
fw.indent()<<"Mode PAGE_AND_DISCARD_USED_IMAGES"<<std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
fw.indent()<<"Length "<<is.getLength()<<std::endl;
|
||||
|
||||
if (!is.getFileNames().empty())
|
||||
{
|
||||
fw.indent()<<"FileNames {"<<std::endl;
|
||||
fw.moveIn();
|
||||
|
||||
const osg::ImageSequence::FileNames& names = is.getFileNames();
|
||||
for(osg::ImageSequence::FileNames::const_iterator itr = names.begin();
|
||||
itr != names.end();
|
||||
++itr)
|
||||
{
|
||||
fw.indent()<<fw.wrapString(*itr)<<std::endl;
|
||||
}
|
||||
|
||||
fw.moveOut();
|
||||
fw.indent()<<"}"<<std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
fw.indent()<<"Images {"<<std::endl;
|
||||
fw.moveIn();
|
||||
|
||||
const osg::ImageSequence::Images& images = is.getImages();
|
||||
for(osg::ImageSequence::Images::const_iterator itr = images.begin();
|
||||
itr != images.end();
|
||||
++itr)
|
||||
{
|
||||
if (!(*itr)->getFileName().empty()) fw.indent()<<fw.wrapString((*itr)->getFileName())<<std::endl;
|
||||
}
|
||||
|
||||
fw.moveOut();
|
||||
fw.indent()<<"}"<<std::endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,169 +0,0 @@
|
||||
#include "osg/LOD"
|
||||
#include <osg/io_utils>
|
||||
|
||||
#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<LOD&>(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<const LOD&>(obj);
|
||||
|
||||
if (lod.getCenterMode()==osg::LOD::USER_DEFINED_CENTER) fw.indent() << "Center "<< lod.getCenter() << std::endl;
|
||||
|
||||
fw.indent() << "Radius "<<lod.getRadius()<<std::endl;
|
||||
|
||||
if(lod.getRangeMode()==osg::LOD::DISTANCE_FROM_EYE_POINT){
|
||||
fw.indent() << "RangeMode DISTANCE_FROM_EYE_POINT"<<std::endl;
|
||||
}
|
||||
else {
|
||||
fw.indent() << "RangeMode PIXEL_SIZE_ON_SCREEN"<<std::endl;
|
||||
}
|
||||
|
||||
fw.indent() << "RangeList "<<lod.getNumRanges()<<" {"<< std::endl;
|
||||
fw.moveIn();
|
||||
|
||||
for(unsigned int i=0; i<lod.getNumRanges();++i)
|
||||
{
|
||||
fw.indent() << lod.getMinRange(i) << " "<<lod.getMaxRange(i)<<std::endl;
|
||||
}
|
||||
fw.moveOut();
|
||||
fw.indent() << "}"<< std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( disable : 4786 )
|
||||
#endif
|
||||
|
||||
#include "osg/Light"
|
||||
#include <osg/io_utils>
|
||||
|
||||
#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<Light&>(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<const Light&>(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;
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
#include <osg/LightModel>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
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<LightModel&>(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<const LightModel&>(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;
|
||||
}
|
||||
|
||||
@@ -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<LightSource&>(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<StateAttribute> sa=fr.readStateAttribute();
|
||||
osg::Light* light = dynamic_cast<Light*>(sa.get());
|
||||
if (light)
|
||||
{
|
||||
lightsource.setLight(light);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool LightSource_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const LightSource& lightsource = static_cast<const LightSource&>(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;
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
#include <osg/LineStipple>
|
||||
|
||||
#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 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<LineStipple&>(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<const LineStipple&>(obj);
|
||||
|
||||
fw.indent() << "factor " << linestipple.getFactor() << std::endl;
|
||||
fw.indent() << "pattern 0x" << hex << linestipple.getPattern() << dec << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( disable : 4786 )
|
||||
#endif
|
||||
|
||||
#include <osg/LineWidth>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
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<LineWidth&>(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<const LineWidth&>(obj);
|
||||
|
||||
fw.indent() << "width " << lineWidth.getWidth() << std::endl;
|
||||
return true;
|
||||
}
|
||||
@@ -1,254 +0,0 @@
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( disable : 4786 )
|
||||
#endif
|
||||
|
||||
#include "osg/Material"
|
||||
#include <osg/io_utils>
|
||||
|
||||
#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<Material&>(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<const Material&>(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;
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#ifndef DOTOSG_MATRIX
|
||||
#define DOTOSG_MATRIX
|
||||
|
||||
#include <osg/Matrix>
|
||||
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
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
|
||||
@@ -1,79 +0,0 @@
|
||||
#include <osg/MatrixTransform>
|
||||
|
||||
#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 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<MatrixTransform&>(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<const MatrixTransform&>(obj);
|
||||
|
||||
writeMatrix(transform.getMatrix(),fw);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -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<Node&>(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<StateSet> s_drawstate = new osg::StateSet;
|
||||
if (StateSet* readState = static_cast<StateSet*>(fr.readObjectOfType(*s_drawstate)))
|
||||
{
|
||||
node.setStateSet(readState);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
|
||||
static ref_ptr<NodeCallback> 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<NodeCallback*>(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<NodeCallback*>(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<NodeCallback*>(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<Node::ComputeBoundingSphereCallback*>(fr.readObjectOfType(type_wrapper<Node::ComputeBoundingSphereCallback>()));
|
||||
if (callback) {
|
||||
node.setComputeBoundingSphereCallback(callback);
|
||||
}
|
||||
else ++fr;
|
||||
}
|
||||
iteratorAdvanced = true;
|
||||
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool Node_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const Node& node = static_cast<const Node&>(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 "<<fw.wrapString(node.getDescriptions().front())<< std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
fw.indent() << "description {"<< std::endl;
|
||||
fw.moveIn();
|
||||
for(Node::DescriptionList::const_iterator ditr=node.getDescriptions().begin();
|
||||
ditr!=node.getDescriptions().end();
|
||||
++ditr)
|
||||
{
|
||||
fw.indent() << fw.wrapString(*ditr)<< std::endl;
|
||||
}
|
||||
fw.moveOut();
|
||||
fw.indent() << "}"<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
if (node.getStateSet())
|
||||
{
|
||||
fw.writeObject(*node.getStateSet());
|
||||
}
|
||||
|
||||
if (node.getUpdateCallback())
|
||||
{
|
||||
fw.indent() << "UpdateCallbacks {" << std::endl;
|
||||
fw.moveIn();
|
||||
fw.writeObject(*node.getUpdateCallback());
|
||||
fw.moveOut();
|
||||
fw.indent() << "}" << std::endl;
|
||||
}
|
||||
|
||||
if (node.getEventCallback())
|
||||
{
|
||||
fw.indent() << "EventCallbacks {" << std::endl;
|
||||
fw.moveIn();
|
||||
fw.writeObject(*node.getEventCallback());
|
||||
fw.moveOut();
|
||||
fw.indent() << "}" << std::endl;
|
||||
}
|
||||
|
||||
if (node.getCullCallback())
|
||||
{
|
||||
fw.indent() << "CullCallbacks {" << std::endl;
|
||||
fw.moveIn();
|
||||
fw.writeObject(*node.getCullCallback());
|
||||
fw.moveOut();
|
||||
fw.indent() << "}" << std::endl;
|
||||
}
|
||||
|
||||
if (node.getInitialBound().valid())
|
||||
{
|
||||
const osg::BoundingSphere& bs = node.getInitialBound();
|
||||
fw.indent()<<"initialBound "<<bs.center()<<" "<<bs.radius()<<std::endl;
|
||||
}
|
||||
|
||||
if (node.getComputeBoundingSphereCallback())
|
||||
{
|
||||
fw.indent() << "ComputeBoundingSphereCallback {" << std::endl;
|
||||
fw.moveIn();
|
||||
fw.writeObject(*node.getComputeBoundingSphereCallback());
|
||||
fw.moveOut();
|
||||
fw.indent() << "}" << std::endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
#include <osg/Notify>
|
||||
|
||||
#include <osg/NodeCallback>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
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<NodeCallback&>(obj);
|
||||
if (!(&nc)) return false;
|
||||
|
||||
bool itrAdvanced = false;
|
||||
|
||||
static osg::ref_ptr<NodeCallback> s_nc = new NodeCallback;
|
||||
osg::ref_ptr<osg::Object> object = fr.readObjectOfType(*s_nc);
|
||||
if (object.valid())
|
||||
{
|
||||
NodeCallback* ncc = dynamic_cast<NodeCallback*>(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<const NodeCallback*>(&obj);
|
||||
if (!nc) return false;
|
||||
|
||||
NodeCallback* nnc = (NodeCallback*) nc;
|
||||
|
||||
if (nnc->getNestedCallback())
|
||||
{
|
||||
fw.writeObject(*(nnc->getNestedCallback()));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -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 "<<object<< std::endl;
|
||||
++fr;
|
||||
}
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool Object_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
switch(obj.getDataVariance())
|
||||
{
|
||||
case(osg::Object::STATIC): fw.indent() << "DataVariance STATIC" << std::endl;break;
|
||||
case(osg::Object::DYNAMIC): fw.indent() << "DataVariance DYNAMIC" << std::endl;break;
|
||||
case(osg::Object::UNSPECIFIED): break; // fw.indent() << "DataVariance UNSPECIFIED" << std::endl;break;
|
||||
}
|
||||
|
||||
if (!obj.getName().empty()) fw.indent() << "name "<<fw.wrapString(obj.getName())<< std::endl;
|
||||
|
||||
if (obj.getUserData())
|
||||
{
|
||||
const Object* object = dynamic_cast<const Object*>(obj.getUserData());
|
||||
if (object)
|
||||
{
|
||||
fw.indent() << "UserData {"<< std::endl;
|
||||
fw.moveIn();
|
||||
fw.writeObject(*object);
|
||||
fw.moveOut();
|
||||
fw.indent() << "}"<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -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<OccluderNode&>(obj);
|
||||
|
||||
static ref_ptr<ConvexPlanarOccluder> s_occluder = new ConvexPlanarOccluder;
|
||||
|
||||
ConvexPlanarOccluder* tmpOccluder = static_cast<ConvexPlanarOccluder*>(fr.readObjectOfType(*s_occluder));
|
||||
|
||||
if (tmpOccluder)
|
||||
{
|
||||
occludernode.setOccluder(tmpOccluder);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool OccluderNode_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const OccluderNode& occludernode = static_cast<const OccluderNode&>(obj);
|
||||
|
||||
if (occludernode.getOccluder())
|
||||
{
|
||||
fw.writeObject(*occludernode.getOccluder());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -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 <osg/OcclusionQueryNode>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
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<osg::OcclusionQueryNode&>( 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<const osg::OcclusionQueryNode&>( 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;
|
||||
}
|
||||
@@ -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<PagedLOD&>(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<const PagedLOD&>(obj);
|
||||
|
||||
|
||||
if (!lod.getDatabasePath().empty())
|
||||
{
|
||||
fw.indent() << "DatabasePath "<<lod.getDatabasePath()<<std::endl;
|
||||
}
|
||||
|
||||
fw.indent() << "NumChildrenThatCannotBeExpired "<<lod.getNumChildrenThatCannotBeExpired()<<std::endl;
|
||||
|
||||
fw.indent() << "DisableExternalChildrenPaging "<<lod.getDisableExternalChildrenPaging()<<std::endl;
|
||||
|
||||
|
||||
fw.indent() << "FileNameList "<<lod.getNumFileNames()<<" {"<< std::endl;
|
||||
fw.moveIn();
|
||||
|
||||
unsigned int numChildrenToWriteOut = 0;
|
||||
|
||||
for(unsigned int i=0; i<lod.getNumFileNames();++i)
|
||||
{
|
||||
if (lod.getFileName(i).empty())
|
||||
{
|
||||
fw.indent() << "\"\"" << std::endl;
|
||||
++numChildrenToWriteOut;
|
||||
}
|
||||
else
|
||||
{
|
||||
fw.indent() << lod.getFileName(i) << std::endl;
|
||||
}
|
||||
}
|
||||
fw.moveOut();
|
||||
fw.indent() << "}"<< std::endl;
|
||||
|
||||
fw.indent() << "num_children " << numChildrenToWriteOut << std::endl;
|
||||
for(unsigned int j=0;j<lod.getNumChildren();++j)
|
||||
{
|
||||
if (lod.getFileName(j).empty())
|
||||
{
|
||||
fw.writeObject(*lod.getChild(j));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( disable : 4786 )
|
||||
#endif
|
||||
|
||||
#include "osg/Point"
|
||||
#include <osg/io_utils>
|
||||
|
||||
#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<Point&>(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<const Point&>(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;
|
||||
}
|
||||
@@ -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<PointSprite&>(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<const PointSprite&>(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;
|
||||
}
|
||||
@@ -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<PolygonMode&>(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<const PolygonMode&>(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;
|
||||
}
|
||||
@@ -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<PolygonOffset&>(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<const PolygonOffset&>(obj);
|
||||
|
||||
fw.indent() << "factor " << polygonoffset.getFactor() << std::endl;
|
||||
fw.indent() << "units " << polygonoffset.getUnits() << std::endl;
|
||||
return true;
|
||||
}
|
||||
@@ -1,100 +0,0 @@
|
||||
#include "osg/PositionAttitudeTransform"
|
||||
#include <osg/io_utils>
|
||||
|
||||
#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<PositionAttitudeTransform&>(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<const PositionAttitudeTransform&>(obj);
|
||||
|
||||
fw.indent()<<"position "<<transform.getPosition()<<std::endl;
|
||||
fw.indent()<<"attitude "<<transform.getAttitude()<<std::endl;
|
||||
fw.indent()<<"scale "<<transform.getScale()<<std::endl;
|
||||
fw.indent()<<"pivotPoint "<<transform.getPivotPoint()<<std::endl;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
#include "osg/Program"
|
||||
#include "osg/Shader"
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
using namespace std;
|
||||
|
||||
extern bool Geometry_matchPrimitiveModeStr(const char* str, GLenum& mode);
|
||||
extern const char* Geometry_getPrimitiveModeStr(GLenum mode);
|
||||
|
||||
// forward declare functions to use later.
|
||||
bool Program_readLocalData(Object& obj, Input& fr);
|
||||
bool Program_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
REGISTER_DOTOSGWRAPPER(Program)
|
||||
(
|
||||
new osg::Program,
|
||||
"Program",
|
||||
"Object StateAttribute Program",
|
||||
&Program_readLocalData,
|
||||
&Program_writeLocalData
|
||||
);
|
||||
|
||||
|
||||
bool Program_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
Program& program = static_cast<Program&>(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<Shader*>(object));
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool Program_writeLocalData(const Object& obj,Output& fw)
|
||||
{
|
||||
const Program& program = static_cast<const Program&>(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<program.getNumShaders();++ic)
|
||||
{
|
||||
fw.writeObject(*program.getShader(ic));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
#include <osg/Projection>
|
||||
#include <osg/Matrix>
|
||||
|
||||
#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<Projection &>(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<const Projection&>(obj);
|
||||
|
||||
writeMatrix(myobj.getMatrix(),fw);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,274 +0,0 @@
|
||||
#include "osg/ProxyNode"
|
||||
#include "osg/Notify"
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/WriteFile>
|
||||
#include <osgDB/FileUtils>
|
||||
#include <osgDB/FileNameUtils>
|
||||
|
||||
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<ProxyNode&>(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; i<num_children; i++)
|
||||
{
|
||||
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)));
|
||||
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.getNumFileNames(); i++)
|
||||
{
|
||||
if(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<const ProxyNode&>(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" <<std::endl;
|
||||
break;
|
||||
case ProxyNode::DEFER_LOADING_TO_DATABASE_PAGER:
|
||||
fw.indent() << "DEFER_LOADING_TO_DATABASE_PAGER" <<std::endl;
|
||||
break;
|
||||
case ProxyNode::NO_AUTOMATIC_LOADING:
|
||||
fw.indent() << "NO_AUTOMATIC_LOADING" <<std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
fw.indent() << "Radius "<<proxyNode.getRadius()<<std::endl;
|
||||
|
||||
fw.indent() << "FileNameList "<<proxyNode.getNumFileNames()<<" {"<< std::endl;
|
||||
fw.moveIn();
|
||||
|
||||
unsigned int numChildrenToWriteOut = 0;
|
||||
|
||||
for(unsigned int i=0; i<proxyNode.getNumFileNames();++i)
|
||||
{
|
||||
if (proxyNode.getFileName(i).empty())
|
||||
{
|
||||
fw.indent() << "\"\"" << std::endl;
|
||||
++numChildrenToWriteOut;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(useOriginalExternalReferences)
|
||||
{
|
||||
fw.indent() << proxyNode.getFileName(i) << std::endl;
|
||||
}
|
||||
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) ;
|
||||
fw.indent() << osgname << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
fw.moveOut();
|
||||
fw.indent() << "}"<< std::endl;
|
||||
|
||||
|
||||
if(includeExternalReferences) //out->getIncludeExternalReferences()) // inlined mode
|
||||
{
|
||||
fw.indent() << "num_children " << proxyNode.getNumChildren() << std::endl;
|
||||
for(unsigned int i=0; i<proxyNode.getNumChildren(); i++)
|
||||
{
|
||||
fw.writeObject(*proxyNode.getChild(i));
|
||||
}
|
||||
}
|
||||
else //----------------------------------------- no inlined mode
|
||||
{
|
||||
fw.indent() << "num_children " << numChildrenToWriteOut << std::endl;
|
||||
for(unsigned int i=0; i<proxyNode.getNumChildren(); ++i)
|
||||
{
|
||||
if (proxyNode.getFileName(i).empty())
|
||||
{
|
||||
fw.writeObject(*proxyNode.getChild(i));
|
||||
}
|
||||
else if(writeExternalReferenceFiles) //out->getWriteExternalReferenceFiles())
|
||||
{
|
||||
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;
|
||||
}
|
||||
@@ -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.
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <osg/Image>
|
||||
#include <osg/Group>
|
||||
#include <osg/Notify>
|
||||
#include <osg/Version>
|
||||
|
||||
#include <osgDB/FileNameUtils>
|
||||
#include <osgDB/FileUtils>
|
||||
@@ -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"<<std::endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"Constructor OSGReaderWriter - failed to load"<<std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
virtual const char* className() const { return "OSG Reader/Writer"; }
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
#include "osg/Scissor"
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
|
||||
// forward declare functions to use later.
|
||||
bool Scissor_readLocalData(Object& obj, Input& fr);
|
||||
bool Scissor_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
REGISTER_DOTOSGWRAPPER(Scissor)
|
||||
(
|
||||
new osg::Scissor,
|
||||
"Scissor",
|
||||
"Object StateAttribute Scissor",
|
||||
&Scissor_readLocalData,
|
||||
&Scissor_writeLocalData
|
||||
);
|
||||
|
||||
|
||||
bool Scissor_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
int x = 0, y = 0, width = 0, height = 0;
|
||||
|
||||
|
||||
if (fr[0].matchWord("x") && fr[1].getInt(x))
|
||||
{
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("y") && fr[1].getInt(y))
|
||||
{
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("width") && fr[1].getInt(width))
|
||||
{
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
if (fr[0].matchWord("height") && fr[1].getInt(height))
|
||||
{
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
Scissor& scissor = static_cast<Scissor&>(obj);
|
||||
scissor.setScissor( x, y, width, height );
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool Scissor_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const Scissor& scissor = static_cast<const Scissor&>(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;
|
||||
}
|
||||
@@ -1,238 +0,0 @@
|
||||
#include "osg/Sequence"
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
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<Sequence&>(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<const Sequence&>(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;
|
||||
}
|
||||
@@ -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<ShadeModel&>(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<const ShadeModel&>(obj);
|
||||
|
||||
switch(shademodel.getMode())
|
||||
{
|
||||
case(ShadeModel::FLAT): fw.indent() << "mode FLAT" <<std::endl; break;
|
||||
case(ShadeModel::SMOOTH): fw.indent() << "mode SMOOTH" <<std::endl; break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
#include "osg/Shader"
|
||||
#include "osg/Notify"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
#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<Shader&>(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 \""<<fr[1].getStr()<<"\""<<std::endl;
|
||||
}
|
||||
|
||||
fr += 2;
|
||||
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;
|
||||
}
|
||||
shader.setShaderSource(code.c_str());
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool Shader_writeLocalData(const Object& obj,Output& fw)
|
||||
{
|
||||
const Shader& shader = static_cast<const Shader&>(obj);
|
||||
|
||||
fw.indent() << "type " << shader.getTypename() << std::endl;
|
||||
|
||||
// osg::notify(osg::NOTICE)<<"fw.getOutputShaderFiles()="<<fw.getOutputShaderFiles()<<std::endl;
|
||||
|
||||
// check whenever output to shader files is requested
|
||||
if (fw.getOutputShaderFiles())
|
||||
{
|
||||
std::string fileName = shader.getFileName();
|
||||
|
||||
if (fileName.empty())
|
||||
{
|
||||
fileName = fw.getShaderFileNameForOutput();
|
||||
}
|
||||
|
||||
osgDB::writeShaderFile(shader, fileName);
|
||||
|
||||
if (!fileName.empty())
|
||||
{
|
||||
fw.indent() << "file "<<fw.wrapString(fw.getFileNameForOutput(fileName))<< std::endl;
|
||||
}
|
||||
|
||||
}
|
||||
else // no need to write shaders to external files, hence embed it
|
||||
{
|
||||
|
||||
// split source text into individual lines
|
||||
std::vector<std::string> 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<std::string>::const_iterator j;
|
||||
for (j=lines.begin(); j!=lines.end(); ++j) {
|
||||
fw.indent() << fw.wrapString(*j) << "\n";
|
||||
}
|
||||
|
||||
fw.moveOut();
|
||||
fw.indent() << "}\n";
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
#include <osg/ShapeDrawable>
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
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<ShapeDrawable&>(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<Object> readObject = fr.readObjectOfType(type_wrapper<TessellationHints>());
|
||||
if (readObject.valid()) {
|
||||
TessellationHints* hints = static_cast<TessellationHints*>(readObject.get());
|
||||
geom.setTessellationHints(hints);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
bool ShapeDrawable_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const ShapeDrawable& geom = static_cast<const ShapeDrawable&>(obj);
|
||||
|
||||
fw.indent() << "color " << geom.getColor() << std::endl;
|
||||
|
||||
const TessellationHints* hints = geom.getTessellationHints();
|
||||
if (hints)
|
||||
fw.writeObject(*hints);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
#include <osg/Shape>
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
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<Sphere&>(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<const Sphere&>(obj);
|
||||
|
||||
fw.indent()<<"Center "<<sphere.getCenter()<<std::endl;
|
||||
fw.indent()<<"Radius "<<sphere.getRadius()<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1,81 +0,0 @@
|
||||
#include "osg/StateAttribute"
|
||||
|
||||
#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 StateAttribute_readLocalData(Object& obj, Input& fr);
|
||||
bool StateAttribute_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
osg::StateAttribute* g_stateAttribute = 0;
|
||||
REGISTER_DOTOSGWRAPPER(StateAttribute)
|
||||
(
|
||||
g_stateAttribute, // no instance, osg::StateAttribute is an abstract class.
|
||||
"StateAttribute",
|
||||
"Object StateAttribute",
|
||||
&StateAttribute_readLocalData,
|
||||
&StateAttribute_writeLocalData
|
||||
);
|
||||
|
||||
|
||||
bool StateAttribute_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
StateAttribute& stateAttribute = static_cast<StateAttribute&>(obj);
|
||||
|
||||
static ref_ptr<StateAttributeCallback> s_callback = new osg::StateAttributeCallback;
|
||||
while (fr.matchSequence("UpdateCallback {"))
|
||||
{
|
||||
//int entry = fr[0].getNoNestedBrackets();
|
||||
fr += 2;
|
||||
StateAttributeCallback* callback = dynamic_cast<StateAttributeCallback*>(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<StateAttributeCallback*>(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<const StateAttribute&>(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;
|
||||
}
|
||||
@@ -1,727 +0,0 @@
|
||||
#include <osg/StateSet>
|
||||
#include <osg/Texture1D>
|
||||
#include <osg/Texture2D>
|
||||
#include <osg/TextureCubeMap>
|
||||
#include <osg/TextureRectangle>
|
||||
#include <osg/TexGen>
|
||||
#include <osg/PolygonOffset>
|
||||
#include <osg/LineStipple>
|
||||
#include <osg/Light>
|
||||
#include <osg/ClipPlane>
|
||||
#include <osg/AlphaFunc>
|
||||
#include <osg/Point>
|
||||
#include <osg/Material>
|
||||
#include <osg/Fog>
|
||||
#include <osg/GL2Extensions>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
#include <OpenThreads/Mutex>
|
||||
#include <OpenThreads/ScopedLock>
|
||||
|
||||
#include <set>
|
||||
#include <string.h>
|
||||
|
||||
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<std::string,StateAttribute::GLMode> GLNameToGLModeMap;
|
||||
typedef std::map<StateAttribute::GLMode,std::string> GLModeToGLNameMap;
|
||||
typedef std::set<StateAttribute::GLMode> 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<OpenThreads::Mutex> 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 ["<<itr->first<<","<<itr->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<StateSet&>(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<StateSet&>(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<StateSet::Callback> s_callback = new osg::StateSet::Callback;
|
||||
while (fr.matchSequence("UpdateCallback {"))
|
||||
{
|
||||
// int entry = fr[0].getNoNestedBrackets();
|
||||
fr += 2;
|
||||
StateSet::Callback* callback = dynamic_cast<StateSet::Callback*>(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<StateSet::Callback*>(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<class T>
|
||||
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<const StateSet&>(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<<stateset.getRenderingHint()<< std::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
fw.indent()<<"renderBinMode "<<StateSet_getRenderBinModeStr(stateset.getRenderBinMode())<< std::endl;
|
||||
if (stateset.getRenderBinMode()!=StateSet::INHERIT_RENDERBIN_DETAILS)
|
||||
{
|
||||
fw.indent()<<"binNumber "<<stateset.getBinNumber()<< std::endl;
|
||||
fw.indent()<<"binName "<<stateset.getBinName()<< std::endl;
|
||||
}
|
||||
|
||||
|
||||
const StateSet::ModeList& ml = stateset.getModeList();
|
||||
for(StateSet::ModeList::const_iterator mitr=ml.begin();
|
||||
mitr!=ml.end();
|
||||
++mitr)
|
||||
{
|
||||
GLModeToGLNameMap::iterator nitr = s_GLModeToGLNameMap.find(mitr->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;unit<maxUnit;++unit)
|
||||
{
|
||||
fw.indent()<<"textureUnit "<<unit<<" {"<< std::endl;
|
||||
fw.moveIn();
|
||||
|
||||
if (unit<tml.size())
|
||||
{
|
||||
const StateSet::ModeList& ml = tml[unit];
|
||||
for(StateSet::ModeList::const_iterator mitr=ml.begin();
|
||||
mitr!=ml.end();
|
||||
++mitr)
|
||||
{
|
||||
GLModeToGLNameMap::iterator nitr = s_GLModeToGLNameMap.find(mitr->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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (unit<tal.size())
|
||||
{
|
||||
const StateSet::AttributeList& sl = tal[unit];
|
||||
for(StateSet::AttributeList::const_iterator sitr=sl.begin();
|
||||
sitr!=sl.end();
|
||||
++sitr)
|
||||
{
|
||||
fw.writeObject(*(sitr->second.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 "";
|
||||
}
|
||||
@@ -1,184 +0,0 @@
|
||||
#include "osg/Stencil"
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
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<Stencil&>(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<const Stencil&>(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 "";
|
||||
}
|
||||
|
||||
@@ -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<Switch&>(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<const Switch&>(obj);
|
||||
|
||||
|
||||
fw.indent()<<"NewChildDefaultValue "<<sw.getNewChildDefaultValue()<<std::endl;
|
||||
|
||||
fw.indent()<<"ValueList {"<< std::endl;
|
||||
fw.moveIn();
|
||||
const Switch::ValueList& values = sw.getValueList();
|
||||
for(Switch::ValueList::const_iterator itr=values.begin();
|
||||
itr!=values.end();
|
||||
++itr)
|
||||
{
|
||||
fw.indent()<<*itr<<std::endl;
|
||||
}
|
||||
fw.moveOut();
|
||||
fw.indent()<<"}"<< std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
#include <osg/ShapeDrawable>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
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<TessellationHints&>(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<const TessellationHints&>(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;
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
#include "osg/TexEnv"
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
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<TexEnv&>(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<const TexEnv&>(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 "";
|
||||
}
|
||||
|
||||
@@ -1,289 +0,0 @@
|
||||
#include "osg/TexEnvCombine"
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
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<TexEnvCombine&>(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<const TexEnvCombine&>(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 "";
|
||||
}
|
||||
|
||||
@@ -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<TexEnvFilter&>(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<const TexEnvFilter&>(obj);
|
||||
|
||||
fw.indent() << "lodBias " << texenvfilter.getLodBias() << std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -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 <string.h>
|
||||
|
||||
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<TexGen&>(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<const TexGen&>(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;
|
||||
}
|
||||
@@ -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<TexGenNode&>(obj);
|
||||
|
||||
unsigned int textureUnit = 0;
|
||||
if (fr[0].matchWord("TextureUnit") && fr[1].getUInt(textureUnit))
|
||||
{
|
||||
|
||||
texGenNode.setTextureUnit(textureUnit);
|
||||
|
||||
fr+=2;
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
|
||||
osg::ref_ptr<StateAttribute> sa=0;
|
||||
while((sa=fr.readStateAttribute())!=0)
|
||||
{
|
||||
TexGen* texgen = dynamic_cast<TexGen*>(sa.get());
|
||||
if (texgen) texGenNode.setTexGen(texgen);
|
||||
iteratorAdvanced = true;
|
||||
}
|
||||
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool TexGenNode_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const TexGenNode& texGenNode = static_cast<const TexGenNode&>(obj);
|
||||
|
||||
fw.indent()<<"TextureUnit "<<texGenNode.getTextureUnit()<<std::endl;
|
||||
|
||||
if (texGenNode.getTexGen())
|
||||
{
|
||||
fw.writeObject(*texGenNode.getTexGen());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
#include <osg/TexMat>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
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<TexMat&>(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<const TexMat&>(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"<<std::endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,542 +0,0 @@
|
||||
#include <osg/Texture>
|
||||
#include <osg/Notify>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
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<Texture&>(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<const Texture&>(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;
|
||||
}
|
||||
@@ -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<Texture1D&>(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<const Texture1D&>(obj);
|
||||
|
||||
if (texture.getImage())
|
||||
{
|
||||
const osg::ImageSequence* is = dynamic_cast<const osg::ImageSequence*>(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 "<<fw.wrapString(fw.getFileNameForOutput(fileName))<< std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,107 +0,0 @@
|
||||
#include "osg/Texture2D"
|
||||
#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 Texture2D_readLocalData(Object& obj, Input& fr);
|
||||
bool Texture2D_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
bool Texture2D_matchWrapStr(const char* str,Texture2D::WrapMode& wrap);
|
||||
const char* Texture2D_getWrapStr(Texture2D::WrapMode wrap);
|
||||
bool Texture2D_matchFilterStr(const char* str,Texture2D::FilterMode& filter);
|
||||
const char* Texture2D_getFilterStr(Texture2D::FilterMode filter);
|
||||
bool Texture2D_matchInternalFormatModeStr(const char* str,Texture2D::InternalFormatMode& mode);
|
||||
const char* Texture2D_getInternalFormatModeStr(Texture2D::InternalFormatMode mode);
|
||||
bool Texture2D_matchInternalFormatStr(const char* str,int& value);
|
||||
const char* Texture2D_getInternalFormatStr(int value);
|
||||
|
||||
REGISTER_DOTOSGWRAPPER(OldTexture)
|
||||
(
|
||||
new osg::Texture2D,
|
||||
"Texture",
|
||||
"Object StateAttribute Texture2D TextureBase",
|
||||
0,
|
||||
0
|
||||
);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
REGISTER_DOTOSGWRAPPER(Texture2D)
|
||||
(
|
||||
new osg::Texture2D,
|
||||
"Texture2D",
|
||||
"Object StateAttribute Texture2D TextureBase",
|
||||
&Texture2D_readLocalData,
|
||||
&Texture2D_writeLocalData
|
||||
);
|
||||
|
||||
bool Texture2D_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
Texture2D& texture = static_cast<Texture2D&>(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<const Texture2D&>(obj);
|
||||
|
||||
if (texture.getImage())
|
||||
{
|
||||
const osg::ImageSequence* is = dynamic_cast<const osg::ImageSequence*>(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 "<<fw.wrapString(fw.getFileNameForOutput(fileName))<< std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
#include "osg/Texture3D"
|
||||
#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 Texture3D_readLocalData(Object& obj, Input& fr);
|
||||
bool Texture3D_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
bool Texture3D_matchWrapStr(const char* str,Texture3D::WrapMode& wrap);
|
||||
const char* Texture3D_getWrapStr(Texture3D::WrapMode wrap);
|
||||
bool Texture3D_matchFilterStr(const char* str,Texture3D::FilterMode& filter);
|
||||
const char* Texture3D_getFilterStr(Texture3D::FilterMode filter);
|
||||
bool Texture3D_matchInternalFormatModeStr(const char* str,Texture3D::InternalFormatMode& mode);
|
||||
const char* Texture3D_getInternalFormatModeStr(Texture3D::InternalFormatMode mode);
|
||||
bool Texture3D_matchInternalFormatStr(const char* str,int& value);
|
||||
const char* Texture3D_getInternalFormatStr(int value);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
REGISTER_DOTOSGWRAPPER(Texture3D)
|
||||
(
|
||||
new osg::Texture3D,
|
||||
"Texture3D",
|
||||
"Object StateAttribute Texture3D TextureBase",
|
||||
&Texture3D_readLocalData,
|
||||
&Texture3D_writeLocalData
|
||||
);
|
||||
|
||||
bool Texture3D_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
Texture3D& texture = static_cast<Texture3D&>(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<const Texture3D&>(obj);
|
||||
|
||||
if (texture.getImage())
|
||||
{
|
||||
const osg::ImageSequence* is = dynamic_cast<const osg::ImageSequence*>(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 "<<fw.wrapString(fw.getFileNameForOutput(fileName))<< std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,114 +0,0 @@
|
||||
#include "osg/TextureCubeMap"
|
||||
#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 TextureCubeMap_readLocalData(Object& obj, Input& fr);
|
||||
bool TextureCubeMap_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
REGISTER_DOTOSGWRAPPER(TextureCubeMap)
|
||||
(
|
||||
new osg::TextureCubeMap,
|
||||
"TextureCubeMap",
|
||||
"Object StateAttribute TextureCubeMap TextureBase",
|
||||
&TextureCubeMap_readLocalData,
|
||||
&TextureCubeMap_writeLocalData
|
||||
);
|
||||
|
||||
|
||||
#define READ_IMAGE(FACE)\
|
||||
matched = false;\
|
||||
if (fr[1].matchWord(#FACE)) \
|
||||
{\
|
||||
if (fr[2].matchWord("ImageSequence") || fr[2].matchWord("Image")) \
|
||||
{ \
|
||||
fr += 2;\
|
||||
osg::Image* image = fr.readImage(); \
|
||||
if (image) texture.setImage(osg::TextureCubeMap::FACE,image); \
|
||||
iteratorAdvanced = true; \
|
||||
matched = true;\
|
||||
} \
|
||||
else if (fr[2].isString())\
|
||||
{ \
|
||||
Image* image = fr.readImage(fr[2].getStr());\
|
||||
if (image) texture.setImage(osg::TextureCubeMap::FACE,image);\
|
||||
fr += 3;\
|
||||
iteratorAdvanced = true; \
|
||||
matched = true;\
|
||||
}\
|
||||
}\
|
||||
|
||||
bool TextureCubeMap_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
TextureCubeMap& texture = static_cast<TextureCubeMap&>(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<const osg::ImageSequence*>(image); \
|
||||
if (is) \
|
||||
{ \
|
||||
fw.indent() << "image "<<#FACE<<std::endl; \
|
||||
fw.writeObject(*is); \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
std::string fileName = image->getFileName();\
|
||||
if (fw.getOutputTextureFiles())\
|
||||
{\
|
||||
if (fileName.empty())\
|
||||
{\
|
||||
fileName = fw.getTextureFileNameForOutput();\
|
||||
}\
|
||||
osgDB::writeImageFile(*image, fileName);\
|
||||
}\
|
||||
if (!fileName.empty())\
|
||||
{\
|
||||
fw.indent() << "image "<<#FACE<<" "<<fw.wrapString(fw.getFileNameForOutput(fileName))<< std::endl;\
|
||||
}\
|
||||
}\
|
||||
} \
|
||||
}
|
||||
|
||||
bool TextureCubeMap_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const TextureCubeMap& texture = static_cast<const TextureCubeMap&>(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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<TextureRectangle&>(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<const TextureRectangle&>(obj);
|
||||
|
||||
if (texture.getImage())
|
||||
{
|
||||
const osg::ImageSequence* is = dynamic_cast<const osg::ImageSequence*>(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 "<<fw.wrapString(fw.getFileNameForOutput(fileName))<< std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
#include <osg/TransferFunction>
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <osgDB/ReadFile>
|
||||
#include <osgDB/Registry>
|
||||
#include <osgDB/Input>
|
||||
#include <osgDB/Output>
|
||||
#include <osgDB/ParameterOutput>
|
||||
|
||||
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<osg::TransferFunction1D&>(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<const osg::TransferFunction1D&>(obj);
|
||||
const osg::TransferFunction1D::ColorMap& colorMap = tf.getColorMap();
|
||||
|
||||
fw.indent()<<"NumberImageCells "<<tf.getNumberImageCells()<<std::endl;
|
||||
fw.indent()<<"Colours {"<<std::endl;
|
||||
|
||||
fw.moveIn();
|
||||
for(osg::TransferFunction1D::ColorMap::const_iterator itr = colorMap.begin();
|
||||
itr != colorMap.end();
|
||||
++itr)
|
||||
{
|
||||
const osg::Vec4& c = itr->second;
|
||||
fw.indent()<<itr->first<<" "<<c.r()<<" "<<c.g()<<" "<<c.b()<<" "<<c.a()<<std::endl;
|
||||
}
|
||||
fw.moveOut();
|
||||
fw.indent()<<"}"<<std::endl;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1,96 +0,0 @@
|
||||
#include "osg/Transform"
|
||||
#include "osg/MatrixTransform"
|
||||
|
||||
#include "osgDB/Registry"
|
||||
#include "osgDB/Input"
|
||||
#include "osgDB/Output"
|
||||
|
||||
#include "osg/Notify"
|
||||
|
||||
using namespace osg;
|
||||
using namespace osgDB;
|
||||
|
||||
// forward declare functions to use later.
|
||||
bool Transform_readLocalData(Object& obj, Input& fr);
|
||||
bool Transform_writeLocalData(const Object& obj, Output& fw);
|
||||
|
||||
// register the read and write functions with the osgDB::Registry.
|
||||
REGISTER_DOTOSGWRAPPER(Transform)
|
||||
(
|
||||
new osg::Transform,
|
||||
"Transform",
|
||||
"Object Node Transform Group",
|
||||
&Transform_readLocalData,
|
||||
&Transform_writeLocalData,
|
||||
DotOsgWrapper::READ_AND_WRITE
|
||||
);
|
||||
|
||||
bool Transform_readLocalData(Object& obj, Input& fr)
|
||||
{
|
||||
bool iteratorAdvanced = false;
|
||||
|
||||
Transform& transform = static_cast<Transform&>(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<const Transform&>(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;
|
||||
}
|
||||
@@ -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<Uniform&>(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<FloatArray*>(data) );
|
||||
uniform.setArray( dynamic_cast<IntArray*>(data) );
|
||||
uniform.setArray( dynamic_cast<UIntArray*>(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<Uniform::Callback> s_callback = new osg::Uniform::Callback;
|
||||
while (fr.matchSequence("UpdateCallback {"))
|
||||
{
|
||||
//int entry = fr[0].getNoNestedBrackets();
|
||||
fr += 2;
|
||||
Uniform::Callback* callback = dynamic_cast<Uniform::Callback*>(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<Uniform::Callback*>(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<const Uniform&>(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;
|
||||
}
|
||||
@@ -1,146 +0,0 @@
|
||||
#include "osg/VertexProgram"
|
||||
#include <osg/io_utils>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#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<VertexProgram&>(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<const VertexProgram&>(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<std::string> 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<std::string>::const_iterator j;
|
||||
for (j=lines.begin(); j!=lines.end(); ++j) {
|
||||
fw.indent() << "\"" << *j << "\"\n";
|
||||
}
|
||||
|
||||
fw.moveOut();
|
||||
fw.indent() << "}\n";
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -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<Viewport&>(obj);
|
||||
viewport.setViewport( x, y, width, height );
|
||||
return iteratorAdvanced;
|
||||
}
|
||||
|
||||
|
||||
bool Viewport_writeLocalData(const Object& obj, Output& fw)
|
||||
{
|
||||
const Viewport& viewport = static_cast<const Viewport&>(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;
|
||||
}
|
||||
7
src/osgPlugins/shadow/CMakeLists.txt
Normal file
7
src/osgPlugins/shadow/CMakeLists.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
SET(TARGET_SRC
|
||||
ReaderWriterOsgShadow.cpp
|
||||
)
|
||||
SET(TARGET_ADDED_LIBRARIES osgShadow )
|
||||
|
||||
#### end var setup ###
|
||||
SETUP_PLUGIN(osgshadow)
|
||||
9
src/osgPlugins/terrain/CMakeLists.txt
Normal file
9
src/osgPlugins/terrain/CMakeLists.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
SET(TARGET_SRC
|
||||
ReaderWriterOsgTerrain.cpp
|
||||
)
|
||||
|
||||
SET(TARGET_ADDED_LIBRARIES osgTerrain )
|
||||
#### end var setup ###
|
||||
SETUP_PLUGIN(osgterrain)
|
||||
|
||||
|
||||
8
src/osgPlugins/view/CMakeLists.txt
Normal file
8
src/osgPlugins/view/CMakeLists.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
SET(TARGET_SRC
|
||||
ReaderWriterOsgViewer.cpp
|
||||
)
|
||||
SET(TARGET_ADDED_LIBRARIES osgViewer )
|
||||
|
||||
#### end var setup ###
|
||||
SETUP_PLUGIN(osgviewer)
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user