GUInity
Public Types | Public Member Functions | List of all members
Material Class Reference

#include <Material.hpp>

Inheritance diagram for Material:
Asset

Public Types

typedef pair< string, shared_ptr< Texture > > StringTexPair
 
typedef pair< string, glm::vec4 > StringVec4Pair
 

Public Member Functions

 Material ()
 
 Material (shared_ptr< Shader > s)
 
virtual ~Material ()
 
void setShader (shared_ptr< Shader > shader)
 
shared_ptr< ShadergetShader () const
 
GLuint getShaderProgram ()
 
bool paramExists (string paramName)
 
void setParamVec4 (string paramName, const glm::vec4 &paramValue)
 
void setParamFloat (string paramName, float paramValue)
 
void setParamTexture (string paramName, shared_ptr< Texture > paramValue)
 
vector< StringTexPair > getAllTextureParams ()
 
vector< StringVec4Pair > getAllVec4Params ()
 
- Public Member Functions inherited from Asset
 Asset ()
 
virtual ~Asset ()
 
void setAssetID (unsigned int newAssetID)
 
unsigned int getAssetID () const
 
string getPath ()
 
void setPath (string newPath)
 
void setName (string name)
 
string getName ()
 
void setCRC (int crc)
 
int setCRC ()
 

Detailed Description

Material is an Asset that allows the same shader to be used several times with different parameters. For example, a Textured Diffuse Shader could be use for both a crate and the floor, the only thing that changes is the Texture.

Currently, the only parameter supported by Shaders and therefore Materials is the Texture type.

Constructor & Destructor Documentation

Material::Material ( )

Default Constructor

Material::Material ( shared_ptr< Shader shader)

Constructor for a Shader

Material::~Material ( )
virtual

Default Destructor. Virtual because inherits from Asset

Member Function Documentation

vector< Material::StringTexPair > Material::getAllTextureParams ( )

Gets all Texture params

vector< Material::StringVec4Pair > Material::getAllVec4Params ( )

Gets all Vec4 params

Gets all Vec3 params

shared_ptr< Shader > Material::getShader ( ) const

shader Getter

GLuint Material::getShaderProgram ( )

Get the shader program

bool Material::paramExists ( string  paramName)

Checks if param exists on params map

void Material::setParamFloat ( string  paramName,
float  paramValue 
)

Set a float param that has name paramName

void Material::setParamTexture ( string  paramName,
shared_ptr< Texture paramValue 
)

Set a Texture param that has name paramName

void Material::setParamVec4 ( string  paramName,
const glm::vec4 &  paramValue 
)

Set a vec4 param that has name paramName

void Material::setShader ( shared_ptr< Shader shader)

shader Setter


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