diff options
author | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2018-08-21 17:40:38 +0200 |
---|---|---|
committer | LaG1924 <12997935+LaG1924@users.noreply.github.com> | 2018-08-21 17:40:38 +0200 |
commit | 2877f4eda3d1b0c7431039e3142ecf1a282a34b1 (patch) | |
tree | 58ad35e27ab2a3b8955f5adbf28f296670681ffc /external/include/glm/detail/func_geometric.inl | |
parent | Smooth sun movement (diff) | |
download | AltCraft-2877f4eda3d1b0c7431039e3142ecf1a282a34b1.tar AltCraft-2877f4eda3d1b0c7431039e3142ecf1a282a34b1.tar.gz AltCraft-2877f4eda3d1b0c7431039e3142ecf1a282a34b1.tar.bz2 AltCraft-2877f4eda3d1b0c7431039e3142ecf1a282a34b1.tar.lz AltCraft-2877f4eda3d1b0c7431039e3142ecf1a282a34b1.tar.xz AltCraft-2877f4eda3d1b0c7431039e3142ecf1a282a34b1.tar.zst AltCraft-2877f4eda3d1b0c7431039e3142ecf1a282a34b1.zip |
Diffstat (limited to 'external/include/glm/detail/func_geometric.inl')
-rw-r--r-- | external/include/glm/detail/func_geometric.inl | 138 |
1 files changed, 69 insertions, 69 deletions
diff --git a/external/include/glm/detail/func_geometric.inl b/external/include/glm/detail/func_geometric.inl index 07137c3..67255d4 100644 --- a/external/include/glm/detail/func_geometric.inl +++ b/external/include/glm/detail/func_geometric.inl @@ -1,8 +1,8 @@ /// @ref core /// @file glm/detail/func_geometric.inl -#include "func_exponential.hpp" -#include "func_common.hpp" +#include "../exponential.hpp" +#include "../common.hpp" #include "type_vec2.hpp" #include "type_vec4.hpp" #include "type_float.hpp" @@ -10,84 +10,84 @@ namespace glm{ namespace detail { - template <template <typename, precision> class vecType, typename T, precision P, bool Aligned> + template<length_t L, typename T, qualifier Q, bool Aligned> struct compute_length { - GLM_FUNC_QUALIFIER static T call(vecType<T, P> const & v) + GLM_FUNC_QUALIFIER static T call(vec<L, T, Q> const& v) { return sqrt(dot(v, v)); } }; - template <template <typename, precision> class vecType, typename T, precision P, bool Aligned> + template<length_t L, typename T, qualifier Q, bool Aligned> struct compute_distance { - GLM_FUNC_QUALIFIER static T call(vecType<T, P> const & p0, vecType<T, P> const & p1) + GLM_FUNC_QUALIFIER static T call(vec<L, T, Q> const& p0, vec<L, T, Q> const& p1) { return length(p1 - p0); } }; - template <template <class, precision> class vecType, typename T, precision P, bool Aligned> + template<typename V, typename T, bool Aligned> struct compute_dot{}; - template <typename T, precision P, bool Aligned> - struct compute_dot<tvec1, T, P, Aligned> + template<typename T, qualifier Q, bool Aligned> + struct compute_dot<vec<1, T, Q>, T, Aligned> { - GLM_FUNC_QUALIFIER static T call(tvec1<T, P> const & a, tvec1<T, P> const & b) + GLM_FUNC_QUALIFIER static T call(vec<1, T, Q> const& a, vec<1, T, Q> const& b) { return a.x * b.x; } }; - template <typename T, precision P, bool Aligned> - struct compute_dot<tvec2, T, P, Aligned> + template<typename T, qualifier Q, bool Aligned> + struct compute_dot<vec<2, T, Q>, T, Aligned> { - GLM_FUNC_QUALIFIER static T call(tvec2<T, P> const & x, tvec2<T, P> const & y) + GLM_FUNC_QUALIFIER static T call(vec<2, T, Q> const& a, vec<2, T, Q> const& b) { - tvec2<T, P> tmp(x * y); + vec<2, T, Q> tmp(a * b); return tmp.x + tmp.y; } }; - template <typename T, precision P, bool Aligned> - struct compute_dot<tvec3, T, P, Aligned> + template<typename T, qualifier Q, bool Aligned> + struct compute_dot<vec<3, T, Q>, T, Aligned> { - GLM_FUNC_QUALIFIER static T call(tvec3<T, P> const & x, tvec3<T, P> const & y) + GLM_FUNC_QUALIFIER static T call(vec<3, T, Q> const& a, vec<3, T, Q> const& b) { - tvec3<T, P> tmp(x * y); + vec<3, T, Q> tmp(a * b); return tmp.x + tmp.y + tmp.z; } }; - template <typename T, precision P, bool Aligned> - struct compute_dot<tvec4, T, P, Aligned> + template<typename T, qualifier Q, bool Aligned> + struct compute_dot<vec<4, T, Q>, T, Aligned> { - GLM_FUNC_QUALIFIER static T call(tvec4<T, P> const & x, tvec4<T, P> const & y) + GLM_FUNC_QUALIFIER static T call(vec<4, T, Q> const& a, vec<4, T, Q> const& b) { - tvec4<T, P> tmp(x * y); + vec<4, T, Q> tmp(a * b); return (tmp.x + tmp.y) + (tmp.z + tmp.w); } }; - template <typename T, precision P, bool Aligned> + template<typename T, qualifier Q, bool Aligned> struct compute_cross { - GLM_FUNC_QUALIFIER static tvec3<T, P> call(tvec3<T, P> const & x, tvec3<T, P> const & y) + GLM_FUNC_QUALIFIER static vec<3, T, Q> call(vec<3, T, Q> const& x, vec<3, T, Q> const& y) { GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'cross' accepts only floating-point inputs"); - return tvec3<T, P>( + return vec<3, T, Q>( x.y * y.z - y.y * x.z, x.z * y.x - y.z * x.x, x.x * y.y - y.x * x.y); } }; - template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> + template<length_t L, typename T, qualifier Q, bool Aligned> struct compute_normalize { - GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & v) + GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& v) { GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' accepts only floating-point inputs"); @@ -95,10 +95,10 @@ namespace detail } }; - template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> + template<length_t L, typename T, qualifier Q, bool Aligned> struct compute_faceforward { - GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & N, vecType<T, P> const & I, vecType<T, P> const & Nref) + GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& N, vec<L, T, Q> const& I, vec<L, T, Q> const& Nref) { GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' accepts only floating-point inputs"); @@ -106,19 +106,19 @@ namespace detail } }; - template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> + template<length_t L, typename T, qualifier Q, bool Aligned> struct compute_reflect { - GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & I, vecType<T, P> const & N) + GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& I, vec<L, T, Q> const& N) { return I - N * dot(N, I) * static_cast<T>(2); } }; - template <typename T, precision P, template <typename, precision> class vecType, bool Aligned> + template<length_t L, typename T, qualifier Q, bool Aligned> struct compute_refract { - GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const & I, vecType<T, P> const & N, T eta) + GLM_FUNC_QUALIFIER static vec<L, T, Q> call(vec<L, T, Q> const& I, vec<L, T, Q> const& N, T eta) { T const dotValue(dot(N, I)); T const k(static_cast<T>(1) - eta * eta * (static_cast<T>(1) - dotValue * dotValue)); @@ -128,7 +128,7 @@ namespace detail }//namespace detail // length - template <typename genType> + template<typename genType> GLM_FUNC_QUALIFIER genType length(genType x) { GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'length' accepts only floating-point inputs"); @@ -136,97 +136,97 @@ namespace detail return abs(x); } - template <typename T, precision P, template <typename, precision> class vecType> - GLM_FUNC_QUALIFIER T length(vecType<T, P> const & v) + template<length_t L, typename T, qualifier Q> + GLM_FUNC_QUALIFIER T length(vec<L, T, Q> const& v) { GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'length' accepts only floating-point inputs"); - return detail::compute_length<vecType, T, P, detail::is_aligned<P>::value>::call(v); + return detail::compute_length<L, T, Q, detail::is_aligned<Q>::value>::call(v); } // distance - template <typename genType> - GLM_FUNC_QUALIFIER genType distance(genType const & p0, genType const & p1) + template<typename genType> + GLM_FUNC_QUALIFIER genType distance(genType const& p0, genType const& p1) { GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'distance' accepts only floating-point inputs"); return length(p1 - p0); } - template <typename T, precision P, template <typename, precision> class vecType> - GLM_FUNC_QUALIFIER T distance(vecType<T, P> const & p0, vecType<T, P> const & p1) + template<length_t L, typename T, qualifier Q> + GLM_FUNC_QUALIFIER T distance(vec<L, T, Q> const& p0, vec<L, T, Q> const& p1) { - return detail::compute_distance<vecType, T, P, detail::is_aligned<P>::value>::call(p0, p1); + return detail::compute_distance<L, T, Q, detail::is_aligned<Q>::value>::call(p0, p1); } // dot - template <typename T> + template<typename T> GLM_FUNC_QUALIFIER T dot(T x, T y) { GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' accepts only floating-point inputs"); return x * y; } - template <typename T, precision P, template <typename, precision> class vecType> - GLM_FUNC_QUALIFIER T dot(vecType<T, P> const & x, vecType<T, P> const & y) + template<length_t L, typename T, qualifier Q> + GLM_FUNC_QUALIFIER T dot(vec<L, T, Q> const& x, vec<L, T, Q> const& y) { GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'dot' accepts only floating-point inputs"); - return detail::compute_dot<vecType, T, P, detail::is_aligned<P>::value>::call(x, y); + return detail::compute_dot<vec<L, T, Q>, T, detail::is_aligned<Q>::value>::call(x, y); } // cross - template <typename T, precision P> - GLM_FUNC_QUALIFIER tvec3<T, P> cross(tvec3<T, P> const & x, tvec3<T, P> const & y) + template<typename T, qualifier Q> + GLM_FUNC_QUALIFIER vec<3, T, Q> cross(vec<3, T, Q> const& x, vec<3, T, Q> const& y) { - return detail::compute_cross<T, P, detail::is_aligned<P>::value>::call(x, y); + return detail::compute_cross<T, Q, detail::is_aligned<Q>::value>::call(x, y); } // normalize - template <typename genType> - GLM_FUNC_QUALIFIER genType normalize(genType const & x) + template<typename genType> + GLM_FUNC_QUALIFIER genType normalize(genType const& x) { GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'normalize' accepts only floating-point inputs"); return x < genType(0) ? genType(-1) : genType(1); } - template <typename T, precision P, template <typename, precision> class vecType> - GLM_FUNC_QUALIFIER vecType<T, P> normalize(vecType<T, P> const & x) + template<length_t L, typename T, qualifier Q> + GLM_FUNC_QUALIFIER vec<L, T, Q> normalize(vec<L, T, Q> const& x) { GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'normalize' accepts only floating-point inputs"); - return detail::compute_normalize<T, P, vecType, detail::is_aligned<P>::value>::call(x); + return detail::compute_normalize<L, T, Q, detail::is_aligned<Q>::value>::call(x); } // faceforward - template <typename genType> - GLM_FUNC_QUALIFIER genType faceforward(genType const & N, genType const & I, genType const & Nref) + template<typename genType> + GLM_FUNC_QUALIFIER genType faceforward(genType const& N, genType const& I, genType const& Nref) { return dot(Nref, I) < static_cast<genType>(0) ? N : -N; } - template <typename T, precision P, template <typename, precision> class vecType> - GLM_FUNC_QUALIFIER vecType<T, P> faceforward(vecType<T, P> const & N, vecType<T, P> const & I, vecType<T, P> const & Nref) + template<length_t L, typename T, qualifier Q> + GLM_FUNC_QUALIFIER vec<L, T, Q> faceforward(vec<L, T, Q> const& N, vec<L, T, Q> const& I, vec<L, T, Q> const& Nref) { - return detail::compute_faceforward<T, P, vecType, detail::is_aligned<P>::value>::call(N, I, Nref); + return detail::compute_faceforward<L, T, Q, detail::is_aligned<Q>::value>::call(N, I, Nref); } // reflect - template <typename genType> - GLM_FUNC_QUALIFIER genType reflect(genType const & I, genType const & N) + template<typename genType> + GLM_FUNC_QUALIFIER genType reflect(genType const& I, genType const& N) { return I - N * dot(N, I) * genType(2); } - template <typename T, precision P, template <typename, precision> class vecType> - GLM_FUNC_QUALIFIER vecType<T, P> reflect(vecType<T, P> const & I, vecType<T, P> const & N) + template<length_t L, typename T, qualifier Q> + GLM_FUNC_QUALIFIER vec<L, T, Q> reflect(vec<L, T, Q> const& I, vec<L, T, Q> const& N) { - return detail::compute_reflect<T, P, vecType, detail::is_aligned<P>::value>::call(I, N); + return detail::compute_reflect<L, T, Q, detail::is_aligned<Q>::value>::call(I, N); } // refract - template <typename genType> - GLM_FUNC_QUALIFIER genType refract(genType const & I, genType const & N, genType eta) + template<typename genType> + GLM_FUNC_QUALIFIER genType refract(genType const& I, genType const& N, genType eta) { GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'refract' accepts only floating-point inputs"); genType const dotValue(dot(N, I)); @@ -234,11 +234,11 @@ namespace detail return (eta * I - (eta * dotValue + sqrt(k)) * N) * static_cast<genType>(k >= static_cast<genType>(0)); } - template <typename T, precision P, template <typename, precision> class vecType> - GLM_FUNC_QUALIFIER vecType<T, P> refract(vecType<T, P> const & I, vecType<T, P> const & N, T eta) + template<length_t L, typename T, qualifier Q> + GLM_FUNC_QUALIFIER vec<L, T, Q> refract(vec<L, T, Q> const& I, vec<L, T, Q> const& N, T eta) { GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'refract' accepts only floating-point inputs"); - return detail::compute_refract<T, P, vecType, detail::is_aligned<P>::value>::call(I, N, eta); + return detail::compute_refract<L, T, Q, detail::is_aligned<Q>::value>::call(I, N, eta); } }//namespace glm |