Skip to content
Brass Orrery

Orrery Terrain · OrreryTerrainCore module · function

Native::

ViewResidencyRadius

Experimental

The residency radius of a view at Height_m above the ground under it: the ground within Radius_m of the camera horizontally and within Reach_m of it in 3D, so a view keeps its near set until that ground is far enough away for the far field to stand in for it, and has none once it is higher than Reach_m.

Declaration

inline double ViewResidencyRadius(double Radius_m, double Reach_m, double Height_m, double Step_m, double Held_m);
Header
#include "Native/TileSource.h"
Module
PublicDependencyModuleNames.Add("OrreryTerrainCore"); in your module’s Build.cs.
Stability
Experimental: supported, may change in a minor version, with a changelog line.
Thread
Pure, any thread, deterministic.

Description

Every LOD decision that follows the near set follows it: the band (its radius is the view's), the far field's near rule and near floor (its near tiles and HfrNearRadius). The sphere of radius Reach_m around the camera meets the ground, taken level at the height under the camera, in a disc of radius √(Reach_m² − Height_m²), capped at Radius_m. Reach_m is a distance from the camera, so the rule does not depend on where the view looks: turning never streams. The disc is rounded up to whole steps below Radius_m, so a view whose disc still covers Radius_m less a step keeps Radius_m exactly (up to √(Reach_m² − (Radius_m − Step_m)²), 5674 m at a 6 km reach, 2 km and 50 m), and every LOD choice there is the horizontal radius's, bit for bit. Held_m, the radius the view had last, holds against a one-step wobble: the radius grows at once (the ground came closer) and shrinks only once the disc lies a full step inside it.

Parameters

NameTypeDefaultMeaning
Radius_mdouble—

The residency radius on the ground, metres. Returned as is when not finite and > 0.

Reach_mdouble—

The distance from the camera, metres, beyond which the far field stands in for the near ground (OrreryTerrain.Streaming.AltitudeReach). Less than Radius_m, or NaN, reads as Radius_m: the sphere of the residency radius. +inf: Radius_m at every height.

Height_mdouble—

The view's height above the ground under it, metres. 0 or less (a tunnel), or NaN (no ground under the view), reads as on the ground.

Step_mdouble—

The rounding step, metres. 0 or less, or NaN: Radius_m at every height (the horizontal radius).

Held_mdouble—

The radius this view had last, as this function returned it; NaN for a new view.

Returns

Radius_m − k · Step_m for a whole k ≥ 0, at least Step_m; or −1 when less than a step is left: the view wants no base tile (FTerrainWorld::SetStreamingSources still gives it its far ring).

Note.

Pure, any thread, deterministic.