diff --git a/CHANGES.md b/CHANGES.md index 0bf74aa4a..e30b28777 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,6 @@ # Change Log -### Next version (not released yet) +### v2.9.0 - 2024-10-01 ##### Additions :tada: @@ -11,6 +11,8 @@ - Drastically reduced tile mesh memory usage in UE 5.3 and 5.4 by working around a bug that causes those engine versions to add more texture coordinate sets than necessary. - Fixed a bug where the `scale`, `noData`, and `default` values of a property in `EXT_strutural_metadata` were not correctly passed to the tileset's material. +This release updates [cesium-native](https://github.com/CesiumGS/cesium-native) from v0.39.0 to v0.40.1. See the [changelog](https://github.com/CesiumGS/cesium-native/blob/main/CHANGES.md) for a complete list of changes in cesium-native. + ### v2.8.0 - 2024-09-02 ##### Additions :tada: diff --git a/CesiumForUnreal.uplugin b/CesiumForUnreal.uplugin index d73b5454b..9dd6d1bb9 100644 --- a/CesiumForUnreal.uplugin +++ b/CesiumForUnreal.uplugin @@ -1,7 +1,7 @@ { "FileVersion": 3, - "Version": 63, - "VersionName": "2.8.0", + "Version": 64, + "VersionName": "2.9.0", "FriendlyName": "Cesium for Unreal", "Description": "Unlock the 3D geospatial ecosystem in Unreal Engine with real-world 3D content and a high accuracy full-scale WGS84 globe.", "Category": "Geospatial", diff --git a/Source/CesiumRuntime/Private/Cesium3DTileset.cpp b/Source/CesiumRuntime/Private/Cesium3DTileset.cpp index 3e2dcc9ef..c1aa0d900 100644 --- a/Source/CesiumRuntime/Private/Cesium3DTileset.cpp +++ b/Source/CesiumRuntime/Private/Cesium3DTileset.cpp @@ -144,17 +144,29 @@ void ACesium3DTileset::SampleHeightMostDetailed( position.Z)); } - CesiumAsync::Future future = - this->_pTileset - ? this->_pTileset->sampleHeightMostDetailed(positions) - : getAsyncSystem().createResolvedFuture( - Cesium3DTilesSelection::SampleHeightResult{ - std::move(positions), - std::vector(positions.size(), false), - {"Could not sample heights from tileset because it has not " - "been created."}}); - - std::move(future).thenImmediately( + auto sampleHeights = [this, &positions]() mutable { + if (this->_pTileset) { + return this->_pTileset->sampleHeightMostDetailed(positions) + .catchImmediately([positions = std::move(positions)]( + std::exception&& exception) mutable { + std::vector sampleSuccess(positions.size(), false); + return Cesium3DTilesSelection::SampleHeightResult{ + std::move(positions), + std::move(sampleSuccess), + {exception.what()}}; + }); + } else { + std::vector sampleSuccess(positions.size(), false); + return getAsyncSystem().createResolvedFuture( + Cesium3DTilesSelection::SampleHeightResult{ + std::move(positions), + std::move(sampleSuccess), + {"Could not sample heights from tileset because it has not " + "been created."}}); + } + }; + + sampleHeights().thenImmediately( [this, OnHeightsSampled = std::move(OnHeightsSampled)]( Cesium3DTilesSelection::SampleHeightResult&& result) { if (!IsValid(this)) diff --git a/Source/CesiumRuntime/Private/Tests/CesiumSceneGeneration.cpp b/Source/CesiumRuntime/Private/Tests/CesiumSceneGeneration.cpp index c0e2c15fc..0d65eb89e 100644 --- a/Source/CesiumRuntime/Private/Tests/CesiumSceneGeneration.cpp +++ b/Source/CesiumRuntime/Private/Tests/CesiumSceneGeneration.cpp @@ -19,7 +19,7 @@ namespace Cesium { FString SceneGenerationContext::testIonToken( - "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiI4NDFlMWY2Ny01Y2MxLTRkNTMtOGJhNS04NzQzNGM1Mjg2YTkiLCJpZCI6MjU5LCJpYXQiOjE3MjUyNjIwMzR9.enFkJqTnXmbEkGeQjLzyw2iPEtS2vq6qyXAqQnhCzTg"); + "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIwNzA3YWIzNS0xMjI5LTQ3MWEtOTgyNS05OTk0YThlOTE4NzMiLCJpZCI6MjU5LCJpYXQiOjE3Mjc3MzgxNjJ9.vll2Xe-NPuNPiC0KSe8uN7hgG-ldlalcXfdDBxxDkXY"); void SceneGenerationContext::setCommonProperties( const FVector& origin, diff --git a/Source/CesiumRuntime/Private/Tests/SampleHeightMostDetailed.spec.cpp b/Source/CesiumRuntime/Private/Tests/SampleHeightMostDetailed.spec.cpp index 4dd80b517..6f766faff 100644 --- a/Source/CesiumRuntime/Private/Tests/SampleHeightMostDetailed.spec.cpp +++ b/Source/CesiumRuntime/Private/Tests/SampleHeightMostDetailed.spec.cpp @@ -298,4 +298,59 @@ void FSampleHeightMostDetailedSpec::Define() { })); }); }); + + Describe("Broken tileset", [this]() { + BeforeEach([this]() { CesiumTestHelpers::pushAllowTickInEditor(); }); + + AfterEach(EAsyncExecution::TaskGraphMainThread, [this]() { + CesiumTestHelpers::popAllowTickInEditor(); + }); + + LatentIt( + "", + EAsyncExecution::TaskGraphMainThread, + [this](const FDoneDelegate& done) { + // Two slightly different error messages will occur, depending on + // whether there's a web server running on localhost. + this->AddExpectedError( + TEXT("(Errors when loading)|(error occurred)")); + + UWorld* pWorld = CesiumTestHelpers::getGlobalWorldContext(); + + ACesium3DTileset* pTileset = pWorld->SpawnActor(); + pTileset->SetTilesetSource(ETilesetSource::FromUrl); + pTileset->SetUrl("http://localhost/notgonnawork"); + + pTileset->SampleHeightMostDetailed( + {FVector(-105.1, 40.1, 1.0)}, + FCesiumSampleHeightMostDetailedCallback::CreateLambda( + [this, done]( + ACesium3DTileset* pTileset, + const TArray& result, + const TArray& warnings) { + TestEqual("Number of results", result.Num(), 1); + TestEqual("Number of warnings", warnings.Num(), 1); + TestFalse("SampleSuccess", result[0].SampleSuccess); + TestEqual( + "Longitude", + result[0].LongitudeLatitudeHeight.X, + -105.1, + 1e-12); + TestEqual( + "Latitude", + result[0].LongitudeLatitudeHeight.Y, + 40.1, + 1e-12); + TestEqual( + "Height", + result[0].LongitudeLatitudeHeight.Z, + 1.0, + 1e-12); + TestTrue( + "Error message", + warnings[0].Contains(TEXT("failed to load"))); + done.ExecuteIfBound(); + })); + }); + }); } diff --git a/extern/cesium-native b/extern/cesium-native index be5145872..82fb7e8fb 160000 --- a/extern/cesium-native +++ b/extern/cesium-native @@ -1 +1 @@ -Subproject commit be514587224ebd8aed73c249135cec08cbc94732 +Subproject commit 82fb7e8fb38a98163a96df806f5ed21d4f7117e8 diff --git a/package.json b/package.json index 3305d76c0..b5e9e7cee 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cesium-unreal", - "version": "2.8.0", + "version": "2.9.0", "description": "Cesium for Unreal", "main": "index.js", "directories": {