From Wang Rui, serializers for osgSim and osgVolume
This commit is contained in:
parent
f5587bad3d
commit
4a0c21a5fc
@ -36,6 +36,9 @@ class OSGSIM_EXPORT SequenceGroup : public osg::Object
|
||||
SequenceGroup(double baseTime);
|
||||
|
||||
META_Object(osgSim,SequenceGroup);
|
||||
|
||||
inline void setBaseTime( double t ) { _baseTime = t; }
|
||||
inline double getBaseTime() const { return _baseTime; }
|
||||
|
||||
double _baseTime;
|
||||
};
|
||||
|
@ -47,6 +47,9 @@ public:
|
||||
|
||||
/** Set the range of colors. */
|
||||
void setColors(const std::vector<osg::Vec4>& colors);
|
||||
|
||||
/** Get the range of colors */
|
||||
const std::vector<osg::Vec4>& getColors() const { return _colors; }
|
||||
|
||||
/** Get the color for a given scalar value. */
|
||||
osg::Vec4 getColor(float scalar) const;
|
||||
|
@ -100,8 +100,8 @@ class OSGSIM_EXPORT DOFTransform : public osg::Transform
|
||||
RHP
|
||||
};
|
||||
|
||||
void setHPRMultOrder(const MultOrder order) { _multOrder = order; }
|
||||
inline const MultOrder getHPRMultOrder() const { return _multOrder;}
|
||||
void setHPRMultOrder(MultOrder order) { _multOrder = order; }
|
||||
inline MultOrder getHPRMultOrder() const { return _multOrder;}
|
||||
|
||||
void setAnimationOn(bool do_animate);
|
||||
inline bool getAnimationOn() const { return _animationOn; }
|
||||
|
@ -81,6 +81,7 @@ class OSGSIM_EXPORT LightPointNode : public osg::Node
|
||||
void setLightPointSystem( osgSim::LightPointSystem* lps) { _lightSystem = lps; }
|
||||
|
||||
osgSim::LightPointSystem* getLightPointSystem() { return _lightSystem.get(); }
|
||||
const osgSim::LightPointSystem* getLightPointSystem() const { return _lightSystem.get(); }
|
||||
|
||||
void setPointSprite(bool enable=true) { _pointSprites = enable; }
|
||||
|
||||
|
@ -177,7 +177,7 @@ public:
|
||||
void setTitle(const std::string& title);
|
||||
|
||||
/** Get the title for the ScalarBar. */
|
||||
std::string getTitle() const;
|
||||
const std::string& getTitle() const;
|
||||
|
||||
|
||||
/** Set the position of scalar bar's lower left corner.*/
|
||||
@ -190,7 +190,7 @@ public:
|
||||
void setWidth(float width);
|
||||
|
||||
/** Get the width of the scalar bar.*/
|
||||
float getWidth() { return _width; }
|
||||
float getWidth() const { return _width; }
|
||||
|
||||
/** Set the aspect ration (y/x) for the displayed bar. Bear in mind you
|
||||
may want to change this if you change the orientation. */
|
||||
|
@ -203,25 +203,25 @@ public:
|
||||
void setSurfaceColor(const osg::Vec4& c);
|
||||
|
||||
/** Get the color of the surface. */
|
||||
osg::Vec4 getSurfaceColor() const { return _surfaceColor; }
|
||||
const osg::Vec4& getSurfaceColor() const { return _surfaceColor; }
|
||||
|
||||
/** Set the color of the spokes. */
|
||||
void setSpokeColor(const osg::Vec4& c);
|
||||
|
||||
/** Get the color of the spokes. */
|
||||
osg::Vec4 getSpokeColor() const { return _spokeColor; }
|
||||
const osg::Vec4& getSpokeColor() const { return _spokeColor; }
|
||||
|
||||
/** Set the color of the edge line. */
|
||||
void setEdgeLineColor(const osg::Vec4& c);
|
||||
|
||||
/** Get the color of the edge line. */
|
||||
osg::Vec4 getEdgeLineColor() const { return _edgeLineColor; }
|
||||
const osg::Vec4& getEdgeLineColor() const { return _edgeLineColor; }
|
||||
|
||||
/** Set the color of the planes. */
|
||||
void setSideColor(const osg::Vec4& c);
|
||||
|
||||
/** Get the color of the planes. */
|
||||
osg::Vec4 getSideColor() const { return _planeColor; }
|
||||
const osg::Vec4& getSideColor() const { return _planeColor; }
|
||||
|
||||
/** Set color of all components. */
|
||||
void setAllColors(const osg::Vec4& c);
|
||||
|
@ -55,7 +55,7 @@ void ScalarBar::setTitle(const std::string& title)
|
||||
createDrawables();
|
||||
}
|
||||
|
||||
std::string ScalarBar::getTitle() const
|
||||
const std::string& ScalarBar::getTitle() const
|
||||
{
|
||||
return _title;
|
||||
}
|
||||
|
@ -169,6 +169,19 @@ BEGIN_OBJECT_REFLECTOR(osgSim::SequenceGroup)
|
||||
__C5_char_P1__className,
|
||||
"return the name of the object's class type. ",
|
||||
"Must be defined by derived classes. ");
|
||||
I_Method1(void, setBaseTime, IN, double, t,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setBaseTime__double,
|
||||
"",
|
||||
"");
|
||||
I_Method0(double, getBaseTime,
|
||||
Properties::NON_VIRTUAL,
|
||||
__double__getBaseTime,
|
||||
"",
|
||||
"");
|
||||
I_SimpleProperty(double, BaseTime,
|
||||
__double__getBaseTime,
|
||||
__void__setBaseTime__double);
|
||||
I_PublicMemberProperty(double, _baseTime);
|
||||
END_REFLECTOR
|
||||
|
||||
|
@ -37,13 +37,18 @@ BEGIN_OBJECT_REFLECTOR(osgSim::ColorRange)
|
||||
__void__setColors__C5_std_vectorT1_osg_Vec4__R1,
|
||||
"Set the range of colors. ",
|
||||
"");
|
||||
I_Method0(const std::vector< osg::Vec4 > &, getColors,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_std_vectorT1_osg_Vec4__R1__getColors,
|
||||
"Get the range of colors. ",
|
||||
"");
|
||||
I_Method1(osg::Vec4, getColor, IN, float, scalar,
|
||||
Properties::VIRTUAL,
|
||||
__osg_Vec4__getColor__float,
|
||||
"Get the color for a given scalar value. ",
|
||||
"");
|
||||
I_SimpleProperty(const std::vector< osg::Vec4 > &, Colors,
|
||||
0,
|
||||
__C5_std_vectorT1_osg_Vec4__R1__getColors,
|
||||
__void__setColors__C5_std_vectorT1_osg_Vec4__R1);
|
||||
END_REFLECTOR
|
||||
|
||||
|
@ -245,14 +245,14 @@ BEGIN_OBJECT_REFLECTOR(osgSim::DOFTransform)
|
||||
__unsigned_long__getLimitationFlags,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, setHPRMultOrder, IN, const osgSim::DOFTransform::MultOrder, order,
|
||||
I_Method1(void, setHPRMultOrder, IN, osgSim::DOFTransform::MultOrder, order,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setHPRMultOrder__C5_MultOrder,
|
||||
__void__setHPRMultOrder__MultOrder,
|
||||
"",
|
||||
"");
|
||||
I_Method0(const osgSim::DOFTransform::MultOrder, getHPRMultOrder,
|
||||
I_Method0(osgSim::DOFTransform::MultOrder, getHPRMultOrder,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_MultOrder__getHPRMultOrder,
|
||||
__MultOrder__getHPRMultOrder,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, setAnimationOn, IN, bool, do_animate,
|
||||
@ -292,9 +292,9 @@ BEGIN_OBJECT_REFLECTOR(osgSim::DOFTransform)
|
||||
I_SimpleProperty(const osg::Vec3 &, CurrentTranslate,
|
||||
__C5_osg_Vec3_R1__getCurrentTranslate,
|
||||
__void__setCurrentTranslate__C5_osg_Vec3_R1);
|
||||
I_SimpleProperty(const osgSim::DOFTransform::MultOrder, HPRMultOrder,
|
||||
__C5_MultOrder__getHPRMultOrder,
|
||||
__void__setHPRMultOrder__C5_MultOrder);
|
||||
I_SimpleProperty(osgSim::DOFTransform::MultOrder, HPRMultOrder,
|
||||
__MultOrder__getHPRMultOrder,
|
||||
__void__setHPRMultOrder__MultOrder);
|
||||
I_SimpleProperty(const osg::Vec3 &, IncrementHPR,
|
||||
__C5_osg_Vec3_R1__getIncrementHPR,
|
||||
__void__setIncrementHPR__C5_osg_Vec3_R1);
|
||||
|
@ -153,6 +153,11 @@ BEGIN_OBJECT_REFLECTOR(osgSim::LightPointNode)
|
||||
__osgSim_LightPointSystem_P1__getLightPointSystem,
|
||||
"",
|
||||
"");
|
||||
I_Method0(const osgSim::LightPointSystem *, getLightPointSystem,
|
||||
Properties::NON_VIRTUAL,
|
||||
__C5_osgSim_LightPointSystem_P1__getLightPointSystem,
|
||||
"",
|
||||
"");
|
||||
I_MethodWithDefaults1(void, setPointSprite, IN, bool, enable, true,
|
||||
Properties::NON_VIRTUAL,
|
||||
__void__setPointSprite__bool,
|
||||
|
@ -110,9 +110,9 @@ BEGIN_OBJECT_REFLECTOR(osgSim::ScalarBar)
|
||||
__void__setTitle__C5_std_string_R1,
|
||||
"Set the title for the ScalarBar, set \"\" for no title. ",
|
||||
"");
|
||||
I_Method0(std::string, getTitle,
|
||||
I_Method0(const std::string &, getTitle,
|
||||
Properties::NON_VIRTUAL,
|
||||
__std_string__getTitle,
|
||||
__C5_std_string_R1__getTitle,
|
||||
"Get the title for the ScalarBar. ",
|
||||
"");
|
||||
I_Method1(void, setPosition, IN, const osg::Vec3 &, pos,
|
||||
@ -210,8 +210,8 @@ BEGIN_OBJECT_REFLECTOR(osgSim::ScalarBar)
|
||||
I_SimpleProperty(const osgSim::ScalarBar::TextProperties &, TextProperties,
|
||||
__C5_TextProperties_R1__getTextProperties,
|
||||
__void__setTextProperties__C5_TextProperties_R1);
|
||||
I_SimpleProperty(std::string, Title,
|
||||
__std_string__getTitle,
|
||||
I_SimpleProperty(const std::string &, Title,
|
||||
__C5_std_string_R1__getTitle,
|
||||
__void__setTitle__C5_std_string_R1);
|
||||
I_SimpleProperty(float, Width,
|
||||
__float__getWidth,
|
||||
|
@ -123,9 +123,9 @@ BEGIN_OBJECT_REFLECTOR(osgSim::SphereSegment)
|
||||
__void__setSurfaceColor__C5_osg_Vec4_R1,
|
||||
"Set the color of the surface. ",
|
||||
"");
|
||||
I_Method0(osg::Vec4, getSurfaceColor,
|
||||
I_Method0(const osg::Vec4 &, getSurfaceColor,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Vec4__getSurfaceColor,
|
||||
__C5_osg_Vec4_R1__getSurfaceColor,
|
||||
"Get the color of the surface. ",
|
||||
"");
|
||||
I_Method1(void, setSpokeColor, IN, const osg::Vec4 &, c,
|
||||
@ -133,9 +133,9 @@ BEGIN_OBJECT_REFLECTOR(osgSim::SphereSegment)
|
||||
__void__setSpokeColor__C5_osg_Vec4_R1,
|
||||
"Set the color of the spokes. ",
|
||||
"");
|
||||
I_Method0(osg::Vec4, getSpokeColor,
|
||||
I_Method0(const osg::Vec4 &, getSpokeColor,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Vec4__getSpokeColor,
|
||||
__C5_osg_Vec4_R1__getSpokeColor,
|
||||
"Get the color of the spokes. ",
|
||||
"");
|
||||
I_Method1(void, setEdgeLineColor, IN, const osg::Vec4 &, c,
|
||||
@ -143,9 +143,9 @@ BEGIN_OBJECT_REFLECTOR(osgSim::SphereSegment)
|
||||
__void__setEdgeLineColor__C5_osg_Vec4_R1,
|
||||
"Set the color of the edge line. ",
|
||||
"");
|
||||
I_Method0(osg::Vec4, getEdgeLineColor,
|
||||
I_Method0(const osg::Vec4 &, getEdgeLineColor,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Vec4__getEdgeLineColor,
|
||||
__C5_osg_Vec4_R1__getEdgeLineColor,
|
||||
"Get the color of the edge line. ",
|
||||
"");
|
||||
I_Method1(void, setSideColor, IN, const osg::Vec4 &, c,
|
||||
@ -153,9 +153,9 @@ BEGIN_OBJECT_REFLECTOR(osgSim::SphereSegment)
|
||||
__void__setSideColor__C5_osg_Vec4_R1,
|
||||
"Set the color of the planes. ",
|
||||
"");
|
||||
I_Method0(osg::Vec4, getSideColor,
|
||||
I_Method0(const osg::Vec4 &, getSideColor,
|
||||
Properties::NON_VIRTUAL,
|
||||
__osg_Vec4__getSideColor,
|
||||
__C5_osg_Vec4_R1__getSideColor,
|
||||
"Get the color of the planes. ",
|
||||
"");
|
||||
I_Method1(void, setAllColors, IN, const osg::Vec4 &, c,
|
||||
@ -225,20 +225,20 @@ BEGIN_OBJECT_REFLECTOR(osgSim::SphereSegment)
|
||||
I_SimpleProperty(int, DrawMask,
|
||||
__int__getDrawMask,
|
||||
__void__setDrawMask__int);
|
||||
I_SimpleProperty(osg::Vec4, EdgeLineColor,
|
||||
__osg_Vec4__getEdgeLineColor,
|
||||
I_SimpleProperty(const osg::Vec4 &, EdgeLineColor,
|
||||
__C5_osg_Vec4_R1__getEdgeLineColor,
|
||||
__void__setEdgeLineColor__C5_osg_Vec4_R1);
|
||||
I_SimpleProperty(float, Radius,
|
||||
__float__getRadius,
|
||||
__void__setRadius__float);
|
||||
I_SimpleProperty(osg::Vec4, SideColor,
|
||||
__osg_Vec4__getSideColor,
|
||||
I_SimpleProperty(const osg::Vec4 &, SideColor,
|
||||
__C5_osg_Vec4_R1__getSideColor,
|
||||
__void__setSideColor__C5_osg_Vec4_R1);
|
||||
I_SimpleProperty(osg::Vec4, SpokeColor,
|
||||
__osg_Vec4__getSpokeColor,
|
||||
I_SimpleProperty(const osg::Vec4 &, SpokeColor,
|
||||
__C5_osg_Vec4_R1__getSpokeColor,
|
||||
__void__setSpokeColor__C5_osg_Vec4_R1);
|
||||
I_SimpleProperty(osg::Vec4, SurfaceColor,
|
||||
__osg_Vec4__getSurfaceColor,
|
||||
I_SimpleProperty(const osg::Vec4 &, SurfaceColor,
|
||||
__C5_osg_Vec4_R1__getSurfaceColor,
|
||||
__void__setSurfaceColor__C5_osg_Vec4_R1);
|
||||
END_REFLECTOR
|
||||
|
||||
|
@ -449,9 +449,9 @@ BEGIN_OBJECT_REFLECTOR(osgVolume::PropertyAdjustmentCallback)
|
||||
__void__setKeyEventCycleForward__int,
|
||||
"",
|
||||
"");
|
||||
I_Method0(int, getKeyEventCyclesForward,
|
||||
I_Method0(int, getKeyEventCycleForward,
|
||||
Properties::NON_VIRTUAL,
|
||||
__int__getKeyEventCyclesForward,
|
||||
__int__getKeyEventCycleForward,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, setKeyEventCycleBackward, IN, int, key,
|
||||
@ -459,9 +459,9 @@ BEGIN_OBJECT_REFLECTOR(osgVolume::PropertyAdjustmentCallback)
|
||||
__void__setKeyEventCycleBackward__int,
|
||||
"",
|
||||
"");
|
||||
I_Method0(int, getKeyEventCyclesBackward,
|
||||
I_Method0(int, getKeyEventCycleBackward,
|
||||
Properties::NON_VIRTUAL,
|
||||
__int__getKeyEventCyclesBackward,
|
||||
__int__getKeyEventCycleBackward,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, setKeyEventActivatesTransparencyAdjustment, IN, int, key,
|
||||
@ -479,9 +479,9 @@ BEGIN_OBJECT_REFLECTOR(osgVolume::PropertyAdjustmentCallback)
|
||||
__void__setKeyEventActivatesSampleDensityAdjustment__int,
|
||||
"",
|
||||
"");
|
||||
I_Method0(int, getKeyEventActivatesSampleAdjustment,
|
||||
I_Method0(int, getKeyEventActivatesSampleDensityAdjustment,
|
||||
Properties::NON_VIRTUAL,
|
||||
__int__getKeyEventActivatesSampleAdjustment,
|
||||
__int__getKeyEventActivatesSampleDensityAdjustment,
|
||||
"",
|
||||
"");
|
||||
I_Method1(void, setKeyEventActivatesAlphaFuncAdjustment, IN, int, key,
|
||||
@ -502,27 +502,18 @@ BEGIN_OBJECT_REFLECTOR(osgVolume::PropertyAdjustmentCallback)
|
||||
I_SimpleProperty(int, KeyEventActivatesAlphaFuncAdjustment,
|
||||
__int__getKeyEventActivatesAlphaFuncAdjustment,
|
||||
__void__setKeyEventActivatesAlphaFuncAdjustment__int);
|
||||
I_SimpleProperty(int, KeyEventActivatesSampleAdjustment,
|
||||
__int__getKeyEventActivatesSampleAdjustment,
|
||||
0);
|
||||
I_SimpleProperty(int, KeyEventActivatesSampleDensityAdjustment,
|
||||
0,
|
||||
__int__getKeyEventActivatesSampleDensityAdjustment,
|
||||
__void__setKeyEventActivatesSampleDensityAdjustment__int);
|
||||
I_SimpleProperty(int, KeyEventActivatesTransparencyAdjustment,
|
||||
__int__getKeyEventActivatesTransparencyAdjustment,
|
||||
__void__setKeyEventActivatesTransparencyAdjustment__int);
|
||||
I_SimpleProperty(int, KeyEventCycleBackward,
|
||||
0,
|
||||
__int__getKeyEventCycleBackward,
|
||||
__void__setKeyEventCycleBackward__int);
|
||||
I_SimpleProperty(int, KeyEventCycleForward,
|
||||
0,
|
||||
__int__getKeyEventCycleForward,
|
||||
__void__setKeyEventCycleForward__int);
|
||||
I_SimpleProperty(int, KeyEventCyclesBackward,
|
||||
__int__getKeyEventCyclesBackward,
|
||||
0);
|
||||
I_SimpleProperty(int, KeyEventCyclesForward,
|
||||
__int__getKeyEventCyclesForward,
|
||||
0);
|
||||
I_PublicMemberProperty(int, _cyleForwardKey);
|
||||
I_PublicMemberProperty(int, _cyleBackwardKey);
|
||||
I_PublicMemberProperty(int, _transparencyKey);
|
||||
|
@ -42,6 +42,8 @@ ADD_SUBDIRECTORY(osgAnimation)
|
||||
ADD_SUBDIRECTORY(osgFX)
|
||||
ADD_SUBDIRECTORY(osgManipulator)
|
||||
ADD_SUBDIRECTORY(osgParticle)
|
||||
ADD_SUBDIRECTORY(osgSim)
|
||||
ADD_SUBDIRECTORY(osgShadow)
|
||||
ADD_SUBDIRECTORY(osgTerrain)
|
||||
ADD_SUBDIRECTORY(osgText)
|
||||
ADD_SUBDIRECTORY(osgVolume)
|
||||
|
49
src/osgWrappers/serializers/osgSim/AzimElevationSector.cpp
Normal file
49
src/osgWrappers/serializers/osgSim/AzimElevationSector.cpp
Normal file
@ -0,0 +1,49 @@
|
||||
#include <osgSim/Sector>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkAzimRange( const osgSim::AzimElevationSector& sector )
|
||||
{ return true; }
|
||||
|
||||
static bool readAzimRange( osgDB::InputStream& is, osgSim::AzimElevationSector& sector )
|
||||
{
|
||||
float minAzimuth, maxAzimuth, fadeAngle;
|
||||
is >> minAzimuth >> maxAzimuth >> fadeAngle;
|
||||
sector.setAzimuthRange( minAzimuth, maxAzimuth, fadeAngle );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeAzimRange( osgDB::OutputStream& os, const osgSim::AzimElevationSector& sector )
|
||||
{
|
||||
float minAzimuth, maxAzimuth, fadeAngle;
|
||||
sector.getAzimuthRange( minAzimuth, maxAzimuth, fadeAngle );
|
||||
os << minAzimuth << maxAzimuth << fadeAngle << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool checkElevationRange( const osgSim::AzimElevationSector& sector )
|
||||
{ return true; }
|
||||
|
||||
static bool readElevationRange( osgDB::InputStream& is, osgSim::AzimElevationSector& sector )
|
||||
{
|
||||
float minElevation, maxElevation, fadeAngle;
|
||||
is >> minElevation >> maxElevation >> fadeAngle;
|
||||
sector.setElevationRange( minElevation, maxElevation, fadeAngle );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeElevationRange( osgDB::OutputStream& os, const osgSim::AzimElevationSector& sector )
|
||||
{
|
||||
os << sector.getMinElevation() << sector.getMaxElevation() << sector.getFadeAngle() << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgSim_AzimElevationSector,
|
||||
new osgSim::AzimElevationSector,
|
||||
osgSim::AzimElevationSector,
|
||||
"osg::Object osgSim::Sector osgSim::AzimElevationSector" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( AzimRange ); // AzimRange
|
||||
ADD_USER_SERIALIZER( ElevationRange ); // ElevationRange
|
||||
}
|
31
src/osgWrappers/serializers/osgSim/AzimSector.cpp
Normal file
31
src/osgWrappers/serializers/osgSim/AzimSector.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
#include <osgSim/Sector>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkAzimRange( const osgSim::AzimSector& sector )
|
||||
{ return true; }
|
||||
|
||||
static bool readAzimRange( osgDB::InputStream& is, osgSim::AzimSector& sector )
|
||||
{
|
||||
float minAzimuth, maxAzimuth, fadeAngle;
|
||||
is >> minAzimuth >> maxAzimuth >> fadeAngle;
|
||||
sector.setAzimuthRange( minAzimuth, maxAzimuth, fadeAngle );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeAzimRange( osgDB::OutputStream& os, const osgSim::AzimSector& sector )
|
||||
{
|
||||
float minAzimuth, maxAzimuth, fadeAngle;
|
||||
sector.getAzimuthRange( minAzimuth, maxAzimuth, fadeAngle );
|
||||
os << minAzimuth << maxAzimuth << fadeAngle << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgSim_AzimSector,
|
||||
new osgSim::AzimSector,
|
||||
osgSim::AzimSector,
|
||||
"osg::Object osgSim::Sector osgSim::AzimSector" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( AzimRange ); // AzimRange
|
||||
}
|
48
src/osgWrappers/serializers/osgSim/BlinkSequence.cpp
Normal file
48
src/osgWrappers/serializers/osgSim/BlinkSequence.cpp
Normal file
@ -0,0 +1,48 @@
|
||||
#include <osgSim/BlinkSequence>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkPulseData( const osgSim::BlinkSequence& bs )
|
||||
{
|
||||
return bs.getNumPulses()>0;
|
||||
}
|
||||
|
||||
static bool readPulseData( osgDB::InputStream& is, osgSim::BlinkSequence& bs )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
double length = 0.0;
|
||||
osg::Vec4 color;
|
||||
is >> length >> color;
|
||||
bs.addPulse( length, color );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writePulseData( osgDB::OutputStream& os, const osgSim::BlinkSequence& bs )
|
||||
{
|
||||
unsigned int size = bs.getNumPulses();
|
||||
os << size << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
double length = 0.0;
|
||||
osg::Vec4 color;
|
||||
bs.getPulse( i, length, color );
|
||||
os << length << color << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgSim_BlinkSequence,
|
||||
new osgSim::BlinkSequence,
|
||||
osgSim::BlinkSequence,
|
||||
"osg::Object osgSim::BlinkSequence" )
|
||||
{
|
||||
ADD_DOUBLE_SERIALIZER( PhaseShift, 0.0 ); // _phaseShift
|
||||
ADD_USER_SERIALIZER( PulseData ); // _pulseData
|
||||
ADD_OBJECT_SERIALIZER( SequenceGroup, osgSim::SequenceGroup, NULL ); // _sequenceGroup
|
||||
}
|
7
src/osgWrappers/serializers/osgSim/CMakeLists.txt
Normal file
7
src/osgWrappers/serializers/osgSim/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
FILE(GLOB TARGET_SRC *.cpp)
|
||||
FILE(GLOB TARGET_H *.h)
|
||||
|
||||
SET(TARGET_ADDED_LIBRARIES osgSim )
|
||||
|
||||
#### end var setup ###
|
||||
SETUP_PLUGIN(osgsim)
|
30
src/osgWrappers/serializers/osgSim/ConeSector.cpp
Normal file
30
src/osgWrappers/serializers/osgSim/ConeSector.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
#include <osgSim/Sector>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkAngle( const osgSim::ConeSector& sector )
|
||||
{ return true; }
|
||||
|
||||
static bool readAngle( osgDB::InputStream& is, osgSim::ConeSector& sector )
|
||||
{
|
||||
float angle, fadeAngle;
|
||||
is >> angle >> fadeAngle;
|
||||
sector.setAngle( angle, fadeAngle );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeAngle( osgDB::OutputStream& os, const osgSim::ConeSector& sector )
|
||||
{
|
||||
os << sector.getAngle() << sector.getFadeAngle() << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgSim_ConeSector,
|
||||
new osgSim::ConeSector,
|
||||
osgSim::ConeSector,
|
||||
"osg::Object osgSim::Sector osgSim::ConeSector" )
|
||||
{
|
||||
ADD_VEC3_SERIALIZER( Axis, osg::Vec3() ); // _axis
|
||||
ADD_USER_SERIALIZER( Angle ); // _cosAngle
|
||||
}
|
69
src/osgWrappers/serializers/osgSim/DOFTransform.cpp
Normal file
69
src/osgWrappers/serializers/osgSim/DOFTransform.cpp
Normal file
@ -0,0 +1,69 @@
|
||||
#include <osgSim/DOFTransform>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkPutMatrix( const osgSim::DOFTransform& dof )
|
||||
{ return !dof.getPutMatrix().isIdentity(); }
|
||||
|
||||
static bool readPutMatrix( osgDB::InputStream& is, osgSim::DOFTransform& dof )
|
||||
{
|
||||
osg::Matrixf put; is >> put;
|
||||
dof.setPutMatrix( put );
|
||||
dof.setInversePutMatrix( osg::Matrix::inverse(put) );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writePutMatrix( osgDB::OutputStream& os, const osgSim::DOFTransform& dof )
|
||||
{
|
||||
osg::Matrixf put = dof.getPutMatrix();
|
||||
os << put << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool checkLimitationFlags( const osgSim::DOFTransform& dof )
|
||||
{ return dof.getLimitationFlags()>0; }
|
||||
|
||||
static bool readLimitationFlags( osgDB::InputStream& is, osgSim::DOFTransform& dof )
|
||||
{
|
||||
unsigned long flags; is >> flags;
|
||||
dof.setLimitationFlags( flags );;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeLimitationFlags( osgDB::OutputStream& os, const osgSim::DOFTransform& dof )
|
||||
{
|
||||
os << dof.getLimitationFlags() << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgSim_DOFTransform,
|
||||
new osgSim::DOFTransform,
|
||||
osgSim::DOFTransform,
|
||||
"osg::Object osg::Node osg::Group osg::Transform osgSim::DOFTransform" )
|
||||
{
|
||||
ADD_VEC3_SERIALIZER( MinHPR, osg::Vec3() ); // _minHPR
|
||||
ADD_VEC3_SERIALIZER( MaxHPR, osg::Vec3() ); // _maxHPR
|
||||
ADD_VEC3_SERIALIZER( CurrentHPR, osg::Vec3() ); // _currentHPR
|
||||
ADD_VEC3_SERIALIZER( IncrementHPR, osg::Vec3() ); // _incrementHPR
|
||||
ADD_VEC3_SERIALIZER( MinTranslate, osg::Vec3() ); // _minTranslate
|
||||
ADD_VEC3_SERIALIZER( MaxTranslate, osg::Vec3() ); // _maxTranslate
|
||||
ADD_VEC3_SERIALIZER( CurrentTranslate, osg::Vec3() ); // _currentTranslate
|
||||
ADD_VEC3_SERIALIZER( IncrementTranslate, osg::Vec3() ); // _incrementTranslate
|
||||
ADD_VEC3_SERIALIZER( MinScale, osg::Vec3() ); // _minScale
|
||||
ADD_VEC3_SERIALIZER( MaxScale, osg::Vec3() ); // _maxScale
|
||||
ADD_VEC3_SERIALIZER( CurrentScale, osg::Vec3() ); // _currentScale
|
||||
ADD_VEC3_SERIALIZER( IncrementScale, osg::Vec3() ); // _incrementScale
|
||||
ADD_USER_SERIALIZER( PutMatrix ); // _Put, _inversePut
|
||||
ADD_USER_SERIALIZER( LimitationFlags ); // _limitationFlags
|
||||
ADD_BOOL_SERIALIZER( AnimationOn, false ); // _animationOn
|
||||
|
||||
BEGIN_ENUM_SERIALIZER2( HPRMultOrder, osgSim::DOFTransform::MultOrder, PRH );
|
||||
ADD_ENUM_VALUE( PRH );
|
||||
ADD_ENUM_VALUE( PHR );
|
||||
ADD_ENUM_VALUE( HPR );
|
||||
ADD_ENUM_VALUE( HRP );
|
||||
ADD_ENUM_VALUE( RPH );
|
||||
ADD_ENUM_VALUE( RHP );
|
||||
END_ENUM_SERIALIZER(); // _multOrder
|
||||
}
|
16
src/osgWrappers/serializers/osgSim/DirectionalSector.cpp
Normal file
16
src/osgWrappers/serializers/osgSim/DirectionalSector.cpp
Normal file
@ -0,0 +1,16 @@
|
||||
#include <osgSim/Sector>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgSim_DirectionalSector,
|
||||
new osgSim::DirectionalSector,
|
||||
osgSim::DirectionalSector,
|
||||
"osg::Object osgSim::Sector osgSim::DirectionalSector" )
|
||||
{
|
||||
ADD_VEC3_SERIALIZER( Direction, osg::Vec3() ); // _direction
|
||||
ADD_FLOAT_SERIALIZER( LobeRollAngle, 0.0f ); // _rollAngle
|
||||
ADD_FLOAT_SERIALIZER( HorizLobeAngle, -1.0f ); // _cosHorizAngle
|
||||
ADD_FLOAT_SERIALIZER( VertLobeAngle, -1.0f ); // _cosVertAngle
|
||||
ADD_FLOAT_SERIALIZER( FadeAngle, -1.0f ); // FadeAngle
|
||||
}
|
29
src/osgWrappers/serializers/osgSim/ElevationSector.cpp
Normal file
29
src/osgWrappers/serializers/osgSim/ElevationSector.cpp
Normal file
@ -0,0 +1,29 @@
|
||||
#include <osgSim/Sector>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkElevationRange( const osgSim::ElevationSector& sector )
|
||||
{ return true; }
|
||||
|
||||
static bool readElevationRange( osgDB::InputStream& is, osgSim::ElevationSector& sector )
|
||||
{
|
||||
float minElevation, maxElevation, fadeAngle;
|
||||
is >> minElevation >> maxElevation >> fadeAngle;
|
||||
sector.setElevationRange( minElevation, maxElevation, fadeAngle );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeElevationRange( osgDB::OutputStream& os, const osgSim::ElevationSector& sector )
|
||||
{
|
||||
os << sector.getMinElevation() << sector.getMaxElevation() << sector.getFadeAngle() << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgSim_ElevationSector,
|
||||
new osgSim::ElevationSector,
|
||||
osgSim::ElevationSector,
|
||||
"osg::Object osgSim::Sector osgSim::ElevationSector" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( ElevationRange ); // ElevationRange
|
||||
}
|
12
src/osgWrappers/serializers/osgSim/Impostor.cpp
Normal file
12
src/osgWrappers/serializers/osgSim/Impostor.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include <osgSim/Impostor>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgSim_Impostor,
|
||||
new osgSim::Impostor,
|
||||
osgSim::Impostor,
|
||||
"osg::Object osg::Node osg::Group osg::LOD osgSim::Impostor" )
|
||||
{
|
||||
ADD_FLOAT_SERIALIZER( ImpostorThreshold, -1.0f ); // _impostorThreshold
|
||||
}
|
67
src/osgWrappers/serializers/osgSim/LightPointNode.cpp
Normal file
67
src/osgWrappers/serializers/osgSim/LightPointNode.cpp
Normal file
@ -0,0 +1,67 @@
|
||||
#include <osgSim/LightPointNode>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkLightPointList( const osgSim::LightPointNode& node )
|
||||
{
|
||||
return node.getNumLightPoints()>0;
|
||||
}
|
||||
|
||||
static bool readLightPointList( osgDB::InputStream& is, osgSim::LightPointNode& node )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
osgSim::LightPoint pt;
|
||||
is >> osgDB::PROPERTY("LightPoint") >> osgDB::BEGIN_BRACKET;
|
||||
is >> osgDB::PROPERTY("Position") >> pt._position;
|
||||
is >> osgDB::PROPERTY("Color") >> pt._color;
|
||||
|
||||
int blendingMode = 0;
|
||||
is >> osgDB::PROPERTY("Attributes") >> pt._on >> blendingMode >> pt._intensity >> pt._radius;
|
||||
pt._blendingMode = (osgSim::LightPoint::BlendingMode)blendingMode;
|
||||
|
||||
is >> osgDB::PROPERTY("Sector");
|
||||
pt._sector = dynamic_cast<osgSim::Sector*>( is.readObject() );
|
||||
is >> osgDB::PROPERTY("BlinkSequence");
|
||||
pt._blinkSequence = dynamic_cast<osgSim::BlinkSequence*>( is.readObject() );
|
||||
is >> osgDB::END_BRACKET;
|
||||
node.addLightPoint( pt );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeLightPointList( osgDB::OutputStream& os, const osgSim::LightPointNode& node )
|
||||
{
|
||||
unsigned int size = node.getNumLightPoints();
|
||||
os << size << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
const osgSim::LightPoint& pt = node.getLightPoint(i);
|
||||
os << osgDB::PROPERTY("LightPoint") << osgDB::BEGIN_BRACKET << std::endl;
|
||||
os << osgDB::PROPERTY("Position") << pt._position << std::endl;
|
||||
os << osgDB::PROPERTY("Color") << pt._color << std::endl;
|
||||
os << osgDB::PROPERTY("Attributes") << pt._on << (int)pt._blendingMode
|
||||
<< pt._intensity << pt._radius << std::endl;
|
||||
os << osgDB::PROPERTY("Sector"); os.writeObject( pt._sector.get() );
|
||||
os << osgDB::PROPERTY("BlinkSequence"); os.writeObject( pt._blinkSequence.get() );
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgSim_LightPointNode,
|
||||
new osgSim::LightPointNode,
|
||||
osgSim::LightPointNode,
|
||||
"osg::Object osg::Node osgSim::LightPointNode" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( LightPointList ); // _lightPointList
|
||||
ADD_FLOAT_SERIALIZER( MinPixelSize, 0.0f ); // _minPixelSize
|
||||
ADD_FLOAT_SERIALIZER( MaxPixelSize, 30.0f ); // _maxPixelSize
|
||||
ADD_FLOAT_SERIALIZER( MaxVisibleDistance2, FLT_MAX ); // _maxVisibleDistance2
|
||||
ADD_OBJECT_SERIALIZER( LightPointSystem, osgSim::LightPointSystem, NULL ); // _lightSystem
|
||||
ADD_BOOL_SERIALIZER( PointSprite, false ); // _pointSprites
|
||||
}
|
17
src/osgWrappers/serializers/osgSim/LightPointSystem.cpp
Normal file
17
src/osgWrappers/serializers/osgSim/LightPointSystem.cpp
Normal file
@ -0,0 +1,17 @@
|
||||
#include <osgSim/LightPointSystem>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgSim_LightPointSystem,
|
||||
new osgSim::LightPointSystem,
|
||||
osgSim::LightPointSystem,
|
||||
"osg::Object osgSim::LightPointSystem" )
|
||||
{
|
||||
ADD_FLOAT_SERIALIZER( Intensity, 1.0f ); // _intensity
|
||||
BEGIN_ENUM_SERIALIZER( AnimationState, ANIMATION_ON );
|
||||
ADD_ENUM_VALUE( ANIMATION_ON );
|
||||
ADD_ENUM_VALUE( ANIMATION_OFF );
|
||||
ADD_ENUM_VALUE( ANIMATION_RANDOM );
|
||||
END_ENUM_SERIALIZER(); // _animationState
|
||||
}
|
59
src/osgWrappers/serializers/osgSim/MultiSwitch.cpp
Normal file
59
src/osgWrappers/serializers/osgSim/MultiSwitch.cpp
Normal file
@ -0,0 +1,59 @@
|
||||
#include <osgSim/MultiSwitch>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkValues( const osgSim::MultiSwitch& node )
|
||||
{
|
||||
return node.getSwitchSetList().size()>0;
|
||||
}
|
||||
|
||||
static bool readValues( osgDB::InputStream& is, osgSim::MultiSwitch& node )
|
||||
{
|
||||
unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
is >> osgDB::PROPERTY("SwitchSet");
|
||||
unsigned int valueSize = is.readSize(); is >> osgDB::BEGIN_BRACKET;
|
||||
|
||||
osgSim::MultiSwitch::ValueList values;
|
||||
for ( unsigned int j=0; j<valueSize; ++j )
|
||||
{
|
||||
bool value; is >> value;
|
||||
values.push_back( value );
|
||||
}
|
||||
node.setValueList( i, values );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeValues( osgDB::OutputStream& os, const osgSim::MultiSwitch& node )
|
||||
{
|
||||
const osgSim::MultiSwitch::SwitchSetList& switches = node.getSwitchSetList();
|
||||
os.writeSize( switches.size() ); os << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( unsigned int i=0; i<switches.size(); ++i )
|
||||
{
|
||||
const osgSim::MultiSwitch::ValueList& values = node.getValueList(i);
|
||||
os << osgDB::PROPERTY("SwitchSet"); os.writeSize( values.size() );
|
||||
os << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( osgSim::MultiSwitch::ValueList::const_iterator itr=values.begin();
|
||||
itr!=values.end(); ++itr )
|
||||
{
|
||||
os << *itr;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgSim_MultiSwitch,
|
||||
new osgSim::MultiSwitch,
|
||||
osgSim::MultiSwitch,
|
||||
"osg::Object osg::Node osg::Group osgSim::MultiSwitch" )
|
||||
{
|
||||
ADD_BOOL_SERIALIZER( NewChildDefaultValue, true ); // _newChildDefaultValue
|
||||
ADD_UINT_SERIALIZER( ActiveSwitchSet, 0 ); // _activeSwitchSet
|
||||
ADD_USER_SERIALIZER( Values ); // _values
|
||||
}
|
39
src/osgWrappers/serializers/osgSim/ObjectRecordData.cpp
Normal file
39
src/osgWrappers/serializers/osgSim/ObjectRecordData.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
#include <osgSim/ObjectRecordData>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkData( const osgSim::ObjectRecordData& data )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool readData( osgDB::InputStream& is, osgSim::ObjectRecordData& data )
|
||||
{
|
||||
is >> osgDB::PROPERTY("Flags") >> data._flags;
|
||||
is >> osgDB::PROPERTY("RelativePriority") >> data._relativePriority;
|
||||
is >> osgDB::PROPERTY("Transparency") >> data._transparency;
|
||||
is >> osgDB::PROPERTY("EffectID1") >> data._effectID1;
|
||||
is >> osgDB::PROPERTY("EffectID2") >> data._effectID2;
|
||||
is >> osgDB::PROPERTY("Significance") >> data._significance;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeData( osgDB::OutputStream& os, const osgSim::ObjectRecordData& data )
|
||||
{
|
||||
os << osgDB::PROPERTY("Flags") << data._flags << std::endl;
|
||||
os << osgDB::PROPERTY("RelativePriority") << data._relativePriority << std::endl;
|
||||
os << osgDB::PROPERTY("Transparency") << data._transparency << std::endl;
|
||||
os << osgDB::PROPERTY("EffectID1") << data._effectID1 << std::endl;
|
||||
os << osgDB::PROPERTY("EffectID2") << data._effectID2 << std::endl;
|
||||
os << osgDB::PROPERTY("Significance") << data._significance << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgSim_ObjectRecordData,
|
||||
new osgSim::ObjectRecordData,
|
||||
osgSim::ObjectRecordData,
|
||||
"osg::Object osgSim::ObjectRecordData" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( Data );
|
||||
}
|
24
src/osgWrappers/serializers/osgSim/OverlayNode.cpp
Normal file
24
src/osgWrappers/serializers/osgSim/OverlayNode.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
#include <osgSim/OverlayNode>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgSim_OverlayNode,
|
||||
new osgSim::OverlayNode,
|
||||
osgSim::OverlayNode,
|
||||
"osg::Object osg::Node osg::Group osgSim::OverlayNode" )
|
||||
{
|
||||
BEGIN_ENUM_SERIALIZER( OverlayTechnique, OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY );
|
||||
ADD_ENUM_VALUE( OBJECT_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY );
|
||||
ADD_ENUM_VALUE( VIEW_DEPENDENT_WITH_ORTHOGRAPHIC_OVERLAY );
|
||||
ADD_ENUM_VALUE( VIEW_DEPENDENT_WITH_PERSPECTIVE_OVERLAY );
|
||||
END_ENUM_SERIALIZER(); // _overlayTechnique
|
||||
|
||||
ADD_OBJECT_SERIALIZER( OverlaySubgraph, osg::Node, NULL ); // _overlaySubgraph
|
||||
ADD_GLENUM_SERIALIZER( TexEnvMode, GLenum, GL_DECAL ); // _texEnvMode
|
||||
ADD_UINT_SERIALIZER( OverlayTextureUnit, 1 ); // _textureUnit
|
||||
ADD_UINT_SERIALIZER( OverlayTextureSizeHint, 1024 ); // _textureSizeHint
|
||||
ADD_VEC4_SERIALIZER( OverlayClearColor, osg::Vec4() ); // _overlayClearColor
|
||||
ADD_BOOL_SERIALIZER( ContinuousUpdate, false ); // _continuousUpdate
|
||||
ADD_DOUBLE_SERIALIZER( OverlayBaseHeight, -100.0 ); // _overlayBaseHeight
|
||||
}
|
146
src/osgWrappers/serializers/osgSim/ScalarBar.cpp
Normal file
146
src/osgWrappers/serializers/osgSim/ScalarBar.cpp
Normal file
@ -0,0 +1,146 @@
|
||||
#include <osgSim/ScalarBar>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
// _stc
|
||||
static bool checkScalarsToColors( const osgSim::ScalarBar& bar )
|
||||
{ return bar.getScalarsToColors()!=NULL; }
|
||||
|
||||
static bool readScalarsToColors( osgDB::InputStream& is, osgSim::ScalarBar& bar )
|
||||
{
|
||||
float min, max;
|
||||
is >> osgDB::BEGIN_BRACKET;
|
||||
is >> osgDB::PROPERTY("Range") >> min >> max;
|
||||
|
||||
bool hasColorRange = false;
|
||||
unsigned int colorSize = 0;
|
||||
is >> osgDB::PROPERTY("Colors") >> hasColorRange >> colorSize;
|
||||
if ( !hasColorRange )
|
||||
{
|
||||
osgSim::ScalarsToColors* stc = new osgSim::ScalarsToColors(min, max);
|
||||
bar.setScalarsToColors( stc );
|
||||
}
|
||||
else
|
||||
{
|
||||
is >> osgDB::BEGIN_BRACKET;
|
||||
std::vector<osg::Vec4> colors;
|
||||
for ( unsigned int i=0; i<colorSize; ++i )
|
||||
{
|
||||
osg::Vec4 color; is >> color;
|
||||
colors.push_back( color );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
|
||||
osgSim::ColorRange* cr = new osgSim::ColorRange(min, max, colors);
|
||||
bar.setScalarsToColors( cr );
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeScalarsToColors( osgDB::OutputStream& os, const osgSim::ScalarBar& bar )
|
||||
{
|
||||
const osgSim::ScalarsToColors* stc = bar.getScalarsToColors();
|
||||
os << osgDB::BEGIN_BRACKET << std::endl;
|
||||
os << osgDB::PROPERTY("Range") << stc->getMin() << stc->getMax() << std::endl;
|
||||
os << osgDB::PROPERTY("Colors");
|
||||
|
||||
unsigned int colorSize = 0;
|
||||
const osgSim::ColorRange* cr = dynamic_cast<const osgSim::ColorRange*>(stc);
|
||||
if ( cr )
|
||||
{
|
||||
const std::vector<osg::Vec4>& colors = cr->getColors();
|
||||
colorSize = colors.size();
|
||||
|
||||
os << true << colorSize << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( unsigned int i=0; i<colorSize; ++i )
|
||||
{
|
||||
os << colors[i] << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
}
|
||||
else
|
||||
os << false << colorSize << std::endl;
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
// _sp
|
||||
static bool checkScalarPrinter( const osgSim::ScalarBar& bar )
|
||||
{
|
||||
return bar.getScalarPrinter()!=NULL &&
|
||||
dynamic_cast<const osg::Object*>(bar.getScalarPrinter());
|
||||
}
|
||||
|
||||
static bool readScalarPrinter( osgDB::InputStream& is, osgSim::ScalarBar& bar )
|
||||
{
|
||||
is >> osgDB::BEGIN_BRACKET;
|
||||
osgSim::ScalarBar::ScalarPrinter* sp =
|
||||
dynamic_cast<osgSim::ScalarBar::ScalarPrinter*>( is.readObject() );
|
||||
if ( sp ) bar.setScalarPrinter( sp );
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeScalarPrinter( osgDB::OutputStream& os, const osgSim::ScalarBar& bar )
|
||||
{
|
||||
os << osgDB::BEGIN_BRACKET << std::endl;
|
||||
os.writeObject( dynamic_cast<const osg::Object*>(bar.getScalarPrinter()) );
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
// _textProperties
|
||||
static bool checkTextProperties( const osgSim::ScalarBar& bar )
|
||||
{ return true; }
|
||||
|
||||
static bool readTextProperties( osgDB::InputStream& is, osgSim::ScalarBar& bar )
|
||||
{
|
||||
osgSim::ScalarBar::TextProperties prop;
|
||||
int resX, resY;
|
||||
is >> osgDB::BEGIN_BRACKET;
|
||||
is >> osgDB::PROPERTY("Font") >> prop._fontFile;
|
||||
is >> osgDB::PROPERTY("Resolution") >> resX >> resY;
|
||||
is >> osgDB::PROPERTY("CharacterSize") >> prop._characterSize;
|
||||
is >> osgDB::PROPERTY("Color") >> prop._fontFile;
|
||||
is >> osgDB::END_BRACKET;
|
||||
|
||||
prop._fontResolution = std::pair<int, int>(resX, resY);
|
||||
bar.setTextProperties( prop );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeTextProperties( osgDB::OutputStream& os, const osgSim::ScalarBar& bar )
|
||||
{
|
||||
const osgSim::ScalarBar::TextProperties& prop = bar.getTextProperties();
|
||||
os << osgDB::BEGIN_BRACKET << std::endl;
|
||||
os << osgDB::PROPERTY("Font") << prop._fontFile << std::endl;
|
||||
os << osgDB::PROPERTY("Resolution") << prop._fontResolution.first
|
||||
<< prop._fontResolution.second << std::endl;
|
||||
os << osgDB::PROPERTY("CharacterSize") << prop._characterSize << std::endl;
|
||||
os << osgDB::PROPERTY("Color") << prop._color << std::endl;
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgSim_ScalarBar,
|
||||
new osgSim::ScalarBar,
|
||||
osgSim::ScalarBar,
|
||||
"osg::Object osg::Node osg::Geode osgSim::ScalarBar" )
|
||||
{
|
||||
ADD_INT_SERIALIZER( NumColors, 256 ); // _numColors
|
||||
ADD_INT_SERIALIZER( NumLabels, 0 ); // _numLabels
|
||||
ADD_USER_SERIALIZER( ScalarsToColors ); // _stc
|
||||
ADD_STRING_SERIALIZER( Title, "" ); // _title
|
||||
ADD_VEC3_SERIALIZER( Position, osg::Vec3() ); // _position
|
||||
ADD_FLOAT_SERIALIZER( Width, 0.0f ); // _width
|
||||
ADD_FLOAT_SERIALIZER( AspectRatio, 0.0f ); // _aspectRatio
|
||||
|
||||
BEGIN_ENUM_SERIALIZER( Orientation, HORIZONTAL );
|
||||
ADD_ENUM_VALUE( HORIZONTAL );
|
||||
ADD_ENUM_VALUE( VERTICAL );
|
||||
END_ENUM_SERIALIZER(); // _orientation
|
||||
|
||||
ADD_USER_SERIALIZER( ScalarPrinter ); // _sp
|
||||
ADD_USER_SERIALIZER( TextProperties ); // _textProperties
|
||||
}
|
11
src/osgWrappers/serializers/osgSim/Sector.cpp
Normal file
11
src/osgWrappers/serializers/osgSim/Sector.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include <osgSim/Sector>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgSim_Sector,
|
||||
/*new osgSim::Sector*/NULL,
|
||||
osgSim::Sector,
|
||||
"osg::Object osgSim::Sector" )
|
||||
{
|
||||
}
|
12
src/osgWrappers/serializers/osgSim/SequenceGroup.cpp
Normal file
12
src/osgWrappers/serializers/osgSim/SequenceGroup.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include <osgSim/BlinkSequence>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgSim_SequenceGroup,
|
||||
new osgSim::SequenceGroup,
|
||||
osgSim::SequenceGroup,
|
||||
"osg::Object osgSim::SequenceGroup" )
|
||||
{
|
||||
ADD_DOUBLE_SERIALIZER( BaseTime, 0.0 ); // _baseTime
|
||||
}
|
71
src/osgWrappers/serializers/osgSim/ShapeAttributeList.cpp
Normal file
71
src/osgWrappers/serializers/osgSim/ShapeAttributeList.cpp
Normal file
@ -0,0 +1,71 @@
|
||||
#include <osgSim/ShapeAttribute>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkAttributes( const osgSim::ShapeAttributeList& list )
|
||||
{
|
||||
return list.size()>0;
|
||||
}
|
||||
|
||||
static bool readAttributes( osgDB::InputStream& is, osgSim::ShapeAttributeList& list )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
std::string name; int type;
|
||||
is >> osgDB::PROPERTY("ShapeAttribute") >> name;
|
||||
is >> osgDB::PROPERTY("Type") >> type;
|
||||
switch ( type )
|
||||
{
|
||||
case osgSim::ShapeAttribute::INTEGER:
|
||||
{
|
||||
int value; is >> value;
|
||||
list.push_back( osgSim::ShapeAttribute(name.c_str(), value) );
|
||||
}
|
||||
break;
|
||||
case osgSim::ShapeAttribute::DOUBLE:
|
||||
{
|
||||
double value; is >> value;
|
||||
list.push_back( osgSim::ShapeAttribute(name.c_str(), value) );
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
std::string value; is >> value;
|
||||
list.push_back( osgSim::ShapeAttribute(name.c_str(), value.c_str()) );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeAttributes( osgDB::OutputStream& os, const osgSim::ShapeAttributeList& list )
|
||||
{
|
||||
unsigned int size = list.size();
|
||||
os << size << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
const osgSim::ShapeAttribute& sa = list[i];
|
||||
os << osgDB::PROPERTY("ShapeAttribute") << sa.getName();
|
||||
os << osgDB::PROPERTY("Type") << (int)sa.getType();
|
||||
switch ( sa.getType() )
|
||||
{
|
||||
case osgSim::ShapeAttribute::INTEGER: os << sa.getInt() << std::endl; break;
|
||||
case osgSim::ShapeAttribute::DOUBLE: os << sa.getDouble() << std::endl; break;
|
||||
default: os << std::string(sa.getString()) << std::endl; break;
|
||||
}
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgSim_ShapeAttributeList,
|
||||
new osgSim::ShapeAttributeList,
|
||||
osgSim::ShapeAttributeList,
|
||||
"osg::Object osgSim::ShapeAttributeList" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( Attributes );
|
||||
}
|
39
src/osgWrappers/serializers/osgSim/SphereSegment.cpp
Normal file
39
src/osgWrappers/serializers/osgSim/SphereSegment.cpp
Normal file
@ -0,0 +1,39 @@
|
||||
#include <osgSim/SphereSegment>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkArea( const osgSim::SphereSegment& sphere )
|
||||
{ return true; }
|
||||
|
||||
static bool readArea( osgDB::InputStream& is, osgSim::SphereSegment& sphere )
|
||||
{
|
||||
float azMin, azMax, elevMin, elevMax;
|
||||
is >> azMin >> azMax >> elevMin >> elevMax;
|
||||
sphere.setArea( azMin, azMax, elevMin, elevMax );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeArea( osgDB::OutputStream& os, const osgSim::SphereSegment& sphere )
|
||||
{
|
||||
float azMin, azMax, elevMin, elevMax;
|
||||
sphere.getArea( azMin, azMax, elevMin, elevMax );
|
||||
os << azMin << azMax << elevMin << elevMax << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgSim_SphereSegment,
|
||||
new osgSim::SphereSegment,
|
||||
osgSim::SphereSegment,
|
||||
"osg::Object osg::Node osg::Geode osgSim::SphereSegment" )
|
||||
{
|
||||
ADD_VEC3_SERIALIZER( Centre, osg::Vec3() ); // _centre
|
||||
ADD_FLOAT_SERIALIZER( Radius, 1.0f ); // _radius
|
||||
ADD_USER_SERIALIZER( Area ); // _azMin, _azMax, _elevMin, _elevMax
|
||||
ADD_INT_SERIALIZER( Density, 10 ); // _density
|
||||
ADD_INT_SERIALIZER( DrawMask, osgSim::SphereSegment::ALL ); // _drawMask
|
||||
ADD_VEC4_SERIALIZER( SurfaceColor, osg::Vec4() ); // _surfaceColor
|
||||
ADD_VEC4_SERIALIZER( SpokeColor, osg::Vec4() ); // _spokeColor
|
||||
ADD_VEC4_SERIALIZER( EdgeLineColor, osg::Vec4() ); // _edgeLineColor
|
||||
ADD_VEC4_SERIALIZER( SideColor, osg::Vec4() ); // _planeColor
|
||||
}
|
14
src/osgWrappers/serializers/osgSim/VisibilityGroup.cpp
Normal file
14
src/osgWrappers/serializers/osgSim/VisibilityGroup.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include <osgSim/VisibilityGroup>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgSim_VisibilityGroup,
|
||||
new osgSim::VisibilityGroup,
|
||||
osgSim::VisibilityGroup,
|
||||
"osg::Object osg::Node osg::Group osgSim::VisibilityGroup" )
|
||||
{
|
||||
ADD_OBJECT_SERIALIZER( VisibilityVolume, osg::Node, NULL ); // _visibilityVolume
|
||||
ADD_UINT_SERIALIZER( VolumeIntersectionMask, 0xffffffff ); // _volumeIntersectionMask
|
||||
ADD_FLOAT_SERIALIZER( SegmentLength, 0.0f ); // _segmentLength
|
||||
}
|
11
src/osgWrappers/serializers/osgVolume/AlphaFuncProperty.cpp
Normal file
11
src/osgWrappers/serializers/osgVolume/AlphaFuncProperty.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include <osgVolume/Property>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_AlphaFuncProperty,
|
||||
new osgVolume::AlphaFuncProperty,
|
||||
osgVolume::AlphaFuncProperty,
|
||||
"osg::Object osgVolume::Property osgVolume::ScalarProperty osgVolume::AlphaFuncProperty" )
|
||||
{
|
||||
}
|
7
src/osgWrappers/serializers/osgVolume/CMakeLists.txt
Normal file
7
src/osgWrappers/serializers/osgVolume/CMakeLists.txt
Normal file
@ -0,0 +1,7 @@
|
||||
FILE(GLOB TARGET_SRC *.cpp)
|
||||
FILE(GLOB TARGET_H *.h)
|
||||
|
||||
SET(TARGET_ADDED_LIBRARIES osgVolume )
|
||||
|
||||
#### end var setup ###
|
||||
SETUP_PLUGIN(osgvolume)
|
41
src/osgWrappers/serializers/osgVolume/CompositeLayer.cpp
Normal file
41
src/osgWrappers/serializers/osgVolume/CompositeLayer.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
#include <osgVolume/Layer>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkLayers( const osgVolume::CompositeLayer& layer )
|
||||
{
|
||||
return layer.getNumLayers()>0;
|
||||
}
|
||||
|
||||
static bool readLayers( osgDB::InputStream& is, osgVolume::CompositeLayer& layer )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
osgVolume::Layer* child = dynamic_cast<osgVolume::Layer*>( is.readObject() );
|
||||
if ( child ) layer.addLayer( child );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeLayers( osgDB::OutputStream& os, const osgVolume::CompositeLayer& layer )
|
||||
{
|
||||
unsigned int size = layer.getNumLayers();
|
||||
os << size << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
os << layer.getLayer(i);
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_CompositeLayer,
|
||||
new osgVolume::CompositeLayer,
|
||||
osgVolume::CompositeLayer,
|
||||
"osg::Object osgVolume::Layer osgVolume::CompositeLayer" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( Layers ); // _layers
|
||||
}
|
41
src/osgWrappers/serializers/osgVolume/CompositeProperty.cpp
Normal file
41
src/osgWrappers/serializers/osgVolume/CompositeProperty.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
#include <osgVolume/Property>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkProperties( const osgVolume::CompositeProperty& prop )
|
||||
{
|
||||
return prop.getNumProperties()>0;
|
||||
}
|
||||
|
||||
static bool readProperties( osgDB::InputStream& is, osgVolume::CompositeProperty& prop )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
osgVolume::Property* child = dynamic_cast<osgVolume::Property*>( is.readObject() );
|
||||
if ( child ) prop.addProperty( child );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeProperties( osgDB::OutputStream& os, const osgVolume::CompositeProperty& prop )
|
||||
{
|
||||
unsigned int size = prop.getNumProperties();
|
||||
os << size << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
os << prop.getProperty(i);
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_CompositeProperty,
|
||||
new osgVolume::CompositeProperty,
|
||||
osgVolume::CompositeProperty,
|
||||
"osg::Object osgVolume::Property osgVolume::CompositeProperty" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( Properties ); // _properties
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
#include <osgVolume/FixedFunctionTechnique>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_FixedFunctionTechnique,
|
||||
new osgVolume::FixedFunctionTechnique,
|
||||
osgVolume::FixedFunctionTechnique,
|
||||
"osg::Object osgVolume::VolumeTechnique osgVolume::FixedFunctionTechnique" )
|
||||
{
|
||||
ADD_UINT_SERIALIZER( NumSlices, 500 ); // _numSlices
|
||||
}
|
32
src/osgWrappers/serializers/osgVolume/ImageDetails.cpp
Normal file
32
src/osgWrappers/serializers/osgVolume/ImageDetails.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include <osgVolume/Layer>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkMatrix( const osgVolume::ImageDetails& details )
|
||||
{
|
||||
return details.getMatrix()!=NULL;
|
||||
}
|
||||
|
||||
static bool readMatrix( osgDB::InputStream& is, osgVolume::ImageDetails& details )
|
||||
{
|
||||
osg::Matrixd matrix; is >> matrix;
|
||||
details.setMatrix( new osg::RefMatrix(matrix) );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeMatrix( osgDB::OutputStream& os, const osgVolume::ImageDetails& details )
|
||||
{
|
||||
os << *(details.getMatrix()) << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_ImageDetails,
|
||||
new osgVolume::ImageDetails,
|
||||
osgVolume::ImageDetails,
|
||||
"osg::Object osgVolume::ImageDetails" )
|
||||
{
|
||||
ADD_VEC4_SERIALIZER( TexelOffset, osg::Vec4() ); // _texelOffset
|
||||
ADD_VEC4_SERIALIZER( TexelScale, osg::Vec4() ); // _texelScale
|
||||
ADD_USER_SERIALIZER( Matrix ); // _matrix
|
||||
}
|
14
src/osgWrappers/serializers/osgVolume/ImageLayer.cpp
Normal file
14
src/osgWrappers/serializers/osgVolume/ImageLayer.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include <osgVolume/Layer>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_ImageLayer,
|
||||
new osgVolume::ImageLayer,
|
||||
osgVolume::ImageLayer,
|
||||
"osg::Object osgVolume::Layer osgVolume::ImageLayer" )
|
||||
{
|
||||
ADD_VEC4_SERIALIZER( TexelOffset, osg::Vec4() ); // _texelOffset
|
||||
ADD_VEC4_SERIALIZER( TexelScale, osg::Vec4() ); // _texelScale
|
||||
ADD_IMAGE_SERIALIZER( Image, osg::Image, NULL ); // _image
|
||||
}
|
11
src/osgWrappers/serializers/osgVolume/IsoSurfaceProperty.cpp
Normal file
11
src/osgWrappers/serializers/osgVolume/IsoSurfaceProperty.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include <osgVolume/Property>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_IsoSurfaceProperty,
|
||||
new osgVolume::IsoSurfaceProperty,
|
||||
osgVolume::IsoSurfaceProperty,
|
||||
"osg::Object osgVolume::Property osgVolume::ScalarProperty osgVolume::IsoSurfaceProperty" )
|
||||
{
|
||||
}
|
32
src/osgWrappers/serializers/osgVolume/Layer.cpp
Normal file
32
src/osgWrappers/serializers/osgVolume/Layer.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
#include <osgVolume/Layer>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
#define FILTER_FUNCTIONS( PROP ) \
|
||||
static bool check##PROP( const osgVolume::Layer& ) { return true; } \
|
||||
static bool read##PROP( osgDB::InputStream& is, osgVolume::Layer& layer ) { \
|
||||
DEF_GLENUM(mode); is >> mode; \
|
||||
layer.set##PROP( (osg::Texture::FilterMode)mode.get() ); \
|
||||
return true; \
|
||||
} \
|
||||
static bool write##PROP( osgDB::OutputStream& os, const osgVolume::Layer& layer ) { \
|
||||
os << GLENUM(layer.get##PROP()) << std::endl; \
|
||||
return true; \
|
||||
}
|
||||
|
||||
FILTER_FUNCTIONS( MinFilter )
|
||||
FILTER_FUNCTIONS( MagFilter )
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_Layer,
|
||||
new osgVolume::Layer,
|
||||
osgVolume::Layer,
|
||||
"osg::Object osgVolume::Layer" )
|
||||
{
|
||||
ADD_STRING_SERIALIZER( FileName, "" ); // _filename
|
||||
ADD_OBJECT_SERIALIZER( Locator, osgVolume::Locator, NULL ); // _locator
|
||||
ADD_VEC4_SERIALIZER( DefaultValue, osg::Vec4() ); // _defaultValue
|
||||
ADD_USER_SERIALIZER( MinFilter ); // _minFilter
|
||||
ADD_USER_SERIALIZER( MagFilter ); // _magFilter
|
||||
ADD_OBJECT_SERIALIZER( Property, osgVolume::Property, NULL ); // _property
|
||||
}
|
11
src/osgWrappers/serializers/osgVolume/LightingProperty.cpp
Normal file
11
src/osgWrappers/serializers/osgVolume/LightingProperty.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include <osgVolume/Property>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_LightingProperty,
|
||||
new osgVolume::LightingProperty,
|
||||
osgVolume::LightingProperty,
|
||||
"osg::Object osgVolume::Property osgVolume::LightingProperty" )
|
||||
{
|
||||
}
|
44
src/osgWrappers/serializers/osgVolume/Locator.cpp
Normal file
44
src/osgWrappers/serializers/osgVolume/Locator.cpp
Normal file
@ -0,0 +1,44 @@
|
||||
#include <osgVolume/Locator>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkLocatorCallbacks( const osgVolume::Locator& locator )
|
||||
{
|
||||
return locator.getLocatorCallbacks().size()>0;
|
||||
}
|
||||
|
||||
static bool readLocatorCallbacks( osgDB::InputStream& is, osgVolume::Locator& locator )
|
||||
{
|
||||
unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
osgVolume::Locator::LocatorCallback* cb =
|
||||
dynamic_cast<osgVolume::Locator::LocatorCallback*>( is.readObject() );
|
||||
if ( cb ) locator.addCallback( cb );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeLocatorCallbacks( osgDB::OutputStream& os, const osgVolume::Locator& locator )
|
||||
{
|
||||
const osgVolume::Locator::LocatorCallbacks& callbacks = locator.getLocatorCallbacks();
|
||||
os.writeSize( callbacks.size() ); os << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( osgVolume::Locator::LocatorCallbacks::const_iterator itr=callbacks.begin();
|
||||
itr!=callbacks.end(); ++itr )
|
||||
{
|
||||
os << itr->get();
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_Locator,
|
||||
new osgVolume::Locator,
|
||||
osgVolume::Locator,
|
||||
"osg::Object osgVolume::Locator" )
|
||||
{
|
||||
ADD_MATRIXD_SERIALIZER( Transform, osg::Matrixd() ); // _transform
|
||||
ADD_USER_SERIALIZER( LocatorCallbacks ); // _locatorCallbacks
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
#include <osgVolume/Property>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_MaximumIntensityProjectionProperty,
|
||||
new osgVolume::MaximumIntensityProjectionProperty,
|
||||
osgVolume::MaximumIntensityProjectionProperty,
|
||||
"osg::Object osgVolume::Property osgVolume::MaximumIntensityProjectionProperty" )
|
||||
{
|
||||
}
|
11
src/osgWrappers/serializers/osgVolume/Property.cpp
Normal file
11
src/osgWrappers/serializers/osgVolume/Property.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include <osgVolume/Property>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_Property,
|
||||
new osgVolume::Property,
|
||||
osgVolume::Property,
|
||||
"osg::Object osgVolume::Property" )
|
||||
{
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
#undef OBJECT_CAST
|
||||
#define OBJECT_CAST dynamic_cast
|
||||
|
||||
#include <osgVolume/Property>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_PropertyAdjustmentCallback,
|
||||
new osgVolume::PropertyAdjustmentCallback,
|
||||
osgVolume::PropertyAdjustmentCallback,
|
||||
"osg::Object osgVolume::PropertyAdjustmentCallback" )
|
||||
{
|
||||
ADD_INT_SERIALIZER( KeyEventCycleForward, 'v' ); // _cyleForwardKey
|
||||
ADD_INT_SERIALIZER( KeyEventCycleBackward, 'V' ); // _cyleBackwardKey
|
||||
ADD_INT_SERIALIZER( KeyEventActivatesTransparencyAdjustment, 't' ); // _transparencyKey
|
||||
ADD_INT_SERIALIZER( KeyEventActivatesAlphaFuncAdjustment, 'a' ); // _alphaFuncKey
|
||||
ADD_INT_SERIALIZER( KeyEventActivatesSampleDensityAdjustment, 'd' ); // _sampleDensityKey
|
||||
}
|
||||
|
||||
#undef OBJECT_CAST
|
||||
#define OBJECT_CAST static_cast
|
11
src/osgWrappers/serializers/osgVolume/RayTracedTechnique.cpp
Normal file
11
src/osgWrappers/serializers/osgVolume/RayTracedTechnique.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include <osgVolume/RayTracedTechnique>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_RayTracedTechnique,
|
||||
new osgVolume::RayTracedTechnique,
|
||||
osgVolume::RayTracedTechnique,
|
||||
"osg::Object osgVolume::VolumeTechnique osgVolume::RayTracedTechnique" )
|
||||
{
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
#include <osgVolume/Property>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_SampleDensityProperty,
|
||||
new osgVolume::SampleDensityProperty,
|
||||
osgVolume::SampleDensityProperty,
|
||||
"osg::Object osgVolume::Property osgVolume::ScalarProperty osgVolume::SampleDensityProperty" )
|
||||
{
|
||||
}
|
14
src/osgWrappers/serializers/osgVolume/ScalarProperty.cpp
Normal file
14
src/osgWrappers/serializers/osgVolume/ScalarProperty.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include <osgVolume/Property>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_ScalarProperty,
|
||||
new osgVolume::ScalarProperty("unknown", 0.0f),
|
||||
osgVolume::ScalarProperty,
|
||||
"osg::Object osgVolume::Property osgVolume::ScalarProperty" )
|
||||
{
|
||||
// FIXME: don't set constructor directly, try implementing a setName() method?
|
||||
|
||||
ADD_FLOAT_SERIALIZER( Value, 1.0f );
|
||||
}
|
12
src/osgWrappers/serializers/osgVolume/SwitchProperty.cpp
Normal file
12
src/osgWrappers/serializers/osgVolume/SwitchProperty.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include <osgVolume/Property>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_SwitchProperty,
|
||||
new osgVolume::SwitchProperty,
|
||||
osgVolume::SwitchProperty,
|
||||
"osg::Object osgVolume::Property osgVolume::CompositeProperty osgVolume::SwitchProperty" )
|
||||
{
|
||||
ADD_INT_SERIALIZER( ActiveProperty, 0 ); // _activeProperty
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
#include <osgVolume/Property>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_TransferFunctionProperty,
|
||||
new osgVolume::TransferFunctionProperty,
|
||||
osgVolume::TransferFunctionProperty,
|
||||
"osg::Object osgVolume::Property osgVolume::TransferFunctionProperty" )
|
||||
{
|
||||
ADD_OBJECT_SERIALIZER( TransferFunction, osg::TransferFunction, NULL ); // _tf
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
#include <osgVolume/Property>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_TransparencyProperty,
|
||||
new osgVolume::TransparencyProperty,
|
||||
osgVolume::TransparencyProperty,
|
||||
"osg::Object osgVolume::Property osgVolume::ScalarProperty osgVolume::TransparencyProperty" )
|
||||
{
|
||||
}
|
12
src/osgWrappers/serializers/osgVolume/Volume.cpp
Normal file
12
src/osgWrappers/serializers/osgVolume/Volume.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include <osgVolume/Volume>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_Volume,
|
||||
new osgVolume::Volume,
|
||||
osgVolume::Volume,
|
||||
"osg::Object osg::Node osg::Group osgVolume::Volume" )
|
||||
{
|
||||
ADD_OBJECT_SERIALIZER( VolumeTechniquePrototype, osgVolume::VolumeTechnique, NULL ); // _volumeTechnique
|
||||
}
|
11
src/osgWrappers/serializers/osgVolume/VolumeTechnique.cpp
Normal file
11
src/osgWrappers/serializers/osgVolume/VolumeTechnique.cpp
Normal file
@ -0,0 +1,11 @@
|
||||
#include <osgVolume/VolumeTechnique>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_VolumeTechnique,
|
||||
new osgVolume::VolumeTechnique,
|
||||
osgVolume::VolumeTechnique,
|
||||
"osg::Object osgVolume::VolumeTechniquee" )
|
||||
{
|
||||
}
|
36
src/osgWrappers/serializers/osgVolume/VolumeTile.cpp
Normal file
36
src/osgWrappers/serializers/osgVolume/VolumeTile.cpp
Normal file
@ -0,0 +1,36 @@
|
||||
#include <osgVolume/Volume>
|
||||
#include <osgVolume/VolumeTile>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkTileID( const osgVolume::VolumeTile& tile )
|
||||
{ return true; }
|
||||
|
||||
static bool readTileID( osgDB::InputStream& is, osgVolume::VolumeTile& tile )
|
||||
{
|
||||
osgVolume::TileID id;
|
||||
is >> id.level >> id.x >> id.y >> id.z;
|
||||
tile.setTileID( id );
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeTileID( osgDB::OutputStream& os, const osgVolume::VolumeTile& tile )
|
||||
{
|
||||
const osgVolume::TileID& id = tile.getTileID();
|
||||
os << id.level << id.x << id.y << id.z << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgVolume_VolumeTile,
|
||||
new osgVolume::VolumeTile,
|
||||
osgVolume::VolumeTile,
|
||||
"osg::Object osg::Node osg::Group osgVolume::VolumeTile" )
|
||||
{
|
||||
ADD_OBJECT_SERIALIZER( Volume, osgVolume::Volume, NULL ); // _volume
|
||||
ADD_BOOL_SERIALIZER( Dirty, false ); // _dirty
|
||||
ADD_USER_SERIALIZER( TileID ); // _tileID
|
||||
ADD_OBJECT_SERIALIZER( VolumeTechnique, osgVolume::VolumeTechnique, NULL ); // _volumeTechnique
|
||||
ADD_OBJECT_SERIALIZER( Locator, osgVolume::Locator, NULL ); // _locator
|
||||
ADD_OBJECT_SERIALIZER( Layer, osgVolume::Layer, NULL ); // _layer
|
||||
}
|
Loading…
Reference in New Issue
Block a user