Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@

### ? - ?

##### Breaking Changes :mega:

- `CesiumRasterOverlays::GeoJsonDocumentRasterOverlay` has been moved to the `CesiumVectorOverlays` library and namespace.

##### Additions :tada:

- Added support for [`EXT_mesh_primitive_edge_visibility`](https://github.com/KhronosGroup/glTF/pull/2479) in `CesiumGltf`, `CesiumGltfReader`, and `CesiumGltfWriter`.
- Added support for [`3DTILES_content_conditional`](https://github.com/CesiumGS/3d-tiles/pull/834) in `Cesium3DTiles`, `Cesium3DTilesReader`, and `Cesium3DTilesWriter`.
- Added `CesiumVectorOverlays::VectorTilesRasterOverlay` supporting vector data loaded from 3D Tiles tilesets.

### v0.60.0 - 2026-05-01

Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,7 @@ add_subdirectory(CesiumIonClient)
add_subdirectory(CesiumITwinClient)
add_subdirectory(CesiumQuantizedMeshTerrain)
add_subdirectory(CesiumVectorData)
add_subdirectory(CesiumVectorOverlays)

if(NOT CESIUM_DISABLE_CURL)
add_subdirectory(CesiumCurl)
Expand Down
1 change: 0 additions & 1 deletion Cesium3DTilesSelection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ target_link_libraries(Cesium3DTilesSelection
CesiumQuantizedMeshTerrain
CesiumRasterOverlays
CesiumUtility
CesiumVectorData
spdlog::spdlog
# PRIVATE
libmorton::libmorton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,8 @@ class CESIUM3DTILESSELECTION_API RasterOverlayCollection final {
*/
size_t size() const noexcept;

void tick() noexcept;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't appear to be used. The Tileset just calls ActivateRasterOverlay::tick directly.


private:
struct GetOverlayFunctor {
CesiumUtility::IntrusivePointer<const CesiumRasterOverlays::RasterOverlay>
Expand All @@ -244,6 +246,9 @@ class CESIUM3DTILESSELECTION_API RasterOverlayCollection final {
std::vector<CesiumUtility::IntrusivePointer<
CesiumRasterOverlays::ActivatedRasterOverlay>>
_activatedOverlays;
std::vector<CesiumUtility::IntrusivePointer<
CesiumRasterOverlays::ActivatedRasterOverlay>>
_tickableOverlays;

CESIUM_TRACE_DECLARE_TRACK_SET(_loadingSlots, "Raster Overlay Loading Slot")
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#pragma once

#include "RasterOverlayUpsampler.h"

#include <Cesium3DTilesSelection/CesiumIonTilesetContentLoaderFactory.h>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer not to make TilesetContentManager part of the public API. Almost everything you need it for can also be achieved through Tileset. Expand and refactor that class, if necessary.

I guess it's worth considering what is the actual separation of concerns here. Originally, there was no TilesetContentManager; everything was in Tileset. When Bao introduced the TilesetContentManager, he described it like this:

Previously Tileset and Tile are used to set the state machine of Tile. Now only TilesetContentManager will take care of that. Its responsibilities consists of loading tile content (by using TilesetContentLoader), managing tile loading state machine, and unloading tile. No ones except the TilesetContentManager can set the state of the tile now

So the content manager handled tile content state transitions (loading/unloading, basically) and the Tileset handled the rest. Where "the rest" was mostly the selection algorithm and the public entry points to the content manager.

Now with #1342, we're talking about moving the selection algorith out of Tileset, too.

What's left? Not much I guess, but I think it's still serving a useful purpose as the public API representation of a Tileset, even if almost everything it does is delegated. By exposing TilesetContentManager, we a) need to give a lot more thought to its public API, because very little has gone into it, and b) are committing to maintaining it (yes, our deprecation policy doesn't strictly require we avoid breakage, but we still should avoid it wherever possibe).

#include <Cesium3DTilesSelection/RasterOverlayCollection.h>
#include <Cesium3DTilesSelection/RasterOverlayUpsampler.h>
#include <Cesium3DTilesSelection/Tile.h>
#include <Cesium3DTilesSelection/TileContent.h>
#include <Cesium3DTilesSelection/TilesetContentLoader.h>
Expand Down
3 changes: 1 addition & 2 deletions Cesium3DTilesSelection/src/GltfModifier.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#include "TilesetContentManager.h"

#include <Cesium3DTilesSelection/GltfModifier.h>
#include <Cesium3DTilesSelection/GltfModifierState.h>
#include <Cesium3DTilesSelection/GltfModifierVersionExtension.h>
#include <Cesium3DTilesSelection/LoadedTileEnumerator.h>
#include <Cesium3DTilesSelection/Tile.h>
#include <Cesium3DTilesSelection/TileContent.h>
#include <Cesium3DTilesSelection/TileLoadRequester.h>
#include <Cesium3DTilesSelection/TilesetContentManager.h>
#include <Cesium3DTilesSelection/TilesetExternals.h>
#include <CesiumAsync/AsyncSystem.h>
#include <CesiumAsync/Future.h>
Expand Down
23 changes: 22 additions & 1 deletion Cesium3DTilesSelection/src/RasterOverlayCollection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ RasterOverlayCollection::RasterOverlayCollection(
: _loadedTiles(loadedTiles),
_externals{externals},
_ellipsoid(ellipsoid),
_activatedOverlays() {}
_activatedOverlays(),
_tickableOverlays() {}

RasterOverlayCollection::~RasterOverlayCollection() noexcept {
for (int64_t i = static_cast<int64_t>(this->_activatedOverlays.size()) - 1;
Expand Down Expand Up @@ -64,6 +65,10 @@ void RasterOverlayCollection::add(
.pLogger = this->_externals.pLogger},
this->_ellipsoid));

if (this->_activatedOverlays.back()->isTickable()) {
this->_tickableOverlays.emplace_back(this->_activatedOverlays.back());
}

CesiumRasterOverlays::RasterOverlayTile* pPlaceholderTile =
this->_activatedOverlays.back()->getPlaceholderTile();

Expand Down Expand Up @@ -151,6 +156,16 @@ void RasterOverlayCollection::remove(
}

this->_activatedOverlays.erase(it);

it = std::find(
this->_tickableOverlays.begin(),
this->_tickableOverlays.end(),
pActivated);
if (it == this->_tickableOverlays.end()) {
return;
}

this->_tickableOverlays.erase(it);
}

std::vector<CesiumGeospatial::Projection>
Expand Down Expand Up @@ -259,4 +274,10 @@ size_t RasterOverlayCollection::size() const noexcept {
return this->_activatedOverlays.size();
}

void RasterOverlayCollection::tick() noexcept {
for (const auto& pOverlay : this->_tickableOverlays) {
pOverlay->tick();
}
}

} // namespace Cesium3DTilesSelection
3 changes: 1 addition & 2 deletions Cesium3DTilesSelection/src/RasterOverlayUpsampler.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "RasterOverlayUpsampler.h"

#include <Cesium3DTilesSelection/RasterMappedTo3DTile.h>
#include <Cesium3DTilesSelection/RasterOverlayUpsampler.h>
#include <Cesium3DTilesSelection/Tile.h>
#include <Cesium3DTilesSelection/TileContent.h>
#include <Cesium3DTilesSelection/TileLoadResult.h>
Expand Down
3 changes: 1 addition & 2 deletions Cesium3DTilesSelection/src/Tile.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include "TilesetContentManager.h"

#include <Cesium3DTilesSelection/GltfModifier.h>
#include <Cesium3DTilesSelection/GltfModifierVersionExtension.h>
#include <Cesium3DTilesSelection/RasterMappedTo3DTile.h>
Expand All @@ -8,6 +6,7 @@
#include <Cesium3DTilesSelection/TileID.h>
#include <Cesium3DTilesSelection/TileRefine.h>
#include <Cesium3DTilesSelection/TilesetContentLoader.h>
#include <Cesium3DTilesSelection/TilesetContentManager.h>
#include <CesiumGltf/Buffer.h>
#include <CesiumGltf/BufferView.h>
#include <CesiumGltf/Image.h>
Expand Down
3 changes: 1 addition & 2 deletions Cesium3DTilesSelection/src/TileLoadRequester.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "TilesetContentManager.h"

#include <Cesium3DTilesSelection/TileLoadRequester.h>
#include <Cesium3DTilesSelection/TilesetContentManager.h>
#include <CesiumUtility/Assert.h>

#include <utility>
Expand Down
8 changes: 7 additions & 1 deletion Cesium3DTilesSelection/src/Tileset.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "TilesetContentManager.h"
#include "TilesetHeightQuery.h"

#include <Cesium3DTilesSelection/BoundingVolume.h>
Expand All @@ -15,6 +14,7 @@
#include <Cesium3DTilesSelection/Tileset.h>
#include <Cesium3DTilesSelection/TilesetContentLoader.h>
#include <Cesium3DTilesSelection/TilesetContentLoaderFactory.h>
#include <Cesium3DTilesSelection/TilesetContentManager.h>
#include <Cesium3DTilesSelection/TilesetExternals.h>
#include <Cesium3DTilesSelection/TilesetFrameState.h>
#include <Cesium3DTilesSelection/TilesetMetadata.h>
Expand All @@ -28,6 +28,7 @@
#include <CesiumGeospatial/Cartographic.h>
#include <CesiumGeospatial/Ellipsoid.h>
#include <CesiumGeospatial/GlobeRectangle.h>
#include <CesiumRasterOverlays/ActivatedRasterOverlay.h>
#include <CesiumRasterOverlays/RasterOverlayTile.h>
#include <CesiumUtility/Assert.h>
#include <CesiumUtility/CreditSystem.h>
Expand Down Expand Up @@ -472,6 +473,11 @@ void Tileset::loadTiles() {
this->_pTilesetContentManager->processWorkerThreadLoadRequests(
this->_options);
this->_pTilesetContentManager->processMainThreadLoadRequests(this->_options);
for (const IntrusivePointer<ActivatedRasterOverlay>& pOverlay :
this->_pTilesetContentManager->getRasterOverlayCollection()
.getActivatedOverlays()) {
pOverlay->tick();
}
}

void Tileset::registerLoadRequester(TileLoadRequester& requester) {
Expand Down
3 changes: 1 addition & 2 deletions Cesium3DTilesSelection/src/TilesetContentLoader.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#include "TilesetContentManager.h"

#include <Cesium3DTilesSelection/TileContent.h>
#include <Cesium3DTilesSelection/TileLoadResult.h>
#include <Cesium3DTilesSelection/TilesetContentLoader.h>
#include <Cesium3DTilesSelection/TilesetContentManager.h>
#include <Cesium3DTilesSelection/TilesetOptions.h>
#include <CesiumAsync/AsyncSystem.h>
#include <CesiumAsync/IAssetAccessor.h>
Expand Down
5 changes: 2 additions & 3 deletions Cesium3DTilesSelection/src/TilesetContentManager.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
#include "TilesetContentManager.h"

#include "LayerJsonTerrainLoader.h"
#include "RasterOverlayUpsampler.h"
#include "TileContentLoadInfo.h"
#include "TilesetJsonLoader.h"

Expand All @@ -12,6 +9,7 @@
#include <Cesium3DTilesSelection/IPrepareRendererResources.h>
#include <Cesium3DTilesSelection/RasterMappedTo3DTile.h>
#include <Cesium3DTilesSelection/RasterOverlayCollection.h>
#include <Cesium3DTilesSelection/RasterOverlayUpsampler.h>
#include <Cesium3DTilesSelection/Tile.h>
#include <Cesium3DTilesSelection/TileContent.h>
#include <Cesium3DTilesSelection/TileID.h>
Expand All @@ -21,6 +19,7 @@
#include <Cesium3DTilesSelection/TilesetContentLoader.h>
#include <Cesium3DTilesSelection/TilesetContentLoaderFactory.h>
#include <Cesium3DTilesSelection/TilesetContentLoaderResult.h>
#include <Cesium3DTilesSelection/TilesetContentManager.h>
#include <Cesium3DTilesSelection/TilesetExternals.h>
#include <Cesium3DTilesSelection/TilesetLoadFailureDetails.h>
#include <Cesium3DTilesSelection/TilesetOptions.h>
Expand Down
3 changes: 1 addition & 2 deletions Cesium3DTilesSelection/src/TilesetHeightQuery.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#include "TilesetHeightQuery.h"

#include "TilesetContentManager.h"

#include <Cesium3DTilesSelection/BoundingVolume.h>
#include <Cesium3DTilesSelection/ITilesetHeightSampler.h>
#include <Cesium3DTilesSelection/SampleHeightResult.h>
#include <Cesium3DTilesSelection/Tile.h>
#include <Cesium3DTilesSelection/TileContent.h>
#include <Cesium3DTilesSelection/TileRefine.h>
#include <Cesium3DTilesSelection/TilesetContentManager.h>
#include <CesiumAsync/Promise.h>
#include <CesiumGeometry/BoundingCylinderRegion.h>
#include <CesiumGeometry/IntersectionTests.h>
Expand Down
2 changes: 1 addition & 1 deletion Cesium3DTilesSelection/test/TestGltfModifier.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include "MockTilesetContentManager.h"
#include "TilesetContentManager.h"

#include <Cesium3DTilesSelection/EllipsoidTilesetLoader.h>
#include <Cesium3DTilesSelection/GltfModifier.h>
#include <Cesium3DTilesSelection/GltfModifierVersionExtension.h>
#include <Cesium3DTilesSelection/Tile.h>
#include <Cesium3DTilesSelection/TileContent.h>
#include <Cesium3DTilesSelection/TileLoadRequester.h>
#include <Cesium3DTilesSelection/TilesetContentManager.h>
#include <CesiumGeometry/BoundingSphere.h>
#include <CesiumGltf/Model.h>
#include <CesiumNativeTests/SimpleAssetAccessor.h>
Expand Down
2 changes: 1 addition & 1 deletion Cesium3DTilesSelection/test/TestTilesetContentManager.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include "SimplePrepareRendererResource.h"
#include "TestTilesetJsonLoader.h"
#include "TilesetContentManager.h"
#include "TilesetJsonLoader.h"

#include <Cesium3DTilesContent/registerAllTileContentTypes.h>
Expand All @@ -11,6 +10,7 @@
#include <Cesium3DTilesSelection/TileLoadResult.h>
#include <Cesium3DTilesSelection/TileRefine.h>
#include <Cesium3DTilesSelection/TilesetContentLoader.h>
#include <Cesium3DTilesSelection/TilesetContentManager.h>
#include <Cesium3DTilesSelection/TilesetExternals.h>
#include <Cesium3DTilesSelection/TilesetOptions.h>
#include <CesiumAsync/Future.h>
Expand Down
13 changes: 13 additions & 0 deletions CesiumGeospatial/include/CesiumGeospatial/CartographicPolygon.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,19 @@ class CESIUMGEOSPATIAL_API CartographicPolygon final {
*/
CartographicPolygon(const std::vector<glm::dvec2>& polygon);

/**
* @brief Constructs a 2D polygon that can be rasterized onto {@link Cesium3DTilesSelection::Tileset}
* objects.
*
* @param vertices An array of longitude-latitude points in radians defining
* the perimeter of the 2D polygon.
* @param indices An array of indices representing a triangle decomposition of
* the polygon. The indices are in reference to the `vertices` array.
*/
CartographicPolygon(
std::vector<glm::dvec2>&& vertices,
std::vector<uint32_t>&& indices);

/**
* @brief Returns the longitude-latitude vertices that define the
* perimeter of the selected polygon.
Expand Down
7 changes: 7 additions & 0 deletions CesiumGeospatial/src/CartographicPolygon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ CartographicPolygon::CartographicPolygon(const std::vector<glm::dvec2>& polygon)
_indices(triangulatePolygon(polygon)),
_boundingRectangle(computeBoundingRectangle(polygon)) {}

CartographicPolygon::CartographicPolygon(
std::vector<glm::dvec2>&& polygon,
std::vector<uint32_t>&& indices)
: _vertices(std::move(polygon)),
_indices(std::move(indices)),
_boundingRectangle(computeBoundingRectangle(this->_vertices)) {}

/*static*/ bool CartographicPolygon::rectangleIsWithinPolygons(
const CesiumGeospatial::GlobeRectangle& rectangle,
const std::vector<CartographicPolygon>& cartographicPolygons) noexcept {
Expand Down
65 changes: 65 additions & 0 deletions CesiumGltf/generated/include/CesiumGltf/ExtensionExtMeshPolygon.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// This file was generated by generate-classes.
// DO NOT EDIT THIS FILE!
#pragma once

#include <CesiumGltf/Library.h>
#include <CesiumUtility/ExtensibleObject.h>

#include <cstdint>

namespace CesiumGltf {
/**
* @brief glTF extension adding an encoding of polygon primitive topology
*/
struct CESIUMGLTF_API ExtensionExtMeshPolygon final
: public CesiumUtility::ExtensibleObject {
/**
* @brief The original name of this type.
*/
static constexpr const char* TypeName = "ExtensionExtMeshPolygon";
/** @brief The official name of the extension. This should be the same as its
* key in the `extensions` object. */
static constexpr const char* ExtensionName = "EXT_mesh_polygon";

/**
* @brief Integer number of polygons encoded in the mesh primitive.
*/
int32_t count = -1;

/**
* @brief Index of an accessor containing indices of the polygons' exterior
* and interior loops. The accessor MUST have SCALAR type and an unsigned
* integer component type.
*/
int32_t loopIndices = -1;

/**
* @brief Index of an accessor containing one integer offset per polygon in
* the primitive, indicating the first index of the first linear ring
* associated with that polygon.
*/
int32_t loopIndicesOffsets = -1;

/**
* @brief Index of an accessor containing one integer offset per polygon in
* the primitive, indicating the first index of the first triangle associated
* with that polygon.
*/
int32_t indicesOffsets = -1;

/**
* @brief Calculates the size in bytes of this object, including the contents
* of all collections, pointers, and strings. This will NOT include the size
* of any extensions attached to the object. Calling this method may be slow
* as it requires traversing the object's entire structure.
*/
int64_t getSizeBytes() const {
int64_t accum = 0;
accum += int64_t(sizeof(ExtensionExtMeshPolygon));
accum += CesiumUtility::ExtensibleObject::getSizeBytes() -
int64_t(sizeof(CesiumUtility::ExtensibleObject));

return accum;
}
};
} // namespace CesiumGltf
Loading
Loading