Created a pull request that adds GenerateSilhouettePolygonAsync to ACesium3DTileset, enabling asynchronous computation of a 2D convex hull polygon representing the top-down silhouette of the tileset’s geometry projected onto the ground plane. This is useful for applications like cartographic polygon clipping (e.g., with ACesiumCartographicPolygon), bounds visualization or automated cinematic camera pathing.
What it does:
-
Offloads grid generation and convex hull computation to background threads using Unreal’s AsyncTask to minimize game thread hitches. Cesium’s SampleHeightMostDetailed handles height sampling asynchronously.
-
If SpacingMeters is positive, uses it (converted to Unreal units, cm). If zero, auto-computes spacing based on bounds area to target ~10,000 grid points for balanced performance/accuracy. Negative values return empty immediately.
-
Caps grid points at 25,000 to prevent excessive memory/CPU use; ensures counter-clockwise polygon orientation via signed area check; uses TWeakObjectPtr for thread-safe actor references.
-
Outputs a closed polygon in Unreal world coordinates (Z=0); empty array on failure (e.g., invalid bounds, few occupied points).
Dependencies: Requires #include “Async/Async.h” and the existing ComputeConvexHull helper (monotone chain algorithm, assumed in namespace or file).
Usage Example:
MyTileset->GenerateSilhouettePolygonAsync(10.0f, FOnSilhouetteGenerated::CreateLambda([this](ACesium3DTileset* Tileset, const TArray<FVector>& Polygon) {
if (Polygon.Num() > 0) {
// Convert to LLH if needed for ACesiumCartographicPolygon
for (const FVector& Point : Polygon) {
FVector LLH = Georeference->TransformUnrealPositionToLongitudeLatitudeHeight(Point);
// ...
}
}
}));