Light.hh

00001 /**********************************************************************
00002  * blaRAY -- photon mapper/raytracer
00003  * (C) 2008 by Tomasz bla Fortuna <bla@thera.be>, <bla@af.gliwice.pl>
00004  *
00005  * This program is free software: you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation, either version 3 of the License, or
00008  * any later version.
00009  *
00010  * See Docs/LICENSE
00011  *********************/
00012 
00013 #ifndef _LIGHT_H_
00014 #define _LIGHT_H_
00015 
00016 #include <iostream>
00017 #include <string>
00018 
00019 #include "Math/Vector.hh"
00020 #include "World/Color.hh"
00021 
00022 namespace World {
00030         class Light {
00031         protected:
00033                 const Color C;
00034 
00036                 virtual std::string Dump() const = 0;
00037         public:
00039                 Light(const Color &C) : C(C)
00040                 {
00041                 }
00042 
00044                 virtual ~Light() {}
00045 
00047                 inline const Color &GetColor() const {
00048                         return C;
00049                 }
00050 
00052                 friend std::ostream &operator<<(std::ostream &os, const Light &L);
00053         };
00054 
00056         class PointLight : public Light {
00057         protected:
00059                 const Math::Vector Position;
00060 
00061                 virtual std::string Dump() const;
00062         public:
00064                 PointLight(const Math::Vector &Position,
00065                            const Color &C = ColLib::White())
00066                         : Light(C), Position(Position)
00067                 {
00068                 }
00069 
00071                 inline const Math::Vector &GetPosition() const {
00072                         return Position;
00073                 }
00074         };
00075 
00077         class AmbientLight : public Light {
00078         protected:
00079 
00080                 virtual std::string Dump() const;
00081         public:
00083                 AmbientLight(const Color &C = ColLib::Gray())
00084                         : Light(C)
00085                 {
00086                 }
00087         };
00088 }
00089 
00090 #endif

Generated on Wed Mar 12 00:34:58 2008 for blaRAY by  doxygen 1.5.5