GL Studio C++ Runtime API
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
ambientThe ambient component of the material.
diffuseThe diffuse component of the material.
specularThe specular component of the material.
emissionThe emission component of the material.
shininessThe 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
faceWhich 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
faceWhich 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
faceWhich 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
faceWhich 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
faceWhich 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
faceWhich 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
valWhether this material is in use

◆ MaterialsAreEquivalent()

static bool MaterialsAreEquivalent ( const Material m1,
const Material m2 
)
inlinestatic

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

Parameters
m1A material to compare.
m2The 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
nameThe material name

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