Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into creditless-raster-ove…
Browse files Browse the repository at this point in the history
…rlays
  • Loading branch information
kring committed Nov 21, 2024
2 parents 3ac1b02 + c21d697 commit 9a217ed
Show file tree
Hide file tree
Showing 246 changed files with 1,363 additions and 1,294 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [windows-2019, windows-2022]
platform: [windows-2022]
build_type: [Debug, RelWithDebInfo]
name: "${{matrix.platform}} / ${{matrix.build_type}}"
env:
Expand Down Expand Up @@ -115,6 +115,15 @@ jobs:
run: |
echo "CC=clang-12" >> "$GITHUB_ENV"
echo "CXX=clang++-12" >> "$GITHUB_ENV"
- name: Make more swap space available
if: ${{ matrix.platform != 'macos-15'}}
run: |
sudo swapoff -a
sudo fallocate -l 10G /mnt/swapfile
sudo chmod 600 /mnt/swapfile
sudo mkswap /mnt/swapfile
sudo swapon /mnt/swapfile
sudo swapon --show
- name: Set macOS cmake options
if: ${{ matrix.platform == 'macos-15' }}
run: |
Expand Down
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

### Not Released Yet

##### Breaking Changes :mega:

- Cesium Native now requires C++20.
- Switched from `gsl::span` to `std::span` throughout the library and API. The GSL library has been removed.

##### Additions :tada:

- Added support for `EXT_accessor_additional_types` in `AccessorView`.
Expand Down
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ message(STATUS "VCPKG_OVERLAY_TRIPLETS ${VCPKG_OVERLAY_TRIPLETS}")
# 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 ms-gsl rapidjson spdlog stb uriparser)
set(PACKAGES_PUBLIC asyncplusplus expected-lite fmt glm rapidjson spdlog stb uriparser)
# 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 All @@ -64,7 +64,7 @@ if(NOT VCPKG_MANIFEST_MODE)
list(APPEND PACKAGES_ALL ${PACKAGES_TEST})

ezvcpkg_fetch(
COMMIT 2024.07.12
COMMIT 2024.11.16
PACKAGES ${PACKAGES_ALL}
# Clean the build trees after building, so that we don't use a ton a disk space on the CI cache
CLEAN_BUILDTREES
Expand Down Expand Up @@ -223,7 +223,6 @@ find_package(draco CONFIG REQUIRED)
find_package(expected-lite CONFIG REQUIRED)
find_package(glm CONFIG REQUIRED)
find_package(meshoptimizer CONFIG REQUIRED)
find_package(Microsoft.GSL REQUIRED)
find_package(httplib CONFIG REQUIRED)
find_package(Ktx CONFIG REQUIRED)
find_package(libmorton CONFIG REQUIRED)
Expand Down
1 change: 0 additions & 1 deletion Cesium3DTiles/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,4 @@ target_include_directories(
target_link_libraries(Cesium3DTiles
PUBLIC
CesiumUtility
Microsoft.GSL::GSL
)
2 changes: 1 addition & 1 deletion Cesium3DTiles/generated/include/Cesium3DTiles/BufferSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct CESIUM3DTILES_API BufferSpec : public CesiumUtility::ExtensibleObject {
return accum;
}

private:
protected:
/**
* @brief This class is not meant to be instantiated directly. Use {@link Buffer} instead.
*/
Expand Down
2 changes: 2 additions & 0 deletions Cesium3DTiles/include/Cesium3DTiles/Buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
namespace Cesium3DTiles {
/** @copydoc BufferSpec */
struct CESIUM3DTILES_API Buffer final : public BufferSpec {
Buffer() = default;

/**
* @brief Holds properties that are specific to the 3D Tiles loader rather
* than part of the 3D Tiles spec.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
#include <CesiumGltf/Model.h>
#include <CesiumGltfReader/GltfReader.h>

#include <gsl/span>

#include <optional>
#include <span>

namespace Cesium3DTilesContent {
struct AssetFetcher;

struct B3dmToGltfConverter {
static CesiumAsync::Future<GltfConverterResult> convert(
const gsl::span<const std::byte>& b3dmBinary,
const std::span<const std::byte>& b3dmBinary,
const CesiumGltfReader::GltfReaderOptions& options,
const AssetFetcher& assetFetcher);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,22 @@
#include <CesiumAsync/Future.h>
#include <CesiumGltfReader/GltfReader.h>

#include <gsl/span>

#include <cstddef>
#include <span>

namespace Cesium3DTilesContent {
struct AssetFetcher;

struct BinaryToGltfConverter {
public:
static CesiumAsync::Future<GltfConverterResult> convert(
const gsl::span<const std::byte>& gltfBinary,
const std::span<const std::byte>& gltfBinary,
const CesiumGltfReader::GltfReaderOptions& options,
const AssetFetcher& assetFetcher);

private:
static GltfConverterResult convertImmediate(
const gsl::span<const std::byte>& gltfBinary,
const std::span<const std::byte>& gltfBinary,
const CesiumGltfReader::GltfReaderOptions& options,
const AssetFetcher& assetFetcher);
static CesiumGltfReader::GltfReader _gltfReader;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@
#include <CesiumAsync/Future.h>
#include <CesiumGltfReader/GltfReader.h>

#include <gsl/span>

#include <cstddef>
#include <span>

namespace Cesium3DTilesContent {
struct AssetFetcher;

struct CmptToGltfConverter {
static CesiumAsync::Future<GltfConverterResult> convert(
const gsl::span<const std::byte>& cmptBinary,
const std::span<const std::byte>& cmptBinary,
const CesiumGltfReader::GltfReaderOptions& options,
const AssetFetcher& assetFetcher);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
#include <CesiumGeometry/Axis.h>
#include <CesiumGltfReader/GltfReader.h>

#include <gsl/span>

#include <optional>
#include <span>
#include <string>
#include <string_view>

Expand Down Expand Up @@ -72,7 +71,7 @@ class CESIUM3DTILESCONTENT_API GltfConverters {
* tile binary content.
*/
using ConverterFunction = CesiumAsync::Future<GltfConverterResult> (*)(
const gsl::span<const std::byte>& content,
const std::span<const std::byte>& content,
const CesiumGltfReader::GltfReaderOptions& options,
const AssetFetcher& subprocessor);

Expand Down Expand Up @@ -132,7 +131,7 @@ class CESIUM3DTILESCONTENT_API GltfConverters {
* @return The {@link ConverterFunction} that is registered with the magic header.
*/
static ConverterFunction
getConverterByMagic(const gsl::span<const std::byte>& content);
getConverterByMagic(const std::span<const std::byte>& content);

/**
* @brief Creates the {@link GltfConverterResult} from the given
Expand Down Expand Up @@ -164,7 +163,7 @@ class CESIUM3DTILESCONTENT_API GltfConverters {
*/
static CesiumAsync::Future<GltfConverterResult> convert(
const std::string& filePath,
const gsl::span<const std::byte>& content,
const std::span<const std::byte>& content,
const CesiumGltfReader::GltfReaderOptions& options,
const AssetFetcher& assetFetcher);

Expand All @@ -191,7 +190,7 @@ class CESIUM3DTILESCONTENT_API GltfConverters {
* @return The {@link GltfConverterResult} that stores the gltf model converted from the binary data.
*/
static CesiumAsync::Future<GltfConverterResult> convert(
const gsl::span<const std::byte>& content,
const std::span<const std::byte>& content,
const CesiumGltfReader::GltfReaderOptions& options,
const AssetFetcher& assetFetcher);

Expand All @@ -205,7 +204,7 @@ class CESIUM3DTILESCONTENT_API GltfConverters {
std::string& fileExtension);

static ConverterFunction getConverterByMagic(
const gsl::span<const std::byte>& content,
const std::span<const std::byte>& content,
std::string& magic);

static std::unordered_map<std::string, ConverterFunction> _loadersByMagic;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
#include <CesiumGltf/Model.h>
#include <CesiumGltfReader/GltfReader.h>

#include <gsl/span>

#include <optional>
#include <span>

namespace Cesium3DTilesContent {
struct AssetFetcher;

struct I3dmToGltfConverter {
static CesiumAsync::Future<GltfConverterResult> convert(
const gsl::span<const std::byte>& instancesBinary,
const std::span<const std::byte>& instancesBinary,
const CesiumGltfReader::GltfReaderOptions& options,
const AssetFetcher& assetFetcher);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
#include <CesiumGltf/Model.h>
#include <CesiumGltfReader/GltfReader.h>

#include <gsl/span>

#include <optional>
#include <span>

namespace Cesium3DTilesContent {
struct AssetFetcher;

struct PntsToGltfConverter {
static CesiumAsync::Future<GltfConverterResult> convert(
const gsl::span<const std::byte>& pntsBinary,
const std::span<const std::byte>& pntsBinary,
const CesiumGltfReader::GltfReaderOptions& options,
const AssetFetcher& assetFetcher);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ class SubtreeAvailability {
/**
* @brief The buffer from which to read and write availability information.
*/
gsl::span<std::byte> view;
std::span<std::byte> view;
};

/**
Expand Down
18 changes: 9 additions & 9 deletions Cesium3DTilesContent/src/B3dmToGltfConverter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct B3dmHeaderLegacy2 {
};

void parseB3dmHeader(
const gsl::span<const std::byte>& b3dmBinary,
const std::span<const std::byte>& b3dmBinary,
B3dmHeader& header,
uint32_t& headerLength,
GltfConverterResult& result) {
Expand Down Expand Up @@ -113,7 +113,7 @@ void parseB3dmHeader(
}

CesiumAsync::Future<GltfConverterResult> convertB3dmContentToGltf(
const gsl::span<const std::byte>& b3dmBinary,
const std::span<const std::byte>& b3dmBinary,
const B3dmHeader& header,
uint32_t headerLength,
const CesiumGltfReader::GltfReaderOptions& options,
Expand All @@ -132,14 +132,14 @@ CesiumAsync::Future<GltfConverterResult> convertB3dmContentToGltf(
return assetFetcher.asyncSystem.createResolvedFuture(std::move(result));
}

const gsl::span<const std::byte> glbData =
const std::span<const std::byte> glbData =
b3dmBinary.subspan(glbStart, glbEnd - glbStart);

return BinaryToGltfConverter::convert(glbData, options, assetFetcher);
}

rapidjson::Document parseFeatureTableJsonData(
const gsl::span<const std::byte>& featureTableJsonData,
const std::span<const std::byte>& featureTableJsonData,
GltfConverterResult& result) {
rapidjson::Document document;
document.Parse(
Expand Down Expand Up @@ -174,14 +174,14 @@ rapidjson::Document parseFeatureTableJsonData(
}

void convertB3dmMetadataToGltfStructuralMetadata(
const gsl::span<const std::byte>& b3dmBinary,
const std::span<const std::byte>& b3dmBinary,
const B3dmHeader& header,
uint32_t headerLength,
GltfConverterResult& result) {
if (result.model && header.featureTableJsonByteLength > 0) {
CesiumGltf::Model& gltf = result.model.value();

const gsl::span<const std::byte> featureTableJsonData =
const std::span<const std::byte> featureTableJsonData =
b3dmBinary.subspan(headerLength, header.featureTableJsonByteLength);
rapidjson::Document featureTableJson =
parseFeatureTableJsonData(featureTableJsonData, result);
Expand All @@ -193,10 +193,10 @@ void convertB3dmMetadataToGltfStructuralMetadata(
header.batchTableBinaryByteLength + header.batchTableJsonByteLength;

if (batchTableLength > 0) {
const gsl::span<const std::byte> batchTableJsonData = b3dmBinary.subspan(
const std::span<const std::byte> batchTableJsonData = b3dmBinary.subspan(
static_cast<size_t>(batchTableStart),
header.batchTableJsonByteLength);
const gsl::span<const std::byte> batchTableBinaryData =
const std::span<const std::byte> batchTableBinaryData =
b3dmBinary.subspan(
static_cast<size_t>(
batchTableStart + header.batchTableJsonByteLength),
Expand Down Expand Up @@ -228,7 +228,7 @@ void convertB3dmMetadataToGltfStructuralMetadata(
} // namespace

CesiumAsync::Future<GltfConverterResult> B3dmToGltfConverter::convert(
const gsl::span<const std::byte>& b3dmBinary,
const std::span<const std::byte>& b3dmBinary,
const CesiumGltfReader::GltfReaderOptions& options,
const AssetFetcher& assetFetcher) {
GltfConverterResult result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1708,7 +1708,7 @@ void updateExtensionWithBatchTableHierarchy(

void convertBatchTableToGltfStructuralMetadataExtension(
const rapidjson::Document& batchTableJson,
const gsl::span<const std::byte>& batchTableBinaryData,
const std::span<const std::byte>& batchTableBinaryData,
CesiumGltf::Model& gltf,
const int64_t featureCount,
ErrorList& result) {
Expand Down Expand Up @@ -1820,7 +1820,7 @@ void convertBatchTableToGltfStructuralMetadataExtension(
ErrorList BatchTableToGltfStructuralMetadata::convertFromB3dm(
const rapidjson::Document& featureTableJson,
const rapidjson::Document& batchTableJson,
const gsl::span<const std::byte>& batchTableBinaryData,
const std::span<const std::byte>& batchTableBinaryData,
CesiumGltf::Model& gltf) {
// Check to make sure a char of rapidjson is 1 byte
static_assert(
Expand Down Expand Up @@ -1899,7 +1899,7 @@ ErrorList BatchTableToGltfStructuralMetadata::convertFromB3dm(
ErrorList BatchTableToGltfStructuralMetadata::convertFromPnts(
const rapidjson::Document& featureTableJson,
const rapidjson::Document& batchTableJson,
const gsl::span<const std::byte>& batchTableBinaryData,
const std::span<const std::byte>& batchTableBinaryData,
CesiumGltf::Model& gltf) {
// Check to make sure a char of rapidjson is 1 byte
static_assert(
Expand Down
6 changes: 3 additions & 3 deletions Cesium3DTilesContent/src/BatchTableToGltfStructuralMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
#include <CesiumGltf/Model.h>
#include <CesiumUtility/ErrorList.h>

#include <gsl/span>
#include <rapidjson/document.h>

#include <cstddef>
#include <span>

namespace Cesium3DTilesContent {
struct BatchTableToGltfStructuralMetadata {
static CesiumUtility::ErrorList convertFromB3dm(
const rapidjson::Document& featureTableJson,
const rapidjson::Document& batchTableJson,
const gsl::span<const std::byte>& batchTableBinaryData,
const std::span<const std::byte>& batchTableBinaryData,
CesiumGltf::Model& gltf);

static CesiumUtility::ErrorList convertFromPnts(
const rapidjson::Document& featureTableJson,
const rapidjson::Document& batchTableJson,
const gsl::span<const std::byte>& batchTableBinaryData,
const std::span<const std::byte>& batchTableBinaryData,
CesiumGltf::Model& gltf);
};
} // namespace Cesium3DTilesContent
Loading

0 comments on commit 9a217ed

Please sign in to comment.