mirror of
https://github.com/g-truc/glm.git
synced 2024-11-13 22:01:46 +00:00
Promoted GTX_epsilon, GTX_ulp, fixed build, removed deprecation warning at build time
This commit is contained in:
parent
b2f0f4d3f9
commit
6a4677c30e
11
glm/ext.hpp
11
glm/ext.hpp
@ -63,15 +63,21 @@
|
|||||||
# pragma message("GLM: All extensions included (not recommanded)")
|
# pragma message("GLM: All extensions included (not recommanded)")
|
||||||
#endif//GLM_MESSAGES
|
#endif//GLM_MESSAGES
|
||||||
|
|
||||||
|
#include "./gtc/constants.hpp"
|
||||||
|
#include "./gtc/epsilon.hpp"
|
||||||
#include "./gtc/half_float.hpp"
|
#include "./gtc/half_float.hpp"
|
||||||
#include "./gtc/matrix_access.hpp"
|
#include "./gtc/matrix_access.hpp"
|
||||||
#include "./gtc/matrix_integer.hpp"
|
#include "./gtc/matrix_integer.hpp"
|
||||||
#include "./gtc/matrix_inverse.hpp"
|
#include "./gtc/matrix_inverse.hpp"
|
||||||
#include "./gtc/matrix_transform.hpp"
|
#include "./gtc/matrix_transform.hpp"
|
||||||
|
#include "./gtc/noise.hpp"
|
||||||
#include "./gtc/quaternion.hpp"
|
#include "./gtc/quaternion.hpp"
|
||||||
|
#include "./gtc/random.hpp"
|
||||||
|
#include "./gtc/reciprocal.hpp"
|
||||||
#include "./gtc/swizzle.hpp"
|
#include "./gtc/swizzle.hpp"
|
||||||
#include "./gtc/type_precision.hpp"
|
#include "./gtc/type_precision.hpp"
|
||||||
#include "./gtc/type_ptr.hpp"
|
#include "./gtc/type_ptr.hpp"
|
||||||
|
#include "./gtc/ulp.hpp"
|
||||||
|
|
||||||
#include "./gtx/associated_min_max.hpp"
|
#include "./gtx/associated_min_max.hpp"
|
||||||
#include "./gtx/bit.hpp"
|
#include "./gtx/bit.hpp"
|
||||||
@ -81,7 +87,6 @@
|
|||||||
#include "./gtx/color_space_YCoCg.hpp"
|
#include "./gtx/color_space_YCoCg.hpp"
|
||||||
#include "./gtx/compatibility.hpp"
|
#include "./gtx/compatibility.hpp"
|
||||||
#include "./gtx/component_wise.hpp"
|
#include "./gtx/component_wise.hpp"
|
||||||
#include "./gtx/epsilon.hpp"
|
|
||||||
#include "./gtx/euler_angles.hpp"
|
#include "./gtx/euler_angles.hpp"
|
||||||
#include "./gtx/extend.hpp"
|
#include "./gtx/extend.hpp"
|
||||||
#include "./gtx/extented_min_max.hpp"
|
#include "./gtx/extented_min_max.hpp"
|
||||||
@ -102,7 +107,6 @@
|
|||||||
#include "./gtx/matrix_query.hpp"
|
#include "./gtx/matrix_query.hpp"
|
||||||
#include "./gtx/mixed_product.hpp"
|
#include "./gtx/mixed_product.hpp"
|
||||||
#include "./gtx/multiple.hpp"
|
#include "./gtx/multiple.hpp"
|
||||||
#include "./gtx/noise.hpp"
|
|
||||||
#include "./gtx/norm.hpp"
|
#include "./gtx/norm.hpp"
|
||||||
#include "./gtx/normal.hpp"
|
#include "./gtx/normal.hpp"
|
||||||
#include "./gtx/normalize_dot.hpp"
|
#include "./gtx/normalize_dot.hpp"
|
||||||
@ -114,16 +118,13 @@
|
|||||||
#include "./gtx/polar_coordinates.hpp"
|
#include "./gtx/polar_coordinates.hpp"
|
||||||
#include "./gtx/projection.hpp"
|
#include "./gtx/projection.hpp"
|
||||||
#include "./gtx/quaternion.hpp"
|
#include "./gtx/quaternion.hpp"
|
||||||
#include "./gtx/random.hpp"
|
|
||||||
#include "./gtx/raw_data.hpp"
|
#include "./gtx/raw_data.hpp"
|
||||||
#include "./gtx/reciprocal.hpp"
|
|
||||||
#include "./gtx/rotate_vector.hpp"
|
#include "./gtx/rotate_vector.hpp"
|
||||||
#include "./gtx/spline.hpp"
|
#include "./gtx/spline.hpp"
|
||||||
#include "./gtx/std_based_type.hpp"
|
#include "./gtx/std_based_type.hpp"
|
||||||
#include "./gtx/string_cast.hpp"
|
#include "./gtx/string_cast.hpp"
|
||||||
#include "./gtx/transform.hpp"
|
#include "./gtx/transform.hpp"
|
||||||
#include "./gtx/transform2.hpp"
|
#include "./gtx/transform2.hpp"
|
||||||
#include "./gtx/ulp.hpp"
|
|
||||||
#include "./gtx/vec1.hpp"
|
#include "./gtx/vec1.hpp"
|
||||||
#include "./gtx/vector_access.hpp"
|
#include "./gtx/vector_access.hpp"
|
||||||
#include "./gtx/vector_angle.hpp"
|
#include "./gtx/vector_angle.hpp"
|
||||||
|
78
glm/gtc/epsilon.hpp
Normal file
78
glm/gtc/epsilon.hpp
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// OpenGL Mathematics (glm.g-truc.net)
|
||||||
|
///
|
||||||
|
/// Copyright (c) 2005 - 2012 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 gtc_epsilon
|
||||||
|
/// @file glm/gtc/epsilon.hpp
|
||||||
|
/// @date 2012-04-07 / 2012-04-07
|
||||||
|
/// @author Christophe Riccio
|
||||||
|
///
|
||||||
|
/// @see core (dependence)
|
||||||
|
/// @see gtc_half_float (dependence)
|
||||||
|
/// @see gtc_quaternion (dependence)
|
||||||
|
///
|
||||||
|
/// @defgroup gtc_epsilon GLM_GTC_epsilon: Epsilon comparison
|
||||||
|
/// @ingroup gtc
|
||||||
|
///
|
||||||
|
/// @brief Comparison functions for a user defined epsilon values.
|
||||||
|
///
|
||||||
|
/// <glm/gtc/epsilon.hpp> need to be included to use these functionalities.
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef GLM_GTC_epsilon
|
||||||
|
#define GLM_GTC_epsilon GLM_VERSION
|
||||||
|
|
||||||
|
// Dependency:
|
||||||
|
#include "../glm.hpp"
|
||||||
|
#include "../gtc/half_float.hpp"
|
||||||
|
#include "../gtc/quaternion.hpp"
|
||||||
|
|
||||||
|
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
|
||||||
|
# pragma message("GLM: GLM_GTC_epsilon extension included")
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace glm
|
||||||
|
{
|
||||||
|
/// @addtogroup gtc_epsilon
|
||||||
|
/// @{
|
||||||
|
|
||||||
|
/// Returns the component-wise compare of |x - y| < epsilon.
|
||||||
|
/// @see gtc_epsilon
|
||||||
|
template <typename genTypeT, typename genTypeU>
|
||||||
|
bool equalEpsilon(
|
||||||
|
genTypeT const & x,
|
||||||
|
genTypeT const & y,
|
||||||
|
genTypeU const & epsilon);
|
||||||
|
|
||||||
|
/// Returns the component-wise compare of |x - y| >= epsilon.
|
||||||
|
/// @see gtc_epsilon
|
||||||
|
template <typename genTypeT, typename genTypeU>
|
||||||
|
bool notEqualEpsilon(
|
||||||
|
genTypeT const & x,
|
||||||
|
genTypeT const & y,
|
||||||
|
genTypeU const & epsilon);
|
||||||
|
|
||||||
|
/// @}
|
||||||
|
}//namespace glm
|
||||||
|
|
||||||
|
#include "epsilon.inl"
|
||||||
|
|
||||||
|
#endif//GLM_GTC_epsilon
|
@ -1,11 +1,30 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
// OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
|
/// OpenGL Mathematics (glm.g-truc.net)
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///
|
||||||
// Created : 2005-12-21
|
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
|
||||||
// Updated : 2011-06-07
|
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// Licence : This source is under MIT License
|
/// of this software and associated documentation files (the "Software"), to deal
|
||||||
// File : glm/gtx/epsilon.inl
|
/// 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 gtc_epsilon
|
||||||
|
/// @file glm/gtc/epsilon.inl
|
||||||
|
/// @date 2012-04-07 / 2012-04-07
|
||||||
|
/// @author Christophe Riccio
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace glm
|
namespace glm
|
||||||
{
|
{
|
@ -1,19 +1,35 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
// OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
|
/// OpenGL Mathematics (glm.g-truc.net)
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///
|
||||||
|
/// Copyright (c) 2005 - 2012 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 gtc_noise
|
||||||
|
/// @file glm/gtc/noise.inl
|
||||||
|
/// @date 2011-04-21 / 2012-04-07
|
||||||
|
/// @author Christophe Riccio
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
// Based on the work of Stefan Gustavson and Ashima Arts on "webgl-noise":
|
// Based on the work of Stefan Gustavson and Ashima Arts on "webgl-noise":
|
||||||
// https://github.com/ashima/webgl-noise
|
// https://github.com/ashima/webgl-noise
|
||||||
// Following Stefan Gustavson's paper "Simplex noise demystified":
|
// Following Stefan Gustavson's paper "Simplex noise demystified":
|
||||||
// http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
|
// http://www.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
// Created : 2011-04-21
|
|
||||||
// Updated : 2011-09-27
|
|
||||||
// Licence : This source is under MIT License
|
|
||||||
// File : glm/gtc/noise.inl
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Dependency:
|
|
||||||
// - GLM core
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
namespace glm
|
namespace glm
|
||||||
{
|
{
|
||||||
|
@ -1,11 +1,30 @@
|
|||||||
//////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
// OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
|
/// OpenGL Mathematics (glm.g-truc.net)
|
||||||
//////////////////////////////////////////////////////////////////////////////////
|
///
|
||||||
// Created : 2011-09-19
|
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
|
||||||
// Updated : 2011-09-19
|
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// Licence : This source is under MIT License
|
/// of this software and associated documentation files (the "Software"), to deal
|
||||||
// File : glm/gtc/random.inl
|
/// 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 gtc_random
|
||||||
|
/// @file glm/gtc/random.inl
|
||||||
|
/// @date 2011-09-19 / 2012-04-07
|
||||||
|
/// @author Christophe Riccio
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
@ -1,11 +1,30 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
// OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
|
/// OpenGL Mathematics (glm.g-truc.net)
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///
|
||||||
// Created : 2008-10-09
|
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
|
||||||
// Updated : 2012-01-25
|
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// Licence : This source is under MIT License
|
/// of this software and associated documentation files (the "Software"), to deal
|
||||||
// File : glm/gtc/reciprocal.inl
|
/// 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 gtc_reciprocal
|
||||||
|
/// @file glm/gtc/reciprocal.inl
|
||||||
|
/// @date 2008-10-09 / 2012-04-07
|
||||||
|
/// @author Christophe Riccio
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "../core/_vectorize.hpp"
|
#include "../core/_vectorize.hpp"
|
||||||
|
|
||||||
|
@ -1,26 +1,41 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
// OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
|
/// OpenGL Mathematics (glm.g-truc.net)
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///
|
||||||
// Created : 2011-03-07
|
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
|
||||||
// Updated : 2011-12-12
|
/// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
// Licence : This source is under MIT License
|
/// of this software and associated documentation files (the "Software"), to deal
|
||||||
// File : glm/gtc/ulp.inl
|
/// 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 gtc_ulp
|
||||||
|
/// @file glm/gtc/ulp.inl
|
||||||
|
/// @date 2011-03-07 / 2012-04-07
|
||||||
|
/// @author Christophe Riccio
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
||||||
|
///
|
||||||
|
/// Developed at SunPro, a Sun Microsystems, Inc. business.
|
||||||
|
/// Permission to use, copy, modify, and distribute this
|
||||||
|
/// software is freely granted, provided that this notice
|
||||||
|
/// is preserved.
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cfloat>
|
#include <cfloat>
|
||||||
|
|
||||||
/*
|
|
||||||
* ====================================================
|
|
||||||
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
|
||||||
*
|
|
||||||
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
||||||
* Permission to use, copy, modify, and distribute this
|
|
||||||
* software is freely granted, provided that this notice
|
|
||||||
* is preserved.
|
|
||||||
* ====================================================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma warning(push)
|
#pragma warning(push)
|
||||||
#pragma warning(disable : 4127)
|
#pragma warning(disable : 4127)
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include "../gtc/constants.hpp"
|
#include "../gtc/constants.hpp"
|
||||||
|
|
||||||
#if(defined(GLM_MESSAGES))
|
#if(defined(GLM_MESSAGES))
|
||||||
# pragma message("GLM: GLM_GTX_constants extension is deprecated, include GLM_GTX_constants instead")
|
# pragma message("GLM: GLM_GTX_constants extension is deprecated, include GLM_GTC_constants (glm/gtc/constants.hpp) instead")
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif//GLM_GTX_constants
|
#endif//GLM_GTX_constants
|
||||||
|
@ -19,60 +19,11 @@
|
|||||||
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
/// 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
|
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
/// THE SOFTWARE.
|
/// THE SOFTWARE.
|
||||||
///
|
|
||||||
/// @ref gtx_epsilon
|
|
||||||
/// @file glm/gtx/epsilon.hpp
|
|
||||||
/// @date 2007-05-21 / 2011-06-07
|
|
||||||
/// @author Christophe Riccio
|
|
||||||
///
|
|
||||||
/// @see core (dependence)
|
|
||||||
/// @see gtc_half_float (dependence)
|
|
||||||
/// @see gtc_quaternion (dependence)
|
|
||||||
///
|
|
||||||
/// @defgroup gtx_epsilon GLM_GTX_epsilon: Epsilon comparison
|
|
||||||
/// @ingroup gtx
|
|
||||||
///
|
|
||||||
/// @brief Comparison functions for a user defined epsilon values.
|
|
||||||
///
|
|
||||||
/// <glm/gtx/epsilon.hpp> need to be included to use these functionalities.
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef GLM_GTX_epsilon
|
#if(defined(GLM_MESSAGES))
|
||||||
#define GLM_GTX_epsilon GLM_VERSION
|
# pragma message("GLM: GLM_GTX_epsilon extension is deprecated, include GLM_GTC_epsilon (glm/gtc/epsilon) instead")
|
||||||
|
|
||||||
// Dependency:
|
|
||||||
#include "../glm.hpp"
|
|
||||||
#include "../gtc/half_float.hpp"
|
|
||||||
#include "../gtc/quaternion.hpp"
|
|
||||||
|
|
||||||
#if(defined(GLM_MESSAGES) && !defined(glm_ext))
|
|
||||||
# pragma message("GLM: GLM_GTX_epsilon extension included")
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace glm
|
// Promoted:
|
||||||
{
|
#include "../gtc/epsilon.hpp"
|
||||||
/// @addtogroup gtx_epsilon
|
|
||||||
/// @{
|
|
||||||
|
|
||||||
/// Returns the component-wise compare of |x - y| < epsilon.
|
|
||||||
/// @see gtx_epsilon
|
|
||||||
template <typename genTypeT, typename genTypeU>
|
|
||||||
bool equalEpsilon(
|
|
||||||
genTypeT const & x,
|
|
||||||
genTypeT const & y,
|
|
||||||
genTypeU const & epsilon);
|
|
||||||
|
|
||||||
/// Returns the component-wise compare of |x - y| >= epsilon.
|
|
||||||
/// @see gtx_epsilon
|
|
||||||
template <typename genTypeT, typename genTypeU>
|
|
||||||
bool notEqualEpsilon(
|
|
||||||
genTypeT const & x,
|
|
||||||
genTypeT const & y,
|
|
||||||
genTypeU const & epsilon);
|
|
||||||
|
|
||||||
/// @}
|
|
||||||
}//namespace glm
|
|
||||||
|
|
||||||
#include "epsilon.inl"
|
|
||||||
|
|
||||||
#endif//GLM_GTX_epsilon
|
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
|
|
||||||
// Dependency:
|
// Dependency:
|
||||||
#include "../glm.hpp"
|
#include "../glm.hpp"
|
||||||
#include "../gtx/epsilon.hpp"
|
#include "../gtc/epsilon.hpp"
|
||||||
#include "../gtx/quaternion.hpp"
|
#include "../gtx/quaternion.hpp"
|
||||||
#include "../gtx/rotate_vector.hpp"
|
#include "../gtx/rotate_vector.hpp"
|
||||||
|
|
||||||
|
@ -11,8 +11,7 @@
|
|||||||
//#include <boost/date_time/posix_time/posix_time.hpp>
|
//#include <boost/date_time/posix_time/posix_time.hpp>
|
||||||
//#include <boost/thread/thread.hpp>
|
//#include <boost/thread/thread.hpp>
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/ext.hpp>
|
#include <glm/gtc/epsilon.hpp>
|
||||||
#include <glm/gtx/epsilon.hpp>
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
int test_modf()
|
int test_modf()
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
// Created : 2011-01-15
|
// Created : 2011-01-15
|
||||||
// Updated : 2011-11-14
|
// Updated : 2011-11-14
|
||||||
// Licence : This source is under MIT licence
|
// Licence : This source is under MIT licence
|
||||||
// File : test/gtx/func_geometric.cpp
|
// File : test/core/func_geometric.cpp
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtx/epsilon.hpp>
|
#include <glm/gtc/epsilon.hpp>
|
||||||
|
|
||||||
int test_reflect()
|
int test_reflect()
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
// Created : 2011-01-15
|
// Created : 2011-01-15
|
||||||
// Updated : 2011-09-13
|
// Updated : 2011-09-13
|
||||||
// Licence : This source is under MIT licence
|
// Licence : This source is under MIT licence
|
||||||
// File : test/gtx/func_noise.cpp
|
// File : test/core/func_noise.cpp
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtc/half_float.hpp>
|
#include <glm/gtc/half_float.hpp>
|
||||||
#include <glm/gtc/type_precision.hpp>
|
#include <glm/gtc/type_precision.hpp>
|
||||||
#include <glm/gtx/epsilon.hpp>
|
#include <glm/gtc/epsilon.hpp>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
int test_packUnorm2x16()
|
int test_packUnorm2x16()
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
// Created : 2011-04-21
|
// Created : 2011-04-21
|
||||||
// Updated : 2011-04-26
|
// Updated : 2011-04-26
|
||||||
// Licence : This source is under MIT licence
|
// Licence : This source is under MIT licence
|
||||||
// File : test/gtx/noise.cpp
|
// File : test/gtc/noise.cpp
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtx/noise.hpp>
|
#include <glm/gtc/noise.hpp>
|
||||||
#include <gli/gli.hpp>
|
#include <gli/gli.hpp>
|
||||||
#include <gli/gtx/loader.hpp>
|
#include <gli/gtx/loader.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -9,7 +9,73 @@
|
|||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtc/quaternion.hpp>
|
#include <glm/gtc/quaternion.hpp>
|
||||||
#include <glm/gtx/epsilon.hpp>
|
#include <glm/gtc/epsilon.hpp>
|
||||||
|
|
||||||
|
int test_quat_angle()
|
||||||
|
{
|
||||||
|
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.01f) ? 0 : 1;
|
||||||
|
float A = glm::angle(N);
|
||||||
|
Error += glm::equalEpsilon(A, 45.0f, 0.01f) ? 0 : 1;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
glm::quat Q = glm::angleAxis(45.0f, glm::normalize(glm::vec3(0, 1, 1)));
|
||||||
|
glm::quat N = glm::normalize(Q);
|
||||||
|
float L = glm::length(N);
|
||||||
|
Error += glm::equalEpsilon(L, 1.0f, 0.01f) ? 0 : 1;
|
||||||
|
float A = glm::angle(N);
|
||||||
|
Error += glm::equalEpsilon(A, 45.0f, 0.01f) ? 0 : 1;
|
||||||
|
}
|
||||||
|
{
|
||||||
|
glm::quat Q = glm::angleAxis(45.0f, glm::normalize(glm::vec3(1, 2, 3)));
|
||||||
|
glm::quat N = glm::normalize(Q);
|
||||||
|
float L = glm::length(N);
|
||||||
|
Error += glm::equalEpsilon(L, 1.0f, 0.01f) ? 0 : 1;
|
||||||
|
float A = glm::angle(N);
|
||||||
|
Error += glm::equalEpsilon(A, 45.0f, 0.01f) ? 0 : 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Error;
|
||||||
|
}
|
||||||
|
|
||||||
|
int test_quat_angleAxis()
|
||||||
|
{
|
||||||
|
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_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_precision()
|
int test_quat_precision()
|
||||||
{
|
{
|
||||||
@ -21,6 +87,32 @@ int test_quat_precision()
|
|||||||
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 test_quat_type()
|
int test_quat_type()
|
||||||
{
|
{
|
||||||
glm::quat A;
|
glm::quat A;
|
||||||
@ -35,6 +127,10 @@ int main()
|
|||||||
|
|
||||||
Error += test_quat_precision();
|
Error += test_quat_precision();
|
||||||
Error += test_quat_type();
|
Error += test_quat_type();
|
||||||
|
Error += test_quat_angle();
|
||||||
|
Error += test_quat_angleAxis();
|
||||||
|
Error += test_quat_mix();
|
||||||
|
Error += test_quat_normalize();
|
||||||
|
|
||||||
return Error;
|
return Error;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtc/random.hpp>
|
#include <glm/gtc/random.hpp>
|
||||||
#include <glm/gtx/epsilon.hpp>
|
#include <glm/gtc/epsilon.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
int test_linearRand()
|
int test_linearRand()
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
// Created : 2011-04-26
|
// Created : 2011-04-26
|
||||||
// Updated : 2011-04-26
|
// Updated : 2011-04-26
|
||||||
// Licence : This source is under MIT licence
|
// Licence : This source is under MIT licence
|
||||||
// File : test/gtx/ulp.cpp
|
// File : test/gtc/ulp.cpp
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtx/ulp.hpp>
|
#include <glm/gtc/ulp.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ glmCreateTestGTC(gtx_bit)
|
|||||||
glmCreateTestGTC(gtx_gradient_paint)
|
glmCreateTestGTC(gtx_gradient_paint)
|
||||||
glmCreateTestGTC(gtx_integer)
|
glmCreateTestGTC(gtx_integer)
|
||||||
glmCreateTestGTC(gtx_matrix_query)
|
glmCreateTestGTC(gtx_matrix_query)
|
||||||
glmCreateTestGTC(gtx_noise)
|
|
||||||
glmCreateTestGTC(gtx_quaternion)
|
glmCreateTestGTC(gtx_quaternion)
|
||||||
glmCreateTestGTC(gtx_rotate_vector)
|
glmCreateTestGTC(gtx_rotate_vector)
|
||||||
glmCreateTestGTC(gtx_simd_vec4)
|
glmCreateTestGTC(gtx_simd_vec4)
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtx/number_precision.hpp>
|
#include <glm/gtc/type_precision.hpp>
|
||||||
#include <glm/gtx/bit.hpp>
|
#include <glm/gtx/bit.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
@ -8,8 +8,8 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
|
#include <glm/gtc/epsilon.hpp>
|
||||||
#include <glm/gtx/integer.hpp>
|
#include <glm/gtx/integer.hpp>
|
||||||
#include <glm/gtx/epsilon.hpp>
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
int test_floor_log2()
|
int test_floor_log2()
|
||||||
|
@ -1,199 +0,0 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// OpenGL Mathematics Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// Created : 2011-04-21
|
|
||||||
// Updated : 2011-04-26
|
|
||||||
// Licence : This source is under MIT licence
|
|
||||||
// File : test/gtx/noise.cpp
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
|
||||||
#include <glm/gtx/noise.hpp>
|
|
||||||
#include <gli/gli.hpp>
|
|
||||||
#include <gli/gtx/loader.hpp>
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
int test_simplex()
|
|
||||||
{
|
|
||||||
std::size_t const Size = 256;
|
|
||||||
|
|
||||||
{
|
|
||||||
std::vector<glm::byte> ImageData(Size * Size * 3);
|
|
||||||
|
|
||||||
for(std::size_t y = 0; y < Size; ++y)
|
|
||||||
for(std::size_t x = 0; x < Size; ++x)
|
|
||||||
{
|
|
||||||
ImageData[(x + y * Size) * 3 + 0] = glm::byte(glm::simplex(glm::vec2(x / 64.f, y / 64.f)) * 128.f + 127.f);
|
|
||||||
ImageData[(x + y * Size) * 3 + 1] = ImageData[(x + y * Size) * 3 + 0];
|
|
||||||
ImageData[(x + y * Size) * 3 + 2] = ImageData[(x + y * Size) * 3 + 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
gli::texture2D Texture(1);
|
|
||||||
Texture[0] = gli::image2D(glm::uvec2(Size), gli::RGB8U);
|
|
||||||
memcpy(Texture[0].data(), &ImageData[0], ImageData.size());
|
|
||||||
gli::saveDDS9(Texture, "texture_simplex2d_256.dds");
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
std::vector<glm::byte> ImageData(Size * Size * 3);
|
|
||||||
|
|
||||||
for(std::size_t y = 0; y < Size; ++y)
|
|
||||||
for(std::size_t x = 0; x < Size; ++x)
|
|
||||||
{
|
|
||||||
ImageData[(x + y * Size) * 3 + 0] = glm::byte(glm::simplex(glm::vec3(x / 64.f, y / 64.f, 0.5f)) * 128.f + 127.f);
|
|
||||||
ImageData[(x + y * Size) * 3 + 1] = ImageData[(x + y * Size) * 3 + 0];
|
|
||||||
ImageData[(x + y * Size) * 3 + 2] = ImageData[(x + y * Size) * 3 + 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
gli::texture2D Texture(1);
|
|
||||||
Texture[0] = gli::image2D(glm::uvec2(Size), gli::RGB8U);
|
|
||||||
memcpy(Texture[0].data(), &ImageData[0], ImageData.size());
|
|
||||||
gli::saveDDS9(Texture, "texture_simplex3d_256.dds");
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
std::vector<glm::byte> ImageData(Size * Size * 3);
|
|
||||||
|
|
||||||
for(std::size_t y = 0; y < Size; ++y)
|
|
||||||
for(std::size_t x = 0; x < Size; ++x)
|
|
||||||
{
|
|
||||||
ImageData[(x + y * Size) * 3 + 0] = glm::byte(glm::simplex(glm::vec4(x / 64.f, y / 64.f, 0.5f, 0.5f)) * 128.f + 127.f);
|
|
||||||
ImageData[(x + y * Size) * 3 + 1] = ImageData[(x + y * Size) * 3 + 0];
|
|
||||||
ImageData[(x + y * Size) * 3 + 2] = ImageData[(x + y * Size) * 3 + 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
gli::texture2D Texture(1);
|
|
||||||
Texture[0] = gli::image2D(glm::uvec2(Size), gli::RGB8U);
|
|
||||||
memcpy(Texture[0].data(), &ImageData[0], ImageData.size());
|
|
||||||
gli::saveDDS9(Texture, "texture_simplex4d_256.dds");
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int test_perlin()
|
|
||||||
{
|
|
||||||
std::size_t const Size = 256;
|
|
||||||
|
|
||||||
{
|
|
||||||
std::vector<glm::byte> ImageData(Size * Size * 3);
|
|
||||||
|
|
||||||
for(std::size_t y = 0; y < Size; ++y)
|
|
||||||
for(std::size_t x = 0; x < Size; ++x)
|
|
||||||
{
|
|
||||||
ImageData[(x + y * Size) * 3 + 0] = glm::byte(glm::perlin(glm::vec2(x / 64.f, y / 64.f)) * 128.f + 127.f);
|
|
||||||
ImageData[(x + y * Size) * 3 + 1] = ImageData[(x + y * Size) * 3 + 0];
|
|
||||||
ImageData[(x + y * Size) * 3 + 2] = ImageData[(x + y * Size) * 3 + 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
gli::texture2D Texture(1);
|
|
||||||
Texture[0] = gli::image2D(glm::uvec2(Size), gli::RGB8U);
|
|
||||||
memcpy(Texture[0].data(), &ImageData[0], ImageData.size());
|
|
||||||
gli::saveDDS9(Texture, "texture_perlin2d_256.dds");
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
std::vector<glm::byte> ImageData(Size * Size * 3);
|
|
||||||
|
|
||||||
for(std::size_t y = 0; y < Size; ++y)
|
|
||||||
for(std::size_t x = 0; x < Size; ++x)
|
|
||||||
{
|
|
||||||
ImageData[(x + y * Size) * 3 + 0] = glm::byte(glm::perlin(glm::vec3(x / 64.f, y / 64.f, 0.5f)) * 128.f + 127.f);
|
|
||||||
ImageData[(x + y * Size) * 3 + 1] = ImageData[(x + y * Size) * 3 + 0];
|
|
||||||
ImageData[(x + y * Size) * 3 + 2] = ImageData[(x + y * Size) * 3 + 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
gli::texture2D Texture(1);
|
|
||||||
Texture[0] = gli::image2D(glm::uvec2(Size), gli::RGB8U);
|
|
||||||
memcpy(Texture[0].data(), &ImageData[0], ImageData.size());
|
|
||||||
gli::saveDDS9(Texture, "texture_perlin3d_256.dds");
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
std::vector<glm::byte> ImageData(Size * Size * 3);
|
|
||||||
|
|
||||||
for(std::size_t y = 0; y < Size; ++y)
|
|
||||||
for(std::size_t x = 0; x < Size; ++x)
|
|
||||||
{
|
|
||||||
ImageData[(x + y * Size) * 3 + 0] = glm::byte(glm::perlin(glm::vec4(x / 64.f, y / 64.f, 0.5f, 0.5f)) * 128.f + 127.f);
|
|
||||||
ImageData[(x + y * Size) * 3 + 1] = ImageData[(x + y * Size) * 3 + 0];
|
|
||||||
ImageData[(x + y * Size) * 3 + 2] = ImageData[(x + y * Size) * 3 + 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
gli::texture2D Texture(1);
|
|
||||||
Texture[0] = gli::image2D(glm::uvec2(Size), gli::RGB8U);
|
|
||||||
memcpy(Texture[0].data(), &ImageData[0], ImageData.size());
|
|
||||||
gli::saveDDS9(Texture, "texture_perlin4d_256.dds");
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int test_perlin_pedioric()
|
|
||||||
{
|
|
||||||
std::size_t const Size = 256;
|
|
||||||
|
|
||||||
{
|
|
||||||
std::vector<glm::byte> ImageData(Size * Size * 3);
|
|
||||||
|
|
||||||
for(std::size_t y = 0; y < Size; ++y)
|
|
||||||
for(std::size_t x = 0; x < Size; ++x)
|
|
||||||
{
|
|
||||||
ImageData[(x + y * Size) * 3 + 0] = glm::byte(glm::perlin(glm::vec2(x / 64.f, y / 64.f), glm::vec2(2.0f)) * 128.f + 127.f);
|
|
||||||
ImageData[(x + y * Size) * 3 + 1] = ImageData[(x + y * Size) * 3 + 0];
|
|
||||||
ImageData[(x + y * Size) * 3 + 2] = ImageData[(x + y * Size) * 3 + 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
gli::texture2D Texture(1);
|
|
||||||
Texture[0] = gli::image2D(glm::uvec2(Size), gli::RGB8U);
|
|
||||||
memcpy(Texture[0].data(), &ImageData[0], ImageData.size());
|
|
||||||
gli::saveDDS9(Texture, "texture_perlin_pedioric_2d_256.dds");
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
std::vector<glm::byte> ImageData(Size * Size * 3);
|
|
||||||
|
|
||||||
for(std::size_t y = 0; y < Size; ++y)
|
|
||||||
for(std::size_t x = 0; x < Size; ++x)
|
|
||||||
{
|
|
||||||
ImageData[(x + y * Size) * 3 + 0] = glm::byte(glm::perlin(glm::vec3(x / 64.f, y / 64.f, 0.5f), glm::vec3(2.0f)) * 128.f + 127.f);
|
|
||||||
ImageData[(x + y * Size) * 3 + 1] = ImageData[(x + y * Size) * 3 + 0];
|
|
||||||
ImageData[(x + y * Size) * 3 + 2] = ImageData[(x + y * Size) * 3 + 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
gli::texture2D Texture(1);
|
|
||||||
Texture[0] = gli::image2D(glm::uvec2(Size), gli::RGB8U);
|
|
||||||
memcpy(Texture[0].data(), &ImageData[0], ImageData.size());
|
|
||||||
gli::saveDDS9(Texture, "texture_perlin_pedioric_3d_256.dds");
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
std::vector<glm::byte> ImageData(Size * Size * 3);
|
|
||||||
|
|
||||||
for(std::size_t y = 0; y < Size; ++y)
|
|
||||||
for(std::size_t x = 0; x < Size; ++x)
|
|
||||||
{
|
|
||||||
ImageData[(x + y * Size) * 3 + 0] = glm::byte(glm::perlin(glm::vec4(x / 64.f, y / 64.f, 0.5f, 0.5f), glm::vec4(2.0f)) * 128.f + 127.f);
|
|
||||||
ImageData[(x + y * Size) * 3 + 1] = ImageData[(x + y * Size) * 3 + 0];
|
|
||||||
ImageData[(x + y * Size) * 3 + 2] = ImageData[(x + y * Size) * 3 + 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
gli::texture2D Texture(1);
|
|
||||||
Texture[0] = gli::image2D(glm::uvec2(Size), gli::RGB8U);
|
|
||||||
memcpy(Texture[0].data(), &ImageData[0], ImageData.size());
|
|
||||||
gli::saveDDS9(Texture, "texture_perlin_pedioric_4d_256.dds");
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main()
|
|
||||||
{
|
|
||||||
int Error = 0;
|
|
||||||
|
|
||||||
Error += test_simplex();
|
|
||||||
Error += test_perlin();
|
|
||||||
Error += test_perlin_pedioric();
|
|
||||||
|
|
||||||
return Error;
|
|
||||||
}
|
|
@ -8,26 +8,8 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
#include <glm/glm.hpp>
|
||||||
#include <glm/gtc/quaternion.hpp>
|
#include <glm/gtc/epsilon.hpp>
|
||||||
#include <glm/gtx/quaternion.hpp>
|
#include <glm/gtx/quaternion.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()
|
||||||
{
|
{
|
||||||
@ -63,91 +45,12 @@ int test_quat_shortMix()
|
|||||||
return Error;
|
return Error;
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_quat_angleAxis()
|
|
||||||
{
|
|
||||||
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_angle()
|
|
||||||
{
|
|
||||||
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.01f) ? 0 : 1;
|
|
||||||
float A = glm::angle(N);
|
|
||||||
Error += glm::equalEpsilon(A, 45.0f, 0.01f) ? 0 : 1;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
glm::quat Q = glm::angleAxis(45.0f, glm::normalize(glm::vec3(0, 1, 1)));
|
|
||||||
glm::quat N = glm::normalize(Q);
|
|
||||||
float L = glm::length(N);
|
|
||||||
Error += glm::equalEpsilon(L, 1.0f, 0.01f) ? 0 : 1;
|
|
||||||
float A = glm::angle(N);
|
|
||||||
Error += glm::equalEpsilon(A, 45.0f, 0.01f) ? 0 : 1;
|
|
||||||
}
|
|
||||||
{
|
|
||||||
glm::quat Q = glm::angleAxis(45.0f, glm::normalize(glm::vec3(1, 2, 3)));
|
|
||||||
glm::quat N = glm::normalize(Q);
|
|
||||||
float L = glm::length(N);
|
|
||||||
Error += glm::equalEpsilon(L, 1.0f, 0.01f) ? 0 : 1;
|
|
||||||
float A = glm::angle(N);
|
|
||||||
Error += glm::equalEpsilon(A, 45.0f, 0.01f) ? 0 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
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_fastMix();
|
||||||
Error += test_quat_angleAxis();
|
|
||||||
Error += test_quat_mix();
|
|
||||||
Error += test_quat_fastMix();
|
|
||||||
Error += test_quat_shortMix();
|
Error += test_quat_shortMix();
|
||||||
Error += test_quat_normalize();
|
|
||||||
|
|
||||||
return Error;
|
return Error;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user