Blender V2.61 - r43446

sunsky.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * Contributor(s): zaghaghi
00019  * 
00020  * ***** END GPL LICENSE BLOCK *****
00021  */
00022 
00032 #ifndef SUNSKY_H_
00033 #define SUNSKY_H_
00034 
00035 #define SPECTRUM_MAX_COMPONENTS     100
00036 #define SPECTRUM_START              350.0
00037 #define SPECTRUM_END                800.0
00038 
00039 typedef struct SunSky
00040 {
00041     short effect_type, skyblendtype, sky_colorspace;
00042     float turbidity;
00043     float theta, phi;
00044     
00045     float toSun[3];
00046 
00047     /*float sunSpectralRaddata[SPECTRUM_MAX_COMPONENTS];*/
00048     float sunSolidAngle;
00049 
00050     float zenith_Y, zenith_x, zenith_y;
00051     
00052     float perez_Y[5], perez_x[5], perez_y[5];
00053 
00054     /* suggested by glome in 
00055      * http://projects.blender.org/tracker/?func=detail&atid=127&aid=8063&group_id=9*/
00056     float horizon_brightness;
00057     float spread;
00058     float sun_brightness;
00059     float sun_size;
00060     float backscattered_light;
00061     float skyblendfac;
00062     float sky_exposure;
00063     
00064     float atm_HGg;
00065 
00066     float atm_SunIntensity;
00067     float atm_InscatteringMultiplier;
00068     float atm_ExtinctionMultiplier;
00069     float atm_BetaRayMultiplier;
00070     float atm_BetaMieMultiplier;
00071     float atm_DistanceMultiplier;
00072 
00073     float atm_BetaRay[3];
00074     float atm_BetaDashRay[3];
00075     float atm_BetaMie[3];
00076     float atm_BetaDashMie[3];
00077     float atm_BetaRM[3];
00078 }SunSky;
00079 
00093 void InitSunSky(struct SunSky *sunsky, float turb, float *toSun, float horizon_brightness, 
00094                 float spread,float sun_brightness, float sun_size, float back_scatter,
00095                 float skyblendfac, short skyblendtype, float sky_exposure, float sky_colorspace);
00096 
00106 void GetSkyXYZRadiance(struct SunSky* sunsky, float theta, float phi, float color_out[3]);
00107 
00116 void GetSkyXYZRadiancef(struct SunSky* sunsky, const float varg[3], float color_out[3]);
00117 
00130 void InitAtmosphere(struct SunSky *sunSky, float sun_intens, float mief, float rayf, float inscattf, float extincf, float disf);
00131 
00141 void AtmospherePixleShader( struct SunSky* sunSky, float view[3], float s, float rgb[3]);
00142 
00147 void ClipColor(float c[3]);
00148 
00149 #endif /*SUNSKY_H_*/