#include <gz/sim/gui/plugins/RenderUtil.hh>
Public Member Functions | |
RenderUtil () | |
Constructor. More... | |
~RenderUtil () | |
Destructor. More... | |
void | CreateVisualsForEntities (const EntityComponentManager &_ecm, const std::set< Entity > &_entities) |
Helper function to create visuals for new entities created in ECM. This function is intended to be used by other GUI plugins when new entities are created on the GUI side. More... | |
void | DeselectAllEntities () |
Clears the set of selected entities and lowlights all of them. More... | |
void | Destroy () |
Destroy the renderer. Must be called in the rendering thread. More... | |
std::string | EngineName () const |
Get the name of the rendering engine used. More... | |
bool | HeadlessRendering () const |
Get the headless mode. More... | |
void | Init () |
Initialize the renderer. Must be called in the rendering thread. More... | |
void | InitRenderEnginePluginPaths () |
Init render engine plugins paths. This lets gz-rendering know paths to find render engine plugins. More... | |
class MarkerManager & | MarkerManager () |
Get the marker manager Returns reference to the marker manager. More... | |
int | PendingSensors () const |
Count of pending sensors. Must be called in the rendering thread. More... | |
rendering::ScenePtr | Scene () const |
Get a pointer to the scene. More... | |
class SceneManager & | SceneManager () |
Get the scene manager Returns reference to the scene manager. More... | |
std::string | SceneName () const |
Get the name of the rendering scene used. More... | |
const std::vector< Entity > & | SelectedEntities () const |
Get the entities currently selected, in order of selection. More... | |
void | SetAmbientLight (const math::Color &_ambient) |
Set ambient light of render window. This will override other sources, such as from SDF. More... | |
void | SetBackgroundColor (const math::Color &_color) |
Set background color of render window. This will override other sources, such as from SDF. More... | |
void | SetEnableSensors (bool _enable, std::function< std::string(const sim::Entity &, const sdf::Sensor &, const std::string &)> _createSensorCb={}) |
Set whether to create rendering sensors. More... | |
void | SetEngineName (const std::string &_engineName) |
Set the rendering engine to use. More... | |
void | SetEventManager (EventManager *_mgr) |
Set the event manager to use. More... | |
void | SetHeadlessRendering (const bool &_headless) |
Set the headless mode. More... | |
void | SetRemoveSensorCb (std::function< void(const sim::Entity &)> _removeSensorCb) |
Set the callback function for removing the sensors. More... | |
void | SetScene (const rendering::ScenePtr &_scene) |
Set the scene to use. More... | |
void | SetSceneName (const std::string &_sceneName) |
Set the scene to use. More... | |
void | SetSelectedEntity (const rendering::NodePtr &_node) |
Set the entity being selected. More... | |
void | SetSkyEnabled (bool _enabled) |
Set whether to enable sky in the scene. More... | |
void | SetTransformActive (bool _active) |
Set whether the transform controls are currently being dragged. More... | |
void | SetUseCurrentGLContext (bool _enable) |
Set whether to use the current GL context. More... | |
void | SetWinID (const std::string &_winID) |
Set the Window ID. More... | |
void | ShowGrid () |
Show grid view in the scene. More... | |
std::chrono::steady_clock::duration | SimTime () const |
Get simulation time that the current rendering state corresponds to. More... | |
void | Update () |
Main update function. Must be called in the rendering thread. More... | |
void | UpdateECM (const UpdateInfo &_info, EntityComponentManager &_ecm) |
Helper Update function for updating the scene. More... | |
void | UpdateFromECM (const UpdateInfo &_info, const EntityComponentManager &_ecm) |
Helper PostUpdate function for updating the scene. More... | |
void | ViewCollisions (const Entity &_entity) |
View collisions of specified entity which are shown in orange. More... | |
void | ViewCOM (const Entity &_entity) |
View center of mass of specified entity. More... | |
void | ViewInertia (const Entity &_entity) |
View inertia of specified entity. More... | |
void | ViewJoints (const Entity &_entity) |
View joints of specified entity. More... | |
void | ViewTransparent (const Entity &_entity) |
View an entity as transparent. More... | |
void | ViewWireframes (const Entity &_entity) |
View wireframes of specified entity. More... | |
Constructor & Destructor Documentation
◆ RenderUtil()
|
explicit |
Constructor.
◆ ~RenderUtil()
~RenderUtil | ( | ) |
Destructor.
Member Function Documentation
◆ CreateVisualsForEntities()
void CreateVisualsForEntities | ( | const EntityComponentManager & | _ecm, |
const std::set< Entity > & | _entities | ||
) |
Helper function to create visuals for new entities created in ECM. This function is intended to be used by other GUI plugins when new entities are created on the GUI side.
- Parameters
-
[in] _ecm Const reference to the entity component manager [in] _entities Entities to create visuals for.
◆ DeselectAllEntities()
void DeselectAllEntities | ( | ) |
Clears the set of selected entities and lowlights all of them.
◆ Destroy()
void Destroy | ( | ) |
Destroy the renderer. Must be called in the rendering thread.
◆ EngineName()
std::string EngineName | ( | ) | const |
Get the name of the rendering engine used.
- Returns
- Name of the rendering engine
◆ HeadlessRendering()
bool HeadlessRendering | ( | ) | const |
Get the headless mode.
- Returns
- True if headless mode is enable, false otherwise.
◆ Init()
void Init | ( | ) |
Initialize the renderer. Must be called in the rendering thread.
◆ InitRenderEnginePluginPaths()
void InitRenderEnginePluginPaths | ( | ) |
Init render engine plugins paths. This lets gz-rendering know paths to find render engine plugins.
◆ MarkerManager()
class MarkerManager& MarkerManager | ( | ) |
Get the marker manager Returns reference to the marker manager.
◆ PendingSensors()
int PendingSensors | ( | ) | const |
Count of pending sensors. Must be called in the rendering thread.
- Returns
- Number of sensors to be added on the next
Update
call
In the case that RenderUtil has not been initialized, this method will return -1.
◆ Scene()
rendering::ScenePtr Scene | ( | ) | const |
Get a pointer to the scene.
- Returns
- Pointer to the scene
◆ SceneManager()
class SceneManager& SceneManager | ( | ) |
Get the scene manager Returns reference to the scene manager.
◆ SceneName()
std::string SceneName | ( | ) | const |
Get the name of the rendering scene used.
- Returns
- Name of the rendering scene.
◆ SelectedEntities()
const std::vector<Entity>& SelectedEntities | ( | ) | const |
Get the entities currently selected, in order of selection.
- Returns
- Vector of currently selected entities
◆ SetAmbientLight()
void SetAmbientLight | ( | const math::Color & | _ambient | ) |
Set ambient light of render window. This will override other sources, such as from SDF.
- Parameters
-
[in] _ambient Color of ambient light
◆ SetBackgroundColor()
void SetBackgroundColor | ( | const math::Color & | _color | ) |
Set background color of render window. This will override other sources, such as from SDF.
- Parameters
-
[in] _color Color of render window background
◆ SetEnableSensors()
void SetEnableSensors | ( | bool | _enable, |
std::function< std::string(const sim::Entity &, const sdf::Sensor &, const std::string &)> | _createSensorCb = {} |
||
) |
Set whether to create rendering sensors.
- Parameters
-
[in] _enable True to create rendering sensors [in] _createSensorCb Callback function for creating the sensors The callback function args are: sensor entity, sensor sdf and parent name, it returns the name of the rendering sensor created.
◆ SetEngineName()
void SetEngineName | ( | const std::string & | _engineName | ) |
Set the rendering engine to use.
- Parameters
-
[in] _engineName Name of the rendering engine.
◆ SetEventManager()
void SetEventManager | ( | EventManager * | _mgr | ) |
Set the event manager to use.
- Parameters
-
[in] _mgr Event manager to set to.
◆ SetHeadlessRendering()
void SetHeadlessRendering | ( | const bool & | _headless | ) |
Set the headless mode.
- Parameters
-
[in] _headless Set to true to enable headless mode.
◆ SetRemoveSensorCb()
void SetRemoveSensorCb | ( | std::function< void(const sim::Entity &)> | _removeSensorCb | ) |
Set the callback function for removing the sensors.
- Parameters
-
[in] _removeSensorCb Callback function for removing the sensors The callback function arg is the sensor entity to remove
◆ SetScene()
void SetScene | ( | const rendering::ScenePtr & | _scene | ) |
Set the scene to use.
- Parameters
-
[in] _scene Pointer to the scene.
◆ SetSceneName()
void SetSceneName | ( | const std::string & | _sceneName | ) |
Set the scene to use.
- Parameters
-
[in] _sceneName Name of the engine.
◆ SetSelectedEntity()
void SetSelectedEntity | ( | const rendering::NodePtr & | _node | ) |
Set the entity being selected.
- Parameters
-
[in] _node Node representing the selected entity
◆ SetSkyEnabled()
void SetSkyEnabled | ( | bool | _enabled | ) |
Set whether to enable sky in the scene.
- Parameters
-
[in] _enabled True to enable sky, false to disable sky
◆ SetTransformActive()
void SetTransformActive | ( | bool | _active | ) |
Set whether the transform controls are currently being dragged.
- Parameters
-
[in] _active True if active.
◆ SetUseCurrentGLContext()
void SetUseCurrentGLContext | ( | bool | _enable | ) |
Set whether to use the current GL context.
- Parameters
-
[in] _enable True to use the current GL context
◆ SetWinID()
void SetWinID | ( | const std::string & | _winID | ) |
Set the Window ID.
- Parameters
-
[in] _winID Window ID
◆ ShowGrid()
void ShowGrid | ( | ) |
Show grid view in the scene.
◆ SimTime()
std::chrono::steady_clock::duration SimTime | ( | ) | const |
Get simulation time that the current rendering state corresponds to.
- Returns
- Simulation time.
◆ Update()
void Update | ( | ) |
Main update function. Must be called in the rendering thread.
◆ UpdateECM()
void UpdateECM | ( | const UpdateInfo & | _info, |
EntityComponentManager & | _ecm | ||
) |
Helper Update function for updating the scene.
- Parameters
-
[in] _info Sim update info [in] _ecm Mutable reference to the entity component manager
◆ UpdateFromECM()
void UpdateFromECM | ( | const UpdateInfo & | _info, |
const EntityComponentManager & | _ecm | ||
) |
Helper PostUpdate function for updating the scene.
◆ ViewCollisions()
void ViewCollisions | ( | const Entity & | _entity | ) |
View collisions of specified entity which are shown in orange.
- Parameters
-
[in] _entity Entity to view collisions
◆ ViewCOM()
void ViewCOM | ( | const Entity & | _entity | ) |
View center of mass of specified entity.
- Parameters
-
[in] _entity Entity to view center of mass
◆ ViewInertia()
void ViewInertia | ( | const Entity & | _entity | ) |
View inertia of specified entity.
- Parameters
-
[in] _entity Entity to view inertia
◆ ViewJoints()
void ViewJoints | ( | const Entity & | _entity | ) |
View joints of specified entity.
- Parameters
-
[in] _entity Entity to view joints
◆ ViewTransparent()
void ViewTransparent | ( | const Entity & | _entity | ) |
View an entity as transparent.
- Parameters
-
[in] _entity Entity to view as transparent
◆ ViewWireframes()
void ViewWireframes | ( | const Entity & | _entity | ) |
View wireframes of specified entity.
- Parameters
-
[in] _entity Entity to view wireframes
The documentation for this class was generated from the following file: