Gazebo Rendering

API Reference

6.6.3
gz/rendering/base/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/common/SuppressWarning.hh>
25 #include "gz/rendering/Storage.hh"
26 
27 namespace ignition
28 {
29  namespace rendering
30  {
31  inline namespace IGNITION_RENDERING_VERSION_NAMESPACE {
32  //
33  class IGNITION_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 void SetHeadless(bool _headless) override;
93 
94  // Documentation Inherited
95  public: virtual bool Headless() const override;
96 
97  // Documentation Inherited
98  public: virtual RenderPassSystemPtr RenderPassSystem() const override;
99 
100  protected: virtual void PrepareScene(ScenePtr _scene);
101 
102  protected: virtual unsigned int NextSceneId();
103 
106  protected: virtual bool LoadImpl(
107  const std::map<std::string, std::string> &_params) = 0;
108 
109  protected: virtual bool InitImpl() = 0;
110 
111  protected: virtual ScenePtr CreateSceneImpl(unsigned int _id,
112  const std::string &_name) = 0;
113 
114  protected: virtual SceneStorePtr Scenes() const = 0;
115 
116  protected: bool loaded = false;
117 
118  protected: bool initialized = false;
119 
120  protected: bool isHeadless = false;
121 
123  protected: std::string winID = "";
124 
125  protected: unsigned int nextSceneId;
126 
131 
135  };
136  }
137  }
138 }
139 #endif
virtual SceneStorePtr Scenes() const =0
virtual void Destroy() override
Destroys all scenes created by render-engine and releases all loaded resources. This should be called...
STL class.
STL class.
#define IGN_COMMON_WARN_IGNORE__DLL_INTERFACE_MISSING
virtual bool IsEnabled() const override
Determines if the render-engine can be used. Despite loading and initializing the render-engine,...
virtual ScenePtr SceneByIndex(unsigned int _index) const override
Get the scene at the given index. If no scenes exist at the given index, NULL will be returned.
virtual unsigned int NextSceneId()
bool loaded
Definition: gz/rendering/base/BaseRenderEngine.hh:116
std::vector< std::string > resourcePaths
a list of paths that render engines use to locate their resources
Definition: gz/rendering/base/BaseRenderEngine.hh:130
virtual bool HasScene(ConstScenePtr _scene) const override
Determine if the given scene is actively managed by this render-engine.
virtual bool IsLoaded() const override
Determines if the render-engine has been loaded.
virtual void DestroyScene(ScenePtr _scene) override
Destroy the given scene. If the given scene is not managed by this render-engine, no work will be don...
virtual bool Headless() const override
Get headless mode.
virtual void SetHeadless(bool _headless) override
Set headless mode Only available in OGRE 2.2, which makes use of EGL.
RenderPassSystemPtr renderPassSystem
Render pass system for this render engine.
Definition: gz/rendering/base/BaseRenderEngine.hh:133
virtual RenderPassSystemPtr RenderPassSystem() const override
Get the render pass system for this engine.
bool initialized
Definition: gz/rendering/base/BaseRenderEngine.hh:118
virtual unsigned int SceneCount() const override
Get the number of scenes actively managed by this render-engine.
virtual bool LoadImpl(const std::map< std::string, std::string > &_params)=0
Engine implementation of Load function.
virtual ScenePtr CreateSceneImpl(unsigned int _id, const std::string &_name)=0
virtual void DestroySceneByName(const std::string &_name) override
Destroy the scene with the given name. If no scenes exist with the given name, no work will be done.
virtual bool HasSceneId(unsigned int _id) const override
Determine if this render-engine manages a scene with the given ID.
virtual void DestroySceneById(unsigned int _id) override
Destroy the scene with the given ID. If no scenes exist with the given ID, no work will be done.
virtual void AddResourcePath(const std::string &_path) override
Add path to media resource location.
STL class.
virtual void DestroyScenes() override
Destroy all scenes managed by this render-engine.
virtual bool Load(const std::map< std::string, std::string > &_params={}) override
Load any necessary resources to set up render-engine. This should called before any other function.
virtual void DestroySceneByIndex(unsigned int _index) override
Destroy the scene at the given index. If no scenes exist at the given index, no work will be done.
unsigned int nextSceneId
Definition: gz/rendering/base/BaseRenderEngine.hh:125
bool isHeadless
Definition: gz/rendering/base/BaseRenderEngine.hh:120
virtual bool Init() override
Initialize the render-engine. This should be called immediately after a successful call to Load.
virtual ScenePtr SceneById(unsigned int _id) const override
Get the scene with the given ID. If no scenes exist with the given ID, NULL will be returned.
virtual void PrepareScene(ScenePtr _scene)
virtual ScenePtr SceneByName(const std::string &_name) const override
Get the scene with the given name. If no scenes exist with the given name, NULL will be returned.
An abstract interface to a concrete render-engine. A RenderEngine is responsible for initializing a r...
Definition: gz/rendering/RenderEngine.hh:36
A class for creating and managing render passes.
Definition: gz/rendering/RenderPassSystem.hh:56
virtual ScenePtr CreateScene(const std::string &_name) override
Create a new scene with the given name. The given name should be unique across all scenes managed by ...
virtual bool IsInitialized() const override
Determines if the render-engine has been initialized.
std::string winID
ID from a external window.
Definition: gz/rendering/base/BaseRenderEngine.hh:123
virtual bool HasSceneName(const std::string &_name) const override
Determine if this render-engine manages a scene with the given name.
Definition: gz/rendering/base/BaseRenderEngine.hh:33
#define IGN_COMMON_WARN_RESUME__DLL_INTERFACE_MISSING