#include <Magnum/Math/Frustum.h>
template<class T>
Frustum class
Camera frustum.
Stores camera frustum planes in order left (index 0
), right (index 1
), bottom (index 2
), top (index 3
), near (index 4
) and far (index 5
).
Public static functions
- static auto fromMatrix(const Matrix4<T>& m) -> Frustum<T>
- Create a frustum from a projection matrix.
Constructors, destructors, conversion operators
- Frustum() constexpr noexcept
- Default constructor.
- Frustum(IdentityInitT) explicit constexpr noexcept
- Identity constructor.
-
Frustum(Magnum::
NoInitT) explicit noexcept - Construct a frustum without initializing the contents.
- Frustum(const Vector4<T>& left, const Vector4<T>& right, const Vector4<T>& bottom, const Vector4<T>& top, const Vector4<T>& near, const Vector4<T>& far) constexpr noexcept
- Construct a frustum from plane equations.
-
template<class U>Frustum(const Frustum<U>& other) explicit constexpr noexcept
- Construct a frustum from another of different type.
-
template<class U, class = decltype(Implementation::FrustumConverter<T, U>::from(std::Frustum(const U& other) explicit constexpr noexcept
declval<U>()))> - Construct a frustum from external representation.
-
template<class U, class = decltype(Implementation::FrustumConverter<T, U>::to(std::operator U() const explicit constexpr
declval<Frustum<T>>()))> - Convert the frustum to external representation.
Public functions
- auto operator==(const Frustum<T>& other) const -> bool
- Equality comparison.
- auto operator!=(const Frustum<T>& other) const -> bool
- Non-equality comparison.
- auto data() -> T*
- Raw data.
- auto data() const -> const T*
-
auto planes() const -> Containers::
StaticArrayView<6, const Vector4<T>> deprecated in 2019.10 constexpr - Frustum planes.
-
auto operator[](std::
size_t i) -> Vector4<T>& new in 2020.06 - Plane at given index.
-
auto operator[](std::
size_t i) const -> const Vector4<T>& constexpr - auto begin() -> Vector4<T>* new in 2019.10
- First plane.
- auto begin() const -> const Vector4<T>* constexpr new in 2019.10
- auto cbegin() const -> const Vector4<T>* constexpr new in 2019.10
- auto end() -> Vector4<T>* new in 2019.10
- (One after) last plane
- auto end() const -> const Vector4<T>* constexpr new in 2019.10
- auto cend() const -> const Vector4<T>* constexpr new in 2019.10
- auto left() -> Vector4<T>& new in 2020.06
- Left plane.
- auto left() const -> Vector4<T> constexpr
- auto right() -> Vector4<T>& new in 2020.06
- Right plane.
- auto right() const -> Vector4<T> constexpr
- auto bottom() -> Vector4<T>& new in 2020.06
- Bottom plane.
- auto bottom() const -> Vector4<T> constexpr
- auto top() -> Vector4<T>& new in 2020.06
- Top plane.
- auto top() const -> Vector4<T> constexpr
- auto near() -> Vector4<T>& new in 2020.06
- Near plane.
- auto near() const -> Vector4<T> constexpr
- auto far() -> Vector4<T>& new in 2020.06
- Far plane.
- auto far() const -> Vector4<T> constexpr
Function documentation
template<class T>
Magnum:: Math:: Frustum<T>:: Frustum() constexpr noexcept
Default constructor.
Equivalent to Frustum(IdentityInitT).
template<class T>
Magnum:: Math:: Frustum<T>:: Frustum(IdentityInitT) explicit constexpr noexcept
Identity constructor.
Equivalent to creating a frustum from an identity matrix.
template<class T>
Magnum:: Math:: Frustum<T>:: Frustum(const Vector4<T>& left,
const Vector4<T>& right,
const Vector4<T>& bottom,
const Vector4<T>& top,
const Vector4<T>& near,
const Vector4<T>& far) constexpr noexcept
Construct a frustum from plane equations.
The equations are in a form . You can use planeEquation() to calculate the coefficients from a normal and a point.
template<class T>
T* Magnum:: Math:: Frustum<T>:: data()
Raw data.
Contrary to what Doxygen shows, returns reference to an one-dimensional fixed-size array of 24 elements, i.e. T(&)[24]
.
template<class T>
const T* Magnum:: Math:: Frustum<T>:: data() const
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
Containers:: StaticArrayView<6, const Vector4<T>> Magnum:: Math:: Frustum<T>:: planes() const constexpr
Frustum planes.
template<class T>
Vector4<T>& Magnum:: Math:: Frustum<T>:: operator[](std:: size_t i) new in 2020.06
Plane at given index.
Expects that i
is less than 6
.
template<class T>
const Vector4<T>& Magnum:: Math:: Frustum<T>:: operator[](std:: size_t i) const constexpr
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
Vector4<T>* Magnum:: Math:: Frustum<T>:: begin() new in 2019.10
First plane.
Together with end() useful for range access, for example here to check for a point/frustum intersection, similarly to Intersection::
for(Vector4 plane: frustum) if(Math::Distance::pointPlaneScaled(point, plane) < 0.0f) return false; return true;
template<class T>
const Vector4<T>* Magnum:: Math:: Frustum<T>:: begin() const constexpr new in 2019.10
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
const Vector4<T>* Magnum:: Math:: Frustum<T>:: cbegin() const constexpr new in 2019.10
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
const Vector4<T>* Magnum:: Math:: Frustum<T>:: end() const constexpr new in 2019.10
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
const Vector4<T>* Magnum:: Math:: Frustum<T>:: cend() const constexpr new in 2019.10
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
template<class T>
template<class T>
Debug& operator<<(Debug& debug,
const Frustum<T>& value)
Debug output operator.