mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-22 19:58:24 +00:00
Oops! (don't attempt a commit when you have to go to the restroom...)
This commit is contained in:
@@ -0,0 +1,65 @@
|
||||
/// @ref gtc_color_encoding
|
||||
/// @file glm/gtc/color_encoding.inl
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> convertLinearSRGBToD65XYZ(tvec3<T, P> const& ColorLinearSRGB)
|
||||
{
|
||||
tvec3<T, P> const M(0.490f, 0.17697f, 0.2f);
|
||||
tvec3<T, P> const N(0.31f, 0.8124f, 0.01063f);
|
||||
tvec3<T, P> const O(0.490f, 0.01f, 0.99f);
|
||||
|
||||
return (M * ColorLinearSRGB + N * ColorLinearSRGB + O * ColorLinearSRGB) * static_cast<T>(5.650675255693055f);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> convertD65XYZToLinearSRGB(tvec3<T, P> const& ColorD65XYZ)
|
||||
{
|
||||
tvec3<T, P> const M(0.41847f, -0.091169f, 0.0009209f);
|
||||
tvec3<T, P> const N(-0.15866f, 0.25243f, 0.015708f);
|
||||
tvec3<T, P> const O(0.0009209f, -0.0025498f, 0.1786f);
|
||||
|
||||
return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> convertLinearSRGBToD50XYZ(tvec3<T, P> const& ColorLinearSRGB)
|
||||
{
|
||||
tvec3<T, P> const M(0.436030342570117f, 0.222438466210245f, 0.013897440074263f);
|
||||
tvec3<T, P> const N(0.385101860087134f, 0.716942745571917f, 0.097076381494207f);
|
||||
tvec3<T, P> const O(0.143067806654203f, 0.060618777416563f, 0.713926257896652f);
|
||||
|
||||
return M * ColorLinearSRGB + N * ColorLinearSRGB + O * ColorLinearSRGB;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> convertD50XYZToLinearSRGB(tvec3<T, P> const& ColorD50XYZ)
|
||||
{
|
||||
tvec3<T, P> const M();
|
||||
tvec3<T, P> const N();
|
||||
tvec3<T, P> const O();
|
||||
|
||||
return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> convertD65XYZToD50XYZ(tvec3<T, P> const& ColorD65XYZ)
|
||||
{
|
||||
tvec3<T, P> const M(+1.047844353856414f, +0.029549007606644f, -0.009250984365223f);
|
||||
tvec3<T, P> const N(+0.022898981050086f, +0.990508028941971f, +0.015072338237051f);
|
||||
tvec3<T, P> const O(-0.050206647741605f, -0.017074711360960f, +0.751717835079977f);
|
||||
|
||||
return M * ColorD65XYZ + N * ColorD65XYZ + O * ColorD65XYZ;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<T, P> convertD50XYZToD65XYZ(tvec3<T, P> const& ColorD50XYZ)
|
||||
{
|
||||
tvec3<T, P> const M();
|
||||
tvec3<T, P> const N();
|
||||
tvec3<T, P> const O();
|
||||
|
||||
return M * ColorD50XYZ + N * ColorD50XYZ + O * ColorD50XYZ;
|
||||
}
|
||||
}//namespace glm
|
||||
@@ -0,0 +1,56 @@
|
||||
/// @ref gtc_color_space
|
||||
/// @file glm/gtc/color_space.hpp
|
||||
///
|
||||
/// @see core (dependence)
|
||||
/// @see gtc_color_space (dependence)
|
||||
///
|
||||
/// @defgroup gtc_color_space GLM_GTC_color_space
|
||||
/// @ingroup gtc
|
||||
///
|
||||
/// @brief Allow to perform bit operations on integer values
|
||||
///
|
||||
/// <glm/gtc/color.hpp> need to be included to use these functionalities.
|
||||
|
||||
#pragma once
|
||||
|
||||
// Dependencies
|
||||
#include "../detail/setup.hpp"
|
||||
#include "../detail/precision.hpp"
|
||||
#include "../exponential.hpp"
|
||||
#include "../vec3.hpp"
|
||||
#include "../vec4.hpp"
|
||||
#include <limits>
|
||||
|
||||
#if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
|
||||
# pragma message("GLM: GLM_GTC_color_space extension included")
|
||||
#endif
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup gtc_color_space
|
||||
/// @{
|
||||
|
||||
/// Convert a linear color to sRGB color using a standard gamma correction.
|
||||
/// IEC 61966-2-1:1999 specification https://www.w3.org/Graphics/Color/srgb
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> convertLinearToSRGB(vecType<T, P> const & ColorLinear);
|
||||
|
||||
/// Convert a linear color to sRGB color using a custom gamma correction.
|
||||
/// IEC 61966-2-1:1999 specification https://www.w3.org/Graphics/Color/srgb
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> convertLinearToSRGB(vecType<T, P> const & ColorLinear, T Gamma);
|
||||
|
||||
/// Convert a sRGB color to linear color using a standard gamma correction.
|
||||
/// IEC 61966-2-1:1999 specification https://www.w3.org/Graphics/Color/srgb
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> convertSRGBToLinear(vecType<T, P> const & ColorSRGB);
|
||||
|
||||
/// Convert a sRGB color to linear color using a custom gamma correction.
|
||||
// IEC 61966-2-1:1999 specification https://www.w3.org/Graphics/Color/srgb
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> convertSRGBToLinear(vecType<T, P> const & ColorSRGB, T Gamma);
|
||||
|
||||
/// @}
|
||||
} //namespace glm
|
||||
|
||||
#include "color_space.inl"
|
||||
@@ -0,0 +1,75 @@
|
||||
/// @ref gtc_color_space
|
||||
/// @file glm/gtc/color_space.inl
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
struct compute_rgbToSrgb
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const& ColorRGB, T GammaCorrection)
|
||||
{
|
||||
vecType<T, P> const ClampedColor(clamp(ColorRGB, static_cast<T>(0), static_cast<T>(1)));
|
||||
|
||||
return mix(
|
||||
pow(ClampedColor, vecType<T, P>(GammaCorrection)) * static_cast<T>(1.055) - static_cast<T>(0.055),
|
||||
ClampedColor * static_cast<T>(12.92),
|
||||
lessThan(ClampedColor, vecType<T, P>(static_cast<T>(0.0031308))));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_rgbToSrgb<T, P, tvec4>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<T, P> call(tvec4<T, P> const& ColorRGB, T GammaCorrection)
|
||||
{
|
||||
return tvec4<T, P>(compute_rgbToSrgb<T, P, tvec3>::call(tvec3<T, P>(ColorRGB), GammaCorrection), ColorRGB.w);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
struct compute_srgbToRgb
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static vecType<T, P> call(vecType<T, P> const& ColorSRGB, T Gamma)
|
||||
{
|
||||
return mix(
|
||||
pow((ColorSRGB + static_cast<T>(0.055)) * static_cast<T>(0.94786729857819905213270142180095), vecType<T, P>(Gamma)),
|
||||
ColorSRGB * static_cast<T>(0.07739938080495356037151702786378),
|
||||
lessThanEqual(ColorSRGB, vecType<T, P>(static_cast<T>(0.04045))));
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T, precision P>
|
||||
struct compute_srgbToRgb<T, P, tvec4>
|
||||
{
|
||||
GLM_FUNC_QUALIFIER static tvec4<T, P> call(tvec4<T, P> const& ColorSRGB, T Gamma)
|
||||
{
|
||||
return tvec4<T, P>(compute_srgbToRgb<T, P, tvec3>::call(tvec3<T, P>(ColorSRGB), Gamma), ColorSRGB.w);
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> convertLinearToSRGB(vecType<T, P> const& ColorLinear)
|
||||
{
|
||||
return detail::compute_rgbToSrgb<T, P, vecType>::call(ColorLinear, static_cast<T>(0.41666));
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> convertLinearToSRGB(vecType<T, P> const& ColorLinear, T Gamma)
|
||||
{
|
||||
return detail::compute_rgbToSrgb<T, P, vecType>::call(ColorLinear, static_cast<T>(1) / Gamma);
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> convertSRGBToLinear(vecType<T, P> const& ColorSRGB)
|
||||
{
|
||||
return detail::compute_srgbToRgb<T, P, vecType>::call(ColorSRGB, static_cast<T>(2.4));
|
||||
}
|
||||
|
||||
template <typename T, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> convertSRGBToLinear(vecType<T, P> const& ColorSRGB, T Gamma)
|
||||
{
|
||||
return detail::compute_srgbToRgb<T, P, vecType>::call(ColorSRGB, Gamma);
|
||||
}
|
||||
}//namespace glm
|
||||
@@ -0,0 +1,53 @@
|
||||
/// @ref gtc_functions
|
||||
/// @file glm/gtc/functions.hpp
|
||||
///
|
||||
/// @see core (dependence)
|
||||
/// @see gtc_half_float (dependence)
|
||||
/// @see gtc_quaternion (dependence)
|
||||
///
|
||||
/// @defgroup gtc_functions GLM_GTC_functions
|
||||
/// @ingroup gtc
|
||||
///
|
||||
/// @brief List of useful common functions.
|
||||
///
|
||||
/// <glm/gtc/functions.hpp> need to be included to use these functionalities.
|
||||
|
||||
#pragma once
|
||||
|
||||
// Dependencies
|
||||
#include "../detail/setup.hpp"
|
||||
#include "../detail/precision.hpp"
|
||||
#include "../detail/type_vec2.hpp"
|
||||
|
||||
#if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
|
||||
# pragma message("GLM: GLM_GTC_functions extension included")
|
||||
#endif
|
||||
|
||||
namespace glm
|
||||
{
|
||||
/// @addtogroup gtc_functions
|
||||
/// @{
|
||||
|
||||
/// 1D gauss function
|
||||
///
|
||||
/// @see gtc_epsilon
|
||||
template <typename T>
|
||||
GLM_FUNC_DECL T gauss(
|
||||
T x,
|
||||
T ExpectedValue,
|
||||
T StandardDeviation);
|
||||
|
||||
/// 2D gauss function
|
||||
///
|
||||
/// @see gtc_epsilon
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_DECL T gauss(
|
||||
tvec2<T, P> const& Coord,
|
||||
tvec2<T, P> const& ExpectedValue,
|
||||
tvec2<T, P> const& StandardDeviation);
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
|
||||
#include "functions.inl"
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
/// @ref gtc_functions
|
||||
/// @file glm/gtc/functions.inl
|
||||
|
||||
#include "../detail/func_exponential.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <typename T>
|
||||
GLM_FUNC_QUALIFIER T gauss
|
||||
(
|
||||
T x,
|
||||
T ExpectedValue,
|
||||
T StandardDeviation
|
||||
)
|
||||
{
|
||||
return exp(-((x - ExpectedValue) * (x - ExpectedValue)) / (static_cast<T>(2) * StandardDeviation * StandardDeviation)) / (StandardDeviation * sqrt(static_cast<T>(6.28318530717958647692528676655900576)));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
GLM_FUNC_QUALIFIER T gauss
|
||||
(
|
||||
tvec2<T, P> const& Coord,
|
||||
tvec2<T, P> const& ExpectedValue,
|
||||
tvec2<T, P> const& StandardDeviation
|
||||
)
|
||||
{
|
||||
tvec2<T, P> const Squared = ((Coord - ExpectedValue) * (Coord - ExpectedValue)) / (static_cast<T>(2) * StandardDeviation * StandardDeviation);
|
||||
return exp(-(Squared.x + Squared.y));
|
||||
}
|
||||
}//namespace glm
|
||||
|
||||
@@ -0,0 +1,198 @@
|
||||
/// @ref core
|
||||
/// @file glm/gtc/quaternion_simd.inl
|
||||
|
||||
#if GLM_ARCH & GLM_ARCH_SSE2_BIT
|
||||
|
||||
namespace glm{
|
||||
namespace detail
|
||||
{
|
||||
/*
|
||||
template <precision P>
|
||||
struct compute_quat_mul<float, P, true>
|
||||
{
|
||||
static tquat<float, P> call(tquat<float, P> const& q1, tquat<float, P> const& q2)
|
||||
{
|
||||
// SSE2 STATS: 11 shuffle, 8 mul, 8 add
|
||||
// SSE4 STATS: 3 shuffle, 4 mul, 4 dpps
|
||||
|
||||
__m128 const mul0 = _mm_mul_ps(q1.Data, _mm_shuffle_ps(q2.Data, q2.Data, _MM_SHUFFLE(0, 1, 2, 3)));
|
||||
__m128 const mul1 = _mm_mul_ps(q1.Data, _mm_shuffle_ps(q2.Data, q2.Data, _MM_SHUFFLE(1, 0, 3, 2)));
|
||||
__m128 const mul2 = _mm_mul_ps(q1.Data, _mm_shuffle_ps(q2.Data, q2.Data, _MM_SHUFFLE(2, 3, 0, 1)));
|
||||
__m128 const mul3 = _mm_mul_ps(q1.Data, q2.Data);
|
||||
|
||||
# if GLM_ARCH & GLM_ARCH_SSE41_BIT
|
||||
__m128 const add0 = _mm_dp_ps(mul0, _mm_set_ps(1.0f, -1.0f, 1.0f, 1.0f), 0xff);
|
||||
__m128 const add1 = _mm_dp_ps(mul1, _mm_set_ps(1.0f, 1.0f, 1.0f, -1.0f), 0xff);
|
||||
__m128 const add2 = _mm_dp_ps(mul2, _mm_set_ps(1.0f, 1.0f, -1.0f, 1.0f), 0xff);
|
||||
__m128 const add3 = _mm_dp_ps(mul3, _mm_set_ps(1.0f, -1.0f, -1.0f, -1.0f), 0xff);
|
||||
# else
|
||||
__m128 const mul4 = _mm_mul_ps(mul0, _mm_set_ps(1.0f, -1.0f, 1.0f, 1.0f));
|
||||
__m128 const add0 = _mm_add_ps(mul0, _mm_movehl_ps(mul4, mul4));
|
||||
__m128 const add4 = _mm_add_ss(add0, _mm_shuffle_ps(add0, add0, 1));
|
||||
|
||||
__m128 const mul5 = _mm_mul_ps(mul1, _mm_set_ps(1.0f, 1.0f, 1.0f, -1.0f));
|
||||
__m128 const add1 = _mm_add_ps(mul1, _mm_movehl_ps(mul5, mul5));
|
||||
__m128 const add5 = _mm_add_ss(add1, _mm_shuffle_ps(add1, add1, 1));
|
||||
|
||||
__m128 const mul6 = _mm_mul_ps(mul2, _mm_set_ps(1.0f, 1.0f, -1.0f, 1.0f));
|
||||
__m128 const add2 = _mm_add_ps(mul6, _mm_movehl_ps(mul6, mul6));
|
||||
__m128 const add6 = _mm_add_ss(add2, _mm_shuffle_ps(add2, add2, 1));
|
||||
|
||||
__m128 const mul7 = _mm_mul_ps(mul3, _mm_set_ps(1.0f, -1.0f, -1.0f, -1.0f));
|
||||
__m128 const add3 = _mm_add_ps(mul3, _mm_movehl_ps(mul7, mul7));
|
||||
__m128 const add7 = _mm_add_ss(add3, _mm_shuffle_ps(add3, add3, 1));
|
||||
#endif
|
||||
|
||||
// This SIMD code is a politically correct way of doing this, but in every test I've tried it has been slower than
|
||||
// the final code below. I'll keep this here for reference - maybe somebody else can do something better...
|
||||
//
|
||||
//__m128 xxyy = _mm_shuffle_ps(add4, add5, _MM_SHUFFLE(0, 0, 0, 0));
|
||||
//__m128 zzww = _mm_shuffle_ps(add6, add7, _MM_SHUFFLE(0, 0, 0, 0));
|
||||
//
|
||||
//return _mm_shuffle_ps(xxyy, zzww, _MM_SHUFFLE(2, 0, 2, 0));
|
||||
|
||||
tquat<float, P> Result(uninitialize);
|
||||
_mm_store_ss(&Result.x, add4);
|
||||
_mm_store_ss(&Result.y, add5);
|
||||
_mm_store_ss(&Result.z, add6);
|
||||
_mm_store_ss(&Result.w, add7);
|
||||
return Result;
|
||||
}
|
||||
};
|
||||
*/
|
||||
|
||||
template <precision P>
|
||||
struct compute_dot<tquat, float, P, true>
|
||||
{
|
||||
static GLM_FUNC_QUALIFIER float call(tquat<float, P> const& x, tquat<float, P> const& y)
|
||||
{
|
||||
return _mm_cvtss_f32(glm_vec1_dot(x.data, y.data));
|
||||
}
|
||||
};
|
||||
|
||||
template <precision P>
|
||||
struct compute_quat_add<float, P, true>
|
||||
{
|
||||
static tquat<float, P> call(tquat<float, P> const& q, tquat<float, P> const& p)
|
||||
{
|
||||
tquat<float, P> Result(uninitialize);
|
||||
Result.data = _mm_add_ps(q.data, p.data);
|
||||
return Result;
|
||||
}
|
||||
};
|
||||
|
||||
# if GLM_ARCH & GLM_ARCH_AVX_BIT
|
||||
template <precision P>
|
||||
struct compute_quat_add<double, P, true>
|
||||
{
|
||||
static tquat<double, P> call(tquat<double, P> const & a, tquat<double, P> const & b)
|
||||
{
|
||||
tquat<double, P> Result(uninitialize);
|
||||
Result.data = _mm256_add_pd(a.data, b.data);
|
||||
return Result;
|
||||
}
|
||||
};
|
||||
# endif
|
||||
|
||||
template <precision P>
|
||||
struct compute_quat_sub<float, P, true>
|
||||
{
|
||||
static tquat<float, P> call(tquat<float, P> const& q, tquat<float, P> const& p)
|
||||
{
|
||||
tvec4<float, P> Result(uninitialize);
|
||||
Result.data = _mm_sub_ps(q.data, p.data);
|
||||
return Result;
|
||||
}
|
||||
};
|
||||
|
||||
# if GLM_ARCH & GLM_ARCH_AVX_BIT
|
||||
template <precision P>
|
||||
struct compute_quat_sub<double, P, true>
|
||||
{
|
||||
static tquat<double, P> call(tquat<double, P> const & a, tquat<double, P> const & b)
|
||||
{
|
||||
tquat<double, P> Result(uninitialize);
|
||||
Result.data = _mm256_sub_pd(a.data, b.data);
|
||||
return Result;
|
||||
}
|
||||
};
|
||||
# endif
|
||||
|
||||
template <precision P>
|
||||
struct compute_quat_mul_scalar<float, P, true>
|
||||
{
|
||||
static tquat<float, P> call(tquat<float, P> const& q, float s)
|
||||
{
|
||||
tvec4<float, P> Result(uninitialize);
|
||||
Result.data = _mm_mul_ps(q.data, _mm_set_ps1(s));
|
||||
return Result;
|
||||
}
|
||||
};
|
||||
|
||||
# if GLM_ARCH & GLM_ARCH_AVX_BIT
|
||||
template <precision P>
|
||||
struct compute_quat_mul_scalar<double, P, true>
|
||||
{
|
||||
static tquat<double, P> call(tquat<double, P> const& q, double s)
|
||||
{
|
||||
tquat<double, P> Result(uninitialize);
|
||||
Result.data = _mm256_mul_pd(q.data, _mm_set_ps1(s));
|
||||
return Result;
|
||||
}
|
||||
};
|
||||
# endif
|
||||
|
||||
template <precision P>
|
||||
struct compute_quat_div_scalar<float, P, true>
|
||||
{
|
||||
static tquat<float, P> call(tquat<float, P> const& q, float s)
|
||||
{
|
||||
tvec4<float, P> Result(uninitialize);
|
||||
Result.data = _mm_div_ps(q.data, _mm_set_ps1(s));
|
||||
return Result;
|
||||
}
|
||||
};
|
||||
|
||||
# if GLM_ARCH & GLM_ARCH_AVX_BIT
|
||||
template <precision P>
|
||||
struct compute_quat_div_scalar<double, P, true>
|
||||
{
|
||||
static tquat<double, P> call(tquat<double, P> const& q, double s)
|
||||
{
|
||||
tquat<double, P> Result(uninitialize);
|
||||
Result.data = _mm256_div_pd(q.data, _mm_set_ps1(s));
|
||||
return Result;
|
||||
}
|
||||
};
|
||||
# endif
|
||||
|
||||
template <precision P>
|
||||
struct compute_quat_mul_vec4<float, P, true>
|
||||
{
|
||||
static tvec4<float, P> call(tquat<float, P> const& q, tvec4<float, P> const& v)
|
||||
{
|
||||
__m128 const q_wwww = _mm_shuffle_ps(q.data, q.data, _MM_SHUFFLE(3, 3, 3, 3));
|
||||
__m128 const q_swp0 = _mm_shuffle_ps(q.data, q.data, _MM_SHUFFLE(3, 0, 2, 1));
|
||||
__m128 const q_swp1 = _mm_shuffle_ps(q.data, q.data, _MM_SHUFFLE(3, 1, 0, 2));
|
||||
__m128 const v_swp0 = _mm_shuffle_ps(v.data, v.data, _MM_SHUFFLE(3, 0, 2, 1));
|
||||
__m128 const v_swp1 = _mm_shuffle_ps(v.data, v.data, _MM_SHUFFLE(3, 1, 0, 2));
|
||||
|
||||
__m128 uv = _mm_sub_ps(_mm_mul_ps(q_swp0, v_swp1), _mm_mul_ps(q_swp1, v_swp0));
|
||||
__m128 uv_swp0 = _mm_shuffle_ps(uv, uv, _MM_SHUFFLE(3, 0, 2, 1));
|
||||
__m128 uv_swp1 = _mm_shuffle_ps(uv, uv, _MM_SHUFFLE(3, 1, 0, 2));
|
||||
__m128 uuv = _mm_sub_ps(_mm_mul_ps(q_swp0, uv_swp1), _mm_mul_ps(q_swp1, uv_swp0));
|
||||
|
||||
__m128 const two = _mm_set1_ps(2.0f);
|
||||
uv = _mm_mul_ps(uv, _mm_mul_ps(q_wwww, two));
|
||||
uuv = _mm_mul_ps(uuv, two);
|
||||
|
||||
tvec4<float, P> Result(uninitialize);
|
||||
Result.data = _mm_add_ps(v.Data, _mm_add_ps(uv, uuv));
|
||||
return Result;
|
||||
}
|
||||
};
|
||||
}//namespace detail
|
||||
}//namespace glm
|
||||
|
||||
#endif//GLM_ARCH & GLM_ARCH_SSE2_BIT
|
||||
|
||||
@@ -0,0 +1,362 @@
|
||||
/// @ref gtc_type_aligned
|
||||
/// @file glm/gtc/type_aligned.hpp
|
||||
///
|
||||
/// @see core (dependence)
|
||||
///
|
||||
/// @defgroup gtc_type_aligned GLM_GTC_type_aligned
|
||||
/// @ingroup gtc
|
||||
///
|
||||
/// @brief Aligned types.
|
||||
/// <glm/gtc/type_aligned.hpp> need to be included to use these features.
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !GLM_HAS_ALIGNED_TYPE
|
||||
# error "GLM: Aligned types are not supported on this platform"
|
||||
#endif
|
||||
#if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED)
|
||||
# pragma message("GLM: GLM_GTC_type_aligned extension included")
|
||||
#endif
|
||||
|
||||
#include "../vec2.hpp"
|
||||
#include "../vec3.hpp"
|
||||
#include "../vec4.hpp"
|
||||
#include "../gtc/vec1.hpp"
|
||||
|
||||
namespace glm
|
||||
{
|
||||
template <typename T, precision P> struct tvec1;
|
||||
template <typename T, precision P> struct tvec2;
|
||||
template <typename T, precision P> struct tvec3;
|
||||
template <typename T, precision P> struct tvec4;
|
||||
/// @addtogroup gtc_type_aligned
|
||||
/// @{
|
||||
|
||||
// -- *vec1 --
|
||||
|
||||
typedef tvec1<float, aligned_highp> aligned_highp_vec1;
|
||||
typedef tvec1<float, aligned_mediump> aligned_mediump_vec1;
|
||||
typedef tvec1<float, aligned_lowp> aligned_lowp_vec1;
|
||||
typedef tvec1<double, aligned_highp> aligned_highp_dvec1;
|
||||
typedef tvec1<double, aligned_mediump> aligned_mediump_dvec1;
|
||||
typedef tvec1<double, aligned_lowp> aligned_lowp_dvec1;
|
||||
typedef tvec1<int, aligned_highp> aligned_highp_ivec1;
|
||||
typedef tvec1<int, aligned_mediump> aligned_mediump_ivec1;
|
||||
typedef tvec1<int, aligned_lowp> aligned_lowp_ivec1;
|
||||
typedef tvec1<uint, aligned_highp> aligned_highp_uvec1;
|
||||
typedef tvec1<uint, aligned_mediump> aligned_mediump_uvec1;
|
||||
typedef tvec1<uint, aligned_lowp> aligned_lowp_uvec1;
|
||||
typedef tvec1<bool, aligned_highp> aligned_highp_bvec1;
|
||||
typedef tvec1<bool, aligned_mediump> aligned_mediump_bvec1;
|
||||
typedef tvec1<bool, aligned_lowp> aligned_lowp_bvec1;
|
||||
|
||||
typedef tvec1<float, packed_highp> packed_highp_vec1;
|
||||
typedef tvec1<float, packed_mediump> packed_mediump_vec1;
|
||||
typedef tvec1<float, packed_lowp> packed_lowp_vec1;
|
||||
typedef tvec1<double, packed_highp> packed_highp_dvec1;
|
||||
typedef tvec1<double, packed_mediump> packed_mediump_dvec1;
|
||||
typedef tvec1<double, packed_lowp> packed_lowp_dvec1;
|
||||
typedef tvec1<int, packed_highp> packed_highp_ivec1;
|
||||
typedef tvec1<int, packed_mediump> packed_mediump_ivec1;
|
||||
typedef tvec1<int, packed_lowp> packed_lowp_ivec1;
|
||||
typedef tvec1<uint, packed_highp> packed_highp_uvec1;
|
||||
typedef tvec1<uint, packed_mediump> packed_mediump_uvec1;
|
||||
typedef tvec1<uint, packed_lowp> packed_lowp_uvec1;
|
||||
typedef tvec1<bool, packed_highp> packed_highp_bvec1;
|
||||
typedef tvec1<bool, packed_mediump> packed_mediump_bvec1;
|
||||
typedef tvec1<bool, packed_lowp> packed_lowp_bvec1;
|
||||
|
||||
// -- *vec2 --
|
||||
|
||||
/// 2 components vector of high single-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec2<float, aligned_highp> aligned_highp_vec2;
|
||||
|
||||
/// 2 components vector of medium single-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec2<float, aligned_mediump> aligned_mediump_vec2;
|
||||
|
||||
/// 2 components vector of low single-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec2<float, aligned_lowp> aligned_lowp_vec2;
|
||||
|
||||
/// 2 components vector of high double-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec2<double, aligned_highp> aligned_highp_dvec2;
|
||||
|
||||
/// 2 components vector of medium double-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec2<double, aligned_mediump> aligned_mediump_dvec2;
|
||||
|
||||
/// 2 components vector of low double-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec2<double, aligned_lowp> aligned_lowp_dvec2;
|
||||
|
||||
/// 2 components vector of high precision signed integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec2<int, aligned_highp> aligned_highp_ivec2;
|
||||
|
||||
/// 2 components vector of medium precision signed integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec2<int, aligned_mediump> aligned_mediump_ivec2;
|
||||
|
||||
/// 2 components vector of low precision signed integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec2<int, aligned_lowp> aligned_lowp_ivec2;
|
||||
|
||||
/// 2 components vector of high precision unsigned integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec2<uint, aligned_highp> aligned_highp_uvec2;
|
||||
|
||||
/// 2 components vector of medium precision unsigned integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec2<uint, aligned_mediump> aligned_mediump_uvec2;
|
||||
|
||||
/// 2 components vector of low precision unsigned integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec2<uint, aligned_lowp> aligned_lowp_uvec2;
|
||||
|
||||
/// 2 components vector of high precision bool numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec2<bool, aligned_highp> aligned_highp_bvec2;
|
||||
|
||||
/// 2 components vector of medium precision bool numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec2<bool, aligned_mediump> aligned_mediump_bvec2;
|
||||
|
||||
/// 2 components vector of low precision bool numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec2<bool, aligned_lowp> aligned_lowp_bvec2;
|
||||
|
||||
// -- *vec3 --
|
||||
|
||||
/// 3 components vector of high single-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec3<float, aligned_highp> aligned_highp_vec3;
|
||||
|
||||
/// 3 components vector of medium single-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec3<float, aligned_mediump> aligned_mediump_vec3;
|
||||
|
||||
/// 3 components vector of low single-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec3<float, aligned_lowp> aligned_lowp_vec3;
|
||||
|
||||
/// 3 components vector of high double-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec3<double, aligned_highp> aligned_highp_dvec3;
|
||||
|
||||
/// 3 components vector of medium double-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec3<double, aligned_mediump> aligned_mediump_dvec3;
|
||||
|
||||
/// 3 components vector of low double-precision floating-point numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec3<double, aligned_lowp> aligned_lowp_dvec3;
|
||||
|
||||
/// 3 components vector of high precision signed integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec3<int, aligned_highp> aligned_highp_ivec3;
|
||||
|
||||
/// 3 components vector of medium precision signed integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec3<int, aligned_mediump> aligned_mediump_ivec3;
|
||||
|
||||
/// 3 components vector of low precision signed integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec3<int, aligned_lowp> aligned_lowp_ivec3;
|
||||
|
||||
/// 3 components vector of high precision unsigned integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec3<uint, aligned_highp> aligned_highp_uvec3;
|
||||
|
||||
/// 3 components vector of medium precision unsigned integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec3<uint, aligned_mediump> aligned_mediump_uvec3;
|
||||
|
||||
/// 3 components vector of low precision unsigned integer numbers.
|
||||
/// There is no guarantee on the actual precision.
|
||||
typedef tvec3<uint, aligned_lowp> aligned_lowp_uvec3;
|
||||
|
||||
/// 3 components vector of high precision bool numbers.
|
||||
typedef tvec3<bool, aligned_highp> aligned_highp_bvec3;
|
||||
|
||||
/// 3 components vector of medium precision bool numbers.
|
||||
typedef tvec3<bool, aligned_mediump> aligned_mediump_bvec3;
|
||||
|
||||
/// 3 components vector of low precision bool numbers.
|
||||
typedef tvec3<bool, aligned_lowp> aligned_lowp_bvec3;
|
||||
|
||||
// -- *vec4 --
|
||||
|
||||
/// 4 components vector of high single-precision floating-point numbers.
|
||||
typedef tvec4<float, aligned_highp> aligned_highp_vec4;
|
||||
|
||||
/// 4 components vector of medium single-precision floating-point numbers.
|
||||
typedef tvec4<float, aligned_mediump> aligned_mediump_vec4;
|
||||
|
||||
/// 4 components vector of low single-precision floating-point numbers.
|
||||
typedef tvec4<float, aligned_lowp> aligned_lowp_vec4;
|
||||
|
||||
/// 4 components vector of high double-precision floating-point numbers.
|
||||
typedef tvec4<double, aligned_highp> aligned_highp_dvec4;
|
||||
|
||||
/// 4 components vector of medium double-precision floating-point numbers.
|
||||
typedef tvec4<double, aligned_mediump> aligned_mediump_dvec4;
|
||||
|
||||
/// 4 components vector of low double-precision floating-point numbers.
|
||||
typedef tvec4<double, aligned_lowp> aligned_lowp_dvec4;
|
||||
|
||||
/// 4 components vector of high precision signed integer numbers.
|
||||
typedef tvec4<int, aligned_highp> aligned_highp_ivec4;
|
||||
|
||||
/// 4 components vector of medium precision signed integer numbers.
|
||||
typedef tvec4<int, aligned_mediump> aligned_mediump_ivec4;
|
||||
|
||||
/// 4 components vector of low precision signed integer numbers.
|
||||
typedef tvec4<int, aligned_lowp> aligned_lowp_ivec4;
|
||||
|
||||
/// 4 components vector of high precision unsigned integer numbers.
|
||||
typedef tvec4<uint, aligned_highp> aligned_highp_uvec4;
|
||||
|
||||
/// 4 components vector of medium precision unsigned integer numbers.
|
||||
typedef tvec4<uint, aligned_mediump> aligned_mediump_uvec4;
|
||||
|
||||
/// 4 components vector of low precision unsigned integer numbers.
|
||||
typedef tvec4<uint, aligned_lowp> aligned_lowp_uvec4;
|
||||
|
||||
/// 4 components vector of high precision bool numbers.
|
||||
typedef tvec4<bool, aligned_highp> aligned_highp_bvec4;
|
||||
|
||||
/// 4 components vector of medium precision bool numbers.
|
||||
typedef tvec4<bool, aligned_mediump> aligned_mediump_bvec4;
|
||||
|
||||
/// 4 components vector of low precision bool numbers.
|
||||
typedef tvec4<bool, aligned_lowp> aligned_lowp_bvec4;
|
||||
|
||||
// -- default --
|
||||
|
||||
#if(defined(GLM_PRECISION_LOWP_FLOAT))
|
||||
typedef aligned_lowp_vec1 aligned_vec1;
|
||||
typedef aligned_lowp_vec2 aligned_vec2;
|
||||
typedef aligned_lowp_vec3 aligned_vec3;
|
||||
typedef aligned_lowp_vec4 aligned_vec4;
|
||||
#elif(defined(GLM_PRECISION_MEDIUMP_FLOAT))
|
||||
typedef aligned_mediump_vec1 aligned_vec1;
|
||||
typedef aligned_mediump_vec2 aligned_vec2;
|
||||
typedef aligned_mediump_vec3 aligned_vec3;
|
||||
typedef aligned_mediump_vec4 aligned_vec4;
|
||||
#else //defined(GLM_PRECISION_HIGHP_FLOAT)
|
||||
/// 1 component vector of floating-point numbers.
|
||||
typedef aligned_highp_vec1 aligned_vec1;
|
||||
|
||||
/// 2 components vector of floating-point numbers.
|
||||
typedef aligned_highp_vec2 aligned_vec2;
|
||||
|
||||
/// 3 components vector of floating-point numbers.
|
||||
typedef aligned_highp_vec3 aligned_vec3;
|
||||
|
||||
/// 4 components vector of floating-point numbers.
|
||||
typedef aligned_highp_vec4 aligned_vec4;
|
||||
#endif//GLM_PRECISION
|
||||
|
||||
#if(defined(GLM_PRECISION_LOWP_DOUBLE))
|
||||
typedef aligned_lowp_dvec1 aligned_dvec1;
|
||||
typedef aligned_lowp_dvec2 aligned_dvec2;
|
||||
typedef aligned_lowp_dvec3 aligned_dvec3;
|
||||
typedef aligned_lowp_dvec4 aligned_dvec4;
|
||||
#elif(defined(GLM_PRECISION_MEDIUMP_DOUBLE))
|
||||
typedef aligned_mediump_dvec1 aligned_dvec1;
|
||||
typedef aligned_mediump_dvec2 aligned_dvec2;
|
||||
typedef aligned_mediump_dvec3 aligned_dvec3;
|
||||
typedef aligned_mediump_dvec4 aligned_dvec4;
|
||||
#else //defined(GLM_PRECISION_HIGHP_DOUBLE)
|
||||
/// 1 component vector of double-precision floating-point numbers.
|
||||
typedef aligned_highp_dvec1 aligned_dvec1;
|
||||
|
||||
/// 2 components vector of double-precision floating-point numbers.
|
||||
typedef aligned_highp_dvec2 aligned_dvec2;
|
||||
|
||||
/// 3 components vector of double-precision floating-point numbers.
|
||||
typedef aligned_highp_dvec3 aligned_dvec3;
|
||||
|
||||
/// 4 components vector of double-precision floating-point numbers.
|
||||
typedef aligned_highp_dvec4 aligned_dvec4;
|
||||
#endif//GLM_PRECISION
|
||||
|
||||
#if(defined(GLM_PRECISION_LOWP_INT))
|
||||
typedef aligned_lowp_ivec1 aligned_ivec1;
|
||||
typedef aligned_lowp_ivec2 aligned_ivec2;
|
||||
typedef aligned_lowp_ivec3 aligned_ivec3;
|
||||
typedef aligned_lowp_ivec4 aligned_ivec4;
|
||||
#elif(defined(GLM_PRECISION_MEDIUMP_INT))
|
||||
typedef aligned_mediump_ivec1 aligned_ivec1;
|
||||
typedef aligned_mediump_ivec2 aligned_ivec2;
|
||||
typedef aligned_mediump_ivec3 aligned_ivec3;
|
||||
typedef aligned_mediump_ivec4 aligned_ivec4;
|
||||
#else //defined(GLM_PRECISION_HIGHP_INT)
|
||||
/// 1 component vector of signed integer numbers.
|
||||
typedef aligned_highp_ivec1 aligned_ivec1;
|
||||
|
||||
/// 2 components vector of signed integer numbers.
|
||||
typedef aligned_highp_ivec2 aligned_ivec2;
|
||||
|
||||
/// 3 components vector of signed integer numbers.
|
||||
typedef aligned_highp_ivec3 aligned_ivec3;
|
||||
|
||||
/// 4 components vector of signed integer numbers.
|
||||
typedef aligned_highp_ivec4 aligned_ivec4;
|
||||
#endif//GLM_PRECISION
|
||||
|
||||
// -- Unsigned integer definition --
|
||||
|
||||
#if(defined(GLM_PRECISION_LOWP_UINT))
|
||||
typedef aligned_lowp_uvec1 aligned_uvec1;
|
||||
typedef aligned_lowp_uvec2 aligned_uvec2;
|
||||
typedef aligned_lowp_uvec3 aligned_uvec3;
|
||||
typedef aligned_lowp_uvec4 aligned_uvec4;
|
||||
#elif(defined(GLM_PRECISION_MEDIUMP_UINT))
|
||||
typedef aligned_mediump_uvec1 aligned_uvec1;
|
||||
typedef aligned_mediump_uvec2 aligned_uvec2;
|
||||
typedef aligned_mediump_uvec3 aligned_uvec3;
|
||||
typedef aligned_mediump_uvec4 aligned_uvec4;
|
||||
#else //defined(GLM_PRECISION_HIGHP_UINT)
|
||||
/// 1 component vector of unsigned integer numbers.
|
||||
typedef aligned_highp_uvec1 aligned_uvec1;
|
||||
|
||||
/// 2 components vector of unsigned integer numbers.
|
||||
typedef aligned_highp_uvec2 aligned_uvec2;
|
||||
|
||||
/// 3 components vector of unsigned integer numbers.
|
||||
typedef aligned_highp_uvec3 aligned_uvec3;
|
||||
|
||||
/// 4 components vector of unsigned integer numbers.
|
||||
typedef aligned_highp_uvec4 aligned_uvec4;
|
||||
#endif//GLM_PRECISION
|
||||
|
||||
#if(defined(GLM_PRECISION_LOWP_BOOL))
|
||||
typedef aligned_lowp_bvec1 aligned_bvec1;
|
||||
typedef aligned_lowp_bvec2 aligned_bvec2;
|
||||
typedef aligned_lowp_bvec3 aligned_bvec3;
|
||||
typedef aligned_lowp_bvec4 aligned_bvec4;
|
||||
#elif(defined(GLM_PRECISION_MEDIUMP_BOOL))
|
||||
typedef aligned_mediump_bvec1 aligned_bvec1;
|
||||
typedef aligned_mediump_bvec2 aligned_bvec2;
|
||||
typedef aligned_mediump_bvec3 aligned_bvec3;
|
||||
typedef aligned_mediump_bvec4 aligned_bvec4;
|
||||
#else //defined(GLM_PRECISION_HIGHP_BOOL)
|
||||
/// 1 component vector of boolean.
|
||||
typedef aligned_highp_bvec1 aligned_bvec1;
|
||||
|
||||
/// 2 components vector of boolean.
|
||||
typedef aligned_highp_bvec2 aligned_bvec2;
|
||||
|
||||
/// 3 components vector of boolean.
|
||||
typedef aligned_highp_bvec3 aligned_bvec3;
|
||||
|
||||
/// 4 components vector of boolean.
|
||||
typedef aligned_highp_bvec4 aligned_bvec4;
|
||||
#endif//GLM_PRECISION
|
||||
|
||||
/// @}
|
||||
}//namespace glm
|
||||
Reference in New Issue
Block a user