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 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 /* 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 }
39 
40 namespace gazebo
41 {
44  namespace rendering
45  {
48 
53  class RenderEngine : public SingletonT<RenderEngine>
54  {
57  public: enum RenderPathType
58  {
60  NONE = 0,
62  VERTEX = 1,
64  FORWARD = 2,
66  DEFERRED = 3,
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 
113  public: unsigned int GetSceneCount() const;
114 
118  public: void AddResourcePath(const std::string &_uri);
119 
123  public: RenderPathType GetRenderPathType() const;
124 
127  public: WindowManagerPtr GetWindowManager() const;
128 
131  private: bool CreateContext();
132 
134  private: void LoadPlugins();
135 
137  private: void SetupResources();
138 
140  private: void SetupRenderSystem();
141 
143  private: void PreRender();
144 
146  private: void Render();
147 
149  private: void PostRender();
150 
152  private: void CheckSystemCapabilities();
153 
155  public: Ogre::Root *root;
156 
158  private: std::vector< ScenePtr > scenes;
159 
161  private: Ogre::LogManager *logManager;
162 
164  protected: uint64_t dummyWindowId;
165 
167  protected: void *dummyDisplay;
168 
171  protected: void* dummyContext;
172 
174  private: bool headless;
175 
177  private: bool initialized;
178 
180  private: std::vector<event::ConnectionPtr> connections;
181 
183  private: transport::NodePtr node;
184 
186  private: RenderPathType renderPathType;
187 
189  private: WindowManagerPtr windowManager;
190 
192  private: friend class SingletonT<RenderEngine>;
193  };
195  }
196 }
197 #endif