Gazebo Rendering

API Reference

6.6.3
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 
32 #include "gz/rendering/ogre2/Export.hh"
33 
34 namespace Ogre
35 {
36  class LogManager;
37  class Root;
38  class Window;
39  namespace v1
40  {
41  class OverlaySystem;
42  }
43 
44  class HlmsPbsTerraShadows;
45  class CompositorWorkspaceListener;
46 }
47 
48 namespace ignition
49 {
50  namespace rendering
51  {
52  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
53  //
54  // forward declaration
55  class Ogre2RenderEnginePrivate;
56  class Ogre2IgnHlmsCustomizations;
57 
59  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2RenderEnginePlugin :
60  public RenderEnginePlugin
61  {
63  public: Ogre2RenderEnginePlugin();
64 
66  public: ~Ogre2RenderEnginePlugin() = default;
67 
70  public: std::string Name() const;
71 
74  public: RenderEngine *Engine() const;
75  };
76 
80  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2RenderEngine :
81  public virtual BaseRenderEngine,
82  public common::SingletonT<Ogre2RenderEngine>
83  {
85  private: Ogre2RenderEngine();
86 
88  public: virtual ~Ogre2RenderEngine();
89 
90  // Documentation Inherited.
91  public: virtual void Destroy() override;
92 
93  // Documentation Inherited.
94  public: virtual bool IsEnabled() const override;
95 
96  // Documentation Inherited.
97  public: virtual std::string Name() const override;
98 
101  public: void AddResourcePath(const std::string &_uri) override;
102 
104  public: Ogre::Window * OgreWindow() const;
105 
108  public: virtual Ogre::Root *OgreRoot() const;
109 
118  public: std::string CreateRenderWindow(const std::string &_handle,
119  const unsigned int _width, const unsigned int _height,
120  const double _ratio, const unsigned int _antiAliasing);
121 
126  public: rendering::GraphicsAPI GraphicsAPI() const;
127 
131  protected: virtual ScenePtr CreateSceneImpl(unsigned int _id,
132  const std::string &_name) override;
133 
137  protected: virtual SceneStorePtr Scenes() const override;
138 
139  // Documentation Inherited.
140  protected: virtual bool LoadImpl(
141  const std::map<std::string, std::string> &_params) override;
142 
145  protected: virtual bool InitImpl() override;
146 
148  private: void LoadAttempt();
149 
151  private: void CreateLogger();
152 
154  private: void CreateContext();
155 
157  private: void RegisterHlms();
158 
160  private: void CreateRoot();
161 
163  private: void CreateOverlay();
164 
166  private: void LoadPlugins();
167 
169  private: void CreateRenderSystem();
170 
172  private: void CreateRenderWindow();
173 
175  private: void CreateResources();
176 
178  private: void InitAttempt();
179 
182  public: std::vector<unsigned int> FSAALevels() const;
183 
186  public: Ogre2IgnHlmsCustomizations &HlmsCustomizations();
187 
191  public: Ogre::v1::OverlaySystem *OverlaySystem() const;
192 
199  public: Ogre::HlmsPbsTerraShadows *HlmsPbsTerraShadows() const;
200 
209  public: Ogre::CompositorWorkspaceListener
210  *TerraWorkspaceListener() const;
211 
213  private: Ogre::v1::OverlaySystem *ogreOverlaySystem = nullptr;
214 
216  private: Ogre2SceneStorePtr scenes;
217 
219  private: Ogre::Root *ogreRoot = nullptr;
220 
222  private: Ogre::LogManager *ogreLogManager = nullptr;
223 
225  private: std::vector<std::string> ogrePaths;
226 
228  private: void *dummyDisplay = nullptr;
229 
231  private: void *dummyContext = nullptr;
232 
234  private: uint64_t dummyWindowId = 0u;
235 
237  private: Ogre::Window *window = nullptr;
238 
240  private: bool useCurrentGLContext = false;
241 
244 
246  private: friend class common::SingletonT<Ogre2RenderEngine>;
247  };
248  }
249  }
250 }
251 #endif
Plugin for loading ogre render engine.
Definition: gz/rendering/ogre2/Ogre2RenderEngine.hh:59
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
GraphicsAPI
The graphics API used by the render engine.
Definition: gz/rendering/GraphicsAPI.hh:32
Ogre2 render engine class. A singleton class that manages the underlying ogre2 render engine,...
Definition: gz/rendering/ogre2/Ogre2RenderEngine.hh:80
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