src/rcrt/materials/Material.h

Go to the documentation of this file.
00001 #ifndef MATERIAL_H_
00002 #define MATERIAL_H_
00003 
00004 #include "../RGBColor.h"
00005 #include "../math/Vec3D.h"
00006 #include "../Intersection.h"
00007 #include "../textures/ImageTexture.h"
00008 #include "../primitives/Primitive.h"
00009 #include "../gi/Photon.h"
00010 #include <complex>
00011 
00012 namespace rcrt
00013 {
00014 
00015 class Scene;
00016 
00020 class Material
00021 {
00022 protected:
00023         std::complex<float> ior;//the index of refraction
00024         RGBColor absorbance;//encodes both absorptivity and density of absorbers, only relevant for refracting materials
00025         Texture2D* bumpMap;//a bump map
00026         float bumpFactor;//the factor by which to bump
00027         int frame;//the current frame to allow for animated materials
00028         
00029 public:
00035         Material(float iorR=1, float iorI=0, const RGBColor& absorb = RGBColor::BLACK);//standard IOR ~ Vacuum
00036         Material(const std::complex<float>& IOR, const RGBColor& absorb = RGBColor::BLACK);
00037         virtual ~Material();
00038         
00045         virtual RGBColor sample(const Vec3D& wOut, const Vec3D& wInc, Intersection& is) =0;
00046         
00053         virtual RGBColor sampleDiffuse(const Vec3D& wOut, const Vec3D& wInc, Intersection& is) =0;
00054         
00061         virtual RGBColor sampleSpecular(const Vec3D& wOut, const Vec3D& wInc, Intersection& is) =0;
00062         
00068         virtual RGBColor getEmitted(const Vec3D& wOut, Intersection& is) =0;
00069         
00075         virtual ScatterEvent scatterPhoton(Intersection& is, Photon* photon) =0;
00076         
00077         const float& getRealIORPart() const;
00078         const float& getImagIORPart() const;
00079         const std::complex<float> getIOR() const;
00080         virtual bool refracts() const;
00081         virtual bool hasDiffuse() const = 0;
00082         virtual bool hasSpecular() const = 0;
00083         virtual bool hasTransmissive() const = 0;
00084         virtual const RGBColor& getAbsorbance() const;
00085         
00086         virtual Vec3D getShadingNormal(Intersection& is) const;
00087         void setBumpMap(Texture2D* tex);
00088         void setBumpFactor(const float& f);
00089         void setFrame(const int& n);
00090 };
00091 
00092 }
00093 
00094 #endif /*MATERIAL_H_*/

Generated on Thu Jan 31 19:26:19 2008 for RenderingCompetitionRayTracer by  doxygen 1.5.3