Browse Source

Add Degh, Radh and Range*Dh typedefs.

We have half-float vectors and matrices, so why not these as well. Not
sure for what all is the angle precision usable, but at the very least
it could be useful for compact meshlet occlusion cone / AABB
representation or rough animations.
pull/529/head
Vladimír Vondruš 5 years ago
parent
commit
120286a930
  1. 2
      doc/changelog.dox
  2. 30
      src/Magnum/Magnum.h
  3. 4
      src/Magnum/Math/Angle.h
  4. 12
      src/Magnum/Math/Range.h

2
doc/changelog.dox

@ -51,6 +51,8 @@ See also:
including mapping to @ref GL::PixelFormat / @ref GL::PixelType,
@ref GL::TextureFormat and @ref Vk::PixelFormat and (partial) support in
@ref DebugTools::CompareImage
- New @ref Degh, @ref Radh, @ref Range1Dh, @ref Range2Dh and @ref Range3Dh
typedefs for half-float angles and ranges
@subsubsection changelog-latest-new-debugtools DebugTools library

30
src/Magnum/Magnum.h

@ -967,6 +967,36 @@ typedef Math::Matrix4x3<Half> Matrix4x3h;
*/
typedef Math::Matrix4x4<Half> Matrix4x4h;
/**
@brief Angle in half-float degrees
@m_since_latest
*/
typedef Math::Deg<Half> Degh;
/**
@brief Angle in half-float radians
@m_since_latest
*/
typedef Math::Rad<Half> Radh;
/**
@brief One-dimensional half-float range
@m_since_latest
*/
typedef Math::Range1D<Half> Range1Dh;
/**
@brief Two-dimensional half-float range
@m_since_latest
*/
typedef Math::Range2D<Half> Range2Dh;
/**
@brief Three-dimensional half-float range
@m_since_latest
*/
typedef Math::Range3D<Half> Range3Dh;
/* Since 1.8.17, the original short-hand group closing doesn't work anymore.
FFS. */
/**

4
src/Magnum/Math/Angle.h

@ -94,7 +94,7 @@ These silent errors are easily avoided by requiring explicit conversions:
@snippet MagnumMath.cpp Deg-usage-explicit-conversion
@see @ref Magnum::Deg, @ref Magnum::Degd
@see @ref Magnum::Deg, @ref Magnum::Degh, @ref Magnum::Degd
*/
template<class T> class Deg: public Unit<Deg, T> {
public:
@ -166,7 +166,7 @@ constexpr Deg<Float> operator "" _degf(long double value) { return Deg<Float>(Fl
@brief Angle in radians
See @ref Deg for more information.
@see @ref Magnum::Rad, @ref Magnum::Radd
@see @ref Magnum::Rad, @ref Magnum::Radh, @ref Magnum::Radd
*/
template<class T> class Rad: public Unit<Rad, T> {
public:

12
src/Magnum/Math/Range.h

@ -348,8 +348,8 @@ template<UnsignedInt dimensions, class T> class Range {
Convenience alternative to @cpp Range<1, T> @ce. See @ref Range for more
information.
@see @ref Range2D, @ref Range3D, @ref Magnum::Range1D, @ref Magnum::Range1Di,
@ref Magnum::Range1Dd
@see @ref Range2D, @ref Range3D, @ref Magnum::Range1D, @ref Magnum::Range1Dh,
@ref Magnum::Range1Dd, @ref Magnum::Range1Di
*/
#ifndef CORRADE_MSVC2015_COMPATIBILITY /* Multiple definitions still broken */
template<class T> using Range1D = Range<1, T>;
@ -359,8 +359,8 @@ template<class T> using Range1D = Range<1, T>;
@brief Two-dimensional range
See @ref Range for more information.
@see @ref Range1D, @ref Range3D, @ref Magnum::Range2D, @ref Magnum::Range2Di,
@ref Magnum::Range2Dd
@see @ref Range1D, @ref Range3D, @ref Magnum::Range2D, @ref Magnum::Range2Dh,
@ref Magnum::Range2Dd, @ref Magnum::Range2Di
*/
template<class T> class Range2D: public Range<2, T> {
public:
@ -513,8 +513,8 @@ template<class T> class Range2D: public Range<2, T> {
@brief Three-dimensional range
See @ref Range for more information.
@see @ref Range1D, @ref Range2D, @ref Magnum::Range3D, @ref Magnum::Range3Di,
@ref Magnum::Range3Dd
@see @ref Range1D, @ref Range2D, @ref Magnum::Range3D, @ref Magnum::Range3Dh,
@ref Magnum::Range3Dd, @ref Magnum::Range3Di
*/
template<class T> class Range3D: public Range<3, T> {
public:

Loading…
Cancel
Save