v3_shaded.hpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
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
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
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