mirror of
https://github.com/g-truc/glm.git
synced 2024-11-10 04:31:47 +00:00
Fixed merge
This commit is contained in:
commit
e7a5e50fc8
@ -803,19 +803,19 @@ namespace detail
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'isnan' only accept floating-point inputs");
|
||||
|
||||
# if(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL))
|
||||
# if(GLM_COMPILER & (GLM_COMPILER_VC | GLM_COMPILER_INTEL))
|
||||
return _isnan(x) != 0;
|
||||
# elif(GLM_COMPILER & GLM_COMPILER_GCC)
|
||||
# elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG))
|
||||
# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
|
||||
return _isnan(x) != 0;
|
||||
# else
|
||||
return std::isnan(x);
|
||||
# endif
|
||||
# elif(GLM_COMPILER & GLM_COMPILER_CUDA)
|
||||
return isnan(x) != 0;
|
||||
# else
|
||||
return isnan(x) != 0;
|
||||
# else
|
||||
return std::isnan(x);
|
||||
# endif
|
||||
# endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -860,35 +860,20 @@ namespace detail
|
||||
{
|
||||
GLM_STATIC_ASSERT(detail::type<genType>::is_float, "'isinf' only accept floating-point inputs");
|
||||
|
||||
# if(GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC))
|
||||
# if(GLM_COMPILER & (GLM_COMPILER_INTEL | GLM_COMPILER_VC))
|
||||
return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF;
|
||||
# elif(GLM_COMPILER & GLM_COMPILER_GCC)
|
||||
# elif(GLM_COMPILER & (GLM_COMPILER_GCC | GLM_COMPILER_CLANG))
|
||||
# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
|
||||
return _isinf(x) != 0;
|
||||
# else
|
||||
return std::isinf(x);
|
||||
# endif
|
||||
# elif(GLM_COMPILER & GLM_COMPILER_CUDA)
|
||||
// http://developer.download.nvidia.com/compute/cuda/4_2/rel/toolkit/docs/online/group__CUDA__MATH__DOUBLE_g13431dd2b40b51f9139cbb7f50c18fab.html#g13431dd2b40b51f9139cbb7f50c18fab
|
||||
return isinf(double(x)) != 0;
|
||||
# else
|
||||
// http://developer.download.nvidia.com/compute/cuda/4_2/rel/toolkit/docs/online/group__CUDA__MATH__DOUBLE_g13431dd2b40b51f9139cbb7f50c18fab.html#g13431dd2b40b51f9139cbb7f50c18fab
|
||||
return isinf(double(x)) != 0;
|
||||
# else
|
||||
return std::isinf(x);
|
||||
# endif
|
||||
/*
|
||||
# if(GLM_COMPILER & GLM_COMPILER_VC)
|
||||
return _fpclass(x) == _FPCLASS_NINF || _fpclass(x) == _FPCLASS_PINF;
|
||||
# elif(GLM_COMPILER & GLM_COMPILER_GCC)
|
||||
# if(GLM_PLATFORM & GLM_PLATFORM_ANDROID)
|
||||
return _isinf(x) != 0;
|
||||
# else
|
||||
return std::isinf(x);
|
||||
# endif
|
||||
# elif(GLM_COMPILER & GLM_COMPILER_INTEL)
|
||||
return isinf(x) != 0;
|
||||
# else
|
||||
return std::isinf(x);
|
||||
# endif
|
||||
*/
|
||||
# endif
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
@ -117,11 +117,12 @@ namespace glm
|
||||
T const delta
|
||||
)
|
||||
{
|
||||
detail::tmat4x4<T> dltRotation = m2 * transpose(m1);
|
||||
detail::tmat4x4<T> m1rot = extractMatrixRotation(m1);
|
||||
detail::tmat4x4<T> dltRotation = m2 * transpose(m1rot);
|
||||
detail::tvec3<T> dltAxis;
|
||||
T dltAngle;
|
||||
axisAngle(dltRotation, dltAxis, dltAngle);
|
||||
detail::tmat4x4<T> out = axisAngleMatrix(dltAxis, dltAngle * delta) * extractMatrixRotation(m1);
|
||||
detail::tmat4x4<T> out = axisAngleMatrix(dltAxis, dltAngle * delta) * m1rot;
|
||||
out[3][0] = m1[3][0] + delta * (m2[3][0] - m1[3][0]);
|
||||
out[3][1] = m1[3][1] + delta * (m2[3][1] - m1[3][1]);
|
||||
out[3][2] = m1[3][2] + delta * (m2[3][2] - m1[3][2]);
|
||||
|
@ -0,0 +1,27 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref gtx_ocl_type
|
||||
/// @file glm/gtx/ocl_type.inl
|
||||
/// @date 2013-03-16 / 2013-03-16
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
@ -0,0 +1,27 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
/// OpenGL Mathematics (glm.g-truc.net)
|
||||
///
|
||||
/// Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
|
||||
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
/// of this software and associated documentation files (the "Software"), to deal
|
||||
/// in the Software without restriction, including without limitation the rights
|
||||
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
/// copies of the Software, and to permit persons to whom the Software is
|
||||
/// furnished to do so, subject to the following conditions:
|
||||
///
|
||||
/// The above copyright notice and this permission notice shall be included in
|
||||
/// all copies or substantial portions of the Software.
|
||||
///
|
||||
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
/// THE SOFTWARE.
|
||||
///
|
||||
/// @ref gtx_vec1
|
||||
/// @file glm/gtx/vec1.inl
|
||||
/// @date 2013-03-16 / 2013-03-16
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
@ -46,7 +46,7 @@ GLM 0.9.5.0: 2013-XX-XX
|
||||
- Added rotation function to GTX_quaternion (#22)
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.4.3: 2013-0X-XX
|
||||
GLM 0.9.4.3: 2013-03-17
|
||||
--------------------------------------------------------------------------------
|
||||
- Detected qualifier for Clang
|
||||
- Fixed C++11 mode for GCC, couldn't be enabled without MS extensions
|
||||
@ -54,6 +54,9 @@ GLM 0.9.4.3: 2013-0X-XX
|
||||
- Fixed GTX_polar_coordinates euclidean function, takes a vec2 instead of a vec3
|
||||
- Clarify the license applying on the manual
|
||||
- Added a docx copy of the manual
|
||||
- Fixed GLM_GTX_matrix_interpolation
|
||||
- Fixed isnan and isinf on Android with Clang
|
||||
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.4.2: 2013-02-14
|
||||
|
@ -11,6 +11,7 @@
|
||||
//#include <boost/date_time/posix_time/posix_time.hpp>
|
||||
//#include <boost/thread/thread.hpp>
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/constants.hpp>
|
||||
#include <glm/gtc/epsilon.hpp>
|
||||
#include <cstdio>
|
||||
|
||||
@ -148,26 +149,94 @@ int test_floatBitsToUint()
|
||||
return Error;
|
||||
}
|
||||
|
||||
int test_mix()
|
||||
namespace test_mix
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
template <typename T, typename B>
|
||||
struct test
|
||||
{
|
||||
float A = glm::mix(0.f, 1.f, true);
|
||||
Error += A == 1.f ? 0 : 1;
|
||||
float B = glm::mix(0.f, 1.f, false);
|
||||
Error += B == 0.f ? 0 : 1;
|
||||
}
|
||||
T x;
|
||||
T y;
|
||||
B a;
|
||||
T Result;
|
||||
};
|
||||
|
||||
test<float, bool> TestBool[] =
|
||||
{
|
||||
float A = glm::mix(0.f, 1.f, 1.f);
|
||||
Error += A == 1.f ? 0 : 1;
|
||||
float B = glm::mix(0.f, 1.f, 0.f);
|
||||
Error += B == 0.f ? 0 : 1;
|
||||
}
|
||||
{0.0f, 1.0f, false, 0.0f},
|
||||
{0.0f, 1.0f, true, 1.0f},
|
||||
{-1.0f, 1.0f, false, -1.0f},
|
||||
{-1.0f, 1.0f, true, 1.0f}
|
||||
};
|
||||
|
||||
return Error;
|
||||
}
|
||||
test<float, bool> TestFloat[] =
|
||||
{
|
||||
{0.0f, 1.0f, 0.0f, 0.0f},
|
||||
{0.0f, 1.0f, 1.0f, 1.0f},
|
||||
{-1.0f, 1.0f, 0.0f, -1.0f},
|
||||
{-1.0f, 1.0f, 1.0f, 1.0f}
|
||||
};
|
||||
|
||||
test<glm::vec2, bool> TestVec2Bool[] =
|
||||
{
|
||||
{glm::vec2(0.0f), glm::vec2(1.0f), false, glm::vec2(0.0f)},
|
||||
{glm::vec2(0.0f), glm::vec2(1.0f), true, glm::vec2(1.0f)},
|
||||
{glm::vec2(-1.0f), glm::vec2(1.0f), false, glm::vec2(-1.0f)},
|
||||
{glm::vec2(-1.0f), glm::vec2(1.0f), true, glm::vec2(1.0f)}
|
||||
};
|
||||
|
||||
test<glm::vec2, glm::bvec2> TestBVec2[] =
|
||||
{
|
||||
{glm::vec2(0.0f), glm::vec2(1.0f), glm::bvec2(false), glm::vec2(0.0f)},
|
||||
{glm::vec2(0.0f), glm::vec2(1.0f), glm::bvec2(true), glm::vec2(1.0f)},
|
||||
{glm::vec2(-1.0f), glm::vec2(1.0f), glm::bvec2(false), glm::vec2(-1.0f)},
|
||||
{glm::vec2(-1.0f), glm::vec2(1.0f), glm::bvec2(true), glm::vec2(1.0f)}
|
||||
};
|
||||
|
||||
int run()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
// Float with bool
|
||||
{
|
||||
for(std::size_t i = 0; i < sizeof(TestBool) / sizeof(test<float, bool>); ++i)
|
||||
{
|
||||
float Result = glm::mix(TestBool[i].x, TestBool[i].y, TestBool[i].a);
|
||||
Error += glm::epsilonEqual(Result, TestBool[i].Result, glm::epsilon<float>()) ? 0 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Float with float
|
||||
{
|
||||
for(std::size_t i = 0; i < sizeof(TestFloat) / sizeof(test<float, float>); ++i)
|
||||
{
|
||||
float Result = glm::mix(TestFloat[i].x, TestFloat[i].y, TestFloat[i].a);
|
||||
Error += glm::epsilonEqual(Result, TestFloat[i].Result, glm::epsilon<float>()) ? 0 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
// vec2 with bool
|
||||
{
|
||||
for(std::size_t i = 0; i < sizeof(TestVec2Bool) / sizeof(test<glm::vec2, bool>); ++i)
|
||||
{
|
||||
glm::vec2 Result = glm::mix(TestVec2Bool[i].x, TestVec2Bool[i].y, TestVec2Bool[i].a);
|
||||
Error += glm::epsilonEqual(Result.x, TestVec2Bool[i].Result.x, glm::epsilon<float>()) ? 0 : 1;
|
||||
Error += glm::epsilonEqual(Result.y, TestVec2Bool[i].Result.y, glm::epsilon<float>()) ? 0 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
// vec2 with bvec2
|
||||
{
|
||||
for(std::size_t i = 0; i < sizeof(TestBVec2) / sizeof(test<glm::vec2, glm::bvec2>); ++i)
|
||||
{
|
||||
glm::vec2 Result = glm::mix(TestBVec2[i].x, TestBVec2[i].y, TestBVec2[i].a);
|
||||
Error += glm::epsilonEqual(Result.x, TestBVec2[i].Result.x, glm::epsilon<float>()) ? 0 : 1;
|
||||
Error += glm::epsilonEqual(Result.y, TestBVec2[i].Result.y, glm::epsilon<float>()) ? 0 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
return Error;
|
||||
}
|
||||
}//namespace test_mix
|
||||
|
||||
int test_round()
|
||||
{
|
||||
@ -414,7 +483,7 @@ int main()
|
||||
Error += test_modf();
|
||||
Error += test_floatBitsToInt();
|
||||
Error += test_floatBitsToUint();
|
||||
Error += test_mix();
|
||||
Error += test_mix::run();
|
||||
Error += test_round();
|
||||
Error += test_roundEven();
|
||||
Error += test_isnan();
|
||||
|
Loading…
Reference in New Issue
Block a user