PGR Copakond OpenGL Engine - Bowling
Loading...
Searching...
No Matches
copakond::Material Class Reference

Defines surface properties and texture maps for rendering a mesh. More...

#include <material.h>

Public Member Functions

 Material ()
 Material (const glm::vec3 &ambient, const glm::vec3 &diffuse, const glm::vec3 &specular)
 Material (const glm::vec3 &ambient, const glm::vec3 &diffuse, const glm::vec3 &specular, float shininess)
 Material (const glm::vec3 &ambient, const glm::vec3 &diffuse, const glm::vec3 &specular, float shininess, float alpha)
 ~Material ()
glm::vec3 & ambient ()
glm::vec3 & diffuse ()
glm::vec3 & specular ()
float & shininess ()
float & alpha ()
void setDiffuseTexture (const std::string &textureFile, bool warpTexture=false, bool mipMap=true)
 Loads and binds a diffuse texture map.
bool hasDiffuseTexture () const
void clearDiffuseTexture ()
void setSpecularTexture (const std::string &textureFile)
bool hasSpecularTexture () const
void clearSpecularTexture ()
void setShininessTexture (const std::string &textureFile)
bool hasShininessTexture () const
void clearShininessTexture ()
void setAlphaTexture (const std::string &textureFile)
bool hasAlphaTexture () const
void clearAlphaTexture ()
void setNormalTexture (const std::string &textureFile)
bool hasNormalTexture () const
void clearNormalTexture ()
GLuint diffuseTextureUniform () const
GLuint specularTextureUniform () const
GLuint shininessTextureUniform () const
GLuint alphaTextureUniform () const
GLuint normalTextureUniform () const
void setAlpha (float alpha)
float getAlpha () const
void setIsTextLabel (bool state)
bool isTextLabel () const

Protected Member Functions

void constructor (const glm::vec3 &ambient, const glm::vec3 &diffuse, const glm::vec3 &specular, float shininess, float alpha)

Protected Attributes

glm::vec3 _ambient
glm::vec3 _diffuse
glm::vec3 _specular
float _shininess
float _alpha
GLuint _diffuseTexture = 0
GLuint _specularTexture = 0
GLuint _shininessTexture = 0
GLuint _alphaTexture = 0
GLuint _normalTexture = 0
bool _hasDiffuseTexture
bool _hasSpecularTexture
bool _hasShininessTexture
bool _hasAlphaTexture
bool _hasNormalTexture
bool _isTextLabel = false

Detailed Description

Defines surface properties and texture maps for rendering a mesh.

Constructor & Destructor Documentation

◆ Material() [1/4]

copakond::Material::Material ( )

◆ Material() [2/4]

copakond::Material::Material ( const glm::vec3 & ambient,
const glm::vec3 & diffuse,
const glm::vec3 & specular )

◆ Material() [3/4]

copakond::Material::Material ( const glm::vec3 & ambient,
const glm::vec3 & diffuse,
const glm::vec3 & specular,
float shininess )

◆ Material() [4/4]

copakond::Material::Material ( const glm::vec3 & ambient,
const glm::vec3 & diffuse,
const glm::vec3 & specular,
float shininess,
float alpha )

◆ ~Material()

copakond::Material::~Material ( )

Member Function Documentation

◆ alpha()

float & copakond::Material::alpha ( )
inline

◆ alphaTextureUniform()

GLuint copakond::Material::alphaTextureUniform ( ) const
inline

◆ ambient()

glm::vec3 & copakond::Material::ambient ( )
inline

◆ clearAlphaTexture()

void copakond::Material::clearAlphaTexture ( )
inline

◆ clearDiffuseTexture()

void copakond::Material::clearDiffuseTexture ( )
inline

◆ clearNormalTexture()

void copakond::Material::clearNormalTexture ( )
inline

◆ clearShininessTexture()

void copakond::Material::clearShininessTexture ( )
inline

◆ clearSpecularTexture()

void copakond::Material::clearSpecularTexture ( )
inline

◆ constructor()

void copakond::Material::constructor ( const glm::vec3 & ambient,
const glm::vec3 & diffuse,
const glm::vec3 & specular,
float shininess,
float alpha )
protected

◆ diffuse()

glm::vec3 & copakond::Material::diffuse ( )
inline

◆ diffuseTextureUniform()

GLuint copakond::Material::diffuseTextureUniform ( ) const
inline

◆ getAlpha()

float copakond::Material::getAlpha ( ) const
inline

◆ hasAlphaTexture()

bool copakond::Material::hasAlphaTexture ( ) const
inline

◆ hasDiffuseTexture()

bool copakond::Material::hasDiffuseTexture ( ) const
inline

◆ hasNormalTexture()

bool copakond::Material::hasNormalTexture ( ) const
inline

◆ hasShininessTexture()

bool copakond::Material::hasShininessTexture ( ) const
inline

◆ hasSpecularTexture()

bool copakond::Material::hasSpecularTexture ( ) const
inline

◆ isTextLabel()

bool copakond::Material::isTextLabel ( ) const
inline

◆ normalTextureUniform()

GLuint copakond::Material::normalTextureUniform ( ) const
inline

◆ setAlpha()

void copakond::Material::setAlpha ( float alpha)
inline

◆ setAlphaTexture()

void copakond::Material::setAlphaTexture ( const std::string & textureFile)

◆ setDiffuseTexture()

void copakond::Material::setDiffuseTexture ( const std::string & textureFile,
bool warpTexture = false,
bool mipMap = true )

Loads and binds a diffuse texture map.

Parameters
warpTextureIf true, applies GL_REPEAT wrapping.
mipMapIf true, generates mipmaps.

◆ setIsTextLabel()

void copakond::Material::setIsTextLabel ( bool state)
inline

◆ setNormalTexture()

void copakond::Material::setNormalTexture ( const std::string & textureFile)

◆ setShininessTexture()

void copakond::Material::setShininessTexture ( const std::string & textureFile)

◆ setSpecularTexture()

void copakond::Material::setSpecularTexture ( const std::string & textureFile)

◆ shininess()

float & copakond::Material::shininess ( )
inline

◆ shininessTextureUniform()

GLuint copakond::Material::shininessTextureUniform ( ) const
inline

◆ specular()

glm::vec3 & copakond::Material::specular ( )
inline

◆ specularTextureUniform()

GLuint copakond::Material::specularTextureUniform ( ) const
inline

Member Data Documentation

◆ _alpha

float copakond::Material::_alpha
protected

◆ _alphaTexture

GLuint copakond::Material::_alphaTexture = 0
protected

◆ _ambient

glm::vec3 copakond::Material::_ambient
protected

◆ _diffuse

glm::vec3 copakond::Material::_diffuse
protected

◆ _diffuseTexture

GLuint copakond::Material::_diffuseTexture = 0
protected

◆ _hasAlphaTexture

bool copakond::Material::_hasAlphaTexture
protected

◆ _hasDiffuseTexture

bool copakond::Material::_hasDiffuseTexture
protected

◆ _hasNormalTexture

bool copakond::Material::_hasNormalTexture
protected

◆ _hasShininessTexture

bool copakond::Material::_hasShininessTexture
protected

◆ _hasSpecularTexture

bool copakond::Material::_hasSpecularTexture
protected

◆ _isTextLabel

bool copakond::Material::_isTextLabel = false
protected

Flag to indicate if material is for a text label (changes shader blend logic)

◆ _normalTexture

GLuint copakond::Material::_normalTexture = 0
protected

◆ _shininess

float copakond::Material::_shininess
protected

◆ _shininessTexture

GLuint copakond::Material::_shininessTexture = 0
protected

◆ _specular

glm::vec3 copakond::Material::_specular
protected

◆ _specularTexture

GLuint copakond::Material::_specularTexture = 0
protected

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