From Wang Rui, "The osgManipulator serializers are ready now. I need to modify the
META_OSGMANIPULATOR_Object macro to ensure these classes could work with their wrappers, and a few naming styles should be changed as well. Fortunately everything seems to compile fine under Windows and my new Ubuntu system. And I finally find the problem of the serializers/osgTerrain/Terrain.cpp, it just missed an "osg::Group" before "osg::CoordinateSystemNode" indicator. With the small fix attached now VPB could generate terrain with osgt/osgb formats."
This commit is contained in:
parent
22dfe6f8d1
commit
0adf26ec6e
@ -51,7 +51,7 @@ class OSGMANIPULATOR_EXPORT AntiSquish: public osg::MatrixTransform
|
||||
_dirty = true;
|
||||
}
|
||||
|
||||
const osg::Vec3d& getPivot() { return _pivot; }
|
||||
const osg::Vec3d& getPivot() const { return _pivot; }
|
||||
|
||||
void setPosition(const osg::Vec3d& pos)
|
||||
{
|
||||
@ -60,7 +60,7 @@ class OSGMANIPULATOR_EXPORT AntiSquish: public osg::MatrixTransform
|
||||
_dirty = true;
|
||||
}
|
||||
|
||||
const osg::Vec3d& getPosition() { return _position; }
|
||||
const osg::Vec3d& getPosition() const { return _position; }
|
||||
|
||||
virtual ~AntiSquish();
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#endif
|
||||
|
||||
#define META_OSGMANIPULATOR_Object(library,name) \
|
||||
virtual osg::Object* cloneType() const { return new name (); } \
|
||||
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const name *>(obj)!=NULL; } \
|
||||
virtual const char* libraryName() const { return #library; }\
|
||||
virtual const char* className() const { return #name; }
|
||||
|
@ -41,7 +41,7 @@ class OSGMANIPULATOR_EXPORT RotateCylinderDragger : public Dragger
|
||||
|
||||
/** Set/Get color for dragger. */
|
||||
inline void setColor(const osg::Vec4& color) { _color = color; setMaterialColor(_color,*this); }
|
||||
inline const osg::Vec4 getColor() const { return _color; }
|
||||
inline const osg::Vec4& getColor() const { return _color; }
|
||||
|
||||
/**
|
||||
* Set/Get pick color for dragger. Pick color is color of the dragger
|
||||
@ -49,7 +49,7 @@ class OSGMANIPULATOR_EXPORT RotateCylinderDragger : public Dragger
|
||||
* been picked.
|
||||
*/
|
||||
inline void setPickColor(const osg::Vec4& color) { _pickColor = color; }
|
||||
inline const osg::Vec4 getPickColor() const { return _pickColor; }
|
||||
inline const osg::Vec4& getPickColor() const { return _pickColor; }
|
||||
|
||||
|
||||
protected:
|
||||
|
@ -41,7 +41,7 @@ class OSGMANIPULATOR_EXPORT RotateSphereDragger : public Dragger
|
||||
|
||||
/** Set/Get color for dragger. */
|
||||
inline void setColor(const osg::Vec4& color) { _color = color; setMaterialColor(_color,*this); }
|
||||
inline const osg::Vec4 getColor() const { return _color; }
|
||||
inline const osg::Vec4& getColor() const { return _color; }
|
||||
|
||||
/**
|
||||
* Set/Get pick color for dragger. Pick color is color of the dragger
|
||||
@ -49,7 +49,7 @@ class OSGMANIPULATOR_EXPORT RotateSphereDragger : public Dragger
|
||||
* been picked.
|
||||
*/
|
||||
inline void setPickColor(const osg::Vec4& color) { _pickColor = color; }
|
||||
inline const osg::Vec4 getPickColor() const { return _pickColor; }
|
||||
inline const osg::Vec4& getPickColor() const { return _pickColor; }
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -51,7 +51,7 @@ class OSGMANIPULATOR_EXPORT Scale1DDragger : public Dragger
|
||||
|
||||
/** Set/Get color for dragger. */
|
||||
inline void setColor(const osg::Vec4& color) { _color = color; setMaterialColor(_color,*this); }
|
||||
inline const osg::Vec4 getColor() const { return _color; }
|
||||
inline const osg::Vec4& getColor() const { return _color; }
|
||||
|
||||
/**
|
||||
* Set/Get pick color for dragger. Pick color is color of the dragger
|
||||
@ -59,19 +59,21 @@ class OSGMANIPULATOR_EXPORT Scale1DDragger : public Dragger
|
||||
* been picked.
|
||||
*/
|
||||
inline void setPickColor(const osg::Vec4& color) { _pickColor = color; }
|
||||
inline const osg::Vec4 getPickColor() const { return _pickColor; }
|
||||
inline const osg::Vec4& getPickColor() const { return _pickColor; }
|
||||
|
||||
/** Set/Get left and right handle nodes for dragger. */
|
||||
inline void setLeftHandleNode (osg::Node& node) { _leftHandleNode = &node; }
|
||||
inline void setRightHandleNode(osg::Node& node) { _rightHandleNode = &node; }
|
||||
inline osg::Node* getLeftHandleNode() { return _leftHandleNode.get(); }
|
||||
inline const osg::Node* getLeftHandleNode() const { return _leftHandleNode.get(); }
|
||||
inline osg::Node* getRightHandleNode() { return _rightHandleNode.get(); }
|
||||
inline const osg::Node* getRightHandleNode() const { return _rightHandleNode.get(); }
|
||||
|
||||
/** Set left/right handle position. */
|
||||
inline void setLeftHandlePosition(double pos) { _projector->getLineStart() = osg::Vec3d(pos,0.0,0.0); }
|
||||
inline double getLeftHandlePosition() const { return _projector->getLineStart()[0]; }
|
||||
inline void setRightHandlePosition(double pos) { _projector->getLineEnd() = osg::Vec3d(pos,0.0,0.0); }
|
||||
inline double getRightHandlePosition() { return _projector->getLineEnd()[0]; }
|
||||
inline double getRightHandlePosition() const { return _projector->getLineEnd()[0]; }
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -51,7 +51,7 @@ class OSGMANIPULATOR_EXPORT Scale2DDragger : public Dragger
|
||||
|
||||
/** Set/Get color for dragger. */
|
||||
inline void setColor(const osg::Vec4& color) { _color = color; setMaterialColor(_color,*this); }
|
||||
inline const osg::Vec4 getColor() const { return _color; }
|
||||
inline const osg::Vec4& getColor() const { return _color; }
|
||||
|
||||
/**
|
||||
* Set/Get pick color for dragger. Pick color is color of the dragger
|
||||
@ -59,27 +59,31 @@ class OSGMANIPULATOR_EXPORT Scale2DDragger : public Dragger
|
||||
* been picked.
|
||||
*/
|
||||
inline void setPickColor(const osg::Vec4& color) { _pickColor = color; }
|
||||
inline const osg::Vec4 getPickColor() const { return _pickColor; }
|
||||
inline const osg::Vec4& getPickColor() const { return _pickColor; }
|
||||
|
||||
/** Set/Get the handle nodes for dragger. */
|
||||
inline void setTopLeftHandleNode (osg::Node& node) { _topLeftHandleNode = &node; }
|
||||
inline osg::Node* getTopLeftHandleNode() { return _topLeftHandleNode.get(); }
|
||||
inline const osg::Node* getTopLeftHandleNode() const { return _topLeftHandleNode.get(); }
|
||||
inline void setBottomLeftHandleNode (osg::Node& node) { _bottomLeftHandleNode = &node; }
|
||||
inline osg::Node* getBottomLeftHandleNode() { return _bottomLeftHandleNode.get(); }
|
||||
inline const osg::Node* getBottomLeftHandleNode() const { return _bottomLeftHandleNode.get(); }
|
||||
inline void setTopRightHandleNode(osg::Node& node) { _topRightHandleNode = &node; }
|
||||
inline osg::Node* getTopRightHandleNode() { return _topRightHandleNode.get(); }
|
||||
inline const osg::Node* getTopRightHandleNode() const { return _topRightHandleNode.get(); }
|
||||
inline void setBottomRightHandleNode(osg::Node& node) { _bottomRightHandleNode = &node; }
|
||||
inline osg::Node* getBottomRightHandleNode() { return _bottomRightHandleNode.get(); }
|
||||
inline const osg::Node* getBottomRightHandleNode() const { return _bottomRightHandleNode.get(); }
|
||||
|
||||
/** Set/Get the handle nodes postion for dragger. */
|
||||
inline void setTopLeftHandlePosition(const osg::Vec2d& pos) { _topLeftHandlePosition = pos; }
|
||||
const osg::Vec2d& getTopLeftHandlePosition() { return _topLeftHandlePosition; }
|
||||
const osg::Vec2d& getTopLeftHandlePosition() const { return _topLeftHandlePosition; }
|
||||
inline void setBottomLeftHandlePosition(const osg::Vec2d& pos) { _bottomLeftHandlePosition = pos; }
|
||||
const osg::Vec2d& getBottomLeftHandlePosition() { return _bottomLeftHandlePosition; }
|
||||
const osg::Vec2d& getBottomLeftHandlePosition() const { return _bottomLeftHandlePosition; }
|
||||
inline void setTopRightHandlePosition(const osg::Vec2d& pos) { _topRightHandlePosition = pos; }
|
||||
const osg::Vec2d& getTopRightHandlePosition() { return _topRightHandlePosition; }
|
||||
const osg::Vec2d& getTopRightHandlePosition() const { return _topRightHandlePosition; }
|
||||
inline void setBottomRightHandlePosition(const osg::Vec2d& pos){ _bottomRightHandlePosition = pos; }
|
||||
const osg::Vec2d& getBottomRightHandlePosition() { return _bottomRightHandlePosition; }
|
||||
const osg::Vec2d& getBottomRightHandlePosition() const { return _bottomRightHandlePosition; }
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -42,12 +42,12 @@ class OSGMANIPULATOR_EXPORT Translate1DDragger : public Dragger
|
||||
|
||||
/** Set/Get color for dragger. */
|
||||
inline void setColor(const osg::Vec4& color) { _color = color; setMaterialColor(_color,*this); }
|
||||
inline const osg::Vec4 getColor() const { return _color; }
|
||||
inline const osg::Vec4& getColor() const { return _color; }
|
||||
|
||||
/** Set/Get pick color for dragger. Pick color is color of the dragger when picked.
|
||||
It gives a visual feedback to show that the dragger has been picked. */
|
||||
inline void setPickColor(const osg::Vec4& color) { _pickColor = color; }
|
||||
inline const osg::Vec4 getPickColor() const { return _pickColor; }
|
||||
inline const osg::Vec4& getPickColor() const { return _pickColor; }
|
||||
|
||||
inline void setCheckForNodeInNodePath(bool onOff) { _checkForNodeInNodePath = onOff; }
|
||||
|
||||
|
@ -43,12 +43,12 @@ class OSGMANIPULATOR_EXPORT Translate2DDragger : public Dragger
|
||||
|
||||
/** Set/Get color for dragger. */
|
||||
inline void setColor(const osg::Vec4& color) { _color = color; setMaterialColor(_color,*this); }
|
||||
inline const osg::Vec4 getColor() const { return _color; }
|
||||
inline const osg::Vec4& getColor() const { return _color; }
|
||||
|
||||
/** Set/Get pick color for dragger. Pick color is color of the dragger when picked.
|
||||
It gives a visual feedback to show that the dragger has been picked. */
|
||||
inline void setPickColor(const osg::Vec4& color) { _pickColor = color; }
|
||||
inline const osg::Vec4 getPickColor() const { return _pickColor; }
|
||||
inline const osg::Vec4& getPickColor() const { return _pickColor; }
|
||||
|
||||
protected:
|
||||
|
||||
|
@ -40,6 +40,7 @@ SET(TARGET_COMMON_LIBRARIES
|
||||
ADD_SUBDIRECTORY(osg)
|
||||
ADD_SUBDIRECTORY(osgAnimation)
|
||||
ADD_SUBDIRECTORY(osgFX)
|
||||
ADD_SUBDIRECTORY(osgManipulator)
|
||||
ADD_SUBDIRECTORY(osgParticle)
|
||||
ADD_SUBDIRECTORY(osgShadow)
|
||||
ADD_SUBDIRECTORY(osgTerrain)
|
||||
|
13
src/osgWrappers/serializers/osgManipulator/AntiSquish.cpp
Normal file
13
src/osgWrappers/serializers/osgManipulator/AntiSquish.cpp
Normal file
@ -0,0 +1,13 @@
|
||||
#include <osgManipulator/AntiSquish>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgManipulator_AntiSquish,
|
||||
new osgManipulator::AntiSquish,
|
||||
osgManipulator::AntiSquish,
|
||||
"osg::Object osg::Node osg::Group osg::Transform osg::MatrixTransform osgManipulator::AntiSquish" )
|
||||
{
|
||||
ADD_VEC3D_SERIALIZER( Pivot, osg::Vec3d() ); // _pivot
|
||||
ADD_VEC3D_SERIALIZER( Position, osg::Vec3d() ); // _position
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
FILE(GLOB TARGET_SRC *.cpp)
|
||||
FILE(GLOB TARGET_H *.h)
|
||||
|
||||
SET(TARGET_ADDED_LIBRARIES osgManipulator )
|
||||
|
||||
#### end var setup ###
|
||||
SETUP_PLUGIN(osgmanipulator)
|
@ -0,0 +1,42 @@
|
||||
#include <osgManipulator/Dragger>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
static bool checkDraggers( const osgManipulator::CompositeDragger& dragger )
|
||||
{
|
||||
return dragger.getNumDraggers()>0;
|
||||
}
|
||||
|
||||
static bool readDraggers( osgDB::InputStream& is, osgManipulator::CompositeDragger& dragger )
|
||||
{
|
||||
unsigned int size = 0; is >> size >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
osgManipulator::Dragger* child = dynamic_cast<osgManipulator::Dragger*>( is.readObject() );
|
||||
if ( child ) dragger.addDragger( child );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeDraggers( osgDB::OutputStream& os, const osgManipulator::CompositeDragger& dragger )
|
||||
{
|
||||
unsigned int size = dragger.getNumDraggers();
|
||||
os << size << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
os << dragger.getDragger(i);
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgManipulator_CompositeDragger,
|
||||
/*new osgManipulator::CompositeDragger*/NULL,
|
||||
osgManipulator::CompositeDragger,
|
||||
"osg::Object osg::Node osg::Transform osg::MatrixTransform osgManipulator::Dragger "
|
||||
"osgManipulator::CompositeDragger" )
|
||||
{
|
||||
ADD_USER_SERIALIZER( Draggers ); // _draggerList
|
||||
}
|
84
src/osgWrappers/serializers/osgManipulator/Dragger.cpp
Normal file
84
src/osgWrappers/serializers/osgManipulator/Dragger.cpp
Normal file
@ -0,0 +1,84 @@
|
||||
#include <osgManipulator/Constraint>
|
||||
#include <osgManipulator/Dragger>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
// TransformUpdating
|
||||
static bool checkTransformUpdating( const osgManipulator::Dragger& dragger )
|
||||
{
|
||||
return dragger.getDraggerCallbacks().size()>0;
|
||||
}
|
||||
|
||||
static bool readTransformUpdating( osgDB::InputStream& is, osgManipulator::Dragger& dragger )
|
||||
{
|
||||
unsigned int size = is.readSize(); is >> osgDB::BEGIN_BRACKET;
|
||||
for ( unsigned int i=0; i<size; ++i )
|
||||
{
|
||||
std::string name; is >> name >> osgDB::BEGIN_BRACKET;
|
||||
if ( name=="DraggerTransformCallback" )
|
||||
{
|
||||
osg::MatrixTransform* transform = dynamic_cast<osg::MatrixTransform*>( is.readObject() );
|
||||
if ( transform ) dragger.addTransformUpdating( transform );
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
}
|
||||
is >> osgDB::END_BRACKET;
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeTransformUpdating( osgDB::OutputStream& os, const osgManipulator::Dragger& dragger )
|
||||
{
|
||||
const osgManipulator::Dragger::DraggerCallbacks& callbacks = dragger.getDraggerCallbacks();
|
||||
os.writeSize( callbacks.size() ); os << osgDB::BEGIN_BRACKET << std::endl;
|
||||
for ( osgManipulator::Dragger::DraggerCallbacks::const_iterator itr=callbacks.begin();
|
||||
itr!=callbacks.end(); ++itr )
|
||||
{
|
||||
osgManipulator::DraggerTransformCallback* dtcb =
|
||||
dynamic_cast<osgManipulator::DraggerTransformCallback*>( itr->get() );
|
||||
if ( dtcb )
|
||||
{
|
||||
os << std::string("DraggerTransformCallback") << osgDB::BEGIN_BRACKET << std::endl;
|
||||
os << dtcb->getTransform();
|
||||
}
|
||||
else
|
||||
{
|
||||
os << std::string("DraggerCallback") << osgDB::BEGIN_BRACKET << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
}
|
||||
os << osgDB::END_BRACKET << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
// DefaultGeometry: FIXME - add a setUseDefaultGeometry(bool) here?
|
||||
static bool checkDefaultGeometry( const osgManipulator::Dragger& dragger )
|
||||
{ return true; }
|
||||
|
||||
static bool readDefaultGeometry( osgDB::InputStream& is, osgManipulator::Dragger& dragger )
|
||||
{
|
||||
bool useDefGeometry = false; is >> useDefGeometry;
|
||||
dragger.setupDefaultGeometry();
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool writeDefaultGeometry( osgDB::OutputStream& os, const osgManipulator::Dragger& dragger )
|
||||
{
|
||||
os << true << std::endl;
|
||||
return true;
|
||||
}
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgManipulator_Dragger,
|
||||
/*new osgManipulator::Dragger*/NULL,
|
||||
osgManipulator::Dragger,
|
||||
"osg::Object osg::Node osg::Transform osg::MatrixTransform osgManipulator::Dragger" )
|
||||
{
|
||||
// Dragger should not record children seperately, so ignore the osg::Group class wrapper
|
||||
|
||||
ADD_BOOL_SERIALIZER( HandleEvents, false ); // _handleEvents
|
||||
ADD_BOOL_SERIALIZER( DraggerActive, false ); // _draggerActive
|
||||
ADD_UINT_SERIALIZER( ActivationModKeyMask, 0 ); // _activationModKeyMask
|
||||
ADD_INT_SERIALIZER( ActivationKeyEvent, 0 ); // _activationKeyEvent
|
||||
ADD_USER_SERIALIZER( TransformUpdating ); // _draggerCallbacks
|
||||
ADD_USER_SERIALIZER( DefaultGeometry );
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
#include <osgManipulator/RotateCylinderDragger>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgManipulator_RotateCylinderDragger,
|
||||
new osgManipulator::RotateCylinderDragger,
|
||||
osgManipulator::RotateCylinderDragger,
|
||||
"osg::Object osg::Node osg::Transform osg::MatrixTransform osgManipulator::Dragger "
|
||||
"osgManipulator::RotateCylinderDragger" )
|
||||
{
|
||||
ADD_VEC4_SERIALIZER( Color, osg::Vec4() ); // _color
|
||||
ADD_VEC4_SERIALIZER( PickColor, osg::Vec4() ); // _pickColor
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
#include <osgManipulator/RotateSphereDragger>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgManipulator_RotateSphereDragger,
|
||||
new osgManipulator::RotateSphereDragger,
|
||||
osgManipulator::RotateSphereDragger,
|
||||
"osg::Object osg::Node osg::Transform osg::MatrixTransform osgManipulator::Dragger "
|
||||
"osgManipulator::RotateSphereDragger" )
|
||||
{
|
||||
ADD_VEC4_SERIALIZER( Color, osg::Vec4() ); // _color
|
||||
ADD_VEC4_SERIALIZER( PickColor, osg::Vec4() ); // _pickColor
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
#include <osgManipulator/Scale1DDragger>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
#define HANDLENODE_FUNC( PROP ) \
|
||||
static bool check##PROP( const osgManipulator::Scale1DDragger& dragger ) \
|
||||
{ return dragger.get##PROP()!=NULL; } \
|
||||
static bool read##PROP( osgDB::InputStream& is, osgManipulator::Scale1DDragger& dragger ) { \
|
||||
osg::Node* node = dynamic_cast<osg::Node*>( is.readObject() ); \
|
||||
if ( node ) dragger.set##PROP( *node ); return true; \
|
||||
} \
|
||||
static bool write##PROP( osgDB::OutputStream& os, const osgManipulator::Scale1DDragger& dragger ) { \
|
||||
os << dragger.get##PROP(); return true; \
|
||||
}
|
||||
|
||||
HANDLENODE_FUNC( LeftHandleNode )
|
||||
HANDLENODE_FUNC( RightHandleNode )
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgManipulator_Scale1DDragger,
|
||||
new osgManipulator::Scale1DDragger,
|
||||
osgManipulator::Scale1DDragger,
|
||||
"osg::Object osg::Node osg::Transform osg::MatrixTransform osgManipulator::Dragger "
|
||||
"osgManipulator::Scale1DDragger" )
|
||||
{
|
||||
ADD_DOUBLE_SERIALIZER( MinScale, 0.0 );// _minScale
|
||||
ADD_VEC4_SERIALIZER( Color, osg::Vec4() ); // _color
|
||||
ADD_VEC4_SERIALIZER( PickColor, osg::Vec4() ); // _pickColor
|
||||
ADD_USER_SERIALIZER( LeftHandleNode ); // _leftHandleNode
|
||||
ADD_USER_SERIALIZER( RightHandleNode ); // _rightHandleNode
|
||||
ADD_DOUBLE_SERIALIZER( LeftHandlePosition, 0.0 );
|
||||
ADD_DOUBLE_SERIALIZER( RightHandlePosition, 0.0 );
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
#include <osgManipulator/Scale2DDragger>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
#define HANDLENODE_FUNC( PROP ) \
|
||||
static bool check##PROP( const osgManipulator::Scale2DDragger& dragger ) \
|
||||
{ return dragger.get##PROP()!=NULL; } \
|
||||
static bool read##PROP( osgDB::InputStream& is, osgManipulator::Scale2DDragger& dragger ) { \
|
||||
osg::Node* node = dynamic_cast<osg::Node*>( is.readObject() ); \
|
||||
if ( node ) dragger.set##PROP( *node ); return true; \
|
||||
} \
|
||||
static bool write##PROP( osgDB::OutputStream& os, const osgManipulator::Scale2DDragger& dragger ) { \
|
||||
os << dragger.get##PROP(); return true; \
|
||||
}
|
||||
|
||||
HANDLENODE_FUNC( TopLeftHandleNode )
|
||||
HANDLENODE_FUNC( BottomLeftHandleNode )
|
||||
HANDLENODE_FUNC( TopRightHandleNode )
|
||||
HANDLENODE_FUNC( BottomRightHandleNode )
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgManipulator_Scale2DDragger,
|
||||
new osgManipulator::Scale2DDragger,
|
||||
osgManipulator::Scale2DDragger,
|
||||
"osg::Object osg::Node osg::Transform osg::MatrixTransform osgManipulator::Dragger "
|
||||
"osgManipulator::Scale2DDragger" )
|
||||
{
|
||||
ADD_VEC2D_SERIALIZER( MinScale, osg::Vec2d() );// _minScale
|
||||
ADD_VEC4_SERIALIZER( Color, osg::Vec4() ); // _color
|
||||
ADD_VEC4_SERIALIZER( PickColor, osg::Vec4() ); // _pickColor
|
||||
ADD_USER_SERIALIZER( TopLeftHandleNode ); // _topLeftHandleNode
|
||||
ADD_USER_SERIALIZER( BottomLeftHandleNode ); // _bottomLeftHandleNode
|
||||
ADD_USER_SERIALIZER( TopRightHandleNode ); // _topRightHandleNode
|
||||
ADD_USER_SERIALIZER( BottomRightHandleNode ); // _bottomRightHandleNode
|
||||
ADD_VEC2D_SERIALIZER( TopLeftHandlePosition, osg::Vec2d() );
|
||||
ADD_VEC2D_SERIALIZER( BottomLeftHandlePosition, osg::Vec2d() );
|
||||
ADD_VEC2D_SERIALIZER( TopRightHandlePosition, osg::Vec2d() );
|
||||
ADD_VEC2D_SERIALIZER( BottomRightHandlePosition, osg::Vec2d() );
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
#include <osgManipulator/ScaleAxisDragger>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgManipulator_ScaleAxisDragger,
|
||||
new osgManipulator::ScaleAxisDragger,
|
||||
osgManipulator::ScaleAxisDragger,
|
||||
"osg::Object osg::Node osg::Transform osg::MatrixTransform osgManipulator::Dragger "
|
||||
"osgManipulator::ScaleAxisDragger" ) // No need to contain CompositeDragger here
|
||||
{
|
||||
}
|
12
src/osgWrappers/serializers/osgManipulator/TabBoxDragger.cpp
Normal file
12
src/osgWrappers/serializers/osgManipulator/TabBoxDragger.cpp
Normal file
@ -0,0 +1,12 @@
|
||||
#include <osgManipulator/TabBoxDragger>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgManipulator_TabBoxDragger,
|
||||
new osgManipulator::TabBoxDragger,
|
||||
osgManipulator::TabBoxDragger,
|
||||
"osg::Object osg::Node osg::Transform osg::MatrixTransform osgManipulator::Dragger "
|
||||
"osgManipulator::TabBoxDragger" ) // No need to contain CompositeDragger here
|
||||
{
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
#include <osgManipulator/TabBoxTrackballDragger>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgManipulator_TabBoxTrackballDragger,
|
||||
new osgManipulator::TabBoxTrackballDragger,
|
||||
osgManipulator::TabBoxTrackballDragger,
|
||||
"osg::Object osg::Node osg::Transform osg::MatrixTransform osgManipulator::Dragger "
|
||||
"osgManipulator::TabBoxTrackballDragger" ) // No need to contain CompositeDragger here
|
||||
{
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
#include <osgManipulator/TabPlaneDragger>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgManipulator_TabPlaneDragger,
|
||||
new osgManipulator::TabPlaneDragger,
|
||||
osgManipulator::TabPlaneDragger,
|
||||
"osg::Object osg::Node osg::Transform osg::MatrixTransform osgManipulator::Dragger "
|
||||
"osgManipulator::TabPlaneDragger" ) // No need to contain CompositeDragger here
|
||||
{
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
#include <osgManipulator/TabPlaneTrackballDragger>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgManipulator_TabPlaneTrackballDragger,
|
||||
new osgManipulator::TabPlaneTrackballDragger,
|
||||
osgManipulator::TabPlaneTrackballDragger,
|
||||
"osg::Object osg::Node osg::Transform osg::MatrixTransform osgManipulator::Dragger "
|
||||
"osgManipulator::TabPlaneTrackballDragger" ) // No need to contain CompositeDragger here
|
||||
{
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
#include <osgManipulator/TrackballDragger>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgManipulator_TrackballDragger,
|
||||
new osgManipulator::TrackballDragger,
|
||||
osgManipulator::TrackballDragger,
|
||||
"osg::Object osg::Node osg::Transform osg::MatrixTransform osgManipulator::Dragger "
|
||||
"osgManipulator::TrackballDragger" ) // No need to contain CompositeDragger here
|
||||
{
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
#include <osgManipulator/Translate1DDragger>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgManipulator_Translate1DDragger,
|
||||
new osgManipulator::Translate1DDragger,
|
||||
osgManipulator::Translate1DDragger,
|
||||
"osg::Object osg::Node osg::Transform osg::MatrixTransform osgManipulator::Dragger "
|
||||
"osgManipulator::Translate1DDragger" )
|
||||
{
|
||||
ADD_VEC4_SERIALIZER( Color, osg::Vec4() ); // _color
|
||||
ADD_VEC4_SERIALIZER( PickColor, osg::Vec4() ); // _pickColor
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
#include <osgManipulator/Translate2DDragger>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgManipulator_Translate2DDragger,
|
||||
new osgManipulator::Translate2DDragger,
|
||||
osgManipulator::Translate2DDragger,
|
||||
"osg::Object osg::Node osg::Transform osg::MatrixTransform osgManipulator::Dragger "
|
||||
"osgManipulator::Translate2DDragger" )
|
||||
{
|
||||
ADD_VEC4_SERIALIZER( Color, osg::Vec4() ); // _color
|
||||
ADD_VEC4_SERIALIZER( PickColor, osg::Vec4() ); // _pickColor
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
#include <osgManipulator/TranslateAxisDragger>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgManipulator_TranslateAxisDragger,
|
||||
new osgManipulator::TranslateAxisDragger,
|
||||
osgManipulator::TranslateAxisDragger,
|
||||
"osg::Object osg::Node osg::Transform osg::MatrixTransform osgManipulator::Dragger "
|
||||
"osgManipulator::TranslateAxisDragger" ) // No need to contain CompositeDragger here
|
||||
{
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
#include <osgManipulator/TranslatePlaneDragger>
|
||||
#include <osgDB/ObjectWrapper>
|
||||
#include <osgDB/InputStream>
|
||||
#include <osgDB/OutputStream>
|
||||
|
||||
REGISTER_OBJECT_WRAPPER( osgManipulator_TranslatePlaneDragger,
|
||||
new osgManipulator::TranslatePlaneDragger,
|
||||
osgManipulator::TranslatePlaneDragger,
|
||||
"osg::Object osg::Node osg::Transform osg::MatrixTransform osgManipulator::Dragger "
|
||||
"osgManipulator::TranslatePlaneDragger" ) // No need to contain CompositeDragger here
|
||||
{
|
||||
}
|
@ -6,7 +6,7 @@
|
||||
REGISTER_OBJECT_WRAPPER( osgTerrain_Terrain,
|
||||
new osgTerrain::Terrain,
|
||||
osgTerrain::Terrain,
|
||||
"osg::Object osg::Node osg::CoordinateSystemNode osgTerrain::Terrain" )
|
||||
"osg::Object osg::Node osg::Group osg::CoordinateSystemNode osgTerrain::Terrain" )
|
||||
{
|
||||
ADD_FLOAT_SERIALIZER( SampleRatio, 1.0f ); // _sampleRatio
|
||||
ADD_FLOAT_SERIALIZER( VerticalScale, 1.0f ); // _verticalScale
|
||||
|
Loading…
Reference in New Issue
Block a user