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
31GZ_SINGLETON_DECLARE(GZ_RENDERING_VISIBLE, gazebo, rendering, RenderEngine)
32
33namespace Ogre
34{
35 class Root;
36 class OverlaySystem;
37}
38
39namespace 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
126
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
143 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
gazebo
Definition RenderEngine.hh:31
rendering
Definition RenderEngine.hh:31
Singleton template class.
Definition SingletonT.hh:34
Adaptor to Ogre3d.
Definition RenderEngine.hh:56
void Fini()
Tears down the rendering engine.
ScenePtr GetScene(const std::string &_name="")
Get a scene by name.
void * dummyContext
GLX context used to render the scenes.Used for gui-less operation.
Definition RenderEngine.hh:179
RenderPathType GetRenderPathType() const
Get the type of rendering path to use.
WindowManagerPtr GetWindowManager() const
Get a pointer to the window manager.
void Init()
Initialize Ogre. Load must happen before Init.
std::vector< unsigned int > FSAALevels() const
Get a list of all supported FSAA levels for this render system.
ScenePtr CreateScene(const std::string &_name, bool _enableVisualizations, bool _isServer=false)
Create a scene.
void RemoveScene(const std::string &_name)
Remove a scene.
ScenePtr GetScene(unsigned int _index)
Get a scene by index.
RenderPathType
The type of rendering path used by the rendering engine.
Definition RenderEngine.hh:60
@ DEFERRED
Utilizes deferred rendering. Best fidelity.
Definition RenderEngine.hh:68
@ VERTEX
Most basic rendering, with least fidelity.
Definition RenderEngine.hh:64
@ RENDER_PATH_COUNT
Count of the rendering path enums.
Definition RenderEngine.hh:70
@ FORWARD
Utilizes the RTT shader system.
Definition RenderEngine.hh:66
@ NONE
No rendering is done.
Definition RenderEngine.hh:62
void AddResourcePath(const std::string &_uri)
Add a new path for Ogre to search for resources.
void * dummyDisplay
Pointer to the dummy display.Used for gui-less operation.
Definition RenderEngine.hh:175
unsigned int SceneCount() const
Get the number of scenes.
uint64_t dummyWindowId
ID for a dummy window. Used for gui-less operation.
Definition RenderEngine.hh:172
Ogre::Root * Root() const
Get a pointer to the Ogre root object.
void Load()
Load the parameters for Ogre. Load must happen before Init.
#define GZ_SINGLETON_DECLARE(visibility, n1, n2, singletonType)
Helper to declare typed SingletonT.
Definition SingletonT.hh:58
Definition JointMaker.hh:40
boost::shared_ptr< WindowManager > WindowManagerPtr
Definition RenderTypes.hh:186
boost::shared_ptr< Scene > ScenePtr
Definition RenderTypes.hh:82
Forward declarations for the common classes.
Definition Animation.hh:27