Skip to content

Commit

Permalink
Merge branch '3dtiles-voxel-content' into tilers-lilleyse
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Oct 29, 2024
2 parents ea09a8b + fa50bce commit 0eaf094
Show file tree
Hide file tree
Showing 25 changed files with 1,445 additions and 237 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on: [push, pull_request]
jobs:
QuickChecks:
name: "Quick Checks"
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Check out repository code
uses: actions/checkout@v4
Expand All @@ -12,7 +12,7 @@ jobs:
npm install
npm run format -- --dry-run -Werror
Documentation:
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
steps:
- name: Install Doxygen
run: |
Expand Down Expand Up @@ -75,11 +75,11 @@ jobs:
fail-fast: false
matrix:
compiler: [ gcc, clang ]
platform: [ ubuntu-latest, ubuntu-20.04, macos-12 ]
platform: [ ubuntu-22.04, ubuntu-20.04, macos-12 ]
build_type: [Debug, RelWithDebInfo]
exclude:
- compiler: clang
platform: ubuntu-latest
platform: ubuntu-22.04
- compiler: gcc
platform: macos-12
- compiler: gcc
Expand Down
22 changes: 20 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,39 @@

##### Breaking Changes :mega:

- `LoadedRasterOverlayImage` now has a single `errorList` property instead of separate `errors` and `warnings` properties.
- Renamed `CesiumUtility/Gunzip.h` to `CesiumUtility/Gzip.h`.

##### Additions :tada:

- Added `CesiumUtility::gzip`.
- Added `CesiumGeometry::Transforms::getUpAxisTransform` to get the transform that converts from one up axis to another.

### v0.40.1 - 2024-10-01

##### Fixes :wrench:

- Fixed a regression in v0.40.0 that could cause tilesets with raster overlays to fail to load in some cases.

### v0.40.0 - 2024-10-01

##### Breaking Changes :mega:

- Renamed `shouldContentContinueUpdating` to `getMightHaveLatentChildren` and `setContentShouldContinueUpdating` to `setMightHaveLatentChildren` on the `Tile` class.
- `LoadedRasterOverlayImage` now has a single `errorList` property instead of separate `errors` and `warnings` properties.

##### Additions :tada:

- Added `CesiumGeometry::Transforms::getUpAxisTransform` to get the transform that converts from one up axis to another.
- Added `sampleHeightMostDetailed` method to `Tileset`.
- `AxisAlignedBox` now has `constexpr` constructors.

##### Fixes :wrench:

- Fixed a bug that prevented use of `Tileset` with a nullptr `IPrepareRendererResources`.
- Fixed a bug in `IntersectionTests::rayOBBParametric` that could cause incorrect results for some oriented bounding boxes.
- `GltfUtilities::intersectRayGltfModel` now reports a warning when given a model it can't compute the intersection with because it uses required extensions that are not supported.
- Errors while loading raster overlays are now logged. Previously, they were silently ignored in many cases.
- A raster overlay image failing to load will no longer completely prevent the geometry tile to which it is attached from rendering. Instead, once the raster overlay fails, the geometry tile will be shown without the raster overlay.
- Fixed a bug in the various `catchImmediately` and `catchInMainThread` functions in `CesiumAsync` that prevented use of a mutable lambda.

### v0.39.0 - 2024-09-02

Expand Down
16 changes: 16 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,22 @@ endif()

message(STATUS "VCPKG_TRIPLET ${VCPKG_TRIPLET}")

if (NOT VCPKG_OVERLAY_PORTS)
if (DEFINED ENV{VCPKG_OVERLAY_PORTS})
set(VCPKG_OVERLAY_PORTS "$ENV{VCPKG_OVERLAY_PORTS}")
endif()
endif()

message(STATUS "VCPKG_OVERLAY_PORTS ${VCPKG_OVERLAY_PORTS}")

if (NOT VCPKG_OVERLAY_TRIPLETS)
if (DEFINED ENV{VCPKG_OVERLAY_TRIPLETS})
set(VCPKG_OVERLAY_TRIPLETS "$ENV{VCPKG_OVERLAY_TRIPLETS}")
endif()
endif()

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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#pragma once

#include <CesiumGeospatial/Cartographic.h>

#include <string>
#include <vector>

namespace Cesium3DTilesSelection {

/**
* @brief The result of sampling heights with
* {@link Tileset::sampleHeightMostDetailed}.
*/
struct SampleHeightResult {
/**
* @brief The positions and their sampled heights.
*
* For each resulting position, its longitude and latitude values will match
* values from its input. Its height will either be the height sampled from
* the tileset at that position, or the original input height if the sample
* was unsuccessful. To determine which, look at the value of
* {@link SampleHeightResult::sampleSuccess} at the same index.
*/
std::vector<CesiumGeospatial::Cartographic> positions;

/**
* @brief The success of each sample.
*
* Each entry specifies whether the height for the position at the
* corresponding index was successfully sampled. If true, then
* {@link SampleHeightResult::positions} has a valid height sampled from the
* tileset at this index. If false, the height could not be sampled, leaving
* the height in {@link SampleHeightResult::positions} unchanged from the
* original input height.
*/
std::vector<bool> sampleSuccess;

/**
* @brief Any warnings that occurred while sampling heights.
*/
std::vector<std::string> warnings;
};

} // namespace Cesium3DTilesSelection
22 changes: 18 additions & 4 deletions Cesium3DTilesSelection/include/Cesium3DTilesSelection/Tile.h
Original file line number Diff line number Diff line change
Expand Up @@ -501,10 +501,24 @@ class CESIUM3DTILESSELECTION_API Tile final {

void setState(TileLoadState state) noexcept;

bool shouldContentContinueUpdating() const noexcept;
/**
* @brief Gets a flag indicating whether this tile might have latent children.
* Latent children don't exist in the `_children` property, but can be created
* by the {@link TilesetContentLoader}.
*
* When true, this tile might have children that can be created by the
* TilesetContentLoader but aren't yet reflected in the `_children` property.
* For example, in implicit tiling, we save memory by only creating explicit
* Tile instances from implicit availability as those instances are needed.
* When this flag is true, the creation of those explicit instances hasn't
* happened yet for this tile.
*
* If this flag is false, the children have already been created, if they
* exist. The tile may still have no children because it is a leaf node.
*/
bool getMightHaveLatentChildren() const noexcept;

void
setContentShouldContinueUpdating(bool shouldContentContinueUpdating) noexcept;
void setMightHaveLatentChildren(bool mightHaveLatentChildren) noexcept;

// Position in bounding-volume hierarchy.
Tile* _pParent;
Expand All @@ -528,7 +542,7 @@ class CESIUM3DTILESSELECTION_API Tile final {
TileContent _content;
TilesetContentLoader* _pLoader;
TileLoadState _loadState;
bool _shouldContentContinueUpdating;
bool _mightHaveLatentChildren;

// mapped raster overlay
std::vector<RasterMappedTo3DTile> _rasterTiles;
Expand Down
28 changes: 28 additions & 0 deletions Cesium3DTilesSelection/include/Cesium3DTilesSelection/Tileset.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "Library.h"
#include "RasterOverlayCollection.h"
#include "SampleHeightResult.h"
#include "Tile.h"
#include "TilesetContentLoader.h"
#include "TilesetExternals.h"
Expand All @@ -15,6 +16,7 @@

#include <rapidjson/fwd.h>

#include <list>
#include <memory>
#include <optional>
#include <string>
Expand All @@ -23,6 +25,8 @@
namespace Cesium3DTilesSelection {
class TilesetContentManager;
class TilesetMetadata;
class TilesetHeightQuery;
class TilesetHeightRequest;

/**
* @brief A <a
Expand Down Expand Up @@ -270,6 +274,27 @@ class CESIUM3DTILESSELECTION_API Tileset final {
*/
CesiumAsync::Future<const TilesetMetadata*> loadMetadata();

/**
* @brief Initiates an asynchronous query for the height of this tileset at a
* list of cartographic positions (longitude and latitude). The most detailed
* available tiles are used to determine each height.
*
* The height of the input positions is ignored. The output height is
* expressed in meters above the ellipsoid (usually WGS84), which should not
* be confused with a height above mean sea level.
*
* Note that {@link Tileset::updateView} must be called periodically, or else
* the returned `Future` will never resolve. If you are not using this tileset
* for visualization, you can call `updateView` with an empty list of
* frustums.
*
* @param positions The positions for which to sample heights.
* @return A future that asynchronously resolves to the result of the height
* query.
*/
CesiumAsync::Future<SampleHeightResult> sampleHeightMostDetailed(
const std::vector<CesiumGeospatial::Cartographic>& positions);

private:
/**
* @brief The result of traversing one branch of the tile hierarchy.
Expand Down Expand Up @@ -495,6 +520,7 @@ class CESIUM3DTILESSELECTION_API Tileset final {

std::vector<TileLoadTask> _mainThreadLoadQueue;
std::vector<TileLoadTask> _workerThreadLoadQueue;
std::vector<Tile*> _heightQueryLoadQueue;

Tile::LoadedLinkedList _loadedTiles;

Expand All @@ -509,6 +535,8 @@ class CESIUM3DTILESSELECTION_API Tileset final {
CesiumUtility::IntrusivePointer<TilesetContentManager>
_pTilesetContentManager;

std::list<TilesetHeightRequest> _heightRequests;

void addTileToLoadQueue(
Tile& tile,
TileLoadPriorityGroup priorityGroup,
Expand Down
16 changes: 8 additions & 8 deletions Cesium3DTilesSelection/src/Tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Tile::Tile(
_content{std::forward<TileContentArgs>(args)...},
_pLoader{pLoader},
_loadState{loadState},
_shouldContentContinueUpdating{true} {}
_mightHaveLatentChildren{true} {}

Tile::Tile(Tile&& rhs) noexcept
: _pParent(rhs._pParent),
Expand All @@ -74,7 +74,7 @@ Tile::Tile(Tile&& rhs) noexcept
_content(std::move(rhs._content)),
_pLoader{rhs._pLoader},
_loadState{rhs._loadState},
_shouldContentContinueUpdating{rhs._shouldContentContinueUpdating} {
_mightHaveLatentChildren{rhs._mightHaveLatentChildren} {
// since children of rhs will have the parent pointed to rhs,
// we will reparent them to this tile as rhs will be destroyed after this
for (Tile& tile : this->_children) {
Expand Down Expand Up @@ -105,7 +105,7 @@ Tile& Tile::operator=(Tile&& rhs) noexcept {
this->_content = std::move(rhs._content);
this->_pLoader = rhs._pLoader;
this->_loadState = rhs._loadState;
this->_shouldContentContinueUpdating = rhs._shouldContentContinueUpdating;
this->_mightHaveLatentChildren = rhs._mightHaveLatentChildren;
}

return *this;
Expand Down Expand Up @@ -227,12 +227,12 @@ void Tile::setParent(Tile* pParent) noexcept { this->_pParent = pParent; }

void Tile::setState(TileLoadState state) noexcept { this->_loadState = state; }

bool Tile::shouldContentContinueUpdating() const noexcept {
return this->_shouldContentContinueUpdating;
bool Tile::getMightHaveLatentChildren() const noexcept {
return this->_mightHaveLatentChildren;
}

void Tile::setContentShouldContinueUpdating(
bool shouldContentContinueUpdating) noexcept {
this->_shouldContentContinueUpdating = shouldContentContinueUpdating;
void Tile::setMightHaveLatentChildren(bool mightHaveLatentChildren) noexcept {
this->_mightHaveLatentChildren = mightHaveLatentChildren;
}

} // namespace Cesium3DTilesSelection
Loading

0 comments on commit 0eaf094

Please sign in to comment.