#include <PhongShader.h>
Inherits Shader.
Inheritance diagram for PhongShader:
Public Member Functions | |
PhongShader (Scene *scene, RGBAColor color, float ka, float kd, float ks, float ke) | |
virtual RGBAColor | shade (const Ray &ray) const |
Private Attributes | |
RGBAColor | mColor |
Base color. | |
float | mKa |
Ambient coefficient. | |
float | mKd |
Diffuse reflection coefficient. | |
float | mKs |
Specular refelection coefficient. | |
float | mKe |
Shininess exponent. |
Definition at line 18 of file PhongShader.h.
PhongShader::PhongShader | ( | Scene * | scene, | |
RGBAColor | color, | |||
float | ka, | |||
float | kd, | |||
float | ks, | |||
float | ke | |||
) | [inline] |
Constructor
scene | Pointer to the scene | |
color | Base color | |
ka | Ambient coefficient | |
kd | Diffuse reflection coefficients | |
ks | Specular refelection coefficients | |
ke | Shininess exponent |
Definition at line 30 of file PhongShader.h.
Calculate color and shadows.
Implements Shader.
Definition at line 47 of file PhongShader.h.
References Ray::dir(), RGBAColor::dot(), Vec3f::dot(), EPSILON, Scene::getLight(), Ray::hit(), Ray::hitPoint(), Light::illuminate(), lerp(), Scene::lightsCount(), mColor, mKa, mKd, mKe, mKs, Shader::mScene, Shader::mTextures, Shader::normal(), Light::numberOfRays(), Ray::obj(), RGBAColor::rgb(), RGBAColor::scaled(), Primitive::texCoord(), and Shader::textureCount().
RGBAColor PhongShader::mColor [private] |
float PhongShader::mKa [private] |
float PhongShader::mKd [private] |
Diffuse reflection coefficient.
Definition at line 118 of file PhongShader.h.
Referenced by shade().
float PhongShader::mKs [private] |
Specular refelection coefficient.
Definition at line 121 of file PhongShader.h.
Referenced by shade().
float PhongShader::mKe [private] |