Skip to content

Commit

Permalink
Add Cesium3DTilesReader
Browse files Browse the repository at this point in the history
  • Loading branch information
lilleyse committed Oct 11, 2021
1 parent 4dbe872 commit 471bc06
Show file tree
Hide file tree
Showing 26 changed files with 1,685 additions and 38 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ CMakeSettings.json
*.user
.cache
*.DS_Store
test.db
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ add_subdirectory(CesiumGltfWriter)
add_subdirectory(CesiumGltfReader)
add_subdirectory(CesiumAsync)
add_subdirectory(Cesium3DTiles)
add_subdirectory(Cesium3DTilesReader)
add_subdirectory(Cesium3DTilesSelection)
add_subdirectory(CesiumIonClient)

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

cesium_glob_files(CESIUM_3DTILES_READER_SOURCES src/*.cpp generated/*.cpp)
cesium_glob_files(CESIUM_3DTILES_READER_HEADERS src/*.h src/*.hpp generated/*.h generated/*.hpp)
cesium_glob_files(CESIUM_3DTILES_READER_PUBLIC_HEADERS include/Cesium3DTiles/*.h) # Correct is Cesium3DTiles not Cesium3DTilesReader
cesium_glob_files(CESIUM_3DTILES_READER_TEST_SOURCES test/*.cpp)
cesium_glob_files(CESIUM_3DTILES_READER_TEST_HEADERS test/*.h)

set_target_properties(Cesium3DTilesReader
PROPERTIES
TEST_SOURCES "${CESIUM_3DTILES_READER_TEST_SOURCES}"
TEST_HEADERS "${CESIUM_3DTILES_READER_TEST_HEADERS}"
TEST_DATA_DIR ${CMAKE_CURRENT_LIST_DIR}/test/data
)

set_target_properties(Cesium3DTilesReader
PROPERTIES
PUBLIC_HEADER "${CESIUM_3DTILES_READER_PUBLIC_HEADERS}"
)

target_sources(
Cesium3DTilesReader
PRIVATE
${CESIUM_3DTILES_READER_SOURCES}
${CESIUM_3DTILES_READER_HEADERS}
PUBLIC
${CESIUM_3DTILES_READER_PUBLIC_HEADERS}
)

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

target_link_libraries(Cesium3DTilesReader
PUBLIC
Cesium3DTiles
CesiumJsonReader
GSL
)

install(TARGETS Cesium3DTilesReader
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/Cesium3DTiles # Correct is Cesium3DTiles not Cesium3DTilesReader
)
33 changes: 33 additions & 0 deletions Cesium3DTilesReader/generated/AssetJsonHandler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// This file was generated by generate-gltf-classes.
// DO NOT EDIT THIS FILE!
#pragma once

#include "Cesium3DTiles/Asset.h"
#include "Cesium3DTiles/ReaderContext.h"
#include "CesiumJsonReader/StringJsonHandler.h"
#include "ExtensibleObjectJsonHandler.h"

namespace Cesium3DTiles {
struct ReaderContext;

class AssetJsonHandler : public ExtensibleObjectJsonHandler {
public:
using ValueType = Asset;

AssetJsonHandler(const ReaderContext& context) noexcept;
void reset(IJsonHandler* pParentHandler, Asset* pObject);

virtual IJsonHandler* readObjectKey(const std::string_view& str) override;

protected:
IJsonHandler* readObjectKeyAsset(
const std::string& objectType,
const std::string_view& str,
Asset& o);

private:
Asset* _pObject = nullptr;
CesiumJsonReader::StringJsonHandler _version;
CesiumJsonReader::StringJsonHandler _tilesetVersion;
};
} // namespace Cesium3DTiles
41 changes: 41 additions & 0 deletions Cesium3DTilesReader/generated/BoundingVolumeJsonHandler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// This file was generated by generate-gltf-classes.
// DO NOT EDIT THIS FILE!
#pragma once

#include "Cesium3DTiles/BoundingVolume.h"
#include "Cesium3DTiles/ReaderContext.h"
#include "CesiumJsonReader/ArrayJsonHandler.h"
#include "CesiumJsonReader/DoubleJsonHandler.h"
#include "ExtensibleObjectJsonHandler.h"

namespace Cesium3DTiles {
struct ReaderContext;

class BoundingVolumeJsonHandler : public ExtensibleObjectJsonHandler {
public:
using ValueType = BoundingVolume;

BoundingVolumeJsonHandler(const ReaderContext& context) noexcept;
void reset(IJsonHandler* pParentHandler, BoundingVolume* pObject);

virtual IJsonHandler* readObjectKey(const std::string_view& str) override;

protected:
IJsonHandler* readObjectKeyBoundingVolume(
const std::string& objectType,
const std::string_view& str,
BoundingVolume& o);

private:
BoundingVolume* _pObject = nullptr;
CesiumJsonReader::
ArrayJsonHandler<double, CesiumJsonReader::DoubleJsonHandler>
_box;
CesiumJsonReader::
ArrayJsonHandler<double, CesiumJsonReader::DoubleJsonHandler>
_region;
CesiumJsonReader::
ArrayJsonHandler<double, CesiumJsonReader::DoubleJsonHandler>
_sphere;
};
} // namespace Cesium3DTiles
34 changes: 34 additions & 0 deletions Cesium3DTilesReader/generated/ContentJsonHandler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// This file was generated by generate-gltf-classes.
// DO NOT EDIT THIS FILE!
#pragma once

#include "BoundingVolumeJsonHandler.h"
#include "Cesium3DTiles/Content.h"
#include "Cesium3DTiles/ReaderContext.h"
#include "CesiumJsonReader/StringJsonHandler.h"
#include "ExtensibleObjectJsonHandler.h"

namespace Cesium3DTiles {
struct ReaderContext;

class ContentJsonHandler : public ExtensibleObjectJsonHandler {
public:
using ValueType = Content;

ContentJsonHandler(const ReaderContext& context) noexcept;
void reset(IJsonHandler* pParentHandler, Content* pObject);

virtual IJsonHandler* readObjectKey(const std::string_view& str) override;

protected:
IJsonHandler* readObjectKeyContent(
const std::string& objectType,
const std::string_view& str,
Content& o);

private:
Content* _pObject = nullptr;
BoundingVolumeJsonHandler _boundingVolume;
CesiumJsonReader::StringJsonHandler _uri;
};
} // namespace Cesium3DTiles
Loading

0 comments on commit 471bc06

Please sign in to comment.