All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RenderEngine.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: Middleman between OGRE and Gazebo
18  * Author: Nate Koenig
19  * Date: 13 Feb 2006
20  */
21 
22 #ifndef _RENDERENGINE_HH_
23 #define _RENDERENGINE_HH_
24 
25 #include <vector>
26 #include <string>
27 
28 #include "gazebo/msgs/msgs.hh"
30 #include "gazebo/common/Event.hh"
33 #include "gazebo/util/system.hh"
34 
35 namespace Ogre
36 {
37  class Root;
38  class LogManager;
39  class OverlaySystem;
40 }
41 
42 namespace gazebo
43 {
46  namespace rendering
47  {
50 
55  class GAZEBO_VISIBLE RenderEngine : public SingletonT<RenderEngine>
56  {
59  public: enum RenderPathType
60  {
62  NONE = 0,
64  VERTEX = 1,
66  FORWARD = 2,
68  DEFERRED = 3,
70  RENDER_PATH_COUNT
71  };
72 
75  private: RenderEngine();
76 
78  private: virtual ~RenderEngine();
79 
81  public: void Load();
82 
84  public: void Init();
85 
87  public: void Fini();
88 
93  public: ScenePtr CreateScene(const std::string &_name,
94  bool _enableVisualizations,
95  bool _isServer = false);
96 
99  public: void RemoveScene(const std::string &_name);
100 
105  public: ScenePtr GetScene(const std::string &_name="");
106 
111  public: ScenePtr GetScene(unsigned int _index);
112 
115  public: unsigned int GetSceneCount() const;
116 
120  public: void AddResourcePath(const std::string &_uri);
121 
125  public: RenderPathType GetRenderPathType() const;
126 
129  public: WindowManagerPtr GetWindowManager() const;
130 
131 #if OGRE_VERSION_MAJOR > 1 || OGRE_VERSION_MINOR >= 9
132  public: Ogre::OverlaySystem *GetOverlaySystem() const;
135 #endif
136 
139  private: bool CreateContext();
140 
142  private: void LoadPlugins();
143 
145  private: void SetupResources();
146 
148  private: void SetupRenderSystem();
149 
151  private: void PreRender();
152 
154  private: void Render();
155 
157  private: void PostRender();
158 
160  private: void CheckSystemCapabilities();
161 
163  public: Ogre::Root *root;
164 
166  private: std::vector< ScenePtr > scenes;
167 
169  private: Ogre::LogManager *logManager;
170 
172  protected: uint64_t dummyWindowId;
173 
175  protected: void *dummyDisplay;
176 
179  protected: void* dummyContext;
180 
182  private: bool headless;
183 
185  private: bool initialized;
186 
188  private: std::vector<event::ConnectionPtr> connections;
189 
192  private: transport::NodePtr node;
193 
195  private: RenderPathType renderPathType;
196 
198  private: WindowManagerPtr windowManager;
199 
200 #if OGRE_VERSION_MAJOR > 1 || OGRE_VERSION_MINOR >= 9
201  private: Ogre::OverlaySystem *overlaySystem;
202 #endif
203 
205  private: friend class SingletonT<RenderEngine>;
206  };
208  }
209 }
210 #endif
Adaptor to Ogre3d.
Definition: RenderEngine.hh:55
Ogre::Root * root
Pointer to the root scene node.
Definition: RenderEngine.hh:163
Forward declarations for transport.
Singleton template class.
Definition: SingletonT.hh:33
RenderPathType
The type of rendering path used by the rendering engine.
Definition: RenderEngine.hh:59
void * dummyDisplay
Pointer to the dummy display.Used for gui-less operation.
Definition: RenderEngine.hh:175
void * dummyContext
GLX context used to render the scenes.Used for gui-less operation.
Definition: RenderEngine.hh:179
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:52
boost::shared_ptr< WindowManager > WindowManagerPtr
Definition: RenderTypes.hh:148
boost::shared_ptr< Scene > ScenePtr
Definition: RenderTypes.hh:72
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
uint64_t dummyWindowId
ID for a dummy window. Used for gui-less operation.
Definition: RenderEngine.hh:172
#define GAZEBO_VISIBLE
Use to represent "symbol visible" if supported.
Definition: system.hh:48