diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-05-12 15:49:50 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2017-05-12 15:49:50 +0200 |
commit | e62817b8252974b8a98393275874ee303840bf13 (patch) | |
tree | 4565935f06e369f4a84410b0c098958e07a750c7 /depedencies/include/glm/detail/_vectorize.hpp | |
parent | 2017-05-10 (diff) | |
download | AltCraft-e62817b8252974b8a98393275874ee303840bf13.tar AltCraft-e62817b8252974b8a98393275874ee303840bf13.tar.gz AltCraft-e62817b8252974b8a98393275874ee303840bf13.tar.bz2 AltCraft-e62817b8252974b8a98393275874ee303840bf13.tar.lz AltCraft-e62817b8252974b8a98393275874ee303840bf13.tar.xz AltCraft-e62817b8252974b8a98393275874ee303840bf13.tar.zst AltCraft-e62817b8252974b8a98393275874ee303840bf13.zip |
Diffstat (limited to '')
-rw-r--r-- | depedencies/include/glm/detail/_vectorize.hpp | 131 |
1 files changed, 131 insertions, 0 deletions
diff --git a/depedencies/include/glm/detail/_vectorize.hpp b/depedencies/include/glm/detail/_vectorize.hpp new file mode 100644 index 0000000..a08ed34 --- /dev/null +++ b/depedencies/include/glm/detail/_vectorize.hpp @@ -0,0 +1,131 @@ +/// @ref core +/// @file glm/detail/_vectorize.hpp + +#pragma once + +#include "type_vec1.hpp" +#include "type_vec2.hpp" +#include "type_vec3.hpp" +#include "type_vec4.hpp" + +namespace glm{ +namespace detail +{ + template <typename R, typename T, precision P, template <typename, precision> class vecType> + struct functor1{}; + + template <typename R, typename T, precision P> + struct functor1<R, T, P, tvec1> + { + GLM_FUNC_QUALIFIER static tvec1<R, P> call(R (*Func) (T x), tvec1<T, P> const & v) + { + return tvec1<R, P>(Func(v.x)); + } + }; + + template <typename R, typename T, precision P> + struct functor1<R, T, P, tvec2> + { + GLM_FUNC_QUALIFIER static tvec2<R, P> call(R (*Func) (T x), tvec2<T, P> const & v) + { + return tvec2<R, P>(Func(v.x), Func(v.y)); + } + }; + + template <typename R, typename T, precision P> + struct functor1<R, T, P, tvec3> + { + GLM_FUNC_QUALIFIER static tvec3<R, P> call(R (*Func) (T x), tvec3<T, P> const & v) + { + return tvec3<R, P>(Func(v.x), Func(v.y), Func(v.z)); + } + }; + + template <typename R, typename T, precision P> + struct functor1<R, T, P, tvec4> + { + GLM_FUNC_QUALIFIER static tvec4<R, P> call(R (*Func) (T x), tvec4<T, P> const & v) + { + return tvec4<R, P>(Func(v.x), Func(v.y), Func(v.z), Func(v.w)); + } + }; + + template <typename T, precision P, template <typename, precision> class vecType> + struct functor2{}; + + template <typename T, precision P> + struct functor2<T, P, tvec1> + { + GLM_FUNC_QUALIFIER static tvec1<T, P> call(T (*Func) (T x, T y), tvec1<T, P> const & a, tvec1<T, P> const & b) + { + return tvec1<T, P>(Func(a.x, b.x)); + } + }; + + template <typename T, precision P> + struct functor2<T, P, tvec2> + { + GLM_FUNC_QUALIFIER static tvec2<T, P> call(T (*Func) (T x, T y), tvec2<T, P> const & a, tvec2<T, P> const & b) + { + return tvec2<T, P>(Func(a.x, b.x), Func(a.y, b.y)); + } + }; + + template <typename T, precision P> + struct functor2<T, P, tvec3> + { + GLM_FUNC_QUALIFIER static tvec3<T, P> call(T (*Func) (T x, T y), tvec3<T, P> const & a, tvec3<T, P> const & b) + { + return tvec3<T, P>(Func(a.x, b.x), Func(a.y, b.y), Func(a.z, b.z)); + } + }; + + template <typename T, precision P> + struct functor2<T, P, tvec4> + { + GLM_FUNC_QUALIFIER static tvec4<T, P> call(T (*Func) (T x, T y), tvec4<T, P> const & a, tvec4<T, P> const & b) + { + return tvec4<T, P>(Func(a.x, b.x), Func(a.y, b.y), Func(a.z, b.z), Func(a.w, b.w)); + } + }; + + template <typename T, precision P, template <typename, precision> class vecType> + struct functor2_vec_sca{}; + + template <typename T, precision P> + struct functor2_vec_sca<T, P, tvec1> + { + GLM_FUNC_QUALIFIER static tvec1<T, P> call(T (*Func) (T x, T y), tvec1<T, P> const & a, T b) + { + return tvec1<T, P>(Func(a.x, b)); + } + }; + + template <typename T, precision P> + struct functor2_vec_sca<T, P, tvec2> + { + GLM_FUNC_QUALIFIER static tvec2<T, P> call(T (*Func) (T x, T y), tvec2<T, P> const & a, T b) + { + return tvec2<T, P>(Func(a.x, b), Func(a.y, b)); + } + }; + + template <typename T, precision P> + struct functor2_vec_sca<T, P, tvec3> + { + GLM_FUNC_QUALIFIER static tvec3<T, P> call(T (*Func) (T x, T y), tvec3<T, P> const & a, T b) + { + return tvec3<T, P>(Func(a.x, b), Func(a.y, b), Func(a.z, b)); + } + }; + + template <typename T, precision P> + struct functor2_vec_sca<T, P, tvec4> + { + GLM_FUNC_QUALIFIER static tvec4<T, P> call(T (*Func) (T x, T y), tvec4<T, P> const & a, T b) + { + return tvec4<T, P>(Func(a.x, b), Func(a.y, b), Func(a.z, b), Func(a.w, b)); + } + }; +}//namespace detail +}//namespace glm |