diff --git a/include/osgSim/BlinkSequence b/include/osgSim/BlinkSequence index f13ac5b30..6cf75ab51 100644 --- a/include/osgSim/BlinkSequence +++ b/include/osgSim/BlinkSequence @@ -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; }; diff --git a/include/osgSim/ColorRange b/include/osgSim/ColorRange index 912e5bbb6..b1e8c5ca9 100644 --- a/include/osgSim/ColorRange +++ b/include/osgSim/ColorRange @@ -47,6 +47,9 @@ public: /** Set the range of colors. */ void setColors(const std::vector& colors); + + /** Get the range of colors */ + const std::vector& getColors() const { return _colors; } /** Get the color for a given scalar value. */ osg::Vec4 getColor(float scalar) const; diff --git a/include/osgSim/DOFTransform b/include/osgSim/DOFTransform index e66dfd322..873a2da8f 100644 --- a/include/osgSim/DOFTransform +++ b/include/osgSim/DOFTransform @@ -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; } diff --git a/include/osgSim/LightPointNode b/include/osgSim/LightPointNode index e50e0e3cd..f4f59f089 100644 --- a/include/osgSim/LightPointNode +++ b/include/osgSim/LightPointNode @@ -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; } diff --git a/include/osgSim/ScalarBar b/include/osgSim/ScalarBar index 7e01693ce..8b90f0487 100644 --- a/include/osgSim/ScalarBar +++ b/include/osgSim/ScalarBar @@ -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. */ diff --git a/include/osgSim/SphereSegment b/include/osgSim/SphereSegment index 89166f70c..1b0313cdf 100644 --- a/include/osgSim/SphereSegment +++ b/include/osgSim/SphereSegment @@ -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); diff --git a/src/osgSim/ScalarBar.cpp b/src/osgSim/ScalarBar.cpp index 1c1264caa..9d3291f63 100644 --- a/src/osgSim/ScalarBar.cpp +++ b/src/osgSim/ScalarBar.cpp @@ -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; } diff --git a/src/osgWrappers/introspection/osgSim/BlinkSequence.cpp b/src/osgWrappers/introspection/osgSim/BlinkSequence.cpp index 642bc7b7c..1dd67e8fe 100644 --- a/src/osgWrappers/introspection/osgSim/BlinkSequence.cpp +++ b/src/osgWrappers/introspection/osgSim/BlinkSequence.cpp @@ -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 diff --git a/src/osgWrappers/introspection/osgSim/ColorRange.cpp b/src/osgWrappers/introspection/osgSim/ColorRange.cpp index c838f2eba..0aeb49e71 100644 --- a/src/osgWrappers/introspection/osgSim/ColorRange.cpp +++ b/src/osgWrappers/introspection/osgSim/ColorRange.cpp @@ -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 diff --git a/src/osgWrappers/introspection/osgSim/DOFTransform.cpp b/src/osgWrappers/introspection/osgSim/DOFTransform.cpp index 3ce27c610..a8da51b14 100644 --- a/src/osgWrappers/introspection/osgSim/DOFTransform.cpp +++ b/src/osgWrappers/introspection/osgSim/DOFTransform.cpp @@ -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); diff --git a/src/osgWrappers/introspection/osgSim/LightPointNode.cpp b/src/osgWrappers/introspection/osgSim/LightPointNode.cpp index 1ab60cf7c..7025c078f 100644 --- a/src/osgWrappers/introspection/osgSim/LightPointNode.cpp +++ b/src/osgWrappers/introspection/osgSim/LightPointNode.cpp @@ -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, diff --git a/src/osgWrappers/introspection/osgSim/ScalarBar.cpp b/src/osgWrappers/introspection/osgSim/ScalarBar.cpp index 9aaf40025..96aee224a 100644 --- a/src/osgWrappers/introspection/osgSim/ScalarBar.cpp +++ b/src/osgWrappers/introspection/osgSim/ScalarBar.cpp @@ -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, diff --git a/src/osgWrappers/introspection/osgSim/SphereSegment.cpp b/src/osgWrappers/introspection/osgSim/SphereSegment.cpp index 4289c6f11..14c7179b9 100644 --- a/src/osgWrappers/introspection/osgSim/SphereSegment.cpp +++ b/src/osgWrappers/introspection/osgSim/SphereSegment.cpp @@ -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 diff --git a/src/osgWrappers/introspection/osgVolume/Property.cpp b/src/osgWrappers/introspection/osgVolume/Property.cpp index 75791cab7..1f4befd47 100644 --- a/src/osgWrappers/introspection/osgVolume/Property.cpp +++ b/src/osgWrappers/introspection/osgVolume/Property.cpp @@ -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); diff --git a/src/osgWrappers/serializers/CMakeLists.txt b/src/osgWrappers/serializers/CMakeLists.txt index 64859f297..941529386 100644 --- a/src/osgWrappers/serializers/CMakeLists.txt +++ b/src/osgWrappers/serializers/CMakeLists.txt @@ -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) diff --git a/src/osgWrappers/serializers/osgSim/AzimElevationSector.cpp b/src/osgWrappers/serializers/osgSim/AzimElevationSector.cpp new file mode 100644 index 000000000..cce68f481 --- /dev/null +++ b/src/osgWrappers/serializers/osgSim/AzimElevationSector.cpp @@ -0,0 +1,49 @@ +#include +#include +#include +#include + +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 +} diff --git a/src/osgWrappers/serializers/osgSim/AzimSector.cpp b/src/osgWrappers/serializers/osgSim/AzimSector.cpp new file mode 100644 index 000000000..1666f82cc --- /dev/null +++ b/src/osgWrappers/serializers/osgSim/AzimSector.cpp @@ -0,0 +1,31 @@ +#include +#include +#include +#include + +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 +} diff --git a/src/osgWrappers/serializers/osgSim/BlinkSequence.cpp b/src/osgWrappers/serializers/osgSim/BlinkSequence.cpp new file mode 100644 index 000000000..11480ace8 --- /dev/null +++ b/src/osgWrappers/serializers/osgSim/BlinkSequence.cpp @@ -0,0 +1,48 @@ +#include +#include +#include +#include + +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> 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 +#include +#include +#include + +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 +} diff --git a/src/osgWrappers/serializers/osgSim/DOFTransform.cpp b/src/osgWrappers/serializers/osgSim/DOFTransform.cpp new file mode 100644 index 000000000..946441470 --- /dev/null +++ b/src/osgWrappers/serializers/osgSim/DOFTransform.cpp @@ -0,0 +1,69 @@ +#include +#include +#include +#include + +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 +} diff --git a/src/osgWrappers/serializers/osgSim/DirectionalSector.cpp b/src/osgWrappers/serializers/osgSim/DirectionalSector.cpp new file mode 100644 index 000000000..eb225c76e --- /dev/null +++ b/src/osgWrappers/serializers/osgSim/DirectionalSector.cpp @@ -0,0 +1,16 @@ +#include +#include +#include +#include + +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 +} diff --git a/src/osgWrappers/serializers/osgSim/ElevationSector.cpp b/src/osgWrappers/serializers/osgSim/ElevationSector.cpp new file mode 100644 index 000000000..3f7d3ad4e --- /dev/null +++ b/src/osgWrappers/serializers/osgSim/ElevationSector.cpp @@ -0,0 +1,29 @@ +#include +#include +#include +#include + +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 +} diff --git a/src/osgWrappers/serializers/osgSim/Impostor.cpp b/src/osgWrappers/serializers/osgSim/Impostor.cpp new file mode 100644 index 000000000..4662bd9dd --- /dev/null +++ b/src/osgWrappers/serializers/osgSim/Impostor.cpp @@ -0,0 +1,12 @@ +#include +#include +#include +#include + +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 +} diff --git a/src/osgWrappers/serializers/osgSim/LightPointNode.cpp b/src/osgWrappers/serializers/osgSim/LightPointNode.cpp new file mode 100644 index 000000000..c279e2c0a --- /dev/null +++ b/src/osgWrappers/serializers/osgSim/LightPointNode.cpp @@ -0,0 +1,67 @@ +#include +#include +#include +#include + +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> 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( is.readObject() ); + is >> osgDB::PROPERTY("BlinkSequence"); + pt._blinkSequence = dynamic_cast( 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 +#include +#include +#include + +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 +} diff --git a/src/osgWrappers/serializers/osgSim/MultiSwitch.cpp b/src/osgWrappers/serializers/osgSim/MultiSwitch.cpp new file mode 100644 index 000000000..8237d1088 --- /dev/null +++ b/src/osgWrappers/serializers/osgSim/MultiSwitch.cpp @@ -0,0 +1,59 @@ +#include +#include +#include +#include + +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> osgDB::PROPERTY("SwitchSet"); + unsigned int valueSize = is.readSize(); is >> osgDB::BEGIN_BRACKET; + + osgSim::MultiSwitch::ValueList values; + for ( unsigned int j=0; j> 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 +#include +#include +#include + +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 ); +} diff --git a/src/osgWrappers/serializers/osgSim/OverlayNode.cpp b/src/osgWrappers/serializers/osgSim/OverlayNode.cpp new file mode 100644 index 000000000..44ab0a2e1 --- /dev/null +++ b/src/osgWrappers/serializers/osgSim/OverlayNode.cpp @@ -0,0 +1,24 @@ +#include +#include +#include +#include + +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 +} diff --git a/src/osgWrappers/serializers/osgSim/ScalarBar.cpp b/src/osgWrappers/serializers/osgSim/ScalarBar.cpp new file mode 100644 index 000000000..a7bbd21bf --- /dev/null +++ b/src/osgWrappers/serializers/osgSim/ScalarBar.cpp @@ -0,0 +1,146 @@ +#include +#include +#include +#include + +// _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 colors; + for ( unsigned int i=0; i> 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(stc); + if ( cr ) + { + const std::vector& colors = cr->getColors(); + colorSize = colors.size(); + + os << true << colorSize << osgDB::BEGIN_BRACKET << std::endl; + for ( unsigned int i=0; i(bar.getScalarPrinter()); +} + +static bool readScalarPrinter( osgDB::InputStream& is, osgSim::ScalarBar& bar ) +{ + is >> osgDB::BEGIN_BRACKET; + osgSim::ScalarBar::ScalarPrinter* sp = + dynamic_cast( 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(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(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 +} diff --git a/src/osgWrappers/serializers/osgSim/Sector.cpp b/src/osgWrappers/serializers/osgSim/Sector.cpp new file mode 100644 index 000000000..04c7e77d3 --- /dev/null +++ b/src/osgWrappers/serializers/osgSim/Sector.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgSim_Sector, + /*new osgSim::Sector*/NULL, + osgSim::Sector, + "osg::Object osgSim::Sector" ) +{ +} diff --git a/src/osgWrappers/serializers/osgSim/SequenceGroup.cpp b/src/osgWrappers/serializers/osgSim/SequenceGroup.cpp new file mode 100644 index 000000000..f44b37f40 --- /dev/null +++ b/src/osgWrappers/serializers/osgSim/SequenceGroup.cpp @@ -0,0 +1,12 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgSim_SequenceGroup, + new osgSim::SequenceGroup, + osgSim::SequenceGroup, + "osg::Object osgSim::SequenceGroup" ) +{ + ADD_DOUBLE_SERIALIZER( BaseTime, 0.0 ); // _baseTime +} diff --git a/src/osgWrappers/serializers/osgSim/ShapeAttributeList.cpp b/src/osgWrappers/serializers/osgSim/ShapeAttributeList.cpp new file mode 100644 index 000000000..74327e37e --- /dev/null +++ b/src/osgWrappers/serializers/osgSim/ShapeAttributeList.cpp @@ -0,0 +1,71 @@ +#include +#include +#include +#include + +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> 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 +#include +#include +#include + +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 +} diff --git a/src/osgWrappers/serializers/osgSim/VisibilityGroup.cpp b/src/osgWrappers/serializers/osgSim/VisibilityGroup.cpp new file mode 100644 index 000000000..1cd16b030 --- /dev/null +++ b/src/osgWrappers/serializers/osgSim/VisibilityGroup.cpp @@ -0,0 +1,14 @@ +#include +#include +#include +#include + +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 +} diff --git a/src/osgWrappers/serializers/osgVolume/AlphaFuncProperty.cpp b/src/osgWrappers/serializers/osgVolume/AlphaFuncProperty.cpp new file mode 100644 index 000000000..ef6ad0a23 --- /dev/null +++ b/src/osgWrappers/serializers/osgVolume/AlphaFuncProperty.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgVolume_AlphaFuncProperty, + new osgVolume::AlphaFuncProperty, + osgVolume::AlphaFuncProperty, + "osg::Object osgVolume::Property osgVolume::ScalarProperty osgVolume::AlphaFuncProperty" ) +{ +} diff --git a/src/osgWrappers/serializers/osgVolume/CMakeLists.txt b/src/osgWrappers/serializers/osgVolume/CMakeLists.txt new file mode 100644 index 000000000..7e665993b --- /dev/null +++ b/src/osgWrappers/serializers/osgVolume/CMakeLists.txt @@ -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) diff --git a/src/osgWrappers/serializers/osgVolume/CompositeLayer.cpp b/src/osgWrappers/serializers/osgVolume/CompositeLayer.cpp new file mode 100644 index 000000000..403410934 --- /dev/null +++ b/src/osgWrappers/serializers/osgVolume/CompositeLayer.cpp @@ -0,0 +1,41 @@ +#include +#include +#include +#include + +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( 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 +#include +#include +#include + +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( 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 +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgVolume_FixedFunctionTechnique, + new osgVolume::FixedFunctionTechnique, + osgVolume::FixedFunctionTechnique, + "osg::Object osgVolume::VolumeTechnique osgVolume::FixedFunctionTechnique" ) +{ + ADD_UINT_SERIALIZER( NumSlices, 500 ); // _numSlices +} diff --git a/src/osgWrappers/serializers/osgVolume/ImageDetails.cpp b/src/osgWrappers/serializers/osgVolume/ImageDetails.cpp new file mode 100644 index 000000000..5d03a3b60 --- /dev/null +++ b/src/osgWrappers/serializers/osgVolume/ImageDetails.cpp @@ -0,0 +1,32 @@ +#include +#include +#include +#include + +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 +} diff --git a/src/osgWrappers/serializers/osgVolume/ImageLayer.cpp b/src/osgWrappers/serializers/osgVolume/ImageLayer.cpp new file mode 100644 index 000000000..12fa93bb9 --- /dev/null +++ b/src/osgWrappers/serializers/osgVolume/ImageLayer.cpp @@ -0,0 +1,14 @@ +#include +#include +#include +#include + +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 +} diff --git a/src/osgWrappers/serializers/osgVolume/IsoSurfaceProperty.cpp b/src/osgWrappers/serializers/osgVolume/IsoSurfaceProperty.cpp new file mode 100644 index 000000000..a53d57ff7 --- /dev/null +++ b/src/osgWrappers/serializers/osgVolume/IsoSurfaceProperty.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgVolume_IsoSurfaceProperty, + new osgVolume::IsoSurfaceProperty, + osgVolume::IsoSurfaceProperty, + "osg::Object osgVolume::Property osgVolume::ScalarProperty osgVolume::IsoSurfaceProperty" ) +{ +} diff --git a/src/osgWrappers/serializers/osgVolume/Layer.cpp b/src/osgWrappers/serializers/osgVolume/Layer.cpp new file mode 100644 index 000000000..251bc7f91 --- /dev/null +++ b/src/osgWrappers/serializers/osgVolume/Layer.cpp @@ -0,0 +1,32 @@ +#include +#include +#include +#include + +#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 +} diff --git a/src/osgWrappers/serializers/osgVolume/LightingProperty.cpp b/src/osgWrappers/serializers/osgVolume/LightingProperty.cpp new file mode 100644 index 000000000..fdb2bf6fb --- /dev/null +++ b/src/osgWrappers/serializers/osgVolume/LightingProperty.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgVolume_LightingProperty, + new osgVolume::LightingProperty, + osgVolume::LightingProperty, + "osg::Object osgVolume::Property osgVolume::LightingProperty" ) +{ +} diff --git a/src/osgWrappers/serializers/osgVolume/Locator.cpp b/src/osgWrappers/serializers/osgVolume/Locator.cpp new file mode 100644 index 000000000..56805bccc --- /dev/null +++ b/src/osgWrappers/serializers/osgVolume/Locator.cpp @@ -0,0 +1,44 @@ +#include +#include +#include +#include + +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( 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 +} diff --git a/src/osgWrappers/serializers/osgVolume/MaximumIntensityProjectionProperty.cpp b/src/osgWrappers/serializers/osgVolume/MaximumIntensityProjectionProperty.cpp new file mode 100644 index 000000000..b05bda8fc --- /dev/null +++ b/src/osgWrappers/serializers/osgVolume/MaximumIntensityProjectionProperty.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgVolume_MaximumIntensityProjectionProperty, + new osgVolume::MaximumIntensityProjectionProperty, + osgVolume::MaximumIntensityProjectionProperty, + "osg::Object osgVolume::Property osgVolume::MaximumIntensityProjectionProperty" ) +{ +} diff --git a/src/osgWrappers/serializers/osgVolume/Property.cpp b/src/osgWrappers/serializers/osgVolume/Property.cpp new file mode 100644 index 000000000..212a8233b --- /dev/null +++ b/src/osgWrappers/serializers/osgVolume/Property.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgVolume_Property, + new osgVolume::Property, + osgVolume::Property, + "osg::Object osgVolume::Property" ) +{ +} diff --git a/src/osgWrappers/serializers/osgVolume/PropertyAdjustmentCallback.cpp b/src/osgWrappers/serializers/osgVolume/PropertyAdjustmentCallback.cpp new file mode 100644 index 000000000..cb15e6822 --- /dev/null +++ b/src/osgWrappers/serializers/osgVolume/PropertyAdjustmentCallback.cpp @@ -0,0 +1,22 @@ +#undef OBJECT_CAST +#define OBJECT_CAST dynamic_cast + +#include +#include +#include +#include + +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 diff --git a/src/osgWrappers/serializers/osgVolume/RayTracedTechnique.cpp b/src/osgWrappers/serializers/osgVolume/RayTracedTechnique.cpp new file mode 100644 index 000000000..1a2f79a99 --- /dev/null +++ b/src/osgWrappers/serializers/osgVolume/RayTracedTechnique.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgVolume_RayTracedTechnique, + new osgVolume::RayTracedTechnique, + osgVolume::RayTracedTechnique, + "osg::Object osgVolume::VolumeTechnique osgVolume::RayTracedTechnique" ) +{ +} diff --git a/src/osgWrappers/serializers/osgVolume/SampleDensityProperty.cpp b/src/osgWrappers/serializers/osgVolume/SampleDensityProperty.cpp new file mode 100644 index 000000000..8f5dc6f32 --- /dev/null +++ b/src/osgWrappers/serializers/osgVolume/SampleDensityProperty.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgVolume_SampleDensityProperty, + new osgVolume::SampleDensityProperty, + osgVolume::SampleDensityProperty, + "osg::Object osgVolume::Property osgVolume::ScalarProperty osgVolume::SampleDensityProperty" ) +{ +} diff --git a/src/osgWrappers/serializers/osgVolume/ScalarProperty.cpp b/src/osgWrappers/serializers/osgVolume/ScalarProperty.cpp new file mode 100644 index 000000000..c41ce8bae --- /dev/null +++ b/src/osgWrappers/serializers/osgVolume/ScalarProperty.cpp @@ -0,0 +1,14 @@ +#include +#include +#include +#include + +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 ); +} diff --git a/src/osgWrappers/serializers/osgVolume/SwitchProperty.cpp b/src/osgWrappers/serializers/osgVolume/SwitchProperty.cpp new file mode 100644 index 000000000..90ced4f9e --- /dev/null +++ b/src/osgWrappers/serializers/osgVolume/SwitchProperty.cpp @@ -0,0 +1,12 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgVolume_SwitchProperty, + new osgVolume::SwitchProperty, + osgVolume::SwitchProperty, + "osg::Object osgVolume::Property osgVolume::CompositeProperty osgVolume::SwitchProperty" ) +{ + ADD_INT_SERIALIZER( ActiveProperty, 0 ); // _activeProperty +} diff --git a/src/osgWrappers/serializers/osgVolume/TransferFunctionProperty.cpp b/src/osgWrappers/serializers/osgVolume/TransferFunctionProperty.cpp new file mode 100644 index 000000000..b1a0d870f --- /dev/null +++ b/src/osgWrappers/serializers/osgVolume/TransferFunctionProperty.cpp @@ -0,0 +1,12 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgVolume_TransferFunctionProperty, + new osgVolume::TransferFunctionProperty, + osgVolume::TransferFunctionProperty, + "osg::Object osgVolume::Property osgVolume::TransferFunctionProperty" ) +{ + ADD_OBJECT_SERIALIZER( TransferFunction, osg::TransferFunction, NULL ); // _tf +} diff --git a/src/osgWrappers/serializers/osgVolume/TransparencyProperty.cpp b/src/osgWrappers/serializers/osgVolume/TransparencyProperty.cpp new file mode 100644 index 000000000..4efa37f8d --- /dev/null +++ b/src/osgWrappers/serializers/osgVolume/TransparencyProperty.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgVolume_TransparencyProperty, + new osgVolume::TransparencyProperty, + osgVolume::TransparencyProperty, + "osg::Object osgVolume::Property osgVolume::ScalarProperty osgVolume::TransparencyProperty" ) +{ +} diff --git a/src/osgWrappers/serializers/osgVolume/Volume.cpp b/src/osgWrappers/serializers/osgVolume/Volume.cpp new file mode 100644 index 000000000..32d55b849 --- /dev/null +++ b/src/osgWrappers/serializers/osgVolume/Volume.cpp @@ -0,0 +1,12 @@ +#include +#include +#include +#include + +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 +} diff --git a/src/osgWrappers/serializers/osgVolume/VolumeTechnique.cpp b/src/osgWrappers/serializers/osgVolume/VolumeTechnique.cpp new file mode 100644 index 000000000..0438ab0f2 --- /dev/null +++ b/src/osgWrappers/serializers/osgVolume/VolumeTechnique.cpp @@ -0,0 +1,11 @@ +#include +#include +#include +#include + +REGISTER_OBJECT_WRAPPER( osgVolume_VolumeTechnique, + new osgVolume::VolumeTechnique, + osgVolume::VolumeTechnique, + "osg::Object osgVolume::VolumeTechniquee" ) +{ +} diff --git a/src/osgWrappers/serializers/osgVolume/VolumeTile.cpp b/src/osgWrappers/serializers/osgVolume/VolumeTile.cpp new file mode 100644 index 000000000..98fa7fa0d --- /dev/null +++ b/src/osgWrappers/serializers/osgVolume/VolumeTile.cpp @@ -0,0 +1,36 @@ +#include +#include +#include +#include +#include + +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 +}