MIRA
OgreWidgetEx.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 by
3  * MetraLabs GmbH (MLAB), GERMANY
4  * and
5  * Neuroinformatics and Cognitive Robotics Labs (NICR) at TU Ilmenau, GERMANY
6  * All rights reserved.
7  *
8  * Contact: info@mira-project.org
9  *
10  * Commercial Usage:
11  * Licensees holding valid commercial licenses may use this file in
12  * accordance with the commercial license agreement provided with the
13  * software or, alternatively, in accordance with the terms contained in
14  * a written agreement between you and MLAB or NICR.
15  *
16  * GNU General Public License Usage:
17  * Alternatively, this file may be used under the terms of the GNU
18  * General Public License version 3.0 as published by the Free Software
19  * Foundation and appearing in the file LICENSE.GPL3 included in the
20  * packaging of this file. Please review the following information to
21  * ensure the GNU General Public License version 3.0 requirements will be
22  * met: http://www.gnu.org/copyleft/gpl.html.
23  * Alternatively you may (at your option) use any later version of the GNU
24  * General Public License if such license has been publicly approved by
25  * MLAB and NICR (or its successors, if any).
26  *
27  * IN NO EVENT SHALL "MLAB" OR "NICR" BE LIABLE TO ANY PARTY FOR DIRECT,
28  * INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF
29  * THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF "MLAB" OR
30  * "NICR" HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * "MLAB" AND "NICR" SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
33  * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
34  * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
35  * ON AN "AS IS" BASIS, AND "MLAB" AND "NICR" HAVE NO OBLIGATION TO
36  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR MODIFICATIONS.
37  */
38 
47 #ifndef _MIRA_OGREWIDGETEX_H_
48 #define _MIRA_OGREWIDGETEX_H_
49 
50 #ifndef Q_MOC_RUN
51 #include <OGRE/OgreColourValue.h>
52 #endif
53 
54 #include <geometry/Point.h>
55 #include <widgets/OgreWidget.h>
56 
57 
58 namespace Ogre {
59  class Camera;
60  class Light;
61  class Viewport;
62  class SceneManager;
63 }
64 
65 namespace mira {
66 
68 
81 {
82 public:
84  {
85  PERSPECTIVE=0,
87  BIRDS_EYE
88  };
89 
91  {
93  CROSSED_EYE
94  };
95 
97  {
98  BACKGROUND_SOLID=0,
101  BACKGROUND_BLACK
102  };
103 
105  {
106  NORMAL = 0,
108  HIDDEN_LINE
109  };
110 
111 public:
112 
113  explicit OgreWidgetEx(QWidget* parent=0);
114  virtual ~OgreWidgetEx();
115 
116 protected:
117 
118  virtual void initOgre();
119 
120 public:
121 
122  void setBackgroundMode(BackgroundMode mode);
123  void setBackgroundColor1(Ogre::ColourValue color1);
124  void setBackgroundColor2(Ogre::ColourValue color2);
125  void setBackgroundColors(Ogre::ColourValue color1, Ogre::ColourValue color2);
126 
127  void setCameraMode(CameraMode mode);
128  void setRenderMode(RenderMode mode);
129  void setStereoMode(StereoMode mode);
130 
131  void showBoundingBoxes(bool show=true);
132 
133 
134  void setCamera(const Point3f& position, float yaw, float pitch, float roll, float distance);
135  void lookAt(const Point3f& from, const Point3f& to);
136 
137 protected:
138 
139  void updateCamera();
140 
141 
142 protected:
143 
144  class ColouredRectangle2D;
145  class RenderModeTechniqueMod;
146 
147  // background style
149  Ogre::ColourValue mBackgroundColor1;
150  Ogre::ColourValue mBackgroundColor2;
151 
152  // camera mode
154  struct {
156  float yaw, pitch, roll;
157  float distance;
158  } mCameraSettings;
159 
160  // render mode
162 
163  // stereo mode
166 
168 
169  // components: light, camera, etc
170  Ogre::Light* mLight;
171  Ogre::Camera* mCamera; // main / left camera
172  Ogre::Camera* mCameraRight; // right camera
173  Ogre::Viewport* mViewport; // main / left viewport
174  Ogre::Viewport* mViewportRight; // right view port
175  Ogre::SceneManager* mSceneManager;
176  ColouredRectangle2D* mBackground;
177  RenderModeTechniqueMod* mRenderModeTechniqueMod;
178 
179 };
180 
182 
183 } // namespace
184 
185 #endif
RenderMode
Definition: OgreWidgetEx.h:104
#define MIRA_GUI_WIDGETS_EXPORT
Definition: GuiWidgetsExports.h:61
Definition: OgreWidgetEx.h:107
Ogre::SceneManager * mSceneManager
Definition: OgreWidgetEx.h:175
float yaw
Definition: OgreWidgetEx.h:156
Ogre::ColourValue mBackgroundColor2
Definition: OgreWidgetEx.h:150
Definition: OgreWidgetEx.h:92
bool mShowBoundingBoxes
Definition: OgreWidgetEx.h:167
Definition: OgreWidgetEx.h:100
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
Ogre::Viewport * mViewport
Definition: OgreWidgetEx.h:173
Class for 2D, 3D and N-dimensional points.
Ogre::Light * mLight
Definition: OgreWidgetEx.h:170
Definition: OgreWidgetEx.h:86
BackgroundMode mBackgroundMode
Definition: OgreWidgetEx.h:145
Point3f position
Definition: OgreWidgetEx.h:155
StereoMode
Definition: OgreWidgetEx.h:90
Definition: OgreWidgetEx.h:99
Ogre::ColourValue mBackgroundColor1
Definition: OgreWidgetEx.h:149
CameraMode
Definition: OgreWidgetEx.h:83
RenderModeTechniqueMod * mRenderModeTechniqueMod
Definition: OgreWidgetEx.h:177
float distance
Definition: OgreWidgetEx.h:157
ColouredRectangle2D * mBackground
Definition: OgreWidgetEx.h:176
Definition: ImageObject.h:60
StereoMode mStereoMode
Definition: OgreWidgetEx.h:164
Declaration of OgreWidget and related classes.
Ogre::Camera * mCameraRight
Definition: OgreWidgetEx.h:172
float mStereoEyeDistance
Definition: OgreWidgetEx.h:165
Non intrusive reflect for OGRE color class.
BackgroundMode
Definition: OgreWidgetEx.h:96
Ogre::Camera * mCamera
Definition: OgreWidgetEx.h:171
CameraMode mCameraMode
Definition: OgreWidgetEx.h:153
Definition: OgreWidget.h:79
Ogre::Viewport * mViewportRight
Definition: OgreWidgetEx.h:174
Extended version of OgreWidget that provides default setup of Ogre components (scene manager...
Definition: OgreWidgetEx.h:80
RenderMode mRenderMode
Definition: OgreWidgetEx.h:161