cesium-native 0.43.0
Loading...
Searching...
No Matches
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
15namespace Cesium3DTilesSelection {
22struct CESIUM3DTILESSELECTION_API TileUnknownContent {};
23
45struct CESIUM3DTILESSELECTION_API TileEmptyContent {};
46
52struct CESIUM3DTILESSELECTION_API TileExternalContent {
57};
58
63class CESIUM3DTILESSELECTION_API TileRenderContent {
64public:
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
152 void setCredits(std::vector<CesiumUtility::Credit>&& credits);
153
160 void setCredits(const std::vector<CesiumUtility::Credit>& credits);
161
167 void* getRenderResources() const noexcept;
168
175 void setRenderResources(void* pRenderResources) noexcept;
176
187 float getLodTransitionFadePercentage() const noexcept;
188
195 void setLodTransitionFadePercentage(float percentage) noexcept;
196
197private:
198 CesiumGltf::Model _model;
199 void* _pRenderResources;
200 CesiumRasterOverlays::RasterOverlayDetails _rasterOverlayDetails;
201 std::vector<CesiumUtility::Credit> _credits;
202 float _lodTransitionFadePercentage;
203};
204
209class CESIUM3DTILESSELECTION_API TileContent {
210 using TileContentKindImpl = std::variant<
213 std::unique_ptr<TileExternalContent>,
214 std::unique_ptr<TileRenderContent>>;
215
216public:
223
228
233 TileContent(std::unique_ptr<TileExternalContent>&& content);
234
241
246
251 void setContentKind(std::unique_ptr<TileExternalContent>&& content);
252
256 void setContentKind(std::unique_ptr<TileRenderContent>&& content);
257
261 bool isUnknownContent() const noexcept;
262
266 bool isEmptyContent() const noexcept;
267
272 bool isExternalContent() const noexcept;
273
277 bool isRenderContent() const noexcept;
278
283 const TileRenderContent* getRenderContent() const noexcept;
284
289 TileRenderContent* getRenderContent() noexcept;
290
295 const TileExternalContent* getExternalContent() const noexcept;
296
301 TileExternalContent* getExternalContent() noexcept;
302
303private:
304 TileContentKindImpl _contentKind;
305};
306} // namespace Cesium3DTilesSelection
A tile content container that can store and query the content type that is currently being owned by t...
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.
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: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
This class is not meant to be instantiated directly. Use Model instead.
Definition Model.h:14