Material Class Reference

#include <Material.h>

Collaboration diagram for Material:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Material ()
 ~Material ()
void texSetup ()
 set up the textures for this material
void surfaceSetup ()
 set up the surface parameters for this material
unsigned int getLayerSize ()
 get the number of layers used
void use ()
 use this material, called before a draw to setup this material
void bindTexture (unsigned short texLayer, cvrIndex texRefId, short tex_type)
 bind texture to a specific layer of this material
void bindTexture (cvrIndex texRefId)
 bind texture to last layer
void addLayer (unsigned short texLayer)
 add a texture layer (specific)
unsigned short addLayer ()
 add a texture layer
void setAmbient (const RGBA &ambient_in)
 set ambient color
void setDiffuse (const RGBA &diffuse_in)
 set diffuse color
void setSpecular (const RGBA &specular_in)
 set specular color
void setColor (const RGBA &color_in)
 set color
void setShininess (float shininess_in)
 set shininess, 0.0 .. 128.0
void set (const RGBA &ambient_in, const RGBA &diffuse_in, const RGBA &specular_in, const RGBA &color_in, float shininess_in)
 set all the above values at once
void setSidedness (unsigned short sidedness_in)
 set whether to show front, back or both sides of faces with this material
void setMaxSmooth (float max_smooth_in)
 set the maximum smoothing angle for the calculation of normals
bool hasMask ()
 has a transparency mask
void setReflective (float ref)
 set reflectivity (environment map) application amount (0.0 - 1.0)
void colorMask (bool cmask_in)
 set Material as transparent with black color mask
bool loadProgram (const char *vp, const char *fp)
bool loadProgramFile (const char *vf, const char *ff)
bool hasProgram ()
void useProgram ()
void setupProgram ()
void clearProgram ()

Static Public Member Functions

static cvrIndex create ()
 create a material and return a global material reference ID
static cvrIndex create (std::string mat_name)
 create a material and return a global material reference ID
static void use (cvrIndex matNum)
 use a global id, convenience routine for calling Material::materials[matNum].use();
static MaterialgetMaterial (cvrIndex matNum)
 Get a reference to a given material ID.
static MaterialgetMaterial (std::string mat_name)
static cvrIndex getMaterialId (std::string mat_name)
static void clear ()
 clear all materials

Public Attributes

RGBA ambient
RGBA diffuse
RGBA specular
RGBA color
unsigned long shader_mask
float reflectivity
bool color_mask
float shininess
unsigned short sidedness
float max_smooth
bool cached
unsigned int dList
std::vector< MaterialLayerlayer

Static Public Attributes

static std::vector< Materialmaterials
 global materials list, generate a global reference using the create() functions
static std::map< std::string,
cvrIndex, string_less
nameref
 name to global id reference, string map, nameref[name] will give you an ID

Static Private Member Functions

static void createNull ()

Private Attributes

GLShader program

Static Private Attributes

static MaterialInit initializer = MaterialInit()

Friends

class MaterialInit


Constructor & Destructor Documentation

Material::Material (  ) 

Material::~Material (  ) 


Member Function Documentation

void Material::createNull (  )  [static, private]

Here is the call graph for this function:

cvrIndex Material::create (  )  [static]

create a material and return a global material reference ID

cvrIndex Material::create ( std::string  mat_name  )  [static]

create a material and return a global material reference ID

Here is the call graph for this function:

void Material::use ( cvrIndex  matNum  )  [static]

use a global id, convenience routine for calling Material::materials[matNum].use();

Material & Material::getMaterial ( cvrIndex  matNum  )  [static]

Get a reference to a given material ID.

Material & Material::getMaterial ( std::string  mat_name  )  [static]

cvrIndex Material::getMaterialId ( std::string  mat_name  )  [static]

void Material::clear (  )  [static]

clear all materials

void Material::texSetup (  ) 

set up the textures for this material

Here is the call graph for this function:

void Material::surfaceSetup (  ) 

set up the surface parameters for this material

hasParallax = needs binormal/tangent for parallax

unsigned int Material::getLayerSize (  ) 

get the number of layers used

void Material::use (  ) 

use this material, called before a draw to setup this material

Here is the call graph for this function:

void Material::bindTexture ( unsigned short  texLayer,
cvrIndex  texRefId,
short  tex_type 
)

bind texture to a specific layer of this material

Here is the call graph for this function:

void Material::bindTexture ( cvrIndex  texRefId  ) 

bind texture to last layer

Here is the call graph for this function:

void Material::addLayer ( unsigned short  texLayer  ) 

add a texture layer (specific)

unsigned short Material::addLayer (  ) 

add a texture layer

void Material::setAmbient ( const RGBA ambient_in  ) 

set ambient color

void Material::setDiffuse ( const RGBA diffuse_in  ) 

set diffuse color

void Material::setSpecular ( const RGBA specular_in  ) 

set specular color

void Material::setColor ( const RGBA color_in  ) 

set color

void Material::setShininess ( float  shininess_in  ) 

set shininess, 0.0 .. 128.0

void Material::set ( const RGBA ambient_in,
const RGBA diffuse_in,
const RGBA specular_in,
const RGBA color_in,
float  shininess_in 
)

set all the above values at once

Here is the call graph for this function:

void Material::setSidedness ( unsigned short  sidedness_in  ) 

set whether to show front, back or both sides of faces with this material

void Material::setMaxSmooth ( float  max_smooth_in  ) 

set the maximum smoothing angle for the calculation of normals

bool Material::hasMask (  ) 

has a transparency mask

void Material::setReflective ( float  ref  ) 

set reflectivity (environment map) application amount (0.0 - 1.0)

void Material::colorMask ( bool  cmask_in  ) 

set Material as transparent with black color mask

bool Material::loadProgram ( const char *  vp,
const char *  fp 
)

Here is the call graph for this function:

bool Material::loadProgramFile ( const char *  vf,
const char *  ff 
)

Here is the call graph for this function:

bool Material::hasProgram (  ) 

Here is the call graph for this function:

void Material::useProgram (  ) 

Here is the call graph for this function:

void Material::setupProgram (  ) 

Here is the call graph for this function:

void Material::clearProgram (  ) 

Here is the call graph for this function:


Friends And Related Function Documentation

friend class MaterialInit [friend]


Member Data Documentation

IMPEXP MaterialInit Material::initializer = MaterialInit() [static, private]

unsigned long Material::shader_mask

unsigned short Material::sidedness

unsigned int Material::dList

std::vector< Material > Material::materials [static]

global materials list, generate a global reference using the create() functions

std::map< std::string, cvrIndex, string_less > Material::nameref [static]

name to global id reference, string map, nameref[name] will give you an ID


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

Generated on Thu Mar 19 19:35:26 2009 for CubicVR by  doxygen 1.5.6