src/TransparentShader.h

Go to the documentation of this file.
00001 #ifndef FLATSHADERTRANSPARENT_H
00002 #define FLATSHADERTRANSPARENT_H
00003 
00004 
00005 #include "Shader.h"
00006 #include "Vec3f.h"
00007 #include "Ray.h"
00008 #include "Scene.h"
00009 #include "defines.h"
00010 
00011 
00016 class TransparentShader : public Shader
00017 {
00018 public:
00024     TransparentShader(  Scene *     scene,
00025                         RGBAColor   color = RGBAColor(1.0, 1.0, 1.0))
00026         : Shader(scene),
00027             mColor(color)
00028     {
00029     }
00030 
00033     RGBAColor shade(const Ray & ray) const
00034     {
00035         // look behind this object, no need to transform coordinates
00036         Ray newray = ray;
00037         newray.init(ray.hitPoint(EPSILON), ray.dir());
00038         newray.updateInfluence(ray); // FIXME consider alpha channel of color
00039         return RGBAColor(lerp(mScene->rayTrace(newray).rgb(), mColor.rgb(), mColor.a()));
00040     }
00041 
00042 private:
00044     RGBAColor mColor;
00045 };
00046 
00047 #endif
00048 

Generated on Fri Feb 1 00:01:42 2008 for Grayfall by  doxygen 1.5.1