CookTorranceShader Class Reference

#include <CookTorranceShader.h>

Inherits Shader.

Inheritance diagram for CookTorranceShader:

Inheritance graph
[legend]
Collaboration diagram for CookTorranceShader:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 CookTorranceShader (Scene *scene, RGBAColor color, float ka, float kd, float ks, float slope=0.12f, float lambda=0.2f)
virtual RGBAColor shade (const Ray &ray) const

Private Member Functions

const float distribution (const Vec3f &normal, const Vec3f &Halfway) const
const float geometry (const Vec3f &normal, const Vec3f &Halfway, const Vec3f &LightDir, const Vec3f &ViewDir) const
const float fresnel (const Vec3f &Halfway, const Vec3f &LightDir) const

Private Attributes

RGBAColor mColor
float mKa
float mKd
float mKs
float mSlope
float mLambda

Detailed Description

Physical based shader developed by Cook and Torrance
Author:
Christian Engels

Definition at line 9 of file CookTorranceShader.h.


Constructor & Destructor Documentation

CookTorranceShader::CookTorranceShader ( Scene scene,
RGBAColor  color,
float  ka,
float  kd,
float  ks,
float  slope = 0.12f,
float  lambda = 0.2f 
) [inline]

Constructor

Parameters:
scene Pointer to the scene
color Base color
ka Ambient coefficient
kd Diffuse reflection coefficients
ks Specular refelection coefficients
slope The slope of the microfasets (if m is small more directed reflection)
lambda Complex index of refraction

Definition at line 22 of file CookTorranceShader.h.


Member Function Documentation

virtual RGBAColor CookTorranceShader::shade ( const Ray ray  )  const [inline, virtual]

Calculate color and shadows

Implements Shader.

Definition at line 41 of file CookTorranceShader.h.

References Ray::dir(), distribution(), Vec3f::dot(), fresnel(), geometry(), Scene::getLight(), Ray::hit(), Light::illuminate(), Scene::lightsCount(), LOG, mColor, mKa, mKd, mKs, Shader::mScene, Shader::mTextures, Shader::normal(), Light::numberOfRays(), Ray::org(), RGBAColor::rgb(), RGBAColor::scale(), Vec3f::scaled(), Ray::t(), and Primitive::texCoord().

const float CookTorranceShader::distribution ( const Vec3f normal,
const Vec3f Halfway 
) const [inline, private]

Calculate the distribution part of the formula

Definition at line 108 of file CookTorranceShader.h.

References Vec3f::dot(), mSlope, and Shader::normal().

Referenced by shade().

const float CookTorranceShader::geometry ( const Vec3f normal,
const Vec3f Halfway,
const Vec3f LightDir,
const Vec3f ViewDir 
) const [inline, private]

Calculate the geometry term

Definition at line 118 of file CookTorranceShader.h.

References Vec3f::dot(), min(), and Shader::normal().

Referenced by shade().

const float CookTorranceShader::fresnel ( const Vec3f Halfway,
const Vec3f LightDir 
) const [inline, private]

Calculate the fresnel term

Definition at line 127 of file CookTorranceShader.h.

References Vec3f::dot(), and mLambda.

Referenced by shade().


Member Data Documentation

RGBAColor CookTorranceShader::mColor [private]

Definition at line 150 of file CookTorranceShader.h.

Referenced by shade().

float CookTorranceShader::mKa [private]

Definition at line 151 of file CookTorranceShader.h.

Referenced by shade().

float CookTorranceShader::mKd [private]

Definition at line 152 of file CookTorranceShader.h.

Referenced by shade().

float CookTorranceShader::mKs [private]

Definition at line 153 of file CookTorranceShader.h.

Referenced by shade().

float CookTorranceShader::mSlope [private]

Definition at line 154 of file CookTorranceShader.h.

Referenced by distribution().

float CookTorranceShader::mLambda [private]

Definition at line 155 of file CookTorranceShader.h.

Referenced by fresnel().


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