-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c0b642a
commit 7538c9e
Showing
12 changed files
with
207 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include "hud.h" | ||
#include "fog.h" | ||
#include "triangleapi.h" | ||
|
||
CFog gFog; | ||
|
||
CFog::CFog() | ||
{ | ||
ClearFog(); | ||
} | ||
|
||
void CFog::SetWaterLevel(int waterLevel) | ||
{ | ||
m_iWaterLevel = waterLevel; | ||
} | ||
|
||
void CFog::SetFogParameters(const FogParams ¶ms) | ||
{ | ||
m_FogParams = params; | ||
} | ||
|
||
FogParams CFog::GetFogParameters() const | ||
{ | ||
return m_FogParams; | ||
} | ||
|
||
void CFog::RenderFog() | ||
{ | ||
bool bFog; | ||
|
||
if (m_iWaterLevel <= 2) // checking if player is not underwater | ||
bFog = (m_FogParams.density > 0.0f) ? true : false; | ||
else | ||
bFog = false; | ||
|
||
gEngfuncs.pTriAPI->FogParams(m_FogParams.density, m_FogParams.fogSkybox); | ||
gEngfuncs.pTriAPI->Fog(m_FogParams.color, FOG_START_DISTANCE, FOG_END_DISTANCE, bFog); | ||
} | ||
|
||
void CFog::ClearFog() | ||
{ | ||
m_FogParams.fogSkybox = false; | ||
m_FogParams.color[0] = m_FogParams.color[1] = m_FogParams.color[2] = 0.0f; | ||
m_FogParams.density = 0.0f; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef FOG_H | ||
#define FOG_H | ||
|
||
constexpr float FOG_START_DISTANCE = 1500.0f; | ||
constexpr float FOG_END_DISTANCE = 2000.0f; | ||
|
||
struct FogParams | ||
{ | ||
bool fogSkybox = false; | ||
float color[3] = {0.0f, 0.0f, 0.0f}; | ||
float density = 0.0f; | ||
}; | ||
|
||
class CFog | ||
{ | ||
public: | ||
CFog(); | ||
void SetWaterLevel(int waterLevel); | ||
void SetFogParameters(const FogParams ¶ms); | ||
FogParams GetFogParameters() const; | ||
void RenderFog(); | ||
void ClearFog(); | ||
private: | ||
FogParams m_FogParams; | ||
int m_iWaterLevel; | ||
}; | ||
|
||
extern CFog gFog; | ||
|
||
#endif // FOG_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters