Page principale   Liste des namespaces   Hiérarchie des classes   Liste par ordre alphabétique   Liste des composants   Liste des fichiers   Composants   Déclarations  

ExManagerFog.cpp

Aller à la documentation de ce fichier.
00001 /*
00002  * ExNihilo 3D Engine
00003  * 
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (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 Library 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
00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  *
00018  * Please read AUTHORS file !!!
00019  * 
00020  * $Id: ExManagerFog.cpp,v 1.4 2002/06/15 22:40:17 binny Exp $
00021  *
00022  */
00023 
00024 #include "ExManagerFog.h"
00025 
00026 ExManagerFog::ExManagerFog(void)
00027 {
00028 Guard(ExManagerFog::ExManagerFog(void))
00029         Reset();
00030 UnGuard
00031 }
00032 
00033 ExManagerFog::~ExManagerFog(void)
00034 {
00035 Guard(ExManagerFog::~ExManagerFog(void))
00036 UnGuard
00037 }
00038 
00039 void ExManagerFog::Reset(void)
00040 {
00041 Guard(ExManagerFog::Reset(void))
00042         SetAlgo(GL_LINEAR);
00043         SetFogColor(0.2f,0.2f,0.2f,1.0f);
00044         SetStartPoint(50.0f);
00045         SetEndPoint(100.0f);
00046         SetDensity(0.30);
00047         m_State=false;
00048 UnGuard
00049 }
00050 
00051 void ExManagerFog::EnableFog(void)
00052 {
00053 Guard(ExManagerFog::EnableFog(void))
00054         glEnable(GL_FOG);
00055         glFogi(GL_FOG_MODE,m_FogAlgo);//GL_EXP,GL_EXP2,GL_LINEAR
00056         glFogfv(GL_FOG_COLOR,m_FogColor);
00057         glFogf(GL_FOG_DENSITY,m_Density);
00058         glHint(GL_FOG_HINT,GL_DONT_CARE);
00059         glFogf(GL_FOG_START,m_StartPoint);
00060         glFogf(GL_FOG_END,m_EndPoint);
00061         m_State=true;
00062 UnGuard
00063 }
00064 
00065 void ExManagerFog::DisableFog(void)
00066 {
00067 Guard(ExManagerFog::DisableFog(void))
00068         glDisable(GL_FOG);
00069         m_State=false;
00070 UnGuard
00071 }
00072 
00073 
00074 void ExManagerFog::SetFogColor(float R,float G,float B,float A)
00075 {
00076 Guard(ExManagerFog::SetFogColor(float R,float G,float B,float A))
00077         SetFogColorR(R);
00078         SetFogColorG(G);
00079         SetFogColorB(B);
00080         SetFogColorA(A);
00081 UnGuard
00082 }
00083 
00084 void ExManagerFog::SetFogColorR(float R)
00085 {
00086 Guard(ExManagerFog::SetFogColorR(float R))
00087         if(R>1.0f)R=1.0f;
00088         if(R<0.0f)R=0.0f;
00089         m_FogColor[0]=R;
00090         glFogfv(GL_FOG_COLOR,m_FogColor);
00091 UnGuard
00092 }
00093 
00094 void ExManagerFog::SetFogColorG(float G)
00095 {
00096 Guard(ExManagerFog::SetFogColorG(float G))
00097         if(G>1.0f)G=1.0f;
00098         if(G<0.0f)G=0.0f;
00099         m_FogColor[1]=G;
00100         glFogfv(GL_FOG_COLOR,m_FogColor);
00101 UnGuard
00102 }
00103 
00104 void ExManagerFog::SetFogColorB(float B)
00105 {
00106 Guard(ExManagerFog::SetFogColorB(float B))
00107         if(B>1.0f)B=1.0f;
00108         if(B<0.0f)B=0.0f;
00109         m_FogColor[2]=B;
00110         glFogfv(GL_FOG_COLOR,m_FogColor);
00111 UnGuard
00112 }
00113 
00114 void ExManagerFog::SetFogColorA(float A)
00115 {
00116 Guard(ExManagerFog::SetFogColorA(float A))
00117         if(A>1.0f)A=1.0f;
00118         if(A<0.0f)A=0.0f;
00119         m_FogColor[3]=A;
00120         glFogfv(GL_FOG_COLOR,m_FogColor);
00121 UnGuard
00122 }
00123 
00124 void ExManagerFog::IncFogColorR(float inc)
00125 {
00126 Guard(ExManagerFog::IncFogColorR(float inc))
00127         SetFogColorR(GetFogColorR()+inc);
00128 UnGuard
00129 }
00130 
00131 void ExManagerFog::IncFogColorG(float inc)
00132 {
00133 Guard(ExManagerFog::IncFogColorG(float inc))
00134         SetFogColorG(GetFogColorG()+inc);
00135 UnGuard
00136 }
00137 
00138 void ExManagerFog::IncFogColorB(float inc)
00139 {
00140 Guard(ExManagerFog::IncFogColorB(float inc))
00141         SetFogColorB(GetFogColorB()+inc);
00142 UnGuard
00143 }
00144 
00145 void ExManagerFog::IncFogColorA(float inc)
00146 {
00147 Guard(ExManagerFog::IncFogColorA(float inc))
00148         SetFogColorA(GetFogColorA()+inc);
00149 UnGuard
00150 }
00151 
00152 void ExManagerFog::SetStartPoint(float P)
00153 {
00154 Guard(ExManagerFog::SetStartPoint(float P))
00155         m_StartPoint=P;
00156         glFogf(GL_FOG_START,m_StartPoint);
00157 UnGuard
00158 }
00159 
00160 void ExManagerFog::IncStartPoint(float inc)
00161 {
00162 Guard(ExManagerFog::IncStartPoint(float inc))
00163         SetStartPoint(GetStarPoint()+inc);
00164 UnGuard
00165 }
00166 
00167 void ExManagerFog::SetEndPoint(float P)
00168 {
00169 Guard(ExManagerFog::SetEndPoint(float P))
00170         m_EndPoint=P;
00171         glFogf(GL_FOG_END,m_EndPoint);
00172 UnGuard
00173 }
00174 
00175 void ExManagerFog::IncEndPoint(float inc)
00176 {
00177 Guard(ExManagerFog::IncEndPoint(float inc))
00178         SetEndPoint(GetEndPoint()+inc);
00179 UnGuard
00180 }
00181 
00182 void ExManagerFog::SetDensity(float P)
00183 {
00184 Guard(ExManagerFog::SetDensity(float P))
00185         m_Density=P;
00186         glFogf(GL_FOG_DENSITY,m_Density);
00187 UnGuard
00188 }
00189 
00190 void ExManagerFog::IncDensity(float inc)
00191 {
00192 Guard(ExManagerFog::IncDensity(float inc))
00193         SetDensity(GetDensity()+inc);
00194 UnGuard
00195 }
00196 
00197 void ExManagerFog::SetAlgo(GLenum algo)
00198 {
00199 Guard(ExManagerFog::SetAlgo(GLenum algo))
00200         switch(algo)
00201         {
00202                 case GL_LINEAR:
00203                         m_FogAlgo=GL_LINEAR;
00204                         glFogi(GL_FOG_MODE,GL_LINEAR);
00205                         break;
00206                 case GL_EXP:
00207                         m_FogAlgo=GL_EXP;
00208                         glFogi(GL_FOG_MODE,GL_EXP);
00209                         break;
00210                 case GL_EXP2:
00211                         m_FogAlgo=GL_EXP2;
00212                         glFogi(GL_FOG_MODE,GL_EXP2);
00213                         break;
00214                 default :
00215                         m_FogAlgo=GL_LINEAR;
00216                         glFogi(GL_FOG_MODE,GL_LINEAR);
00217                         break;
00218         }
00219 UnGuard
00220 }

Généré le Tue Aug 6 20:25:28 2002 pour ExNihilo par doxygen1.2.17