Chemical Data Processing Library C++ API - Version 1.3.0
Public Member Functions | List of all members
CDPL::Vis::Material Class Reference

Defines material properties of Vis::Object3D instances. More...

#include <Material.hpp>

Public Member Functions

 Material (const Color &amb_color, double amb_factor, const Color &diff_color, const Color &spec_color, double shininess, double transp=0.0)
 Constructs an new Material instance with the specified properties. More...
 
 Material (double amb_factor, const Color &diff_color, const Color &spec_color, double shininess, double transp=0.0)
 Constructs an new Material instance with the specified properties. More...
 
void setAmbientColor (const Color &color)
 Sets the ambient color component. More...
 
const ColorgetAmbientColor () const
 Returns the ambient color component. More...
 
void setAmbientFactor (double factor)
 Sets the scaling factor to use for calculating the ambient from the diffuse color component. More...
 
double getAmbientFactor () const
 Returns the scaling factor used for calculating the ambient from the diffuse color component. More...
 
void setDiffuseColor (const Color &color)
 Sets the diffuse color component. More...
 
const ColorgetDiffuseColor () const
 Returns the diffuse color component. More...
 
void setSpecularColor (const Color &color)
 Sets the specular color component. More...
 
const ColorgetSpecularColor () const
 Returns the specular color component. More...
 
void setShininess (double shininess)
 Sets the shininess of the material. More...
 
double getShininess () const
 Returns the shininess of the material. More...
 
void setTransparency (double transp)
 Sets the transparency of the material. More...
 
double getTransparency () const
 Returns the transparency of the material. More...
 
bool operator== (const Material &material) const
 Equality comparison operator. More...
 
bool operator!= (const Material &material) const
 Inequality comparison operator. More...
 

Detailed Description

Defines material properties of Vis::Object3D instances.

A color vector for each of the Phong lighting's components is defined (alpha channel will be inored): The ambient component defines what color the surface reflects under ambient lighting. This is usually the same as the surface's color. The diffuse component defines the color of the surface under diffuse lighting. The diffuse color is (just like ambient lighting) usually set to the desired surface's color. The specular component sets the color of the specular highlight on the surface (or possibly even reflect a surface-specific color). Lastly, the shininess impacts the scattering/radius of the specular highlight. For transparent materials a transparency in the range 0.0 to 1.0 can be specified where a value of 0.0 represents a completely opaque material.

Since
1.3

Constructor & Destructor Documentation

◆ Material() [1/2]

CDPL::Vis::Material::Material ( const Color amb_color,
double  amb_factor,
const Color diff_color,
const Color spec_color,
double  shininess,
double  transp = 0.0 
)

Constructs an new Material instance with the specified properties.

Parameters
amb_colorThe ambient color component.
amb_factorThe scaling factor to use for calculating the ambient from the diffuse color component.
diff_colorThe diffuse color component.
spec_colorThe specular color component.
shininessThe shininess value.
transpThe transparency value.

◆ Material() [2/2]

CDPL::Vis::Material::Material ( double  amb_factor,
const Color diff_color,
const Color spec_color,
double  shininess,
double  transp = 0.0 
)

Constructs an new Material instance with the specified properties.

Parameters
amb_factorThe scaling factor to use for calculating the ambient from the diffuse color component.
diff_colorThe diffuse color component.
spec_colorThe specular color component.
shininessThe shininess value.
transpThe transparency value.

Member Function Documentation

◆ setAmbientColor()

void CDPL::Vis::Material::setAmbientColor ( const Color color)

Sets the ambient color component.

Parameters
colorThe ambient color component.

◆ getAmbientColor()

const Color& CDPL::Vis::Material::getAmbientColor ( ) const

Returns the ambient color component.

Returns
The ambient color component.

◆ setAmbientFactor()

void CDPL::Vis::Material::setAmbientFactor ( double  factor)

Sets the scaling factor to use for calculating the ambient from the diffuse color component.

Parameters
factorThe scaling factor in the range [0, 1].

◆ getAmbientFactor()

double CDPL::Vis::Material::getAmbientFactor ( ) const

Returns the scaling factor used for calculating the ambient from the diffuse color component.

Returns
The scaling factor.

◆ setDiffuseColor()

void CDPL::Vis::Material::setDiffuseColor ( const Color color)

Sets the diffuse color component.

Parameters
colorThe diffuse color component.

◆ getDiffuseColor()

const Color& CDPL::Vis::Material::getDiffuseColor ( ) const

Returns the diffuse color component.

Returns
The diffuse color component.

◆ setSpecularColor()

void CDPL::Vis::Material::setSpecularColor ( const Color color)

Sets the specular color component.

Parameters
colorThe specular color component.

◆ getSpecularColor()

const Color& CDPL::Vis::Material::getSpecularColor ( ) const

Returns the specular color component.

Returns
The specular color component.

◆ setShininess()

void CDPL::Vis::Material::setShininess ( double  shininess)

Sets the shininess of the material.

Parameters
shininessThe shininess value in the range [0, 1].

◆ getShininess()

double CDPL::Vis::Material::getShininess ( ) const

Returns the shininess of the material.

Returns
The shininess value.

◆ setTransparency()

void CDPL::Vis::Material::setTransparency ( double  transp)

Sets the transparency of the material.

Parameters
transpThe transparency value in the range [0, 1].

◆ getTransparency()

double CDPL::Vis::Material::getTransparency ( ) const

Returns the transparency of the material.

Returns
The transparency value.

◆ operator==()

bool CDPL::Vis::Material::operator== ( const Material material) const

Equality comparison operator.

Parameters
materialThe other Material object to be compared with.
Returns
true if the style and color attributes compare equal, and false otherwise.

◆ operator!=()

bool CDPL::Vis::Material::operator!= ( const Material material) const

Inequality comparison operator.

The result is equivalent to !(*this == material).

Parameters
materialThe other Material object to be compared with.
Returns
true if either the style or the color attributes compare non-equal, and false otherwise.

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