|
QGroundControl
Ground Control Station for MAVLink Drones
|
#include <PatchGeometry.h>
Inheritance diagram for PatchGeometry:
Collaboration diagram for PatchGeometry:Signals | |
| void | gridSizeChanged () |
| void | spanChanged () |
| void | heightsChanged () |
| void | edgeLodDeltasChanged () |
| void | heightFieldChanged () |
Public Member Functions | |
| PatchGeometry (QQuick3DObject *parent=nullptr) | |
| int | gridSize () const |
| void | setGridSize (int gridSize) |
| qreal | span () const |
| void | setSpan (qreal span) |
| QList< float > | heights () const |
| (gridSize+1)^2 heights row-major from the north-west corner; empty = flat | |
| void | setHeights (const QList< float > &heights) |
| HeightField * | heightField () const |
| Field for sampleFromField to sample from; not owned, may be null. | |
| void | setHeightField (HeightField *heightField) |
| bool | sampleFromField (const TileMath::TileKey &key) |
| void | setEdgeLodDeltas (int north, int south, int west, int east) |
| QList< int > | edgeLodDeltas () const |
| QML-bindable form of the deltas: {north, south, west, east}. | |
| void | setEdgeLodDeltas (const QList< int > &deltas) |
Static Public Attributes | |
| static constexpr int | kMinGridSize = 1 |
| static constexpr int | kMaxGridSize = 256 |
| static constexpr double | kSkirtDepthFraction |
| base skirt depth (fraction of span); scaled by 2^maxEdgeDelta | |
Protected Member Functions | |
| void | componentComplete () override |
Grid mesh for one surface patch of the GeoMap engine.
Local space: origin at the patch center, x east, y north, z up (meters). The grid has (gridSize+1)^2 vertices spanning [-span/2, +span/2] in x/y, displaced in z by the height grid (row-major from the north-west corner, matching HeightSource). Empty heights produce a flat patch at z=0.
Skirt geometry hangs from all four edges to hide cracks between adjacent patches of different LOD levels. UVs map (0,0) at the north-west corner to (1,1) at the south-east corner, matching raster tile orientation.
Known limitation: normals are central differences over this patch's own height grid (one-sided at edges), so lit materials show shading seams at patch borders. Fix when lit terrain matters (M2): deliver a one-sample apron from the HeightSource so edge normals use neighboring data.
Definition at line 38 of file PatchGeometry.h.
|
explicit |
Definition at line 13 of file PatchGeometry.cc.
|
overrideprotected |
Definition at line 18 of file PatchGeometry.cc.
|
inline |
QML-bindable form of the deltas: {north, south, west, east}.
Definition at line 87 of file PatchGeometry.h.
|
signal |
Referenced by setEdgeLodDeltas(), and setGridSize().
|
inline |
Definition at line 56 of file PatchGeometry.h.
Referenced by setGridSize().
|
signal |
Referenced by setGridSize().
|
inline |
Field for sampleFromField to sample from; not owned, may be null.
Definition at line 70 of file PatchGeometry.h.
Referenced by setHeightField().
|
signal |
Referenced by setHeightField().
|
inline |
(gridSize+1)^2 heights row-major from the north-west corner; empty = flat
Definition at line 65 of file PatchGeometry.h.
Referenced by setHeights().
|
signal |
Referenced by sampleFromField(), and setHeights().
| bool PatchGeometry::sampleFromField | ( | const TileMath::TileKey & | key | ) |
Samples the height field at this patch's vertex world positions (tile key at the current gridSize) and rebuilds the mesh. Returns false when no field is set or the key is invalid.
Definition at line 71 of file PatchGeometry.cc.
References heightsChanged(), and HeightField::samplePatch().
| void PatchGeometry::setEdgeLodDeltas | ( | const QList< int > & | deltas | ) |
Definition at line 135 of file PatchGeometry.cc.
References setEdgeLodDeltas().
| void PatchGeometry::setEdgeLodDeltas | ( | int | north, |
| int | south, | ||
| int | west, | ||
| int | east | ||
| ) |
How many LOD levels coarser each edge's neighbor renders (0 = same or finer: unconstrained). Non-coincident edge vertices are collapsed onto the segments between the coincident ones so no T-junction cracks open; HeightField::samplePatch's canonical boundary resolution guarantees the coincident vertices already match the coarse neighbor's rendered edge.
Definition at line 111 of file PatchGeometry.cc.
References edgeLodDeltasChanged(), and kMaxGridSize.
Referenced by setEdgeLodDeltas().
| void PatchGeometry::setGridSize | ( | int | gridSize | ) |
Definition at line 31 of file PatchGeometry.cc.
References edgeLodDeltasChanged(), gridSize(), gridSizeChanged(), kMaxGridSize, and kMinGridSize.
| void PatchGeometry::setHeightField | ( | HeightField * | heightField | ) |
Definition at line 91 of file PatchGeometry.cc.
References heightField(), and heightFieldChanged().
| void PatchGeometry::setHeights | ( | const QList< float > & | heights | ) |
Definition at line 61 of file PatchGeometry.cc.
References heights(), and heightsChanged().
| void PatchGeometry::setSpan | ( | qreal | span | ) |
Definition at line 51 of file PatchGeometry.cc.
References span(), and spanChanged().
|
inline |
Definition at line 60 of file PatchGeometry.h.
Referenced by setSpan().
|
signal |
Referenced by setSpan().
|
staticconstexpr |
Definition at line 52 of file PatchGeometry.h.
Referenced by setEdgeLodDeltas(), and setGridSize().
|
staticconstexpr |
Definition at line 51 of file PatchGeometry.h.
Referenced by setGridSize().
|
staticconstexpr |
base skirt depth (fraction of span); scaled by 2^maxEdgeDelta
Definition at line 53 of file PatchGeometry.h.