3#include <Cesium3DTiles/BoundingVolume.h>
4#include <Cesium3DTilesSelection/GeneralCullingVolume.h>
5#include <Cesium3DTilesSelection/Library.h>
6#include <CesiumGeometry/CullingVolume.h>
7#include <CesiumGeometry/Plane.h>
8#include <CesiumGeospatial/Cartographic.h>
9#include <CesiumGeospatial/Ellipsoid.h>
11#include <glm/mat3x3.hpp>
12#include <glm/mat4x4.hpp>
13#include <glm/vec2.hpp>
14#include <glm/vec3.hpp>
46 uint32_t depth)
const;
90 const glm::dvec3& position,
91 const glm::dvec3& direction,
93 const glm::dvec2& viewportSize,
94 double horizontalFieldOfView,
95 double verticalFieldOfView,
115 const glm::dvec3& position,
116 const glm::dvec3& direction,
117 const glm::dvec3& up,
118 const glm::dvec2& viewportSize,
119 double horizontalFieldOfView,
120 double verticalFieldOfView,
137 const glm::dmat4& viewMatrix,
138 const glm::dmat4& projectionMatrix,
139 const glm::dvec2& viewportSize,
160 const glm::dvec3& position,
161 const glm::dvec3& direction,
162 const glm::dvec3& up,
163 const glm::dvec2& viewportSize,
186 std::shared_ptr<ViewStateMeasureDelegate> pMeasureDelegate,
193 const glm::dvec3&
getPosition() const noexcept {
return this->_position; }
199 const glm::dvec3&
getDirection() const noexcept {
return this->_direction; }
207 this->_viewMatrix[0][1],
208 this->_viewMatrix[1][1],
209 this->_viewMatrix[2][1]};
218 const std::optional<CesiumGeospatial::Cartographic>&
220 return this->_positionCartographic;
227 return this->_viewportSize;
245 const glm::dmat4&
getViewMatrix() const noexcept {
return this->_viewMatrix; }
251 return this->_projectionMatrix;
319 uint32_t depth)
const noexcept;
329 if (_pVisibilityDelegate) {
330 return _pVisibilityDelegate->isContentVisible(*
this, tile);
340 return this->_pMeasureDelegate;
348 std::shared_ptr<ViewStateMeasureDelegate> pMeasureDelegate) {
349 this->_pMeasureDelegate = std::move(pMeasureDelegate);
357 return this->_pVisibilityDelegate;
365 std::shared_ptr<ViewStateVisibilityDelegate> pVisibilityDelegate) {
366 this->_pVisibilityDelegate = std::move(pVisibilityDelegate);
370 glm::dvec3 _position;
371 glm::dvec3 _direction;
372 glm::dvec2 _viewportSize;
375 std::optional<CesiumGeospatial::Cartographic> _positionCartographic;
378 glm::dmat4 _viewMatrix;
379 glm::dmat4 _projectionMatrix;
380 std::shared_ptr<ViewStateMeasureDelegate> _pMeasureDelegate;
381 std::shared_ptr<ViewStateVisibilityDelegate> _pVisibilityDelegate;
A handler for customizing calculation of the selection measure for tiles. By default that value is th...
virtual double computeSelectionMeasure(const ViewState &viewState, const Tile &tile, double distance, uint32_t depth) const
Compute the error measure, a generalization of screen space error.
virtual ~ViewStateMeasureDelegate()=default
destructor
A delegate for determining if a tile's content is visible, using user-defined criteria....
virtual ~ViewStateVisibilityDelegate()=default
destructor
virtual bool isContentVisible(const ViewState &viewState, const Tile &tile) const
Determine if this tile's content is visible. If the tile has external content, then this determines i...
The state of the view that is used during the traversal of a tileset.
ViewState(const Cesium3DTiles::BoundingVolume &boundingVolume, std::shared_ptr< ViewStateMeasureDelegate > pMeasureDelegate, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84)
Creates a new instance of a view state from a bounding volume associated with a geographic area,...
bool isContentVisible(const Tile &tile) const noexcept
Reports whether a tile's content is visible. This will use the ViewStateVisibilityDelegate on this Vi...
std::shared_ptr< ViewStateMeasureDelegate > getMeasureDelegate() const
Get the measure delegate object.
const glm::dvec3 & getDirection() const noexcept
Gets the look direction of the camera in Earth-centered, Earth-fixed coordinates.
bool isBoundingVolumeVisible(const Cesium3DTiles::BoundingVolume &boundingVolume) const noexcept
Returns whether the given Cesium3DTiles::BoundingVolume is visible for this camera.
ViewState(const glm::dvec3 &position, const glm::dvec3 &direction, const glm::dvec3 &up, const glm::dvec2 &viewportSize, double horizontalFieldOfView, double verticalFieldOfView, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84)
Creates a new instance.
double computeDistanceSquaredToBoundingVolume(const Cesium3DTiles::BoundingVolume &boundingVolume) const noexcept
Computes the squared distance to the given Cesium3DTiles::BoundingVolume.
double getHorizontalFieldOfView() const noexcept
Gets the horizontal field-of-view angle in radians. This is only valid for a symmetric perspective pr...
static ViewState create(const glm::dvec3 &position, const glm::dvec3 &direction, const glm::dvec3 &up, const glm::dvec2 &viewportSize, double horizontalFieldOfView, double verticalFieldOfView, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84)
Creates a new instance of a view state with a symmetric perspective projection.
ViewState(const glm::dmat4 &viewMatrix, const glm::dmat4 &projectionMatrix, const glm::dvec2 &viewportSize, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84)
Creates a new instance of a view state with a general projection, including skewed perspective and or...
double computeScreenSpaceError(double geometricError, double distance) const noexcept
Computes the screen space error from a given geometric error.
void setVisibilityDelegate(std::shared_ptr< ViewStateVisibilityDelegate > pVisibilityDelegate)
Set the visibility delegate object.
const std::optional< CesiumGeospatial::Cartographic > & getPositionCartographic() const noexcept
Gets the position of the camera as a longitude / latitude / height.
std::shared_ptr< ViewStateVisibilityDelegate > getVisibilityDelegate() const
Get the visibility delegate object.
const glm::dvec2 & getViewportSize() const noexcept
Gets the size of the viewport in pixels.
const glm::dmat4 & getViewMatrix() const noexcept
Gets the view matrix for the ViewState.
const glm::dmat4 & getProjectionMatrix() const noexcept
Gets the projection matrix for the ViewState.
ViewState(const glm::dvec3 &position, const glm::dvec3 &direction, const glm::dvec3 &up, const glm::dvec2 &viewportSize, double left, double right, double bottom, double top, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84)
Creates a new instance of a view state with an orthographic projection.
void setMeasureDelegate(std::shared_ptr< ViewStateMeasureDelegate > pMeasureDelegate)
Set the measure delegate object.
glm::dvec3 getUp() const noexcept
Gets the up direction of the camera in Earth-centered, Earth-fixed coordinates.
double computeScreenSpaceError(const Tile &tile, double distance, uint32_t depth) const noexcept
Computes the screen space error.
double getVerticalFieldOfView() const noexcept
Gets the vertical field-of-view angle in radians. This is only valid for a symmetric perspective proj...
const glm::dvec3 & getPosition() const noexcept
Gets the position of the camera in Earth-centered, Earth-fixed coordinates.
A quadratic surface defined in Cartesian coordinates.
Classes that implement the 3D Tiles standard.
std::variant< CesiumGeometry::CullingVolume, Cesium3DTiles::BoundingVolume > GeneralCullingVolume
A general culling volume for selecting and filtering tiles.
std::variant< CesiumGeometry::BoundingSphere, CesiumGeometry::OrientedBoundingBox, CesiumGeospatial::BoundingRegion, CesiumGeospatial::BoundingRegionWithLooseFittingHeights, CesiumGeospatial::S2CellBoundingVolume, CesiumGeometry::BoundingCylinderRegion > BoundingVolume
A bounding volume.