00001 /* 00002 toxic - A Global Illumination Renderer 00003 Copyright (C) 2003-2004 Francois Beaune 00004 Contact: http://toxicengine.sourceforge.net/ 00005 00006 This file is part of toxic. 00007 00008 toxic is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 2 of the License, or 00011 (at your option) any later version. 00012 00013 toxic is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with toxic; if not, write to the Free Software 00020 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 */ 00022 00023 #ifndef TOXIC_RENDERER_POINTLIGHT_H 00024 #define TOXIC_RENDERER_POINTLIGHT_H 00025 00026 #include "common/math/matrix4.h" 00027 #include "common/math/point3.h" 00028 #include "common/math/sampling.h" 00029 #include "common/math/vector3.h" 00030 #include "basis.h" 00031 #include "color3.h" 00032 #include "context.h" 00033 #include "globals.h" 00034 #include "ilight.h" 00035 #include "isurfacesampler.h" 00036 #include "ray.h" 00037 #include "utilities.h" 00038 00039 namespace toxic { 00040 00041 class Scene; 00042 00043 //! The point light is located at the origin. 00044 class PointLight : public Basis, public ILight { 00045 public: 00046 //! m is the object space to world space transformation matrix. 00047 PointLight( 00048 const sheep::Matrix4 &m, 00049 const Color3 &power, //!< Power of the light, expressed in W (not W.m^-2!). 00050 bool cast_shadows = true); 00051 00052 //! Returns the emission power of this object, expressed in W. 00053 virtual const Color3 &GetPower() const; 00054 00055 virtual Ray GeneratePhotonRay(const Context &context) const; 00056 00057 //! Computes irradiance due to this light source. The point and the surface normal 00058 //! are both expressed in world space. 00059 virtual void ComputeIrradiance( 00060 const Context &context, 00061 const Scene *scene, 00062 const sheep::Point3 &point, 00063 const sheep::Vector3 &geometric_normal, 00064 const sheep::Vector3 &shading_normal, 00065 const ISurfaceSampler::SampleVector &/*input*/, //!< Not used. 00066 IrradianceSampleVector *output 00067 ) const; 00068 00069 private: 00070 sheep::Point3 m_origin; //!< Location of the point light in world space. 00071 Color3 m_power; //!< Emission power of the light, expressed in W. 00072 Color3 m_scaled_power; //!< m_scaled_power = m_power / (4.0 * PI) 00073 }; 00074 00075 #include "pointlight.inl" 00076 00077 } 00078 00079 #endif // !TOXIC_RENDERER_POINTLIGHT_H
1.3.6