Fixed merge with origin

This commit is contained in:
Christophe Riccio 2011-06-01 20:20:12 +01:00
commit b049f47c2f
15 changed files with 395 additions and 188 deletions

View File

@ -3,16 +3,17 @@
<glm copyright="Copyright © 2005 - 2011"> <glm copyright="Copyright © 2005 - 2011">
<downloads> <downloads>
<section name="GLM - zip files"> <section name="GLM - zip files">
<download name="GLM 0.9.2.1" date="24/05/2010" size="3.4 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.2.1/glm-0.9.2.1.zip/download"/> <download name="GLM 0.9.2.2" date="06/06/2011" size="3.4 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.2.2/glm-0.9.2.2.zip/download"/>
<download name="GLM 0.9.2.0" date="08/05/2010" size="3.4 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.2.0/glm-0.9.2.0.zip/download"/> <download name="GLM 0.9.2.1" date="24/05/2011" size="3.4 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.2.1/glm-0.9.2.1.zip/download"/>
<download name="GLM 0.9.1.3" date="07/05/2010" size="3.4 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.1.3/glm-0.9.1.3.zip/download"/> <download name="GLM 0.9.2.0" date="08/05/2011" size="3.4 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.2.0/glm-0.9.2.0.zip/download"/>
<download name="GLM 0.9.1.2" date="12/04/2010" size="3.4 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.1.2/glm-0.9.1.2.zip/download"/> <download name="GLM 0.9.1.3" date="07/05/2011" size="3.4 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.1.3/glm-0.9.1.3.zip/download"/>
<download name="GLM 0.9.1.1" date="17/03/2010" size="3.4 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.1.1/glm-0.9.1.1.zip/download"/> <download name="GLM 0.9.1.2" date="12/04/2011" size="3.4 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.1.2/glm-0.9.1.2.zip/download"/>
<download name="GLM 0.9.1.0" date="03/03/2010" size="3.4 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.1.0/glm-0.9.1.0.zip/download"/> <download name="GLM 0.9.1.1" date="17/03/2011" size="3.4 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.1.1/glm-0.9.1.1.zip/download"/>
<download name="GLM 0.9.1.B" date="13/02/2010" size="3.4 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.1.B/glm-0.9.1.B.zip/download"/> <download name="GLM 0.9.1.0" date="03/03/2011" size="3.4 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.1.0/glm-0.9.1.0.zip/download"/>
<download name="GLM 0.9.0.8" date="13/02/2010" size="3.3 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.0.8/glm-0.9.0.8.zip/download"/> <download name="GLM 0.9.1.B" date="13/02/2011" size="3.4 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.1.B/glm-0.9.1.B.zip/download"/>
<download name="GLM 0.9.1.A" date="31/01/2010" size="3.0 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.1.A/glm-0.9.1.A.zip/download"/> <download name="GLM 0.9.0.8" date="13/02/2011" size="3.3 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.0.8/glm-0.9.0.8.zip/download"/>
<download name="GLM 0.9.0.7" date="30/01/2010" size="1.4 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.0.7/glm-0.9.0.7.zip/download"/> <download name="GLM 0.9.1.A" date="31/01/2011" size="3.0 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.1.A/glm-0.9.1.A.zip/download"/>
<download name="GLM 0.9.0.7" date="30/01/2011" size="1.4 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.0.7/glm-0.9.0.7.zip/download"/>
<download name="GLM 0.9.0.6" date="21/12/2010" size="2.2 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.0.6/glm-0.9.0.6.zip/download"/> <download name="GLM 0.9.0.6" date="21/12/2010" size="2.2 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.0.6/glm-0.9.0.6.zip/download"/>
<download name="GLM 0.9.0.5" date="01/11/2010" size="2.2 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.0.5/glm-0.9.0.5.zip/download"/> <download name="GLM 0.9.0.5" date="01/11/2010" size="2.2 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.0.5/glm-0.9.0.5.zip/download"/>
<download name="GLM 0.9.0.4" date="04/10/2010" size="1.5 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.0.4/glm-0.9.0.4.zip/download"/> <download name="GLM 0.9.0.4" date="04/10/2010" size="1.5 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.0.4/glm-0.9.0.4.zip/download"/>
@ -64,6 +65,7 @@
<download name="GLM 0.1.0.0" date="02/21/2005" size="29.2 KB" link="http://prdownloads.sourceforge.net/glf/glm-0.1-ur.zip?download"/> <download name="GLM 0.1.0.0" date="02/21/2005" size="29.2 KB" link="http://prdownloads.sourceforge.net/glf/glm-0.1-ur.zip?download"/>
</section> </section>
<section name="GLM - 7z files"> <section name="GLM - 7z files">
<download name="GLM 0.9.2.2" date="06/06/2011" size="2.1 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.2.2/glm-0.9.2.2.7z/download"/>
<download name="GLM 0.9.2.1" date="24/05/2011" size="2.1 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.2.1/glm-0.9.2.1.7z/download"/> <download name="GLM 0.9.2.1" date="24/05/2011" size="2.1 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.2.1/glm-0.9.2.1.7z/download"/>
<download name="GLM 0.9.2.0" date="08/05/2011" size="2.1 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.2.0/glm-0.9.2.0.7z/download"/> <download name="GLM 0.9.2.0" date="08/05/2011" size="2.1 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.2.0/glm-0.9.2.0.7z/download"/>
<download name="GLM 0.9.1.3" date="07/05/2011" size="2.1 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.1.3/glm-0.9.1.3.7z/download"/> <download name="GLM 0.9.1.3" date="07/05/2011" size="2.1 MB" link="https://sourceforge.net/projects/ogl-math/files/glm-0.9.1.3/glm-0.9.1.3.7z/download"/>
@ -152,6 +154,46 @@
</todo> </todo>
<page_news> <page_news>
<news index="0067" date="06/06/2011" title="GLM 0.9.2.2 released" image="goodies/logo.png" image-mini="image/logo-mini.png">
<paragraph>
The main improvement of this version comes from the extented number of matrix contructors so that a programmer can used diffent scalar types for each parameter.
</paragraph>
<code>
<line>
<keyword>#include </keyword>
<string>&lt;glm/glm.hpp&gt;</string>
</line>
<line>
</line>
<line>
<comment>// Create an identity matrix</comment>
</line>
<line>
glm::mat3 m(
</line>
<line align="32px">
1, 0.0, 0,
</line>
<line align="32px">
0.0, 1.0, 0.0f,
</line>
<line align="32px">
0, 0.0, 1.0f);
</line>
</code>
<paragraph>
The quaternion implementation has been updated as well, fixing the various slerp implementation flavour (mix, shortMix and fastMix) and providing more completeness: Added interaction with GLM_GTX_epsilon and missing lowp_quat, mediump_quat and highp_quat but also none square matrix equivalents.
</paragraph>
<paragraph>
Finally, some efforts have been put to remove warnings across all supported compilers.
</paragraph>
<source type="Download" href="https://sourceforge.net/projects/ogl-math/files/glm-0.9.2.2/glm-0.9.2.2.zip/download">GLM 0.9.2.2 (zip)</source>
<source type="Download" href="https://sourceforge.net/projects/ogl-math/files/glm-0.9.2.2/glm-0.9.2.2.7z/download">GLM 0.9.2.2 (7z)</source>
<source type="Link" href="https://sourceforge.net/apps/trac/ogl-math/newticket">Submit a bug report</source>
</news>
<news index="0066" date="24/05/2011" title="GLM 0.9.2.1 released" image="goodies/logo.png" image-mini="image/logo-mini.png"> <news index="0066" date="24/05/2011" title="GLM 0.9.2.1 released" image="goodies/logo.png" image-mini="image/logo-mini.png">
<paragraph> <paragraph>
GLM 0.9.2.1 significantly improves compiler detection which allows CUDA to be automatically recognized when GLM is used inside a CUDA kernel. GLM 0.9.2.1 significantly improves compiler detection which allows CUDA to be automatically recognized when GLM is used inside a CUDA kernel.

View File

@ -21,107 +21,107 @@ namespace detail{
ieee754_QNAN() : f(0.0)/*, mantissa(0x7FFFFF), exp(0xFF), sign(0x0)*/ {} ieee754_QNAN() : f(0.0)/*, mantissa(0x7FFFFF), exp(0xFF), sign(0x0)*/ {}
}; };
static const __m128 zero = _mm_setzero_ps(); static const __m128 GLM_VAR_USED zero = _mm_setzero_ps();
static const __m128 one = _mm_set_ps1(1.0f); static const __m128 GLM_VAR_USED one = _mm_set_ps1(1.0f);
static const __m128 minus_one = _mm_set_ps1(-1.0f); static const __m128 GLM_VAR_USED minus_one = _mm_set_ps1(-1.0f);
static const __m128 two = _mm_set_ps1(2.0f); static const __m128 GLM_VAR_USED two = _mm_set_ps1(2.0f);
static const __m128 three = _mm_set_ps1(3.0f); static const __m128 GLM_VAR_USED three = _mm_set_ps1(3.0f);
static const __m128 pi = _mm_set_ps1(3.1415926535897932384626433832795f); static const __m128 GLM_VAR_USED pi = _mm_set_ps1(3.1415926535897932384626433832795f);
static const __m128 hundred_eighty = _mm_set_ps1(180.f); static const __m128 GLM_VAR_USED hundred_eighty = _mm_set_ps1(180.f);
static const __m128 pi_over_hundred_eighty = _mm_set_ps1(0.017453292519943295769236907684886f); static const __m128 GLM_VAR_USED pi_over_hundred_eighty = _mm_set_ps1(0.017453292519943295769236907684886f);
static const __m128 hundred_eighty_over_pi = _mm_set_ps1(57.295779513082320876798154814105f); static const __m128 GLM_VAR_USED hundred_eighty_over_pi = _mm_set_ps1(57.295779513082320876798154814105f);
static const ieee754_QNAN absMask; static const ieee754_QNAN absMask;
static const __m128 abs4Mask = _mm_set_ps1(absMask.f); static const __m128 GLM_VAR_USED abs4Mask = _mm_set_ps1(absMask.f);
static const __m128 _epi32_sign_mask = _mm_castsi128_ps(_mm_set1_epi32(0x80000000)); static const __m128 GLM_VAR_USED _epi32_sign_mask = _mm_castsi128_ps(_mm_set1_epi32(0x80000000));
//static const __m128 _epi32_inv_sign_mask = _mm_castsi128_ps(_mm_set1_epi32(0x7FFFFFFF)); //static const __m128 GLM_VAR_USED _epi32_inv_sign_mask = _mm_castsi128_ps(_mm_set1_epi32(0x7FFFFFFF));
//static const __m128 _epi32_mant_mask = _mm_castsi128_ps(_mm_set1_epi32(0x7F800000)); //static const __m128 GLM_VAR_USED _epi32_mant_mask = _mm_castsi128_ps(_mm_set1_epi32(0x7F800000));
//static const __m128 _epi32_inv_mant_mask = _mm_castsi128_ps(_mm_set1_epi32(0x807FFFFF)); //static const __m128 GLM_VAR_USED _epi32_inv_mant_mask = _mm_castsi128_ps(_mm_set1_epi32(0x807FFFFF));
//static const __m128 _epi32_min_norm_pos = _mm_castsi128_ps(_mm_set1_epi32(0x00800000)); //static const __m128 GLM_VAR_USED _epi32_min_norm_pos = _mm_castsi128_ps(_mm_set1_epi32(0x00800000));
static const __m128 _epi32_0 = _mm_set_ps1(0); static const __m128 GLM_VAR_USED _epi32_0 = _mm_set_ps1(0);
static const __m128 _epi32_1 = _mm_set_ps1(1); static const __m128 GLM_VAR_USED _epi32_1 = _mm_set_ps1(1);
static const __m128 _epi32_2 = _mm_set_ps1(2); static const __m128 GLM_VAR_USED _epi32_2 = _mm_set_ps1(2);
static const __m128 _epi32_3 = _mm_set_ps1(3); static const __m128 GLM_VAR_USED _epi32_3 = _mm_set_ps1(3);
static const __m128 _epi32_4 = _mm_set_ps1(4); static const __m128 GLM_VAR_USED _epi32_4 = _mm_set_ps1(4);
static const __m128 _epi32_5 = _mm_set_ps1(5); static const __m128 GLM_VAR_USED _epi32_5 = _mm_set_ps1(5);
static const __m128 _epi32_6 = _mm_set_ps1(6); static const __m128 GLM_VAR_USED _epi32_6 = _mm_set_ps1(6);
static const __m128 _epi32_7 = _mm_set_ps1(7); static const __m128 GLM_VAR_USED _epi32_7 = _mm_set_ps1(7);
static const __m128 _epi32_8 = _mm_set_ps1(8); static const __m128 GLM_VAR_USED _epi32_8 = _mm_set_ps1(8);
static const __m128 _epi32_9 = _mm_set_ps1(9); static const __m128 GLM_VAR_USED _epi32_9 = _mm_set_ps1(9);
static const __m128 _epi32_127 = _mm_set_ps1(127); static const __m128 GLM_VAR_USED _epi32_127 = _mm_set_ps1(127);
//static const __m128 _epi32_ninf = _mm_castsi128_ps(_mm_set1_epi32(0xFF800000)); //static const __m128 GLM_VAR_USED _epi32_ninf = _mm_castsi128_ps(_mm_set1_epi32(0xFF800000));
//static const __m128 _epi32_pinf = _mm_castsi128_ps(_mm_set1_epi32(0x7F800000)); //static const __m128 GLM_VAR_USED _epi32_pinf = _mm_castsi128_ps(_mm_set1_epi32(0x7F800000));
static const __m128 _ps_1_3 = _mm_set_ps1(0.33333333333333333333333333333333f); static const __m128 GLM_VAR_USED _ps_1_3 = _mm_set_ps1(0.33333333333333333333333333333333f);
static const __m128 _ps_0p5 = _mm_set_ps1(0.5f); static const __m128 GLM_VAR_USED _ps_0p5 = _mm_set_ps1(0.5f);
static const __m128 _ps_1 = _mm_set_ps1(1.0f); static const __m128 GLM_VAR_USED _ps_1 = _mm_set_ps1(1.0f);
static const __m128 _ps_m1 = _mm_set_ps1(-1.0f); static const __m128 GLM_VAR_USED _ps_m1 = _mm_set_ps1(-1.0f);
static const __m128 _ps_2 = _mm_set_ps1(2.0f); static const __m128 GLM_VAR_USED _ps_2 = _mm_set_ps1(2.0f);
static const __m128 _ps_3 = _mm_set_ps1(3.0f); static const __m128 GLM_VAR_USED _ps_3 = _mm_set_ps1(3.0f);
static const __m128 _ps_127 = _mm_set_ps1(127.0f); static const __m128 GLM_VAR_USED _ps_127 = _mm_set_ps1(127.0f);
static const __m128 _ps_255 = _mm_set_ps1(255.0f); static const __m128 GLM_VAR_USED _ps_255 = _mm_set_ps1(255.0f);
static const __m128 _ps_2pow23 = _mm_set_ps1(8388608.0f); static const __m128 GLM_VAR_USED _ps_2pow23 = _mm_set_ps1(8388608.0f);
static const __m128 _ps_1_0_0_0 = _mm_set_ps(1.0f, 0.0f, 0.0f, 0.0f); static const __m128 GLM_VAR_USED _ps_1_0_0_0 = _mm_set_ps(1.0f, 0.0f, 0.0f, 0.0f);
static const __m128 _ps_0_1_0_0 = _mm_set_ps(0.0f, 1.0f, 0.0f, 0.0f); static const __m128 GLM_VAR_USED _ps_0_1_0_0 = _mm_set_ps(0.0f, 1.0f, 0.0f, 0.0f);
static const __m128 _ps_0_0_1_0 = _mm_set_ps(0.0f, 0.0f, 1.0f, 0.0f); static const __m128 GLM_VAR_USED _ps_0_0_1_0 = _mm_set_ps(0.0f, 0.0f, 1.0f, 0.0f);
static const __m128 _ps_0_0_0_1 = _mm_set_ps(0.0f, 0.0f, 0.0f, 1.0f); static const __m128 GLM_VAR_USED _ps_0_0_0_1 = _mm_set_ps(0.0f, 0.0f, 0.0f, 1.0f);
static const __m128 _ps_pi = _mm_set_ps1(3.1415926535897932384626433832795f); static const __m128 GLM_VAR_USED _ps_pi = _mm_set_ps1(3.1415926535897932384626433832795f);
static const __m128 _ps_pi2 = _mm_set_ps1(6.283185307179586476925286766560f); static const __m128 GLM_VAR_USED _ps_pi2 = _mm_set_ps1(6.283185307179586476925286766560f);
static const __m128 _ps_2_pi = _mm_set_ps1(0.63661977236758134307553505349006f); static const __m128 GLM_VAR_USED _ps_2_pi = _mm_set_ps1(0.63661977236758134307553505349006f);
static const __m128 _ps_pi_2 = _mm_set_ps1(1.5707963267948966192313216916398f); static const __m128 GLM_VAR_USED _ps_pi_2 = _mm_set_ps1(1.5707963267948966192313216916398f);
static const __m128 _ps_4_pi = _mm_set_ps1(1.2732395447351626861510701069801f); static const __m128 GLM_VAR_USED _ps_4_pi = _mm_set_ps1(1.2732395447351626861510701069801f);
static const __m128 _ps_pi_4 = _mm_set_ps1(0.78539816339744830961566084581988f); static const __m128 GLM_VAR_USED _ps_pi_4 = _mm_set_ps1(0.78539816339744830961566084581988f);
static const __m128 _ps_sincos_p0 = _mm_set_ps1(0.15707963267948963959e1f); static const __m128 GLM_VAR_USED _ps_sincos_p0 = _mm_set_ps1(0.15707963267948963959e1f);
static const __m128 _ps_sincos_p1 = _mm_set_ps1(-0.64596409750621907082e0f); static const __m128 GLM_VAR_USED _ps_sincos_p1 = _mm_set_ps1(-0.64596409750621907082e0f);
static const __m128 _ps_sincos_p2 = _mm_set_ps1(0.7969262624561800806e-1f); static const __m128 GLM_VAR_USED _ps_sincos_p2 = _mm_set_ps1(0.7969262624561800806e-1f);
static const __m128 _ps_sincos_p3 = _mm_set_ps1(-0.468175413106023168e-2f); static const __m128 GLM_VAR_USED _ps_sincos_p3 = _mm_set_ps1(-0.468175413106023168e-2f);
static const __m128 _ps_tan_p0 = _mm_set_ps1(-1.79565251976484877988e7f); static const __m128 GLM_VAR_USED _ps_tan_p0 = _mm_set_ps1(-1.79565251976484877988e7f);
static const __m128 _ps_tan_p1 = _mm_set_ps1(1.15351664838587416140e6f); static const __m128 GLM_VAR_USED _ps_tan_p1 = _mm_set_ps1(1.15351664838587416140e6f);
static const __m128 _ps_tan_p2 = _mm_set_ps1(-1.30936939181383777646e4f); static const __m128 GLM_VAR_USED _ps_tan_p2 = _mm_set_ps1(-1.30936939181383777646e4f);
static const __m128 _ps_tan_q0 = _mm_set_ps1(-5.38695755929454629881e7f); static const __m128 GLM_VAR_USED _ps_tan_q0 = _mm_set_ps1(-5.38695755929454629881e7f);
static const __m128 _ps_tan_q1 = _mm_set_ps1(2.50083801823357915839e7f); static const __m128 GLM_VAR_USED _ps_tan_q1 = _mm_set_ps1(2.50083801823357915839e7f);
static const __m128 _ps_tan_q2 = _mm_set_ps1(-1.32089234440210967447e6f); static const __m128 GLM_VAR_USED _ps_tan_q2 = _mm_set_ps1(-1.32089234440210967447e6f);
static const __m128 _ps_tan_q3 = _mm_set_ps1(1.36812963470692954678e4f); static const __m128 GLM_VAR_USED _ps_tan_q3 = _mm_set_ps1(1.36812963470692954678e4f);
static const __m128 _ps_tan_poleval = _mm_set_ps1(3.68935e19f); static const __m128 GLM_VAR_USED _ps_tan_poleval = _mm_set_ps1(3.68935e19f);
static const __m128 _ps_atan_t0 = _mm_set_ps1(-0.91646118527267623468e-1f); static const __m128 GLM_VAR_USED _ps_atan_t0 = _mm_set_ps1(-0.91646118527267623468e-1f);
static const __m128 _ps_atan_t1 = _mm_set_ps1(-0.13956945682312098640e1f); static const __m128 GLM_VAR_USED _ps_atan_t1 = _mm_set_ps1(-0.13956945682312098640e1f);
static const __m128 _ps_atan_t2 = _mm_set_ps1(-0.94393926122725531747e2f); static const __m128 GLM_VAR_USED _ps_atan_t2 = _mm_set_ps1(-0.94393926122725531747e2f);
static const __m128 _ps_atan_t3 = _mm_set_ps1(0.12888383034157279340e2f); static const __m128 GLM_VAR_USED _ps_atan_t3 = _mm_set_ps1(0.12888383034157279340e2f);
static const __m128 _ps_atan_s0 = _mm_set_ps1(0.12797564625607904396e1f); static const __m128 GLM_VAR_USED _ps_atan_s0 = _mm_set_ps1(0.12797564625607904396e1f);
static const __m128 _ps_atan_s1 = _mm_set_ps1(0.21972168858277355914e1f); static const __m128 GLM_VAR_USED _ps_atan_s1 = _mm_set_ps1(0.21972168858277355914e1f);
static const __m128 _ps_atan_s2 = _mm_set_ps1(0.68193064729268275701e1f); static const __m128 GLM_VAR_USED _ps_atan_s2 = _mm_set_ps1(0.68193064729268275701e1f);
static const __m128 _ps_atan_s3 = _mm_set_ps1(0.28205206687035841409e2f); static const __m128 GLM_VAR_USED _ps_atan_s3 = _mm_set_ps1(0.28205206687035841409e2f);
static const __m128 _ps_exp_hi = _mm_set_ps1(88.3762626647949f); static const __m128 GLM_VAR_USED _ps_exp_hi = _mm_set_ps1(88.3762626647949f);
static const __m128 _ps_exp_lo = _mm_set_ps1(-88.3762626647949f); static const __m128 GLM_VAR_USED _ps_exp_lo = _mm_set_ps1(-88.3762626647949f);
static const __m128 _ps_exp_rln2 = _mm_set_ps1(1.4426950408889634073599f); static const __m128 GLM_VAR_USED _ps_exp_rln2 = _mm_set_ps1(1.4426950408889634073599f);
static const __m128 _ps_exp_p0 = _mm_set_ps1(1.26177193074810590878e-4f); static const __m128 GLM_VAR_USED _ps_exp_p0 = _mm_set_ps1(1.26177193074810590878e-4f);
static const __m128 _ps_exp_p1 = _mm_set_ps1(3.02994407707441961300e-2f); static const __m128 GLM_VAR_USED _ps_exp_p1 = _mm_set_ps1(3.02994407707441961300e-2f);
static const __m128 _ps_exp_q0 = _mm_set_ps1(3.00198505138664455042e-6f); static const __m128 GLM_VAR_USED _ps_exp_q0 = _mm_set_ps1(3.00198505138664455042e-6f);
static const __m128 _ps_exp_q1 = _mm_set_ps1(2.52448340349684104192e-3f); static const __m128 GLM_VAR_USED _ps_exp_q1 = _mm_set_ps1(2.52448340349684104192e-3f);
static const __m128 _ps_exp_q2 = _mm_set_ps1(2.27265548208155028766e-1f); static const __m128 GLM_VAR_USED _ps_exp_q2 = _mm_set_ps1(2.27265548208155028766e-1f);
static const __m128 _ps_exp_q3 = _mm_set_ps1(2.00000000000000000009e0f); static const __m128 GLM_VAR_USED _ps_exp_q3 = _mm_set_ps1(2.00000000000000000009e0f);
static const __m128 _ps_exp_c1 = _mm_set_ps1(6.93145751953125e-1f); static const __m128 GLM_VAR_USED _ps_exp_c1 = _mm_set_ps1(6.93145751953125e-1f);
static const __m128 _ps_exp_c2 = _mm_set_ps1(1.42860682030941723212e-6f); static const __m128 GLM_VAR_USED _ps_exp_c2 = _mm_set_ps1(1.42860682030941723212e-6f);
static const __m128 _ps_exp2_hi = _mm_set_ps1(127.4999961853f); static const __m128 GLM_VAR_USED _ps_exp2_hi = _mm_set_ps1(127.4999961853f);
static const __m128 _ps_exp2_lo = _mm_set_ps1(-127.4999961853f); static const __m128 GLM_VAR_USED _ps_exp2_lo = _mm_set_ps1(-127.4999961853f);
static const __m128 _ps_exp2_p0 = _mm_set_ps1(2.30933477057345225087e-2f); static const __m128 GLM_VAR_USED _ps_exp2_p0 = _mm_set_ps1(2.30933477057345225087e-2f);
static const __m128 _ps_exp2_p1 = _mm_set_ps1(2.02020656693165307700e1f); static const __m128 GLM_VAR_USED _ps_exp2_p1 = _mm_set_ps1(2.02020656693165307700e1f);
static const __m128 _ps_exp2_p2 = _mm_set_ps1(1.51390680115615096133e3f); static const __m128 GLM_VAR_USED _ps_exp2_p2 = _mm_set_ps1(1.51390680115615096133e3f);
static const __m128 _ps_exp2_q0 = _mm_set_ps1(2.33184211722314911771e2f); static const __m128 GLM_VAR_USED _ps_exp2_q0 = _mm_set_ps1(2.33184211722314911771e2f);
static const __m128 _ps_exp2_q1 = _mm_set_ps1(4.36821166879210612817e3f); static const __m128 GLM_VAR_USED _ps_exp2_q1 = _mm_set_ps1(4.36821166879210612817e3f);
static const __m128 _ps_log_p0 = _mm_set_ps1(-7.89580278884799154124e-1f); static const __m128 GLM_VAR_USED _ps_log_p0 = _mm_set_ps1(-7.89580278884799154124e-1f);
static const __m128 _ps_log_p1 = _mm_set_ps1(1.63866645699558079767e1f); static const __m128 GLM_VAR_USED _ps_log_p1 = _mm_set_ps1(1.63866645699558079767e1f);
static const __m128 _ps_log_p2 = _mm_set_ps1(-6.41409952958715622951e1f); static const __m128 GLM_VAR_USED _ps_log_p2 = _mm_set_ps1(-6.41409952958715622951e1f);
static const __m128 _ps_log_q0 = _mm_set_ps1(-3.56722798256324312549e1f); static const __m128 GLM_VAR_USED _ps_log_q0 = _mm_set_ps1(-3.56722798256324312549e1f);
static const __m128 _ps_log_q1 = _mm_set_ps1(3.12093766372244180303e2f); static const __m128 GLM_VAR_USED _ps_log_q1 = _mm_set_ps1(3.12093766372244180303e2f);
static const __m128 _ps_log_q2 = _mm_set_ps1(-7.69691943550460008604e2f); static const __m128 GLM_VAR_USED _ps_log_q2 = _mm_set_ps1(-7.69691943550460008604e2f);
static const __m128 _ps_log_c0 = _mm_set_ps1(0.693147180559945f); static const __m128 GLM_VAR_USED _ps_log_c0 = _mm_set_ps1(0.693147180559945f);
static const __m128 _ps_log2_c0 = _mm_set_ps1(1.44269504088896340735992f); static const __m128 GLM_VAR_USED _ps_log2_c0 = _mm_set_ps1(1.44269504088896340735992f);
GLM_FUNC_QUALIFIER __m128 sse_abs_ps(__m128 x) GLM_FUNC_QUALIFIER __m128 sse_abs_ps(__m128 x)
{ {
@ -205,12 +205,19 @@ GLM_FUNC_QUALIFIER __m128 sse_mod_ps(__m128 x, __m128 y)
} }
/// TODO /// TODO
<<<<<<< HEAD
/* /*
GLM_FUNC_QUALIFIER __m128 sse_modf_ps(__m128 x, __m128i & i) GLM_FUNC_QUALIFIER __m128 sse_modf_ps(__m128 x, __m128i & i)
{ {
return __m128(); return __m128();
} }
*/ */
=======
//GLM_FUNC_QUALIFIER __m128 sse_modf_ps(__m128 x, __m128i & i)
//{
// return __m128();
//}
>>>>>>> d373c85b676bf28e721f3b30fd3fb0b1ceadd0d2
//GLM_FUNC_QUALIFIER __m128 _mm_min_ps(__m128 x, __m128 y) //GLM_FUNC_QUALIFIER __m128 _mm_min_ps(__m128 x, __m128 y)
@ -254,17 +261,19 @@ GLM_FUNC_QUALIFIER __m128 sse_ssp_ps(__m128 edge0, __m128 edge1, __m128 x)
return mul2; return mul2;
} }
/* TODO /// \todo
GLM_FUNC_QUALIFIER __m128 sse_nan_ps(__m128 x) GLM_FUNC_QUALIFIER __m128 sse_nan_ps(__m128 x)
{ {
__m128 empty;
return empty;
} }
/// \todo
GLM_FUNC_QUALIFIER __m128 sse_inf_ps(__m128 x) GLM_FUNC_QUALIFIER __m128 sse_inf_ps(__m128 x)
{ {
__m128 empty;
return empty;
} }
*/
// SSE scalar reciprocal sqrt using rsqrt op, plus one Newton-Rhaphson iteration // SSE scalar reciprocal sqrt using rsqrt op, plus one Newton-Rhaphson iteration
// By Elan Ruskin, http://assemblyrequired.crashworks.org/ // By Elan Ruskin, http://assemblyrequired.crashworks.org/

View File

@ -10,9 +10,8 @@
namespace glm{ namespace glm{
namespace detail{ namespace detail{
/// \todo static const __m128 GLM_VAR_USED _m128_rad_ps = _mm_set_ps1(3.141592653589793238462643383279f / 180.f);
//static const __m128 _m128_rad_ps = _mm_set_ps1(3.141592653589793238462643383279f / 180.f); static const __m128 GLM_VAR_USED _m128_deg_ps = _mm_set_ps1(180.f / 3.141592653589793238462643383279f);
//static const __m128 _m128_deg_ps = _mm_set_ps1(180.f / 3.141592653589793238462643383279f);
template <typename matType> template <typename matType>
GLM_FUNC_QUALIFIER matType sse_comp_mul_ps GLM_FUNC_QUALIFIER matType sse_comp_mul_ps
@ -969,7 +968,7 @@ GLM_FUNC_QUALIFIER void sse_inverse_fast_ps(__m128 const in[4], __m128 out[4])
out[2] = _mm_mul_ps(Inv2, Rcp0); out[2] = _mm_mul_ps(Inv2, Rcp0);
out[3] = _mm_mul_ps(Inv3, Rcp0); out[3] = _mm_mul_ps(Inv3, Rcp0);
} }
/*
GLM_FUNC_QUALIFIER void sse_rotate_ps(__m128 const in[4], float Angle, float const v[3], __m128 out[4]) GLM_FUNC_QUALIFIER void sse_rotate_ps(__m128 const in[4], float Angle, float const v[3], __m128 out[4])
{ {
float a = glm::radians(Angle); float a = glm::radians(Angle);
@ -1039,7 +1038,7 @@ GLM_FUNC_QUALIFIER void sse_rotate_ps(__m128 const in[4], float Angle, float con
//return Result; //return Result;
sse_mul_ps(in, Result, out); sse_mul_ps(in, Result, out);
} }
*/
GLM_FUNC_QUALIFIER void sse_outer_ps(__m128 const & c, __m128 const & r, __m128 out[4]) GLM_FUNC_QUALIFIER void sse_outer_ps(__m128 const & c, __m128 const & r, __m128 out[4])
{ {
out[0] = _mm_mul_ps(c, _mm_shuffle_ps(r, r, _MM_SHUFFLE(0, 0, 0, 0))); out[0] = _mm_mul_ps(c, _mm_shuffle_ps(r, r, _MM_SHUFFLE(0, 0, 0, 0)));

View File

@ -43,8 +43,8 @@
// GCC defines // GCC defines
#define GLM_COMPILER_GCC 0x02000000 #define GLM_COMPILER_GCC 0x02000000
#define GLM_COMPILER_GCC_LLVM 0x02000000 #define GLM_COMPILER_GCC_LLVM 0x02000001
#define GLM_COMPILER_GCC_CLANG 0x02000000 #define GLM_COMPILER_GCC_CLANG 0x02000002
#define GLM_COMPILER_GCC30 0x02000010 #define GLM_COMPILER_GCC30 0x02000010
#define GLM_COMPILER_GCC31 0x02000020 #define GLM_COMPILER_GCC31 0x02000020
#define GLM_COMPILER_GCC32 0x02000030 #define GLM_COMPILER_GCC32 0x02000030
@ -214,9 +214,9 @@
# elif(GLM_COMPILER & GLM_COMPILER_LLVM_GCC) # elif(GLM_COMPILER & GLM_COMPILER_LLVM_GCC)
# pragma message("GLM: LLVM GCC compiler detected") # pragma message("GLM: LLVM GCC compiler detected")
# elif(GLM_COMPILER & GLM_COMPILER_GCC) # elif(GLM_COMPILER & GLM_COMPILER_GCC)
# if(GLM_COMPILER & GLM_COMPILER_GCC_LLVM) # if(GLM_COMPILER == GLM_COMPILER_GCC_LLVM)
# pragma message("GLM: LLVM GCC compiler detected") # pragma message("GLM: LLVM GCC compiler detected")
# elif(GLM_COMPILER & GLM_COMPILER_GCC_CLANG) # elif(GLM_COMPILER == GLM_COMPILER_GCC_CLANG)
# pragma message("GLM: CLANG compiler detected") # pragma message("GLM: CLANG compiler detected")
# else # else
# pragma message("GLM: GCC compiler detected") # pragma message("GLM: GCC compiler detected")
@ -441,6 +441,12 @@
# define GLM_CUDA_FUNC_DECL # define GLM_CUDA_FUNC_DECL
#endif #endif
#if GLM_COMPILER & GLM_COMPILER_GCC
#define GLM_VAR_USED __attribute__ ((unused))
#else
#define GLM_VAR_USED
#endif
#if(defined(GLM_FORCE_INLINE)) #if(defined(GLM_FORCE_INLINE))
# if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2005)) # if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC2005))
# define GLM_INLINE __forceinline # define GLM_INLINE __forceinline

View File

@ -8,7 +8,8 @@
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
// Dependency: // Dependency:
// - GLM core // - GLM core
// - GLM_GTX_half // - GLM_GTC_half_float
// - GLM_GTC_quaternion
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef glm_gtx_epsilon #ifndef glm_gtx_epsilon
@ -17,6 +18,7 @@
// Dependency: // Dependency:
#include "../glm.hpp" #include "../glm.hpp"
#include "../gtc/half_float.hpp" #include "../gtc/half_float.hpp"
#include "../gtc/quaternion.hpp"
#if(defined(GLM_MESSAGES) && !defined(glm_ext)) #if(defined(GLM_MESSAGES) && !defined(glm_ext))
# pragma message("GLM: GLM_GTX_epsilon extension included") # pragma message("GLM: GLM_GTX_epsilon extension included")

View File

@ -157,6 +157,21 @@ GLM_FUNC_QUALIFIER detail::tvec4<bool> equalEpsilon
abs(x.w - y.w) < epsilon.w); abs(x.w - y.w) < epsilon.w);
} }
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<bool> equalEpsilon
(
detail::tquat<valType> const & x,
detail::tquat<valType> const & y,
detail::tquat<valType> const & epsilon
)
{
return detail::tvec4<bool>(
abs(x.x - y.x) < epsilon.x,
abs(x.y - y.y) < epsilon.y,
abs(x.z - y.z) < epsilon.z,
abs(x.w - y.w) < epsilon.w);
}
template <typename valType> template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec2<bool> notEqualEpsilon GLM_FUNC_QUALIFIER detail::tvec2<bool> notEqualEpsilon
( (
@ -199,6 +214,21 @@ GLM_FUNC_QUALIFIER detail::tvec4<bool> notEqualEpsilon
abs(x.w - y.w) >= epsilon.w); abs(x.w - y.w) >= epsilon.w);
} }
template <typename valType>
GLM_FUNC_QUALIFIER detail::tvec4<bool> notEqualEpsilon
(
detail::tquat<valType> const & x,
detail::tquat<valType> const & y,
detail::tquat<valType> const & epsilon
)
{
return detail::tvec4<bool>(
abs(x.x - y.x) >= epsilon.x,
abs(x.y - y.y) >= epsilon.y,
abs(x.z - y.z) >= epsilon.z,
abs(x.w - y.w) >= epsilon.w);
}
}//namespace epsilon }//namespace epsilon
}//namespace gtx }//namespace gtx
}//namespace glm }//namespace glm

View File

@ -256,7 +256,7 @@ namespace quaternion
if(a <= typename detail::tquat<T>::value_type(0)) return x; if(a <= typename detail::tquat<T>::value_type(0)) return x;
if(a >= typename detail::tquat<T>::value_type(1)) return y; if(a >= typename detail::tquat<T>::value_type(1)) return y;
float fCos = dot(x, y); detail::tquat<T>::value_type fCos = dot(x, y);
detail::tquat<T> y2(y); //BUG!!! tquat<T> y2; detail::tquat<T> y2(y); //BUG!!! tquat<T> y2;
if(fCos < typename detail::tquat<T>::value_type(0)) if(fCos < typename detail::tquat<T>::value_type(0))
{ {
@ -265,7 +265,7 @@ namespace quaternion
} }
//if(fCos > 1.0f) // problem //if(fCos > 1.0f) // problem
float k0, k1; detail::tquat<T>::value_type k0, k1;
if(fCos > typename detail::tquat<T>::value_type(0.9999)) if(fCos > typename detail::tquat<T>::value_type(0.9999))
{ {
k0 = typename detail::tquat<T>::value_type(1) - a; k0 = typename detail::tquat<T>::value_type(1) - a;
@ -295,7 +295,7 @@ namespace quaternion
T const & a T const & a
) )
{ {
return glm::normalize(x * (1 - a) + (y * a)); return glm::normalize(x * (detail::tquat<T>::value_type(1) - a) + (y * a));
} }
}//namespace quaternion }//namespace quaternion

View File

@ -17,7 +17,7 @@ namespace random
template <> template <>
GLM_FUNC_QUALIFIER float signedRand1() GLM_FUNC_QUALIFIER float signedRand1()
{ {
#if(GLM_COMPILER & GLM_COMPILER_VC) #if(GLM_COMPILER & GLM_COMPILER_VC)// && (GLM_COMPILER < GLM_COMPILER_VC2010)
#define RAND_SHIFT_NUM 5 #define RAND_SHIFT_NUM 5
#else #else
#define RAND_SHIFT_NUM 0 #define RAND_SHIFT_NUM 0

View File

@ -1,6 +1,3 @@
#ifndef GLM_EXT_VIRTREV_XSTREAM_HPP
#define GLM_EXT_VIRTREV_XSTREAM_HPP
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) // OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
// Virtrev SDK copyright matrem (matrem84.free.fr) // Virtrev SDK copyright matrem (matrem84.free.fr)
@ -15,6 +12,9 @@
// - GLM_GTX_matrix_selection // - GLM_GTX_matrix_selection
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#ifndef GLM_EXT_VIRTREV_XSTREAM_HPP
#define GLM_EXT_VIRTREV_XSTREAM_HPP
#include "../glm.hpp" #include "../glm.hpp"
#include "../gtc/matrix_access.hpp" #include "../gtc/matrix_access.hpp"
#include <iostream> #include <iostream>

View File

@ -37,7 +37,14 @@ More informations in GLM manual:
http://glm.g-truc.net/glm-0.9.2.pdf http://glm.g-truc.net/glm-0.9.2.pdf
================================================================================ ================================================================================
GLM 0.9.2.1: 2010-05-24 GLM 0.9.2.2: 2011-06-XX
--------------------------------------------------------------------------------
- Expend matrix constructors flexibility
- Improved quaternion implementation
- Fixed many warnings across platforms and compilers
================================================================================
GLM 0.9.2.1: 2011-05-24
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- Automatically detect CUDA support - Automatically detect CUDA support
- Improved compiler detection - Improved compiler detection
@ -46,7 +53,7 @@ GLM 0.9.2.1: 2010-05-24
- Fixed and tested GLM_GTX_rotate_vector - Fixed and tested GLM_GTX_rotate_vector
================================================================================ ================================================================================
GLM 0.9.2.0: 2010-05-09 GLM 0.9.2.0: 2011-05-09
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- Added CUDA support - Added CUDA support
- Added CTest test suite - Added CTest test suite
@ -56,27 +63,27 @@ GLM 0.9.2.0: 2010-05-09
- Updated quaternion slerp interpolation - Updated quaternion slerp interpolation
================================================================================ ================================================================================
GLM 0.9.1.3: 2010-05-07 GLM 0.9.1.3: 2011-05-07
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- Fixed bugs - Fixed bugs
================================================================================ ================================================================================
GLM 0.9.1.2: 2010-04-15 GLM 0.9.1.2: 2011-04-15
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- Fixed bugs - Fixed bugs
================================================================================ ================================================================================
GLM 0.9.1.1: 2010-03-17 GLM 0.9.1.1: 2011-03-17
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- Fixed bugs - Fixed bugs
================================================================================ ================================================================================
GLM 0.9.1.0: 2010-03-03 GLM 0.9.1.0: 2011-03-03
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- Fixed bugs - Fixed bugs
================================================================================ ================================================================================
GLM 0.9.1.B: 2010-02-13 GLM 0.9.1.B: 2011-02-13
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- Updated API documentation - Updated API documentation
- Improved SIMD implementation - Improved SIMD implementation
@ -89,7 +96,7 @@ GLM 0.9.0.8: 2011-02-13
- Clarify that GLM is a header only library. - Clarify that GLM is a header only library.
================================================================================ ================================================================================
GLM 0.9.1.A: 2010-01-31 GLM 0.9.1.A: 2011-01-31
-------------------------------------------------------------------------------- --------------------------------------------------------------------------------
- Added SIMD support - Added SIMD support
- Added new swizzle functions - Added new swizzle functions

View File

@ -29,67 +29,12 @@ int test_quat_type()
return 0; return 0;
} }
int test_quat_slerp()
{
int Error = 0;
glm::quat A(glm::vec3(0, 0, 1));
glm::quat B(glm::vec3(0, 1, 0));
glm::quat C = glm::mix(A, B, 0.5f);
glm::quat D(glm::normalize(glm::vec3(0, 1, 1)));
Error += C == D ? 0 : 1;
return Error;
}
int test_quat_length()
{
int Error = 0;
float A = glm::length(glm::quat(45.0f, glm::vec3(0, 0, 1)));
Error += A == 1.0f ? 0 : 1;
float B = glm::length(glm::quat(90.0f, glm::vec3(0, 0, 2)));
Error += B == 2.0f ? 0 : 1;
return Error;
}
int test_quat_normalize()
{
int Error = 0;
{
glm::quat Q(45.0f, glm::vec3(0, 0, 1));
glm::quat N = glm::normalize(Q);
float L = glm::length(N);
Error += L == 1.0f ? 0 : 1;
}
{
glm::quat Q(45.0f, glm::vec3(0, 0, 2));
glm::quat N = glm::normalize(Q);
float L = glm::length(N);
Error += L == 1.0f ? 0 : 1;
}
{
glm::quat Q(45.0f, glm::vec3(1, 2, 3));
glm::quat N = glm::normalize(Q);
float L = glm::length(N);
Error += L == 1.0f ? 0 : 1;
}
return Error;
}
int main() int main()
{ {
int Error = 0; int Error = 0;
Error += test_quat_precision(); Error += test_quat_precision();
Error += test_quat_type(); Error += test_quat_type();
Error += test_quat_slerp();
Error += test_quat_length();
Error += test_quat_normalize();
return Error; return Error;
} }

View File

@ -1,6 +1,7 @@
glmCreateTestGTC(gtx_bit) glmCreateTestGTC(gtx_bit)
glmCreateTestGTC(gtx_noise) glmCreateTestGTC(gtx_noise)
glmCreateTestGTC(gtx_quaternion) glmCreateTestGTC(gtx_quaternion)
glmCreateTestGTC(gtx_random)
glmCreateTestGTC(gtx_rotate_vector) glmCreateTestGTC(gtx_rotate_vector)
glmCreateTestGTC(gtx_simd_vec4) glmCreateTestGTC(gtx_simd_vec4)
glmCreateTestGTC(gtx_simd_mat4) glmCreateTestGTC(gtx_simd_mat4)

View File

@ -11,17 +11,40 @@
#include <glm/gtx/noise.hpp> #include <glm/gtx/noise.hpp>
#include <iostream> #include <iostream>
int main() int test_simplex()
{ {
float ValueSNoise2D = glm::simplex(glm::vec2(0.5f)); float ValueSNoise2D = glm::simplex(glm::vec2(0.5f));
float ValueSNoise3D = glm::simplex(glm::vec3(0.5f)); float ValueSNoise3D = glm::simplex(glm::vec3(0.5f));
float ValueSNoise4D = glm::simplex(glm::vec4(0.5f)); float ValueSNoise4D = glm::simplex(glm::vec4(0.5f));
return 0;
}
int test_perlin()
{
float ValueCNoise2D = glm::perlin(glm::vec2(0.5f)); float ValueCNoise2D = glm::perlin(glm::vec2(0.5f));
float ValueCNoise3D = glm::perlin(glm::vec3(0.5f)); float ValueCNoise3D = glm::perlin(glm::vec3(0.5f));
float ValueCNoise4D = glm::perlin(glm::vec4(0.5f)); float ValueCNoise4D = glm::perlin(glm::vec4(0.5f));
return 0;
}
int test_perlin_pedioric()
{
float ValuePNoise2D = glm::perlin(glm::vec2(0.5f), glm::vec2(0.5f)); float ValuePNoise2D = glm::perlin(glm::vec2(0.5f), glm::vec2(0.5f));
float ValuePNoise3D = glm::perlin(glm::vec3(0.5f), glm::vec3(0.5f)); float ValuePNoise3D = glm::perlin(glm::vec3(0.5f), glm::vec3(0.5f));
float ValuePNoise4D = glm::perlin(glm::vec4(0.5f), glm::vec4(0.5f)); float ValuePNoise4D = glm::perlin(glm::vec4(0.5f), glm::vec4(0.5f));
return 0;
}
int main()
{
int Error = 0;
Error += test_simplex();
Error += test_perlin();
Error += test_perlin_pedioric();
return Error;
} }

View File

@ -11,6 +11,23 @@
#include <glm/gtx/quaternion.hpp> #include <glm/gtx/quaternion.hpp>
#include <glm/gtx/epsilon.hpp> #include <glm/gtx/epsilon.hpp>
int test_quat_mix()
{
int Error = 0;
glm::quat A = glm::angleAxis(0.0f, glm::vec3(0, 0, 1));
glm::quat B = glm::angleAxis(90.0f, glm::vec3(0, 0, 1));
glm::quat C = glm::mix(A, B, 0.5f);
glm::quat D = glm::angleAxis(45.0f, glm::vec3(0, 0, 1));
Error += glm::equalEpsilon(C.x, D.x, 0.01f) ? 0 : 1;
Error += glm::equalEpsilon(C.y, D.y, 0.01f) ? 0 : 1;
Error += glm::equalEpsilon(C.z, D.z, 0.01f) ? 0 : 1;
Error += glm::equalEpsilon(C.w, D.w, 0.01f) ? 0 : 1;
return Error;
}
int test_quat_fastMix() int test_quat_fastMix()
{ {
int Error = 0; int Error = 0;
@ -94,14 +111,42 @@ int test_quat_angle()
return Error; return Error;
} }
int test_quat_normalize()
{
int Error = 0;
{
glm::quat Q = glm::angleAxis(45.0f, glm::vec3(0, 0, 1));
glm::quat N = glm::normalize(Q);
float L = glm::length(N);
Error += glm::equalEpsilon(L, 1.0f, 0.000001f) ? 0 : 1;
}
{
glm::quat Q = glm::angleAxis(45.0f, glm::vec3(0, 0, 2));
glm::quat N = glm::normalize(Q);
float L = glm::length(N);
Error += glm::equalEpsilon(L, 1.0f, 0.000001f) ? 0 : 1;
}
{
glm::quat Q = glm::angleAxis(45.0f, glm::vec3(1, 2, 3));
glm::quat N = glm::normalize(Q);
float L = glm::length(N);
Error += glm::equalEpsilon(L, 1.0f, 0.000001f) ? 0 : 1;
}
return Error;
}
int main() int main()
{ {
int Error = 0; int Error = 0;
Error += test_quat_angle(); Error += test_quat_angle();
Error += test_quat_angleAxis(); Error += test_quat_angleAxis();
Error += test_quat_mix();
Error += test_quat_fastMix(); Error += test_quat_fastMix();
Error += test_quat_shortMix(); Error += test_quat_shortMix();
Error += test_quat_normalize();
return Error; return Error;
} }

98
test/gtx/gtx_random.cpp Normal file
View File

@ -0,0 +1,98 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2011-05-31
// Updated : 2011-05-31
// Licence : This source is under MIT licence
// File : test/gtx/random.cpp
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp>
#include <glm/gtx/random.hpp>
#include <glm/gtx/epsilon.hpp>
#include <iostream>
int test_signedRand1()
{
int Error = 0;
{
float ResultFloat = 0.0f;
double ResultDouble = 0.0f;
for(std::size_t i = 0; i < 100000; ++i)
{
ResultFloat += glm::signedRand1<float>();
ResultDouble += glm::signedRand1<double>();
}
Error += glm::equalEpsilon(ResultFloat, 0.0f, 0.0001f);
Error += glm::equalEpsilon(ResultDouble, 0.0, 0.0001);
}
return Error;
}
int test_normalizedRand2()
{
int Error = 0;
{
std::size_t Max = 100000;
float ResultFloat = 0.0f;
double ResultDouble = 0.0f;
for(std::size_t i = 0; i < Max; ++i)
{
ResultFloat += glm::length(glm::normalizedRand2<float>());
ResultDouble += glm::length(glm::normalizedRand2<double>());
}
Error += glm::equalEpsilon(ResultFloat, float(Max), 0.0001f);
Error += glm::equalEpsilon(ResultDouble, double(Max), 0.0001);
}
return Error;
}
int test_normalizedRand3()
{
int Error = 0;
{
std::size_t Max = 100000;
float ResultFloatA = 0.0f;
float ResultFloatB = 0.0f;
float ResultFloatC = 0.0f;
double ResultDoubleA = 0.0f;
double ResultDoubleB = 0.0f;
double ResultDoubleC = 0.0f;
for(std::size_t i = 0; i < Max; ++i)
{
ResultFloatA += glm::length(glm::normalizedRand3<float>());
ResultDoubleA += glm::length(glm::normalizedRand3<double>());
ResultFloatB += glm::length(glm::normalizedRand3(2.0f, 2.0f));
ResultDoubleB += glm::length(glm::normalizedRand3(2.0, 2.0));
ResultFloatC += glm::length(glm::normalizedRand3(1.0f, 3.0f));
ResultDoubleC += glm::length(glm::normalizedRand3(1.0, 3.0));
}
Error += glm::equalEpsilon(ResultFloatA, float(Max), 0.0001f) ? 0 : 1;
Error += glm::equalEpsilon(ResultDoubleA, double(Max), 0.0001) ? 0 : 1;
Error += glm::equalEpsilon(ResultFloatB, float(Max * 2), 0.0001f) ? 0 : 1;
Error += glm::equalEpsilon(ResultDoubleB, double(Max * 2), 0.0001) ? 0 : 1;
Error += (ResultFloatC >= float(Max) && ResultFloatC <= float(Max * 3)) ? 0 : 1;
Error += (ResultDoubleC >= double(Max) && ResultDoubleC <= double(Max * 3)) ? 0 : 1;
}
return Error;
}
int main()
{
int Error = 0;
Error += test_signedRand1();
Error += test_normalizedRand2();
Error += test_normalizedRand3();
return Error;
}