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 
31 GZ_SINGLETON_DECLARE(GZ_RENDERING_VISIBLE, gazebo, rendering, RenderEngine)
32 
33 namespace Ogre
34 {
35  class Root;
36  class OverlaySystem;
37 }
38 
39 namespace gazebo
40 {
43  namespace rendering
44  {
45  // Forward declare private data.
46  class RenderEnginePrivate;
47 
50 
55  class GZ_RENDERING_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 SceneCount() const;
116 
120  public: void AddResourcePath(const std::string &_uri);
121 
125  public: RenderPathType GetRenderPathType() const;
126 
129  public: WindowManagerPtr GetWindowManager() const;
130 
133  public: Ogre::Root *Root() const;
134 
137  public: std::vector<unsigned int> FSAALevels() const;
138 
139 #if OGRE_VERSION_MAJOR > 1 || OGRE_VERSION_MINOR >= 9
140  public: Ogre::OverlaySystem *OverlaySystem() const;
144 #endif
145 
148  private: bool CreateContext();
149 
151  private: void LoadPlugins();
152 
154  private: void SetupResources();
155 
157  private: void SetupRenderSystem();
158 
160  private: void PreRender();
161 
163  private: void Render();
164 
166  private: void PostRender();
167 
169  private: void CheckSystemCapabilities();
170 
172  protected: uint64_t dummyWindowId;
173 
175  protected: void *dummyDisplay;
176 
179  protected: void *dummyContext;
180 
182  private: friend class SingletonT<RenderEngine>;
183 
186  private: std::unique_ptr<RenderEnginePrivate> dataPtr;
187  };
189  }
190 }
191 #endif
void * dummyDisplay
Pointer to the dummy display.Used for gui-less operation.
Definition: RenderEngine.hh:175
Forward declarations for the common classes.
Definition: Animation.hh:26
Adaptor to Ogre3d.
Definition: RenderEngine.hh:55
Singleton template class.
Definition: SingletonT.hh:33
rendering
Definition: RenderEngine.hh:31
void * dummyContext
GLX context used to render the scenes.Used for gui-less operation.
Definition: RenderEngine.hh:179
boost::shared_ptr< Scene > ScenePtr
Definition: RenderTypes.hh:82
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:186
RenderPathType
The type of rendering path used by the rendering engine.
Definition: RenderEngine.hh:59
#define GZ_SINGLETON_DECLARE(visibility, n1, n2, singletonType)
Helper to declare typed SingletonT.
Definition: SingletonT.hh:61
uint64_t dummyWindowId
ID for a dummy window. Used for gui-less operation.
Definition: RenderEngine.hh:172