All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RenderEngine.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2014 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"
33 
34 namespace Ogre
35 {
36  class Root;
37  class LogManager;
38  class OverlaySystem;
39 }
40 
41 namespace gazebo
42 {
45  namespace rendering
46  {
49 
54  class RenderEngine : public SingletonT<RenderEngine>
55  {
58  public: enum RenderPathType
59  {
61  NONE = 0,
63  VERTEX = 1,
65  FORWARD = 2,
67  DEFERRED = 3,
70  };
71 
74  private: RenderEngine();
75 
77  private: virtual ~RenderEngine();
78 
80  public: void Load();
81 
83  public: void Init();
84 
86  public: void Fini();
87 
92  public: ScenePtr CreateScene(const std::string &_name,
93  bool _enableVisualizations,
94  bool _isServer = false);
95 
98  public: void RemoveScene(const std::string &_name);
99 
104  public: ScenePtr GetScene(const std::string &_name="");
105 
110  public: ScenePtr GetScene(unsigned int _index);
111 
114  public: unsigned int GetSceneCount() const;
115 
119  public: void AddResourcePath(const std::string &_uri);
120 
124  public: RenderPathType GetRenderPathType() const;
125 
128  public: WindowManagerPtr GetWindowManager() const;
129 
130 #if OGRE_VERSION_MAJOR > 1 || OGRE_VERSION_MINOR >= 9
131 
132 
133  public: Ogre::OverlaySystem *GetOverlaySystem() const;
134 #endif
135 
138  private: bool CreateContext();
139 
141  private: void LoadPlugins();
142 
144  private: void SetupResources();
145 
147  private: void SetupRenderSystem();
148 
150  private: void PreRender();
151 
153  private: void Render();
154 
156  private: void PostRender();
157 
159  private: void CheckSystemCapabilities();
160 
162  public: Ogre::Root *root;
163 
165  private: std::vector< ScenePtr > scenes;
166 
168  private: Ogre::LogManager *logManager;
169 
171  protected: uint64_t dummyWindowId;
172 
174  protected: void *dummyDisplay;
175 
178  protected: void* dummyContext;
179 
181  private: bool headless;
182 
184  private: bool initialized;
185 
187  private: std::vector<event::ConnectionPtr> connections;
188 
190  private: transport::NodePtr node;
191 
193  private: RenderPathType renderPathType;
194 
196  private: WindowManagerPtr windowManager;
197 
198 #if OGRE_VERSION_MAJOR > 1 || OGRE_VERSION_MINOR >= 9
199  private: Ogre::OverlaySystem *overlaySystem;
200 #endif
201 
203  private: friend class SingletonT<RenderEngine>;
204  };
206  }
207 }
208 #endif