Shader Class Reference

#include <Shader.h>

Inherited by CombineShader, CookTorranceShader, DebugShader, MirrorShader, PhongShader, ProceduralShader, RefractiveShader, and TransparentShader.

Inheritance diagram for Shader:

Inheritance graph
[legend]
Collaboration diagram for Shader:

Collaboration graph
[legend]
List of all members.

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 Texturetexture (unsigned int i) const
const TexturebumpTexture () const
void setBumpTexture (Texture *tex)
const Vec3f normal (const Ray &ray) const
void setBumpCoefficient (const float f)
float bumpCoefficient () const

Protected Attributes

ScenemScene
 Scene pointer to retrieve data.
std::vector< Texture * > mTextures
 List of textures used in this shader.
TexturemBumpTexture
 Bump Mapping Texture.
float mBumpCoeff
 Bump Mapping coefficient.

Detailed Description

Abstract base class for all shaders. FIXME split textures to TexturedShader

Author:
Christian Engels

Definition at line 18 of file Shader.h.


Constructor & Destructor Documentation

Shader::Shader ( Scene scene  ) 

Constructor

Parameters:
scene a pointer to the scene

Definition at line 11 of file Shader.cpp.

virtual Shader::~Shader (  )  [inline, virtual]

Destructor

Definition at line 29 of file Shader.h.


Member Function Documentation

virtual RGBAColor Shader::shade ( const Ray ray  )  const [pure virtual]

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

Returns the BumpMapping texture

Definition at line 49 of file Shader.cpp.

References mBumpTexture.

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().

const Vec3f Shader::normal ( const Ray ray  )  const

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.


Member Data Documentation

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().


The documentation for this class was generated from the following files:
Generated on Fri Feb 1 00:02:29 2008 for Grayfall by  doxygen 1.5.1