cesium-native 0.50.0
Loading...
Searching...
No Matches
TileContent.h
1#pragma once
2
3#include <Cesium3DTilesSelection/Library.h>
4#include <Cesium3DTilesSelection/TilesetMetadata.h>
5#include <CesiumGeospatial/Projection.h>
6#include <CesiumGltf/Model.h>
7#include <CesiumRasterOverlays/RasterOverlayDetails.h>
8#include <CesiumUtility/CreditSystem.h>
9#include <CesiumUtility/ExtensibleObject.h>
10
11#include <memory>
12#include <variant>
13#include <vector>
14
15namespace Cesium3DTilesSelection {
22struct CESIUM3DTILESSELECTION_API TileUnknownContent {};
23
45struct CESIUM3DTILESSELECTION_API TileEmptyContent {};
46
52struct CESIUM3DTILESSELECTION_API TileExternalContent
58};
59
64class CESIUM3DTILESSELECTION_API TileRenderContent {
65public:
72
78 const CesiumGltf::Model& getModel() const noexcept;
79
85 CesiumGltf::Model& getModel() noexcept;
86
92 void setModel(const CesiumGltf::Model& model);
93
99 void setModel(CesiumGltf::Model&& model);
100
106 const CesiumRasterOverlays::RasterOverlayDetails&
107 getRasterOverlayDetails() const noexcept;
108
114 CesiumRasterOverlays::RasterOverlayDetails&
116
123 const CesiumRasterOverlays::RasterOverlayDetails& rasterOverlayDetails);
124
131 CesiumRasterOverlays::RasterOverlayDetails&& rasterOverlayDetails);
132
138 const std::vector<CesiumUtility::Credit>& getCredits() const noexcept;
139
145 std::vector<CesiumUtility::Credit>& getCredits() noexcept;
146
153 void setCredits(std::vector<CesiumUtility::Credit>&& credits);
154
161 void setCredits(const std::vector<CesiumUtility::Credit>& credits);
162
168 void* getRenderResources() const noexcept;
169
176 void setRenderResources(void* pRenderResources) noexcept;
177
188 float getLodTransitionFadePercentage() const noexcept;
189
196 void setLodTransitionFadePercentage(float percentage) noexcept;
197
198private:
199 CesiumGltf::Model _model;
200 void* _pRenderResources;
201 CesiumRasterOverlays::RasterOverlayDetails _rasterOverlayDetails;
202 std::vector<CesiumUtility::Credit> _credits;
203 float _lodTransitionFadePercentage;
204};
205
210class CESIUM3DTILESSELECTION_API TileContent {
211 using TileContentKindImpl = std::variant<
214 std::unique_ptr<TileExternalContent>,
215 std::unique_ptr<TileRenderContent>>;
216
217public:
224
229
234 TileContent(std::unique_ptr<TileExternalContent>&& content);
235
242
247
252 void setContentKind(std::unique_ptr<TileExternalContent>&& content);
253
257 void setContentKind(std::unique_ptr<TileRenderContent>&& content);
258
262 bool isUnknownContent() const noexcept;
263
267 bool isEmptyContent() const noexcept;
268
273 bool isExternalContent() const noexcept;
274
278 bool isRenderContent() const noexcept;
279
284 const TileRenderContent* getRenderContent() const noexcept;
285
291
297
303
304private:
305 TileContentKindImpl _contentKind;
306};
307} // namespace Cesium3DTilesSelection
TileContent(std::unique_ptr< TileExternalContent > &&content)
Construct an external content for a tile whose content points to an external tileset.
TileContent(TileEmptyContent content)
Construct an empty content for a tile.
TileContent()
Construct an unknown content for a tile. This constructor is useful when the tile content is known af...
const TileExternalContent * getExternalContent() const noexcept
Get the TileExternalContent which stores the details of the external tileset.
void setContentKind(TileEmptyContent content)
Construct an empty content tag for a tile.
const TileRenderContent * getRenderContent() const noexcept
Get the TileRenderContent which stores the glTF model and render resources of the tile.
bool isExternalContent() const noexcept
Query if a tile has an external content which points to an external tileset.
void setContentKind(std::unique_ptr< TileRenderContent > &&content)
Set a glTF model content for a tile.
bool isEmptyContent() const noexcept
Query if a tile has an empty content.
bool isRenderContent() const noexcept
Query if a tile has an glTF model content.
void setContentKind(std::unique_ptr< TileExternalContent > &&content)
Set an external content for a tile whose content points to an external tileset.
bool isUnknownContent() const noexcept
Query if a tile has an unknown content.
void setContentKind(TileUnknownContent content)
Set an unknown content tag for a tile. This constructor is useful when the tile content is known afte...
A content tag that indicates a tile has a glTF model content and render resources for the model.
Definition TileContent.h:64
void setModel(const CesiumGltf::Model &model)
Set the glTF model for this content.
void setCredits(std::vector< CesiumUtility::Credit > &&credits)
Set the list of Credit for the content.
void * getRenderResources() const noexcept
Get the render resources created for the glTF model of the content.
void setLodTransitionFadePercentage(float percentage) noexcept
Set the fade percentage of this tile during an LOD transition with. Not to be used by clients.
TileRenderContent(CesiumGltf::Model &&model)
Construct the content with a glTF model.
const std::vector< CesiumUtility::Credit > & getCredits() const noexcept
Get the list of Credit of the content.
void setRenderResources(void *pRenderResources) noexcept
Set the render resources created for the glTF model of the content.
float getLodTransitionFadePercentage() const noexcept
Get the fade percentage that this tile during an LOD transition.
void setRasterOverlayDetails(const CesiumRasterOverlays::RasterOverlayDetails &rasterOverlayDetails)
Set the CesiumRasterOverlays::RasterOverlayDetails which is the result of generating raster overlay U...
const CesiumRasterOverlays::RasterOverlayDetails & getRasterOverlayDetails() const noexcept
Get the CesiumRasterOverlays::RasterOverlayDetails which is the result of generating raster overlay U...
const CesiumGltf::Model & getModel() const noexcept
Retrieve a glTF model that is owned by this content.
Holds the metadata associated with a Tileset or an external tileset.
Classes that implement the 3D Tiles standard.
Classes for working with glTF models.
Classes for raster overlays, which allow draping massive 2D textures over a model.
Utility classes for Cesium.
STL namespace.
A content tag that indicates a tile has no content.
Definition TileContent.h:45
A content tag that indicates a tile content points to an external tileset. When this tile is loaded,...
Definition TileContent.h:53
TilesetMetadata metadata
The metadata associated with this tileset.
Definition TileContent.h:57
A content tag that indicates the TilesetContentLoader does not know if a tile's content will point to...
Definition TileContent.h:22
This class is not meant to be instantiated directly. Use Model instead.
Definition Model.h:14
The base class for objects that have extensions and extras.