Ignition Rendering

API Reference

5.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 IGNITION_RENDERING_OGRE_OGRERENDERENGINE_HH_
18 #define IGNITION_RENDERING_OGRE_OGRERENDERENGINE_HH_
19 
20 #include <map>
21 #include <memory>
22 #include <string>
23 #include <vector>
24 
26 
32 #include "ignition/rendering/ogre/Export.hh"
33 
34 namespace Ogre
35 {
36  class LogManager;
37  class Root;
38 }
39 
40 namespace ignition
41 {
42  namespace rendering
43  {
44  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
45  //
46  // forward declaration
47  class OgreRenderEnginePrivate;
48 
50  class IGNITION_RENDERING_OGRE_VISIBLE OgreRenderEnginePlugin :
51  public RenderEnginePlugin
52  {
54  public: OgreRenderEnginePlugin();
55 
57  public: ~OgreRenderEnginePlugin() = default;
58 
61  public: std::string Name() const;
62 
65  public: RenderEngine *Engine() const;
66  };
67 
68  class IGNITION_RENDERING_OGRE_VISIBLE OgreRenderEngine :
69  public virtual BaseRenderEngine,
70  public common::SingletonT<OgreRenderEngine>
71  {
74  public: enum OgreRenderPathType
75  {
77  NONE = 0,
79  VERTEX = 1,
81  FORWARD = 2,
83  DEFERRED = 3,
85  RENDER_PATH_COUNT
86  };
87 
89  private: OgreRenderEngine();
90 
91  public: virtual ~OgreRenderEngine();
92 
93  public: virtual void Destroy() override;
94 
95  public: virtual bool IsEnabled() const override;
96 
97  public: virtual std::string Name() const override;
98 
99  public: OgreRenderPathType RenderPathType() const;
100 
101  public: void AddResourcePath(const std::string &_uri) override;
102 
103  public: virtual Ogre::Root *OgreRoot() const;
104 
105  public: std::string CreateRenderWindow(const std::string &_handle,
106  const unsigned int _width, const unsigned int _height,
107  const double _ratio, const unsigned int _antiAliasing);
108 
111  public: std::vector<unsigned int> FSAALevels() const;
112 
113  protected: virtual ScenePtr CreateSceneImpl(unsigned int _id,
114  const std::string &_name) override;
115 
116  protected: virtual SceneStorePtr Scenes() const override;
117 
123  protected: virtual bool LoadImpl(
124  const std::map<std::string, std::string> &_params) override;
125 
126  protected: virtual bool InitImpl() override;
127 
128  private: void LoadAttempt();
129 
130  private: void CreateLogger();
131 
132  private: void CreateContext();
133 
134  private: void CreateRoot();
135 
136  private: void CreateOverlay();
137 
138  private: void LoadPlugins();
139 
140  private: void CreateRenderSystem();
141 
142  private: void CreateResources();
143 
144  private: void CreateRenderWindow();
145 
146  private: void CheckCapabilities();
147 
148  private: void InitAttempt();
149 
150 #if (OGRE_VERSION >= ((1 << 16) | (9 << 8) | 0))
151  public: Ogre::OverlaySystem *OverlaySystem() const;
155 
156  private: Ogre::OverlaySystem *ogreOverlaySystem = nullptr;
157 
158 #endif
159  private: OgreSceneStorePtr scenes;
160 
161  private: OgreRenderPathType renderPathType;
162 
163  private: Ogre::Root *ogreRoot = nullptr;
164 
165  private: Ogre::LogManager *ogreLogManager = nullptr;
166 
168  private: std::vector<std::string> ogrePaths;
169 
170 #if !defined(__APPLE__) && !defined(_WIN32)
171  private: void *dummyDisplay = nullptr;
172 
173  private: void *dummyContext = nullptr;
174 #endif
175 
176  private: uint64_t dummyWindowId = 0u;
177 
179  private: bool useCurrentGLContext = false;
180 
182 
183  private: friend class common::SingletonT<OgreRenderEngine>;
184  };
185  }
186  }
187 }
188 #endif
189 
OgreRenderPathType
Definition: OgreRenderEngine.hh:74
STL class.
Plugin for loading ogre render engine.
Definition: OgreRenderEngine.hh:50
STL class.
Definition: BaseRenderEngine.hh:33
Definition: OgreRenderEngine.hh:68
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
NONE