From 52897b27f5eafda1cee1262d3c294b382030dbe3 Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Thu, 20 Jul 2023 21:15:01 +1000 Subject: [PATCH 01/13] Lots of CesiumGeoreference cleanup. --- .../Private/CesiumCartographicPolygon.cpp | 10 +- .../Private/CesiumGeoreference.cpp | 335 ++++------- .../Private/CesiumGlobeAnchorComponent.cpp | 10 +- .../Private/CesiumSubLevelComponent.cpp | 16 +- Source/CesiumRuntime/Private/CesiumSunSky.cpp | 16 +- .../Private/CesiumWgs84Ellipsoid.cpp | 63 +++ .../Private/GlobeAwareDefaultPawn.cpp | 7 +- .../Private/Tests/SubLevels.spec.cpp | 18 +- .../CesiumRuntime/Public/CesiumGeoreference.h | 518 +++++++----------- .../Public/CesiumWgs84Ellipsoid.h | 74 +++ 10 files changed, 474 insertions(+), 593 deletions(-) create mode 100644 Source/CesiumRuntime/Private/CesiumWgs84Ellipsoid.cpp create mode 100644 Source/CesiumRuntime/Public/CesiumWgs84Ellipsoid.h diff --git a/Source/CesiumRuntime/Private/CesiumCartographicPolygon.cpp b/Source/CesiumRuntime/Private/CesiumCartographicPolygon.cpp index 34ccc45e4..d81260681 100644 --- a/Source/CesiumRuntime/Private/CesiumCartographicPolygon.cpp +++ b/Source/CesiumRuntime/Private/CesiumCartographicPolygon.cpp @@ -63,14 +63,12 @@ ACesiumCartographicPolygon::CreateCartographicPolygon( this->Polygon->GetLocationAtSplinePoint( i, ESplineCoordinateSpace::World)); - glm::dvec3 cartographic = + FVector cartographic = this->GlobeAnchor->ResolveGeoreference() - ->TransformUnrealToLongitudeLatitudeHeight(glm::dvec3( - unrealPosition.X, - unrealPosition.Y, - unrealPosition.Z)); + ->TransformUnrealToLongitudeLatitudeHeight( + FVector(unrealPosition.X, unrealPosition.Y, unrealPosition.Z)); polygon[i] = - glm::dvec2(glm::radians(cartographic.x), glm::radians(cartographic.y)); + glm::dvec2(glm::radians(cartographic.X), glm::radians(cartographic.Y)); } return CartographicPolygon(polygon); diff --git a/Source/CesiumRuntime/Private/CesiumGeoreference.cpp b/Source/CesiumRuntime/Private/CesiumGeoreference.cpp index d35eedbe5..b6f293909 100644 --- a/Source/CesiumRuntime/Private/CesiumGeoreference.cpp +++ b/Source/CesiumRuntime/Private/CesiumGeoreference.cpp @@ -121,13 +121,7 @@ ACesiumGeoreference::GetDefaultGeoreference(const UObject* WorldContextObject) { return pGeoreference; } -ACesiumGeoreference::ACesiumGeoreference() - : AActor(), - _ellipsoidRadii{ - CesiumGeospatial::Ellipsoid::WGS84.getRadii().x, - CesiumGeospatial::Ellipsoid::WGS84.getRadii().y, - CesiumGeospatial::Ellipsoid::WGS84.getRadii().z}, - _geoTransforms() { +ACesiumGeoreference::ACesiumGeoreference() : AActor(), _geoTransforms() { PrimaryActorTick.bCanEverTick = true; this->Root = CreateDefaultSubobject(TEXT("Root")); @@ -232,7 +226,7 @@ FString longPackageNameToCesiumName(UWorld* pWorld, const TStringish& name) { } // namespace #if WITH_EDITOR -void ACesiumGeoreference::_updateCesiumSubLevels() { +void ACesiumGeoreference::_createSubLevelsFromWorldComposition() { UWorld* pWorld = this->GetWorld(); if (!IsValid(pWorld)) { // This happens for the georeference that is shown in the @@ -339,57 +333,86 @@ void ACesiumGeoreference::_updateCesiumSubLevels() { } #endif -void ACesiumGeoreference::SetScale(double NewScale) { - if (NewScale < 1e-6) { - this->Scale = 1e-6; - } else { - this->Scale = NewScale; - } - this->UpdateGeoreference(); -} - -double ACesiumGeoreference::GetScale() const { return Scale; } - FVector ACesiumGeoreference::GetGeoreferenceOriginLongitudeLatitudeHeight() const { return FVector(OriginLongitude, OriginLatitude, OriginHeight); } void ACesiumGeoreference::SetGeoreferenceOriginLongitudeLatitudeHeight( - const glm::dvec3& targetLongitudeLatitudeHeight) { + const FVector& targetLongitudeLatitudeHeight) { this->_setGeoreferenceOrigin( - targetLongitudeLatitudeHeight.x, - targetLongitudeLatitudeHeight.y, - targetLongitudeLatitudeHeight.z); + targetLongitudeLatitudeHeight.X, + targetLongitudeLatitudeHeight.Y, + targetLongitudeLatitudeHeight.Z); } -void ACesiumGeoreference::SetGeoreferenceOrigin( - const glm::dvec3& TargetLongitudeLatitudeHeight) { - UE_LOG( - LogCesium, - Warning, - TEXT( - "SetGeoreferenceOrigin was renamed to SetGeoreferenceOriginLongitudeLatitudeHeight.")); - SetGeoreferenceOriginLongitudeLatitudeHeight(TargetLongitudeLatitudeHeight); +void ACesiumGeoreference::SetGeoreferenceOriginEcef(const FVector& TargetEcef) { + this->SetGeoreferenceOriginLongitudeLatitudeHeight(VecMath::createVector( + _geoTransforms.TransformEcefToLongitudeLatitudeHeight( + VecMath::createVector3D(TargetEcef)))); } -void ACesiumGeoreference::SetGeoreferenceOriginEcef( - const glm::dvec3& TargetEcef) { - SetGeoreferenceOriginLongitudeLatitudeHeight( - _geoTransforms.TransformEcefToLongitudeLatitudeHeight(TargetEcef)); +EOriginPlacement ACesiumGeoreference::GetOriginPlacement() const { + return this->OriginPlacement; } -void ACesiumGeoreference::SetGeoreferenceOriginLongitudeLatitudeHeight( - const FVector& targetLongitudeLatitudeHeight) { - this->SetGeoreferenceOriginLongitudeLatitudeHeight(glm::dvec3( - targetLongitudeLatitudeHeight.X, - targetLongitudeLatitudeHeight.Y, - targetLongitudeLatitudeHeight.Z)); +void ACesiumGeoreference::SetOriginPlacement(EOriginPlacement NewValue) { + this->OriginPlacement = NewValue; + this->UpdateGeoreference(); } -void ACesiumGeoreference::SetGeoreferenceOriginEcef(const FVector& TargetEcef) { - this->SetGeoreferenceOriginEcef( - glm::dvec3(TargetEcef.X, TargetEcef.Y, TargetEcef.Z)); +double ACesiumGeoreference::GetOriginLatitude() const { + return this->OriginLatitude; +} + +void ACesiumGeoreference::SetOriginLatitude(double NewValue) { + this->OriginLatitude = NewValue; + this->UpdateGeoreference(); +} + +double ACesiumGeoreference::GetOriginLongitude() const { + return this->OriginLongitude; +} + +void ACesiumGeoreference::SetOriginLongitude(double NewValue) { + this->OriginLongitude = NewValue; + this->UpdateGeoreference(); +} + +double ACesiumGeoreference::GetOriginHeight() const { + return this->OriginHeight; +} + +void ACesiumGeoreference::SetOriginHeight(double NewValue) { + this->OriginHeight = NewValue; + this->UpdateGeoreference(); +} + +double ACesiumGeoreference::GetScale() const { return this->Scale; } + +void ACesiumGeoreference::SetScale(double NewValue) { + if (NewValue < 1e-6) { + this->Scale = 1e-6; + } else { + this->Scale = NewValue; + } + this->UpdateGeoreference(); +} + +APlayerCameraManager* ACesiumGeoreference::GetSubLevelCamera() const { + return this->SubLevelCamera; +} + +void ACesiumGeoreference::SetSubLevelCamera(APlayerCameraManager* NewValue) { + this->SubLevelCamera = NewValue; +} + +bool ACesiumGeoreference::GetShowLoadRadii() const { + return this->ShowLoadRadii; +} + +void ACesiumGeoreference::SetShowLoadRadii(bool NewValue) { + this->ShowLoadRadii = NewValue; } // Called when the game starts or when spawned @@ -426,13 +449,11 @@ void ACesiumGeoreference::BeginPlay() { UpdateGeoreference(); } -void ACesiumGeoreference::EndPlay(const EEndPlayReason::Type EndPlayReason) { - Super::EndPlay(EndPlayReason); -} - /** In case the CesiumGeoreference gets spawned at run time, instead of design * time, ensure that frames are updated */ void ACesiumGeoreference::OnConstruction(const FTransform& Transform) { + Super::OnConstruction(Transform); + UE_LOG( LogCesium, Verbose, @@ -444,6 +465,18 @@ void ACesiumGeoreference::OnConstruction(const FTransform& Transform) { void ACesiumGeoreference::BeginDestroy() { Super::BeginDestroy(); } +void ACesiumGeoreference::PostLoad() { + Super::PostLoad(); + +#if WITH_EDITOR + if (GEditor && IsValid(this->GetWorld()) && + IsValid(this->GetWorld()->WorldComposition) && + !this->GetWorld()->IsGameWorld()) { + this->_createSubLevelsFromWorldComposition(); + } +#endif +} + void ACesiumGeoreference::UpdateGeoreference() { this->_updateGeoTransforms(); @@ -544,51 +577,6 @@ void ACesiumGeoreference::_showSubLevelLoadRadii() const { } #endif // WITH_EDITOR -#if WITH_EDITOR -void ACesiumGeoreference::_handleViewportOriginEditing() { - if (!this->EditOriginInViewport) { - return; - } - FHitResult mouseRayResults; - bool mouseRaySuccess; - - this->_lineTraceViewportMouse(false, mouseRaySuccess, mouseRayResults); - - if (!mouseRaySuccess) { - return; - } - const FIntVector& originLocation = this->GetWorld()->OriginLocation; - - FVector grabbedLocation = mouseRayResults.Location; - // convert from UE to ECEF to LongitudeLatitudeHeight - glm::dvec4 grabbedLocationAbs = - VecMath::add4D(grabbedLocation, originLocation); - - glm::dvec3 grabbedLocationECEF = glm::dvec3( - this->_geoTransforms - .GetAbsoluteUnrealWorldToEllipsoidCenteredTransform() * - grabbedLocationAbs); - - glm::dvec3 cartographic = - _geoTransforms.TransformEcefToLongitudeLatitudeHeight( - grabbedLocationECEF); - - UE_LOG( - LogActor, - Warning, - TEXT("Mouse Location: (Longitude: %f, Latitude: %f, Height: %f)"), - cartographic.x, - cartographic.y, - cartographic.z); - - // TODO: find editor viewport mouse click event - // if (mouseDown) { - // this->_setGeoreferenceOrigin() - // this->EditOriginInViewport = false; - //} -} -#endif // WITH_EDITOR - namespace { /** * @brief Clamping addition. @@ -686,10 +674,7 @@ void ACesiumGeoreference::_updateGeoTransforms() { } this->_geoTransforms = GeoTransforms( - CesiumGeospatial::Ellipsoid( - this->_ellipsoidRadii[0], - this->_ellipsoidRadii[1], - this->_ellipsoidRadii[2]), + CesiumGeospatial::Ellipsoid::WGS84, center, this->Scale / 100.0); } @@ -698,16 +683,7 @@ void ACesiumGeoreference::Tick(float DeltaTime) { Super::Tick(DeltaTime); #if WITH_EDITOR - // There doesn't appear to be a good way to be notified about the wide variety - // of level manipulations we care about, so in the Editor we'll poll. - if (GEditor && IsValid(this->GetWorld()) && - IsValid(this->GetWorld()->WorldComposition) && - !this->GetWorld()->IsGameWorld()) { - this->_updateCesiumSubLevels(); - } - _showSubLevelLoadRadii(); - _handleViewportOriginEditing(); #endif if (this->_shouldManageSubLevels()) { @@ -728,12 +704,6 @@ void ACesiumGeoreference::Serialize(FArchive& Ar) { * Useful Conversion Functions */ -glm::dvec3 ACesiumGeoreference::TransformLongitudeLatitudeHeightToEcef( - const glm::dvec3& longitudeLatitudeHeight) const { - return _geoTransforms.TransformLongitudeLatitudeHeightToEcef( - longitudeLatitudeHeight); -} - FVector ACesiumGeoreference::TransformLongitudeLatitudeHeightToEcef( const FVector& longitudeLatitudeHeight) const { glm::dvec3 ecef = this->_geoTransforms.TransformLongitudeLatitudeHeightToEcef( @@ -741,11 +711,6 @@ FVector ACesiumGeoreference::TransformLongitudeLatitudeHeightToEcef( return FVector(ecef.x, ecef.y, ecef.z); } -glm::dvec3 ACesiumGeoreference::TransformEcefToLongitudeLatitudeHeight( - const glm::dvec3& ecef) const { - return _geoTransforms.TransformEcefToLongitudeLatitudeHeight(ecef); -} - FVector ACesiumGeoreference::TransformEcefToLongitudeLatitudeHeight( const FVector& ecef) const { glm::dvec3 llh = this->_geoTransforms.TransformEcefToLongitudeLatitudeHeight( @@ -753,13 +718,6 @@ FVector ACesiumGeoreference::TransformEcefToLongitudeLatitudeHeight( return FVector(llh.x, llh.y, llh.z); } -glm::dvec3 ACesiumGeoreference::TransformLongitudeLatitudeHeightToUnreal( - const glm::dvec3& longitudeLatitudeHeight) const { - return this->_geoTransforms.TransformLongitudeLatitudeHeightToUnreal( - glm::dvec3(CesiumActors::getWorldOrigin4D(this)), - longitudeLatitudeHeight); -} - FVector ACesiumGeoreference::TransformLongitudeLatitudeHeightToUnreal( const FVector& longitudeLatitudeHeight) const { glm::dvec3 ue = this->_geoTransforms.TransformLongitudeLatitudeHeightToUnreal( @@ -768,13 +726,6 @@ FVector ACesiumGeoreference::TransformLongitudeLatitudeHeightToUnreal( return FVector(ue.x, ue.y, ue.z); } -glm::dvec3 ACesiumGeoreference::TransformUnrealToLongitudeLatitudeHeight( - const glm::dvec3& ue) const { - return this->_geoTransforms.TransformUnrealToLongitudeLatitudeHeight( - glm::dvec3(CesiumActors::getWorldOrigin4D(this)), - ue); -} - FVector ACesiumGeoreference::TransformUnrealToLongitudeLatitudeHeight( const FVector& ue) const { glm::dvec3 llh = @@ -784,13 +735,6 @@ FVector ACesiumGeoreference::TransformUnrealToLongitudeLatitudeHeight( return FVector(llh.x, llh.y, llh.z); } -glm::dvec3 -ACesiumGeoreference::TransformEcefToUnreal(const glm::dvec3& ecef) const { - return this->_geoTransforms.TransformEcefToUnreal( - glm::dvec3(CesiumActors::getWorldOrigin4D(this)), - ecef); -} - FVector ACesiumGeoreference::TransformEcefToUnreal(const FVector& ecef) const { glm::dvec3 ue = this->_geoTransforms.TransformEcefToUnreal( glm::dvec3(CesiumActors::getWorldOrigin4D(this)), @@ -798,13 +742,6 @@ FVector ACesiumGeoreference::TransformEcefToUnreal(const FVector& ecef) const { return FVector(ue.x, ue.y, ue.z); } -glm::dvec3 -ACesiumGeoreference::TransformUnrealToEcef(const glm::dvec3& ue) const { - return this->_geoTransforms.TransformUnrealToEcef( - glm::dvec3(CesiumActors::getWorldOrigin4D(this)), - ue); -} - FVector ACesiumGeoreference::TransformUnrealToEcef(const FVector& ue) const { glm::dvec3 ecef = this->_geoTransforms.TransformUnrealToEcef( glm::dvec3(CesiumActors::getWorldOrigin4D(this)), @@ -812,47 +749,24 @@ FVector ACesiumGeoreference::TransformUnrealToEcef(const FVector& ue) const { return FVector(ecef.x, ecef.y, ecef.z); } -glm::dquat ACesiumGeoreference::TransformRotatorUnrealToEastSouthUp( - const glm::dquat& UeRotator, - const glm::dvec3& UeLocation) const { - return this->_geoTransforms.TransformRotatorUnrealToEastSouthUp( - glm::dvec3(CesiumActors::getWorldOrigin4D(this)), - UeRotator, - UeLocation); -} - FRotator ACesiumGeoreference::TransformRotatorUnrealToEastSouthUp( const FRotator& UERotator, const FVector& ueLocation) const { - glm::dquat q = TransformRotatorUnrealToEastSouthUp( - VecMath::createQuaternion(UERotator.Quaternion()), - VecMath::createVector3D(ueLocation)); - return VecMath::createRotator(q); -} - -glm::dquat ACesiumGeoreference::TransformRotatorEastSouthUpToUnreal( - const glm::dquat& EsuRotator, - const glm::dvec3& UeLocation) const { - return this->_geoTransforms.TransformRotatorEastSouthUpToUnreal( - glm::dvec3(CesiumActors::getWorldOrigin4D(this)), - EsuRotator, - UeLocation); + return VecMath::createRotator( + this->_geoTransforms.TransformRotatorUnrealToEastSouthUp( + glm::dvec3(CesiumActors::getWorldOrigin4D(this)), + VecMath::createQuaternion(UERotator.Quaternion()), + VecMath::createVector3D(ueLocation))); } FRotator ACesiumGeoreference::TransformRotatorEastSouthUpToUnreal( const FRotator& EsuRotator, const FVector& ueLocation) const { - glm::dquat q = TransformRotatorEastSouthUpToUnreal( - VecMath::createQuaternion(EsuRotator.Quaternion()), - VecMath::createVector3D(ueLocation)); - return VecMath::createRotator(q); -} - -glm::dmat3 -ACesiumGeoreference::ComputeEastSouthUpToUnreal(const glm::dvec3& ue) const { - return _geoTransforms.ComputeEastSouthUpToUnreal( - glm::dvec3(CesiumActors::getWorldOrigin4D(this)), - ue); + return VecMath::createRotator( + this->_geoTransforms.TransformRotatorEastSouthUpToUnreal( + glm::dvec3(CesiumActors::getWorldOrigin4D(this)), + VecMath::createQuaternion(EsuRotator.Quaternion()), + VecMath::createVector3D(ueLocation))); } FMatrix @@ -863,11 +777,6 @@ ACesiumGeoreference::ComputeEastSouthUpToUnreal(const FVector& ue) const { return VecMath::createMatrix(esuToUe); } -glm::dmat3 -ACesiumGeoreference::ComputeEastNorthUpToEcef(const glm::dvec3& ecef) const { - return _geoTransforms.ComputeEastNorthUpToEcef(ecef); -} - FMatrix ACesiumGeoreference::ComputeEastNorthUpToEcef(const FVector& ecef) const { glm::dmat3 enuToEcef = this->_geoTransforms.ComputeEastNorthUpToEcef( @@ -890,66 +799,6 @@ void ACesiumGeoreference::_setGeoreferenceOrigin( this->UpdateGeoreference(); } -// TODO: should consider raycasting the WGS84 ellipsoid instead. The Unreal -// raycast seems to be inaccurate at glancing angles, perhaps due to the large -// single-precision distances. -#if WITH_EDITOR -void ACesiumGeoreference::_lineTraceViewportMouse( - const bool ShowTrace, - bool& Success, - FHitResult& HitResult) const { - HitResult = FHitResult(); - Success = false; - - UWorld* world = this->GetWorld(); - - FViewport* pViewport = GEditor->GetActiveViewport(); - FViewportClient* pViewportClient = pViewport->GetClient(); - FEditorViewportClient* pEditorViewportClient = - static_cast(pViewportClient); - - if (!world || !pEditorViewportClient || - !pEditorViewportClient->Viewport->HasFocus()) { - return; - } - - FViewportCursorLocation cursor = - pEditorViewportClient->GetCursorWorldLocationFromMousePos(); - - const FVector& viewLoc = cursor.GetOrigin(); - const FVector& viewDir = cursor.GetDirection(); - - // TODO (low prio, because this whole function is preliminary) : - // This radius should probably be taken from the ellipsoid - const double earthRadiusCm = 637100000.0; - FVector lineEnd = viewLoc + viewDir * earthRadiusCm; - - static const FName LineTraceSingleName(TEXT("LevelEditorLineTrace")); - if (ShowTrace) { - world->DebugDrawTraceTag = LineTraceSingleName; - } else { - world->DebugDrawTraceTag = NAME_None; - } - - FCollisionQueryParams CollisionParams(LineTraceSingleName); - - FCollisionObjectQueryParams ObjectParams = - FCollisionObjectQueryParams(ECC_WorldStatic); - ObjectParams.AddObjectTypesToQuery(ECC_WorldDynamic); - ObjectParams.AddObjectTypesToQuery(ECC_Pawn); - ObjectParams.AddObjectTypesToQuery(ECC_Visibility); - - if (world->LineTraceSingleByObjectType( - HitResult, - viewLoc, - lineEnd, - ObjectParams, - CollisionParams)) { - Success = true; - } -} -#endif - bool ACesiumGeoreference::_shouldManageSubLevels() const { // Only a Georeference in the PersistentLevel should manage sub-levels. return this->GetLevel()->IsPersistentLevel(); diff --git a/Source/CesiumRuntime/Private/CesiumGlobeAnchorComponent.cpp b/Source/CesiumRuntime/Private/CesiumGlobeAnchorComponent.cpp index 7987b5584..96e70627f 100644 --- a/Source/CesiumRuntime/Private/CesiumGlobeAnchorComponent.cpp +++ b/Source/CesiumRuntime/Private/CesiumGlobeAnchorComponent.cpp @@ -6,6 +6,7 @@ #include "CesiumGeoreference.h" #include "CesiumRuntime.h" #include "CesiumTransforms.h" +#include "CesiumWgs84Ellipsoid.h" #include "Components/SceneComponent.h" #include "Engine/World.h" #include "GameFramework/Actor.h" @@ -103,9 +104,8 @@ void UCesiumGlobeAnchorComponent::SnapLocalUpToEllipsoidNormal() { const glm::dvec3 actorUp = glm::normalize(currentRotation[2]); // Compute the surface normal of the ellipsoid - const glm::dvec3 ellipsoidNormal = - this->ResolvedGeoreference->ComputeGeodeticSurfaceNormal( - VecMath::createVector3D(this->GetECEF())); + glm::dvec3 ellipsoidNormal = VecMath::createVector3D( + UCesiumWgs84Ellipsoid::GeodeticSurfaceNormal(this->GetECEF())); // Find the shortest rotation to align local up with the ellipsoid normal const glm::dquat R = glm::rotation(actorUp, ellipsoidNormal); @@ -231,8 +231,8 @@ void UCesiumGlobeAnchorComponent::MoveToLongitudeLatitudeHeight( } this->MoveToECEF( - this->ResolvedGeoreference->TransformLongitudeLatitudeHeightToEcef( - TargetLongitudeLatitudeHeight)); + UCesiumWgs84Ellipsoid::LongitudeLatitudeHeightToEarthCenteredEarthFixed( + VecMath::createVector(TargetLongitudeLatitudeHeight))); } void UCesiumGlobeAnchorComponent::MoveToLongitudeLatitudeHeight( diff --git a/Source/CesiumRuntime/Private/CesiumSubLevelComponent.cpp b/Source/CesiumRuntime/Private/CesiumSubLevelComponent.cpp index 106357bfc..1a62c3536 100644 --- a/Source/CesiumRuntime/Private/CesiumSubLevelComponent.cpp +++ b/Source/CesiumRuntime/Private/CesiumSubLevelComponent.cpp @@ -254,11 +254,13 @@ void UCesiumSubLevelComponent::UpdateGeoreferenceIfSubLevelIsActive() { // target level and there is no current level. if (pCurrent == pOwner || (pCurrent == nullptr && pTarget == pOwner)) { // Apply the sub-level's origin to the georeference, if it's different. - if (this->OriginLongitude != this->ResolvedGeoreference->OriginLongitude || - this->OriginLatitude != this->ResolvedGeoreference->OriginLatitude || - this->OriginHeight != this->ResolvedGeoreference->OriginHeight) { + if (this->OriginLongitude != + this->ResolvedGeoreference->GetOriginLongitude() || + this->OriginLatitude != + this->ResolvedGeoreference->GetOriginLatitude() || + this->OriginHeight != this->ResolvedGeoreference->GetOriginHeight()) { this->ResolvedGeoreference->SetGeoreferenceOriginLongitudeLatitudeHeight( - glm::dvec3( + FVector( this->OriginLongitude, this->OriginLatitude, this->OriginHeight)); @@ -278,9 +280,9 @@ void UCesiumSubLevelComponent::OnComponentCreated() { UCesiumSubLevelSwitcherComponent* pSwitcher = this->_getSwitcher(); if (pSwitcher && this->ResolvedGeoreference) { - this->OriginLongitude = this->ResolvedGeoreference->OriginLongitude; - this->OriginLatitude = this->ResolvedGeoreference->OriginLatitude; - this->OriginHeight = this->ResolvedGeoreference->OriginHeight; + this->OriginLongitude = this->ResolvedGeoreference->GetOriginLongitude(); + this->OriginLatitude = this->ResolvedGeoreference->GetOriginLatitude(); + this->OriginHeight = this->ResolvedGeoreference->GetOriginHeight(); // In Editor worlds, make the newly-created sub-level the active one. Unless // it's already hidden. diff --git a/Source/CesiumRuntime/Private/CesiumSunSky.cpp b/Source/CesiumRuntime/Private/CesiumSunSky.cpp index ed8517ac2..56796ed3b 100644 --- a/Source/CesiumRuntime/Private/CesiumSunSky.cpp +++ b/Source/CesiumRuntime/Private/CesiumSunSky.cpp @@ -421,8 +421,8 @@ void ACesiumSunSky::UpdateSun_Implementation() { FSunPositionData sunPosition; USunPositionFunctionLibrary::GetSunPosition( - this->GetGeoreference()->OriginLatitude, - this->GetGeoreference()->OriginLongitude, + this->GetGeoreference()->GetOriginLatitude(), + this->GetGeoreference()->GetOriginLongitude(), this->TimeZone, isDST, this->Year, @@ -511,14 +511,14 @@ void ACesiumSunSky::UpdateAtmosphereRadius() { FVector location = transform.TransformPosition(getViewLocation(this->GetWorld())); - glm::dvec3 llh = + FVector llh = this->GetGeoreference()->TransformUnrealToLongitudeLatitudeHeight( - VecMath::createVector3D(location)); + location); // An atmosphere of this radius should circumscribe all Earth terrain. double maxRadius = 6387000.0; - if (llh.z / 1000.0 > this->CircumscribedGroundThreshold) { + if (llh.Z / 1000.0 > this->CircumscribedGroundThreshold) { this->SetSkyAtmosphereGroundRadius( this->SkyAtmosphere, maxRadius * this->_computeScale() / 1000.0); @@ -528,16 +528,16 @@ void ACesiumSunSky::UpdateAtmosphereRadius() { glm::dvec3 ecef = this->GetGeoreference() ->GetGeoTransforms() .TransformLongitudeLatitudeHeightToEcef( - glm::dvec3(llh.x, llh.y, -100.0)); + glm::dvec3(llh.X, llh.Y, -100.0)); double minRadius = glm::length(ecef); - if (llh.z / 1000.0 < this->InscribedGroundThreshold) { + if (llh.Z / 1000.0 < this->InscribedGroundThreshold) { this->SetSkyAtmosphereGroundRadius( this->SkyAtmosphere, minRadius * this->_computeScale() / 1000.0); } else { double t = - ((llh.z / 1000.0) - this->InscribedGroundThreshold) / + ((llh.Z / 1000.0) - this->InscribedGroundThreshold) / (this->CircumscribedGroundThreshold - this->InscribedGroundThreshold); double radius = glm::mix(minRadius, maxRadius, t); this->SetSkyAtmosphereGroundRadius( diff --git a/Source/CesiumRuntime/Private/CesiumWgs84Ellipsoid.cpp b/Source/CesiumRuntime/Private/CesiumWgs84Ellipsoid.cpp new file mode 100644 index 000000000..498e4583b --- /dev/null +++ b/Source/CesiumRuntime/Private/CesiumWgs84Ellipsoid.cpp @@ -0,0 +1,63 @@ +// Copyright 2020-2023 CesiumGS, Inc. and Contributors + +#include "CesiumWgs84Ellipsoid.h" +#include "VecMath.h" +#include +#include + +using namespace CesiumGeospatial; +using namespace CesiumUtility; + +FVector UCesiumWgs84Ellipsoid::GetRadii() { + const glm::dvec3& radii = Ellipsoid::WGS84.getRadii(); + return VecMath::createVector(radii); +} + +double UCesiumWgs84Ellipsoid::GetMaximumRadius() { + return Ellipsoid::WGS84.getRadii().x; +} + +double UCesiumWgs84Ellipsoid::GetMinimumRadius() { + return Ellipsoid::WGS84.getRadii().z; +} + +FVector UCesiumWgs84Ellipsoid::ScaleToGeodeticSurface( + const FVector& earthCenteredEarthFixed) { + std::optional result = Ellipsoid::WGS84.scaleToGeodeticSurface( + VecMath::createVector3D(earthCenteredEarthFixed)); + if (result) { + return VecMath::createVector(*result); + } else { + return FVector(0.0, 0.0, 0.0); + } +} + +FVector UCesiumWgs84Ellipsoid::GeodeticSurfaceNormal( + const FVector& earthCenteredEarthFixed) { + return VecMath::createVector(Ellipsoid::WGS84.geodeticSurfaceNormal( + VecMath::createVector3D(earthCenteredEarthFixed))); +} + +FVector UCesiumWgs84Ellipsoid::LongitudeLatitudeHeightToEarthCenteredEarthFixed( + const FVector& longitudeLatitudeHeight) { + glm::dvec3 cartesian = + Ellipsoid::WGS84.cartographicToCartesian(Cartographic::fromDegrees( + longitudeLatitudeHeight.X, + longitudeLatitudeHeight.Y, + longitudeLatitudeHeight.Z)); + return VecMath::createVector(cartesian); +} + +FVector UCesiumWgs84Ellipsoid::EarthCenteredEarthFixedToLongitudeLatitudeHeight( + const FVector& earthCenteredEarthFixed) { + std::optional result = Ellipsoid::WGS84.cartesianToCartographic( + VecMath::createVector3D(earthCenteredEarthFixed)); + if (result) { + return FVector( + Math::radiansToDegrees(result->longitude), + Math::radiansToDegrees(result->latitude), + result->height); + } else { + return FVector(0.0, 0.0, 0.0); + } +} diff --git a/Source/CesiumRuntime/Private/GlobeAwareDefaultPawn.cpp b/Source/CesiumRuntime/Private/GlobeAwareDefaultPawn.cpp index d47f4403f..7d8687fb9 100644 --- a/Source/CesiumRuntime/Private/GlobeAwareDefaultPawn.cpp +++ b/Source/CesiumRuntime/Private/GlobeAwareDefaultPawn.cpp @@ -9,6 +9,7 @@ #include "CesiumRuntime.h" #include "CesiumTransforms.h" #include "CesiumUtility/Math.h" +#include "CesiumWgs84Ellipsoid.h" #include "Curves/CurveFloat.h" #include "DrawDebugHelpers.h" #include "Engine/World.h" @@ -267,9 +268,9 @@ void AGlobeAwareDefaultPawn::FlyToLocationLongitudeLatitudeHeight( TEXT("GlobeAwareDefaultPawn %s does not have a valid Georeference"), *this->GetName()); } - const glm::dvec3& ecef = - this->GetGeoreference()->TransformLongitudeLatitudeHeightToEcef( - LongitudeLatitudeHeightDestination); + FVector ecef = + UCesiumWgs84Ellipsoid::LongitudeLatitudeHeightToEarthCenteredEarthFixed( + VecMath::createVector(LongitudeLatitudeHeightDestination)); this->FlyToLocationECEF( ecef, YawAtDestination, diff --git a/Source/CesiumRuntime/Private/Tests/SubLevels.spec.cpp b/Source/CesiumRuntime/Private/Tests/SubLevels.spec.cpp index 87d3ed90b..074500c80 100644 --- a/Source/CesiumRuntime/Private/Tests/SubLevels.spec.cpp +++ b/Source/CesiumRuntime/Private/Tests/SubLevels.spec.cpp @@ -137,9 +137,9 @@ void FSubLevelsSpec::Define() { pLevelComponent1->SetOriginLongitudeLatitudeHeight( FVector(4.0, 5.0, 6.0)); - TestEqual("Longitude", pGeoreference->OriginLongitude, 4.0); - TestEqual("Latitude", pGeoreference->OriginLatitude, 5.0); - TestEqual("Height", pGeoreference->OriginHeight, 6.0); + TestEqual("Longitude", pGeoreference->GetOriginLongitude(), 4.0); + TestEqual("Latitude", pGeoreference->GetOriginLatitude(), 5.0); + TestEqual("Height", pGeoreference->GetOriginHeight(), 6.0); }); }); @@ -157,9 +157,9 @@ void FSubLevelsSpec::Define() { It("", EAsyncExecution::TaskGraphMainThread, [this]() { // Verify that the previously-active sub-level isn't affected by // georeference origin changes. - double expectedLongitude = pGeoreference->OriginLongitude; - double expectedLatitude = pGeoreference->OriginLatitude; - double expectedHeight = pGeoreference->OriginHeight; + double expectedLongitude = pGeoreference->GetOriginLongitude(); + double expectedLatitude = pGeoreference->GetOriginLatitude(); + double expectedHeight = pGeoreference->GetOriginHeight(); TestNotEqual("Longitude", expectedLongitude, 7.0); TestNotEqual("Latitude", expectedLatitude, 8.0); @@ -169,13 +169,13 @@ void FSubLevelsSpec::Define() { FVector(7.0, 8.0, 9.0)); TestEqual( "Longitude", - pGeoreference->OriginLongitude, + pGeoreference->GetOriginLongitude(), expectedLongitude); TestEqual( "Latitude", - pGeoreference->OriginLatitude, + pGeoreference->GetOriginLatitude(), expectedLatitude); - TestEqual("Height", pGeoreference->OriginHeight, expectedHeight); + TestEqual("Height", pGeoreference->GetOriginHeight(), expectedHeight); }); }); diff --git a/Source/CesiumRuntime/Public/CesiumGeoreference.h b/Source/CesiumRuntime/Public/CesiumGeoreference.h index d0e9ec0b8..2fbc7af78 100644 --- a/Source/CesiumRuntime/Public/CesiumGeoreference.h +++ b/Source/CesiumRuntime/Public/CesiumGeoreference.h @@ -38,7 +38,6 @@ DECLARE_DYNAMIC_MULTICAST_DELEGATE(FGeoreferenceUpdated); UCLASS() class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { GENERATED_BODY() - public: /* * Finds and returns the actor labeled `CesiumGeoreferenceDefault` in the @@ -53,35 +52,16 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { static ACesiumGeoreference* GetDefaultGeoreference(const UObject* WorldContextObject); - ACesiumGeoreference(); - - UPROPERTY(VisibleAnywhere, Category = "Cesium") - USceneComponent* Root; - - /* - * Whether to visualize the level loading radii in the editor. Helpful for - * initially positioning the level and choosing a load radius. + /** + * A delegate that will be called whenever the Georeference is + * modified in a way that affects its computations. */ - UPROPERTY(EditAnywhere, Category = "Cesium|Cesium Sublevels") - bool ShowLoadRadii = true; + UPROPERTY(BlueprintAssignable, Category = "Cesium") + FGeoreferenceUpdated OnGeoreferenceUpdated; - /* - * The list of georeferenced sub-levels. Each of these has a corresponding - * world location that can be jumped to. Only one level can be worked on in - * the editor at a time. - * - * New levels added in the Editor should appear in this list automatically. If - * any are missing, check that "World Composition" is enabled in World - * Settings and that the level is in a Layer with Distance Based Streaming - * DISABLED. - */ - UPROPERTY( - Meta = - (DeprecatedProperty, - DeprecationMessage = - "Create sub-levels by adding a UCesiumSubLevelComponent to an ALevelInstance Actor.")) - TArray CesiumSubLevels_DEPRECATED; +#pragma region Properties +private: /** * The placement of this Actor's origin (coordinate 0,0,0) within the tileset. * @@ -93,7 +73,13 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { * this property will preserve vertex precision (and thus avoid jittering) * much better than setting the Actor's Transform property. */ - UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Cesium") + UPROPERTY( + Category = "Cesium", + EditAnywhere, + BlueprintReadWrite, + BlueprintGetter = GetOriginPlacement, + BlueprintSetter = SetOriginPlacement, + meta = (AllowPrivateAccess)) EOriginPlacement OriginPlacement = EOriginPlacement::CartographicOrigin; /** @@ -101,10 +87,15 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { * 90] */ UPROPERTY( - EditAnywhere, Category = "Cesium", + EditAnywhere, + BlueprintReadWrite, + BlueprintGetter = GetOriginLatitude, + BlueprintSetter = SetOriginLatitude, + Interp, meta = - (EditCondition = + (AllowPrivateAccess, + EditCondition = "OriginPlacement==EOriginPlacement::CartographicOrigin", ClampMin = -90.0, ClampMax = 90.0)) @@ -115,10 +106,15 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { * [-180, 180] */ UPROPERTY( - EditAnywhere, Category = "Cesium", + EditAnywhere, + BlueprintReadWrite, + BlueprintGetter = GetOriginLongitude, + BlueprintSetter = SetOriginLongitude, + Interp, meta = - (EditCondition = + (AllowPrivateAccess, + EditCondition = "OriginPlacement==EOriginPlacement::CartographicOrigin", ClampMin = -180.0, ClampMax = 180.0)) @@ -129,101 +125,80 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { * ellipsoid. */ UPROPERTY( - EditAnywhere, Category = "Cesium", + EditAnywhere, + BlueprintReadWrite, + BlueprintGetter = GetOriginHeight, + BlueprintSetter = SetOriginHeight, + Interp, meta = - (EditCondition = + (AllowPrivateAccess, + EditCondition = "OriginPlacement==EOriginPlacement::CartographicOrigin")) double OriginHeight = 2250.0; /** - * TODO: Once point-and-click georeference placement is in place, restore this - * as a UPROPERTY - */ - // UPROPERTY(EditAnywhere, Category = "Cesium", AdvancedDisplay) - bool EditOriginInViewport = false; - -#if WITH_EDITOR - /** - * Places the georeference origin at the camera's current location. Rotates - * the globe so the current longitude/latitude/height of the camera is at the - * Unreal origin. The camera is also teleported to the Unreal origin. - * - * Warning: Before clicking, ensure that all non-Cesium objects in the - * persistent level are georeferenced with the "CesiumGeoreferenceComponent" - * or attached to an actor with that component. Ensure that static actors only - * exist in georeferenced sub-levels. + * The percentage scale of the globe in the Unreal world. If this value is 50, + * for example, one meter on the globe occupies half a meter in the Unreal + * world. */ - UFUNCTION(CallInEditor, Category = "Cesium") - void PlaceGeoreferenceOriginHere(); -#endif + UPROPERTY( + Category = "Cesium", + EditAnywhere, + BlueprintReadWrite, + BlueprintSetter = SetScale, + BlueprintGetter = GetScale, + Interp, + Meta = (AllowPrivateAccess, UIMin = 0.000001, UIMax = 100.0)) + double Scale = 100.0; /** * The camera to use to determine which sub-level is closest, so that one can * be activated and all others deactivated. */ - UPROPERTY(EditAnywhere, Category = "Cesium|Cesium Sublevels") + UPROPERTY( + Category = "Cesium|Cesium Sublevels", + EditAnywhere, + BlueprintReadWrite, + BlueprintGetter = GetSubLevelCamera, + BlueprintSetter = SetSublevelCamera, + meta = (AllowPrivateAccess)) APlayerCameraManager* SubLevelCamera = nullptr; - /** - * This sets the percentage scale of the globe. For instance, if the value is - * 50, the globe will shrink by half. +#if WITH_EDITORONLY_DATA + /* + * Whether to visualize the level loading radii in the editor. Helpful for + * initially positioning the level and choosing a load radius. */ - UFUNCTION(BlueprintCallable, Category = "Cesium") - void SetScale(double NewScale); + UPROPERTY( + Category = "Cesium|Cesium Sublevels", + EditAnywhere, + BlueprintReadWrite, + BlueprintGetter = GetShowLoadRadii, + BlueprintSetter = SetShowLoadRadii, + meta = (AllowPrivateAccess)) + bool ShowLoadRadii = true; +#endif - UFUNCTION(BlueprintCallable, Category = "Cesium") - double GetScale() const; +#pragma endregion - // TODO: Allow user to select/configure the ellipsoid. - // Yeah, we're working on that... +#pragma region PropertyAccessors +public: /** * Returns the georeference origin position as an FVector where `X` is * longitude (degrees), `Y` is latitude (degrees), and `Z` is height above the * ellipsoid (meters). Only valid if the placement type is Cartographic Origin * (i.e. Longitude / Latitude / Height). */ - UFUNCTION(BlueprintCallable, Category = "Cesium") + UFUNCTION(BlueprintPure, Category = "Cesium") FVector GetGeoreferenceOriginLongitudeLatitudeHeight() const; - /** - * This aligns the specified longitude in degrees (x), latitude in - * degrees (y), and height above the ellipsoid in meters (z) to Unreal's world - * origin. I.e. it moves the globe so that these coordinates exactly fall on - * the origin. - * - * When the SubLevelCamera of this instance is currently contained in - * the bounds of a sub-level, calling this method will update the sub-level's - * origin as well. - */ - void SetGeoreferenceOriginLongitudeLatitudeHeight( - const glm::dvec3& TargetLongitudeLatitudeHeight); - - /** - * This function is here for backwards compatibility. The function - * SetGeoreferenceOriginLongitudeLatitudeHeight should be used instead. - */ - void SetGeoreferenceOrigin(const glm::dvec3& TargetLongitudeLatitudeHeight); - - /** - * This aligns the specified Earth-Centered, Earth-Fixed (ECEF) coordinates to - * Unreal's world origin. I.e. it moves the globe so that these coordinates - * exactly fall on the origin. - * - * When the SubLevelCamera of this instance is currently contained in - * the bounds of a sub-level, then this call has no effect. - */ - void SetGeoreferenceOriginEcef(const glm::dvec3& TargetEcef); - /** * This aligns the specified longitude in degrees (X), latitude in * degrees (Y), and height above the ellipsoid in meters (Z) to Unreal's world - * origin. I.e. it moves the globe so that these coordinates exactly fall on - * the origin. - * - * When the SubLevelCamera of this instance is currently contained in - * the bounds of a sub-level, then this call has no effect. + * origin. That is, it moves the globe so that these coordinates exactly fall + * on the origin. */ UFUNCTION(BlueprintCallable, Category = "Cesium") void SetGeoreferenceOriginLongitudeLatitudeHeight( @@ -233,25 +208,67 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { * This aligns the specified Earth-Centered, Earth-Fixed (ECEF) coordinates to * Unreal's world origin. I.e. it moves the globe so that these coordinates * exactly fall on the origin. - * - * When the SubLevelCamera of this instance is currently contained in - * the bounds of a sub-level, then this call has no effect. */ UFUNCTION(BlueprintCallable, Category = "Cesium") void SetGeoreferenceOriginEcef(const FVector& TargetEcef); - /* - * USEFUL CONVERSION FUNCTIONS + UFUNCTION(BlueprintGetter) + EOriginPlacement GetOriginPlacement() const; + + UFUNCTION(BlueprintSetter) + void SetOriginPlacement(EOriginPlacement NewValue); + + UFUNCTION(BlueprintGetter) + double GetOriginLatitude() const; + + UFUNCTION(BlueprintSetter) + void SetOriginLatitude(double NewValue); + + UFUNCTION(BlueprintGetter) + double GetOriginLongitude() const; + + UFUNCTION(BlueprintSetter) + void SetOriginLongitude(double NewValue); + + UFUNCTION(BlueprintGetter) + double GetOriginHeight() const; + + UFUNCTION(BlueprintSetter) + void SetOriginHeight(double NewValue); + + /** + * The percentage scale of the globe in the Unreal world. If this value is 50, + * for example, one meter on the globe occupies half a meter in the Unreal + * world. */ + UFUNCTION(BlueprintGetter) + double GetScale() const; /** - * Transforms the given longitude in degrees (x), latitude in - * degrees (y), and height in meters (z) into Earth-Centered, Earth-Fixed - * (ECEF) coordinates. + * The percentage scale of the globe in the Unreal world. If this value is 50, + * for example, one meter on the globe occupies half a meter in the Unreal + * world. */ - glm::dvec3 TransformLongitudeLatitudeHeightToEcef( - const glm::dvec3& LongitudeLatitudeHeight) const; + UFUNCTION(BlueprintSetter) + void SetScale(double NewValue); + + UFUNCTION(BlueprintGetter) + APlayerCameraManager* GetSubLevelCamera() const; + + UFUNCTION(BlueprintSetter) + void SetSubLevelCamera(APlayerCameraManager* NewValue); + + UFUNCTION(BlueprintGetter) + bool GetShowLoadRadii() const; + + UFUNCTION(BlueprintSetter) + void SetShowLoadRadii(bool NewValue); +#pragma endregion + +#pragma region Transformation Functions + +public: /** * Transforms the given longitude in degrees (x), latitude in * degrees (y), and height above the ellipsoid in meters (z) into @@ -261,7 +278,7 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { * the C++ API, corresponding double-precision function * TransformLongitudeLatitudeHeightToEcef can be used. */ - UFUNCTION(BlueprintCallable, Category = "Cesium") + UFUNCTION(BlueprintPure, Category = "Cesium") FVector TransformLongitudeLatitudeHeightToEcef( const FVector& LongitudeLatitudeHeight) const; @@ -270,15 +287,7 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { * WGS84 longitude in degrees (x), latitude in degrees (y), and height above * the ellipsoid in meters (z). */ - glm::dvec3 - TransformEcefToLongitudeLatitudeHeight(const glm::dvec3& Ecef) const; - - /** - * Transforms the given Earth-Centered, Earth-Fixed (ECEF) coordinates into - * WGS84 longitude in degrees (x), latitude in degrees (y), and height above - * the ellipsoid in meters (z). - */ - UFUNCTION(BlueprintCallable, Category = "Cesium") + UFUNCTION(BlueprintPure, Category = "Cesium") FVector TransformEcefToLongitudeLatitudeHeight(const FVector& Ecef) const; /** @@ -289,18 +298,7 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { * Actor's reference frame as defined by its Transform. This way, the chain of * Unreal transforms places and orients the "globe" in the Unreal world. */ - glm::dvec3 TransformLongitudeLatitudeHeightToUnreal( - const glm::dvec3& longitudeLatitudeHeight) const; - - /** - * Transforms the given longitude in degrees (x), latitude in - * degrees (y), and height above the ellipsoid in meters (z) into Unreal - * coordinates. The resulting position should generally not be interpreted as - * an Unreal _world_ position, but rather a position expressed in some parent - * Actor's reference frame as defined by its Transform. This way, the chain of - * Unreal transforms places and orients the "globe" in the Unreal world. - */ - UFUNCTION(BlueprintCallable, Category = "Cesium") + UFUNCTION(BlueprintPure, Category = "Cesium") FVector TransformLongitudeLatitudeHeightToUnreal( const FVector& LongitudeLatitudeHeight) const; @@ -312,18 +310,7 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { * Transform. This way, the chain of Unreal transforms places and orients the * "globe" in the Unreal world. */ - glm::dvec3 - TransformUnrealToLongitudeLatitudeHeight(const glm::dvec3& unreal) const; - - /** - * Transforms Unreal coordinates into longitude in degrees (x), latitude in - * degrees (y), and height above the ellipsoid in meters (z). The position - * should generally not be an Unreal _world_ position, but rather a position - * expressed in some parent Actor's reference frame as defined by its - * Transform. This way, the chain of Unreal transforms places and orients the - * "globe" in the Unreal world. - */ - UFUNCTION(BlueprintCallable, Category = "Cesium") + UFUNCTION(BlueprintPure, Category = "Cesium") FVector TransformUnrealToLongitudeLatitudeHeight(const FVector& Unreal) const; /** @@ -334,17 +321,7 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { * way, the chain of Unreal transforms places and orients the "globe" in the * Unreal world. */ - glm::dvec3 TransformEcefToUnreal(const glm::dvec3& ecef) const; - - /** - * Transforms the given point from Earth-Centered, Earth-Fixed (ECEF) into - * Unreal coordinates. The resulting position should generally not be - * interpreted as an Unreal _world_ position, but rather a position expressed - * in some parent Actor's reference frame as defined by its Transform. This - * way, the chain of Unreal transforms places and orients the "globe" in the - * Unreal world. - */ - UFUNCTION(BlueprintCallable, Category = "Cesium") + UFUNCTION(BlueprintPure, Category = "Cesium") FVector TransformEcefToUnreal(const FVector& Ecef) const; /** @@ -354,16 +331,7 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { * frame as defined by its Transform. This way, the chain of Unreal transforms * places and orients the "globe" in the Unreal world. */ - glm::dvec3 TransformUnrealToEcef(const glm::dvec3& unreal) const; - - /** - * Transforms the given point from Unreal coordinates to Earth-Centered, - * Earth-Fixed (ECEF). The position should generally not be an Unreal _world_ - * position, but rather a position expressed in some parent Actor's reference - * frame as defined by its Transform. This way, the chain of Unreal transforms - * places and orients the "globe" in the Unreal world. - */ - UFUNCTION(BlueprintCallable, Category = "Cesium") + UFUNCTION(BlueprintPure, Category = "Cesium") FVector TransformUnrealToEcef(const FVector& Unreal) const; /** @@ -373,18 +341,7 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { * Actor's reference frame as defined by its Transform. This way, the chain of * Unreal transforms places and orients the "globe" in the Unreal world. */ - glm::dquat TransformRotatorUnrealToEastSouthUp( - const glm::dquat& UnrealRotator, - const glm::dvec3& UnrealLocation) const; - - /** - * Transforms a rotator from Unreal to East-South-Up at the given - * Unreal location. The rotator and location should generally not be relative - * to the Unreal _world_, but rather be expressed in some parent - * Actor's reference frame as defined by its Transform. This way, the chain of - * Unreal transforms places and orients the "globe" in the Unreal world. - */ - UFUNCTION(BlueprintCallable, Category = "Cesium") + UFUNCTION(BlueprintPure, Category = "Cesium") FRotator TransformRotatorUnrealToEastSouthUp( const FRotator& UnrealRotator, const FVector& UnrealLocation) const; @@ -396,18 +353,7 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { * Actor's reference frame as defined by its Transform. This way, the chain of * Unreal transforms places and orients the "globe" in the Unreal world. */ - glm::dquat TransformRotatorEastSouthUpToUnreal( - const glm::dquat& EsuRotator, - const glm::dvec3& UnrealLocation) const; - - /** - * Transforms a rotator from East-South-Up to Unreal at the given - * Unreal location. The location and resulting rotator should generally not be - * relative to the Unreal _world_, but rather be expressed in some parent - * Actor's reference frame as defined by its Transform. This way, the chain of - * Unreal transforms places and orients the "globe" in the Unreal world. - */ - UFUNCTION(BlueprintCallable, Category = "Cesium") + UFUNCTION(BlueprintPure, Category = "Cesium") FRotator TransformRotatorEastSouthUpToUnreal( const FRotator& EsuRotator, const FVector& UnrealLocation) const; @@ -421,182 +367,129 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { * the chain of Unreal transforms places and orients the "globe" in the Unreal * world. */ - glm::dmat3 ComputeEastSouthUpToUnreal(const glm::dvec3& unreal) const; - - /** - * Computes the rotation matrix from the local East-South-Up to Unreal at the - * specified Unreal location. The returned transformation works in Unreal's - * left-handed coordinate system. The location and resulting rotation should - * generally not be relative to the Unreal _world_, but rather be expressed in - * some parent Actor's reference frame as defined by its Transform. This way, - * the chain of Unreal transforms places and orients the "globe" in the Unreal - * world. - */ - UFUNCTION(BlueprintCallable, Category = "Cesium") + UFUNCTION(BlueprintPure, Category = "Cesium") FMatrix ComputeEastSouthUpToUnreal(const FVector& Unreal) const; /** * Computes the rotation matrix from the local East-North-Up to * Earth-Centered, Earth-Fixed (ECEF) at the specified ECEF location. */ - glm::dmat3 ComputeEastNorthUpToEcef(const glm::dvec3& ecef) const; - - /** - * Computes the rotation matrix from the local East-North-Up to - * Earth-Centered, Earth-Fixed (ECEF) at the specified ECEF location. - */ - UFUNCTION(BlueprintCallable, Category = "Cesium") + UFUNCTION(BlueprintPure, Category = "Cesium") FMatrix ComputeEastNorthUpToEcef(const FVector& Ecef) const; - /** - * @brief Computes the normal of the plane tangent to the surface of the - * ellipsoid that is used by this instance, at the provided position ECEF. - * - * @param position The ECEF position for which to to determine the - * surface normal. - * @return The normal. - */ - glm::dvec3 ComputeGeodeticSurfaceNormal(const glm::dvec3& position) const { - return _geoTransforms.ComputeGeodeticSurfaceNormal(position); - } - /** - * A delegate that will be called whenever the Georeference is - * modified in a way that affects its computations. - */ - UPROPERTY(BlueprintAssignable, Category = "Cesium") - FGeoreferenceUpdated OnGeoreferenceUpdated; +#pragma endregion - /** - * Recomputes all world georeference transforms. Usually there is no need to - * explicitly call this from external code. - */ - void UpdateGeoreference(); +#pragma region Editor Support +public: +#if WITH_EDITOR /** - * @brief Returns whether `Tick` should be called in viewports-only mode. + * Places the georeference origin at the camera's current location. Rotates + * the globe so the current longitude/latitude/height of the camera is at the + * Unreal origin. The camera is also teleported to the Unreal origin. * - * "If `true`, actor is ticked even if TickType==LEVELTICK_ViewportsOnly." - * (The TickType is determined by the unreal engine internally). + * Warning: Before clicking, ensure that all non-Cesium objects in the + * persistent level are georeferenced with the "CesiumGeoreferenceComponent" + * or attached to an actor with that component. Ensure that static actors only + * exist in georeferenced sub-levels. */ - virtual bool ShouldTickIfViewportsOnly() const override; + UFUNCTION(CallInEditor, Category = "Cesium") + void PlaceGeoreferenceOriginHere(); +#endif - /** - * @brief Function called every frame on this Actor. - * - * @param DeltaTime Game time elapsed during last frame modified by the time - * dilation - */ - virtual void Tick(float DeltaTime) override; +private: + // This property mirrors RootComponent, and exists only so that the root + // component's transform is editable in the Editor. + UPROPERTY(VisibleAnywhere, Category = "Cesium") + USceneComponent* Root; +#if WITH_EDITOR /** - * Handles reading, writing, and reference collecting using FArchive. - * This implementation handles all FProperty serialization, but can be - * overridden for native variables. + * @brief Show the load radius of each sub-level as a sphere. * - * This class overrides this method to ensure internal variables are - * immediately synchronized with newly-loaded values. + * If this is not called "in-game", and `ShowLoadRadii` is `true`, + * then it will show a sphere indicating the load radius of each + * sub-level. */ - virtual void Serialize(FArchive& Ar) override; + void _showSubLevelLoadRadii() const; +#endif - /** - * Returns the GeoTransforms that offers the same conversion - * functions as this class, but performs the computations - * in double precision. - */ - const GeoTransforms& GetGeoTransforms() const noexcept { - return _geoTransforms; - } +#pragma endregion + +#pragma region Unreal Lifecycle protected: - // Called when the game starts or when spawned + virtual bool ShouldTickIfViewportsOnly() const override; + virtual void Tick(float DeltaTime) override; + virtual void Serialize(FArchive& Ar) override; virtual void BeginPlay() override; - virtual void EndPlay(const EEndPlayReason::Type EndPlayReason) override; virtual void OnConstruction(const FTransform& Transform) override; virtual void BeginDestroy() override; + virtual void PostLoad() override; #if WITH_EDITOR virtual void PostEditChangeProperty(FPropertyChangedEvent& PropertyChangedEvent) override; #endif +#pragma endregion + +#pragma region Obsolete + private: + PRAGMA_DISABLE_DEPRECATION_WARNINGS + UPROPERTY( + Meta = + (DeprecatedProperty, + DeprecationMessage = + "Create sub-levels by adding a UCesiumSubLevelComponent to an ALevelInstance Actor.")) + TArray CesiumSubLevels_DEPRECATED; + PRAGMA_ENABLE_DEPRECATION_WARNINGS + +#if WITH_EDITOR + void _createSubLevelsFromWorldComposition(); +#endif + +#pragma endregion + +#pragma region Implementation Details + +public: + ACesiumGeoreference(); + /** - * A tag that is assigned to Georeferences when they are created - * as the "default" Georeference for a certain world. + * Recomputes all world georeference transforms. Usually there is no need to + * explicitly call this from external code. */ - static FName DEFAULT_GEOREFERENCE_TAG; + void UpdateGeoreference(); /** - * The percentage scale of the globe in the Unreal world. If this value is 50, - * for example, one meter on the globe occupies half a meter in the Unreal - * world. + * Returns the GeoTransforms that offers the same conversion + * functions as this class, but performs the computations + * in double precision. */ - UPROPERTY( - EditAnywhere, - Meta = (AllowPrivateAccess), - BlueprintReadWrite, - BlueprintSetter = "SetScale", - BlueprintGetter = "GetScale", - Category = "Cesium", - Meta = (UIMin = 0.000001, UIMax = 100.0)) - double Scale = 100.0; + const GeoTransforms& GetGeoTransforms() const noexcept { + return _geoTransforms; + } +private: /** - * The radii, in x-, y-, and z-direction, of the ellipsoid that - * should be used in this instance. + * A tag that is assigned to Georeferences when they are created + * as the "default" Georeference for a certain world. */ - UPROPERTY() - double _ellipsoidRadii[3]; + static FName DEFAULT_GEOREFERENCE_TAG; GeoTransforms _geoTransforms; UPROPERTY() UCesiumSubLevelSwitcherComponent* SubLevelSwitcher; -#if WITH_EDITOR - FDelegateHandle _newCurrentLevelSubscription; -#endif - // TODO: add option to set georeference directly from ECEF void _setGeoreferenceOrigin( double targetLongitude, double targetLatitude, double targetHeight); -#if WITH_EDITOR - /** - * Will make sure that the `CesiumSubLevels` array contains all - * of the current streaming levels of the world. - */ - void _updateCesiumSubLevels(); -#endif - -#if WITH_EDITOR - void _lineTraceViewportMouse( - const bool ShowTrace, - bool& Success, - FHitResult& HitResult) const; - - /** - * @brief Show the load radius of each sub-level as a sphere. - * - * If this is not called "in-game", and `ShowLoadRadii` is `true`, - * then it will show a sphere indicating the load radius of each - * sub-level. - */ - void _showSubLevelLoadRadii() const; - - /** - * @brief Allow editing the origin with the mouse. - * - * If `EditOriginInViewport` is true, this will trace the mouse - * position, and update the origin based on the point that was - * hit. - */ - void _handleViewportOriginEditing(); - -#endif - /** * @brief Updates the load state of sub-levels. * @@ -630,4 +523,5 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { * PersistentLevel. */ bool _shouldManageSubLevels() const; +#pragma endregion }; diff --git a/Source/CesiumRuntime/Public/CesiumWgs84Ellipsoid.h b/Source/CesiumRuntime/Public/CesiumWgs84Ellipsoid.h new file mode 100644 index 000000000..577d8b8dc --- /dev/null +++ b/Source/CesiumRuntime/Public/CesiumWgs84Ellipsoid.h @@ -0,0 +1,74 @@ +// Copyright 2020-2023 CesiumGS, Inc. and Contributors + +#pragma once + +#include "CesiumRuntime.h" +#include "Kismet/BlueprintFunctionLibrary.h" +#include "Misc/Optional.h" +#include "CesiumWgs84Ellipsoid.generated.h" + +UCLASS() +class CESIUMRUNTIME_API UCesiumWgs84Ellipsoid + : public UBlueprintFunctionLibrary { + GENERATED_BODY() + +public: + /** + * Gets the radii of the WGS84 ellipsoid in its x-, y-, and z-directions in + * meters. + */ + UFUNCTION(BlueprintPure, Category = "Cesium|WGS84 Ellipsoid") + static FVector GetRadii(); + + /** + * Gets the maximum radius of the WGS84 ellipsoid in any dimension, in meters. + */ + UFUNCTION(BlueprintPure, Category = "Cesium|WGS84 Ellipsoid") + static double GetMaximumRadius(); + + /** + * Gets the minimum radius of the WGS854 ellipsoid in any dimension, in + * meters. + */ + UFUNCTION(BlueprintPure, Category = "Cesium|WGS84 Ellipsoid") + static double GetMinimumRadius(); + + /** + * Scale the given Earth-Centered, Earth-Fixed position along the geodetic + * surface normal so that it is on the surface of the ellipsoid. If the + * position is near the center of the ellipsoid, the result will have the + * value (0,0,0) because the surface position is undefined. + */ + UFUNCTION(BlueprintPure, Category = "Cesium|WGS84 Ellipsoid") + static FVector ScaleToGeodeticSurface(const FVector& earthCenteredEarthFixed); + + /** + * Computes the normal of the plane tangent to the surface of the ellipsoid + * at the provided Earth-Centered, Earth-Fixed position. + * + * The ECEF position in meters. + * The normal at the ECEF position + */ + UFUNCTION(BlueprintPure, Category = "Cesium|WGS84 Ellipsoid") + static FVector GeodeticSurfaceNormal(const FVector& earthCenteredEarthFixed); + + /** + * Convert longitude in degrees (X), latitude in degrees (Y), and height above + * the WGS84 ellipsoid in meters (Z) to Earth-Centered, Earth-Fixed (ECEF) + * coordinates. + */ + UFUNCTION(BlueprintPure, Category = "Cesium|WGS84 Ellipsoid") + static FVector LongitudeLatitudeHeightToEarthCenteredEarthFixed( + const FVector& longitudeLatitudeHeight); + + /** + * Convert Earth-Centered, Earth-Fixed (ECEF) coordinates to longitude in + * degrees (X), latitude in degrees (Y), and height above the WGS84 ellipsoid + * in meters (Z). If the position is near the center of the Earth, the result + * will have the value (0,0,0) because the longitude, latitude, and height are + * undefined. + */ + UFUNCTION(BlueprintPure, Category = "Cesium|WGS84 Ellipsoid") + static FVector EarthCenteredEarthFixedToLongitudeLatitudeHeight( + const FVector& earthCenteredEarthFixed); +}; From 15ca845cf3a4f413c3f4b04745b7ec3aa2e95365 Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Thu, 20 Jul 2023 22:06:01 +1000 Subject: [PATCH 02/13] Doc and category tweaks. --- CHANGES.md | 2 ++ Source/CesiumRuntime/Public/CesiumGeoreference.h | 10 +++++----- Source/CesiumRuntime/Public/CesiumWgs84Ellipsoid.h | 3 --- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 00568fe4d..edd363a41 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,6 +7,7 @@ - The old sub-level system, based on Unreal's old (and now deprecated) World Composition system, has been removed. Instead, create Level Instance Actors and attach the "Cesium Sub Level Component" to them to achieve similar functionality. Old levels will automatically be converted to the new system when they are loaded in the Editor. - `CesiumSunSky` now uses a default `TransmittanceMinLightElevationAngle` value on its `SkyAtmosphere` component of 90.0 degrees instead of -90.0 degrees. This will generally improve lighting when far from the CesiumGeoreference origin, but it is a breaking change because it may change the lighting conditions in existing levels, particularly at sunrise and sunset. - The `Mobility` property on `ACesium3DTileset` is now obsolete. Instead, use the normal mechanism of setting the root component's mobility. +- Removed many methods that from the C++ interface of `ACesiumGeoreference` that used `glm` vector types. Use the versions that work with Unreal types instead. ##### Additions :tada: @@ -17,6 +18,7 @@ - Cesium objects in sub-levels can now explicitly reference `ACesiumGeoreference`, `ACesiumCreditSystem`, and `ACesiumCameraManager` instances in the Persistent Level. - `ACesiumGeoreference` can now act as a parent Actor. By adjusting the georeference's transformation, the entire globe can be located, rotated, and scaled within the Unreal Engine world. - Added `AtmosphereHeight`, `AerialPerspectiveViewDistanceScale`, `RayleighExponentialDistribution`, and `MieExponentialDistribution` properties to `ACesiumSunSky`. These have the same function as the properties of the same name on Unreal's built-in SkyAtmosphere component, except that they automatically respond to the scale of the globe. +- Added `UCesiumWgs84Ellipsoid` Blueprint function library class. ##### Fixes :wrench: diff --git a/Source/CesiumRuntime/Public/CesiumGeoreference.h b/Source/CesiumRuntime/Public/CesiumGeoreference.h index 2fbc7af78..e249eb683 100644 --- a/Source/CesiumRuntime/Public/CesiumGeoreference.h +++ b/Source/CesiumRuntime/Public/CesiumGeoreference.h @@ -39,7 +39,7 @@ UCLASS() class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { GENERATED_BODY() public: - /* + /** * Finds and returns the actor labeled `CesiumGeoreferenceDefault` in the * persistent level of the calling object's world. If not found, it creates a * new default Georeference. @@ -47,7 +47,7 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { */ UFUNCTION( BlueprintCallable, - Category = "CesiumGeoreference", + Category = "Cesium", meta = (WorldContext = "WorldContextObject")) static ACesiumGeoreference* GetDefaultGeoreference(const UObject* WorldContextObject); @@ -157,7 +157,7 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { * be activated and all others deactivated. */ UPROPERTY( - Category = "Cesium|Cesium Sublevels", + Category = "Cesium|Sub-levels", EditAnywhere, BlueprintReadWrite, BlueprintGetter = GetSubLevelCamera, @@ -171,7 +171,7 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { * initially positioning the level and choosing a load radius. */ UPROPERTY( - Category = "Cesium|Cesium Sublevels", + Category = "Cesium|Sub-levels", EditAnywhere, BlueprintReadWrite, BlueprintGetter = GetShowLoadRadii, @@ -393,7 +393,7 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { * or attached to an actor with that component. Ensure that static actors only * exist in georeferenced sub-levels. */ - UFUNCTION(CallInEditor, Category = "Cesium") + UFUNCTION(CallInEditor, Category = "Actions") void PlaceGeoreferenceOriginHere(); #endif diff --git a/Source/CesiumRuntime/Public/CesiumWgs84Ellipsoid.h b/Source/CesiumRuntime/Public/CesiumWgs84Ellipsoid.h index 577d8b8dc..678c4bb8f 100644 --- a/Source/CesiumRuntime/Public/CesiumWgs84Ellipsoid.h +++ b/Source/CesiumRuntime/Public/CesiumWgs84Ellipsoid.h @@ -45,9 +45,6 @@ class CESIUMRUNTIME_API UCesiumWgs84Ellipsoid /** * Computes the normal of the plane tangent to the surface of the ellipsoid * at the provided Earth-Centered, Earth-Fixed position. - * - * The ECEF position in meters. - * The normal at the ECEF position */ UFUNCTION(BlueprintPure, Category = "Cesium|WGS84 Ellipsoid") static FVector GeodeticSurfaceNormal(const FVector& earthCenteredEarthFixed); From 98bc3791197fbd5eff8c73920bddecb3da74d4c9 Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Mon, 24 Jul 2023 21:39:38 +1000 Subject: [PATCH 03/13] Georeference transform cleanup. --- Config/Engine.ini | 8 + .../Private/CesiumCartographicPolygon.cpp | 3 +- .../Private/CesiumGeoreference.cpp | 66 +++++-- .../Private/CesiumGlobeAnchorComponent.cpp | 4 +- Source/CesiumRuntime/Private/CesiumSunSky.cpp | 2 +- .../CesiumRuntime/Private/GeoTransforms.cpp | 13 +- .../Private/Tests/SubLevels.spec.cpp | 35 ++-- .../CesiumRuntime/Public/CesiumGeoreference.h | 175 +++++++++++++----- .../Public/CesiumWgs84Ellipsoid.h | 8 +- Source/CesiumRuntime/Public/GeoTransforms.h | 9 + 10 files changed, 233 insertions(+), 90 deletions(-) diff --git a/Config/Engine.ini b/Config/Engine.ini index 2652f1c9c..81f3247b9 100644 --- a/Config/Engine.ini +++ b/Config/Engine.ini @@ -53,3 +53,11 @@ +FunctionRedirects=(OldName="GlobeAwareDefaultPawn.InaccurateFlyToLocationLongitudeLatitudeHeight",NewName="FlyToLocationLongitudeLatitudeHeight") +PropertyRedirects=(OldName="CesiumPolygonRasterOverlay.ExcludeTilesInside",NewName="ExcludeSelectedTiles") + ++FunctionRedirects=(OldName="CesiumGeoreference.TransformUnrealToLongitudeLatitudeHeight",NewName="TransformUnrealPositionToLongitudeLatitudeHeight") ++PropertyRedirects=(OldName="CesiumGeoreference.TransformUnrealPositionToLongitudeLatitudeHeight.Unreal", NewName="UnrealPosition") ++FunctionRedirects=(OldName="CesiumGeoreference.TransformEcefToUnreal",NewName="TransformEarthCenteredEarthFixedPositionToUnreal") ++PropertyRedirects=(OldName="CesiumGeoreference.TransformEarthCenteredEarthFixedPositionToUnreal.Ecef", NewName="EarthCenteredEarthFixedPosition") ++FunctionRedirects=(OldName="CesiumGeoreference.TransformUnrealToEcef",NewName="TransformUnrealPositionToEarthCenteredEarthFixed") ++PropertyRedirects=(OldName="CesiumGeoreference.TransformUnrealPositionToEarthCenteredEarthFixed.Unreal", NewName="UnrealPosition") ++FunctionRedirects=(OldName="CesiumGeoreference.TransformLongitudeLatitudeHeightToUnreal",NewName="TransformLongitudeLatitudeHeightPositionToUnreal") diff --git a/Source/CesiumRuntime/Private/CesiumCartographicPolygon.cpp b/Source/CesiumRuntime/Private/CesiumCartographicPolygon.cpp index d81260681..925090845 100644 --- a/Source/CesiumRuntime/Private/CesiumCartographicPolygon.cpp +++ b/Source/CesiumRuntime/Private/CesiumCartographicPolygon.cpp @@ -65,8 +65,7 @@ ACesiumCartographicPolygon::CreateCartographicPolygon( ESplineCoordinateSpace::World)); FVector cartographic = this->GlobeAnchor->ResolveGeoreference() - ->TransformUnrealToLongitudeLatitudeHeight( - FVector(unrealPosition.X, unrealPosition.Y, unrealPosition.Z)); + ->TransformUnrealPositionToLongitudeLatitudeHeight(unrealPosition); polygon[i] = glm::dvec2(glm::radians(cartographic.X), glm::radians(cartographic.Y)); } diff --git a/Source/CesiumRuntime/Private/CesiumGeoreference.cpp b/Source/CesiumRuntime/Private/CesiumGeoreference.cpp index b6f293909..eea7644ef 100644 --- a/Source/CesiumRuntime/Private/CesiumGeoreference.cpp +++ b/Source/CesiumRuntime/Private/CesiumGeoreference.cpp @@ -9,6 +9,7 @@ #include "CesiumSubLevelSwitcherComponent.h" #include "CesiumTransforms.h" #include "CesiumUtility/Math.h" +#include "CesiumWgs84Ellipsoid.h" #include "Engine/LevelStreaming.h" #include "Engine/World.h" #include "Engine/WorldComposition.h" @@ -226,6 +227,7 @@ FString longPackageNameToCesiumName(UWorld* pWorld, const TStringish& name) { } // namespace #if WITH_EDITOR +PRAGMA_DISABLE_DEPRECATION_WARNINGS void ACesiumGeoreference::_createSubLevelsFromWorldComposition() { UWorld* pWorld = this->GetWorld(); if (!IsValid(pWorld)) { @@ -331,6 +333,7 @@ void ACesiumGeoreference::_createSubLevelsFromWorldComposition() { TEXT( "Cesium sub-levels based on World Composition have been converted to Level Instances. Save the level to keep these changes. We recommend disabling World Composition in the World Settings, as it is now obsolete.")); } +PRAGMA_ENABLE_DEPRECATION_WARNINGS #endif FVector @@ -415,6 +418,16 @@ void ACesiumGeoreference::SetShowLoadRadii(bool NewValue) { this->ShowLoadRadii = NewValue; } +const FMatrix& +ACesiumGeoreference::GetUnrealToEarthCenteredEarthFixedTransformation() const { + return this->_geoTransforms.GetAbsoluteUnrealWorldToEllipsoidCenteredMatrix(); +} + +const FMatrix& +ACesiumGeoreference::GetEarthCenteredEarthFixedToUnrealTransformation() const { + return this->_geoTransforms.GetEllipsoidCenteredToAbsoluteUnrealWorldMatrix(); +} + // Called when the game starts or when spawned void ACesiumGeoreference::BeginPlay() { Super::BeginPlay(); @@ -561,10 +574,11 @@ void ACesiumGeoreference::_showSubLevelLoadRadii() const { pComponent->GetOriginLatitude(), pComponent->GetOriginHeight())); - FVector center = this->TransformLongitudeLatitudeHeightToUnreal(FVector( - pComponent->GetOriginLongitude(), - pComponent->GetOriginLatitude(), - pComponent->GetOriginHeight())); + FVector center = + this->TransformLongitudeLatitudeHeightPositionToUnreal(FVector( + pComponent->GetOriginLongitude(), + pComponent->GetOriginLatitude(), + pComponent->GetOriginHeight())); center = GetActorTransform().TransformPosition(center); DrawDebugSphere( @@ -706,49 +720,61 @@ void ACesiumGeoreference::Serialize(FArchive& Ar) { FVector ACesiumGeoreference::TransformLongitudeLatitudeHeightToEcef( const FVector& longitudeLatitudeHeight) const { - glm::dvec3 ecef = this->_geoTransforms.TransformLongitudeLatitudeHeightToEcef( - VecMath::createVector3D(longitudeLatitudeHeight)); - return FVector(ecef.x, ecef.y, ecef.z); + return UCesiumWgs84Ellipsoid:: + LongitudeLatitudeHeightToEarthCenteredEarthFixed(longitudeLatitudeHeight); } FVector ACesiumGeoreference::TransformEcefToLongitudeLatitudeHeight( const FVector& ecef) const { - glm::dvec3 llh = this->_geoTransforms.TransformEcefToLongitudeLatitudeHeight( - glm::dvec3(ecef.X, ecef.Y, ecef.Z)); - return FVector(llh.x, llh.y, llh.z); + return UCesiumWgs84Ellipsoid:: + EarthCenteredEarthFixedToLongitudeLatitudeHeight(ecef); } -FVector ACesiumGeoreference::TransformLongitudeLatitudeHeightToUnreal( - const FVector& longitudeLatitudeHeight) const { +FVector ACesiumGeoreference::TransformLongitudeLatitudeHeightPositionToUnreal( + const FVector& LongitudeLatitudeHeight) const { glm::dvec3 ue = this->_geoTransforms.TransformLongitudeLatitudeHeightToUnreal( glm::dvec3(CesiumActors::getWorldOrigin4D(this)), - VecMath::createVector3D(longitudeLatitudeHeight)); + VecMath::createVector3D(LongitudeLatitudeHeight)); return FVector(ue.x, ue.y, ue.z); } -FVector ACesiumGeoreference::TransformUnrealToLongitudeLatitudeHeight( - const FVector& ue) const { +FVector ACesiumGeoreference::TransformUnrealPositionToLongitudeLatitudeHeight( + const FVector& UnrealPosition) const { glm::dvec3 llh = this->_geoTransforms.TransformUnrealToLongitudeLatitudeHeight( glm::dvec3(CesiumActors::getWorldOrigin4D(this)), - VecMath::createVector3D(ue)); + VecMath::createVector3D(UnrealPosition)); return FVector(llh.x, llh.y, llh.z); } -FVector ACesiumGeoreference::TransformEcefToUnreal(const FVector& ecef) const { +FVector ACesiumGeoreference::TransformEarthCenteredEarthFixedPositionToUnreal( + const FVector& EarthCenteredEarthFixedPosition) const { glm::dvec3 ue = this->_geoTransforms.TransformEcefToUnreal( glm::dvec3(CesiumActors::getWorldOrigin4D(this)), - VecMath::createVector3D(ecef)); + VecMath::createVector3D(EarthCenteredEarthFixedPosition)); return FVector(ue.x, ue.y, ue.z); } -FVector ACesiumGeoreference::TransformUnrealToEcef(const FVector& ue) const { +FVector ACesiumGeoreference::TransformUnrealPositionToEarthCenteredEarthFixed( + const FVector& UnrealPosition) const { glm::dvec3 ecef = this->_geoTransforms.TransformUnrealToEcef( glm::dvec3(CesiumActors::getWorldOrigin4D(this)), - glm::dvec3(ue.X, ue.Y, ue.Z)); + glm::dvec3(UnrealPosition.X, UnrealPosition.Y, UnrealPosition.Z)); return FVector(ecef.x, ecef.y, ecef.z); } +FVector ACesiumGeoreference::TransformEarthCenteredEarthFixedDirectionToUnreal( + const FVector& EarthCenteredEarthFixedDirection) const { + return this->_geoTransforms.GetEllipsoidCenteredToAbsoluteUnrealWorldMatrix() + .TransformVector(EarthCenteredEarthFixedDirection); +} + +FVector ACesiumGeoreference::TransformUnrealDirectionToEarthCenteredEarthFixed( + const FVector& UnrealDirection) const { + return this->_geoTransforms.GetAbsoluteUnrealWorldToEllipsoidCenteredMatrix() + .TransformVector(UnrealDirection); +} + FRotator ACesiumGeoreference::TransformRotatorUnrealToEastSouthUp( const FRotator& UERotator, const FVector& ueLocation) const { diff --git a/Source/CesiumRuntime/Private/CesiumGlobeAnchorComponent.cpp b/Source/CesiumRuntime/Private/CesiumGlobeAnchorComponent.cpp index 96e70627f..0aae8fcbf 100644 --- a/Source/CesiumRuntime/Private/CesiumGlobeAnchorComponent.cpp +++ b/Source/CesiumRuntime/Private/CesiumGlobeAnchorComponent.cpp @@ -214,8 +214,8 @@ FVector UCesiumGlobeAnchorComponent::GetLongitudeLatitudeHeight() const { return FVector(0.0); } - return this->ResolvedGeoreference->TransformEcefToLongitudeLatitudeHeight( - this->GetECEF()); + return UCesiumWgs84Ellipsoid:: + EarthCenteredEarthFixedToLongitudeLatitudeHeight(this->GetECEF()); } void UCesiumGlobeAnchorComponent::MoveToLongitudeLatitudeHeight( diff --git a/Source/CesiumRuntime/Private/CesiumSunSky.cpp b/Source/CesiumRuntime/Private/CesiumSunSky.cpp index 56796ed3b..991d30999 100644 --- a/Source/CesiumRuntime/Private/CesiumSunSky.cpp +++ b/Source/CesiumRuntime/Private/CesiumSunSky.cpp @@ -512,7 +512,7 @@ void ACesiumSunSky::UpdateAtmosphereRadius() { FVector location = transform.TransformPosition(getViewLocation(this->GetWorld())); FVector llh = - this->GetGeoreference()->TransformUnrealToLongitudeLatitudeHeight( + this->GetGeoreference()->TransformUnrealPositionToLongitudeLatitudeHeight( location); // An atmosphere of this radius should circumscribe all Earth terrain. diff --git a/Source/CesiumRuntime/Private/GeoTransforms.cpp b/Source/CesiumRuntime/Private/GeoTransforms.cpp index bd20d6fde..419afbe4c 100644 --- a/Source/CesiumRuntime/Private/GeoTransforms.cpp +++ b/Source/CesiumRuntime/Private/GeoTransforms.cpp @@ -5,6 +5,7 @@ #include "CesiumGeospatial/GlobeTransforms.h" #include "CesiumRuntime.h" #include "CesiumTransforms.h" +#include "VecMath.h" #include #include @@ -36,7 +37,9 @@ GeoTransforms::GeoTransforms() 1.0), _ellipsoid(CesiumGeospatial::Ellipsoid::WGS84), _center(0.0), - _scale(1.0) { + _scale(1.0), + _ecefToUnreal(), + _unrealToEcef() { // Coordinate system is initialized with the default values. This function // overrides them with proper values. this->updateTransforms(); @@ -54,7 +57,9 @@ GeoTransforms::GeoTransforms( 1.0), _ellipsoid(ellipsoid), _center(center), - _scale(scale) { + _scale(scale), + _ecefToUnreal(), + _unrealToEcef() { // Coordinate system is initialized with the default values. This function // overrides them with proper values. this->updateTransforms(); @@ -100,6 +105,10 @@ glm::dquat GeoTransforms::ComputeSurfaceNormalRotationUnreal( void GeoTransforms::updateTransforms() noexcept { this->_coordinateSystem = createCoordinateSystem(this->_ellipsoid, this->_center, this->_scale); + this->_ecefToUnreal = VecMath::createMatrix( + this->_coordinateSystem.getEcefToLocalTransformation()); + this->_unrealToEcef = VecMath::createMatrix( + this->_coordinateSystem.getLocalToEcefTransformation()); UE_LOG( LogCesium, diff --git a/Source/CesiumRuntime/Private/Tests/SubLevels.spec.cpp b/Source/CesiumRuntime/Private/Tests/SubLevels.spec.cpp index 074500c80..9773443e0 100644 --- a/Source/CesiumRuntime/Private/Tests/SubLevels.spec.cpp +++ b/Source/CesiumRuntime/Private/Tests/SubLevels.spec.cpp @@ -233,11 +233,12 @@ void FSubLevelsSpec::Define() { // Move the player within range of the first sub-level UCesiumSubLevelComponent* pPlayLevelComponent1 = findInPlay(pLevelComponent1); - FVector origin1 = findInPlay(pGeoreference) - ->TransformLongitudeLatitudeHeightToUnreal(FVector( - pPlayLevelComponent1->GetOriginLongitude(), - pPlayLevelComponent1->GetOriginLatitude(), - pPlayLevelComponent1->GetOriginHeight())); + FVector origin1 = + findInPlay(pGeoreference) + ->TransformLongitudeLatitudeHeightPositionToUnreal(FVector( + pPlayLevelComponent1->GetOriginLongitude(), + pPlayLevelComponent1->GetOriginLatitude(), + pPlayLevelComponent1->GetOriginHeight())); findInPlay(pPawn)->SetActorLocation(origin1); }); LatentBeforeEach( @@ -284,11 +285,12 @@ void FSubLevelsSpec::Define() { // Move the player within range of the first sub-level UCesiumSubLevelComponent* pPlayLevelComponent1 = findInPlay(pLevelComponent1); - FVector origin1 = findInPlay(pGeoreference) - ->TransformLongitudeLatitudeHeightToUnreal(FVector( - pPlayLevelComponent1->GetOriginLongitude(), - pPlayLevelComponent1->GetOriginLatitude(), - pPlayLevelComponent1->GetOriginHeight())); + FVector origin1 = + findInPlay(pGeoreference) + ->TransformLongitudeLatitudeHeightPositionToUnreal(FVector( + pPlayLevelComponent1->GetOriginLongitude(), + pPlayLevelComponent1->GetOriginLatitude(), + pPlayLevelComponent1->GetOriginHeight())); findInPlay(pPawn)->SetActorLocation(origin1); }); LatentBeforeEach( @@ -305,7 +307,7 @@ void FSubLevelsSpec::Define() { findInPlay(pLevelComponent1); FVector origin1 = findInPlay(pGeoreference) - ->TransformLongitudeLatitudeHeightToUnreal(FVector( + ->TransformLongitudeLatitudeHeightPositionToUnreal(FVector( pPlayLevelComponent1->GetOriginLongitude(), pPlayLevelComponent1->GetOriginLatitude(), pPlayLevelComponent1->GetOriginHeight() + 100000.0)); @@ -316,11 +318,12 @@ void FSubLevelsSpec::Define() { // inside it. UCesiumSubLevelComponent* pPlayLevelComponent1 = findInPlay(pLevelComponent1); - FVector origin1 = findInPlay(pGeoreference) - ->TransformLongitudeLatitudeHeightToUnreal(FVector( - pPlayLevelComponent1->GetOriginLongitude(), - pPlayLevelComponent1->GetOriginLatitude(), - pPlayLevelComponent1->GetOriginHeight())); + FVector origin1 = + findInPlay(pGeoreference) + ->TransformLongitudeLatitudeHeightPositionToUnreal(FVector( + pPlayLevelComponent1->GetOriginLongitude(), + pPlayLevelComponent1->GetOriginLatitude(), + pPlayLevelComponent1->GetOriginHeight())); findInPlay(pPawn)->SetActorLocation(origin1); }); LatentBeforeEach( diff --git a/Source/CesiumRuntime/Public/CesiumGeoreference.h b/Source/CesiumRuntime/Public/CesiumGeoreference.h index e249eb683..8d6551472 100644 --- a/Source/CesiumRuntime/Public/CesiumGeoreference.h +++ b/Source/CesiumRuntime/Public/CesiumGeoreference.h @@ -180,6 +180,36 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { bool ShowLoadRadii = true; #endif + /** + * The transformation matrix from the Unreal coordinate system to the + * Earth-Centered, Earth-Fixed (ECEF) coordinate system. The Unreal + * coordinates should generally not be interpreted as Unreal _world_ + * coordinates, but rather a coordinate system based on some parent Actor's + * reference frame as defined by its transform. This way, the chain of Unreal + * transforms places and orients the "globe" in the Unreal world. + */ + UPROPERTY( + BlueprintReadOnly, + BlueprintGetter = GetUnrealToEarthCenteredEarthFixedTransformation, + Category = "Cesium", + meta = (AllowPrivateAccess)) + FMatrix UnrealToEarthCenteredEarthFixedTransformation; + + /** + * The transformation matrix from the Earth-Centered, Earth-Fixed (ECEF) + * coordinate system to the Unreal coordinate system. The Unreal coordinates + * should generally not be interpreted as Unreal _world_ coordinates, but + * rather a coordinate system based on some parent Actor's reference frame as + * defined by its transform. This way, the chain of Unreal transforms places + * and orients the "globe" in the Unreal world. + */ + UPROPERTY( + BlueprintReadOnly, + BlueprintGetter = GetEarthCenteredEarthFixedToUnrealTransformation, + Category = "Cesium", + meta = (AllowPrivateAccess)) + FMatrix EarthCenteredEarthFixedToUnrealTransformation; + #pragma endregion #pragma region PropertyAccessors @@ -264,75 +294,105 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { UFUNCTION(BlueprintSetter) void SetShowLoadRadii(bool NewValue); + UFUNCTION(BlueprintGetter) + const FMatrix& GetUnrealToEarthCenteredEarthFixedTransformation() const; + + UFUNCTION(BlueprintGetter) + const FMatrix& GetEarthCenteredEarthFixedToUnrealTransformation() const; + #pragma endregion #pragma region Transformation Functions public: - /** - * Transforms the given longitude in degrees (x), latitude in - * degrees (y), and height above the ellipsoid in meters (z) into - * Earth-Centered, Earth-Fixed (ECEF) coordinates. - * - * This function peforms the computation in single-precision. When using - * the C++ API, corresponding double-precision function - * TransformLongitudeLatitudeHeightToEcef can be used. - */ - UFUNCTION(BlueprintPure, Category = "Cesium") - FVector TransformLongitudeLatitudeHeightToEcef( - const FVector& LongitudeLatitudeHeight) const; - - /** - * Transforms the given Earth-Centered, Earth-Fixed (ECEF) coordinates into - * WGS84 longitude in degrees (x), latitude in degrees (y), and height above - * the ellipsoid in meters (z). - */ - UFUNCTION(BlueprintPure, Category = "Cesium") - FVector TransformEcefToLongitudeLatitudeHeight(const FVector& Ecef) const; - /** * Transforms the given longitude in degrees (x), latitude in * degrees (y), and height above the ellipsoid in meters (z) into Unreal * coordinates. The resulting position should generally not be interpreted as * an Unreal _world_ position, but rather a position expressed in some parent - * Actor's reference frame as defined by its Transform. This way, the chain of + * Actor's reference frame as defined by its transform. This way, the chain of * Unreal transforms places and orients the "globe" in the Unreal world. */ - UFUNCTION(BlueprintPure, Category = "Cesium") - FVector TransformLongitudeLatitudeHeightToUnreal( + UFUNCTION( + BlueprintPure, + Category = "Cesium", + meta = (ReturnDisplayName = "UnrealPosition")) + FVector TransformLongitudeLatitudeHeightPositionToUnreal( const FVector& LongitudeLatitudeHeight) const; /** - * Transforms Unreal coordinates into longitude in degrees (x), latitude in - * degrees (y), and height above the ellipsoid in meters (z). The position - * should generally not be an Unreal _world_ position, but rather a position - * expressed in some parent Actor's reference frame as defined by its - * Transform. This way, the chain of Unreal transforms places and orients the + * Transforms a position in Unreal coordinates into longitude in degrees (x), + * latitude in degrees (y), and height above the ellipsoid in meters (z). The + * position should generally not be an Unreal _world_ position, but rather a + * position expressed in some parent Actor's reference frame as defined by its + * transform. This way, the chain of Unreal transforms places and orients the * "globe" in the Unreal world. */ - UFUNCTION(BlueprintPure, Category = "Cesium") - FVector TransformUnrealToLongitudeLatitudeHeight(const FVector& Unreal) const; + UFUNCTION( + BlueprintPure, + Category = "Cesium", + meta = (ReturnDisplayName = "LongitudeLatitudeHeight")) + FVector TransformUnrealPositionToLongitudeLatitudeHeight( + const FVector& UnrealPosition) const; /** - * Transforms the given point from Earth-Centered, Earth-Fixed (ECEF) into - * Unreal coordinates. The resulting position should generally not be + * Transforms a position in Earth-Centered, Earth-Fixed (ECEF) coordinates + * into Unreal coordinates. The resulting position should generally not be * interpreted as an Unreal _world_ position, but rather a position expressed - * in some parent Actor's reference frame as defined by its Transform. This + * in some parent Actor's reference frame as defined by its transform. This * way, the chain of Unreal transforms places and orients the "globe" in the * Unreal world. */ - UFUNCTION(BlueprintPure, Category = "Cesium") - FVector TransformEcefToUnreal(const FVector& Ecef) const; + UFUNCTION( + BlueprintPure, + Category = "Cesium", + meta = (ReturnDisplayName = "UnrealPosition")) + FVector TransformEarthCenteredEarthFixedPositionToUnreal( + const FVector& EarthCenteredEarthFixedPosition) const; /** - * Transforms the given point from Unreal coordinates to Earth-Centered, + * Transforms the given position from Unreal coordinates to Earth-Centered, * Earth-Fixed (ECEF). The position should generally not be an Unreal _world_ * position, but rather a position expressed in some parent Actor's reference - * frame as defined by its Transform. This way, the chain of Unreal transforms + * frame as defined by its transform. This way, the chain of Unreal transforms * places and orients the "globe" in the Unreal world. */ - UFUNCTION(BlueprintPure, Category = "Cesium") - FVector TransformUnrealToEcef(const FVector& Unreal) const; + UFUNCTION( + BlueprintPure, + Category = "Cesium", + meta = (ReturnDisplayName = "EarthCenteredEarthFixedPosition")) + FVector TransformUnrealPositionToEarthCenteredEarthFixed( + const FVector& UnrealPosition) const; + + /** + * Transforms a direction vector in Earth-Centered, Earth-Fixed (ECEF) + * coordinates into Unreal coordinates. The resulting direction vector should + * generally not be interpreted as an Unreal _world_ vector, but rather a + * vector expressed in some parent Actor's reference frame as defined by its + * transform. This way, the chain of Unreal transforms places and orients the + * "globe" in the Unreal world. + */ + UFUNCTION( + BlueprintPure, + Category = "Cesium", + meta = (ReturnDisplayName = "UnrealDirection")) + FVector TransformEarthCenteredEarthFixedDirectionToUnreal( + const FVector& EarthCenteredEarthFixedDirection) const; + + /** + * Transforms the given direction vector from Unreal coordinates to + * Earth-Centered, Earth-Fixed (ECEF) coordinates. The direction vector should + * generally not be an Unreal _world_ vector, but rather a vector expressed in + * some parent Actor's reference frame as defined by its transform. This way, + * the chain of Unreal transforms places and orients the "globe" in the Unreal + * world. + */ + UFUNCTION( + BlueprintPure, + Category = "Cesium", + meta = (ReturnDisplayName = "EarthCenteredEarthFixedPosition")) + FVector TransformUnrealDirectionToEarthCenteredEarthFixed( + const FVector& UnrealDirection) const; /** * Transforms a rotator from Unreal to East-South-Up at the given @@ -381,19 +441,19 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { #pragma region Editor Support -public: #if WITH_EDITOR +public: /** * Places the georeference origin at the camera's current location. Rotates * the globe so the current longitude/latitude/height of the camera is at the * Unreal origin. The camera is also teleported to the Unreal origin. * * Warning: Before clicking, ensure that all non-Cesium objects in the - * persistent level are georeferenced with the "CesiumGeoreferenceComponent" + * persistent level are georeferenced with the "CesiumGlobeAnchorComponent" * or attached to an actor with that component. Ensure that static actors only * exist in georeferenced sub-levels. */ - UFUNCTION(CallInEditor, Category = "Actions") + UFUNCTION(CallInEditor, Category = "Cesium") void PlaceGeoreferenceOriginHere(); #endif @@ -450,6 +510,35 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { void _createSubLevelsFromWorldComposition(); #endif + /** + * Transforms the given longitude in degrees (x), latitude in + * degrees (y), and height above the ellipsoid in meters (z) into + * Earth-Centered, Earth-Fixed (ECEF) coordinates. + */ + UFUNCTION( + BlueprintPure, + Category = "Cesium", + meta = + (DeprecatedFunction, + DeprecationMessage = + "Use LongitudeLatitudeHeightToEarthCenteredEarthFixed on CesiumWgs84Ellipsoid instead.")) + FVector TransformLongitudeLatitudeHeightToEcef( + const FVector& LongitudeLatitudeHeight) const; + + /** + * Transforms the given Earth-Centered, Earth-Fixed (ECEF) coordinates into + * WGS84 longitude in degrees (x), latitude in degrees (y), and height above + * the ellipsoid in meters (z). + */ + UFUNCTION( + BlueprintPure, + Category = "Cesium", + meta = + (DeprecatedFunction, + DeprecationMessage = + "Use EarthCenteredEarthFixedToLongitudeLatitudeHeight on CesiumWgs84Ellipsoid instead.")) + FVector TransformEcefToLongitudeLatitudeHeight(const FVector& Ecef) const; + #pragma endregion #pragma region Implementation Details diff --git a/Source/CesiumRuntime/Public/CesiumWgs84Ellipsoid.h b/Source/CesiumRuntime/Public/CesiumWgs84Ellipsoid.h index 678c4bb8f..f83785c36 100644 --- a/Source/CesiumRuntime/Public/CesiumWgs84Ellipsoid.h +++ b/Source/CesiumRuntime/Public/CesiumWgs84Ellipsoid.h @@ -40,14 +40,14 @@ class CESIUMRUNTIME_API UCesiumWgs84Ellipsoid * value (0,0,0) because the surface position is undefined. */ UFUNCTION(BlueprintPure, Category = "Cesium|WGS84 Ellipsoid") - static FVector ScaleToGeodeticSurface(const FVector& earthCenteredEarthFixed); + static FVector ScaleToGeodeticSurface(const FVector& EarthCenteredEarthFixed); /** * Computes the normal of the plane tangent to the surface of the ellipsoid * at the provided Earth-Centered, Earth-Fixed position. */ UFUNCTION(BlueprintPure, Category = "Cesium|WGS84 Ellipsoid") - static FVector GeodeticSurfaceNormal(const FVector& earthCenteredEarthFixed); + static FVector GeodeticSurfaceNormal(const FVector& EarthCenteredEarthFixed); /** * Convert longitude in degrees (X), latitude in degrees (Y), and height above @@ -56,7 +56,7 @@ class CESIUMRUNTIME_API UCesiumWgs84Ellipsoid */ UFUNCTION(BlueprintPure, Category = "Cesium|WGS84 Ellipsoid") static FVector LongitudeLatitudeHeightToEarthCenteredEarthFixed( - const FVector& longitudeLatitudeHeight); + const FVector& LongitudeLatitudeHeight); /** * Convert Earth-Centered, Earth-Fixed (ECEF) coordinates to longitude in @@ -67,5 +67,5 @@ class CESIUMRUNTIME_API UCesiumWgs84Ellipsoid */ UFUNCTION(BlueprintPure, Category = "Cesium|WGS84 Ellipsoid") static FVector EarthCenteredEarthFixedToLongitudeLatitudeHeight( - const FVector& earthCenteredEarthFixed); + const FVector& EarthCenteredEarthFixed); }; diff --git a/Source/CesiumRuntime/Public/GeoTransforms.h b/Source/CesiumRuntime/Public/GeoTransforms.h index 801a824bd..ed4159380 100644 --- a/Source/CesiumRuntime/Public/GeoTransforms.h +++ b/Source/CesiumRuntime/Public/GeoTransforms.h @@ -215,6 +215,13 @@ class CESIUMRUNTIME_API GeoTransforms { const glm::dvec3& oldPosition, const glm::dvec3& newPosition) const; + const FMatrix& GetEllipsoidCenteredToAbsoluteUnrealWorldMatrix() const { + return this->_ecefToUnreal; + } + const FMatrix& GetAbsoluteUnrealWorldToEllipsoidCenteredMatrix() const { + return this->_unrealToEcef; + } + private: /** * Update the derived state (i.e. the local horizontal coordinate system) when @@ -228,4 +235,6 @@ class CESIUMRUNTIME_API GeoTransforms { CesiumGeospatial::Ellipsoid _ellipsoid; glm::dvec3 _center; double _scale; + FMatrix _ecefToUnreal; + FMatrix _unrealToEcef; }; From 722c9e68393ad106e8cc993447f82d32a3197d78 Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Tue, 25 Jul 2023 15:00:36 +1000 Subject: [PATCH 04/13] Clean rotator and matrix transformations. --- CHANGES.md | 1 + Config/Engine.ini | 5 + .../Private/CesiumGeoreference.cpp | 20 ++-- .../Private/CesiumWgs84Ellipsoid.cpp | 29 ++++-- .../CesiumRuntime/Private/GeoTransforms.cpp | 11 ++- .../Private/GlobeAwareDefaultPawn.cpp | 3 +- .../CesiumRuntime/Public/CesiumGeoreference.h | 95 ++++++++++++++----- .../Public/CesiumWgs84Ellipsoid.h | 35 +++++-- Source/CesiumRuntime/Public/GeoTransforms.h | 2 +- 9 files changed, 141 insertions(+), 60 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index edd363a41..136ecf1c5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,6 +8,7 @@ - `CesiumSunSky` now uses a default `TransmittanceMinLightElevationAngle` value on its `SkyAtmosphere` component of 90.0 degrees instead of -90.0 degrees. This will generally improve lighting when far from the CesiumGeoreference origin, but it is a breaking change because it may change the lighting conditions in existing levels, particularly at sunrise and sunset. - The `Mobility` property on `ACesium3DTileset` is now obsolete. Instead, use the normal mechanism of setting the root component's mobility. - Removed many methods that from the C++ interface of `ACesiumGeoreference` that used `glm` vector types. Use the versions that work with Unreal types instead. +- The `ComputeEastSouthUpToUnreal` function on `ACesiumGeoreference` now returns a matrix that includes the translation component of the transformation. Previously it only included the rotation component. ##### Additions :tada: diff --git a/Config/Engine.ini b/Config/Engine.ini index 81f3247b9..5f8dd3969 100644 --- a/Config/Engine.ini +++ b/Config/Engine.ini @@ -61,3 +61,8 @@ +FunctionRedirects=(OldName="CesiumGeoreference.TransformUnrealToEcef",NewName="TransformUnrealPositionToEarthCenteredEarthFixed") +PropertyRedirects=(OldName="CesiumGeoreference.TransformUnrealPositionToEarthCenteredEarthFixed.Unreal", NewName="UnrealPosition") +FunctionRedirects=(OldName="CesiumGeoreference.TransformLongitudeLatitudeHeightToUnreal",NewName="TransformLongitudeLatitudeHeightPositionToUnreal") ++FunctionRedirects=(OldName="CesiumGeoreference.TransformRotatorUnrealToEastSouthUp",NewName="TransformUnrealRotatorToEastSouthUp") ++FunctionRedirects=(OldName="CesiumGeoreference.TransformRotatorEastSouthUpToUnreal",NewName="TransformEastSouthUpRotatorToUnreal") ++PropertyRedirects=(OldName="CesiumGeoreference.TransformEastSouthUpRotatorToUnreal.EsuRotator", NewName="EastSouthUpRotator") ++FunctionRedirects=(OldName="CesiumGeoreference.ComputeEastSouthUpToUnreal",NewName="ComputeEastSouthUpToUnrealTransformation") ++PropertyRedirects=(OldName="CesiumGeoreference.ComputeEastSouthUpToUnrealTransformation.Unreal", NewName="UnrealLocation") diff --git a/Source/CesiumRuntime/Private/CesiumGeoreference.cpp b/Source/CesiumRuntime/Private/CesiumGeoreference.cpp index eea7644ef..e3941dde3 100644 --- a/Source/CesiumRuntime/Private/CesiumGeoreference.cpp +++ b/Source/CesiumRuntime/Private/CesiumGeoreference.cpp @@ -775,7 +775,7 @@ FVector ACesiumGeoreference::TransformUnrealDirectionToEarthCenteredEarthFixed( .TransformVector(UnrealDirection); } -FRotator ACesiumGeoreference::TransformRotatorUnrealToEastSouthUp( +FRotator ACesiumGeoreference::TransformUnrealRotatorToEastSouthUp( const FRotator& UERotator, const FVector& ueLocation) const { return VecMath::createRotator( @@ -785,21 +785,21 @@ FRotator ACesiumGeoreference::TransformRotatorUnrealToEastSouthUp( VecMath::createVector3D(ueLocation))); } -FRotator ACesiumGeoreference::TransformRotatorEastSouthUpToUnreal( - const FRotator& EsuRotator, - const FVector& ueLocation) const { +FRotator ACesiumGeoreference::TransformEastSouthUpRotatorToUnreal( + const FRotator& EastSouthUpRotator, + const FVector& UnrealLocation) const { return VecMath::createRotator( this->_geoTransforms.TransformRotatorEastSouthUpToUnreal( glm::dvec3(CesiumActors::getWorldOrigin4D(this)), - VecMath::createQuaternion(EsuRotator.Quaternion()), - VecMath::createVector3D(ueLocation))); + VecMath::createQuaternion(EastSouthUpRotator.Quaternion()), + VecMath::createVector3D(UnrealLocation))); } -FMatrix -ACesiumGeoreference::ComputeEastSouthUpToUnreal(const FVector& ue) const { - glm::dmat3 esuToUe = this->_geoTransforms.ComputeEastSouthUpToUnreal( +FMatrix ACesiumGeoreference::ComputeEastSouthUpToUnrealTransformation( + const FVector& UnrealLocation) const { + glm::dmat4 esuToUe = this->_geoTransforms.ComputeEastSouthUpToUnreal( glm::dvec3(CesiumActors::getWorldOrigin4D(this)), - glm::dvec3(ue.X, ue.Y, ue.Z)); + glm::dvec3(UnrealLocation.X, UnrealLocation.Y, UnrealLocation.Z)); return VecMath::createMatrix(esuToUe); } diff --git a/Source/CesiumRuntime/Private/CesiumWgs84Ellipsoid.cpp b/Source/CesiumRuntime/Private/CesiumWgs84Ellipsoid.cpp index 498e4583b..6f6c7239f 100644 --- a/Source/CesiumRuntime/Private/CesiumWgs84Ellipsoid.cpp +++ b/Source/CesiumRuntime/Private/CesiumWgs84Ellipsoid.cpp @@ -3,6 +3,7 @@ #include "CesiumWgs84Ellipsoid.h" #include "VecMath.h" #include +#include #include using namespace CesiumGeospatial; @@ -22,9 +23,9 @@ double UCesiumWgs84Ellipsoid::GetMinimumRadius() { } FVector UCesiumWgs84Ellipsoid::ScaleToGeodeticSurface( - const FVector& earthCenteredEarthFixed) { + const FVector& EarthCenteredEarthFixedPosition) { std::optional result = Ellipsoid::WGS84.scaleToGeodeticSurface( - VecMath::createVector3D(earthCenteredEarthFixed)); + VecMath::createVector3D(EarthCenteredEarthFixedPosition)); if (result) { return VecMath::createVector(*result); } else { @@ -33,25 +34,25 @@ FVector UCesiumWgs84Ellipsoid::ScaleToGeodeticSurface( } FVector UCesiumWgs84Ellipsoid::GeodeticSurfaceNormal( - const FVector& earthCenteredEarthFixed) { + const FVector& EarthCenteredEarthFixedPosition) { return VecMath::createVector(Ellipsoid::WGS84.geodeticSurfaceNormal( - VecMath::createVector3D(earthCenteredEarthFixed))); + VecMath::createVector3D(EarthCenteredEarthFixedPosition))); } FVector UCesiumWgs84Ellipsoid::LongitudeLatitudeHeightToEarthCenteredEarthFixed( - const FVector& longitudeLatitudeHeight) { + const FVector& LongitudeLatitudeHeight) { glm::dvec3 cartesian = Ellipsoid::WGS84.cartographicToCartesian(Cartographic::fromDegrees( - longitudeLatitudeHeight.X, - longitudeLatitudeHeight.Y, - longitudeLatitudeHeight.Z)); + LongitudeLatitudeHeight.X, + LongitudeLatitudeHeight.Y, + LongitudeLatitudeHeight.Z)); return VecMath::createVector(cartesian); } FVector UCesiumWgs84Ellipsoid::EarthCenteredEarthFixedToLongitudeLatitudeHeight( - const FVector& earthCenteredEarthFixed) { + const FVector& EarthCenteredEarthFixedPosition) { std::optional result = Ellipsoid::WGS84.cartesianToCartographic( - VecMath::createVector3D(earthCenteredEarthFixed)); + VecMath::createVector3D(EarthCenteredEarthFixedPosition)); if (result) { return FVector( Math::radiansToDegrees(result->longitude), @@ -61,3 +62,11 @@ FVector UCesiumWgs84Ellipsoid::EarthCenteredEarthFixedToLongitudeLatitudeHeight( return FVector(0.0, 0.0, 0.0); } } + +FMatrix UCesiumWgs84Ellipsoid::EastNorthUpToEarthCenteredEarthFixed( + const FVector& EarthCenteredEarthFixedPosition) { + return VecMath::createMatrix( + CesiumGeospatial::GlobeTransforms::eastNorthUpToFixedFrame( + VecMath::createVector3D(EarthCenteredEarthFixedPosition), + CesiumGeospatial::Ellipsoid::WGS84)); +} diff --git a/Source/CesiumRuntime/Private/GeoTransforms.cpp b/Source/CesiumRuntime/Private/GeoTransforms.cpp index 419afbe4c..5f017feb0 100644 --- a/Source/CesiumRuntime/Private/GeoTransforms.cpp +++ b/Source/CesiumRuntime/Private/GeoTransforms.cpp @@ -179,7 +179,8 @@ glm::dquat GeoTransforms::TransformRotatorUnrealToEastSouthUp( const glm::dvec3& origin, const glm::dquat& UERotator, const glm::dvec3& ueLocation) const noexcept { - glm::dmat3 esuToUe = this->ComputeEastSouthUpToUnreal(origin, ueLocation); + glm::dmat3 esuToUe = + glm::dmat3(this->ComputeEastSouthUpToUnreal(origin, ueLocation)); glm::dmat3 ueToEsu = glm::affineInverse(esuToUe); glm::dquat ueToEsuQuat = glm::quat_cast(ueToEsu); return ueToEsuQuat * UERotator; @@ -190,19 +191,19 @@ glm::dquat GeoTransforms::TransformRotatorEastSouthUpToUnreal( const glm::dquat& ESURotator, const glm::dvec3& ueLocation) const noexcept { - glm::dmat3 esuToUe = this->ComputeEastSouthUpToUnreal(origin, ueLocation); + glm::dmat3 esuToUe = + glm::dmat3(this->ComputeEastSouthUpToUnreal(origin, ueLocation)); glm::dquat esuToUeQuat = glm::quat_cast(esuToUe); return esuToUeQuat * ESURotator; } -glm::dmat3 GeoTransforms::ComputeEastSouthUpToUnreal( +glm::dmat4 GeoTransforms::ComputeEastSouthUpToUnreal( const glm::dvec3& origin, const glm::dvec3& ue) const noexcept { glm::dvec3 ecef = this->TransformUnrealToEcef(origin, ue); LocalHorizontalCoordinateSystem newLocal = createCoordinateSystem(this->_ellipsoid, ecef, this->_scale); - return glm::dmat3( - newLocal.computeTransformationToAnotherLocal(this->_coordinateSystem)); + return newLocal.computeTransformationToAnotherLocal(this->_coordinateSystem); } glm::dmat3 diff --git a/Source/CesiumRuntime/Private/GlobeAwareDefaultPawn.cpp b/Source/CesiumRuntime/Private/GlobeAwareDefaultPawn.cpp index 7d8687fb9..8d8920ce3 100644 --- a/Source/CesiumRuntime/Private/GlobeAwareDefaultPawn.cpp +++ b/Source/CesiumRuntime/Private/GlobeAwareDefaultPawn.cpp @@ -96,7 +96,8 @@ FRotator AGlobeAwareDefaultPawn::GetViewRotation() const { FVector globePosition = transform.InverseTransformPosition(this->GetPawnViewLocation()); FMatrix esuAdjustmentMatrix = - this->GetGeoreference()->ComputeEastSouthUpToUnreal(globePosition) * + this->GetGeoreference()->ComputeEastSouthUpToUnrealTransformation( + globePosition) * transform.ToMatrixNoScale(); return FRotator(esuAdjustmentMatrix.ToQuat() * localRotation.Quaternion()); diff --git a/Source/CesiumRuntime/Public/CesiumGeoreference.h b/Source/CesiumRuntime/Public/CesiumGeoreference.h index 8d6551472..d1d0cd2e4 100644 --- a/Source/CesiumRuntime/Public/CesiumGeoreference.h +++ b/Source/CesiumRuntime/Public/CesiumGeoreference.h @@ -395,47 +395,77 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { const FVector& UnrealDirection) const; /** - * Transforms a rotator from Unreal to East-South-Up at the given - * Unreal location. The rotator and location should generally not be relative - * to the Unreal _world_, but rather be expressed in some parent + * Given a Rotator that transforms an object into the Unreal coordinate + * system, returns a new Rotator that transforms that object into an + * East-South-Up frame centered at a given location. + * + * In an East-South-Up frame, +X points East, +Y points South, and +Z points + * Up. However, the directions of "East", "South", and "Up" in Unreal or ECEF + * coordinates vary depending on where on the globe we are talking about. + * That is why this function takes a location, expressed in Unreal + * coordinates, that defines the origin of the East-South-Up frame of + * interest. + * + * The Unreal location and the resulting Rotator should generally not be + * relative to the Unreal _world_, but rather be expressed in some parent * Actor's reference frame as defined by its Transform. This way, the chain of * Unreal transforms places and orients the "globe" in the Unreal world. */ - UFUNCTION(BlueprintPure, Category = "Cesium") - FRotator TransformRotatorUnrealToEastSouthUp( + UFUNCTION( + BlueprintPure, + Category = "Cesium", + meta = (ReturnDisplayName = "EastSouthUpRotator")) + FRotator TransformUnrealRotatorToEastSouthUp( const FRotator& UnrealRotator, const FVector& UnrealLocation) const; /** - * Transforms a rotator from East-South-Up to Unreal at the given - * Unreal location. The location and resulting rotator should generally not be + * Given a Rotator that transforms an object into the East-South-Up frame + * centered at a given location, returns a new Rotator that transforms that + * object into Unreal coordinates. + * + * In an East-South-Up frame, +X points East, +Y points South, and +Z points + * Up. However, the directions of "East", "South", and "Up" in Unreal or ECEF + * coordinates vary depending on where on the globe we are talking about. + * That is why this function takes a location, expressed in Unreal + * coordinates, that defines the origin of the East-South-Up frame of + * interest. + * + * The Unreal location and the resulting Rotator should generally not be * relative to the Unreal _world_, but rather be expressed in some parent * Actor's reference frame as defined by its Transform. This way, the chain of * Unreal transforms places and orients the "globe" in the Unreal world. */ - UFUNCTION(BlueprintPure, Category = "Cesium") - FRotator TransformRotatorEastSouthUpToUnreal( - const FRotator& EsuRotator, + UFUNCTION( + BlueprintPure, + Category = "Cesium", + meta = (ReturnDisplayName = "UnrealRotator")) + FRotator TransformEastSouthUpRotatorToUnreal( + const FRotator& EastSouthUpRotator, const FVector& UnrealLocation) const; /** - * Computes the rotation matrix from the local East-South-Up to Unreal at the - * specified Unreal location. The returned transformation works in Unreal's - * left-handed coordinate system. The location and resulting rotation should - * generally not be relative to the Unreal _world_, but rather be expressed in - * some parent Actor's reference frame as defined by its Transform. This way, - * the chain of Unreal transforms places and orients the "globe" in the Unreal - * world. - */ - UFUNCTION(BlueprintPure, Category = "Cesium") - FMatrix ComputeEastSouthUpToUnreal(const FVector& Unreal) const; - - /** - * Computes the rotation matrix from the local East-North-Up to - * Earth-Centered, Earth-Fixed (ECEF) at the specified ECEF location. + * Computes the matrix that transforms from an East-South-Up frame centered at + * a given location to the Unreal frame. + * + * In an East-South-Up frame, +X points East, +Y points South, and +Z points + * Up. However, the directions of "East", "South", and "Up" in Unreal or ECEF + * coordinates vary depending on where on the globe we are talking about. + * That is why this function takes a location, expressed in Unreal + * coordinates, that defines the origin of the East-South-Up frame of + * interest. + * + * The Unreal location and the resulting matrix should generally not be + * relative to the Unreal _world_, but rather be expressed in some parent + * Actor's reference frame as defined by its Transform. This way, the chain of + * Unreal transforms places and orients the "globe" in the Unreal world. */ - UFUNCTION(BlueprintPure, Category = "Cesium") - FMatrix ComputeEastNorthUpToEcef(const FVector& Ecef) const; + UFUNCTION( + BlueprintPure, + Category = "Cesium", + meta = (ReturnDisplayName = "EastSouthUpToUnrealMatrix")) + FMatrix + ComputeEastSouthUpToUnrealTransformation(const FVector& UnrealLocation) const; #pragma endregion @@ -539,6 +569,19 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { "Use EarthCenteredEarthFixedToLongitudeLatitudeHeight on CesiumWgs84Ellipsoid instead.")) FVector TransformEcefToLongitudeLatitudeHeight(const FVector& Ecef) const; + /** + * Computes the rotation matrix from the local East-North-Up to + * Earth-Centered, Earth-Fixed (ECEF) at the specified ECEF location. + */ + UFUNCTION( + BlueprintPure, + Category = "Cesium", + meta = + (DeprecatedFunction, + DeprecationMessage = + "Use EastNorthUpToEarthCenteredEarthFixed on CesiumWgs84Ellipsoid instead.")) + FMatrix ComputeEastNorthUpToEcef(const FVector& Ecef) const; + #pragma endregion #pragma region Implementation Details diff --git a/Source/CesiumRuntime/Public/CesiumWgs84Ellipsoid.h b/Source/CesiumRuntime/Public/CesiumWgs84Ellipsoid.h index f83785c36..a6621cf25 100644 --- a/Source/CesiumRuntime/Public/CesiumWgs84Ellipsoid.h +++ b/Source/CesiumRuntime/Public/CesiumWgs84Ellipsoid.h @@ -39,22 +39,33 @@ class CESIUMRUNTIME_API UCesiumWgs84Ellipsoid * position is near the center of the ellipsoid, the result will have the * value (0,0,0) because the surface position is undefined. */ - UFUNCTION(BlueprintPure, Category = "Cesium|WGS84 Ellipsoid") - static FVector ScaleToGeodeticSurface(const FVector& EarthCenteredEarthFixed); + UFUNCTION( + BlueprintPure, + Category = "Cesium|WGS84 Ellipsoid", + meta = (ReturnDisplayName = "SurfacePosition")) + static FVector + ScaleToGeodeticSurface(const FVector& EarthCenteredEarthFixedPosition); /** * Computes the normal of the plane tangent to the surface of the ellipsoid * at the provided Earth-Centered, Earth-Fixed position. */ - UFUNCTION(BlueprintPure, Category = "Cesium|WGS84 Ellipsoid") - static FVector GeodeticSurfaceNormal(const FVector& EarthCenteredEarthFixed); + UFUNCTION( + BlueprintPure, + Category = "Cesium|WGS84 Ellipsoid", + meta = (ReturnDisplayName = "SurfaceNormalVector")) + static FVector + GeodeticSurfaceNormal(const FVector& EarthCenteredEarthFixedPosition); /** * Convert longitude in degrees (X), latitude in degrees (Y), and height above * the WGS84 ellipsoid in meters (Z) to Earth-Centered, Earth-Fixed (ECEF) * coordinates. */ - UFUNCTION(BlueprintPure, Category = "Cesium|WGS84 Ellipsoid") + UFUNCTION( + BlueprintPure, + Category = "Cesium|WGS84 Ellipsoid", + meta = (ReturnDisplayName = "EarthCenteredEarthFixedPosition")) static FVector LongitudeLatitudeHeightToEarthCenteredEarthFixed( const FVector& LongitudeLatitudeHeight); @@ -65,7 +76,17 @@ class CESIUMRUNTIME_API UCesiumWgs84Ellipsoid * will have the value (0,0,0) because the longitude, latitude, and height are * undefined. */ - UFUNCTION(BlueprintPure, Category = "Cesium|WGS84 Ellipsoid") + UFUNCTION( + BlueprintPure, + Category = "Cesium|WGS84 Ellipsoid", + meta = (ReturnDisplayName = "LongitudeLatitudeHeight")) static FVector EarthCenteredEarthFixedToLongitudeLatitudeHeight( - const FVector& EarthCenteredEarthFixed); + const FVector& EarthCenteredEarthFixedPosition); + + /** + * Computes the transformation matrix from the local East-North-Up (ENU) frame + * to Earth-Centered, Earth-Fixed (ECEF) at the specified ECEF location. + */ + static FMatrix EastNorthUpToEarthCenteredEarthFixed( + const FVector& EarthCenteredEarthFixedPosition); }; diff --git a/Source/CesiumRuntime/Public/GeoTransforms.h b/Source/CesiumRuntime/Public/GeoTransforms.h index ed4159380..cff920bd1 100644 --- a/Source/CesiumRuntime/Public/GeoTransforms.h +++ b/Source/CesiumRuntime/Public/GeoTransforms.h @@ -131,7 +131,7 @@ class CESIUMRUNTIME_API GeoTransforms { * origin). The returned transformation works in Unreal's left-handed * coordinate system. */ - glm::dmat3 ComputeEastSouthUpToUnreal( + glm::dmat4 ComputeEastSouthUpToUnreal( const glm::dvec3& origin, const glm::dvec3& Ue) const noexcept; From 7794b44fc426d6c638e7446167207e8e19e74234 Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Tue, 25 Jul 2023 22:13:36 +1000 Subject: [PATCH 05/13] Georeference transform tests, more cleanup. --- Config/Engine.ini | 4 + .../Private/CesiumGeoreference.cpp | 36 ++-- .../Private/CesiumSubLevelComponent.cpp | 9 +- .../Private/Tests/CesiumGeoreference.spec.cpp | 189 ++++++++++++++++++ .../Private/Tests/SubLevels.spec.cpp | 2 +- .../CesiumRuntime/Public/CesiumGeoreference.h | 17 +- 6 files changed, 226 insertions(+), 31 deletions(-) create mode 100644 Source/CesiumRuntime/Private/Tests/CesiumGeoreference.spec.cpp diff --git a/Config/Engine.ini b/Config/Engine.ini index 5f8dd3969..ba4ab8878 100644 --- a/Config/Engine.ini +++ b/Config/Engine.ini @@ -66,3 +66,7 @@ +PropertyRedirects=(OldName="CesiumGeoreference.TransformEastSouthUpRotatorToUnreal.EsuRotator", NewName="EastSouthUpRotator") +FunctionRedirects=(OldName="CesiumGeoreference.ComputeEastSouthUpToUnreal",NewName="ComputeEastSouthUpToUnrealTransformation") +PropertyRedirects=(OldName="CesiumGeoreference.ComputeEastSouthUpToUnrealTransformation.Unreal", NewName="UnrealLocation") ++FunctionRedirects=(OldName="CesiumGeoreference.SetGeoreferenceOriginLongitudeLatitudeHeight",NewName="SetOriginLongitudeLatitudeHeight") ++FunctionRedirects=(OldName="CesiumGeoreference.GetGeoreferenceOriginLongitudeLatitudeHeight",NewName="GetOriginLongitudeLatitudeHeight") ++FunctionRedirects=(OldName="CesiumGeoreference.SetGeoreferenceOriginEcef",NewName="SetOriginEarthCenteredEarthFixed") ++PropertyRedirects=(OldName="CesiumGeoreference.SetOriginEarthCenteredEarthFixed.TargetEcef", NewName="TargetEarthCenteredEarthFixed") diff --git a/Source/CesiumRuntime/Private/CesiumGeoreference.cpp b/Source/CesiumRuntime/Private/CesiumGeoreference.cpp index e3941dde3..0c8ac02b8 100644 --- a/Source/CesiumRuntime/Private/CesiumGeoreference.cpp +++ b/Source/CesiumRuntime/Private/CesiumGeoreference.cpp @@ -336,12 +336,11 @@ void ACesiumGeoreference::_createSubLevelsFromWorldComposition() { PRAGMA_ENABLE_DEPRECATION_WARNINGS #endif -FVector -ACesiumGeoreference::GetGeoreferenceOriginLongitudeLatitudeHeight() const { +FVector ACesiumGeoreference::GetOriginLongitudeLatitudeHeight() const { return FVector(OriginLongitude, OriginLatitude, OriginHeight); } -void ACesiumGeoreference::SetGeoreferenceOriginLongitudeLatitudeHeight( +void ACesiumGeoreference::SetOriginLongitudeLatitudeHeight( const FVector& targetLongitudeLatitudeHeight) { this->_setGeoreferenceOrigin( targetLongitudeLatitudeHeight.X, @@ -349,10 +348,11 @@ void ACesiumGeoreference::SetGeoreferenceOriginLongitudeLatitudeHeight( targetLongitudeLatitudeHeight.Z); } -void ACesiumGeoreference::SetGeoreferenceOriginEcef(const FVector& TargetEcef) { - this->SetGeoreferenceOriginLongitudeLatitudeHeight(VecMath::createVector( +void ACesiumGeoreference::SetOriginEarthCenteredEarthFixed( + const FVector& TargetEarthCenteredEarthFixed) { + this->SetOriginLongitudeLatitudeHeight(VecMath::createVector( _geoTransforms.TransformEcefToLongitudeLatitudeHeight( - VecMath::createVector3D(TargetEcef)))); + VecMath::createVector3D(TargetEarthCenteredEarthFixed)))); } EOriginPlacement ACesiumGeoreference::GetOriginPlacement() const { @@ -776,23 +776,23 @@ FVector ACesiumGeoreference::TransformUnrealDirectionToEarthCenteredEarthFixed( } FRotator ACesiumGeoreference::TransformUnrealRotatorToEastSouthUp( - const FRotator& UERotator, - const FVector& ueLocation) const { - return VecMath::createRotator( - this->_geoTransforms.TransformRotatorUnrealToEastSouthUp( - glm::dvec3(CesiumActors::getWorldOrigin4D(this)), - VecMath::createQuaternion(UERotator.Quaternion()), - VecMath::createVector3D(ueLocation))); + const FRotator& UnrealRotator, + const FVector& UnrealLocation) const { + FMatrix unrealToEsu = + this->ComputeEastSouthUpToUnrealTransformation(UnrealLocation).Inverse(); + FMatrix unreal = FRotationMatrix::Make(UnrealRotator); + FMatrix esu = unrealToEsu * unreal; + return esu.Rotator(); } FRotator ACesiumGeoreference::TransformEastSouthUpRotatorToUnreal( const FRotator& EastSouthUpRotator, const FVector& UnrealLocation) const { - return VecMath::createRotator( - this->_geoTransforms.TransformRotatorEastSouthUpToUnreal( - glm::dvec3(CesiumActors::getWorldOrigin4D(this)), - VecMath::createQuaternion(EastSouthUpRotator.Quaternion()), - VecMath::createVector3D(UnrealLocation))); + FMatrix esuToUnreal = + this->ComputeEastSouthUpToUnrealTransformation(UnrealLocation); + FMatrix esu = FRotationMatrix::Make(EastSouthUpRotator); + FMatrix unreal = esuToUnreal * esu; + return unreal.Rotator(); } FMatrix ACesiumGeoreference::ComputeEastSouthUpToUnrealTransformation( diff --git a/Source/CesiumRuntime/Private/CesiumSubLevelComponent.cpp b/Source/CesiumRuntime/Private/CesiumSubLevelComponent.cpp index 1a62c3536..827a12efc 100644 --- a/Source/CesiumRuntime/Private/CesiumSubLevelComponent.cpp +++ b/Source/CesiumRuntime/Private/CesiumSubLevelComponent.cpp @@ -259,11 +259,10 @@ void UCesiumSubLevelComponent::UpdateGeoreferenceIfSubLevelIsActive() { this->OriginLatitude != this->ResolvedGeoreference->GetOriginLatitude() || this->OriginHeight != this->ResolvedGeoreference->GetOriginHeight()) { - this->ResolvedGeoreference->SetGeoreferenceOriginLongitudeLatitudeHeight( - FVector( - this->OriginLongitude, - this->OriginLatitude, - this->OriginHeight)); + this->ResolvedGeoreference->SetOriginLongitudeLatitudeHeight(FVector( + this->OriginLongitude, + this->OriginLatitude, + this->OriginHeight)); } } } diff --git a/Source/CesiumRuntime/Private/Tests/CesiumGeoreference.spec.cpp b/Source/CesiumRuntime/Private/Tests/CesiumGeoreference.spec.cpp new file mode 100644 index 000000000..7fdc3c7eb --- /dev/null +++ b/Source/CesiumRuntime/Private/Tests/CesiumGeoreference.spec.cpp @@ -0,0 +1,189 @@ +// Copyright 2020-2023 CesiumGS, Inc. and Contributors + +#include "CesiumGeoreference.h" +#include "CesiumGeospatial/Ellipsoid.h" +#include "CesiumTestHelpers.h" +#include "CesiumUtility/Math.h" +#include "GeoTransforms.h" +#include "Misc/AutomationTest.h" + +using namespace CesiumGeospatial; +using namespace CesiumUtility; + +BEGIN_DEFINE_SPEC( + FCesiumGeoreferenceSpec, + "Cesium.Georeference", + EAutomationTestFlags::ApplicationContextMask | + EAutomationTestFlags::ProductFilter) + +TObjectPtr pGeoreferenceNullIsland; +TObjectPtr pGeoreference90Longitude; + +END_DEFINE_SPEC(FCesiumGeoreferenceSpec) + +void FCesiumGeoreferenceSpec::Define() { + BeforeEach([this]() { + UWorld* pWorld = CesiumTestHelpers::getGlobalWorldContext(); + pGeoreferenceNullIsland = pWorld->SpawnActor(); + pGeoreferenceNullIsland->SetOriginLongitudeLatitudeHeight( + FVector(0.0, 0.0, 0.0)); + pGeoreference90Longitude = pWorld->SpawnActor(); + pGeoreference90Longitude->SetOriginLongitudeLatitudeHeight( + FVector(90.0, 0.0, 0.0)); + }); + + Describe("Position Transformation", [this]() { + It("transforms longitude-latitude-height positions to Unreal", [this]() { + FVector nullIslandUnreal = + pGeoreferenceNullIsland + ->TransformLongitudeLatitudeHeightPositionToUnreal( + FVector(0.0, 0.0, 0.0)); + TestEqual("nullIslandUnreal", nullIslandUnreal, FVector(0.0, 0.0, 0.0)); + + FVector antiMeridianUnreal = + pGeoreferenceNullIsland + ->TransformLongitudeLatitudeHeightPositionToUnreal( + FVector(180.0, 0.0, 0.0)); + TestEqual( + "antiMeridianUnreal", + antiMeridianUnreal, + FVector( + 0.0, + 0.0, + -2.0 * Ellipsoid::WGS84.getMaximumRadius() * 100.0)); + }); + + It("transforms Earth-Centered, Earth-Fixed positions to Unreal", [this]() { + FVector nullIslandUnreal = + pGeoreferenceNullIsland + ->TransformEarthCenteredEarthFixedPositionToUnreal( + FVector(Ellipsoid::WGS84.getMaximumRadius(), 0.0, 0.0)); + TestEqual("nullIslandUnreal", nullIslandUnreal, FVector(0.0, 0.0, 0.0)); + + FVector antiMeridianUnreal = + pGeoreferenceNullIsland + ->TransformEarthCenteredEarthFixedPositionToUnreal( + FVector(-Ellipsoid::WGS84.getMaximumRadius(), 0.0, 0.0)); + TestEqual( + "antiMeridianUnreal", + antiMeridianUnreal, + FVector( + 0.0, + 0.0, + -2.0 * Ellipsoid::WGS84.getMaximumRadius() * 100.0)); + }); + + It("transforms Unreal positions to longitude-latitude-height", [this]() { + FVector nullIslandLLH = + pGeoreferenceNullIsland + ->TransformUnrealPositionToLongitudeLatitudeHeight( + FVector(0.0, 0.0, 0.0)); + TestEqual("nullIslandLLH", nullIslandLLH, FVector(0.0, 0.0, 0.0)); + + FVector antiMeridianLLH = + pGeoreferenceNullIsland + ->TransformUnrealPositionToLongitudeLatitudeHeight(FVector( + 0.0, + 0.0, + -2.0 * Ellipsoid::WGS84.getMaximumRadius() * 100.0)); + TestEqual("antiMeridianLLH", antiMeridianLLH, FVector(180.0, 0.0, 0.0)); + }); + + It("transforms Unreal positions to Earth-Centered, Earth-Fixed", [this]() { + FVector nullIslandEcef = + pGeoreferenceNullIsland + ->TransformUnrealPositionToEarthCenteredEarthFixed( + FVector(0.0, 0.0, 0.0)); + TestEqual( + "nullIslandEcef", + nullIslandEcef, + FVector(Ellipsoid::WGS84.getMaximumRadius(), 0.0, 0.0)); + + FVector antiMeridianEcef = + pGeoreferenceNullIsland + ->TransformUnrealPositionToEarthCenteredEarthFixed(FVector( + 0.0, + 0.0, + -2.0 * Ellipsoid::WGS84.getMaximumRadius() * 100.0)); + TestEqual( + "antiMeridianEcef", + antiMeridianEcef, + FVector(-Ellipsoid::WGS84.getMaximumRadius(), 0.0, 0.0)); + }); + }); + + Describe("Direction Transformation", [this]() { + It("transforms Earth-Centered, Earth-Fixed directions to Unreal", [this]() { + FVector northAtNullIslandUnreal = + pGeoreferenceNullIsland + ->TransformEarthCenteredEarthFixedDirectionToUnreal( + FVector(0.0, 0.0, 1.0)); + TestEqual( + "northAtNullIslandUnreal", + northAtNullIslandUnreal, + FVector(0.0, -100.0, 0.0)); // meters -> centimeters + + FVector westAtAntiMeridianUnreal = + pGeoreferenceNullIsland + ->TransformEarthCenteredEarthFixedDirectionToUnreal( + FVector(0.0, 1.0, 0.0)); + TestEqual( + "westAtAntiMeridianUnreal", + westAtAntiMeridianUnreal, + FVector( + 100.0, // West at anti-merdian is East at null island + 0.0, + 0.0)); + }); + + It("transforms Unreal directions to Earth-Centered, Earth-Fixed", [this]() { + FVector northAtNullIslandEcef = + pGeoreferenceNullIsland + ->TransformUnrealDirectionToEarthCenteredEarthFixed( + FVector(0.0, -1.0, 0.0)); + TestEqual( + "northAtNullIslandEcef", + northAtNullIslandEcef, + FVector(0.0, 0.0, 1.0 / 100.0)); // centimeters -> meters + + // West at anti-merdian is East at null island + FVector westAtAntiMeridianEcef = + pGeoreferenceNullIsland + ->TransformUnrealDirectionToEarthCenteredEarthFixed( + FVector(1.0, 0.0, 0.0)); + TestEqual( + "westAtAntiMeridianEcef", + westAtAntiMeridianEcef, + FVector(0.0, 1.0 / 100.0, 0.0)); + }); + }); + + Describe("Rotator Transformation", [this]() { + It("treats Unreal and East-South-Up as identical at the georeference origin", + [this]() { + FRotator atOrigin1 = + pGeoreferenceNullIsland->TransformEastSouthUpRotatorToUnreal( + FRotator(1.0, 2.0, 3.0), + FVector(0.0, 0.0, 0.0)); + TestEqual("atOrigin1", atOrigin1, FRotator(1.0, 2.0, 3.0)); + + FRotator atOrigin2 = + pGeoreferenceNullIsland->TransformUnrealRotatorToEastSouthUp( + FRotator(1.0, 2.0, 3.0), + FVector(0.0, 0.0, 0.0)); + TestEqual("atOrigin2", atOrigin2, FRotator(1.0, 2.0, 3.0)); + }); + }); + + It("transforms Unreal Rotators to East-South-Up", [this]() { + FRotator atNullIsland = + pGeoreferenceNullIsland->TransformEastSouthUpRotatorToUnreal( + FRotator(1.0, 2.0, 3.0), // pitch (+X), yaw (-Z), roll (+Y) + // at the anti-meridian / equator + FVector( + 0.0, + 0.0, + -2.0 * Ellipsoid::WGS84.getMaximumRadius() * 100.0)); + TestEqual("atNullIsland", atNullIsland, FRotator(-1.0, -2.0, 177.0)); + }); +} diff --git a/Source/CesiumRuntime/Private/Tests/SubLevels.spec.cpp b/Source/CesiumRuntime/Private/Tests/SubLevels.spec.cpp index 9773443e0..20f8587a1 100644 --- a/Source/CesiumRuntime/Private/Tests/SubLevels.spec.cpp +++ b/Source/CesiumRuntime/Private/Tests/SubLevels.spec.cpp @@ -116,7 +116,7 @@ void FSubLevelsSpec::Define() { "pSubLevel1 is hidden", pSubLevel1->IsTemporarilyHiddenInEditor(true)); - pGeoreference->SetGeoreferenceOriginLongitudeLatitudeHeight( + pGeoreference->SetOriginLongitudeLatitudeHeight( FVector(1.0, 2.0, 3.0)); TestEqual("Longitude", pLevelComponent1->GetOriginLongitude(), 1.0); TestEqual("Latitude", pLevelComponent1->GetOriginLatitude(), 2.0); diff --git a/Source/CesiumRuntime/Public/CesiumGeoreference.h b/Source/CesiumRuntime/Public/CesiumGeoreference.h index d1d0cd2e4..7b71e3a79 100644 --- a/Source/CesiumRuntime/Public/CesiumGeoreference.h +++ b/Source/CesiumRuntime/Public/CesiumGeoreference.h @@ -222,25 +222,28 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { * (i.e. Longitude / Latitude / Height). */ UFUNCTION(BlueprintPure, Category = "Cesium") - FVector GetGeoreferenceOriginLongitudeLatitudeHeight() const; + FVector GetOriginLongitudeLatitudeHeight() const; /** * This aligns the specified longitude in degrees (X), latitude in - * degrees (Y), and height above the ellipsoid in meters (Z) to Unreal's world + * degrees (Y), and height above the ellipsoid in meters (Z) to the Unreal * origin. That is, it moves the globe so that these coordinates exactly fall - * on the origin. + * on the origin. Only valid if the placement type is Cartographic Origin + * (i.e. Longitude / Latitude / Height). */ UFUNCTION(BlueprintCallable, Category = "Cesium") - void SetGeoreferenceOriginLongitudeLatitudeHeight( + void SetOriginLongitudeLatitudeHeight( const FVector& TargetLongitudeLatitudeHeight); /** * This aligns the specified Earth-Centered, Earth-Fixed (ECEF) coordinates to - * Unreal's world origin. I.e. it moves the globe so that these coordinates - * exactly fall on the origin. + * the Unreal origin. That is, it moves the globe so that these coordinates + * exactly fall on the origin. Only valid if the placement type is + * Cartographic Origin (i.e. Longitude / Latitude / Height). */ UFUNCTION(BlueprintCallable, Category = "Cesium") - void SetGeoreferenceOriginEcef(const FVector& TargetEcef); + void SetOriginEarthCenteredEarthFixed( + const FVector& TargetEarthCenteredEarthFixed); UFUNCTION(BlueprintGetter) EOriginPlacement GetOriginPlacement() const; From b8edabd10e5ced0e52eeb76c0a81118172448119 Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Thu, 27 Jul 2023 18:54:13 +1000 Subject: [PATCH 06/13] More efficient TransformEastSouthUpRotatorToUnreal. And a passing test. --- .../Private/CesiumGeoreference.cpp | 8 +-- .../Private/Tests/CesiumGeoreference.spec.cpp | 56 +++++++++++++++---- 2 files changed, 47 insertions(+), 17 deletions(-) diff --git a/Source/CesiumRuntime/Private/CesiumGeoreference.cpp b/Source/CesiumRuntime/Private/CesiumGeoreference.cpp index 0c8ac02b8..d3dc6bb42 100644 --- a/Source/CesiumRuntime/Private/CesiumGeoreference.cpp +++ b/Source/CesiumRuntime/Private/CesiumGeoreference.cpp @@ -780,9 +780,7 @@ FRotator ACesiumGeoreference::TransformUnrealRotatorToEastSouthUp( const FVector& UnrealLocation) const { FMatrix unrealToEsu = this->ComputeEastSouthUpToUnrealTransformation(UnrealLocation).Inverse(); - FMatrix unreal = FRotationMatrix::Make(UnrealRotator); - FMatrix esu = unrealToEsu * unreal; - return esu.Rotator(); + return FRotator(unrealToEsu.ToQuat() * EastSouthUpRotator.Quaternion()); } FRotator ACesiumGeoreference::TransformEastSouthUpRotatorToUnreal( @@ -790,9 +788,7 @@ FRotator ACesiumGeoreference::TransformEastSouthUpRotatorToUnreal( const FVector& UnrealLocation) const { FMatrix esuToUnreal = this->ComputeEastSouthUpToUnrealTransformation(UnrealLocation); - FMatrix esu = FRotationMatrix::Make(EastSouthUpRotator); - FMatrix unreal = esuToUnreal * esu; - return unreal.Rotator(); + return FRotator(esuToUnreal.ToQuat() * EastSouthUpRotator.Quaternion()); } FMatrix ACesiumGeoreference::ComputeEastSouthUpToUnrealTransformation( diff --git a/Source/CesiumRuntime/Private/Tests/CesiumGeoreference.spec.cpp b/Source/CesiumRuntime/Private/Tests/CesiumGeoreference.spec.cpp index 7fdc3c7eb..0331e4fbb 100644 --- a/Source/CesiumRuntime/Private/Tests/CesiumGeoreference.spec.cpp +++ b/Source/CesiumRuntime/Private/Tests/CesiumGeoreference.spec.cpp @@ -173,17 +173,51 @@ void FCesiumGeoreferenceSpec::Define() { FVector(0.0, 0.0, 0.0)); TestEqual("atOrigin2", atOrigin2, FRotator(1.0, 2.0, 3.0)); }); - }); - It("transforms Unreal Rotators to East-South-Up", [this]() { - FRotator atNullIsland = - pGeoreferenceNullIsland->TransformEastSouthUpRotatorToUnreal( - FRotator(1.0, 2.0, 3.0), // pitch (+X), yaw (-Z), roll (+Y) - // at the anti-meridian / equator - FVector( - 0.0, - 0.0, - -2.0 * Ellipsoid::WGS84.getMaximumRadius() * 100.0)); - TestEqual("atNullIsland", atNullIsland, FRotator(-1.0, -2.0, 177.0)); + It("transforms Unreal Rotators to East-South-Up", [this]() { + FRotator rotationAt90DegreesLongitude = FRotator(1.0, 2.0, 3.0); + FVector originOf90DegreesLongitudeInNullIslandCoordinates = + pGeoreferenceNullIsland + ->TransformLongitudeLatitudeHeightPositionToUnreal( + FVector(90.0, 0.0, 0.0)); + FRotator rotationAtNullIsland = + pGeoreferenceNullIsland->TransformEastSouthUpRotatorToUnreal( + rotationAt90DegreesLongitude, + originOf90DegreesLongitudeInNullIslandCoordinates); + + // Verify the rotation by checking the directions of the three axes. + FVector xEcefExpected = + pGeoreference90Longitude + ->TransformUnrealDirectionToEarthCenteredEarthFixed( + rotationAt90DegreesLongitude.RotateVector( + FVector::XAxisVector)); + FVector yEcefExpected = + pGeoreference90Longitude + ->TransformUnrealDirectionToEarthCenteredEarthFixed( + rotationAt90DegreesLongitude.RotateVector( + FVector::YAxisVector)); + FVector zEcefExpected = + pGeoreference90Longitude + ->TransformUnrealDirectionToEarthCenteredEarthFixed( + rotationAt90DegreesLongitude.RotateVector( + FVector::ZAxisVector)); + + FVector xEcefActual = + pGeoreferenceNullIsland + ->TransformUnrealDirectionToEarthCenteredEarthFixed( + rotationAtNullIsland.RotateVector(FVector::XAxisVector)); + FVector yEcefActual = + pGeoreferenceNullIsland + ->TransformUnrealDirectionToEarthCenteredEarthFixed( + rotationAtNullIsland.RotateVector(FVector::YAxisVector)); + FVector zEcefActual = + pGeoreferenceNullIsland + ->TransformUnrealDirectionToEarthCenteredEarthFixed( + rotationAtNullIsland.RotateVector(FVector::ZAxisVector)); + + TestEqual("xEcefActual", xEcefActual, xEcefExpected); + TestEqual("yEcefActual", yEcefActual, yEcefExpected); + TestEqual("zEcefActual", zEcefActual, zEcefExpected); + }); }); } From bdf36af47db7adfcf18c405a2dc492686b0f4f26 Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Thu, 27 Jul 2023 19:44:39 +1000 Subject: [PATCH 07/13] Factor out rotator comparisons to a helper. --- .../Private/CesiumGeoreference.cpp | 2 +- .../Private/Tests/CesiumGeoreference.spec.cpp | 40 ++++--------------- .../Private/Tests/CesiumTestHelpers.cpp | 32 +++++++++++++++ .../Private/Tests/CesiumTestHelpers.h | 17 +++++++- 4 files changed, 56 insertions(+), 35 deletions(-) diff --git a/Source/CesiumRuntime/Private/CesiumGeoreference.cpp b/Source/CesiumRuntime/Private/CesiumGeoreference.cpp index d3dc6bb42..2da7e5d45 100644 --- a/Source/CesiumRuntime/Private/CesiumGeoreference.cpp +++ b/Source/CesiumRuntime/Private/CesiumGeoreference.cpp @@ -780,7 +780,7 @@ FRotator ACesiumGeoreference::TransformUnrealRotatorToEastSouthUp( const FVector& UnrealLocation) const { FMatrix unrealToEsu = this->ComputeEastSouthUpToUnrealTransformation(UnrealLocation).Inverse(); - return FRotator(unrealToEsu.ToQuat() * EastSouthUpRotator.Quaternion()); + return FRotator(unrealToEsu.ToQuat() * UnrealRotator.Quaternion()); } FRotator ACesiumGeoreference::TransformEastSouthUpRotatorToUnreal( diff --git a/Source/CesiumRuntime/Private/Tests/CesiumGeoreference.spec.cpp b/Source/CesiumRuntime/Private/Tests/CesiumGeoreference.spec.cpp index 0331e4fbb..4042d7da3 100644 --- a/Source/CesiumRuntime/Private/Tests/CesiumGeoreference.spec.cpp +++ b/Source/CesiumRuntime/Private/Tests/CesiumGeoreference.spec.cpp @@ -180,44 +180,18 @@ void FCesiumGeoreferenceSpec::Define() { pGeoreferenceNullIsland ->TransformLongitudeLatitudeHeightPositionToUnreal( FVector(90.0, 0.0, 0.0)); + FRotator rotationAtNullIsland = pGeoreferenceNullIsland->TransformEastSouthUpRotatorToUnreal( rotationAt90DegreesLongitude, originOf90DegreesLongitudeInNullIslandCoordinates); - // Verify the rotation by checking the directions of the three axes. - FVector xEcefExpected = - pGeoreference90Longitude - ->TransformUnrealDirectionToEarthCenteredEarthFixed( - rotationAt90DegreesLongitude.RotateVector( - FVector::XAxisVector)); - FVector yEcefExpected = - pGeoreference90Longitude - ->TransformUnrealDirectionToEarthCenteredEarthFixed( - rotationAt90DegreesLongitude.RotateVector( - FVector::YAxisVector)); - FVector zEcefExpected = - pGeoreference90Longitude - ->TransformUnrealDirectionToEarthCenteredEarthFixed( - rotationAt90DegreesLongitude.RotateVector( - FVector::ZAxisVector)); - - FVector xEcefActual = - pGeoreferenceNullIsland - ->TransformUnrealDirectionToEarthCenteredEarthFixed( - rotationAtNullIsland.RotateVector(FVector::XAxisVector)); - FVector yEcefActual = - pGeoreferenceNullIsland - ->TransformUnrealDirectionToEarthCenteredEarthFixed( - rotationAtNullIsland.RotateVector(FVector::YAxisVector)); - FVector zEcefActual = - pGeoreferenceNullIsland - ->TransformUnrealDirectionToEarthCenteredEarthFixed( - rotationAtNullIsland.RotateVector(FVector::ZAxisVector)); - - TestEqual("xEcefActual", xEcefActual, xEcefExpected); - TestEqual("yEcefActual", yEcefActual, yEcefExpected); - TestEqual("zEcefActual", zEcefActual, zEcefExpected); + CesiumTestHelpers::TestRotatorsAreEquivalent( + this, + pGeoreference90Longitude, + rotationAt90DegreesLongitude, + pGeoreferenceNullIsland, + rotationAtNullIsland); }); }); } diff --git a/Source/CesiumRuntime/Private/Tests/CesiumTestHelpers.cpp b/Source/CesiumRuntime/Private/Tests/CesiumTestHelpers.cpp index 59bfc64f5..100f4bd1c 100644 --- a/Source/CesiumRuntime/Private/Tests/CesiumTestHelpers.cpp +++ b/Source/CesiumRuntime/Private/Tests/CesiumTestHelpers.cpp @@ -1,6 +1,7 @@ // Copyright 2020-2023 CesiumGS, Inc. and Contributors #include "CesiumTestHelpers.h" +#include "CesiumGeoreference.h" #include "Engine/Engine.h" namespace CesiumTestHelpers { @@ -12,6 +13,37 @@ UWorld* getGlobalWorldContext() { return firstWorldContext.World(); } +void TestRotatorsAreEquivalent( + FAutomationTestBase* pSpec, + ACesiumGeoreference* pGeoreferenceExpected, + const FRotator& rotatorExpected, + ACesiumGeoreference* pGeoreferenceActual, + const FRotator& rotatorActual) { + FVector xEcefExpected = + pGeoreferenceExpected->TransformUnrealDirectionToEarthCenteredEarthFixed( + rotatorExpected.RotateVector(FVector::XAxisVector)); + FVector yEcefExpected = + pGeoreferenceExpected->TransformUnrealDirectionToEarthCenteredEarthFixed( + rotatorExpected.RotateVector(FVector::YAxisVector)); + FVector zEcefExpected = + pGeoreferenceExpected->TransformUnrealDirectionToEarthCenteredEarthFixed( + rotatorExpected.RotateVector(FVector::ZAxisVector)); + + FVector xEcefActual = + pGeoreferenceActual->TransformUnrealDirectionToEarthCenteredEarthFixed( + rotatorActual.RotateVector(FVector::XAxisVector)); + FVector yEcefActual = + pGeoreferenceActual->TransformUnrealDirectionToEarthCenteredEarthFixed( + rotatorActual.RotateVector(FVector::YAxisVector)); + FVector zEcefActual = + pGeoreferenceActual->TransformUnrealDirectionToEarthCenteredEarthFixed( + rotatorActual.RotateVector(FVector::ZAxisVector)); + + pSpec->TestEqual("xEcefActual", xEcefActual, xEcefExpected); + pSpec->TestEqual("yEcefActual", yEcefActual, yEcefExpected); + pSpec->TestEqual("zEcefActual", zEcefActual, zEcefExpected); +} + FName getUniqueTag(AActor* pActor) { return FName(FString::Printf(TEXT("%lld"), pActor)); } diff --git a/Source/CesiumRuntime/Private/Tests/CesiumTestHelpers.h b/Source/CesiumRuntime/Private/Tests/CesiumTestHelpers.h index ebbc79b0b..988d55182 100644 --- a/Source/CesiumRuntime/Private/Tests/CesiumTestHelpers.h +++ b/Source/CesiumRuntime/Private/Tests/CesiumTestHelpers.h @@ -4,6 +4,7 @@ #include "EngineUtils.h" #include "Kismet/GameplayStatics.h" +#include "Math/MathFwd.h" #include "Misc/AutomationTest.h" #include "TimerManager.h" @@ -12,10 +13,24 @@ #endif class UWorld; +class ACesiumGeoreference; namespace CesiumTestHelpers { -static UWorld* getGlobalWorldContext(); +UWorld* getGlobalWorldContext(); + +/// +/// Verify that two rotations (expressed relative to two different +/// georeferences) are equivalent by using them to rotate the principal axis +/// vectors and then transforming those vectors to ECEF. The ECEF vectors should +/// be the same in both cases. +/// +void TestRotatorsAreEquivalent( + FAutomationTestBase* pSpec, + ACesiumGeoreference* pGeoreferenceExpected, + const FRotator& rotatorExpected, + ACesiumGeoreference* pGeoreferenceActual, + const FRotator& rotatorActual); template void waitForImpl( From 4a16c77f3250effdfbf63c1b5846e760479d8fcb Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Thu, 27 Jul 2023 21:21:29 +1000 Subject: [PATCH 08/13] Add a test for opposite rotator transformation direction. --- .../Private/Tests/CesiumGeoreference.spec.cpp | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Source/CesiumRuntime/Private/Tests/CesiumGeoreference.spec.cpp b/Source/CesiumRuntime/Private/Tests/CesiumGeoreference.spec.cpp index 4042d7da3..571a69fb0 100644 --- a/Source/CesiumRuntime/Private/Tests/CesiumGeoreference.spec.cpp +++ b/Source/CesiumRuntime/Private/Tests/CesiumGeoreference.spec.cpp @@ -174,7 +174,7 @@ void FCesiumGeoreferenceSpec::Define() { TestEqual("atOrigin2", atOrigin2, FRotator(1.0, 2.0, 3.0)); }); - It("transforms Unreal Rotators to East-South-Up", [this]() { + It("transforms East-South-Up Rotators to Unreal", [this]() { FRotator rotationAt90DegreesLongitude = FRotator(1.0, 2.0, 3.0); FVector originOf90DegreesLongitudeInNullIslandCoordinates = pGeoreferenceNullIsland @@ -193,5 +193,25 @@ void FCesiumGeoreferenceSpec::Define() { pGeoreferenceNullIsland, rotationAtNullIsland); }); + + It("transforms Unreal Rotators to East-South-Up", [this]() { + FRotator rotationAtNullIsland = FRotator(1.0, 2.0, 3.0); + FVector originOf90DegreesLongitudeInNullIslandCoordinates = + pGeoreferenceNullIsland + ->TransformLongitudeLatitudeHeightPositionToUnreal( + FVector(90.0, 0.0, 0.0)); + + FRotator rotationAt90DegreesLongitude = + pGeoreferenceNullIsland->TransformUnrealRotatorToEastSouthUp( + rotationAtNullIsland, + originOf90DegreesLongitudeInNullIslandCoordinates); + + CesiumTestHelpers::TestRotatorsAreEquivalent( + this, + pGeoreferenceNullIsland, + rotationAtNullIsland, + pGeoreference90Longitude, + rotationAt90DegreesLongitude); + }); }); } From 5d7e0365794bd3bc32b95aba96352b3c3963e84e Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Fri, 28 Jul 2023 14:52:15 +1000 Subject: [PATCH 09/13] Make CesiumGeoreference cpp order order match header order. --- CHANGES.md | 2 +- Source/CesiumRuntime/Private/CesiumActors.h | 7 + .../Private/CesiumGeoreference.cpp | 791 +++++++++--------- .../CesiumRuntime/Public/CesiumGeoreference.h | 113 +-- 4 files changed, 448 insertions(+), 465 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 761c48369..d399376fb 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -8,7 +8,7 @@ - `CesiumSunSky` now uses a default `TransmittanceMinLightElevationAngle` value on its `SkyAtmosphere` component of 90.0 degrees instead of -90.0 degrees. This will generally improve lighting when far from the CesiumGeoreference origin, but it is a breaking change because it may change the lighting conditions in existing levels, particularly at sunrise and sunset. - The `Mobility` property on `ACesium3DTileset` is now obsolete. Instead, use the normal mechanism of setting the root component's mobility. - Removed many methods that from the C++ interface of `ACesiumGeoreference` that used `glm` vector types. Use the versions that work with Unreal types instead. -- The `ComputeEastSouthUpToUnreal` function on `ACesiumGeoreference` now returns a matrix that includes the translation component of the transformation. Previously it only included the rotation component. +- The `ComputeEastSouthUpToUnreal` function on `ACesiumGeoreference` has been renamed to `ComputeEastSouthUpToUnrealTransformation` and now returns a matrix that includes the translation component of the transformation. Previously it only included the rotation component. ##### Additions :tada: diff --git a/Source/CesiumRuntime/Private/CesiumActors.h b/Source/CesiumRuntime/Private/CesiumActors.h index c9fa2fb63..23ff60f45 100644 --- a/Source/CesiumRuntime/Private/CesiumActors.h +++ b/Source/CesiumRuntime/Private/CesiumActors.h @@ -5,6 +5,13 @@ #include "GameFramework/Actor.h" #include +#define CESIUM_POST_EDIT_CHANGE(changedPropertyName, ClassName, PropertyName) \ + if (changedPropertyName == \ + GET_MEMBER_NAME_CHECKED(ClassName, PropertyName)) { \ + this->Set##PropertyName(this->PropertyName); \ + return; \ + } + /** * @brief Utility functions related to Unreal actors */ diff --git a/Source/CesiumRuntime/Private/CesiumGeoreference.cpp b/Source/CesiumRuntime/Private/CesiumGeoreference.cpp index 2da7e5d45..a986d00cb 100644 --- a/Source/CesiumRuntime/Private/CesiumGeoreference.cpp +++ b/Source/CesiumRuntime/Private/CesiumGeoreference.cpp @@ -36,17 +36,8 @@ #include "Editor.h" #include "EditorViewportClient.h" #include "Slate/SceneViewport.h" -#include "WorldBrowserModule.h" - -// These are in the Private directory, yet they are exported, so we're able to -// use them. And there's no other way (AFAIK) to get details of unloaded levels. -#include "../Private/LevelCollectionModel.h" -#include "../Private/LevelModel.h" #endif -FName ACesiumGeoreference::DEFAULT_GEOREFERENCE_TAG = - FName("DEFAULT_GEOREFERENCE"); - /*static*/ ACesiumGeoreference* ACesiumGeoreference::GetDefaultGeoreference(const UObject* WorldContextObject) { UWorld* world = WorldContextObject->GetWorld(); @@ -122,22 +113,182 @@ ACesiumGeoreference::GetDefaultGeoreference(const UObject* WorldContextObject) { return pGeoreference; } -ACesiumGeoreference::ACesiumGeoreference() : AActor(), _geoTransforms() { - PrimaryActorTick.bCanEverTick = true; +FVector ACesiumGeoreference::GetOriginLongitudeLatitudeHeight() const { + return FVector(OriginLongitude, OriginLatitude, OriginHeight); +} - this->Root = CreateDefaultSubobject(TEXT("Root")); - this->RootComponent = this->Root; +void ACesiumGeoreference::SetOriginLongitudeLatitudeHeight( + const FVector& targetLongitudeLatitudeHeight) { + this->_setGeoreferenceOrigin( + targetLongitudeLatitudeHeight.X, + targetLongitudeLatitudeHeight.Y, + targetLongitudeLatitudeHeight.Z); +} -#if WITH_EDITOR - this->SetIsSpatiallyLoaded(false); -#endif - this->SubLevelSwitcher = - CreateDefaultSubobject( - "SubLevelSwitcher"); +FVector ACesiumGeoreference::GetOriginEarthCenteredEarthFixed() const { + return UCesiumWgs84Ellipsoid:: + LongitudeLatitudeHeightToEarthCenteredEarthFixed( + this->GetOriginLongitudeLatitudeHeight()); } -#if WITH_EDITOR +void ACesiumGeoreference::SetOriginEarthCenteredEarthFixed( + const FVector& TargetEarthCenteredEarthFixed) { + this->SetOriginLongitudeLatitudeHeight( + UCesiumWgs84Ellipsoid::EarthCenteredEarthFixedToLongitudeLatitudeHeight( + TargetEarthCenteredEarthFixed)); +} + +EOriginPlacement ACesiumGeoreference::GetOriginPlacement() const { + return this->OriginPlacement; +} + +void ACesiumGeoreference::SetOriginPlacement(EOriginPlacement NewValue) { + this->OriginPlacement = NewValue; + this->UpdateGeoreference(); +} + +double ACesiumGeoreference::GetOriginLatitude() const { + return this->OriginLatitude; +} + +void ACesiumGeoreference::SetOriginLatitude(double NewValue) { + this->OriginLatitude = NewValue; + this->UpdateGeoreference(); +} + +double ACesiumGeoreference::GetOriginLongitude() const { + return this->OriginLongitude; +} + +void ACesiumGeoreference::SetOriginLongitude(double NewValue) { + this->OriginLongitude = NewValue; + this->UpdateGeoreference(); +} + +double ACesiumGeoreference::GetOriginHeight() const { + return this->OriginHeight; +} + +void ACesiumGeoreference::SetOriginHeight(double NewValue) { + this->OriginHeight = NewValue; + this->UpdateGeoreference(); +} + +double ACesiumGeoreference::GetScale() const { return this->Scale; } + +void ACesiumGeoreference::SetScale(double NewValue) { + if (NewValue < 1e-6) { + this->Scale = 1e-6; + } else { + this->Scale = NewValue; + } + this->UpdateGeoreference(); +} + +APlayerCameraManager* ACesiumGeoreference::GetSubLevelCamera() const { + return this->SubLevelCamera; +} + +void ACesiumGeoreference::SetSubLevelCamera(APlayerCameraManager* NewValue) { + this->SubLevelCamera = NewValue; +} + +bool ACesiumGeoreference::GetShowLoadRadii() const { + return this->ShowLoadRadii; +} + +void ACesiumGeoreference::SetShowLoadRadii(bool NewValue) { + this->ShowLoadRadii = NewValue; +} + +FVector ACesiumGeoreference::TransformLongitudeLatitudeHeightPositionToUnreal( + const FVector& LongitudeLatitudeHeight) const { + glm::dvec3 ue = this->_geoTransforms.TransformLongitudeLatitudeHeightToUnreal( + glm::dvec3(CesiumActors::getWorldOrigin4D(this)), + VecMath::createVector3D(LongitudeLatitudeHeight)); + return FVector(ue.x, ue.y, ue.z); +} + +FVector ACesiumGeoreference::TransformUnrealPositionToLongitudeLatitudeHeight( + const FVector& UnrealPosition) const { + glm::dvec3 llh = + this->_geoTransforms.TransformUnrealToLongitudeLatitudeHeight( + glm::dvec3(CesiumActors::getWorldOrigin4D(this)), + VecMath::createVector3D(UnrealPosition)); + return FVector(llh.x, llh.y, llh.z); +} + +FVector ACesiumGeoreference::TransformEarthCenteredEarthFixedPositionToUnreal( + const FVector& EarthCenteredEarthFixedPosition) const { + glm::dvec3 ue = this->_geoTransforms.TransformEcefToUnreal( + glm::dvec3(CesiumActors::getWorldOrigin4D(this)), + VecMath::createVector3D(EarthCenteredEarthFixedPosition)); + return FVector(ue.x, ue.y, ue.z); +} + +FVector ACesiumGeoreference::TransformUnrealPositionToEarthCenteredEarthFixed( + const FVector& UnrealPosition) const { + glm::dvec3 ecef = this->_geoTransforms.TransformUnrealToEcef( + glm::dvec3(CesiumActors::getWorldOrigin4D(this)), + glm::dvec3(UnrealPosition.X, UnrealPosition.Y, UnrealPosition.Z)); + return FVector(ecef.x, ecef.y, ecef.z); +} + +FVector ACesiumGeoreference::TransformEarthCenteredEarthFixedDirectionToUnreal( + const FVector& EarthCenteredEarthFixedDirection) const { + return this->_geoTransforms.GetEllipsoidCenteredToAbsoluteUnrealWorldMatrix() + .TransformVector(EarthCenteredEarthFixedDirection); +} + +FVector ACesiumGeoreference::TransformUnrealDirectionToEarthCenteredEarthFixed( + const FVector& UnrealDirection) const { + return this->_geoTransforms.GetAbsoluteUnrealWorldToEllipsoidCenteredMatrix() + .TransformVector(UnrealDirection); +} + +FRotator ACesiumGeoreference::TransformUnrealRotatorToEastSouthUp( + const FRotator& UnrealRotator, + const FVector& UnrealLocation) const { + FMatrix unrealToEsu = + this->ComputeEastSouthUpToUnrealTransformation(UnrealLocation).Inverse(); + return FRotator(unrealToEsu.ToQuat() * UnrealRotator.Quaternion()); +} + +FRotator ACesiumGeoreference::TransformEastSouthUpRotatorToUnreal( + const FRotator& EastSouthUpRotator, + const FVector& UnrealLocation) const { + FMatrix esuToUnreal = + this->ComputeEastSouthUpToUnrealTransformation(UnrealLocation); + return FRotator(esuToUnreal.ToQuat() * EastSouthUpRotator.Quaternion()); +} + +const FMatrix& +ACesiumGeoreference::ComputeUnrealToEarthCenteredEarthFixedTransformation() + const { + return this->_geoTransforms.GetAbsoluteUnrealWorldToEllipsoidCenteredMatrix(); +} + +const FMatrix& +ACesiumGeoreference::ComputeEarthCenteredEarthFixedToUnrealTransformation() + const { + return this->_geoTransforms.GetEllipsoidCenteredToAbsoluteUnrealWorldMatrix(); +} + +FMatrix ACesiumGeoreference::ComputeEastSouthUpToUnrealTransformation( + const FVector& UnrealLocation) const { + glm::dmat4 esuToUe = this->_geoTransforms.ComputeEastSouthUpToUnreal( + glm::dvec3(CesiumActors::getWorldOrigin4D(this)), + glm::dvec3(UnrealLocation.X, UnrealLocation.Y, UnrealLocation.Z)); + return VecMath::createMatrix(esuToUe); +} + +FMatrix ACesiumGeoreference::ComputeUnrealToEastSouthUpTransformation( + const FVector& UnrealLocation) const { + return this->ComputeEastSouthUpToUnrealTransformation(UnrealLocation) + .Inverse(); +} +#if WITH_EDITOR void ACesiumGeoreference::PlaceGeoreferenceOriginHere() { // If this is PIE mode, ignore UWorld* pWorld = this->GetWorld(); @@ -213,52 +364,190 @@ void ACesiumGeoreference::PlaceGeoreferenceOriginHere() { FVector(-originLocation.X, -originLocation.Y, -originLocation.Z)); } -#endif +void ACesiumGeoreference::_showSubLevelLoadRadii() const { + UWorld* world = this->GetWorld(); + if (world->IsGameWorld()) { + return; + } + if (!this->ShowLoadRadii) { + return; + } + const glm::dvec4 originLocation = + glm::dvec4(VecMath::createVector3D(world->OriginLocation), 1.0); + for (const auto& pLevelWeak : + this->SubLevelSwitcher->GetRegisteredSubLevels()) { + ALevelInstance* pLevel = pLevelWeak.Get(); + if (!IsValid(pLevel)) + continue; -namespace { + UCesiumSubLevelComponent* pComponent = + pLevel->FindComponentByClass(); -template -FString longPackageNameToCesiumName(UWorld* pWorld, const TStringish& name) { - FString levelName = FPackageName::GetShortName(name); - levelName.RemoveFromStart(pWorld->StreamingLevelsPrefix); - return levelName; -} + glm::dvec3 levelECEF = + _geoTransforms.TransformLongitudeLatitudeHeightToEcef(glm::dvec3( + pComponent->GetOriginLongitude(), + pComponent->GetOriginLatitude(), + pComponent->GetOriginHeight())); -} // namespace + FVector center = + this->TransformLongitudeLatitudeHeightPositionToUnreal(FVector( + pComponent->GetOriginLongitude(), + pComponent->GetOriginLatitude(), + pComponent->GetOriginHeight())); + center = GetActorTransform().TransformPosition(center); -#if WITH_EDITOR -PRAGMA_DISABLE_DEPRECATION_WARNINGS -void ACesiumGeoreference::_createSubLevelsFromWorldComposition() { - UWorld* pWorld = this->GetWorld(); - if (!IsValid(pWorld)) { - // This happens for the georeference that is shown in the - // content browser. Might omit this message. - UE_LOG( - LogCesium, - Verbose, - TEXT( - "Georeference is not spawned in world: %s, skipping _updateCesiumSubLevels"), - *this->GetFullName()); - return; + DrawDebugSphere( + world, + center, + 100.0 * pComponent->GetLoadRadius() * GetActorScale3D().GetMax(), + 100, + FColor::Blue); } +} +#endif // WITH_EDITOR - if (this->CesiumSubLevels_DEPRECATED.IsEmpty() || - !this->_shouldManageSubLevels()) - return; +bool ACesiumGeoreference::ShouldTickIfViewportsOnly() const { return true; } - this->Modify(); +void ACesiumGeoreference::Tick(float DeltaTime) { + Super::Tick(DeltaTime); - // Convert old-style sub-levels (using World Composition) to new style - // sub-levels (level instances) - UWorldComposition::FTilesList& allLevels = - pWorld->WorldComposition->GetTilesList(); +#if WITH_EDITOR + _showSubLevelLoadRadii(); +#endif - ALevelInstance* pActiveSubLevel = nullptr; + if (this->_shouldManageSubLevels()) { + _updateSublevelState(); + } +} - for (const FWorldCompositionTile& level : allLevels) { - FString levelName = longPackageNameToCesiumName(pWorld, level.PackageName); +void ACesiumGeoreference::Serialize(FArchive& Ar) { + Super::Serialize(Ar); - // Check if the level is already known + // Recompute derived values on load. + if (Ar.IsLoading()) { + this->_updateGeoTransforms(); + } +} + +void ACesiumGeoreference::BeginPlay() { + Super::BeginPlay(); + + PrimaryActorTick.TickGroup = TG_PrePhysics; + + UWorld* pWorld = this->GetWorld(); + if (!pWorld) { + UE_LOG( + LogCesium, + Warning, + TEXT("CesiumGeoreference does not have a World in BeginPlay.")); + return; + } + + if (!this->SubLevelCamera) { + // Find the first player's camera manager + APlayerController* pPlayerController = pWorld->GetFirstPlayerController(); + if (pPlayerController) { + this->SubLevelCamera = pPlayerController->PlayerCameraManager; + } + + if (!this->SubLevelCamera) { + UE_LOG( + LogCesium, + Warning, + TEXT( + "CesiumGeoreference could not find a FirstPlayerController or a corresponding PlayerCameraManager.")); + } + } + + UpdateGeoreference(); +} + +/** In case the CesiumGeoreference gets spawned at run time, instead of design + * time, ensure that frames are updated */ +void ACesiumGeoreference::OnConstruction(const FTransform& Transform) { + Super::OnConstruction(Transform); + + UE_LOG( + LogCesium, + Verbose, + TEXT("Called OnConstruction on actor %s"), + *this->GetName()); + + this->UpdateGeoreference(); +} + +void ACesiumGeoreference::PostLoad() { + Super::PostLoad(); + +#if WITH_EDITOR + if (GEditor && IsValid(this->GetWorld()) && + IsValid(this->GetWorld()->WorldComposition) && + !this->GetWorld()->IsGameWorld()) { + this->_createSubLevelsFromWorldComposition(); + } +#endif // WITH_EDITOR +} + +#if WITH_EDITOR +void ACesiumGeoreference::PostEditChangeProperty(FPropertyChangedEvent& event) { + Super::PostEditChangeProperty(event); + + if (!event.Property) { + return; + } + + FName propertyName = event.Property->GetFName(); + + CESIUM_POST_EDIT_CHANGE(propertyName, ACesiumGeoreference, OriginPlacement); + CESIUM_POST_EDIT_CHANGE(propertyName, ACesiumGeoreference, OriginLongitude); + CESIUM_POST_EDIT_CHANGE(propertyName, ACesiumGeoreference, OriginLatitude); + CESIUM_POST_EDIT_CHANGE(propertyName, ACesiumGeoreference, OriginHeight); + CESIUM_POST_EDIT_CHANGE(propertyName, ACesiumGeoreference, Scale); +} + +namespace { + +template +FString longPackageNameToCesiumName(UWorld* pWorld, const TStringish& name) { + FString levelName = FPackageName::GetShortName(name); + levelName.RemoveFromStart(pWorld->StreamingLevelsPrefix); + return levelName; +} + +} // namespace + +PRAGMA_DISABLE_DEPRECATION_WARNINGS +void ACesiumGeoreference::_createSubLevelsFromWorldComposition() { + UWorld* pWorld = this->GetWorld(); + if (!IsValid(pWorld)) { + // This happens for the georeference that is shown in the + // content browser. Might omit this message. + UE_LOG( + LogCesium, + Verbose, + TEXT( + "Georeference is not spawned in world: %s, skipping _updateCesiumSubLevels"), + *this->GetFullName()); + return; + } + + if (this->CesiumSubLevels_DEPRECATED.IsEmpty() || + !this->_shouldManageSubLevels()) + return; + + this->Modify(); + + // Convert old-style sub-levels (using World Composition) to new style + // sub-levels (level instances) + UWorldComposition::FTilesList& allLevels = + pWorld->WorldComposition->GetTilesList(); + + ALevelInstance* pActiveSubLevel = nullptr; + + for (const FWorldCompositionTile& level : allLevels) { + FString levelName = longPackageNameToCesiumName(pWorld, level.PackageName); + + // Check if the level is already known FCesiumSubLevel* pFound = this->CesiumSubLevels_DEPRECATED.FindByPredicate( [&levelName](FCesiumSubLevel& subLevel) { return levelName.Equals(subLevel.LevelName); @@ -334,160 +623,39 @@ void ACesiumGeoreference::_createSubLevelsFromWorldComposition() { "Cesium sub-levels based on World Composition have been converted to Level Instances. Save the level to keep these changes. We recommend disabling World Composition in the World Settings, as it is now obsolete.")); } PRAGMA_ENABLE_DEPRECATION_WARNINGS -#endif - -FVector ACesiumGeoreference::GetOriginLongitudeLatitudeHeight() const { - return FVector(OriginLongitude, OriginLatitude, OriginHeight); -} - -void ACesiumGeoreference::SetOriginLongitudeLatitudeHeight( - const FVector& targetLongitudeLatitudeHeight) { - this->_setGeoreferenceOrigin( - targetLongitudeLatitudeHeight.X, - targetLongitudeLatitudeHeight.Y, - targetLongitudeLatitudeHeight.Z); -} - -void ACesiumGeoreference::SetOriginEarthCenteredEarthFixed( - const FVector& TargetEarthCenteredEarthFixed) { - this->SetOriginLongitudeLatitudeHeight(VecMath::createVector( - _geoTransforms.TransformEcefToLongitudeLatitudeHeight( - VecMath::createVector3D(TargetEarthCenteredEarthFixed)))); -} - -EOriginPlacement ACesiumGeoreference::GetOriginPlacement() const { - return this->OriginPlacement; -} - -void ACesiumGeoreference::SetOriginPlacement(EOriginPlacement NewValue) { - this->OriginPlacement = NewValue; - this->UpdateGeoreference(); -} - -double ACesiumGeoreference::GetOriginLatitude() const { - return this->OriginLatitude; -} - -void ACesiumGeoreference::SetOriginLatitude(double NewValue) { - this->OriginLatitude = NewValue; - this->UpdateGeoreference(); -} - -double ACesiumGeoreference::GetOriginLongitude() const { - return this->OriginLongitude; -} - -void ACesiumGeoreference::SetOriginLongitude(double NewValue) { - this->OriginLongitude = NewValue; - this->UpdateGeoreference(); -} - -double ACesiumGeoreference::GetOriginHeight() const { - return this->OriginHeight; -} - -void ACesiumGeoreference::SetOriginHeight(double NewValue) { - this->OriginHeight = NewValue; - this->UpdateGeoreference(); -} - -double ACesiumGeoreference::GetScale() const { return this->Scale; } - -void ACesiumGeoreference::SetScale(double NewValue) { - if (NewValue < 1e-6) { - this->Scale = 1e-6; - } else { - this->Scale = NewValue; - } - this->UpdateGeoreference(); -} - -APlayerCameraManager* ACesiumGeoreference::GetSubLevelCamera() const { - return this->SubLevelCamera; -} - -void ACesiumGeoreference::SetSubLevelCamera(APlayerCameraManager* NewValue) { - this->SubLevelCamera = NewValue; -} - -bool ACesiumGeoreference::GetShowLoadRadii() const { - return this->ShowLoadRadii; -} - -void ACesiumGeoreference::SetShowLoadRadii(bool NewValue) { - this->ShowLoadRadii = NewValue; -} - -const FMatrix& -ACesiumGeoreference::GetUnrealToEarthCenteredEarthFixedTransformation() const { - return this->_geoTransforms.GetAbsoluteUnrealWorldToEllipsoidCenteredMatrix(); -} +#endif // WITH_EDITOR -const FMatrix& -ACesiumGeoreference::GetEarthCenteredEarthFixedToUnrealTransformation() const { - return this->_geoTransforms.GetEllipsoidCenteredToAbsoluteUnrealWorldMatrix(); +FVector ACesiumGeoreference::TransformLongitudeLatitudeHeightToEcef( + const FVector& longitudeLatitudeHeight) const { + return UCesiumWgs84Ellipsoid:: + LongitudeLatitudeHeightToEarthCenteredEarthFixed(longitudeLatitudeHeight); } -// Called when the game starts or when spawned -void ACesiumGeoreference::BeginPlay() { - Super::BeginPlay(); - - PrimaryActorTick.TickGroup = TG_PrePhysics; - - UWorld* pWorld = this->GetWorld(); - if (!pWorld) { - UE_LOG( - LogCesium, - Warning, - TEXT("CesiumGeoreference does not have a World in BeginPlay.")); - return; - } - - if (!this->SubLevelCamera) { - // Find the first player's camera manager - APlayerController* pPlayerController = pWorld->GetFirstPlayerController(); - if (pPlayerController) { - this->SubLevelCamera = pPlayerController->PlayerCameraManager; - } - - if (!this->SubLevelCamera) { - UE_LOG( - LogCesium, - Warning, - TEXT( - "CesiumGeoreference could not find a FirstPlayerController or a corresponding PlayerCameraManager.")); - } - } - - UpdateGeoreference(); +FVector ACesiumGeoreference::TransformEcefToLongitudeLatitudeHeight( + const FVector& ecef) const { + return UCesiumWgs84Ellipsoid:: + EarthCenteredEarthFixedToLongitudeLatitudeHeight(ecef); } -/** In case the CesiumGeoreference gets spawned at run time, instead of design - * time, ensure that frames are updated */ -void ACesiumGeoreference::OnConstruction(const FTransform& Transform) { - Super::OnConstruction(Transform); - - UE_LOG( - LogCesium, - Verbose, - TEXT("Called OnConstruction on actor %s"), - *this->GetName()); - - this->UpdateGeoreference(); +FMatrix +ACesiumGeoreference::ComputeEastNorthUpToEcef(const FVector& ecef) const { + glm::dmat3 enuToEcef = this->_geoTransforms.ComputeEastNorthUpToEcef( + glm::dvec3(ecef.X, ecef.Y, ecef.Z)); + return VecMath::createMatrix(enuToEcef); } -void ACesiumGeoreference::BeginDestroy() { Super::BeginDestroy(); } +ACesiumGeoreference::ACesiumGeoreference() : AActor(), _geoTransforms() { + PrimaryActorTick.bCanEverTick = true; -void ACesiumGeoreference::PostLoad() { - Super::PostLoad(); + this->Root = CreateDefaultSubobject(TEXT("Root")); + this->RootComponent = this->Root; #if WITH_EDITOR - if (GEditor && IsValid(this->GetWorld()) && - IsValid(this->GetWorld()->WorldComposition) && - !this->GetWorld()->IsGameWorld()) { - this->_createSubLevelsFromWorldComposition(); - } + this->SetIsSpatiallyLoaded(false); #endif + this->SubLevelSwitcher = + CreateDefaultSubobject( + "SubLevelSwitcher"); } void ACesiumGeoreference::UpdateGeoreference() { @@ -519,98 +687,19 @@ void ACesiumGeoreference::UpdateGeoreference() { OnGeoreferenceUpdated.Broadcast(); } -#if WITH_EDITOR -void ACesiumGeoreference::PostEditChangeProperty(FPropertyChangedEvent& event) { - Super::PostEditChangeProperty(event); - - if (!event.Property) { - return; - } - - FName propertyName = event.Property->GetFName(); - - if (propertyName == - GET_MEMBER_NAME_CHECKED(ACesiumGeoreference, OriginPlacement) || - propertyName == - GET_MEMBER_NAME_CHECKED(ACesiumGeoreference, OriginLongitude) || - propertyName == - GET_MEMBER_NAME_CHECKED(ACesiumGeoreference, OriginLatitude) || - propertyName == - GET_MEMBER_NAME_CHECKED(ACesiumGeoreference, OriginHeight)) { - this->UpdateGeoreference(); - return; - } else if ( - propertyName == GET_MEMBER_NAME_CHECKED(ACesiumGeoreference, Scale)) { - this->SetScale(Scale); - } -} -#endif - -bool ACesiumGeoreference::ShouldTickIfViewportsOnly() const { return true; } - -#if WITH_EDITOR -void ACesiumGeoreference::_showSubLevelLoadRadii() const { - UWorld* world = this->GetWorld(); - if (world->IsGameWorld()) { - return; - } - if (!this->ShowLoadRadii) { - return; - } - const glm::dvec4 originLocation = - glm::dvec4(VecMath::createVector3D(world->OriginLocation), 1.0); - for (const auto& pLevelWeak : - this->SubLevelSwitcher->GetRegisteredSubLevels()) { - ALevelInstance* pLevel = pLevelWeak.Get(); - if (!IsValid(pLevel)) - continue; - - UCesiumSubLevelComponent* pComponent = - pLevel->FindComponentByClass(); - - glm::dvec3 levelECEF = - _geoTransforms.TransformLongitudeLatitudeHeightToEcef(glm::dvec3( - pComponent->GetOriginLongitude(), - pComponent->GetOriginLatitude(), - pComponent->GetOriginHeight())); - - FVector center = - this->TransformLongitudeLatitudeHeightPositionToUnreal(FVector( - pComponent->GetOriginLongitude(), - pComponent->GetOriginLatitude(), - pComponent->GetOriginHeight())); - center = GetActorTransform().TransformPosition(center); +FName ACesiumGeoreference::DEFAULT_GEOREFERENCE_TAG = + FName("DEFAULT_GEOREFERENCE"); - DrawDebugSphere( - world, - center, - 100.0 * pComponent->GetLoadRadius() * GetActorScale3D().GetMax(), - 100, - FColor::Blue); - } -} -#endif // WITH_EDITOR +void ACesiumGeoreference::_setGeoreferenceOrigin( + double targetLongitude, + double targetLatitude, + double targetHeight) { + this->OriginLongitude = targetLongitude; + this->OriginLatitude = targetLatitude; + this->OriginHeight = targetHeight; -namespace { -/** - * @brief Clamping addition. - * - * Returns the sum of the given values, clamping the result to - * the minimum/maximum value that can be represented as a 32 bit - * signed integer. - * - * @param f The floating point value - * @param i The integer value - * @return The clamped result - */ -int32 clampedAdd(double f, int32 i) { - int64 sum = static_cast(f) + static_cast(i); - int64 min = static_cast(TNumericLimits::Min()); - int64 max = static_cast(TNumericLimits::Max()); - int64 clamped = FMath::Max(min, FMath::Min(max, sum)); - return static_cast(clamped); + this->UpdateGeoreference(); } -} // namespace bool ACesiumGeoreference::_updateSublevelState() { const TArray>& sublevels = @@ -693,134 +782,6 @@ void ACesiumGeoreference::_updateGeoTransforms() { this->Scale / 100.0); } -void ACesiumGeoreference::Tick(float DeltaTime) { - Super::Tick(DeltaTime); - -#if WITH_EDITOR - _showSubLevelLoadRadii(); -#endif - - if (this->_shouldManageSubLevels()) { - _updateSublevelState(); - } -} - -void ACesiumGeoreference::Serialize(FArchive& Ar) { - Super::Serialize(Ar); - - // Recompute derived values on load. - if (Ar.IsLoading()) { - this->_updateGeoTransforms(); - } -} - -/** - * Useful Conversion Functions - */ - -FVector ACesiumGeoreference::TransformLongitudeLatitudeHeightToEcef( - const FVector& longitudeLatitudeHeight) const { - return UCesiumWgs84Ellipsoid:: - LongitudeLatitudeHeightToEarthCenteredEarthFixed(longitudeLatitudeHeight); -} - -FVector ACesiumGeoreference::TransformEcefToLongitudeLatitudeHeight( - const FVector& ecef) const { - return UCesiumWgs84Ellipsoid:: - EarthCenteredEarthFixedToLongitudeLatitudeHeight(ecef); -} - -FVector ACesiumGeoreference::TransformLongitudeLatitudeHeightPositionToUnreal( - const FVector& LongitudeLatitudeHeight) const { - glm::dvec3 ue = this->_geoTransforms.TransformLongitudeLatitudeHeightToUnreal( - glm::dvec3(CesiumActors::getWorldOrigin4D(this)), - VecMath::createVector3D(LongitudeLatitudeHeight)); - return FVector(ue.x, ue.y, ue.z); -} - -FVector ACesiumGeoreference::TransformUnrealPositionToLongitudeLatitudeHeight( - const FVector& UnrealPosition) const { - glm::dvec3 llh = - this->_geoTransforms.TransformUnrealToLongitudeLatitudeHeight( - glm::dvec3(CesiumActors::getWorldOrigin4D(this)), - VecMath::createVector3D(UnrealPosition)); - return FVector(llh.x, llh.y, llh.z); -} - -FVector ACesiumGeoreference::TransformEarthCenteredEarthFixedPositionToUnreal( - const FVector& EarthCenteredEarthFixedPosition) const { - glm::dvec3 ue = this->_geoTransforms.TransformEcefToUnreal( - glm::dvec3(CesiumActors::getWorldOrigin4D(this)), - VecMath::createVector3D(EarthCenteredEarthFixedPosition)); - return FVector(ue.x, ue.y, ue.z); -} - -FVector ACesiumGeoreference::TransformUnrealPositionToEarthCenteredEarthFixed( - const FVector& UnrealPosition) const { - glm::dvec3 ecef = this->_geoTransforms.TransformUnrealToEcef( - glm::dvec3(CesiumActors::getWorldOrigin4D(this)), - glm::dvec3(UnrealPosition.X, UnrealPosition.Y, UnrealPosition.Z)); - return FVector(ecef.x, ecef.y, ecef.z); -} - -FVector ACesiumGeoreference::TransformEarthCenteredEarthFixedDirectionToUnreal( - const FVector& EarthCenteredEarthFixedDirection) const { - return this->_geoTransforms.GetEllipsoidCenteredToAbsoluteUnrealWorldMatrix() - .TransformVector(EarthCenteredEarthFixedDirection); -} - -FVector ACesiumGeoreference::TransformUnrealDirectionToEarthCenteredEarthFixed( - const FVector& UnrealDirection) const { - return this->_geoTransforms.GetAbsoluteUnrealWorldToEllipsoidCenteredMatrix() - .TransformVector(UnrealDirection); -} - -FRotator ACesiumGeoreference::TransformUnrealRotatorToEastSouthUp( - const FRotator& UnrealRotator, - const FVector& UnrealLocation) const { - FMatrix unrealToEsu = - this->ComputeEastSouthUpToUnrealTransformation(UnrealLocation).Inverse(); - return FRotator(unrealToEsu.ToQuat() * UnrealRotator.Quaternion()); -} - -FRotator ACesiumGeoreference::TransformEastSouthUpRotatorToUnreal( - const FRotator& EastSouthUpRotator, - const FVector& UnrealLocation) const { - FMatrix esuToUnreal = - this->ComputeEastSouthUpToUnrealTransformation(UnrealLocation); - return FRotator(esuToUnreal.ToQuat() * EastSouthUpRotator.Quaternion()); -} - -FMatrix ACesiumGeoreference::ComputeEastSouthUpToUnrealTransformation( - const FVector& UnrealLocation) const { - glm::dmat4 esuToUe = this->_geoTransforms.ComputeEastSouthUpToUnreal( - glm::dvec3(CesiumActors::getWorldOrigin4D(this)), - glm::dvec3(UnrealLocation.X, UnrealLocation.Y, UnrealLocation.Z)); - return VecMath::createMatrix(esuToUe); -} - -FMatrix -ACesiumGeoreference::ComputeEastNorthUpToEcef(const FVector& ecef) const { - glm::dmat3 enuToEcef = this->_geoTransforms.ComputeEastNorthUpToEcef( - glm::dvec3(ecef.X, ecef.Y, ecef.Z)); - return VecMath::createMatrix(enuToEcef); -} - -/** - * Private Helper Functions - */ - -void ACesiumGeoreference::_setGeoreferenceOrigin( - double targetLongitude, - double targetLatitude, - double targetHeight) { - this->OriginLongitude = targetLongitude; - this->OriginLatitude = targetLatitude; - this->OriginHeight = targetHeight; - - this->UpdateGeoreference(); -} - bool ACesiumGeoreference::_shouldManageSubLevels() const { // Only a Georeference in the PersistentLevel should manage sub-levels. return this->GetLevel()->IsPersistentLevel(); diff --git a/Source/CesiumRuntime/Public/CesiumGeoreference.h b/Source/CesiumRuntime/Public/CesiumGeoreference.h index 7b71e3a79..6c2a67035 100644 --- a/Source/CesiumRuntime/Public/CesiumGeoreference.h +++ b/Source/CesiumRuntime/Public/CesiumGeoreference.h @@ -3,14 +3,11 @@ #pragma once #include "CesiumSubLevel.h" -#include "Components/ActorComponent.h" #include "Containers/UnrealString.h" #include "CoreMinimal.h" #include "GameFramework/Actor.h" #include "GeoTransforms.h" #include "OriginPlacement.h" -#include "UObject/WeakInterfacePtr.h" -#include #include "CesiumGeoreference.generated.h" class APlayerCameraManager; @@ -180,36 +177,6 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { bool ShowLoadRadii = true; #endif - /** - * The transformation matrix from the Unreal coordinate system to the - * Earth-Centered, Earth-Fixed (ECEF) coordinate system. The Unreal - * coordinates should generally not be interpreted as Unreal _world_ - * coordinates, but rather a coordinate system based on some parent Actor's - * reference frame as defined by its transform. This way, the chain of Unreal - * transforms places and orients the "globe" in the Unreal world. - */ - UPROPERTY( - BlueprintReadOnly, - BlueprintGetter = GetUnrealToEarthCenteredEarthFixedTransformation, - Category = "Cesium", - meta = (AllowPrivateAccess)) - FMatrix UnrealToEarthCenteredEarthFixedTransformation; - - /** - * The transformation matrix from the Earth-Centered, Earth-Fixed (ECEF) - * coordinate system to the Unreal coordinate system. The Unreal coordinates - * should generally not be interpreted as Unreal _world_ coordinates, but - * rather a coordinate system based on some parent Actor's reference frame as - * defined by its transform. This way, the chain of Unreal transforms places - * and orients the "globe" in the Unreal world. - */ - UPROPERTY( - BlueprintReadOnly, - BlueprintGetter = GetEarthCenteredEarthFixedToUnrealTransformation, - Category = "Cesium", - meta = (AllowPrivateAccess)) - FMatrix EarthCenteredEarthFixedToUnrealTransformation; - #pragma endregion #pragma region PropertyAccessors @@ -235,11 +202,23 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { void SetOriginLongitudeLatitudeHeight( const FVector& TargetLongitudeLatitudeHeight); + /** + * Returns the georeference origin position as an FVector in Earth-Centerd, + * Earth-Fixed (ECEF) coordinates. Only valid if the placement type is + * Cartographic Origin (i.e. Longitude / Latitude / Height). + */ + UFUNCTION(BlueprintPure, Category = "Cesium") + FVector GetOriginEarthCenteredEarthFixed() const; + /** * This aligns the specified Earth-Centered, Earth-Fixed (ECEF) coordinates to * the Unreal origin. That is, it moves the globe so that these coordinates * exactly fall on the origin. Only valid if the placement type is - * Cartographic Origin (i.e. Longitude / Latitude / Height). + * Cartographic Origin (i.e. Longitude / Latitude / Height). Note that if the + * provided ECEF coordiantes are near the center of the Earth so that + * Longitude, Latitude, and Height are undefined, this function will instead + * place the origin at 0 degrees longitude, 0 degrees latitude, and 0 meters + * height about the ellipsoid. */ UFUNCTION(BlueprintCallable, Category = "Cesium") void SetOriginEarthCenteredEarthFixed( @@ -297,12 +276,6 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { UFUNCTION(BlueprintSetter) void SetShowLoadRadii(bool NewValue); - UFUNCTION(BlueprintGetter) - const FMatrix& GetUnrealToEarthCenteredEarthFixedTransformation() const; - - UFUNCTION(BlueprintGetter) - const FMatrix& GetEarthCenteredEarthFixedToUnrealTransformation() const; - #pragma endregion #pragma region Transformation Functions @@ -447,6 +420,34 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { const FRotator& EastSouthUpRotator, const FVector& UnrealLocation) const; + /** + * Computes the transformation matrix from the Unreal coordinate system to the + * Earth-Centered, Earth-Fixed (ECEF) coordinate system. The Unreal + * coordinates should generally not be interpreted as Unreal _world_ + * coordinates, but rather a coordinate system based on some parent Actor's + * reference frame as defined by its transform. This way, the chain of Unreal + * transforms places and orients the "globe" in the Unreal world. + */ + UFUNCTION( + BlueprintPure, + Category = "Cesium", + meta = (ReturnDisplayName = "UnrealToEarthCenteredEarthFixedMatrix")) + const FMatrix& ComputeUnrealToEarthCenteredEarthFixedTransformation() const; + + /** + * Computes the transformation matrix from the Earth-Centered, Earth-Fixed + * (ECEF) coordinate system to the Unreal coordinate system. The Unreal + * coordinates should generally not be interpreted as Unreal _world_ + * coordinates, but rather a coordinate system based on some parent Actor's + * reference frame as defined by its transform. This way, the chain of Unreal + * transforms places and orients the "globe" in the Unreal world. + */ + UFUNCTION( + BlueprintPure, + Category = "Cesium", + meta = (ReturnDisplayName = "EarthCenteredEarthFixedToUnrealMatrix")) + const FMatrix& ComputeEarthCenteredEarthFixedToUnrealTransformation() const; + /** * Computes the matrix that transforms from an East-South-Up frame centered at * a given location to the Unreal frame. @@ -470,6 +471,29 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { FMatrix ComputeEastSouthUpToUnrealTransformation(const FVector& UnrealLocation) const; + /** + * Computes the matrix that transforms from the Unreal frame to an + * East-South-Up frame centered at a given location. + * + * In an East-South-Up frame, +X points East, +Y points South, and +Z points + * Up. However, the directions of "East", "South", and "Up" in Unreal or ECEF + * coordinates vary depending on where on the globe we are talking about. + * That is why this function takes a location, expressed in Unreal + * coordinates, that defines the origin of the East-South-Up frame of + * interest. + * + * The Unreal location and the resulting matrix should generally not be + * relative to the Unreal _world_, but rather be expressed in some parent + * Actor's reference frame as defined by its Transform. This way, the chain of + * Unreal transforms places and orients the "globe" in the Unreal world. + */ + UFUNCTION( + BlueprintPure, + Category = "Cesium", + meta = (ReturnDisplayName = "UnrealToEastSouthUpMatrix")) + FMatrix + ComputeUnrealToEastSouthUpTransformation(const FVector& UnrealLocation) const; + #pragma endregion #pragma region Editor Support @@ -517,7 +541,6 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { virtual void Serialize(FArchive& Ar) override; virtual void BeginPlay() override; virtual void OnConstruction(const FTransform& Transform) override; - virtual void BeginDestroy() override; virtual void PostLoad() override; #if WITH_EDITOR @@ -642,14 +665,6 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor { */ void _updateGeoTransforms(); - /** - * @brief Finds the ULevelStreaming with given name. - * - * @returns The ULevelStreaming, or nullptr if the provided name does not - * exist. - */ - ULevelStreaming* _findLevelStreamingByName(const FString& name); - /** * Determines if this Georeference should manage sub-level switching. * From 7d05b44cc775eb09277601b0faacc82c69e37e49 Mon Sep 17 00:00:00 2001 From: Kevin Ring Date: Fri, 28 Jul 2023 16:01:22 +1000 Subject: [PATCH 10/13] Add basic reference doc generation with Doxygen. --- .gitignore | 1 + Documentation/Doxyfile | 2816 +++++++++++++++++ .../CesiumRuntime/Public/CesiumGeoreference.h | 78 +- package.json | 6 +- 4 files changed, 2891 insertions(+), 10 deletions(-) create mode 100644 Documentation/Doxyfile diff --git a/.gitignore b/.gitignore index 85cfe3bbe..f1911b37f 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ ThirdParty/build Source/ThirdParty node_modules extern/build-helper.sh +Documentation/Reference diff --git a/Documentation/Doxyfile b/Documentation/Doxyfile new file mode 100644 index 000000000..c8440009d --- /dev/null +++ b/Documentation/Doxyfile @@ -0,0 +1,2816 @@ +# Doxyfile 1.9.7 + +# This file describes the settings to be used by the documentation system +# doxygen (www.doxygen.org) for a project. +# +# All text after a double hash (##) is considered a comment and is placed in +# front of the TAG it is preceding. +# +# All text after a single hash (#) is considered a comment and will be ignored. +# The format is: +# TAG = value [value, ...] +# For lists, items can also be appended using: +# TAG += value [value, ...] +# Values that contain spaces should be placed between quotes (\" \"). +# +# Note: +# +# Use doxygen to compare the used configuration file with the template +# configuration file: +# doxygen -x [configFile] +# Use doxygen to compare the used configuration file with the template +# configuration file without replacing the environment variables or CMake type +# replacement variables: +# doxygen -x_noenv [configFile] + +#--------------------------------------------------------------------------- +# Project related configuration options +#--------------------------------------------------------------------------- + +# This tag specifies the encoding used for all characters in the configuration +# file that follow. The default is UTF-8 which is also the encoding used for all +# text before the first occurrence of this tag. Doxygen uses libiconv (or the +# iconv built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. +# The default value is: UTF-8. + +DOXYFILE_ENCODING = UTF-8 + +# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by +# double-quotes, unless you are using Doxywizard) that should identify the +# project for which the documentation is generated. This name is used in the +# title of most generated pages and in a few other places. +# The default value is: My Project. + +PROJECT_NAME = "Cesium for Unreal" + +# The PROJECT_NUMBER tag can be used to enter a project or revision number. This +# could be handy for archiving the generated documentation or if some version +# control system is used. + +PROJECT_NUMBER = + +# Using the PROJECT_BRIEF tag one can provide an optional one line description +# for a project that appears at the top of each page and should give viewer a +# quick idea about the purpose of the project. Keep the description short. + +PROJECT_BRIEF = "Unlock the 3D geospatial ecosystem in Unreal Engine with real-world 3D content and a high accuracy full-scale WGS84 globe." + +# With the PROJECT_LOGO tag one can specify a logo or an icon that is included +# in the documentation. The maximum height of the logo should not exceed 55 +# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy +# the logo to the output directory. + +PROJECT_LOGO = ../Content/Cesium-128x128.png + +# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path +# into which the generated documentation will be written. If a relative path is +# entered, it will be relative to the location where doxygen was started. If +# left blank the current directory will be used. + +OUTPUT_DIRECTORY = ./Documentation/Reference + +# If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096 +# sub-directories (in 2 levels) under the output directory of each output format +# and will distribute the generated files over these directories. Enabling this +# option can be useful when feeding doxygen a huge amount of source files, where +# putting all generated files in the same directory would otherwise causes +# performance problems for the file system. Adapt CREATE_SUBDIRS_LEVEL to +# control the number of sub-directories. +# The default value is: NO. + +CREATE_SUBDIRS = NO + +# Controls the number of sub-directories that will be created when +# CREATE_SUBDIRS tag is set to YES. Level 0 represents 16 directories, and every +# level increment doubles the number of directories, resulting in 4096 +# directories at level 8 which is the default and also the maximum value. The +# sub-directories are organized in 2 levels, the first level always has a fixed +# number of 16 directories. +# Minimum value: 0, maximum value: 8, default value: 8. +# This tag requires that the tag CREATE_SUBDIRS is set to YES. + +CREATE_SUBDIRS_LEVEL = 8 + +# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII +# characters to appear in the names of generated files. If set to NO, non-ASCII +# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode +# U+3044. +# The default value is: NO. + +ALLOW_UNICODE_NAMES = NO + +# The OUTPUT_LANGUAGE tag is used to specify the language in which all +# documentation generated by doxygen is written. Doxygen will use this +# information to generate all constant output in the proper language. +# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Bulgarian, +# Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, Dutch, English +# (United States), Esperanto, Farsi (Persian), Finnish, French, German, Greek, +# Hindi, Hungarian, Indonesian, Italian, Japanese, Japanese-en (Japanese with +# English messages), Korean, Korean-en (Korean with English messages), Latvian, +# Lithuanian, Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, +# Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, +# Swedish, Turkish, Ukrainian and Vietnamese. +# The default value is: English. + +OUTPUT_LANGUAGE = English + +# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member +# descriptions after the members that are listed in the file and class +# documentation (similar to Javadoc). Set to NO to disable this. +# The default value is: YES. + +BRIEF_MEMBER_DESC = YES + +# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief +# description of a member or function before the detailed description +# +# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the +# brief descriptions will be completely suppressed. +# The default value is: YES. + +REPEAT_BRIEF = YES + +# This tag implements a quasi-intelligent brief description abbreviator that is +# used to form the text in various listings. Each string in this list, if found +# as the leading text of the brief description, will be stripped from the text +# and the result, after processing the whole list, is used as the annotated +# text. Otherwise, the brief description is used as-is. If left blank, the +# following values are used ($name is automatically replaced with the name of +# the entity):The $name class, The $name widget, The $name file, is, provides, +# specifies, contains, represents, a, an and the. + +ABBREVIATE_BRIEF = "The $name class" \ + "The $name widget" \ + "The $name file" \ + is \ + provides \ + specifies \ + contains \ + represents \ + a \ + an \ + the + +# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then +# doxygen will generate a detailed section even if there is only a brief +# description. +# The default value is: NO. + +ALWAYS_DETAILED_SEC = NO + +# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all +# inherited members of a class in the documentation of that class as if those +# members were ordinary class members. Constructors, destructors and assignment +# operators of the base classes will not be shown. +# The default value is: NO. + +INLINE_INHERITED_MEMB = NO + +# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path +# before files name in the file list and in the header files. If set to NO the +# shortest path that makes the file name unique will be used +# The default value is: YES. + +FULL_PATH_NAMES = YES + +# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. +# Stripping is only done if one of the specified strings matches the left-hand +# part of the path. The tag can be used to show relative paths in the file list. +# If left blank the directory from which doxygen is run is used as the path to +# strip. +# +# Note that you can specify absolute paths here, but also relative paths, which +# will be relative from the directory where doxygen is started. +# This tag requires that the tag FULL_PATH_NAMES is set to YES. + +STRIP_FROM_PATH = + +# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the +# path mentioned in the documentation of a class, which tells the reader which +# header file to include in order to use a class. If left blank only the name of +# the header file containing the class definition is used. Otherwise one should +# specify the list of include paths that are normally passed to the compiler +# using the -I flag. + +STRIP_FROM_INC_PATH = + +# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but +# less readable) file names. This can be useful is your file systems doesn't +# support long names like on DOS, Mac, or CD-ROM. +# The default value is: NO. + +SHORT_NAMES = NO + +# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the +# first line (until the first dot) of a Javadoc-style comment as the brief +# description. If set to NO, the Javadoc-style will behave just like regular Qt- +# style comments (thus requiring an explicit @brief command for a brief +# description.) +# The default value is: NO. + +JAVADOC_AUTOBRIEF = YES + +# If the JAVADOC_BANNER tag is set to YES then doxygen will interpret a line +# such as +# /*************** +# as being the beginning of a Javadoc-style comment "banner". If set to NO, the +# Javadoc-style will behave just like regular comments and it will not be +# interpreted by doxygen. +# The default value is: NO. + +JAVADOC_BANNER = NO + +# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first +# line (until the first dot) of a Qt-style comment as the brief description. If +# set to NO, the Qt-style will behave just like regular Qt-style comments (thus +# requiring an explicit \brief command for a brief description.) +# The default value is: NO. + +QT_AUTOBRIEF = NO + +# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a +# multi-line C++ special comment block (i.e. a block of //! or /// comments) as +# a brief description. This used to be the default behavior. The new default is +# to treat a multi-line C++ comment block as a detailed description. Set this +# tag to YES if you prefer the old behavior instead. +# +# Note that setting this tag to YES also means that rational rose comments are +# not recognized any more. +# The default value is: NO. + +MULTILINE_CPP_IS_BRIEF = NO + +# By default Python docstrings are displayed as preformatted text and doxygen's +# special commands cannot be used. By setting PYTHON_DOCSTRING to NO the +# doxygen's special commands can be used and the contents of the docstring +# documentation blocks is shown as doxygen documentation. +# The default value is: YES. + +PYTHON_DOCSTRING = YES + +# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the +# documentation from any documented member that it re-implements. +# The default value is: YES. + +INHERIT_DOCS = YES + +# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new +# page for each member. If set to NO, the documentation of a member will be part +# of the file/class/namespace that contains it. +# The default value is: NO. + +SEPARATE_MEMBER_PAGES = NO + +# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen +# uses this value to replace tabs by spaces in code fragments. +# Minimum value: 1, maximum value: 16, default value: 4. + +TAB_SIZE = 4 + +# This tag can be used to specify a number of aliases that act as commands in +# the documentation. An alias has the form: +# name=value +# For example adding +# "sideeffect=@par Side Effects:^^" +# will allow you to put the command \sideeffect (or @sideeffect) in the +# documentation, which will result in a user-defined paragraph with heading +# "Side Effects:". Note that you cannot put \n's in the value part of an alias +# to insert newlines (in the resulting output). You can put ^^ in the value part +# of an alias to insert a newline as if a physical newline was in the original +# file. When you need a literal { or } or , in the value part of an alias you +# have to escape them by means of a backslash (\), this can lead to conflicts +# with the commands \{ and \} for these it is advised to use the version @{ and +# @} or use a double escape (\\{ and \\}) + +ALIASES = + +# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources +# only. Doxygen will then generate output that is more tailored for C. For +# instance, some of the names that are used will be different. The list of all +# members will be omitted, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_FOR_C = NO + +# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or +# Python sources only. Doxygen will then generate output that is more tailored +# for that language. For instance, namespaces will be presented as packages, +# qualified scopes will look different, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_JAVA = NO + +# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran +# sources. Doxygen will then generate output that is tailored for Fortran. +# The default value is: NO. + +OPTIMIZE_FOR_FORTRAN = NO + +# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL +# sources. Doxygen will then generate output that is tailored for VHDL. +# The default value is: NO. + +OPTIMIZE_OUTPUT_VHDL = NO + +# Set the OPTIMIZE_OUTPUT_SLICE tag to YES if your project consists of Slice +# sources only. Doxygen will then generate output that is more tailored for that +# language. For instance, namespaces will be presented as modules, types will be +# separated into more groups, etc. +# The default value is: NO. + +OPTIMIZE_OUTPUT_SLICE = NO + +# Doxygen selects the parser to use depending on the extension of the files it +# parses. With this tag you can assign which parser to use for a given +# extension. Doxygen has a built-in mapping, but you can override or extend it +# using this tag. The format is ext=language, where ext is a file extension, and +# language is one of the parsers supported by doxygen: IDL, Java, JavaScript, +# Csharp (C#), C, C++, Lex, D, PHP, md (Markdown), Objective-C, Python, Slice, +# VHDL, Fortran (fixed format Fortran: FortranFixed, free formatted Fortran: +# FortranFree, unknown formatted Fortran: Fortran. In the later case the parser +# tries to guess whether the code is fixed or free formatted code, this is the +# default for Fortran type files). For instance to make doxygen treat .inc files +# as Fortran files (default is PHP), and .f files as C (default is Fortran), +# use: inc=Fortran f=C. +# +# Note: For files without extension you can use no_extension as a placeholder. +# +# Note that for custom extensions you also need to set FILE_PATTERNS otherwise +# the files are not read by doxygen. When specifying no_extension you should add +# * to the FILE_PATTERNS. +# +# Note see also the list of default file extension mappings. + +EXTENSION_MAPPING = + +# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments +# according to the Markdown format, which allows for more readable +# documentation. See https://daringfireball.net/projects/markdown/ for details. +# The output of markdown processing is further processed by doxygen, so you can +# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in +# case of backward compatibilities issues. +# The default value is: YES. + +MARKDOWN_SUPPORT = YES + +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 5. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 5 + +# The MARKDOWN_ID_STYLE tag can be used to specify the algorithm used to +# generate identifiers for the Markdown headings. Note: Every identifier is +# unique. +# Possible values are: DOXYGEN Use a fixed 'autotoc_md' string followed by a +# sequence number starting at 0. and GITHUB Use the lower case version of title +# with any whitespace replaced by '-' and punctations characters removed.. +# The default value is: DOXYGEN. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +MARKDOWN_ID_STYLE = DOXYGEN + +# When enabled doxygen tries to link words that correspond to documented +# classes, or namespaces to their corresponding documentation. Such a link can +# be prevented in individual cases by putting a % sign in front of the word or +# globally by setting AUTOLINK_SUPPORT to NO. +# The default value is: YES. + +AUTOLINK_SUPPORT = YES + +# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want +# to include (a tag file for) the STL sources as input, then you should set this +# tag to YES in order to let doxygen match functions declarations and +# definitions whose arguments contain STL classes (e.g. func(std::string); +# versus func(std::string) {}). This also make the inheritance and collaboration +# diagrams that involve STL classes more complete and accurate. +# The default value is: NO. + +BUILTIN_STL_SUPPORT = NO + +# If you use Microsoft's C++/CLI language, you should set this option to YES to +# enable parsing support. +# The default value is: NO. + +CPP_CLI_SUPPORT = NO + +# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen +# will parse them like normal C++ but will assume all classes use public instead +# of private inheritance when no explicit protection keyword is present. +# The default value is: NO. + +SIP_SUPPORT = NO + +# For Microsoft's IDL there are propget and propput attributes to indicate +# getter and setter methods for a property. Setting this option to YES will make +# doxygen to replace the get and set methods by a property in the documentation. +# This will only work if the methods are indeed getting or setting a simple +# type. If this is not the case, or you want to show the methods anyway, you +# should set this option to NO. +# The default value is: YES. + +IDL_PROPERTY_SUPPORT = YES + +# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC +# tag is set to YES then doxygen will reuse the documentation of the first +# member in the group (if any) for the other members of the group. By default +# all members of a group must be documented explicitly. +# The default value is: NO. + +DISTRIBUTE_GROUP_DOC = NO + +# If one adds a struct or class to a group and this option is enabled, then also +# any nested class or struct is added to the same group. By default this option +# is disabled and one has to add nested compounds explicitly via \ingroup. +# The default value is: NO. + +GROUP_NESTED_COMPOUNDS = NO + +# Set the SUBGROUPING tag to YES to allow class member groups of the same type +# (for instance a group of public functions) to be put as a subgroup of that +# type (e.g. under the Public Functions section). Set it to NO to prevent +# subgrouping. Alternatively, this can be done per class using the +# \nosubgrouping command. +# The default value is: YES. + +SUBGROUPING = YES + +# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions +# are shown inside the group in which they are included (e.g. using \ingroup) +# instead of on a separate page (for HTML and Man pages) or section (for LaTeX +# and RTF). +# +# Note that this feature does not work in combination with +# SEPARATE_MEMBER_PAGES. +# The default value is: NO. + +INLINE_GROUPED_CLASSES = NO + +# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions +# with only public data fields or simple typedef fields will be shown inline in +# the documentation of the scope in which they are defined (i.e. file, +# namespace, or group documentation), provided this scope is documented. If set +# to NO, structs, classes, and unions are shown on a separate page (for HTML and +# Man pages) or section (for LaTeX and RTF). +# The default value is: NO. + +INLINE_SIMPLE_STRUCTS = NO + +# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or +# enum is documented as struct, union, or enum with the name of the typedef. So +# typedef struct TypeS {} TypeT, will appear in the documentation as a struct +# with name TypeT. When disabled the typedef will appear as a member of a file, +# namespace, or class. And the struct will be named TypeS. This can typically be +# useful for C code in case the coding convention dictates that all compound +# types are typedef'ed and only the typedef is referenced, never the tag name. +# The default value is: NO. + +TYPEDEF_HIDES_STRUCT = NO + +# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This +# cache is used to resolve symbols given their name and scope. Since this can be +# an expensive process and often the same symbol appears multiple times in the +# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small +# doxygen will become slower. If the cache is too large, memory is wasted. The +# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range +# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 +# symbols. At the end of a run doxygen will report the cache usage and suggest +# the optimal cache size from a speed point of view. +# Minimum value: 0, maximum value: 9, default value: 0. + +LOOKUP_CACHE_SIZE = 0 + +# The NUM_PROC_THREADS specifies the number of threads doxygen is allowed to use +# during processing. When set to 0 doxygen will based this on the number of +# cores available in the system. You can set it explicitly to a value larger +# than 0 to get more control over the balance between CPU load and processing +# speed. At this moment only the input processing can be done using multiple +# threads. Since this is still an experimental feature the default is set to 1, +# which effectively disables parallel processing. Please report any issues you +# encounter. Generating dot graphs in parallel is controlled by the +# DOT_NUM_THREADS setting. +# Minimum value: 0, maximum value: 32, default value: 1. + +NUM_PROC_THREADS = 1 + +# If the TIMESTAMP tag is set different from NO then each generated page will +# contain the date or date and time when the page was generated. Setting this to +# NO can help when comparing the output of multiple runs. +# Possible values are: YES, NO, DATETIME and DATE. +# The default value is: NO. + +TIMESTAMP = NO + +#--------------------------------------------------------------------------- +# Build related configuration options +#--------------------------------------------------------------------------- + +# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in +# documentation are documented, even if no documentation was available. Private +# class members and static file members will be hidden unless the +# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. +# Note: This will also disable the warnings about undocumented members that are +# normally produced when WARNINGS is set to YES. +# The default value is: NO. + +EXTRACT_ALL = YES + +# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will +# be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIVATE = NO + +# If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual +# methods of a class will be included in the documentation. +# The default value is: NO. + +EXTRACT_PRIV_VIRTUAL = NO + +# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal +# scope will be included in the documentation. +# The default value is: NO. + +EXTRACT_PACKAGE = NO + +# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be +# included in the documentation. +# The default value is: NO. + +EXTRACT_STATIC = NO + +# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined +# locally in source files will be included in the documentation. If set to NO, +# only classes defined in header files are included. Does not have any effect +# for Java sources. +# The default value is: YES. + +EXTRACT_LOCAL_CLASSES = YES + +# This flag is only useful for Objective-C code. If set to YES, local methods, +# which are defined in the implementation section but not in the interface are +# included in the documentation. If set to NO, only methods in the interface are +# included. +# The default value is: NO. + +EXTRACT_LOCAL_METHODS = NO + +# If this flag is set to YES, the members of anonymous namespaces will be +# extracted and appear in the documentation as a namespace called +# 'anonymous_namespace{file}', where file will be replaced with the base name of +# the file that contains the anonymous namespace. By default anonymous namespace +# are hidden. +# The default value is: NO. + +EXTRACT_ANON_NSPACES = NO + +# If this flag is set to YES, the name of an unnamed parameter in a declaration +# will be determined by the corresponding definition. By default unnamed +# parameters remain unnamed in the output. +# The default value is: YES. + +RESOLVE_UNNAMED_PARAMS = YES + +# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all +# undocumented members inside documented classes or files. If set to NO these +# members will be included in the various overviews, but no documentation +# section is generated. This option has no effect if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_MEMBERS = NO + +# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all +# undocumented classes that are normally visible in the class hierarchy. If set +# to NO, these classes will be included in the various overviews. This option +# will also hide undocumented C++ concepts if enabled. This option has no effect +# if EXTRACT_ALL is enabled. +# The default value is: NO. + +HIDE_UNDOC_CLASSES = NO + +# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend +# declarations. If set to NO, these declarations will be included in the +# documentation. +# The default value is: NO. + +HIDE_FRIEND_COMPOUNDS = NO + +# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any +# documentation blocks found inside the body of a function. If set to NO, these +# blocks will be appended to the function's detailed documentation block. +# The default value is: NO. + +HIDE_IN_BODY_DOCS = NO + +# The INTERNAL_DOCS tag determines if documentation that is typed after a +# \internal command is included. If the tag is set to NO then the documentation +# will be excluded. Set it to YES to include the internal documentation. +# The default value is: NO. + +INTERNAL_DOCS = NO + +# With the correct setting of option CASE_SENSE_NAMES doxygen will better be +# able to match the capabilities of the underlying filesystem. In case the +# filesystem is case sensitive (i.e. it supports files in the same directory +# whose names only differ in casing), the option must be set to YES to properly +# deal with such files in case they appear in the input. For filesystems that +# are not case sensitive the option should be set to NO to properly deal with +# output files written for symbols that only differ in casing, such as for two +# classes, one named CLASS and the other named Class, and to also support +# references to files without having to specify the exact matching casing. On +# Windows (including Cygwin) and MacOS, users should typically set this option +# to NO, whereas on Linux or other Unix flavors it should typically be set to +# YES. +# Possible values are: SYSTEM, NO and YES. +# The default value is: SYSTEM. + +CASE_SENSE_NAMES = SYSTEM + +# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with +# their full class and namespace scopes in the documentation. If set to YES, the +# scope will be hidden. +# The default value is: NO. + +HIDE_SCOPE_NAMES = NO + +# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will +# append additional text to a page's title, such as Class Reference. If set to +# YES the compound reference will be hidden. +# The default value is: NO. + +HIDE_COMPOUND_REFERENCE= NO + +# If the SHOW_HEADERFILE tag is set to YES then the documentation for a class +# will show which file needs to be included to use the class. +# The default value is: YES. + +SHOW_HEADERFILE = YES + +# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of +# the files that are included by a file in the documentation of that file. +# The default value is: YES. + +SHOW_INCLUDE_FILES = YES + +# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each +# grouped member an include statement to the documentation, telling the reader +# which file to include in order to use the member. +# The default value is: NO. + +SHOW_GROUPED_MEMB_INC = NO + +# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include +# files with double quotes in the documentation rather than with sharp brackets. +# The default value is: NO. + +FORCE_LOCAL_INCLUDES = NO + +# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the +# documentation for inline members. +# The default value is: YES. + +INLINE_INFO = YES + +# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the +# (detailed) documentation of file and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. +# The default value is: YES. + +SORT_MEMBER_DOCS = YES + +# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief +# descriptions of file, namespace and class members alphabetically by member +# name. If set to NO, the members will appear in declaration order. Note that +# this will also influence the order of the classes in the class list. +# The default value is: NO. + +SORT_BRIEF_DOCS = NO + +# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the +# (brief and detailed) documentation of class members so that constructors and +# destructors are listed first. If set to NO the constructors will appear in the +# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. +# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief +# member documentation. +# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting +# detailed member documentation. +# The default value is: NO. + +SORT_MEMBERS_CTORS_1ST = NO + +# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy +# of group names into alphabetical order. If set to NO the group names will +# appear in their defined order. +# The default value is: NO. + +SORT_GROUP_NAMES = NO + +# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by +# fully-qualified names, including namespaces. If set to NO, the class list will +# be sorted only by class name, not including the namespace part. +# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. +# Note: This option applies only to the class list, not to the alphabetical +# list. +# The default value is: NO. + +SORT_BY_SCOPE_NAME = NO + +# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper +# type resolution of all parameters of a function it will reject a match between +# the prototype and the implementation of a member function even if there is +# only one candidate or it is obvious which candidate to choose by doing a +# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still +# accept a match between prototype and implementation in such cases. +# The default value is: NO. + +STRICT_PROTO_MATCHING = NO + +# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo +# list. This list is created by putting \todo commands in the documentation. +# The default value is: YES. + +GENERATE_TODOLIST = YES + +# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test +# list. This list is created by putting \test commands in the documentation. +# The default value is: YES. + +GENERATE_TESTLIST = YES + +# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug +# list. This list is created by putting \bug commands in the documentation. +# The default value is: YES. + +GENERATE_BUGLIST = YES + +# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) +# the deprecated list. This list is created by putting \deprecated commands in +# the documentation. +# The default value is: YES. + +GENERATE_DEPRECATEDLIST= YES + +# The ENABLED_SECTIONS tag can be used to enable conditional documentation +# sections, marked by \if ... \endif and \cond +# ... \endcond blocks. + +ENABLED_SECTIONS = + +# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the +# initial value of a variable or macro / define can have for it to appear in the +# documentation. If the initializer consists of more lines than specified here +# it will be hidden. Use a value of 0 to hide initializers completely. The +# appearance of the value of individual variables and macros / defines can be +# controlled using \showinitializer or \hideinitializer command in the +# documentation regardless of this setting. +# Minimum value: 0, maximum value: 10000, default value: 30. + +MAX_INITIALIZER_LINES = 30 + +# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at +# the bottom of the documentation of classes and structs. If set to YES, the +# list will mention the files that were used to generate the documentation. +# The default value is: YES. + +SHOW_USED_FILES = YES + +# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This +# will remove the Files entry from the Quick Index and from the Folder Tree View +# (if specified). +# The default value is: YES. + +SHOW_FILES = YES + +# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces +# page. This will remove the Namespaces entry from the Quick Index and from the +# Folder Tree View (if specified). +# The default value is: YES. + +SHOW_NAMESPACES = YES + +# The FILE_VERSION_FILTER tag can be used to specify a program or script that +# doxygen should invoke to get the current version for each file (typically from +# the version control system). Doxygen will invoke the program by executing (via +# popen()) the command command input-file, where command is the value of the +# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided +# by doxygen. Whatever the program writes to standard output is used as the file +# version. For an example see the documentation. + +FILE_VERSION_FILTER = + +# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed +# by doxygen. The layout file controls the global structure of the generated +# output files in an output format independent way. To create the layout file +# that represents doxygen's defaults, run doxygen with the -l option. You can +# optionally specify a file name after the option, if omitted DoxygenLayout.xml +# will be used as the name of the layout file. See also section "Changing the +# layout of pages" for information. +# +# Note that if you run doxygen from a directory containing a file called +# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE +# tag is left empty. + +LAYOUT_FILE = + +# The CITE_BIB_FILES tag can be used to specify one or more bib files containing +# the reference definitions. This must be a list of .bib files. The .bib +# extension is automatically appended if omitted. This requires the bibtex tool +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. +# For LaTeX the style of the bibliography can be controlled using +# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the +# search path. See also \cite for info how to create references. + +CITE_BIB_FILES = + +#--------------------------------------------------------------------------- +# Configuration options related to warning and progress messages +#--------------------------------------------------------------------------- + +# The QUIET tag can be used to turn on/off the messages that are generated to +# standard output by doxygen. If QUIET is set to YES this implies that the +# messages are off. +# The default value is: NO. + +QUIET = NO + +# The WARNINGS tag can be used to turn on/off the warning messages that are +# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES +# this implies that the warnings are on. +# +# Tip: Turn warnings on while writing the documentation. +# The default value is: YES. + +WARNINGS = YES + +# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate +# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: YES. + +WARN_IF_UNDOCUMENTED = YES + +# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for +# potential errors in the documentation, such as documenting some parameters in +# a documented function twice, or documenting parameters that don't exist or +# using markup commands wrongly. +# The default value is: YES. + +WARN_IF_DOC_ERROR = YES + +# If WARN_IF_INCOMPLETE_DOC is set to YES, doxygen will warn about incomplete +# function parameter documentation. If set to NO, doxygen will accept that some +# parameters have no documentation without warning. +# The default value is: YES. + +WARN_IF_INCOMPLETE_DOC = YES + +# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that +# are documented, but have no documentation for their parameters or return +# value. If set to NO, doxygen will only warn about wrong parameter +# documentation, but not about the absence of documentation. If EXTRACT_ALL is +# set to YES then this flag will automatically be disabled. See also +# WARN_IF_INCOMPLETE_DOC +# The default value is: NO. + +WARN_NO_PARAMDOC = NO + +# If WARN_IF_UNDOC_ENUM_VAL option is set to YES, doxygen will warn about +# undocumented enumeration values. If set to NO, doxygen will accept +# undocumented enumeration values. If EXTRACT_ALL is set to YES then this flag +# will automatically be disabled. +# The default value is: NO. + +WARN_IF_UNDOC_ENUM_VAL = NO + +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS +# then doxygen will continue running as if WARN_AS_ERROR tag is set to NO, but +# at the end of the doxygen process doxygen will return with a non-zero status. +# If the WARN_AS_ERROR tag is set to FAIL_ON_WARNINGS_PRINT then doxygen behaves +# like FAIL_ON_WARNINGS but in case no WARN_LOGFILE is defined doxygen will not +# write the warning messages in between other messages but write them at the end +# of a run, in case a WARN_LOGFILE is defined the warning messages will be +# besides being in the defined file also be shown at the end of a run, unless +# the WARN_LOGFILE is defined as - i.e. standard output (stdout) in that case +# the behavior will remain as with the setting FAIL_ON_WARNINGS. +# Possible values are: NO, YES, FAIL_ON_WARNINGS and FAIL_ON_WARNINGS_PRINT. +# The default value is: NO. + +WARN_AS_ERROR = NO + +# The WARN_FORMAT tag determines the format of the warning messages that doxygen +# can produce. The string should contain the $file, $line, and $text tags, which +# will be replaced by the file and line number from which the warning originated +# and the warning text. Optionally the format may contain $version, which will +# be replaced by the version of the file (if it could be obtained via +# FILE_VERSION_FILTER) +# See also: WARN_LINE_FORMAT +# The default value is: $file:$line: $text. + +WARN_FORMAT = "$file:$line: $text" + +# In the $text part of the WARN_FORMAT command it is possible that a reference +# to a more specific place is given. To make it easier to jump to this place +# (outside of doxygen) the user can define a custom "cut" / "paste" string. +# Example: +# WARN_LINE_FORMAT = "'vi $file +$line'" +# See also: WARN_FORMAT +# The default value is: at line $line of file $file. + +WARN_LINE_FORMAT = "at line $line of file $file" + +# The WARN_LOGFILE tag can be used to specify a file to which warning and error +# messages should be written. If left blank the output is written to standard +# error (stderr). In case the file specified cannot be opened for writing the +# warning and error messages are written to standard error. When as file - is +# specified the warning and error messages are written to standard output +# (stdout). + +WARN_LOGFILE = + +#--------------------------------------------------------------------------- +# Configuration options related to the input files +#--------------------------------------------------------------------------- + +# The INPUT tag is used to specify the files and/or directories that contain +# documented source files. You may enter file names like myfile.cpp or +# directories like /usr/src/myproject. Separate the files or directories with +# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING +# Note: If this tag is empty the current directory is searched. + +INPUT = ./Source/CesiumRuntime/Public + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses +# libiconv (or the iconv built into libc) for the transcoding. See the libiconv +# documentation (see: +# https://www.gnu.org/software/libiconv/) for the list of possible encodings. +# See also: INPUT_FILE_ENCODING +# The default value is: UTF-8. + +INPUT_ENCODING = UTF-8 + +# This tag can be used to specify the character encoding of the source files +# that doxygen parses The INPUT_FILE_ENCODING tag can be used to specify +# character encoding on a per file pattern basis. Doxygen will compare the file +# name with each pattern and apply the encoding instead of the default +# INPUT_ENCODING) if there is a match. The character encodings are a list of the +# form: pattern=encoding (like *.php=ISO-8859-1). See cfg_input_encoding +# "INPUT_ENCODING" for further information on supported encodings. + +INPUT_FILE_ENCODING = + +# If the value of the INPUT tag contains directories, you can use the +# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and +# *.h) to filter out the source-files in the directories. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# read by doxygen. +# +# Note the list of default checked file patterns might differ from the list of +# default file extension mappings. +# +# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, +# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, +# *.hh, *.hxx, *.hpp, *.h++, *.l, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, +# *.inc, *.m, *.markdown, *.md, *.mm, *.dox (to be provided as doxygen C +# comment), *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, *.f18, *.f, *.for, *.vhd, +# *.vhdl, *.ucf, *.qsf and *.ice. + +FILE_PATTERNS = *.c \ + *.cc \ + *.cxx \ + *.cpp \ + *.c++ \ + *.java \ + *.ii \ + *.ixx \ + *.ipp \ + *.i++ \ + *.inl \ + *.idl \ + *.ddl \ + *.odl \ + *.h \ + *.hh \ + *.hxx \ + *.hpp \ + *.h++ \ + *.l \ + *.cs \ + *.d \ + *.php \ + *.php4 \ + *.php5 \ + *.phtml \ + *.inc \ + *.m \ + *.markdown \ + *.md \ + *.mm \ + *.dox \ + *.py \ + *.pyw \ + *.f90 \ + *.f95 \ + *.f03 \ + *.f08 \ + *.f18 \ + *.f \ + *.for \ + *.vhd \ + *.vhdl \ + *.ucf \ + *.qsf \ + *.ice + +# The RECURSIVE tag can be used to specify whether or not subdirectories should +# be searched for input files as well. +# The default value is: NO. + +RECURSIVE = NO + +# The EXCLUDE tag can be used to specify files and/or directories that should be +# excluded from the INPUT source files. This way you can easily exclude a +# subdirectory from a directory tree whose root is specified with the INPUT tag. +# +# Note that relative paths are relative to the directory from which doxygen is +# run. + +EXCLUDE = + +# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or +# directories that are symbolic links (a Unix file system feature) are excluded +# from the input. +# The default value is: NO. + +EXCLUDE_SYMLINKS = NO + +# If the value of the INPUT tag contains directories, you can use the +# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude +# certain files from those directories. +# +# Note that the wildcards are matched against the file with absolute path, so to +# exclude all test directories for example use the pattern */test/* + +EXCLUDE_PATTERNS = + +# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names +# (namespaces, classes, functions, etc.) that should be excluded from the +# output. The symbol name can be a fully qualified name, a word, or if the +# wildcard * is used, a substring. Examples: ANamespace, AClass, +# ANamespace::AClass, ANamespace::*Test + +EXCLUDE_SYMBOLS = CesiumMetadataConversions<* + +# The EXAMPLE_PATH tag can be used to specify one or more files or directories +# that contain example code fragments that are included (see the \include +# command). + +EXAMPLE_PATH = + +# If the value of the EXAMPLE_PATH tag contains directories, you can use the +# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and +# *.h) to filter out the source-files in the directories. If left blank all +# files are included. + +EXAMPLE_PATTERNS = * + +# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be +# searched for input files to be used with the \include or \dontinclude commands +# irrespective of the value of the RECURSIVE tag. +# The default value is: NO. + +EXAMPLE_RECURSIVE = NO + +# The IMAGE_PATH tag can be used to specify one or more files or directories +# that contain images that are to be included in the documentation (see the +# \image command). + +IMAGE_PATH = + +# The INPUT_FILTER tag can be used to specify a program that doxygen should +# invoke to filter for each input file. Doxygen will invoke the filter program +# by executing (via popen()) the command: +# +# +# +# where is the value of the INPUT_FILTER tag, and is the +# name of an input file. Doxygen will then use the output that the filter +# program writes to standard output. If FILTER_PATTERNS is specified, this tag +# will be ignored. +# +# Note that the filter must not add or remove lines; it is applied before the +# code is scanned, but not when the output code is generated. If lines are added +# or removed, the anchors will not be placed correctly. +# +# Note that doxygen will use the data processed and written to standard output +# for further processing, therefore nothing else, like debug statements or used +# commands (so in case of a Windows batch file always use @echo OFF), should be +# written to standard output. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +INPUT_FILTER = + +# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern +# basis. Doxygen will compare the file name with each pattern and apply the +# filter if there is a match. The filters are a list of the form: pattern=filter +# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how +# filters are used. If the FILTER_PATTERNS tag is empty or if none of the +# patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. + +FILTER_PATTERNS = + +# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using +# INPUT_FILTER) will also be used to filter the input files that are used for +# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). +# The default value is: NO. + +FILTER_SOURCE_FILES = NO + +# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file +# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and +# it is also possible to disable source filtering for a specific pattern using +# *.ext= (so without naming a filter). +# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. + +FILTER_SOURCE_PATTERNS = + +# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that +# is part of the input, its contents will be placed on the main page +# (index.html). This can be useful if you have a project on for instance GitHub +# and want to reuse the introduction page also for the doxygen output. + +USE_MDFILE_AS_MAINPAGE = + +# The Fortran standard specifies that for fixed formatted Fortran code all +# characters from position 72 are to be considered as comment. A common +# extension is to allow longer lines before the automatic comment starts. The +# setting FORTRAN_COMMENT_AFTER will also make it possible that longer lines can +# be processed before the automatic comment starts. +# Minimum value: 7, maximum value: 10000, default value: 72. + +FORTRAN_COMMENT_AFTER = 72 + +#--------------------------------------------------------------------------- +# Configuration options related to source browsing +#--------------------------------------------------------------------------- + +# If the SOURCE_BROWSER tag is set to YES then a list of source files will be +# generated. Documented entities will be cross-referenced with these sources. +# +# Note: To get rid of all source code in the generated output, make sure that +# also VERBATIM_HEADERS is set to NO. +# The default value is: NO. + +SOURCE_BROWSER = NO + +# Setting the INLINE_SOURCES tag to YES will include the body of functions, +# classes and enums directly into the documentation. +# The default value is: NO. + +INLINE_SOURCES = NO + +# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any +# special comment blocks from generated source code fragments. Normal C, C++ and +# Fortran comments will always remain visible. +# The default value is: YES. + +STRIP_CODE_COMMENTS = YES + +# If the REFERENCED_BY_RELATION tag is set to YES then for each documented +# entity all documented functions referencing it will be listed. +# The default value is: NO. + +REFERENCED_BY_RELATION = NO + +# If the REFERENCES_RELATION tag is set to YES then for each documented function +# all documented entities called/used by that function will be listed. +# The default value is: NO. + +REFERENCES_RELATION = NO + +# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set +# to YES then the hyperlinks from functions in REFERENCES_RELATION and +# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will +# link to the documentation. +# The default value is: YES. + +REFERENCES_LINK_SOURCE = YES + +# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the +# source code will show a tooltip with additional information such as prototype, +# brief description and links to the definition and documentation. Since this +# will make the HTML file larger and loading of large files a bit slower, you +# can opt to disable this feature. +# The default value is: YES. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +SOURCE_TOOLTIPS = YES + +# If the USE_HTAGS tag is set to YES then the references to source code will +# point to the HTML generated by the htags(1) tool instead of doxygen built-in +# source browser. The htags tool is part of GNU's global source tagging system +# (see https://www.gnu.org/software/global/global.html). You will need version +# 4.8.6 or higher. +# +# To use it do the following: +# - Install the latest version of global +# - Enable SOURCE_BROWSER and USE_HTAGS in the configuration file +# - Make sure the INPUT points to the root of the source tree +# - Run doxygen as normal +# +# Doxygen will invoke htags (and that will in turn invoke gtags), so these +# tools must be available from the command line (i.e. in the search path). +# +# The result: instead of the source browser generated by doxygen, the links to +# source code will now point to the output of htags. +# The default value is: NO. +# This tag requires that the tag SOURCE_BROWSER is set to YES. + +USE_HTAGS = NO + +# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a +# verbatim copy of the header file for each class for which an include is +# specified. Set to NO to disable this. +# See also: Section \class. +# The default value is: YES. + +VERBATIM_HEADERS = YES + +# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the +# clang parser (see: +# http://clang.llvm.org/) for more accurate parsing at the cost of reduced +# performance. This can be particularly helpful with template rich C++ code for +# which doxygen's built-in parser lacks the necessary type information. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. +# The default value is: NO. + +CLANG_ASSISTED_PARSING = NO + +# If the CLANG_ASSISTED_PARSING tag is set to YES and the CLANG_ADD_INC_PATHS +# tag is set to YES then doxygen will add the directory of each input to the +# include path. +# The default value is: YES. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_ADD_INC_PATHS = YES + +# If clang assisted parsing is enabled you can provide the compiler with command +# line options that you would normally use when invoking the compiler. Note that +# the include paths will already be set by doxygen for the files and directories +# specified with INPUT and INCLUDE_PATH. +# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES. + +CLANG_OPTIONS = + +# If clang assisted parsing is enabled you can provide the clang parser with the +# path to the directory containing a file called compile_commands.json. This +# file is the compilation database (see: +# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) containing the +# options used when the source files were built. This is equivalent to +# specifying the -p option to a clang tool, such as clang-check. These options +# will then be passed to the parser. Any options specified with CLANG_OPTIONS +# will be added as well. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse_libclang=ON option for CMake. + +CLANG_DATABASE_PATH = + +#--------------------------------------------------------------------------- +# Configuration options related to the alphabetical class index +#--------------------------------------------------------------------------- + +# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all +# compounds will be generated. Enable this if the project contains a lot of +# classes, structs, unions or interfaces. +# The default value is: YES. + +ALPHABETICAL_INDEX = YES + +# The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes) +# that should be ignored while generating the index headers. The IGNORE_PREFIX +# tag works for classes, function and member names. The entity will be placed in +# the alphabetical list under the first letter of the entity name that remains +# after removing the prefix. +# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. + +IGNORE_PREFIX = + +#--------------------------------------------------------------------------- +# Configuration options related to the HTML output +#--------------------------------------------------------------------------- + +# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output +# The default value is: YES. + +GENERATE_HTML = YES + +# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a +# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of +# it. +# The default directory is: html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_OUTPUT = html + +# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each +# generated HTML page (for example: .htm, .php, .asp). +# The default value is: .html. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FILE_EXTENSION = .html + +# The HTML_HEADER tag can be used to specify a user-defined HTML header file for +# each generated HTML page. If the tag is left blank doxygen will generate a +# standard header. +# +# To get valid HTML the header file that includes any scripts and style sheets +# that doxygen needs, which is dependent on the configuration options used (e.g. +# the setting GENERATE_TREEVIEW). It is highly recommended to start with a +# default header using +# doxygen -w html new_header.html new_footer.html new_stylesheet.css +# YourConfigFile +# and then modify the file new_header.html. See also section "Doxygen usage" +# for information on how to generate the default header that doxygen normally +# uses. +# Note: The header is subject to change so you typically have to regenerate the +# default header when upgrading to a newer version of doxygen. For a description +# of the possible markers and block names see the documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_HEADER = + +# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each +# generated HTML page. If the tag is left blank doxygen will generate a standard +# footer. See HTML_HEADER for more information on how to generate a default +# footer and what special commands can be used inside the footer. See also +# section "Doxygen usage" for information on how to generate the default footer +# that doxygen normally uses. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FOOTER = + +# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style +# sheet that is used by each HTML page. It can be used to fine-tune the look of +# the HTML output. If left blank doxygen will generate a default style sheet. +# See also section "Doxygen usage" for information on how to generate the style +# sheet that doxygen normally uses. +# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as +# it is more robust and this tag (HTML_STYLESHEET) will in the future become +# obsolete. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_STYLESHEET = + +# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined +# cascading style sheets that are included after the standard style sheets +# created by doxygen. Using this option one can overrule certain style aspects. +# This is preferred over using HTML_STYLESHEET since it does not replace the +# standard style sheet and is therefore more robust against future updates. +# Doxygen will copy the style sheet files to the output directory. +# Note: The order of the extra style sheet files is of importance (e.g. the last +# style sheet in the list overrules the setting of the previous ones in the +# list). +# Note: Since the styling of scrollbars can currently not be overruled in +# Webkit/Chromium, the styling will be left out of the default doxygen.css if +# one or more extra stylesheets have been specified. So if scrollbar +# customization is desired it has to be added explicitly. For an example see the +# documentation. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_STYLESHEET = + +# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or +# other source files which should be copied to the HTML output directory. Note +# that these files will be copied to the base HTML output directory. Use the +# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these +# files. In the HTML_STYLESHEET file, use the file name only. Also note that the +# files will be copied as-is; there are no commands or markers available. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_EXTRA_FILES = + +# The HTML_COLORSTYLE tag can be used to specify if the generated HTML output +# should be rendered with a dark or light theme. +# Possible values are: LIGHT always generate light mode output, DARK always +# generate dark mode output, AUTO_LIGHT automatically set the mode according to +# the user preference, use light mode if no preference is set (the default), +# AUTO_DARK automatically set the mode according to the user preference, use +# dark mode if no preference is set and TOGGLE allow to user to switch between +# light and dark mode via a button. +# The default value is: AUTO_LIGHT. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE = AUTO_LIGHT + +# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen +# will adjust the colors in the style sheet and background images according to +# this color. Hue is specified as an angle on a color-wheel, see +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value +# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 +# purple, and 360 is red again. +# Minimum value: 0, maximum value: 359, default value: 220. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_HUE = 220 + +# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors +# in the HTML output. For a value of 0 the output will use gray-scales only. A +# value of 255 will produce the most vivid colors. +# Minimum value: 0, maximum value: 255, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_SAT = 100 + +# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the +# luminance component of the colors in the HTML output. Values below 100 +# gradually make the output lighter, whereas values above 100 make the output +# darker. The value divided by 100 is the actual gamma applied, so 80 represents +# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not +# change the gamma. +# Minimum value: 40, maximum value: 240, default value: 80. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_COLORSTYLE_GAMMA = 80 + +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via JavaScript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have JavaScript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + +# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML +# documentation will contain sections that can be hidden and shown after the +# page has loaded. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_SECTIONS = NO + +# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries +# shown in the various tree structured indices initially; the user can expand +# and collapse entries dynamically later on. Doxygen will expand the tree to +# such a level that at most the specified number of entries are visible (unless +# a fully collapsed tree already exceeds this amount). So setting the number of +# entries 1 will produce a full collapsed tree by default. 0 is a special value +# representing an infinite number of entries and will result in a full expanded +# tree by default. +# Minimum value: 0, maximum value: 9999, default value: 100. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_INDEX_NUM_ENTRIES = 100 + +# If the GENERATE_DOCSET tag is set to YES, additional index files will be +# generated that can be used as input for Apple's Xcode 3 integrated development +# environment (see: +# https://developer.apple.com/xcode/), introduced with OSX 10.5 (Leopard). To +# create a documentation set, doxygen will generate a Makefile in the HTML +# output directory. Running make will produce the docset in that directory and +# running make install will install the docset in +# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at +# startup. See https://developer.apple.com/library/archive/featuredarticles/Doxy +# genXcode/_index.html for more information. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_DOCSET = NO + +# This tag determines the name of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# The default value is: Doxygen generated docs. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDNAME = "Doxygen generated docs" + +# This tag determines the URL of the docset feed. A documentation feed provides +# an umbrella under which multiple documentation sets from a single provider +# (such as a company or product suite) can be grouped. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_FEEDURL = + +# This tag specifies a string that should uniquely identify the documentation +# set bundle. This should be a reverse domain-name style string, e.g. +# com.mycompany.MyDocSet. Doxygen will append .docset to the name. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_BUNDLE_ID = org.doxygen.Project + +# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify +# the documentation publisher. This should be a reverse domain-name style +# string, e.g. com.mycompany.MyDocSet.documentation. +# The default value is: org.doxygen.Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_ID = org.doxygen.Publisher + +# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. +# The default value is: Publisher. +# This tag requires that the tag GENERATE_DOCSET is set to YES. + +DOCSET_PUBLISHER_NAME = Publisher + +# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three +# additional HTML index files: index.hhp, index.hhc, and index.hhk. The +# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop +# on Windows. In the beginning of 2021 Microsoft took the original page, with +# a.o. the download links, offline the HTML help workshop was already many years +# in maintenance mode). You can download the HTML help workshop from the web +# archives at Installation executable (see: +# http://web.archive.org/web/20160201063255/http://download.microsoft.com/downlo +# ad/0/A/9/0A939EF6-E31C-430F-A3DF-DFAE7960D564/htmlhelp.exe). +# +# The HTML Help Workshop contains a compiler that can convert all HTML output +# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML +# files are now used as the Windows 98 help format, and will replace the old +# Windows help format (.hlp) on all Windows platforms in the future. Compressed +# HTML files also contain an index, a table of contents, and you can search for +# words in the documentation. The HTML workshop also contains a viewer for +# compressed HTML files. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_HTMLHELP = NO + +# The CHM_FILE tag can be used to specify the file name of the resulting .chm +# file. You can add a path in front of the file if the result should not be +# written to the html output directory. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_FILE = + +# The HHC_LOCATION tag can be used to specify the location (absolute path +# including file name) of the HTML help compiler (hhc.exe). If non-empty, +# doxygen will try to run the HTML help compiler on the generated index.hhp. +# The file has to be specified with full path. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +HHC_LOCATION = + +# The GENERATE_CHI flag controls if a separate .chi index file is generated +# (YES) or that it should be included in the main .chm file (NO). +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +GENERATE_CHI = NO + +# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) +# and project file content. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +CHM_INDEX_ENCODING = + +# The BINARY_TOC flag controls whether a binary table of contents is generated +# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it +# enables the Previous and Next buttons. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +BINARY_TOC = NO + +# The TOC_EXPAND flag can be set to YES to add extra items for group members to +# the table of contents of the HTML help documentation and to the tree view. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTMLHELP is set to YES. + +TOC_EXPAND = NO + +# The SITEMAP_URL tag is used to specify the full URL of the place where the +# generated documentation will be placed on the server by the user during the +# deployment of the documentation. The generated sitemap is called sitemap.xml +# and placed on the directory specified by HTML_OUTPUT. In case no SITEMAP_URL +# is specified no sitemap is generated. For information about the sitemap +# protocol see https://www.sitemaps.org +# This tag requires that the tag GENERATE_HTML is set to YES. + +SITEMAP_URL = + +# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and +# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that +# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help +# (.qch) of the generated HTML documentation. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_QHP = NO + +# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify +# the file name of the resulting .qch file. The path specified is relative to +# the HTML output folder. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QCH_FILE = + +# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help +# Project output. For more information please see Qt Help Project / Namespace +# (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#namespace). +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_NAMESPACE = org.doxygen.Project + +# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt +# Help Project output. For more information please see Qt Help Project / Virtual +# Folders (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#virtual-folders). +# The default value is: doc. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_VIRTUAL_FOLDER = doc + +# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom +# filter to add. For more information please see Qt Help Project / Custom +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_NAME = + +# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the +# custom filter to add. For more information please see Qt Help Project / Custom +# Filters (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#custom-filters). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_CUST_FILTER_ATTRS = + +# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this +# project's filter section matches. Qt Help Project / Filter Attributes (see: +# https://doc.qt.io/archives/qt-4.8/qthelpproject.html#filter-attributes). +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHP_SECT_FILTER_ATTRS = + +# The QHG_LOCATION tag can be used to specify the location (absolute path +# including file name) of Qt's qhelpgenerator. If non-empty doxygen will try to +# run qhelpgenerator on the generated .qhp file. +# This tag requires that the tag GENERATE_QHP is set to YES. + +QHG_LOCATION = + +# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be +# generated, together with the HTML files, they form an Eclipse help plugin. To +# install this plugin and make it available under the help contents menu in +# Eclipse, the contents of the directory containing the HTML and XML files needs +# to be copied into the plugins directory of eclipse. The name of the directory +# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. +# After copying Eclipse needs to be restarted before the help appears. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_ECLIPSEHELP = NO + +# A unique identifier for the Eclipse help plugin. When installing the plugin +# the directory name containing the HTML and XML files should also have this +# name. Each documentation set should have its own identifier. +# The default value is: org.doxygen.Project. +# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. + +ECLIPSE_DOC_ID = org.doxygen.Project + +# If you want full control over the layout of the generated HTML pages it might +# be necessary to disable the index and replace it with your own. The +# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top +# of each HTML page. A value of NO enables the index and the value YES disables +# it. Since the tabs in the index contain the same information as the navigation +# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +DISABLE_INDEX = NO + +# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index +# structure should be generated to display hierarchical information. If the tag +# value is set to YES, a side panel will be generated containing a tree-like +# index structure (just like the one that is generated for HTML Help). For this +# to work a browser that supports JavaScript, DHTML, CSS and frames is required +# (i.e. any modern browser). Windows users are probably better off using the +# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can +# further fine tune the look of the index (see "Fine-tuning the output"). As an +# example, the default style sheet generated by doxygen has an example that +# shows how to put an image at the root of the tree instead of the PROJECT_NAME. +# Since the tree basically has the same information as the tab index, you could +# consider setting DISABLE_INDEX to YES when enabling this option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +GENERATE_TREEVIEW = NO + +# When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the +# FULL_SIDEBAR option determines if the side bar is limited to only the treeview +# area (value NO) or if it should extend to the full height of the window (value +# YES). Setting this to YES gives a layout similar to +# https://docs.readthedocs.io with more room for contents, but less room for the +# project logo, title, and description. If either GENERATE_TREEVIEW or +# DISABLE_INDEX is set to NO, this option has no effect. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FULL_SIDEBAR = NO + +# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that +# doxygen will group on one line in the generated HTML documentation. +# +# Note that a value of 0 will completely suppress the enum values from appearing +# in the overview section. +# Minimum value: 0, maximum value: 20, default value: 4. +# This tag requires that the tag GENERATE_HTML is set to YES. + +ENUM_VALUES_PER_LINE = 4 + +# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used +# to set the initial width (in pixels) of the frame in which the tree is shown. +# Minimum value: 0, maximum value: 1500, default value: 250. +# This tag requires that the tag GENERATE_HTML is set to YES. + +TREEVIEW_WIDTH = 250 + +# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to +# external symbols imported via tag files in a separate window. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +EXT_LINKS_IN_WINDOW = NO + +# If the OBFUSCATE_EMAILS tag is set to YES, doxygen will obfuscate email +# addresses. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +OBFUSCATE_EMAILS = YES + +# If the HTML_FORMULA_FORMAT option is set to svg, doxygen will use the pdf2svg +# tool (see https://github.com/dawbarton/pdf2svg) or inkscape (see +# https://inkscape.org) to generate formulas as SVG images instead of PNGs for +# the HTML output. These images will generally look nicer at scaled resolutions. +# Possible values are: png (the default) and svg (looks nicer but requires the +# pdf2svg or inkscape tool). +# The default value is: png. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_FORMULA_FORMAT = png + +# Use this tag to change the font size of LaTeX formulas included as images in +# the HTML documentation. When you change the font size after a successful +# doxygen run you need to manually remove any form_*.png images from the HTML +# output directory to force them to be regenerated. +# Minimum value: 8, maximum value: 50, default value: 10. +# This tag requires that the tag GENERATE_HTML is set to YES. + +FORMULA_FONTSIZE = 10 + +# The FORMULA_MACROFILE can contain LaTeX \newcommand and \renewcommand commands +# to create new LaTeX commands to be used in formulas as building blocks. See +# the section "Including formulas" for details. + +FORMULA_MACROFILE = + +# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see +# https://www.mathjax.org) which uses client side JavaScript for the rendering +# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX +# installed or if you want to formulas look prettier in the HTML output. When +# enabled you may also need to install MathJax separately and configure the path +# to it using the MATHJAX_RELPATH option. +# The default value is: NO. +# This tag requires that the tag GENERATE_HTML is set to YES. + +USE_MATHJAX = NO + +# With MATHJAX_VERSION it is possible to specify the MathJax version to be used. +# Note that the different versions of MathJax have different requirements with +# regards to the different settings, so it is possible that also other MathJax +# settings have to be changed when switching between the different MathJax +# versions. +# Possible values are: MathJax_2 and MathJax_3. +# The default value is: MathJax_2. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_VERSION = MathJax_2 + +# When MathJax is enabled you can set the default output format to be used for +# the MathJax output. For more details about the output format see MathJax +# version 2 (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) and MathJax version 3 +# (see: +# http://docs.mathjax.org/en/latest/web/components/output.html). +# Possible values are: HTML-CSS (which is slower, but has the best +# compatibility. This is the name for Mathjax version 2, for MathJax version 3 +# this will be translated into chtml), NativeMML (i.e. MathML. Only supported +# for NathJax 2. For MathJax version 3 chtml will be used instead.), chtml (This +# is the name for Mathjax version 3, for MathJax version 2 this will be +# translated into HTML-CSS) and SVG. +# The default value is: HTML-CSS. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_FORMAT = HTML-CSS + +# When MathJax is enabled you need to specify the location relative to the HTML +# output directory using the MATHJAX_RELPATH option. The destination directory +# should contain the MathJax.js script. For instance, if the mathjax directory +# is located at the same level as the HTML output directory, then +# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax +# Content Delivery Network so you can quickly see the result without installing +# MathJax. However, it is strongly recommended to install a local copy of +# MathJax from https://www.mathjax.org before deployment. The default value is: +# - in case of MathJax version 2: https://cdn.jsdelivr.net/npm/mathjax@2 +# - in case of MathJax version 3: https://cdn.jsdelivr.net/npm/mathjax@3 +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_RELPATH = + +# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax +# extension names that should be enabled during MathJax rendering. For example +# for MathJax version 2 (see +# https://docs.mathjax.org/en/v2.7-latest/tex.html#tex-and-latex-extensions): +# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols +# For example for MathJax version 3 (see +# http://docs.mathjax.org/en/latest/input/tex/extensions/index.html): +# MATHJAX_EXTENSIONS = ams +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_EXTENSIONS = + +# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces +# of code that will be used on startup of the MathJax code. See the MathJax site +# (see: +# http://docs.mathjax.org/en/v2.7-latest/output.html) for more details. For an +# example see the documentation. +# This tag requires that the tag USE_MATHJAX is set to YES. + +MATHJAX_CODEFILE = + +# When the SEARCHENGINE tag is enabled doxygen will generate a search box for +# the HTML output. The underlying search engine uses javascript and DHTML and +# should work on any modern browser. Note that when using HTML help +# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) +# there is already a search function so this one should typically be disabled. +# For large projects the javascript based search engine can be slow, then +# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to +# search using the keyboard; to jump to the search box use + S +# (what the is depends on the OS and browser, but it is typically +# , /