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

perfectspecularbrdf.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_PERFECTSPECULARBRDF_H
00024 #define TOXIC_RENDERER_PERFECTSPECULARBRDF_H
00025 
00026 #include "common/math/real.h"
00027 #include "common/math/vector3.h"
00028 #include "globals.h"
00029 #include "ibdf.h"
00030 
00031 #include <cassert>
00032 
00033 namespace toxic {
00034 
00035     class Context;
00036 
00037     class PerfectSpecularBRDF : public IBRDF {
00038     public:
00039         //! Incoming and outgoing directions are both always expressed in the upper
00040         //! part of the unit hemisphere, and they are always unit-length.
00041 
00042         virtual ~PerfectSpecularBRDF() {}
00043 
00044         virtual PerfectSpecularBRDF *Clone() const;
00045 
00046         virtual bool IsDiffuse() const { return false; }
00047         virtual bool IsSpecular() const { return true; }
00048 
00049         //! Evaluates the function. Both the incoming and outgoing directions are
00050         //! expressed in local space.
00051         virtual sheep::Real Evaluate(
00052             const Context &context,
00053             const sheep::Vector3 &incoming,
00054             const sheep::Vector3 &outgoing) const;
00055 
00056         virtual sheep::Real EvaluateSpecular(
00057             const Context &context,
00058             const sheep::Vector3 &incoming,
00059             sheep::Vector3 *outgoing) const;
00060 
00061         //! Samples the function in order to obtain an outgoing direction, given
00062         //! an incoming direction. The probability with which the direction has
00063         //! been chosen is also computed. Both incoming and outgoing directions
00064         //! are expressed in local space.
00065         virtual void Sample(
00066             const Context &context,
00067             const sheep::Vector3 &incoming,
00068             sheep::Vector3 *outgoing,
00069             sheep::Real *prob,
00070             sheep::Real *value) const;
00071 
00072         //! Computes the probability of scattering from 'incoming' direction to
00073         //! 'outgoing' direction. Both incoming and outgoing directions are
00074         //! expressed in local space.
00075         virtual sheep::Real ComputeScatteringProbability(
00076             const sheep::Vector3 &incoming,
00077             const sheep::Vector3 &outgoing) const;
00078 
00079         //! Computes and returns the hemispherical hemispherical reflectance.
00080         virtual sheep::Real ComputeReflectance(const Context &context) const;
00081 
00082         //! Computes and returns the directional hemispherical reflectance. The
00083         //! incoming direction is expressed in local space.
00084         virtual sheep::Real ComputeReflectance(
00085             const Context &context,
00086             const sheep::Vector3 &incoming) const;
00087     };
00088 
00089 #include "perfectspecularbrdf.inl"
00090 
00091 }
00092 
00093 #endif  // !TOXIC_RENDERER_PERFECTSPECULARBRDF_H

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