RenderEngine.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2015 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"
34 #include "gazebo/util/system.hh"
35 
36 namespace Ogre
37 {
38  class Root;
39  class LogManager;
40  class OverlaySystem;
41 }
42 
43 namespace gazebo
44 {
47  namespace rendering
48  {
51 
56  class GZ_RENDERING_VISIBLE RenderEngine : public SingletonT<RenderEngine>
57  {
60  public: enum RenderPathType
61  {
63  NONE = 0,
65  VERTEX = 1,
67  FORWARD = 2,
69  DEFERRED = 3,
71  RENDER_PATH_COUNT
72  };
73 
76  private: RenderEngine();
77 
79  private: virtual ~RenderEngine();
80 
82  public: void Load();
83 
85  public: void Init();
86 
88  public: void Fini();
89 
94  public: ScenePtr CreateScene(const std::string &_name,
95  bool _enableVisualizations,
96  bool _isServer = false);
97 
100  public: void RemoveScene(const std::string &_name);
101 
106  public: ScenePtr GetScene(const std::string &_name="");
107 
112  public: ScenePtr GetScene(unsigned int _index);
113 
116  public: unsigned int GetSceneCount() const;
117 
121  public: void AddResourcePath(const std::string &_uri);
122 
126  public: RenderPathType GetRenderPathType() const;
127 
130  public: WindowManagerPtr GetWindowManager() const;
131 
132 #if OGRE_VERSION_MAJOR > 1 || OGRE_VERSION_MINOR >= 9
133  public: Ogre::OverlaySystem *GetOverlaySystem() const;
136 #endif
137 
140  private: bool CreateContext();
141 
143  private: void LoadPlugins();
144 
146  private: void SetupResources();
147 
149  private: void SetupRenderSystem();
150 
152  private: void PreRender();
153 
155  private: void Render();
156 
158  private: void PostRender();
159 
161  private: void CheckSystemCapabilities();
162 
164  public: Ogre::Root *root;
165 
167  private: std::vector< ScenePtr > scenes;
168 
170  private: Ogre::LogManager *logManager;
171 
173  protected: uint64_t dummyWindowId;
174 
176  protected: void *dummyDisplay;
177 
180  protected: void* dummyContext;
181 
183  private: bool headless;
184 
186  private: bool initialized;
187 
189  private: std::vector<event::ConnectionPtr> connections;
190 
193  private: transport::NodePtr node;
194 
196  private: RenderPathType renderPathType;
197 
199  private: WindowManagerPtr windowManager;
200 
201 #if OGRE_VERSION_MAJOR > 1 || OGRE_VERSION_MINOR >= 9
202  private: Ogre::OverlaySystem *overlaySystem;
203 #endif
204 
206  private: friend class SingletonT<RenderEngine>;
207  };
209  }
210 }
211 #endif
Adaptor to Ogre3d.
Definition: RenderEngine.hh:56
Ogre::Root * root
Pointer to the root scene node.
Definition: RenderEngine.hh:164
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:60
#define GZ_RENDERING_VISIBLE
Definition: system.hh:241
void * dummyDisplay
Pointer to the dummy display.Used for gui-less operation.
Definition: RenderEngine.hh:176
void * dummyContext
GLX context used to render the scenes.Used for gui-less operation.
Definition: RenderEngine.hh:180
boost::shared_ptr< Node > NodePtr
Definition: TransportTypes.hh:57
boost::shared_ptr< WindowManager > WindowManagerPtr
Definition: RenderTypes.hh:175
boost::shared_ptr< Scene > ScenePtr
Definition: RenderTypes.hh:79
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:173