Interface IFogOfWarRenderer
ENGINE: Interface for pluggable fog of war rendering implementations.
ENGINE provides default compute-shader based implementation. GAME can register custom implementations for different fog styles:
- Different visual effects (animated fog, stylized clouds)
- Alternative visibility rules
- Performance optimizations for specific use cases
Pattern 20: Pluggable Implementation (Interface + Registry)
public interface IFogOfWarRenderer
Properties
DisplayName
Human-readable name for UI/debugging
string DisplayName { get; }
Property Value
- string
IsEnabled
Get current enabled state
bool IsEnabled { get; }
Property Value
- bool
RendererId
Unique identifier for this renderer (e.g., "Default", "Stylized", "Minimal")
string RendererId { get; }
Property Value
- string
RequiresPerFrameUpdate
Whether this renderer needs per-frame updates (e.g., animated fog)
bool RequiresPerFrameUpdate { get; }
Property Value
- bool
Methods
ApplyToMaterial(Material, FogOfWarStyleParams)
Apply style parameters to material (shader uniforms)
void ApplyToMaterial(Material material, FogOfWarStyleParams styleParams)
Parameters
materialMaterialstyleParamsFogOfWarStyleParams
Dispose()
Cleanup resources
void Dispose()
GetPlayerCountry()
Get the current player country ID
ushort GetPlayerCountry()
Returns
- ushort
GetProvinceVisibility(ushort)
Get visibility level for a province (0.0 = unexplored, 0.5 = explored, 1.0 = visible)
float GetProvinceVisibility(ushort provinceID)
Parameters
provinceIDushort
Returns
- float
Initialize(MapTextureManager, FogOfWarRendererContext)
Initialize the renderer with required dependencies
void Initialize(MapTextureManager textureManager, FogOfWarRendererContext context)
Parameters
textureManagerMapTextureManagercontextFogOfWarRendererContext
OnRenderFrame()
Called each frame if RequiresPerFrameUpdate is true
void OnRenderFrame()
RevealProvince(ushort)
Reveal a specific province (mark as explored)
void RevealProvince(ushort provinceID)
Parameters
provinceIDushort
SetEnabled(bool)
Set whether fog of war is enabled
void SetEnabled(bool enabled)
Parameters
enabledbool
SetPlayerCountry(ushort)
Set the player's country for visibility calculations
void SetPlayerCountry(ushort countryID)
Parameters
countryIDushort
UpdateVisibility()
Update visibility state based on current ownership
void UpdateVisibility()