Tucano  0.1
A library for rapid prototyping with modern OpenGL and GLSL
Tucano::Effects::Phong Class Reference

Renders a mesh using a Phong shader. More...

#include <phongshader.hpp>

Inheritance diagram for Tucano::Effects::Phong:
Tucano::Effect

Public Member Functions

 Phong (void)
 Default constructor. More...
 
virtual void initialize (void)
 Load and initialize shaders. More...
 
void setDefaultColor (const Eigen::Vector4f &color)
 Sets the default color, usually used for meshes without color attribute. More...
 
void setAmbientCoeff (float value)
 Set ambient coefficient. More...
 
void setDiffuseCoeff (float value)
 Set diffuse coefficient. More...
 
void setSpecularCoeff (float value)
 Set specular coefficient. More...
 
void setShininessCoeff (float value)
 Set shininess exponent. More...
 
float getDiffuseCoeff (void)
 
float getAmbientCoeff (void)
 
float getSpecularCoeff (void)
 
float getShininessCoeff (void)
 
void render (Tucano::Mesh &mesh, const Tucano::Camera &camera, const Tucano::Camera &lightTrackball)
 Render the mesh given a camera and light, using a Phong shader. More...
 
- Public Member Functions inherited from Tucano::Effect
 Effect (string shadersDir="shaders/")
 Default constructor. More...
 
virtual ShaderloadShader (string shader_name)
 Loads a shader by filename, initializes it, and inserts in shaders list. More...
 
virtual void loadShader (Shader &shader, string shader_name)
 
virtual ShaderloadShader (string shader_name, string vertex_name, string frag_name, string geom_name)
 Loads a shader by complete filenames (with extensions), initializes it, and inserts in shaders list. More...
 
void setShadersDir (string dir)
 
virtual void reloadShaders (void)
 Reloads all shaders needed for effect usage. More...
 

Private Attributes

Tucano::Shader phong_shader
 Phong Shader. More...
 
Eigen::Vector4f default_color = Eigen::Vector4f (0.7, 0.7, 0.7, 1.0)
 Default color. More...
 
float ka = 0.5
 Ambient coefficient. More...
 
float kd = 0.8
 Diffuse coefficient. More...
 
float ks = 0.5
 Specular coefficient. More...
 
float shininess = 10
 Shininess. More...
 

Additional Inherited Members

- Protected Attributes inherited from Tucano::Effect
std::vector< Shader * > shaders_list
 Vector of pointers to shaders used in this effect, in case the user needs multiple pass rendering. More...
 
string shaders_dir
 Directory in which the shader files are stored. More...
 

Detailed Description

Renders a mesh using a Phong shader.

Constructor & Destructor Documentation

Tucano::Effects::Phong::Phong ( void  )
inline

Default constructor.

Member Function Documentation

float Tucano::Effects::Phong::getAmbientCoeff ( void  )
inline
float Tucano::Effects::Phong::getDiffuseCoeff ( void  )
inline
float Tucano::Effects::Phong::getShininessCoeff ( void  )
inline
float Tucano::Effects::Phong::getSpecularCoeff ( void  )
inline
virtual void Tucano::Effects::Phong::initialize ( void  )
inlinevirtual

Load and initialize shaders.

Implements Tucano::Effect.

void Tucano::Effects::Phong::render ( Tucano::Mesh mesh,
const Tucano::Camera camera,
const Tucano::Camera lightTrackball 
)
inline

Render the mesh given a camera and light, using a Phong shader.

*

Parameters
meshGiven mesh
cameraGiven camera
lightTrackballGiven light camera
void Tucano::Effects::Phong::setAmbientCoeff ( float  value)
inline

Set ambient coefficient.

Parameters
valueNew ambient coeff (ka)
void Tucano::Effects::Phong::setDefaultColor ( const Eigen::Vector4f &  color)
inline

Sets the default color, usually used for meshes without color attribute.

void Tucano::Effects::Phong::setDiffuseCoeff ( float  value)
inline

Set diffuse coefficient.

Parameters
valueNew diffuse coeff (kd)
void Tucano::Effects::Phong::setShininessCoeff ( float  value)
inline

Set shininess exponent.

Parameters
Newshininess coeff (shininess)
void Tucano::Effects::Phong::setSpecularCoeff ( float  value)
inline

Set specular coefficient.

Parameters
Newspecular coeff (ks)

Member Data Documentation

Eigen::Vector4f Tucano::Effects::Phong::default_color = Eigen::Vector4f (0.7, 0.7, 0.7, 1.0)
private

Default color.

float Tucano::Effects::Phong::ka = 0.5
private

Ambient coefficient.

float Tucano::Effects::Phong::kd = 0.8
private

Diffuse coefficient.

float Tucano::Effects::Phong::ks = 0.5
private

Specular coefficient.

Tucano::Shader Tucano::Effects::Phong::phong_shader
private
float Tucano::Effects::Phong::shininess = 10
private

Shininess.


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