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 
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 
112  public: unsigned int SceneCount() const;
113 
117  public: void AddResourcePath(const std::string &_uri);
118 
122  public: RenderPathType GetRenderPathType() const;
123 
126  public: WindowManagerPtr GetWindowManager() const;
127 
130  public: Ogre::Root *Root() const;
131 
134  public: std::vector<unsigned int> FSAALevels() const;
135 
136 #if OGRE_VERSION_MAJOR > 1 || OGRE_VERSION_MINOR >= 9
137  public: Ogre::OverlaySystem *OverlaySystem() const;
141 #endif
142 
145  private: bool CreateContext();
146 
148  private: void LoadPlugins();
149 
151  private: void SetupResources();
152 
154  private: void SetupRenderSystem();
155 
157  private: void PreRender();
158 
160  private: void Render();
161 
163  private: void PostRender();
164 
166  private: void CheckSystemCapabilities();
167 
169  protected: uint64_t dummyWindowId;
170 
172  protected: void *dummyDisplay;
173 
176  protected: void *dummyContext;
177 
179  private: friend class SingletonT<RenderEngine>;
180 
183  private: std::unique_ptr<RenderEnginePrivate> dataPtr;
184  };
186  }
187 }
188 #endif
void * dummyDisplay
Pointer to the dummy display.Used for gui-less operation.
Definition: RenderEngine.hh:172
Forward declarations for the common classes.
Definition: Animation.hh:33
Adaptor to Ogre3d.
Definition: RenderEngine.hh:52
Singleton template class.
Definition: SingletonT.hh:33
void * dummyContext
GLX context used to render the scenes.Used for gui-less operation.
Definition: RenderEngine.hh:176
boost::shared_ptr< Scene > ScenePtr
Definition: RenderTypes.hh:81
Definition: JointMaker.hh:39
GAZEBO_VISIBLE void Init(google::protobuf::Message &_message, const std::string &_id="")
Initialize a message.
boost::shared_ptr< WindowManager > WindowManagerPtr
Definition: RenderTypes.hh:185
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:169