Skip to content

Commit

Permalink
HeightSampled -> SampleSuccess, update cesium-native.
Browse files Browse the repository at this point in the history
  • Loading branch information
kring committed Sep 27, 2024
1 parent 78d279d commit 07d8954
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions Source/CesiumRuntime/Private/Cesium3DTileset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ void ACesium3DTileset::SampleHeightMostDetailed(
if (!IsValid(this))
return;

check(result.positions.size() == result.heightSampled.size());
check(result.positions.size() == result.sampleSuccess.size());

// This should do nothing, but will prevent undefined behavior if
// the array sizes are unexpectedly different.
result.heightSampled.resize(result.positions.size(), false);
result.sampleSuccess.resize(result.positions.size(), false);

TArray<FCesiumSampleHeightResult> sampleHeightResults;
sampleHeightResults.Reserve(result.positions.size());
Expand All @@ -181,7 +181,7 @@ void ACesium3DTileset::SampleHeightMostDetailed(
CesiumUtility::Math::radiansToDegrees(position.longitude),
CesiumUtility::Math::radiansToDegrees(position.latitude),
position.height);
unrealResult.HeightSampled = result.heightSampled[i];
unrealResult.SampleSuccess = result.sampleSuccess[i];

sampleHeightResults.Emplace(std::move(unrealResult));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ bool RunSingleQueryTest(
const FVector& queryLongitudeLatitudeHeight =
testResults.heightResults[resultIndex].LongitudeLatitudeHeight;

if (!testResults.heightResults[resultIndex].HeightSampled) {
if (!testResults.heightResults[resultIndex].SampleSuccess) {
UE_LOG(
LogCesium,
Error,
Expand Down Expand Up @@ -401,7 +401,7 @@ bool RunMultipleQueryTest(

const FVector& newCoordinate =
results[0].LongitudeLatitudeHeight;
if (!results[0].HeightSampled) {
if (!results[0].SampleSuccess) {
UE_LOG(
LogCesium,
Error,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void FSampleHeightMostDetailedSpec::Define() {
const TArray<FString>& warnings) {
TestEqual("Number of results", result.Num(), 1);
TestEqual("Number of warnings", warnings.Num(), 0);
TestTrue("HeightSampled", result[0].HeightSampled);
TestTrue("SampleSuccess", result[0].SampleSuccess);
TestEqual(
"Longitude",
result[0].LongitudeLatitudeHeight.X,
Expand Down Expand Up @@ -106,7 +106,7 @@ void FSampleHeightMostDetailedSpec::Define() {
const TArray<FString>& warnings) {
TestEqual("Number of results", result.Num(), 2);
TestEqual("Number of warnings", warnings.Num(), 0);
TestTrue("HeightSampled", result[0].HeightSampled);
TestTrue("SampleSuccess", result[0].SampleSuccess);
TestEqual(
"Longitude",
result[0].LongitudeLatitudeHeight.X,
Expand All @@ -123,7 +123,7 @@ void FSampleHeightMostDetailedSpec::Define() {
result[0].LongitudeLatitudeHeight.Z,
1.0,
1.0));
TestTrue("HeightSampled", result[1].HeightSampled);
TestTrue("SampleSuccess", result[1].SampleSuccess);
TestEqual(
"Longitude",
result[1].LongitudeLatitudeHeight.X,
Expand Down Expand Up @@ -178,7 +178,7 @@ void FSampleHeightMostDetailedSpec::Define() {
const TArray<FString>& warnings) {
TestEqual("Number of results", result.Num(), 1);
TestEqual("Number of warnings", warnings.Num(), 0);
TestTrue("HeightSampled", !result[0].HeightSampled);
TestTrue("SampleSuccess", !result[0].SampleSuccess);
TestEqual(
"Longitude",
result[0].LongitudeLatitudeHeight.X,
Expand Down Expand Up @@ -215,7 +215,7 @@ void FSampleHeightMostDetailedSpec::Define() {
const TArray<FString>& warnings) {
TestEqual("Number of results", result.Num(), 1);
TestEqual("Number of warnings", warnings.Num(), 0);
TestTrue("HeightSampled", result[0].HeightSampled);
TestTrue("SampleSuccess", result[0].SampleSuccess);
TestEqual(
"Longitude",
result[0].LongitudeLatitudeHeight.X,
Expand Down
6 changes: 3 additions & 3 deletions Source/CesiumRuntime/Public/CesiumSampleHeightResult.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ struct CESIUMRUNTIME_API FCesiumSampleHeightResult {

/**
* The Longitude (X) and Latitude (Y) are the same values provided on input.
* The Height (Z) is the height sampled from the tileset if the HeightSampled
* property is true, or the original height provided on input if HeightSampled
* The Height (Z) is the height sampled from the tileset if the SampleSuccess
* property is true, or the original height provided on input if SampleSuccess
* is false.
*/
UPROPERTY(BlueprintReadWrite, Category = "Cesium")
Expand All @@ -28,5 +28,5 @@ struct CESIUMRUNTIME_API FCesiumSampleHeightResult {
* will have more information about the problem.
*/
UPROPERTY(BlueprintReadWrite, Category = "Cesium")
bool HeightSampled;
bool SampleSuccess;
};

0 comments on commit 07d8954

Please sign in to comment.