RenderEngine.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2016 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_RENDERING_RENDERENGINE_HH_
18 #define _GAZEBO_RENDERING_RENDERENGINE_HH_
19 
20 #include <memory>
21 #include <string>
22 
25 
28 #include "gazebo/util/system.hh"
29 
30 namespace Ogre
31 {
32  class Root;
33  class OverlaySystem;
34 }
35 
36 namespace gazebo
37 {
40  namespace rendering
41  {
42  // Forward declare private data.
43  class RenderEnginePrivate;
44 
47 
52  class GZ_RENDERING_VISIBLE RenderEngine : public SingletonT<RenderEngine>
53  {
56  public: enum RenderPathType
57  {
59  NONE = 0,
61  VERTEX = 1,
63  FORWARD = 2,
65  DEFERRED = 3,
67  RENDER_PATH_COUNT
68  };
69 
72  private: RenderEngine();
73 
75  private: virtual ~RenderEngine();
76 
78  public: void Load();
79 
81  public: void Init();
82 
84  public: void Fini();
85 
90  public: ScenePtr CreateScene(const std::string &_name,
91  bool _enableVisualizations,
92  bool _isServer = false);
93 
96  public: void RemoveScene(const std::string &_name);
97 
102  public: ScenePtr GetScene(const std::string &_name="");
103 
108  public: ScenePtr GetScene(unsigned int _index);
109 
113  public: unsigned int GetSceneCount() const GAZEBO_DEPRECATED(7.0);
114 
117  public: unsigned int SceneCount() const;
118 
122  public: void AddResourcePath(const std::string &_uri);
123 
127  public: RenderPathType GetRenderPathType() const;
128 
131  public: WindowManagerPtr GetWindowManager() const;
132 
135  public: Ogre::Root *Root() const;
136 
137 #if OGRE_VERSION_MAJOR > 1 || OGRE_VERSION_MINOR >= 9
138  public: Ogre::OverlaySystem *GetOverlaySystem() const
143  GAZEBO_DEPRECATED(7.0);
144 
148  public: Ogre::OverlaySystem *OverlaySystem() const;
149 #endif
150 
153  private: bool CreateContext();
154 
156  private: void LoadPlugins();
157 
159  private: void SetupResources();
160 
162  private: void SetupRenderSystem();
163 
165  private: void PreRender();
166 
168  private: void Render();
169 
171  private: void PostRender();
172 
174  private: void CheckSystemCapabilities();
175 
177  protected: uint64_t dummyWindowId;
178 
180  protected: void *dummyDisplay;
181 
184  protected: void *dummyContext;
185 
187  private: friend class SingletonT<RenderEngine>;
188 
191  private: std::unique_ptr<RenderEnginePrivate> dataPtr;
192  };
194  }
195 }
196 #endif
void * dummyDisplay
Pointer to the dummy display.Used for gui-less operation.
Definition: RenderEngine.hh:180
Adaptor to Ogre3d.
Definition: RenderEngine.hh:52
#define GAZEBO_DEPRECATED(version)
Definition: CommonTypes.hh:48
Singleton template class.
Definition: SingletonT.hh:33
void * dummyContext
GLX context used to render the scenes.Used for gui-less operation.
Definition: RenderEngine.hh:184
boost::shared_ptr< Scene > ScenePtr
Definition: RenderTypes.hh:80
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
boost::shared_ptr< WindowManager > WindowManagerPtr
Definition: RenderTypes.hh:184
RenderPathType
The type of rendering path used by the rendering engine.
Definition: RenderEngine.hh:56
uint64_t dummyWindowId
ID for a dummy window. Used for gui-less operation.
Definition: RenderEngine.hh:177