Interface ITerrainRenderer
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
materialMaterialstyleParamsTerrainStyleParams
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
provinceIDTextureRenderTextureProvince ID texture
provinceTerrainBufferComputeBufferProvince terrain buffer (terrain type per province)
widthintMap width
heightintMap 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
textureManagerMapTextureManagercontextTerrainRendererContext
OnRenderFrame()
Called each frame if RequiresPerFrameUpdate is true
void OnRenderFrame()
SetBlendSharpness(float)
Set the blend sharpness value
void SetBlendSharpness(float sharpness)
Parameters
sharpnessfloat
SetSampleRadius(int)
Set the sample radius for terrain blending
void SetSampleRadius(int radius)
Parameters
radiusint