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 
33 #include <OgreVector3.h>
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_*/
Generic interface for a camera.
Definition: camera_base.h:53
Ogre::Camera * getOgreCamera()
Get the Ogre camera associated with this camera object.
Definition: camera_base.h:67
IMETHOD Vector diff(const Vector &p_w_a, const Vector &p_w_b, double dt=1)
TFSIMD_FORCE_INLINE tfScalar angle(const Quaternion &q1, const Quaternion &q2)
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)
virtual void mouseLeftDown(int, int)
Definition: camera_base.h:177
Ogre::Camera * camera_
Ogre camera associated with this camera object.
Definition: camera_base.h:236
Ogre::SceneNode * relative_node_
Definition: camera_base.h:239
virtual void mouseLeftUp(int, int)
Definition: camera_base.h:186
virtual void mouseMiddleDown(int, int)
Definition: camera_base.h:180
virtual void relativeNodeChanged()
Called when the relative node changes.
Definition: camera_base.h:80
virtual void mouseRightDown(int, int)
Definition: camera_base.h:183
virtual void mouseRightUp(int, int)
Definition: camera_base.h:192
Ogre::SceneManager * scene_manager_
Scene manager this camera is part of.
Definition: camera_base.h:237
virtual void mouseMiddleUp(int, int)
Definition: camera_base.h:189


rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust
autogenerated on Mon Aug 15 2022 02:05:16