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 
23 #ifndef Q_MOC_RUN
26 #include "gazebo/msgs/msgs.hh"
27 #include "gazebo/gui/qt.h"
28 #endif
29 
30 namespace gazebo
31 {
32  namespace gui
33  {
36 
40  class GZ_GUI_VISIBLE OculusWindow : public QWidget
41  {
42  Q_OBJECT
43 
45  public: OculusWindow(int _x, int _y, const std::string &_visual,
46  QWidget *_parent = 0);
47 
49  public: virtual ~OculusWindow();
50 
53  public: bool CreateCamera();
54 
55  // Documentation inherited.
56  protected: virtual void showEvent(QShowEvent *_e);
57 
58  // Documentation inherited.
59  protected: virtual void resizeEvent(QResizeEvent *_e);
60 
61  // Documentation inherited.
62  protected: void keyPressEvent(QKeyEvent *_event);
63 
66  private: std::string GetOgreHandle() const;
67 
69  private: void AttachCameraToVisual();
70 
72  private: QFrame *renderFrame;
73 
75  private: int windowId;
76 
78  private: rendering::OculusCameraPtr oculusCamera;
79 
81  private: rendering::ScenePtr scene;
82 
84  private: bool isFullScreen;
85 
87  private: int xPos;
88 
90  private: int yPos;
91 
93  private: std::string visualName;
94 
96  private: std::thread *attachCameraThread;
97  };
98  }
99 }
100 #endif
Forward declarations for the common classes.
Definition: Animation.hh:26
A widget that renders a camera view suitable for the Oculus Rift.
Definition: OculusWindow.hh:40
Forward declarations for transport.
boost::shared_ptr< Scene > ScenePtr
Definition: RenderTypes.hh:82
gui
Definition: KeyEventHandler.hh:29