OculusWindow.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014-2016 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 
18 #ifndef _GAZEBO_OCULUS_WINDOW_HH_
19 #define _GAZEBO_OCULUS_WINDOW_HH_
20 
21 #include <boost/thread.hpp>
22 #include <string>
23 
26 #include "gazebo/msgs/msgs.hh"
27 #include "gazebo/gui/qt.h"
28 
29 namespace gazebo
30 {
31  namespace gui
32  {
35 
39  class GZ_GUI_VISIBLE OculusWindow : public QWidget
40  {
41  Q_OBJECT
42 
44  public: OculusWindow(int _x, int _y, const std::string &_visual,
45  QWidget *_parent = 0);
46 
48  public: virtual ~OculusWindow();
49 
52  public: bool CreateCamera();
53 
54  // Documentation inherited.
55  protected: virtual void showEvent(QShowEvent *_e);
56 
57  // Documentation inherited.
58  protected: virtual void resizeEvent(QResizeEvent *_e);
59 
60  // Documentation inherited.
61  protected: void keyPressEvent(QKeyEvent *_event);
62 
65  private: std::string GetOgreHandle() const;
66 
68  private: void AttachCameraToVisual();
69 
71  private: QFrame *renderFrame;
72 
74  private: int windowId;
75 
77  private: rendering::OculusCameraPtr oculusCamera;
78 
80  private: rendering::ScenePtr scene;
81 
83  private: bool isFullScreen;
84 
86  private: int xPos;
87 
89  private: int yPos;
90 
92  private: std::string visualName;
93 
95  private: boost::thread *attachCameraThread;
96  };
97  }
98 }
99 #endif
#define GZ_GUI_VISIBLE
Definition: system.hh:284
A widget that renders a camera view suitable for the Oculus Rift.
Definition: OculusWindow.hh:39
Forward declarations for transport.
boost::shared_ptr< Scene > ScenePtr
Definition: RenderTypes.hh:80
boost::shared_ptr< OculusCamera > OculusCameraPtr
Definition: RenderTypes.hh:201