Browse Source

Add Vector[324][u][hsb] convenience typedefs for small types.

And also Color variants, to make it complete. No half types for matrices
right now, those might come later.
pull/275/head
Vladimír Vondruš 6 years ago
parent
commit
73c37a8339
  1. 7
      doc/changelog.dox
  2. 14
      doc/types.dox
  3. 122
      src/Magnum/Magnum.h
  4. 6
      src/Magnum/Math/Color.h
  5. 5
      src/Magnum/Math/Vector2.h
  6. 5
      src/Magnum/Math/Vector3.h
  7. 5
      src/Magnum/Math/Vector4.h

7
doc/changelog.dox

@ -43,6 +43,13 @@ See also:
@subsection changelog-latest-new New features @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 @subsubsection changelog-latest-new-audio Audio library
- Added a @ref Audio::Buffer::frequency() getter - Added a @ref Audio::Buffer::frequency() getter

14
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 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 types are aliases of corresponding types in @ref Math namespace. No suffix
after type name means @ref Float underlying type, `ui` means @ref UnsignedInt after type name means @ref Float underlying type, `h` means @ref Half, `d` is
underlying type, `i` is @ref Int underlying type and `d` is for @ref Double @ref Double, `ub` @ref UnsignedByte, `b` @ref Byte, `us` @ref UnsignedShort,
underlying type. `s` @ref Short, `ui` @ref UnsignedInt and `i` is @ref Int.
@section types-matrix Matrix/vector types @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 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 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 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 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 | | Magnum matrix type | Equivalent GLSL type |
| ---------------------------------------------------------------- | ------------------------------------- | | ---------------------------------------------------------------- | ------------------------------------- |

122
src/Magnum/Magnum.h

@ -269,6 +269,78 @@ Equivalent to GLSL @glsl vec4 @ce.
*/ */
typedef Math::Vector4<Float> Vector4; typedef Math::Vector4<Float> Vector4;
/**
@brief Two-component unsigned byte vector
@m_since_latest
*/
typedef Math::Vector2<UnsignedByte> Vector2ub;
/**
@brief Three-component unsigned byte vector
@m_since_latest
*/
typedef Math::Vector3<UnsignedByte> Vector3ub;
/**
@brief Four-component unsigned byte vector
@m_since_latest
*/
typedef Math::Vector4<UnsignedByte> Vector4ub;
/**
@brief Two-component signed byte vector
@m_since_latest
*/
typedef Math::Vector2<Byte> Vector2b;
/**
@brief Three-component signed byte vector
@m_since_latest
*/
typedef Math::Vector3<Byte> Vector3b;
/**
@brief Four-component signed byte vector
@m_since_latest
*/
typedef Math::Vector4<Byte> Vector4b;
/**
@brief Two-component unsigned short vector
@m_since_latest
*/
typedef Math::Vector2<UnsignedShort> Vector2us;
/**
@brief Three-component unsigned short vector
@m_since_latest
*/
typedef Math::Vector3<UnsignedShort> Vector3us;
/**
@brief Four-component unsigned short vector
@m_since_latest
*/
typedef Math::Vector4<UnsignedShort> Vector4us;
/**
@brief Two-component signed short vector
@m_since_latest
*/
typedef Math::Vector2<Short> Vector2s;
/**
@brief Three-component signed short vector
@m_since_latest
*/
typedef Math::Vector3<Short> Vector3s;
/**
@brief Four-component signed short vector
@m_since_latest
*/
typedef Math::Vector4<Short> Vector4s;
/** /**
@brief Two-component unsigned integer vector @brief Two-component unsigned integer vector
@ -336,6 +408,12 @@ typedef Math::ColorHsv<Float> ColorHsv;
*/ */
typedef Math::Color3<UnsignedByte> Color3ub; typedef Math::Color3<UnsignedByte> Color3ub;
/**
@brief Three-component (RGB) unsigned short color
@m_since_latest
*/
typedef Math::Color3<UnsignedShort> Color3us;
/** /**
@brief Four-component (RGBA) unsigned byte color @brief Four-component (RGBA) unsigned byte color
@ -346,6 +424,12 @@ typedef Math::Color3<UnsignedByte> Color3ub;
*/ */
typedef Math::Color4<UnsignedByte> Color4ub; typedef Math::Color4<UnsignedByte> Color4ub;
/**
@brief Four-component (RGB) unsigned short color
@m_since_latest
*/
typedef Math::Color4<UnsignedShort> Color4us;
/** /**
@brief 3x3 float transformation matrix @brief 3x3 float transformation matrix
@ -509,6 +593,44 @@ typedef Math::Frustum<Float> 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<Half> Vector2h;
/**
@brief Three-component half-float vector
@m_since_latest
*/
typedef Math::Vector3<Half> Vector3h;
/**
@brief Four-component half-float vector
@m_since_latest
*/
typedef Math::Vector4<Half> Vector4h;
/**
@brief Three-component (RGB) half-float color
@m_since_latest
*/
typedef Math::Color3<Half> Color3h;
/**
@brief Four-component (RGBA) half-float color
@m_since_latest
*/
typedef Math::Color4<Half> Color4h;
/*@}*/
/** @{ @name Double-precision types /** @{ @name Double-precision types
See @ref types for more information. See @ref types for more information.

6
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, @see @link operator""_rgb() @endlink, @link operator""_rgbf() @endlink,
@link operator""_srgb() @endlink, @link operator""_srgbf() @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 /* Not using template specialization because some internal functions are
impossible to explicitly instantiate */ impossible to explicitly instantiate */
@ -619,7 +620,8 @@ MAGNUM_VECTORn_OPERATOR_IMPLEMENTATION(3, Color3)
See @ref Color3 for more information. See @ref Color3 for more information.
@see @link operator""_rgba() @endlink, @link operator""_rgbaf() @endlink, @see @link operator""_rgba() @endlink, @link operator""_rgbaf() @endlink,
@link operator""_srgba() @endlink, @link operator""_srgbaf() @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 /* Not using template specialization because some internal functions are
impossible to explicitly instantiate */ impossible to explicitly instantiate */

5
src/Magnum/Math/Vector2.h

@ -56,8 +56,9 @@ template<class T> inline T cross(const Vector2<T>& a, const Vector2<T>& b) {
@tparam T Data type @tparam T Data type
See @ref matrix-vector for brief introduction. See @ref matrix-vector for brief introduction.
@see @ref Magnum::Vector2, @ref Magnum::Vector2i, @ref Magnum::Vector2ui, @see @ref Magnum::Vector2, @ref Magnum::Vector3h, @ref Magnum::Vector2d,
@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} @configurationvalueref{Magnum::Math::Vector2}
*/ */
template<class T> class Vector2: public Vector<2, T> { template<class T> class Vector2: public Vector<2, T> {

5
src/Magnum/Math/Vector3.h

@ -60,8 +60,9 @@ template<class T> inline Vector3<T> cross(const Vector3<T>& a, const Vector3<T>&
@tparam T Data type @tparam T Data type
See @ref matrix-vector for brief introduction. See @ref matrix-vector for brief introduction.
@see @ref Magnum::Vector3, @ref Magnum::Vector3i, @ref Magnum::Vector3ui, @see @ref Magnum::Vector3, @ref Magnum::Vector3h, @ref Magnum::Vector3d,
@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} @configurationvalueref{Magnum::Math::Vector3}
*/ */
template<class T> class Vector3: public Vector<3, T> { template<class T> class Vector3: public Vector<3, T> {

5
src/Magnum/Math/Vector4.h

@ -38,8 +38,9 @@ namespace Magnum { namespace Math {
@tparam T Data type @tparam T Data type
See @ref matrix-vector for brief introduction. See @ref matrix-vector for brief introduction.
@see @ref Magnum::Vector4, @ref Magnum::Vector4i, @ref Magnum::Vector4ui, @see @ref Magnum::Vector4, @ref Magnum::Vector4h, @ref Magnum::Vector4d,
@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} @configurationvalueref{Magnum::Math::Vector4}
*/ */
template<class T> class Vector4: public Vector<4, T> { template<class T> class Vector4: public Vector<4, T> {

Loading…
Cancel
Save