All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UserCamera.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2014 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 /* Desc: Camera for viewing the world
18  * Author: Nate Koenig
19  * Date: 19 Jun 2008
20  */
21 
22 #ifndef _USERCAMERA_HH_
23 #define _USERCAMERA_HH_
24 
25 #include <string>
26 #include <vector>
27 
31 
32 namespace gazebo
33 {
34  namespace rendering
35  {
36  class OrbitViewController;
37  class FPSViewController;
38  class Visual;
39  class GUIOverlay;
40  class SelectionBuffer;
41 
44 
47  class UserCamera : public Camera
48  {
52  public: UserCamera(const std::string &_name, ScenePtr _scene);
53 
55  public: virtual ~UserCamera();
56 
59  public: void Load(sdf::ElementPtr _sdf);
60 
62  public: void Load();
63 
65  public: void Init();
66 
68  public: virtual void Update();
69 
71  public: virtual void PostRender();
72 
74  public: void Fini();
75 
78  public: virtual void SetWorldPose(const math::Pose &_pose);
79 
82  public: void HandleMouseEvent(const common::MouseEvent &_evt);
83 
86  public: void HandleKeyPressEvent(const std::string &_key);
87 
90  public: void HandleKeyReleaseEvent(const std::string &_key);
91 
94  public: void SetViewController(const std::string &_type);
95 
99  public: void SetViewController(const std::string &_type,
100  const math::Vector3 &_pos);
101 
104  public: std::string GetViewControllerTypeString();
105 
109  public: void Resize(unsigned int _w, unsigned int _h);
110 
116  public: void SetViewportDimensions(float _x, float _y,
117  float _w, float _h);
118 
121  public: float GetAvgFPS() const;
122 
125  public: float GetTriangleCount() const;
126 
129  public: void MoveToVisual(VisualPtr _visual);
130 
131  // Doxygen automatically pulls in the correct documentation.
132  public: virtual bool MoveToPosition(const math::Pose &_pose,
133  double _time);
134 
137  public: void MoveToVisual(const std::string &_visualName);
138 
143  public: virtual void SetRenderTarget(Ogre::RenderTarget *_target);
144 
149  public: GUIOverlay *GetGUIOverlay();
150 
156  public: void EnableViewController(bool _value) const;
157 
163  public: VisualPtr GetVisual(const math::Vector2i &_mousePos,
164  std::string &_mod);
165 
168  public: VisualPtr GetVisual(const math::Vector2i &_mousePos) const;
169 
172  public: void SetFocalPoint(const math::Vector3 &_pt);
173 
174  // Documentation inherited
175  public: virtual unsigned int GetImageWidth() const;
176 
177  // Documentation inherited
178  public: virtual unsigned int GetImageHeight() const;
179 
191  protected: virtual bool AttachToVisualImpl(VisualPtr _visual,
192  bool _inheritOrientation, double _minDist = 0,
193  double _maxDist = 0);
194 
195  // Documentation inherited.
196  protected: virtual void AnimationComplete();
197 
203  protected: virtual bool TrackVisualImpl(VisualPtr _visual);
204 
205 
207  private: void ToggleShowVisual();
208 
212  private: void ShowVisual(bool _show);
213 
216  private: void OnMoveToVisualComplete();
217 
219  private: Visual *visual;
220 
222  private: ViewController *viewController;
223 
225  private: OrbitViewController *orbitViewController;
226 
228  private: FPSViewController *fpsViewController;
229 
231  private: GUIOverlay *gui;
232 
234  // private: Ogre::SceneNode *axisNode;
235 
237  private: SelectionBuffer *selectionBuffer;
238  };
240  }
241 }
242 #endif