Public Member Functions | List of all members
sdf::SDF_VERSION_NAMESPACE::Material Class Reference

This class contains visual material properties. More...

#include <Material.hh>

Public Member Functions

 Material ()
 Default constructor. More...
 
gz::math::Color Ambient () const
 Get the ambient color. More...
 
gz::math::Color Diffuse () const
 Get the diffuse color. More...
 
bool DoubleSided () const
 Get whether double sided material is enabled. More...
 
sdf::ElementPtr Element () const
 Get a pointer to the SDF element that was used during load. More...
 
gz::math::Color Emissive () const
 Get the emissive color. More...
 
const std::string & FilePath () const
 The path to the file where this element was loaded from. More...
 
bool Lighting () const
 Get whether dynamic lighting is enabled. More...
 
Errors Load (ElementPtr _sdf)
 Load the material based on a element pointer. More...
 
Errors Load (sdf::ElementPtr _sdf, const ParserConfig &_config)
 Load the material based on a element pointer. More...
 
std::string NormalMap () const
 Get the normal map filename. More...
 
const PbrPbrMaterial () const
 Get the Physically Based Rendering (PBR) material. More...
 
float RenderOrder () const
 Get render order for coplanar polygons. More...
 
std::string ScriptName () const
 Get the name of the material script, or empty if one has not been specified. More...
 
std::string ScriptUri () const
 Get the URI of the material script, if one has been set. More...
 
void SetAmbient (const gz::math::Color &_color)
 Set the ambient color. More...
 
void SetDiffuse (const gz::math::Color &_color)
 Set the diffuse color. More...
 
void SetDoubleSided (bool _doubleSided)
 Set whether double sided material is enabled. More...
 
void SetEmissive (const gz::math::Color &_color)
 Set the emissive color. More...
 
void SetFilePath (const std::string &_filePath)
 Set the path to the file where this element was loaded from. More...
 
void SetLighting (const bool _lighting)
 Set whether dynamic lighting is enabled. More...
 
void SetNormalMap (const std::string &_map)
 Set the normal map filename. More...
 
void SetPbrMaterial (const Pbr &_pbr)
 Set the Physically Based Rendering (PBR) material. More...
 
void SetRenderOrder (const float _renderOrder)
 Set render order. More...
 
void SetScriptName (const std::string &_name)
 Set the name of the material script. More...
 
void SetScriptUri (const std::string &_uri)
 Set the URI of the material script. More...
 
void SetShader (const ShaderType &_type)
 Set the type of shader. More...
 
void SetShininess (const double _shininess)
 Set the specular exponent. More...
 
void SetSpecular (const gz::math::Color &_color)
 Set the specular color. More...
 
ShaderType Shader () const
 Get the type of shader. More...
 
double Shininess () const
 Get the specular exponent. More...
 
gz::math::Color Specular () const
 Get the specular color. More...
 
sdf::ElementPtr ToElement () const
 Create and return an SDF element filled with data from this material. More...
 
sdf::ElementPtr ToElement (sdf::Errors &_errors) const
 Create and return an SDF element filled with data from this material. More...
 

Detailed Description

This class contains visual material properties.

Constructor & Destructor Documentation

◆ Material()

sdf::SDF_VERSION_NAMESPACE::Material::Material ( )

Default constructor.

Member Function Documentation

◆ Ambient()

gz::math::Color sdf::SDF_VERSION_NAMESPACE::Material::Ambient ( ) const

Get the ambient color.

The ambient color is specified by a set of three numbers representing red/green/blue, each in the range of [0,1].

Returns
Ambient color.

◆ Diffuse()

gz::math::Color sdf::SDF_VERSION_NAMESPACE::Material::Diffuse ( ) const

Get the diffuse color.

The diffuse color is specified by a set of three numbers representing red/green/blue, each in the range of [0,1].

Returns
Diffuse color.

◆ DoubleSided()

bool sdf::SDF_VERSION_NAMESPACE::Material::DoubleSided ( ) const

Get whether double sided material is enabled.

The default value is false.

Returns
False if double sided material should be disabled.

◆ Element()

sdf::ElementPtr sdf::SDF_VERSION_NAMESPACE::Material::Element ( ) const

Get a pointer to the SDF element that was used during load.

Returns
SDF element pointer. The value will be nullptr if Load has not been called.

◆ Emissive()

gz::math::Color sdf::SDF_VERSION_NAMESPACE::Material::Emissive ( ) const

Get the emissive color.

The emissive color is specified by a set of three numbers representing red/green/blue, each in the range of [0,1].

Returns
Emissive color.

◆ FilePath()

const std::string& sdf::SDF_VERSION_NAMESPACE::Material::FilePath ( ) const

The path to the file where this element was loaded from.

Returns
Full path to the file on disk.

◆ Lighting()

bool sdf::SDF_VERSION_NAMESPACE::Material::Lighting ( ) const

Get whether dynamic lighting is enabled.

The default value is true.

Returns
False if dynamic lighting should be disabled.

◆ Load() [1/2]

Errors sdf::SDF_VERSION_NAMESPACE::Material::Load ( ElementPtr  _sdf)

Load the material based on a element pointer.

This is not the usual entry point. Typical usage of the SDF DOM is through the Root object.

Parameters
[in]_sdfThe SDF Element pointer
Returns
Errors, which is a vector of Error objects. Each Error includes an error code and message. An empty vector indicates no error.

◆ Load() [2/2]

Errors sdf::SDF_VERSION_NAMESPACE::Material::Load ( sdf::ElementPtr  _sdf,
const ParserConfig _config 
)

Load the material based on a element pointer.

This is not the usual entry point. Typical usage of the SDF DOM is through the Root object.

Parameters
[in]_sdfThe SDF Element pointer
[in]_configParser configuration
Returns
Errors, which is a vector of Error objects. Each Error includes an error code and message. An empty vector indicates no error.

◆ NormalMap()

std::string sdf::SDF_VERSION_NAMESPACE::Material::NormalMap ( ) const

Get the normal map filename.

This will be an empty string if a normal map has not been set.

Returns
Filename of the normal map, or empty string if a normal map has not been specified.

◆ PbrMaterial()

const Pbr* sdf::SDF_VERSION_NAMESPACE::Material::PbrMaterial ( ) const

Get the Physically Based Rendering (PBR) material.

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

◆ RenderOrder()

float sdf::SDF_VERSION_NAMESPACE::Material::RenderOrder ( ) const

Get render order for coplanar polygons.

The higher value will be rendered on top of the other coplanar polygons. The default value is zero.

Returns
Render order

◆ ScriptName()

std::string sdf::SDF_VERSION_NAMESPACE::Material::ScriptName ( ) const

Get the name of the material script, or empty if one has not been specified.

The name should match an script element in the script located at the ScriptUri().

Returns
The name of the material script, or empty string if one has not been set.

◆ ScriptUri()

std::string sdf::SDF_VERSION_NAMESPACE::Material::ScriptUri ( ) const

Get the URI of the material script, if one has been set.

Returns
The URI of the material script, or empty string if one has not been set.

◆ SetAmbient()

void sdf::SDF_VERSION_NAMESPACE::Material::SetAmbient ( const gz::math::Color &  _color)

Set the ambient color.

The ambient color is specified by a set of three numbers representing red/green/blue, each in the range of [0,1].

Parameters
[in]_colorAmbient color.

◆ SetDiffuse()

void sdf::SDF_VERSION_NAMESPACE::Material::SetDiffuse ( const gz::math::Color &  _color)

Set the diffuse color.

The diffuse color is specified by a set of three numbers representing red/green/blue, each in the range of [0,1].

Parameters
[in]_colorDiffuse color.

◆ SetDoubleSided()

void sdf::SDF_VERSION_NAMESPACE::Material::SetDoubleSided ( bool  _doubleSided)

Set whether double sided material is enabled.

Parameters
[in]_lightingFalse disables double sided material.

◆ SetEmissive()

void sdf::SDF_VERSION_NAMESPACE::Material::SetEmissive ( const gz::math::Color &  _color)

Set the emissive color.

The emissive color is specified by a set of three numbers representing red/green/blue, each in the range of [0,1].

Parameters
[in]_colorEmissive color.

◆ SetFilePath()

void sdf::SDF_VERSION_NAMESPACE::Material::SetFilePath ( const std::string &  _filePath)

Set the path to the file where this element was loaded from.

\paramp[in] _filePath Full path to the file on disk.

◆ SetLighting()

void sdf::SDF_VERSION_NAMESPACE::Material::SetLighting ( const bool  _lighting)

Set whether dynamic lighting is enabled.

Parameters
[in]_lightingFalse disables dynamic lighting.

◆ SetNormalMap()

void sdf::SDF_VERSION_NAMESPACE::Material::SetNormalMap ( const std::string &  _map)

Set the normal map filename.

Parameters
[in]_mapFilename of the normal map.

◆ SetPbrMaterial()

void sdf::SDF_VERSION_NAMESPACE::Material::SetPbrMaterial ( const Pbr _pbr)

Set the Physically Based Rendering (PBR) material.

Returns
The PBR material to set to.

◆ SetRenderOrder()

void sdf::SDF_VERSION_NAMESPACE::Material::SetRenderOrder ( const float  _renderOrder)

Set render order.

Parameters
[in]_renderOrderrender order
See also
float RenderOrder() const

◆ SetScriptName()

void sdf::SDF_VERSION_NAMESPACE::Material::SetScriptName ( const std::string &  _name)

Set the name of the material script.

The name should match an script element in the script located at the ScriptUri().

Parameters
[in]_nameThe name of the material script.

◆ SetScriptUri()

void sdf::SDF_VERSION_NAMESPACE::Material::SetScriptUri ( const std::string &  _uri)

Set the URI of the material script.

Parameters
[in]_uriThe URI of the material script.

◆ SetShader()

void sdf::SDF_VERSION_NAMESPACE::Material::SetShader ( const ShaderType _type)

Set the type of shader.

Parameters
[in]_typeShader type.

◆ SetShininess()

void sdf::SDF_VERSION_NAMESPACE::Material::SetShininess ( const double  _shininess)

Set the specular exponent.

Parameters
[in]_shininessSpecular exponent.

◆ SetSpecular()

void sdf::SDF_VERSION_NAMESPACE::Material::SetSpecular ( const gz::math::Color &  _color)

Set the specular color.

The specular color is specified by a set of three numbers representing red/green/blue, each in the range of [0,1].

Parameters
[in]_colorSpecular color.

◆ Shader()

ShaderType sdf::SDF_VERSION_NAMESPACE::Material::Shader ( ) const

Get the type of shader.

Returns
Shader type.

◆ Shininess()

double sdf::SDF_VERSION_NAMESPACE::Material::Shininess ( ) const

Get the specular exponent.

Returns
Specular exponent.

◆ Specular()

gz::math::Color sdf::SDF_VERSION_NAMESPACE::Material::Specular ( ) const

Get the specular color.

The specular color is specified by a set of three numbers representing red/green/blue, each in the range of [0,1].

Returns
Specular color.

◆ ToElement() [1/2]

sdf::ElementPtr sdf::SDF_VERSION_NAMESPACE::Material::ToElement ( ) const

Create and return an SDF element filled with data from this material.

Note that parameter passing functionality is not captured with this function.

Returns
SDF element pointer with updated material values.

◆ ToElement() [2/2]

sdf::ElementPtr sdf::SDF_VERSION_NAMESPACE::Material::ToElement ( sdf::Errors _errors) const

Create and return an SDF element filled with data from this material.

Note that parameter passing functionality is not captured with this function.

Parameters
[out]_errorsVector of errors.
Returns
SDF element pointer with updated material values.

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