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 
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 GetSceneCount() const;
113 
117  public: void AddResourcePath(const std::string &_uri);
118 
122  public: RenderPathType GetRenderPathType() const;
123 
126  public: WindowManagerPtr GetWindowManager() const;
127 
130  private: bool CreateContext();
131 
133  private: void LoadPlugins();
134 
136  private: void SetupResources();
137 
139  private: void SetupRenderSystem();
140 
142  private: void PreRender();
143 
145  private: void Render();
146 
148  private: void PostRender();
149 
151  private: void CheckSystemCapabilities();
152 
154  public: Ogre::Root *root;
155 
157  private: std::vector< ScenePtr > scenes;
158 
160  private: Ogre::LogManager *logManager;
161 
163  protected: uint64_t dummyWindowId;
164 
166  protected: void *dummyDisplay;
167 
170  protected: void* dummyContext;
171 
173  private: bool headless;
174 
176  private: bool initialized;
177 
179  private: std::vector<event::ConnectionPtr> connections;
180 
182  private: transport::NodePtr node;
183 
185  private: RenderPathType renderPathType;
186 
188  private: WindowManagerPtr windowManager;
189 
191  private: friend class SingletonT<RenderEngine>;
192  };
194  }
195 }
196 #endif