OculusWindow.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 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 #ifndef GAZEBO_GUI_OCULUS_WINDOW_HH_
18 #define GAZEBO_GUI_OCULUS_WINDOW_HH_
19 
20 #include <string>
21 #include <thread>
22 
25 #include "gazebo/msgs/msgs.hh"
26 #include "gazebo/gui/qt.h"
27 
28 namespace gazebo
29 {
30  namespace gui
31  {
34 
38  class GZ_GUI_VISIBLE OculusWindow : public QWidget
39  {
40  Q_OBJECT
41 
43  public: OculusWindow(int _x, int _y, const std::string &_visual,
44  QWidget *_parent = 0);
45 
47  public: virtual ~OculusWindow();
48 
51  public: bool CreateCamera();
52 
53  // Documentation inherited.
54  protected: virtual void showEvent(QShowEvent *_e);
55 
56  // Documentation inherited.
57  protected: virtual void resizeEvent(QResizeEvent *_e);
58 
59  // Documentation inherited.
60  protected: void keyPressEvent(QKeyEvent *_event);
61 
64  private: std::string GetOgreHandle() const;
65 
67  private: void AttachCameraToVisual();
68 
70  private: QFrame *renderFrame;
71 
73  private: int windowId;
74 
76  private: rendering::OculusCameraPtr oculusCamera;
77 
79  private: rendering::ScenePtr scene;
80 
82  private: bool isFullScreen;
83 
85  private: int xPos;
86 
88  private: int yPos;
89 
91  private: std::string visualName;
92 
94  private: std::thread *attachCameraThread;
95  };
96  }
97 }
98 #endif
Forward declarations for the common classes.
Definition: Animation.hh:33
A widget that renders a camera view suitable for the Oculus Rift.
Definition: OculusWindow.hh:38
Forward declarations for transport.
boost::shared_ptr< Scene > ScenePtr
Definition: RenderTypes.hh:81