Updated wrappers
This commit is contained in:
@@ -29,133 +29,133 @@ namespace osgGA {
|
||||
for user controlled manipulation.*/
|
||||
class OSGGA_EXPORT StandardManipulator : public MatrixManipulator
|
||||
{
|
||||
typedef MatrixManipulator inherited;
|
||||
typedef MatrixManipulator inherited;
|
||||
|
||||
public:
|
||||
public:
|
||||
|
||||
// flags
|
||||
enum {
|
||||
UPDATE_MODEL_SIZE = 0x01,
|
||||
COMPUTE_HOME_USING_BBOX = 0x02,
|
||||
PROCESS_MOUSE_WHEEL = 0x04,
|
||||
SET_CENTER_ON_WHEEL_UP = 0x08,
|
||||
DEFAULT_SETTINGS = UPDATE_MODEL_SIZE | COMPUTE_HOME_USING_BBOX | PROCESS_MOUSE_WHEEL
|
||||
};
|
||||
// flags
|
||||
enum UserInteractionFlags
|
||||
{
|
||||
UPDATE_MODEL_SIZE = 0x01,
|
||||
COMPUTE_HOME_USING_BBOX = 0x02,
|
||||
PROCESS_MOUSE_WHEEL = 0x04,
|
||||
SET_CENTER_ON_WHEEL_UP = 0x08,
|
||||
DEFAULT_SETTINGS = UPDATE_MODEL_SIZE | COMPUTE_HOME_USING_BBOX | PROCESS_MOUSE_WHEEL
|
||||
};
|
||||
|
||||
StandardManipulator( int flags = DEFAULT_SETTINGS );
|
||||
StandardManipulator( const StandardManipulator& m,
|
||||
const osg::CopyOp& copyOp = osg::CopyOp::SHALLOW_COPY );
|
||||
StandardManipulator( int flags = DEFAULT_SETTINGS );
|
||||
StandardManipulator( const StandardManipulator& m,
|
||||
const osg::CopyOp& copyOp = osg::CopyOp::SHALLOW_COPY );
|
||||
|
||||
// We are not using META_Object as this is abstract class.
|
||||
// Use META_Object(osgGA,YourManipulator); in your descendant non-abstract classes.
|
||||
virtual const char* className() const { return "StandardManipulator"; }
|
||||
// We are not using META_Object as this is abstract class.
|
||||
// Use META_Object(osgGA,YourManipulator); in your descendant non-abstract classes.
|
||||
virtual const char* className() const { return "StandardManipulator"; }
|
||||
|
||||
virtual void setTransformation( const osg::Vec3d& eye, const osg::Quat& rotation ) = 0;
|
||||
virtual void setTransformation( const osg::Vec3d& center, const osg::Vec3d& eye, const osg::Vec3d& up ) = 0;
|
||||
virtual void getTransformation( osg::Vec3d& eye, osg::Quat& rotation ) const = 0;
|
||||
virtual void getTransformation( osg::Vec3d& center, osg::Vec3d& eye, osg::Vec3d& up ) const = 0;
|
||||
virtual void setTransformation( const osg::Vec3d& eye, const osg::Quat& rotation ) = 0;
|
||||
virtual void setTransformation( const osg::Vec3d& center, const osg::Vec3d& eye, const osg::Vec3d& up ) = 0;
|
||||
virtual void getTransformation( osg::Vec3d& eye, osg::Quat& rotation ) const = 0;
|
||||
virtual void getTransformation( osg::Vec3d& center, osg::Vec3d& eye, osg::Vec3d& up ) const = 0;
|
||||
|
||||
virtual void setNode( osg::Node* );
|
||||
virtual const osg::Node* getNode() const;
|
||||
virtual osg::Node* getNode();
|
||||
virtual void setNode( osg::Node* );
|
||||
virtual const osg::Node* getNode() const;
|
||||
virtual osg::Node* getNode();
|
||||
|
||||
virtual void setVerticalAxisFixed( bool value );
|
||||
inline bool getVerticalAxisFixed() const;
|
||||
virtual void setVerticalAxisFixed( bool value );
|
||||
inline bool getVerticalAxisFixed() const;
|
||||
|
||||
virtual void setAnimationTime( const double t );
|
||||
double getAnimationTime() const;
|
||||
bool isAnimating() const;
|
||||
virtual void finishAnimation();
|
||||
virtual void setAnimationTime( const double t );
|
||||
double getAnimationTime() const;
|
||||
bool isAnimating() const;
|
||||
virtual void finishAnimation();
|
||||
|
||||
virtual void home( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual void home( double );
|
||||
virtual void home( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual void home( double );
|
||||
|
||||
virtual void init( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual void getUsage( osg::ApplicationUsage& usage ) const;
|
||||
virtual void init( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual void getUsage( osg::ApplicationUsage& usage ) const;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
|
||||
virtual bool handleFrame( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool handleResize( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool handleMouseMove( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool handleMouseDrag( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool handleMousePush( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool handleMouseRelease( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool handleKeyDown( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool handleKeyUp( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool handleMouseWheel( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool handleMouseDeltaMovement( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool handleFrame( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool handleResize( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool handleMouseMove( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool handleMouseDrag( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool handleMousePush( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool handleMouseRelease( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool handleKeyDown( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool handleKeyUp( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool handleMouseWheel( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool handleMouseDeltaMovement( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
|
||||
virtual bool performMovement();
|
||||
virtual bool performMovementLeftMouseButton( const double dt, const double dx, const double dy );
|
||||
virtual bool performMovementMiddleMouseButton( const double dt, const double dx, const double dy );
|
||||
virtual bool performMovementRightMouseButton( const double dt, const double dx, const double dy );
|
||||
virtual bool performMouseDeltaMovement( const float dx, const float dy );
|
||||
virtual bool performAnimationMovement( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual void applyAnimationStep( const double currentProgress, const double prevProgress );
|
||||
virtual bool performMovement();
|
||||
virtual bool performMovementLeftMouseButton( const double dt, const double dx, const double dy );
|
||||
virtual bool performMovementMiddleMouseButton( const double dt, const double dx, const double dy );
|
||||
virtual bool performMovementRightMouseButton( const double dt, const double dx, const double dy );
|
||||
virtual bool performMouseDeltaMovement( const float dx, const float dy );
|
||||
virtual bool performAnimationMovement( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual void applyAnimationStep( const double currentProgress, const double prevProgress );
|
||||
|
||||
void addMouseEvent( const osgGA::GUIEventAdapter& ea );
|
||||
void flushMouseEventStack();
|
||||
virtual bool isMouseMoving() const;
|
||||
virtual void centerMousePointer( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
void addMouseEvent( const osgGA::GUIEventAdapter& ea );
|
||||
void flushMouseEventStack();
|
||||
virtual bool isMouseMoving() const;
|
||||
virtual void centerMousePointer( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
|
||||
static void rotateYawPitch( osg::Quat& rotation, const double yaw, const double pitch,
|
||||
const osg::Vec3d& localUp = osg::Vec3d( 0.,0.,0.) );
|
||||
static void fixVerticalAxis( osg::Quat& rotation, const osg::Vec3d& localUp, bool disallowFlipOver );
|
||||
void fixVerticalAxis( osg::Vec3d& eye, osg::Quat& rotation, bool disallowFlipOver );
|
||||
static void fixVerticalAxis( const osg::Vec3d& forward, const osg::Vec3d& up, osg::Vec3d& newUp,
|
||||
const osg::Vec3d& localUp, bool disallowFlipOver );
|
||||
virtual bool setCenterByMousePointerIntersection( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool startAnimationByMousePointerIntersection( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
static void rotateYawPitch( osg::Quat& rotation, const double yaw, const double pitch,
|
||||
const osg::Vec3d& localUp = osg::Vec3d( 0.,0.,0.) );
|
||||
static void fixVerticalAxis( osg::Quat& rotation, const osg::Vec3d& localUp, bool disallowFlipOver );
|
||||
void fixVerticalAxis( osg::Vec3d& eye, osg::Quat& rotation, bool disallowFlipOver );
|
||||
static void fixVerticalAxis( const osg::Vec3d& forward, const osg::Vec3d& up, osg::Vec3d& newUp,
|
||||
const osg::Vec3d& localUp, bool disallowFlipOver );
|
||||
virtual bool setCenterByMousePointerIntersection( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
virtual bool startAnimationByMousePointerIntersection( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
|
||||
|
||||
// mouse state
|
||||
bool _thrown;
|
||||
float _mouseCenterX, _mouseCenterY;
|
||||
// mouse state
|
||||
bool _thrown;
|
||||
float _mouseCenterX, _mouseCenterY;
|
||||
|
||||
// internal event stack comprising last two mouse events.
|
||||
osg::ref_ptr< const osgGA::GUIEventAdapter > _ga_t1;
|
||||
osg::ref_ptr< const osgGA::GUIEventAdapter > _ga_t0;
|
||||
// internal event stack comprising last two mouse events.
|
||||
osg::ref_ptr< const osgGA::GUIEventAdapter > _ga_t1;
|
||||
osg::ref_ptr< const osgGA::GUIEventAdapter > _ga_t0;
|
||||
|
||||
/** The approximate amount of time it is currently taking to draw a frame.
|
||||
* This is used to compute the delta in translation/rotation during a thrown display update.
|
||||
* It allows us to match an delta in position/rotation independent of the rendering frame rate.
|
||||
*/
|
||||
double _delta_frame_time;
|
||||
/** The approximate amount of time it is currently taking to draw a frame.
|
||||
* This is used to compute the delta in translation/rotation during a thrown display update.
|
||||
* It allows us to match an delta in position/rotation independent of the rendering frame rate.
|
||||
*/
|
||||
double _delta_frame_time;
|
||||
|
||||
/** The time the last frame started.
|
||||
* Used when _rate_sensitive is true so that we can match display update rate to rotation/translation rate.
|
||||
*/
|
||||
double _last_frame_time;
|
||||
/** The time the last frame started.
|
||||
* Used when _rate_sensitive is true so that we can match display update rate to rotation/translation rate.
|
||||
*/
|
||||
double _last_frame_time;
|
||||
|
||||
// scene data
|
||||
osg::ref_ptr< osg::Node > _node;
|
||||
double _modelSize;
|
||||
bool _verticalAxisFixed;
|
||||
// scene data
|
||||
osg::ref_ptr< osg::Node > _node;
|
||||
double _modelSize;
|
||||
bool _verticalAxisFixed;
|
||||
|
||||
// animation stuff
|
||||
class AnimationData : public osg::Referenced {
|
||||
public:
|
||||
double _animationTime;
|
||||
bool _isAnimating;
|
||||
double _startTime;
|
||||
double _phase;
|
||||
AnimationData();
|
||||
void start( const double startTime );
|
||||
};
|
||||
osg::ref_ptr< AnimationData > _animationData;
|
||||
virtual void allocAnimationData() { _animationData = new AnimationData(); }
|
||||
// animation stuff
|
||||
class AnimationData : public osg::Referenced {
|
||||
public:
|
||||
double _animationTime;
|
||||
bool _isAnimating;
|
||||
double _startTime;
|
||||
double _phase;
|
||||
AnimationData();
|
||||
void start( const double startTime );
|
||||
};
|
||||
osg::ref_ptr< AnimationData > _animationData;
|
||||
virtual void allocAnimationData() { _animationData = new AnimationData(); }
|
||||
|
||||
// flags
|
||||
int _flags;
|
||||
|
||||
// flags indicating that a value is relative to model size
|
||||
int _relativeFlags;
|
||||
inline bool getRelativeFlag( int index ) const;
|
||||
inline void setRelativeFlag( int index, bool value );
|
||||
static int numRelativeFlagsAllocated;
|
||||
static int allocateRelativeFlag();
|
||||
// flags
|
||||
int _flags;
|
||||
|
||||
// flags indicating that a value is relative to model size
|
||||
int _relativeFlags;
|
||||
inline bool getRelativeFlag( int index ) const;
|
||||
inline void setRelativeFlag( int index, bool value );
|
||||
static int numRelativeFlagsAllocated;
|
||||
static int allocateRelativeFlag();
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user