Gazebo Rendering

API Reference

9.0.0
OgreRenderEngine.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 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 GZ_RENDERING_OGRE_OGRERENDERENGINE_HH_
18#define GZ_RENDERING_OGRE_OGRERENDERENGINE_HH_
19
20#include <map>
21#include <memory>
22#include <string>
23#include <vector>
24
26
32#include "gz/rendering/ogre/Export.hh"
33
34namespace Ogre
35{
36 class LogManager;
37 class Root;
38}
39
40namespace gz
41{
42 namespace rendering
43 {
44 inline namespace GZ_RENDERING_VERSION_NAMESPACE {
45 //
46 // forward declaration
47 class OgreRenderEnginePrivate;
48
50 class GZ_RENDERING_OGRE_VISIBLE OgreRenderEnginePlugin :
52 {
55
57 public: ~OgreRenderEnginePlugin() = default;
58
61 public: std::string Name() const;
62
65 public: RenderEngine *Engine() const;
66 };
67
68 class GZ_RENDERING_OGRE_VISIBLE OgreRenderEngine :
69 public virtual BaseRenderEngine
70 {
73 public: enum OgreRenderPathType
74 {
76 NONE = 0,
78 VERTEX = 1,
80 FORWARD = 2,
82 DEFERRED = 3,
84 RENDER_PATH_COUNT
85 };
86
88 private: OgreRenderEngine();
89
90 public: virtual ~OgreRenderEngine();
91
92 public: virtual void Destroy() override;
93
94 public: virtual bool IsEnabled() const override;
95
96 public: virtual std::string Name() const override;
97
99
100 public: void AddResourcePath(const std::string &_uri) override;
101
102 // Documentation Inherited
103 public: virtual rendering::GraphicsAPI GraphicsAPI() const override;
104
105 public: virtual Ogre::Root *OgreRoot() const;
106
108 const unsigned int _width, const unsigned int _height,
109 const double _ratio, const unsigned int _antiAliasing);
110
114
117 public: static OgreRenderEngine *Instance();
118
119 protected: virtual ScenePtr CreateSceneImpl(unsigned int _id,
120 const std::string &_name) override;
121
122 protected: virtual SceneStorePtr Scenes() const override;
123
129 protected: virtual bool LoadImpl(
130 const std::map<std::string, std::string> &_params) override;
131
132 protected: virtual bool InitImpl() override;
133
134 private: void LoadAttempt();
135
136 private: void CreateLogger();
137
138 private: void CreateContext();
139
140 private: void CreateRoot();
141
142 private: void CreateOverlay();
143
144 private: void LoadPlugins();
145
146 private: void CreateRenderSystem();
147
148 private: void CreateResources();
149
150 private: void CreateRenderWindow();
151
152 private: void CheckCapabilities();
153
154 private: void InitAttempt();
155
156#if (OGRE_VERSION >= ((1 << 16) | (9 << 8) | 0))
160 public: Ogre::OverlaySystem *OverlaySystem() const;
161
162 private: Ogre::OverlaySystem *ogreOverlaySystem = nullptr;
163
164#endif
165 private: OgreSceneStorePtr scenes;
166
167 private: OgreRenderPathType renderPathType;
168
169 private: Ogre::Root *ogreRoot = nullptr;
170
171 private: Ogre::LogManager *ogreLogManager = nullptr;
172
174 private: std::vector<std::string> ogrePaths;
175
176#if !defined(__APPLE__) && !defined(_WIN32)
177 private: void *dummyDisplay = nullptr;
178
179 private: void *dummyContext = nullptr;
180#endif
181
182 private: uint64_t dummyWindowId = 0u;
183
185 private: bool useCurrentGLContext = false;
186
188
189 private: friend class common::SingletonT<OgreRenderEngine>;
190 };
191 }
192 }
193}
194#endif