cesium-native  0.41.0
TileContent.h
1 #pragma once
2 
3 #include "Library.h"
4 #include "TilesetMetadata.h"
5 
6 #include <CesiumGeospatial/Projection.h>
7 #include <CesiumGltf/Model.h>
8 #include <CesiumRasterOverlays/RasterOverlayDetails.h>
9 #include <CesiumUtility/CreditSystem.h>
10 
11 #include <memory>
12 #include <variant>
13 #include <vector>
14 
15 namespace Cesium3DTilesSelection {
22 struct CESIUM3DTILESSELECTION_API TileUnknownContent {};
23 
45 struct CESIUM3DTILESSELECTION_API TileEmptyContent {};
46 
52 struct CESIUM3DTILESSELECTION_API TileExternalContent {
57 };
58 
63 class CESIUM3DTILESSELECTION_API TileRenderContent {
64 public:
71 
77  const CesiumGltf::Model& getModel() const noexcept;
78 
84  CesiumGltf::Model& getModel() noexcept;
85 
91  void setModel(const CesiumGltf::Model& model);
92 
98  void setModel(CesiumGltf::Model&& model);
99 
105  const CesiumRasterOverlays::RasterOverlayDetails&
106  getRasterOverlayDetails() const noexcept;
107 
113  CesiumRasterOverlays::RasterOverlayDetails&
114  getRasterOverlayDetails() noexcept;
115 
121  void setRasterOverlayDetails(
122  const CesiumRasterOverlays::RasterOverlayDetails& rasterOverlayDetails);
123 
129  void setRasterOverlayDetails(
130  CesiumRasterOverlays::RasterOverlayDetails&& rasterOverlayDetails);
131 
137  const std::vector<CesiumUtility::Credit>& getCredits() const noexcept;
138 
144  std::vector<CesiumUtility::Credit>& getCredits() noexcept;
145 
151  void setCredits(std::vector<CesiumUtility::Credit>&& credits);
152 
158  void setCredits(const std::vector<CesiumUtility::Credit>& credits);
159 
165  void* getRenderResources() const noexcept;
166 
173  void setRenderResources(void* pRenderResources) noexcept;
174 
185  float getLodTransitionFadePercentage() const noexcept;
186 
193  void setLodTransitionFadePercentage(float percentage) noexcept;
194 
195 private:
196  CesiumGltf::Model _model;
197  void* _pRenderResources;
198  CesiumRasterOverlays::RasterOverlayDetails _rasterOverlayDetails;
199  std::vector<CesiumUtility::Credit> _credits;
200  float _lodTransitionFadePercentage;
201 };
202 
207 class CESIUM3DTILESSELECTION_API TileContent {
208  using TileContentKindImpl = std::variant<
211  std::unique_ptr<TileExternalContent>,
212  std::unique_ptr<TileRenderContent>>;
213 
214 public:
221 
226 
231  TileContent(std::unique_ptr<TileExternalContent>&& content);
232 
239 
244 
249  void setContentKind(std::unique_ptr<TileExternalContent>&& content);
250 
254  void setContentKind(std::unique_ptr<TileRenderContent>&& content);
255 
259  bool isUnknownContent() const noexcept;
260 
264  bool isEmptyContent() const noexcept;
265 
270  bool isExternalContent() const noexcept;
271 
275  bool isRenderContent() const noexcept;
276 
281  const TileRenderContent* getRenderContent() const noexcept;
282 
287  TileRenderContent* getRenderContent() noexcept;
288 
293  const TileExternalContent* getExternalContent() const noexcept;
294 
299  TileExternalContent* getExternalContent() noexcept;
300 
301 private:
302  TileContentKindImpl _contentKind;
303 };
304 } // namespace Cesium3DTilesSelection
A tile content container that can store and query the content type that is currently being owned by t...
Definition: TileContent.h:207
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...
void setContentKind(TileEmptyContent content)
Construct an empty content tag for a tile.
void setContentKind(std::unique_ptr< TileRenderContent > &&content)
Set a glTF model content for a tile.
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:63
TileRenderContent(CesiumGltf::Model &&model)
Construct the content with a glTF model.
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.
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:52
TilesetMetadata metadata
The metadata associated with this tileset.
Definition: TileContent.h:56
A content tag that indicates the TilesetContentLoader does not know if a tile's content will point to...
Definition: TileContent.h:22
The root object for a glTF asset.
Definition: Model.h:14