#include <Shader.h>
Inherited by CombineShader, CookTorranceShader, DebugShader, MirrorShader, PhongShader, ProceduralShader, RefractiveShader, and TransparentShader.
Inheritance diagram for Shader:
Public Member Functions | |
Shader (Scene *scene) | |
virtual | ~Shader () |
virtual RGBAColor | shade (const Ray &ray) const=0 |
unsigned int | textureCount () const |
void | addTexture (Texture *tex) |
void | removeTexture (Texture *tex) |
const Texture * | texture (unsigned int i) const |
const Texture * | bumpTexture () const |
void | setBumpTexture (Texture *tex) |
const Vec3f | normal (const Ray &ray) const |
void | setBumpCoefficient (const float f) |
float | bumpCoefficient () const |
Protected Attributes | |
Scene * | mScene |
Scene pointer to retrieve data. | |
std::vector< Texture * > | mTextures |
List of textures used in this shader. | |
Texture * | mBumpTexture |
Bump Mapping Texture. | |
float | mBumpCoeff |
Bump Mapping coefficient. |
Definition at line 18 of file Shader.h.
Shader::Shader | ( | Scene * | scene | ) |
Calculate color of the hit point
Implemented in CloudShader, CombineShader, CookTorranceShader, DebugShader, MirrorShader, PhongShader, RefractiveShader, TransparentShader, and WoodShader.
Referenced by Primitive::shade().
unsigned int Shader::textureCount | ( | ) | const |
Get number of textures used by the shader
Definition at line 20 of file Shader.cpp.
References mTextures.
Referenced by PhongShader::shade(), DebugShader::shade(), CombineShader::shade(), and texture().
void Shader::addTexture | ( | Texture * | tex | ) |
Add new texture to the shader
Definition at line 25 of file Shader.cpp.
References mTextures.
Referenced by CombineShaderFactory::create(), CookTorranceShaderFactory::create(), and PhongShaderFactory::create().
void Shader::removeTexture | ( | Texture * | tex | ) |
Remove texture from the shader (Note: Pointer is not deleted)
Definition at line 31 of file Shader.cpp.
References mTextures.
const Texture * Shader::texture | ( | unsigned int | i | ) | const |
Get texture according to the index (start from 0)
Definition at line 42 of file Shader.cpp.
References mTextures, and textureCount().
Referenced by DebugShader::shade().
const Texture * Shader::bumpTexture | ( | ) | const |
void Shader::setBumpTexture | ( | Texture * | tex | ) |
sets the BumpMapping texture
Definition at line 55 of file Shader.cpp.
References mBumpTexture.
Referenced by RefractiveShaderFactory::create(), CookTorranceShaderFactory::create(), PhongShaderFactory::create(), MirrorShaderFactory::create(), WoodShaderFactory::create(), and CloudShaderFactory::create().
Get normal for the right object considering Bump Mapping if a bumptexture is set
Definition at line 60 of file Shader.cpp.
References Primitive::axes(), Ray::hit(), mBumpCoeff, mBumpTexture, Vec3f::normal(), Primitive::normal(), RGBAColor::r(), Texture::resX(), Texture::resY(), Primitive::texCoord(), Texture::texel(), TexCoordinate::x(), and TexCoordinate::y().
Referenced by CookTorranceShader::distribution(), CookTorranceShader::geometry(), RefractiveShader::shade(), PhongShader::shade(), MirrorShader::shade(), and CookTorranceShader::shade().
void Shader::setBumpCoefficient | ( | const float | f | ) | [inline] |
Set the bump mapping coefficient which says how strong the bump mapping should be applied
Definition at line 68 of file Shader.h.
References mBumpCoeff.
Referenced by RefractiveShaderFactory::create(), CookTorranceShaderFactory::create(), PhongShaderFactory::create(), MirrorShaderFactory::create(), WoodShaderFactory::create(), and CloudShaderFactory::create().
float Shader::bumpCoefficient | ( | ) | const [inline] |
returns the bump mapping coefficient, which says how strong the bump mapping should be applied
Definition at line 75 of file Shader.h.
References mBumpCoeff.
Scene* Shader::mScene [protected] |
Scene pointer to retrieve data.
Definition at line 82 of file Shader.h.
Referenced by TransparentShader::shade(), RefractiveShader::shade(), PhongShader::shade(), MirrorShader::shade(), and CookTorranceShader::shade().
std::vector<Texture *> Shader::mTextures [protected] |
List of textures used in this shader.
Definition at line 85 of file Shader.h.
Referenced by addTexture(), removeTexture(), PhongShader::shade(), CookTorranceShader::shade(), CombineShader::shade(), texture(), and textureCount().
Texture* Shader::mBumpTexture [protected] |
Bump Mapping Texture.
Definition at line 88 of file Shader.h.
Referenced by bumpTexture(), normal(), and setBumpTexture().
float Shader::mBumpCoeff [protected] |
Bump Mapping coefficient.
Definition at line 91 of file Shader.h.
Referenced by bumpCoefficient(), normal(), and setBumpCoefficient().