Gazebo Rendering

API Reference

8.2.0
BaseRenderEngine.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_BASE_BASERENDERENGINE_HH_
18 #define GZ_RENDERING_BASE_BASERENDERENGINE_HH_
19 
20 #include <map>
21 #include <string>
22 #include <vector>
23 #include <gz/utils/SuppressWarning.hh>
25 #include "gz/rendering/Storage.hh"
26 
27 namespace gz
28 {
29  namespace rendering
30  {
31  inline namespace GZ_RENDERING_VERSION_NAMESPACE {
32  //
33  class GZ_RENDERING_VISIBLE BaseRenderEngine :
34  public virtual RenderEngine
35  {
36  protected: BaseRenderEngine();
37 
38  public: virtual ~BaseRenderEngine();
39 
40  // Documentation Inherited.
41  public: virtual bool Load(
42  const std::map<std::string, std::string> &_params = {}) override;
43 
44  public: virtual bool Init() override;
45 
46  public: virtual bool Fini() override;
47 
48  public: virtual bool IsLoaded() const override;
49 
50  public: virtual bool IsInitialized() const override;
51 
52  public: virtual bool IsEnabled() const override;
53 
54  public: virtual unsigned int SceneCount() const override;
55 
56  public: virtual bool HasScene(ConstScenePtr _scene) const override;
57 
58  public: virtual bool HasSceneId(unsigned int _id) const override;
59 
60  public: virtual bool HasSceneName(const std::string &_name) const
61  override;
62 
63  public: virtual ScenePtr SceneById(unsigned int _id) const override;
64 
65  public: virtual ScenePtr SceneByName(const std::string &_name) const
66  override;
67 
68  public: virtual ScenePtr SceneByIndex(unsigned int _index) const override;
69 
70  public: virtual void DestroyScene(ScenePtr _scene) override;
71 
72  public: virtual void DestroySceneById(unsigned int _id) override;
73 
74  public: virtual void DestroySceneByName(const std::string &_name)
75  override;
76 
77  public: virtual void DestroySceneByIndex(unsigned int _index) override;
78 
79  public: virtual void DestroyScenes() override;
80 
81  public: virtual ScenePtr CreateScene(const std::string &_name) override;
82 
83  public: virtual ScenePtr CreateScene(unsigned int _id,
84  const std::string &_name) override;
85 
86  public: virtual void Destroy() override;
87 
88  // Documentation Inherited
89  public: virtual void AddResourcePath(const std::string &_path) override;
90 
91  // Documentation Inherited
92  public: virtual rendering::GraphicsAPI GraphicsAPI() const override
93  {
94  return GraphicsAPI::UNKNOWN;
95  }
96 
97  // Documentation Inherited
99  const std::string & /*_winHandle*/, uint32_t /*_width*/,
100  uint32_t /*_height*/, const double /*_ratio*/) override
101  {
102  return nullptr;
103  }
104 
105  // Documentation Inherited
106  public: virtual void SetHeadless(bool _headless) override;
107 
108  // Documentation Inherited
109  public: virtual bool Headless() const override;
110 
111  // Documentation Inherited
112  public: virtual RenderPassSystemPtr RenderPassSystem() const override;
113 
114  protected: virtual void PrepareScene(ScenePtr _scene);
115 
116  protected: virtual unsigned int NextSceneId();
117 
120  protected: virtual bool LoadImpl(
121  const std::map<std::string, std::string> &_params) = 0;
122 
123  protected: virtual bool InitImpl() = 0;
124 
125  protected: virtual ScenePtr CreateSceneImpl(unsigned int _id,
126  const std::string &_name) = 0;
127 
128  protected: virtual SceneStorePtr Scenes() const = 0;
129 
130  protected: bool loaded = false;
131 
132  protected: bool initialized = false;
133 
134  protected: bool isHeadless = false;
135 
137  protected: std::string winID = "";
138 
139  protected: unsigned int nextSceneId;
140 
141  GZ_UTILS_WARN_IGNORE__DLL_INTERFACE_MISSING
145 
148  GZ_UTILS_WARN_RESUME__DLL_INTERFACE_MISSING
149  };
150  }
151  }
152 }
153 #endif