_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

Classes | Public Types | Public Member Functions | List of all members
CFogOfWar Class Reference

Types of the fog of war. More...

#include <fow.h>

Public Types

enum  VisionType { cUnseen = 0, cExplored = 0b001, cVisible = 0b010 }
 
enum  States {
  cFirstEntry = 0, cGenerateFog, cGenerateTexture, cBlurTexture,
  cReady
}
 
enum  UpscaleTypes { cSimple = 0, cBilinear }
 

Public Member Functions

 CFogOfWar ()
 
FogOfWarTypes GetType () const
 
CColor GetFogColor () const
 
uint32_t GetFogColorSDL () const
 
uint8_t GetExploredOpacity () const
 
uint8_t GetRevealedOpacity () const
 
uint8_t GetUnseenOpacity () const
 
void ShowVisionFor (const CPlayer &player)
 
void HideVisionFor (const CPlayer &player)
 
bool IsBilinearUpscaleEnabled () const
 

fow.h - The fog of war headerfile.

uint8_t GetVisibilityForTile (const Vec2i tilePos) const
 

fow.cpp - The fog of war.

void Init ()
 
void Clean (const bool isHardClean=false)
 
bool SetType (const FogOfWarTypes fowType)
 
void SetOpacityLevels (const uint8_t explored, const uint8_t revealed, const uint8_t unseen)
 
void SetFogColor (const uint8_t r, const uint8_t g, const uint8_t b)
 
void SetFogColor (const CColor color)
 
void EnableBilinearUpscale (const bool enable)
 
void InitBlurer (const float radius1, const float radius2, const uint16_t numOfIterations)
 
void Update (bool doAtOnce=false)
 
void Draw (CViewport &viewport)
 
static void SetTiledFogGraphic (const std::string &fogGraphicFile)
 

Detailed Description

Types of the fog of war.

Member Enumeration Documentation

◆ States

Enumerator
cFirstEntry 
cGenerateFog 
cGenerateTexture 
cBlurTexture 
cReady 

◆ UpscaleTypes

Enumerator
cSimple 
cBilinear 

◆ VisionType

Enumerator
cUnseen 
cExplored 
cVisible 

Constructor & Destructor Documentation

◆ CFogOfWar()

CFogOfWar::CFogOfWar ( )
inline

Member Function Documentation

◆ Clean()

void CFogOfWar::Clean ( const bool  isHardClean = false)

◆ Draw()

void CFogOfWar::Draw ( CViewport viewport)

Generate fog of war texture for certain viewport.

Parameters
viewportviewport to generate fog of war texture for
vpFogSurfacesurface where to put the generated texture

◆ EnableBilinearUpscale()

void CFogOfWar::EnableBilinearUpscale ( const bool  enable)

Enable or disable bilinear upscale for the final fog texture rendering

Parameters
enablecmd to enable/disable

◆ GetExploredOpacity()

uint8_t CFogOfWar::GetExploredOpacity ( ) const
inline

◆ GetFogColor()

CColor CFogOfWar::GetFogColor ( ) const
inline

◆ GetFogColorSDL()

uint32_t CFogOfWar::GetFogColorSDL ( ) const
inline

◆ GetRevealedOpacity()

uint8_t CFogOfWar::GetRevealedOpacity ( ) const
inline

◆ GetType()

FogOfWarTypes CFogOfWar::GetType ( ) const
inline

◆ GetUnseenOpacity()

uint8_t CFogOfWar::GetUnseenOpacity ( ) const
inline

◆ GetVisibilityForTile()

uint8_t CFogOfWar::GetVisibilityForTile ( const Vec2i  tilePos) const
inline

◆ HideVisionFor()

void CFogOfWar::HideVisionFor ( const CPlayer player)
inline

◆ Init()

void CFogOfWar::Init ( )

+1 to the top & left and +1 to the bottom & right for 4x scale algorithm purposes, Extra tiles will always be VisionType::cUnseen.

TODO: Add fog initialization for replays and observer players

◆ InitBlurer()

void CFogOfWar::InitBlurer ( const float  radius1,
const float  radius2,
const uint16_t  numOfIterations 
)

◆ IsBilinearUpscaleEnabled()

bool CFogOfWar::IsBilinearUpscaleEnabled ( ) const
inline

◆ SetFogColor() [1/2]

void CFogOfWar::SetFogColor ( const CColor  color)

◆ SetFogColor() [2/2]

void CFogOfWar::SetFogColor ( const uint8_t  r,
const uint8_t  g,
const uint8_t  b 
)

◆ SetOpacityLevels()

void CFogOfWar::SetOpacityLevels ( const uint8_t  explored,
const uint8_t  revealed,
const uint8_t  unseen 
)

Set fog of war opacity (alpha chanel values) for different levels of visibility

Parameters
exploredalpha channel value for explored tiles
revealedalpha channel value for revealed tiles (when the map revealed)
unseenalpha channel value for unseen tiles

◆ SetTiledFogGraphic()

void CFogOfWar::SetTiledFogGraphic ( const std::string &  fogGraphicFile)
static

◆ SetType()

bool CFogOfWar::SetType ( const FogOfWarTypes  fowType)

Select which type of Fog of War to use

Parameters
fowTypetype to set
Returns
true if success, false for wrong fow_type

◆ ShowVisionFor()

void CFogOfWar::ShowVisionFor ( const CPlayer player)
inline

◆ Update()

void CFogOfWar::Update ( bool  doAtOnce = false)

Proceed fog of war state update

Parameters
doAtOncecommand to calculate fog of war in single sycle

pass through

FogOfWarTypes::cEnhanced


The documentation for this class was generated from the following files:
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.