00001 /* 00002 * SkyLight.cpp 00003 * 00004 * Part of Fly! Legacy project 00005 * 00006 * Copyright 2003 Chris Wallace 00007 * 00008 * Fly! Legacy 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 * Fly! Legacy 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 Fly! Legacy; if not, write to the Free Software 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 * 00022 */ 00023 00024 #include "../Include/Sky.h" 00025 #include "../Include/Utility.h" 00026 00027 00028 // 00029 // Constructor 00030 // 00031 CSkyLight::CSkyLight (void) 00032 { 00033 } 00034 00035 00036 // 00037 // Initialize lighting tables 00038 // 00039 void CSkyLight::Init (void) 00040 { 00041 } 00042 00043 00044 // 00045 // Update sky lighting attributes 00046 // 00047 void CSkyLight::Update (void) 00048 { 00049 // Define basic colours 00050 GLfloat base_sky[4] = {0.39, 0.50, 0.74, 1.0 }; 00051 GLfloat base_fog[4] = {0.84, 0.87, 1.0, 1.0 }; 00052 00053 // TEMP : Assume sun angle 45 degrees 00054 // sun_angle = PI/2; 00055 // float sun_deg = RadToDeg (sun_angle); 00056 00057 // TEMP : Use constant sky brightness 0.5 00059 float sky_brightness = 0.5; 00060 // float sky_brightness = 0.1; 00061 if (sky_brightness > 1.0) sky_brightness = 1.0; 00062 if (sky_brightness < 0.0) sky_brightness = 0.0; 00063 00064 // Set sky colour 00065 sky_colour[0] = base_sky[0] * sky_brightness; 00066 sky_colour[1] = base_sky[1] * sky_brightness; 00067 sky_colour[2] = base_sky[2] * sky_brightness; 00068 sky_colour[3] = base_sky[3]; 00069 00070 // Set fog colour 00071 fog_colour[0] = base_fog[0] * sky_brightness; 00072 fog_colour[1] = base_fog[1] * sky_brightness; 00073 fog_colour[2] = base_fog[2] * sky_brightness; 00074 fog_colour[3] = base_fog[3]; 00075 } 00076 00077
|
|
Documentation generated by
|