Skip to content

Game.Rendering.ViewerDistances

Assembly: Assembly-CSharp
Namespace: Game.Rendering

Type: public struct ViewerDistances

Base: System.ValueType

Summary:
Represents a small value object that holds various distance measurements used by the rendering/viewer system (camera, LOD and culling heuristics). All members are simple single-precision floats that describe distances to surfaces, focus distance, ground clearance and the maximum distance relative to sea level. Values are stored in world units (float, typically meters in Cities: Skylines 2).


Fields

  • None
    This struct declares no explicit fields. It exposes six auto-implemented properties; the compiler generates private backing fields for those properties.

Properties

  • public float focus { get; set; }
    Distance representing the current focus point of the viewer/camera. Used to bias LOD or focus-based rendering decisions.

  • public float closestSurface { get; set; }
    Distance to the closest surface beneath or near the viewer. Useful for near-plane culling or collision/occlusion checks.

  • public float farthestSurface { get; set; }
    Distance to the farthest visible surface from the viewer. Can be used to determine far-plane or LOD extents.

  • public float averageSurface { get; set; }
    An average distance of visible surfaces around the viewer. May be used for smoothing LOD transitions or distance-based effects.

  • public float ground { get; set; }
    Distance from the viewer to the ground (terrain) directly beneath the viewer/camera. Useful for ground-following adjustments and camera constraints.

  • public float maxDistanceToSeaLevel { get; set; }
    Maximum allowed distance relative to sea level. Likely used for clamping or special-case logic when rendering over water or adjusting visuals by elevation.

Constructors

  • public ViewerDistances()
    No explicit constructors are declared. The implicit parameterless constructor (default struct constructor) initializes all fields to 0. Use object initializers to set values at creation.

Methods

  • None
    This struct has no methods; it only carries data through its properties.

Usage Example

// Create and initialize a ViewerDistances instance
var distances = new Game.Rendering.ViewerDistances
{
    focus = 150f,
    closestSurface = 2.5f,
    farthestSurface = 1200f,
    averageSurface = 300f,
    ground = 1.8f,
    maxDistanceToSeaLevel = 500f
};

// Example usage: decide if we need high-detail rendering based on farthest surface
bool useHighDetail = distances.farthestSurface < 800f;