| GL Studio C++ Runtime API

Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Material Class Reference

`#include <material.h>`

## Public Member Functions
| Material (const GlsColor &ambient, const GlsColor &diffuse, const GlsColor &specular, const GlsColor &emission, const float &shininess)
void | ApplyAmbient (GLenum face=GL_FRONT_AND_BACK)
void | ApplyDiffuse (GLenum face=GL_FRONT_AND_BACK)
void | ApplySpecular (GLenum face=GL_FRONT_AND_BACK)
void | ApplyEmission (GLenum face=GL_FRONT_AND_BACK)
void | ApplyShininess (GLenum face=GL_FRONT_AND_BACK)
void | ApplyAll (GLenum face=GL_FRONT_AND_BACK)
bool | InUse () const
void | InUse (bool val)
const std::string & | Name () const
void | Name (const std::string &name)

## Static Public Member Functions
static bool | MaterialsAreEquivalent (const Material &m1, const Material &m2)

## Public Attributes
GlsColor | _ambient
| Ambient component of the material.
GlsColor | _diffuse
| Diffuse component of the material.
GlsColor | _specular
| Specular component of the material.
GlsColor | _emission
| Emission component of the material.
float | _shininess
| Shininess component of the material.
bool | _inUse
| True if the material is in use.
std::string | _name
| String name of the material.
ColorMaterialMode_e | _colorMaterialMode
| Color mode to use for this material.

## Static Public Attributes
static GlsColor | _ambientDefault
| The ambient value for the default material.
static GlsColor | _diffuseDefault
| The diffuse value for the default material.
static GlsColor | _specularDefault
| The specular value for the default material.
static GlsColor | _emissionDefault
| The emission value for the default material.
static float | _shininessDefault
| The shininess value for the default material.

## Detailed Description

The Material class

## Constructor & Destructor Documentation

## ◆ Material()

Material | ( | const GlsColor & | ambient,
|  | const GlsColor & | diffuse,
|  | const GlsColor & | specular,
|  | const GlsColor & | emission,
|  | const float & | shininess
| ) |  |

Constructor

Parameters

  ambient | The ambient component of the material.
  diffuse | The diffuse component of the material.
  specular | The specular component of the material.
  emission | The emission component of the material.
  shininess | The shininess component of the material.

## Member Function Documentation

## ◆ ApplyAll()

void ApplyAll | ( | GLenum | face = `GL_FRONT_AND_BACK` | ) |

Applies all of the components of this material to the OpenGL pipeline

Parameters

  face | Which faces to apply this to (front, back or front and back faces)

## ◆ ApplyAmbient()

void ApplyAmbient | ( | GLenum | face = `GL_FRONT_AND_BACK` | ) |

Applies the ambient component of this material to the OpenGL pipeline

Parameters

  face | Which faces to apply this to (front, back or front and back faces)

## ◆ ApplyDiffuse()

void ApplyDiffuse | ( | GLenum | face = `GL_FRONT_AND_BACK` | ) |

Applies the diffuse component of this material to the OpenGL pipeline

Parameters

  face | Which faces to apply this to (front, back or front and back faces)

## ◆ ApplyEmission()

void ApplyEmission | ( | GLenum | face = `GL_FRONT_AND_BACK` | ) |

Applies the emission component of this material to the OpenGL pipeline

Parameters

  face | Which faces to apply this to (front, back or front and back faces)

## ◆ ApplyShininess()

void ApplyShininess | ( | GLenum | face = `GL_FRONT_AND_BACK` | ) |

Applies the shininess component of this material to the OpenGL pipeline

Parameters

  face | Which faces to apply this to (front, back or front and back faces)

## ◆ ApplySpecular()

void ApplySpecular | ( | GLenum | face = `GL_FRONT_AND_BACK` | ) |

Applies the specular component of this material to the OpenGL pipeline

Parameters

  face | Which faces to apply this to (front, back or front and back faces)

## ◆ InUse() [1/2]

bool InUse | ( |  | ) | const

Returns
  True if this material is in use

## ◆ InUse() [2/2]

void InUse | ( | bool | val | ) |

Sets whether this material is in use

Parameters

  val | Whether this material is in use

## ◆ MaterialsAreEquivalent()

static bool MaterialsAreEquivalent | ( | const Material & | m1,
|  | const Material & | m2
| ) |  |
| inline static

Materials are equivalent if all of their parameters are the same.

Parameters

  m1 | A material to compare.
  m2 | The other material to compare.

Returns
  True if the materials are the same.

## ◆ Name() [1/2]

const std::string & Name | ( |  | ) | const

Returns
  The material name

## ◆ Name() [2/2]

void Name | ( | const std::string & | name | ) |

Sets the material name

Parameters

  name | The material name

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

- material.h