Main Page Namespace List Class Hierarchy Alphabetical List Data Structures File List Namespace Members Data Fields Globals

# ExManagerFog Class Reference

`#include <ExManagerFog.h>`

Inheritance diagram for ExManagerFog:

## Public Methods
void | Reset (void)
void | Init (void)
ExCAction | InputCommand (ExCCommand Command)
ExCAction | InputAction (ExCAction Action)
void | EnableFog (void)
void | DisableFog (void)
bool | GetState (void)
void | SetFogColor (float R, float G, float B, float A)
void | SetFogColorR (float R)
float | GetFogColorR (void)
void | IncFogColorR (float inc)
void | SetFogColorG (float G)
float | GetFogColorG (void)
void | IncFogColorG (float inc)
void | SetFogColorB (float B)
float | GetFogColorB (void)
void | IncFogColorB (float inc)
void | SetFogColorA (float A)
float | GetFogColorA (void)
void | IncFogColorA (float inc)
void | SetStartPoint (float P)
float | GetStarPoint (void)
void | IncStartPoint (float inc)
void | SetEndPoint (float P)
float | GetEndPoint (void)
void | IncEndPoint (float inc)
void | SetDensity (float P)
float | GetDensity (void)
void | IncDensity (float inc)
GLenum | GetAlgo (void)
void | SetAlgo (GLenum algo)
## Static Public Methods
ExManagerFog * | CreateSingleton (void)
## Private Methods
| ExManagerFog (void)
| ~ExManagerFog (void)
## Private Attributes
GLfloat | m_FogColor [4]
GLfloat | m_StartPoint
GLfloat | m_EndPoint
GLfloat | m_Density
GLenum | m_FogAlgo
bool | m_State
## Static Private Attributes
bool | m_flag = false
ExManagerFog * | m_instance = NULL

## Constructor & Destructor Documentation

ExManagerFog | ( | void |  | ) | `[private]`

| Definition at line 43 of file ExManagerFog.cpp. References ExManagerFog(), Guard, and Reset(). Referenced by ExManagerFog(), and ~ExManagerFog().
    00044 {
    00045 Guard(ExManagerFog::ExManagerFog(void))
    00046         Reset();
    00047 UnGuard
    00048 }

~ExManagerFog | ( | void |  | ) | `[private]`

| Definition at line 50 of file ExManagerFog.cpp. References ExManagerFog(), and Guard.
    00051 {
    00052 Guard(ExManagerFog::~ExManagerFog(void))
    00053 UnGuard
    00054 }

## Member Function Documentation

ExManagerFog * CreateSingleton | ( | void |  | ) | `[static]`

| Definition at line 29 of file ExManagerFog.cpp. References CreateSingleton(), Guard, m_flag, and m_instance. Referenced by CreateSingleton(), and main().
    00029                                                {
    00030 Guard(ExManagerFog* ExManagerFog::CreateSingleton(void))
    00031         if(!m_flag)
    00032         {
    00033                 m_flag = true; // We are creating the error log now, so set flag to true
    00034                 m_instance = new ExManagerFog; // Create the error log
    00035         }else
    00036         {
    00037                 std::cout<<"Error singleton already created"<<std::endl;
    00038         }
    00039         return m_instance;
    00040 UnGuard
    00041 }

void DisableFog | ( | void |  | ) |

| Definition at line 83 of file ExManagerFog.cpp. References DisableFog(), Guard, and m_State. Referenced by DisableFog(), InputAction(), and Reset().
    00084 {
    00085 Guard(ExManagerFog::DisableFog(void))
    00086         glDisable(GL_FOG);
    00087         m_State=false;
    00088 UnGuard
    00089 }

void EnableFog | ( | void |  | ) |

| Definition at line 69 of file ExManagerFog.cpp. References EnableFog(), Guard, m_Density, m_EndPoint, m_FogAlgo, m_FogColor, m_StartPoint, and m_State. Referenced by EnableFog(), and InputAction().
    00070 {
    00071 Guard(ExManagerFog::EnableFog(void))
    00072         glEnable(GL_FOG);
    00073         glFogi(GL_FOG_MODE,m_FogAlgo);//GL_EXP,GL_EXP2,GL_LINEAR
    00074         glFogfv(GL_FOG_COLOR,m_FogColor);
    00075         glFogf(GL_FOG_DENSITY,m_Density);
    00076         glHint(GL_FOG_HINT,GL_DONT_CARE);
    00077         glFogf(GL_FOG_START,m_StartPoint);
    00078         glFogf(GL_FOG_END,m_EndPoint);
    00079         m_State=true;
    00080 UnGuard
    00081 }

GLenum GetAlgo | ( | void |  | ) | `[inline]`

| Definition at line 122 of file ExManagerFog.h. References m_FogAlgo.
    00123 {return m_FogAlgo;}

float GetDensity | ( | void |  | ) | `[inline]`

| Definition at line 119 of file ExManagerFog.h. References m_Density. Referenced by IncDensity().
    00120 {return m_Density;}

float GetEndPoint | ( | void |  | ) | `[inline]`

| Definition at line 115 of file ExManagerFog.h. References m_EndPoint. Referenced by IncEndPoint().
    00116 {return m_EndPoint;}

float GetFogColorA | ( | void |  | ) | `[inline]`

| Definition at line 107 of file ExManagerFog.h. References A, and m_FogColor. Referenced by IncFogColorA().
    00108 {return m_FogColor[3];}

float GetFogColorB | ( | void |  | ) | `[inline]`

| Definition at line 104 of file ExManagerFog.h. References B, and m_FogColor. Referenced by IncFogColorB().
    00105 {return m_FogColor[2];}

float GetFogColorG | ( | void |  | ) | `[inline]`

| Definition at line 101 of file ExManagerFog.h. References m_FogColor. Referenced by IncFogColorG().
    00102 {return m_FogColor[1];}

float GetFogColorR | ( | void |  | ) | `[inline]`

| Definition at line 98 of file ExManagerFog.h. References m_FogColor. Referenced by IncFogColorR().
    00099 {return m_FogColor[0];}

float GetStarPoint | ( | void |  | ) | `[inline]`

| Definition at line 111 of file ExManagerFog.h. References m_StartPoint. Referenced by IncStartPoint().
    00112 {return m_StartPoint;}

bool GetState | ( | void |  | ) | `[inline]`

| Definition at line 94 of file ExManagerFog.h. References m_State.
    00095 {return m_State;}

void IncDensity | ( | float | inc | ) |

| Definition at line 208 of file ExManagerFog.cpp. References GetDensity(), Guard, IncDensity(), and SetDensity(). Referenced by IncDensity().
    00209 {
    00210 Guard(ExManagerFog::IncDensity(float inc))
    00211         SetDensity(GetDensity()+inc);
    00212 UnGuard
    00213 }

void IncEndPoint | ( | float | inc | ) |

| Definition at line 193 of file ExManagerFog.cpp. References GetEndPoint(), Guard, IncEndPoint(), and SetEndPoint(). Referenced by IncEndPoint().
    00194 {
    00195 Guard(ExManagerFog::IncEndPoint(float inc))
    00196         SetEndPoint(GetEndPoint()+inc);
    00197 UnGuard
    00198 }

void IncFogColorA | ( | float | inc | ) |

| Definition at line 163 of file ExManagerFog.cpp. References GetFogColorA(), Guard, IncFogColorA(), and SetFogColorA(). Referenced by IncFogColorA().
    00164 {
    00165 Guard(ExManagerFog::IncFogColorA(float inc))
    00166         SetFogColorA(GetFogColorA()+inc);
    00167 UnGuard
    00168 }

void IncFogColorB | ( | float | inc | ) |

| Definition at line 156 of file ExManagerFog.cpp. References GetFogColorB(), Guard, IncFogColorB(), and SetFogColorB(). Referenced by IncFogColorB().
    00157 {
    00158 Guard(ExManagerFog::IncFogColorB(float inc))
    00159         SetFogColorB(GetFogColorB()+inc);
    00160 UnGuard
    00161 }

void IncFogColorG | ( | float | inc | ) |

| Definition at line 149 of file ExManagerFog.cpp. References GetFogColorG(), Guard, IncFogColorG(), and SetFogColorG(). Referenced by IncFogColorG().
    00150 {
    00151 Guard(ExManagerFog::IncFogColorG(float inc))
    00152         SetFogColorG(GetFogColorG()+inc);
    00153 UnGuard
    00154 }

void IncFogColorR | ( | float | inc | ) |

| Definition at line 142 of file ExManagerFog.cpp. References GetFogColorR(), Guard, IncFogColorR(), and SetFogColorR(). Referenced by IncFogColorR().
    00143 {
    00144 Guard(ExManagerFog::IncFogColorR(float inc))
    00145         SetFogColorR(GetFogColorR()+inc);
    00146 UnGuard
    00147 }

void IncStartPoint | ( | float | inc | ) |

| Definition at line 178 of file ExManagerFog.cpp. References GetStarPoint(), Guard, IncStartPoint(), and SetStartPoint(). Referenced by IncStartPoint().
    00179 {
    00180 Guard(ExManagerFog::IncStartPoint(float inc))
    00181         SetStartPoint(GetStarPoint()+inc);
    00182 UnGuard
    00183 }

void Init | ( | void |  | ) | `[inline, virtual]`

| Reimplemented from ExManager. Definition at line 88 of file ExManagerFog.h.
    00089 {return;}

ExCAction InputAction | ( | ExCAction | Action | ) | `[virtual]`

| Reimplemented from ExManager. Definition at line 247 of file ExManagerFog.cpp. References ExManager::Consol, DisableFog(), EnableFog(), Guard, InputAction(), ExCAction::m_Action, ExCAction::m_NextAction, ExCAction::m_Param, SetAlgo(), SetDensity(), SetEndPoint(), SetFogColorB(), SetFogColorG(), SetFogColorR(), and SetStartPoint(). Referenced by InputAction(), and ExManagerCommand::ProcesExCAction().
    00248 {
    00249 Guard(ExCAction ExManagerFog::InputAction(ExCAction Action))
    00250         switch(Action.m_Action)
    00251         {
    00252         case ENABLE_FOG:EnableFog();break;
    00253         case DISABEL_FOG:DisableFog();break;
    00254         case SET_FOG_ALGO_LINEAR:SetAlgo(GL_LINEAR);break;
    00255         case SET_FOG_ALGO_EXP:SetAlgo(GL_EXP);break;
    00256         case SET_FOG_ALGO_EXP2:SetAlgo(GL_LINEAR);break;
    00257
    00258         case SET_FOG_COLOR_R:
    00259                 try
    00260                 {
    00261                         SetFogColorR(atof(Action.m_Param.data()));
    00262                 }catch(...)
    00263                 {
    00264                         *Consol<<"Enter a float value"<<std::endl;
    00265                 }
    00266                 break;
    00267
    00268         case SET_FOG_COLOR_G:
    00269                 try
    00270                 {
    00271                         SetFogColorG(atof(Action.m_Param.data()));
    00272                 }catch(...)
    00273                 {
    00274                         *Consol<<"Enter a float value"<<std::endl;
    00275                 }
    00276                 break;
    00277
    00278         case SET_FOG_COLOR_B:
    00279                 try
    00280                 {
    00281                         SetFogColorB(atof(Action.m_Param.data()));
    00282                 }catch(...)
    00283                 {
    00284                         *Consol<<"Enter a float value"<<std::endl;
    00285                 }
    00286                 break;
    00287
    00288         case SET_FOG_START_POINT:
    00289                 try
    00290                 {
    00291                         SetStartPoint(atof(Action.m_Param.data()));
    00292                 }catch(...)
    00293                 {
    00294                         *Consol<<"Enter a float value"<<std::endl;
    00295                 }
    00296                 break;
    00297
    00298         case SET_FOG_END_POINT:
    00299                 try
    00300                 {
    00301                         SetEndPoint(atof(Action.m_Param.data()));
    00302                 }catch(...)
    00303                 {
    00304                         *Consol<<"Enter a float value"<<std::endl;
    00305                 }
    00306                 break;
    00307
    00308         case SET_FOG_DENSITY:
    00309                 try
    00310                 {
    00311                         SetDensity(atof(Action.m_Param.data()));
    00312                 }catch(...)
    00313                 {
    00314                         *Consol<<"Enter a float value"<<std::endl;
    00315                 }
    00316                 break;
    00317
    00318         default:
    00319                 *Consol<<"Can not file action in FOG_ACTION_MAP"<<std::endl;
    00320                 break;
    00321         }
    00322
    00323         if(Action.m_NextAction){return *Action.m_NextAction;}
    00324         else{return NOTHING;}
    00325 UnGuard
    00326 }

ExCAction InputCommand | ( | ExCCommand | Command | ) | `[virtual]`

| Reimplemented from ExManager. Definition at line 240 of file ExManagerFog.cpp. References Guard, and InputCommand(). Referenced by InputCommand().
    00241 {
    00242 Guard(ExCAction ExManagerFog::InputCommand(ExCCommand Command))
    00243         return NOTHING;
    00244 UnGuard
    00245 }

void Reset | ( | void |  | ) | `[virtual]`

| Reimplemented from ExManager. Definition at line 56 of file ExManagerFog.cpp. References DisableFog(), Guard, m_State, Reset(), SetAlgo(), SetDensity(), SetEndPoint(), SetFogColor(), and SetStartPoint(). Referenced by ExManagerFog(), ExManagerCommand::ProcesExCAction(), and Reset().
    00057 {
    00058 Guard(ExManagerFog::Reset(void))
    00059         SetAlgo(GL_LINEAR);
    00060         SetFogColor(0.3f,0.3f,0.3f,0.5f);
    00061         SetStartPoint(300.0f);
    00062         SetEndPoint(800.0f);
    00063         SetDensity(0.50);
    00064         m_State=false;
    00065         DisableFog();
    00066 UnGuard
    00067 }

void SetAlgo | ( | GLenum | algo | ) |

| Definition at line 215 of file ExManagerFog.cpp. References Guard, m_FogAlgo, and SetAlgo(). Referenced by InputAction(), Reset(), and SetAlgo().
    00216 {
    00217 Guard(ExManagerFog::SetAlgo(GLenum algo))
    00218         switch(algo)
    00219         {
    00220                 case GL_LINEAR:
    00221                         m_FogAlgo=GL_LINEAR;
    00222                         glFogi(GL_FOG_MODE,GL_LINEAR);
    00223                         break;
    00224                 case GL_EXP:
    00225                         m_FogAlgo=GL_EXP;
    00226                         glFogi(GL_FOG_MODE,GL_EXP);
    00227                         break;
    00228                 case GL_EXP2:
    00229                         m_FogAlgo=GL_EXP2;
    00230                         glFogi(GL_FOG_MODE,GL_EXP2);
    00231                         break;
    00232                 default :
    00233                         m_FogAlgo=GL_LINEAR;
    00234                         glFogi(GL_FOG_MODE,GL_LINEAR);
    00235                         break;
    00236         }
    00237 UnGuard
    00238 }

void SetDensity | ( | float | P | ) |

| Definition at line 200 of file ExManagerFog.cpp. References Guard, m_Density, and SetDensity(). Referenced by IncDensity(), InputAction(), Reset(), and SetDensity().
    00201 {
    00202 Guard(ExManagerFog::SetDensity(float P))
    00203         m_Density=P;
    00204         glFogf(GL_FOG_DENSITY,m_Density);
    00205 UnGuard
    00206 }

void SetEndPoint | ( | float | P | ) |

| Definition at line 185 of file ExManagerFog.cpp. References Guard, m_EndPoint, and SetEndPoint(). Referenced by IncEndPoint(), InputAction(), Reset(), and SetEndPoint().
    00186 {
    00187 Guard(ExManagerFog::SetEndPoint(float P))
    00188         m_EndPoint=P;
    00189         glFogf(GL_FOG_END,m_EndPoint);
    00190 UnGuard
    00191 }

void SetFogColor | ( | float | R,
|  | float | G,
|  | float | B,
|  | float | A
| ) |

| Definition at line 92 of file ExManagerFog.cpp. References A, B, Guard, SetFogColor(), SetFogColorA(), SetFogColorB(), SetFogColorG(), and SetFogColorR(). Referenced by Reset(), and SetFogColor().
    00093 {
    00094 Guard(ExManagerFog::SetFogColor(float R,float G,float B,float A))
    00095         SetFogColorR(R);
    00096         SetFogColorG(G);
    00097         SetFogColorB(B);
    00098         SetFogColorA(A);
    00099 UnGuard
    00100 }

void SetFogColorA | ( | float | A | ) |

| Definition at line 132 of file ExManagerFog.cpp. References A, Guard, m_FogColor, and SetFogColorA(). Referenced by IncFogColorA(), SetFogColor(), and SetFogColorA().
    00133 {
    00134 Guard(ExManagerFog::SetFogColorA(float A))
    00135         if(A>1.0f)A=1.0f;
    00136         if(A<0.0f)A=0.0f;
    00137         m_FogColor[3]=A;
    00138         glFogfv(GL_FOG_COLOR,m_FogColor);
    00139 UnGuard
    00140 }

void SetFogColorB | ( | float | B | ) |

| Definition at line 122 of file ExManagerFog.cpp. References B, Guard, m_FogColor, and SetFogColorB(). Referenced by IncFogColorB(), InputAction(), SetFogColor(), and SetFogColorB().
    00123 {
    00124 Guard(ExManagerFog::SetFogColorB(float B))
    00125         if(B>1.0f)B=1.0f;
    00126         if(B<0.0f)B=0.0f;
    00127         m_FogColor[2]=B;
    00128         glFogfv(GL_FOG_COLOR,m_FogColor);
    00129 UnGuard
    00130 }

void SetFogColorG | ( | float | G | ) |

| Definition at line 112 of file ExManagerFog.cpp. References Guard, m_FogColor, and SetFogColorG(). Referenced by IncFogColorG(), InputAction(), SetFogColor(), and SetFogColorG().
    00113 {
    00114 Guard(ExManagerFog::SetFogColorG(float G))
    00115         if(G>1.0f)G=1.0f;
    00116         if(G<0.0f)G=0.0f;
    00117         m_FogColor[1]=G;
    00118         glFogfv(GL_FOG_COLOR,m_FogColor);
    00119 UnGuard
    00120 }

void SetFogColorR | ( | float | R | ) | `[inline]`

| Definition at line 102 of file ExManagerFog.cpp. References Guard, m_FogColor, and SetFogColorR(). Referenced by IncFogColorR(), InputAction(), SetFogColor(), and SetFogColorR().
    00103 {
    00104 Guard(ExManagerFog::SetFogColorR(float R))
    00105         if(R>1.0f)R=1.0f;
    00106         if(R<0.0f)R=0.0f;
    00107         m_FogColor[0]=R;
    00108         glFogfv(GL_FOG_COLOR,m_FogColor);
    00109 UnGuard
    00110 }

void SetStartPoint | ( | float | P | ) |

| Definition at line 170 of file ExManagerFog.cpp. References Guard, m_StartPoint, and SetStartPoint(). Referenced by IncStartPoint(), InputAction(), Reset(), and SetStartPoint().
    00171 {
    00172 Guard(ExManagerFog::SetStartPoint(float P))
    00173         m_StartPoint=P;
    00174         glFogf(GL_FOG_START,m_StartPoint);
    00175 UnGuard
    00176 }

## Field Documentation

GLfloat m_Density`[private]`

| Definition at line 70 of file ExManagerFog.h. Referenced by EnableFog(), GetDensity(), and SetDensity().

GLfloat m_EndPoint`[private]`

| Definition at line 69 of file ExManagerFog.h. Referenced by EnableFog(), GetEndPoint(), and SetEndPoint().

bool m_flag = false`[static, private]`

| Definition at line 26 of file ExManagerFog.cpp. Referenced by CreateSingleton().

GLenum m_FogAlgo`[private]`

| Definition at line 71 of file ExManagerFog.h. Referenced by EnableFog(), GetAlgo(), and SetAlgo().

GLfloat m_FogColor[4]`[private]`

| Definition at line 67 of file ExManagerFog.h. Referenced by EnableFog(), GetFogColorA(), GetFogColorB(), GetFogColorG(), GetFogColorR(), SetFogColorA(), SetFogColorB(), SetFogColorG(), and SetFogColorR().

ExManagerFog * m_instance = NULL`[static, private]`

| Definition at line 27 of file ExManagerFog.cpp. Referenced by CreateSingleton().

GLfloat m_StartPoint`[private]`

| Definition at line 68 of file ExManagerFog.h. Referenced by EnableFog(), GetStarPoint(), and SetStartPoint().

bool m_State`[private]`

| Definition at line 72 of file ExManagerFog.h. Referenced by DisableFog(), EnableFog(), GetState(), and Reset().

The documentation for this class was generated from the following files:

- ExManagerFog.h
- ExManagerFog.cpp