diff --git a/.github/ISSUE_TEMPLATE/bug_report.yaml b/.github/ISSUE_TEMPLATE/bug_report.yaml new file mode 100644 index 000000000..f44401b2f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.yaml @@ -0,0 +1,55 @@ +name: Report a bug +description: Let us know so we can fix it! +labels: ["needs triage", "bug"] +body: + - type: markdown + attributes: + value: | + Thanks for helping us improve Cesium for Unreal! + + First, check if the issue already exists in the [issues](https://github.com/CesiumGS/cesium-unreal/issues) page. If it does, please leave a **comment** on the existing issue instead. + + Otherwise, if you can't find a similar issue, describe what is happening using the text fields below. + - type: textarea + id: what-happened + attributes: + label: What happened? + description: Also tell us, what did you expect to happen? + validations: + required: true + - type: textarea + id: environment + attributes: + label: Environment + description: What environment are you experiencing this issue in? + value: | + Cesium for Unreal version: + Unreal Engine Version: + Operating System: + validations: + required: true + - type: textarea + id: repro + attributes: + label: Reproduction steps + description: "How do you trigger this bug? Please walk us through it step by step, starting from either a blank project or the Cesium for Unreal Samples. (We can triage bugs much faster when we have these steps.)" + value: | + 1. + 2. + 3. + ... + validations: + required: false + - type: textarea + id: evidence + attributes: + label: Supporting evidence + description: Providing screenshots, videos, or GIFs of the issue helps us a lot, especially for visual bugs. If there were any error messages or logs in the console, please include those too. + validations: + required: false + - type: markdown + attributes: + value: | + If you can also contribute a fix, we'd absolutely appreciate it! Fixing a bug in Cesium for Unreal often means fixing a bug for numerous applications and end users. Check out the contributor guide to get started: [CONTRIBUTING.md](https://github.com/CesiumGS/cesium-unreal/tree/main/CONTRIBUTING.md) + + Let us know you're working on it, and we'd be happy to provide advice and feedback. diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 000000000..3bc02c5ad --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,5 @@ +blank_issues_enabled: true +contact_links: +- name: Ask a question + url: https://community.cesium.com/c/cesium-for-unreal/10 + about: Please use the community forum for general questions. The Cesium team and community actively monitor it and love to see what people are working on! We reserve GitHub for confirmed bug reports and feature requests. diff --git a/.github/ISSUE_TEMPLATE/feature_request.yaml b/.github/ISSUE_TEMPLATE/feature_request.yaml new file mode 100644 index 000000000..4baceef2d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.yaml @@ -0,0 +1,20 @@ +name: Request a feature +description: New ideas & improvements to Cesium for Unreal are always welcome. +labels: ["needs triage", "enhancement"] +body: + - type: markdown + attributes: + value: | + Thanks for helping us improve Cesium for Unreal! + + When suggesting an idea, give examples of the intended use case. Features that benefit the wider community are more likely to be prioritized. + - type: textarea + id: new-feature + attributes: + label: Feature + validations: + required: true + - type: markdown + attributes: + value: | + The best way to get your ideas into Cesium for Unreal is to help us! We love contributions and are always happy to be provide feedback and advice. Check out the contributor guide to get started: [CONTRIBUTING.md](https://github.com/CesiumGS/cesium-unreal/tree/main/CONTRIBUTING.md) \ No newline at end of file diff --git a/CHANGES.md b/CHANGES.md index 706a1577c..c7449bd55 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,10 +5,17 @@ ##### Additions :tada: - Added `CesiumUrlTemplateRasterOverlay`, allowing a raster overlay to be added using tiles requested based on a specified URL template. +- Added `RequestHeaders` property to `Cesium3DTileset`, allowing per-tileset headers to be specified. +- Added `RequestHeaders` properties to `CesiumTileMapServiceRasterOverlay`, `CesiumUrlTemplateRasterOverlay`, `CesiumWebMapServiceRasterOverlay`, + and `CesiumWebMapTileServiceRasterOverlay`, allowing per-raster-overlay HTTP headers to be specified. ##### Fixes :wrench: - Fixed another bug in `CesiumSubLevelSwitcherComponent` that could prevent all sub-levels from loading if a single sub-level failed to load. +- Fixed a crash in `UCesiumIonServer` when running in a packaged build where tilesets are only created at runtime. +- Worked around a limitation in Unreal's `FMatrix` -> `FTransform` conversion that prevented models with a small scale factor (e.g., where vertex positions are expressed in millimeters) from rendering because their scale was treated as 0.0. +- Fixed a crash when calling `SampleHeightMostDetailed` blueprint function without a valid tileset. +- Removed duplicate "Enable Water Mask" checkbox on `Cesium3DTileset` resulting from EditCondition flag. ### v2.12.0 - 2025-01-02 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8be26b308..84f75e9ac 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -16,22 +16,24 @@ To ensure an inclusive community, contributors and users in the Cesium community # Submitting an Issue {#submitting-an-issue} -If you have a question, do not submit an issue; instead, search the [Cesium community forum](https://community.cesium.com/). The forum is very active and there are years of informative archives for the Cesium platform, often with answers from the core Cesium team. If you do not find an answer to your question, start a new thread and you'll likely get a quick response. +If you have a question, **do not submit an issue**. Instead, search the [Cesium community forum](https://community.cesium.com/) for your question. The forum is very active and there are years of informative archives for the Cesium platform, often with answers from the core Cesium team. If you do not find an answer to your question, start a new thread and you'll likely get a quick response. -If you think you've found a bug in Cesium for Unreal, first search the [issues](https://github.com/CesiumGS/cesium-unreal/issues). If an issue already exists, please add a comment expressing your interest and any additional information. This helps us prioritize issues. +If you think you've found a bug in Cesium for Unreal, first search the existing [issues](https://github.com/CesiumGS/cesium-unreal/issues). If an issue already exists, please add a **comment** expressing your interest and any additional information. This helps us stay organized and prioritize issues. -If a related issue does not exist, submit a new one. Please be concise and include as much of the following information as is relevant: +If a related issue does not exist, then you can submit a new one. Please include as much of the following information as is relevant: -- The version of Cesium for Unreal. Did this work in a previous version? -- Your operating system and version, Unreal Engine version, and video card. Are they all up-to-date? Is the issue specific to one of them? -- If possible, an Unreal project (and data or IDs of Cesium ion assets that have been used) where the issue can be reproduced. +- What version of Cesium for Unreal were you using? Do other versions have the same issue? +- What version of Unreal Engine were you using? +- What is your operating system and version, and your video card? Are they up-to-date? Is the issue specific to one of them? - Can the issue be reproduced in the [Cesium for Unreal Samples](https://github.com/CesiumGS/cesium-unreal-samples)? -- A Screenshot, video or animated .gif if appropriate. Screenshots are particularly useful for exceptions and rendering artifacts. -- Information about whether the issue appeared in the Unreal Editor or in the play mode. -- If the issue is about a crash of the Unreal Editor, include the stack trace that is shown together with the error message. -- Depending on the type of the issue, it can be helpful to see the log files that have been created before encountering the unexpected behavior. The log files is stored as `Saved\Logs\cesiumunreal.log` in your project directory. -- A link to the thread if this was discussed on the [Cesium community forum](https://community.cesium.com/) or elsewhere. -- Ideas for how to fix or workaround the issue. Also mention if you are willing to help fix it. If so, the Cesium team can often provide guidance and the issue may get fixed more quickly with your help. +- Does the issue occur in the Unreal Editor? In Play Mode? Both? +- Are there any error messages in the console? Any stack traces or logs? Please include them if so. Logs are stored as `Saved\Logs\cesiumunreal.log` in your project directory. +- Share a screenshot, video or animated `.gif` if appropriate. Screenshots are particularly useful for exceptions and rendering artifacts. +- Link to threads on the [Cesium community forum](https://community.cesium.com/) if this was discussed on there. +- Include step-by-step instructions for us to reproduce the issue from scratch. +- Any ideas for how to fix or workaround the issue. Also mention if you are willing to help fix it. If so, the Cesium team can often provide guidance and the issue may get fixed more quickly with your help. + +**Note**: It is difficult for us to debug everyone's individual projects. We can triage issues faster when we receive steps to reproduce the issue from scratch—either from [Cesium for Unreal Samples](https://github.com/CesiumGS/cesium-unreal-samples) or from a blank project. We will only request your Unreal project and/or data as a last resort. # Getting Started Contributing {#getting-started-contributing} @@ -41,16 +43,17 @@ In addition to contributing code, we appreciate many types of contributions: - Being active on the [Cesium community forum](https://community.cesium.com/) by answering questions and providing input on Cesium's direction. - Showcasing your Cesium for Unreal apps on [Cesium blog](https://cesium.com/blog/categories/userstories/). Contact us at hello@cesium.com. -- Writing tutorials, creating examples, and improving the reference documentation. See the issues labeled [category - doc](https://github.com/CesiumGS/cesium-unreal/labels/category%20-%20doc). +- Writing tutorials, creating examples, and improving the reference documentation. See the issues labeled [documentation](https://github.com/CesiumGS/cesium-unreal/labels/documentation). - Submitting issues as [described above](#submitting-an-issue). - Triaging issues. Browse the [issues](https://github.com/CesiumGS/cesium-unreal/issues) and comment on issues that are no longer reproducible or on issues for which you have additional information. For ideas for Cesium for Unreal code contributions, see: -- issues labeled [`good first issue`](https://github.com/CesiumGS/cesium-unreal/labels/good%20first%20issue) and -- issues labeled [`type - roadmap`](https://github.com/CesiumGS/cesium-unreal/labels/type%20-%20roadmap). +- issues labeled [`good first issue`](https://github.com/CesiumGS/cesium-unreal/labels/good%20first%20issue), +- issues labeled [`low hanging fruit`](https://github.com/CesiumGS/cesium-unreal/labels/low%20hanging%20fruit), and +- issues labeled [`enhancement`](https://github.com/CesiumGS/cesium-unreal/labels/enhancement). -See the [build guide](https://github.com/CesiumGS/cesium-unreal#computer-developing-with-unreal-engine) for how to build and run Cesium for Unreal. +See [Developer Setup](https://cesium.com/learn/cesium-unreal/ref-doc/developer-setup-unreal.html) for how to build and run Cesium for Unreal. Always feel free to introduce yourself on the [Cesium community forum](https://community.cesium.com/) to brainstorm ideas and ask for guidance. @@ -62,14 +65,7 @@ We love pull requests. We strive to promptly review them, provide feedback, and ## Contributor License Agreement (CLA) -Before we can review a pull request, we require a signed Contributor License Agreement. There is a CLA for: - -- [individuals](https://docs.google.com/forms/d/e/1FAIpQLScU-yvQdcdjCFHkNXwdNeEXx5Qhu45QXuWX_uF5qiLGFSEwlA/viewform) and -- [corporations](https://docs.google.com/forms/d/e/1FAIpQLSeYEaWlBl1tQEiegfHMuqnH9VxyfgXGyIw13C2sN7Fj3J3GVA/viewform). - -This only needs to be completed once, and enables contributions to all of the projects under the [CesiumGS](https://github.com/CesiumGS) organization, including Cesium for Unreal. The CLA ensures you retain copyright to your contributions, and provides us the right to use, modify, and redistribute your contributions using the [Apache 2.0 License](LICENSE). If you have already signed a CLA for CesiumJS or other contributions to Cesium, you will not need to sign it again. - -If you have any questions, feel free to reach out to hello@cesium.com! +Before we can review a pull request, we require a signed Contributor License Agreement. The CLA forms can be found in our `community` repo [here](https://github.com/CesiumGS/community/tree/main/CLAs). ## Pull Request Guidelines @@ -77,12 +73,11 @@ Our code is our lifeblood so maintaining Cesium's high code quality is important - For an overview of our workflow see [github pull request workflows](https://cesium.com/blog/2013/10/08/github-pull-request-workflows/). - Pull request tips - - After you open a pull request, the friendly [cesium-concierge](https://github.com/CesiumGS/cesium-concierge) bot will comment with a short automated review. At least one human will also review your pull request. + - After you open a pull request, one or more Cesium teammates will review your pull request. - If your pull request fixes an existing issue, include a link to the issue in the description (like this: [#1](https://github.com/CesiumGS/cesium-unreal/issues/1)). Likewise, if your pull request fixes an issue reported on the Cesium forum, include a link to the thread. - If your pull request needs additional work, include a [task list](https://github.com/blog/1375%0A-task-lists-in-gfm-issues-pulls-comments). - - Once you are done making new commits to address feedback, add a comment to the pull request such as `"this is ready"` since GitHub doesn't notify us about commits. - - Follow the [Coding Guide](https://github.com/CesiumGS/cesium-native/blob/main/doc/style-guide.md). - - Verify your is formatted, as described in the Coding Guide. + - Once you are done making new commits to address feedback, add a comment to the pull request such as `"this is ready"` so we know to take another look. + - Verify that your code conforms to our [Style Guide](https://cesium.com/learn/cesium-native/ref-doc/style-guide.html). ## Code of Conduct diff --git a/Documentation/developer-setup-osx.md b/Documentation/developer-setup-osx.md index a19844813..d3a388426 100644 --- a/Documentation/developer-setup-osx.md +++ b/Documentation/developer-setup-osx.md @@ -6,9 +6,9 @@ Detailed instructions for setting up a Cesium for Unreal development environment # Prerequisities - Install CMake (version 3.15 or newer) from https://cmake.org/install/ -- Install Xcode 11.3 from https://developer.apple.com/xcode/resources/ +- Install Xcode 14.2+ from https://developer.apple.com/xcode/resources/ - For best JPEG-decoding performance, you must have [nasm](https://www.nasm.us/) installed so that CMake can find it. Everything will work fine without it, just slower. -- Install the Unreal Engine (version 4.26 or newer) from https://www.unrealengine.com/en-US/download +- Install the minimum supported version of Unreal Engine (version 5.3 as of this writing) from https://www.unrealengine.com/en-US/download # Cloning the git repos @@ -35,29 +35,136 @@ git clone --recursive https://github.com/CesiumGS/cesium-unreal.git git submodule update --init --recursive ``` -# Building cesium-native +# Setting up Xcode + +Unreal Engine 5.3 requires a version of Xcode _no later_ than Xcode 15.x. This means that Xcode 16, which is the earliest version supported on macOS 15.2 Sequoia, cannot be used to build a UE 5.3 project without some tricks. You will see an error like this when you attempt to generate project files: + +> Exception while generating include data for UnrealEditor: Platform Mac is not a valid platform to build. Check that the SDK is installed properly. + +We have a few options: + +1. Use an earlier version of macOS +2. Use a later version of Unreal Engine +3. [Hack UnrealBuildTool to allow us to build for UE 5.3 using Xcode 16](#modify-unrealbuildtool-for-xcode-16) +4. [Hack Xcode 15.4 to run on macOS 15.2 Sequoia](#modify-xcode-for-sequoia) + +## Modify UnrealBuildTool for Xcode 16 + +The source code for the UnrealBuildTool is installed with Unreal Engine, which makes it easy to modify it for our purposes. The file to edit in Unreal Engine 5.3 is here (or equivalent on your system): + +``` +/Users/Shared/Epic Games/UE_5.3/Engine/Source/Programs/UnrealBuildTool/Platform/Mac/ApplePlatformSDK.Versions.cs +``` -The cesium-native libraries and their dependencies use CMake and must be built separately from Cesium for Unreal. There are a number of ways to do this, but typically on macOS. +Find a line in that file that looks like this: -## CMake command-line +``` +MaxVersion = "15.9.9"; +``` + +If you have Xcode 16, change it to: + +``` +MaxVersion = "16.9.9"; +``` + +Now we need to build our modifications into a new binary, which we can do by running: + +``` +cd "/Users/Shared/Epic Games/UE_5.3/Engine/Source/Programs/UnrealBuildTool" +"/Users/Shared/Epic Games/UE_5.3/Engine/Binaries/ThirdParty/DotNet/6.0.302/mac-x64/dotnet" build UnrealBuildTool.csproj +``` -First, configure the CMake project in the `~/dev/cesium-unreal-samples/Plugins/cesium-unreal/extern` directory by following the instructions below. > [!note] -> The following steps must be done in the `extern` directory, and _not_ the `cesium-native` subdirectory! +> The path to the `dotnet` executable may be different in different Unreal Engine versions. You can also install a system `dotnet` if desired with `brew install dotnet`. + +This will build UnrealBuildTool to the place all of Unreal's build scripts expect to find it. You should now be able to [generate project files](#building-cesium-for-unreal) successfully. + +However, because this version of Unreal Engine has not been tested on this Xcode version, you may run into compiler errors, and these may be easy or difficult to fix. With Unreal Engine 5.3 and Xcode 16.2, you'll likely see errors like this: + +> /Users/Shared/Epic Games/UE_5.3/Engine/Source/Runtime/RenderCore/Public/ShaderParameterStructDeclaration.h:22:3: encoding prefix 'u' on an unevaluated string literal has no effect and is incompatible with c++2c [-Werror,-Winvalid-unevaluated-string] -Change to the `~/dev/cesium-unreal-samples/Plugins/cesium-unreal/extern` directory, and execute the following commands to build and install a Debug version of cesium-native: +We can "fix" this by suppressing this warning. Open `/Users/Shared/Epic Games/UE_5.3/Engine/Source/Runtime/Core/Public/Apple/ApplePlatformCompilerPreSetup.h` and add a line to disable this warning: + +``` +#pragma clang diagnostic ignored "-Winvalid-unevaluated-string" ``` + +## Modify Xcode for Sequoia + +It's possible to run Xcode 15.4 on macOS 15.2 Sequoia, as described here: +https://stackoverflow.com/questions/78996419/xcode-15-is-not-running-in-macos-sequoia + +More detailed instructions coming soon. + +# Building cesium-native + +The cesium-native libraries and their dependencies use CMake and must be built separately from Cesium for Unreal. Cesium for Unreal supports both Intel and Apple Silicon processors. In development, we usually just want to build for the host's architecture, which is done as follows: + +``` +cd ~/dev/cesium-unreal-samples/Plugins/cesium-unreal/extern cmake -B build -S . -DCMAKE_BUILD_TYPE=Debug -cmake --build build --target install +cmake --build build --target install --parallel 14 +``` + +Or to build a Release version: + +``` +cd ~/dev/cesium-unreal-samples/Plugins/cesium-unreal/extern +cmake -B build -S . -DCMAKE_BUILD_TYPE=RelWithDebInfo +cmake --build build --target install --parallel 14 +``` + +This will install the built libraries to one of these subdirectories of `~/dev/cesium-unreal-samples/Plugins/cesium-unreal/Source/ThirdParty/lib/`, depending on your configuration and processor architecture: + +* `Darwin-arm64-Debug` - Debug configuration for Apple Silicon. +* `Darwin-arm64-Release` - Release or RelWithDebInfo configuration for Apple Silicon. +* `Darwin-x64-Debug` - Debug configuration for Intel processors. +* `Darwin-x64-Release` - Release or RelWithDebInfo configuration for Intel processors. + +Cesium for Unreal expects to find the libraries in one of these locations, depending on its configuration: + +* `Darwin-universal-Debug` - DebugGame configuration for both processors. +* `Darwin-universal-Release` - Development and Shipping configuration for both processors. + +If we only care to run on the host's architecture, such as during development, we can create a symlink to enable the Cesium for Unreal build to find the libraries for the one processor: + ``` +cd ~/dev/cesium-unreal-samples/Plugins/cesium-unreal/Source/ThirdParty/lib +ln -s ./Darwin-arm64-Debug Darwin-universal-Debug +ln -s ./Darwin-arm64-Release Darwin-universal-Release +``` + +Or, we can build for the other processor: -To build a Release version, do the following: ``` -cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -cmake --build build --target install +cd ~/dev/cesium-unreal-samples/Plugins/cesium-unreal/extern +# Remove the symlink if it exists +rm ~/dev/cesium-unreal-samples/Plugins/cesium-unreal/Source/ThirdParty/lib/Darwin-universal-Release +# Build for Intel +cmake -B build-x64 -S . -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_SYSTEM_NAME=Darwin -DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCMAKE_BUILD_TYPE=RelWithDebInfo +cmake --build build --target install --parallel 14 ``` -## CMake command-line for iOS +And then create universal libraries using lipo: + +``` +mkdir -p ~/dev/cesium-unreal-samples/Plugins/cesium-unreal/Source/ThirdParty/lib/Darwin-universal-Release +for f in ~/dev/cesium-unreal-samples/Plugins/cesium-unreal/Source/ThirdParty/lib/Darwin-x86_64-Release/*.a +do + arm64f=~/dev/cesium-unreal-samples/Plugins/cesium-unreal/Source/ThirdParty/lib/Darwin-arm64-Release/$(basename -- $f) + x64f=~/dev/cesium-unreal-samples/Plugins/cesium-unreal/Source/ThirdParty/lib/Darwin-x86_64-Release/$(basename -- $f) + universalf=~/dev/cesium-unreal-samples/Plugins/cesium-unreal/Source/ThirdParty/lib/Darwin-universal-Release/$(basename -- $f) + if diff $arm64f $x64f; then + # arm64 and x64 files are identical, so just copy one to the universal directory. + cp $arm64f $universalf + else + lipo -create -output $universalf $arm64f $x64f + fi +done +``` + +## Building for iOS **Note**: It is recommended that the build steps for CMake command-line for macOS (above) be completed first. Unreal Engine Editor will not launch without the host side binaries compiled as well. @@ -65,10 +172,51 @@ Configure the CMake project in the `~/dev/cesium-unreal-samples/Plugins/cesium-u > [!note] > The following steps must be done in the `extern` directory, and _not_ the `cesium-native` subdirectory! -Change to the `~/dev/cesium-unreal-samples/Plugins/cesium-unreal/extern` directory, and execute the following commands to build and install a Release version of cesium-native: +Execute the following commands to build and install a Release version of cesium-native: + ``` -cmake -B build-ios -S . -GXcode -DCMAKE_SYSTEM_NAME=iOS -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_BUILD_TYPE=Release -cmake --build build-ios --target install --config Release +cd ~/dev/cesium-unreal-samples/Plugins/cesium-unreal/extern +cmake -B build-ios -S . -GXcode -DCMAKE_TOOLCHAIN_FILE="unreal-ios-toolchain.cmake" -DCMAKE_BUILD_TYPE=Release +cmake --build build-ios --target install --config Release --parallel 14 ``` You can also build and install the debug version by using `Debug` or `RelWithDebInfo` instead of `Release`. + +# Building Cesium for Unreal + +The Cesium for Unreal plugin must be built as part of a larger project, and that project must be a C++ project. The Cesium for Unreal Samples project is a Blueprint project, not C++, but it's easy to convert it to a C++ project by copying the `Source` directory from the documentation: + +``` +cd ~/dev/cesium-unreal-samples +cp -r ./Plugins/cesium-unreal/Documentation/Source . +``` + +Now we can generate Xcode project files for the Samples project and the plugin: + +``` +cd ~/dev/cesium-unreal-samples +"/Users/Shared/Epic Games/UE_5.3/Engine/Build/BatchFiles/Mac/GenerateProjectFiles.sh" -game -project="$PWD/CesiumForUnrealSamples.uproject" +``` + +You may see an error message like this: + +> Your Mac is set to use CommandLineTools for its build tools (/Library/Developer/CommandLineTools). Unreal expects Xcode as the build tools. Please install Xcode if it's not already, then do one of the following: +> - Run Xcode, go to Settings, and in the Locations tab, choose your Xcode in Command Line Tools dropdown. +> - In Terminal, run 'sudo xcode-select -s /Applications/Xcode.app' (or an alternate location if you installed Xcode to a non-standard location) +> Either way, you will need to enter your Mac password. + +In which case, do what it says. + +If you see a message like this: + +> Exception while generating include data for UnrealEditor: Platform Mac is not a valid platform to build. Check that the SDK is installed properly. + +It probably means Unreal doesn't like your Xcode version. Be sure that Xcode is installed and that you have followed the [Xcode setup instructions](#setting-up-xcode). + +If the project file generation succeeds, you should see a file named `CesiumForUnrealSamples (Mac).xcworkspace` in the same directory as your uproject. Double-click it to open Xcode. + +In Xcode, on the Product -> Scheme menu, choose `devEditor`. If you want to build a debug configuration, go to Product -> Scheme -> Edit Scheme... and then change the "Build Configuration" to "DebugGame". + +Build by choosing Product -> Build. Watch the progress in the "Report Navigator" which is the rightmost icon above the tree on the left. + +You can launch the Unreal Engine Editor and the Samples project with Product -> Run. diff --git a/Source/CesiumRuntime/CesiumRuntime.Build.cs b/Source/CesiumRuntime/CesiumRuntime.Build.cs index 56ac39daa..9d4bd207c 100644 --- a/Source/CesiumRuntime/CesiumRuntime.Build.cs +++ b/Source/CesiumRuntime/CesiumRuntime.Build.cs @@ -113,7 +113,7 @@ public CesiumRuntime(ReadOnlyTargetRules Target) : base(Target) "LIBASYNC_STATIC", "GLM_FORCE_XYZW_ONLY", "GLM_FORCE_EXPLICIT_CTOR", - "GLM_FORCE_SIZE_T_LENGTH", + "GLM_ENABLE_EXPERIMENTAL", "TIDY_STATIC", "URI_STATIC_BUILD", "SWL_VARIANT_NO_CONSTEXPR_EMPLACE", diff --git a/Source/CesiumRuntime/Private/Cesium3DTileset.cpp b/Source/CesiumRuntime/Private/Cesium3DTileset.cpp index fa224a405..824ad94eb 100644 --- a/Source/CesiumRuntime/Private/Cesium3DTileset.cpp +++ b/Source/CesiumRuntime/Private/Cesium3DTileset.cpp @@ -117,10 +117,6 @@ ACesium3DTileset::ACesium3DTileset() this->Root = this->RootComponent; PlatformName = UGameplayStatics::GetPlatformName(); - -#if WITH_EDITOR - bIsMac = PlatformName == TEXT("Mac"); -#endif } ACesium3DTileset::~ACesium3DTileset() { this->DestroyTileset(); } @@ -385,6 +381,35 @@ void ACesium3DTileset::SetTilesetSource(ETilesetSource InSource) { } } +namespace { + +bool MapsAreEqual( + const TMap& Lhs, + const TMap& Rhs) { + if (Lhs.Num() != Rhs.Num()) { + return false; + } + + for (const auto& [Key, Value] : Lhs) { + const FString* RhsVal = Rhs.Find(Key); + if (!RhsVal || *RhsVal != Value) { + return false; + } + } + + return true; +} + +} // namespace + +void ACesium3DTileset::SetRequestHeaders( + const TMap& InRequestHeaders) { + if (!MapsAreEqual(InRequestHeaders, this->RequestHeaders)) { + this->DestroyTileset(); + this->RequestHeaders = InRequestHeaders; + } +} + void ACesium3DTileset::SetUrl(const FString& InUrl) { if (InUrl != this->Url) { if (this->TilesetSource == ETilesetSource::FromUrl) { @@ -1287,6 +1312,14 @@ void ACesium3DTileset::LoadTileset() { options.contentOptions.applyTextureTransform = false; + options.requestHeaders.reserve(this->RequestHeaders.Num()); + + for (const auto& [Key, Value] : this->RequestHeaders) { + options.requestHeaders.emplace_back(CesiumAsync::IAssetAccessor::THeader{ + TCHAR_TO_UTF8(*Key), + TCHAR_TO_UTF8(*Value)}); + } + switch (this->TilesetSource) { case ETilesetSource::FromEllipsoid: UE_LOG(LogCesium, Log, TEXT("Loading tileset from ellipsoid")); @@ -2368,6 +2401,7 @@ void ACesium3DTileset::PostEditChangeProperty( GET_MEMBER_NAME_CHECKED(ACesium3DTileset, ShowCreditsOnScreen) || PropName == GET_MEMBER_NAME_CHECKED(ACesium3DTileset, Root) || PropName == GET_MEMBER_NAME_CHECKED(ACesium3DTileset, CesiumIonServer) || + PropName == GET_MEMBER_NAME_CHECKED(ACesium3DTileset, RequestHeaders) || // For properties nested in structs, GET_MEMBER_NAME_CHECKED will prefix // with the struct name, so just do a manual string comparison. PropNameAsString == TEXT("RenderCustomDepth") || @@ -2434,6 +2468,15 @@ void ACesium3DTileset::PostEditImport() { // Recreate the tileset on Paste. this->DestroyTileset(); } + +bool ACesium3DTileset::CanEditChange(const FProperty* InProperty) const { + if (InProperty->GetFName() == + GET_MEMBER_NAME_CHECKED(ACesium3DTileset, EnableWaterMask)) { + // Disable this option on Mac + return PlatformName != TEXT("Mac"); + } + return true; +} #endif void ACesium3DTileset::BeginDestroy() { diff --git a/Source/CesiumRuntime/Private/CesiumBoundingVolumeComponent.cpp b/Source/CesiumRuntime/Private/CesiumBoundingVolumeComponent.cpp index 7f517369d..dd262db00 100644 --- a/Source/CesiumRuntime/Private/CesiumBoundingVolumeComponent.cpp +++ b/Source/CesiumRuntime/Private/CesiumBoundingVolumeComponent.cpp @@ -120,8 +120,8 @@ void UCesiumBoundingVolumeComponent::UpdateOcclusion( } void UCesiumBoundingVolumeComponent::_updateTransform() { - const FTransform transform = FTransform( - VecMath::createMatrix(this->_cesiumToUnreal * this->_tileTransform)); + const FTransform transform = + VecMath::createTransform(this->_cesiumToUnreal * this->_tileTransform); this->SetRelativeTransform_Direct(transform); this->SetComponentToWorld(transform); diff --git a/Source/CesiumRuntime/Private/CesiumGlobeAnchorComponent.cpp b/Source/CesiumRuntime/Private/CesiumGlobeAnchorComponent.cpp index 055d656d8..3ad84b02c 100644 --- a/Source/CesiumRuntime/Private/CesiumGlobeAnchorComponent.cpp +++ b/Source/CesiumRuntime/Private/CesiumGlobeAnchorComponent.cpp @@ -732,8 +732,7 @@ void UCesiumGlobeAnchorComponent::_updateFromNativeGlobeAnchor( glm::dmat4 anchorToLocal = nativeAnchor.getAnchorToLocalTransform( pGeoreference->GetCoordinateSystem()); - this->_setCurrentRelativeTransform( - FTransform(VecMath::createMatrix(anchorToLocal))); + this->_setCurrentRelativeTransform(VecMath::createTransform(anchorToLocal)); } else { this->_lastRelativeTransformIsValid = false; } diff --git a/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp b/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp index d82ae89dc..c899d71c8 100644 --- a/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp +++ b/Source/CesiumRuntime/Private/CesiumGltfComponent.cpp @@ -2040,8 +2040,7 @@ static void loadInstancingData( for (int64_t i = 0; i < count; ++i) { glm::dmat4 unrealMat = yInvertMatrix * instanceTransforms[i] * yInvertMatrix; - auto unrealFMatrix = VecMath::createMatrix(unrealMat); - result.InstanceTransforms[i].SetFromMatrix(unrealFMatrix); + result.InstanceTransforms[i] = VecMath::createTransform(unrealMat); } if (pInstanceFeatures) { result.pInstanceFeatures = diff --git a/Source/CesiumRuntime/Private/CesiumGltfPrimitiveComponent.cpp b/Source/CesiumRuntime/Private/CesiumGltfPrimitiveComponent.cpp index ddcd89caa..68951e5f9 100644 --- a/Source/CesiumRuntime/Private/CesiumGltfPrimitiveComponent.cpp +++ b/Source/CesiumRuntime/Private/CesiumGltfPrimitiveComponent.cpp @@ -107,8 +107,8 @@ bool UpdateTransformFromCesiumAux( const glm::dmat4& CesiumToUnrealTransform, CesiumComponent* cesiumComponent) { const CesiumPrimitiveData& primData = cesiumComponent->getPrimitiveData(); - const FTransform transform = FTransform(VecMath::createMatrix( - CesiumToUnrealTransform * primData.HighPrecisionNodeTransform)); + const FTransform transform = VecMath::createTransform( + CesiumToUnrealTransform * primData.HighPrecisionNodeTransform); if (cesiumComponent->Mobility == EComponentMobility::Movable) { // For movable objects, move the component in the normal way, but don't diff --git a/Source/CesiumRuntime/Private/CesiumIonServer.cpp b/Source/CesiumRuntime/Private/CesiumIonServer.cpp index 2cb67f241..d7d803ed5 100644 --- a/Source/CesiumRuntime/Private/CesiumIonServer.cpp +++ b/Source/CesiumRuntime/Private/CesiumIonServer.cpp @@ -15,6 +15,11 @@ #include "FileHelpers.h" #endif +const FString DISPLAY_NAME = TEXT("ion.cesium.com"); +const FString SERVER_URL = TEXT("https://ion.cesium.com"); +const FString API_URL = TEXT("https://api.cesium.com"); +const int64 OAUTH_APP_ID = 190; + /*static*/ UCesiumIonServer* UCesiumIonServer::_pDefaultForNewObjects = nullptr; /*static*/ UCesiumIonServer* UCesiumIonServer::GetDefaultServer() { @@ -35,10 +40,10 @@ nullptr, GWarn)); - Server->DisplayName = TEXT("ion.cesium.com"); - Server->ServerUrl = TEXT("https://ion.cesium.com"); - Server->ApiUrl = TEXT("https://api.cesium.com"); - Server->OAuth2ApplicationID = 190; + Server->DisplayName = DISPLAY_NAME; + Server->ServerUrl = SERVER_URL; + Server->ApiUrl = API_URL; + Server->OAuth2ApplicationID = OAUTH_APP_ID; FAssetRegistryModule::AssetCreated(Server); @@ -46,6 +51,18 @@ Package->SetDirtyFlag(true); UEditorLoadingAndSavingUtils::SavePackages({Package}, true); } +#else + if (!IsValid(Server)) { + Server = NewObject( + UCesiumIonServer::StaticClass(), + "CesiumIonSaaS", + RF_Public | RF_Standalone | RF_Transactional); + + Server->DisplayName = DISPLAY_NAME; + Server->ServerUrl = SERVER_URL; + Server->ApiUrl = API_URL; + Server->OAuth2ApplicationID = OAUTH_APP_ID; + } #endif return Server; diff --git a/Source/CesiumRuntime/Private/CesiumSampleHeightMostDetailedAsyncAction.cpp b/Source/CesiumRuntime/Private/CesiumSampleHeightMostDetailedAsyncAction.cpp index 24d06196f..5f1ad933f 100644 --- a/Source/CesiumRuntime/Private/CesiumSampleHeightMostDetailedAsyncAction.cpp +++ b/Source/CesiumRuntime/Private/CesiumSampleHeightMostDetailedAsyncAction.cpp @@ -16,13 +16,25 @@ UCesiumSampleHeightMostDetailedAsyncAction::SampleHeightMostDetailed( } void UCesiumSampleHeightMostDetailedAsyncAction::Activate() { - this->RegisterWithGameInstance(this->_pTileset); + if (!IsValid(this->_pTileset)) { + TArray Warnings; + Warnings.Push(TEXT( + "Invalid Tileset parameter passed to UCesiumSampleHeightMostDetailedAsyncAction, returning no results")); - this->_pTileset->SampleHeightMostDetailed( - this->_longitudeLatitudeHeightArray, - FCesiumSampleHeightMostDetailedCallback::CreateUObject( - this, - &UCesiumSampleHeightMostDetailedAsyncAction::RaiseOnHeightsSampled)); + this->RaiseOnHeightsSampled( + this->_pTileset, + TArray(), + Warnings); + } else { + this->RegisterWithGameInstance(this->_pTileset); + + this->_pTileset->SampleHeightMostDetailed( + this->_longitudeLatitudeHeightArray, + FCesiumSampleHeightMostDetailedCallback::CreateUObject( + this, + &UCesiumSampleHeightMostDetailedAsyncAction:: + RaiseOnHeightsSampled)); + } } void UCesiumSampleHeightMostDetailedAsyncAction::RaiseOnHeightsSampled( diff --git a/Source/CesiumRuntime/Private/CesiumSubLevelComponent.cpp b/Source/CesiumRuntime/Private/CesiumSubLevelComponent.cpp index 3831d70b9..c74f2959b 100644 --- a/Source/CesiumRuntime/Private/CesiumSubLevelComponent.cpp +++ b/Source/CesiumRuntime/Private/CesiumSubLevelComponent.cpp @@ -284,8 +284,7 @@ void UCesiumSubLevelComponent::PlaceOriginAtEcef(const FVector& NewOriginEcef) { } pOwner->Modify(); - pOwner->SetActorTransform( - FTransform(VecMath::createMatrix(NewLevelTransform))); + pOwner->SetActorTransform(VecMath::createTransform(NewLevelTransform)); // Set the new sub-level georeference origin. this->Modify(); @@ -355,7 +354,7 @@ void UCesiumSubLevelComponent::PlaceOriginAtEcef(const FVector& NewOriginEcef) { Tileset->Modify(); Root->Modify(); Root->SetRelativeTransform( - FTransform(VecMath::createMatrix(RelativeTransformInNew)), + VecMath::createTransform(RelativeTransformInNew), false, nullptr, ETeleportType::TeleportPhysics); diff --git a/Source/CesiumRuntime/Private/CesiumTileMapServiceRasterOverlay.cpp b/Source/CesiumRuntime/Private/CesiumTileMapServiceRasterOverlay.cpp index 8f0f7b2e3..769f182a5 100644 --- a/Source/CesiumRuntime/Private/CesiumTileMapServiceRasterOverlay.cpp +++ b/Source/CesiumRuntime/Private/CesiumTileMapServiceRasterOverlay.cpp @@ -17,10 +17,19 @@ UCesiumTileMapServiceRasterOverlay::CreateOverlay( tmsOptions.minimumLevel = MinimumLevel; tmsOptions.maximumLevel = MaximumLevel; } + + std::vector headers; + + for (const auto& [Key, Value] : this->RequestHeaders) { + headers.push_back(CesiumAsync::IAssetAccessor::THeader{ + TCHAR_TO_UTF8(*Key), + TCHAR_TO_UTF8(*Value)}); + } + return std::make_unique( TCHAR_TO_UTF8(*this->MaterialLayerKey), TCHAR_TO_UTF8(*this->Url), - std::vector(), + headers, tmsOptions, options); } diff --git a/Source/CesiumRuntime/Private/CesiumUrlTemplateRasterOverlay.cpp b/Source/CesiumRuntime/Private/CesiumUrlTemplateRasterOverlay.cpp index 095dcf133..2bebfa044 100644 --- a/Source/CesiumRuntime/Private/CesiumUrlTemplateRasterOverlay.cpp +++ b/Source/CesiumRuntime/Private/CesiumUrlTemplateRasterOverlay.cpp @@ -55,10 +55,18 @@ UCesiumUrlTemplateRasterOverlay::CreateOverlay( RootTilesY); } + std::vector headers; + + for (const auto& [Key, Value] : this->RequestHeaders) { + headers.push_back(CesiumAsync::IAssetAccessor::THeader{ + TCHAR_TO_UTF8(*Key), + TCHAR_TO_UTF8(*Value)}); + } + return std::make_unique( TCHAR_TO_UTF8(*this->MaterialLayerKey), TCHAR_TO_UTF8(*this->TemplateUrl), - std::vector(), + headers, urlTemplateOptions, options); } diff --git a/Source/CesiumRuntime/Private/CesiumWebMapServiceRasterOverlay.cpp b/Source/CesiumRuntime/Private/CesiumWebMapServiceRasterOverlay.cpp index 82da5dafa..2e5c53642 100644 --- a/Source/CesiumRuntime/Private/CesiumWebMapServiceRasterOverlay.cpp +++ b/Source/CesiumRuntime/Private/CesiumWebMapServiceRasterOverlay.cpp @@ -21,10 +21,19 @@ UCesiumWebMapServiceRasterOverlay::CreateOverlay( wmsOptions.layers = TCHAR_TO_UTF8(*Layers); wmsOptions.tileWidth = TileWidth; wmsOptions.tileHeight = TileHeight; + + std::vector headers; + + for (const auto& [Key, Value] : this->RequestHeaders) { + headers.push_back(CesiumAsync::IAssetAccessor::THeader{ + TCHAR_TO_UTF8(*Key), + TCHAR_TO_UTF8(*Value)}); + } + return std::make_unique( TCHAR_TO_UTF8(*this->MaterialLayerKey), TCHAR_TO_UTF8(*this->BaseUrl), - std::vector(), + headers, wmsOptions, options); } diff --git a/Source/CesiumRuntime/Private/CesiumWebMapTileServiceRasterOverlay.cpp b/Source/CesiumRuntime/Private/CesiumWebMapTileServiceRasterOverlay.cpp index ecefeca4c..1126246c3 100644 --- a/Source/CesiumRuntime/Private/CesiumWebMapTileServiceRasterOverlay.cpp +++ b/Source/CesiumRuntime/Private/CesiumWebMapTileServiceRasterOverlay.cpp @@ -103,10 +103,19 @@ UCesiumWebMapTileServiceRasterOverlay::CreateOverlay( wmtsOptions.tileMatrixLabels = labels; } } + + std::vector headers; + + for (const auto& [Key, Value] : this->RequestHeaders) { + headers.push_back(CesiumAsync::IAssetAccessor::THeader{ + TCHAR_TO_UTF8(*Key), + TCHAR_TO_UTF8(*Value)}); + } + return std::make_unique( TCHAR_TO_UTF8(*this->MaterialLayerKey), TCHAR_TO_UTF8(*this->BaseUrl), - std::vector(), + headers, wmtsOptions, options); } diff --git a/Source/CesiumRuntime/Private/GeoTransforms.cpp b/Source/CesiumRuntime/Private/GeoTransforms.cpp index 685975912..80629c534 100644 --- a/Source/CesiumRuntime/Private/GeoTransforms.cpp +++ b/Source/CesiumRuntime/Private/GeoTransforms.cpp @@ -8,7 +8,6 @@ #include "VecMath.h" #include -#define GLM_ENABLE_EXPERIMENTAL #include using namespace CesiumGeospatial; diff --git a/Source/CesiumRuntime/Private/Tests/SampleHeightMostDetailed.spec.cpp b/Source/CesiumRuntime/Private/Tests/SampleHeightMostDetailed.spec.cpp index 479e63beb..a0ed673ac 100644 --- a/Source/CesiumRuntime/Private/Tests/SampleHeightMostDetailed.spec.cpp +++ b/Source/CesiumRuntime/Private/Tests/SampleHeightMostDetailed.spec.cpp @@ -309,7 +309,7 @@ void FSampleHeightMostDetailedSpec::Define() { }); LatentIt( - "", + "invalid tileset URL", EAsyncExecution::TaskGraphMainThread, [this](const FDoneDelegate& done) { // Two slightly different error messages will occur, depending on @@ -354,5 +354,28 @@ void FSampleHeightMostDetailedSpec::Define() { done.ExecuteIfBound(); })); }); + + LatentIt( + "tileset parameter is nullptr", + EAsyncExecution::TaskGraphMainThread, + [this](const FDoneDelegate& done) { + UCesiumSampleHeightMostDetailedAsyncAction* pAsync = + UCesiumSampleHeightMostDetailedAsyncAction:: + SampleHeightMostDetailed( + nullptr, + {FVector(144.93406, -37.82457, 1.0)}); + + USampleHeightCallbackReceiver::Bind( + pAsync->OnHeightsSampled, + [this, done]( + const TArray& result, + const TArray& warnings) { + TestEqual("Number of results", result.Num(), 0); + TestEqual("Number of warnings", warnings.Num(), 1); + done.ExecuteIfBound(); + }); + + pAsync->Activate(); + }); }); } diff --git a/Source/CesiumRuntime/Private/Tests/VecMath.spec.cpp b/Source/CesiumRuntime/Private/Tests/VecMath.spec.cpp new file mode 100644 index 000000000..ce97ba63f --- /dev/null +++ b/Source/CesiumRuntime/Private/Tests/VecMath.spec.cpp @@ -0,0 +1,77 @@ +// Copyright 2020-2025 CesiumGS, Inc. and Contributors + +#include "VecMath.h" +#include "Misc/AutomationTest.h" + +BEGIN_DEFINE_SPEC( + FVecMathSpec, + "Cesium.Unit.VecMath", + EAutomationTestFlags::EditorContext | EAutomationTestFlags::ClientContext | + EAutomationTestFlags::ServerContext | + EAutomationTestFlags::CommandletContext | + EAutomationTestFlags::ProductFilter) +END_DEFINE_SPEC(FVecMathSpec) + +void FVecMathSpec::Define() { + Describe("createTransform", [this]() { + It("matches FMatrix -> FTransform for larger scales", [this]() { + FTransform original = FTransform( + FQuat::MakeFromRotator(FRotator(10.0, 20.0, 30.0)), + FVector(3000.0, 2000.0, 1000.0), + FVector(1.0, 2.0, 3.0)); + + FMatrix originalUnrealMatrix = original.ToMatrixWithScale(); + glm::dmat4 originalGlmMatrix = + VecMath::createMatrix4D(originalUnrealMatrix); + + FTransform viaUnrealMatrix = + FTransform(VecMath::createMatrix(originalGlmMatrix)); + FTransform viaVecMath = VecMath::createTransform(originalGlmMatrix); + + TestNearlyEqual( + TEXT("Translation"), + viaVecMath.GetTranslation(), + viaUnrealMatrix.GetTranslation(), + 1e-8); + TestNearlyEqual( + TEXT("Rotation"), + viaVecMath.GetRotation().Rotator(), + viaUnrealMatrix.GetRotation().Rotator(), + 1e-10); + TestNearlyEqual( + TEXT("Scale"), + viaVecMath.GetScale3D(), + viaUnrealMatrix.GetScale3D(), + 1e-11); + }); + + It("returns correct values when scale is small", [this]() { + FTransform original = FTransform( + FQuat::MakeFromRotator(FRotator(10.0, 20.0, 30.0)), + FVector(3000.0, 2000.0, 1000.0), + FVector(1e-7, 2e-7, 3e-7)); + + FMatrix originalUnrealMatrix = original.ToMatrixWithScale(); + glm::dmat4 originalGlmMatrix = + VecMath::createMatrix4D(originalUnrealMatrix); + + FTransform viaVecMath = VecMath::createTransform(originalGlmMatrix); + + TestNearlyEqual( + TEXT("Translation"), + viaVecMath.GetTranslation(), + original.GetTranslation(), + 1e-8); + TestNearlyEqual( + TEXT("Rotation"), + viaVecMath.GetRotation().Rotator(), + original.GetRotation().Rotator(), + 1e-10); + TestNearlyEqual( + TEXT("Scale"), + viaVecMath.GetScale3D(), + original.GetScale3D(), + 1e-18); + }); + }); +} diff --git a/Source/CesiumRuntime/Private/VecMath.cpp b/Source/CesiumRuntime/Private/VecMath.cpp index 87d46a352..cbfa08d83 100644 --- a/Source/CesiumRuntime/Private/VecMath.cpp +++ b/Source/CesiumRuntime/Private/VecMath.cpp @@ -2,9 +2,10 @@ #include "VecMath.h" -#include "CesiumUtility/Math.h" #include "Math/Quat.h" #include "Math/RotationMatrix.h" +#include +#include #include glm::dmat4 VecMath::createMatrix4D(const FMatrix& m) noexcept { @@ -123,6 +124,22 @@ FMatrix VecMath::createMatrix(const glm::dmat4& m) noexcept { FVector(m[3].x, m[3].y, m[3].z)); } +FTransform VecMath::createTransform(const glm::dmat4& m) noexcept { + glm::dvec3 translation; + glm::dquat rotation; + glm::dvec3 scale; + CesiumGeometry::Transforms::computeTranslationRotationScaleFromMatrix( + m, + &translation, + &rotation, + &scale); + + return FTransform( + VecMath::createQuaternion(rotation), + VecMath::createVector(translation), + VecMath::createVector(scale)); +} + FMatrix VecMath::createMatrix(const glm::dmat3& m) noexcept { return FMatrix( FVector(m[0].x, m[0].y, m[0].z), diff --git a/Source/CesiumRuntime/Private/VecMath.h b/Source/CesiumRuntime/Private/VecMath.h index d6b6ecc97..2ef3e6c08 100644 --- a/Source/CesiumRuntime/Private/VecMath.h +++ b/Source/CesiumRuntime/Private/VecMath.h @@ -143,11 +143,22 @@ class VecMath { /** * @brief Create a `FMatrix` from the given `glm` matrix. * + * If the ultimate goal is to create an `FTransform`, use + * {@link createTransform} instead. + * * @param m The `glm` matrix. * @return The `FMatrix`. */ static FMatrix createMatrix(const glm::dmat4& m) noexcept; + /** + * @brief Create a `FTransform` from the given `glm` matrix. + * + * @param m The `glm` matrix. + * @return The `FTransform`. + */ + static FTransform createTransform(const glm::dmat4& m) noexcept; + /** * @brief Create a `FMatrix` from the given `glm` columns * diff --git a/Source/CesiumRuntime/Public/Cesium3DTileset.h b/Source/CesiumRuntime/Public/Cesium3DTileset.h index 22f27eb83..b43084e25 100644 --- a/Source/CesiumRuntime/Public/Cesium3DTileset.h +++ b/Source/CesiumRuntime/Public/Cesium3DTileset.h @@ -764,6 +764,16 @@ class CESIUMRUNTIME_API ACesium3DTileset : public AActor { meta = (EditCondition = "TilesetSource==ETilesetSource::FromCesiumIon")) UCesiumIonServer* CesiumIonServer; + /** + * Headers to be attached to each request made for this tileset. + */ + UPROPERTY( + EditAnywhere, + BlueprintGetter = GetRequestHeaders, + BlueprintSetter = SetRequestHeaders, + Category = "Cesium") + TMap RequestHeaders; + /** * Check if the Cesium ion token used to access this tileset is working * correctly, and fix it if necessary. @@ -850,8 +860,7 @@ class CESIUMRUNTIME_API ACesium3DTileset : public AActor { EditAnywhere, BlueprintGetter = GetEnableWaterMask, BlueprintSetter = SetEnableWaterMask, - Category = "Cesium|Rendering", - meta = (EditCondition = "!bIsMac")) + Category = "Cesium|Rendering") bool EnableWaterMask = false; /** @@ -945,11 +954,6 @@ class CESIUMRUNTIME_API ACesium3DTileset : public AActor { UPROPERTY() FString PlatformName; -#if WITH_EDITORONLY_DATA - UPROPERTY() - bool bIsMac; -#endif - public: UFUNCTION(BlueprintGetter, Category = "Cesium") float GetLoadProgress() const { return LoadProgress; } @@ -972,6 +976,12 @@ class CESIUMRUNTIME_API ACesium3DTileset : public AActor { UFUNCTION(BlueprintSetter, Category = "Cesium") void SetUrl(const FString& InUrl); + UFUNCTION(BlueprintGetter, Category = "Cesium") + TMap GetRequestHeaders() const { return RequestHeaders; } + + UFUNCTION(BlueprintSetter, Category = "Cesium") + void SetRequestHeaders(const TMap& InRequestHeaders); + UFUNCTION(BlueprintGetter, Category = "Cesium") int64 GetIonAssetID() const { return IonAssetID; } @@ -1139,6 +1149,7 @@ class CESIUMRUNTIME_API ACesium3DTileset : public AActor { FPropertyChangedChainEvent& PropertyChangedChainEvent) override; virtual void PostEditUndo() override; virtual void PostEditImport() override; + virtual bool CanEditChange(const FProperty* InProperty) const override; #endif protected: diff --git a/Source/CesiumRuntime/Public/CesiumTileMapServiceRasterOverlay.h b/Source/CesiumRuntime/Public/CesiumTileMapServiceRasterOverlay.h index db64a15e1..be0aaa938 100644 --- a/Source/CesiumRuntime/Public/CesiumTileMapServiceRasterOverlay.h +++ b/Source/CesiumRuntime/Public/CesiumTileMapServiceRasterOverlay.h @@ -52,6 +52,12 @@ class CESIUMRUNTIME_API UCesiumTileMapServiceRasterOverlay meta = (EditCondition = "bSpecifyZoomLevels", ClampMin = 0)) int32 MaximumLevel = 10; + /** + * HTTP headers to be attached to each request made for this raster overlay. + */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium") + TMap RequestHeaders; + protected: virtual std::unique_ptr CreateOverlay( const CesiumRasterOverlays::RasterOverlayOptions& options = {}) override; diff --git a/Source/CesiumRuntime/Public/CesiumUrlTemplateRasterOverlay.h b/Source/CesiumRuntime/Public/CesiumUrlTemplateRasterOverlay.h index 7a6997505..dc2c396bd 100644 --- a/Source/CesiumRuntime/Public/CesiumUrlTemplateRasterOverlay.h +++ b/Source/CesiumRuntime/Public/CesiumUrlTemplateRasterOverlay.h @@ -220,6 +220,12 @@ class CESIUMRUNTIME_API UCesiumUrlTemplateRasterOverlay meta = (ClampMin = 64, ClampMax = 2048)) int32 TileHeight = 256; + /** + * HTTP headers to be attached to each request made for this raster overlay. + */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium") + TMap RequestHeaders; + protected: virtual std::unique_ptr CreateOverlay( const CesiumRasterOverlays::RasterOverlayOptions& options = {}) override; diff --git a/Source/CesiumRuntime/Public/CesiumWebMapServiceRasterOverlay.h b/Source/CesiumRuntime/Public/CesiumWebMapServiceRasterOverlay.h index 1b2f284b1..e052e34cc 100644 --- a/Source/CesiumRuntime/Public/CesiumWebMapServiceRasterOverlay.h +++ b/Source/CesiumRuntime/Public/CesiumWebMapServiceRasterOverlay.h @@ -75,6 +75,12 @@ class CESIUMRUNTIME_API UCesiumWebMapServiceRasterOverlay meta = (ClampMin = 0)) int32 MaximumLevel = 14; + /** + * HTTP headers to be attached to each request made for this raster overlay. + */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium") + TMap RequestHeaders; + protected: virtual std::unique_ptr CreateOverlay( const CesiumRasterOverlays::RasterOverlayOptions& options = {}) override; diff --git a/Source/CesiumRuntime/Public/CesiumWebMapTileServiceRasterOverlay.h b/Source/CesiumRuntime/Public/CesiumWebMapTileServiceRasterOverlay.h index 0a305dfc7..6cc2ced7e 100644 --- a/Source/CesiumRuntime/Public/CesiumWebMapTileServiceRasterOverlay.h +++ b/Source/CesiumRuntime/Public/CesiumWebMapTileServiceRasterOverlay.h @@ -267,6 +267,12 @@ class CESIUMRUNTIME_API UCesiumWebMapTileServiceRasterOverlay meta = (ClampMin = 64, ClampMax = 2048)) int32 TileHeight = 256; + /** + * HTTP headers to be attached to each request made for this raster overlay. + */ + UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cesium") + TMap RequestHeaders; + virtual void Serialize(FArchive& Ar) override; protected: diff --git a/extern/cesium-native b/extern/cesium-native index 4b3e558ee..5ec42ed41 160000 --- a/extern/cesium-native +++ b/extern/cesium-native @@ -1 +1 @@ -Subproject commit 4b3e558eec7bd8ac01a5b871eba2edce9a579d73 +Subproject commit 5ec42ed417db11061e6a82229eb588326d60edc9 diff --git a/extern/vcpkg-overlays/ktx/0005-no-vendored-libs.patch b/extern/vcpkg-overlays/ktx/0005-no-vendored-libs.patch index 77cdd8518..4c900225f 100644 --- a/extern/vcpkg-overlays/ktx/0005-no-vendored-libs.patch +++ b/extern/vcpkg-overlays/ktx/0005-no-vendored-libs.patch @@ -1,10 +1,10 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index d7ca937..ffcbe95 100644 +index e99fb143..0f69adf7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -1059,10 +1059,10 @@ endif() - # except for building the ktx library. +@@ -1071,10 +1071,10 @@ endif() if((KTX_FEATURE_TOOLS OR KTX_FEATURE_TESTS) AND NOT TARGET fmt::fmt) + set(FMT_INSTALL OFF) set(FMT_SYSTEM_HEADERS ON) - add_subdirectory(other_projects/fmt) + find_package(fmt CONFIG REQUIRED) diff --git a/extern/vcpkg-overlays/ktx/0006-fix-ios-install.patch b/extern/vcpkg-overlays/ktx/0006-fix-ios-install.patch new file mode 100644 index 000000000..0af3fea68 --- /dev/null +++ b/extern/vcpkg-overlays/ktx/0006-fix-ios-install.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e99fb143..072ea889 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -489,7 +489,7 @@ macro(common_libktx_settings target enable_write library_type) + CXX_STANDARD_REQUIRED YES + + ) +- if(IOS) ++ if(0) + set_target_properties(${target} PROPERTIES + FRAMEWORK TRUE + ) +@@ -1145,7 +1145,7 @@ endif() + # Use of this to install KHR/khr_df.h is due to CMake's failure to + # preserve the include source folder hierarchy. + # See https://gitlab.kitware.com/cmake/cmake/-/issues/16739. +-if (IOS) ++if (0) + set_source_files_properties( + include/KHR/khr_df.h + PROPERTIES MACOSX_PACKAGE_LOCATION Headers/KHR diff --git a/extern/vcpkg-overlays/ktx/CESIUM-0002-not-a-framework.patch b/extern/vcpkg-overlays/ktx/CESIUM-0002-not-a-framework.patch deleted file mode 100644 index 4458110f4..000000000 --- a/extern/vcpkg-overlays/ktx/CESIUM-0002-not-a-framework.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 7b13753..b62b849 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -474,9 +474,9 @@ macro(common_libktx_settings target enable_write library_type) - - ) - if(IOS) -- set_target_properties(${target} PROPERTIES -- FRAMEWORK TRUE -- ) -+# set_target_properties(${target} PROPERTIES -+# FRAMEWORK TRUE -+# ) - endif() - - if( NOT ${library_type} STREQUAL STATIC ) diff --git a/extern/vcpkg-overlays/ktx/CESIUM-0003-ios-normal-header-path.patch b/extern/vcpkg-overlays/ktx/CESIUM-0003-ios-normal-header-path.patch deleted file mode 100644 index 6ad9c9771..000000000 --- a/extern/vcpkg-overlays/ktx/CESIUM-0003-ios-normal-header-path.patch +++ /dev/null @@ -1,30 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index b62b849..d8c4745 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1133,18 +1133,18 @@ endif() - # Use of this to install KHR/khr_df.h is due to CMake's failure to - # preserve the include source folder hierarchy. - # See https://gitlab.kitware.com/cmake/cmake/-/issues/16739. --if (IOS) -- set_source_files_properties( -- include/KHR/khr_df.h -- PROPERTIES MACOSX_PACKAGE_LOCATION Headers/KHR -- ) --else() -+# if (IOS) -+# set_source_files_properties( -+# include/KHR/khr_df.h -+# PROPERTIES MACOSX_PACKAGE_LOCATION Headers/KHR -+# ) -+# else() - include(GNUInstallDirs) - install(FILES include/KHR/khr_df.h - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/KHR - COMPONENT dev - ) --endif() -+# endif() - - install(EXPORT KTXTargets - FILE KtxTargets.cmake diff --git a/extern/vcpkg-overlays/ktx/portfile.cmake b/extern/vcpkg-overlays/ktx/portfile.cmake index 40c64bbf2..887362c8f 100644 --- a/extern/vcpkg-overlays/ktx/portfile.cmake +++ b/extern/vcpkg-overlays/ktx/portfile.cmake @@ -1,18 +1,17 @@ -vcpkg_from_github( +vcpkg_from_git( OUT_SOURCE_PATH SOURCE_PATH - REPO KhronosGroup/KTX-Software - REF "v${VERSION}" - SHA512 5a89f8986464705ec36ac1becaddd0ff335e4c3c235468aaef0e963fcfeda4c0d669a086b91e61c16a3ae9e1fa5bf456dccf12cc65720e1a22e7cc0f30552541 - HEAD_REF master + URL "https://github.com/KhronosGroup/KTX-Software.git" + REF 91ace88675ac59a97e55d0378a6602a9ae6b98bd + FETCH_REF "v${VERSION}" + HEAD_REF main PATCHES 0001-Use-vcpkg-zstd.patch 0002-Fix-versioning.patch 0003-mkversion.patch 0004-quirks.patch 0005-no-vendored-libs.patch + 0006-fix-ios-install.patch CESIUM-0001-do-not-define-_DEBUG.patch - CESIUM-0002-not-a-framework.patch - CESIUM-0003-ios-normal-header-path.patch ) file(REMOVE "${SOURCE_PATH}/other_include/zstd_errors.h") @@ -50,8 +49,6 @@ vcpkg_cmake_configure( -DKTX_FEATURE_STATIC_LIBRARY=${ENABLE_STATIC} ${FEATURE_OPTIONS} ${OPTIONS} - # Do not regenerate headers (needs more dependencies) - -DCMAKE_DISABLE_FIND_PACKAGE_Vulkan=1 DISABLE_PARALLEL_CONFIGURE ) diff --git a/extern/vcpkg-overlays/ktx/vcpkg.json b/extern/vcpkg-overlays/ktx/vcpkg.json index 102e28131..94eea841c 100644 --- a/extern/vcpkg-overlays/ktx/vcpkg.json +++ b/extern/vcpkg-overlays/ktx/vcpkg.json @@ -1,7 +1,6 @@ { "name": "ktx", - "version-semver": "4.3.0-beta1", - "port-version": 1, + "version-semver": "4.3.2", "description": [ "The Khronos KTX library and tools.", "Functions for writing and reading KTX files, and instantiating OpenGL®, OpenGL ES™️ and Vulkan® textures from them." @@ -23,7 +22,7 @@ "features": { "tools": { "description": "Build tools", - "supports": "!android", + "supports": "!android & !uwp", "dependencies": [ "cxxopts", "fmt"