PhongReflection.h

Go to the documentation of this file.
00001 /* $Id: PhongReflection.h,v 1.1 2002/12/05 15:08:03 cvs Exp $ */
00002 
00003 #ifndef __PHONG_REFLECTION_H
00004 #define __PHONG_REFLECTION_H
00005 
00006 #include <gra/reflection/LocalReflection.h>
00007 
00008 /*
00009  * Phong reflection model extends the generic local reflection
00010  * with a global ambient contribution.
00011  * It employs either Phong or Blinn BRDF together with Lambertian diffuse BRDF.
00012  */
00013 
00014 using namespace esg;
00015 
00016 namespace gra {
00017 
00018 class GRA_EXPORT PhongReflection : public LocalReflection {
00019 public:
00020     enum SpecularEval { PHONG, BLINN };
00021     
00022 protected:
00023     Color3f _globalAmbient;
00024 
00025 public:
00026     PhongReflection (Emittance    * e  /* emittance      */ = NULL,
00027                      SpecularEval   s  /* Diffuse eval.  */ = PHONG,
00028                      const Color3f& c  /* global ambient */ = Color3f(0,0,0));
00029 
00030     virtual ~PhongReflection ();
00031     
00032     virtual void setDiffuseBRDF   (DiffuseBRDF*)  {}
00033     virtual void setSpecularBRDF  (SpecularBRDF*) {}
00034     virtual void setGlobalAmbient (const Color3f& c) { _globalAmbient.set(c); }
00035 
00036     /*
00037      * Required input parametters,
00038      * viwerDir() and distance() have to be defined together:
00039      *   PointEnv.intersection()    = point of interest (PoI)
00040      *   PointEnv.normal()          = surface normal at PoI
00041      * [ PointEnv.viewerDir()       = normalized direction from PoI to viewer
00042      *   PointEnv.distance()        = distance between PoI and viewer ]
00043      */
00044     virtual Color3f* illuminatePoint(PointEnv   & /* point of interest  */,
00045                                      MatVisitor & /* intialized visitor */);
00046 };
00047     
00048 } // namespace
00049 
00050 #endif // __PHONG_REFLECTION_H

Generated on Tue Nov 21 15:11:42 2006 for gra by  doxygen 1.4.6