Gazebo Sim

API Reference

7.7.0
gz/sim/rendering/RenderUtil.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 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_SIM_RENDERUTIL_HH_
18 #define GZ_SIM_RENDERUTIL_HH_
19 
20 #include <memory>
21 #include <set>
22 #include <string>
23 #include <vector>
24 
25 #include <sdf/Sensor.hh>
26 
27 #include <gz/sim/config.hh>
28 #include <gz/sim/rendering/Export.hh>
29 #include <gz/sim/System.hh>
30 
33 
34 
35 namespace gz
36 {
37 namespace sim
38 {
39 // Inline bracket to help doxygen filtering.
40 inline namespace GZ_SIM_VERSION_NAMESPACE {
41  // forward declaration
42  class RenderUtilPrivate;
43 
45  class GZ_SIM_RENDERING_VISIBLE RenderUtil
46  {
48  public: explicit RenderUtil();
49 
51  public: ~RenderUtil();
52 
54  public: void Init();
55 
57  public: void Destroy();
58 
64  public: int PendingSensors() const;
65 
67  public: void Update();
68 
71  public: rendering::ScenePtr Scene() const;
72 
76  public: void UpdateECM(const UpdateInfo &_info,
78 
80  public: void UpdateFromECM(const UpdateInfo &_info,
81  const EntityComponentManager &_ecm);
82 
88  public: void CreateVisualsForEntities(const EntityComponentManager &_ecm,
89  const std::set<Entity> &_entities);
90 
93  public: void SetEngineName(const std::string &_engineName);
94 
97  public: std::string EngineName() const;
98 
101  public: void SetHeadlessRendering(const bool &_headless);
102 
105  public: bool HeadlessRendering() const;
106 
109  public: void SetSceneName(const std::string &_sceneName);
110 
113  public: std::string SceneName() const;
114 
117  public: void SetScene(const rendering::ScenePtr &_scene);
118 
122  public: void SetBackgroundColor(const math::Color &_color);
123 
127  public: void SetAmbientLight(const math::Color &_ambient);
128 
131  public: void SetSkyEnabled(bool _enabled);
132 
134  public: void ShowGrid();
135 
138  public: void SetUseCurrentGLContext(bool _enable);
139 
142  public: void SetWinID(const std::string &_winID);
143 
149  public: void SetEnableSensors(bool _enable, std::function<
150  std::string(const sim::Entity &, const sdf::Sensor &,
151  const std::string &)> _createSensorCb = {});
152 
156  public : void SetRemoveSensorCb(
157  std::function<void(const sim::Entity &)> _removeSensorCb);
158 
161  public: void ViewTransparent(const Entity &_entity);
162 
165  public: void ViewCOM(const Entity &_entity);
166 
169  public: void ViewInertia(const Entity &_entity);
170 
173  public: void ViewJoints(const Entity &_entity);
174 
177  public: void ViewWireframes(const Entity &_entity);
178 
181  public: void ViewCollisions(const Entity &_entity);
182 
185  public: class SceneManager &SceneManager();
186 
189  public: class MarkerManager &MarkerManager();
190 
194  public: std::chrono::steady_clock::duration SimTime() const;
195 
198  public: void SetSelectedEntity(const rendering::NodePtr &_node);
199 
202  public: const std::vector<Entity> &SelectedEntities() const;
203 
205  public: void DeselectAllEntities();
206 
209  public: void InitRenderEnginePluginPaths();
210 
214  private: std::vector<Entity> FindChildLinks(const Entity &_entity);
215 
218  private: void HideWireboxes(const Entity &_entity);
219 
222  public: void SetTransformActive(bool _active);
223 
226  public: void SetEventManager(EventManager *_mgr);
227 
229  private: std::unique_ptr<RenderUtilPrivate> dataPtr;
230  };
231 }
232 }
233 }
234 #endif