osg MatrixManipulator CameraManipulator
<osgGA/MatrixManipulator>:No such file or directory
修改为
#include <osgGA/CameraManipulator>
osgGA::GUIEventHandler
- /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
- *
- * This library is open source and may be redistributed and/or modified under
- * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
- * (at your option) any later version. The full license is in LICENSE file
- * included with this distribution, and on the openscenegraph.org website.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * OpenSceneGraph Public License for more details.
- */
- #ifndef OSGGA_GUIEVENTHANDLER
- #define OSGGA_GUIEVENTHANDLER 1
- #include <vector>
- #include <osg/Drawable>
- #include <osg/ApplicationUsage>
- #include <osgGA/EventHandler>
- #include <osgGA/GUIEventAdapter>
- #include <osgGA/GUIActionAdapter>
- // #define COMPILE_COMPOSITE_EVENTHANDLER
- namespace osgGA{
- /**
- GUIEventHandler provides a basic interface for any class which wants to handle
- a GUI Events.
- The GUIEvent is supplied by a GUIEventAdapter. Feedback resulting from the
- handle method is supplied by a GUIActionAdapter, which allows the GUIEventHandler
- to ask the GUI to take some action in response to an incoming event.
- For example, consider a Trackball Viewer class which takes mouse events and
- manipulates a scene camera in response. The Trackball Viewer is a GUIEventHandler,
- and receives the events via the handle method. If the user 'throws' the model,
- the Trackball Viewer class can detect this via the incoming events, and
- request that the GUI set up a timer callback to continually redraw the view.
- This request is made via the GUIActionAdapter class.
- */
- class OSGGA_EXPORT GUIEventHandler : public EventHandler
- {
- public:
- GUIEventHandler() {}
- GUIEventHandler(const GUIEventHandler& eh,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
- osg::Object(eh, copyop),
- osg::Callback(eh, copyop),
- EventHandler(eh, copyop) {}
- META_Object(osgGA,GUIEventHandler);
- /** Handle event. Override the handle(..) method in your event handlers to respond to events. */
- virtual bool handle(osgGA::Event* event, osg::Object* object, osg::NodeVisitor* nv);
- /** Handle events, return true if handled, false otherwise. */
- virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor*) { return handle(ea,aa); }
- /** Deprecated, Handle events, return true if handled, false otherwise. */
- virtual bool handle(const GUIEventAdapter&,GUIActionAdapter&) { return false; }
- protected:
- virtual ~GUIEventHandler();
- };
- }
- #endif
osgGA::CameraManipulator
- /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
- *
- * This library is open source and may be redistributed and/or modified under
- * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
- * (at your option) any later version. The full license is in LICENSE file
- * included with this distribution, and on the openscenegraph.org website.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * OpenSceneGraph Public License for more details.
- */
- #ifndef OSGGA_CameraManipulator
- #define OSGGA_CameraManipulator 1
- #include <osg/Node>
- #include <osg/Matrixd>
- #include <osg/CoordinateSystemNode>
- #include <osgUtil/SceneView>
- #include <osgGA/Export>
- #include <osgGA/GUIEventHandler>
- #include <osgGA/GUIEventAdapter>
- #include <osgGA/GUIActionAdapter>
- namespace osgGA{
- #define NEW_HOME_POSITION
- /**
- CameraManipulator is an abstract base class defining the interface, and a certain
- amount of default functionality, for classes which wish to control OSG cameras
- in response to GUI events.
- */
- class OSGGA_EXPORT CameraManipulator : public GUIEventHandler
- {
- typedef GUIEventHandler inherited;
- public:
- // 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 "CameraManipulator"; }
- /** callback class to use to allow matrix manipulators to query the application for the local coordinate frame.*/
- class CoordinateFrameCallback : public osg::Referenced
- {
- public:
- virtual osg::CoordinateFrame getCoordinateFrame(const osg::Vec3d& position) const = ;
- protected:
- virtual ~CoordinateFrameCallback() {}
- };
- /** set the coordinate frame which callback tells the manipulator which way is up, east and north.*/
- virtual void setCoordinateFrameCallback(CoordinateFrameCallback* cb) { _coordinateFrameCallback = cb; }
- /** get the coordinate frame callback which tells the manipulator which way is up, east and north.*/
- CoordinateFrameCallback* getCoordinateFrameCallback() { return _coordinateFrameCallback.get(); }
- /** get the coordinate frame callback which tells the manipulator which way is up, east and north.*/
- const CoordinateFrameCallback* getCoordinateFrameCallback() const { return _coordinateFrameCallback.get(); }
- /** get the coordinate frame.*/
- osg::CoordinateFrame getCoordinateFrame(const osg::Vec3d& position) const
- {
- if (_coordinateFrameCallback.valid()) return _coordinateFrameCallback->getCoordinateFrame(position);
- return osg::CoordinateFrame();
- }
- osg::Vec3d getSideVector(const osg::CoordinateFrame& cf) const { return osg::Vec3d(cf(,),cf(,),cf(,)); }
- osg::Vec3d getFrontVector(const osg::CoordinateFrame& cf) const { return osg::Vec3d(cf(,),cf(,),cf(,)); }
- osg::Vec3d getUpVector(const osg::CoordinateFrame& cf) const { return osg::Vec3d(cf(,),cf(,),cf(,)); }
- /** set the position of the matrix manipulator using a 4x4 Matrix.*/
- virtual void setByMatrix(const osg::Matrixd& matrix) = ;
- /** set the position of the matrix manipulator using a 4x4 Matrix.*/
- virtual void setByInverseMatrix(const osg::Matrixd& matrix) = ;
- /** get the position of the manipulator as 4x4 Matrix.*/
- virtual osg::Matrixd getMatrix() const = ;
- /** get the position of the manipulator as a inverse matrix of the manipulator, typically used as a model view matrix.*/
- virtual osg::Matrixd getInverseMatrix() const = ;
- /** update the camera for the current frame, typically called by the viewer classes.
- Default implementation simply set the camera view matrix. */
- virtual void updateCamera(osg::Camera& camera) { camera.setViewMatrix(getInverseMatrix()); }
- /** Get the FusionDistanceMode. Used by SceneView for setting up stereo convergence.*/
- virtual osgUtil::SceneView::FusionDistanceMode getFusionDistanceMode() const { return osgUtil::SceneView::PROPORTIONAL_TO_SCREEN_DISTANCE; }
- /** Get the FusionDistanceValue. Used by SceneView for setting up stereo convergence.*/
- virtual float getFusionDistanceValue() const { return 1.0f; }
- /** Set the mask to use when set up intersection traversal such as used in manipulators that follow terrain or have collision detection.
- * The intersection traversal mask is useful for controlling what parts of the scene graph should be used for intersection purposes.*/
- void setIntersectTraversalMask(unsigned int mask) { _intersectTraversalMask = mask; }
- /** Get the mask to use when set up intersection traversal such as used in manipulators that follow terrain or have collision detection.*/
- unsigned int getIntersectTraversalMask() const { return _intersectTraversalMask; }
- /**
- Attach a node to the manipulator, automatically detaching any previously attached node.
- setNode(NULL) detaches previous nodes.
- May be ignored by manipulators which do not require a reference model.
- */
- virtual void setNode(osg::Node*) {}
- /** Return const node if attached.*/
- virtual const osg::Node* getNode() const { return NULL; }
- /** Return node if attached.*/
- virtual osg::Node* getNode() { return NULL; }
- /** Manually set the home position, and set the automatic compute of home position. */
- virtual void setHomePosition(const osg::Vec3d& eye, const osg::Vec3d& center, const osg::Vec3d& up, bool autoComputeHomePosition=false)
- {
- setAutoComputeHomePosition(autoComputeHomePosition);
- _homeEye = eye;
- _homeCenter = center;
- _homeUp = up;
- }
- /** Get the manually set home position. */
- virtual void getHomePosition(osg::Vec3d& eye, osg::Vec3d& center, osg::Vec3d& up) const
- {
- eye = _homeEye;
- center = _homeCenter;
- up = _homeUp;
- }
- /** Set whether the automatic compute of the home position is enabled.*/
- virtual void setAutoComputeHomePosition(bool flag) { _autoComputeHomePosition = flag; }
- /** Get whether the automatic compute of the home position is enabled.*/
- bool getAutoComputeHomePosition() const { return _autoComputeHomePosition; }
- /** Compute the home position.*/
- virtual void computeHomePosition(const osg::Camera *camera = NULL, bool useBoundingBox = false);
- /** finish any active manipulator animations.*/
- virtual void finishAnimation() {}
- /**
- Move the camera to the default position.
- May be ignored by manipulators if home functionality is not appropriate.
- */
- virtual void home(const GUIEventAdapter& ,GUIActionAdapter&) {}
- /**
- Move the camera to the default position.
- This version does not require GUIEventAdapter and GUIActionAdapter so may be
- called from somewhere other than a handle() method in GUIEventHandler. Application
- must be aware of implications.
- */
- virtual void home(double /*currentTime*/) {}
- /**
- Start/restart the manipulator.
- */
- virtual void init(const GUIEventAdapter& ,GUIActionAdapter&) {}
- /** Handle event. Override the handle(..) method in your event handlers to respond to events. */
- virtual bool handle(osgGA::Event* event, osg::Object* object, osg::NodeVisitor* nv) { return GUIEventHandler::handle(event, object, nv); }
- /** Handle events, return true if handled, false otherwise. */
- virtual bool handle(const GUIEventAdapter& ea,GUIActionAdapter& us);
- protected:
- CameraManipulator();
- CameraManipulator(const CameraManipulator& mm, const osg::CopyOp& copyOp = osg::CopyOp::SHALLOW_COPY);
- virtual ~CameraManipulator();
- std::string getManipulatorName() const;
- unsigned int _intersectTraversalMask;
- bool _autoComputeHomePosition;
- osg::Vec3d _homeEye;
- osg::Vec3d _homeCenter;
- osg::Vec3d _homeUp;
- osg::ref_ptr<CoordinateFrameCallback> _coordinateFrameCallback;
- };
- }
- #endif
osgGA::StandardManipulator
- /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
- *
- * This library is open source and may be redistributed and/or modified under
- * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
- * (at your option) any later version. The full license is in LICENSE file
- * included with this distribution, and on the openscenegraph.org website.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * OpenSceneGraph Public License for more details.
- *
- * StandardManipulator code Copyright (C) 2010 PCJohn (Jan Peciva)
- * while some pieces of code were taken from OSG.
- * Thanks to company Cadwork (www.cadwork.ch) and
- * Brno University of Technology (www.fit.vutbr.cz) for open-sourcing this work.
- */
- #ifndef OSGGA_CAMERA_MANIPULATOR
- #define OSGGA_CAMERA_MANIPULATOR 1
- #include <osgGA/CameraManipulator>
- namespace osgGA {
- /** StandardManipulator class provides basic functionality
- for user controlled manipulation.*/
- class OSGGA_EXPORT StandardManipulator : public CameraManipulator
- {
- typedef CameraManipulator inherited;
- public:
- // flags
- enum UserInteractionFlags
- {
- UPDATE_MODEL_SIZE = 0x01,
- COMPUTE_HOME_USING_BBOX = 0x02,
- PROCESS_MOUSE_WHEEL = 0x04,
- SET_CENTER_ON_WHEEL_FORWARD_MOVEMENT = 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 );
- // 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"; }
- /** Sets manipulator by eye position and eye orientation.*/
- virtual void setTransformation( const osg::Vec3d& eye, const osg::Quat& rotation ) = ;
- /** Sets manipulator by eye position, center of rotation, and up vector.*/
- virtual void setTransformation( const osg::Vec3d& eye, const osg::Vec3d& center, const osg::Vec3d& up ) = ;
- /** Gets manipulator's eye position and eye orientation.*/
- virtual void getTransformation( osg::Vec3d& eye, osg::Quat& rotation ) const = ;
- /** Gets manipulator's focal center, eye position, and up vector.*/
- virtual void getTransformation( osg::Vec3d& eye, osg::Vec3d& center, osg::Vec3d& up ) const = ;
- virtual void setNode( osg::Node* );
- virtual const osg::Node* getNode() const;
- virtual osg::Node* getNode();
- virtual void setVerticalAxisFixed( bool value );
- inline bool getVerticalAxisFixed() const;
- inline bool getAllowThrow() const;
- virtual void setAllowThrow( bool allowThrow );
- 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 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:
- 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 eventTimeDelta, const double dx, const double dy );
- virtual bool performMovementMiddleMouseButton( const double eventTimeDelta, const double dx, const double dy );
- virtual bool performMovementRightMouseButton( const double eventTimeDelta, 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;
- float getThrowScale( const double eventTimeDelta ) 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( .,.,.) );
- 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;
- bool _allowThrow;
- 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;
- /** 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;
- // scene data
- osg::ref_ptr< osg::Node > _node;
- double _modelSize;
- bool _verticalAxisFixed;
- // animation stuff
- class OSGGA_EXPORT 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();
- };
- //
- // inline methods
- //
- inline bool StandardManipulator::getRelativeFlag( int index ) const
- {
- return ( _relativeFlags & (0x01 << index) ) != ;
- }
- inline void StandardManipulator::setRelativeFlag( int index, bool value )
- {
- if( value ) _relativeFlags |= (0x01 << index);
- else _relativeFlags &= ~(0x01 << index);
- }
- /// Returns whether manipulator preserves camera's "UP" vector.
- inline bool StandardManipulator::getVerticalAxisFixed() const
- {
- return _verticalAxisFixed;
- }
- /// Returns true if the camera can be thrown, false otherwise. It defaults to true.
- inline bool StandardManipulator::getAllowThrow() const
- {
- return _allowThrow;
- }
- }
- #endif /* OSGGA_CAMERA_MANIPULATOR */
osgGA::OrbitManipulator
- /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
- *
- * This library is open source and may be redistributed and/or modified under
- * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
- * (at your option) any later version. The full license is in LICENSE file
- * included with this distribution, and on the openscenegraph.org website.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * OpenSceneGraph Public License for more details.
- *
- * OrbitManipulator code Copyright (C) 2010 PCJohn (Jan Peciva)
- * while some pieces of code were taken from OSG.
- * Thanks to company Cadwork (www.cadwork.ch) and
- * Brno University of Technology (www.fit.vutbr.cz) for open-sourcing this work.
- */
- #ifndef OSGGA_ORBIT_MANIPULATOR
- #define OSGGA_ORBIT_MANIPULATOR 1
- #include <osgGA/StandardManipulator>
- namespace osgGA {
- /** OrbitManipulator is base class for camera control based on focal center,
- distance from the center, and orientation of distance vector to the eye.
- This is the base class for trackball style manipulators.*/
- class OSGGA_EXPORT OrbitManipulator : public StandardManipulator
- {
- typedef StandardManipulator inherited;
- public:
- OrbitManipulator( int flags = DEFAULT_SETTINGS );
- OrbitManipulator( const OrbitManipulator& om,
- const osg::CopyOp& copyOp = osg::CopyOp::SHALLOW_COPY );
- META_Object( osgGA, OrbitManipulator );
- virtual void setByMatrix( const osg::Matrixd& matrix );
- virtual void setByInverseMatrix( const osg::Matrixd& matrix );
- virtual osg::Matrixd getMatrix() const;
- virtual osg::Matrixd getInverseMatrix() const;
- virtual void setTransformation( const osg::Vec3d& eye, const osg::Quat& rotation );
- virtual void setTransformation( const osg::Vec3d& eye, const osg::Vec3d& center, const osg::Vec3d& up );
- virtual void getTransformation( osg::Vec3d& eye, osg::Quat& rotation ) const;
- virtual void getTransformation( osg::Vec3d& eye, osg::Vec3d& center, osg::Vec3d& up ) const;
- void setHeading( double azimuth );
- double getHeading() const;
- void setElevation( double elevation );
- double getElevation() const;
- virtual void setCenter( const osg::Vec3d& center );
- const osg::Vec3d& getCenter() const;
- virtual void setRotation( const osg::Quat& rotation );
- const osg::Quat& getRotation() const;
- virtual void setDistance( double distance );
- double getDistance() const;
- virtual void setTrackballSize( const double& size );
- inline double getTrackballSize() const;
- virtual void setWheelZoomFactor( double wheelZoomFactor );
- inline double getWheelZoomFactor() const;
- virtual void setMinimumDistance( const double& minimumDistance, bool relativeToModelSize = false );
- double getMinimumDistance( bool *relativeToModelSize = NULL ) const;
- virtual osgUtil::SceneView::FusionDistanceMode getFusionDistanceMode() const;
- virtual float getFusionDistanceValue() const;
- protected:
- virtual bool handleMouseWheel( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
- virtual bool performMovementLeftMouseButton( const double eventTimeDelta, const double dx, const double dy );
- virtual bool performMovementMiddleMouseButton( const double eventTimeDelta, const double dx, const double dy );
- virtual bool performMovementRightMouseButton( const double eventTimeDelta, const double dx, const double dy );
- virtual bool performMouseDeltaMovement( const float dx, const float dy );
- virtual void applyAnimationStep( const double currentProgress, const double prevProgress );
- virtual void rotateTrackball( const float px0, const float py0,
- const float px1, const float py1, const float scale );
- virtual void rotateWithFixedVertical( const float dx, const float dy );
- virtual void rotateWithFixedVertical( const float dx, const float dy, const osg::Vec3f& up );
- virtual void panModel( const float dx, const float dy, const float dz = .f );
- virtual void zoomModel( const float dy, bool pushForwardIfNeeded = true );
- void trackball( osg::Vec3d& axis, float& angle, float p1x, float p1y, float p2x, float p2y );
- float tb_project_to_sphere( float r, float x, float y );
- virtual bool startAnimationByMousePointerIntersection( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us );
- osg::Vec3d _center;
- osg::Quat _rotation;
- double _distance;
- double _trackballSize;
- double _wheelZoomFactor;
- double _minimumDistance;
- static int _minimumDistanceFlagIndex;
- class OrbitAnimationData : public AnimationData {
- public:
- osg::Vec3d _movement;
- void start( const osg::Vec3d& movement, const double startTime );
- };
- virtual void allocAnimationData() { _animationData = new OrbitAnimationData(); }
- };
- //
- // inline functions
- //
- /** Get the size of the trackball relative to the model size. */
- inline double OrbitManipulator::getTrackballSize() const { return _trackballSize; }
- /** Get the mouse wheel zoom factor.*/
- inline double OrbitManipulator::getWheelZoomFactor() const { return _wheelZoomFactor; }
- }
- #endif /* OSGGA_ORBIT_MANIPULATOR */
osgGA::TrackballManipulator
- /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
- *
- * This library is open source and may be redistributed and/or modified under
- * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
- * (at your option) any later version. The full license is in LICENSE file
- * included with this distribution, and on the openscenegraph.org website.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * OpenSceneGraph Public License for more details.
- */
- #ifndef OSGGA_TRACKBALL_MANIPULATOR
- #define OSGGA_TRACKBALL_MANIPULATOR 1
- #include <osgGA/OrbitManipulator>
- namespace osgGA {
- class OSGGA_EXPORT TrackballManipulator : public OrbitManipulator
- {
- typedef OrbitManipulator inherited;
- public:
- TrackballManipulator( int flags = DEFAULT_SETTINGS );
- TrackballManipulator( const TrackballManipulator& tm,
- const osg::CopyOp& copyOp = osg::CopyOp::SHALLOW_COPY );
- META_Object( osgGA, TrackballManipulator );
- };
- }
- #endif /* OSGGA_TRACKBALL_MANIPULATOR */
osg MatrixManipulator CameraManipulator的更多相关文章
- [OSG]OpenSceneGraph FAQ 以及OSG资源
1.地球背面的一个点,计算它在屏幕上的坐标,能得到吗? 不是被挡住了吗? 答:计算一个空间点的屏幕坐标,使用osgAPEx::GetScreenPosition函数.当空间点处于相机视空间内(不管它是 ...
- osg设置相机参数,包括初始位置
严重注意!!!以下设置必须在viewer.realize();之后,否则不起作用!!!! 设置相机的位置,可以通过CameraManipulator(一般是osgGA::TrackballManipu ...
- osg中的视点控制
osg中的视点控制 osg的视点控制基类是CameraManipulator, 它是一个虚基类, 有用的方法都跟home有关. 在这个类里面有三个重要的成员变量: osg::Vec3d _homeEy ...
- osg实例介绍
osg实例介绍 转自:http://blog.csdn.net/yungis/article/list/1 [原]osgmotionblur例子 该例子演示了运动模糊的效果.一下内容是转自网上的:原理 ...
- OSG开发概览
1 OSG基础知识 Ø OSG是Open Scene Graphic 的缩写,OSG于1997年诞生于以为滑翔机爱好者之手,Don burns 为了对滑翔机的飞行进行模拟,对openGL的库进行了封 ...
- OSG 实现跟随节点的相机(转)
本章教程将继续使用回调和节点路径(NodePath)来检索节点的世界坐标. 本章目标: 在一个典型的仿真过程中,用户可能需要从场景中的各种车辆和人物里选择一个进行跟随.本章将介绍一种将摄像机“依附 ...
- OSG实现场景漫游(转载)
OSG实现场景漫游 下面的代码将可以实现场景模型的导入,然后在里面任意行走,于此同时还实现了碰撞检测. 源代码下载地址: /* * File : Travel.cpp * Description : ...
- OSG开发概览(转载)
OSG开发概览 1 OSG基础知识 Ø OSG是Open Scene Graphic 的缩写,OSG于1997年诞生于以为滑翔机爱好者之手,Don burns 为了对滑翔机的飞行进行模拟,对open ...
- OSG开源教程(转)
例:geom->addPrimitiveSet(new osg::DrawArrays(osg::PrimitiveSet::QUADS,0,4)); 来指定要利用这些数据生成一个怎么样的形状. ...
随机推荐
- Nginx服务优化及优化深入(配置网页缓存时间、日志切割、防盗链等等)
原文:https://blog.51cto.com/11134648/2134389 默认的Nginx安装参数只能提供最基本的服务,还需要调整如网页缓存时间.连接超时.网页压缩等相应参数,才能发挥出服 ...
- selenium xpath定位方式整理
#xpath定位元素方法: /html/body/div[2] #绝对路径定位 #相对路径定位元素 //* #找到所有的元素 //input #找到input元素 //*[@*] #表示有属性的所有元 ...
- 前端知识总结--html
1. doctype的作用是什么? <!DOCTYPE> 声明必须是 HTML 文档的第一行,位于 <html> 标签之前. <!DOCTYPE> 声明不是 HT ...
- Vmware Pro 14报错:无法连接 MKS: 套接字连接尝试次数太多;正在放弃。
软件环境: 虚拟机软件:VMware Pro 14 母机操作系统:win7 客户机操作系统:CentOS 7 问题详情: 报错:无法连接 MKS: 套接字连接尝试次数太多:正在放弃. ...
- Nginx入门(四)——反向代理
server { listen 8020; server_name localhost; location / { root html; index index.html index.htm; pro ...
- python基础--文件控制
读写文件是最常见的IO操作.Python内置了读写文件的函数,用法和C是兼容的. 读写文件前,我们先必须了解一下,在磁盘上读写文件的功能都是由操作系统提供的,现代操作系统不允许普通的程序直接操作磁盘, ...
- C语言入坑指南-缓冲区溢出
前言 缓冲区溢出通常指的是向缓冲区写入了超过缓冲区所能保存的最大数据量的数据.如果说之前所提到的一些问题可能只是影响部分功能的实现,那么缓冲区溢出将可能会造成程序运行终止,被不安全代码攻击等严重问题, ...
- 二十七. Keepalived热备 Keepalived+LVS 、 HAProxy服务器
1.Keepalived高可用服务器 proxy:192.168.4.5(客户端主机) web1:192.168.4.100(Web服务器,部署Keepalived高可用软件) web2:192.16 ...
- The backup set holds a backup of a database other than the existing ‘dbName’ database
[Solved] System.Data.SqlClient.SqlError: The backup set holds a backup of a database other than t ...
- Linux Swap是干嘛的?
swap是干嘛的? 在Linux下,SWAP的作用类似Windows系统下的“虚拟内存”.当物理内存不足时,拿出部分硬盘空间当SWAP分区(虚拟成内存)使用,从而解决内存容量不足的情况. SWAP意思 ...