3#include <Cesium3DTilesSelection/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>
34 const glm::dvec3& position,
35 const glm::dvec3& direction,
37 const glm::dvec2& viewportSize,
38 double horizontalFieldOfView,
39 double verticalFieldOfView,
59 const glm::dvec3& position,
60 const glm::dvec3& direction,
62 const glm::dvec2& viewportSize,
63 double horizontalFieldOfView,
64 double verticalFieldOfView,
81 const glm::dmat4& viewMatrix,
82 const glm::dmat4& projectionMatrix,
83 const glm::dvec2& viewportSize,
104 const glm::dvec3& position,
105 const glm::dvec3& direction,
106 const glm::dvec3& up,
107 const glm::dvec2& viewportSize,
129 double geometricErrorThreshold,
136 const glm::dvec3&
getPosition() const noexcept {
return this->_position; }
142 const glm::dvec3&
getDirection() const noexcept {
return this->_direction; }
150 this->_viewMatrix[0][1],
151 this->_viewMatrix[1][1],
152 this->_viewMatrix[2][1]};
161 const std::optional<CesiumGeospatial::Cartographic>&
163 return this->_positionCartographic;
170 return this->_viewportSize;
188 const glm::dmat4&
getViewMatrix() const noexcept {
return this->_viewMatrix; }
194 return this->_projectionMatrix;
201 return this->_geometricErrorThreshold;
247 glm::dvec3 _position;
248 glm::dvec3 _direction;
249 glm::dvec2 _viewportSize;
252 std::optional<CesiumGeospatial::Cartographic> _positionCartographic;
255 glm::dmat4 _viewMatrix;
256 glm::dmat4 _projectionMatrix;
257 std::optional<double> _geometricErrorThreshold;
const glm::dvec3 & getDirection() const noexcept
Gets the look direction of the camera in Earth-centered, Earth-fixed coordinates.
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 getHorizontalFieldOfView() const noexcept
Gets the horizontal field-of-view angle in radians. This is only valid for a symmetric perspective pr...
double computeDistanceSquaredToBoundingVolume(const BoundingVolume &boundingVolume) const noexcept
Computes the squared distance to the given BoundingVolume.
std::optional< double > getGeometricErrorThreshold() const
Gets the geometric error threshold.
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.
const std::optional< CesiumGeospatial::Cartographic > & getPositionCartographic() const noexcept
Gets the position of the camera as a longitude / latitude / height.
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.
ViewState(const BoundingVolume &boundingVolume, double geometricErrorThreshold, const CesiumGeospatial::Ellipsoid &ellipsoid=CesiumGeospatial::Ellipsoid::WGS84)
Creates a new instance of a view state from a bounding volume associated with a geographic area,...
glm::dvec3 getUp() const noexcept
Gets the up direction of the camera in Earth-centered, Earth-fixed coordinates.
bool isBoundingVolumeVisible(const BoundingVolume &boundingVolume) const noexcept
Returns whether the given BoundingVolume is visible for this camera.
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::BoundingSphere, CesiumGeometry::OrientedBoundingBox, CesiumGeospatial::BoundingRegion, CesiumGeospatial::BoundingRegionWithLooseFittingHeights, CesiumGeospatial::S2CellBoundingVolume, CesiumGeometry::BoundingCylinderRegion > BoundingVolume
A bounding volume.
std::variant< CesiumGeometry::CullingVolume, BoundingVolume > GeneralCullingVolume
A general culling volume for selecting and filtering tiles.