From 602a0c5951050e7cce645534cb4f136cf9f4fee4 Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Thu, 17 Jun 2021 14:20:54 +0700 Subject: Rename source and build directory --- src/Fog.cpp | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 src/Fog.cpp (limited to 'src/Fog.cpp') diff --git a/src/Fog.cpp b/src/Fog.cpp new file mode 100644 index 0000000..21ca229 --- /dev/null +++ b/src/Fog.cpp @@ -0,0 +1,54 @@ +/**> HEADER FILES <**/ +#include "Fog.h" + +void Fog::SetFog(float colorR, float colorG, float colorB, float fStart, float fEnd, float Density) +{ + fogColor[0]=colorR; + fogColor[1]=colorG; + fogColor[2]=colorB; + fogColor[3]=1; + fogStart=fStart; + fogEnd=fEnd; + fogDensity=Density; + fogMode=GL_LINEAR; + + glFogi(GL_FOG_MODE,fogMode); + glFogfv(GL_FOG_COLOR,fogColor); + glFogf(GL_FOG_DENSITY,fogDensity); + glFogi(GL_FOG_HINT,GL_DONT_CARE); + glFogi(GL_FOG_START,fogStart); + glFogi(GL_FOG_END,fogEnd); + + glEnable(GL_FOG); +} + +void Fog::TempFog(float colorR, float colorG, float colorB) +{ + GLfloat tempfogColor[4]; + tempfogColor[0]=colorR; + tempfogColor[1]=colorG; + tempfogColor[2]=colorB; + tempfogColor[3]=1; + + glFogi(GL_FOG_MODE,fogMode); + glFogfv(GL_FOG_COLOR,tempfogColor); + glFogf(GL_FOG_DENSITY,fogDensity); + glFogi(GL_FOG_HINT,GL_DONT_CARE); + glFogi(GL_FOG_START,fogStart); + glFogi(GL_FOG_END,fogEnd); + + glEnable(GL_FOG); +} + +void Fog::ResetFog() +{ + glFogi(GL_FOG_MODE,fogMode); + glFogfv(GL_FOG_COLOR,fogColor); + glFogf(GL_FOG_DENSITY,fogDensity); + glFogi(GL_FOG_HINT,GL_DONT_CARE); + glFogi(GL_FOG_START,fogStart); + glFogi(GL_FOG_END,fogEnd); + + glEnable(GL_FOG); +} + -- cgit 1.4.1