Gazebo Rendering

API Reference

3.7.2
gz/rendering/ogre2/Ogre2RenderEngine.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2018 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_OGRE2_OGRE2RENDERENGINE_HH_
18 #define GZ_RENDERING_OGRE2_OGRE2RENDERENGINE_HH_
19 
20 #include <map>
21 #include <memory>
22 #include <string>
23 #include <vector>
24 
25 #include <gz/common/SingletonT.hh>
26 
31 #include "gz/rendering/ogre2/Export.hh"
32 
33 namespace Ogre
34 {
35  class LogManager;
36  class Root;
37  namespace v1
38  {
39  class OverlaySystem;
40  }
41 }
42 
43 namespace ignition
44 {
45  namespace rendering
46  {
47  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
48  //
49  // forward declaration
50  class Ogre2RenderEnginePrivate;
51 
53  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2RenderEnginePlugin :
54  public RenderEnginePlugin
55  {
57  public: Ogre2RenderEnginePlugin();
58 
60  public: ~Ogre2RenderEnginePlugin() = default;
61 
64  public: std::string Name() const;
65 
68  public: RenderEngine *Engine() const;
69  };
70 
74  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2RenderEngine :
75  public virtual BaseRenderEngine,
76  public common::SingletonT<Ogre2RenderEngine>
77  {
79  private: Ogre2RenderEngine();
80 
82  public: virtual ~Ogre2RenderEngine();
83 
84  // Documentation Inherited.
85  public: virtual void Destroy() override;
86 
87  // Documentation Inherited.
88  public: virtual bool IsEnabled() const override;
89 
90  // Documentation Inherited.
91  public: virtual std::string Name() const override;
92 
95  public: void AddResourcePath(const std::string &_uri) override;
96 
99  public: virtual Ogre::Root *OgreRoot() const;
100 
109  public: std::string CreateRenderWindow(const std::string &_handle,
110  const unsigned int _width, const unsigned int _height,
111  const double _ratio, const unsigned int _antiAliasing);
112 
116  protected: virtual ScenePtr CreateSceneImpl(unsigned int _id,
117  const std::string &_name) override;
118 
122  protected: virtual SceneStorePtr Scenes() const override;
123 
124  // Documentation Inherited.
125  protected: virtual bool LoadImpl(
126  const std::map<std::string, std::string> &_params) override;
127 
130  protected: virtual bool InitImpl() override;
131 
133  private: void LoadAttempt();
134 
136  private: void CreateLogger();
137 
139  private: void CreateContext();
140 
142  private: void CreateRoot();
143 
145  private: void CreateOverlay();
146 
148  private: void LoadPlugins();
149 
151  private: void CreateRenderSystem();
152 
154  private: void CreateRenderWindow();
155 
157  private: void CreateResources();
158 
160  private: void InitAttempt();
161 
164  public: std::vector<unsigned int> FSAALevels() const;
165 
169  public: Ogre::v1::OverlaySystem *OverlaySystem() const;
170 
172  private: Ogre::v1::OverlaySystem *ogreOverlaySystem = nullptr;
173 
175  private: Ogre2SceneStorePtr scenes;
176 
178  private: Ogre::Root *ogreRoot = nullptr;
179 
181  private: Ogre::LogManager *ogreLogManager = nullptr;
182 
184  private: std::vector<std::string> ogrePaths;
185 
187  private: void *dummyDisplay = nullptr;
188 
190  private: void *dummyContext = nullptr;
191 
193  private: uint64_t dummyWindowId = 0u;
194 
196  private: bool useCurrentGLContext = false;
197 
200 
202  private: friend class common::SingletonT<Ogre2RenderEngine>;
203  };
204  }
205  }
206 }
207 #endif
Plugin for loading ogre render engine.
Definition: gz/rendering/ogre2/Ogre2RenderEngine.hh:53
Definition: gz/rendering/ogre/OgreCamera.hh:27
STL class.
STL class.
STL class.
Base plugin class for render engines.
Definition: gz/rendering/RenderEnginePlugin.hh:40
Ogre2 render engine class. A singleton class that manages the underlying ogre2 render engine,...
Definition: gz/rendering/ogre2/Ogre2RenderEngine.hh:74
STL class.
An abstract interface to a concrete render-engine. A RenderEngine is responsible for initializing a r...
Definition: gz/rendering/RenderEngine.hh:36
Definition: gz/rendering/base/BaseRenderEngine.hh:33