Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

iarealight.h

Go to the documentation of this file.
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_IAREALIGHT_H
00024 #define TOXIC_RENDERER_IAREALIGHT_H
00025 
00026 #include "common/math/matrix4.h"
00027 #include "common/math/point3.h"
00028 #include "common/math/real.h"
00029 #include "common/math/vector3.h"
00030 #include "color3.h"
00031 #include "globals.h"
00032 #include "iboundedobject.h"
00033 #include "ilight.h"
00034 #include "isurfacesampler.h"
00035 
00036 namespace toxic {
00037 
00038     class Context;
00039     class ISurfaceShader;
00040     class Scene;
00041 
00042     class IAreaLight : public IBoundedObject, public ILight {
00043     public:
00044         //! m is the object space to world space transformation matrix.
00045         IAreaLight(
00046             const sheep::Matrix4 &m,
00047             const ISurfaceShader *surface_shader,
00048             IntersectionMask intersection_mask = INTERSECT_ALL_RAYS
00049         );
00050 
00051         virtual ~IAreaLight() {}
00052 
00053         //! This method must be called only once, after the object is completely
00054         //! configured, and before it is used for the first time.
00055         virtual void Finalize(const Context &context);
00056 
00057         //! Returns the emission power of this object, expressed in W.
00058         virtual const Color3 &GetPower() const;
00059 
00060         virtual Ray GeneratePhotonRay(const Context &context) const;
00061 
00062         //! Computes irradiance due to this light source. The point and the surface normal
00063         //! are both expressed in world space.
00064         virtual void ComputeIrradiance(
00065             const Context &context,
00066             const Scene *scene,
00067             const sheep::Point3 &point,
00068             const sheep::Vector3 &geometric_normal,
00069             const sheep::Vector3 &shading_normal,
00070             const ISurfaceSampler::SampleVector &input,
00071             IrradianceSampleVector *output
00072         ) const;
00073 
00074     protected:
00075         sheep::Real m_surface_area; //!< Cached value of the surface area of this object, expressed in m^2.
00076         Color3 m_power;             //!< Emission power of this object, expressed in W.
00077     };
00078 
00079 #include "iarealight.inl"
00080 
00081 }
00082 
00083 #endif  // !TOXIC_RENDERER_IAREALIGHT_H

Generated on Tue May 11 01:31:50 2004 for toxic by doxygen 1.3.6