cesium-native  0.41.0
RasterOverlayUtilities.h
1 #pragma once
2 
3 #include "Library.h"
4 #include "RasterOverlayDetails.h"
5 
6 #include <CesiumGeometry/QuadtreeTileID.h>
7 #include <CesiumGeospatial/Ellipsoid.h>
8 #include <CesiumGeospatial/Projection.h>
9 
10 #include <glm/fwd.hpp>
11 
12 #include <optional>
13 #include <string_view>
14 #include <vector>
15 
16 namespace CesiumGltf {
17 struct Model;
18 }
19 
20 namespace CesiumRasterOverlays {
21 
22 struct CESIUMRASTEROVERLAYS_API RasterOverlayUtilities {
23  static constexpr std::string_view DEFAULT_TEXTURE_COORDINATE_BASE_NAME =
24  "_CESIUMOVERLAY_";
25 
76  static std::optional<RasterOverlayDetails>
78  CesiumGltf::Model& gltf,
79  const glm::dmat4& modelToEcefTransform,
80  const std::optional<CesiumGeospatial::GlobeRectangle>& globeRectangle,
81  std::vector<CesiumGeospatial::Projection>&& projections,
82  bool invertVCoordinate = false,
83  const std::string_view& textureCoordinateAttributeBaseName =
84  DEFAULT_TEXTURE_COORDINATE_BASE_NAME,
85  int32_t firstTextureCoordinateID = 0);
86 
113  static std::optional<CesiumGltf::Model> upsampleGltfForRasterOverlays(
114  const CesiumGltf::Model& parentModel,
116  bool hasInvertedVCoordinate = false,
117  const std::string_view& textureCoordinateAttributeBaseName =
118  DEFAULT_TEXTURE_COORDINATE_BASE_NAME,
119  int32_t textureCoordinateIndex = 0,
120  const CesiumGeospatial::Ellipsoid& ellipsoid =
122 
161  static glm::dvec2 computeDesiredScreenPixels(
162  double geometricError,
163  double maximumScreenSpaceError,
164  const CesiumGeospatial::Projection& projection,
165  const CesiumGeometry::Rectangle& rectangle,
166  const CesiumGeospatial::Ellipsoid& ellipsoid CESIUM_DEFAULT_ELLIPSOID);
167 
179  static glm::dvec4 computeTranslationAndScale(
180  const CesiumGeometry::Rectangle& geometryRectangle,
181  const CesiumGeometry::Rectangle& overlayRectangle);
182 };
183 
184 } // namespace CesiumRasterOverlays
A quadratic surface defined in Cartesian coordinates.
Definition: Ellipsoid.h:38
static const Ellipsoid WGS84
An Ellipsoid instance initialized to the WGS84 standard.
Definition: Ellipsoid.h:47
std::variant< GeographicProjection, WebMercatorProjection > Projection
A projection.
Definition: Projection.h:25
Classes for working with glTF models.
Classes for raster overlays, which allow draping massive 2D textures over a model.
A 2D rectangle.
Definition: Rectangle.h:14
A node of a tile hierarchy that was created by upsampling the tile content of a parent node.
The root object for a glTF asset.
Definition: Model.h:14
static glm::dvec2 computeDesiredScreenPixels(double geometricError, double maximumScreenSpaceError, const CesiumGeospatial::Projection &projection, const CesiumGeometry::Rectangle &rectangle, const CesiumGeospatial::Ellipsoid &ellipsoid CESIUM_DEFAULT_ELLIPSOID)
Computes the desired screen pixels for a raster overlay texture.
static std::optional< RasterOverlayDetails > createRasterOverlayTextureCoordinates(CesiumGltf::Model &gltf, const glm::dmat4 &modelToEcefTransform, const std::optional< CesiumGeospatial::GlobeRectangle > &globeRectangle, std::vector< CesiumGeospatial::Projection > &&projections, bool invertVCoordinate=false, const std::string_view &textureCoordinateAttributeBaseName=DEFAULT_TEXTURE_COORDINATE_BASE_NAME, int32_t firstTextureCoordinateID=0)
Creates texture coordinates for mapping RasterOverlay tiles to a glTF model.
static glm::dvec4 computeTranslationAndScale(const CesiumGeometry::Rectangle &geometryRectangle, const CesiumGeometry::Rectangle &overlayRectangle)
Computes the texture translation and scale necessary to align a raster overlay with the given rectang...
static std::optional< CesiumGltf::Model > upsampleGltfForRasterOverlays(const CesiumGltf::Model &parentModel, CesiumGeometry::UpsampledQuadtreeNode childID, bool hasInvertedVCoordinate=false, const std::string_view &textureCoordinateAttributeBaseName=DEFAULT_TEXTURE_COORDINATE_BASE_NAME, int32_t textureCoordinateIndex=0, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84)
Creates a new glTF model from one of the quadtree children of the given parent model.