coord: use template typedefs

This commit is contained in:
Danny Robson 2015-07-24 01:34:44 +10:00
parent 86b36afc49
commit 4ea5896d21
4 changed files with 42 additions and 25 deletions

View File

@ -46,11 +46,14 @@ namespace util {
};
// Convenience types
typedef colour<3,uint8_t> colour3u;
typedef colour<4,uint8_t> colour4u;
template <typename T> using colour3 = colour<3,T>;
template <typename T> using colour4 = colour<4,T>;
typedef colour<4,float> colour4f;
typedef colour<3,float> colour3f;
typedef colour3<uint8_t> colour3u;
typedef colour4<uint8_t> colour4u;
typedef colour4<float> colour4f;
typedef colour3<float> colour3f;
// RGB <-> HSV
colour3f rgb_to_hsv (colour3f);

View File

@ -51,10 +51,14 @@ namespace util {
static const extent MIN;
};
typedef extent<2,intmax_t> extent2i;
typedef extent<2,size_t> extent2u;
typedef extent<2,float> extent2f;
typedef extent<2,double> extent2d;
// convenience typedefs
template <typename T> using extent2 = extent<2,T>;
template <typename T> using extent3 = extent<3,T>;
typedef extent2<intmax_t> extent2i;
typedef extent2<size_t> extent2u;
typedef extent2<float> extent2f;
typedef extent2<double> extent2d;
template <size_t S, typename T>
std::ostream& operator<< (std::ostream&, util::extent<S,T>);

View File

@ -61,15 +61,25 @@ namespace util {
std::ostream& operator<< (std::ostream&, point<S,T>);
// Convenience typedefs
typedef point<2,float> point2f;
typedef point<3,float> point3f;
typedef point<4,float> point4f;
template <typename T> using point2 = point<2,T>;
template <typename T> using point3 = point<3,T>;
template <typename T> using point4 = point<4,T>;
typedef point<2,double> point2d;
typedef point<3,double> point3d;
typedef point2<float> point2f;
typedef point3<float> point3f;
typedef point4<float> point4f;
typedef point<2,size_t> point2u;
typedef point<2,intmax_t> point2i;
typedef point2<double> point2d;
typedef point3<double> point3d;
typedef point4<double> point4d;
typedef point2<size_t> point2u;
typedef point3<size_t> point3u;
typedef point4<size_t> point4u;
typedef point2<intmax_t> point2i;
typedef point3<intmax_t> point3i;
typedef point4<intmax_t> point4i;
}
#include <functional>

View File

@ -77,19 +77,19 @@ namespace util {
template <typename T> using vector3 = vector<3,T>;
template <typename T> using vector4 = vector<4,T>;
typedef vector<2,size_t> vector2u;
typedef vector<3,size_t> vector3u;
typedef vector2<size_t> vector2u;
typedef vector3<size_t> vector3u;
typedef vector<2,intmax_t> vector2i;
typedef vector<3,intmax_t> vector3i;
typedef vector2<intmax_t> vector2i;
typedef vector3<intmax_t> vector3i;
typedef vector<2,float> vector2f;
typedef vector<3,float> vector3f;
typedef vector<4,float> vector4f;
typedef vector2<float> vector2f;
typedef vector3<float> vector3f;
typedef vector4<float> vector4f;
typedef vector<2,double> vector2d;
typedef vector<3,double> vector3d;
typedef vector<3,double> vector4d;
typedef vector2<double> vector2d;
typedef vector3<double> vector3d;
typedef vector3<double> vector4d;
}
#include "vector.ipp"