#include <RefractiveShader.h>
Inherits Shader.
Inheritance diagram for RefractiveShader:
Public Member Functions | |
RefractiveShader (Scene *scene, const RGBAColor &color, float refractionIdx) | |
RGBAColor | shade (const Ray &ray) const |
Private Attributes | |
RGBAColor | mColor |
Material color, alpha channel gives shading coefficient per 1 length unit. | |
float | mRefractionIndex |
Refraction index of the material. | |
float | mInvRefractionIndex |
Inverted refraction index of the material. |
Definition at line 17 of file RefractiveShader.h.
Constructor. Alpha channel of material color gives shading coefficient per 1 length unit
scene | Pointer to the scene | |
color | Material color | |
refractionIdx | Refraction index of material, should be in range [0.01, 10] |
Definition at line 13 of file RefractiveShader.cpp.
Trace through the object and refract the ray according to Fresnel's and Snell's laws
Implements Shader.
Definition at line 32 of file RefractiveShader.h.
References RGBAColor::a(), Ray::dir(), Vec3f::dot(), EPSILON, Ray::hit(), Ray::hitPoint(), Ray::influence(), Ray::init(), lerp(), MAX_RECURSION_DEEP, mColor, MIN_INFLUENCE, mInvRefractionIndex, mRefractionIndex, Shader::mScene, Shader::normal(), Ray::obj(), Scene::rayTrace(), Ray::recDeep(), RGBAColor::rgb(), Ray::t(), and Ray::updateInfluence().
RGBAColor RefractiveShader::mColor [private] |
Material color, alpha channel gives shading coefficient per 1 length unit.
Definition at line 122 of file RefractiveShader.h.
Referenced by shade().
float RefractiveShader::mRefractionIndex [private] |
Refraction index of the material.
Definition at line 125 of file RefractiveShader.h.
Referenced by shade().
float RefractiveShader::mInvRefractionIndex [private] |
Inverted refraction index of the material.
Definition at line 128 of file RefractiveShader.h.
Referenced by shade().