Ignition Rendering

API Reference

6.0.1
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 IGNITION_RENDERING_OGRE2_OGRE2RENDERENGINE_HH_
18 #define IGNITION_RENDERING_OGRE2_OGRE2RENDERENGINE_HH_
19 
20 #include <map>
21 #include <memory>
22 #include <string>
23 #include <vector>
24 
26 
31 #include "ignition/rendering/ogre2/Export.hh"
32 
33 namespace Ogre
34 {
35  class LogManager;
36  class Root;
37  class Window;
38  namespace v1
39  {
40  class OverlaySystem;
41  }
42 
43  class HlmsPbsTerraShadows;
44  class CompositorWorkspaceListener;
45 }
46 
47 namespace ignition
48 {
49  namespace rendering
50  {
51  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
52  //
53  // forward declaration
54  class Ogre2RenderEnginePrivate;
55  class Ogre2IgnHlmsCustomizations;
56 
58  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2RenderEnginePlugin :
59  public RenderEnginePlugin
60  {
62  public: Ogre2RenderEnginePlugin();
63 
65  public: ~Ogre2RenderEnginePlugin() = default;
66 
69  public: std::string Name() const;
70 
73  public: RenderEngine *Engine() const;
74  };
75 
79  class IGNITION_RENDERING_OGRE2_VISIBLE Ogre2RenderEngine :
80  public virtual BaseRenderEngine,
81  public common::SingletonT<Ogre2RenderEngine>
82  {
84  private: Ogre2RenderEngine();
85 
87  public: virtual ~Ogre2RenderEngine();
88 
89  // Documentation Inherited.
90  public: virtual void Destroy() override;
91 
92  // Documentation Inherited.
93  public: virtual bool IsEnabled() const override;
94 
95  // Documentation Inherited.
96  public: virtual std::string Name() const override;
97 
100  public: void AddResourcePath(const std::string &_uri) override;
101 
103  public: Ogre::Window * OgreWindow() const;
104 
107  public: virtual Ogre::Root *OgreRoot() const;
108 
117  public: std::string CreateRenderWindow(const std::string &_handle,
118  const unsigned int _width, const unsigned int _height,
119  const double _ratio, const unsigned int _antiAliasing);
120 
124  protected: virtual ScenePtr CreateSceneImpl(unsigned int _id,
125  const std::string &_name) override;
126 
130  protected: virtual SceneStorePtr Scenes() const override;
131 
132  // Documentation Inherited.
133  protected: virtual bool LoadImpl(
134  const std::map<std::string, std::string> &_params) override;
135 
138  protected: virtual bool InitImpl() override;
139 
141  private: void LoadAttempt();
142 
144  private: void CreateLogger();
145 
147  private: void CreateContext();
148 
150  private: void RegisterHlms();
151 
153  private: void CreateRoot();
154 
156  private: void CreateOverlay();
157 
159  private: void LoadPlugins();
160 
162  private: void CreateRenderSystem();
163 
165  private: void CreateRenderWindow();
166 
168  private: void CreateResources();
169 
171  private: void InitAttempt();
172 
175  public: std::vector<unsigned int> FSAALevels() const;
176 
179  public: Ogre2IgnHlmsCustomizations &HlmsCustomizations();
180 
184  public: Ogre::v1::OverlaySystem *OverlaySystem() const;
185 
192  public: Ogre::HlmsPbsTerraShadows *HlmsPbsTerraShadows() const;
193 
202  public: Ogre::CompositorWorkspaceListener
203  *TerraWorkspaceListener() const;
204 
206  private: Ogre::v1::OverlaySystem *ogreOverlaySystem = nullptr;
207 
209  private: Ogre2SceneStorePtr scenes;
210 
212  private: Ogre::Root *ogreRoot = nullptr;
213 
215  private: Ogre::LogManager *ogreLogManager = nullptr;
216 
218  private: std::vector<std::string> ogrePaths;
219 
221  private: void *dummyDisplay = nullptr;
222 
224  private: void *dummyContext = nullptr;
225 
227  private: uint64_t dummyWindowId = 0u;
228 
230  private: Ogre::Window *window = nullptr;
231 
233  private: bool useCurrentGLContext = false;
234 
237 
239  private: friend class common::SingletonT<Ogre2RenderEngine>;
240  };
241  }
242  }
243 }
244 #endif
STL class.
STL class.
Definition: BaseRenderEngine.hh:33
Ogre2 render engine class. A singleton class that manages the underlying ogre2 render engine...
Definition: Ogre2RenderEngine.hh:79
Plugin for loading ogre render engine.
Definition: Ogre2RenderEngine.hh:58
Base plugin class for render engines.
Definition: RenderEnginePlugin.hh:40
STL class.
Definition: OgreCamera.hh:27
An abstract interface to a concrete render-engine. A RenderEngine is responsible for initializing a r...
Definition: RenderEngine.hh:36