cesium-native 0.44.2
Loading...
Searching...
No Matches
RasterOverlayUtilities.h
1#pragma once
2
3#include <CesiumGeometry/QuadtreeTileID.h>
4#include <CesiumGeospatial/Ellipsoid.h>
5#include <CesiumGeospatial/Projection.h>
6#include <CesiumRasterOverlays/Library.h>
7#include <CesiumRasterOverlays/RasterOverlayDetails.h>
8
9#include <glm/fwd.hpp>
10
11#include <optional>
12#include <string_view>
13#include <vector>
14
15namespace CesiumGltf {
16struct Model;
17}
18
19namespace CesiumRasterOverlays {
20
25struct CESIUMRASTEROVERLAYS_API RasterOverlayUtilities {
31 static constexpr std::string_view DEFAULT_TEXTURE_COORDINATE_BASE_NAME =
32 "_CESIUMOVERLAY_";
33
84 static std::optional<RasterOverlayDetails>
87 const glm::dmat4& modelToEcefTransform,
88 const std::optional<CesiumGeospatial::GlobeRectangle>& globeRectangle,
89 std::vector<CesiumGeospatial::Projection>&& projections,
90 bool invertVCoordinate = false,
91 const std::string_view& textureCoordinateAttributeBaseName =
92 DEFAULT_TEXTURE_COORDINATE_BASE_NAME,
93 int32_t firstTextureCoordinateID = 0);
94
122 static std::optional<CesiumGltf::Model> upsampleGltfForRasterOverlays(
123 const CesiumGltf::Model& parentModel,
125 bool hasInvertedVCoordinate = false,
126 const std::string_view& textureCoordinateAttributeBaseName =
127 DEFAULT_TEXTURE_COORDINATE_BASE_NAME,
128 int32_t textureCoordinateIndex = 0,
129 const CesiumGeospatial::Ellipsoid& ellipsoid =
131
170 static glm::dvec2 computeDesiredScreenPixels(
171 double geometricError,
172 double maximumScreenSpaceError,
173 const CesiumGeospatial::Projection& projection,
174 const CesiumGeometry::Rectangle& rectangle,
175 const CesiumGeospatial::Ellipsoid& ellipsoid CESIUM_DEFAULT_ELLIPSOID);
176
188 static glm::dvec4 computeTranslationAndScale(
189 const CesiumGeometry::Rectangle& geometryRectangle,
190 const CesiumGeometry::Rectangle& overlayRectangle);
191};
192
193} // namespace CesiumRasterOverlays
A quadratic surface defined in Cartesian coordinates.
Definition Ellipsoid.h:39
static const Ellipsoid WGS84
An Ellipsoid instance initialized to the WGS84 standard.
Definition Ellipsoid.h:48
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.
This class is not meant to be instantiated directly. Use Model instead.
Definition Model.h:14
A collection of utilities useful for operations involving raster overlay tiles.
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.
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< 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::dvec2 computeDesiredScreenPixels(double geometricError, double maximumScreenSpaceError, const CesiumGeospatial::Projection &projection, const CesiumGeometry::Rectangle &rectangle, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84)
Computes the desired screen pixels for a raster overlay texture.