Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/deprecate-geotransforms' into gl…
Browse files Browse the repository at this point in the history
…obe-anchor-improvements
  • Loading branch information
kring committed Sep 11, 2023
2 parents e1d02e6 + bdcb2b5 commit d948021
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -660,7 +660,7 @@ jobs:
name: ${{ env.BUILD_CESIUM_UNREAL_PACKAGE_NAME}}
path: packages
iOS52:
runs-on: macos-13
runs-on: macos-12
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Expand Down
7 changes: 7 additions & 0 deletions Source/CesiumRuntime/Private/Cesium3DTileset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2001,6 +2001,13 @@ void ACesium3DTileset::Tick(float DeltaTime) {
glm::dmat4 unrealWorldToCesiumTileset =
glm::affineInverse(ueTilesetToUeWorld * cesiumTilesetToUeTileset);

if (glm::isnan(unrealWorldToCesiumTileset[3].x) ||
glm::isnan(unrealWorldToCesiumTileset[3].y) ||
glm::isnan(unrealWorldToCesiumTileset[3].z)) {
// Probably caused by a zero scale.
return;
}

std::vector<Cesium3DTilesSelection::ViewState> frustums;
for (const FCesiumCamera& camera : cameras) {
frustums.push_back(
Expand Down
6 changes: 4 additions & 2 deletions Source/CesiumRuntime/Private/CesiumGeoreference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ createCoordinateSystem(const FVector& center, double scale) {

} // namespace

/*static*/ const double ACesiumGeoreference::kMinimumScale = 1.0e-6;

/*static*/ ACesiumGeoreference*
ACesiumGeoreference::GetDefaultGeoreference(const UObject* WorldContextObject) {
UWorld* world = WorldContextObject->GetWorld();
Expand Down Expand Up @@ -195,8 +197,8 @@ void ACesiumGeoreference::SetOriginHeight(double NewValue) {
double ACesiumGeoreference::GetScale() const { return this->Scale; }

void ACesiumGeoreference::SetScale(double NewValue) {
if (NewValue < 1e-6) {
this->Scale = 1e-6;
if (NewValue < ACesiumGeoreference::kMinimumScale) {
this->Scale = ACesiumGeoreference::kMinimumScale;
} else {
this->Scale = NewValue;
}
Expand Down
5 changes: 2 additions & 3 deletions Source/CesiumRuntime/Private/CesiumPolygonRasterOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ std::unique_ptr<Cesium3DTilesSelection::RasterOverlay>
UCesiumPolygonRasterOverlay::CreateOverlay(
const Cesium3DTilesSelection::RasterOverlayOptions& options) {
ACesium3DTileset* pTileset = this->GetOwner<ACesium3DTileset>();
if (pTileset == nullptr)
return nullptr;

FTransform worldToTileset = pTileset->GetActorTransform().Inverse();
FTransform worldToTileset =
pTileset ? pTileset->GetActorTransform().Inverse() : FTransform::Identity;

std::vector<CartographicPolygon> polygons;
polygons.reserve(this->Polygons.Num());
Expand Down
3 changes: 0 additions & 3 deletions Source/CesiumRuntime/Private/CesiumSunSky.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,6 @@ void ACesiumSunSky::BeginPlay() {
if (this->UpdateAtmosphereAtRuntime) {
this->UpdateAtmosphereRadius();
}

if (this->SkyAtmosphere->AtmosphereHeight != this->AtmosphereHeight) {
}
}

void ACesiumSunSky::EndPlay(const EEndPlayReason::Type EndPlayReason) {
Expand Down
16 changes: 10 additions & 6 deletions Source/CesiumRuntime/Public/CesiumGeoreference.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ UCLASS()
class CESIUMRUNTIME_API ACesiumGeoreference : public AActor {
GENERATED_BODY()
public:
/**
* The minimum allowed value for the Scale property, 1e-6.
*/
static const double kMinimumScale;

/**
* Finds and returns the actor labeled `CesiumGeoreferenceDefault` in the
* persistent level of the calling object's world. If not found, it creates a
Expand Down Expand Up @@ -715,18 +720,17 @@ class CESIUMRUNTIME_API ACesiumGeoreference : public AActor {
public:
ACesiumGeoreference();

/**
* Recomputes all world georeference transforms. Usually there is no need to
* explicitly call this from external code.
*/
void UpdateGeoreference();

const CesiumGeospatial::LocalHorizontalCoordinateSystem&
getCoordinateSystem() const noexcept {
return this->_coordinateSystem;
}

private:
/**
* Recomputes all world georeference transforms.
*/
void UpdateGeoreference();

/**
* A tag that is assigned to Georeferences when they are created
* as the "default" Georeference for a certain world.
Expand Down

0 comments on commit d948021

Please sign in to comment.