Class FogOfWarRendererBase
ENGINE: Abstract base class for fog of war renderer implementations. Provides common utilities and state management.
Pattern 20: Pluggable Implementation (Interface + Registry)
public abstract class FogOfWarRendererBase : IFogOfWarRenderer
- Inheritance
-
objectFogOfWarRendererBase
- Implements
- Derived
Fields
THREAD_GROUP_SIZE
protected const int THREAD_GROUP_SIZE = 8
Field Value
- int
VISIBILITY_EXPLORED
protected const float VISIBILITY_EXPLORED = 0.5
Field Value
- float
VISIBILITY_UNEXPLORED
Visibility constants
protected const float VISIBILITY_UNEXPLORED = 0
Field Value
- float
VISIBILITY_VISIBLE
protected const float VISIBILITY_VISIBLE = 1
Field Value
- float
context
protected FogOfWarRendererContext context
Field Value
fogEnabled
protected bool fogEnabled
Field Value
- bool
isInitialized
protected bool isInitialized
Field Value
- bool
playerCountryID
protected ushort playerCountryID
Field Value
- ushort
provinceVisibility
protected float[] provinceVisibility
Field Value
- float[]
textureManager
protected MapTextureManager textureManager
Field Value
Properties
DisplayName
Human-readable name for UI/debugging
public abstract string DisplayName { get; }
Property Value
- string
IsEnabled
Get current enabled state
public bool IsEnabled { get; }
Property Value
- bool
RendererId
Unique identifier for this renderer (e.g., "Default", "Stylized", "Minimal")
public abstract string RendererId { get; }
Property Value
- string
RequiresPerFrameUpdate
Whether this renderer needs per-frame updates (e.g., animated fog)
public virtual bool RequiresPerFrameUpdate { get; }
Property Value
- bool
Methods
ApplyToMaterial(Material, FogOfWarStyleParams)
Apply style parameters to material (shader uniforms)
public virtual void ApplyToMaterial(Material material, FogOfWarStyleParams styleParams)
Parameters
materialMaterialstyleParamsFogOfWarStyleParams
CalculateThreadGroups(int, int)
Calculate thread groups for compute shader dispatch
protected (int x, int y) CalculateThreadGroups(int width, int height)
Parameters
widthintheightint
Returns
- (int x, int y)
Dispose()
Cleanup resources
public virtual void Dispose()
GetPlayerCountry()
Get the current player country ID
public ushort GetPlayerCountry()
Returns
- ushort
GetProvinceVisibility(ushort)
Get visibility level for a province (0.0 = unexplored, 0.5 = explored, 1.0 = visible)
public float GetProvinceVisibility(ushort provinceID)
Parameters
provinceIDushort
Returns
- float
Initialize(MapTextureManager, FogOfWarRendererContext)
Initialize the renderer with required dependencies
public virtual void Initialize(MapTextureManager textureManager, FogOfWarRendererContext context)
Parameters
textureManagerMapTextureManagercontextFogOfWarRendererContext
OnInitialize()
Override to perform implementation-specific initialization
protected virtual void OnInitialize()
OnRenderFrame()
Called each frame if RequiresPerFrameUpdate is true
public virtual void OnRenderFrame()
OnVisibilityChanged()
Called when visibility state changes - override to update textures
protected virtual void OnVisibilityChanged()
RevealProvince(ushort)
Reveal a specific province (mark as explored)
public virtual void RevealProvince(ushort provinceID)
Parameters
provinceIDushort
SetEnabled(bool)
Set whether fog of war is enabled
public virtual void SetEnabled(bool enabled)
Parameters
enabledbool
SetPlayerCountry(ushort)
Set the player's country for visibility calculations
public virtual void SetPlayerCountry(ushort countryID)
Parameters
countryIDushort
UpdateVisibility()
Update visibility state based on current ownership
public abstract void UpdateVisibility()