diff --git a/doc/changelog.dox b/doc/changelog.dox index 4b0dea925..b0b7ef075 100644 --- a/doc/changelog.dox +++ b/doc/changelog.dox @@ -43,6 +43,13 @@ See also: @subsection changelog-latest-new New features +- New @ref Vector2h, @ref Vector3h, @ref Vector4h, @ref Vector2ub, + @ref Vector3ub, @ref Vector4ub, @ref Vector2b, @ref Vector3b, + @ref Vector4b, @ref Vector2us, @ref Vector3us, @ref Vector4us, + @ref Vector2s, @ref Vector3s, @ref Vector4s, @ref Color3h, @ref Color4h, + @ref Color3us, @ref Color4us convenience typedefs for half-float, 8- and + 16-bit integer vector and color types + @subsubsection changelog-latest-new-audio Audio library - Added a @ref Audio::Buffer::frequency() getter diff --git a/doc/types.dox b/doc/types.dox index 21496fa85..7441f18ef 100644 --- a/doc/types.dox +++ b/doc/types.dox @@ -61,9 +61,9 @@ Types not meant to be used in arithmetic (such as @cpp bool @ce or Types from the above table are then used to define other types. All following types are aliases of corresponding types in @ref Math namespace. No suffix -after type name means @ref Float underlying type, `ui` means @ref UnsignedInt -underlying type, `i` is @ref Int underlying type and `d` is for @ref Double -underlying type. +after type name means @ref Float underlying type, `h` means @ref Half, `d` is +@ref Double, `ub` @ref UnsignedByte, `b` @ref Byte, `us` @ref UnsignedShort, +`s` @ref Short, `ui` @ref UnsignedInt and `i` is @ref Int. @section types-matrix Matrix/vector types @@ -71,10 +71,14 @@ underlying type. | ---------------------------------------------- | ------------------------- | | @ref BoolVector2, @ref BoolVector3, @ref BoolVector4 | @glsl bvec2 @ce, @glsl bvec3 @ce, @glsl bvec4 @ce | | @ref Vector2, @ref Vector3, @ref Color3, @ref Vector4, @ref Color4 | @glsl vec2 @ce, @glsl vec3 @ce, @glsl vec4 @ce | +| @ref Vector2h, @ref Vector3h, @ref Color3h, @ref Vector4h, @ref Color4h | (*none*) | +| @ref Vector2d, @ref Vector3d, @ref Vector4d | @glsl dvec2 @ce, @glsl dvec3 @ce, @glsl dvec4 @ce | +| @ref Vector2ub, @ref Vector3ub, @ref Vector4ub, @ref Color3ub, @ref Color4ub | (*none*) | +| @ref Vector2b, @ref Vector3b, @ref Vector4b | (*none*) | +| @ref Vector2us, @ref Vector3us, @ref Vector4us, @ref Color3us, @ref Color4us | (*none*) | +| @ref Vector2s, @ref Vector3s, @ref Vector4s | (*none*) | | @ref Vector2ui, @ref Vector3ui, @ref Vector4ui | @glsl uvec2 @ce, @glsl uvec3 @ce, @glsl uvec4 @ce | | @ref Vector2i, @ref Vector3i, @ref Vector4i | @glsl ivec2 @ce, @glsl ivec3 @ce, @glsl ivec4 @ce | -| @ref Vector2d, @ref Vector3d, @ref Vector4d | @glsl dvec2 @ce, @glsl dvec3 @ce, @glsl dvec4 @ce | -| @ref Color3ub, @ref Color4ub | (*none*) | | Magnum matrix type | Equivalent GLSL type | | ---------------------------------------------------------------- | ------------------------------------- | diff --git a/src/Magnum/Magnum.h b/src/Magnum/Magnum.h index b815b83af..f169d1884 100644 --- a/src/Magnum/Magnum.h +++ b/src/Magnum/Magnum.h @@ -269,6 +269,78 @@ Equivalent to GLSL @glsl vec4 @ce. */ typedef Math::Vector4 Vector4; +/** +@brief Two-component unsigned byte vector +@m_since_latest +*/ +typedef Math::Vector2 Vector2ub; + +/** +@brief Three-component unsigned byte vector +@m_since_latest +*/ +typedef Math::Vector3 Vector3ub; + +/** +@brief Four-component unsigned byte vector +@m_since_latest +*/ +typedef Math::Vector4 Vector4ub; + +/** +@brief Two-component signed byte vector +@m_since_latest +*/ +typedef Math::Vector2 Vector2b; + +/** +@brief Three-component signed byte vector +@m_since_latest +*/ +typedef Math::Vector3 Vector3b; + +/** +@brief Four-component signed byte vector +@m_since_latest +*/ +typedef Math::Vector4 Vector4b; + +/** +@brief Two-component unsigned short vector +@m_since_latest +*/ +typedef Math::Vector2 Vector2us; + +/** +@brief Three-component unsigned short vector +@m_since_latest +*/ +typedef Math::Vector3 Vector3us; + +/** +@brief Four-component unsigned short vector +@m_since_latest +*/ +typedef Math::Vector4 Vector4us; + +/** +@brief Two-component signed short vector +@m_since_latest +*/ +typedef Math::Vector2 Vector2s; + +/** +@brief Three-component signed short vector +@m_since_latest +*/ +typedef Math::Vector3 Vector3s; + +/** +@brief Four-component signed short vector +@m_since_latest +*/ +typedef Math::Vector4 Vector4s; + /** @brief Two-component unsigned integer vector @@ -336,6 +408,12 @@ typedef Math::ColorHsv ColorHsv; */ typedef Math::Color3 Color3ub; +/** +@brief Three-component (RGB) unsigned short color +@m_since_latest +*/ +typedef Math::Color3 Color3us; + /** @brief Four-component (RGBA) unsigned byte color @@ -346,6 +424,12 @@ typedef Math::Color3 Color3ub; */ typedef Math::Color4 Color4ub; +/** +@brief Four-component (RGB) unsigned short color +@m_since_latest +*/ +typedef Math::Color4 Color4us; + /** @brief 3x3 float transformation matrix @@ -509,6 +593,44 @@ typedef Math::Frustum Frustum; /*@}*/ +/** @{ @name Half-precision types + +These types are for storage and conversion from / to single-precision types, +no arithmetic operations are implemented. See @ref types for more information. +*/ + +/** +@brief Two-component half-float vector +@m_since_latest +*/ +typedef Math::Vector2 Vector2h; + +/** +@brief Three-component half-float vector +@m_since_latest +*/ +typedef Math::Vector3 Vector3h; + +/** +@brief Four-component half-float vector +@m_since_latest +*/ +typedef Math::Vector4 Vector4h; + +/** +@brief Three-component (RGB) half-float color +@m_since_latest +*/ +typedef Math::Color3 Color3h; + +/** +@brief Four-component (RGBA) half-float color +@m_since_latest +*/ +typedef Math::Color4 Color4h; + +/*@}*/ + /** @{ @name Double-precision types See @ref types for more information. diff --git a/src/Magnum/Math/Color.h b/src/Magnum/Math/Color.h index 2db51da63..5bb30ab2e 100644 --- a/src/Magnum/Math/Color.h +++ b/src/Magnum/Math/Color.h @@ -242,7 +242,8 @@ value in range @f$ [0.0, 1.0] @f$. @see @link operator""_rgb() @endlink, @link operator""_rgbf() @endlink, @link operator""_srgb() @endlink, @link operator""_srgbf() @endlink, - @ref Color4, @ref Magnum::Color3, @ref Magnum::Color3ub + @ref Color4, @ref Magnum::Color3, @ref Magnum::Color3h, + @ref Magnum::Color3ub, @ref Magnum::Color3us */ /* Not using template specialization because some internal functions are impossible to explicitly instantiate */ @@ -619,7 +620,8 @@ MAGNUM_VECTORn_OPERATOR_IMPLEMENTATION(3, Color3) See @ref Color3 for more information. @see @link operator""_rgba() @endlink, @link operator""_rgbaf() @endlink, @link operator""_srgba() @endlink, @link operator""_srgbaf() @endlink, - @ref Magnum::Color4, @ref Magnum::Color4ub + @ref Magnum::Color4, @ref Magnum::Color4h, @ref Magnum::Color4ub, + @ref Magnum::Color4us */ /* Not using template specialization because some internal functions are impossible to explicitly instantiate */ diff --git a/src/Magnum/Math/Vector2.h b/src/Magnum/Math/Vector2.h index af8168e98..d5d7b47ef 100644 --- a/src/Magnum/Math/Vector2.h +++ b/src/Magnum/Math/Vector2.h @@ -56,8 +56,9 @@ template inline T cross(const Vector2& a, const Vector2& b) { @tparam T Data type See @ref matrix-vector for brief introduction. -@see @ref Magnum::Vector2, @ref Magnum::Vector2i, @ref Magnum::Vector2ui, - @ref Magnum::Vector2d +@see @ref Magnum::Vector2, @ref Magnum::Vector3h, @ref Magnum::Vector2d, + @ref Magnum::Vector2ub, @ref Magnum::Vector2b, @ref Magnum::Vector2us, + @ref Magnum::Vector2s, @ref Magnum::Vector2ui, @ref Magnum::Vector2i @configurationvalueref{Magnum::Math::Vector2} */ template class Vector2: public Vector<2, T> { diff --git a/src/Magnum/Math/Vector3.h b/src/Magnum/Math/Vector3.h index cb8a6120b..ca5cfe119 100644 --- a/src/Magnum/Math/Vector3.h +++ b/src/Magnum/Math/Vector3.h @@ -60,8 +60,9 @@ template inline Vector3 cross(const Vector3& a, const Vector3& @tparam T Data type See @ref matrix-vector for brief introduction. -@see @ref Magnum::Vector3, @ref Magnum::Vector3i, @ref Magnum::Vector3ui, - @ref Magnum::Vector3d +@see @ref Magnum::Vector3, @ref Magnum::Vector3h, @ref Magnum::Vector3d, + @ref Magnum::Vector3ub, @ref Magnum::Vector3b, @ref Magnum::Vector3us, + @ref Magnum::Vector3s, @ref Magnum::Vector3ui, @ref Magnum::Vector3i @configurationvalueref{Magnum::Math::Vector3} */ template class Vector3: public Vector<3, T> { diff --git a/src/Magnum/Math/Vector4.h b/src/Magnum/Math/Vector4.h index 68facd8e5..f964c7dbe 100644 --- a/src/Magnum/Math/Vector4.h +++ b/src/Magnum/Math/Vector4.h @@ -38,8 +38,9 @@ namespace Magnum { namespace Math { @tparam T Data type See @ref matrix-vector for brief introduction. -@see @ref Magnum::Vector4, @ref Magnum::Vector4i, @ref Magnum::Vector4ui, - @ref Magnum::Vector4d +@see @ref Magnum::Vector4, @ref Magnum::Vector4h, @ref Magnum::Vector4d, + @ref Magnum::Vector4ub, @ref Magnum::Vector4b, @ref Magnum::Vector4us, + @ref Magnum::Vector4s, @ref Magnum::Vector4ui, @ref Magnum::Vector4i @configurationvalueref{Magnum::Math::Vector4} */ template class Vector4: public Vector<4, T> {