Gazebo Sim

API Reference

9.0.0
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
35namespace gz
36{
37namespace sim
38{
39// Inline bracket to help doxygen filtering.
40inline 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
89 const std::set<Entity> &_entities);
90
93 public: void SetEngineName(const std::string &_engineName);
94
97 public: std::string EngineName() const;
98
102 public: void SetApiBackend(const std::string &_apiBackend);
103
106 public: std::string ApiBackend() const;
107
110 public: void SetHeadlessRendering(const bool &_headless);
111
114 public: bool HeadlessRendering() const;
115
118 public: void SetSceneName(const std::string &_sceneName);
119
122 public: std::string SceneName() const;
123
126 public: void SetScene(const rendering::ScenePtr &_scene);
127
131 public: void SetBackgroundColor(const math::Color &_color);
132
136 public: void SetAmbientLight(const math::Color &_ambient);
137
140 public: void SetSkyEnabled(bool _enabled);
141
143 public: void ShowGrid();
144
147 public: void SetUseCurrentGLContext(bool _enable);
148
151 public: void SetWinID(const std::string &_winID);
152
158 public: void SetEnableSensors(bool _enable, std::function<
159 std::string(const sim::Entity &, const sdf::Sensor &,
160 const std::string &)> _createSensorCb = {});
161
165 public : void SetRemoveSensorCb(
166 std::function<void(const sim::Entity &)> _removeSensorCb);
167
170 public: void ViewTransparent(const Entity &_entity);
171
174 public: void ViewCOM(const Entity &_entity);
175
178 public: void ViewInertia(const Entity &_entity);
179
182 public: void ViewJoints(const Entity &_entity);
183
186 public: void ViewWireframes(const Entity &_entity);
187
190 public: void ViewCollisions(const Entity &_entity);
191
194 public: class SceneManager &SceneManager();
195
198 public: class MarkerManager &MarkerManager();
199
203 public: std::chrono::steady_clock::duration SimTime() const;
204
207 public: void SetSelectedEntity(const rendering::NodePtr &_node);
208
211 public: const std::vector<Entity> &SelectedEntities() const;
212
214 public: void DeselectAllEntities();
215
219
223 private: std::vector<Entity> FindChildLinks(const Entity &_entity);
224
227 private: void HideWireboxes(const Entity &_entity);
228
231 public: void SetTransformActive(bool _active);
232
235 public: void SetEventManager(EventManager *_mgr);
236
238 private: std::unique_ptr<RenderUtilPrivate> dataPtr;
239 };
240}
241}
242}
243#endif