30 #include <OgreCamera.h> 31 #include <OgreQuaternion.h> 32 #include <OgreSceneManager.h> 33 #include <OgreSceneNode.h> 34 #include <OgreVector3.h> 35 #include <OgreViewport.h> 66 camera_->setProjectionType( Ogre::PT_ORTHOGRAPHIC );
67 camera_->setFixedYawAxis(
false );
83 setStatus(
"<b>Left-Click:</b> Move X/Y." );
87 setStatus(
"<b>Left-Click:</b> Rotate. <b>Middle-Click:</b> Move X/Y. <b>Right-Click:</b>: Zoom. <b>Shift</b>: More options." );
95 if( event.
type == QEvent::MouseButtonPress )
99 else if( event.
type == QEvent::MouseButtonRelease )
105 diff_x =
event.x -
event.last_x;
106 diff_y =
event.y -
event.last_y;
110 if( event.
left() && !
event.shift() )
116 else if( event.
middle() || (
event.shift() &&
event.left() ))
120 move( -diff_x / scale, diff_y / scale );
122 else if( event.
right() )
134 int diff =
event.wheel_delta;
165 Ogre::Camera* source_camera = source_view->
getCamera();
191 float width =
camera_->getViewport()->getActualWidth();
192 float height =
camera_->getViewport()->getActualHeight();
196 buildScaledOrthoMatrix( proj, -width / scale / 2, width / scale / 2, -height / scale / 2, height / scale / 2,
198 camera_->setCustomProjectionMatrix(
true, proj);
FloatProperty * y_property_
FloatProperty * scale_property_
virtual void mimic(ViewController *source_view)
Configure the settings of this view controller to give, as much as possible, a similar view as that g...
virtual void update(float dt, float ros_dt)
Called at 30Hz by ViewManager::update() while this view is active. Override with code that needs to r...
void emitConfigChanged()
Subclasses should call this whenever a change is made which would change the results of toString()...
void setCursor(CursorType cursor_type)
virtual float getFloat() const
bool multiply(float factor)
Multiply the property value by the given factor.
virtual void lookAt(const Ogre::Vector3 &point_rel_world)
This should be implemented in each subclass to aim the camera at the given point in space (relative t...
Property specialized to enforce floating point max/min.
TFSIMD_FORCE_INLINE tfScalar angle(const Quaternion &q1, const Quaternion &q2)
bool add(float delta)
Add the given delta to the property value.
bool setFloat(float new_value)
Float-typed "SLOT" version of setValue().
Ogre::Vector3 reference_position_
FloatProperty * angle_property_
virtual ~FixedOrientationOrthoViewController()
virtual void update(float dt, float ros_dt)
Called at 30Hz by ViewManager::update() while this view is active. Override with code that needs to r...
void setPosition(const Ogre::Vector3 &pos_rel_target)
virtual void mimic(ViewController *source_view)
Configure the settings of this view controller to give, as much as possible, a similar view as that g...
Ogre::Camera * getCamera() const
void setStatus(const QString &message)
virtual void queueRender()=0
Queues a render. Multiple calls before a render happens will only cause a single render.
void buildScaledOrthoMatrix(Ogre::Matrix4 &proj, float left, float right, float bottom, float top, float near, float far)
virtual void handleMouseEvent(ViewportMouseEvent &evt)
virtual void onInitialize()
Do subclass-specific initialization. Called by ViewController::initialize after context_, target_scene_node_, and camera_ are set. This version calls updateTargetSceneNode().
FloatProperty * x_property_
virtual void onInitialize()
Do subclass-specific initialization. Called by ViewController::initialize after context_, target_scene_node_, and camera_ are set. This version calls updateTargetSceneNode().
Ogre::SceneNode * target_scene_node_
virtual void onTargetFrameChanged(const Ogre::Vector3 &old_reference_position, const Ogre::Quaternion &old_reference_orientation)
Override to implement the change in properties which nullifies the change in target frame...
void hide()
Hide this Property in any PropertyTreeWidgets.
FixedOrientationOrthoViewController()
DisplayContext * context_
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)
void move(float x, float y)