Gazebo Sim

API Reference

8.7.0
ShaderParam Class Reference

A plugin for setting shaders to a visual and its params. More...

#include <ShaderParam.hh>

Public Member Functions

 ShaderParam ()
 Constructor. More...
 
 ~ShaderParam () override
 Destructor. More...
 
void Configure (const Entity &_entity, const std::shared_ptr< const sdf::Element > &_sdf, EntityComponentManager &_ecm, EventManager &_eventMgr) final
 Configure the system. More...
 
void PreUpdate (const UpdateInfo &_info, EntityComponentManager &_ecm) override
 Documentation inherited. More...
 
- Public Member Functions inherited from System
 System ()=default
 Constructor. More...
 
virtual ~System ()=default
 Destructor. More...
 

Additional Inherited Members

- Public Types inherited from System
using PriorityType = int32_t
 Signed integer type used for specifying priority of the execution order of PreUpdate and Update phases. More...
 
- Static Public Attributes inherited from System
constexpr static PriorityType kDefaultPriority = {0}
 Default priority value for execution order of the PreUpdate and Update phases. More...
 
constexpr static std::string_view kPriorityElementName
 Name of the XML element from which the priority value will be parsed. More...
 

Detailed Description

A plugin for setting shaders to a visual and its params.

System Parameters

  • <shader>: Shader to use - can be repeated to specify shader programs written in different languages.
    • Attributes:
      • language: Shader language. Possible values: glsl, metal Default to glsl if not specified
    • <vertex>: Path to vertex program
    • <fragment>: Path to fragment program
  • <param>: Shader parameter - can be repeated within plugin SDF element
    • <name>: Name of uniform variable bound to the shader
    • <shader>: Type of shader, i.e. vertex, fragment
    • <type>: Variable type: float, int, float_array, int_array
    • <value>: Value to set the shader parameter to. The vallue string can be an int, float, or a space delimited array of ints or floats. It can also be "TIME", in which case the value will be bound to sim time.

Example

<plugin filename="gz-sim-shader-param-system"
name="systems::ShaderParam">
<shader language='glsl'>
<vertex>materials/my_vs.glsl</vertex>
<fragment>materials/my_fs.glsl</fragment>
</shader>
<!-- Sets a fragment shader variable named "ambient" to red -->
<param>
<name>ambient</name>
<shader>fragment</shader>
<type>float_array</type>
<value>1.0 0.0 0.0 1.0</value>
</param>
</plugin>

Constructor & Destructor Documentation

◆ ShaderParam()

Constructor.

◆ ~ShaderParam()

~ShaderParam ( )
override

Destructor.

Member Function Documentation

◆ Configure()

void Configure ( const Entity _entity,
const std::shared_ptr< const sdf::Element > &  _sdf,
EntityComponentManager _ecm,
EventManager _eventMgr 
)
finalvirtual

Configure the system.

Parameters
[in]_entityThe entity this plugin is attached to.
[in]_sdfThe SDF Element associated with this system plugin.
[in]_ecmThe EntityComponentManager of the given simulation instance.
[in]_eventMgrThe EventManager of the given simulation instance.

Implements ISystemConfigure.

◆ PreUpdate()

void PreUpdate ( const UpdateInfo _info,
EntityComponentManager _ecm 
)
overridevirtual

Documentation inherited.

Implements ISystemPreUpdate.


The documentation for this class was generated from the following file: