v3_shaded.hpp

Go to the documentation of this file.
00001 /*
00002 **    TP 4ETI CPE Lyon
00003 **    Copyright (C) 2011 Damien Rohmer
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 **    (at your option) any later version.
00009 **
00010 **   This program is distributed in the hope that it will be useful,
00011 **    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 **    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 **    GNU General Public License for more details.
00014 **
00015 **    You should have received a copy of the GNU General Public License
00016 **    along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017 */
00018 
00019 #ifndef _V3D_SHADED_HPP_
00020 #define _V3D_SHADED_HPP_
00021 
00022 #include <v3.hpp>
00023 #include <color.hpp>
00024 
00025 namespace cpe
00026 {
00027     struct shading_parameters;
00028     struct light_parameters;
00029 
00030 
00032     class v3_shaded : public v3
00033     {
00034     public:
00035 
00036         // ********************************************* //
00037         // ********************************************* //
00038         //  CONSTRUCTORS
00039         // ********************************************* //
00040         // ********************************************* //
00041 
00043         v3_shaded();
00045         v3_shaded(const double& x,const double& y,const double& z);
00047         v3_shaded(const v3& x);
00048 
00049         // ********************************************* //
00050         // ********************************************* //
00051         //  SHADING COMPUTATION
00052         // ********************************************* //
00053         // ********************************************* //
00054 
00061         color shading(const color& c,const v3& normal,const shading_parameters& shading,const light_parameters& light) const;
00062 
00063     };
00064 
00065 
00067     struct shading_parameters
00068     {
00070         shading_parameters(const double& _ambiant,const double& _diffuse,const double& _specular,const double& _specular_exponent)
00071             :ambiant(_ambiant),diffuse(_diffuse),specular(_specular),specular_exponent(_specular_exponent){}
00072 
00074         double ambiant;
00076         double diffuse;
00078         double specular;
00080         double specular_exponent;
00081     };
00082 
00084     struct light_parameters
00085     {
00087         light_parameters(const v3& _light_position)
00088             :light_position(_light_position){}
00089 
00091         v3 light_position;
00092     };
00093 }
00094 
00095 #endif
00096 
00097 
Generated on Mon Apr 18 20:43:30 2011 by  doxygen 1.6.3