Skip to content

Commit

Permalink
Add new Cesium3DTilesContent library.
Browse files Browse the repository at this point in the history
  • Loading branch information
kring committed Nov 2, 2023
1 parent af24dbe commit a71a982
Show file tree
Hide file tree
Showing 30 changed files with 140 additions and 40 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Change Log

### ? - ?

##### Breaking Changes :mega:

- Moved `ErrorList` from `Cesium3DTilesSelection` to `CesiumUtility`.

### v0.29.0 - 2023-11-01

##### Breaking Changes :mega:
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ add_subdirectory(CesiumAsync)
add_subdirectory(Cesium3DTiles)
add_subdirectory(Cesium3DTilesReader)
add_subdirectory(Cesium3DTilesWriter)
add_subdirectory(Cesium3DTilesContent)
add_subdirectory(Cesium3DTilesSelection)
add_subdirectory(CesiumIonClient)

Expand Down
65 changes: 65 additions & 0 deletions Cesium3DTilesContent/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
add_library(Cesium3DTilesContent "")
configure_cesium_library(Cesium3DTilesContent)

cesium_glob_files(CESIUM_3DTILES_CONTENT_SOURCES
${CMAKE_CURRENT_LIST_DIR}/src/*.cpp
${CMAKE_CURRENT_LIST_DIR}/generated/src/*.cpp
)
cesium_glob_files(CESIUM_3DTILES_CONTENT_HEADERS
${CMAKE_CURRENT_LIST_DIR}/src/*.h
${CMAKE_CURRENT_LIST_DIR}/generated/src/*.h
)
cesium_glob_files(CESIUM_3DTILES_CONTENT_PUBLIC_HEADERS
${CMAKE_CURRENT_LIST_DIR}/include/Cesium3DTilesContent/*.h
${CMAKE_CURRENT_LIST_DIR}/generated/include/Cesium3DTilesContent/*.h
)
cesium_glob_files(CESIUM_3DTILES_CONTENT_TEST_SOURCES
${CMAKE_CURRENT_LIST_DIR}/test/*.cpp
)
cesium_glob_files(CESIUM_3DTILES_CONTENT_TEST_HEADERS
${CMAKE_CURRENT_LIST_DIR}/test/*.h
)

set_target_properties(Cesium3DTilesContent
PROPERTIES
TEST_SOURCES "${CESIUM_3DTILES_CONTENT_TEST_SOURCES}"
TEST_HEADERS "${CESIUM_3DTILES_CONTENT_TEST_HEADERS}"
TEST_DATA_DIR ${CMAKE_CURRENT_LIST_DIR}/test/data
)

set_target_properties(Cesium3DTilesContent
PROPERTIES
PUBLIC_HEADER "${CESIUM_3DTILES_CONTENT_PUBLIC_HEADERS}"
)

target_sources(
Cesium3DTilesContent
PRIVATE
${CESIUM_3DTILES_CONTENT_SOURCES}
${CESIUM_3DTILES_CONTENT_HEADERS}
PUBLIC
${CESIUM_3DTILES_CONTENT_PUBLIC_HEADERS}
)

target_include_directories(
Cesium3DTilesContent
SYSTEM PUBLIC
${CMAKE_CURRENT_LIST_DIR}/include
${CMAKE_CURRENT_LIST_DIR}/generated/include
PRIVATE
${CMAKE_CURRENT_LIST_DIR}/src
${CMAKE_CURRENT_LIST_DIR}/generated/src
)

target_link_libraries(Cesium3DTilesContent
PUBLIC
CesiumAsync
CesiumGeometry
CesiumGltf
CesiumGltfReader
)

install(TARGETS Cesium3DTilesContent
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Cesium3DTilesContent
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <Cesium3DTilesSelection/GltfConverterResult.h>
#include "GltfConverterResult.h"

#include <CesiumGltf/Model.h>
#include <CesiumGltfReader/GltfReader.h>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <Cesium3DTilesSelection/GltfConverterResult.h>
#include <Cesium3DTilesContent/GltfConverterResult.h>
#include <CesiumGltfReader/GltfReader.h>

#include <gsl/span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#include "Library.h"

#include <Cesium3DTilesSelection/ErrorList.h>
#include <CesiumGltf/Model.h>
#include <CesiumUtility/ErrorList.h>

#include <optional>

Expand All @@ -15,7 +15,7 @@ namespace Cesium3DTilesSelection {
* {@link GltfConverters}, when the response to a network request for
* loading the tile content was received.
*/
struct CESIUM3DTILESSELECTION_API GltfConverterResult {
struct CESIUM3DTILESCONTENT_API GltfConverterResult {
/**
* @brief The gltf model converted from a binary content. This is empty if
* there are errors during the conversion
Expand All @@ -26,6 +26,6 @@ struct CESIUM3DTILESSELECTION_API GltfConverterResult {
* @brief The error and warning list when converting a binary content to gltf
* model. This is empty if there are no errors during the conversion
*/
ErrorList errors;
CesiumUtility::ErrorList errors;
};
} // namespace Cesium3DTilesSelection
16 changes: 16 additions & 0 deletions Cesium3DTilesContent/include/Cesium3DTilesContent/Library.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once

/**
* @brief Classes that support the 3D Tiles tile content types.
*/
namespace Cesium3DTilesContent {}

#if defined(_WIN32) && defined(CESIUM_SHARED)
#ifdef CESIUM3DTILESCONTENT_BUILDING
#define CESIUM3DTILESCONTENT_API __declspec(dllexport)
#else
#define CESIUM3DTILESCONTENT_API __declspec(dllimport)
#endif
#else
#define CESIUM3DTILESCONTENT_API
#endif
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <Cesium3DTilesSelection/GltfConverterResult.h>
#include "GltfConverterResult.h"

#include <CesiumGltf/Model.h>
#include <CesiumGltfReader/GltfReader.h>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#include "B3dmToGltfConverter.h"

#include "BatchTableToGltfStructuralMetadata.h"
#include "BinaryToGltfConverter.h"

#include <Cesium3DTilesContent/B3dmToGltfConverter.h>
#include <Cesium3DTilesContent/BinaryToGltfConverter.h>
#include <CesiumGltf/ExtensionCesiumRTC.h>

#include <rapidjson/document.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "BatchTableToGltfStructuralMetadata.h"

#include "BatchTableHierarchyPropertyValues.h"
#include "Cesium3DTilesSelection/spdlog-cesium.h"

#include <CesiumGltf/ExtensionExtMeshFeatures.h>
#include <CesiumGltf/ExtensionModelExtStructuralMetadata.h>
Expand All @@ -20,6 +19,7 @@

using namespace CesiumGltf;
using namespace Cesium3DTilesSelection::CesiumImpl;
using namespace CesiumUtility;

namespace Cesium3DTilesSelection {
namespace {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#pragma once

#include <Cesium3DTilesSelection/ErrorList.h>
#include <CesiumGltf/Model.h>
#include <CesiumUtility/ErrorList.h>

#include <gsl/span>
#include <rapidjson/document.h>
Expand All @@ -10,13 +10,13 @@

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

static ErrorList convertFromPnts(
static CesiumUtility::ErrorList convertFromPnts(
const rapidjson::Document& featureTableJson,
const rapidjson::Document& batchTableJson,
const gsl::span<const std::byte>& batchTableBinaryData,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "BinaryToGltfConverter.h"
#include <Cesium3DTilesContent/BinaryToGltfConverter.h>

namespace Cesium3DTilesSelection {
CesiumGltfReader::GltfReader BinaryToGltfConverter::_gltfReader;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "PntsToGltfConverter.h"

#include "BatchTableToGltfStructuralMetadata.h"

#include <Cesium3DTilesContent/PntsToGltfConverter.h>
#include <CesiumGeometry/Transforms.h>
#include <CesiumGltf/ExtensionCesiumRTC.h>
#include <CesiumGltf/ExtensionKhrMaterialsUnlit.h>
Expand Down Expand Up @@ -228,7 +227,7 @@ struct PntsContent {
std::map<std::string, DracoMetadataSemantic> dracoMetadataSemantics;
std::vector<std::byte> dracoBatchTableBinary;

Cesium3DTilesSelection::ErrorList errors;
ErrorList errors;
bool dracoMetadataHasErrors = false;
};

Expand Down
1 change: 1 addition & 0 deletions Cesium3DTilesSelection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ target_include_directories(
target_link_libraries(Cesium3DTilesSelection
PUBLIC
Cesium3DTiles
Cesium3DTilesContent
Cesium3DTilesReader
CesiumAsync
CesiumGeospatial
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "Library.h"

#include <Cesium3DTilesSelection/GltfConverterResult.h>
#include <Cesium3DTilesContent/GltfConverterResult.h>
#include <CesiumGltfReader/GltfReader.h>

#include <gsl/span>
Expand Down
2 changes: 1 addition & 1 deletion Cesium3DTilesSelection/src/CmptToGltfConverter.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <Cesium3DTilesSelection/GltfConverterResult.h>
#include <Cesium3DTilesContent/GltfConverterResult.h>
#include <CesiumGltfReader/GltfReader.h>

#include <gsl/span>
Expand Down
2 changes: 2 additions & 0 deletions Cesium3DTilesSelection/src/GltfConverters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include <spdlog/spdlog.h>

using namespace CesiumUtility;

namespace Cesium3DTilesSelection {
std::unordered_map<std::string, GltfConverters::ConverterFunction>
GltfConverters::_loadersByMagic;
Expand Down
6 changes: 3 additions & 3 deletions Cesium3DTilesSelection/src/QuantizedMeshLoader.h
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#pragma once

#include <Cesium3DTilesSelection/BoundingVolume.h>
#include <Cesium3DTilesSelection/ErrorList.h>
#include <Cesium3DTilesSelection/Library.h>
#include <Cesium3DTilesSelection/TileID.h>
#include <CesiumGeometry/QuadtreeTileRectangularRange.h>
#include <CesiumGltf/Model.h>
#include <CesiumUtility/ErrorList.h>

#include <rapidjson/document.h>

Expand Down Expand Up @@ -52,12 +52,12 @@ struct QuantizedMeshLoadResult {
*/
std::shared_ptr<CesiumAsync::IAssetRequest> pRequest;

ErrorList errors;
CesiumUtility::ErrorList errors;
};

struct QuantizedMeshMetadataResult {
std::vector<CesiumGeometry::QuadtreeTileRectangularRange> availability;
ErrorList errors;
CesiumUtility::ErrorList errors;
};

/**
Expand Down
6 changes: 3 additions & 3 deletions Cesium3DTilesSelection/src/TilesetContentLoaderResult.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

#include <Cesium3DTilesSelection/ErrorList.h>
#include <Cesium3DTilesSelection/Tile.h>
#include <CesiumAsync/IAssetAccessor.h>
#include <CesiumGeometry/Axis.h>
#include <CesiumUtility/ErrorList.h>

#include <memory>
#include <type_traits>
Expand All @@ -24,7 +24,7 @@ template <class TilesetContentLoaderType> struct TilesetContentLoaderResult {
std::unique_ptr<Tile>&& pRootTile_,
std::vector<LoaderCreditResult>&& credits_,
std::vector<CesiumAsync::IAssetAccessor::THeader>&& requestHeaders_,
ErrorList&& errors_)
CesiumUtility::ErrorList&& errors_)
: pLoader{std::move(pLoader_)},
pRootTile{std::move(pRootTile_)},
credits{std::move(credits_)},
Expand Down Expand Up @@ -85,7 +85,7 @@ template <class TilesetContentLoaderType> struct TilesetContentLoaderResult {

std::vector<CesiumAsync::IAssetAccessor::THeader> requestHeaders;

ErrorList errors;
CesiumUtility::ErrorList errors;

uint16_t statusCode{200};
};
Expand Down
2 changes: 2 additions & 0 deletions Cesium3DTilesSelection/src/TilesetJsonLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

#include <cctype>

using namespace CesiumUtility;

namespace Cesium3DTilesSelection {
namespace {
struct ExternalContentInitializer {
Expand Down
2 changes: 2 additions & 0 deletions Cesium3DTilesSelection/src/logTileLoadResult.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "logTileLoadResult.h"

using namespace CesiumUtility;

namespace Cesium3DTilesSelection {
void logTileLoadResult(
const std::shared_ptr<spdlog::logger>& pLogger,
Expand Down
4 changes: 2 additions & 2 deletions Cesium3DTilesSelection/src/logTileLoadResult.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#pragma once

#include <Cesium3DTilesSelection/ErrorList.h>
#include <CesiumUtility/ErrorList.h>

#include <spdlog/spdlog.h>

Expand All @@ -11,5 +11,5 @@ namespace Cesium3DTilesSelection {
void logTileLoadResult(
const std::shared_ptr<spdlog::logger>& pLogger,
const std::string& url,
const ErrorList& errorLists);
const CesiumUtility::ErrorList& errorLists);
}
6 changes: 3 additions & 3 deletions Cesium3DTilesSelection/src/registerAllTileContentTypes.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "B3dmToGltfConverter.h"
#include "BinaryToGltfConverter.h"
#include "CmptToGltfConverter.h"
#include "PntsToGltfConverter.h"

#include <Cesium3DTilesContent/B3dmToGltfConverter.h>
#include <Cesium3DTilesContent/BinaryToGltfConverter.h>
#include <Cesium3DTilesContent/PntsToGltfConverter.h>
#include <Cesium3DTilesSelection/GltfConverters.h>
#include <Cesium3DTilesSelection/registerAllTileContentTypes.h>

Expand Down
5 changes: 3 additions & 2 deletions Cesium3DTilesSelection/test/ConvertTileToGltf.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#pragma once

#include "B3dmToGltfConverter.h"
#include "PntsToGltfConverter.h"
#include "readFile.h"

#include <Cesium3DTilesContent/B3dmToGltfConverter.h>
#include <Cesium3DTilesContent/PntsToGltfConverter.h>

#include <filesystem>

namespace Cesium3DTilesSelection {
Expand Down
1 change: 1 addition & 0 deletions CesiumUtility/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ target_link_libraries_system(
PUBLIC
glm
uriparser
spdlog
)

target_link_libraries(CesiumUtility
Expand Down
Loading

0 comments on commit a71a982

Please sign in to comment.