camera_base.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008, Willow Garage, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of the Willow Garage, Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from
15  * this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27  * POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef OGRE_TOOLS_CAMERA_BASE_H_
31 #define OGRE_TOOLS_CAMERA_BASE_H_
32 
34 #include <OgreQuaternion.h>
35 
36 namespace Ogre
37 {
38 class Camera;
39 class SceneNode;
40 class SceneManager;
41 } // namespace Ogre
42 
43 namespace rviz
44 {
54 {
55 public:
60  CameraBase(Ogre::SceneManager* scene_manager);
61  virtual ~CameraBase();
62 
67  Ogre::Camera* getOgreCamera()
68  {
69  return camera_;
70  }
71 
76  void setRelativeNode(Ogre::SceneNode* node);
80  virtual void relativeNodeChanged()
81  {
82  }
83 
84  virtual void update() = 0;
85 
89  virtual void setPosition(const Ogre::Vector3& position);
93  virtual void setOrientation(const Ogre::Quaternion& orientation);
94 
107  virtual void yaw(float angle) = 0;
120  virtual void pitch(float angle) = 0;
133  virtual void roll(float angle) = 0;
134 
138  virtual void setOrientation(float x, float y, float z, float w) = 0;
142  virtual void setPosition(float x, float y, float z) = 0;
143 
149  virtual void setFrom(CameraBase* camera) = 0;
150 
155  virtual Ogre::Vector3 getPosition() = 0;
160  virtual Ogre::Quaternion getOrientation() = 0;
161 
166  virtual void lookAt(const Ogre::Vector3& point) = 0;
167 
175  virtual void move(float x, float y, float z) = 0;
176 
177  virtual void mouseLeftDown(int /*x*/, int /*y*/)
178  {
179  }
180  virtual void mouseMiddleDown(int /*x*/, int /*y*/)
181  {
182  }
183  virtual void mouseRightDown(int /*x*/, int /*y*/)
184  {
185  }
186  virtual void mouseLeftUp(int /*x*/, int /*y*/)
187  {
188  }
189  virtual void mouseMiddleUp(int /*x*/, int /*y*/)
190  {
191  }
192  virtual void mouseRightUp(int /*x*/, int /*y*/)
193  {
194  }
195 
202  virtual void mouseLeftDrag(int diff_x, int diff_y, bool ctrl, bool alt, bool shift) = 0;
209  virtual void mouseMiddleDrag(int diff_x, int diff_y, bool ctrl, bool alt, bool shift) = 0;
216  virtual void mouseRightDrag(int diff_x, int diff_y, bool ctrl, bool alt, bool shift) = 0;
223  virtual void scrollWheel(int diff, bool ctrl, bool alt, bool shift) = 0;
224 
229  virtual void fromString(const std::string& str) = 0;
233  virtual std::string toString() = 0;
234 
235 protected:
236  Ogre::Camera* camera_;
237  Ogre::SceneManager* scene_manager_;
238 
239  Ogre::SceneNode* relative_node_;
240 };
241 
242 } // namespace rviz
243 
244 #endif /*OGRE_TOOLS_CAMERA_BASE_H_*/
rviz::CameraBase::getOgreCamera
Ogre::Camera * getOgreCamera()
Get the Ogre camera associated with this camera object.
Definition: camera_base.h:67
rviz::CameraBase::setPosition
virtual void setPosition(const Ogre::Vector3 &position)
Set the position of the camera.
Definition: camera_base.cpp:66
Ogre
Definition: axes_display.h:35
rviz::CameraBase::roll
virtual void roll(float angle)=0
Roll the camera.
rviz::CameraBase::yaw
virtual void yaw(float angle)=0
Yaw the camera.
rviz::CameraBase::mouseMiddleUp
virtual void mouseMiddleUp(int, int)
Definition: camera_base.h:189
rviz::CameraBase::camera_
Ogre::Camera * camera_
Ogre camera associated with this camera object.
Definition: camera_base.h:236
rviz::CameraBase::mouseLeftDrag
virtual void mouseLeftDrag(int diff_x, int diff_y, bool ctrl, bool alt, bool shift)=0
Handle a left mouse button drag.
rviz::CameraBase::relative_node_
Ogre::SceneNode * relative_node_
Definition: camera_base.h:239
rviz::CameraBase::setRelativeNode
void setRelativeNode(Ogre::SceneNode *node)
Set a scene node that all camera transformations should be relative to.
Definition: camera_base.cpp:57
rviz::CameraBase::mouseRightDrag
virtual void mouseRightDrag(int diff_x, int diff_y, bool ctrl, bool alt, bool shift)=0
Handle a right mouse button drag.
rviz::CameraBase::toString
virtual std::string toString()=0
Returns a string representation of the camera's configuration.
rviz::CameraBase
Generic interface for a camera.
Definition: camera_base.h:53
rviz::CameraBase::mouseMiddleDrag
virtual void mouseMiddleDrag(int diff_x, int diff_y, bool ctrl, bool alt, bool shift)=0
Handle a middle mouse button drag.
rviz::CameraBase::CameraBase
CameraBase(Ogre::SceneManager *scene_manager)
Constructor.
Definition: camera_base.cpp:43
rviz::CameraBase::update
virtual void update()=0
rviz
Definition: add_display_dialog.cpp:54
rviz::CameraBase::lookAt
virtual void lookAt(const Ogre::Vector3 &point)=0
Point the camera at the specified point.
rviz::CameraBase::mouseMiddleDown
virtual void mouseMiddleDown(int, int)
Definition: camera_base.h:180
ogre_vector.h
rviz::CameraBase::mouseRightUp
virtual void mouseRightUp(int, int)
Definition: camera_base.h:192
rviz::CameraBase::mouseLeftDown
virtual void mouseLeftDown(int, int)
Definition: camera_base.h:177
rviz::CameraBase::getOrientation
virtual Ogre::Quaternion getOrientation()=0
Get the orientation of this camera.
rviz::CameraBase::setFrom
virtual void setFrom(CameraBase *camera)=0
Set the position/orientation of this camera from another camera.
rviz::CameraBase::move
virtual void move(float x, float y, float z)=0
Move the camera relative to its orientation.
rviz::CameraBase::~CameraBase
virtual ~CameraBase()
Definition: camera_base.cpp:52
rviz::CameraBase::setOrientation
virtual void setOrientation(const Ogre::Quaternion &orientation)
Set the orientation of the camera.
Definition: camera_base.cpp:71
rviz::CameraBase::mouseLeftUp
virtual void mouseLeftUp(int, int)
Definition: camera_base.h:186
rviz::CameraBase::pitch
virtual void pitch(float angle)=0
Pitch the camera.
rviz::CameraBase::scrollWheel
virtual void scrollWheel(int diff, bool ctrl, bool alt, bool shift)=0
Handle a scrollwheel change.
rviz::CameraBase::mouseRightDown
virtual void mouseRightDown(int, int)
Definition: camera_base.h:183
rviz::CameraBase::getPosition
virtual Ogre::Vector3 getPosition()=0
Get the position of this camera.
rviz::CameraBase::fromString
virtual void fromString(const std::string &str)=0
Loads the camera's configure from the supplied string (generated through toString())
rviz::CameraBase::relativeNodeChanged
virtual void relativeNodeChanged()
Called when the relative node changes.
Definition: camera_base.h:80
rviz::CameraBase::scene_manager_
Ogre::SceneManager * scene_manager_
Scene manager this camera is part of.
Definition: camera_base.h:237


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust, William Woodall
autogenerated on Fri Dec 13 2024 03:31:02