Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
efead0a
Parts of implementation using ada-url instead of uriparser
azrogers Jan 15, 2025
b397b06
Merge branch 'main' of github.com:CesiumGS/cesium-native into ada-url
azrogers Jan 16, 2025
9617622
Part of a Uri refactor
azrogers Jan 17, 2025
ad542c1
It's working!?
azrogers Jan 17, 2025
6fe2fdf
Document methods
azrogers Jan 17, 2025
f57f7d9
Remove cruft
azrogers Jan 17, 2025
45d9d7f
Merge from main
azrogers Jan 17, 2025
6115d11
Format
azrogers Jan 17, 2025
eadf419
Fix clang-tidy issues
azrogers Jan 17, 2025
887f981
Fix Doxygen issues
azrogers Jan 17, 2025
68aebad
Remove find_package(uriparser)
kring Jan 19, 2025
78f0f40
Re-add uriparser for now, and fix macOS compile error.
kring Jan 19, 2025
e777426
Fix CI issues
azrogers Jan 21, 2025
38c1e31
Format
azrogers Jan 21, 2025
ea46377
Rewrite substituteTemplateParameters to work with encoded brackets
azrogers Jan 23, 2025
605ea5a
Format
azrogers Jan 23, 2025
40d4ba9
Merge branch 'main' of github.com:CesiumGS/cesium-native into ada-url
azrogers Jan 23, 2025
84cc7c7
Merge branch 'main' of github.com:CesiumGS/cesium-native into ada-url
azrogers Jan 23, 2025
8c84337
A few more tests for edge cases, regex implementation
azrogers Jan 24, 2025
4b3e558
Merge branch 'main' of github.com:CesiumGS/cesium-native into ada-url
azrogers Jan 24, 2025
369d3a8
Merge remote-tracking branch 'origin/main' into ada-url
kring Jan 28, 2025
17eefa1
Substitute placeholders before manipulating layer.json URLs.
kring Jan 28, 2025
158de7e
Merge branch 'main' of github.com:CesiumGS/cesium-native into ada-url
azrogers Jan 28, 2025
9789911
Address most of review
azrogers Jan 28, 2025
9e032f8
Merge pull request #1084 from CesiumGS/ada-url-substitute-first
azrogers Jan 28, 2025
cb18f76
Return to previous substitution logic
azrogers Jan 28, 2025
7006b81
Remove uriparser, format, etc
azrogers Jan 28, 2025
3d5d39d
Update dependency graphs
azrogers Jan 28, 2025
c3a18c6
Format
azrogers Jan 28, 2025
1c4e4c2
Merge from main
azrogers Jan 29, 2025
db5868a
Address review comments
azrogers Jan 29, 2025
46ad1ac
Separate query handling from Uri
azrogers Jan 29, 2025
cea035d
Fix clang-tidy header warning
azrogers Jan 30, 2025
b0a16d2
Fix docs
azrogers Jan 30, 2025
f34c8fe
Format
azrogers Jan 30, 2025
eb016f0
Rename UriQueryParams -> UriQuery
azrogers Jan 31, 2025
9263109
Merge remote-tracking branch 'origin/main' into ada-url
kring Feb 1, 2025
8d319e4
Correct comment that is no longer true.
kring Feb 1, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- Fixed a bug in `SharedAssetDepot` that could cause assertion failures in debug builds, and could rarely cause premature deletion of shared assets even in release builds.
- Fixed a bug that could cause `Tileset::sampleHeightMostDetailed` to return a height that is not the highest one when the sampled tileset contained multiple heights at the given location.
- `LayerJsonTerrainLoader` will now log errors and warnings when failing to load a `.terrain` file referenced in the layer.json, instead of silently ignoring them.
- URIs containing unicode characters are now supported.
- Fixed a crash in `CullingVolume` when the camera was very far away from the globe.

### v0.43.0 - 2025-01-02
Expand Down
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ message(STATUS "VCPKG_OVERLAY_TRIPLETS ${VCPKG_OVERLAY_TRIPLETS}")
# These packages are used in the public headers of Cesium libraries, so we need to distribute the headers and binaries
# with the installation
# Note that fmt is a public dependency of the vcpkg version of spdlog
# STB and uriparser aren't technically part of the public interface, but they're used by the downstream Cesium for Unreal project
set(PACKAGES_PUBLIC asyncplusplus expected-lite fmt glm rapidjson spdlog stb uriparser)
# STB is not technically part of the public interface, but it is used by the downstream Cesium for Unreal project
set(PACKAGES_PUBLIC asyncplusplus expected-lite fmt glm rapidjson spdlog stb ada-url)
# These packages are used in the code and produce binaries, but are not part of the public interface. Therefore we need
# to distribute the binaries for linking, but not the headers, as downstream consumers don't need them
# OpenSSL and abseil are both dependencies of s2geometry
Expand Down Expand Up @@ -257,8 +257,8 @@ find_package(s2 CONFIG REQUIRED)
find_package(spdlog CONFIG REQUIRED)
find_package(tinyxml2 CONFIG REQUIRED)
find_package(unofficial-sqlite3 CONFIG REQUIRED)
find_package(uriparser CONFIG REQUIRED char wchar_t)
find_package(WebP CONFIG REQUIRED)
find_package(ada CONFIG REQUIRED)


# Private Library (s2geometry)
Expand Down
1 change: 0 additions & 1 deletion Cesium3DTilesSelection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ target_link_libraries(Cesium3DTilesSelection
CesiumUtility
spdlog::spdlog spdlog::spdlog_header_only
# PRIVATE
uriparser::uriparser
libmorton::libmorton
draco::draco
nonstd::expected-lite
Expand Down
22 changes: 13 additions & 9 deletions Cesium3DTilesSelection/src/LayerJsonTerrainLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -340,13 +340,6 @@ Future<LoadLayersResult> loadLayersRecursive(
std::string extensionsToRequest =
createExtensionsQueryParameter(knownExtensions, extensions);

if (!extensionsToRequest.empty()) {
for (std::string& url : urls) {
url =
CesiumUtility::Uri::addQuery(url, "extensions", extensionsToRequest);
}
}

const auto availabilityLevelsIt =
layerJson.FindMember("metadataAvailability");

Expand Down Expand Up @@ -379,6 +372,7 @@ Future<LoadLayersResult> loadLayersRecursive(
baseUrl,
std::move(version),
std::move(urls),
std::move(extensionsToRequest),
std::move(availability),
static_cast<uint32_t>(maxZoom),
availabilityLevels);
Expand Down Expand Up @@ -648,12 +642,14 @@ LayerJsonTerrainLoader::Layer::Layer(
const std::string& baseUrl_,
std::string&& version_,
std::vector<std::string>&& tileTemplateUrls_,
std::string&& extensionsToRequest_,
CesiumGeometry::QuadtreeRectangleAvailability&& contentAvailability_,
uint32_t maxZooms_,
int32_t availabilityLevels_)
: baseUrl{baseUrl_},
version{std::move(version_)},
tileTemplateUrls{std::move(tileTemplateUrls_)},
extensionsToRequest{std::move(extensionsToRequest_)},
contentAvailability{std::move(contentAvailability_)},
loadedSubtrees(maxSubtreeInLayer(maxZooms_, availabilityLevels_)),
availabilityLevels{availabilityLevels_} {}
Expand All @@ -675,9 +671,9 @@ std::string resolveTileUrl(
return std::string();
}

return CesiumUtility::Uri::resolve(
Uri uri(
layer.baseUrl,
CesiumUtility::Uri::substituteTemplateParameters(
Uri::substituteTemplateParameters(
layer.tileTemplateUrls[0],
[&tileID, &layer](const std::string& placeholder) -> std::string {
if (placeholder == "level" || placeholder == "z") {
Expand All @@ -695,6 +691,14 @@ std::string resolveTileUrl(

return placeholder;
}));

if (!layer.extensionsToRequest.empty()) {
UriQuery params(uri);
params.setValue("extensions", layer.extensionsToRequest);
uri.setQuery(params.toQueryString());
}

return uri.toString();
}

Future<QuantizedMeshLoadResult> requestTileContent(
Expand Down
2 changes: 2 additions & 0 deletions Cesium3DTilesSelection/src/LayerJsonTerrainLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@ class LayerJsonTerrainLoader : public TilesetContentLoader {
const std::string& baseUrl,
std::string&& version,
std::vector<std::string>&& tileTemplateUrls,
std::string&& extensionsToRequest,
CesiumGeometry::QuadtreeRectangleAvailability&& contentAvailability,
uint32_t maxZooms,
int32_t availabilityLevels);

std::string baseUrl;
std::string version;
std::vector<std::string> tileTemplateUrls;
std::string extensionsToRequest;
CesiumGeometry::QuadtreeRectangleAvailability contentAvailability;
std::vector<std::unordered_set<uint64_t>> loadedSubtrees;
int32_t availabilityLevels;
Expand Down
25 changes: 17 additions & 8 deletions Cesium3DTilesSelection/test/TestLayerJsonTerrainLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ TEST_CASE("Test create layer json terrain loader") {
CHECK(layers[0].version == "1.33.0");
CHECK(
layers[0].tileTemplateUrls.front() ==
"{z}/{x}/{y}.terrain?v={version}&extensions=octvertexnormals-metadata");
"{z}/{x}/{y}.terrain?v={version}");
CHECK(layers[0].extensionsToRequest == "octvertexnormals-metadata");
CHECK(layers[0].loadedSubtrees.size() == 2);
CHECK(layers[0].availabilityLevels == 10);
}
Expand Down Expand Up @@ -299,7 +300,8 @@ TEST_CASE("Test create layer json terrain loader") {
CHECK(layers[0].version == "1.0.0");
CHECK(
layers[0].tileTemplateUrls.front() ==
"{z}/{x}/{y}.terrain?v={version}&extensions=octvertexnormals");
"{z}/{x}/{y}.terrain?v={version}");
CHECK(layers[0].extensionsToRequest == "octvertexnormals");
CHECK(layers[0].loadedSubtrees.empty());
CHECK(layers[0].availabilityLevels == -1);

Expand All @@ -322,7 +324,7 @@ TEST_CASE("Test create layer json terrain loader") {
auto parentJsonPath =
testDataPath / "CesiumTerrainTileJson" / "Parent.tile.json";
pMockedAssetAccessor->mockCompletedRequests.insert(
{"./Parent/layer.json", createMockAssetRequest(parentJsonPath)});
{"Parent/layer.json", createMockAssetRequest(parentJsonPath)});

auto loaderFuture =
LayerJsonTerrainLoader::createLoader(externals, {}, "layer.json", {});
Expand Down Expand Up @@ -418,10 +420,8 @@ TEST_CASE("Test create layer json terrain loader") {
const auto& layers = loaderResult.pLoader->getLayers();
CHECK(layers.size() == 1);
CHECK(layers[0].tileTemplateUrls.size() == 1);
CHECK(
layers[0].tileTemplateUrls[0] ==
"{z}/{x}/"
"{y}.terrain?v={version}&extensions=octvertexnormals-watermask");
CHECK(layers[0].tileTemplateUrls[0] == "{z}/{x}/{y}.terrain?v={version}");
CHECK(layers[0].extensionsToRequest == "octvertexnormals-watermask");
}
}

Expand Down Expand Up @@ -452,6 +452,7 @@ TEST_CASE("Test load layer json tile content") {
"layer.json",
"1.0.0",
std::vector<std::string>{"{level}.{x}.{y}/{version}.terrain"},
"one-two",
std::move(contentAvailability),
maxZoom,
10);
Expand All @@ -460,7 +461,7 @@ TEST_CASE("Test load layer json tile content") {

// mock tile content request
pMockedAssetAccessor->mockCompletedRequests.insert(
{"0.0.0/1.0.0.terrain",
{"0.0.0/1.0.0.terrain?extensions=one-two",
createMockAssetRequest(
testDataPath / "CesiumTerrainTileJson" /
"tile.metadataavailability.terrain")});
Expand Down Expand Up @@ -502,6 +503,7 @@ TEST_CASE("Test load layer json tile content") {
"layer.json",
"1.0.0",
std::vector<std::string>{"{level}.{x}.{y}/{version}.terrain"},
std::string(),
std::move(contentAvailability),
maxZoom,
-1);
Expand Down Expand Up @@ -563,6 +565,7 @@ TEST_CASE("Test load layer json tile content") {
"layer.json",
"1.0.0",
std::vector<std::string>{"{level}.{x}.{y}/{version}_layer0.terrain"},
std::string(),
std::move(layer0ContentAvailability),
maxZoom,
-1);
Expand All @@ -577,6 +580,7 @@ TEST_CASE("Test load layer json tile content") {
"layer.json",
"1.0.0",
std::vector<std::string>{"{level}.{x}.{y}/{version}_layer1.terrain"},
std::string(),
std::move(layer1ContentAvailability),
maxZoom,
-1);
Expand Down Expand Up @@ -639,6 +643,7 @@ TEST_CASE("Test load layer json tile content") {
"layer.json",
"1.0.0",
std::vector<std::string>{"{level}.{x}.{y}/{version}_layer0.terrain"},
std::string(),
std::move(layer0ContentAvailability),
maxZoom,
10);
Expand All @@ -650,6 +655,7 @@ TEST_CASE("Test load layer json tile content") {
"layer.json",
"1.0.0",
std::vector<std::string>{"{level}.{x}.{y}/{version}_layer1.terrain"},
std::string(),
std::move(layer1ContentAvailability),
maxZoom,
10);
Expand Down Expand Up @@ -724,6 +730,7 @@ TEST_CASE("Test load layer json tile content") {
"layer.json",
"1.0.0",
std::vector<std::string>{"{level}.{x}.{y}/{version}.terrain"},
std::string{},
std::move(contentAvailability),
maxZoom,
10);
Expand Down Expand Up @@ -784,6 +791,7 @@ TEST_CASE("Test creating tile children for layer json") {
"layer.json",
"1.0.0",
std::vector<std::string>{"{level}.{x}.{y}/{version}_layer0.terrain"},
std::string(),
std::move(layer0ContentAvailability),
maxZoom,
10);
Expand All @@ -799,6 +807,7 @@ TEST_CASE("Test creating tile children for layer json") {
"layer.json",
"1.0.0",
std::vector<std::string>{"{level}.{x}.{y}/{version}_layer1.terrain"},
std::string(),
std::move(layer1ContentAvailability),
maxZoom,
10);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"geometricError": 0,
"refine": "ADD",
"content": {
"uri": "tileset3/ll.b3dm"
"uri": "ll.b3dm"
}
}
}
21 changes: 9 additions & 12 deletions CesiumIonClient/src/Connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
#include <rapidjson/rapidjson.h>
#include <rapidjson/stringbuffer.h>
#include <rapidjson/writer.h>
#include <uriparser/Uri.h>
#include <uriparser/UriBase.h>

#include <algorithm>
#include <cstddef>
Expand Down Expand Up @@ -495,19 +493,18 @@ Asset jsonToAsset(const rapidjson::Value& item) {
}

std::optional<std::string> generateApiUrl(const std::string& ionUrl) {
UriUriA newUri;
if (uriParseSingleUriA(&newUri, ionUrl.c_str(), nullptr) != URI_SUCCESS) {
return std::optional<std::string>();
Uri parsedIonUrl(ionUrl);
if (!parsedIonUrl) {
return std::nullopt;
}

std::string hostName =
std::string(newUri.hostText.first, newUri.hostText.afterLast);
std::string scheme =
std::string(newUri.scheme.first, newUri.scheme.afterLast);

uriFreeUriMembersA(&newUri);
std::string url;
url.append(parsedIonUrl.getScheme());
url.append("//api.");
url.append(parsedIonUrl.getHost());
url.append("/");

return std::make_optional<std::string>(scheme + "://api." + hostName + '/');
return url;
}

} // namespace
Expand Down
2 changes: 1 addition & 1 deletion CesiumUtility/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ target_link_libraries(
zlib-ng::zlib-ng
spdlog::spdlog
glm::glm
uriparser::uriparser
ada::ada
)
Loading