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 Nate Koenig
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 "msgs/msgs.hh"
29 #include "common/SingletonT.hh"
30 #include "common/Event.hh"
32 #include "rendering/RenderTypes.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  {
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  private: bool CreateContext();
127 
129  private: void LoadPlugins();
130 
132  private: void SetupResources();
133 
135  private: void SetupRenderSystem();
136 
138  private: void PreRender();
139 
141  private: void Render();
142 
144  private: void PostRender();
145 
147  private: void CheckSystemCapabilities();
148 
150  public: Ogre::Root *root;
151 
153  private: std::vector< ScenePtr > scenes;
154 
156  private: Ogre::LogManager *logManager;
157 
159  protected: uint64_t dummyWindowId;
160 
162  protected: void *dummyDisplay;
163 
166  protected: void* dummyContext;
167 
169  private: bool headless;
170 
172  private: bool initialized;
173 
175  private: std::vector<event::ConnectionPtr> connections;
176 
178  private: transport::NodePtr node;
179 
181  private: RenderPathType renderPathType;
182 
184  private: friend class SingletonT<RenderEngine>;
185  };
187  }
188 }
189 #endif