cesium-native  0.41.0
RasterMappedTo3DTile.h
1 #pragma once
2 
3 #include "IPrepareRendererResources.h"
4 
5 #include <CesiumGeometry/Rectangle.h>
6 #include <CesiumGeospatial/Projection.h>
7 #include <CesiumRasterOverlays/RasterOverlayTile.h>
8 #include <CesiumUtility/IntrusivePointer.h>
9 
10 #include <memory>
11 
12 namespace Cesium3DTilesSelection {
13 
14 class Tile;
15 
23 class RasterMappedTo3DTile final {
24 public:
29  enum class AttachmentState {
33  Unattached = 0,
34 
40 
44  Attached = 2
45  };
46 
58  int32_t textureCoordinateIndex);
59 
69  return this->_pLoadingTile.get();
70  }
71 
74  getLoadingTile() const noexcept {
75  return this->_pLoadingTile.get();
76  }
77 
87  return this->_pReadyTile.get();
88  }
89 
92  return this->_pReadyTile.get();
93  }
94 
103  int32_t getTextureCoordinateID() const noexcept {
104  return this->_textureCoordinateID;
105  }
106 
114  void setTextureCoordinateID(int32_t textureCoordinateID) noexcept {
115  this->_textureCoordinateID = textureCoordinateID;
116  }
117 
127  const glm::dvec2& getTranslation() const noexcept {
128  return this->_translation;
129  }
130 
140  const glm::dvec2& getScale() const noexcept { return this->_scale; }
141 
151  AttachmentState getState() const noexcept { return this->_state; }
152 
166  update(IPrepareRendererResources& prepareRendererResources, Tile& tile);
167 
168  bool isMoreDetailAvailable() const noexcept;
169 
177  IPrepareRendererResources& prepareRendererResources,
178  Tile& tile) noexcept;
179 
189  bool loadThrottled() noexcept;
190 
222  double maximumScreenSpaceError,
223  CesiumRasterOverlays::RasterOverlayTileProvider& tileProvider,
224  CesiumRasterOverlays::RasterOverlayTileProvider& placeholder,
225  Tile& tile,
226  std::vector<CesiumGeospatial::Projection>& missingProjections,
227  const CesiumGeospatial::Ellipsoid& ellipsoid CESIUM_DEFAULT_ELLIPSOID);
228 
229 private:
230  void computeTranslationAndScale(const Tile& tile);
231 
232  CesiumUtility::IntrusivePointer<CesiumRasterOverlays::RasterOverlayTile>
233  _pLoadingTile;
234  CesiumUtility::IntrusivePointer<CesiumRasterOverlays::RasterOverlayTile>
235  _pReadyTile;
236  int32_t _textureCoordinateID;
237  glm::dvec2 _translation;
238  glm::dvec2 _scale;
239  AttachmentState _state;
240  bool _originalFailed;
241 };
242 
243 } // namespace Cesium3DTilesSelection
When implemented for a rendering engine, allows renderer resources to be created and destroyed under ...
The result of applying a RasterOverlayTile to geometry.
CesiumRasterOverlays::RasterOverlayTile * getReadyTile() noexcept
Returns the RasterOverlayTile that represents the imagery data that is ready to render.
const CesiumRasterOverlays::RasterOverlayTile * getLoadingTile() const noexcept
Returns a RasterOverlayTile that is currently loading.
static RasterMappedTo3DTile * mapOverlayToTile(double maximumScreenSpaceError, CesiumRasterOverlays::RasterOverlayTileProvider &tileProvider, CesiumRasterOverlays::RasterOverlayTileProvider &placeholder, Tile &tile, std::vector< CesiumGeospatial::Projection > &missingProjections, const CesiumGeospatial::Ellipsoid &ellipsoid CESIUM_DEFAULT_ELLIPSOID)
Creates a maping between a RasterOverlay and a Tile.
AttachmentState
The states indicating whether the raster tile is attached to the geometry.
@ Attached
This raster tile is attached to the geometry.
@ TemporarilyAttached
This raster tile is attached to the geometry, but it is a temporary, low-res version usable while the...
@ Unattached
This raster tile is not yet attached to the geometry at all.
const glm::dvec2 & getScale() const noexcept
Returns the scaling that converts between the geometry texture coordinates and the texture coordinate...
AttachmentState getState() const noexcept
Indicates whether this overlay tile is currently attached to its owning geometry tile.
const CesiumRasterOverlays::RasterOverlayTile * getReadyTile() const noexcept
Returns the RasterOverlayTile that represents the imagery data that is ready to render.
int32_t getTextureCoordinateID() const noexcept
Returns an identifier for the texture coordinates of this tile.
CesiumRasterOverlays::RasterOverlayTile * getLoadingTile() noexcept
Returns a RasterOverlayTile that is currently loading.
RasterMappedTo3DTile(const CesiumUtility::IntrusivePointer< CesiumRasterOverlays::RasterOverlayTile > &pRasterTile, int32_t textureCoordinateIndex)
Creates a new instance.
void setTextureCoordinateID(int32_t textureCoordinateID) noexcept
Sets the texture coordinate ID.
bool loadThrottled() noexcept
Does a throttled load of the mapped RasterOverlayTile.
CesiumRasterOverlays::RasterOverlayTile::MoreDetailAvailable update(IPrepareRendererResources &prepareRendererResources, Tile &tile)
Update this tile during the update of its owner.
void detachFromTile(IPrepareRendererResources &prepareRendererResources, Tile &tile) noexcept
Detach the raster from the given tile.
const glm::dvec2 & getTranslation() const noexcept
Returns the translation that converts between the geometry texture coordinates and the texture coordi...
A tile in a Tileset.
Definition: Tile.h:97
Raster image data for a tile in a quadtree.
MoreDetailAvailable
Tile availability states.
A smart pointer that calls addReference and releaseReference on the controlled object.
T * get() const noexcept
Returns the internal pointer.
Classes that implement the 3D Tiles standard.
Classes for geospatial computations in Cesium.
Classes for raster overlays, which allow draping massive 2D textures over a model.
Utility classes for Cesium.