cesium-native 0.43.0
Loading...
Searching...
No Matches
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
16namespace CesiumGltf {
17struct Model;
18}
19
20namespace CesiumRasterOverlays {
21
26struct CESIUMRASTEROVERLAYS_API RasterOverlayUtilities {
32 static constexpr std::string_view DEFAULT_TEXTURE_COORDINATE_BASE_NAME =
33 "_CESIUMOVERLAY_";
34
85 static std::optional<RasterOverlayDetails>
88 const glm::dmat4& modelToEcefTransform,
89 const std::optional<CesiumGeospatial::GlobeRectangle>& globeRectangle,
90 std::vector<CesiumGeospatial::Projection>&& projections,
91 bool invertVCoordinate = false,
92 const std::string_view& textureCoordinateAttributeBaseName =
93 DEFAULT_TEXTURE_COORDINATE_BASE_NAME,
94 int32_t firstTextureCoordinateID = 0);
95
123 static std::optional<CesiumGltf::Model> upsampleGltfForRasterOverlays(
124 const CesiumGltf::Model& parentModel,
126 bool hasInvertedVCoordinate = false,
127 const std::string_view& textureCoordinateAttributeBaseName =
128 DEFAULT_TEXTURE_COORDINATE_BASE_NAME,
129 int32_t textureCoordinateIndex = 0,
130 const CesiumGeospatial::Ellipsoid& ellipsoid =
132
171 static glm::dvec2 computeDesiredScreenPixels(
172 double geometricError,
173 double maximumScreenSpaceError,
174 const CesiumGeospatial::Projection& projection,
175 const CesiumGeometry::Rectangle& rectangle,
176 const CesiumGeospatial::Ellipsoid& ellipsoid CESIUM_DEFAULT_ELLIPSOID);
177
189 static glm::dvec4 computeTranslationAndScale(
190 const CesiumGeometry::Rectangle& geometryRectangle,
191 const CesiumGeometry::Rectangle& overlayRectangle);
192};
193
194} // 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.
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.