Gazebo Common

API Reference

5.6.0

Encapsulates description of a material. More...

#include <Material.hh>

Public Types

enum  BlendMode {
  BLEND_MODE_BEGIN = 0 , ADD = 0 , MODULATE = 1 , REPLACE = 2 ,
  BLEND_MODE_END
}
 
enum  ShadeMode {
  SHADE_MODE_BEGIN = 0 , FLAT = 0 , GOURAUD = 1 , PHONG = 2 ,
  BLINN = 3 , SHADE_MODE_END
}
 

Public Member Functions

 Material ()
 Constructor. More...
 
 Material (const math::Color &_clr)
 Create a material with a default color. More...
 
 ~Material ()
 Destructor. More...
 
double AlphaThreshold () const
 Get the alpha threshold. More...
 
math::Color Ambient () const
 Get the ambient color. More...
 
BlendMode Blend () const
 Get the blending mode. More...
 
void BlendFactors (double &_srcFactor, double &_dstFactor) const
 Get the blend factors. More...
 
std::string BlendStr () const
 Get the blend mode string. More...
 
bool DepthWrite () const
 Get depth write. More...
 
math::Color Diffuse () const
 Get the diffuse color. More...
 
math::Color Emissive () const
 Get the emissive color. More...
 
bool Lighting () const
 Get lighting enabled. More...
 
std::string Name () const
 Get the name of the material. More...
 
PbrPbrMaterial () const
 Get the Physically Based Rendering (PBR) material. More...
 
double PointSize () const
 Get the point size. More...
 
float RenderOrder () const
 Get the render order. More...
 
void SetAlphaFromTexture (bool _enabled, double _alpha=0.5, bool _twoSided=true)
 Set the material to use the alpha channel from the textures. More...
 
void SetAmbient (const math::Color &_clr)
 Set the ambient color. More...
 
void SetBlend (BlendMode _b)
 Set the blending mode. More...
 
void SetBlendFactors (double _srcFactor, double _dstFactor)
 Set the blend factors. Will be interpreted as: (texture * _srcFactor) + (scene_pixel * _dstFactor) More...
 
void SetDepthWrite (bool _value)
 Set depth write. More...
 
void SetDiffuse (const math::Color &_clr)
 Set the diffuse color. More...
 
void SetEmissive (const math::Color &_clr)
 Set the emissive color. More...
 
void SetLighting (bool _value)
 Set lighting enabled. More...
 
void SetPbrMaterial (const Pbr &_pbr)
 Set the Physically Based Rendering (PBR) material. More...
 
void SetPointSize (double _size)
 Set the point size. More...
 
void SetRenderOrder (float _renderOrder)
 Set the render order. The higher value will be rendered on top of the other coplanar polygons. More...
 
void SetShade (ShadeMode _b)
 Set the shading mode param[in] the shading mode. More...
 
void SetShininess (double _t)
 Set the shininess. More...
 
void SetSpecular (const math::Color &_clr)
 Set the specular color. More...
 
void SetTextureImage (const std::string &_tex, const std::shared_ptr< const Image > &_img=nullptr)
 Set a texture image. More...
 
void SetTextureImage (const std::string &_tex, const std::string &_resourcePath)
 Set a texture image. More...
 
void SetTransparency (double _t)
 Set the transparency percentage (0..1) More...
 
ShadeMode Shade () const
 Get the shading mode. More...
 
std::string ShadeStr () const
 Get the shade mode string. More...
 
double Shininess () const
 Get the shininess. More...
 
math::Color Specular () const
 Get the specular color. More...
 
bool TextureAlphaEnabled () const
 Get the enable alpha from textures. More...
 
std::shared_ptr< const ImageTextureData () const
 Gets the texture image, if the texture was loaded from memory. More...
 
std::string TextureImage () const
 Get a texture image. More...
 
double Transparency () const
 Get the transparency percentage (0..1) A value of 1 is fully transparent and 0 is not transparent. More...
 
bool TwoSidedEnabled () const
 Get the enable two sided rendering. More...
 

Detailed Description

Encapsulates description of a material.

Member Enumeration Documentation

◆ BlendMode

enum BlendMode
Enumerator
BLEND_MODE_BEGIN 
ADD 

Add mode.

MODULATE 

Modulate mode.

REPLACE 

Replace mode.

BLEND_MODE_END 

◆ ShadeMode

enum ShadeMode
Enumerator
SHADE_MODE_BEGIN 
FLAT 

Flat shading.

GOURAUD 

Gouraud shading.

PHONG 

Phong shading.

BLINN 

Blinn shading.

SHADE_MODE_END 

Constructor & Destructor Documentation

◆ Material() [1/2]

Material ( )

Constructor.

◆ ~Material()

~Material ( )

Destructor.

◆ Material() [2/2]

Material ( const math::Color _clr)
explicit

Create a material with a default color.

Parameters
[in]_clrColor of the material

Member Function Documentation

◆ AlphaThreshold()

double AlphaThreshold ( ) const

Get the alpha threshold.

Returns
The alpha threshold value

◆ Ambient()

math::Color Ambient ( ) const

Get the ambient color.

Returns
The ambient color

◆ Blend()

BlendMode Blend ( ) const

Get the blending mode.

Returns
the blend mode

◆ BlendFactors()

void BlendFactors ( double &  _srcFactor,
double &  _dstFactor 
) const

Get the blend factors.

Parameters
[in]_srcFactorSource factor is returned in this variable
[in]_dstFactorDestination factor is returned in this variable

◆ BlendStr()

std::string BlendStr ( ) const

Get the blend mode string.

◆ DepthWrite()

bool DepthWrite ( ) const

Get depth write.

Returns
the depth write enabled state

◆ Diffuse()

math::Color Diffuse ( ) const

Get the diffuse color.

Returns
The diffuse color

◆ Emissive()

math::Color Emissive ( ) const

Get the emissive color.

Returns
The emissive color

◆ Lighting()

bool Lighting ( ) const

Get lighting enabled.

Returns
the lighting enabled state

◆ Name()

std::string Name ( ) const

Get the name of the material.

Returns
The name of the material

◆ PbrMaterial()

Pbr* PbrMaterial ( ) const

Get the Physically Based Rendering (PBR) material.

Returns
Pointer to the PBR material. Null if it does not exist.

◆ PointSize()

double PointSize ( ) const

Get the point size.

Returns
the point size

◆ RenderOrder()

float RenderOrder ( ) const

Get the render order.

Returns
The render order value

◆ SetAlphaFromTexture()

void SetAlphaFromTexture ( bool  _enabled,
double  _alpha = 0.5,
bool  _twoSided = true 
)

Set the material to use the alpha channel from the textures.

Parameters
[in]_enabledEnable alpha channel based rendering
[in]_alphaSet the alpha threshold value
[in]_twoSidedEnable two sided rendering

◆ SetAmbient()

void SetAmbient ( const math::Color _clr)

Set the ambient color.

Parameters
[in]_clrThe ambient color

◆ SetBlend()

void SetBlend ( BlendMode  _b)

Set the blending mode.

Parameters
[in]_bthe blend mode

◆ SetBlendFactors()

void SetBlendFactors ( double  _srcFactor,
double  _dstFactor 
)

Set the blend factors. Will be interpreted as: (texture * _srcFactor) + (scene_pixel * _dstFactor)

Parameters
[in]_srcFactorThe source factor
[in]_dstFactorThe destination factor

◆ SetDepthWrite()

void SetDepthWrite ( bool  _value)

Set depth write.

Parameters
[in]_valuethe depth write enabled state

◆ SetDiffuse()

void SetDiffuse ( const math::Color _clr)

Set the diffuse color.

Parameters
[in]_clrThe diffuse color

◆ SetEmissive()

void SetEmissive ( const math::Color _clr)

Set the emissive color.

Parameters
[in]_clrThe emissive color

◆ SetLighting()

void SetLighting ( bool  _value)

Set lighting enabled.

Parameters
[in]_valuethe lighting enabled state

◆ SetPbrMaterial()

void SetPbrMaterial ( const Pbr _pbr)

Set the Physically Based Rendering (PBR) material.

Returns
The PBR material to set to.

◆ SetPointSize()

void SetPointSize ( double  _size)

Set the point size.

Parameters
[in]_sizethe size

◆ SetRenderOrder()

void SetRenderOrder ( float  _renderOrder)

Set the render order. The higher value will be rendered on top of the other coplanar polygons.

Parameters
[in]_renderOrderThe render order value

◆ SetShade()

void SetShade ( ShadeMode  _b)

Set the shading mode param[in] the shading mode.

◆ SetShininess()

void SetShininess ( double  _t)

Set the shininess.

Parameters
[in]_tThe shininess value

◆ SetSpecular()

void SetSpecular ( const math::Color _clr)

Set the specular color.

Parameters
[in]_clrThe specular color

◆ SetTextureImage() [1/2]

void SetTextureImage ( const std::string _tex,
const std::shared_ptr< const Image > &  _img = nullptr 
)

Set a texture image.

Parameters
[in]_texThe name of the texture, which must be in the resource path or its name if _img is provided
[in]_imgThe image containing the texture if image has been loaded in memory

◆ SetTextureImage() [2/2]

void SetTextureImage ( const std::string _tex,
const std::string _resourcePath 
)

Set a texture image.

Parameters
[in]_texThe name of the texture
[in]_resourcePathPath which contains _tex

◆ SetTransparency()

void SetTransparency ( double  _t)

Set the transparency percentage (0..1)

Parameters
[in]_tThe amount of transparency (0..1) where a value of 1 is fully transparent and 0 is not transparent.

◆ Shade()

ShadeMode Shade ( ) const

Get the shading mode.

Returns
the shading mode

◆ ShadeStr()

std::string ShadeStr ( ) const

Get the shade mode string.

◆ Shininess()

double Shininess ( ) const

Get the shininess.

Returns
The shininess value

◆ Specular()

math::Color Specular ( ) const

Get the specular color.

Returns
The specular color

◆ TextureAlphaEnabled()

bool TextureAlphaEnabled ( ) const

Get the enable alpha from textures.

Returns
The enable alpha value

◆ TextureData()

std::shared_ptr<const Image> TextureData ( ) const

Gets the texture image, if the texture was loaded from memory.

Returns
A pointer to the image that was loaded from memory

◆ TextureImage()

std::string TextureImage ( ) const

Get a texture image.

Returns
The name of the texture image (if one exists) or an empty string

◆ Transparency()

double Transparency ( ) const

Get the transparency percentage (0..1) A value of 1 is fully transparent and 0 is not transparent.

Returns
The transparency percentage

◆ TwoSidedEnabled()

bool TwoSidedEnabled ( ) const

Get the enable two sided rendering.

Returns
The enable two sided rendering value

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