Table of Contents

Interface ITerrainRenderer

Namespace
Map.Rendering.Terrain
Assembly
MapAssembly.dll

ENGINE: Interface for pluggable terrain rendering implementations.

ENGINE provides default Imperator Rome-style 4-channel blend map generation. GAME can register custom implementations for different terrain styles:

  • Different blending algorithms (8-channel, height-based, etc.)
  • Stylized terrain rendering
  • Performance-optimized variants

Pattern 20: Pluggable Implementation (Interface + Registry)

public interface ITerrainRenderer

Properties

DisplayName

Human-readable name for UI/debugging

string DisplayName { get; }

Property Value

string

RendererId

Unique identifier for this renderer (e.g., "Default", "Stylized", "HighDetail")

string RendererId { get; }

Property Value

string

RequiresPerFrameUpdate

Whether this renderer needs per-frame updates

bool RequiresPerFrameUpdate { get; }

Property Value

bool

Methods

ApplyToMaterial(Material, TerrainStyleParams)

Apply style parameters to material (shader uniforms)

void ApplyToMaterial(Material material, TerrainStyleParams styleParams)

Parameters

material Material
styleParams TerrainStyleParams

Dispose()

Cleanup resources

void Dispose()

GenerateBlendMaps(RenderTexture, ComputeBuffer, int, int)

Generate terrain blend maps (DetailIndexTexture + DetailMaskTexture) Called after ProvinceTerrainAnalyzer completes

(RenderTexture detailIndex, RenderTexture detailMask) GenerateBlendMaps(RenderTexture provinceIDTexture, ComputeBuffer provinceTerrainBuffer, int width, int height)

Parameters

provinceIDTexture RenderTexture

Province ID texture

provinceTerrainBuffer ComputeBuffer

Province terrain buffer (terrain type per province)

width int

Map width

height int

Map height

Returns

(RenderTexture detailIndex, RenderTexture detailMask)

Tuple of (DetailIndexTexture, DetailMaskTexture)

GetBlendSharpness()

Get the blend sharpness value

float GetBlendSharpness()

Returns

float

GetSampleRadius()

Get the sample radius used for terrain blending

int GetSampleRadius()

Returns

int

Initialize(MapTextureManager, TerrainRendererContext)

Initialize the renderer with required dependencies

void Initialize(MapTextureManager textureManager, TerrainRendererContext context)

Parameters

textureManager MapTextureManager
context TerrainRendererContext

OnRenderFrame()

Called each frame if RequiresPerFrameUpdate is true

void OnRenderFrame()

SetBlendSharpness(float)

Set the blend sharpness value

void SetBlendSharpness(float sharpness)

Parameters

sharpness float

SetSampleRadius(int)

Set the sample radius for terrain blending

void SetSampleRadius(int radius)

Parameters

radius int