RenderEngine.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012 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 #include <vector>
23 
26 
29 #include "gazebo/util/system.hh"
30 
31 namespace Ogre
32 {
33  class Root;
34  class OverlaySystem;
35 }
36 
37 namespace gazebo
38 {
41  namespace rendering
42  {
43  // Forward declare private data.
44  class RenderEnginePrivate;
45 
48 
53  class GZ_RENDERING_VISIBLE RenderEngine : public SingletonT<RenderEngine>
54  {
57  public: enum RenderPathType
58  {
60  NONE = 0,
62  VERTEX = 1,
64  FORWARD = 2,
66  DEFERRED = 3,
68  RENDER_PATH_COUNT
69  };
70 
73  private: RenderEngine();
74 
76  private: virtual ~RenderEngine();
77 
79  public: void Load();
80 
82  public: void Init();
83 
85  public: void Fini();
86 
91  public: ScenePtr CreateScene(const std::string &_name,
92  bool _enableVisualizations,
93  bool _isServer = false);
94 
97  public: void RemoveScene(const std::string &_name);
98 
103  public: ScenePtr GetScene(const std::string &_name="");
104 
109  public: ScenePtr GetScene(unsigned int _index);
110 
114  public: unsigned int GetSceneCount() const GAZEBO_DEPRECATED(7.0);
115 
118  public: unsigned int SceneCount() const;
119 
123  public: void AddResourcePath(const std::string &_uri);
124 
128  public: RenderPathType GetRenderPathType() const;
129 
132  public: WindowManagerPtr GetWindowManager() const;
133 
136  public: Ogre::Root *Root() const;
137 
140  public: std::vector<unsigned int> FSAALevels() const;
141 
142 #if OGRE_VERSION_MAJOR > 1 || OGRE_VERSION_MINOR >= 9
143  public: Ogre::OverlaySystem *GetOverlaySystem() const
148  GAZEBO_DEPRECATED(7.0);
149 
153  public: Ogre::OverlaySystem *OverlaySystem() const;
154 #endif
155 
158  private: bool CreateContext();
159 
161  private: void LoadPlugins();
162 
164  private: void SetupResources();
165 
167  private: void SetupRenderSystem();
168 
170  private: void PreRender();
171 
173  private: void Render();
174 
176  private: void PostRender();
177 
179  private: void CheckSystemCapabilities();
180 
182  protected: uint64_t dummyWindowId;
183 
185  protected: void *dummyDisplay;
186 
189  protected: void *dummyContext;
190 
192  private: friend class SingletonT<RenderEngine>;
193 
196  private: std::unique_ptr<RenderEnginePrivate> dataPtr;
197  };
199  }
200 }
201 #endif
void * dummyDisplay
Pointer to the dummy display.Used for gui-less operation.
Definition: RenderEngine.hh:185
Forward declarations for the common classes.
Definition: Animation.hh:33
Adaptor to Ogre3d.
Definition: RenderEngine.hh:53
STL namespace.
#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:189
boost::shared_ptr< Scene > ScenePtr
Definition: RenderTypes.hh:80
Definition: JointMaker.hh:41
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:57
uint64_t dummyWindowId
ID for a dummy window. Used for gui-less operation.
Definition: RenderEngine.hh:182