##

Material Class Reference
Common

Encapsulates description of a material. More...

`#include <common/common.hh>`

## Public Types

enum | BlendMode { ADD, MODULATE, REPLACE, BLEND_COUNT }
enum | ShadeMode { FLAT, GOURAUD, PHONG, BLINN, SHADE_COUNT }

## Public Member Functions

| Material ()
| Constructor. More...
| Material (const Color &_clr) GAZEBO_DEPRECATED(9.0)
| Create a material with a default color. More...
| Material (const ignition::math::Color &_clr)
| Create a material with a default color. More...
virtual | ~Material ()
| Destructor. More...
ignition::math::Color | Ambient () const
| Get the ambient color. More...
ignition::math::Color | Diffuse () const
| Get the diffuse color. More...
ignition::math::Color | Emissive () const
| Get the emissive color. More...
Color | GetAmbient () const GAZEBO_DEPRECATED(9.0)
| Get the ambient color. More...
void | GetBlendFactors (double &_srcFactor, double &_dstFactor) const
| Get the blend factors. More...
BlendMode | GetBlendMode () const
| Get the blending mode. More...
bool | GetDepthWrite () const
| Get depth write. More...
Color | GetDiffuse () const GAZEBO_DEPRECATED(9.0)
| Get the diffuse color. More...
Color | GetEmissive () const GAZEBO_DEPRECATED(9.0)
| Get the emissive color. More...
bool | GetLighting () const
| Get lighting enabled. More...
std::string | GetName () const
| Get the name of the material. More...
double | GetPointSize () const
| Get the point size. More...
ShadeMode | GetShadeMode () const
| Get the shading mode. More...
double | GetShininess () const
| Get the shininess. More...
Color | GetSpecular () const GAZEBO_DEPRECATED(9.0)
| Get the specular color. More...
std::string | GetTextureImage () const
| Get a texture image. More...
double | GetTransparency () const
| Get the transparency percentage (0..1) More...
void | SetAmbient (const Color &_clr) GAZEBO_DEPRECATED(9.0)
| Set the ambient color. More...
void | SetAmbient (const ignition::math::Color &_clr)
| Set the ambient color. More...
void | SetBlendFactors (double _srcFactor, double _dstFactor)
| Set the blende factors. More...
void | SetBlendMode (BlendMode _b)
| Set the blending mode. More...
void | SetDepthWrite (bool _value)
| Set depth write. More...
void | SetDiffuse (const Color &_clr) GAZEBO_DEPRECATED(9.0)
| Set the diffuse color. More...
void | SetDiffuse (const ignition::math::Color &_clr)
| Set the diffuse color. More...
void | SetEmissive (const Color &_clr) GAZEBO_DEPRECATED(9.0)
| Set the emissive color. More...
void | SetEmissive (const ignition::math::Color &_clr)
| Set the emissive color. More...
void | SetLighting (bool _value)
| Set lighting enabled. More...
void | SetPointSize (double _size)
| Set the point size. More...
void | SetShadeMode (ShadeMode _b)
| Set the shading mode param[in] the shading mode. More...
void | SetShininess (double _t)
| Set the shininess. More...
void | SetSpecular (const Color &_clr) GAZEBO_DEPRECATED(9.0)
| Set the specular color. More...
void | SetSpecular (const ignition::math::Color &_clr)
| Set the specular color. More...
void | SetTextureImage (const std::string &_tex)
| 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...
ignition::math::Color | Specular () const
| Get the specular color. More...

## Static Public Attributes

static std::string | BlendModeStr [BLEND_COUNT]
static std::string | ShadeModeStr [SHADE_COUNT]

## Protected Attributes

ignition::math::Color | ambient
| the ambient light color More...
BlendMode | blendMode
| blend mode More...
ignition::math::Color | diffuse
| the diffuse ligth color More...
ignition::math::Color | emissive
| the emissive light color More...
std::string | name
| the name of the material More...
double | pointSize
| point size More...
ShadeMode | shadeMode
| the shade mode More...
double | shininess = 0.0
| shininess value (0 to 1) More...
ignition::math::Color | specular
| the specular light color More...
std::string | texImage
| the texture image file name More...
double | transparency = 0.0
| transparency value in the range 0 to 1 More...

## Friends

std::ostream & | operator<< (std::ostream &_out, const gazebo::common::Material &_m)
| Stream insertion operator param[in] _out the output stream to extract from param[out] _m the material information. More...

## Detailed Description

Encapsulates description of a material.

## Member Enumeration Documentation

## BlendMode

enum BlendMode

Enumerator
ADD |
MODULATE |
REPLACE |
BLEND_COUNT |

## ShadeMode

enum ShadeMode

Enumerator
FLAT |
GOURAUD |
PHONG |
BLINN |
SHADE_COUNT |

## Constructor & Destructor Documentation

## Material() [1/3]

Material | ( |  | ) |

Constructor.

## ~Material()

virtual ~Material | ( |  | ) |

virtual

Destructor.

## Material() [2/3]

Material | ( | const Color & | _clr | ) |

explicit

Create a material with a default color.

Parameters

  [in] | _clr | Color of the material

Deprecated:
  Use constructor which accepts ignition::math::Color.

## Material() [3/3]

Material | ( | const ignition::math::Color & | _clr | ) |

explicit

Create a material with a default color.

Parameters

  [in] | _clr | Color of the material

## Member Function Documentation

## Ambient()

ignition::math::Color Ambient | ( |  | ) | const

Get the ambient color.

Returns
  The ambient color

## Diffuse()

ignition::math::Color Diffuse | ( |  | ) | const

Get the diffuse color.

Returns
  The diffuse color

## Emissive()

ignition::math::Color Emissive | ( |  | ) | const

Get the emissive color.

Returns
  The emissive color

## GetAmbient()

Color GetAmbient | ( |  | ) | const

Get the ambient color.

Returns
  The ambient color

Deprecated:
  Use function that returns ignition::math::Color.

## GetBlendFactors()

void GetBlendFactors | ( | double & | _srcFactor,
|  | double & | _dstFactor
| ) |  | const

Get the blend factors.

Parameters

  [in] | _srcFactor | Source factor is returned in this variable
  [in] | _dstFactor | Destination factor is returned in this variable

## GetBlendMode()

BlendMode GetBlendMode | ( |  | ) | const

Get the blending mode.

Returns
  the blend mode

## GetDepthWrite()

bool GetDepthWrite | ( |  | ) | const

Get depth write.

Returns
  the depth write enabled state

## GetDiffuse()

Color GetDiffuse | ( |  | ) | const

Get the diffuse color.

Returns
  The diffuse color

Deprecated:
  Use function that returns ignition::math::Color.

## GetEmissive()

Color GetEmissive | ( |  | ) | const

Get the emissive color.

Returns
  The emissive color

Deprecated:
  Use function that returns ignition::math::Color.

## GetLighting()

bool GetLighting | ( |  | ) | const

Get lighting enabled.

Returns
  the lighting enabled state

## GetName()

std::string GetName | ( |  | ) | const

Get the name of the material.

Returns
  The name of the material

## GetPointSize()

double GetPointSize | ( |  | ) | const

Get the point size.

Returns
  the point size

## GetShadeMode()

ShadeMode GetShadeMode | ( |  | ) | const

Get the shading mode.

Returns
  the shading mode

## GetShininess()

double GetShininess | ( |  | ) | const

Get the shininess.

Returns
  The shininess value

## GetSpecular()

Color GetSpecular | ( |  | ) | const

Get the specular color.

Returns
  The specular color

Deprecated:
  Use function that returns ignition::math::Color.

## GetTextureImage()

std::string GetTextureImage | ( |  | ) | const

Get a texture image.

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

## GetTransparency()

double GetTransparency | ( |  | ) | const

Get the transparency percentage (0..1)

Returns
  The transparency percentage

## SetAmbient() [1/2]

void SetAmbient | ( | const Color & | _clr | ) |

Set the ambient color.

Parameters

  [in] | _clr | The ambient color

Deprecated:
  Use function that accepts ignition::math::Color.

## SetAmbient() [2/2]

void SetAmbient | ( | const ignition::math::Color & | _clr | ) |

Set the ambient color.

Parameters

  [in] | _clr | The ambient color

## SetBlendFactors()

void SetBlendFactors | ( | double | _srcFactor,
|  | double | _dstFactor
| ) |  |

Set the blende factors.

Will be interpreted as: (texture * _srcFactor) + (scene_pixel * _dstFactor)

Parameters

  [in] | _srcFactor | The source factor
  [in] | _dstFactor | The destination factor

## SetBlendMode()

void SetBlendMode | ( | BlendMode | _b | ) |

Set the blending mode.

Parameters

  [in] | _b | the blend mode

## SetDepthWrite()

void SetDepthWrite | ( | bool | _value | ) |

Set depth write.

Parameters

  [in] | _value | the depth write enabled state

## SetDiffuse() [1/2]

void SetDiffuse | ( | const Color & | _clr | ) |

Set the diffuse color.

Parameters

  [in] | _clr | The diffuse color

Deprecated:
  Use function that accepts ignition::math::Color.

## SetDiffuse() [2/2]

void SetDiffuse | ( | const ignition::math::Color & | _clr | ) |

Set the diffuse color.

Parameters

  [in] | _clr | The diffuse color

## SetEmissive() [1/2]

void SetEmissive | ( | const Color & | _clr | ) |

Set the emissive color.

Parameters

  [in] | _clr | The emissive color

Deprecated:
  Use function that accepts ignition::math::Color.

## SetEmissive() [2/2]

void SetEmissive | ( | const ignition::math::Color & | _clr | ) |

Set the emissive color.

Parameters

  [in] | _clr | The emissive color

## SetLighting()

void SetLighting | ( | bool | _value | ) |

Set lighting enabled.

Parameters

  [in] | _value | the lighting enabled state

## SetPointSize()

void SetPointSize | ( | double | _size | ) |

Set the point size.

Parameters

  [in] | _size | the size

## SetShadeMode()

void SetShadeMode | ( | ShadeMode | _b | ) |

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

## SetShininess()

void SetShininess | ( | double | _t | ) |

Set the shininess.

Parameters

  [in] | _t | The shininess value

## SetSpecular() [1/2]

void SetSpecular | ( | const Color & | _clr | ) |

Set the specular color.

Parameters

  [in] | _clr | The specular color

Deprecated:
  Use function that accepts ignition::math::Color.

## SetSpecular() [2/2]

void SetSpecular | ( | const ignition::math::Color & | _clr | ) |

Set the specular color.

Parameters

  [in] | _clr | The specular color

## SetTextureImage() [1/2]

void SetTextureImage | ( | const std::string & | _tex | ) |

Set a texture image.

Parameters

  [in] | _tex | The name of the texture, which must be in Gazebo's resource path

## SetTextureImage() [2/2]

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

Set a texture image.

Parameters

  [in] | _tex | The name of the texture
  [in] | _resourcePath | Path which contains _tex

## SetTransparency()

void SetTransparency | ( | double | _t | ) |

Set the transparency percentage (0..1)

Parameters

  [in] | _t | The amount of transparency (0..1)

## Specular()

ignition::math::Color Specular | ( |  | ) | const

Get the specular color.

Returns
  The specular color

## Friends And Related Function Documentation

## operator<<

std::ostream& operator<< | ( | std::ostream & | _out,
|  | const gazebo::common::Material & | _m
| ) |  |

friend

Stream insertion operator param[in] _out the output stream to extract from param[out] _m the material information.

## Member Data Documentation

## ambient

ignition::math::Color ambient

protected

the ambient light color

## blendMode

BlendMode blendMode

protected

blend mode

## BlendModeStr

std::string BlendModeStr[BLEND_COUNT]

static

## diffuse

ignition::math::Color diffuse

protected

the diffuse ligth color

## emissive

ignition::math::Color emissive

protected

the emissive light color

## name

std::string name

protected

the name of the material

## pointSize

double pointSize

protected

point size

## shadeMode

ShadeMode shadeMode

protected

the shade mode

## ShadeModeStr

std::string ShadeModeStr[SHADE_COUNT]

static

## shininess

double shininess = 0.0

protected

shininess value (0 to 1)

## specular

ignition::math::Color specular

protected

the specular light color

## texImage

std::string texImage

protected

the texture image file name

## transparency

double transparency = 0.0

protected

transparency value in the range 0 to 1

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

- common/Material.hh