14#include <QtCore/QElapsedTimer>
15#include <QtCore/QHash>
16#include <QtCore/QList>
17#include <QtCore/QObject>
18#include <QtCore/QPointF>
19#include <QtCore/QRectF>
21#include <QtCore/QVarLengthArray>
97 bool updateSettled()
const {
return !_updatePending && !_addsDeferred && !_removalsDeferred; }
136#ifdef QGC_UNITTEST_BUILD
144 }
while ((_addsDeferred || _removalsDeferred) && (--guard > 0));
161 void _fieldRegionChanged(
const QRectF& worldRect);
166 QList<float> heights;
167 float maxHeight = 0.0f;
168 qint64 cliffSinceMs = -1;
169 float edgeStep = 0.0f;
171 bool edgeCliff =
false;
176 static constexpr double kCliffLogSlope = 0.5;
180 double _projectedPixels(
const TileMath::TileKey& key,
const QPointF& cameraGround,
double cameraHeight)
const;
181 QList<TileMath::TileKey> _desiredPatches(
const QRectF& visible,
const QPointF& cameraGround,
182 double cameraHeight)
const;
183 QRectF _visibleGroundRect(
double terrainZ)
const;
184 double _maxTerrainZ()
const;
186 void _scheduleUpdate();
195 AddResult _addDesiredPatches(
const QList<TileMath::TileKey>& desired, QVarLengthArray<QRectF, 8>& churnRects);
196 int _removeStalePatches(
const QList<TileMath::TileKey>& desired,
const QSet<TileMath::TileKey>& desiredSet,
197 QVarLengthArray<QRectF, 8>& churnRects);
198 void _notifyEdgeChurn(
const QVarLengthArray<QRectF, 8>& churnRects);
199 void _repinAncestors();
204 QHash<TileMath::TileKey, PatchData> _patches;
205 UpdateStats _updateStats;
206 bool _updatePending =
false;
207 bool _addsDeferred =
false;
208 bool _removalsDeferred =
false;
209 double _culledTerrainZ = 0.0;
210 QElapsedTimer _cliffClock;
static constexpr double kRecullHeightMargin
static constexpr int kMaxPatchAddsPerUpdate
void surfaceHeightsChanged()
static constexpr double kMaxRangeMultiplier
visible-range cap in camera distances
std::optional< Patch > patch(const TileMath::TileKey &key) const
Single-patch lookup; std::nullopt when the key is not resident.
static constexpr int kMaxPatchRemovalsPerUpdate
static constexpr int kGridSize
QList< Patch > patches() const
bool updateSettled() const
False while a scheduled update pass or deferred patch churn is outstanding.
std::optional< double > renderedHeightAt(const QPointF &world) const
void patchEdgeDeltasChanged(const TileMath::TileKey &key)
QList< int > edgeLodDeltas(const TileMath::TileKey &key) const
void patchRemoved(const TileMath::TileKey &key)
static constexpr int kVisibleSampleGrid
void patchAdded(const TileMath::TileKey &key)
static constexpr double kRefinePixelThreshold
subdivide above this projected size
void patchMeshChanged(const TileMath::TileKey &key)
The patch's mesh content changed (heights re-sampled): consumers must re-pull heights.
QRectF visibleGroundRect() const
Estimated visible ground region in world meters (see class comment)
UpdateStats takeUpdateStats()
Returns the counters accumulated since the previous call and resets them.
static constexpr int kMaxPatches
float edgeStep
cliff monitor: largest in-patch edge step (m); 0 while off
bool edgeCliff
cliff monitor: edgeStep is steep enough to log as a cliff
QPointF edgeStepAt
world position of edgeStep
bool covered
always false (see ready)
update() call/duration counters for the perf overlay
qint64 addTotalUs
time inside the patch-add loop (delegate creation share)